#include <nodetxts.h>
Inheritance diagram for TextStory:
Public Member Functions | |
TextStory () | |
Simple TextStory constructor, it is required so that SimpleCopy will work. | |
~TextStory () | |
The destructor currently just checks to see if the TextStory being deleted still has the input focus, and clears it if it has. One situation where this occurs is when deleting a document. This dosen't clear the selection. | |
TextStory (Node *ContextNode, AttachNodeDirection Direction) | |
The main TextStory constructor. | |
void | Init () |
Initialies the member variables of the TextStory. | |
String_256 | GetStoryAsString () |
virtual BOOL | IsSetCandidate () const |
Indicates that NodeRenderableInks are candidates for membership of Attribute gallery set. | |
virtual BOOL | IsCompound () const |
virtual Node * | SimpleCopy () |
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes of Node. | |
void | CopyNodeContents (TextStory *NodeCopy) |
This method copies the node's contents to the node pointed to by NodeCopy. | |
virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
Polymorphically copies the contents of this node to another. | |
INT32 | BaseComplexCopy (CopyStage Stage, Range &RangeToCopy, Node **pOutput) |
INT32 | BaseComplexHide (UndoableOperation *pOp) |
This function handles the text story being hidden during operations such as OpDelete / OpCut / etc. The function is called indirectly via it child nodes. It should never be called directly. Its purpose is to cope with various parts of the text story being hidden. It is not possible to DoHideNodes() on a selection of the text stories children as this may leave the story in an invalid state. Hence all children ask their parent text story to sort out the problem. The function is usually called from a derived version of Node::ComplexHide(). | |
virtual BOOL | HidingNode () |
Called when this TextStory is hidden - Clears the input focus from this TextStory if it currently has it, then calls the parent class. | |
virtual BOOL | CanBecomeA (BecomeA *pBecomeA) |
This function is used by the convert to shapes operation. It determines if the node or any of its children can convert themselves into an InkClass object. | |
virtual BOOL | DoBecomeA (BecomeA *pBecomeA) |
Transforms the object into another type of object. | |
virtual String | Describe (BOOL Plural, BOOL Verbose) |
Gives a description of the TextStory node for the status line etc. | |
virtual UINT32 | GetNodeSize () const |
For finding the size of the node. | |
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 TextStory to respond to pop up menu clicks on itself. | |
virtual DocRect | GetBlobBoundingRect () |
virtual void | RenderObjectBlobs (RenderRegion *pRender) |
Render the text story's object blobs. | |
virtual void | RenderTinyBlobs (RenderRegion *pRender) |
Render the text story's tiny blobs. | |
DocCoord | GetBlobPosAndSize (INT32 *pSize=NULL) |
virtual BOOL | AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE) |
Allows the TextStory to abort the following operations under the following circumstances. | |
virtual BOOL | AllowOp_AccountForCompound (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE) |
Req'd so that the curve bit of text-on-a-curve gets AllowOp messages, thus allowing feathered curve bits to update correctly. | |
virtual ChangeCode | OnChildChange (ObjChangeParam *pParam) |
This function is called at the end of any operation which has affected a TextStory in order to (undoably) reformat the story and redraw affected bits. | |
BOOL | MoveCaretLeftAChar () |
This routine moves the caret to the left by one position. | |
BOOL | MoveCaretRightAChar () |
This routine moves the caret to the right by one position. | |
BOOL | MoveCaretLeftAWord () |
This routine moves the caret to the left by a word. If the caret is in a word it is moved to the start of that word, else the caret is positioned at the start of the previous word. | |
BOOL | MoveCaretRightAWord () |
This routine moves the caret to the right by a word. It caret is positioned to the left of the first character encountered after a space. | |
BOOL | MoveCaretToStartOfLine () |
This routine moves the caret to the start of the TextLine that it is on. | |
BOOL | MoveCaretToEndOfLine () |
Move caret to end of TextLine which it is on. | |
BOOL | MoveCaretToCharacter (VisibleTextNode *pChar, AttachNodeDirection Dir) |
This routine moves the caret to the left or right of a specified char. | |
BOOL | AttachCaretAttributes () |
This function should be called after the caret has been moved to its new location. It deletes all its previous children, and copies the children of the character to the left of it. If there isn't anything to the left then the attributes to the right are used; if there isn't anything to the right then no attributes are attached so the defaults are used. This function broacasts an attribute changed message. | |
VisibleTextNode * | GetPrevWordChar (VisibleTextNode *pStartChar) |
VisibleTextNode * | GetNextWordChar (VisibleTextNode *pStartChar) |
VisibleTextNode * | GetSelectionEnd (BOOL *pDirection=NULL) |
This function should be called to find what character nodes are selected. The return value is a pointer to the last selected node, at the other end of the selected characters from the anchor (which is the caret). NULL will be returned if there is no selection. | |
BOOL | GetCharacterAtPoint (BOOL InBounds, DocCoord Point, VisibleTextNode **pHitChar, BOOL *ToLeft) |
Given a location works out the nearest character to that location. | |
CaretNode * | GetCaret () |
Returns a pointer to the caret node of this TextStory, NULL will be returned if there is no Caret. | |
NodePath * | GetTextPath () const |
This function should be used to get a pointer to the path the text is on. NULL is returned if there is no text path. | |
TextLine * | FindFirstLine () const |
This function should be used to obtain a pointer to the TextStory's first TextLine node. | |
TextLine * | FindLastLine () const |
VisibleTextNode * | FindFirstVTN () const |
VisibleTextNode * | FindLastVTN () const |
virtual void | Transform (TransformBase &transform) |
transform a text story and any children capable of being transformed | |
DocRect | GetUTStoryBounds () |
The bounding box of the story in it's untransformed space. | |
BOOL | CreateUntransformedPath (TextStoryInfo *pPathInfo) |
Create a copy of the story's path removing the Story matrix transform Also, reverse path if text is reversed on the path Note: This should really be broken up into member functions of Path. | |
void | MatrixFitToPath () |
modify TextStory matrix appropriately when fitting text to a path | |
void | MatrixRemoveFromPath () |
modify TextStory matrix appropriately when removing text from a path | |
virtual BOOL | FormatAndChildren (UndoableOperation *pUndoOp=NULL, BOOL UseNodeFlags=FALSE, BOOL WordWrap=TRUE) |
Reformat a text story. | |
BOOL | UnWrapStory (UndoableOperation *pUndoOp) |
Join consecutive soft lines into single hard lines and append a final (virtual) EOL to the story if none. | |
BOOL | DeleteSelectedText (UndoableOperation *pUndoOp) |
Delete all selected text objects in story, deleteing whole lines where possible. | |
BOOL | DeleteSelectedTextLines (UndoableOperation *pUndoOp) |
Called by DeleteSelectedText to delete all selected TextLines (including TextLines will all children selected). | |
BOOL | DeleteSelectedTextCharacters (UndoableOperation *pUndoOp) |
delete all (remaining) selected VTN in story, joining lines if EOL deleted and story not word wrapping | |
void | PreExportRender (RenderRegion *pRegion) |
This function is called when the render function passes through this node It outputs the Text Object start and end tokens. | |
BOOL | ExportRender (RenderRegion *pRegion) |
This function is called when the render function passes through this node It outputs the Text Object start and end tokens. | |
BOOL | PostImport () |
This functions is called following the complete import of a document. It allows nodes to complete their post import initialisation once they are in complete tree. The TextStory and its children are formatted following loading. | |
BOOL | PostDuplicate (UndoableOperation *pOp) |
This function is called following the (simple)copy of a text story. The TextStory and its children are re-formatted. | |
BOOL | ImportFix_MoveScaleToAttrs () |
Move the scale from the story's matrix down to its attributes (ie fix up docs which were created with partly developed by code!). | |
BOOL | CorelStyleBaselineShift (BaseShiftEnum BaseShift) |
BOOL | OKToExport () |
Determines wether or not this text story should be exported. If there are no characters in it then we don't want to save it as it will cause bother when loaded back. | |
virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
Writes out a records associated with this node. | |
virtual BOOL | WritePreChildrenNative (BaseCamelotFilter *pFilter) |
virtual BOOL | CanWriteChildrenWeb (BaseCamelotFilter *pFilter) |
If the node does not mind the filter automatically writing out its child nodes, then return TRUE. | |
virtual BOOL | CanWriteChildrenNative (BaseCamelotFilter *pFilter) |
virtual BOOL | WriteBeginChildRecordsWeb (BaseCamelotFilter *pFilter) |
Writes out child records associated with the text story. | |
virtual BOOL | WriteBeginChildRecordsNative (BaseCamelotFilter *pFilter) |
Begin to write out you child records, in the native format. | |
virtual BOOL | WriteEndChildRecordsWeb (BaseCamelotFilter *pFilter) |
Finished writing out you child records, in the web format. | |
virtual BOOL | WriteEndChildRecordsNative (BaseCamelotFilter *pFilter) |
Finished writing out you child records, in the native format. | |
void | ResetStringList () |
void | AddImportedString (ImportedString *pImportedString) |
Adds the object to the list of imported strings. | |
BOOL | EnsureStoryHasCaret () |
Makes sure the story has a caret node. | |
void | Validate (BOOL EnsureOpFlagsReset=TRUE) |
Perform various integrity checks on a text story in debug builds. | |
void | CheckLeaf (Node *pLeafNode) |
Ensure no Linelevel attrs below line level. | |
void | CheckSubtree (Node *pNode, AttrTypeSet *pParentAttrSet=NULL, BOOL *pDescendantSelected=NULL) |
Validate a subtree, checking for:
| |
TCHAR * | GetNodeInfo (Node *pNode) |
return string with CC_RUNTIME_CLASS name of node and address | |
void | ResetEOLs (BOOL Status) |
Scan through all end of line nodes in this text story and set the status of their virtual flag. | |
BOOL | WillStoryWrapOnPath () |
Calculates whether the formatter will wrap any line of text around the path It calculates this by checking the position of the last character (or VTN in each line). If this wraps it is assumed the whole line will wrap. Note text is assumed to only ever wrap on a path which is closed. | |
const Matrix * | GetpStoryMatrix () const |
Matrix * | GetpStoryMatrix () |
Matrix | GetStoryMatrix () const |
void | SetStoryMatrix (Matrix &matrix) |
DocRect | GetRedrawRect () const |
void | SetRedrawRect (DocRect rect) |
void | UpdateRedrawRect (DocRect rect) |
MILLIPOINT | GetStoryWidth () const |
void | SetStoryWidth (MILLIPOINT NewValue) |
MILLIPOINT | GetImportFormatWidth () const |
BaseShiftEnum | GetImportBaseShift () const |
void | SetImportFormatWidth (MILLIPOINT width) |
void | SetImportBaseShift (BaseShiftEnum shift) |
BOOL | IsTextOnPathReversed () const |
BOOL | IsTextOnPathTangential () const |
BOOL | IsPrintingAsShapes () const |
BOOL | IsWordWrapping () const |
void | ReverseTextOnPath () |
void | ToggleTextOnPathTangentialness () |
void | SetPrintingAsShapes (BOOL NewValues) |
void | SetWordWrapping (BOOL NewValues) |
FIXED16 | GetCharsScale () const |
FIXED16 | GetCharsAspect () const |
ANGLE | GetCharsRotation () const |
ANGLE | GetCharsShear () const |
void | SetCharsScale (FIXED16 scale) |
void | SetCharsAspect (FIXED16 aspect) |
void | SetCharsRotation (ANGLE rotation) |
void | SetCharsShear (ANGLE shear) |
BOOL | IsAutoKerning () |
void | SetAutoKerning (BOOL NewValue) |
MILLIPOINT | GetLeftIndent () const |
MILLIPOINT | GetRightIndent () const |
DocCoord | GetLeftIndentPos () const |
Gets the position in the document of the left indent of this story. | |
DocCoord | GetRightIndentPos () const |
Gets the position in the document of the right indent of this story. Remember that the right inrent is relative to the RHS of the path. | |
void | SetLeftIndent (MILLIPOINT NewIndent) |
void | SetRightIndent (MILLIPOINT NewIndent) |
virtual BOOL | IsTypeExtendible () const |
virtual DocRect | ValidateExtend (const ExtendParams &ExtParams) |
Tests to see whether this text-story's extend-centre is positioned so as to make an extend operation irreversible. See also: Extender class. | |
virtual void | Extend (const ExtendParams &ExtParams) |
Perform an Extend operation on this text-story. See also: Extender class. | |
DocCoord | FindExtendCentre () |
Find the extend-centre reference point. See also: Extender class. | |
Justification | FindJustification () |
Used in conjunction with Extend() and its sister functions to determine which way a text-story should extend. If you use this function for another purpose, read it and make sure it does what you think it should do first. Notes: Be aware that this function uses IsKindOf() to test this node's children within the tree. See also: Extender class. | |
Static Public Member Functions | |
static TextStory * | CreateTextObject (DocCoord Anchor) |
Creates a Text object. | |
static TextStory * | CreateTextObject (Matrix TheMatrix) |
Creates a Text object. | |
static TextStory * | CreateFromChars (DocCoord Pos, char *pChars, WCHAR *pWChars, Document *pCreateDoc, LOGFONT *pLogFont=NULL, BOOL ControlCodes=FALSE, DocColour *pColour=NULL) |
Create a TextStory from an array of chars OR WCHARs and optionally account for control codes and a LogFont (ie size/aspect/bold/italic/typeface/rotation). | |
static TextStory * | GetFocusStory () |
This function should be used to get a pointer to the TextStory with the input focus. There can be only one such story with an active caret at any time, although there does not have to aways be one (in this case NULL is returned). | |
static void | SetFocusStory (TextStory *pNewStory) |
This function should be used to set the pointer with the input focus. Setting the pointer to NULL clears the into focus. | |
static DocCoord | GetPathBlobPos (MILLIPOINT IndentLength, NodePath *pPath) |
Gets the location of the of a point a certian distance along the path. This function is static so others, eg the drag op, can call it and it's scary math. | |
Protected Member Functions | |
BOOL | Copy (Range &RangeToCopy, Node **pOutput) |
Make a copy of the text story and all children which lie inside RangeToCopy. | |
void | SetStoryMarkers (Range &RangeToCopy) |
Scan through the text story setting the necessary copyme bits to make sure the text story is copied correctly. The range is used to determin what items are actually being copied. If characters are being copied, we need to copy a line and text story as well. | |
BOOL | ExpandImportedStrings () |
Expands any strings that were imported into a series of text characters. | |
BOOL | IsGradientFilled () |
Looks through the list of nodes under the text story node to see if there are any gradient fills on this object. See also: TextStory::PreExportRender. | |
Static Protected Member Functions | |
static BOOL | DeleteChildAttribute (NodeRenderableInk *pParent, CCRuntimeClass *ReqdAttrib) |
Finds and deletes a child attribute of the given type. | |
Private Attributes | |
Matrix | StoryMatrix |
DocRect | RedrawRect |
CaretNode * | CachedCaret |
MILLIPOINT | mLeftIndent |
MILLIPOINT | mRightIndent |
MILLIPOINT | StoryWidth |
BOOL | TextOnPathReversed: 1 |
BOOL | TextOnPathTangential: 1 |
BOOL | PrintAsShapes: 1 |
BOOL | WordWrapping: 1 |
BOOL | BeingCopied: 1 |
MILLIPOINT | ImportFormatWidth |
BaseShiftEnum | ImportBaseShift |
FIXED16 | CharsScale |
FIXED16 | CharsAspect |
ANGLE | CharsRotation |
ANGLE | CharsShear |
ImportedStringList * | pImportedStringList |
bool | AutoKern |
Static Private Attributes | |
static TextStory * | pFocusStory = NULL |
Definition at line 260 of file nodetxts.h.
|
Simple TextStory constructor, it is required so that SimpleCopy will work.
Definition at line 1024 of file nodetxts.cpp. 01024 : BaseTextClass() // Call the base class 01025 { 01026 Init(); 01027 }
|
|
The destructor currently just checks to see if the TextStory being deleted still has the input focus, and clears it if it has. One situation where this occurs is when deleting a document. This dosen't clear the selection.
Definition at line 1040 of file nodetxts.cpp. 01041 { 01042 if (GetFocusStory() == this) 01043 SetFocusStory(NULL); 01044 01045 if (pImportedStringList != NULL) 01046 { 01047 pImportedStringList->DeleteAll(); 01048 delete pImportedStringList; 01049 pImportedStringList = NULL; 01050 } 01051 }
|
|
The main TextStory 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 1074 of file nodetxts.cpp. 01075 :BaseTextClass(ContextNode, Direction) 01076 { 01077 Init(); 01078 }
|
|
Adds the object to the list of imported strings.
Definition at line 4593 of file nodetxts.cpp. 04594 { 04595 if (pImportedStringList == NULL) 04596 pImportedStringList = new ImportedStringList; 04597 04598 if (pImportedStringList != NULL) 04599 pImportedStringList->AddTail(pImportedString); 04600 }
|
|
Allows the TextStory to abort the following operations under the following circumstances.
Reimplemented from BaseTextClass. Definition at line 1454 of file nodetxts.cpp. 01456 { 01457 ERROR2IF(pParam==NULL,FALSE,"TextStory::AllowOp() - pParam==NULL"); 01458 01459 // decide if we allow it ... 01460 01461 // Karim 14/11/2000 01462 // Added the !=OBJCHANGE_CALLEDBYCHILD clause. 01463 // TextStories don't usually pass AllowOp down to their children. 01464 // This is an exception - see TextStory::AllowOp_AccountForCompound for more info. 01465 BOOL allowed=TRUE; 01466 ObjChangeFlags Flags=pParam->GetChangeFlags(); 01467 if (pParam->GetDirection() != OBJCHANGE_CALLEDBYCHILD) 01468 AllowOp_AccountForCompound(pParam, SetOpPermissionState, DoPreTriggerEdit); 01469 01470 else 01471 { 01472 // we disallow changes to our text chars, but any child NodePath is fair game. 01473 if (pParam->GetCallingChild() == NULL || !pParam->GetCallingChild()->IsNodePath()) 01474 { 01475 if (Flags.ReplaceNode || Flags.MultiReplaceNode) 01476 { 01477 pParam->SetReasonForDenial(_R(IDE_TEXT_USEDBYSTORY)); 01478 allowed=FALSE; 01479 } 01480 } 01481 } 01482 01483 // if we allow it, (and our parents weren't calling us) see if our parents do ... 01484 if (allowed && pParam->GetDirection()!=OBJCHANGE_CALLEDBYPARENT && Parent!=NULL) 01485 { 01486 // pass a temporary copy of the ObjChangeParam to our parent indicating call direction 01487 // and if all our children are deleted we know we don't delete ourselves so clear delete flag 01488 ObjChangeFlags NewFlags=pParam->GetChangeFlags(); 01489 if (pParam->GetDirection()==OBJCHANGE_CALLEDBYCHILD) 01490 NewFlags.DeleteNode=FALSE; 01491 ObjChangeParam ObjParam(pParam->GetChangeType(), NewFlags, pParam->GetChangeObj(), 01492 pParam->GetOpPointer(), OBJCHANGE_CALLEDBYCHILD); 01493 ObjParam.SetCallingChild(this); 01494 allowed=Parent->AllowOp(&ObjParam,SetOpPermissionState,DoPreTriggerEdit); 01495 } 01496 01497 // if setting permisions ... 01498 if (SetOpPermissionState) 01499 { 01500 if (allowed) 01501 { 01502 if (Parent!=NULL) 01503 Parent->SetOpPermission(PERMISSION_ALLOWED); 01504 01505 // if post process required, 01506 // ensure our OnChildChange is called for post processing (by setting permission on ourself), 01507 // and do all pre-op processing we need to do for text 01508 if (pParam->GetDirection()!=OBJCHANGE_CALLEDBYPARENT || Flags.Attribute || Flags.TransformNode) 01509 { 01510 SetOpPermission(PERMISSION_ALLOWED); 01511 allowed=PreOpProcessing(pParam); 01512 } 01513 } 01514 else 01515 SetOpPermission(PERMISSION_DENIED,TRUE); 01516 } 01517 01518 // if we're ok so far and were asked to do a PreTriggerEdit, then 01519 // determine whether the Op may change the bounds of some nodes. 01520 // If it may, then call NameGallery::PreTriggerEdit. 01521 if (allowed && DoPreTriggerEdit) 01522 { 01523 // if the Op is non-NULL then query its MayChangeNodeBounds() method. 01524 UndoableOperation* pChangeOp = pParam->GetOpPointer(); 01525 if (pChangeOp != NULL && pChangeOp->MayChangeNodeBounds() && NameGallery::Instance()) 01526 { 01527 allowed = NameGallery::Instance()->PreTriggerEdit(pChangeOp, pParam, this); 01528 } 01529 } 01530 01531 // Ilan 8/5/00 01532 // Inform geom linked attrs of the change. 01533 if(allowed) 01534 { 01535 UndoableOperation* pChangeOp = pParam->GetOpPointer(); 01536 BOOL InformGeomLinkedAttrs = SetOpPermissionState && pChangeOp && pChangeOp->MayChangeNodeBounds(); 01537 if(InformGeomLinkedAttrs) 01538 { 01539 NodeAttribute* pNA = FindFirstGeometryLinkedAttr(); 01540 while(pNA) 01541 { 01542 pNA->LinkedNodeGeometryHasChanged(pChangeOp); 01543 pNA = pNA->FindNextGeometryLinkedAttr(); 01544 } 01545 } 01546 } 01547 01548 // return result (directly, or indirectly via a child AllowOp()) to op 01549 return allowed; 01550 }
|
|
Req'd so that the curve bit of text-on-a-curve gets AllowOp messages, thus allowing feathered curve bits to update correctly. This is a very much cut-down version of Node::AllowOp_AccountForCompound, tailored to the way TextStories behave - DON'T COPY IT! See also: Node::AllowOp_AccountForCompound(). Reimplemented from Node. Definition at line 1571 of file nodetxts.cpp. 01573 { 01574 // we only do the biz if an attr changes, or if we're transformin' or regeneratin'. 01575 ObjChangeFlags Flags = pParam->GetChangeFlags(); 01576 if (Flags.Attribute || Flags.TransformNode || Flags.RegenerateNode) 01577 { 01578 ObjChangeDirection OldDirection = pParam->GetDirection(); 01579 pParam->SetDirection(OBJCHANGE_CALLEDBYPARENT); 01580 01581 for (Node* pNode = FindFirstChild(); 01582 pNode != NULL; 01583 pNode = pNode->FindNext()) 01584 { 01585 if (pNode->IsNodePath()) 01586 pNode->AllowOp(pParam, SetOpPermissionState, DoPreTriggerEdit); 01587 } 01588 01589 pParam->SetDirection(OldDirection); 01590 } 01591 01592 return TRUE; 01593 }
|
|
This function should be called after the caret has been moved to its new location. It deletes all its previous children, and copies the children of the character to the left of it. If there isn't anything to the left then the attributes to the right are used; if there isn't anything to the right then no attributes are attached so the defaults are used. This function broacasts an attribute changed message.
Definition at line 2399 of file nodetxts.cpp. 02400 { 02401 CaretNode* pCaret = GetCaret(); 02402 BOOL Success = TRUE; 02403 BOOL TellPeople = FALSE; 02404 ERROR2IF(pCaret==NULL,FALSE,"Text story didn't have caret"); 02405 02406 // Identify where were are going to get the new attributes from 02407 VisibleTextNode* pAttributeSource = pCaret->FindPrevVTNInLine(); 02408 if (pAttributeSource == NULL) 02409 pAttributeSource = pCaret->FindNextVTNInLine(); 02410 02411 // See if the attributes are the same as the current ones 02412 /* if (pAttributeSource != NULL) 02413 { 02414 Node* pCaretChild = pCaret->FindFirstChild(); 02415 Node* pSourceChild = pAttributeSource->FindFirstChild(); 02416 02417 if ( ( (pCaretChild == NULL) && (pSourceChild != NULL) ) || 02418 ( (pCaretChild != NULL) && (pSourceChild == NULL) ) ) 02419 { 02420 TellPeople = TRUE; 02421 } 02422 02423 if ( (pCaretChild != NULL) && (pSourceChild != NULL) ) 02424 { 02425 while ((pCaretChild != NULL) && (pSourceChild != NULL)) 02426 { 02427 if ( (pCaretChild->IsAnAttribute()) && (pSourceChild->IsAnAttribute()) ) 02428 { 02429 if (! ( *((NodeAttribute*)pCaretChild) == *((NodeAttribute*)pSourceChild) )) 02430 TellPeople = TRUE; 02431 } 02432 else 02433 TellPeople = TRUE; 02434 pCaretChild = pCaretChild->FindNext(); 02435 pSourceChild = pSourceChild->FindNext(); 02436 } 02437 } 02438 } 02439 else */ 02440 TellPeople = TRUE; 02441 02442 if (pAttributeSource != NULL) 02443 { 02444 // Delete the children of the caret 02445 pCaret->DeleteChildren(pCaret->FindFirstChild()); 02446 02447 // Attempt to copy the attributes of the previous character across 02448 Node* pToCopy = pAttributeSource->FindFirstChild(CC_RUNTIME_CLASS(NodeAttribute)); 02449 while (Success && (pToCopy != NULL)) 02450 { 02451 Success = pToCopy->CopyNode(pCaret, LASTCHILD); 02452 pToCopy = pToCopy->FindNext(CC_RUNTIME_CLASS(NodeAttribute)); 02453 } 02454 } 02455 02456 // Update other people 02457 if (TellPeople) 02458 GetApplication()->FindSelection()->Update(); 02459 02460 return Success; 02461 }
|
|
Definition at line 3646 of file nodetxts.cpp. 03647 { 03648 ERROR2IF(pOutput==NULL,FALSE,"TextStory::RootComplexCopy() called with NULL output pointer"); 03649 03650 switch (Stage) 03651 { 03652 case COPYOBJECT: 03653 if (!BeingCopied) 03654 { 03655 BeingCopied = TRUE; 03656 if (Copy(RangeToCopy, pOutput)) 03657 return 1; 03658 else 03659 return -1; 03660 } 03661 return 0; 03662 break; 03663 03664 case COPYFINISHED: 03665 if (BeingCopied) 03666 { 03667 BeingCopied = FALSE; 03668 Node* pCopy = (*pOutput); 03669 if (pCopy && (IS_A(pCopy,TextStory))) 03670 ((TextStory*)pCopy)->FormatAndChildren(NULL,FALSE,FALSE); 03671 } 03672 return 0; 03673 break; 03674 03675 default: 03676 return -1; 03677 break; 03678 } 03679 }
|
|
This function handles the text story being hidden during operations such as OpDelete / OpCut / etc. The function is called indirectly via it child nodes. It should never be called directly. Its purpose is to cope with various parts of the text story being hidden. It is not possible to DoHideNodes() on a selection of the text stories children as this may leave the story in an invalid state. Hence all children ask their parent text story to sort out the problem. The function is usually called from a derived version of Node::ComplexHide().
Definition at line 3987 of file nodetxts.cpp. 03988 { 03989 ERROR2IF(pOp==NULL, -1, "Operation pointer is NULL in TextStory::BaseComplexHide()"); 03990 03991 if (!DeleteSelectedText(pOp)) 03992 return -1; 03993 03994 #if !defined(EXCLUDE_FROM_RALPH) 03995 // try to regain the caret on completion 03996 TextInfoBarOp::RegainCaretOnOpEnd(); 03997 #endif 03998 03999 return 1; 04000 }
|
|
This function is used by the convert to shapes operation. It determines if the node or any of its children can convert themselves into an InkClass object.
Also, the entry value of *pNumObjects cannot be assumed to be 0. Reimplemented from Node. Definition at line 1697 of file nodetxts.cpp. 01698 { 01699 // A TextStory can become a NodePath 01700 if (pBecomeA->BAPath()) 01701 { 01702 if (pBecomeA->IsCounting()) 01703 { 01704 // Sum the number of paths our immediate children will create 01705 Node* pNode = FindFirstDepthFirst(); 01706 while (pNode!=NULL && pNode!=this) 01707 { 01708 // Call child to update BecomeA count 01709 pNode->CanBecomeA(pBecomeA); 01710 01711 // Text chars don't have their own CanBecomeA, so count them here. 01712 if (IS_A(pNode, TextChar) && !((TextChar*)pNode)->IsAVisibleSpace()) 01713 pBecomeA->AddCount(1); 01714 01715 pNode = pNode->FindNextDepthFirst(this); 01716 } 01717 } 01718 01719 return TRUE; 01720 } 01721 01722 return FALSE; 01723 }
|
|
Reimplemented from Node. Definition at line 4518 of file nodetxts.cpp. 04519 { 04520 #ifdef DO_EXPORT 04521 return CXaraFileTxtStory::CanWriteChildrenNative(pFilter, this); 04522 #else 04523 return FALSE; 04524 #endif 04525 }
|
|
If the node does not mind the filter automatically writing out its child nodes, then return TRUE. > virtual BOOL Node::CanWriteChildrenWeb(BaseCamelotFilter* pFilter)
Reimplemented from Node. Definition at line 4509 of file nodetxts.cpp. 04510 { 04511 #ifdef DO_EXPORT 04512 return CXaraFileTxtStory::CanWriteChildrenWeb(pFilter, this); 04513 #else 04514 return FALSE; 04515 #endif 04516 }
|
|
Ensure no Linelevel attrs below line level.
Definition at line 4863 of file nodetxts.cpp. 04864 { 04865 #ifdef VALIDATE 04866 if (pLeafNode==NULL) 04867 { 04868 ERROR3("TextStory::CheckLeaf() - pNode==NULL"); 04869 return; 04870 } 04871 04872 Node* pNodeOnLeaf = pLeafNode->FindFirstChild(); 04873 while (pNodeOnLeaf!=NULL) 04874 { 04875 if (pNodeOnLeaf->IsAnAttribute()) 04876 { 04877 if ( ((NodeAttribute*)pNodeOnLeaf)->IsALineLevelAttrib() ) 04878 { 04879 if (IS_A(pLeafNode,CaretNode)) 04880 TRACE( _T("TextStory::CheckLeaf() - Line level attr applied to caret!\n")); 04881 else 04882 ERROR3("TextStory::CheckLeaf() - Line level attr applied below line level"); 04883 } 04884 } 04885 pNodeOnLeaf = pNodeOnLeaf->FindNext(); 04886 } 04887 #endif 04888 }
|
|
Validate a subtree, checking for:
Definition at line 4914 of file nodetxts.cpp. 04915 { 04916 #ifdef VALIDATE 04917 if (pNode==NULL) 04918 { 04919 ERROR3("CheckSubtree() - pNode==NULL"); 04920 return; 04921 } 04922 04923 PORTNOTE("text","Removed AfxCheckMemory") 04924 #ifndef EXCLUDE_FROM_XARALX 04925 ERROR3IF(!AfxCheckMemory(),"CheckSubtree() - memory corrupt!"); 04926 #endif 04927 04928 // get ptr to doc (if not an isolated subtree) as children are default attrs 04929 NodeDocument* pDoc = NULL; 04930 if (IS_A(pNode,NodeDocument)) 04931 pDoc = (NodeDocument*)pNode; 04932 else 04933 pDoc = (NodeDocument*)(pNode->FindParent(CC_RUNTIME_CLASS(NodeDocument))); 04934 04935 // flag attr set not yet coied - only do so if we have to as it is SLOOOW 04936 AttrTypeSet* pAttrSet = NULL; 04937 04938 BOOL ChildSelected = FALSE; 04939 BOOL ChildParentOfSel = FALSE; 04940 BOOL ChildObjectFound = FALSE; 04941 Node* pChildNode = pNode->FindFirstChild(); 04942 while (pChildNode) 04943 { 04944 TRACEIF( pChildNode->IsSelected() && pChildNode->IsParentOfSelected(), 04945 ( _T("CheckSubtree() - node (%s) both selected and parent of selected\n"), GetNodeInfo(pChildNode) ) ); 04946 ChildSelected |= pChildNode->IsSelected(); 04947 ChildParentOfSel |= pChildNode->IsParentOfSelected(); 04948 if (pChildNode->IsAnAttribute()) 04949 { 04950 // if not already done, if no Attr set passed in, create one else copy the given one 04951 if (pAttrSet==NULL) 04952 { 04953 if (pParentAttrSet==NULL) 04954 pAttrSet = new AttrTypeSet; 04955 else 04956 pAttrSet = pParentAttrSet->CopySet(); 04957 } 04958 04959 TRACEIF( ChildObjectFound, ( _T("CheckSubtree() - attribute (%s) found after child object\n"), GetNodeInfo(pChildNode) ) ); 04960 NodeAttribute* pAttr = (NodeAttribute*)pChildNode; 04961 TRACEIF(pAttr->IsSelected(), ( _T("CheckSubtree() - attribute (%s) selected\n"), GetNodeInfo(pAttr) ) ); 04962 TRACEIF(pAttr->IsParentOfSelected(),( _T("CheckSubtree() - attribute (%s) parent of selected\n"), GetNodeInfo(pAttr) ) ); 04963 if (!IS_A(pNode,CaretNode)) 04964 { 04965 // if attrbute already in set it is a duplicate of one on a parent (exc defaults) 04966 CCRuntimeClass* pAttrType = pAttr->GetAttributeType(); 04967 TRACEIF( pAttrSet->InSet(pAttrType), ( _T("CheckSubtree() - attribute (%s) duplicate of one on self (%s) or parent\n"), 04968 GetNodeInfo(pAttr),GetNodeInfo(pNode))); 04969 04970 // if not an isolated subtree and not default attr, check for duplicated default attrs 04971 if (pDoc!=NULL && pNode!=pDoc) 04972 { 04973 NodeAttribute* pDefaultAttr = (NodeAttribute*)(pDoc->FindFirstChild(pAttrType)); 04974 TRACEIF( pDefaultAttr==NULL, ( _T("CheckSubtree() - attribute (%s) found for which there is no default!\n"), 04975 GetNodeInfo(pAttr))); 04976 TRACEIF( (*pDefaultAttr)==(*pAttr), ( _T("CheckSubtree() - duplicate of default attr (%s) found!\n"), 04977 GetNodeInfo(pAttr))); 04978 } 04979 04980 // if not default doc attrs, add to attr set 04981 if (pNode!=pDoc) 04982 if (pAttrSet->AddToSet(pAttrType)==FALSE) 04983 ERROR3("CheckSubtree() - AttrTypeSet::AddToSet() failed"); 04984 } 04985 } 04986 else if (pChildNode->IsNodeHidden()) 04987 { 04988 NodeHidden* pNodeHidden = (NodeHidden*)pChildNode; 04989 TRACEIF(pNodeHidden->IsSelected() ,( _T("CheckSubtree() - hidden node (%s) selected\n"), 04990 GetNodeInfo(pChildNode))); 04991 TRACEIF(pNodeHidden->IsParentOfSelected(),( _T("CheckSubtree() - hidden node (%s) parent of selected\n"), 04992 GetNodeInfo(pChildNode))); 04993 TRACEIF(pNodeHidden->IsCompound(), ( _T("CheckSubtree() - hidden node (%s) is compound\n"), 04994 GetNodeInfo(pChildNode))); 04995 } 04996 else 04997 { 04998 Node* pNode = pChildNode; 04999 BOOL DescendantSelected = FALSE; 05000 // if not already done, if no Attr set passed in, create one else copy the given one 05001 if (pAttrSet==NULL) 05002 { 05003 if (pParentAttrSet==NULL) 05004 pAttrSet = new AttrTypeSet; 05005 else 05006 pAttrSet = pParentAttrSet->CopySet(); 05007 } 05008 CheckSubtree(pNode, pAttrSet, &DescendantSelected); 05009 TRACEIF( DescendantSelected && !pChildNode->IsParentOfSelected(), 05010 ( _T("CheckSubtree() - descendant selected but node (%s) not parent of selected\n"), GetNodeInfo(pNode))); 05011 // TRACEIF(!DescendantSelected && pNode->IsParentOfSelected(),("CheckSubtree() - node (%s) parent of selected but no descendant selected\n",GetNodeInfo(pNode))); 05012 if (!DescendantSelected && pNode->IsParentOfSelected()) 05013 TRACE( _T("CheckSubtree() - node (%s) parent of selected but no descendant selected\n"),GetNodeInfo(pNode)); 05014 ChildObjectFound = TRUE; 05015 } 05016 pChildNode = pChildNode->FindNext(); 05017 } 05018 TRACEIF( ChildObjectFound && !pNode->IsCompound(), ( _T("CheckSubtree() - child object found on non-compound node (%s)\n"), 05019 GetNodeInfo(pNode))); 05020 05021 if (pAttrSet!=NULL) 05022 { 05023 pAttrSet->DeleteAll(); 05024 delete pAttrSet; 05025 } 05026 05027 if (pDescendantSelected!=NULL) 05028 *pDescendantSelected = ChildSelected || ChildParentOfSel; 05029 #endif 05030 }
|
|
Make a copy of the text story and all children which lie inside RangeToCopy.
Definition at line 3693 of file nodetxts.cpp. 03694 { 03695 ERROR2IF(pOutput==NULL,FALSE,"TextStory::Copy() called with NULL output pointer"); 03696 03697 /* Notes: ok, at this stage, each object in the copy range has been called with 03698 MakeAttributesComplete() apart from those that state they are complex 03699 copy nodes. Here I expect simply to make attributes complete on the 03700 text story and assume the rest of the subtree is correct. Until I changed this 03701 OpCopy used to MakeAttributesComplete on the whole selected range. This was a 03702 problem, as we are actually copying more than the selected range. We are in 03703 effect grouping the selected range under a parent. On pasting, the paste code 03704 only (sensibly) normalises on all first level siblings and hence misses our 03705 'grouped' children, the result being all selected characters having thousands of 03706 atts applied to them which cannot be factored out. 03707 */ 03708 03709 // copy the story 03710 TextStory* pStoryCopy = (TextStory*)SimpleCopy(); 03711 BOOL ok = (pStoryCopy!=NULL); 03712 03713 // Make the attrs complete so we can copy the story correctly 03714 if (ok) ok = MakeAttributeComplete(); 03715 if (ok) 03716 { 03717 // Mark all nodes in this current range // why is this not part of SetStoryMarkers?! 03718 Node* pNode = RangeToCopy.FindFirst(TRUE); 03719 while (pNode) 03720 { 03721 pNode->SetMarker(TRUE); 03722 pNode=RangeToCopy.FindNext(pNode,TRUE); 03723 } 03724 03725 // specifically set the flags to copy the correct nodes 03726 SetStoryMarkers(RangeToCopy); 03727 ok = CopyChildrenTo(pStoryCopy, ccMARKED); 03728 03729 // Now that EOLNodes take attributes we have all sorts of bother with the last EOL. 03730 // The user can't put attributes onto it. We must copy 03731 // the attributes applied to the ATC prior to the last EOL onto the EOL. 03732 if (ok) 03733 { 03734 VisibleTextNode* pLastNode = pStoryCopy->FindLastVTN(); 03735 AbstractTextChar* pPrevLast = NULL; 03736 if (pLastNode!=NULL) 03737 pPrevLast = (AbstractTextChar*)pLastNode->FindPrevious(CC_RUNTIME_CLASS(AbstractTextChar)); 03738 if (pLastNode!=NULL && pPrevLast!=NULL) 03739 { 03740 // Clear out any attributes off the last EOLNode 03741 Node* pLastChild = pLastNode->FindFirstChild(); 03742 if (pLastChild!=NULL) 03743 pLastNode->DeleteChildren(pLastChild); 03744 03745 // Copy the correct ones onto it. 03746 if (pPrevLast->FindFirstChild() != NULL) 03747 ok = pPrevLast->CopyChildrenTo(pLastNode); 03748 } 03749 } 03750 03751 // Mark all nodes in this current range // is this not made redundant by ClearMarks()?! 03752 pNode = RangeToCopy.FindFirst(TRUE); 03753 while (pNode) 03754 { 03755 pNode->SetMarker(FALSE); 03756 pNode=RangeToCopy.FindNext(pNode,TRUE); 03757 } 03758 03759 ClearMarks(); // clear flags on source story 03760 pStoryCopy->ClearMarks(); // clear flags on destination story 03761 ResetEOLs(FALSE); // make EOLs physical again (ie not virtual!) // why does this take a param?! 03762 NormaliseAttributes(); // on source story // why not dest? 03763 } 03764 03765 // unwrap the story on the clipboard 03766 if (ok) ok = pStoryCopy->UnWrapStory(NULL); 03767 03768 // insert a caret into the copied story 03769 CaretNode* pCaret = NULL; 03770 VisibleTextNode* pAttachNode = NULL; 03771 if (ok) pAttachNode = pStoryCopy->FindFirstVTN(); 03772 ok = (pAttachNode!=NULL); 03773 if (ok) pCaret = new CaretNode; 03774 ok = (pCaret!=NULL); // should an error be set if caret not created? 03775 if (ok) pCaret->AttachNode(pAttachNode, PREV); 03776 03777 // if we failed but a story copy was created, delete it 03778 if (!ok && pStoryCopy!=NULL) 03779 { 03780 pStoryCopy->CascadeDelete(); 03781 delete pStoryCopy; 03782 pStoryCopy = NULL; 03783 } 03784 03785 *pOutput = pStoryCopy; 03786 return ok; 03787 }
|
|
This method copies the node's contents to the node pointed to by NodeCopy.
Definition at line 1179 of file nodetxts.cpp. 01180 { 01181 // Ask the base class to do its bit 01182 BaseTextClass::CopyNodeContents(NodeCopy); 01183 01184 // Copy the rest of the data (which should not be that set by the default constructor?) 01185 NodeCopy->StoryMatrix = StoryMatrix; 01186 01187 NodeCopy->StoryWidth = StoryWidth; 01188 01189 NodeCopy->TextOnPathReversed = TextOnPathReversed; 01190 NodeCopy->TextOnPathTangential = TextOnPathTangential; 01191 NodeCopy->PrintAsShapes = PrintAsShapes; 01192 NodeCopy->WordWrapping = WordWrapping; 01193 01194 NodeCopy->ImportFormatWidth = ImportFormatWidth; 01195 NodeCopy->ImportBaseShift = ImportBaseShift; 01196 01197 NodeCopy->CharsScale = CharsScale; 01198 NodeCopy->CharsAspect = CharsAspect; 01199 NodeCopy->CharsRotation = CharsRotation; 01200 NodeCopy->CharsShear = CharsShear; 01201 01202 NodeCopy->mLeftIndent = mLeftIndent; 01203 NodeCopy->mRightIndent = mRightIndent; 01204 01205 NodeCopy->AutoKern = AutoKern; 01206 }
|
|
Definition at line 3189 of file nodetxts.cpp. 03190 { 03191 TextLine* pTextLine = this->FindFirstLine(); 03192 ERROR2IF(pTextLine==NULL,FALSE,"TextStory::CorelStyleBaselineShift() - couldn't find text line in story"); 03193 MILLIPOINT BaselineShift=0; 03194 MILLIPOINT LineAscent=(pTextLine->GetLineAscent()*4)/5; 03195 switch (BaseShift) 03196 { 03197 case AlignAscenders: BaselineShift=-LineAscent; break; 03198 case AlignDescenders: BaselineShift=-pTextLine->GetLineDescent(); break; 03199 case AlignCentres: BaselineShift=(-LineAscent-pTextLine->GetLineDescent())/2; break; 03200 default: break; 03201 } 03202 TxtBaseLineAttribute BaselineAttr(BaselineShift); 03203 BOOL ok = ((AttributeValue*)&BaselineAttr)->MakeNode(this,FIRSTCHILD) != NULL; 03204 03205 return ok; 03206 }
|
|
Create a TextStory from an array of chars OR WCHARs and optionally account for control codes and a LogFont (ie size/aspect/bold/italic/typeface/rotation).
Definition at line 4026 of file nodetxts.cpp. 04028 { 04029 ERROR2IF(pChars==NULL && pWChars==NULL || pChars!=NULL && pWChars!=NULL, NULL, 04030 "TextStory::CreateFromCharArray() - must specify one and only one char array"); 04031 ERROR2IF(pCreateDoc==NULL, NULL, "No creation document"); 04032 04033 // create an empty text story, getting pointers to TextLine and Caret 04034 TextStory* pTextStory=TextStory::CreateTextObject(Pos); 04035 TextLine* pTextLine =NULL; 04036 CaretNode* pCaretNode=NULL; 04037 BOOL ok=(pTextStory!=NULL); 04038 if (ok) 04039 { 04040 pTextLine = pTextStory->FindFirstLine(); 04041 if (pTextLine!=NULL) 04042 pCaretNode=pTextLine->FindCaret(); 04043 if (pCaretNode==NULL) 04044 { 04045 ok=FALSE; 04046 ERROR2RAW("TextStory::CreateFromChars() - failed to find TextLine or Caret"); 04047 } 04048 } 04049 04050 // Put the current attributes onto the story 04051 if (ok) 04052 ok = pCreateDoc->GetAttributeMgr().ApplyCurrentAttribsToNode(pTextStory); 04053 04054 // Before forcing on attributes we need to delete the current instances first 04055 if (ok) 04056 ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrFillGeometry)); 04057 // if (ok) 04058 // ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrStrokeTransp)); 04059 if (ok) 04060 ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrLineWidth)); 04061 if (ok) 04062 ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrStrokeColour)); 04063 04064 // add black fill colour, no/transparent line colour, 0.25pt line width attributes 04065 if (ok) 04066 { 04067 FlatFillAttribute FlatFillAttr(pColour!=NULL ? *pColour : AttributeManager::DefaultBlack); 04068 StrokeTranspAttribute StrokeTranspAttr(255); 04069 LineWidthAttribute LineWidthAttr(250); 04070 if (ok) ok = ((AttributeValue*) &FlatFillAttr)->MakeNode(pTextLine,PREV) != NULL; 04071 // if (ok) ok = ((AttributeValue*)&StrokeTranspAttr)->MakeNode(pTextLine,PREV) != NULL; 04072 if (ok) ok = ((AttributeValue*) &LineWidthAttr)->MakeNode(pTextLine,PREV) != NULL; 04073 // BODGE TEXT - this is the only way this attribute will work!!!! 04074 AttributeValue* pAttr=NULL; 04075 DocColour trans(COLOUR_TRANS); 04076 if (ok) ok = NULL!=(pAttr=new StrokeColourAttribute(trans)); 04077 if (ok) ok = NULL!=pAttr->MakeNode(pTextLine,PREV); 04078 if (pAttr!=NULL) delete pAttr; 04079 } 04080 04081 // if we have a LogFont, set story rotation, add typeface, size, aspect, bold, italic attributes 04082 if (ok && pLogFont!=NULL) 04083 { 04084 // Delete the current instances of the attribute first 04085 if (ok) 04086 ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrTxtFontTypeface)); 04087 if (ok) 04088 ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrTxtFontSize)); 04089 if (ok) 04090 ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrTxtAspectRatio)); 04091 if (ok) 04092 ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrTxtBold)); 04093 if (ok) 04094 ok = DeleteChildAttribute(pTextStory, CC_RUNTIME_CLASS(AttrTxtItalic)); 04095 04096 if (ok) 04097 { 04098 FontInfo info; 04099 ok=TextManager::GetInfoFromLogFont(&info,pLogFont); 04100 if (ok) 04101 { 04102 Matrix StoryMatrix(info.Rotation); 04103 StoryMatrix.translate(Pos.x,Pos.y); 04104 pTextStory->SetStoryMatrix(StoryMatrix); 04105 04106 TxtFontTypefaceAttribute FontAttr(info.Handle); 04107 TxtFontSizeAttribute SizeAttr(info.Size); 04108 TxtAspectRatioAttribute AspectAttr(info.Aspect); 04109 TxtBoldAttribute BoldAttr(info.Bold); 04110 TxtItalicAttribute ItalicAttr(info.Italic); 04111 if (ok) ok = ((AttributeValue*) &FontAttr)->MakeNode(pTextLine,PREV) != NULL; 04112 if (ok) ok = ((AttributeValue*) &SizeAttr)->MakeNode(pTextLine,PREV) != NULL; 04113 if (ok) ok = ((AttributeValue*)&AspectAttr)->MakeNode(pTextLine,PREV) != NULL; 04114 if (ok) ok = ((AttributeValue*) &BoldAttr)->MakeNode(pTextLine,PREV) != NULL; 04115 if (ok) ok = ((AttributeValue*)&ItalicAttr)->MakeNode(pTextLine,PREV) != NULL; 04116 } 04117 } 04118 } 04119 04120 // insert each char before the caret 04121 INT32 index=0; 04122 WCHAR LastChar=0; 04123 while (ok) 04124 { 04125 // get a char from the appropriate array, increase index, exitting if none left 04126 WCHAR ch = 0; 04127 if (pChars==NULL) 04128 ch = pWChars[index++] ; 04129 else 04130 { 04131 // Read the next character from the array 04132 if (UnicodeManager::IsDBCSOS() && UnicodeManager::IsDBCSLeadByte(pChars[index])) 04133 { 04134 ch = UnicodeManager::ComposeMultiBytes(pChars[index], pChars[index+1]); 04135 index += 2; 04136 } 04137 else 04138 { 04139 ch = (unsigned char)(pChars[index]); 04140 index += 1; 04141 } 04142 04143 // Convert into Unicode if it's not a control char 04144 if ((pChars != NULL) && (ch>=32 && ch!=127)) 04145 ch = UnicodeManager::MultiByteToUnicode(ch); 04146 } 04147 04148 if (ch=='\0') 04149 break; 04150 04151 // if not a control code, just insert the char to the left of the caret 04152 // else, if handling control codes, do what is required 04153 if (ch>=32 && ch!=127) 04154 { 04155 TextChar* pTextChar = new TextChar(pCaretNode, PREV, ch); 04156 ok=(pTextChar!=NULL); 04157 } 04158 else if (ControlCodes) 04159 { 04160 switch (ch) 04161 { 04162 case '\n': 04163 { 04164 // Give the progress system a chance to update its displays 04165 ContinueSlowJob(); 04166 04167 // if part of '\r\n' pair ignore it as already insereted new line, 04168 // else continue into '\r' case and insert a new line 04169 if (LastChar=='\r') 04170 break; 04171 } 04172 case '\r': // insert a new line 04173 { 04174 pTextLine = TextLine::CreateEmptyTextLine(pTextLine, NEXT); 04175 ok=(pTextLine!=NULL); 04176 if (ok) pCaretNode->MoveNode(pTextLine,FIRSTCHILD); 04177 break; 04178 } 04179 case '\t': // insert a horizontal tab 04180 { 04181 HorizontalTab* pTab = new HorizontalTab(pCaretNode, PREV); 04182 ok = (pTab != NULL); 04183 break; 04184 } 04185 default: 04186 TRACE( _T("Control Code %d, not yet supported\n"),ch); 04187 } 04188 } 04189 LastChar=ch; 04190 } 04191 04192 if (ok) 04193 { 04194 EOLNode* pLastEOL=(EOLNode*)(pCaretNode->FindNext()); 04195 ok=(pLastEOL!=NULL); 04196 if (ok) 04197 pLastEOL->SetVirtual(TRUE); 04198 else 04199 ERROR2RAW("TextStory::CreateFromChars() - couldn't EOL after caret!"); 04200 } 04201 04202 // if we failed to finish the job, tidy up 04203 if (!ok) 04204 { 04205 pTextStory->CascadeDelete(); 04206 delete pTextStory; 04207 pTextStory=NULL; 04208 } 04209 04210 return pTextStory; 04211 }
|
|
Creates a Text object.
Definition at line 1272 of file nodetxts.cpp. 01273 { 01274 // Pointers to objects we will create to construct a TextStory 01275 TextStory* pTextStory = NULL; 01276 TextLine* pTextLine = NULL; 01277 // CaretNode* pCaret = NULL; 01278 // EOLNode* pEOLN = NULL; 01279 BOOL ok = TRUE; 01280 01281 // Try to create the root TextStory node 01282 pTextStory = new TextStory(); 01283 ok = (pTextStory != NULL); 01284 01285 // Set the matrix so that the origin is translated to the start point 01286 if (ok) 01287 pTextStory->SetStoryMatrix(TheMatrix); 01288 01289 // Create a line for the story 01290 if (ok) 01291 { 01292 pTextLine = new TextLine(pTextStory, LASTCHILD); 01293 ok = (pTextLine != NULL); 01294 } 01295 01296 // Add an EOLNode to the line 01297 if (ok) 01298 ok = (new EOLNode(pTextLine, FIRSTCHILD) != NULL); 01299 01300 // Create the TextStory's Caret node 01301 if (ok) 01302 ok = (new CaretNode(pTextLine, FIRSTCHILD) != NULL); 01303 01304 // Clean up if failure 01305 if (!ok && (pTextStory != NULL)) 01306 { 01307 pTextStory->CascadeDelete(); 01308 delete pTextStory; 01309 pTextStory = NULL; 01310 } 01311 01312 return pTextStory; 01313 }
|
|
Creates a Text object.
Definition at line 1254 of file nodetxts.cpp. 01255 { 01256 Matrix StoryMat(Anchor.x, Anchor.y); 01257 return CreateTextObject(StoryMat); 01258 }
|
|
Create a copy of the story's path removing the Story matrix transform Also, reverse path if text is reversed on the path Note: This should really be broken up into member functions of Path.
Definition at line 3242 of file nodetxts.cpp. 03243 { 03244 ERROR2IF(pStoryInfo==NULL,FALSE,"TextStory::CreateUntransformedPath() - pStoryInfo==NULL"); 03245 03246 // get pointers to info in text story's NodePath 03247 NodePath* pNodePath = GetTextPath(); 03248 ERROR2IF(pNodePath==NULL,FALSE,"TextStory::CreateUntransformedPath() - the TextStory has no path!!"); 03249 INT32 NumCoords = pNodePath->InkPath.GetNumCoords(); 03250 DocCoord* pNodePathCoords = pNodePath->InkPath.GetCoordArray(); 03251 PathVerb* pNodePathVerbs = pNodePath->InkPath.GetVerbArray(); 03252 BOOL ok = (NumCoords>=2 && pNodePathCoords!=NULL && pNodePathVerbs!=NULL); 03253 ERROR2IF(!ok,FALSE,"TextStory::CreateUntransformedPath() - problem with NodePath in story"); 03254 03255 // create a copy of the transformed path 03256 Path* pPath = new Path; 03257 ERROR2IF(pPath==NULL,FALSE,"TextStory::CreateUntransformedPath() - failed to crete path"); 03258 if (ok) ok=pPath->Initialise(NumCoords, 12); 03259 if (ok) ok=pPath->CopyPathDataFrom(pNodePathCoords, pNodePathVerbs, NumCoords, TRUE); 03260 DocCoord* pPathCoords = NULL; 03261 PathVerb* pPathVerbs = NULL; 03262 if (ok) 03263 { 03264 pPathCoords = pPath->GetCoordArray(); 03265 pPathVerbs = pPath->GetVerbArray(); 03266 ok = (pPathCoords!=NULL && pPathVerbs!=NULL); 03267 if (!ok) ERROR2RAW("TextStory::CreateUntransformedPath() - Problem copying path"); 03268 } 03269 03270 // if text reversed on path, reverse path 03271 if (ok && IsTextOnPathReversed()) 03272 pPath->Reverse(); 03273 03274 // remove the story transform from the copy of the path 03275 if (ok) 03276 { 03277 Matrix matrix = GetStoryMatrix(); 03278 matrix = matrix.Inverse(); 03279 matrix.transform((Coord*)pPathCoords, NumCoords); 03280 } 03281 03282 // find the untransformed path length 03283 if (ok) 03284 { 03285 double fPathLength = 0; 03286 ProcessLength PathLengthProcess(64); 03287 ok = PathLengthProcess.PathLength(pPath, &fPathLength); 03288 pStoryInfo->PathLength = (MILLIPOINT)(fPathLength+0.5); 03289 } 03290 03291 // determine if the path is closed 03292 if (ok) 03293 pStoryInfo->PathClosed = ( (pPathVerbs[NumCoords-1] & PT_CLOSEFIGURE) != 0); 03294 03295 // determine direction of perpendicular to first point (downwards) 03296 if (ok) 03297 { 03298 // get the x,y offsets ratios for the line position at a perpendicular to the first point on the path ... 03299 double dx = pPathCoords[1].x-pPathCoords[0].x; 03300 double dy = pPathCoords[1].y-pPathCoords[0].y; 03301 double LineLength = sqrt(dx*dx+dy*dy); 03302 pStoryInfo->UnitDirectionVectorX = -dy/LineLength; 03303 pStoryInfo->UnitDirectionVectorY = dx/LineLength; 03304 } 03305 03306 pStoryInfo->LeftPathIndent = GetLeftIndent(); 03307 pStoryInfo->RightPathIndent = GetRightIndent(); 03308 03309 // if not ok and we created a path, delete it 03310 if (!ok && pPath!=NULL) 03311 { 03312 delete pPath; 03313 pPath=NULL; 03314 } 03315 03316 // set output 03317 pStoryInfo->pPath = pPath; 03318 03319 return ok; 03320 }
|
|
Finds and deletes a child attribute of the given type.
Definition at line 5066 of file nodetxts.cpp. 05067 { 05068 ERROR2IF(pParent==NULL || pReqdAttrib==NULL, FALSE, "NULL parameter"); 05069 05070 NodeAttribute* pAppliedAttr = pParent->GetChildAttrOfType(pReqdAttrib); 05071 05072 ERROR3IF(pAppliedAttr==NULL, "Attribute not found"); 05073 05074 if (pAppliedAttr != NULL) 05075 { 05076 pAppliedAttr->CascadeDelete(); 05077 delete pAppliedAttr; 05078 } 05079 05080 return TRUE; 05081 }
|
|
Delete all selected text objects in story, deleteing whole lines where possible.
Definition at line 3445 of file nodetxts.cpp. 03446 { 03447 #if !defined(EXCLUDE_FROM_RALPH) 03448 ERROR2IF(pUndoOp==NULL,FALSE,"TextStory::DeleteSelectedText() - pUndoOp==NULL"); 03449 BOOL ok = DeleteSelectedTextLines(pUndoOp); 03450 if (ok) ok = DeleteSelectedTextCharacters(pUndoOp); 03451 return ok; 03452 #else 03453 return FALSE; 03454 #endif 03455 }
|
|
delete all (remaining) selected VTN in story, joining lines if EOL deleted and story not word wrapping
Definition at line 3553 of file nodetxts.cpp. 03554 { 03555 #if !defined(EXCLUDE_FROM_RALPH) 03556 ERROR2IF(pUndoOp==NULL,FALSE,"TextStory::DeleteSelectedTextCharacters() - pUndoOp==NULL"); 03557 03558 // get a set of non line level attrs on this story, which are to be localised to char level 03559 AttrTypeSet NonLineLevelAttrs; 03560 BOOL ok = this->AddNonLineLevelDescendantAttrsToSet(&NonLineLevelAttrs); 03561 03562 // delete all the selected chars (except caret) in the story, joining line if EOL deleted 03563 TextLine* pLine = this->FindFirstLine(); 03564 ERROR2IF(pLine==NULL,FALSE,"TextStory::DeleteSelectedTextCharacters() - story has no lines"); 03565 while (ok && pLine!=NULL) 03566 { 03567 BOOL AttrsLocalisedOnLine = FALSE; 03568 VisibleTextNode* pVTN = pLine->FindFirstVTN(); 03569 ERROR2IF(pVTN==NULL,FALSE,"TextStory::DeleteSelectedTextCharacters() - line has no VTN"); 03570 while (ok && pVTN!=NULL) 03571 { 03572 // ensure last EOL in story not selected (so not deleted) 03573 if (pVTN->IsAnEOLNode() && pVTN->IsSelected() && pLine->FindNextLine()==NULL) 03574 { 03575 ERROR3("TextStory::DeleteSelectedTextCharacters() - last EOL of the story selected"); 03576 pVTN->DeSelect(FALSE); 03577 } 03578 03579 // if char not to be deleted, skip to next char, else ... 03580 if (!pVTN->IsSelected() || pVTN->IsACaret()) 03581 pVTN = pVTN->FindNextVTNInLine(); 03582 else 03583 { 03584 // if attrs not already loaclised on this line, do so 03585 if (!AttrsLocalisedOnLine) 03586 ok = pUndoOp->DoLocaliseCommonAttributes(pLine,FALSE,TRUE,&NonLineLevelAttrs); 03587 AttrsLocalisedOnLine = TRUE; 03588 03589 // if deleting EOL move all chars from next line to end of this and hide next line 03590 if (pVTN->IsAnEOLNode()) 03591 { 03592 TextLine* pNextLine = pLine->FindNextLine(); 03593 ERROR2IF(pNextLine==NULL,FALSE,"TextStory::DeleteSelectedTextCharacters() - trying to delete last EOL in story!"); 03594 VisibleTextNode* pFirstVTN = pNextLine->FindFirstVTN(); 03595 VisibleTextNode* pLastVTN = pNextLine->FindLastVTN(); 03596 ERROR2IF(pFirstVTN==NULL || pLastVTN==NULL,FALSE,"TextStory::DeleteSelectedTextCharacters() - no VTN on next line"); 03597 03598 if (ok) ok = pUndoOp->DoLocaliseCommonAttributes(pNextLine,FALSE,TRUE,&NonLineLevelAttrs); 03599 if (ok) ok = pFirstVTN->DoMoveNodes(pUndoOp,pLastVTN,pLine,LASTCHILD); 03600 if (ok) ok = pNextLine->DoHideNode(pUndoOp); 03601 } 03602 03603 // hide VTN, getting pointer to next 03604 VisibleTextNode* pNextVTN = pVTN->FindNextVTNInLine(); 03605 if (ok) ok = pVTN->DoHideNode(pUndoOp); 03606 pVTN = pNextVTN; 03607 } 03608 } 03609 // if ok and attrs were localised on the line, factor out 03610 if (ok && AttrsLocalisedOnLine) 03611 ok = pUndoOp->DoFactorOutCommonChildAttributes(pLine,TRUE,&NonLineLevelAttrs); 03612 03613 pLine = pLine->FindNextLine(); 03614 } 03615 03616 return ok; 03617 #else 03618 return FALSE; 03619 #endif 03620 }
|
|
Called by DeleteSelectedText to delete all selected TextLines (including TextLines will all children selected).
Definition at line 3469 of file nodetxts.cpp. 03470 { 03471 #if !defined(EXCLUDE_FROM_RALPH) 03472 ERROR2IF(pUndoOp==NULL,FALSE,"TextStory::DeleteSelectedTextLines() - pUndoOp==NULL"); 03473 03474 // Delete all selected lines except the last one 03475 BOOL AttrsLocalisedOnStory = FALSE; 03476 TextLine* pLine = this->FindFirstLine(); 03477 ERROR2IF(pLine==NULL,FALSE,"TextStory::DeleteSelectedTextLines() - story has no lines"); 03478 while (pLine!=NULL) 03479 { 03480 TextLine* pNextLine = pLine->FindNextLine(); 03481 if (pLine->WholeLineSelected()) 03482 { 03483 // If caret on line to be deleted, move it to next line 03484 CaretNode* pCaret = pLine->FindCaret(); 03485 if (pCaret!=NULL) 03486 { 03487 BaseTextClass* pAttachNode = NULL; 03488 AttachNodeDirection AttachDir = PREV; 03489 TextLine* pPrevLine = pLine->FindPrevLine(); 03490 if (pNextLine!=NULL) 03491 { 03492 pAttachNode = pNextLine->FindFirstVTN(); 03493 ERROR2IF(pAttachNode==NULL,FALSE,"TextStory::DeleteSelectedTextLines() - text line has no VTN"); 03494 AttachDir = PREV; 03495 } 03496 else if (pPrevLine!=NULL) 03497 { 03498 pAttachNode = pPrevLine->FindLastVTN(); 03499 ERROR2IF(pAttachNode==NULL,FALSE,"TextStory::DeleteSelectedTextLines() - text line has no VTN"); 03500 if (IS_A(pAttachNode,EOLNode)) 03501 AttachDir = PREV; 03502 else 03503 AttachDir = NEXT; 03504 } 03505 else // deleting only line in story, so create a new one 03506 { 03507 pAttachNode = TextLine::CreateEmptyTextLine(); 03508 if (pAttachNode==NULL) 03509 return FALSE; 03510 if (!pUndoOp->DoInsertNewNode(pAttachNode,pLine,NEXT, FALSE,FALSE,FALSE,FALSE)) 03511 return FALSE; 03512 AttachDir = FIRSTCHILD; 03513 } 03514 03515 if (!PositionCaretAction::DoStoreCaretPosition(pUndoOp,this)) 03516 return FALSE; 03517 pCaret->MakeAttributeComplete(); 03518 pCaret->MoveNode(pAttachNode,AttachDir); // caret should not be selected 03519 pCaret->NormaliseAttributes(); 03520 } 03521 03522 // if not already localised, loaclise attrs on story, then hide line 03523 if (!AttrsLocalisedOnStory) 03524 if (!pUndoOp->DoLocaliseCommonAttributes(this,FALSE,TRUE)) 03525 return FALSE; 03526 AttrsLocalisedOnStory = TRUE; 03527 if (!pLine->DoHideNode(pUndoOp)) 03528 return FALSE; 03529 } 03530 pLine = pNextLine; 03531 } 03532 03533 // if attrs were loaclised on story, factor out 03534 if (AttrsLocalisedOnStory) 03535 if (!pUndoOp->DoFactorOutCommonChildAttributes(this, TRUE)) 03536 return FALSE; 03537 #endif 03538 return TRUE; 03539 }
|
|
Gives a description of the TextStory node for the status line etc.
Reimplemented from Node. Definition at line 1219 of file nodetxts.cpp. 01220 { 01221 if (Plural) 01222 return(String(_R(IDS_DESCRIBE_TEXTSTORYP))); 01223 else 01224 return(String(_R(IDS_DESCRIBE_TEXTSTORYS))); 01225 }
|
|
Transforms the object into another type of object.
Reimplemented from Node. Definition at line 1736 of file nodetxts.cpp. 01737 { 01738 01739 // BODGE TEXT - pass back should delete nodes if it fails - though MarkN claimed not when I wrote this! 01740 01741 ERROR2IF(pBecomeA==NULL,FALSE,"TextStory::DoBecomeA() - pBecomeA==NULL"); 01742 01743 // here to overcome scope problem 01744 Node* pNode=NULL; 01745 01746 // create a format region to keep an attribute stack 01747 FormatRegion FRegion; 01748 FormatRegion* pFormatRegion=&FRegion; 01749 if (pFormatRegion->Init(this)==FALSE) 01750 return FALSE; 01751 pFormatRegion->SaveContext(); 01752 01753 // if not passing back, create a NodeGroup to encompass the story 01754 // BODGE - should use ALLOC_WITH_FAIL 01755 NodeGroup* pStoryNodeGroup=NULL; 01756 if (pBecomeA->GetReason()!=BECOMEA_PASSBACK) 01757 { 01758 pStoryNodeGroup=new NodeGroup; 01759 if (pStoryNodeGroup==NULL) 01760 goto Fail; 01761 01762 // render story level attrs and copy non-text attrs 01763 pNode=FindFirstChild(); 01764 while (pNode) 01765 { 01766 if (pNode->IsAnAttribute()) 01767 { 01768 pNode->Render(pFormatRegion); // render attributes 01769 if (!pNode->IsKindOfTextAttribute()) 01770 if (pNode->CopyNode(pStoryNodeGroup, LASTCHILD)==FALSE) 01771 goto Fail; 01772 } 01773 pNode=pNode->FindNext(); 01774 } 01775 } 01776 01777 // convert all the story's childs either attaching to the StoryNodeGroup or PassingBack 01778 pNode=FindFirstChild(); 01779 while (pNode) 01780 { 01781 // convert all TextLines to groups (inc attrs and chars) 01782 if (IS_A(pNode,TextLine)) 01783 { 01784 TextLine* pTextLine=(TextLine*)pNode; 01785 NodeGroup* pLineNodeGroup=NULL; 01786 if (pTextLine->CreateNodeGroup(&pLineNodeGroup,pFormatRegion,pBecomeA)==FALSE) 01787 goto Fail; 01788 if (pBecomeA->GetReason()!=BECOMEA_PASSBACK) 01789 pLineNodeGroup->AttachNode(pStoryNodeGroup,LASTCHILD); 01790 } 01791 // copy any NodePath with it's children attrs 01792 if (pNode->IsNodePath()) 01793 { 01794 NodePath* pNodePath=(NodePath*)pNode; 01795 NodePath* pNodePathCopy=(NodePath*)pNodePath->SimpleCopy(); 01796 if (pNodePathCopy==NULL) 01797 goto Fail; 01798 if (pNodePath->CopyChildrenTo(pNodePathCopy)==FALSE) 01799 goto Fail; 01800 if (pBecomeA->GetReason()!=BECOMEA_PASSBACK) 01801 { 01802 pNodePathCopy->AttachNode(pStoryNodeGroup,LASTCHILD); 01803 pBecomeA->PassBack(pNodePathCopy, pNodePath); 01804 } 01805 else 01806 if (pBecomeA->PassBack(pNodePathCopy,pNodePath)==FALSE) 01807 goto Fail; 01808 } 01809 pNode=pNode->FindNext(); 01810 } 01811 01812 // Must do this here or else the current attributes in the region 01813 // will have been deleted 01814 pFormatRegion->RestoreContext(); 01815 01816 // now either insert the replace the story or pass it back 01817 switch (pBecomeA->GetReason()) 01818 { 01819 case BECOMEA_REPLACE: 01820 { 01821 UndoableOperation* pUndoOp = pBecomeA->GetUndoOp(); 01822 01823 // Deselect the node 01824 SetSelected(TRUE); // ensures all children are deselected 01825 SetSelected(FALSE); 01826 01827 // are we undoable or not ... 01828 if (pUndoOp!=NULL) 01829 { 01830 // hide the text story 01831 NodeHidden* pNodeHidden; 01832 if (pUndoOp->DoHideNode(this,FALSE,&pNodeHidden)==FALSE) 01833 goto FailNoRestore; 01834 // Insert the NodeGroup next to the old hidden TextStory 01835 if (!pUndoOp->DoInsertNewNode(pStoryNodeGroup,pNodeHidden,NEXT,FALSE,FALSE,FALSE,FALSE)) 01836 goto FailNoRestore; 01837 01838 } 01839 else 01840 { 01841 // attach the NodeGroup next to the text story, then delete 'this' TextStory - eek! 01842 pStoryNodeGroup->AttachNode(this,NEXT); 01843 CascadeDelete(); 01844 delete this; 01845 } 01846 01847 // Select the group, but only if the caller wants us too (moulds don't, for example) 01848 if (pBecomeA->Reselect() && pUndoOp!=NULL) 01849 if (!pUndoOp->DoSelectNode(pStoryNodeGroup,FALSE)) 01850 return FALSE; 01851 01852 break; 01853 } 01854 01855 case BECOMEA_PASSBACK: 01856 // all pass back done by children! 01857 break; 01858 01859 default: 01860 ERROR2_PF(FALSE,("Unknown BecomeA reason %d",pBecomeA->GetReason())); 01861 break; 01862 } 01863 01864 return TRUE; 01865 01866 01867 Fail: 01868 pFormatRegion->RestoreContext(); 01869 01870 FailNoRestore: 01871 if (pStoryNodeGroup) 01872 { 01873 pStoryNodeGroup->CascadeDelete(); 01874 delete pStoryNodeGroup; 01875 } 01876 01877 return TRUE; 01878 }
|
|
Makes sure the story has a caret node. > BOOL TextStory::EnsureStoryHasCaret()
Definition at line 3056 of file nodetxts.cpp. 03057 { 03058 TextLine* pFirstLine = FindFirstLine(); 03059 TextLine* pLine = pFirstLine; 03060 03061 if (pFirstLine != NULL) 03062 { 03063 // Scan all the lines looking for a caret node 03064 while (pLine != NULL) 03065 { 03066 // Does the line have a caret? 03067 if (pLine->FindCaret() != NULL) 03068 return TRUE; 03069 03070 // Get next line 03071 pLine = pLine->FindNextLine(); 03072 } 03073 03074 // No caret in the text story, so lets stick one in the first line 03075 // just before the first visible text node 03076 VisibleTextNode* pVTN = pFirstLine->FindFirstVTN(); 03077 if (pVTN != NULL) 03078 { 03079 CaretNode* pCaret = new CaretNode(pVTN,PREV); 03080 if (pCaret != NULL) 03081 return TRUE; 03082 } 03083 } 03084 03085 return FALSE; 03086 }
|
|
Expands any strings that were imported into a series of text characters.
The whole string is then saved (in an ImportedString object), along with the inserted text char node, until post-import. Post-import then inserts text chars for the rest of the string next to the first text char of the string, copying child attrs from the first char to each of the string's remaining chars, to ensure that they look correct. Why do this on post import? Why not do it when you get a string record from the file? Well, at the point that the string record is read, we don't know what child attrs will be applied to it, because, if there are any child attrs, they will appear later in the file. There are a number of ways to do it, but they all involve doing something to the string after* you know that the child attrs have been read in. Post-import was considered a good place because the necessary processing can be done before the story is formatted, it doesn't assume anything about the order of records in the file format, and it was a Tuesday. Definition at line 4640 of file nodetxts.cpp. 04641 { 04642 // If the list is empty, get out of here, now! 04643 if (pImportedStringList == NULL) 04644 return TRUE; 04645 04646 BOOL ok = TRUE; 04647 04648 // Expand each string in the list 04649 ImportedString* pImportedString = pImportedStringList->GetHead(); 04650 while (ok && pImportedString != NULL) 04651 { 04652 // get the char node, and a copy of the original record 04653 TextChar* pChar = pImportedString->GetFirstChar(); 04654 CXaraFileRecord* pRecord = pImportedString->GetRecord(); 04655 04656 if (pChar != NULL && pRecord != NULL) 04657 { 04658 WCHAR wChar; 04659 04660 // The first char is read and discarded because pChar contains the char. 04661 ok = pRecord->ReadWCHAR(&wChar); 04662 04663 // Find out the size of the record (and hence the num chars in the string) 04664 // Num chars = Size/2 (Unicode - double byte chars) 04665 UINT32 Size = pRecord->GetSize(); 04666 04667 // We only iterate until Size <=2, because we have read and discarded the first 04668 // char in the string. 04669 for (;ok && Size > 2;Size-=2) 04670 { 04671 // Read the next char code 04672 ok = pRecord->ReadWCHAR(&wChar); 04673 04674 TextChar* pNewChar = NULL; 04675 04676 if (ok) pNewChar = new TextChar(); // Create a new TextChar 04677 if (ok) ok = (pNewChar != NULL); // 04678 if (ok) pNewChar->SetUnicodeValue(wChar); // Set the char's code 04679 if (ok) pNewChar->AttachNode(pChar,NEXT); // Attach it next to the last inserted char 04680 if (ok) ok = pChar->CopyChildAttrs(pNewChar); // Make sure it looks the same as the last char 04681 if (ok) pChar = pNewChar; // pNewChar now becomes the last char inserted 04682 } 04683 } 04684 04685 // Get the next imported string 04686 pImportedString = pImportedStringList->GetNext(pImportedString); 04687 } 04688 04689 // After expanding the strings, throw them away, and throw the list away too. 04690 pImportedStringList->DeleteAll(); 04691 delete pImportedStringList; 04692 pImportedStringList = NULL; 04693 04694 return ok; 04695 }
|
|
This function is called when the render function passes through this node It outputs the Text Object start and end tokens.
Reimplemented from NodeRenderableInk. Definition at line 3001 of file nodetxts.cpp. 03002 { 03003 #if EXPORT_TEXT 03004 // (ChrisG 8/11/00) - Reset the 'exporting text as shapes' flag, so that it's valid for 03005 // the next text story - also don't export the 'end of text object' data if we aren't 03006 // exporting a text object. 03007 BOOL endTextObject = TRUE; 03008 03009 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(AIEPSRenderRegion))) 03010 { 03011 if (((AIEPSRenderRegion*) pRegion)->GetTextAsShapes () == TRUE) 03012 { 03013 endTextObject = FALSE; 03014 } 03015 ((AIEPSRenderRegion*) pRegion)->SetTextAsShapes (FALSE); 03016 } 03017 03018 // don't export the 'end text object' if we shouldn't 03019 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(EPSRenderRegion)) && (endTextObject)) 03020 { 03021 // Output "End text object" token 03022 EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC(); 03023 pDC->OutputToken(_T("TO")); 03024 pDC->OutputNewLine(); 03025 03026 // output token if text is wrapped 03027 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(NativeRenderRegion))) 03028 { 03029 if (WillStoryWrapOnPath()) 03030 { 03031 pDC->OutputValue((INT32)EOTAG_TEXTWRAPPED); 03032 pDC->OutputToken(_T("cso")); 03033 pDC->OutputNewLine(); 03034 pDC->OutputToken(_T("ceo")); 03035 pDC->OutputNewLine(); 03036 } 03037 } 03038 return TRUE; 03039 } 03040 #endif 03041 return FALSE; 03042 }
|
|
Perform an Extend operation on this text-story. See also: Extender class.
Reimplemented from Node. Definition at line 5249 of file nodetxts.cpp. 05250 { 05251 // if we lie on a curve, we must extend that curve, together with our attributes, 05252 // otherwise we must extend ourself, then extend our children. 05253 NodePath* pnPath = GetTextPath(); 05254 if (pnPath == NULL) 05255 { 05256 // do the extension operations on ourself. 05257 // text stories never stretch, they just translate. 05258 TransformTranslateNoStretchObject(ExtParams); 05259 TransformTranslateObject(ExtParams); 05260 05261 // do the base-class implementation to extend our children. 05262 Node::Extend(ExtParams); 05263 } 05264 else 05265 { 05266 // extend our path. 05267 pnPath->Extend(ExtParams); 05268 05269 // extend our attributes. 05270 for ( Node* pChildNode = FindFirstChild(); 05271 pChildNode != NULL; 05272 pChildNode = pChildNode->FindNext() ) 05273 { 05274 if (pChildNode->IsAnAttribute()) 05275 pChildNode->Extend(ExtParams); 05276 } 05277 } 05278 }
|
|
Find the extend-centre reference point. See also: Extender class.
Reimplemented from NodeRenderableBounded. Definition at line 5294 of file nodetxts.cpp. 05295 { 05296 DocRect rectNode = GetBoundingRect(); 05297 DocCoord doccCentre = rectNode.Centre(); 05298 switch ( FindJustification() ) 05299 { 05300 case JCENTRE: 05301 case JFULL: 05302 // do nothing - the centre of the rectangle is required. 05303 break; 05304 05305 case JRIGHT: 05306 doccCentre.x = rectNode.hi.x; 05307 break; 05308 05309 case JLEFT: 05310 default: 05311 doccCentre.x = rectNode.lo.x; 05312 break; 05313 } 05314 05315 return doccCentre; 05316 }
|
|
This function should be used to obtain a pointer to the TextStory's first TextLine node.
Definition at line 1947 of file nodetxts.cpp. 01948 { 01949 return (TextLine*)FindFirstChild(CC_RUNTIME_CLASS(TextLine)); 01950 }
|
|
Definition at line 3377 of file nodetxts.cpp. 03378 { 03379 TextLine* pFirstLine = this->FindFirstLine(); 03380 ERROR2IF(pFirstLine==NULL,NULL,"TextStory::FindFirstVisibleTextNode() - No TextLine in the TextStory"); 03381 return pFirstLine->FindFirstVTN(); 03382 }
|
|
Used in conjunction with Extend() and its sister functions to determine which way a text-story should extend. If you use this function for another purpose, read it and make sure it does what you think it should do first. Notes: Be aware that this function uses IsKindOf() to test this node's children within the tree. See also: Extender class.
Definition at line 5335 of file nodetxts.cpp. 05336 { 05337 // first, search for a text-justify attribute underneath this TextStory in the tree. 05338 Node* pNode = FindFirstDepthFirst(); 05339 while (pNode != NULL && !pNode->IsKindOf(CC_RUNTIME_CLASS(AttrTxtJustification))) 05340 pNode = pNode->FindNextDepthFirst(this); 05341 05342 // if we didn't find one, then find the attribute currently applied to pTextStory. 05343 BOOL bFoundAttr = FALSE; 05344 AttrTxtJustification* pAttrJustify = NULL; 05345 if (pNode != NULL) 05346 { 05347 pAttrJustify = (AttrTxtJustification*)pNode; 05348 bFoundAttr = TRUE; 05349 } 05350 else 05351 bFoundAttr = FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTxtJustification), (NodeAttribute**)&pAttrJustify); 05352 05353 // if we retrieved an attribute, get its value. 05354 // if we have no luck, we'll just use JLEFT as the default. 05355 Justification justify = JLEFT; 05356 if (bFoundAttr) 05357 { 05358 TxtJustificationAttribute* textJustAttr = (TxtJustificationAttribute*)pAttrJustify->GetAttributeValue(); 05359 if (textJustAttr != NULL) 05360 justify = textJustAttr->justification; 05361 } 05362 05363 return justify; 05364 }
|
|
Definition at line 1960 of file nodetxts.cpp. 01961 { 01962 return (TextLine*)FindLastChild(CC_RUNTIME_CLASS(TextLine)); 01963 }
|
|
Definition at line 3392 of file nodetxts.cpp. 03393 { 03394 TextLine* pLastLine = this->FindLastLine(); 03395 ERROR2IF(pLastLine==NULL,NULL,"TextStory::FindLastVTN() - story has no lines!"); 03396 return pLastLine->FindLastVTN(); 03397 }
|
|
Reformat a text story.
Definition at line 2680 of file nodetxts.cpp. 02681 { 02682 #ifndef DISABLE_TEXT_RENDERING 02683 // if whole story is affected, just flag all children as 'ModifiedByOp' 02684 if (UseNodeFlags==FALSE) 02685 FlagNodeAndDescendantsModifiedByOpAndParentsHaveDescendantModifiedByOp(); 02686 02687 // if DOing the format (as opposed to undo/redo) 02688 // ensure all lines in paragraphs have same line level attrs as first line 02689 // flagging any changed lines as modified, before metrics are recached 02690 if (WordWrap) 02691 { 02692 Validate(FALSE); 02693 TextLine* pLine = this->FindFirstLine(); 02694 while (pLine!=NULL) 02695 { 02696 if (pLine->FindEOLNode()==NULL) 02697 if (!pLine->EnsureNextLineOfParagraphHasSameLineLevelAttrs(pUndoOp)) 02698 return FALSE; 02699 pLine = pLine->FindNextLine(); 02700 } 02701 } 02702 02703 // recache metrics in any nodes in story 'ModifiedByOp' 02704 // Karim 02/03/2000 - braces added because this FormatRegion needs to go out of scope 02705 // *before* people start localising attributes in one of the fn's called later on. 02706 { 02707 FormatRegion FormattingRegion; 02708 if (FormattingRegion.Init(this)==FALSE) 02709 return FALSE; 02710 ReCacheNodeAndDescendantsMetrics(&FormattingRegion); 02711 } 02712 02713 // if text on path, get untransfomed (reversed) copy and associated information 02714 TextStoryInfo StoryInfo; 02715 StoryInfo.pUndoOp = pUndoOp; 02716 StoryInfo.WordWrap = WordWrap; 02717 if (GetTextPath()!=NULL) 02718 { 02719 if (CreateUntransformedPath(&StoryInfo)==FALSE) 02720 return FALSE; 02721 } 02722 02723 // determine the story's width, and if it is word wrapping or not 02724 if (StoryInfo.pPath==NULL) 02725 StoryInfo.StoryWidth = GetStoryWidth(); // 0 if text at point 02726 else 02727 { 02728 StoryInfo.StoryWidth = StoryInfo.PathLength; 02729 if (IsWordWrapping()) 02730 // we might just as well store the logical width in the story as well 02731 // (for the benefit of displaying it on the ruler) 02732 StoryWidth = StoryInfo.PathLength - StoryInfo.LeftPathIndent - StoryInfo.RightPathIndent; 02733 } 02734 StoryInfo.WordWrapping = IsWordWrapping(); 02735 02736 // format each line in story 02737 TextLine* pLine = this->FindFirstLine(); 02738 while (pLine!=NULL) 02739 { 02740 if (pLine->Format(&StoryInfo)==FALSE) 02741 return FALSE; 02742 pLine = pLine->FindNextLine(); 02743 } 02744 02745 // delete the untransformed copy of the path if there was one 02746 if (StoryInfo.pPath!=NULL) 02747 delete StoryInfo.pPath; 02748 02749 // ensure the caret is in the correct place 02750 CaretNode* pCaret=GetCaret(); 02751 ERROR2IF(pCaret==NULL,FALSE,"TextStory::Format() - pCaret==NULL"); 02752 if (pCaret->HasMoved()==FALSE) 02753 return FALSE; 02754 02755 // update the redraw rect to encompass all the affected nodes 02756 UnionNodeAndDescendantsOldAndNewBounds(&RedrawRect); 02757 02758 // clear all the flags in the story 02759 ClearNodeAndDescendantsFlags(); 02760 02761 Validate(); 02762 #endif 02763 return TRUE; 02764 }
|
|
Reimplemented from NodeRenderable. Definition at line 2023 of file nodetxts.cpp. 02024 { 02025 // get the bounds of the test story's blob 02026 INT32 BlobSize=0; 02027 DocCoord BlobPos=GetBlobPosAndSize(&BlobSize); 02028 DocRect BlobBounds(BlobPos,BlobPos); 02029 02030 BlobBounds.Inflate(BlobSize/2); 02031 02032 IncludeChildrensBoundingRects(&BlobBounds); 02033 return BlobBounds; 02034 }
|
|
Definition at line 2046 of file nodetxts.cpp. 02047 { 02048 #if !defined(EXCLUDE_FROM_RALPH) 02049 // Get the bounds of the text story 02050 DocRect StoryBounds=GetBoundingRect(); 02051 02052 // get the size of a blob 02053 INT32 BlobSize=0; 02054 BlobManager* pBlobMgr=GetApplication()->GetBlobManager(); 02055 if (pBlobMgr) 02056 BlobSize=pBlobMgr->GetBlobSize(); 02057 else 02058 ERROR3("TextStory::GetObjectBlobPos() - GetBlobManager() returned NULL"); 02059 02060 if (pSize) *pSize=BlobSize; 02061 return DocCoord( StoryBounds.lo.x-BlobSize/2, StoryBounds.hi.y+BlobSize/2 ); 02062 #else 02063 return DocCoord(0,0); 02064 #endif 02065 }
|
|
Returns a pointer to the caret node of this TextStory, NULL will be returned if there is no Caret.
Definition at line 1414 of file nodetxts.cpp. 01415 { 01416 // if there's a caret pointer in the cache then use it 01417 if (CachedCaret) 01418 return CachedCaret; 01419 01420 // otherwise find the thing inside the story 01421 Node* pNode=FindFirstDepthFirst(); 01422 while (pNode != NULL) 01423 { 01424 if (IS_A(pNode,CaretNode)) 01425 break; 01426 pNode=pNode->FindNextDepthFirst(this); 01427 } 01428 01429 // if we can't find the thing its trouble! 01430 ERROR2IF(pNode==NULL,NULL,"TextStory::GetCaret() - could not find caret!"); 01431 01432 CachedCaret = (CaretNode*)pNode; 01433 return CachedCaret; 01434 }
|
|
Given a location works out the nearest character to that location.
Definition at line 4309 of file nodetxts.cpp. 04310 { 04311 ERROR3IF(GetTextPath()!=NULL, "GetCharacterAtPoint : Results are unpredictable for stories on a path"); 04312 04313 // Get inital pointers, checking them 04314 ERROR2IF(pHitChar==NULL || ToLeft==NULL, FALSE, "NULL output param"); 04315 CaretNode* pCaret = GetCaret(); 04316 ERROR2IF(pCaret == NULL, FALSE, "Story has no caret"); 04317 TextLine* pFirstLine = FindFirstLine(); 04318 TextLine* pLastLine = FindLastLine(); 04319 ERROR2IF((pFirstLine==NULL || pLastLine==NULL), FALSE, "Story has no text lines"); 04320 04321 // Set outputs to defaults 04322 *pHitChar = NULL; 04323 *ToLeft = FALSE; 04324 04325 // Untransform the point via the story matrix 04326 DocCoord UTPoint = Point; 04327 Matrix StoryMat = GetStoryMatrix(); 04328 StoryMat=StoryMat.Inverse(); 04329 StoryMat.transform(&UTPoint); 04330 04331 // Check to see wether the point is within the untransformed bounds of the story 04332 if (InBounds) 04333 { 04334 DocRect UTStoryBounds = GetUTStoryBounds(); 04335 if (!UTStoryBounds.ContainsCoord(UTPoint)) 04336 { 04337 *pHitChar = NULL; 04338 *ToLeft = FALSE; 04339 return TRUE; 04340 } 04341 } 04342 04343 // See if the point is above the first line 04344 INT32 HighestPointFound = INT32_MIN; 04345 INT32 LowestPointFound = INT32_MAX; 04346 TextLine* HighestLine = NULL; 04347 TextLine* LowestLine = NULL; 04348 04349 // Scan through the lines to see if one contains the point 04350 INT32 PrevHigh = pFirstLine->GetPosInStory() + pFirstLine->GetLineAscent(); 04351 INT32 PrevLow = pFirstLine->GetPosInStory() + pFirstLine->GetLineDescent(); 04352 TextLine* pLine = pFirstLine; 04353 while (pLine != NULL) 04354 { 04355 INT32 HighestPoint = pLine->GetPosInStory() + pLine->GetLineAscent(); 04356 INT32 LowestPoint = pLine->GetPosInStory() + pLine->GetLineDescent(); 04357 04358 // Update the highest and lowest known points in the story 04359 if (HighestPointFound < HighestPoint) 04360 { 04361 HighestPointFound = HighestPoint; 04362 HighestLine = pLine; 04363 } 04364 if (LowestPointFound > LowestPoint) 04365 { 04366 LowestPointFound = LowestPoint; 04367 LowestLine = pLine; 04368 } 04369 04370 // Get the bounds of the current and previous lines 04371 INT32 Highest = max( PrevHigh, max( PrevLow, max( HighestPoint, LowestPoint ) ) ); 04372 INT32 Lowest = min( PrevHigh, min( PrevLow, min( HighestPoint, LowestPoint ) ) ); 04373 04374 if ((UTPoint.y <= Highest) && (UTPoint.y >= Lowest)) 04375 break; 04376 04377 PrevHigh = HighestPoint; 04378 PrevLow = LowestPoint; 04379 pLine = pLine->FindNextLine(); 04380 } 04381 04382 // If pLine is NULL then the point is above/below the story 04383 if (pLine == NULL) 04384 { 04385 if (UTPoint.y >= HighestPointFound) 04386 pLine = HighestLine; 04387 if (UTPoint.y <= LowestPointFound) 04388 pLine = LowestLine; 04389 } 04390 ERROR2IF(pLine == NULL, FALSE, "Didn't find a line"); 04391 04392 // Find a character on the line 04393 BOOL ToLeftPosChar = TRUE; 04394 VisibleTextNode* pPointerChar = pLine->FindCharAtDistAlongLine(UTPoint.x, &ToLeftPosChar); 04395 if (pPointerChar->IsAnEOLNode()) 04396 ToLeftPosChar = FALSE; 04397 if (pPointerChar->IsACaret()) 04398 { 04399 if (pPointerChar->FindNextVTNInLine()!=NULL) 04400 pPointerChar = pPointerChar->FindNextVTNInLine(); 04401 else 04402 pPointerChar = pPointerChar->FindPrevVTNInLine(); 04403 } 04404 04405 *pHitChar = pPointerChar; 04406 *ToLeft = ToLeftPosChar; 04407 04408 return TRUE; 04409 }
|
|
Definition at line 418 of file nodetxts.h. 00418 { return CharsAspect; }
|
|
Definition at line 419 of file nodetxts.h. 00419 { return CharsRotation; }
|
|
Definition at line 417 of file nodetxts.h. 00417 { return CharsScale; }
|
|
Definition at line 420 of file nodetxts.h. 00420 { return CharsShear; }
|
|
For obtaining debug information about the Node. This fn can be deleted before we ship.
Reimplemented from NodeRenderableBounded. Definition at line 1326 of file nodetxts.cpp. 01327 { 01328 #if DEBUG_TREE 01329 01330 BaseTextClass::GetDebugDetails(Str); 01331 01332 String_256 TempStr; 01333 String_256 TempStr2; 01334 TCHAR floatStr[20]; 01335 01336 (*Str) += TEXT( "\r\nText story Data Dump\r\n" ); 01337 01338 fixed16 abcd[4]; 01339 INT32 ef[2]; 01340 StoryMatrix.GetComponents(abcd, ef); 01341 01342 TempStr._MakeMsg( TEXT("\r\nMatrix\r\n")); 01343 (*Str) += TempStr; 01344 camSnprintf( floatStr, 20, _T("%f,%f"), abcd[0].MakeDouble(), abcd[1].MakeDouble() ); 01345 TempStr._MakeMsg( TEXT("a, b :\t#1%s\r\n"), floatStr); 01346 (*Str) += TempStr; 01347 camSnprintf( floatStr, 20, _T("%f,%f"), abcd[2].MakeDouble(), abcd[3].MakeDouble() ); 01348 TempStr._MakeMsg( TEXT("c, d :\t#1%s\r\n"), floatStr); 01349 (*Str) += TempStr; 01350 TempStr._MakeMsg( TEXT("e, f :\t#1%ld,\t#2%ld\r\n"), ef[0], ef[1]); 01351 (*Str) += TempStr; 01352 01353 TempStr._MakeMsg( TEXT("\r\nIndents")); 01354 (*Str) += TempStr; 01355 TempStr._MakeMsg( TEXT("\tLeft\t#1%ld\r\n"), GetLeftIndent()); 01356 (*Str) += TempStr; 01357 TempStr._MakeMsg( TEXT("\tRight\t#1%ld\r\n"), GetRightIndent()); 01358 (*Str) += TempStr; 01359 TempStr._MakeMsg( TEXT("\tStory Width\t#1%ld\r\n"), GetStoryWidth()); 01360 (*Str) += TempStr; 01361 01362 TempStr._MakeMsg( TEXT("\r\nFlags")); 01363 (*Str) += TempStr; 01364 if (IsTextOnPathReversed()) 01365 TempStr._MakeMsg( TEXT("\tText on path is reversed\r\n")); 01366 else 01367 TempStr._MakeMsg( TEXT("\tText on path is NOT reversed\r\n")); 01368 (*Str) += TempStr; 01369 if (IsTextOnPathTangential()) 01370 TempStr._MakeMsg( TEXT("\tText on path is tangential\r\n")); 01371 else 01372 TempStr._MakeMsg( TEXT("\tText on path is NOT tangential\r\n")); 01373 (*Str) += TempStr; 01374 if (IsPrintingAsShapes()) 01375 TempStr._MakeMsg( TEXT("\tText is printing as shapes\r\n")); 01376 else 01377 TempStr._MakeMsg( TEXT("\tText is NOT printing as shapes\r\n")); 01378 (*Str) += TempStr; 01379 if (IsWordWrapping()) 01380 TempStr._MakeMsg( TEXT("\tText is word wrapping\r\n")); 01381 else 01382 TempStr._MakeMsg( TEXT("\tText is NOT word wrapping\r\n")); 01383 (*Str) += TempStr; 01384 if (IsAutoKerning()) 01385 TempStr._MakeMsg( TEXT("\tText is auto kerned\r\n")); 01386 else 01387 TempStr._MakeMsg( TEXT("\tText is NOT auto kerned\r\n")); 01388 (*Str) += TempStr; 01389 01390 TempStr._MakeMsg( TEXT("\tCharsScale = #1%ld\r\n"), CharsScale.GetRawLong() ); 01391 (*Str) += TempStr; 01392 TempStr._MakeMsg( TEXT("\tCharsAspect = #1%ld\r\n"), CharsAspect.GetRawLong() ); 01393 (*Str) += TempStr; 01394 TempStr._MakeMsg( TEXT("\tCharsRotation = #1%ld\r\n"), CharsRotation.GetRawLong() ); 01395 (*Str) += TempStr; 01396 TempStr._MakeMsg( TEXT("\tCharsShear = #1%ld\r\n"), CharsShear.GetRawLong() ); 01397 (*Str) += TempStr; 01398 01399 01400 #endif 01401 }
|
|
This function should be used to get a pointer to the TextStory with the input focus. There can be only one such story with an active caret at any time, although there does not have to aways be one (in this case NULL is returned).
Definition at line 1892 of file nodetxts.cpp. 01893 { 01894 return pFocusStory; 01895 }
|
|
Definition at line 404 of file nodetxts.h. 00404 { return ImportBaseShift; }
|
|
Definition at line 403 of file nodetxts.h. 00403 { return ImportFormatWidth; }
|
|
Definition at line 431 of file nodetxts.h. 00431 {return mLeftIndent;}
|
|
Gets the position in the document of the left indent of this story.
Definition at line 4420 of file nodetxts.cpp. 04421 { 04422 ERROR3IF(GetTextPath() == NULL, "Story not on a path, LeftIndent unused"); 04423 04424 if (GetTextPath() != NULL) 04425 { 04426 if (IsTextOnPathReversed()) 04427 { 04428 INT32 TotalPathLength = (INT32)GetTextPath()->InkPath.GetPathLength(); 04429 return GetPathBlobPos(TotalPathLength-GetLeftIndent(), GetTextPath()); 04430 } 04431 else 04432 return GetPathBlobPos(GetLeftIndent(), GetTextPath()); 04433 } 04434 04435 04436 else 04437 return DocCoord(0,0); 04438 }
|
|
Definition at line 2177 of file nodetxts.cpp. 02178 { 02179 ERROR2IF(pStartChar==NULL,NULL,"TextStory::GetNextWordChar() - pStartChar==NULL"); 02180 VisibleTextNode* pVTN = pStartChar; 02181 02182 // skip the caret so we always start on a char 02183 if (pStartChar->IsACaret()) 02184 { 02185 pVTN = pVTN->FindNextVTNInStory(); 02186 ERROR2IF(pVTN==NULL,NULL,"TextStory::GetNextWordChar() - no VTN after caret"); 02187 } 02188 02189 // skips chars until space found, then return pointer to first non-space 02190 // also return ptr to EOL and char immediately after EOL 02191 BOOL SpaceFound = FALSE; 02192 while (1) 02193 { 02194 VisibleTextNode* pNextVTN = pVTN->FindNextVTNInStory(); 02195 02196 // if this is an EOL return pointer to next char if not at end of story 02197 if (pVTN->IsAnEOLNode()) 02198 { 02199 if (pNextVTN!=NULL) 02200 return pNextVTN; 02201 else 02202 return pVTN; 02203 } 02204 02205 // if next char is an EOL return pointer to it 02206 ERROR2IF(pNextVTN==NULL,NULL,"TextStory::GetNextWordChar() - story deos not end in EOL"); 02207 if (pNextVTN->IsAnEOLNode()) 02208 return pNextVTN; 02209 02210 // if char a space, flag it, 02211 // else non-space and if space found, return ptr to non-space 02212 if (pVTN->IsAVisibleSpace()) 02213 SpaceFound = TRUE; 02214 else if (SpaceFound) 02215 return pVTN; 02216 02217 pVTN = pNextVTN; 02218 } 02219 }
|
|
return string with CC_RUNTIME_CLASS name of node and address
Definition at line 5042 of file nodetxts.cpp. 05043 { 05044 static TCHAR pDesc[256]; 05045 if (pNode!=NULL) 05046 camSnprintf( pDesc, 256, _T("%s @ 0x%p\0"), pNode->GetRuntimeClass()->GetClassName(), pNode ); 05047 else 05048 camSnprintf( pDesc, 256, _T("\0") ); 05049 return pDesc; 05050 }
|
|
For finding the size of the node.
Reimplemented from Node. Definition at line 1237 of file nodetxts.cpp. 01238 { 01239 return (sizeof(TextStory)); 01240 }
|
|
Gets the location of the of a point a certian distance along the path. This function is static so others, eg the drag op, can call it and it's scary math.
Definition at line 4287 of file nodetxts.cpp. 04288 { 04289 DocCoord Result(0,0); 04290 pPath->InkPath.GetPointAtDistance(IndentLength, &Result); 04291 return Result; 04292 }
|
|
Definition at line 2131 of file nodetxts.cpp. 02132 { 02133 ERROR2IF(pStartChar==NULL,NULL,"TextStory::GetPrevWordChar() - pStartChar==NULL"); 02134 02135 // skips chars until non-space found, then return ptr to last non-space before space 02136 // also return ptr to char immediately after EOL and EOL 02137 BOOL NonSpaceFound = FALSE; 02138 VisibleTextNode* pVTN = pStartChar; 02139 while (1) 02140 { 02141 VisibleTextNode* pPrevVTN = pVTN->FindPrevVTNInStory(); 02142 02143 // if at start of story, return ptr to first VTN 02144 if (pPrevVTN==NULL) 02145 return pVTN; 02146 02147 // if EOL found, if we've moved, return ptr to char after EOL, else return EOL 02148 if (pPrevVTN->IsAnEOLNode()) 02149 { 02150 if (pVTN!=pStartChar) 02151 return pVTN; 02152 else 02153 return pPrevVTN; 02154 } 02155 02156 // if prev char not a space, flag this, 02157 // else prev char a space and if non-space found, return ptr to this char 02158 if (!pPrevVTN->IsAVisibleSpace()) 02159 NonSpaceFound = TRUE; 02160 else if (NonSpaceFound) 02161 return pVTN; 02162 02163 pVTN = pPrevVTN; 02164 } 02165 }
|
|
Definition at line 392 of file nodetxts.h. 00392 { return &StoryMatrix; }
|
|
Definition at line 391 of file nodetxts.h. 00391 { return &StoryMatrix; }
|
|
Definition at line 396 of file nodetxts.h. 00396 { return RedrawRect; }
|
|
Definition at line 432 of file nodetxts.h. 00432 {return mRightIndent;}
|
|
Gets the position in the document of the right indent of this story. Remember that the right inrent is relative to the RHS of the path.
Definition at line 4451 of file nodetxts.cpp. 04452 { 04453 ERROR3IF(GetTextPath() == NULL, "Story not on a path, RightIndent unused"); 04454 04455 if (GetTextPath() != NULL) 04456 { 04457 if (IsTextOnPathReversed()) 04458 { 04459 return GetPathBlobPos(GetRightIndent(), GetTextPath()); 04460 } 04461 else 04462 { 04463 INT32 TotalPathLength = (INT32)GetTextPath()->InkPath.GetPathLength(); 04464 return GetPathBlobPos(TotalPathLength-GetRightIndent(), GetTextPath()); 04465 } 04466 } 04467 else 04468 return DocCoord(0,0); 04469 }
|
|
This function should be called to find what character nodes are selected. The return value is a pointer to the last selected node, at the other end of the selected characters from the anchor (which is the caret). NULL will be returned if there is no selection.
Definition at line 2627 of file nodetxts.cpp. 02628 { 02629 CaretNode* pCaret = GetCaret(); 02630 ERROR2IF(pCaret==NULL, NULL, "Story has no caret"); 02631 VisibleTextNode* pNextChar = NULL; 02632 02633 // Get the direction of the selection 02634 BOOL Forward = TRUE; 02635 pNextChar = pCaret->FindPrevVTNInStory(); 02636 if ((pNextChar != NULL) && pNextChar->IsSelected()) 02637 Forward = FALSE; 02638 if (pDirection != NULL) 02639 *pDirection = Forward; 02640 02641 // Loop to the end of the selection 02642 VisibleTextNode* pResult = NULL; 02643 if (Forward) 02644 pNextChar = pCaret->FindNextVTNInStory(); 02645 else 02646 pNextChar = pCaret->FindPrevVTNInStory(); 02647 while ((pNextChar != NULL) && pNextChar->IsSelected()) 02648 { 02649 pResult = pNextChar; 02650 if (Forward) 02651 pNextChar = pNextChar->FindNextVTNInStory(); 02652 else 02653 pNextChar = pNextChar->FindPrevVTNInStory(); 02654 } 02655 02656 if (pResult == pCaret) 02657 pResult = NULL; 02658 02659 return pResult; 02660 }
|
|
Definition at line 5366 of file nodetxts.cpp. 05367 { 05368 String_256 Content = ""; 05369 String_256 AddTemplate = "x"; 05370 Node * pTextLine = FindFirstChild(CC_RUNTIME_CLASS(TextLine)); 05371 05372 INT32 StringMaxSize = 255; 05373 05374 while (pTextLine && StringMaxSize > 0) 05375 { 05376 Node * pChar = pTextLine->FindFirstChild(CC_RUNTIME_CLASS(TextChar)); 05377 05378 while (pChar && StringMaxSize > 0) 05379 { 05380 *AddTemplate = (TCHAR) (((TextChar *)pChar)->GetUnicodeValue()); 05381 Content += AddTemplate; 05382 05383 StringMaxSize--; 05384 05385 pChar = pChar->FindNext(CC_RUNTIME_CLASS(TextChar)); 05386 } 05387 05388 pTextLine = pTextLine->FindNext(CC_RUNTIME_CLASS(TextLine)); 05389 05390 if (pTextLine) 05391 { 05392 Content += _T("\n"); 05393 StringMaxSize -=2; 05394 } 05395 05396 } 05397 05398 return Content; 05399 }
|
|
Definition at line 393 of file nodetxts.h. 00393 { return StoryMatrix; }
|
|
Definition at line 400 of file nodetxts.h. 00400 { return StoryWidth; }
|
|
This function should be used to get a pointer to the path the text is on. NULL is returned if there is no text path.
Definition at line 1932 of file nodetxts.cpp. 01933 { 01934 return (NodePath*)FindFirstChild(CC_RUNTIME_CLASS(NodePath)); 01935 }
|
|
The bounding box of the story in it's untransformed space.
Definition at line 5139 of file nodetxts.cpp. 05140 { 05141 // Get pointers to first and last lines in story 05142 TextLine* pFirstLine = FindFirstLine(); 05143 TextLine* pLastLine = FindLastLine(); 05144 ERROR3IF((pFirstLine==NULL || pLastLine==NULL), "Story has no text lines"); 05145 05146 if (pFirstLine!=NULL && pLastLine!=NULL) 05147 { 05148 // Get the width of the widest line in the story 05149 MILLIPOINT WidestLineWidth = 0; 05150 TextLine* pLine = pFirstLine; 05151 while (pLine != NULL) 05152 { 05153 VisibleTextNode* pLastVTN = pLine->FindLastVTN(); 05154 05155 if (pLastVTN!=NULL) 05156 { 05157 const MILLIPOINT Dist = pLastVTN->CalcCharDistAlongLine(TRUE); 05158 05159 if (Dist > WidestLineWidth) 05160 WidestLineWidth = Dist; 05161 } 05162 05163 pLine = (TextLine*)pLine->FindNext(CC_RUNTIME_CLASS(TextLine)); 05164 } 05165 05166 INT32 LowY = pLastLine->GetPosInStory() + pLastLine->GetLineDescent(); 05167 INT32 HighY = -pFirstLine->GetLineAscent(); 05168 05169 return DocRect( 0, // Err, this only works for left justified stories! 05170 (LowY < HighY) ? LowY : HighY, 05171 WidestLineWidth, 05172 (LowY < HighY) ? HighY : LowY); 05173 } 05174 else 05175 return DocRect(0,0,0,0); 05176 }
|
|
Called when this TextStory is hidden - Clears the input focus from this TextStory if it currently has it, then calls the parent class.
Reimplemented from Node. Definition at line 2079 of file nodetxts.cpp. 02080 { 02081 // Clear the focus 02082 if (GetFocusStory() == this) 02083 { 02084 SetFocusStory(NULL); 02085 } 02086 02087 // Call the parent for it's processing 02088 return BaseTextClass::HidingNode(); 02089 }
|
|
Move the scale from the story's matrix down to its attributes (ie fix up docs which were created with partly developed by code!).
Definition at line 3219 of file nodetxts.cpp. 03220 { 03221 BOOL ok=TRUE; 03222 // remove scale from story matrix 03223 // Localise 03224 // for attrs on story/line/chars if txtattr and fontsize/linespace/baseline, scale 03225 // FactorOut 03226 return ok; 03227 }
|
|
Initialies the member variables of the TextStory.
Reimplemented from BaseTextClass. Definition at line 1090 of file nodetxts.cpp. 01091 { 01092 StoryMatrix = Matrix(); 01093 RedrawRect = DocRect(0,0,0,0); 01094 01095 StoryWidth = 0; 01096 mLeftIndent = 0; 01097 mRightIndent = 0; 01098 CachedCaret = NULL; 01099 01100 TextOnPathReversed = FALSE; 01101 TextOnPathTangential = TRUE; 01102 PrintAsShapes = FALSE; 01103 WordWrapping = FALSE; 01104 BeingCopied = FALSE; 01105 01106 ImportFormatWidth = 0; 01107 ImportBaseShift = AlignBaseline; 01108 01109 CharsScale = 1; 01110 CharsAspect = 1; 01111 CharsRotation = 0; 01112 CharsShear = 0; 01113 01114 pImportedStringList = NULL; // Used when importing strings in the v2 file format 01115 01116 AutoKern = true; 01117 }
|
|
Definition at line 427 of file nodetxts.h. 00427 { return AutoKern; }
|
|
Reimplemented from Node. Definition at line 277 of file nodetxts.h. 00277 { return TRUE; } // See also NodeCompound
|
|
Looks through the list of nodes under the text story node to see if there are any gradient fills on this object. See also: TextStory::PreExportRender.
Definition at line 5416 of file nodetxts.cpp. 05417 { 05418 ListItem *pItem = NULL; 05419 List GradientList; 05420 BOOL filled = FALSE; 05421 05422 // Now get the list of nodes. 05423 BevelTools::GetAllNodesUnderNode ( this, &GradientList, 05424 CC_RUNTIME_CLASS ( AttrFillGeometry ) ); 05425 05426 // (ChrisG 8/11/00) - Cycle through the gradient list finding if there are any 05427 // gradient fills. 05428 pItem = GradientList.GetHead (); 05429 while ( (pItem != NULL) && (filled == FALSE) ) 05430 { 05431 NodeListItem *pNodeItem = ( NodeListItem* ) pItem; 05432 AttrFillGeometry *pFill = ( AttrFillGeometry* ) pNodeItem->pNode; 05433 05434 // if it is a graduated colour fill, then it is gradient filled 05435 if ( pFill->IsAColourFill () && // Is it a colour fill? 05436 pFill->IsAGradFill ()) // Is it a graduated fill? 05437 { 05438 filled = TRUE; 05439 } 05440 05441 // Get the next list item. 05442 pItem = GradientList.GetNext ( pItem ); 05443 } 05444 05445 GradientList.DeleteAll(); 05446 05447 return filled; 05448 }
|
|
Definition at line 410 of file nodetxts.h. 00410 { return PrintAsShapes; }
|
|
Indicates that NodeRenderableInks are candidates for membership of Attribute gallery set.
Reimplemented from BaseTextClass. Definition at line 276 of file nodetxts.h. 00276 { return TRUE; }
|
|
Definition at line 408 of file nodetxts.h. 00408 { return TextOnPathReversed; }
|
|
Definition at line 409 of file nodetxts.h. 00409 { return TextOnPathTangential; }
|
|
Reimplemented from Node. Definition at line 445 of file nodetxts.h. 00445 { return TRUE; }
|
|
Definition at line 411 of file nodetxts.h. 00411 { return WordWrapping; }
|
|
modify TextStory matrix appropriately when fitting text to a path
Definition at line 3331 of file nodetxts.cpp. 03332 { 03333 DocCoord Translation(0,0); 03334 BOOL ok=GetpStoryMatrix()->Decompose(&CharsScale,&CharsAspect,&CharsRotation,&CharsShear,&Translation); 03335 ERROR2IF(!ok,void(0),"TextStory::MatrixFitToPath() - Matrix::Decompose() failed"); 03336 03337 // if text rotated to 2nd/3rd quadrant, reverse text on curve 03338 if (CharsRotation<(ANGLE)(-PI/2) || CharsRotation>(ANGLE)(PI/2)) 03339 { 03340 ReverseTextOnPath(); 03341 CharsRotation = (CharsRotation>0) ? CharsRotation-PI : CharsRotation+PI; 03342 } 03343 03344 StoryMatrix=Matrix(Translation.x,Translation.y); // keep a record of translation 03345 }
|
|
modify TextStory matrix appropriately when removing text from a path
Definition at line 3356 of file nodetxts.cpp. 03357 { 03358 if (IsTextOnPathReversed()) 03359 { 03360 CharsRotation = (CharsRotation>0) ? CharsRotation-PI : CharsRotation+PI; 03361 ReverseTextOnPath(); 03362 } 03363 Matrix CharsMatrix; 03364 CharsMatrix.Compose(CharsScale,CharsAspect,CharsRotation,CharsShear); 03365 CharsMatrix*=StoryMatrix; 03366 SetStoryMatrix(CharsMatrix); 03367 }
|
|
This routine moves the caret to the left by one position.
Definition at line 2231 of file nodetxts.cpp. 02232 { 02233 CaretNode* pCaret = GetCaret(); 02234 ERROR2IF(pCaret==NULL,FALSE,"TextStory::MoveCaretLeftAChar() - Story has no charet"); 02235 02236 VisibleTextNode* pNewCaretPos = pCaret->FindPrevVTNInStory(); 02237 if (pNewCaretPos==NULL) 02238 return TRUE; // do nothing if at start of story 02239 02240 return MoveCaretToCharacter(pNewCaretPos, PREV); 02241 }
|
|
This routine moves the caret to the left by a word. If the caret is in a word it is moved to the start of that word, else the caret is positioned at the start of the previous word.
Definition at line 2279 of file nodetxts.cpp. 02280 { 02281 CaretNode* pCaret = GetCaret(); // Obtain the caret 02282 ERROR2IF(pCaret == NULL, FALSE, "Story had no caret"); 02283 02284 // Get the new caret position 02285 VisibleTextNode* pStartOfPrev = GetPrevWordChar(pCaret); 02286 ERROR2IF(pStartOfPrev == NULL, FALSE, "Didn't find prev word start"); 02287 02288 // Move the caret 02289 if (pStartOfPrev != pCaret) 02290 return MoveCaretToCharacter(pStartOfPrev, PREV); 02291 else 02292 return TRUE; 02293 }
|
|
This routine moves the caret to the right by one position.
Definition at line 2253 of file nodetxts.cpp. 02254 { 02255 CaretNode* pCaret = GetCaret(); 02256 ERROR2IF(pCaret==NULL,FALSE,"TextStory::MoveCaretRightAChar() - Story has no caret"); 02257 02258 VisibleTextNode* pNewCaretPos = pCaret->FindNextVTNInStory(); 02259 ERROR2IF(pNewCaretPos==NULL,FALSE,"TextStory::MoveCaretRightAChar() - no VTN after caret in story!"); 02260 pNewCaretPos = pNewCaretPos->FindNextVTNInStory(); 02261 if (pNewCaretPos==NULL) 02262 return TRUE; // if at end of story, do nothing 02263 02264 return MoveCaretToCharacter(pNewCaretPos, PREV); 02265 }
|
|
This routine moves the caret to the right by a word. It caret is positioned to the left of the first character encountered after a space.
Definition at line 2307 of file nodetxts.cpp. 02308 { 02309 CaretNode* pCaret = GetCaret(); // Obtain the caret 02310 ERROR2IF(pCaret == NULL, FALSE, "Story had no caret"); 02311 02312 // Get the new caret position 02313 VisibleTextNode* pStartOfNext = GetNextWordChar(pCaret); 02314 ERROR2IF(pStartOfNext == NULL, FALSE, "Didn't find next word start"); 02315 02316 // Move the caret 02317 if (pStartOfNext != pCaret) 02318 return MoveCaretToCharacter(pStartOfNext, PREV); 02319 else 02320 return TRUE; 02321 }
|
|
This routine moves the caret to the left or right of a specified char.
Definition at line 2104 of file nodetxts.cpp. 02105 { 02106 ERROR2IF(Dir!=PREV && Dir!=NEXT,FALSE,"Dir must be PREV or NEXT"); 02107 ERROR2IF(pChar==NULL,FALSE,"Attempted to move the caret to NULL"); 02108 CaretNode* pCaret=GetCaret(); 02109 ERROR2IF(pCaret==NULL,FALSE,"TextStory::MoveCaretToCharacter() - TextStory has no caret"); 02110 02111 // ensure not inserted after EOL 02112 AttachNodeDirection AttachDir = Dir; 02113 if (pChar->IsAnEOLNode() && AttachDir==NEXT) 02114 AttachDir = PREV; 02115 02116 pCaret->MoveNode(pChar, AttachDir); 02117 pCaret->HasMoved(); 02118 return AttachCaretAttributes(); 02119 }
|
|
Move caret to end of TextLine which it is on.
Definition at line 2362 of file nodetxts.cpp. 02363 { 02364 CaretNode* pCaret = GetCaret(); 02365 ERROR2IF(pCaret==NULL,FALSE,"TextStory::MoveCaretToEndOfLine() - story has no caret"); 02366 TextLine* pCaretLine = (TextLine*)pCaret->FindParent(); 02367 ERROR2IF(pCaretLine==NULL || !IS_A(pCaretLine,TextLine), FALSE, "Parent of Caret was not a TextLine!"); 02368 02369 VisibleTextNode* pLastChar = pCaretLine->FindLastVTN(); 02370 if (pLastChar->IsAnEOLNode()) 02371 { 02372 pLastChar = pLastChar->FindPrevVTNInLine(); 02373 ERROR2IF(pLastChar==NULL,FALSE,"TextStory::MoveCaretToEndOfLine() - should be at least 1 other VTN on line - the caret!"); 02374 } 02375 02376 if (pLastChar!=pCaret) 02377 return MoveCaretToCharacter(pLastChar, NEXT); 02378 02379 return TRUE; 02380 }
|
|
This routine moves the caret to the start of the TextLine that it is on.
Definition at line 2333 of file nodetxts.cpp. 02334 { 02335 CaretNode* pCaret = GetCaret(); // Obtain the caret 02336 ERROR2IF(pCaret == NULL, FALSE, "Story had no caret"); 02337 02338 // Get its parent (which should be a TextLine) 02339 TextLine* pParent = (TextLine*)pCaret->FindParent(); 02340 ERROR2IF(!IS_A(pParent,TextLine), FALSE, "Parent of Caret was not a TextLine!"); 02341 02342 // Get the first child of the TextLine 02343 VisibleTextNode* pFirstChar = pParent->FindFirstVTN(); 02344 02345 // Only move the caret if we need to 02346 if (pFirstChar != pCaret) 02347 return MoveCaretToCharacter(pFirstChar, PREV); 02348 else 02349 return TRUE; 02350 }
|
|
Determines wether or not this text story should be exported. If there are no characters in it then we don't want to save it as it will cause bother when loaded back.
Definition at line 5097 of file nodetxts.cpp. 05098 { 05099 // See if we have any visible characters inside us. 05100 VisibleTextNode* pVTN = FindFirstVTN(); 05101 BOOL FoundCharacter = FALSE; 05102 while (pVTN!=NULL && !FoundCharacter) 05103 { 05104 if (pVTN->IsATextChar()) 05105 FoundCharacter = !pVTN->IsAVisibleSpace(); 05106 pVTN = pVTN->FindNextVTNInStory(); 05107 } 05108 05109 if (FoundCharacter) 05110 return TRUE; 05111 05112 // If we get here then we are an empty story. Is it safe to not export us? 05113 // Scan up the tree. If we reach a layer without passing though compounds other than groups it's fine. 05114 Node* pParent = FindParent(); 05115 while (pParent!=NULL && !pParent->IsLayer()) 05116 { 05117 if (pParent->IsCompound() && !IS_A(pParent, NodeGroup)) 05118 return TRUE; // Must export the story as the compound may rely on its presence. 05119 05120 pParent = pParent->FindParent(); 05121 } 05122 05123 // If we get here it's safe to not export this story. 05124 return FALSE; 05125 }
|
|
This function is called at the end of any operation which has affected a TextStory in order to (undoably) reformat the story and redraw affected bits.
Reimplemented from Node. Definition at line 1609 of file nodetxts.cpp. 01610 { 01611 ERROR2IF(pParam==NULL,CC_FAIL,"TextStory::OnChildChange() - pParam==NULL"); 01612 01613 // ignore all but OBJCHANGE_FINISHED codes 01614 if (pParam->GetChangeType()!=OBJCHANGE_FINISHED) 01615 return CC_OK; 01616 01617 // The AllowOp system will have called the CaretNode and it will have set 01618 // PERMISSION_DENIED on itself. We must ensure that that is cleared at the 01619 // end of the operation. 01620 if (IS_A(this, CaretNode)) 01621 SetOpPermission(PERMISSION_UNDEFINED); 01622 01623 // if we have an op pointer format and redraw the story undoably else just do it 01624 // (ie consecutive attribute applies only do the first one undoably) 01625 BOOL ok = TRUE; 01626 UndoableOperation* pOp=pParam->GetOpPointer(); 01627 if (pOp!=NULL) 01628 { 01629 if (ok) 01630 ok = PrePostTextAction::DoFormatStory(pOp,this); 01631 if (ok) 01632 { 01633 DocRect temprect = RedrawRect; 01634 // Don't call ReleaseCached here without very good reason 01635 // Some Ops which call this function have carefully controlled 01636 // their cacheing so that unwanted re-renders are avoided. 01637 // Calling ReleaseCached here blows all that control away 01638 if (!pParam->GetRetainCachedData()) 01639 { 01640 ReleaseCached(TRUE, FALSE); 01641 BOOL bFoundEffects = FALSE; 01642 DocRect effectrect = GetEffectStackBounds(&bFoundEffects); 01643 if (bFoundEffects) temprect = temprect.Union(effectrect); 01644 } 01645 01646 ok = pOp->DoInvalidateRegion(FindParentSpread(), temprect); 01647 } 01648 } 01649 else 01650 { 01651 if (ok) 01652 ok = FormatAndChildren(pOp,TRUE); 01653 01654 BaseDocument* pOwnerDoc = FindOwnerDoc(); 01655 ERROR2IF(pOwnerDoc==NULL,CC_FAIL,"TextStory::OnChildChange() - pDoc==NULL"); 01656 if (ok && IS_A(pOwnerDoc, Document)) 01657 { 01658 DocRect temprect = RedrawRect; 01659 if (!pParam->GetRetainCachedData()) 01660 { 01661 ReleaseCached(TRUE, FALSE); 01662 BOOL bFoundEffects = FALSE; 01663 DocRect effectrect = GetEffectStackBounds(&bFoundEffects); 01664 if (bFoundEffects) temprect = temprect.Union(effectrect); 01665 } 01666 ((Document*)pOwnerDoc)->ForceRedraw(FindParentSpread(), temprect, TRUE, this, FALSE); 01667 } 01668 } 01669 01670 if (ok) 01671 return CC_OK; 01672 else 01673 return CC_FAIL; 01674 }
|
|
Allows the TextStory to respond to pop up menu clicks on itself.
Reimplemented from NodeRenderableInk. Definition at line 3413 of file nodetxts.cpp. 03414 { 03415 #if !defined(EXCLUDE_FROM_RALPH) 03416 BOOL ok = TRUE; 03417 ok = ok && pMenu->BuildCommand(TOOL_OPTOKEN_TEXT, TRUE); 03418 // ok = ok && pMenu->BuildCommand(OPTOKEN_APPLYLEFTJUSTIFY); 03419 // ok = ok && pMenu->BuildCommand(OPTOKEN_APPLYCENTREJUSTIFY); 03420 // ok = ok && pMenu->BuildCommand(OPTOKEN_APPLYRIGHTJUSTIFY); 03421 // ok = ok && pMenu->BuildCommand(OPTOKEN_APPLYFULLJUSTIFY, TRUE); 03422 // WEBSTER-ranbirr-13/11/96 03423 03424 ok = ok && pMenu->BuildCommand(OPTOKEN_REVERSESTORYPATH); 03425 #ifndef WEBSTER 03426 ok = ok && pMenu->BuildCommand(OPTOKEN_TOGGLEPRINTASSHAPES, TRUE); 03427 #endif //webster 03428 return ok; 03429 #else 03430 return FALSE; 03431 #endif 03432 }
|
|
Polymorphically copies the contents of this node to another.
Reimplemented from BaseTextClass. Definition at line 1158 of file nodetxts.cpp. 01159 { 01160 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 01161 ENSURE(IS_A(pNodeCopy, TextStory), "PolyCopyNodeContents given wrong dest node type"); 01162 01163 if (IS_A(pNodeCopy, TextStory)) 01164 CopyNodeContents((TextStory*)pNodeCopy); 01165 }
|
|
This function is called following the (simple)copy of a text story. The TextStory and its children are re-formatted.
Reimplemented from Node. Definition at line 3170 of file nodetxts.cpp. 03171 { 03172 ERROR2IF(pOp==NULL, FALSE, "Operation pointer was NULL"); 03173 03174 return PrePostTextAction::DoFormatStory(pOp, this); 03175 }
|
|
This functions is called following the complete import of a document. It allows nodes to complete their post import initialisation once they are in complete tree. The TextStory and its children are formatted following loading. > BOOL TextStory::PostImport()
Reimplemented from Node. Definition at line 3102 of file nodetxts.cpp. 03103 { 03104 #ifdef RALPH 03105 // We don't want to be rendering at the same time as doing this, because we get 03106 // blobby text problems - fun, but bad ! 03107 RalphCriticalSection RalphCS; 03108 #endif 03109 03110 // Expand any strings that might have been imported from the v2 file format 03111 if (!ExpandImportedStrings()) 03112 return FALSE; 03113 03114 // Make sure it has a caret 03115 if (!EnsureStoryHasCaret()) 03116 return FALSE; 03117 03118 // if not newly inserted, ignore! 03119 if (!ModifiedByOp()) 03120 return TRUE; 03121 03122 // format to a width if one is specified 03123 if (GetImportFormatWidth()!=0) 03124 { 03125 SetWordWrapping(TRUE); 03126 SetStoryWidth(GetImportFormatWidth()); 03127 ImportFormatWidth=0; // prevent it happening on subsequent imports (as all stories are called!) 03128 } 03129 03130 // account for any corel baseline shift style 03131 BOOL ok = TRUE; 03132 if (ok && ImportBaseShift!=AlignBaseline) 03133 { 03134 ok=CorelStyleBaselineShift(ImportBaseShift); 03135 ImportBaseShift=AlignBaseline; // prevent it happening on subsequent imports (as all stories are called!) 03136 } 03137 03138 // format and redraw 03139 if (ok) ok=FormatAndChildren(); 03140 if (ok) 03141 { 03142 BaseDocument* pDoc = FindOwnerDoc(); 03143 if (pDoc!=NULL && IS_A(pDoc, Document)) 03144 { 03145 DocRect temprect = RedrawRect; 03146 ReleaseCached(TRUE, FALSE); 03147 BOOL bFoundEffects = FALSE; 03148 DocRect effectrect = GetEffectStackBounds(&bFoundEffects); 03149 if (bFoundEffects) temprect = temprect.Union(effectrect); 03150 ((Document*)pDoc)->ForceRedraw(FindParentSpread(), RedrawRect, TRUE, this); 03151 } 03152 } 03153 03154 return ok; 03155 }
|
|
This function is called when the render function passes through this node It outputs the Text Object start and end tokens. void TextStory::PreExportRender(RenderRegion* pRegion)
Reimplemented from Node. Definition at line 2777 of file nodetxts.cpp. 02778 { 02779 #if EXPORT_TEXT 02780 BOOL exportingAsShapes = FALSE; 02781 02782 // Determine whether or not to export AI text as shapes (i.e. if there are any 02783 // gradient fills in the text. 02784 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(AIEPSRenderRegion))) 02785 { 02786 exportingAsShapes = IsGradientFilled (); 02787 } 02788 02789 // if there are gradient fills, then don't export text info, just set the RenderRegion up 02790 // so that it's ready for converting text to shapes. 02791 if (exportingAsShapes) 02792 { 02793 ((AIEPSRenderRegion*) pRegion)->SetTextAsShapes (exportingAsShapes); 02794 } 02795 // if there are no gradient fills, or we're not doing AI export, then carry on as normal. 02796 else 02797 { 02798 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(EPSRenderRegion))) 02799 { 02800 // Output "start text object" token 02801 EPSExportDC *pDC = (EPSExportDC *) CCDC::ConvertFromNativeDC(pRegion->GetRenderDC()); 02802 EPSRenderRegion* pEPSRegion = (EPSRenderRegion*)pRegion; 02803 02804 NodePath* pPath = GetTextPath(); 02805 02806 // Text Story type 02807 if (pPath) 02808 pDC->OutputValue((INT32)2); 02809 else 02810 pDC->OutputValue((INT32)0); 02811 02812 // text object token 02813 pDC->OutputToken(_T("To")); 02814 pDC->OutputNewLine(); 02815 02816 // output the story matrix. We need to make this relative to the spread the 02817 // story is on. 02818 Matrix TempMatrix; 02819 TempMatrix = StoryMatrix; 02820 02821 // if we're exporting to illustrator, make the text position relative to 02822 // the page. 02823 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(AIEPSRenderRegion))) 02824 { 02825 DocCoord pos; 02826 TempMatrix.GetTranslation(pos); 02827 02828 Spread* pCurSpread = FindParentSpread(); 02829 if (pCurSpread) 02830 { 02831 DocCoord result; 02832 pCurSpread->SpreadCoordToPagesCoord(&result, pos); 02833 TempMatrix.SetTranslation(result); 02834 } 02835 } 02836 02837 pDC->OutputMatrix(&TempMatrix); 02838 // null start point 02839 pDC->OutputValue((INT32)0); 02840 // start path 02841 pDC->OutputToken(_T("Tp")); 02842 pDC->OutputNewLine(); 02843 02844 // export the path 02845 if (pPath) 02846 { 02847 // if it's an AI EPS region, we need to save the text attributes after the TP token, or 02848 // Photoshop screws up. 02849 if (pRegion->IsKindOf (CC_RUNTIME_CLASS (AIEPSRenderRegion)) == FALSE) 02850 { 02851 // Need to call this for any text attributes that may have 02852 // changed 02853 pEPSRegion->GetValidTextAttributes(); 02854 } 02855 02856 // Save the attribute context 02857 pRegion->SaveContext(); 02858 02859 // Save the attributes associated with this path. 02860 Node* pNode = pPath->FindPrevious(); 02861 while (pNode) 02862 { 02863 if (pNode->IsAnAttribute()) 02864 { 02865 ((NodeAttribute*)pNode)->Render(pEPSRegion); 02866 } 02867 pNode=pNode->FindPrevious(); 02868 } 02869 02870 pNode = pPath->FindFirstChild(); 02871 while (pNode) 02872 { 02873 if (pNode->IsAnAttribute()) 02874 { 02875 ((NodeAttribute*)pNode)->Render(pEPSRegion); 02876 } 02877 pNode=pNode->FindNext(); 02878 } 02879 02880 /* 02881 CMapPtrToPtr* pAttribMap = new CMapPtrToPtr(30); 02882 if (pAttribMap == NULL) 02883 return; 02884 02885 // Now find any attributes that are applied to this node. 02886 BOOL FoundAttrs = pPath->FindAppliedAttributes(pAttribMap); 02887 02888 if (FoundAttrs) 02889 { 02890 // iterating all (key, value) pairs 02891 for (POSITION Pos = pAttribMap->GetStartPosition(); Pos != NULL;) 02892 { 02893 void *pType,*pVal; 02894 pAttribMap->GetNextAssoc(Pos,pType,pVal); 02895 02896 NodeAttribute* pAttr = (NodeAttribute*)pVal; 02897 pAttr->Render(pEPSRegion); 02898 } 02899 } 02900 */ 02901 if (IsTextOnPathReversed()) 02902 (pPath->InkPath).Reverse(); 02903 02904 pEPSRegion->ExportPath(&(pPath->InkPath),FALSE); 02905 02906 if (IsTextOnPathReversed()) 02907 (pPath->InkPath).Reverse(); 02908 02909 // restore the old context. 02910 pRegion->RestoreContext(); 02911 02912 } 02913 02914 // end path 02915 pDC->OutputToken(_T("TP")); 02916 pDC->OutputNewLine(); 02917 02918 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(AIEPSRenderRegion))) 02919 { 02920 // Need to call this for any text attributes that may have 02921 // changed. 02922 // 02923 // (ChrisG - 8/11/00). Removed, as this should be done by the 02924 // individual characters themselves, and can screw up the export 02925 // if it isn't, (AI doesn't like lots of font and render changes 02926 // without actually drawing any text). 02927 // pEPSRegion->GetValidTextAttributes(); 02928 02929 // (ChrisG - 8/11/00) Added support for automatic kerning. 02930 if (AutoKern) 02931 pDC->OutputValue ((INT32)1); 02932 else 02933 pDC->OutputValue ((INT32)0); 02934 02935 pDC->OutputToken (_T("TA")); // automatic kerning TA 02936 pDC->OutputNewLine(); 02937 pDC->OutputToken(_T("0 0 0 TC")); // Character spacing TC 02938 pDC->OutputNewLine(); 02939 pDC->OutputToken(_T("100 100 100 TW")); // Word spacing TW 02940 pDC->OutputNewLine(); 02941 pDC->OutputToken(_T("0 0 0 Ti")); // Line indentation Ti 02942 pDC->OutputNewLine(); 02943 02944 // (ChrisG - 3/11/00) 02945 // Export the overflow text if the text is on a path 02946 if (pPath) 02947 ((AIEPSRenderRegion *) pRegion)->OverflowTextStart (); 02948 } 02949 } 02950 02951 if (pRegion->IsKindOf(CC_RUNTIME_CLASS(NativeRenderRegion))) 02952 { 02953 // Output "extras" token for text 02954 EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC(); 02955 // EPSRenderRegion* pEPSRegion = (EPSRenderRegion*)pRegion; 02956 02957 INT32 WordWrapping = (IsWordWrapping() ? 1 : 0); 02958 pDC->OutputValue(WordWrapping); 02959 pDC->OutputValue(GetStoryWidth()); 02960 double CScale = CharsScale.MakeDouble(); 02961 pDC->OutputReal(CScale); 02962 double CAspect = CharsAspect.MakeDouble(); 02963 pDC->OutputReal(CAspect); 02964 double CRotation = CharsRotation.MakeDouble(); 02965 pDC->OutputReal(CRotation); 02966 double CShear = CharsShear.MakeDouble(); 02967 pDC->OutputReal(CShear); 02968 INT32 AsShapes = ((PrintAsShapes) ? (1) : (0)); 02969 pDC->OutputValue(AsShapes); 02970 02971 // Output version zero and token 02972 pDC->OutputValue((INT32)0); 02973 pDC->OutputToken(_T("ctex")); 02974 pDC->OutputNewLine(); 02975 02976 // Version one stuff 02977 /* pDC->OutputValue(GetLeftMargin()); 02978 pDC->OutputValue(GetRightMargin()); 02979 02980 // Output version and token 02981 pDC->OutputValue((INT32)1); 02982 pDC->OutputToken(_T("ctex")); 02983 pDC->OutputNewLine();*/ 02984 } 02985 } 02986 #endif 02987 }
|
|
Render the text story's object blobs.
Reimplemented from NodeRenderable. Definition at line 1975 of file nodetxts.cpp. 01976 { 01977 #if !defined(EXCLUDE_FROM_RALPH) 01978 if (pRenderRegion != NULL) 01979 { 01980 pRenderRegion->SetLineColour(COLOUR_NONE); 01981 pRenderRegion->SetFillColour(COLOUR_UNSELECTEDBLOB); 01982 01983 pRenderRegion->DrawBlob(GetBlobPosAndSize(), BT_UNSELECTED); 01984 } 01985 else 01986 ERROR3("TextStory::RenderTinyBlobs() - pRenderRegion==NULL"); 01987 #endif 01988 }
|
|
Render the text story's tiny blobs.
Reimplemented from NodeRenderable. Definition at line 2000 of file nodetxts.cpp. 02001 { 02002 #if !defined(EXCLUDE_FROM_RALPH) 02003 if (pRenderRegion != NULL) 02004 { 02005 pRenderRegion->SetLineColour(COLOUR_NONE); 02006 pRenderRegion->SetFillColour(COLOUR_UNSELECTEDBLOB); 02007 pRenderRegion->DrawBlob(GetBlobPosAndSize(), BT_UNSELECTED); 02008 } 02009 else 02010 ERROR3("TextStory::RenderTinyBlobs() - pRenderRegion==NULL"); 02011 #endif 02012 }
|
|
Scan through all end of line nodes in this text story and set the status of their virtual flag.
Definition at line 3953 of file nodetxts.cpp. 03954 { 03955 // find the first line in this story 03956 TextLine* pLine = this->FindFirstLine(); 03957 while (pLine) 03958 { 03959 // for each line, set its EOL nodes status 03960 EOLNode* pEOL = pLine->FindEOLNode(); 03961 if (pEOL!=NULL) 03962 pEOL->SetVirtual(Status); 03963 03964 pLine=pLine->FindNextLine(); 03965 } 03966 }
|
|
|
|
Definition at line 412 of file nodetxts.h. 00412 { TextOnPathReversed = !TextOnPathReversed; }
|
|
Definition at line 428 of file nodetxts.h. 00428 { AutoKern = NewValue; }
|
|
Definition at line 422 of file nodetxts.h. 00422 { CharsAspect = aspect; }
|
|
Definition at line 423 of file nodetxts.h. 00423 { CharsRotation = rotation; }
|
|
Definition at line 421 of file nodetxts.h. 00421 { CharsScale = scale; }
|
|
Definition at line 424 of file nodetxts.h. 00424 { CharsShear = shear; }
|
|
This function should be used to set the pointer with the input focus. Setting the pointer to NULL clears the into focus.
Definition at line 1911 of file nodetxts.cpp. 01912 { 01913 if ((pNewStory != NULL) && (!IS_A(pNewStory,TextStory)) ) 01914 { 01915 ERROR3("Attempted to set FocusTextStory to a non-TextStory object"); 01916 pNewStory = NULL; 01917 } 01918 01919 pFocusStory = pNewStory; 01920 }
|
|
Definition at line 406 of file nodetxts.h. 00406 { ImportBaseShift=shift; }
|
|
Definition at line 405 of file nodetxts.h. 00405 { ImportFormatWidth=width; }
|
|
Definition at line 436 of file nodetxts.h. 00436 {mLeftIndent = NewIndent;}
|
|
Definition at line 414 of file nodetxts.h. 00414 { PrintAsShapes = NewValues; }
|
|
Definition at line 397 of file nodetxts.h. 00397 { RedrawRect=rect; }
|
|
Definition at line 437 of file nodetxts.h. 00437 {mRightIndent = NewIndent;}
|
|
Scan through the text story setting the necessary copyme bits to make sure the text story is copied correctly. The range is used to determin what items are actually being copied. If characters are being copied, we need to copy a line and text story as well.
Definition at line 3851 of file nodetxts.cpp. 03852 { 03853 // find the first object in the story 03854 Node* pNode = FindFirstChild(); 03855 while (pNode) 03856 { 03857 if (pNode->IsAnAttribute()) 03858 { 03859 pNode->MarkNodeAndChildren(); 03860 } 03861 else 03862 { 03863 // ok check if its a line and if so do all the character level stuff 03864 if (IS_A(pNode,TextLine)) 03865 { 03866 // find the first child of this particular line 03867 Node* cNode = NULL; 03868 Node* qNode = pNode->FindFirstChild(); 03869 while (qNode) 03870 { 03871 // Mark in range characters, kern codes and other abstract characters 03872 // Only copy the char if it is in the search range. 03873 if (qNode->IsMarked()) 03874 { 03875 qNode->MarkNodeAndChildren(); 03876 // Save a copy of this chap for later 03877 cNode=qNode; 03878 } 03879 qNode=qNode->FindNext(); 03880 } 03881 03882 // we've found an item inrange in this line..... 03883 if (cNode) 03884 { 03885 // Make sure we mark the line too 03886 qNode = cNode->FindParent(); 03887 qNode->SetMarker(TRUE); 03888 03889 // take all the line level attributes with us too 03890 qNode = qNode->FindFirstChild(); 03891 while (qNode) 03892 { 03893 if (qNode->IsAnAttribute()) 03894 qNode->MarkNodeAndChildren(); 03895 qNode=qNode->FindNext(); 03896 } 03897 03898 // Now we need to make sure we take the end of line node with us. 03899 qNode=cNode->FindParent(); 03900 qNode=qNode->FindFirstChild(CC_RUNTIME_CLASS(EOLNode)); 03901 03902 ERROR3IF((qNode) && (!IS_A(qNode,EOLNode)),"Where has the lines EOLnode gone? - (TextStory::SetStoryMarkers())"); 03903 03904 // We assume the last node is an EOLnode. 03905 if (qNode && IS_A(qNode,EOLNode)) 03906 { 03907 if (!qNode->IsMarked()) 03908 { 03909 // It wasn't already marked ie it can't have been 'inrange' 03910 qNode->MarkNodeAndChildren(); 03911 // We need to mark the eolnode as transient 03912 // ie so we know the difference between unselected 03913 // and selected nodes. 03914 ((EOLNode*)qNode)->SetVirtual(TRUE); 03915 } 03916 } 03917 } 03918 } 03919 else 03920 { 03921 // otherwise its not a line and its not an attribute so is it in the range? 03922 // if its in range, take it and its children with us 03923 if (pNode->IsMarked()) 03924 pNode->MarkNodeAndChildren(); 03925 } 03926 } 03927 03928 // Scan for the next object 03929 pNode=pNode->FindNext(); 03930 } 03931 03932 /* I suppose we need to take the caret too, 03933 erh no we need to wait and insert a caret later, it could be in a different line 03934 to the selection if select inside has occured! and hence wont be copied properly 03935 03936 CaretNode* pCaret = GetCaret(); 03937 if (pCaret) 03938 pCaret->MarkNodeAndChildren(); */ 03939 03940 }
|
|
Definition at line 394 of file nodetxts.h. 00394 { StoryMatrix=matrix; }
|
|
Definition at line 401 of file nodetxts.h. 00401 { StoryWidth = NewValue; }
|
|
Definition at line 415 of file nodetxts.h. 00415 { WordWrapping = NewValues; }
|
|
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes of Node.
Reimplemented from BaseTextClass. Definition at line 1132 of file nodetxts.cpp. 01133 { 01134 // Make a new TextStory and then copy things into it 01135 TextStory* NodeCopy = new TextStory(); 01136 01137 ERROR1IF(NodeCopy==NULL, NULL, _R(IDE_NOMORE_MEMORY)); 01138 01139 if (NodeCopy) 01140 CopyNodeContents(NodeCopy); 01141 01142 return NodeCopy; 01143 }
|
|
Definition at line 413 of file nodetxts.h. 00413 { TextOnPathTangential = !TextOnPathTangential; }
|
|
transform a text story and any children capable of being transformed
Reimplemented from NodeRenderableBounded. Definition at line 2473 of file nodetxts.cpp. 02474 { 02475 BOOL ok=TRUE; 02476 if (IS_A(&transform, Trans2DMatrix)) 02477 { 02478 // apply transform to story matrix 02479 StoryMatrix *= ((Trans2DMatrix&)transform).GetMatrix(); 02480 02481 // decompose new story matrix 02482 FIXED16 Scale=1; 02483 FIXED16 Aspect=1; 02484 ANGLE Rotation=0; 02485 ANGLE Shear=0; 02486 DocCoord Translation(0,0); 02487 ok=StoryMatrix.Decompose(&Scale,&Aspect,&Rotation,&Shear,&Translation); 02488 //TRACEUSER( "Ed", _T("\nNew Story Matrix - Scale=%8.5f, Aspect=%8.5f, Rotation=%9.4f, Shear=%8.5f, Translation=%d,%d\n"),Scale.MakeDouble(),Aspect.MakeDouble(),Rotation.MakeDouble()*180/PI,Shear.MakeDouble()*180/PI,Translation.x,Translation.y); 02489 if (Scale<0) 02490 { 02491 Scale=-Scale; 02492 Shear=-Shear; 02493 } 02494 02495 // if the scale or aspect in the matrix deviate from unit by more than a specified amount normalise them 02496 const FIXED16 NormaliseLimit=0.001; 02497 FIXED16 AbsScaleError = Scale-1; 02498 FIXED16 AbsAspectError = Aspect-1; 02499 AbsScaleError = AbsScaleError<0 ? -AbsScaleError : AbsScaleError; 02500 AbsAspectError = AbsAspectError<0 ? -AbsAspectError : AbsAspectError; 02501 if (ok && (AbsScaleError>NormaliseLimit || AbsAspectError>NormaliseLimit) ) 02502 { 02503 // determine if we can handle aspect ratio transforms in the attributes 02504 BOOL TransformAspect=(GetTextPath()==NULL); 02505 if (TransformAspect==FALSE) 02506 Aspect=1; 02507 02508 // any change in width applied to attributes must also be applied to the story width 02509 FIXED16 AbsAspect = Aspect<0 ? -Aspect : Aspect; 02510 if (ok) 02511 SetStoryWidth( XLONG(GetStoryWidth()) * Scale * AbsAspect ); 02512 if (ok) 02513 SetLeftIndent( XLONG(GetLeftIndent()) * Scale * AbsAspect ); 02514 if (ok) 02515 SetRightIndent( XLONG(GetRightIndent()) * Scale * AbsAspect ); 02516 02517 // create a set containing attributes which will be transformed 02518 AttrTypeSet AffectedAttrs; 02519 if (ok) ok=AffectedAttrs.AddToSet(CC_RUNTIME_CLASS(AttrTxtFontSize)); 02520 if (ok) ok=AffectedAttrs.AddToSet(CC_RUNTIME_CLASS(AttrTxtLineSpace)); 02521 if (ok) ok=AffectedAttrs.AddToSet(CC_RUNTIME_CLASS(AttrTxtBaseLine)); 02522 if (ok) ok=AffectedAttrs.AddToSet(CC_RUNTIME_CLASS(AttrTxtLeftMargin)); 02523 if (ok) ok=AffectedAttrs.AddToSet(CC_RUNTIME_CLASS(AttrTxtRightMargin)); 02524 if (ok) ok=AffectedAttrs.AddToSet(CC_RUNTIME_CLASS(AttrTxtFirstIndent)); 02525 if (ok) ok=AffectedAttrs.AddToSet(CC_RUNTIME_CLASS(AttrTxtRuler)); 02526 if (ok && TransformAspect) ok=AffectedAttrs.AddToSet(CC_RUNTIME_CLASS(AttrTxtAspectRatio)); 02527 02528 // We add all attributes, including the defaults to the TextStory 02529 if (ok) ok=MakeAttributeComplete(NULL, TRUE, &AffectedAttrs, TRUE); 02530 // Now localise the stories attributes, globally, checking for duplicates 02531 if (ok) ok=LocaliseCommonAttributes(TRUE,TRUE,&AffectedAttrs); 02532 02533 // Before we transform the TextStory we must add all non-common defaults to the 02534 // children of the TextLines. 02535 if (ok) 02536 { 02537 // Scan all lines, localising and factoring out, to add defaults 02538 TextLine* pLine = this->FindFirstLine(); 02539 while (pLine!=NULL) 02540 { 02541 ok = pLine->LocaliseCommonAttributes(TRUE,FALSE,&AffectedAttrs); 02542 if (ok) ok = pLine->FactorOutCommonChildAttributes(FALSE,&AffectedAttrs); 02543 pLine = pLine->FindNextLine(); 02544 } 02545 } 02546 // At this stage there should be no invalidly placed defaults in the tree 02547 02548 // apply scale/aspect to attribtes 02549 if (ok) 02550 { 02551 // for the entire TextStory sub-tree, transform and of the text attributes 02552 Node* pNode=FindFirstDepthFirst(); 02553 while (pNode!=NULL) 02554 { 02555 if (pNode->IsAnAttribute() && pNode->IsKindOfTextAttribute()) 02556 ((AttrTxtBase*)pNode)->BaseLineRelativeTransform(Scale,Aspect); 02557 pNode=pNode->FindNextDepthFirst(this); 02558 } 02559 02560 // normalise the attributes which may have been affected 02561 if (ok) ok=FactorOutCommonChildAttributes(FALSE,&AffectedAttrs); 02562 02563 // even if factor out failed, remove effect of attribute scale/(aspect) from story matrix 02564 Matrix AttrChanges, AttrSpace, StoryChanges; 02565 AttrChanges.Compose(Scale,Aspect); // effect of scale/aspect on attrs in attr space 02566 AttrSpace.Compose(1,1,Rotation,Shear,Translation); // story to attr space transfom 02567 StoryChanges=AttrSpace.Inverse(); // transform into attr space 02568 StoryChanges*=AttrChanges.Inverse(); // remove effect of attr scale/aspect 02569 StoryChanges*=AttrSpace; // transform back into doc space 02570 StoryMatrix*=StoryChanges; // effect of scale/aspect on attrs in story space 02571 } 02572 02573 if (ok) 02574 { 02575 // Finally factor out the attributes globally 02576 ok = FactorOutCommonChildAttributes(TRUE,&AffectedAttrs); 02577 } 02578 02579 AffectedAttrs.DeleteAll(); 02580 } 02581 02582 if (!ok) 02583 { 02584 InformError(); 02585 return; 02586 } 02587 } 02588 else 02589 ERROR3("TextStory::Transform() - can't handle non-Trans2DMatrix transforms!"); 02590 02591 #if 0 02592 { 02593 FIXED16 Scale=1; 02594 FIXED16 Aspect=1; 02595 ANGLE Rotation=0; 02596 ANGLE Shear=0; 02597 DocCoord Translation(0,0); 02598 StoryMatrix.Decompose(&Scale,&Aspect,&Rotation,&Shear,&Translation); 02599 TRACEUSER( "Ed", _T("Normalised Story Matrix - Scale=%8.5f, Aspect=%8.5f, Rotation=%9.4f, Shear=%8.5f, Translation=%d,%d\n"),Scale.MakeDouble(),Aspect.MakeDouble(),Rotation.MakeDouble()*180/PI,Shear.MakeDouble()*180/PI,Translation.x,Translation.y); 02600 } 02601 #endif 02602 02603 InvalidateBoundingRect(); 02604 TransformChildren(transform); 02605 02606 if (transform.bSolidDrag) 02607 FormatAndChildren(); 02608 }
|
|
Join consecutive soft lines into single hard lines and append a final (virtual) EOL to the story if none.
Definition at line 3800 of file nodetxts.cpp. 03801 { 03802 TextLine* pThisLine = FindFirstLine(); 03803 ERROR2IF(pThisLine==NULL,FALSE,"TextStory::UnWrapStory() - story has no text lines!"); 03804 while (pThisLine!=NULL) 03805 { 03806 TextLine* pNextLine = pThisLine->FindNextLine(); 03807 if (pThisLine->FindEOLNode()==NULL) 03808 { 03809 if (pNextLine!=NULL) 03810 { 03811 // wrap next line back to end of this 03812 VisibleTextNode* pLastVTN = pNextLine->FindLastVTN(); 03813 ERROR2IF(pLastVTN==NULL,FALSE,"TextStory::UnWrapStory() - no VTN on soft line"); 03814 pLastVTN->WrapFromStartOfLineBack(pUndoOp); 03815 } 03816 else 03817 { 03818 // add a virtual EOL to keep Mike's stuff from falling over 03819 EOLNode* pEOL = new EOLNode; 03820 if (pEOL==NULL) 03821 return FALSE; 03822 pEOL->SetVirtual(TRUE); 03823 pEOL->AttachNode(pThisLine,LASTCHILD); 03824 } 03825 } 03826 else 03827 pThisLine = pNextLine; // move onto start of next paragraph 03828 } 03829 03830 // ensure op flags not set in story on clipboard 03831 ClearNodeAndDescendantsFlags(); 03832 03833 Validate(); 03834 03835 return TRUE; 03836 }
|
|
Definition at line 398 of file nodetxts.h. 00398 { RedrawRect=RedrawRect.Union(rect); }
|
|
Perform various integrity checks on a text story in debug builds.
Definition at line 4713 of file nodetxts.cpp. 04714 { 04715 PORTNOTE("text","Removed 'Ed' validate from TextStory::Validate") 04716 #ifndef EXCLUDE_FROM_XARALX 04717 #ifdef VALIDATE 04718 if (IsUserName("Ed")) 04719 { 04720 // choose parent to check from 04721 Node* pNode = this; 04722 if (pNode==NULL) 04723 { 04724 ERROR3("TestStory::Validate() - could not find desired parent, using top parent"); 04725 pNode = this; 04726 } 04727 04728 static INT32 count=0; 04729 if ((count++ % 12)==0) 04730 CheckSubtree(pNode); 04731 04732 ERROR3IF(CharsScale !=FIXED16(1), "TextStory::Validate() - CharsScale!=1"); 04733 ERROR3IF(CharsAspect!=FIXED16(1), "TextStory::Validate() - CharsAspect!=1"); 04734 ERROR3IF(CharsRotation !=0, "TextStory::Validate() - CharsRoation!=0 - not yet supported"); 04735 ERROR3IF(ImportFormatWidth !=0, "TextStory::Validate() - ImportFormatWidth!=0"); 04736 ERROR3IF(!TextOnPathTangential, "TextStory::Validate() - TextOnPathTangential!=0 - not yet supported"); 04737 ERROR3IF(ImportBaseShift!=AlignBaseline,"TextStory::Validate() - ImportBaseShift!=AlignBaseline"); 04738 VisibleTextNode* pLastVTNInStory = this->FindLastVTN(); 04739 ERROR3IF(pLastVTNInStory==NULL,"TextStory::Validate() - story has no VTN!"); 04740 ERROR3IF(!pLastVTNInStory->IsAnEOLNode(),"TextStory::Validate() - last VTN in story is not an EOLNode"); 04741 04742 FIXED16 Scale = 1; 04743 FIXED16 Aspect = 1; 04744 ANGLE Rotation = 0; 04745 ANGLE Shear = 0; 04746 DocCoord Translation(0,0); 04747 if (StoryMatrix.Decompose(&Scale,&Aspect,&Rotation,&Shear,&Translation)) 04748 { 04749 const FIXED16 NormaliseLimit = 0.001; 04750 if (Scale<0) 04751 { 04752 Scale = -Scale; 04753 Shear = -Shear; 04754 } 04755 FIXED16 AbsScaleError = Scale-1; 04756 FIXED16 AbsAspectError = Aspect-1; 04757 AbsScaleError = AbsScaleError<0 ? -AbsScaleError : AbsScaleError; 04758 AbsAspectError = AbsAspectError<0 ? -AbsAspectError : AbsAspectError; 04759 if (AbsScaleError>NormaliseLimit || AbsAspectError>NormaliseLimit) 04760 ERROR3("TextStory::Validate() - StroyMatrix scale or aspect not normalised!"); 04761 } 04762 else 04763 ERROR3("TextStory::Validate() - failed to decompose story matrix"); 04764 04765 BOOL LineFound = FALSE; 04766 BOOL PathFound = FALSE; 04767 BOOL CaretFound = FALSE; 04768 Node* pNodeInStory = this->FindFirstChild(); 04769 while (pNodeInStory!=NULL) 04770 { 04771 if (EnsureOpFlagsReset && pNodeInStory->IsABaseTextClass()) 04772 { 04773 BaseTextClass* pBTC = (BaseTextClass*)pNodeInStory; 04774 ERROR3IF(pBTC->Affected(), "TextStory::Validate() - AffectedFlag Set!"); 04775 ERROR3IF(pBTC->DescendantAffected(), "TextStory::Validate() - DescendantAffectedFlag Set!"); 04776 ERROR3IF(pBTC->ModifiedByOp(), "TextStory::Validate() - ModifiedByOpFlag Set!"); 04777 ERROR3IF(pBTC->DescendantModifiedByOp(),"TextStory::Validate() - DescendantModifiedByOpFlag Set!"); 04778 } 04779 if (pNodeInStory->IsAnAttribute()) 04780 { 04781 ERROR3IF(LineFound,"TextStory::Validate() - Attribute found after first line in story"); 04782 ERROR3IF(PathFound,"TextStory::Validate() - Attribute found after path in story"); 04783 NodeAttribute* pAttr = (NodeAttribute*)pNodeInStory; 04784 if (pAttr->IsALineLevelAttrib() && !TextLine::IsAttrTypeLineLevel(pAttr->GetAttributeType())) 04785 ERROR3("TextStory::Validate() - TextLine::IsAttrTypeLineLevel() out of date?"); 04786 } 04787 else if (IS_A(pNodeInStory,NodePath)) 04788 { 04789 ERROR3IF(LineFound,"TextStory::Validate() - Path is not first object in story"); 04790 CheckLeaf(pNodeInStory); 04791 PathFound = TRUE; 04792 } 04793 else if (IS_A(pNodeInStory,TextLine)) 04794 { 04795 BOOL VTNFound = FALSE; 04796 BOOL EOLFound = FALSE; 04797 Node* pNodeInLine = pNodeInStory->FindFirstChild(); 04798 while (pNodeInLine!=NULL) 04799 { 04800 if (EnsureOpFlagsReset && pNodeInStory->IsABaseTextClass()) 04801 { 04802 BaseTextClass* pBTC = (BaseTextClass*)pNodeInStory; 04803 ERROR3IF(pBTC->Affected(), "TextStory::Validate() - AffectedFlag Set!"); 04804 ERROR3IF(pBTC->DescendantAffected(), "TextStory::Validate() - DescendantAffectedFlag Set!"); 04805 ERROR3IF(pBTC->ModifiedByOp(), "TextStory::Validate() - ModifiedByOpFlag Set!"); 04806 ERROR3IF(pBTC->DescendantModifiedByOp(),"TextStory::Validate() - DescendantModifiedByOpFlag Set!"); 04807 } 04808 if (pNodeInLine->IsAnAttribute()) 04809 { 04810 ERROR3IF(VTNFound,"TextStory::Validate() - Attribute found after first VTN in line"); 04811 NodeAttribute* pAttr = (NodeAttribute*)pNodeInLine; 04812 if (pAttr->IsALineLevelAttrib() && !TextLine::IsAttrTypeLineLevel(pAttr->GetAttributeType())) 04813 ERROR3("TextStory::Validate() - TextLine::IsAttrTypeLineLevel() out of date?"); 04814 } 04815 else if (IS_A(pNodeInLine,CaretNode)) 04816 { 04817 ERROR3IF(CaretFound,"TextStory::Validate() - story has more than 1 caret"); 04818 CheckLeaf(pNodeInLine); 04819 VTNFound = TRUE; 04820 CaretFound = TRUE; 04821 } 04822 else if (IS_A(pNodeInLine,EOLNode)) 04823 { 04824 ERROR3IF(EOLFound,"TextStory::Validate() - line has more than 1 EOL"); 04825 CheckLeaf(pNodeInLine); 04826 VTNFound = TRUE; 04827 EOLFound = TRUE; 04828 } 04829 else if (pNodeInLine->IsAVisibleTextNode()) 04830 { 04831 ERROR3IF(EOLFound,"TextStory::Validate() - VTN found after EOL on line"); 04832 CheckLeaf(pNodeInLine); 04833 VTNFound = TRUE; 04834 } 04835 else if (!pNodeInLine->IsNodeHidden()) 04836 ERROR3("TextStory::Validate() - unknown node in line (ie not a NodeAttribute, VisibleTextNode or NodeHidden)"); 04837 pNodeInLine = pNodeInLine->FindNext(); 04838 } 04839 LineFound = TRUE; 04840 } 04841 else if (!pNodeInStory->IsNodeHidden()) 04842 ERROR3("TextStory::Validate() - unknown node in story (ie not a NodeAttribute, NodePath, TextLine or NodeHidden)"); 04843 pNodeInStory = pNodeInStory->FindNext(); 04844 } 04845 ERROR3IF(!LineFound, "TextStory::Validate() - story has no lines!"); 04846 // ERROR3IF(!CaretFound,"TextStory::Validate() - story has no caret!"); 04847 TRACEIF(!CaretFound,("TextStory::Validate() - story has no caret!\n")); 04848 } 04849 #endif 04850 #endif 04851 }
|
|
Tests to see whether this text-story's extend-centre is positioned so as to make an extend operation irreversible. See also: Extender class.
Reimplemented from Node. Definition at line 5194 of file nodetxts.cpp. 05195 { 05196 // if we lie on a curve, we must test that curve and our attributes, 05197 // otherwise we must test ourself, then pass the test on to our children. 05198 DocRect drMinExtend(INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX); 05199 NodePath* pnPath = GetTextPath(); 05200 if (pnPath == NULL) 05201 { 05202 DocCoord doccArray[1] = { FindExtendCentre() }; 05203 drMinExtend = Extender::ValidateControlPoints(1, doccArray, ExtParams); 05204 05205 // if we didn't invalidate the extension, we must call the base class 05206 // implementation, which will validate our children. 05207 if (drMinExtend.lo.x == INT32_MAX && 05208 drMinExtend.lo.y == INT32_MAX && 05209 drMinExtend.hi.x == INT32_MAX && 05210 drMinExtend.hi.y == INT32_MAX) 05211 drMinExtend = Node::ValidateExtend(ExtParams); 05212 } 05213 else 05214 { 05215 drMinExtend = pnPath->ValidateExtend(ExtParams); 05216 05217 DocRect drThisMinExtend; 05218 for ( Node* pChildNode = FindFirstChild(); 05219 pChildNode != NULL; 05220 pChildNode = pChildNode->FindNext() ) 05221 { 05222 if (!pChildNode->IsAnAttribute()) 05223 continue; 05224 05225 drThisMinExtend = pChildNode->ValidateExtend(ExtParams); 05226 if (drMinExtend.lo.x > drThisMinExtend.lo.x) drMinExtend.lo.x = drThisMinExtend.lo.x; 05227 if (drMinExtend.lo.y > drThisMinExtend.lo.y) drMinExtend.lo.y = drThisMinExtend.lo.y; 05228 if (drMinExtend.hi.x > drThisMinExtend.hi.x) drMinExtend.hi.x = drThisMinExtend.hi.x; 05229 if (drMinExtend.hi.y > drThisMinExtend.hi.y) drMinExtend.hi.y = drThisMinExtend.hi.y; 05230 } 05231 } 05232 05233 return drMinExtend; 05234 }
|
|
Calculates whether the formatter will wrap any line of text around the path It calculates this by checking the position of the last character (or VTN in each line). If this wraps it is assumed the whole line will wrap. Note text is assumed to only ever wrap on a path which is closed.
Definition at line 4228 of file nodetxts.cpp. 04229 { 04230 // BODGE TEXT - horrible copy of code elsewhere 04231 04232 // first find the text path. 04233 NodePath* pNodePath = GetTextPath(); 04234 if (pNodePath==NULL) 04235 return FALSE; 04236 Path* pPath = &(pNodePath->InkPath); 04237 04238 // if the path is open, text never wraps. 04239 INT32 NumPathCoords=pPath->GetNumCoords(); 04240 if (NumPathCoords<2) 04241 return FALSE; 04242 04243 BOOL PathClosed=FALSE; 04244 PathVerb* pPathVerbs=pPath->GetVerbArray(); 04245 ERROR2IF(pPathVerbs==NULL,FALSE,"TextStory::IsStoryWrappedOnpath() - pPathVerbs==NULL"); 04246 if (pPathVerbs[NumPathCoords-1] & PT_CLOSEFIGURE) 04247 PathClosed=TRUE; 04248 04249 if (!PathClosed) 04250 return FALSE; 04251 04252 // find the untransformed path length 04253 MILLIPOINT PathLength = 0; 04254 double fPathLength=0; 04255 ProcessLength PathLengthProcess(64); 04256 if (PathLengthProcess.PathLength(pPath,&fPathLength)) 04257 PathLength=(MILLIPOINT)fPathLength; 04258 04259 FIXED16 scale = GetCharsScale(); 04260 FIXED16 xscale = (scale<0 ? -scale : scale) * GetCharsAspect(); 04261 04262 BOOL Wrapped = FALSE; 04263 TextLine* pLine = FindFirstLine(); 04264 while (pLine && !Wrapped) 04265 { 04266 Wrapped = pLine->WillLineWrapOnPath(xscale,PathLength); 04267 pLine = pLine->FindNextLine(); 04268 } 04269 04270 return Wrapped; 04271 }
|
|
Begin to write out you child records, in the native format.
Reimplemented from NodeRenderableInk. Definition at line 4554 of file nodetxts.cpp. 04555 { 04556 #ifdef DO_EXPORT 04557 return CXaraFileTxtStory::WriteBeginChildRecordsNative(pFilter, this); 04558 #else 04559 return FALSE; 04560 #endif 04561 }
|
|
Writes out child records associated with the text story.
Reimplemented from NodeRenderableInk. Definition at line 4545 of file nodetxts.cpp. 04546 { 04547 #ifdef DO_EXPORT 04548 return CXaraFileTxtStory::WriteBeginChildRecordsWeb(pFilter, this); 04549 #else 04550 return FALSE; 04551 #endif 04552 }
|
|
Finished writing out you child records, in the native format.
Reimplemented from NodeRenderableInk. Definition at line 4572 of file nodetxts.cpp. 04573 { 04574 #ifdef DO_EXPORT 04575 return CXaraFileTxtStory::WriteEndChildRecordsNative(pFilter, this); 04576 #else 04577 return FALSE; 04578 #endif 04579 }
|
|
Finished writing out you child records, in the web format.
Reimplemented from NodeRenderableInk. Definition at line 4563 of file nodetxts.cpp. 04564 { 04565 #ifdef DO_EXPORT 04566 return CXaraFileTxtStory::WriteEndChildRecordsWeb(pFilter, this); 04567 #else 04568 return FALSE; 04569 #endif 04570 }
|
|
Reimplemented from Node. Definition at line 4500 of file nodetxts.cpp. 04501 { 04502 #ifdef DO_EXPORT 04503 return CXaraFileTxtStory::WritePreChildrenNative(pFilter, this); 04504 #else 04505 return FALSE; 04506 #endif 04507 }
|
|
Writes out a records associated with this node.
Reimplemented from Node. Definition at line 4491 of file nodetxts.cpp. 04492 { 04493 #ifdef DO_EXPORT 04494 return CXaraFileTxtStory::WritePreChildrenWeb(pFilter, this); 04495 #else 04496 return FALSE; 04497 #endif 04498 }
|
|
Definition at line 482 of file nodetxts.h. |
|
Definition at line 469 of file nodetxts.h. |
|
Definition at line 460 of file nodetxts.h. |
|
Definition at line 475 of file nodetxts.h. |
|
Definition at line 476 of file nodetxts.h. |
|
Definition at line 474 of file nodetxts.h. |
|
Definition at line 477 of file nodetxts.h. |
|
Definition at line 472 of file nodetxts.h. |
|
Definition at line 471 of file nodetxts.h. |
|
Definition at line 461 of file nodetxts.h. |
|
Definition at line 462 of file nodetxts.h. |
|
Definition at line 456 of file nodetxts.h. |
|
Definition at line 479 of file nodetxts.h. |
|
Definition at line 467 of file nodetxts.h. |
|
Definition at line 459 of file nodetxts.h. |
|
Definition at line 458 of file nodetxts.h. |
|
Definition at line 463 of file nodetxts.h. |
|
Definition at line 465 of file nodetxts.h. |
|
Definition at line 466 of file nodetxts.h. |
|
Definition at line 468 of file nodetxts.h. |