1
0

Exports.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #include "StdAfx.h"
  2. #include ".\exports.h"
  3. #include "PasteAnyAsText.h"
  4. #include ".\pasteimageashtmlimage.h"
  5. #include "ReadOnlyFlag.h"
  6. #include "RemoveLineFeeds.h"
  7. bool DittoAddin(const CDittoInfo &DittoInfo, CDittoAddinInfo &info)
  8. {
  9. if(DittoInfo.ValidateSize() == false || info.ValidateSize() == false)
  10. {
  11. CString csError;
  12. csError.Format(_T("PasteAnyAsText Addin - Passed in structures are of different size, DittoInfo Passed: %d, Local: %d, DittoAddinInfo Passed: %d, Local: %d"), DittoInfo.m_nSizeOfThis, sizeof(CDittoInfo), info.m_nSizeOfThis, sizeof(CDittoAddinInfo));
  13. OutputDebugString(csError);
  14. return false;
  15. }
  16. info.m_Name = _T("Ditto Utils");
  17. info.m_AddinVersion = 1;
  18. return true;
  19. }
  20. bool SupportedFunctions(const CDittoInfo &DittoInfo, FunctionType type, std::vector<CFunction> &Functions)
  21. {
  22. switch(type)
  23. {
  24. case eFuncType_PRE_PASTE:
  25. {
  26. CFunction func;
  27. func.m_csFunction = _T("PasteAnyAsText");
  28. func.m_csDisplayName = _T("Paste Any Clip As Text");
  29. func.m_csDetailDescription = _T("Displays a list of clip formats allowing you to select one and paste the contents as text");
  30. Functions.push_back(func);
  31. CFunction func2;
  32. func2.m_csFunction = _T("ConvertPathToHtmlImageTag");
  33. func2.m_csDisplayName = _T("Paste As html image link");
  34. func2.m_csDetailDescription = _T("Converts a CF_DIB or CF_HDROP to a html format for pasting into outlook express");
  35. Functions.push_back(func2);
  36. CFunction func3;
  37. func3.m_csFunction = _T("ClearReadOnlyFlag");
  38. func3.m_csDisplayName = _T("Clear read only flag");
  39. func3.m_csDetailDescription = _T("Clears read only flag on the types CF_HDROP, or files paths in text");
  40. Functions.push_back(func3);
  41. CFunction func4;
  42. func4.m_csFunction = _T("SetReadOnlyFlag");
  43. func4.m_csDisplayName = _T("Set read only flag");
  44. func4.m_csDetailDescription = _T("Sets the read only flag on the types CF_HDROP, or files paths in text");
  45. Functions.push_back(func4);
  46. /*CFunction func5;
  47. func5.m_csFunction = _T("RemoveLineFeeds");
  48. func5.m_csDisplayName = _T("Paste Removing Line Feeds");
  49. func5.m_csDetailDescription = _T("Removes all line feeds from text and rich text entries");
  50. Functions.push_back(func5);*/
  51. }
  52. break;
  53. }
  54. return true;
  55. }
  56. bool PasteAnyAsText(const CDittoInfo &DittoInfo, IClip *pClip)
  57. {
  58. return PasteAnyAsText::SelectClipToPasteAsText(DittoInfo, pClip);
  59. }
  60. bool ConvertPathToHtmlImageTag(const CDittoInfo &DittoInfo, IClip *pClip)
  61. {
  62. CPasteImageAsHtmlImage convert;
  63. return convert.ConvertPathToHtmlImageTag(DittoInfo, pClip);
  64. }
  65. bool ClearReadOnlyFlag(const CDittoInfo &DittoInfo, IClip *pClip)
  66. {
  67. CReadOnlyFlag readOnly;
  68. readOnly.ResetReadOnlyFlag(DittoInfo, pClip, true);
  69. //return false so the clip is not pasted
  70. return false;
  71. }
  72. bool SetReadOnlyFlag(const CDittoInfo &DittoInfo, IClip *pClip)
  73. {
  74. CReadOnlyFlag readOnly;
  75. readOnly.ResetReadOnlyFlag(DittoInfo, pClip, false);
  76. //return false so the clip is not pasted
  77. return false;
  78. }
  79. bool RemoveLineFeeds(const CDittoInfo &DittoInfo, IClip *pClip)
  80. {
  81. CRemoveLineFeeds remove;
  82. bool didSomething = remove.RemoveLineFeeds(DittoInfo, pClip);
  83. //return false so the clip is not pasted
  84. return didSomething;
  85. }