00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #ifndef MAX_BUTTONS_IN_A_BAR
00103
00104 #define MAX_BUTTONS_IN_A_BAR 20
00105
00106 #define INCLUDE_CLICKED_STATE 1 // 1 to have a clicked state, 0 to not have it
00107
00108 #include "ngscan.h"
00109
00110 class TemplateAttribute;
00111
00112 class UndoableOperation;
00113 class TextLine;
00114 class TextStory;
00115
00116 class SliceHelper
00117 {
00118 public:
00119
00120 enum SelStateAction { CLEAR, SET, TOGGLE };
00121
00122
00123 static Layer * FindLayerCalled(const StringBase & LayerName);
00124
00125
00126 static INT32 CountButtonsInBar(const StringBase & BarName);
00127 static void CountButtonsInBarScan(Node * pNode, TemplateAttribute ** ppFoundButton, INT32 * pNumberOfButtons, const StringBase & BarName);
00128
00129
00130 static void BuildListOfNodesInBar(List * pList, Node * pNode, const StringBase & BarName);
00131
00132
00133 static SGNameItem* LookupNameGalleryItem(const StringBase & strName);
00134 static void GetNextFreeButtonName(INT32 &butno, StringBase * pStr = NULL);
00135
00136
00137 static Node * FindNextOfClass(Node *pNode, Node * pLidNode, const class CCRuntimeClass * pClass, BOOL CheckThis = FALSE);
00138
00139
00140 static Node * FindNextNameNode(Node *pNode, Node * pLidNode, BOOL CheckThis = FALSE)
00141 {
00142 Node * pNextNode = NULL;
00143 BOOL tested = FALSE;
00144 Node * pPassedNode = CheckThis ? NULL : pNode;
00145
00146 while (pNode != pLidNode || !tested)
00147 {
00148 tested = TRUE;
00149
00150
00151 if (!pNode->IsNodeHidden() && pNode != pPassedNode && pNode->IsAnObjectName())
00152 return pNode;
00153
00154
00155 pNextNode = pNode->FindFirstChild();
00156
00157 if (pNextNode && pNextNode->IsNodeHidden())
00158 pNextNode = pNextNode->FindNextNonHidden();
00159
00160 while(pNextNode)
00161 {
00162 pNode = pNextNode;
00163
00164
00165 if (!pNode->IsNodeHidden() && pNode != pPassedNode && pNode->IsAnObjectName())
00166 return pNode;
00167
00168 pNextNode = pNode->FindFirstChild();
00169
00170 if (pNextNode && pNextNode->IsNodeHidden())
00171 pNextNode = pNextNode->FindNextNonHidden();
00172 }
00173
00174
00175 if (pNode == pLidNode)
00176 return NULL;
00177
00178
00179 pNextNode = pNode->FindNextNonHidden();
00180
00181 if (pNextNode)
00182 pNode = pNextNode;
00183 else
00184 {
00185 BOOL FoundUncle = FALSE;
00186
00187 while (!FoundUncle)
00188 {
00189 pNextNode = pNode->FindParent();
00190 if (pNextNode == pLidNode || !pNextNode)
00191 return NULL;
00192
00193 pNode = pNextNode;
00194 pNextNode = pNode->FindNextNonHidden();
00195
00196
00197 if (pNextNode)
00198 {
00199 pNode = pNextNode;
00200 FoundUncle = TRUE;
00201 }
00202 }
00203 }
00204 }
00205
00206 return NULL;
00207 }
00208
00209
00210 static void SelectAllSetsOfThisNode(NodeRenderableInk* pInk, String_256 & SetName, BOOL bShift);
00211 static void RecurseSelectAllSetsOfThisNode(Node * pAttrs, String_256 & SetName, BOOL bShift);
00212 static BOOL SelectObjectsInSet(const StringBase& strName, SelectScan::Change eNewState);
00213
00214
00215
00216 static void SelectAllSetsInRect(const DocRect, Spread*, SelStateAction st = SET);
00217
00218 static String_256 GetBarName(TemplateAttribute * pTemplAttrib);
00219 static void MeshImportedLayersWithExistingButtonBars(Node * pImportedLayer[5], UndoableOperation * pUndoableOp, BOOL Imported);
00220 static BOOL IsUniqueName(const String_256 & Name, List * pList);
00221
00222 static Node * ReplaceAttrsInTree(UndoableOperation * pOp,
00223 List * pImportedAttrList,
00224 const String_256 & OldButtonName,
00225 const String_256 & OldBarName,
00226 const String_256 & NewButtonName,
00227 const String_256 & NewBarName,
00228 Node ** ppNodeFound = NULL);
00229
00230 static BOOL BarNameExists(Node * pNode, String_256 &BarName, Node * pLid = NULL);
00231 static INT32 FindTargetAndExtender(Node * pStartNode,
00232 String_256 & Target,
00233 String_256 & Extender,
00234 INT32 RequiredLevel,
00235 BYTE *pExtenderFlags = NULL,
00236 DocRect *pTargetRect = NULL,
00237 DocRect *pExtenderRect = NULL);
00238
00239
00240 static BOOL CreatePropertiesForSet( const String_256& SetName,
00241 const String_256& BarName,
00242 BOOL isSlice,
00243 BOOL Stretches,
00244 BOOL IsBackBar,
00245 BYTE StretchFlags,
00246 const String_256& StretchedBy,
00247 BOOL DontOverWrite = FALSE,
00248 DocRect *pTargetRect = NULL,
00249 DocRect *pExtenderRect = NULL,
00250 UndoableOperation * pOp = NULL,
00251 NodeSetProperty * pExampleProp = NULL);
00252
00253 static BOOL PurgeUseOfSetName(const StringBase & SetName, UndoableOperation* pOp, const String_256 * pReplacementName = NULL);
00254
00255
00256 static BOOL MakeTriggerLikeExample(const String_256 & NewButtonName, const String_256 & ButtonName, const String_256 * pExclude = NULL);
00257
00258 static DocRect BoundingNodeSize(Node * pNode);
00259
00260 static INT32 GetBarNumberFromBarName(const String_256 & BarName);
00261
00262 static TemplateAttribute * FindFirstSetNodeBelongsTo(Node * pNode);
00263 static String_256 GetSetNameFromAttrib(Node * pNode);
00264 static TextStory * FindNextTextStoryToSync( TextStory * pLastStory,
00265 Node * pLid,
00266 TextStory * pMasterStory,
00267 const String_256 & ButtonName,
00268 const String_256 & MasterText,
00269 BOOL AnyText = FALSE);
00270
00271 static BOOL TextStoriesHaveSameText (TextStory * pStory1, TextStory * pStory2);
00272 static BOOL TextLinesHaveSameText (TextLine * pLine1, TextLine * pLine2);
00273 static BOOL SyncTextLines (TextLine * pLine1, TextLine * pLine2, UndoableOperation * pOp);
00274 static BOOL SyncTextStories (TextStory * pStory, TextStory * pMaster, UndoableOperation * pOp);
00275
00276 static BOOL OnTextStoryChanged( TextStory * pMasterStory,
00277 UndoableOperation * pOp,
00278 ObjChangeParam * pObjChange,
00279 const String_256 & MasterText);
00280
00281 static DocRect ScanForSetSizeExcluding (const String_256 & IncludeSet, const String_256 & ExcludeSet);
00282 static BOOL BarExistsOnLayer(const String_256 &BarName, const String_256 &Layer);
00283 static void BarNameInRect(DocRect r, String_256 *pBarName);
00284 static void ShowLayer(BOOL Visible, Layer * pLayer, Spread * pSpread, UndoableOperation * pUndoOp);
00285 static INT32 DoesSelectionOnlyContainCompleteSets();
00286
00287 static BOOL SetUsedInTree(Node * pNode, const String_256 &SetName, Node * pLid = NULL);
00288 static void DeleteUnusedReferences(const String_256 &SetName, UndoableOperation * pOp);
00289
00290 static BOOL AddNamesToController (UndoableOperation * pOp, Node * pCtrlr);
00291 static BOOL RemoveNamesFromController (UndoableOperation * pOp, Node * pCtrlr);
00292
00293
00294
00295
00296
00297 static BOOL ModifySelectionToContainWholeButtonElements();
00298
00299
00300
00301 static void SaveSelection();
00302
00303
00304
00305 static void RestoreSelection();
00306
00307
00308
00309 static void ValidateNodeSetSentinel();
00310
00311
00312
00313 static void BuildListOfNodesInButton(List * pList, Layer * pLayer, const StringBase & ButtonName);
00314
00315
00316
00317
00318 static void EnsureTriggerInfo();
00319
00320 private:
00321 static List* m_pSelNodeList;
00322
00323 };
00324
00325 #endif