The filename of the header file: "sntxmod.h". There are 6 functions declared. A new button can be added after these 6 functions are implemented:
// Caption const char * GetCaption();
// Tooltip ( Optional ) const char * GetTooltip();
// Button Face ( Optinal ) HBITMAP GetBtnFace();
// Parse void Parse(wchar_t * text, int len);
// Nextpos bool GetNextPos(int
& pos,
int & len);
// Color bool GetColor(int & color);
// Bgcolor ( Optional ) bool GetBgColor(int
& bgcolor); |
Explanation:
GetCaption() will be called at first time Word is opened after addin's installation. The return string will be used as caption text on the new button.
GetTooltip() will be called at first time Word is opened after addin's installation. The return string will be used as tool tip text on the new button. This text will be shown as tool tip when mouse hovers on the button.
GetBtnFace() will be called at first time Word is opened after addin's installation. It should return a handle of 16x16 bitmap. The HBITMAP returned is used to be the face of the button. In the bitmap, fuchsia color ( 0xFF00FF ) will
stands for transparent color.
Parse() will be called each time when the corresponding button is clicked. The 'text' passed in is the selected text, the 'len' passed in is the length of the selected text. Also, 'text' ends with '\0' too.
After Parse() is called, GetNextPos() will called many times until it returns false. If GetNextPos() returns true, it means that some part of text should be highlighted. At the same time, it should tell Word the pos and length of the part of text
through referenced arguments 'pos' and 'len'. Please pay attention to that: the 'pos' relative to the beginning of the text which is passed to Parser(), not relative to the whole article in the Word. After all highlight operations completed, GetNextPos() must
return false.
GetColor() will be called each time after GetNextPos() returns true. It should tell Word whether the color of the part of text should be changed or not, through return vale. If true, the color should be passed to Word through ref argument
'color'.
GetBgColor() will be called each time after GetNextPos() returns true. It should tell Word whether the background color of the text should be changed or not, through return value. If true, the color should be passed to Word through ref
argument 'bgcolor'.