00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #ifndef INC_TEXTTOOL
00101 #define INC_TEXTTOOL
00102
00103
00104 #include "transop.h"
00105
00106 class Cursor;
00107 class TextStory;
00108 class CaretNode;
00109 class KeyPress;
00110
00111 #if !defined(EXCLUDE_FROM_RALPH)
00112 class TextInfoBarOp;
00113 #endif
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123 class TextToolBlobPosItem : public ListItem
00124 {
00125 public:
00126 CC_DECLARE_DYNAMIC(TextToolBlobPosItem);
00127 TextToolBlobPosItem(DocCoord Left, DocCoord Right, BOOL Connected, TextStory* pStory);
00128 ~TextToolBlobPosItem();
00129
00130 public:
00131
00132 DocCoord GetLeftBlobPos() const {return m_LeftBlobPos;}
00133 DocCoord GetRightBlobPos() const {return m_RightBlobPos;}
00134 BOOL IsConnected() const {return m_BlobsConnected;}
00135 TextStory* GetBlobStory() const {return m_pTextStory;}
00136
00137 protected:
00138 DocCoord m_LeftBlobPos;
00139 DocCoord m_RightBlobPos;
00140 BOOL m_BlobsConnected;
00141 TextStory* m_pTextStory;
00142 };
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 class TextToolBlobPosList : public List
00155 {
00156 public:
00157 CC_DECLARE_DYNAMIC(TextToolBlobPosList);
00158 TextToolBlobPosList();
00159 ~TextToolBlobPosList();
00160
00161 BOOL BuildFromSelection();
00162 BOOL RenderAllBlobs(Spread* pSpread = NULL, DocRect* pClipRect = NULL);
00163 static void RenderBlobPair(Spread* pSpread, DocRect* pClipRect, TextToolBlobPosItem* pPair);
00164 static void RenderBlob(Spread* pSpread, DocRect* pClipRect, DocCoord BlobPos);
00165 BOOL FindBlobStory(Spread* pSpread, DocCoord PointerPos, BOOL* pLeft, TextStory** pStory);
00166 BOOL RenderAndRemove(TextStory* pStory);
00167 void RenderAndRemoveAll();
00168
00169 Spread* GetBlobSpread() const {return m_pSelSpread;}
00170
00171 protected:
00172 Spread* m_pSelSpread;
00173 };
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189 class CCAPI TextTool : public Tool_v1
00190 {
00191 CC_DECLARE_MEMDUMP(TextTool);
00192
00193 public:
00194 TextTool();
00195 ~TextTool();
00196
00197
00198 BOOL Init();
00199 void Describe(void* InfoPtr);
00200 UINT32 GetID() { return TOOLID_TEXT; };
00201
00202
00203
00204 static BOOL DelayingUpdate();
00205
00206
00207 void SelectChange(BOOL isSelected);
00208 void OnClick( DocCoord, ClickType, ClickModifiers, Spread* );
00209 void OnMouseMove(DocCoord PointerPos,Spread* pSpread, ClickModifiers ClickMods);
00210 void RenderToolBlobs(Spread *, DocRect*);
00211
00212
00213 void GetRulerOrigin(Spread*,UserCoord*);
00214 void RenderRulerBlobs(RulerBase* pRuler, UserRect& UpdateRect, BOOL IsBackground);
00215 BOOL OnRulerClick( UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
00216 Spread* pSpread, RulerBase* pRuler);
00217 BOOL GetRulerStatusLineText(String_256* pText, UserCoord PointerPos, Spread* pSpread, RulerBase* pRuler);
00218
00219
00220 BOOL OnKeyPress(KeyPress* pKeyPress);
00221 BOOL GetStatusLineText(String_256* ptext, Spread* pSpread, DocCoord DocPos, ClickModifiers ClickMods);
00222 BOOL OnIdle();
00223
00224
00225 #if !defined(EXCLUDE_FROM_RALPH)
00226 static TextInfoBarOp* GetTextInfoBarOp() { return pTextInfoBarOp; }
00227 #endif
00228 static BOOL IsCurrentTool() { return CurrentTool; }
00229
00230 void LocaleChanged();
00231 BOOL SelectionHasChanged();
00232
00233 virtual BOOL AreToolBlobsRenderedOnSelection() {return TRUE;}
00234
00235 protected:
00236
00237 void DisplayStatusBarHelp(DocCoord DocPos, Spread* pSpread, ClickModifiers ClickMods);
00238 void GetCurrentStatusText(String_256* ptext, Spread* pSpread, DocCoord DocPos, ClickModifiers ClickMods);
00239
00240
00241 BOOL IsPointNearUnselectedTextStory(Spread*, DocCoord, TextStory**, Node**, BOOL);
00242 BOOL IsPointNearNonStoryPath(Spread*, DocCoord, NodePath**, BOOL);
00243 BOOL HandleSingleClick(Spread*, DocCoord, ClickModifiers);
00244 BOOL HandleDoubleClick(Spread*, DocCoord, ClickModifiers);
00245 BOOL HandleTripleClick(Spread*, DocCoord, ClickModifiers);
00246 BOOL HandleQuadClick(Spread*, DocCoord, ClickModifiers);
00247 BOOL HandleDragClick(Spread*, DocCoord, ClickModifiers);
00248
00249
00250 BOOL RegisterDeadKeys();
00251 BOOL RemoveDeadKeys();
00252 BOOL RegisterAdditionalVirtKey(KeyPress** pKey, TCHAR ch);
00253 BOOL HandleSpecialNonStoryKeys(KeyPress* pKeyPress);
00254 BOOL HandleSpecialStoryAndNonStoryKeys(KeyPress* pKeyPress);
00255 BOOL HandleDeadKeys(KeyPress* pKeyPress, WCHAR* pNewUnicode);
00256 BOOL TestForDeadKey(KeyPress* pKeyPress, KeyPress* pDeadKeypress);
00257 BOOL HandleSpecialStoryKeys(KeyPress* pKeyPress, TextStory* pStory, CaretNode* pCaret);
00258 BOOL IsUsableUnicode(WCHAR CodeValue);
00259 BOOL ApplyBold();
00260 BOOL ApplyItalic();
00261 BOOL IncreaseTrackKern();
00262 BOOL DecreaseTrackKern();
00263 BOOL CommonApplyKern(MILLIPOINT ChangeAmmount);
00264 BOOL CommonApplyTracking(MILLIPOINT ChangeAmmount);
00265
00266 BOOL OnToolSelect();
00267 BOOL OnToolDeselect();
00268
00269 BOOL CreateCursors();
00270 void DestroyCursors();
00271
00272 static BOOL CurrentTool;
00273 #if !defined(EXCLUDE_FROM_RALPH)
00274 static TextInfoBarOp* pTextInfoBarOp;
00275 #endif
00276
00277 Cursor* pcNormalTextCursor;
00278 Cursor* pcBlobTextCursor;
00279 Cursor* pcBlankCursor;
00280 Cursor* pcIndentCursor;
00281 Cursor* pcCurrentCursor;
00282
00283 INT32 CurrentCursorID;
00284 BOOL IsBlankCursorUp;
00285
00286
00287 static TCHAR* FamilyName;
00288 static TCHAR* ToolName;
00289 static TCHAR* Purpose;
00290 static TCHAR* Author;
00291
00292 BOOL UpdateAfterTyping;
00293
00294 TextStory* pLastFocusStory;
00295
00296
00297 static BOOL UseDeadKeys;
00298
00299
00300 KeyPress* PreviousDeadKey;
00301 KeyPress* GraveVirtKey;
00302 KeyPress* AcuteVirtKey;
00303 KeyPress* HatVirtKey;
00304 KeyPress* TildeVirtKey;
00305 KeyPress* ColonVirtKey;
00306 KeyPress* AtVirtKey;
00307 KeyPress* CommaVirtKey;
00308 KeyPress* SlashVirtKey;
00309
00310
00311 TextToolBlobPosList m_BlobPosList;
00312 };
00313
00314
00315 #endif // INC_TEXTTOOL