TextTool Class Reference

A template tool class. More...

#include <texttool.h>

Inheritance diagram for TextTool:

Tool_v1 List of all members.

Public Member Functions

 TextTool ()
 Default Constructor. Other initialisation is done in TextTool::Init which is called by the Tool Manager.
 ~TextTool ()
 Destructor (Virtual). Does nothing.
BOOL Init ()
 Used to check if the Tool was properly constructed.
void Describe (void *InfoPtr)
 Allows the tool manager to extract information about the tool.
UINT32 GetID ()
void SelectChange (BOOL isSelected)
 Starts up and closes down the Text tool.
void OnClick (DocCoord, ClickType, ClickModifiers, Spread *)
 To handle a Mouse Click event for the Text Tool.
void OnMouseMove (DocCoord PointerPos, Spread *pSpread, ClickModifiers ClickMods)
 To handle a Mouse Move event for the Text Tool.
void RenderToolBlobs (Spread *, DocRect *)
 Called to render the tool blobs for the text tool.
void GetRulerOrigin (Spread *, UserCoord *)
 Gives the current tool the chance to change the coordinates displayed on the ruler.
void RenderRulerBlobs (RulerBase *pRuler, UserRect &UpdateRect, BOOL IsBackground)
 Gives the current tool the chance to render additional blobs on the ruler Is called twice - once before the standard ruler graphics are rendered (to allow additional background to be drawn) and once afterwards.
BOOL OnRulerClick (UserCoord PointerPos, ClickType Click, ClickModifiers Mods, Spread *pSpread, RulerBase *pRuler)
 Called when the user has clicked on the ruler and we are the current tool.
BOOL GetRulerStatusLineText (String_256 *pText, UserCoord PointerPos, Spread *pSpread, RulerBase *pRuler)
 Allows the tool to set the status line text for the ruler.
BOOL OnKeyPress (KeyPress *pKeyPress)
 To handle a keypress event for the Text Tool.
BOOL GetStatusLineText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 Returns the current status line help string.
BOOL OnIdle ()
 Called on idle events. Used to update the infobar kern field after typing.
void LocaleChanged ()
 Called when the machines locale changes. Re-registers the dead keys as their virtual key code may have changed.
BOOL SelectionHasChanged ()
 Called when the selection has changed. Ensures tool blobs are up-to-date.
virtual BOOL AreToolBlobsRenderedOnSelection ()

Static Public Member Functions

static BOOL DelayingUpdate ()
 Let's the caller know if the text-tool has finished mucking about with the document's modified flag.
static TextInfoBarOpGetTextInfoBarOp ()
static BOOL IsCurrentTool ()

Protected Member Functions

void DisplayStatusBarHelp (DocCoord DocPos, Spread *pSpread, ClickModifiers ClickMods)
 Displays status help string for the given position in the status bar.
void GetCurrentStatusText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 Selects a suitable string for the status line based on the current location (as input via the parameters).
BOOL IsPointNearUnselectedTextStory (Spread *, DocCoord, TextStory **, Node **, BOOL)
 To see if a click at the current positon would select a TextStory.
BOOL IsPointNearNonStoryPath (Spread *, DocCoord, NodePath **, BOOL)
 To see if a click at the current positon should create a story on a path.
BOOL HandleSingleClick (Spread *, DocCoord, ClickModifiers)
 To handle single click events in the text tool.
BOOL HandleDoubleClick (Spread *, DocCoord, ClickModifiers)
 To handle double click events in the text tool.
BOOL HandleTripleClick (Spread *, DocCoord, ClickModifiers)
 To handle triple click events in the text tool.
BOOL HandleQuadClick (Spread *, DocCoord, ClickModifiers)
 To handle quad click events in the text tool.
BOOL HandleDragClick (Spread *, DocCoord, ClickModifiers)
 To handle drag events in the text tool.
BOOL RegisterDeadKeys ()
 Registers all the dead keys virtual codes with the keypress system.
BOOL RemoveDeadKeys ()
 Deregisters all the dead keys.
BOOL RegisterAdditionalVirtKey (KeyPress **pKey, TCHAR ch)
 Registers a requirement for a virtual key message with the KeyPress system.
BOOL HandleSpecialNonStoryKeys (KeyPress *pKeyPress)
 To deal with keys presses that work without a focus story.
