Can't include SnpManipulateTextFrame.cpp snippet into my plugin
Simple goal:
To get all text from active TextFrame, iterate over it, add "-" (dash) at the end of each word, apply it back to the TextFrame
Current state: Can't even fetch a text from TextFrame
After hours of reading unintuitive SDK docs, I found out that there is a class SnpManipulateTextFrame, which has a method that gets text from TextFrame:
WideString GetWideStringFromTextFrame(IMultiColumnTextFrame* mcf)
So, I've copied `SnpManipulateTextFrame.cpp` file into my plugin directory, and created its header file for importing it into my `WFPDialogController.cpp`. Inside the header file, I copied only the class definition part with all #include lines from cpp file.
Inside my controller cpp, I did include the header file and tried to initialize the class and get the text from TextFrame:
#include "SnpManipulateTextFrame.h"
...
void WFPDialogController::ApplyDialogFields(IActiveContext* myContext, const WidgetID& widgetId) {
...
InterfacePtr<IMultiColumnTextFrame> mcTextFrame(myContext->GetContextSelection(), UseDefaultIID());
WideString textContent;
SnpManipulateTextFrame manTextFrame = SnpManipulateTextFrame();
textContent = manTextFrame.GetWideStringFromTextFrame(mcTextFrame);
}Include directories:

