RenameObjectsDlg Class Reference

#include <ngdialog.h>

Inheritance diagram for RenameObjectsDlg:

BaseNameObjectsDlg DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Protected Member Functions

 RenameObjectsDlg ()
 Constructs a RenameObjectsDlg object, a modal version of the base class dialog, which renames highlighted name items in the Attribute gallery.
virtual StringBaseGetDescription (StringBase *pstrDesc)
virtual StringBaseGetSuggestion (StringBase *pstrDesc)
virtual BOOL DoCommit (const StringBase &strName)
 Called when the user enters a unique name and clicks OK in the Rename objects dialog.

Private Member Functions

 CC_DECLARE_DYNCREATE (RenameObjectsDlg)

Detailed Description

Definition at line 176 of file ngdialog.h.


Constructor & Destructor Documentation

RenameObjectsDlg::RenameObjectsDlg  )  [protected]
 

Constructs a RenameObjectsDlg object, a modal version of the base class dialog, which renames highlighted name items in the Attribute gallery.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/5/99
See also:
BaseNameObjectsDlg

Definition at line 502 of file ngdialog.cpp.

00503   : BaseNameObjectsDlg(_R(IDD_NAMEDLG_RENAME_TEMPLATE), MODAL)
00504 {
00505     // Empty.
00506 }


Member Function Documentation

RenameObjectsDlg::CC_DECLARE_DYNCREATE RenameObjectsDlg   )  [private]
 

BOOL RenameObjectsDlg::DoCommit const StringBase strName  )  [protected, virtual]
 

Called when the user enters a unique name and clicks OK in the Rename objects dialog.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/5/99
Parameters:
strName --- the name to OpRenameNames [INPUTS]
Returns:
TRUE - close the dialog on returning.
See also:
BaseNameObjectsDlg::Message; OpRenameNames

Implements BaseNameObjectsDlg.

Definition at line 649 of file ngdialog.cpp.

00650 {
00651     // Rename all the highlighted items to the new name and close.
00652     OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_RENAME_ALL);
00653     ERROR3IF(pDesc == 0, "RenameObjectsDlg::DoCommit: can't find OPTOKEN_RENAME_ALL");
00654     OpParam param((void *) &strName, 0);
00655     pDesc->Invoke(&param);
00656     return FALSE;
00657 }

StringBase * RenameObjectsDlg::GetDescription StringBase pstrDesc  )  [protected, virtual]
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/5/99
Returns:
The input.
Parameters:
pstrDesc --- a description of the objects to be renamed, if any. [OUTPUTS]
See also:
BaseNameObjectsDlg

Implements BaseNameObjectsDlg.

Definition at line 520 of file ngdialog.cpp.

00521 {
00522     // Get the highlighted item from the Attribute gallery.
00523     SGNameItem* pItem =
00524             (SGNameItem*) NameGallery::Instance()->GetUsedNames()->FindNextSelectedItem(0);
00525     ERROR3IF(pItem == 0, "NameGallery::OnRename: no highlighted item to rename");
00526 
00527     // Build up a string description of it.
00528     //INT32 nTotal = pItem->GetObjectCount();
00529 
00530     // dont rely on the object count as it counts the text story, text line and each char if just the story has the tag
00531     // better to count the number of tags found! (sjk 12/9/00)
00532     INT32 nTotal = 0;
00533     INT32 nSel = 0;
00534 
00535     String_256 ItemText = "";
00536     if (pItem)
00537         pItem->GetNameText(&ItemText);
00538 
00539     Node * pSpread = (Node *) Document::GetSelectedSpread();
00540     if (pSpread)
00541     {
00542         Node * pNode = SliceHelper::FindNextNameNode(pSpread, pSpread);
00543         while (pNode)
00544         {
00545             if (ItemText.CompareTo(((TemplateAttribute *)pNode)->GetParam()) == 0)
00546             {
00547                 nTotal++; // found a name
00548 
00549                 // is it selected?
00550                 // or even is its parent selected?
00551                 BOOL ParentSelected = FALSE;
00552                 Node * pParent = pNode->FindParent();
00553                 while (pParent && !ParentSelected)
00554                 {
00555                     if (pParent->IsSelected())
00556                     {
00557                         nSel++;
00558                         ParentSelected = TRUE;
00559                     }
00560 
00561                     pParent = pParent->FindParent();
00562                     if (pParent && pParent->IsLayer())
00563                         pParent = NULL;
00564                 }
00565             }
00566 
00567             pNode = SliceHelper::FindNextNameNode(pNode, pSpread);
00568         }
00569     }
00570 
00571     if (nTotal < 1 && !pSpread)
00572         pstrDesc->Load(_R(IDS_NAMEDLG_DESCRIBE_NOSET));
00573     else
00574     {
00575         // The set has some members, some or all of which might be selected.
00576         UINT32 idMask;
00577         String_256 strSel;
00578         if (nTotal == 1)
00579         {
00580             // Singular.  Work out if it's "which is" or "which isn't".
00581             idMask = _R(IDS_NAMEDLG_DESCRIBE_SET);
00582             if (nSel == 0)
00583                 strSel = _R(IDS_NAMEDLG_WHICH_ISNT);
00584             else 
00585                 strSel = _R(IDS_NAMEDLG_WHICH_IS);
00586         }
00587         else
00588         {       
00589             // Plural.  Work out if it's "none", "all", or "<a number>".
00590             idMask = _R(IDS_NAMEDLG_DESCRIBE_SET_PL);
00591             if (nSel == 0)
00592                 strSel = _R(IDS_NAMEDLG_NONE);
00593             else if (nSel == nTotal)
00594             {
00595                 strSel = _R(IDBBL_NAMEGAL_ALL);
00596                 strSel.toLower();
00597             }
00598             else
00599                 Convert::LongToString(nSel, &strSel);
00600         }
00601 
00602         String_256 strName;
00603         pItem->GetNameText(&strName);
00604         pstrDesc->MakeMsg(idMask, &strName, &strSel, nTotal);
00605     }
00606 
00607     return pstrDesc;
00608 }

StringBase * RenameObjectsDlg::GetSuggestion StringBase pstrSuggest  )  [protected, virtual]
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/5/99
Returns:
The input.
Parameters:
pstrSuggest --- a suggested name for the selected objects, if any. [OUTPUTS]
See also:
BaseNameObjectsDlg

Implements BaseNameObjectsDlg.

Definition at line 622 of file ngdialog.cpp.

00623 {
00624     // Suggest the old name of the highlighted Attribute gallery item.
00625     SGNameItem* pItem =
00626             (SGNameItem*) NameGallery::Instance()->GetUsedNames()->FindNextSelectedItem(0);
00627     ERROR3IF(pItem == 0, "NameGallery::OnRename: no highlighted item to rename");
00628     
00629     String_256 str;
00630     pItem->GetNameText(&str);
00631     *pstrSuggest = str;
00632     return pstrSuggest;
00633 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:27 2007 for Camelot by  doxygen 1.4.4