#include <slicehelper.h>
Public Types | |
| enum | SelStateAction { CLEAR, SET, TOGGLE } |
Static Public Member Functions | |
| static Layer * | FindLayerCalled (const StringBase &LayerName) |
| static INT32 | CountButtonsInBar (const StringBase &BarName) |
| static void | CountButtonsInBarScan (Node *pNode, TemplateAttribute **ppFoundButton, INT32 *pNumberOfButtons, const StringBase &BarName) |
| Finds the number of buttons in the bar and the names of each button, by filling in the ppFoundButton array and pNumberOfButtons. | |
| static void | BuildListOfNodesInBar (List *pList, Node *pNode, const StringBase &BarName) |
| Builds a list (or extends an existing list) of ALL the wix attribute nodes that have this bar name hidden in the question. | |
| static SGNameItem * | LookupNameGalleryItem (const StringBase &strName) |
| Used to find out if a button name has been used before. Or find the dimensions of a button. | |
| static void | GetNextFreeButtonName (INT32 &butno, StringBase *pStr=NULL) |
| Used to find the next button name that can be reused or created, that isn't going to interfere with what we have. | |
| static Node * | FindNextOfClass (Node *pNode, Node *pLidNode, const class CCRuntimeClass *pClass, BOOL CheckThis=FALSE) |
| Used to walk a tree repeatedly from any given branch, searching for nodes of a particular type. | |
| static Node * | FindNextNameNode (Node *pNode, Node *pLidNode, BOOL CheckThis=FALSE) |
| static void | SelectAllSetsOfThisNode (NodeRenderableInk *pInk, String_256 &SetName, BOOL bShift) |
| Calls RecurseSelectAllSetsOfThisNode after looking up the tree for any non-selectable nodes. These are tested for by looking for a FALSE return from PromoteHitTestOnChildrenToMe. We do this because the user may try to select eg a NodeBevelController with a name on it, the selection slips through to its children who don't have the name directly applied. We must therefore find the node the user thought they were clicking on, and work on from there. | |
| static void | RecurseSelectAllSetsOfThisNode (Node *pAttrs, String_256 &SetName, BOOL bShift) |
| Looks at all template attributes applied to this node and its children. Sets the selection state of the any referred name sets according to the shift setting. ie. you pick a member of a set and it selects all members of that set. ie2. If it is a member of more than one set all those sets are selected. | |
| static BOOL | SelectObjectsInSet (const StringBase &strName, SelectScan::Change eNewState) |
| Wraps the scan functionality. Selects all items from the named set. | |
| static void | SelectAllSetsInRect (const DocRect, Spread *, SelStateAction st=SET) |
| For each object wholly inside the supplied rectangle, selects that object and all other objects sharing any names belonging to that object. It will draw in all the EORed blobs of the objects that it selects/deselects. rewritten by Simon so that objects on locked layers do not get selected also more optimal. (st parameter etc added by JCF 1.11.94). | |
| static String_256 | GetBarName (TemplateAttribute *pTemplAttrib) |
| The bar name is stored as the question in the wix attrib. This fn extracts the bar name from the attrib, checking that it is a bar name and not any old string in there. If it isn't a bar identifier it returns an empty string. | |
| static void | MeshImportedLayersWithExistingButtonBars (Node *pImportedLayer[5], UndoableOperation *pUndoableOp, BOOL Imported) |
| Used when a drawing (.XAR, .WEB) is imported or dragged into an existing drawing, or cloned. Button names and bar names are rationalised and made unique, after the nodes themselves have already been merged onto the existing special layers. The function also has to mesh the stretching properties of any buttons that it tampers with providing new extenders to go with each new button defined. The extenders have to be uniquely named too and match with the correct button and the correct nodes of that button. | |
| static BOOL | IsUniqueName (const String_256 &Name, List *pList) |
| static Node * | ReplaceAttrsInTree (UndoableOperation *pOp, List *pImportedAttrList, const String_256 &OldButtonName, const String_256 &OldBarName, const String_256 &NewButtonName, const String_256 &NewBarName, Node **ppNodeFound=NULL) |
| Scans the pImportedAttrList looking for OldButtonName and OldBarName. Replaces it with new versions of the template attribute. Returns a ptr to an example of a changed attr node Fills in an example of an old node into ppNodeFound if required. | |
| static BOOL | BarNameExists (Node *pNode, String_256 &BarName, Node *pLid=NULL) |
| Just a quick check to see if this bar name is used anywhere here. Used to find unused bar names. | |
| static INT32 | FindTargetAndExtender (Node *pStartNode, String_256 &Target, String_256 &Extender, INT32 RequiredLevel, BYTE *pExtenderFlags=NULL, DocRect *pTargetRect=NULL, DocRect *pExtenderRect=NULL) |
| When you want to find out what extends what from a button level (ie you have a node). | |
| static BOOL | CreatePropertiesForSet (const String_256 &SetName, const String_256 &BarName, BOOL isSlice, BOOL Stretches, BOOL IsBackBar, BYTE StretchFlags, const String_256 &StretchedBy, BOOL DontOverWrite=FALSE, DocRect *pTargetRect=NULL, DocRect *pExtenderRect=NULL, UndoableOperation *pOp=NULL, NodeSetProperty *pExampleProp=NULL) |
| If you create a named set these days you need to create properties in the node set sentinel too so that they are stored somewhere that can be saved out, undone, etc. So if you have made any in your code this is a useful little number. | |
| static BOOL | PurgeUseOfSetName (const StringBase &SetName, UndoableOperation *pOp, const String_256 *pReplacementName=NULL) |
| "SetName" should be a new clean set there should be no old references to this "SetName" in any extend lists remove them if there are any. find the property node for the setname | |
| static BOOL | MakeTriggerLikeExample (const String_256 &NewButtonName, const String_256 &ButtonName, const String_256 *pExclude=NULL) |
| Adds NewButtonName to the lists of triggers that ButtonName belongs to. This is used by the bars thatwant all the buttons to stretch the same background bar. | |
| static DocRect | BoundingNodeSize (Node *pNode) |
| Get bounds was returning the acturate "how big is it" This fn treats text that is of a size and the same font as being the same size ignoring decsenders and ascenders. | |
| static INT32 | GetBarNumberFromBarName (const String_256 &BarName) |
| Converts the bar name into a bar number. | |
| static TemplateAttribute * | FindFirstSetNodeBelongsTo (Node *pNode) |
| returns the fist attrib that may apply to a node | |
| static String_256 | GetSetNameFromAttrib (Node *pNode) |
| returns the fist attrib that may apply to a node | |
| static TextStory * | FindNextTextStoryToSync (TextStory *pLastStory, Node *pLid, TextStory *pMasterStory, const String_256 &ButtonName, const String_256 &MasterText, BOOL AnyText=FALSE) |
| scans for text stories that are of the named set and match the criteria to edit when the master is edited. | |
| static BOOL | TextStoriesHaveSameText (TextStory *pStory1, TextStory *pStory2) |
| static BOOL | TextLinesHaveSameText (TextLine *pLine1, TextLine *pLine2) |
| static BOOL | SyncTextLines (TextLine *pLine1, TextLine *pLine2, UndoableOperation *pOp) |
| static BOOL | SyncTextStories (TextStory *pStory, TextStory *pMaster, UndoableOperation *pOp) |
| Changes the characters in the story pStory to match those in pMaster. In this process it attempts to minimise the amount of undo information required. Calls the fn bellow SyncTextLines(). | |
| static BOOL | OnTextStoryChanged (TextStory *pMasterStory, UndoableOperation *pOp, ObjChangeParam *pObjChange, const String_256 &MasterText) |
| Call this if a master text may have been edited. It tests to see if the text is a master text. Finds slave text stories and syncs these with the master text. | |
| static DocRect | ScanForSetSizeExcluding (const String_256 &IncludeSet, const String_256 &ExcludeSet) |
| Caculating clean set sizes for extending buttons. | |
| static BOOL | BarExistsOnLayer (const String_256 &BarName, const String_256 &Layer) |
| Fast scan for existance. | |
| static void | BarNameInRect (DocRect r, String_256 *pBarName) |
| static void | ShowLayer (BOOL Visible, Layer *pLayer, Spread *pSpread, UndoableOperation *pUndoOp) |
| static INT32 | DoesSelectionOnlyContainCompleteSets () |
| static BOOL | SetUsedInTree (Node *pNode, const String_256 &SetName, Node *pLid=NULL) |
| static void | DeleteUnusedReferences (const String_256 &SetName, UndoableOperation *pOp) |
| static BOOL | AddNamesToController (UndoableOperation *pOp, Node *pCtrlr) |
| static BOOL | RemoveNamesFromController (UndoableOperation *pOp, Node *pCtrlr) |
| static BOOL | ModifySelectionToContainWholeButtonElements () |
| static void | SaveSelection () |
| Save the current selection to m_pSelNodeList. | |
| static void | RestoreSelection () |
| Restores the current selection to that given in m_pSelNodeList. | |
| static void | ValidateNodeSetSentinel () |
| static void | BuildListOfNodesInButton (List *pList, Layer *pLayer, const StringBase &ButtonName) |
| Scans all of pLayer, building a list of all nodes which are part of ButonName - if a NodeShadowController is encountered, we add its children instead in order to get the correct bounding box info... | |
| static void | EnsureTriggerInfo () |
| Scans the NameGallery ensuring that the triggers are in the right places... | |
Static Private Attributes | |
| static List * | m_pSelNodeList = 0 |
Definition at line 116 of file slicehelper.h.
|
|
Definition at line 120 of file slicehelper.h.
|
|
||||||||||||
|
Definition at line 2909 of file slicehelper.cpp. 02910 { 02911 Node * pNode = pCtrlr->FindFirstChild(); 02912 02913 while (pNode) 02914 { 02915 if (!pNode->IsAnAttribute() && !pNode->IsNodeHidden()) 02916 { 02917 Node * pAttr = NULL; 02918 02919 do 02920 { 02921 // find any name attrs on this node 02922 pAttr = SliceHelper::FindNextNameNode(pNode, pNode); 02923 02924 // does this already exist on the controller? 02925 Node * pExistingAttr = NULL; 02926 Node * pTemp = NULL; 02927 if (pAttr) 02928 { 02929 for (pTemp = pCtrlr->FindFirstChild(); 02930 pTemp != NULL && pExistingAttr == NULL; 02931 pTemp = pTemp->FindNext() ) 02932 { 02933 if (pTemp->IsAnObjectName()) 02934 { 02935 if (((TemplateAttribute *) pTemp)->GetParam() == ((TemplateAttribute *) pAttr)->GetParam()) 02936 pExistingAttr = pTemp; 02937 } 02938 } 02939 02940 pTemp = SliceHelper::FindNextNameNode(pAttr, pNode); 02941 02942 // didn't exist on controller so add it 02943 if (!pExistingAttr) 02944 { 02945 TemplateAttribute* pNewAttr = new TemplateAttribute(String_256(TEXT("ObjectName")), 02946 ((TemplateAttribute *) pAttr)->GetQuestion(), 02947 ((TemplateAttribute *) pAttr)->GetParam()); 02948 02949 // add the new attrib to the tree 02950 if (pNewAttr) 02951 { 02952 pNewAttr->AttachNode(pCtrlr, FIRSTCHILD); 02953 // Create a hide node action to hide the node when we undo 02954 HideNodeAction* UndoHideNodeAction; 02955 HideNodeAction::Init(pOp, 02956 pOp->GetUndoActions(), //&UndoActions, 02957 pNewAttr, 02958 TRUE, // Include subtree size 02959 ( Action**)(&UndoHideNodeAction)); 02960 } 02961 } 02962 02963 // did exist so just delete the duplicate 02964 pOp->DoHideNode(pAttr, FALSE); 02965 02966 pAttr = pTemp; 02967 } 02968 02969 }while (pAttr != NULL); 02970 02971 } 02972 02973 pNode = pNode->FindNext(); 02974 } 02975 02976 return TRUE; 02977 }
|
|
||||||||||||
|
Fast scan for existance.
Definition at line 2773 of file slicehelper.cpp. 02774 { 02775 Node * pLayer = SliceHelper::FindLayerCalled(Layer); 02776 02777 if (!pLayer) return FALSE; 02778 02779 Node * pNode = pLayer; 02780 do 02781 { 02782 pNode = FindNextOfClass(pNode, pLayer, CC_RUNTIME_CLASS(TemplateAttribute)); 02783 if (pNode && BarName.CompareTo(((TemplateAttribute *)pNode)->GetQuestion()) == 0) 02784 return TRUE; 02785 } while (pNode); 02786 02787 return FALSE; 02788 }
|
|
||||||||||||||||
|
Just a quick check to see if this bar name is used anywhere here. Used to find unused bar names.
Definition at line 1537 of file slicehelper.cpp. 01538 { 01539 if (pLid == NULL) 01540 pLid = pNode; 01541 01542 Node * pNextNode = FindNextNameNode(pNode, pLid); 01543 01544 while (pNextNode) 01545 { 01546 if (BarName.CompareTo(((TemplateAttribute *)pNextNode)->GetQuestion()) == 0) 01547 return TRUE; 01548 01549 pNextNode = FindNextNameNode(pNextNode, pLid); 01550 } 01551 01552 return FALSE; 01553 }
|
|
||||||||||||
|
Definition at line 2791 of file slicehelper.cpp. 02792 { 02793 NameGallery * pNameGallery = NameGallery::Instance(); 02794 if (!pNameGallery) 02795 return; 02796 02797 SGUsedNames* pNames = pNameGallery->GetUsedNames(); 02798 if (!pNames) 02799 return; 02800 02801 SGNameItem * pNameGalleryItem = (SGNameItem*) pNames->GetChild(); 02802 02803 while (pNameGalleryItem) 02804 { 02805 if (pNameGalleryItem->m_BarNumber >= 0 && r.IsIntersectedWith(pNameGalleryItem->GetSetBounds())) 02806 { 02807 pBarName->MakeMsg(_R(IDS_BARNAME), pNameGalleryItem->m_BarNumber + 1); 02808 return; 02809 } 02810 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext(); 02811 } 02812 }
|
|
|
Get bounds was returning the acturate "how big is it" This fn treats text that is of a size and the same font as being the same size ignoring decsenders and ascenders.
Definition at line 1966 of file slicehelper.cpp. 01967 { 01968 if (!pNode->IsBounded()) 01969 return DocRect(0,0,0,0); 01970 01971 DocRect rBounds = ((NodeRenderableBounded*) pNode)->GetBoundingRect(); 01972 01973 if (IS_A(pNode,TextStory)) 01974 { 01975 DocRect rTextBounds; 01976 Node * pLid = pNode; 01977 pNode = SliceHelper::FindNextOfClass(pLid, pLid, CC_RUNTIME_CLASS(TextChar)); 01978 01979 if (pNode) 01980 { 01981 if (((TextChar*) pNode)->GetMetricsRectBounds(&rTextBounds)) 01982 { 01983 rBounds.hi.y = rTextBounds.hi.y; 01984 rBounds.lo.y = rTextBounds.lo.y; 01985 } 01986 } 01987 else 01988 return DocRect(0,0,0,0); // no text chars should return empty 01989 01990 while (pNode) 01991 { 01992 pNode = SliceHelper::FindNextOfClass(pNode, pLid, CC_RUNTIME_CLASS(TextLine)); 01993 01994 if (pNode) 01995 { 01996 pNode = SliceHelper::FindNextOfClass(pNode, pLid, CC_RUNTIME_CLASS(TextChar)); 01997 if (pNode) 01998 { 01999 if (((TextChar*) pNode)->GetMetricsRectBounds(&rTextBounds)) 02000 { 02001 rBounds.hi.y = max(rTextBounds.hi.y, rBounds.hi.y); 02002 rBounds.lo.y = min(rTextBounds.lo.y, rBounds.lo.y); 02003 } 02004 } 02005 } 02006 } 02007 } 02008 else 02009 if (IS_A(pNode,NodeShadowController)) // ignore the size of the shadow and just get me the size of the other bits 02010 { 02011 rBounds.MakeEmpty(); 02012 02013 pNode = pNode->FindFirstChild(); 02014 02015 while (pNode) 02016 { 02017 if (!pNode->IsAnAttribute() && !pNode->IsNodeHidden() && !IS_A(pNode, NodeShadow)) 02018 rBounds = rBounds.Union(BoundingNodeSize(pNode)); 02019 02020 pNode = pNode->FindNext(); 02021 } 02022 02023 } 02024 else 02025 if (IS_A(pNode,NodeBevelController)) // ignore the size of the bevel and just get me the size of the other bits 02026 { 02027 rBounds.MakeEmpty(); 02028 02029 INT32 BevWidth = ((NodeBevelController *)pNode)->m_bOuter ? ((NodeBevelController *)pNode)->m_Indent : 0; 02030 pNode = pNode->FindFirstChild(); 02031 02032 while (pNode) 02033 { 02034 if (!pNode->IsAnAttribute() && !pNode->IsNodeHidden() 02035 && !IS_A(pNode, NodeBevel) && !IS_A(pNode, NodeBevelBegin)) 02036 { 02037 rBounds = rBounds.Union(BoundingNodeSize(pNode)); 02038 } 02039 02040 pNode = pNode->FindNext(); 02041 } 02042 02043 if (!rBounds.IsEmpty()) 02044 rBounds.Inflate(BevWidth); // inflate the other bits' size by the bevel width 02045 02046 } 02047 else 02048 if (IS_A(pNode,NodeContourController)) // ignore the size of the contour and just get me the size of the other bits 02049 { 02050 rBounds.MakeEmpty(); 02051 02052 // -ve width means outer contour!!?! 02053 // this is crazy but ignore inners so negate it to get the actual width increase 02054 INT32 Width = -((NodeContourController *)pNode)->GetWidth(); 02055 pNode = pNode->FindFirstChild(); 02056 02057 while (pNode) 02058 { 02059 if (!pNode->IsAnAttribute() && !pNode->IsNodeHidden() 02060 && !IS_A(pNode, NodeContour)) 02061 { 02062 rBounds = rBounds.Union(BoundingNodeSize(pNode)); 02063 } 02064 02065 pNode = pNode->FindNext(); 02066 } 02067 02068 if (Width > 0) 02069 rBounds.Inflate(Width); // inflate the size of the other bits' by the width of the contour 02070 } 02071 02072 return rBounds; 02073 }
|
|
||||||||||||||||
|
Builds a list (or extends an existing list) of ALL the wix attribute nodes that have this bar name hidden in the question.
Definition at line 324 of file slicehelper.cpp. 00325 { 00326 if (pNode->IsAnAttribute()) // looking for an attrib 00327 { 00328 if (IS_A(pNode,TemplateAttribute)) // that is a wix attrib 00329 { 00330 // that has the bar name in the question 00331 // the same as the one we are looking for 00332 if (BarName.CompareTo(((TemplateAttribute *)pNode)->GetQuestion()) == 0) 00333 { 00334 //add it to the list then 00335 NodeListItem * pItem = new NodeListItem(pNode); 00336 pList->AddTail(pItem); 00337 } 00338 } 00339 } 00340 else // find anything else interesting? 00341 { 00342 Node * pChildNode = pNode->FindFirstChild(); 00343 00344 while (pChildNode) 00345 { 00346 // ***recursive call*** 00347 if (!pChildNode->IsNodeHidden()) 00348 BuildListOfNodesInBar(pList, pChildNode, BarName); 00349 pChildNode = pChildNode->FindNext(); 00350 } 00351 } 00352 }
|
|
||||||||||||||||
|
Scans all of pLayer, building a list of all nodes which are part of ButonName - if a NodeShadowController is encountered, we add its children instead in order to get the correct bounding box info...
Definition at line 3356 of file slicehelper.cpp. 03357 { 03358 ERROR3IF(!pLayer || !ButtonName || !pList, "Please don't call SliceHelper::BuildListOfNodesInButton with null params!"); 03359 03360 // Starting at pLayer, look for all TemplateAttributes with the correct name attached... 03361 Node * pNode = FindNextOfClass(pLayer, pLayer, CC_RUNTIME_CLASS(TemplateAttribute)); 03362 while (pNode) 03363 { 03364 // If this Node is part of a bar AND has the correct name, then add it to the list... 03365 if (((TemplateAttribute *)pNode)->GetQuestion() && (((TemplateAttribute *)pNode)->GetParam() == ButtonName)) 03366 { 03367 // Add this node to the list unless it is a nodeshadowcontroller - if it is, add all of its children individually (except the nodeshadow child) 03368 if (IS_A(pNode->FindParent(), NodeShadowController)) 03369 { 03370 TRACEUSER( "Matt", _T("\nNodeShadowController found in BuildListOfNodesInButton - replacing list entries with its children")); 03371 Node * pChild = pNode->FindParent()->FindFirstChild(); 03372 while (pChild) 03373 { 03374 if (!pChild->IsAnAttribute() && !pChild->IsNodeHidden() && !IS_A(pChild, NodeShadow)) 03375 { 03376 // Then add this child to the list 03377 NodeListItem * pItem = new NodeListItem(pChild); 03378 pList->AddTail(pItem); 03379 } 03380 pChild = pChild->FindNext(); 03381 } 03382 } 03383 else 03384 { 03385 // Then we were safe to add it to the list... 03386 NodeListItem * pItem = new NodeListItem(pNode->FindParent()); 03387 pList->AddTail(pItem); 03388 } 03389 } 03390 03391 pNode = FindNextOfClass(pNode, pLayer, CC_RUNTIME_CLASS(TemplateAttribute)); 03392 } 03393 }
|
|
|
Definition at line 207 of file slicehelper.cpp. 00208 { 00209 String_256 DefaultLayerName; 00210 DefaultLayerName.Load(_R(IDS_ROLLOVER_DEFAULT)); 00211 00212 // count the buttons on the default layer 00213 // every button bar requires a member to be on the default layer 00214 // so there is no point in counting any other layer 00215 Layer * pDef = FindLayerCalled(DefaultLayerName); 00216 00217 INT32 NumberOfButtons = 0; 00218 00219 if (pDef) 00220 { 00221 // store of example attribs of each button in this bar 00222 // but we don't need this data so we can throw it away afterwards 00223 TemplateAttribute ** ppFoundButton[MAX_BUTTONS_IN_A_BAR]; 00224 00225 // scan down from the default layer counting the different button names 00226 // that all have the same bar name 00227 CountButtonsInBarScan(pDef, (TemplateAttribute **) ppFoundButton, &NumberOfButtons, BarName); 00228 } 00229 00230 return NumberOfButtons; 00231 }
|
|
||||||||||||||||||||
|
Finds the number of buttons in the bar and the names of each button, by filling in the ppFoundButton array and pNumberOfButtons.
Definition at line 255 of file slicehelper.cpp. 00256 { 00257 // is this a node we are looking for? 00258 if (pNode->IsAnAttribute()) // is an attrib 00259 { 00260 if (IS_A(pNode,TemplateAttribute)) // is a wix attrib 00261 { 00262 // does it have the correct bar name hidden in the question? 00263 if (BarName.CompareTo(((TemplateAttribute *)pNode)->GetQuestion()) == 0) 00264 { 00265 BOOL ok = TRUE; 00266 // get this buttons name 00267 String_256 ThisButton = ((TemplateAttribute *)pNode)->GetParam(); 00268 00269 for (INT32 i = 0; ok && i < *pNumberOfButtons; i++) 00270 { 00271 // has this button name been seen before? 00272 if (ThisButton.CompareTo(ppFoundButton[i]->GetParam()) == 0) 00273 ok = FALSE; 00274 } 00275 00276 // found a new button name 00277 if (ok && *pNumberOfButtons < MAX_BUTTONS_IN_A_BAR) 00278 { 00279 // add this button to the array 00280 ppFoundButton[*pNumberOfButtons] = (TemplateAttribute *)pNode; 00281 TRACE( _T("Found new button called ")); 00282 TRACE(ppFoundButton[*pNumberOfButtons]->GetParam()); 00283 TRACE( _T("\n")); 00284 // increase the number of buttons 00285 *pNumberOfButtons = *pNumberOfButtons + 1; 00286 } 00287 00288 } 00289 } 00290 } 00291 else // look at this nodes children 00292 { 00293 Node * pChildNode = pNode->FindFirstChild(); 00294 00295 while (pChildNode) 00296 { 00297 // ***recursive call*** 00298 if (!pChildNode->IsNodeHidden()) 00299 CountButtonsInBarScan(pChildNode, ppFoundButton, pNumberOfButtons, BarName); 00300 00301 pChildNode = pChildNode->FindNext(); 00302 } 00303 } 00304 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If you create a named set these days you need to create properties in the node set sentinel too so that they are stored somewhere that can be saved out, undone, etc. So if you have made any in your code this is a useful little number.
Definition at line 1664 of file slicehelper.cpp. 01676 { 01677 NodeSetSentinel * pSentinel = Document::GetSelected()->GetSetSentinel(); 01678 01679 if (!pSentinel) 01680 return FALSE; 01681 01682 // find the property node for the setname 01683 NodeSetProperty* pOldSetProp =pSentinel->FindPropertyNode(SetName); 01684 01685 // hide the old properties if they existed 01686 if (pOldSetProp) 01687 { 01688 if (DontOverWrite) 01689 return TRUE; // it exists and that is good enough for us 01690 01691 // need a ptr to an op to hide a node 01692 ASSERT(pOp); 01693 pOp->DoHideNode(pOldSetProp, FALSE); 01694 TRACE( _T("Deleting property set of ")); 01695 TRACE(SetName); 01696 TRACE( _T("\n")); 01697 } 01698 01699 // create the new properties 01700 NodeSetProperty* pNewSetProp = pSentinel->CreatePropertyNode(SetName); 01701 if (pNewSetProp == 0 || !pNewSetProp->CreateDefaults()) return FALSE; 01702 01703 // debug info 01704 TRACE( _T("Creating property set of ")); 01705 TRACE(SetName); 01706 TRACE( _T(" ")); 01707 01708 NamedSliceProp* pNamedSliceProp = !isSlice ? new NamedSliceProp(SetName, isSlice) : 0; 01709 if (!pNamedSliceProp && !isSlice) return FALSE; 01710 01711 NamedStretchProp* pNamedStretchProp = new NamedStretchProp(SetName, StretchFlags, Stretches); 01712 if (!pNamedStretchProp) 01713 { 01714 if (pNamedSliceProp) delete pNamedSliceProp; 01715 return FALSE; 01716 } 01717 01718 // add the export props from the example if passed one 01719 // this will remember that the user wanted it as a jpeg and saved as whatever 01720 if (pExampleProp) 01721 { 01722 NamedExportProp * pExampleExportProp = (NamedExportProp *) pExampleProp->GetProperty(NamedExportProp::nIndex); 01723 if (pExampleExportProp) 01724 { 01725 NamedExportProp * pNamedExportProp = new NamedExportProp(*pExampleExportProp); 01726 if (pNamedExportProp) 01727 { 01728 SGNameProp* pOld = pNewSetProp->SetProperty(pNamedExportProp); 01729 if (pOld) 01730 delete pOld; 01731 } 01732 } 01733 } 01734 01735 // debugging info 01736 if (pNamedSliceProp) TRACE( _T("with slices ")); 01737 if (Stretches) TRACE( _T("with stretching ")); 01738 01739 // add an extend trigger 01740 if (pNamedStretchProp) 01741 { 01742 if (!StretchedBy.IsEmpty() && !IsBackBar) 01743 { 01744 pNamedStretchProp->AddTrigger(StretchedBy); 01745 01746 // Fix up the trigger and target reference rectangles. 01747 if (pTargetRect && pExtenderRect) 01748 { 01749 TRACE( _T("button")); 01750 pNamedStretchProp->SetRefTargetBounds(*pTargetRect); 01751 pNamedStretchProp->SetRefUnionTriggerBounds(*pExtenderRect); 01752 } 01753 } 01754 else 01755 if (IsBackBar) // build a list of all the members of the bar to make triggers for the back bar 01756 { 01757 NameGallery * pNameGallery = NameGallery::Instance(); 01758 SGUsedNames* pNames = pNameGallery ? pNameGallery->GetUsedNames() : NULL; 01759 01760 if (pNameGallery && pNames) 01761 { 01762 TRACE( _T("BackBar")); 01763 // scan to get data about everything 01764 pNameGallery->FastUpdateNamedSetSizes(FALSE); 01765 01766 INT32 BarNo = GetBarNumberFromBarName(BarName); 01767 DocRect RefUnionTriggers; 01768 DocRect BackBarBounds; 01769 01770 RefUnionTriggers.MakeEmpty(); 01771 BackBarBounds.MakeEmpty(); 01772 01773 String_256 FoundSetName; 01774 01775 // reset all the names 01776 SGNameItem * pNameGalleryItem = (SGNameItem*) pNames->GetChild(); 01777 01778 while (pNameGalleryItem) 01779 { 01780 if (pNameGalleryItem->m_BarNumber == BarNo )//&& !pNameGalleryItem->IsABackBar()) 01781 { 01782 pNameGalleryItem->GetNameText(&FoundSetName); 01783 01784 if (FoundSetName.CompareTo(SetName) == 0) 01785 { 01786 // found yourself the back bar 01787 BackBarBounds = pNameGalleryItem->GetSetBounds(); 01788 } 01789 else 01790 { 01791 // found a button of this bar 01792 RefUnionTriggers = RefUnionTriggers.Union(pNameGalleryItem->GetSetBounds()); 01793 pNamedStretchProp->AddTrigger(FoundSetName); 01794 } 01795 } 01796 01797 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext(); 01798 } 01799 01800 pNamedStretchProp->SetRefTargetBounds(pTargetRect ? *pTargetRect : BackBarBounds); 01801 pNamedStretchProp->SetRefUnionTriggerBounds(pExtenderRect ? *pExtenderRect : RefUnionTriggers); 01802 } 01803 } 01804 } 01805 01806 // replace the slice and stretch properties 01807 if (pNamedSliceProp) 01808 { 01809 SGNameProp* pOld = pNewSetProp->SetProperty(pNamedSliceProp); 01810 if (pOld) 01811 delete pOld; 01812 } 01813 01814 if (pNamedStretchProp) 01815 { 01816 SGNameProp* pOld = pNewSetProp->SetProperty(pNamedStretchProp); 01817 if (pOld) 01818 delete pOld; 01819 } 01820 01821 TRACE( _T("\n")); 01822 01823 // Create a hide node action to hide the node when we undo 01824 // this node was attached by the fn "NodeSetProperty* pNewSetProp = pSentinel->CreatePropertyNode(SetName);" 01825 // which is 107 lines above 01826 HideNodeAction* UndoHideNodeAction; 01827 HideNodeAction::Init(pOp, 01828 pOp->GetUndoActions(), //&UndoActions, 01829 pNewSetProp, 01830 TRUE, // Include subtree size 01831 ( Action**)(&UndoHideNodeAction)); 01832 01833 // now we have added the property we should also add the standard attrib 01834 // to the node set sentinel too 01835 Node * pSentinelChild = pSentinel->FindFirstChild(); 01836 01837 BOOL Found = FALSE; 01838 while (pSentinelChild && !Found) 01839 { 01840 if (pSentinelChild->IsAnAttribute()) 01841 { 01842 if (SetName.CompareTo(((TemplateAttribute *)pSentinelChild)->GetParam()) == 0) 01843 { 01844 if ((BarName.CompareTo(((TemplateAttribute *)pSentinelChild)->GetQuestion()) == 0)) 01845 Found = TRUE; 01846 else 01847 { 01848 pOp->DoHideNode(pSentinelChild, TRUE); // hide the near duplicate 01849 pSentinelChild = NULL; // end the search 01850 } 01851 } 01852 } 01853 01854 if (pSentinelChild) 01855 pSentinelChild = pSentinelChild->FindNext(); 01856 } 01857 01858 if (!Found) 01859 { 01860 TemplateAttribute* pExtraAttr = new TemplateAttribute(String_256(TEXT("ObjectName")), 01861 BarName, 01862 SetName); 01863 01864 if (!pExtraAttr) return TRUE; 01865 01866 // add the attrib into the tree 01867 pExtraAttr->AttachNode(pSentinel, FIRSTCHILD); 01868 01869 // Create a hide node action to hide the node when we undo 01870 HideNodeAction* UndoHideNodeAction; 01871 HideNodeAction::Init(pOp, 01872 pOp->GetUndoActions(), //&UndoActions, 01873 pExtraAttr, 01874 TRUE, // Include subtree size 01875 ( Action**)(&UndoHideNodeAction)); 01876 01877 } 01878 return TRUE; 01879 }
|
|
||||||||||||
|
Definition at line 2889 of file slicehelper.cpp. 02890 { 02891 NodeSetSentinel * pNodeSetSentinel = Document::GetSelected()->GetSetSentinel(); 02892 if (!pNodeSetSentinel) 02893 return; 02894 02895 // remove all properties of the deleted node 02896 Node * pNode = pNodeSetSentinel->FindPropertyNode(SetName); 02897 if (pNode) 02898 pOp->DoHideNode(pNode, FALSE); 02899 02900 // deleted bar members should be got rid of completely 02901 // remove the attribs from the sentinel 02902 pNode = pNodeSetSentinel->GetNameAttr(SetName); 02903 if (pNode) 02904 pOp->DoHideNode(pNode, FALSE); 02905 }
|
|
|
Definition at line 2834 of file slicehelper.cpp. 02835 { 02836 NameGallery * pNameGallery = NameGallery::Instance(); 02837 if (!pNameGallery) 02838 return 2; 02839 02840 pNameGallery->FastUpdateNamedSetSizes(); // Ensure timely info in NameGallery 02841 SGUsedNames* pNames = pNameGallery->GetUsedNames(); 02842 if (!pNames) 02843 return 2; 02844 02845 SGNameItem * pNameGalleryItem = (SGNameItem*) pNames->GetChild(); 02846 02847 INT32 ret = 2; // default as none of any set 02848 INT32 count = 0; 02849 02850 while (pNameGalleryItem) 02851 { 02852 count = pNameGalleryItem->GetSelectedCount(); 02853 if ( count > 0 && count < pNameGalleryItem->GetObjectCount()) 02854 { 02855 return 0; // has part of this set 02856 } 02857 else if (count > 0) 02858 ret = 1; // has all of this set then 02859 02860 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext(); 02861 } 02862 02863 return ret; 02864 }
|
|
|
Scans the NameGallery ensuring that the triggers are in the right places...
Definition at line 3403 of file slicehelper.cpp. 03404 { 03405 NameGallery *pNameGallery = NameGallery::Instance(); 03406 SGUsedNames* pNames = pNameGallery->GetUsedNames(); 03407 03408 if (!pNames) { return; } 03409 03410 SGNameItem* pNameGalleryItem = (SGNameItem*) pNames->GetChild(); 03411 03412 // First we need to loop around and set all the triggers to false... 03413 while (pNameGalleryItem) 03414 { 03415 pNameGalleryItem->m_IsATrigger = FALSE; 03416 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext(); 03417 } 03418 03419 // Now go back to the beginning and work out which named sets have triggers - mark these triggers as being such... 03420 pNameGalleryItem = (SGNameItem*) pNames->GetChild(); 03421 while (pNameGalleryItem) 03422 { 03423 NodeSetProperty* pPropNode = NULL; 03424 NamedStretchProp* pProp = NULL; 03425 03426 // Check if the named set has 'Stretch' property information... 03427 pPropNode = pNameGalleryItem->GetPropertyNode(); 03428 if (pPropNode) 03429 { 03430 pProp = (NamedStretchProp*) pPropNode->GetProperty(NamedStretchProp::nIndex); 03431 } 03432 03433 // If so, and its list of triggers is not empty, loop around ensuring that all of the triggers of this set have their 'is trigger' flag set... 03434 if (pProp && !pProp->GetTriggers().empty()) 03435 { 03436 for (std::list<TriggerSet>::iterator pt = pProp->GetTriggers().begin(); pt != pProp->GetTriggers().end(); pt++) 03437 { 03438 SGNameItem* pTempTriggerSet = SliceHelper::LookupNameGalleryItem(pt->m_strSet); 03439 03440 if (pTempTriggerSet) 03441 { 03442 pTempTriggerSet->m_IsATrigger = TRUE; 03443 } 03444 } 03445 } 03446 03447 // Get the next item and try again... 03448 pNameGalleryItem = (SGNameItem *) pNameGalleryItem->GetNext(); 03449 } 03450 }
|
|
|
returns the fist attrib that may apply to a node / /*!
Definition at line 2110 of file slicehelper.cpp. 02111 { 02112 while (!pNode->IsLayer()) 02113 { 02114 // test children for wix attrib 02115 Node * pChild = pNode->FindFirstChild(); 02116 02117 while (pChild) 02118 { 02119 if (pChild->IsAnAttribute() && IS_A(pChild,TemplateAttribute)) 02120 return (TemplateAttribute *) pChild; 02121 02122 pChild = pChild->FindNext(); 02123 } 02124 02125 pNode = pNode->FindParent(); 02126 } 02127 02128 return NULL; 02129 }
|
|
|
Definition at line 173 of file slicehelper.cpp. 00174 { 00175 // find a spread? 00176 Spread* pSpread = Document::GetSelectedSpread(); 00177 if (pSpread == NULL) 00178 return FALSE; 001 |