1*ecfe53c5SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ecfe53c5SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ecfe53c5SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ecfe53c5SAndrew Rist * distributed with this work for additional information 6*ecfe53c5SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ecfe53c5SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ecfe53c5SAndrew Rist * "License"); you may not use this file except in compliance 9*ecfe53c5SAndrew Rist * with the License. You may obtain a copy of the License at 10*ecfe53c5SAndrew Rist * 11*ecfe53c5SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ecfe53c5SAndrew Rist * 13*ecfe53c5SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ecfe53c5SAndrew Rist * software distributed under the License is distributed on an 15*ecfe53c5SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ecfe53c5SAndrew Rist * KIND, either express or implied. See the License for the 17*ecfe53c5SAndrew Rist * specific language governing permissions and limitations 18*ecfe53c5SAndrew Rist * under the License. 19*ecfe53c5SAndrew Rist * 20*ecfe53c5SAndrew Rist *************************************************************/ 21*ecfe53c5SAndrew Rist 22*ecfe53c5SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir /** @#file 25cdf0e10cSrcweir * 26cdf0e10cSrcweir * XML import of all variable related text fields plus database display field 27cdf0e10cSrcweir */ 28cdf0e10cSrcweir 29cdf0e10cSrcweir #ifndef _XMLOFF_TXTVFLDI_HXX 30cdf0e10cSrcweir #define _XMLOFF_TXTVFLDI_HXX 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include "txtvfldi.hxx" 33cdf0e10cSrcweir #include "txtfldi.hxx" 34cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 35cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp> 36cdf0e10cSrcweir 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39cdf0e10cSrcweir /// variable type (for XMLSetVarFieldImportContext) 40cdf0e10cSrcweir enum VarType 41cdf0e10cSrcweir { 42cdf0e10cSrcweir VarTypeSimple, 43cdf0e10cSrcweir VarTypeUserField, 44cdf0e10cSrcweir VarTypeSequence 45cdf0e10cSrcweir }; 46cdf0e10cSrcweir 47cdf0e10cSrcweir 48cdf0e10cSrcweir 49cdf0e10cSrcweir /** helper class: parses value-type and associated value attributes */ 50cdf0e10cSrcweir class XMLValueImportHelper 51cdf0e10cSrcweir { 52cdf0e10cSrcweir 53cdf0e10cSrcweir const ::rtl::OUString sPropertyContent; 54cdf0e10cSrcweir const ::rtl::OUString sPropertyValue; 55cdf0e10cSrcweir const ::rtl::OUString sPropertyFormula; 56cdf0e10cSrcweir const ::rtl::OUString sPropertyNumberFormat; 57cdf0e10cSrcweir const ::rtl::OUString sPropertyIsFixedLanguage; 58cdf0e10cSrcweir 59cdf0e10cSrcweir SvXMLImport& rImport; 60cdf0e10cSrcweir XMLTextImportHelper& rHelper; 61cdf0e10cSrcweir 62cdf0e10cSrcweir ::rtl::OUString sValue; /// string value (only valid if bStringValueOK) 63cdf0e10cSrcweir double fValue; /// double value (only valid if bFloatValueOK) 64cdf0e10cSrcweir sal_Int32 nFormatKey; /// format key (only valid of bFormatOK) 65cdf0e10cSrcweir ::rtl::OUString sFormula; /// formula string 66cdf0e10cSrcweir ::rtl::OUString sDefault; /// default (see bStringDefault/bFormulaDef.) 67cdf0e10cSrcweir sal_Bool bIsDefaultLanguage;/// format (of nFormatKey) has system language? 68cdf0e10cSrcweir 69cdf0e10cSrcweir sal_Bool bStringType; /// is this a string (or a float) type? 70cdf0e10cSrcweir sal_Bool bFormatOK; /// have we read a style:data-style-name attr.? 71cdf0e10cSrcweir sal_Bool bTypeOK; /// have we read a value-type attribute? 72cdf0e10cSrcweir sal_Bool bStringValueOK; /// have we read a string-value attr.? 73cdf0e10cSrcweir sal_Bool bFloatValueOK; /// have we read any of the float attr.s? 74cdf0e10cSrcweir sal_Bool bFormulaOK; /// have we read the formula attribute? 75cdf0e10cSrcweir 76cdf0e10cSrcweir const sal_Bool bSetType; /// should PrepareField set the SetExp subtype? 77cdf0e10cSrcweir const sal_Bool bSetValue; /// should PrepareField set content/value? 78cdf0e10cSrcweir const sal_Bool bSetStyle; /// should PrepareField set NumberFormat? 79cdf0e10cSrcweir const sal_Bool bSetFormula; /// should PrepareField set Formula? 80cdf0e10cSrcweir 81cdf0e10cSrcweir const sal_Bool bStringDefault; /// default: string-value = content 82cdf0e10cSrcweir const sal_Bool bFormulaDefault; /// default: formula = content 83cdf0e10cSrcweir 84cdf0e10cSrcweir public: 85cdf0e10cSrcweir XMLValueImportHelper( 86cdf0e10cSrcweir SvXMLImport& rImprt, /// XML Import 87cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// text import helper 88cdf0e10cSrcweir sal_Bool bType, /// process type (PrepareField) 89cdf0e10cSrcweir sal_Bool bStyle, /// process data style (P.F.) 90cdf0e10cSrcweir sal_Bool bValue, /// process value (Prep.Field) 91cdf0e10cSrcweir sal_Bool bFormula); /// process formula (Prep.F.) 92cdf0e10cSrcweir 93cdf0e10cSrcweir virtual ~XMLValueImportHelper(); 94cdf0e10cSrcweir 95cdf0e10cSrcweir /// process attribute values 96cdf0e10cSrcweir virtual void ProcessAttribute( sal_uInt16 nAttrToken, 97cdf0e10cSrcweir const ::rtl::OUString& sAttrValue ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir /// prepare XTextField for insertion into document 100cdf0e10cSrcweir virtual void PrepareField( 101cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 102cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 103cdf0e10cSrcweir 104cdf0e10cSrcweir /// is value a string (rather than double)? IsStringValue()105cdf0e10cSrcweir inline sal_Bool IsStringValue() { return bStringType; } 106cdf0e10cSrcweir 107cdf0e10cSrcweir /// has format been read? IsFormatOK()108cdf0e10cSrcweir inline sal_Bool IsFormatOK() { return bFormatOK; } 109cdf0e10cSrcweir SetDefault(const::rtl::OUString & sStr)110cdf0e10cSrcweir inline void SetDefault(const ::rtl::OUString& sStr) { sDefault = sStr; } 111cdf0e10cSrcweir }; 112cdf0e10cSrcweir 113cdf0e10cSrcweir 114cdf0e10cSrcweir 115cdf0e10cSrcweir /** 116cdf0e10cSrcweir * abstract parent class for all variable related fields 117cdf0e10cSrcweir * - variable-set/get/decl (not -decls), 118cdf0e10cSrcweir * - user-field-get/decl (not -decls), 119cdf0e10cSrcweir * - sequence/-decl (not -decls), 120cdf0e10cSrcweir * - expression, 121cdf0e10cSrcweir * - text-input 122cdf0e10cSrcweir * 123cdf0e10cSrcweir * Processes the following attributes: 124cdf0e10cSrcweir * - name 125cdf0e10cSrcweir * - formula 126cdf0e10cSrcweir * - display 127cdf0e10cSrcweir * - value, value-type, data-style-name (via XMLValueImportHelper) 128cdf0e10cSrcweir * - description. 129cdf0e10cSrcweir * 130cdf0e10cSrcweir * Each attribute has a corresponding member, a bool variable to indicate 131cdf0e10cSrcweir * whether it was set or not, and a bool variable whether it should be set 132cdf0e10cSrcweir * using the standard property name. 133cdf0e10cSrcweir * 134cdf0e10cSrcweir * bValid is set true, when name is found! 135cdf0e10cSrcweir * (Most variable related fields are valid, if a name is 136cdf0e10cSrcweir * found. However, some are always valid. In this case, setting bValid 137cdf0e10cSrcweir * does not matter.) 138cdf0e10cSrcweir */ 139cdf0e10cSrcweir class XMLVarFieldImportContext : public XMLTextFieldImportContext 140cdf0e10cSrcweir { 141cdf0e10cSrcweir protected: 142cdf0e10cSrcweir const ::rtl::OUString sPropertyContent; 143cdf0e10cSrcweir const ::rtl::OUString sPropertyHint; 144cdf0e10cSrcweir const ::rtl::OUString sPropertyHelp; 145cdf0e10cSrcweir const ::rtl::OUString sPropertyTooltip; 146cdf0e10cSrcweir const ::rtl::OUString sPropertyIsVisible; 147cdf0e10cSrcweir const ::rtl::OUString sPropertyIsDisplayFormula; 148cdf0e10cSrcweir const ::rtl::OUString sPropertyCurrentPresentation; 149cdf0e10cSrcweir 150cdf0e10cSrcweir private: 151cdf0e10cSrcweir ::rtl::OUString sName; /// name attribute 152cdf0e10cSrcweir ::rtl::OUString sFormula; /// formula attribute 153cdf0e10cSrcweir ::rtl::OUString sDescription; /// description 154cdf0e10cSrcweir ::rtl::OUString sHelp; /// help text 155cdf0e10cSrcweir ::rtl::OUString sHint; /// hint 156cdf0e10cSrcweir XMLValueImportHelper aValueHelper; /// value, value-type, and style 157cdf0e10cSrcweir sal_Bool bDisplayFormula; /// display formula?(rather than value) 158cdf0e10cSrcweir sal_Bool bDisplayNone; /// hide field? 159cdf0e10cSrcweir 160cdf0e10cSrcweir sal_Bool bNameOK; /// sName was set 161cdf0e10cSrcweir sal_Bool bFormulaOK; /// sFormula was set 162cdf0e10cSrcweir sal_Bool bDescriptionOK; /// sDescription was set 163cdf0e10cSrcweir sal_Bool bHelpOK; /// sHelp was set 164cdf0e10cSrcweir sal_Bool bHintOK; /// sHint was set 165cdf0e10cSrcweir sal_Bool bDisplayOK; /// sDisplayFormula/-None were set 166cdf0e10cSrcweir 167cdf0e10cSrcweir sal_Bool bSetName; /// set sName with ???-property 168cdf0e10cSrcweir sal_Bool bSetFormula; /// set Formula property 169cdf0e10cSrcweir sal_Bool bSetFormulaDefault; /// use content as default for formula 170cdf0e10cSrcweir sal_Bool bSetDescription; /// set sDescription with Hint-property 171cdf0e10cSrcweir sal_Bool bSetHelp; 172cdf0e10cSrcweir sal_Bool bSetHint; 173cdf0e10cSrcweir sal_Bool bSetVisible; /// set IsVisible 174cdf0e10cSrcweir sal_Bool bSetDisplayFormula; /// set DisplayFormula (sub type???) 175cdf0e10cSrcweir sal_Bool bSetPresentation; /// set presentation frm elem. content? 176cdf0e10cSrcweir 177cdf0e10cSrcweir public: 178cdf0e10cSrcweir 179cdf0e10cSrcweir TYPEINFO(); 180cdf0e10cSrcweir 181cdf0e10cSrcweir XMLVarFieldImportContext( 182cdf0e10cSrcweir // for XMLTextFieldImportContext: 183cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 184cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// text import helper 185cdf0e10cSrcweir const sal_Char* pServiceName, /// name of SO API service 186cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 187cdf0e10cSrcweir const ::rtl::OUString& rLocalName, /// element name w/o prefix 188cdf0e10cSrcweir // config variables for PrepareField behavior: 189cdf0e10cSrcweir sal_Bool bName, /// set sName with ???-property 190cdf0e10cSrcweir sal_Bool bFormula, /// set Formula property 191cdf0e10cSrcweir sal_Bool bFormulaDefault, /// use content as default for formula 192cdf0e10cSrcweir sal_Bool bDescription, /// set sDescription with Hint-property 193cdf0e10cSrcweir sal_Bool bHelp, 194cdf0e10cSrcweir sal_Bool bHint, 195cdf0e10cSrcweir sal_Bool bVisible, /// set IsVisible (display attr) 196cdf0e10cSrcweir sal_Bool bDisplayFormula, /// set ??? (display attr.) 197cdf0e10cSrcweir sal_Bool bType, /// set value type with ???-property 198cdf0e10cSrcweir sal_Bool bStyle, /// set data style (NumberFormat-Prop.) 199cdf0e10cSrcweir sal_Bool bValue, /// set value with Content/Value-Prop. 200cdf0e10cSrcweir sal_Bool bPresentation); /// set presentation from elem. content 201cdf0e10cSrcweir 202cdf0e10cSrcweir protected: 203cdf0e10cSrcweir /// process attribute values 204cdf0e10cSrcweir virtual void ProcessAttribute( sal_uInt16 nAttrToken, 205cdf0e10cSrcweir const ::rtl::OUString& sAttrValue ); 206cdf0e10cSrcweir 207cdf0e10cSrcweir /// prepare XTextField for insertion into document 208cdf0e10cSrcweir virtual void PrepareField( 209cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 210cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 211cdf0e10cSrcweir 212cdf0e10cSrcweir // various accessor methods: GetName()213cdf0e10cSrcweir inline ::rtl::OUString GetName() { return sName; } IsStringValue()214cdf0e10cSrcweir inline sal_Bool IsStringValue() { return aValueHelper.IsStringValue();} IsNameOK()215cdf0e10cSrcweir inline sal_Bool IsNameOK() { return bNameOK; } IsFormulaOK()216cdf0e10cSrcweir inline sal_Bool IsFormulaOK() { return bFormulaOK; } IsDescriptionOK()217cdf0e10cSrcweir inline sal_Bool IsDescriptionOK() { return bDescriptionOK; } IsDisplayOK()218cdf0e10cSrcweir inline sal_Bool IsDisplayOK() { return bDisplayOK; } 219cdf0e10cSrcweir }; 220cdf0e10cSrcweir 221cdf0e10cSrcweir 222cdf0e10cSrcweir 223cdf0e10cSrcweir /** import variable get fields (<text:variable-get>) */ 224cdf0e10cSrcweir class XMLVariableGetFieldImportContext : public XMLVarFieldImportContext 225cdf0e10cSrcweir { 226cdf0e10cSrcweir const ::rtl::OUString sPropertySubType; 227cdf0e10cSrcweir 228cdf0e10cSrcweir public: 229cdf0e10cSrcweir 230cdf0e10cSrcweir TYPEINFO(); 231cdf0e10cSrcweir 232cdf0e10cSrcweir XMLVariableGetFieldImportContext( 233cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 234cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// Text import helper 235cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 236cdf0e10cSrcweir const ::rtl::OUString& rLocalName); /// element name w/o prefix 237cdf0e10cSrcweir 238cdf0e10cSrcweir 239cdf0e10cSrcweir protected: 240cdf0e10cSrcweir /// prepare XTextField for insertion into document 241cdf0e10cSrcweir virtual void PrepareField( 242cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 243cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 244cdf0e10cSrcweir }; 245cdf0e10cSrcweir 246cdf0e10cSrcweir 247cdf0e10cSrcweir 248cdf0e10cSrcweir /** import expression fields (<text:expression>) */ 249cdf0e10cSrcweir class XMLExpressionFieldImportContext : public XMLVarFieldImportContext 250cdf0e10cSrcweir { 251cdf0e10cSrcweir const ::rtl::OUString sPropertySubType; 252cdf0e10cSrcweir 253cdf0e10cSrcweir public: 254cdf0e10cSrcweir 255cdf0e10cSrcweir TYPEINFO(); 256cdf0e10cSrcweir 257cdf0e10cSrcweir XMLExpressionFieldImportContext( 258cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 259cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// Text import helper 260cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 261cdf0e10cSrcweir const ::rtl::OUString& sLocalName); /// element name w/o prefix 262cdf0e10cSrcweir 263cdf0e10cSrcweir protected: 264cdf0e10cSrcweir virtual void PrepareField( 265cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 266cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 267cdf0e10cSrcweir }; 268cdf0e10cSrcweir 269cdf0e10cSrcweir /*** import text input fields (<text:text-input>) */ 270cdf0e10cSrcweir class XMLTextInputFieldImportContext : public XMLVarFieldImportContext 271cdf0e10cSrcweir { 272cdf0e10cSrcweir const ::rtl::OUString sPropertyContent; 273cdf0e10cSrcweir 274cdf0e10cSrcweir public: 275cdf0e10cSrcweir 276cdf0e10cSrcweir TYPEINFO(); 277cdf0e10cSrcweir 278cdf0e10cSrcweir XMLTextInputFieldImportContext( 279cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 280cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// Text import helper 281cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 282cdf0e10cSrcweir const ::rtl::OUString& sLocalName); /// element name w/o prefix 283cdf0e10cSrcweir 284cdf0e10cSrcweir protected: 285cdf0e10cSrcweir virtual void PrepareField( 286cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 287cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 288cdf0e10cSrcweir }; 289cdf0e10cSrcweir 290cdf0e10cSrcweir 291cdf0e10cSrcweir 292cdf0e10cSrcweir 293cdf0e10cSrcweir 294cdf0e10cSrcweir 295cdf0e10cSrcweir /** 296cdf0e10cSrcweir * uperclass for variable/user-set, var/user-input, and sequence fields 297cdf0e10cSrcweir * inds field master of appropriate type and attaches field to it. 298cdf0e10cSrcweir */ 299cdf0e10cSrcweir class XMLSetVarFieldImportContext : public XMLVarFieldImportContext 300cdf0e10cSrcweir { 301cdf0e10cSrcweir const VarType eFieldType; 302cdf0e10cSrcweir 303cdf0e10cSrcweir public: 304cdf0e10cSrcweir 305cdf0e10cSrcweir TYPEINFO(); 306cdf0e10cSrcweir 307cdf0e10cSrcweir XMLSetVarFieldImportContext( 308cdf0e10cSrcweir // for XMLTextFieldImportContext: 309cdf0e10cSrcweir SvXMLImport& rImport, /// see XMLTextFieldImportContext 310cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// see XMLTextFieldImportContext 311cdf0e10cSrcweir const sal_Char* pServiceName, /// see XMLTextFieldImportContext 312cdf0e10cSrcweir sal_uInt16 nPrfx, /// see XMLTextFieldImportContext 313cdf0e10cSrcweir const ::rtl::OUString& rLocalName, /// see XMLTextFieldImportContext 314cdf0e10cSrcweir // for finding appropriate field master (see EndElement()) 315cdf0e10cSrcweir VarType eVarType, /// variable type 316cdf0e10cSrcweir // config variables: 317cdf0e10cSrcweir sal_Bool bName, /// see XMLTextFieldImportContext 318cdf0e10cSrcweir sal_Bool bFormula, /// see XMLTextFieldImportContext 319cdf0e10cSrcweir sal_Bool bFormulaDefault, /// see XMLTextFieldImportContext 320cdf0e10cSrcweir sal_Bool bDescription, /// see XMLTextFieldImportContext 321cdf0e10cSrcweir sal_Bool bHelp, /// see XMLTextFieldImportContext 322cdf0e10cSrcweir sal_Bool bHint, /// see XMLTextFieldImportContext 323cdf0e10cSrcweir sal_Bool bVisible, /// see XMLTextFieldImportContext 324cdf0e10cSrcweir sal_Bool bDisplayFormula, /// see XMLTextFieldImportContext 325cdf0e10cSrcweir sal_Bool bType, /// see XMLTextFieldImportContext 326cdf0e10cSrcweir sal_Bool bStyle, /// see XMLTextFieldImportContext 327cdf0e10cSrcweir sal_Bool bValue, /// see XMLTextFieldImportContext 328cdf0e10cSrcweir sal_Bool bPresentation); /// see XMLTextFieldImportContext 329cdf0e10cSrcweir 330cdf0e10cSrcweir protected: 331cdf0e10cSrcweir 332cdf0e10cSrcweir /// create XTextField, attach master and insert into document; 333cdf0e10cSrcweir /// also calls PrepareTextField 334cdf0e10cSrcweir virtual void EndElement(); 335cdf0e10cSrcweir 336cdf0e10cSrcweir /// find appropriate field master 337cdf0e10cSrcweir sal_Bool FindFieldMaster( 338cdf0e10cSrcweir ::com::sun::star::uno::Reference< 339cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xMaster); 340cdf0e10cSrcweir }; 341cdf0e10cSrcweir 342cdf0e10cSrcweir 343cdf0e10cSrcweir 344cdf0e10cSrcweir /** import variable set fields (<text:variable-set>) */ 345cdf0e10cSrcweir class XMLVariableSetFieldImportContext : public XMLSetVarFieldImportContext 346cdf0e10cSrcweir { 347cdf0e10cSrcweir const ::rtl::OUString sPropertySubType; 348cdf0e10cSrcweir 349cdf0e10cSrcweir public: 350cdf0e10cSrcweir 351cdf0e10cSrcweir TYPEINFO(); 352cdf0e10cSrcweir 353cdf0e10cSrcweir XMLVariableSetFieldImportContext( 354cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 355cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// Text import helper 356cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 357cdf0e10cSrcweir const ::rtl::OUString& rLocalName); /// element name w/o prefix 358cdf0e10cSrcweir 359cdf0e10cSrcweir protected: 360cdf0e10cSrcweir /// prepare XTextField for insertion into document 361cdf0e10cSrcweir virtual void PrepareField( 362cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 363cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 364cdf0e10cSrcweir }; 365cdf0e10cSrcweir 366cdf0e10cSrcweir 367cdf0e10cSrcweir 368cdf0e10cSrcweir /** variable input fields (<text:variable-input>) */ 369cdf0e10cSrcweir class XMLVariableInputFieldImportContext : public XMLSetVarFieldImportContext 370cdf0e10cSrcweir { 371cdf0e10cSrcweir const ::rtl::OUString sPropertySubType; 372cdf0e10cSrcweir const ::rtl::OUString sPropertyIsInput; 373cdf0e10cSrcweir 374cdf0e10cSrcweir public: 375cdf0e10cSrcweir 376cdf0e10cSrcweir TYPEINFO(); 377cdf0e10cSrcweir 378cdf0e10cSrcweir XMLVariableInputFieldImportContext( 379cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 380cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// Text import helper 381cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 382cdf0e10cSrcweir const ::rtl::OUString& rLocalName); /// element name w/o prefix 383cdf0e10cSrcweir 384cdf0e10cSrcweir protected: 385cdf0e10cSrcweir 386cdf0e10cSrcweir /// prepare XTextField for insertion into document 387cdf0e10cSrcweir virtual void PrepareField( 388cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 389cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 390cdf0e10cSrcweir }; 391cdf0e10cSrcweir 392cdf0e10cSrcweir 393cdf0e10cSrcweir 394cdf0e10cSrcweir /** user fields (<text:user-field-get>) */ 395cdf0e10cSrcweir class XMLUserFieldImportContext : public XMLSetVarFieldImportContext 396cdf0e10cSrcweir { 397cdf0e10cSrcweir 398cdf0e10cSrcweir public: 399cdf0e10cSrcweir 400cdf0e10cSrcweir TYPEINFO(); 401cdf0e10cSrcweir 402cdf0e10cSrcweir XMLUserFieldImportContext( 403cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 404cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// Text import helper 405cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 406cdf0e10cSrcweir const ::rtl::OUString& rLocalName); /// element name w/o prefix 407cdf0e10cSrcweir }; 408cdf0e10cSrcweir 409cdf0e10cSrcweir /** user input fields (<text:user-field-input>) */ 410cdf0e10cSrcweir class XMLUserFieldInputImportContext : public XMLVarFieldImportContext 411cdf0e10cSrcweir { 412cdf0e10cSrcweir 413cdf0e10cSrcweir public: 414cdf0e10cSrcweir 415cdf0e10cSrcweir TYPEINFO(); 416cdf0e10cSrcweir 417cdf0e10cSrcweir XMLUserFieldInputImportContext( 418cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 419cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// Text import helper 420cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 421cdf0e10cSrcweir const ::rtl::OUString& rLocalName); /// element name w/o prefix 422cdf0e10cSrcweir 423cdf0e10cSrcweir virtual void PrepareField( 424cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 425cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 426cdf0e10cSrcweir }; 427cdf0e10cSrcweir 428cdf0e10cSrcweir 429cdf0e10cSrcweir 430cdf0e10cSrcweir /** sequence fields (<text:sequence>) */ 431cdf0e10cSrcweir class XMLSequenceFieldImportContext : public XMLSetVarFieldImportContext 432cdf0e10cSrcweir { 433cdf0e10cSrcweir const ::rtl::OUString sPropertyFormula; 434cdf0e10cSrcweir const ::rtl::OUString sPropertyNumberFormat; 435cdf0e10cSrcweir const ::rtl::OUString sPropertySequenceValue; 436cdf0e10cSrcweir ::rtl::OUString sFormula; 437cdf0e10cSrcweir ::rtl::OUString sNumFormat; 438cdf0e10cSrcweir ::rtl::OUString sNumFormatSync; 439cdf0e10cSrcweir ::rtl::OUString sRefName; 440cdf0e10cSrcweir 441cdf0e10cSrcweir sal_Bool bRefNameOK; 442cdf0e10cSrcweir 443cdf0e10cSrcweir public: 444cdf0e10cSrcweir 445cdf0e10cSrcweir TYPEINFO(); 446cdf0e10cSrcweir 447cdf0e10cSrcweir XMLSequenceFieldImportContext( 448cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 449cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// Text import helper 450cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 451cdf0e10cSrcweir const ::rtl::OUString& rLocalName); /// element name w/o prefix 452cdf0e10cSrcweir 453cdf0e10cSrcweir protected: 454cdf0e10cSrcweir 455cdf0e10cSrcweir /// process attribute values 456cdf0e10cSrcweir virtual void ProcessAttribute( sal_uInt16 nAttrToken, 457cdf0e10cSrcweir const ::rtl::OUString& sAttrValue ); 458cdf0e10cSrcweir 459cdf0e10cSrcweir /// prepare XTextField for insertion into document 460cdf0e10cSrcweir virtual void PrepareField( 461cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 462cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 463cdf0e10cSrcweir }; 464cdf0e10cSrcweir 465cdf0e10cSrcweir 466cdf0e10cSrcweir 467cdf0e10cSrcweir 468cdf0e10cSrcweir 469cdf0e10cSrcweir 470cdf0e10cSrcweir /** 471cdf0e10cSrcweir * variable declaration container for all variable fields 472cdf0e10cSrcweir * (variable-decls, user-field-decls, sequence-decls) 473cdf0e10cSrcweir */ 474cdf0e10cSrcweir class XMLVariableDeclsImportContext : public SvXMLImportContext 475cdf0e10cSrcweir { 476cdf0e10cSrcweir enum VarType eVarDeclsContextType; 477cdf0e10cSrcweir XMLTextImportHelper& rImportHelper; 478cdf0e10cSrcweir 479cdf0e10cSrcweir public: 480cdf0e10cSrcweir 481cdf0e10cSrcweir TYPEINFO(); 482cdf0e10cSrcweir 483cdf0e10cSrcweir XMLVariableDeclsImportContext( 484cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 485cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// text import helper 486cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 487cdf0e10cSrcweir const ::rtl::OUString& rLocalName, /// element name w/o prefix 488cdf0e10cSrcweir enum VarType eVarType); /// variable type 489cdf0e10cSrcweir 490cdf0e10cSrcweir virtual SvXMLImportContext *CreateChildContext( 491cdf0e10cSrcweir sal_uInt16 nPrefix, 492cdf0e10cSrcweir const ::rtl::OUString& rLocalName, 493cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 494cdf0e10cSrcweir ::com::sun::star::xml::sax::XAttributeList> & xAttrList ); 495cdf0e10cSrcweir }; 496cdf0e10cSrcweir 497cdf0e10cSrcweir /** 498cdf0e10cSrcweir * variable field declarations 499cdf0e10cSrcweir * (variable-decl, user-field-decl, sequence-decl) 500cdf0e10cSrcweir */ 501cdf0e10cSrcweir class XMLVariableDeclImportContext : public SvXMLImportContext 502cdf0e10cSrcweir { 503cdf0e10cSrcweir const ::rtl::OUString sPropertyName; 504cdf0e10cSrcweir const ::rtl::OUString sPropertySubType; 505cdf0e10cSrcweir const ::rtl::OUString sPropertyNumberingLevel; 506cdf0e10cSrcweir const ::rtl::OUString sPropertyNumberingSeparator; 507cdf0e10cSrcweir const ::rtl::OUString sPropertyIsExpression; 508cdf0e10cSrcweir 509cdf0e10cSrcweir ::rtl::OUString sName; 510cdf0e10cSrcweir XMLValueImportHelper aValueHelper; 511cdf0e10cSrcweir sal_Int8 nNumLevel; 512cdf0e10cSrcweir sal_Unicode cSeparationChar; 513cdf0e10cSrcweir 514cdf0e10cSrcweir public: 515cdf0e10cSrcweir 516cdf0e10cSrcweir TYPEINFO(); 517cdf0e10cSrcweir 518cdf0e10cSrcweir XMLVariableDeclImportContext( 519cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 520cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// text import helper 521cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 522cdf0e10cSrcweir const ::rtl::OUString& rLocalName, /// element name w/o prefix 523cdf0e10cSrcweir const ::com::sun::star::uno::Reference< /// list of element attributes 524cdf0e10cSrcweir ::com::sun::star::xml::sax::XAttributeList> & xAttrList, 525cdf0e10cSrcweir enum VarType eVarType); /// variable type 526cdf0e10cSrcweir 527cdf0e10cSrcweir /// get field master for name and rename if appropriate 528cdf0e10cSrcweir static sal_Bool FindFieldMaster(::com::sun::star::uno::Reference< 529cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xMaster, 530cdf0e10cSrcweir SvXMLImport& rImport, 531cdf0e10cSrcweir XMLTextImportHelper& rHelper, 532cdf0e10cSrcweir const ::rtl::OUString& sVarName, 533cdf0e10cSrcweir enum VarType eVarType); 534cdf0e10cSrcweir }; 535cdf0e10cSrcweir 536cdf0e10cSrcweir 537cdf0e10cSrcweir 538cdf0e10cSrcweir /** import table formula fields (deprecated; for Writer 2.0 compatibility) */ 539cdf0e10cSrcweir class XMLTableFormulaImportContext : public XMLTextFieldImportContext 540cdf0e10cSrcweir { 541cdf0e10cSrcweir const ::rtl::OUString sPropertyNumberFormat; 542cdf0e10cSrcweir const ::rtl::OUString sPropertyContent; 543cdf0e10cSrcweir const ::rtl::OUString sPropertyIsShowFormula; 544cdf0e10cSrcweir const ::rtl::OUString sPropertyCurrentPresentation; 545cdf0e10cSrcweir 546cdf0e10cSrcweir XMLValueImportHelper aValueHelper; 547cdf0e10cSrcweir 548cdf0e10cSrcweir ::rtl::OUString sFormula; 549cdf0e10cSrcweir sal_Bool bFormulaOK; 550cdf0e10cSrcweir 551cdf0e10cSrcweir sal_Bool bIsShowFormula; 552cdf0e10cSrcweir 553cdf0e10cSrcweir public: 554cdf0e10cSrcweir 555cdf0e10cSrcweir TYPEINFO(); 556cdf0e10cSrcweir 557cdf0e10cSrcweir XMLTableFormulaImportContext( 558cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 559cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// text import helper 560cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 561cdf0e10cSrcweir const ::rtl::OUString& rLocalName); /// element name w/o prefix 562cdf0e10cSrcweir virtual ~XMLTableFormulaImportContext(); 563cdf0e10cSrcweir 564cdf0e10cSrcweir protected: 565cdf0e10cSrcweir 566cdf0e10cSrcweir /// process attribute values 567cdf0e10cSrcweir virtual void ProcessAttribute( sal_uInt16 nAttrToken, 568cdf0e10cSrcweir const ::rtl::OUString& sAttrValue ); 569cdf0e10cSrcweir 570cdf0e10cSrcweir /// prepare XTextField for insertion into document 571cdf0e10cSrcweir virtual void PrepareField( 572cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 573cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet> & xPropertySet); 574cdf0e10cSrcweir }; 575cdf0e10cSrcweir 576cdf0e10cSrcweir 577cdf0e10cSrcweir 578cdf0e10cSrcweir /** import database display fields (<text:database-display>) */ 579cdf0e10cSrcweir class XMLDatabaseDisplayImportContext : public XMLDatabaseFieldImportContext 580cdf0e10cSrcweir { 581cdf0e10cSrcweir const ::rtl::OUString sPropertyColumnName; 582cdf0e10cSrcweir const ::rtl::OUString sPropertyDatabaseFormat; 583cdf0e10cSrcweir const ::rtl::OUString sPropertyCurrentPresentation; 584cdf0e10cSrcweir const ::rtl::OUString sPropertyIsVisible; 585cdf0e10cSrcweir 586cdf0e10cSrcweir XMLValueImportHelper aValueHelper; 587cdf0e10cSrcweir 588cdf0e10cSrcweir ::rtl::OUString sColumnName; 589cdf0e10cSrcweir sal_Bool bColumnOK; 590cdf0e10cSrcweir 591cdf0e10cSrcweir sal_Bool bDisplay; 592cdf0e10cSrcweir sal_Bool bDisplayOK; 593cdf0e10cSrcweir 594cdf0e10cSrcweir public: 595cdf0e10cSrcweir 596cdf0e10cSrcweir TYPEINFO(); 597cdf0e10cSrcweir 598cdf0e10cSrcweir XMLDatabaseDisplayImportContext( 599cdf0e10cSrcweir SvXMLImport& rImport, /// XML Import 600cdf0e10cSrcweir XMLTextImportHelper& rHlp, /// text import helper 601cdf0e10cSrcweir sal_uInt16 nPrfx, /// namespace prefix 602cdf0e10cSrcweir const ::rtl::OUString& rLocalName); /// element name w/o prefix 603cdf0e10cSrcweir 604cdf0e10cSrcweir protected: 605cdf0e10cSrcweir 606cdf0e10cSrcweir /// process attribute values 607cdf0e10cSrcweir virtual void ProcessAttribute( sal_uInt16 nAttrToken, 608cdf0e10cSrcweir const ::rtl::OUString& sAttrValue ); 609cdf0e10cSrcweir 610cdf0e10cSrcweir /// create, prepare and insert database field master and database field 611cdf0e10cSrcweir virtual void EndElement(); 612cdf0e10cSrcweir }; 613cdf0e10cSrcweir 614cdf0e10cSrcweir #endif 615