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 #ifndef INC_NODETEXT
00100 #define INC_NODETEXT
00101
00102 #ifdef DO_EXPORT
00103 #define EXPORT_TEXT 1
00104 #else
00105 #define EXPORT_TEXT 0
00106 #endif
00107
00108
00109
00110 #include "nodetxts.h"
00111 #include "textfuns.h"
00112
00113 class AbstractTextChar;
00114 class TextChar;
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 class VisibleTextNode: public BaseTextClass
00127 {
00128 CC_DECLARE_DYNAMIC(VisibleTextNode)
00129
00130 public:
00131 VisibleTextNode();
00132 VisibleTextNode(Node* ContextNode, AttachNodeDirection Direction);
00133
00134 VisibleTextNode* FindNextVTNInStory();
00135 VisibleTextNode* FindPrevVTNInStory();
00136 AbstractTextChar* FindNextAbstractTextCharInStory();
00137 AbstractTextChar* FindPrevAbstractTextCharInStory();
00138 TextChar* FindNextTextCharInStory();
00139 TextChar* FindPrevTextCharInStory();
00140
00141 VisibleTextNode* FindNextVTNInLine();
00142 VisibleTextNode* FindPrevVTNInLine();
00143
00144 AbstractTextChar* FindNextAbstractTextCharInLine();
00145 AbstractTextChar* FindPrevAbstractTextCharInLine();
00146
00147 TextLine* FindParentLine();
00148
00149 virtual CopyType GetCopyType();
00150 virtual INT32 ComplexCopy(CopyStage Stage, Range& RangeToCopy, Node** pOutput);
00151 virtual INT32 ComplexHide(UndoableOperation* pOp, Node* pNextNode);
00152
00153 BOOL RenderChildAttrs(RenderRegion* pRenderRegion);
00154 virtual BOOL CanAttrBeAppliedToMe(CCRuntimeClass* AttrType);
00155
00156 virtual UINT32 GetNodeSize() const;
00157 virtual void GetDebugDetails(StringBase* Str);
00158
00159 virtual BOOL OnNodePopUp(Spread* pSpread, DocCoord PointerPos, ContextMenu* pMenu);
00160 void ScrollToShow();
00161
00162 BOOL GetStoryAndCharMatrix(Matrix* pMatrix);
00163 virtual BOOL ValidateBoundingRect(FormatRegion* pFormatRegion=NULL)
00164 { ERROR2(FALSE,"VisibleTextNode::ValidateBoundingRect() - should never be called!"); }
00165
00166 MILLIPOINT CalcCharDistAlongLine(BOOL IncludeThisChar);
00167 BOOL WrapRestOfLineForward(UndoableOperation* pUndoOp);
00168 BOOL WrapFromStartOfLineBack(UndoableOperation* pUndoOp);
00169 BOOL DoMoveNodes(UndoableOperation* pUndoOp, VisibleTextNode* pLastNode,
00170 Node* pDestNode, AttachNodeDirection Direction);
00171 BOOL DoMoveNode(UndoableOperation* pUndoOp, Node* pDestNode, AttachNodeDirection Direction);
00172
00173 inline virtual BOOL IsAVisibleTextNode() const { return TRUE; }
00174 inline virtual BOOL IsACaret() const { return FALSE; }
00175 inline virtual BOOL IsAnEOLNode() const { return FALSE; }
00176 inline virtual BOOL IsASpace() { return FALSE; }
00177 inline virtual BOOL IsAVisibleSpace() { return FALSE; }
00178 inline virtual BOOL IsAHyphen() { return FALSE; }
00179 inline virtual BOOL IsADecimalPoint() { return FALSE; }
00180
00181 virtual MILLIPOINT GetCharAdvance() { return 0; }
00182 virtual MILLIPOINT GetCharWidth() { return 0; }
00183 virtual MILLIPOINT GetBaseLineShift() { return 0; }
00184 virtual MILLIPOINT GetAutoKernSize(FormatRegion*) { return 0; }
00185
00186
00187 MILLIPOINT GetPosInLine() { return PosInLine; }
00188 void SetPosInLine(MILLIPOINT x) { PosInLine=x; }
00189
00190 void SetMatrix( const Matrix &matrix ) { CharMatrix = matrix; }
00191 Matrix GetMatrix() { return CharMatrix; }
00192 Matrix* GetpMatrix() { return &CharMatrix; }
00193
00194 protected:
00195 void Init();
00196 void CopyNodeContents(VisibleTextNode* NodeCopy);
00197 virtual Node* SimpleCopy();
00198
00199 private:
00200 Matrix CharMatrix;
00201 MILLIPOINT PosInLine;
00202 };
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 class AbstractTextChar: public VisibleTextNode
00215 {
00216 CC_DECLARE_DYNAMIC(AbstractTextChar)
00217
00218 public:
00219 AbstractTextChar();
00220 AbstractTextChar(Node* ContextNode, AttachNodeDirection Direction);
00221
00222 virtual String Describe(BOOL Plural, BOOL Verbose);
00223 virtual UINT32 GetNodeSize() const;
00224 virtual void GetDebugDetails(StringBase* Str);
00225
00226 virtual DocRect GetBoundingRect(BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE);
00227 virtual DocRect GetBlobBoundingRect();
00228 virtual DocRect GetImagemapClickableRectangle();
00229
00230 void RenderObjectBlobs(RenderRegion* pRenderRegion);
00231 void RenderTinyBlobs(RenderRegion* pRenderRegion);
00232
00233 virtual BOOL ReCacheMetrics(FormatRegion* pFormatRegion);
00234 Path* CreateMetricsRectPath();
00235 BOOL GetMetricsRect(DocRect* pRect);
00236 BOOL GetMetricsRectInStory(DocRect* pRect);
00237 BOOL GetMetricsRectBounds(DocRect* pRect);
00238
00239 BOOL IsAnAbstractTextChar() const { return TRUE; }
00240 virtual WCHAR GetUnicodeValue() { return FONTEMCHAR; }
00241 MILLIPOINT GetVisibleAdvance();
00242
00243 virtual MILLIPOINT GetCharWidth() { return mCharWidth; }
00244 virtual MILLIPOINT GetCharAdvance() { return mCharAdvance; }
00245 virtual MILLIPOINT GetBaseLineShift() { return mBaseLineShift; }
00246
00247 MILLIPOINT GetFontAscent() { return mFontAscent; }
00248 MILLIPOINT GetFontDescent() { return mFontDescent; }
00249 MILLIPOINT GetFontSize() { return mFontSize; }
00250
00251 void SetCharAdvance( MILLIPOINT Advance) { mCharAdvance = Advance; }
00252 void SetCharWidth( MILLIPOINT Width) { mCharWidth = Width; }
00253 void SetFontAscent( MILLIPOINT Ascent) { mFontAscent = Ascent; }
00254 void SetFontDescent( MILLIPOINT Descent) { mFontDescent = Descent; }
00255 void SetFontSize( MILLIPOINT Size) { mFontSize = Size; }
00256 void SetBaseLineShift(MILLIPOINT Size) { mBaseLineShift = Size; }
00257
00258 void SetAttrdCharBounds(DocRect& rect) { mAttrdCharBounds = rect; }
00259 DocRect GetAttrdCharBounds() { return mAttrdCharBounds; }
00260
00261 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00262
00263 protected:
00264 void Init();
00265 void CopyNodeContents(AbstractTextChar* NodeCopy);
00266 virtual Node* SimpleCopy();
00267
00268 DocRect GetImagemapRectForAdjacentChars(BOOL fForwards);
00269
00270 private:
00271 MILLIPOINT mCharWidth;
00272 MILLIPOINT mCharAdvance;
00273 MILLIPOINT mBaseLineShift;
00274 MILLIPOINT mFontAscent;
00275 MILLIPOINT mFontDescent;
00276 MILLIPOINT mFontSize;
00277 DocRect mAttrdCharBounds;
00278 };
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289 class TextChar: public AbstractTextChar
00290 {
00291 CC_DECLARE_DYNAMIC(TextChar)
00292
00293 public:
00294 TextChar();
00295 TextChar(Node* ContextNode, AttachNodeDirection Direction, WCHAR ChCode);
00296
00297 virtual BOOL SupportsClipboardFormat(InternalClipboardFormat *Format) const;
00298 virtual BOOL Snap(DocCoord* pDocCoord);
00299
00300 virtual UINT32 GetNodeSize() const;
00301 virtual void GetDebugDetails(StringBase* Str);
00302
00303 virtual void Render(RenderRegion* pRenderRegion);
00304 BOOL RenderCore(RenderRegion* pRenderRegion);
00305 void RenderEorDrag(RenderRegion* pRenderRegion);
00306 BOOL CreateNodePath(NodePath** ppNodePath, FormatRegion* pFormatRegion);
00307
00308 virtual BOOL IsATextChar() const { return TRUE; }
00309 virtual BOOL IsSetCandidate() const { return TRUE; }
00310
00311 virtual BOOL IsASpace() { return Ch==' '; }
00312 virtual BOOL IsAVisibleSpace() { return iswspace(Ch); }
00313 virtual BOOL IsAHyphen() { return Ch=='-'; }
00314
00315 virtual WCHAR GetUnicodeValue() { return Ch; }
00316 virtual void SetUnicodeValue(WCHAR Char) { Ch = Char; }
00317
00318 virtual MILLIPOINT GetAutoKernSize(FormatRegion* pFormatRegion);
00319
00320 virtual BOOL ExportRender(RenderRegion* pRegion);
00321
00322 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00323
00324 protected:
00325 virtual Node* SimpleCopy();
00326 void CopyNodeContents(TextChar* NodeCopy);
00327
00328 public:
00329 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter *pFilter);
00330 virtual BOOL WritePreChildrenNative(BaseCamelotFilter *pFIlter);
00331 virtual BOOL WritePostChildrenWeb(BaseCamelotFilter* pFilter);
00332 virtual BOOL WritePostChildrenNative(BaseCamelotFilter* pFilter);
00333 virtual BOOL CanWriteChildrenWeb(BaseCamelotFilter* pFilter);
00334 virtual BOOL CanWriteChildrenNative(BaseCamelotFilter* pFilter);
00335
00336 private:
00337 WCHAR Ch;
00338 };
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 class KernCode: public AbstractTextChar
00350 {
00351 CC_DECLARE_DYNAMIC(KernCode)
00352
00353 public:
00354 KernCode();
00355 KernCode(DocCoord& Value);
00356 KernCode(Node* ContextNode, AttachNodeDirection Direction, DocCoord& Value);
00357
00358 virtual BOOL ExportRender(RenderRegion* pRegion);
00359 virtual UINT32 GetNodeSize() const;
00360 virtual void GetDebugDetails(StringBase* Str);
00361
00362 void SetValue(DocCoord& KernValue) { Value = KernValue; }
00363 DocCoord GetValue() { return Value; }
00364
00365 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00366
00367 protected:
00368 virtual Node* SimpleCopy();
00369 void CopyNodeContents(KernCode* NodeCopy);
00370
00371 public:
00372 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter *pFilter);
00373 virtual BOOL WritePreChildrenNative(BaseCamelotFilter *pFIlter);
00374
00375 private:
00376 DocCoord Value;
00377 };
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387 class HorizontalTab: public AbstractTextChar
00388 {
00389 CC_DECLARE_DYNAMIC(HorizontalTab)
00390
00391 public:
00392 HorizontalTab() {}
00393 HorizontalTab(Node* ContextNode, AttachNodeDirection Direction);
00394
00395 virtual BOOL ExportRender(RenderRegion* pRegion);
00396 virtual UINT32 GetNodeSize() const;
00397 void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00398 protected:
00399 virtual Node* SimpleCopy();
00400 public:
00401 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter *pFilter);
00402 virtual BOOL WritePreChildrenNative(BaseCamelotFilter *pFIlter);
00403 };
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423 class CaretNode: public VisibleTextNode
00424 {
00425 CC_DECLARE_DYNAMIC(CaretNode)
00426
00427 public:
00428 CaretNode();
00429 CaretNode(Node* ContextNode, AttachNodeDirection Direction);
00430
00431 virtual void SetSelected(BOOL Status);
00432 virtual BOOL DiscardsAttributeChildren() const;
00433 BOOL DoApplyAttrsTo(UndoableOperation* pUndoOp, VisibleTextNode* pDstVTN, BOOL bDeleteDups = TRUE);
00434
00435 Path* CreatePath(Matrix* pMatrix);
00436 void RenderObjectBlobs(RenderRegion* pRender);
00437 BOOL RenderObjectBlobsCore(RenderRegion* pRender);
00438
00439 virtual BOOL ValidateBoundingRect(FormatRegion* pFormatRegion=NULL);
00440 virtual DocRect GetBoundingRect(BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE);
00441 virtual DocRect GetBlobBoundingRect();
00442
00443 virtual BOOL ExportRender(RenderRegion* pRegion);
00444
00445 virtual UINT32 GetNodeSize() const;
00446 virtual void GetDebugDetails(StringBase* Str);
00447 virtual String Describe(BOOL Plural, BOOL Verbose);
00448
00449 inline virtual BOOL IsACaret() const {return TRUE;};
00450 BOOL HasMoved();
00451
00452 protected:
00453 virtual Node* SimpleCopy();
00454
00455 public:
00456 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter *pFilter);
00457 virtual BOOL WritePreChildrenNative(BaseCamelotFilter *pFIlter);
00458 virtual BOOL CanWriteChildrenWeb(BaseCamelotFilter* pFilter);
00459 virtual BOOL CanWriteChildrenNative(BaseCamelotFilter* pFilter);
00460
00461 private:
00462 DocRect BlobBounds;
00463 };
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474 class EOLNode: public AbstractTextChar
00475 {
00476 CC_DECLARE_DYNAMIC(EOLNode)
00477
00478 public:
00479 EOLNode();
00480 EOLNode(Node* ContextNode, AttachNodeDirection Direction);
00481
00482 virtual DocRect GetBlobBoundingRect();
00483 virtual void RenderObjectBlobs(RenderRegion* pRender);
00484 virtual void RenderTinyBlobs(RenderRegion* pRender);
00485 BOOL GetBlobPath(Path*);
00486
00487 virtual BOOL ExportRender(RenderRegion* pRegion);
00488 virtual UINT32 GetNodeSize() const;
00489 virtual void GetDebugDetails(StringBase* Str);
00490 virtual String Describe(BOOL Plural, BOOL Verbose);
00491
00492 virtual BOOL ValidateBoundingRect(FormatRegion* pFormatRegion=NULL);
00493 virtual DocRect GetBoundingRect(BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE);
00494
00495 inline virtual BOOL IsAnEOLNode() const {return TRUE;};
00496
00497 BOOL IsVirtual() const { return Virtual; }
00498 void SetVirtual(BOOL Status) { Virtual = Status; }
00499
00500 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00501
00502 protected:
00503 virtual Node* SimpleCopy();
00504 void CopyNodeContents(EOLNode* NodeCopy);
00505
00506 public:
00507 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter *pFilter);
00508 virtual BOOL WritePreChildrenNative(BaseCamelotFilter *pFIlter);
00509 virtual BOOL CanWriteChildrenWeb(BaseCamelotFilter* pFilter);
00510 virtual BOOL CanWriteChildrenNative(BaseCamelotFilter* pFilter);
00511
00512 private:
00513 BYTE Virtual : 1;
00514 };
00515
00516 #endif