BOOL HandleSpecialStoryAndNonStoryKeys (KeyPress *pKeyPress)
 To handle keypress events that wotk with and without a text focus story.
BOOL HandleDeadKeys (KeyPress *pKeyPress, WCHAR *pNewUnicode)
 Flags 'dead-keys'. Attempts to apply an accent onto the next character.
BOOL TestForDeadKey (KeyPress *pKeyPress, KeyPress *pDeadKeypress)
 Flags 'dead-keys'. Attempts to apply an accent onto the next character.
BOOL HandleSpecialStoryKeys (KeyPress *pKeyPress, TextStory *pStory, CaretNode *pCaret)
 To handle special keypress events that apply at a story and/or caret.
BOOL IsUsableUnicode (WCHAR CodeValue)
 Central place to filter out unicode greater than 255.
BOOL ApplyBold ()
 Applies or removes the bold attribute from the current selection or caret.
BOOL ApplyItalic ()
 Applies or removes the italic attribute from the current selection or caret.
BOOL IncreaseTrackKern ()
 If there is a text selection then the tracking applied to it is increased by 10/1000's of an em If there is no selection then a kern up of 50/1000 is inserted.
BOOL DecreaseTrackKern ()
 If there is a text selection then the tracking applied to it is decreased by 10/1000's of an em If there is no selection then a kern down of 50/1000 is inserted.
BOOL CommonApplyKern (MILLIPOINT ChangeAmmount)
 Applys/increases/descreases the horizontal kern at the caret.
BOOL CommonApplyTracking (MILLIPOINT ChangeAmmount)
 Applys/increases/descreases the tracking across the selected characters.
BOOL OnToolSelect ()
 Called to do processing required when text tool is selected.
BOOL OnToolDeselect ()
 Called to do processing required when text tool is deselected.
BOOL CreateCursors ()
 Creates all the Text tool cursors.
void DestroyCursors ()
 Destroys all the Text tool cursors.

Protected Attributes

CursorpcNormalTextCursor
CursorpcBlobTextCursor
CursorpcBlankCursor
CursorpcIndentCursor
CursorpcCurrentCursor
INT32 CurrentCursorID
BOOL IsBlankCursorUp
BOOL UpdateAfterTyping
TextStorypLastFocusStory
KeyPressPreviousDeadKey
KeyPressGraveVirtKey
KeyPressAcuteVirtKey
KeyPressHatVirtKey
KeyPressTildeVirtKey
KeyPressColonVirtKey
KeyPressAtVirtKey
KeyPressCommaVirtKey
KeyPressSlashVirtKey
TextToolBlobPosList m_BlobPosList

Static Protected Attributes

static BOOL CurrentTool = FALSE
static TextInfoBarOppTextInfoBarOp = NULL
static TCHARFamilyName = _T("Text Tools")
static TCHARToolName = _T("Text Tool")
static TCHARPurpose = _T("Text manipulation")
static TCHARAuthor = _T("TextToolTeam")
static BOOL UseDeadKeys = TRUE

Private Member Functions

 CC_DECLARE_MEMDUMP (TextTool)

Detailed Description

A template tool class.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94

Definition at line 189 of file texttool.h.


Constructor & Destructor Documentation

TextTool::TextTool  ) 
 

Default Constructor. Other initialisation is done in TextTool::Init which is called by the Tool Manager.

Author:
Mark_Goodall (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
See also:
TextTool::Init

Definition at line 259 of file texttool.cpp.

00260 {
00261     pcCurrentCursor = NULL;
00262     IsBlankCursorUp = FALSE;
00263     UpdateAfterTyping = FALSE;
00264 
00265     PreviousDeadKey = NULL;
00266     GraveVirtKey = NULL;
00267     AcuteVirtKey = NULL;
00268     HatVirtKey = NULL;
00269     TildeVirtKey = NULL;
00270     ColonVirtKey = NULL;
00271     AtVirtKey = NULL;
00272     CommaVirtKey = NULL;
00273     SlashVirtKey = NULL;
00274     pLastFocusStory = NULL;
00275 }

TextTool::~TextTool  ) 
 

Destructor (Virtual). Does nothing.

