textops.h

Go to the documentation of this file.
00001 // $Id: textops.h 1446 2006-07-14 21:53:52Z phil $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // Header for the Text tool implementation
00099 
00100 // This file contains the following class definitions
00101 
00102 // class OpTextUndoable:    All Undoable text operations are derived from this base class. It
00103 //                          currently provides a set of useful DO functions for text ops.
00104 // class OpCreateTextObject:This is the op which gets executed to create a text object
00105 // class OpTextFormat:      This op groups together those text operations which will cause
00106 //                          the TextStory to be formatted.
00107 // class OpFitTextToCurve:  Self explanatory
00108 
00109 // class OpTextCaret:       Derived from Operation. This Op groups together all caret operations.
00110 
00111 #ifndef INC_TEXTOPS
00112 #define INC_TEXTOPS
00113 
00114 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00115 #include "cutop.h"
00116 
00117 class BaseTextClass;
00118 class TextStory;
00119 class TextLine;
00120 class CaretNode;
00121 class AbstractTextChar;
00122 class VisibleTextNode;
00123 class AttrTypeSet;
00124 class AttrTxtLineSpace;
00125 class AttrTxtJustification;
00126 
00127 // All operations OpTokens go here
00128 // Currently most ops do not have associated OpDescriptors, as they do not require GetState
00129 // functions. They are unlikely to ever get added to bars or get exposed for OLE-automation.
00130 // They are what they call 'Internal operations'
00131 
00132 // The FitTextToPath operation needs to live on menus etc. I suspect so it does need an OpToken
00133 #define OPTOKEN_FITTEXTTOPATH       _T("FitTextToPath")
00134 #define OPTOKEN_KERNTEXT            _T("Kern")
00135 #define OPTOKEN_AUTOKERNTEXT        _T("AutoKerning")
00136 #define OPTOKEN_TEXTSELECTION       _T("TextSelect")
00137 #define OPTOKEN_DELETESTORY         _T("TextStoryDeletion")
00138 #define OPTOKEN_REVERSESTORYPATH    _T("ReverseStoryPath")
00139 #define OPTOKEN_APPLYLEFTJUSTIFY    _T("ApplyLeftJustify")
00140 #define OPTOKEN_APPLYCENTREJUSTIFY  _T("ApplyCentreJustify")
00141 #define OPTOKEN_APPLYRIGHTJUSTIFY   _T("ApplyRightJustify")
00142 #define OPTOKEN_APPLYFULLJUSTIFY    _T("ApplyFullJustify")
00143 #define OPTOKEN_TEXTPASTE           _T("PasteText")
00144 #define OPTOKEN_TOGGLEPRINTASSHAPES _T("TogglePrintAsShapes")
00145 #define OPTOKEN_TEXTDRAGLEFTPATHINDENT  _T("DragLeftPathIndent")
00146 #define OPTOKEN_TEXTDRAGRIGHTPATHINDENT _T("DragRightPathIndent")
00147 #define OPTOKEN_TEXTDRAGLEFTNONPATHINDENT   _T("DragLeftNonPathIndent")
00148 #define OPTOKEN_TEXTDRAGRIGHTNONPATHINDENT  _T("DragRightNonPathIndent")
00149 #define OPTOKEN_AFFECTFONTCHANGE    _T("AffectFontChange")
00150 
00151 
00152 /********************************************************************************************
00153 >   class OpTextUndoable : public SelOperation
00154 
00155     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00156     Created:    24/3/95
00157 
00158     Purpose:    All undoable text operations are derived from this base class. It provides 
00159                 useful functions required by all Undoable Text Operations.
00160 
00161                 Principally DoStartFormatOp 
00162                             DoEndFormatOp
00163 
00164     SeeAlso:    OpTextUndoable::DoStartTextFormatOp
00165                 OpTextUndoable::DoEndTextFormatOp
00166 ********************************************************************************************/
00167 
00168 class OpTextUndoable : public SelOperation
00169 {         
00170 
00171     CC_DECLARE_DYNCREATE( OpTextUndoable )    
00172 
00173 public:
00174     OpTextUndoable();
00175     
00176     virtual BOOL DoStartTextOp(TextStory* pTextStory, BOOL StartBlobs = TRUE, BOOL EndBlobs = TRUE);
00177 };                                                                         
00178 
00179 
00180 /********************************************************************************************
00181 >   class OpCreateTextObject : public OpTextUndoable
00182 
00183     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00184     Created:    24/03/95
00185     Purpose:    This operation is invoked to allow the user to insert a TextStory into the 
00186                 document. Currently the only way the user can create a TextStory is to click
00187                 on a spread.
00188 ********************************************************************************************/
00189 
00190 class OpCreateTextObject : public OpTextUndoable
00191 {
00192 
00193     CC_DECLARE_DYNCREATE(OpCreateTextObject);
00194 
00195 public:
00196     // Construction/Destruction
00197     OpCreateTextObject();
00198 
00199     void GetOpName(String_256* OpName);
00200 
00201     // DoImmediate gets called after a click is received. The optional pPath parameter is a
00202     // path which is clicked on. It is the Do function
00203     void DoImmediate( Spread* pSpread, DocCoord Anchor, NodePath* pPath, ClickModifiers ClickMods, DocCoord StoryWidth = DocCoord(MinDocCoord, MinDocCoord));
00204 
00205     // Create a wrapping story by a drag, not on a path
00206     void DoDrag( Spread* pSpread, DocCoord Anchor, ClickModifiers ClickMods);
00207     void DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread* pSpread, BOOL bSolidDrag);
00208     void DragFinished( DocCoord PointerPos, ClickModifiers ClickMods, Spread* pSpread, BOOL Success, BOOL bSolidDrag);
00209     void RenderDragBlobs(DocRect EditPathBBox, Spread* pSpread, BOOL bSolidDrag);
00210 
00211 protected:
00212     DocCoord m_CurrentOtherEnd;
00213     DocCoord m_AnchorPoint;
00214     Spread* m_pStartSpread;
00215 };
00216 
00217 
00218 /********************************************************************************************
00219 >   class OpTextFormat: public OpTextUndoable
00220 
00221     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00222     Created:    9/7/93
00223     Purpose:    This class implements many of the 'operations' which will cause the TextStory
00224                 to be reformated.
00225 
00226                 A seperate Do function is provided for each of these ops
00227 ********************************************************************************************/
00228 
00229 class OpTextFormat: public OpTextUndoable
00230 {         
00231     CC_DECLARE_DYNCREATE( OpTextFormat )    
00232 
00233 public:
00234     OpTextFormat();
00235     
00236     // Op has no OpDescriptor                               
00237     
00238     enum InsertStatus {INSERT, OVER};                    // Insert or overwrite
00239     enum DeleteType {DEL, BACKSPACE};                    // Same as keys 
00240 
00241     void DoInsertChar(WCHAR Ch, OpTextFormat::InsertStatus InsStatus);
00242     BOOL DoInsertCharHelper(WCHAR Ch);
00243     void DoDeleteChar(OpTextFormat::DeleteType DelTyp);              
00244     void DoSwapCase();
00245     BOOL DoReturn(OpTextFormat::InsertStatus InsStatus);
00246     BOOL DoTab();
00247 
00248     // One GetOpName fn for all flavours of this op
00249     void GetOpName(String_256* OpName);
00250 
00251 
00252 private:
00253     BOOL DoDeleteSelection(TextStory* pTextStory, BOOL ReattachAttributes, BOOL* AllowOpRefused = NULL);
00254 };
00255 
00256 
00257 
00258 /********************************************************************************************
00259 >   class OpFitTextToCurve : public OpTextUndoable
00260 
00261     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00262     Created:    09/03/95
00263     Purpose:    This class is the operation used to fit a line of text to a path
00264 ********************************************************************************************/
00265 
00266 class OpFitTextToCurve: public OpTextUndoable     // Derived from this base class by Simon
00267 {         
00268 
00269     CC_DECLARE_DYNCREATE( OpFitTextToCurve )    
00270 
00271 public:
00272     OpFitTextToCurve();                             
00273     static BOOL     Init();             
00274     static OpState  GetState(String_256*, OpDescriptor*);       
00275     void            Do(OpDescriptor*);  
00276 
00277 private:
00278     static BOOL FindPathAndText(NodeRenderableInk** pPath, TextStory** pStory, UndoableOperation* pOp, UINT32* ID);
00279 };
00280 
00281 
00282 /********************************************************************************************
00283 >   class OpTextKern : public OpTextUndoable
00284 
00285     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00286     Created:    29/03/95
00287     Purpose:    This Operation applies a kern to the FocusStory
00288 ********************************************************************************************/
00289 
00290 class OpTextKern: public OpTextUndoable   
00291 {         
00292 
00293     CC_DECLARE_DYNCREATE( OpTextKern )    
00294 
00295 public:
00296     OpTextKern();                               
00297     static BOOL     Init();             
00298     static OpState  GetState(String_256*, OpDescriptor*);       
00299     virtual void    DoWithParam(OpDescriptor*, OpParam* pParam);
00300 
00301     virtual void    PerformMergeProcessing();
00302 
00303 private:
00304     // Routine to insert a Kern at the specified position in the tree, handles kern merging
00305     BOOL DoInsertKernWithMerge(VisibleTextNode* TTContextNode, DocCoord& Value);    
00306 };
00307 
00308 /********************************************************************************************
00309 >   class OpTextAuoKern : public OpTextUndoable
00310 
00311     Author:     Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
00312     Created:    27/10/2000
00313     Purpose:    This Operation applies autokern to the FocusStory
00314 ********************************************************************************************/
00315 
00316 class OpTextAutoKern: public OpTextUndoable   
00317 {         
00318     CC_DECLARE_DYNCREATE( OpTextAutoKern )
00319 
00320 public:
00321     OpTextAutoKern();
00322     static BOOL     Init();             
00323     static OpState  GetState(String_256*, OpDescriptor*);       
00324     virtual void    DoWithParam(OpDescriptor*, OpParam* pParam);
00325 };
00326 
00327 
00328 /********************************************************************************************
00329 >   class OpTextPaste : public OpPaste
00330 
00331     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00332     Created:    09/05/95
00333     Purpose:    An undoable operation to paste the contents of the clipboard into a
00334                 text story
00335 ********************************************************************************************/
00336 
00337 class OpTextPaste: public OpPaste
00338 {
00339     CC_DECLARE_DYNCREATE( OpTextPaste )    
00340 
00341     public:
00342         OpTextPaste();                              
00343         static BOOL     Init();
00344         static OpState  GetState(String_256*, OpDescriptor*);       
00345         void Do(OpDescriptor*);
00346 
00347     protected:
00348         BOOL DoPasteTextHelper();
00349         BOOL DoPasteText(TextStory *pPasteStory, TextStory *pFocusStory, Range* pPasteRange);
00350 };
00351 
00352 
00353 /********************************************************************************************
00354 >   class OpTogglePrintTextAsShapes : public Operation
00355 
00356     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00357     Created:    31/05/95
00358     Purpose:    This operation toggles the state of the "print text as shapes flag" in 
00359                 selected TextStories
00360 ********************************************************************************************/
00361 
00362 class OpTogglePrintTextAsShapes: public Operation     
00363 {         
00364     CC_DECLARE_DYNCREATE( OpTogglePrintTextAsShapes )    
00365 
00366 public:
00367     OpTogglePrintTextAsShapes() {};                             
00368     static BOOL     Init();             
00369     static OpState  GetState(String_256*, OpDescriptor*);       
00370     virtual void    Do(OpDescriptor*);
00371 };
00372 
00373 
00374 
00375 /********************************************************************************************
00376 >   class OpDeleteTextStory : public SelOperation
00377 
00378     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00379     Created:    25/04/95
00380     Purpose:    This operation should be used to hide a particular TextStory
00381 ********************************************************************************************/
00382 
00383 class OpDeleteTextStory: public SelOperation      
00384 {         
00385     CC_DECLARE_DYNCREATE( OpDeleteTextStory )    
00386 
00387 public:
00388     OpDeleteTextStory() {};                             
00389     static BOOL     Init();             
00390     static OpState  GetState(String_256*, OpDescriptor*);       
00391     virtual void    DoWithParam(OpDescriptor*, OpParam* pParam);
00392 
00393     static BOOL DoActions(UndoableOperation*, TextStory*);
00394 
00395     static BOOL RemoveEmptyFocusStory(UndoableOperation* pOp = NULL);
00396 
00397     void PerformMergeProcessing();
00398 };
00399 
00400 
00401 /********************************************************************************************
00402 >   class OpReverseStoryPath : public OpTextUndoable
00403 
00404     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00405     Created:    25/04/95
00406     Purpose:    This operation should be used to hide a particular TextStory
00407 ********************************************************************************************/
00408 
00409 class OpReverseStoryPath: public OpTextUndoable   
00410 {         
00411     CC_DECLARE_DYNCREATE( OpReverseStoryPath )    
00412 
00413 public:
00414     OpReverseStoryPath() {};                                
00415     static BOOL     Init();             
00416     static OpState  GetState(String_256*, OpDescriptor*);       
00417     virtual void    Do(OpDescriptor*);
00418 };
00419 
00420 
00421 /********************************************************************************************
00422 >   class OpApplyJustificationToStory : public Operation
00423 
00424     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00425     Created:    27/04/95
00426     Purpose:    This operation is the base class of the operations that sit on the TextStory
00427                 pop-up menu
00428 ********************************************************************************************/
00429 
00430 class OpApplyJustificationToStory: public Operation   
00431 {         
00432     CC_DECLARE_DYNCREATE( OpApplyJustificationToStory )    
00433 
00434 public:
00435     OpApplyJustificationToStory() {};                               
00436     static BOOL     Init();             
00437     static OpState  GetState(String_256*, OpDescriptor*);       
00438 };
00439 
00440 
00441 /********************************************************************************************
00442 >   class OpApplyLeftJustifyToStory : public OpApplyJustificationToStory
00443 
00444     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00445     Created:    27/04/95
00446     Purpose:    This operation is the left justify option on the TextStory pop-up menu.
00447 ********************************************************************************************/
00448 
00449 class OpApplyLeftJustifyToStory: public OpApplyJustificationToStory   
00450 {         
00451     CC_DECLARE_DYNCREATE( OpApplyLeftJustifyToStory )    
00452 
00453 public:
00454     OpApplyLeftJustifyToStory() {};                             
00455     virtual void    Do(OpDescriptor*);
00456 };
00457 
00458 
00459 /********************************************************************************************
00460 >   class OpApplyCentreJustifyToStory : public OpApplyJustificationToStory
00461 
00462     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00463     Created:    27/04/95
00464     Purpose:    This operation is the centre justify option on the TextStory pop-up menu.
00465 ********************************************************************************************/
00466 
00467 class OpApplyCentreJustifyToStory: public OpApplyJustificationToStory     
00468 {         
00469     CC_DECLARE_DYNCREATE( OpApplyCentreJustifyToStory )    
00470 
00471 public:
00472     OpApplyCentreJustifyToStory() {};                               
00473     virtual void    Do(OpDescriptor*);
00474 };
00475 
00476 
00477 /********************************************************************************************
00478 >   class OpApplyRightJustifyToStory : public OpApplyJustificationToStory
00479 
00480     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00481     Created:    27/04/95
00482     Purpose:    This operation is the right justify option on the TextStory pop-up menu.
00483 ********************************************************************************************/
00484 
00485 class OpApplyRightJustifyToStory: public OpApplyJustificationToStory      
00486 {         
00487     CC_DECLARE_DYNCREATE( OpApplyRightJustifyToStory )    
00488 
00489 public:
00490     OpApplyRightJustifyToStory() {};                                
00491     virtual void    Do(OpDescriptor*);
00492 };
00493 
00494 
00495 /********************************************************************************************
00496 >   class OpApplyFullJustifyToStory : public OpApplyJustificationToStory
00497 
00498     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00499     Created:    27/04/95
00500     Purpose:    This operation is the full justify option on the TextStory pop-up menu.
00501 ********************************************************************************************/
00502 
00503 class OpApplyFullJustifyToStory: public OpApplyJustificationToStory   
00504 {         
00505     CC_DECLARE_DYNCREATE( OpApplyFullJustifyToStory )    
00506 
00507 public:
00508     OpApplyFullJustifyToStory() {};                             
00509     virtual void    Do(OpDescriptor*);
00510 };
00511 
00512 
00513 /********************************************************************************************
00514 >   class PrePostTextAction : public Action
00515 
00516     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00517     Created:    14/03/95
00518     Purpose:    This action will be generated at the start and end of an OpTextUndoable 
00519                 operation. It will perform the following tasks
00520 
00521                 Restores the Caret position
00522                 
00523                 Calls FormatAndChild on the Text story on which it operates so that text 
00524                 stories get formated when we undo/redo.
00525 
00526                 The action toggles between being active and not active so that it only
00527                 gets executed when it is a last executed action. 
00528 ********************************************************************************************/
00529 
00530 class PrePostTextAction : public Action
00531 {
00532 
00533 CC_DECLARE_DYNCREATE(PrePostTextAction)
00534 
00535 public:
00536     PrePostTextAction();
00537     ~PrePostTextAction();
00538     virtual ActionCode Execute();
00539     static ActionCode Init( Operation* pOp,
00540                             ActionList* pActionList,
00541                             TextStory* pStory,
00542                             BOOL ThisActionReformats,
00543                             BOOL ToTail = FALSE);
00544     static BOOL DoFormatStory(UndoableOperation* pUndoOp, TextStory* pStory,
00545         BOOL ToTail = FALSE);
00546 
00547     // DMc inserted
00548     BOOL DoIReformat() { return HasEffect; }
00549 
00550 protected:
00551     BOOL                HasEffect;
00552     VisibleTextNode*    CaretContextNode; // Restores the caret relative to this node
00553     AttachNodeDirection CaretAttachDir;   // direction in which to attach caret to context node
00554     TextStory*          pTextStoryToReformat;
00555     BOOL                m_bToTail;        // DMc - tells the action whether to put itself
00556                                           // at the head or the tail of the action
00557 };
00558 
00559 
00560 /********************************************************************************************
00561 >   class PositionCaretAction : public Action
00562 
00563     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00564     Created:    11/04/95
00565     Purpose:    This action is used to position a caret within a TextStory.  Its execute
00566                 function inserts another PositionCaretAction into the undo record to return
00567                 the caret to its current position and then moves it to the stored position
00568 ********************************************************************************************/
00569 
00570 class PositionCaretAction : public Action
00571 {
00572 
00573 CC_DECLARE_DYNCREATE(PositionCaretAction)
00574 
00575 public:
00576     PositionCaretAction();
00577     ~PositionCaretAction();
00578     virtual ActionCode Execute();
00579     static ActionCode Init( Operation* pOp,
00580                             ActionList* pActionList,
00581                             TextStory* pStory,
00582                             BaseTextClass* pAttachNode,
00583                             AttachNodeDirection Direction);
00584     static BOOL DoStoreCaretPosition( Operation* pOp, TextStory* pStory);
00585 
00586 protected:
00587     static BOOL GetCaretNeighbour(TextStory* pStory, BaseTextClass** pNeighbour, AttachNodeDirection * pDirection); 
00588 
00589 // Member variables stored with each action
00590     TextStory*          pTextStory;
00591     BaseTextClass*      pNearNode;
00592     AttachNodeDirection AttachDirection;
00593 }; 
00594 
00595 /********************************************************************************************
00596 
00597 >   class ToggleStoryAutoKerning : public Action
00598 
00599     Author:     Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
00600     Created:    27/10/2000
00601     Purpose:    Toggle a story's auto kerning value
00602 
00603 ********************************************************************************************/
00604 class ToggleAutoKerningAction : public Action
00605 {
00606     CC_DECLARE_DYNCREATE(ToggleAutoKerningAction)
00607 
00608 public:
00609     ToggleAutoKerningAction();
00610     virtual ActionCode Execute();
00611     static ActionCode Init( Operation* pOp,
00612                             ActionList* pActionList,
00613                             TextStory* pStory,
00614                             BOOL NewIsAutoKerning);
00615 
00616 protected:
00617     TextStory*  pTextStory;
00618     bool        OldIsAutoKerning;
00619 };
00620 
00621 
00622 /********************************************************************************************
00623 >   class VerticalInsetStore
00624 
00625     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00626     Created:    21/11/95
00627     Purpose:    Class grouping the data for a vertical insert position.  The story and the
00628                 inset.  As the cursor moved vertically it should keep its position along
00629                 the line.  The OpTextCaret remembers this across each caret move. 
00630 ********************************************************************************************/
00631 const INT32 VERTICALMOVEINSET_NONE = 0xf0000000;
00632 class VerticalInsetStore
00633 {
00634 public:
00635     VerticalInsetStore() {HoldingInset = VERTICALMOVEINSET_NONE; LastInset = VERTICALMOVEINSET_NONE;};
00636 
00637     INT32 HoldingInset;
00638     INT32 LastInset;
00639 };
00640 
00641 
00642 /********************************************************************************************
00643 >   class OpTextCaret: public Operation
00644 
00645     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00646     Created:    25/3/95
00647     Purpose:    OpTextCaret groups together all caret moving ops. 
00648 ********************************************************************************************/
00649 
00650 class OpTextCaret: public Operation
00651 {
00652     CC_DECLARE_DYNCREATE(OpTextCaret)
00653 
00654 public:
00655     OpTextCaret();
00656     void DoMoveCaretLeft(BOOL WithSelect, BOOL AWord);  // Move the caret left
00657     void DoMoveCaretRight(BOOL WithSelect, BOOL AWord); // Move the caret right
00658     void DoMoveCaretUp(BOOL WithSelect);                // Move the caret up
00659     void DoMoveCaretDown(BOOL WithSelect);              // Move the caret down
00660     void DoMoveCaretHome(BOOL WithSelect, BOOL ToStoryStart);   // Move the caret to the start of the line
00661     void DoMoveCaretEnd(BOOL WithSelect, BOOL ToStoryEnd);      // Move the caret to the end of the line
00662     void DoSelectWordAtCaret();
00663 
00664     static VisibleTextNode* GetLineStartCharacter(VisibleTextNode* pCharacter);
00665     static VisibleTextNode* GetLineEndCharacter(VisibleTextNode* pCharacter);
00666 
00667     static void SelectStoryCharacters(VisibleTextNode*, VisibleTextNode*, TextStory*, CaretNode*);
00668 
00669 protected:
00670     void MoveCaretToSelectionEnd(BOOL MoveToLeft);
00671     void CompleteOperation();
00672     VisibleTextNode* GetCharacterLineChange(VisibleTextNode* pCharacter,
00673                                             BOOL ToLeftOfChar,
00674                                             BOOL* NewToLeft,
00675                                             BOOL MoveUp);
00676 
00677     // Common code for cursor-key caret movement
00678     BOOL PreCaretMove();
00679     
00680     // Data members
00681     TextStory* pStory;              // Pointer to focus story
00682     CaretNode* pCaret;              // Pointer to caret with in.
00683     VisibleTextNode* pOtherSelEnd;  // Pointer to the other end of the selection (caret is at one end)
00684     BOOL SelToRightOfCaret;
00685 
00686     static VerticalInsetStore VertInset;
00687     VerticalInsetStore PreviousVerticalInset;
00688 };
00689 
00690 
00691 /********************************************************************************************
00692 >   class OpTextSelection : public Operation
00693 
00694     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00695     Created:    03/04/95
00696     Purpose:    This is the operation that positions the caret after a click, and then does
00697                 a drag to select characters.  It also provides other functions for selecting
00698                 groups of characters
00699 ********************************************************************************************/
00700 
00701 class OpTextSelection : public Operation
00702 {
00703 
00704 CC_DECLARE_DYNCREATE(OpTextSelection);
00705 
00706 public:
00707     enum SelectionPos {TO_LEFT, TO_RIGHT, NOT_NEAR};
00708     
00709     // Construction/Destruction
00710     OpTextSelection();
00711 
00712     // Call this to position the caret and start region selection
00713     BOOL DoDrag( DocCoord Anchor, Spread* pSpread, ClickModifiers ClickMods, Node* ClickNode);
00714     virtual BOOL SnappingDrag() { return FALSE; }
00715     
00716     // Virtual functions needed for the dragging operations to work
00717     virtual void DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread* pSpread, BOOL bSolidDrag);
00718     virtual void DragFinished( DocCoord PointerPos, ClickModifiers ClickMods, Spread* pSpread, BOOL Success, BOOL bSolidDrag);
00719 
00720     // These functions required for the OpDescriptor class
00721     static BOOL Declare();
00722     static OpState GetState(String_256* Description, OpDescriptor*);
00723     static BOOL Init();
00724 
00725     // Non-drag ways of selecting text
00726     BOOL DoSelectAllText(TextStory* pStory);
00727     BOOL DoSelectLineText();
00728 
00729 protected:
00730     // Member functions
00731     BOOL InitialCaretPosition(VisibleTextNode*);
00732     BOOL ExtendSelection(VisibleTextNode*, DocCoord ClickPoint);
00733     BOOL SelectLine();
00734     SelectionPos IsClickToLeftHalfOfChar(AbstractTextChar* pClickChar, DocCoord ClickPoint, BOOL MustChoose);
00735 
00736     BOOL GetNewSelEndsOnPath(DocCoord Point, VisibleTextNode** pSelStart, VisibleTextNode** pSelEnd, BOOL*);
00737     BOOL GetNewSelEndsInStory(DocCoord Point, VisibleTextNode** pSelStart, VisibleTextNode** pSelEnd);
00738     BOOL GetNewSelBoundsChars(BOOL, BOOL, VisibleTextNode*, VisibleTextNode**, VisibleTextNode**);
00739 
00740     // Member variables
00741     Spread* StartSpread;
00742     DocCoord StartPoint;
00743     TextStory* pSelectionStory; 
00744     CaretNode* pCaret;
00745 };
00746 
00747 
00748 /********************************************************************************************
00749 >   class StorePathIndentAction : public Action
00750 
00751     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00752     Created:    18/12/95
00753     Purpose:    This action is used to store a text stories path indent value.
00754 ********************************************************************************************/
00755 
00756 class StorePathIndentAction : public Action
00757 {
00758     CC_DECLARE_DYNCREATE(StorePathIndentAction)
00759     
00760 public:
00761     StorePathIndentAction();
00762     ~StorePathIndentAction();
00763     virtual ActionCode Execute();
00764     static ActionCode Init( Operation* pOp, ActionList* pActionList, TextStory* pStory, MILLIPOINT LeftIndent, MILLIPOINT RightIndent, MILLIPOINT StoryWidth);
00765     static BOOL DoStoreIndent( Operation* pOp, ActionList* pActionList, TextStory* pStory);
00766 
00767 protected:
00768 // Member variables stored with each action
00769     TextStory* mpTextStory;
00770     MILLIPOINT mLeftIndentLength;
00771     MILLIPOINT mRightIndentLength;
00772     MILLIPOINT mStoryWidth;
00773 }; 
00774 
00775 
00776 /********************************************************************************************
00777 >   class OpDragStoryIndent : public OpTextUndoable
00778 
00779     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00780     Created:    15/12/95
00781     Purpose:    This is the operation that is used to drag the indent position along the path
00782                 the text story is on
00783 ********************************************************************************************/
00784 
00785 class OpDragStoryIndent : public OpTextUndoable
00786 {
00787     CC_DECLARE_DYNAMIC(OpDragStoryIndent);
00788 
00789 public:
00790         // Construction/Destruction
00791     OpDragStoryIndent();
00792     ~OpDragStoryIndent();
00793 
00794     // Call this to start the drag going
00795     BOOL DoDrag( DocCoord Anchor, Spread* pSpread, ClickModifiers ClickMods, TextStory* pStory);
00796     
00797     // Virtual functions needed for the dragging operations to work
00798     virtual void DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread* pSpread, BOOL bSolidDrag);
00799     virtual void DragFinished( DocCoord PointerPos, ClickModifiers ClickMods, Spread* pSpread, BOOL Success, BOOL bSolidDrag);
00800     virtual void RenderDragBlobs( DocRect, Spread*, BOOL bSolidDrag );
00801 
00802     // These functions required for the OpDescriptor class
00803     static OpState GetState(String_256* Description, OpDescriptor*);
00804 
00805 protected:
00806     // Functions that the derived classes must provide
00807     virtual DocCoord GetOtherIndent() = 0;
00808     virtual DocCoord GetThisIndent() = 0;
00809     virtual BOOL DoIndentChange() = 0; 
00810     virtual DocCoord InternalConstrain(DocCoord Current, ClickModifiers ClickMods) = 0;
00811     virtual BOOL SetCurrentPos(DocCoord MousePos, ClickModifiers ClickMods) = 0;
00812 
00813 protected:
00814     // Member functions
00815     void RenderDraggingBlobs( DocRect, Spread* );
00816     static BOOL GetLeftHandLength(DocCoord Coord, NodePath* pPath, MILLIPOINT* pResult);
00817     static BOOL GetRightHandLength(DocCoord Coord, NodePath* pPath, MILLIPOINT* pResult);
00818     BOOL GetLeftHandLength(MILLIPOINT* pResult);
00819     BOOL GetRightHandLength(MILLIPOINT* pResult);
00820 
00821     // Member variables
00822     DocCoord mStartPoint;
00823     DocCoord mCurrentBlobPos;
00824     Spread* mpStartSpread;
00825     TextStory* mpDragStory;
00826     NodePath* mpStoryPath;
00827 };
00828 
00829 
00830 /********************************************************************************************
00831 >   class OpDragStoryPathIndent : public OpDragStoryIndent
00832 
00833     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00834     Created:    19/8/96
00835     Purpose:    Base class for dragging indents for stories on a path
00836 ********************************************************************************************/
00837 class OpDragStoryPathIndent : public OpDragStoryIndent
00838 {
00839     CC_DECLARE_DYNAMIC(OpDragStoryPathIndent);
00840 
00841 public:
00842     // Construction/Destruction
00843     OpDragStoryPathIndent() {};
00844     ~OpDragStoryPathIndent() {};
00845 
00846 protected:
00847     virtual BOOL SetCurrentPos(DocCoord MousePos, ClickModifiers ClickMods);
00848 
00849 };
00850 
00851 
00852 /********************************************************************************************
00853 >   class OpDragStoryPathLeftIndent : public OpDragStoryPathIndent
00854 
00855     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00856     Created:    19/8/96
00857     Purpose:    This is the operation that is used to drag the left hand path indent
00858 ********************************************************************************************/
00859 class OpDragStoryPathLeftIndent : public OpDragStoryPathIndent
00860 {
00861     CC_DECLARE_DYNCREATE(OpDragStoryPathLeftIndent);
00862 
00863 public:
00864     // Construction/Destruction
00865     OpDragStoryPathLeftIndent() {};
00866     ~OpDragStoryPathLeftIndent() {};
00867 
00868     static BOOL Init();
00869 
00870 protected:
00871     virtual DocCoord InternalConstrain(DocCoord Current, ClickModifiers ClickMods);
00872 
00873 protected:
00874     virtual DocCoord GetOtherIndent();
00875     virtual DocCoord GetThisIndent();
00876     virtual BOOL DoIndentChange();
00877 };
00878 
00879 
00880 /********************************************************************************************
00881 >   class OpDragStoryPathRightIndent : public OpDragStoryPathIndent
00882 
00883     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00884     Created:    19/8/96
00885     Purpose:    This is the operation that is used to drag the right hand path indent
00886 ********************************************************************************************/
00887 class OpDragStoryPathRightIndent : public OpDragStoryPathIndent
00888 {
00889     CC_DECLARE_DYNCREATE(OpDragStoryPathRightIndent);
00890 
00891 public:
00892     // Construction/Destruction
00893     OpDragStoryPathRightIndent() {};
00894     ~OpDragStoryPathRightIndent() {};
00895 
00896     static BOOL Init();
00897 
00898 protected:
00899     virtual DocCoord InternalConstrain(DocCoord Current, ClickModifiers ClickMods);
00900 
00901 protected:
00902     virtual DocCoord GetOtherIndent();
00903     virtual DocCoord GetThisIndent();
00904     virtual BOOL DoIndentChange();
00905 };
00906 
00907 
00908 
00909 /********************************************************************************************
00910 >   class OpDragStoryNonPathIndent : public OpDragStoryIndent
00911 
00912     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00913     Created:    19/8/96
00914     Purpose:    Base class for dragging indents for stories not on a path
00915 ********************************************************************************************/
00916 class OpDragStoryNonPathIndent : public OpDragStoryIndent
00917 {
00918     CC_DECLARE_DYNAMIC(OpDragStoryNonPathIndent);
00919 
00920 public:
00921     // Construction/Destruction
00922     OpDragStoryNonPathIndent() {};
00923     ~OpDragStoryNonPathIndent() {};
00924 
00925 protected:
00926     virtual DocCoord InternalConstrain(DocCoord Current, ClickModifiers ClickMods);
00927     virtual BOOL SetCurrentPos(DocCoord MousePos, ClickModifiers ClickMods);
00928 };
00929 
00930 
00931 /********************************************************************************************
00932 >   class OpDragStoryNonPathLeftIndent : public OpDragStoryNonPathIndent
00933 
00934     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00935     Created:    19/8/96
00936     Purpose:    This is the operation that is used to drag the left hand path indent
00937 ********************************************************************************************/
00938 class OpDragStoryNonPathLeftIndent : public OpDragStoryNonPathIndent
00939 {
00940     CC_DECLARE_DYNCREATE(OpDragStoryNonPathLeftIndent);
00941 
00942 public:
00943     // Construction/Destruction
00944     OpDragStoryNonPathLeftIndent() {};
00945     ~OpDragStoryNonPathLeftIndent() {};
00946 
00947     static BOOL Init();
00948 
00949 protected:
00950     virtual DocCoord GetOtherIndent();
00951     virtual DocCoord GetThisIndent();
00952     virtual BOOL DoIndentChange();
00953 };
00954 
00955 
00956 /********************************************************************************************
00957 >   class OpDragStoryNonPathRightIndent : public OpDragStoryNonPathIndent
00958 
00959     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00960     Created:    19/8/96
00961     Purpose:    This is the operation that is used to drag the right hand path indent
00962 ********************************************************************************************/
00963 class OpDragStoryNonPathRightIndent : public OpDragStoryNonPathIndent
00964 {
00965     CC_DECLARE_DYNCREATE(OpDragStoryNonPathRightIndent);
00966 
00967 public:
00968     // Construction/Destruction
00969     OpDragStoryNonPathRightIndent() {};
00970     ~OpDragStoryNonPathRightIndent() {};
00971 
00972     static BOOL Init();
00973 
00974 protected:
00975     virtual DocCoord GetOtherIndent();
00976     virtual DocCoord GetThisIndent();
00977     virtual BOOL DoIndentChange();
00978 };
00979 
00980 
00981 
00982 
00983 /********************************************************************************************
00984     class CCAPI OpAffectFontChange : public Operation
00985 
00986     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00987     Created:    17/01/96
00988     Purpose:    An operation to scan all objects in all documents, calling a user defined
00989                 function to perform a none undoable operation on them.
00990 ********************************************************************************************/
00991 
00992 class CCAPI OpApplyGlobalAffect : public Operation
00993 {
00994 CC_DECLARE_DYNCREATE( OpApplyGlobalAffect );
00995 
00996 protected:
00997     void            DoAffectChange(ObjChangeParam* pObjChange, Document* pSearchDoc=NULL);
00998     virtual void    AffectNode(Document*, Node*, ObjChangeParam*);
00999 };
01000 
01001 
01002 /********************************************************************************************
01003     class CCAPI OpAffectFontChange : public OpApplyGlobalAffect
01004 
01005     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
01006     Created:    17/01/96
01007     Purpose:    An operation to update all text stories in all documents
01008 ********************************************************************************************/
01009 
01010 class CCAPI OpAffectFontChange : public OpApplyGlobalAffect
01011 {         
01012 CC_DECLARE_DYNCREATE( OpAffectFontChange );
01013 
01014 public:
01015     static BOOL     Init();             
01016     static OpState  GetState(String_256*, OpDescriptor*);
01017     void            DoAffectFontChange();
01018 
01019 protected:
01020     virtual void    AffectNode(Document*, Node*, ObjChangeParam*);
01021 };  
01022 
01023 
01024 #endif      // INC_TEXTOPS

Generated on Sat Nov 10 03:48:01 2007 for Camelot by  doxygen 1.4.4