#include <tmpltatr.h>
Inheritance diagram for StyleReferenceAttribute:
Public Member Functions | |
StyleReferenceAttribute (const WizOpStyle &Style) | |
Constructor ensures this attribute actually references a style. | |
virtual Node * | SimpleCopy () |
Creates a new copy of this StyleReferenceAttribute. | |
virtual UINT32 | GetAttrNameID (void) |
Provides an attribute name for undo, etc. | |
virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
Writes this StyleReferenceAttribute via the given filter. | |
virtual BOOL | CopyComponentData (BaseDocument *SrcDoc, BaseDocument *NodesDoc) |
Ensures that the style to which this refers is in the target document. | |
virtual VisibleAttribute * | CreateVisibleAttribute () const |
Creates the user with something to look at in the Wizard Properties dialog. | |
const StringBase & | GetStyleName () const |
Support function to get the name of the referred style. | |
Protected Member Functions | |
BOOL | SetStyle (const Style &StyleToReference) |
When the component copy does it's stuff it sometimes needs to change the reference. This member is for that purpose. | |
WizOpStyles * | GetStylesForFilter (BaseCamelotFilter &Filter) const |
Support function to get the styles for the exporting document. | |
WizOpStyles * | GetStylesForDoc (BaseDocument &Doc) const |
Support function to get the styles for the given document. |
Definition at line 209 of file tmpltatr.h.
|
Constructor ensures this attribute actually references a style.
Definition at line 1027 of file tmpltatr.cpp. 01028 { 01029 SetWizOpNameAndParam( Style.GetWizOp().GetInternalName(), Style.GetParam() ); 01030 SetStyle( Style ); 01031 }
|
|
Ensures that the style to which this refers is in the target document.
Reimplemented from NodeAttribute. Definition at line 1097 of file tmpltatr.cpp. 01099 { 01100 ENSURE_NOT_NULL(Value.m_pStyle); 01101 01102 ENSURE_NOT_NULL(pSourceDoc); 01103 ENSURE_NOT_NULL(pTargetDoc); 01104 01105 // Ask the base class to copy its data 01106 BOOL Ok = TemplateAttribute::CopyComponentData(pSourceDoc, pTargetDoc); 01107 01108 // Get the style in our document 01109 WizOpStyles* pTargetStyles = NULL; 01110 01111 if (Ok) 01112 { 01113 pTargetStyles = GetStylesForDoc(*pTargetDoc); 01114 01115 Ok = (pTargetStyles != NULL); 01116 } 01117 01118 if (Ok) 01119 { 01120 // Attempt to add the style that was in the old (source) document and to which this 01121 // StyleReferenceAttribute currently refers, to the new (target) document 01122 01123 // If the new document already has a style of the same name, but different 01124 // characteristics it will return a style with a different name, which we will need 01125 // to use as our reference. 01126 ENSURE_KIND(Value.m_pStyle, WizOpStyle); 01127 const WizOpStyle& SourceStyle = (WizOpStyle&)*Value.m_pStyle; 01128 01129 WizOpStyle* const pTargetStyle = (WizOpStyle*)pTargetStyles->CopyComponentData(SourceStyle); 01130 if (pTargetStyle != NULL) 01131 { 01132 SetStyle(*pTargetStyle); 01133 } 01134 else 01135 { 01136 Ok = FALSE; 01137 } 01138 } 01139 01140 return Ok; 01141 }
|
|
Creates the user with something to look at in the Wizard Properties dialog.
Reimplemented from TemplateAttribute. Definition at line 1222 of file tmpltatr.cpp. 01223 { 01224 ENSURE_NOT_NULL(Value.m_pStyle); 01225 ENSURE_KIND(Value.m_pStyle, WizOpStyle); 01226 const WizOpStyle& ActualStyle = (WizOpStyle&)*Value.m_pStyle; 01227 01228 return new VisibleStyleReference(ActualStyle); 01229 }
|
|
Provides an attribute name for undo, etc.
Reimplemented from TemplateAttribute. Definition at line 1074 of file tmpltatr.cpp. 01075 { 01076 return _R(IDS_WIZOP_STYLEREF); 01077 }
|
|
Support function to get the name of the referred style.
Definition at line 1265 of file tmpltatr.cpp. 01266 { 01267 STRING_ENSURE_NOT_NULL(Value.m_pStyle); 01268 return Value.m_pStyle->GetName(); 01269 }
|
|
Support function to get the styles for the given document.
Definition at line 1310 of file tmpltatr.cpp. 01311 { 01312 return (WizOpStyles*)Doc.GetDocComponent( CC_RUNTIME_CLASS(WizOpStyles) ); 01313 }
|
|
Support function to get the styles for the exporting document.
Definition at line 1284 of file tmpltatr.cpp. 01285 { 01286 WizOpStyles* pStyles = NULL; 01287 01288 BaseDocument* const pDoc = Filter.GetDocument(); 01289 if (pDoc != NULL) 01290 { 01291 pStyles = GetStylesForDoc(*pDoc); 01292 } 01293 01294 return pStyles; 01295 }
|
|
When the component copy does it's stuff it sometimes needs to change the reference. This member is for that purpose.
Definition at line 1246 of file tmpltatr.cpp.
|
|
Creates a new copy of this StyleReferenceAttribute.
Reimplemented from TemplateAttribute. Definition at line 1046 of file tmpltatr.cpp. 01047 { 01048 ENSURE_NOT_NULL(Value.m_pStyle); 01049 ENSURE_KIND(Value.m_pStyle, WizOpStyle); 01050 01051 WizOpStyle& TrueStyle = (WizOpStyle&)*Value.m_pStyle; 01052 StyleReferenceAttribute* pNodeCopy = new StyleReferenceAttribute(TrueStyle); 01053 01054 ERRORIF(pNodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 01055 01056 CopyNodeContents(pNodeCopy); 01057 01058 return pNodeCopy; 01059 }
|
|
Writes this StyleReferenceAttribute via the given filter.
Reimplemented from TemplateAttribute. Definition at line 1162 of file tmpltatr.cpp. 01163 { 01164 #ifdef DO_EXPORT 01165 ENSURE_NOT_NULL(Value.m_pStyle); 01166 01167 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param"); 01168 01169 // Must write out the style first 01170 ENSURE_KIND(Value.m_pStyle, WizOpStyle); 01171 const WizOpStyle& ActualStyle = (WizOpStyle&)*Value.m_pStyle; 01172 01173 WizOpStyles* const pStyles = GetStylesForFilter(*pFilter); 01174 BOOL Ok = (pStyles != NULL); 01175 01176 XFileRef RecordRef = 0; 01177 if (Ok) 01178 { 01179 RecordRef = pStyles->GetRecordRefForStyle(ActualStyle); 01180 01181 // Is the style reference ok? 01182 Ok = (RecordRef != 0); 01183 } 01184 01185 if (Ok) 01186 { 01187 // Add a description of the TAG_WIZOP_STYLEREF record for older importers 01188 pFilter->AddTagDescription(TAG_WIZOP_STYLEREF, _R(IDS_TAG_WIZOP_STYLEREF)); 01189 } 01190 01191 if (Ok) 01192 { 01193 CamelotFileRecord Rec(pFilter, TAG_WIZOP_STYLEREF, TAG_WIZOP_STYLEREF_SIZE); 01194 01195 if (Ok) Ok = Rec.Init(); 01196 if (Ok) Ok = Rec.WriteReference(RecordRef); 01197 if (Ok) Ok = pFilter->Write(&Rec); 01198 } 01199 01200 if (!Ok) 01201 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 01202 01203 return Ok; 01204 #else 01205 return FALSE; 01206 #endif 01207 }
|