Author:
Mark_Goodall (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94

Definition at line 287 of file texttool.cpp.

00288 {
00289     pTextInfoBarOp->pTextTool = NULL;
00290     TextInfoBarOp::DeInit(); 
00291 
00292     RemoveDeadKeys();
00293 }


Member Function Documentation

BOOL TextTool::ApplyBold  )  [protected]
 

Applies or removes the bold attribute from the current selection or caret.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/04/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 1709 of file texttool.cpp.

01710 {
01711     AttrTxtBold* ApplyBoldAttrib = new AttrTxtBold();
01712     BOOL Success = ApplyBoldAttrib != NULL;
01713 
01714     if (Success)
01715     {
01716         // See wether bold is currently on or off across the selection
01717         AttrTxtBold* CurrentBoldAttrib = NULL;
01718         SelRange::CommonAttribResult AttrRes = GetApplication()->FindSelection()->
01719                     FindCommonAttribute(CC_RUNTIME_CLASS(AttrTxtBold), (NodeAttribute **)&CurrentBoldAttrib);
01720         if (AttrRes == SelRange::ATTR_COMMON)
01721             ApplyBoldAttrib->Value.BoldOn = !(CurrentBoldAttrib->Value.BoldOn);
01722         else
01723             ApplyBoldAttrib->Value.BoldOn = TRUE;
01724 
01725         // Apply the new bold attribute to the selection
01726         AttributeManager::AttributeSelected(ApplyBoldAttrib, NULL);
01727     }
01728 
01729     return Success;
01730 }

BOOL TextTool::ApplyItalic  )  [protected]
 

Applies or removes the italic attribute from the current selection or caret.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/04/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 1745 of file texttool.cpp.

01746 {
01747     AttrTxtItalic* ApplyItalicAttrib = new AttrTxtItalic();
01748     BOOL Success = ApplyItalicAttrib != NULL;
01749 
01750     if (Success)
01751     {
01752         // See wether italic is currently on or off across the selection
01753         AttrTxtItalic* CurrentItalicAttrib = NULL;
01754         SelRange::CommonAttribResult AttrRes = GetApplication()->FindSelection()->
01755                     FindCommonAttribute(CC_RUNTIME_CLASS(AttrTxtItalic), (NodeAttribute **)&CurrentItalicAttrib);
01756         if (AttrRes == SelRange::ATTR_COMMON)
01757             ApplyItalicAttrib->Value.ItalicOn = !(CurrentItalicAttrib->Value.ItalicOn);
01758         else
01759             ApplyItalicAttrib->Value.ItalicOn = TRUE;
01760 
01761         // Apply the new italic attribute to the selection
01762         AttributeManager::AttributeSelected(ApplyItalicAttrib, NULL);
01763     }
01764 
01765     return Success;
01766 }

virtual BOOL TextTool::AreToolBlobsRenderedOnSelection  )  [inline, virtual]
 

Reimplemented from Tool_v1.

Definition at line 233 of file texttool.h.

00233 {return TRUE;}

TextTool::CC_DECLARE_MEMDUMP TextTool   )  [private]
 

BOOL TextTool::CommonApplyKern MILLIPOINT  ChangeAmmount  )  [protected]
 

Applys/increases/descreases the horizontal kern at the caret.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/04/95
Parameters:
ChangeAmmount - ammount to increase/decrease the kern at the caret by [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 1884 of file texttool.cpp.

01885 {
01886     MILLIPOINT NewKernVal = ChangeAmmount;
01887 
01888     // Get the current kern ammount - check the node to the left of the caret
01889     TextStory* pStory = TextStory::GetFocusStory();
01890     CaretNode* pCaret = NULL;
01891     if (pStory != NULL)
01892         pCaret = pStory->GetCaret();
01893     if (pCaret != NULL)
01894     {
01895         VisibleTextNode* LastNode = pCaret->FindPrevAbstractTextCharInStory();
01896         if ((LastNode != NULL) && IS_A(LastNode, KernCode))
01897             NewKernVal += (((KernCode*)LastNode)->GetValue()).x;
01898     }
01899 
01900     // Invoke an operation to apply the kern
01901     OpDescriptor* OpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpTextKern));
01902     if (OpDesc != NULL)
01903     {
01904         OpParam param(NewKernVal,0);
01905         OpDesc->Invoke(&param);
01906     }
01907 
01908     return TRUE;
01909 }

BOOL TextTool::CommonApplyTracking MILLIPOINT  ChangeAmmount  )  [protected]
 