[Project > Properties > Configuration Properties > VC++ Directories > Include Directories]
(I wonder if there is any option to include whole SDK folder and let VS automatically detect all .h files, instead of manually including its subdirectories where .h file reside. Or maybe I'm doing something wrong)
Also, If you know a better and simpler solution towards achieving the goal, please suggest!
Here is the build error log:
Build started...
1>------ Build started: Project: WriteFishPrice, Configuration: Release x64 ------
1>WFPDialogController.cpp
1>SnpManipulateTextFrame.cpp
1>Performing Custom Build Tools
1>ODFRC deleting old resources...
1>merge_res.cmd - calling ConcatRes
1> 1 file(s) copied.
1>ConcatRes skipped since ".\objRx64\WriteFishPrice"\WFP.fres is an empty file.
1>merge_res.cmd done.
1>Deleting old resources...
1>14 File(s) copied
1> Creating library ..\..\..\build\win\objRx64\WriteFishPrice/WriteFishPrice.lib and object ..\..\..\build\win\objRx64\WriteFishPrice/WriteFishPrice.exp
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: __cdecl SDKLayoutHelper::SDKLayoutHelper(void)" (??0SDKLayoutHelper@@QEAA@XZ) referenced in function "public: class UIDRef __cdecl SnpManipulateTextFrame::CreateAndThreadTextFrame(class UIDRef const &)" (?CreateAndThreadTextFrame@SnpManipulateTextFrame@@QEAA?AVUIDRef@@AEBV2@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl SDKLayoutHelper::~SDKLayoutHelper(void)" (??1SDKLayoutHelper@@UEAA@XZ) referenced in function "public: class UIDRef __cdecl SnpManipulateTextFrame::CreateAndThreadTextFrame(class UIDRef const &)" (?CreateAndThreadTextFrame@SnpManipulateTextFrame@@QEAA?AVUIDRef@@AEBV2@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: class UIDRef __cdecl SDKLayoutHelper::CreateDocument(enum K2::UIFlags,class PMReal const &,class PMReal const &,long,long,long)" (?CreateDocument@SDKLayoutHelper@@QEAA?AVUIDRef@@W4UIFlags@K2@@AEBVPMReal@@1JJJ@Z) referenced in function "public: long __cdecl SnpManipulateTextFrame::CreateLinkedStory(class UIDRef const &)" (?CreateLinkedStory@SnpManipulateTextFrame@@QEAAJAEBVUIDRef@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: long __cdecl SDKLayoutHelper::OpenLayoutWindow(class UIDRef const &)" (?OpenLayoutWindow@SDKLayoutHelper@@QEAAJAEBVUIDRef@@@Z) referenced in function "public: long __cdecl SnpManipulateTextFrame::CreateLinkedStory(class UIDRef const &)" (?CreateLinkedStory@SnpManipulateTextFrame@@QEAAJAEBVUIDRef@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: class UIDRef __cdecl SDKLayoutHelper::GetActiveSpreadLayerRef(class UIDRef const &,short)" (?GetActiveSpreadLayerRef@SDKLayoutHelper@@QEAA?AVUIDRef@@AEBV2@F@Z) referenced in function "public: long __cdecl SnpManipulateTextFrame::CreateLinkedStory(class UIDRef const &)" (?CreateLinkedStory@SnpManipulateTextFrame@@QEAAJAEBVUIDRef@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: class UIDRef __cdecl SDKLayoutHelper::CreateTextFrame(class UIDRef const &,class PMRect const &,long,short,class UIDRef *,short)" (?CreateTextFrame@SDKLayoutHelper@@QEAA?AVUIDRef@@AEBV2@AEBVPMRect@@JFPEAV2@F@Z) referenced in function "public: class UIDRef __cdecl SnpManipulateTextFrame::CreateAndThreadTextFrame(class UIDRef const &)" (?CreateAndThreadTextFrame@SnpManipulateTextFrame@@QEAA?AVUIDRef@@AEBV2@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: class UIDRef __cdecl SDKLayoutHelper::GetTextModelRef(class InterfacePtr<class IGraphicFrameData> const &)" (?GetTextModelRef@SDKLayoutHelper@@QEAA?AVUIDRef@@AEBV?$InterfacePtr@VIGraphicFrameData@@@@@Z) referenced in function "public: long __cdecl SnpManipulateTextFrame::SelectFrameDisplayingTextIndex(class UIDRef const &,class ISelectionManager *)" (?SelectFrameDisplayingTextIndex@SnpManipulateTextFrame@@QEAAJAEBVUIDRef@@PEAVISelectionManager@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: __cdecl SnpRunnable::SnpRunnable(char const *)" (??0SnpRunnable@@QEAA@PEBD@Z) referenced in function "public: __cdecl _SnpRunnerManipulateTextFrame::_SnpRunnerManipulateTextFrame(void)" (??0_SnpRunnerManipulateTextFrame@@QEAA@XZ)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl SnpRunnable::~SnpRunnable(void)" (??1SnpRunnable@@UEAA@XZ) referenced in function "public: virtual __cdecl _SnpRunnerManipulateTextFrame::~_SnpRunnerManipulateTextFrame(void)" (??1_SnpRunnerManipulateTextFrame@@UEAA@XZ)
1>SnpManipulateTextFrame.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl SnpRunnable::RunUnitTest(class ISnpRunnableContext *)" (?RunUnitTest@SnpRunnable@@UEAAJPEAVISnpRunnableContext@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl SnpRunnable::SetupContext(class ISnpRunnableContext *)" (?SetupContext@SnpRunnable@@UEAAJPEAVISnpRunnableContext@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "void __cdecl SNIPLOG(char const *,...)" (?SNIPLOG@@YAXPEBDZZ) referenced in function "public: long __cdecl SnpManipulateTextFrame::CreateLinkedStory(class UIDRef const &)" (?CreateLinkedStory@SnpManipulateTextFrame@@QEAAJAEBVUIDRef@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: __cdecl SnpTextModelHelper::SnpTextModelHelper(void)" (??0SnpTextModelHelper@@QEAA@XZ) referenced in function "public: class WideString __cdecl SnpManipulateTextFrame::GetWideStringFromTextFrame(class IMultiColumnTextFrame *)" (?GetWideStringFromTextFrame@SnpManipulateTextFrame@@QEAA?AVWideString@@PEAVIMultiColumnTextFrame@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl SnpTextModelHelper::~SnpTextModelHelper(void)" (??1SnpTextModelHelper@@UEAA@XZ) referenced in function "public: class WideString __cdecl SnpManipulateTextFrame::GetWideStringFromTextFrame(class IMultiColumnTextFrame *)" (?GetWideStringFromTextFrame@SnpManipulateTextFrame@@QEAA?AVWideString@@PEAVIMultiColumnTextFrame@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: class IParcel * __cdecl SnpTextModelHelper::QueryParcelContaining(class ITextModel *,long)" (?QueryParcelContaining@SnpTextModelHelper@@QEAAPEAVIParcel@@PEAVITextModel@@J@Z) referenced in function "public: class ITextFrameColumn * __cdecl SnpManipulateTextFrame::QueryTextFrameContaining(class ITextModel *,long)" (?QueryTextFrameContaining@SnpManipulateTextFrame@@QEAAPEAVITextFrameColumn@@PEAVITextModel@@J@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: class WideString __cdecl SnpTextModelHelper::GetWideStringFromTextRange(class InDesign::TextRange const &)" (?GetWideStringFromTextRange@SnpTextModelHelper@@QEAA?AVWideString@@AEBVTextRange@InDesign@@@Z) referenced in function "public: class WideString __cdecl SnpManipulateTextFrame::GetWideStringFromTextFrame(class IMultiColumnTextFrame *)" (?GetWideStringFromTextFrame@SnpManipulateTextFrame@@QEAA?AVWideString@@PEAVIMultiColumnTextFrame@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: void __cdecl K2Internals::K2VectorBase<struct KeyValuePair<long,class PMString>,class K2Allocator<struct KeyValuePair<long,class PMString> > >::push_back(struct KeyValuePair<long,class PMString> const &)" (?push_back@?$K2VectorBase@U?$KeyValuePair@JVPMString@@@@V?$K2Allocator@U?$KeyValuePair@JVPMString@@@@@@@K2Internals@@QEAAXAEBU?$KeyValuePair@JVPMString@@@@@Z) referenced in function "private: class PMString __cdecl SnpManipulateTextFrame::ResolveClass(class IDType<struct ClassID_tag> const &)" (?ResolveClass@SnpManipulateTextFrame@@AEAA?AVPMString@@AEBV?$IDType@UClassID_tag@@@@@Z)
1>SnpManipulateTextFrame.obj : error LNK2019: unresolved external symbol "public: void __cdecl K2Internals::K2VectorBase<struct KeyValuePair<long,class PMString>,class K2Allocator<struct KeyValuePair<long,class PMString> > >::DoCleanup(void)" (?DoCleanup@?$K2VectorBase@U?$KeyValuePair@JVPMString@@@@V?$K2Allocator@U?$KeyValuePair@JVPMString@@@@@@@K2Internals@@QEAAXXZ) referenced in function "void __cdecl `private: class PMString __cdecl SnpManipulateTextFrame::ResolveClass(class IDType<struct ClassID_tag> const &)'::`2'::`dynamic atexit destructor for 'gClassNameDict''(void)" (??__FgClassNameDict@?1??ResolveClass@SnpManipulateTextFrame@@AEAA?AVPMString@@AEBV?$IDType@UClassID_tag@@@@@Z@YAXXZ)
1>.\releasex64\sdk\WriteFishPrice.sdk.pln : fatal error LNK1120: 18 unresolved externals
1>Done building project "WriteFishPrice.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 11:20 PM and took 06.815 seconds ==========
