#include <nodetext.h>
Inheritance diagram for VisibleTextNode:
Public Member Functions | |
VisibleTextNode () | |
Simple VisibleTextNode constructor, it is required so that SimpleCopy will work. | |
VisibleTextNode (Node *ContextNode, AttachNodeDirection Direction) | |
The main VisibleTextNode constructor. | |
VisibleTextNode * | FindNextVTNInStory () |
Finds the next VisibleTextNode in the TextStory. The routine searches across TextLines. | |
VisibleTextNode * | FindPrevVTNInStory () |
Finds the previous VisibleTextNode in the TextStory. The routine searches across TextLines. | |
AbstractTextChar * | FindNextAbstractTextCharInStory () |
AbstractTextChar * | FindPrevAbstractTextCharInStory () |
TextChar * | FindNextTextCharInStory () |
TextChar * | FindPrevTextCharInStory () |
VisibleTextNode * | FindNextVTNInLine () |
VisibleTextNode * | FindPrevVTNInLine () |
AbstractTextChar * | FindNextAbstractTextCharInLine () |
AbstractTextChar * | FindPrevAbstractTextCharInLine () |
TextLine * | FindParentLine () |
virtual CopyType | GetCopyType () |
This function returns a type describing how this object is to be copied. The fuction is called from the low level copy operation CopyObjects. There are two options at present, these being SIMPLECOPY and COMPLEXCOPY. SIMPLECOPY indicates that the node can be copied by a call to its virtual function SimpleCopy(). COMPLEXCOPY however indicates that the node needs to do its own thing when copying and must be called via the ComplexCopy() virtual function. This virtual will likely return a tree of copied objects rather than just a copy of itself. | |
virtual INT32 | ComplexCopy (CopyStage Stage, Range &RangeToCopy, Node **pOutput) |
Create a complex copy of this node. This node has overridden GetCopyType() to return COMPLEXCOPY which means, when copying to the clipboard it must make a copy of itself and whatever else it needs. The resulting tree will be attached as the last child of the clipboard root. The routine will be called twice during a copy. Once when Stage==COPYOBJECT and once when Stage==COPYFINISHED. It is only necessary to return a copy during COPYOBJECT. COPYFINISHED can be used to tidy up and flags the node may set during COPYOBJECT. | |
virtual INT32 | ComplexHide (UndoableOperation *pOp, Node *pNextNode) |
Override the node level virtual function ComplexHide. This gives us a chance to get in and hide the various selected members of a text story sensibly. We hide all necessary nodes when the last member of the text story is called to complex hide itself, otherwise we may corrupt the range being scanned. | |
BOOL | RenderChildAttrs (RenderRegion *pRenderRegion) |
Render any first level children attributes into the region. | |
virtual BOOL | CanAttrBeAppliedToMe (CCRuntimeClass *AttrType) |
This fn is not to be confused with RequiresAttrib, it determines if an attribute of type AttrType can be directly applied to this object. The object is assumed to Require the attribute. | |
virtual UINT32 | GetNodeSize () const |
For finding the size of the VisibleTextNode. | |
virtual void | GetDebugDetails (StringBase *Str) |
For obtaining debug information about the Node. This fn can be deleted before we ship. | |
virtual BOOL | OnNodePopUp (Spread *pSpread, DocCoord PointerPos, ContextMenu *pMenu) |
Allows the VisibleTextNode to respond to pop up menu clicks on itself. | |
void | ScrollToShow () |
If this VTN is not fully on the screen then the screen is scrolled so the VTN is more visible. | |
BOOL | GetStoryAndCharMatrix (Matrix *pMatrix) |
set the given matrix to be the concatenation of the TextStory and VTN matrices | |
virtual BOOL | ValidateBoundingRect (FormatRegion *pFormatRegion=NULL) |
MILLIPOINT | CalcCharDistAlongLine (BOOL IncludeThisChar) |
Finds the distance along the text line of this character. You can optionally include the width of this character in the sum. | |
BOOL | WrapRestOfLineForward (UndoableOperation *pUndoOp) |
Wrap all nodes from this VTN (inc) to last VTN forward to start of next line If the line containing this VTN is hard (ends in an EOL) create a new line to wrap the text onto. | |
BOOL | WrapFromStartOfLineBack (UndoableOperation *pUndoOp) |
Wrap all chars upto this VTN (inc) back to the end of the previous line If this line is then empty, hide it. | |
BOOL | DoMoveNodes (UndoableOperation *pUndoOp, VisibleTextNode *pLastNode, Node *pDestNode, AttachNodeDirection Direction) |
Move ALL nodes from this VTN to LastVTN to pDestNode in the specified direction Assumes: First and last VTNs are on the same line Note: only VTN in range are moved so hidden nodes don't cause undo bloat! | |
BOOL | DoMoveNode (UndoableOperation *pUndoOp, Node *pDestNode, AttachNodeDirection Direction) |
Move this VTN to the specified location, flagging it 'Affected' in the old and new position. | |
virtual BOOL | IsAVisibleTextNode () const |
virtual BOOL | IsACaret () const |
virtual BOOL | IsAnEOLNode () const |
virtual BOOL | IsASpace () |
virtual BOOL | IsAVisibleSpace () |
virtual BOOL | IsAHyphen () |
virtual BOOL | IsADecimalPoint () |
virtual MILLIPOINT | GetCharAdvance () |
virtual MILLIPOINT | GetCharWidth () |
virtual MILLIPOINT | GetBaseLineShift () |
virtual MILLIPOINT | GetAutoKernSize (FormatRegion *) |
MILLIPOINT | GetPosInLine () |
void | SetPosInLine (MILLIPOINT x) |
void | SetMatrix (const Matrix &matrix) |
Matrix | GetMatrix () |
Matrix * | GetpMatrix () |
Protected Member Functions | |
void | Init () |
Initialise the members of a VisibleTextNode. Called by all constructors. | |
void | CopyNodeContents (VisibleTextNode *NodeCopy) |
This method copies the node's contents to the node pointed to by NodeCopy. | |
virtual Node * | SimpleCopy () |
It is illegal to copy a VisibleTextNode (it's abstract), therefore this function will generate an error if called. | |
Private Attributes | |
Matrix | CharMatrix |
MILLIPOINT | PosInLine |
Definition at line 126 of file nodetext.h.
|
Simple VisibleTextNode constructor, it is required so that SimpleCopy will work.
Definition at line 167 of file nodetext.cpp. 00167 : BaseTextClass() // Call the base class 00168 { 00169 Init(); 00170 }
|
|
The main VisibleTextNode constructor.
Specifies the direction in which the node is to be attached to the ContextNode. The values this variable can take are as follows: PREV : Attach node as a previous sibling of the context node NEXT : Attach node as a next sibling of the context node FIRSTCHILD: Attach node as the first child of the context node LASTCHILD : Attach node as a last child of the context node Definition at line 193 of file nodetext.cpp. 00194 : BaseTextClass(ContextNode, Direction) 00195 { 00196 Init(); 00197 }
|
|
Finds the distance along the text line of this character. You can optionally include the width of this character in the sum.
Definition at line 777 of file nodetext.cpp. 00778 { 00779 if (IncludeThisChar) 00780 return GetPosInLine()+GetCharAdvance(); 00781 else 00782 return GetPosInLine(); 00783 }
|
|
This fn is not to be confused with RequiresAttrib, it determines if an attribute of type AttrType can be directly applied to this object. The object is assumed to Require the attribute.
The function returns FALSE if we are trying to apply a line level attribute to a VisibleTextNode. As a result attributes will get applied to the parent TextLine object. Reimplemented from NodeRenderableInk. Definition at line 1145 of file nodetext.cpp. 01146 { 01147 return !TextLine::IsAttrTypeLineLevel(AttrType); 01148 }
|
|
Create a complex copy of this node. This node has overridden GetCopyType() to return COMPLEXCOPY which means, when copying to the clipboard it must make a copy of itself and whatever else it needs. The resulting tree will be attached as the last child of the clipboard root. The routine will be called twice during a copy. Once when Stage==COPYOBJECT and once when Stage==COPYFINISHED. It is only necessary to return a copy during COPYOBJECT. COPYFINISHED can be used to tidy up and flags the node may set during COPYOBJECT.
Reimplemented from Node. Definition at line 590 of file nodetext.cpp. 00591 { 00592 TextStory* pTextStory = FindParentStory(); 00593 ERROR2IF(pTextStory==NULL,FALSE,"VisibleTextNode::ComplexCopy() - pTextStory==NULL"); 00594 return pTextStory->BaseComplexCopy(Stage, RangeToCopy, pOutput); 00595 }
|
|
Override the node level virtual function ComplexHide. This gives us a chance to get in and hide the various selected members of a text story sensibly. We hide all necessary nodes when the last member of the text story is called to complex hide itself, otherwise we may corrupt the range being scanned.
Reimplemented from Node. Definition at line 636 of file nodetext.cpp. 00637 { 00638 // if there is no next node in the range then we need to hide all nodes 00639 BOOL CallComplexHide = TRUE; 00640 TextStory* pThisStory = this->FindParentStory(); 00641 ERROR2IF(pThisStory==NULL,FALSE,"VisibleTextNode::ComplexHide() - pThisStory==NULL"); 00642 00643 if (pNextNode) 00644 { 00645 if ( pNextNode->IsAVisibleTextNode() || IS_A(pNextNode,TextLine) ) 00646 { 00647 TextStory* pTextStory = (TextStory*)(pNextNode->FindParent(CC_RUNTIME_CLASS(TextStory))); 00648 ERROR2IF(pTextStory==NULL,FALSE,"VisibleTextNode::ComplexHide() - pTextStory==NULL"); 00649 if (pThisStory==pTextStory) 00650 CallComplexHide=FALSE; 00651 } 00652 } 00653 00654 if (CallComplexHide) 00655 return pThisStory->BaseComplexHide(pOp); 00656 else 00657 return 1; 00658 }
|
|
This method copies the node's contents to the node pointed to by NodeCopy.
Definition at line 608 of file nodetext.cpp. 00609 { 00610 // Ask the base class to do its bit 00611 Node::CopyNodeContents(NodeCopy); 00612 00613 // copy specifics 00614 NodeCopy->CharMatrix = CharMatrix; 00615 NodeCopy->PosInLine = PosInLine; 00616 }
|
|
Move this VTN to the specified location, flagging it 'Affected' in the old and new position.
Definition at line 955 of file nodetext.cpp. 00958 { 00959 ERROR2IF(pDestNode==NULL,FALSE,"VisibleTextNode::DoMoveNode() - pDestNode==NULL"); 00960 TextStory* pTextStory = this->FindParentStory(); 00961 ERROR2IF(pTextStory==NULL,FALSE,"VisibleTextNode::DoMoveNode() - caret has no parent story!"); 00962 00963 // flag node affected in old position (and parents) 00964 FlagNodeAndDescendantsAffectedAndParentsHaveDescendantAffected(); 00965 00966 // if selected, deselect to maintain 'parent of selected' flag 00967 BOOL selected = IsSelected(); 00968 if (selected) 00969 SetSelected(FALSE); 00970 00971 // if the caret (remember its position if undoable) always move it non-undoably 00972 // else just move the char, non-undoably if required 00973 // Note:must remember caret's old pos as if it is moved onto a new line, 00974 // when it is undone, the caret will be a child of the hidden line 00975 // and PrePostTextAction cannot cope with restoring the caret once hidden 00976 if (this->IsACaret()) 00977 { 00978 #if !defined(EXCLUDE_FROM_RALPH) 00979 if (pUndoOp!=NULL) 00980 if (!PositionCaretAction::DoStoreCaretPosition(pUndoOp,pTextStory)) 00981 return FALSE; 00982 #endif 00983 MoveNode(pDestNode,Direction); 00984 } 00985 else 00986 { 00987 if (pUndoOp==NULL) 00988 MoveNode(pDestNode,Direction); 00989 else 00990 if (pUndoOp->DoMoveNode(this, pDestNode, Direction)==FALSE) 00991 return FALSE; 00992 } 00993 00994 // if was selected, reselect to maintain 'parent of selected' flag 00995 if (selected) 00996 SetSelected(TRUE); 00997 00998 // flag node affected in new position (so parents flagged correctly) 00999 FlagNodeAndDescendantsAffectedAndParentsHaveDescendantAffected(); 01000 01001 return TRUE; 01002 }
|
|
Move ALL nodes from this VTN to LastVTN to pDestNode in the specified direction Assumes: First and last VTNs are on the same line Note: only VTN in range are moved so hidden nodes don't cause undo bloat!
Definition at line 913 of file nodetext.cpp. 00917 { 00918 ERROR2IF( pLastVTN==NULL,FALSE,"VisibleTextNode::DoMoveNodes() - pLastVTN==NULL"); 00919 ERROR2IF(pDestNode==NULL,FALSE,"VisibleTextNode::DoMoveNodes() - pDestNode==NULL"); 00920 00921 // move all VTN in the range to the specified location 00922 // however, can only move the caret once there are are some cahrs on the new line 00923 Node* pPrevDestNode = pDestNode; 00924 VisibleTextNode* pSrcVTN = this; 00925 while (pPrevDestNode!=pLastVTN) 00926 { 00927 ERROR2IF(pSrcVTN==NULL,FALSE,"VisibleTextNode::DoMoveNodes() - did not find pLastVTN"); 00928 VisibleTextNode* pNextSrcVTN = pSrcVTN->FindNextVTNInLine(); 00929 if (pSrcVTN->DoMoveNode(pUndoOp, pPrevDestNode, Direction)==FALSE) 00930 return FALSE; 00931 Direction = NEXT; // all subsequent VTN moved after previous 00932 pPrevDestNode = pSrcVTN; 00933 pSrcVTN = pNextSrcVTN; 00934 } 00935 00936 return TRUE; 00937 }
|
|
Definition at line 443 of file nodetext.cpp. 00444 { 00445 Node* pNode = FindNext(); 00446 while (pNode!=NULL && pNode->IsAnAbstractTextChar()==FALSE) 00447 pNode = pNode->FindNext(); 00448 00449 return (AbstractTextChar*)pNode; 00450 }
|
|
Definition at line 354 of file nodetext.cpp. 00355 { 00356 VisibleTextNode* pChar = FindNextVTNInStory(); 00357 while (pChar!=NULL && !pChar->IsAnAbstractTextChar()) 00358 pChar = pChar->FindNextVTNInStory(); 00359 00360 return (AbstractTextChar*)pChar; 00361 }
|
|
Definition at line 390 of file nodetext.cpp. 00391 { 00392 VisibleTextNode* pChar = FindNextVTNInStory(); 00393 while (pChar!=NULL && !IS_A(pChar,TextChar)) 00394 pChar = pChar->FindNextVTNInStory(); 00395 00396 return (TextChar*)pChar; 00397 }
|
|
Definition at line 426 of file nodetext.cpp. 00427 { 00428 Node* pNode = FindNext(); 00429 while (pNode!=NULL && pNode->IsAVisibleTextNode()==FALSE) 00430 pNode = pNode->FindNext(); 00431 00432 return (VisibleTextNode*)pNode; 00433 }
|
|
Finds the next VisibleTextNode in the TextStory. The routine searches across TextLines.
Definition at line 228 of file nodetext.cpp. 00229 { 00230 Node* Line = FindParent(); 00231 00232 // Be cautious 00233 ERROR3IF(Line == NULL, "VisibleTextNode has no parent"); 00234 ERROR3IF(!(IS_A(Line, TextLine)), "Parent of VisibleTextNode is not a TextLine"); 00235 00236 Node* Story = Line->FindParent(); 00237 00238 ERROR3IF(Story == NULL, "TextLine has no parent"); 00239 ERROR3IF(!(IS_A(Story, TextStory)), "Parent of TextLine is not a TextStory"); 00240 00241 Node* n = this; 00242 00243 // Loop until we have found a next VisibleTextNode 00244 // This code is an optimised depth first routine 00245 do 00246 { 00247 if (n->FindNext()) // Has the current node got a next sibling 00248 { 00249 n = n->FindNext(); // Let's visit it 00250 00251 if (IS_A(n,TextLine)) 00252 { 00253 // We have skipped to the next line, let's go to its first child if 00254 // it has one 00255 if (n->FindFirstChild()) 00256 { 00257 n = n->FindFirstChild(); 00258 } 00259 } 00260 00261 if (n->IsAVisibleTextNode()) 00262 { 00263 // Found one ! 00264 return (VisibleTextNode*)n; 00265 } 00266 00267 } 00268 else 00269 { 00270 // The only way is up 00271 n = n->FindParent(); 00272 } 00273 ERROR3IF(n == NULL, "We haven't found the parent TextStory"); 00274 } 00275 while (n != Story); 00276 00277 return NULL; // No more 00278 }
|
|
Definition at line 496 of file nodetext.cpp. 00497 { 00498 return (TextLine*)(this->FindParent(CC_RUNTIME_CLASS(TextLine))); 00499 }
|
|
Definition at line 479 of file nodetext.cpp. 00480 { 00481 Node* pNode = FindPrevious(); 00482 while (pNode!=NULL && pNode->IsAnAbstractTextChar()==FALSE) 00483 pNode = pNode->FindPrevious(); 00484 00485 return (AbstractTextChar*)pNode; 00486 }
|
|
Definition at line 372 of file nodetext.cpp. 00373 { 00374 VisibleTextNode* pChar = FindPrevVTNInStory(); 00375 while (pChar!=NULL && !pChar->IsAnAbstractTextChar()) 00376 pChar = pChar->FindPrevVTNInStory(); 00377 00378 return (AbstractTextChar*)pChar; 00379 }
|
|
Definition at line 408 of file nodetext.cpp. 00409 { 00410 VisibleTextNode* pChar = FindPrevVTNInStory(); 00411 while (pChar!=NULL && !IS_A(pChar,TextChar)) 00412 pChar = pChar->FindPrevVTNInStory(); 00413 00414 return (TextChar*)pChar; 00415 }
|
|
Definition at line 462 of file nodetext.cpp. 00463 { 00464 Node* pNode = FindPrevious(); 00465 while (pNode!=NULL && pNode->IsAVisibleTextNode()==FALSE) 00466 pNode = pNode->FindPrevious(); 00467 00468 return (VisibleTextNode*)pNode; 00469 }
|
|
Finds the previous VisibleTextNode in the TextStory. The routine searches across TextLines.
Definition at line 293 of file nodetext.cpp. 00294 { 00295 Node* Line = FindParent(); 00296 00297 // Be cautious 00298 ERROR3IF(Line == NULL, "VisibleTextNode has no parent"); 00299 ERROR3IF(!(IS_A(Line, TextLine)), "Parent of VisibleTextNode is not a TextLine"); 00300 00301 Node* Story = Line->FindParent(); 00302 00303 ERROR3IF(Story == NULL, "TextLine has no parent"); 00304 ERROR3IF(!(IS_A(Story, TextStory)), "Parent of TextLine is not a TextStory"); 00305 00306 Node* n = this; 00307 00308 // Loop until we have found a previous VisibleTextNode 00309 // This code is an optimised prev depth first routine 00310 do 00311 { 00312 if (n->FindPrevious()) // Has the current node got a previous sibling 00313 { 00314 n = n->FindPrevious(); // Let's visit it 00315 00316 if (IS_A(n, TextLine)) 00317 { 00318 // Next node to check is the last child of this TextLine 00319 Node* LastChild = n->FindLastChild(); 00320 if (LastChild != NULL) 00321 { 00322 n = LastChild; 00323 } 00324 } 00325 00326 if (n->IsAVisibleTextNode()) 00327 { 00328 // Found one ! 00329 return (VisibleTextNode*)n; 00330 } 00331 00332 } 00333 else 00334 { 00335 // The only way is up 00336 n = n->FindParent(); 00337 } 00338 ERROR3IF(n == NULL, "We haven't found the parent TextStory"); 00339 } 00340 while (n != Story); 00341 00342 return NULL; // No more 00343 }
|
|
Reimplemented in TextChar. Definition at line 184 of file nodetext.h.
|
|
Reimplemented in AbstractTextChar. Definition at line 183 of file nodetext.h.
|
|
Reimplemented in AbstractTextChar. Definition at line 181 of file nodetext.h.
|
|
Reimplemented in AbstractTextChar. Definition at line 182 of file nodetext.h.
|
|
This function returns a type describing how this object is to be copied. The fuction is called from the low level copy operation CopyObjects. There are two options at present, these being SIMPLECOPY and COMPLEXCOPY. SIMPLECOPY indicates that the node can be copied by a call to its virtual function SimpleCopy(). COMPLEXCOPY however indicates that the node needs to do its own thing when copying and must be called via the ComplexCopy() virtual function. This virtual will likely return a tree of copied objects rather than just a copy of itself.
Reimplemented from Node. Definition at line 519 of file nodetext.cpp. 00520 { 00521 return COMPLEXCOPY; 00522 }
|
|
For obtaining debug information about the Node. This fn can be deleted before we ship.
Reimplemented from NodeRenderableBounded. Reimplemented in AbstractTextChar, TextChar, KernCode, CaretNode, and EOLNode. Definition at line 687 of file nodetext.cpp. 00688 { 00689 #if DEBUG_TREE 00690 BaseTextClass::GetDebugDetails(Str); 00691 00692 String_256 TempStr; 00693 String_256 TempStr2; 00694 TCHAR floatStr[20]; 00695 00696 // dump the character matrix 00697 fixed16 abcd[4]; 00698 INT32 ef[2]; 00699 CharMatrix.GetComponents(abcd, ef); 00700 00701 TempStr._MakeMsg( TEXT("\r\nMatrix\r\n")); 00702 (*Str) += TempStr; 00703 camSnprintf( floatStr, 20, _T("%f,%f"), abcd[0].MakeDouble(), abcd[1].MakeDouble()); 00704 TempStr._MakeMsg( TEXT("a, b :\t#1%s\r\n"), floatStr); 00705 (*Str) += TempStr; 00706 camSnprintf( floatStr, 20, _T("%f,%f"), abcd[2].MakeDouble(), abcd[3].MakeDouble()); 00707 TempStr._MakeMsg( TEXT("c, d :\t#1%s\r\n"), floatStr); 00708 (*Str) += TempStr; 00709 TempStr._MakeMsg( TEXT("e, f :\t#1%ld,\t#2%ld\r\n"), ef[0], ef[1]); 00710 (*Str) += TempStr; 00711 #endif 00712 }
|
|
Definition at line 191 of file nodetext.h. 00191 { return CharMatrix; }
|
|
For finding the size of the VisibleTextNode.
Reimplemented from Node. Reimplemented in AbstractTextChar, TextChar, KernCode, HorizontalTab, CaretNode, and EOLNode. Definition at line 670 of file nodetext.cpp. 00671 { 00672 ERROR3("Tring to find the size of abstract VisibleTextNode"); 00673 return (sizeof(VisibleTextNode)); 00674 }
|
|
Definition at line 192 of file nodetext.h. 00192 { return &CharMatrix; }
|
|
Definition at line 187 of file nodetext.h. 00187 { return PosInLine; }
|
|
set the given matrix to be the concatenation of the TextStory and VTN matrices
Definition at line 725 of file nodetext.cpp. 00726 { 00727 ERROR2IF(pMatrix==NULL,FALSE,"VisibleTextNode::GetStoryAndCharMatrix() - pMatrix==NULL"); 00728 00729 // get the VTN matrix, then concatenate the TextStory matrix 00730 *pMatrix=CharMatrix; 00731 TextStory* pTextStory = this->FindParentStory(); 00732 ERROR2IF(pTextStory==NULL,FALSE,"VisibleTextNode::GetStoryAndCharMatrix() - pTextStory==NULL"); 00733 *pMatrix*=*(pTextStory->GetpStoryMatrix()); 00734 00735 return TRUE; 00736 }
|
|
Initialise the members of a VisibleTextNode. Called by all constructors.
Reimplemented from BaseTextClass. Reimplemented in AbstractTextChar. Definition at line 208 of file nodetext.cpp. 00209 { 00210 CharMatrix = Matrix(0,0); 00211 PosInLine = 0; 00212 IsBoundingRectValid = FALSE; 00213 }
|
|
Reimplemented in CaretNode. Definition at line 174 of file nodetext.h. 00174 { return FALSE; }
|
|
Definition at line 179 of file nodetext.h. 00179 { return FALSE; }
|
|
Reimplemented in TextChar. Definition at line 178 of file nodetext.h. 00178 { return FALSE; }
|
|
Reimplemented in EOLNode. Definition at line 175 of file nodetext.h. 00175 { return FALSE; }
|
|
Reimplemented in TextChar. Definition at line 176 of file nodetext.h. 00176 { return FALSE; }
|
|
Reimplemented in TextChar. Definition at line 177 of file nodetext.h. 00177 { return FALSE; }
|
|
Reimplemented from Node. Definition at line 173 of file nodetext.h. 00173 { return TRUE; }
|
|
Allows the VisibleTextNode to respond to pop up menu clicks on itself.
Reimplemented from NodeRenderableInk. Definition at line 1164 of file nodetext.cpp. 01165 { 01166 TextStory* pStory = this->FindParentStory(); 01167 01168 if (pStory!=NULL && pStory->IsSelected()) 01169 return pStory->OnNodePopUp(pSpread, PointerPos, pMenu); 01170 else 01171 return FALSE; 01172 }
|
|
Render any first level children attributes into the region.
Definition at line 749 of file nodetext.cpp. 00750 { 00751 ERROR2IF(pRenderRegion==NULL,FALSE,"VisibleTextNode::RenderChildAttrs() - pRenderRegion==NULL"); 00752 00753 Node* pChildNode=FindFirstChild(); 00754 while (pChildNode) 00755 { 00756 if (pChildNode->IsAnAttribute()) 00757 pChildNode->Render(pRenderRegion); 00758 pChildNode=pChildNode->FindNext(); 00759 } 00760 00761 return TRUE; 00762 }
|
|
If this VTN is not fully on the screen then the screen is scrolled so the VTN is more visible.
Definition at line 1014 of file nodetext.cpp. 01015 { 01016 #if !defined(EXCLUDE_FROM_RALPH) 01017 DocView* pDocView = DocView::GetSelected(); 01018 Spread* pSpread = FindParentSpread(); 01019 01020 if (pDocView!=NULL && pSpread!=NULL) 01021 { 01022 DocRect ScreenArea = GetBlobBoundingRect(); 01023 01024 // Get the extent of the current view and convert to spread coordinates. 01025 DocRect WorkArea = pDocView->GetDocViewRect(pSpread); 01026 pSpread->DocCoordToSpreadCoord(&WorkArea); 01027 01028 BOOL Scroll = FALSE; 01029 DocCoord WindowTopLeft; 01030 DocCoord Offset(0,0); // Amount to offset current TopLeft by 01031 01032 if (!WorkArea.ContainsRect(ScreenArea)) 01033 { 01034 if (WorkArea.Height() > ScreenArea.Height() && WorkArea.Width() > ScreenArea.Width()) 01035 { 01036 const double Shift = 0.05; 01037 01038 if (ScreenArea.hi.y > WorkArea.hi.y) 01039 Offset.y = ScreenArea.hi.y-WorkArea.hi.y + (INT32)(WorkArea.Height()*Shift); 01040 01041 if (ScreenArea.lo.y < WorkArea.lo.y) 01042 Offset.y = ScreenArea.lo.y-WorkArea.lo.y - (INT32)(WorkArea.Height()*Shift); 01043 01044 if (ScreenArea.hi.x > WorkArea.hi.x) 01045 Offset.x = ScreenArea.hi.x-WorkArea.hi.x + (INT32)(WorkArea.Width()*Shift); 01046 01047 if (ScreenArea.lo.x < WorkArea.lo.x) 01048 Offset.x = ScreenArea.lo.x-WorkArea.lo.x - (INT32)(WorkArea.Width()*Shift); 01049 01050 if (Offset != DocCoord(0,0)) 01051 { 01052 Scroll = TRUE; 01053 WindowTopLeft = DocCoord(WorkArea.lo.x, WorkArea.hi.y) + Offset; 01054 } 01055 } 01056 else 01057 { 01058 // Cannot contain object on screen. Centre it. 01059 Scroll = TRUE; 01060 DocCoord CentreOfObject((ScreenArea.lo.x+ScreenArea.hi.x)/2, (ScreenArea.lo.y+ScreenArea.hi.y)/2); 01061 01062 WindowTopLeft = DocCoord(CentreOfObject.x-WorkArea.Width()/2,CentreOfObject.y+WorkArea.Height()/2); 01063 } 01064 } 01065 01066 // Now scroll to the new position 01067 if (Scroll) 01068 { 01069 // First, ensure that the spread's pasteboard is large enough to include this node 01070 // This is pretty quick if it is big enough. 01071 pSpread->ExpandPasteboardToInclude(GetBoundingRect()); 01072 01073 // Convert the window coordinate from Spread to Document coords... 01074 pSpread->SpreadCoordToDocCoord(&WindowTopLeft); 01075 01076 // ...and thence to Logical coordinates 01077 WorkCoord WTL = WindowTopLeft.ToWork(pSpread, pDocView); 01078 pDocView->SetScrollOffsets(WTL, TRUE); 01079 01080 // New stuff added by Will 29/6/95 01081 // Now we have scrolled the View, we need to invalidate the newly visible areas, 01082 // so that any blob rendering knows that the area has a pending redraw. 01083 // If we wait for the Paint message from the OS, then it will be too late. 01084 01085 // First we get the new extent of the view we just scrolled and convert to spread coordinates. 01086 WorkArea = pDocView->GetDocViewRect(pSpread); 01087 pSpread->DocCoordToSpreadCoord(&WorkArea); 01088 01089 DocRect Invalid; 01090 01091 if (Offset.x != 0) 01092 { 01093 // Get the invalid horizontal scroll rect, by subtracting the x scroll offset 01094 // from the left or right edge of the screen (depending on which way we scrolled) 01095 Invalid.lo.x = Offset.x > 0 ? WorkArea.hi.x - Offset.x : WorkArea.lo.x; 01096 Invalid.lo.y = WorkArea.lo.y; 01097 Invalid.hi.x = Offset.x > 0 ? WorkArea.hi.x : WorkArea.lo.x - Offset.x; 01098 Invalid.hi.y = WorkArea.hi.y; 01099 01100 // and invalidate it 01101 pDocView->ForceRedraw(pSpread, Invalid); 01102 } 01103 01104 if (Offset.y != 0) 01105 { 01106 // Get the invalid vertical scroll rect, by subtracting the y scroll offset 01107 // from the top or bottom edge of the screen (depending on which way we scrolled) 01108 Invalid.lo.x = WorkArea.lo.x; 01109 Invalid.lo.y = Offset.y > 0 ? WorkArea.hi.y - Offset.y : WorkArea.lo.y; 01110 Invalid.hi.x = WorkArea.hi.x; 01111 Invalid.hi.y = Offset.y > 0 ? WorkArea.hi.y : WorkArea.lo.y - Offset.y; 01112 01113 // and invalidate it 01114 pDocView->ForceRedraw(pSpread, Invalid); 01115 } 01116 } 01117 } 01118 #endif 01119 }
|
|
Definition at line 190 of file nodetext.h. 00190 { CharMatrix = matrix; }
|
|
Definition at line 188 of file nodetext.h. 00188 { PosInLine=x; }
|
|
It is illegal to copy a VisibleTextNode (it's abstract), therefore this function will generate an error if called.
Reimplemented from BaseTextClass. Reimplemented in AbstractTextChar, TextChar, KernCode, HorizontalTab, CaretNode, and EOLNode. Definition at line 535 of file nodetext.cpp.
|
|
Reimplemented in CaretNode, and EOLNode. Definition at line 163 of file nodetext.h.
|
|
Wrap all chars upto this VTN (inc) back to the end of the previous line If this line is then empty, hide it.
Definition at line 863 of file nodetext.cpp. 00864 { 00865 // get info about this and previous line 00866 TextLine* pThisLine = this->FindParentLine(); 00867 ERROR2IF(pThisLine==NULL,FALSE,"VisibleTextNode::WrapFromStartOfLineBack() - pThisLine==NULL"); 00868 VisibleTextNode* pFirstVTN = pThisLine->FindFirstVTN(); 00869 ERROR2IF(pFirstVTN==NULL,FALSE,"VisibleTextNode::WrapFromStartOfLineBack() - no VTN on this line!"); 00870 TextLine* pPrevLine = pThisLine->FindPrevLine(); 00871 ERROR2IF(pPrevLine==NULL,FALSE,"VisibleTextNode::WrapFromStartOfLineBack() - pPrevLine==NULL"); 00872 ERROR2IF(pPrevLine->FindEOLNode()!=NULL,FALSE,"VisibleTextNode::WrapFromStartOfLineBack() - trying to wrap back onto a hard line!"); 00873 00874 // get a set of non line level attrs, which are to be localised to char level 00875 AttrTypeSet NonLineLevelAttrs; 00876 BOOL ok = pThisLine->AddNonLineLevelDescendantAttrsToSet(&NonLineLevelAttrs); 00877 if (ok) ok = pPrevLine->AddNonLineLevelDescendantAttrsToSet(&NonLineLevelAttrs); 00878 00879 // move ALL the nodes from first VTN on line to this VTN back to end of prev line 00880 // if wrapping whole line back, hide the empty line 00881 // since previous line is soft assumes this and prev lines have same line level attrs 00882 // Localise/FactorOut global as Line Level attrs on story may change change 00883 BOOL WholeLine = (this->FindNextVTNInLine()==NULL); 00884 if (ok) ok = pThisLine->DoLocaliseCommonAttributes(pUndoOp,FALSE,TRUE,&NonLineLevelAttrs); 00885 if (ok) ok = pPrevLine->DoLocaliseCommonAttributes(pUndoOp,FALSE,TRUE,&NonLineLevelAttrs); 00886 if (ok) ok = pFirstVTN->DoMoveNodes(pUndoOp, this, pPrevLine, LASTCHILD); 00887 if (ok && WholeLine) ok = pThisLine->DoHideNode(pUndoOp); 00888 if (ok && !WholeLine) ok = pThisLine->DoFactorOutCommonChildAttributes(pUndoOp,TRUE,&NonLineLevelAttrs); 00889 if (ok) ok = pPrevLine->DoFactorOutCommonChildAttributes(pUndoOp,TRUE,&NonLineLevelAttrs); 00890 00891 return ok; 00892 }
|
|
Wrap all nodes from this VTN (inc) to last VTN forward to start of next line If the line containing this VTN is hard (ends in an EOL) create a new line to wrap the text onto.
Definition at line 798 of file nodetext.cpp. 00799 { 00800 // get info about the source line 00801 TextLine* pSrcLine = this->FindParentLine(); 00802 ERROR2IF(pSrcLine==NULL,FALSE,"VisibleTextNode::WrapRestOfLineForward() - pSrcLine==NULL"); 00803 VisibleTextNode* pLastVTNToMove = pSrcLine->FindLastVTN(); 00804 ERROR2IF(pLastVTNToMove==NULL,FALSE,"VisibleTextNode::WrapRestOfLineForward() - no VTN's on soft line"); 00805 00806 // if SrcLine soft, find next line (localising non-LLA attrs on it) else create a new line 00807 AttrTypeSet* pAttrSet = NULL; // assume creating new line so all attrs need localising 00808 TextLine* pDstLine = NULL; 00809 BOOL ok = TRUE; 00810 if (pLastVTNToMove->IsAnEOLNode()) 00811 { 00812 pDstLine = new TextLine; 00813 if (pDstLine==NULL) 00814 return FALSE; 00815 pSrcLine->CopyNodeContents(pDstLine); // copy cached line level attr info 00816 if (ok) ok = pDstLine->DoInsertNewNode(pUndoOp,pSrcLine,NEXT); 00817 } 00818 else 00819 { 00820 pDstLine = pSrcLine->FindNextLine(); 00821 ERROR2IF(pDstLine==NULL,FALSE,"VisibleTextNode::WrapRestOfLineForward() - no next line after soft line"); 00822 00823 pAttrSet = new AttrTypeSet(); 00824 if (ok) ok = pSrcLine->AddNonLineLevelDescendantAttrsToSet(pAttrSet); 00825 if (ok) ok = pDstLine->AddNonLineLevelDescendantAttrsToSet(pAttrSet); 00826 00827 if (ok) ok = pDstLine->DoLocaliseCommonAttributes(pUndoOp,FALSE,FALSE,pAttrSet); 00828 } 00829 00830 // get context node and attach direction for attaching text as first objects in dest line 00831 Node* pAttachNode = pDstLine; 00832 AttachNodeDirection AttachDir = FIRSTCHILD; 00833 pDstLine->GetAttachNodeAndDirectionToAttachFirstChildObject(&pAttachNode,&AttachDir); 00834 00835 // localise on SrcLine, move text to DstLine, then factor out on both 00836 // Localise/FactorOut not global as attrs on story should never change 00837 if (ok) ok = pSrcLine->DoLocaliseCommonAttributes(pUndoOp,FALSE,FALSE,pAttrSet); 00838 if (ok) ok = this->DoMoveNodes(pUndoOp, pLastVTNToMove, pAttachNode, AttachDir); 00839 if (ok) ok = pSrcLine->DoFactorOutCommonChildAttributes(pUndoOp,FALSE,pAttrSet); 00840 if (ok) ok = pDstLine->DoFactorOutCommonChildAttributes(pUndoOp,FALSE,pAttrSet); 00841 00842 if (pAttrSet!=NULL) 00843 { 00844 pAttrSet->DeleteAll(); 00845 delete pAttrSet; 00846 } 00847 00848 return ok; 00849 }
|
|
Definition at line 200 of file nodetext.h. |
|
Definition at line 201 of file nodetext.h. |