Applys/increases/descreases the tracking across the selected characters.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/04/95
Parameters:
ChangeAmmount - ammount to increase/decrease the tracking by [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 1847 of file texttool.cpp.

01848 {
01849     // Create a new attribute to apply (will replace any existing)
01850     AttrTxtTracking* ApplyTrackingAttrib = new AttrTxtTracking();
01851     BOOL Success = (ApplyTrackingAttrib != NULL);
01852 
01853     if (Success)
01854     {
01855         // Get the current tracking ammount across the selection
01856         AttrTxtTracking* CurrentTrackingAttrib = NULL;
01857         SelRange::CommonAttribResult AttrRes = GetApplication()->FindSelection()->
01858                     FindCommonAttribute(CC_RUNTIME_CLASS(AttrTxtTracking), (NodeAttribute **)&CurrentTrackingAttrib);
01859         if (AttrRes == SelRange::ATTR_COMMON)
01860             ApplyTrackingAttrib->Value.Tracking = CurrentTrackingAttrib->Value.Tracking + ChangeAmmount;
01861         else
01862             ApplyTrackingAttrib->Value.Tracking = ChangeAmmount;
01863 
01864         // Apply the increased attribute to the selection
01865         AttributeManager::AttributeSelected(ApplyTrackingAttrib, NULL);
01866     }
01867 
01868     return Success;
01869 }

BOOL TextTool::CreateCursors  )  [protected]
 

Creates all the Text tool cursors.

Author:
Mark_Goodall (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if all the Text tool cursors have been successfully created
See also:
-

Definition at line 460 of file texttool.cpp.

00461 {
00462     // This tool has just been selected.  Create the cursors.
00463     pcNormalTextCursor = new Cursor(this, _R(IDC_TEXTTOOLBLOBCURSOR));
00464     pcBlobTextCursor = new Cursor(this, _R(IDC_TEXTTOOLCURSOR));
00465     pcIndentCursor = new Cursor(this, _R(IDC_TEXTTOOLINDENTCURSOR));
00466     pcBlankCursor = new Cursor(this, _R(IDC_TEXTTOOLBLANKCURSOR));
00467 
00468     if ( pcNormalTextCursor==NULL || !pcNormalTextCursor->IsValid() ||
00469          pcBlobTextCursor==NULL || !pcBlobTextCursor->IsValid() ||
00470          pcIndentCursor==NULL || !pcIndentCursor->IsValid() ||
00471          pcBlankCursor==NULL || !pcBlankCursor->IsValid() )
00472     {
00473         DestroyCursors();
00474         return FALSE;
00475     }
00476     else
00477         return TRUE;
00478 }

BOOL TextTool::DecreaseTrackKern  )  [protected]
 

If there is a text selection then the tracking applied to it is decreased by 10/1000's of an em If there is no selection then a kern down of 50/1000 is inserted.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/04/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 1816 of file texttool.cpp.

01817 {
01818     // Get pointers to focus story and its caret
01819     TextStory* pStory = TextStory::GetFocusStory();
01820     ERROR3IF(pStory == NULL, "DecreaseTrackKern called without a focus story!");
01821     BOOL Success = TRUE;
01822 
01823     if (pStory != NULL)
01824     {
01825         if (pStory->GetSelectionEnd() == NULL)
01826             Success = CommonApplyKern(-50);
01827         else
01828             Success = CommonApplyTracking(-10);
01829     }
01830 
01831     return Success;
01832 }

BOOL TextTool::DelayingUpdate  )  [static]
 

Let's the caller know if the text-tool has finished mucking about with the document's modified flag.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/9/96
Returns:
TRUE if the text tool is saving up any updates to do when it is idle, FALSE if it isn't or if the text tool is not the current tool.
See also:
CCamSrvrItem::QueryTypeAhead

Definition at line 1950 of file texttool.cpp.

01951 {
01952     // Is the text tool the current tool?
01953     Tool* pTool = Tool::GetCurrent();
01954     if (!pTool || pTool->GetID() != TOOLID_TEXT) return FALSE;
01955 
01956     // Is it saving up some updates?
01957     return ((TextTool*) pTool)->UpdateAfterTyping;
01958 }

void TextTool::Describe void *  InfoPtr  )  [virtual]
 

