texttool.h

Go to the documentation of this file.
00001 // $Id: texttool.h 1535 2006-07-25 16:50:32Z alex $
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 #ifndef INC_TEXTTOOL
00101 #define INC_TEXTTOOL
00102 
00103 //#include "tool.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 #include "transop.h"
00105 
00106 class Cursor;
00107 class TextStory;
00108 class CaretNode;
00109 class KeyPress;
00110 
00111 #if !defined(EXCLUDE_FROM_RALPH)
00112 class TextInfoBarOp;
00113 #endif
00114 
00115 /********************************************************************************************
00116 >   class TextToolBlobPosItem : public ListItem
00117 
00118     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00119     Created:    5/2/96
00120     Purpose:    The class of objects stored in the TextToolBlobPosList.  These items store
00121                 the blobs position and associated story.
00122 ********************************************************************************************/
00123 class TextToolBlobPosItem : public ListItem
00124 {
00125 public:
00126     CC_DECLARE_DYNAMIC(TextToolBlobPosItem);
00127     TextToolBlobPosItem(DocCoord Left, DocCoord Right, BOOL Connected, TextStory* pStory);
00128     ~TextToolBlobPosItem();
00129 
00130 public:
00131     // Access functions
00132     DocCoord GetLeftBlobPos() const     {return m_LeftBlobPos;}
00133     DocCoord GetRightBlobPos() const    {return m_RightBlobPos;}
00134     BOOL IsConnected() const            {return m_BlobsConnected;}
00135     TextStory* GetBlobStory() const     {return m_pTextStory;}
00136 
00137 protected:
00138     DocCoord m_LeftBlobPos;
00139     DocCoord m_RightBlobPos;
00140     BOOL m_BlobsConnected;
00141     TextStory* m_pTextStory;
00142 };
00143 
00144 
00145 /********************************************************************************************
00146 >   class TextToolBlobPosList : public List
00147 
00148     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00149     Created:    5/2/96
00150     Purpose:    A list the positions of blobs that the text tool is rendering as tool blobs.
00151                 This class is just a wrapper arouind the list class, providing common handling
00152                 functions.
00153 ********************************************************************************************/
00154 class TextToolBlobPosList : public List
00155 {
00156 public:
00157     CC_DECLARE_DYNAMIC(TextToolBlobPosList);
00158     TextToolBlobPosList();
00159     ~TextToolBlobPosList();
00160 
00161     BOOL BuildFromSelection();
00162     BOOL RenderAllBlobs(Spread* pSpread = NULL, DocRect* pClipRect = NULL);
00163     static void RenderBlobPair(Spread* pSpread, DocRect* pClipRect, TextToolBlobPosItem* pPair);
00164     static void RenderBlob(Spread* pSpread, DocRect* pClipRect, DocCoord BlobPos);
00165     BOOL FindBlobStory(Spread* pSpread, DocCoord PointerPos, BOOL* pLeft, TextStory** pStory);
00166     BOOL RenderAndRemove(TextStory* pStory); 
00167     void RenderAndRemoveAll(); 
00168 
00169     Spread* GetBlobSpread() const {return m_pSelSpread;}
00170 
00171 protected:
00172     Spread* m_pSelSpread;
00173 };
00174 
00175 
00176 
00177 
00178 
00179 /********************************************************************************************
00180 
00181 >   class TextTool : public Tool_v1
00182 
00183     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00184     Created:    3/10/94
00185     Purpose:    A template tool class
00186 
00187 ********************************************************************************************/
00188 
00189 class CCAPI TextTool : public Tool_v1
00190 {
00191 CC_DECLARE_MEMDUMP(TextTool);
00192 
00193 public:
00194     TextTool();
00195     ~TextTool();
00196 
00197     // Standard calls your tool must provide
00198     BOOL Init();
00199     void Describe(void* InfoPtr);
00200     UINT32 GetID() { return TOOLID_TEXT; };
00201 
00202     // This returns TRUE if the text-tool is delaying it's updates until it is idle.  It
00203     // is used by the OLE update routines to avoid luching redraws ...
00204     static BOOL DelayingUpdate();
00205     
00206     // Some very common event handlers
00207     void SelectChange(BOOL isSelected);
00208     void OnClick( DocCoord, ClickType, ClickModifiers, Spread* );
00209     void OnMouseMove(DocCoord PointerPos,Spread* pSpread, ClickModifiers ClickMods);
00210     void RenderToolBlobs(Spread *, DocRect*);
00211 
00212     // new event handles for handling tab stops on the page ruler
00213     void GetRulerOrigin(Spread*,UserCoord*);
00214     void RenderRulerBlobs(RulerBase* pRuler, UserRect& UpdateRect, BOOL IsBackground);
00215     BOOL OnRulerClick( UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
00216                        Spread* pSpread, RulerBase* pRuler);
00217     BOOL GetRulerStatusLineText(String_256* pText, UserCoord PointerPos, Spread* pSpread, RulerBase* pRuler);
00218 
00219 
00220     BOOL OnKeyPress(KeyPress* pKeyPress);
00221     BOOL GetStatusLineText(String_256* ptext, Spread* pSpread, DocCoord DocPos, ClickModifiers ClickMods);
00222     BOOL OnIdle();
00223 
00224     // Some useful static functions
00225 #if !defined(EXCLUDE_FROM_RALPH)
00226     static TextInfoBarOp*   GetTextInfoBarOp()  { return pTextInfoBarOp; }
00227 #endif
00228     static BOOL             IsCurrentTool()      { return CurrentTool; }
00229 
00230     void LocaleChanged();
00231     BOOL SelectionHasChanged();
00232 
00233     virtual BOOL AreToolBlobsRenderedOnSelection() {return TRUE;}
00234 
00235 protected:
00236     // Status line help functions
00237     void DisplayStatusBarHelp(DocCoord DocPos, Spread* pSpread, ClickModifiers ClickMods);
00238     void GetCurrentStatusText(String_256* ptext, Spread* pSpread, DocCoord DocPos, ClickModifiers ClickMods);
00239 
00240     // Mouse click and movement functions
00241     BOOL IsPointNearUnselectedTextStory(Spread*, DocCoord, TextStory**, Node**, BOOL);
00242     BOOL IsPointNearNonStoryPath(Spread*, DocCoord, NodePath**, BOOL);
00243     BOOL HandleSingleClick(Spread*, DocCoord, ClickModifiers);
00244     BOOL HandleDoubleClick(Spread*, DocCoord, ClickModifiers);
00245     BOOL HandleTripleClick(Spread*, DocCoord, ClickModifiers);
00246     BOOL HandleQuadClick(Spread*, DocCoord, ClickModifiers);
00247     BOOL HandleDragClick(Spread*, DocCoord, ClickModifiers);
00248 
00249     // Keypress processing
00250     BOOL RegisterDeadKeys();
00251     BOOL RemoveDeadKeys();
00252     BOOL RegisterAdditionalVirtKey(KeyPress** pKey, TCHAR ch);
00253     BOOL HandleSpecialNonStoryKeys(KeyPress* pKeyPress);
00254     BOOL HandleSpecialStoryAndNonStoryKeys(KeyPress* pKeyPress);
00255     BOOL HandleDeadKeys(KeyPress* pKeyPress, WCHAR* pNewUnicode);
00256     BOOL TestForDeadKey(KeyPress* pKeyPress, KeyPress* pDeadKeypress);
00257     BOOL HandleSpecialStoryKeys(KeyPress* pKeyPress, TextStory* pStory, CaretNode* pCaret);
00258     BOOL IsUsableUnicode(WCHAR CodeValue);
00259     BOOL ApplyBold();
00260     BOOL ApplyItalic();
00261     BOOL IncreaseTrackKern();
00262     BOOL DecreaseTrackKern();
00263     BOOL CommonApplyKern(MILLIPOINT ChangeAmmount);
00264     BOOL CommonApplyTracking(MILLIPOINT ChangeAmmount);
00265 
00266     BOOL OnToolSelect();
00267     BOOL OnToolDeselect();
00268 
00269     BOOL CreateCursors();                       // Create  your tool's cursors in this func
00270     void DestroyCursors();                      // Destroy your tool's cursors in this func
00271 
00272     static BOOL             CurrentTool;        // Can be useful to keep a "is my tool currenmt?" flag
00273 #if !defined(EXCLUDE_FROM_RALPH)
00274     static TextInfoBarOp*   pTextInfoBarOp;     // Ptr to your tool's infobar
00275 #endif
00276 
00277     Cursor* pcNormalTextCursor;
00278     Cursor* pcBlobTextCursor;
00279     Cursor* pcBlankCursor;
00280     Cursor* pcIndentCursor;
00281     Cursor* pcCurrentCursor;
00282 
00283     INT32 CurrentCursorID;                      // A unique cursor id for Jim's new cursor stacking
00284     BOOL IsBlankCursorUp;
00285 
00286     // Standard tool static vars
00287     static  TCHAR* FamilyName;                  // The Tools Family Name
00288     static  TCHAR* ToolName;                        // The Tool Name
00289     static  TCHAR* Purpose;                     // What the tool is for
00290     static  TCHAR* Author;                      // Who wrote it
00291 
00292     BOOL UpdateAfterTyping;
00293 
00294     TextStory* pLastFocusStory;
00295 
00296     // Ini file preferences
00297     static BOOL UseDeadKeys;
00298 
00299     // Used for dead key accent entry
00300     KeyPress* PreviousDeadKey;
00301     KeyPress* GraveVirtKey;
00302     KeyPress* AcuteVirtKey;
00303     KeyPress* HatVirtKey;
00304     KeyPress* TildeVirtKey;
00305     KeyPress* ColonVirtKey;
00306     KeyPress* AtVirtKey;
00307     KeyPress* CommaVirtKey;
00308     KeyPress* SlashVirtKey;
00309 
00310     // List of current blobs
00311     TextToolBlobPosList m_BlobPosList;
00312 };
00313 
00314 
00315 #endif          // INC_TEXTTOOL

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