Allows the tool manager to extract information about the tool.

Author:
Mark_Goodall (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
InfoPtr - A pointer to a tool info block. It is passed cast to void* as [INPUTS] the version of the tool is unknown at this point. Later versions of the Tool class may have more items in this block, that this tool will not use
InfoPtr - The structure pointed to by InfoPtr will have had all the info [OUTPUTS] that this version of the Tool knows about

Reimplemented from Tool_v1.

Definition at line 392 of file texttool.cpp.

00393 {
00394     // Cast structure into the latest one we understand.
00395     ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
00396 
00397     Info->InfoVersion = 1;
00398     
00399     Info->InterfaceVersion = GetToolInterfaceVersion();  // You should always have this line.
00400         
00401     // These are all arbitrary at present.
00402     Info->Version = 1;
00403     Info->ID      = GetID();
00404     Info->TextID  = _R(IDS_TEXT_TOOL);
00405 
00406     Info->Family  = FamilyName;
00407     Info->Name    = ToolName;
00408     Info->Purpose = Purpose;
00409     Info->Author  = Author;
00410 
00411     Info->BubbleID = _R(IDBBL_TEXT_TOOLBOX);
00412     // Text tool is associated with the BaseTextClass attribute group
00413     Info->CurrentAttributeGroup = CC_RUNTIME_CLASS(BaseTextClass); 
00414 }

void TextTool::DestroyCursors  )  [protected]
 

Destroys all the Text tool cursors.

Author:
Mark_Goodall (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 496 of file texttool.cpp.

00497 {
00498     if (pcNormalTextCursor != NULL) delete pcNormalTextCursor;
00499     if (pcBlobTextCursor != NULL) delete pcBlobTextCursor;
00500     if (pcIndentCursor != NULL) delete pcIndentCursor;
00501     if (pcBlankCursor != NULL) delete pcBlankCursor;
00502 }

void TextTool::DisplayStatusBarHelp DocCoord  DocPos,
Spread pSpread,
ClickModifiers  ClickMods
[protected]
 

Displays status help string for the given position in the status bar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
DocPos - the document coordinate of the point to display help on [INPUTS] pSpread - pointer to the spread containing DocPos ClickMods - the current click modifiers
- [OUTPUTS]
Returns:
-
See also:
TextTool::GetCurrentStatusText

Definition at line 1600 of file texttool.cpp.

01601 {
01602     String_256 StatusMsg("");
01603 
01604     // Get a string from the underlying help function and display it.
01605     GetCurrentStatusText(&StatusMsg, pSpread, DocPos, ClickMods);
01606     GetApplication()->UpdateStatusBarText(&StatusMsg);                           
01607 }

void TextTool::GetCurrentStatusText String_256 ptext,
Spread pSpread,
DocCoord  DocPos,
ClickModifiers  ClickMods
[protected]
 

Selects a suitable string for the status line based on the current location (as input via the parameters).

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
pSpread points to a spread [INPUTS] DocPos points to a point in a document ClickMods are the current click modifiers
Updates the string in ptext [OUTPUTS]
Returns:
-
See also:
TextTool::GetStatusLineText, TextTool::DisplayStatusBarHelp

Definition at line 1654 of file texttool.cpp.

01655 {
01656     // If nothing is detected, we are over the document
01657     INT32 IDToUse = _R(IDS_TEXTTOOL_OVERDOCUMENT);
01658 
01659     // Is the caret in the focus story selected (ie, can the user type?)
01660     if (TextStory::GetFocusStory()!=NULL && TextStory::GetFocusStory()->GetCaret()!=NULL
01661             && TextStory::GetFocusStory()->GetCaret()->IsSelected())
01662     {
01663         IDToUse = _R(IDS_TEXTTOOL_OVERDOCUMENTC);
01664     }
01665     
01666     // Are we over a story or a path for a new story?
01667     TextStory* pTextStoryToSelect = NULL;
01668     if (IsPointNearUnselectedTextStory(pSpread, DocPos, &pTextStoryToSelect, NULL, TRUE))
01669     {
01670         if (pTextStoryToSelect != NULL)
01671             IDToUse = _R(IDS_TEXTTOOL_OVERTEXTSTORY);
01672     }
01673     else
01674     {
01675         NodePath* pPath = NULL;
01676         if (IsPointNearNonStoryPath(pSpread, DocPos, &pPath, TRUE))
01677             IDToUse = _R(IDS_TEXTTOOL_OVERNODEPATH);
01678     }
01679 
01680     // See if we are near any story path indent blobs
01681     BOOL LeftBlob = TRUE;
01682     TextStory* pFoundStory = NULL;
01683     if (!m_BlobPosList.FindBlobStory(pSpread, DocPos, &LeftBlob, &pFoundStory))
01684         InformError();
01685     else if (pFoundStory != NULL)
01686     {
01687         if (pFoundStory->GetTextPath() != NULL)
01688             IDToUse = _R(IDS_TEXTTOOL_DRAGPATHINDENT);
01689         else
01690             IDToUse = _R(IDS_TEXTTOOL_DRAGSTORYWIDTH);
01691     }
01692 
01693     ptext->Load(IDToUse);
01694 }

UINT32 TextTool::GetID void   )  [inline, virtual]
 

Reimplemented from Tool_v1.

Definition at line 200 of file texttool.h.

00200 { return TOOLID_TEXT; };

void TextTool::GetRulerOrigin Spread pSpread,
UserCoord pOrigin
[virtual]
 

Gives the current tool the chance to change the coordinates displayed on the ruler.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/Jun/2006
Parameters:
pSpread - the spread for which the ruler is displayed [INPUTS]
pOffsets - the desired origin shift in user space (is initialised to 0,0) [OUTPUTS]

Reimplemented from Tool_v1.

Definition at line 974 of file texttool.cpp.

00975 {
00976     if (TextInfoBarOp::IsRulerOriginClaimed())
00977     {
00978         pOrigin->x = TextInfoBarOp::GetRulerOrigin();
00979     }
00980 }

BOOL TextTool::GetRulerStatusLineText String_256 pText,
UserCoord  PointerPos,
Spread pSpread,
RulerBase pRuler
[virtual]
 

Allows the tool to set the status line text for the ruler.

Author:
Martin Wuerthner <xara@mw-software.com>
Date:
25/07/06
Parameters:
PointerPos - user coordinates of click on ruler (relative to origin set by tool) [INPUTS] pSpread - pointer to spread upon which click occurred pRuler - pointer to ruler which generated click
Status line text written to pText (if returning TRUE) [OUTPUTS]
Returns:
TRUE if the text has been set

Reimplemented from Tool_v1.

Definition at line 1038 of file texttool.cpp.

01040 {
01041     if (!TextInfoBarOp::IsRulerOriginClaimed()) return FALSE;
01042     return TextInfoBarOp::GetRulerStatusLineText(pText, PointerPos, pSpread, pRuler);
01043 }

BOOL TextTool::GetStatusLineText String_256 ptext,
Spread pSpread,
DocCoord  DocPos,
ClickModifiers  ClickMods
[virtual]
 

Returns the current status line help string.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
ptest - pointer to a string [INPUTS] pSpread points to a spread DocPos points to a point in a document ClickMods are the current click modifiers
Updates the string in ptext [OUTPUTS]
Returns:
TRUE if the string was updates (FALSE if not updated)
See also:
TextTool::GetCurrentStatusText, Tool_v1::GetStatusLineText

Reimplemented from Tool_v1.

Definition at line 1628 of file texttool.cpp.

01629 {
01630     // We can call the underlying help function to get a string and return the result.
01631     GetCurrentStatusText(ptext, pSpread, DocPos, ClickMods);
01632     return TRUE;
01633 }

static TextInfoBarOp* TextTool::GetTextInfoBarOp  )  [inline, static]
 

Definition at line 226 of file texttool.h.

00226 { return pTextInfoBarOp; }

BOOL TextTool::HandleDeadKeys KeyPress pKeyPress,
WCHAR pNewUnicode
[protected]
 

Flags 'dead-keys'. Attempts to apply an accent onto the next character.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
pKeyPress - points to the keypress object [INPUTS]
pNewUnicode contains the unicode value of the keypress, possibly changed to [OUTPUTS] an accented version of the pressed key.
Returns:
TRUE if keypress used, FALSE if not

Definition at line 2098 of file texttool.cpp.

02099 {
02100     BOOL UsedKey = FALSE;
02101     *pNewUnicode = pKeyPress->GetUnicode();
02102 //  WCHAR OldUnicode = *pNewUnicode;
02103 
02104     if (!UseDeadKeys)
02105         return FALSE;
02106 
02107     // Is this a dead key?
02108     if ( TestForDeadKey(pKeyPress, GraveVirtKey)    ||
02109          TestForDeadKey(pKeyPress, AcuteVirtKey)    ||
02110          TestForDeadKey(pKeyPress, HatVirtKey)      ||
02111          TestForDeadKey(pKeyPress, TildeVirtKey)    ||
02112          TestForDeadKey(pKeyPress, ColonVirtKey)    ||
02113          TestForDeadKey(pKeyPress, AtVirtKey)       ||
02114          TestForDeadKey(pKeyPress, SlashVirtKey)    ||
02115          TestForDeadKey(pKeyPress, CommaVirtKey) )
02116     {
02117         UsedKey = TRUE;
02118     }
02119 
02120     // This isn't a dead key, was the previous?
02121     if (!UsedKey && (PreviousDeadKey != NULL) && IsUsableUnicode(pKeyPress->GetUnicode()) )
02122     {
02123         // Get a pointer to the appropiate accent map
02124         UINT32* pMapArrays = NULL;
02125         if (PreviousDeadKey == GraveVirtKey)
02126             pMapArrays = GraveArray;
02127         else if (PreviousDeadKey == AcuteVirtKey)
02128             pMapArrays = AcuteArray;
02129         else if (PreviousDeadKey == HatVirtKey)
02130             pMapArrays = HatArray;
02131         else if (PreviousDeadKey == TildeVirtKey)
02132             pMapArrays = TildeArray;
02133         else if (PreviousDeadKey == ColonVirtKey)
02134             pMapArrays = ColonArray;
02135         else if (PreviousDeadKey == AtVirtKey)
02136             pMapArrays = AtArray;
02137         else if (PreviousDeadKey == SlashVirtKey)
02138             pMapArrays = SlashArray;
02139         else if (PreviousDeadKey == CommaVirtKey)
02140             pMapArrays = CommaArray;
02141         else
02142         {
02143             ERROR3("Unknown dead key");
02144             pMapArrays = NULL;
02145         }
02146 
02147         // See if the pressed key maps onto an accented version
02148         if (pMapArrays != NULL)
02149         {
02150             BOOL Found = FALSE;
02151             while (!Found && (*pMapArrays != 0))
02152             {
02153                 if (*pMapArrays == (UINT32)(*pNewUnicode))
02154                 {                                     
02155                     *pNewUnicode = *(pMapArrays+1);
02156                     Found = TRUE;
02157                 }
02158                 pMapArrays += 2;
02159             }
02160         }
02161 
02162         PreviousDeadKey = 0;
02163         UsedKey = FALSE;
02164     }
02165 
02166     return UsedKey;
02167 }

BOOL TextTool::HandleDoubleClick Spread pSpread,
DocCoord  ClickPos,
ClickModifiers  ClickMods
[protected]
 

To handle double click events in the text tool.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/02/95
Parameters:
pSpread - The spread in which the click occurred [INPUTS] ClickPos - The DocCoord of the point where the mouse was clicked ClickMods - The state of the various modifiers at the time of the click
Returns:
FALSE if an error occurs during processing
See also:
TextTool::OnClick

Definition at line 666 of file texttool.cpp.

00667 {
00668     BOOL Success = TRUE;
00669     // Select the word at the caret
00670     if ((TextStory::GetFocusStory() != NULL) && !ClickMods.Constrain && !ClickMods.Adjust)
00671     {
00672         OpTextCaret* pOp = new OpTextCaret();
00673         if (pOp != NULL)
00674             pOp->DoSelectWordAtCaret();
00675         else
00676             Success = FALSE;
00677     }
00678     return Success;
00679 }

BOOL TextTool::HandleDragClick Spread pSpread,
DocCoord  ClickPos,
ClickModifiers  ClickMods
[protected]
 

To handle drag events in the text tool.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/02/95
Parameters:
pSpread - The spread in which the click occurred [INPUTS] ClickPos - The DocCoord of the point where the mouse was clicked ClickMods - The state of the various modifiers at the time of the click
Returns:
FALSE if an error occurs during processing
See also:
TextTool::OnClick

Definition at line 746 of file texttool.cpp.

00747 {
00748     return TRUE;
00749 }

BOOL TextTool::HandleQuadClick Spread pSpread,
DocCoord  ClickPos,
ClickModifiers  ClickMods
[protected]
 

To handle quad click events in the text tool.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/95
Parameters:
pSpread - The spread in which the click occurred [INPUTS] ClickPos - The DocCoord of the point where the mouse was clicked ClickMods - The state of the various modifiers at the time of the click
Returns:
FALSE if an error occurs during processing
See also:
TextTool::OnClick

Definition at line 724 of file texttool.cpp.

00725 {
00726     return TRUE;
00727 }

BOOL TextTool::HandleSingleClick Spread pSpread,
DocCoord  ClickPos,
ClickModifiers  ClickMods
[protected]
 

To handle single click events in the text tool.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/02/95
Parameters:
pSpread - The spread in which the click occurred [INPUTS] ClickPos - The DocCoord of the point where the mouse was clicked ClickMods - The state of the various modifiers at the time of the click
Returns:
FALSE if an error occurs during processing
See also:
TextTool::OnClick

Definition at line 584 of file texttool.cpp.

00585 {
00586     Node* pHitObject = NULL;
00587     TextStory* pTextStoryToSelect = NULL;
00588 
00589     // Is the click over an indent blob?
00590     BOOL BlobIsLeft = TRUE;
00591     TextStory* pFoundStory = NULL;
00592     if (!m_BlobPosList.FindBlobStory(pSpread, ClickPos, &BlobIsLeft, &pFoundStory))
00593         return FALSE;
00594     
00595     if (pFoundStory != NULL)
00596     {
00597         if (!m_BlobPosList.RenderAndRemove(pFoundStory))
00598             return FALSE;
00599 
00600         // Invoke a operation to drag the indent position
00601         OpDragStoryIndent* pOp = NULL;
00602         if (BlobIsLeft)
00603         {
00604             if (pFoundStory->GetTextPath() != NULL)
00605                 pOp = new OpDragStoryPathLeftIndent;
00606             else
00607                 pOp = new OpDragStoryNonPathLeftIndent;
00608         }
00609         else
00610         {
00611             if (pFoundStory->GetTextPath() != NULL)
00612                 pOp = new OpDragStoryPathRightIndent;
00613             else
00614                 pOp = new OpDragStoryNonPathRightIndent;
00615         }
00616         if (pOp==NULL)
00617             return FALSE;
00618         else
00619             return pOp->DoDrag(ClickPos, pSpread, ClickMods, pFoundStory);
00620     }
00621     else if ( IsPointNearUnselectedTextStory(pSpread, ClickPos, &pTextStoryToSelect, &pHitObject, FALSE) )
00622     {
00623         // Position the caret with a story, and drag selection
00624         OpTextSelection* pOp = new OpTextSelection;
00625         if (pOp == NULL)
00626             return FALSE;
00627         else
00628             return pOp->DoDrag(ClickPos, pSpread, ClickMods, pHitObject);
00629     }
00630     else
00631     {
00632         // Create a new text story
00633         OpCreateTextObject* pOpCreateTextObject = new OpCreateTextObject;
00634         if (pOpCreateTextObject == NULL)
00635             return FALSE;
00636         else
00637         {
00638             NodePath* pPath = NULL;
00639             IsPointNearNonStoryPath(pSpread, ClickPos, &pPath, FALSE);
00640             if (pPath != NULL)
00641                 pOpCreateTextObject->DoImmediate(pSpread, ClickPos, pPath, ClickMods);
00642             else
00643                 pOpCreateTextObject->DoDrag(pSpread, ClickPos, ClickMods);
00644         }
00645     }
00646     return TRUE;
00647 }                                               

BOOL TextTool::HandleSpecialNonStoryKeys KeyPress pKeyPress  )  [protected]
 

To deal with keys presses that work without a focus story.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/08/95
Parameters:
pKeyPress - pointer to a keypress object [INPUTS]
Returns:
TRUE if it used the keypress, FALSE otherwise
See also:
TextTool::HandleSpecialStoryKeys, TextTool::HandleSpecialStoryAndNonStoryKeys

Definition at line 1297 of file texttool.cpp.

01298 {
01299     ERROR3IF(pKeyPress == NULL, "KeyPress poin