diff options
-rw-r--r-- | xmlscript/inc/xmlscript/xmldlg_imexp.hxx | 9 | ||||
-rw-r--r-- | xmlscript/prj/d.lst | 1 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/exp_share.hxx | 17 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/imp_share.hxx | 185 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 337 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 257 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 561 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 150 | ||||
-rw-r--r-- | xmlscript/test/makefile.mk | 24 | ||||
-rw-r--r-- | xmlscript/test/test.xml | 38 | ||||
-rw-r--r-- | xmlscript/util/makefile.mk | 24 |
11 files changed, 1381 insertions, 222 deletions
diff --git a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx index 9641c6547162..5feeb58e3494 100644 --- a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_imexp.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dbo $ $Date: 2001-02-16 14:14:47 $ + * last change: $Author: dbo $ $Date: 2001-02-21 20:49:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,13 +74,14 @@ namespace xmlscript //================================================================================================== -void exportDialogModel( +SAL_DLLEXPORT void SAL_CALL exportDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel, ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut ) throw (::com::sun::star::uno::Exception); //================================================================================================== -::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > importDialogModel( +SAL_DLLEXPORT ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > +SAL_CALL importDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel ) throw (::com::sun::star::uno::Exception); diff --git a/xmlscript/prj/d.lst b/xmlscript/prj/d.lst index 6b8cc19a8763..7a4354216712 100644 --- a/xmlscript/prj/d.lst +++ b/xmlscript/prj/d.lst @@ -1,2 +1,3 @@ ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so +..\inc\xmlscript\xmldlg_imexp.hxx %_DEST%\inc%_EXT%\xmlscript\xmldlg_imexp.hxx diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index 5ea4db826312..23b7a905340f 100644 --- a/xmlscript/source/xmldlg_imexp/exp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx @@ -2,9 +2,9 @@ * * $RCSfile: exp_share.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dbo $ $Date: 2001-02-20 16:51:10 $ + * last change: $Author: dbo $ $Date: 2001-02-21 20:49:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,12 +86,14 @@ struct Style sal_uInt32 _textColor; sal_Int16 _border; awt::FontDescriptor _descr; + short _all; short _set; OUString _id; - Style() - : _set( 0 ) + Style( short all_ ) + : _all( all_ ) + , _set( 0 ) {} Reference< xml::sax::XAttributeList > createElement(); @@ -149,17 +151,20 @@ public: void readDefaults(); // void readStringAttr( OUString const & rPropName, OUString const & rAttrName ); + void readDoubleAttr( OUString const & rPropName, OUString const & rAttrName ); void readLongAttr( OUString const & rPropName, OUString const & rAttrName ); void readHexLongAttr( OUString const & rPropName, OUString const & rAttrName ); void readShortAttr( OUString const & rPropName, OUString const & rAttrName ); void readBoolAttr( OUString const & rPropName, OUString const & rAttrName ); void readAlignAttr( OUString const & rPropName, OUString const & rAttrName ); + void readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName ); + void readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName ); // inline void addAttr( OUString const & rAttrName, OUString const & rValue ); inline void addBoolAttr( OUString const & rAttrName, sal_Bool bValue ); // - void addEvents() + void readEvents() throw (Exception); // void readButtonModel( StyleBag * all_styles ) @@ -192,8 +197,6 @@ public: throw (Exception); void readTimeFieldModel( StyleBag * all_styles ) throw (Exception); - void readContainerModel( StyleBag * all_styles ) - throw (Exception); // XAttributeList virtual sal_Int16 SAL_CALL getLength() diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index 9b0b23ea2710..8cab38857e34 100644 --- a/xmlscript/source/xmldlg_imexp/imp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx @@ -2,9 +2,9 @@ * * $RCSfile: imp_share.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dbo $ $Date: 2001-02-20 16:51:10 $ + * last change: $Author: dbo $ $Date: 2001-02-21 20:49:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -237,7 +237,7 @@ public: Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) throw (xml::sax::SAXException, RuntimeException); - StylesElement( + inline StylesElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -273,7 +273,7 @@ public: bool importBorderStyle( Reference< beans::XPropertySet > const & xProps ); - StyleElement( + inline StyleElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -298,7 +298,7 @@ public: Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) throw (xml::sax::SAXException, RuntimeException); - MenuPopupElement( + inline MenuPopupElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -326,7 +326,7 @@ public: vector< Reference< xml::sax2::XExtendedAttributes > > const * getEvents() throw () { return &_events; } - ControlElement( + inline ControlElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -363,6 +363,9 @@ public: bool importStringProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); + bool importDoubleProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); bool importBooleanProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); @@ -379,6 +382,12 @@ public: bool importAlignProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); + bool importDateFormatProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); + bool importTimeFormatProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); }; //================================================================================================== class WindowElement @@ -392,7 +401,7 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - WindowElement( + inline WindowElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -408,7 +417,7 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - EventElement( + inline EventElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -426,7 +435,7 @@ public: Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) throw (xml::sax::SAXException, RuntimeException); - BulletinBoardElement( + inline BulletinBoardElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -444,7 +453,7 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - ButtonElement( + inline ButtonElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -464,7 +473,7 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - CheckBoxElement( + inline CheckBoxElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -485,7 +494,7 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - ComboBoxElement( + inline ComboBoxElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -506,7 +515,7 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - MenuListElement( + inline MenuListElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -524,7 +533,7 @@ public: Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) throw (xml::sax::SAXException, RuntimeException); - RadioElement( + inline RadioElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -545,7 +554,7 @@ public: void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - RadioGroupElement( + inline RadioGroupElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -567,7 +576,7 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - TitledBoxElement( + inline TitledBoxElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -587,7 +596,7 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - TextElement( + inline TextElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) @@ -607,7 +616,147 @@ public: virtual void SAL_CALL endElement() throw (xml::sax::SAXException, RuntimeException); - TextFieldElement( + inline TextFieldElement( + OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + throw () + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +}; +//================================================================================================== +class ImageControlElement + : public ControlElement +{ +public: + virtual Reference< xml::XImportContext > SAL_CALL createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException); + virtual void SAL_CALL endElement() + throw (xml::sax::SAXException, RuntimeException); + + inline ImageControlElement( + OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + throw () + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +}; +//================================================================================================== +class FileControlElement + : public ControlElement +{ +public: + virtual Reference< xml::XImportContext > SAL_CALL createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException); + virtual void SAL_CALL endElement() + throw (xml::sax::SAXException, RuntimeException); + + inline FileControlElement( + OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + throw () + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +}; +//================================================================================================== +class CurrencyFieldElement + : public ControlElement +{ +public: + virtual Reference< xml::XImportContext > SAL_CALL createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException); + virtual void SAL_CALL endElement() + throw (xml::sax::SAXException, RuntimeException); + + inline CurrencyFieldElement( + OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + throw () + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +}; +//================================================================================================== +class DateFieldElement + : public ControlElement +{ +public: + virtual Reference< xml::XImportContext > SAL_CALL createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException); + virtual void SAL_CALL endElement() + throw (xml::sax::SAXException, RuntimeException); + + inline DateFieldElement( + OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + throw () + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +}; +//================================================================================================== +class NumericFieldElement + : public ControlElement +{ +public: + virtual Reference< xml::XImportContext > SAL_CALL createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException); + virtual void SAL_CALL endElement() + throw (xml::sax::SAXException, RuntimeException); + + inline NumericFieldElement( + OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + throw () + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +}; +//================================================================================================== +class TimeFieldElement + : public ControlElement +{ +public: + virtual Reference< xml::XImportContext > SAL_CALL createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException); + virtual void SAL_CALL endElement() + throw (xml::sax::SAXException, RuntimeException); + + inline TimeFieldElement( + OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + throw () + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +}; +//================================================================================================== +class PatternFieldElement + : public ControlElement +{ +public: + virtual Reference< xml::XImportContext > SAL_CALL createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException); + virtual void SAL_CALL endElement() + throw (xml::sax::SAXException, RuntimeException); + + inline PatternFieldElement( OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index eb4febb790cf..06357e25a71e 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_expmodels.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dbo $ $Date: 2001-02-20 14:05:25 $ + * last change: $Author: dbo $ $Date: 2001-02-21 20:49:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,12 +68,12 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles ) throw (Exception) { // collect styles - Style aStyle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor ) + Style aStyle( 0x1 | 0x2 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) aStyle._set |= 0x8; if (aStyle._set) { @@ -83,22 +83,23 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles ) // collect elements readDefaults(); - + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":default") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) throw (Exception) { // collect styles - Style aStyle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._backgroundColor ) + Style aStyle( 0x2 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) aStyle._set |= 0x8; if (aStyle._set) { @@ -108,7 +109,8 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) // collect elements readDefaults(); - + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); @@ -136,20 +138,21 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) break; } } + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) throw (Exception) { // collect styles - Style aStyle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor ) + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) aStyle._set |= 0x8; if (aStyle._set) { @@ -159,7 +162,8 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) // collect elements readDefaults(); - + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ), @@ -167,7 +171,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin-button") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), @@ -195,20 +199,21 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) addSubElem( popup ); } + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) throw (Exception) { // collect styles - Style aStyle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor ) + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) aStyle._set |= 0x8; if (aStyle._set) { @@ -218,13 +223,14 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) // collect elements readDefaults(); - + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiselection") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin-button") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) ); @@ -264,16 +270,17 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) addSubElem( popup ); } + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) throw (Exception) { // collect styles - Style aStyle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor ) + Style aStyle( 0x2 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) aStyle._set |= 0x8; if (aStyle._set) { @@ -283,7 +290,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) // collect elements readDefaults(); - + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); @@ -306,16 +314,17 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) break; } } + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles ) throw (Exception) { // collect styles - Style aStyle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor ) + Style aStyle( 0x2 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) aStyle._set |= 0x8; if (aStyle._set) { @@ -343,7 +352,6 @@ void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) ); // readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), // OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":left") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ), @@ -369,14 +377,14 @@ void ElementDescriptor::readFixedTextModel( StyleBag * all_styles ) throw (Exception) { // collect styles - Style aStyle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor ) + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) aStyle._set |= 0x8; if (aStyle._set) { @@ -386,7 +394,6 @@ void ElementDescriptor::readFixedTextModel( StyleBag * all_styles ) // collect elements readDefaults(); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), @@ -399,14 +406,14 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles ) throw (Exception) { // collect styles - Style aStyle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor ) + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr ) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) aStyle._set |= 0x8; if (aStyle._set) { @@ -416,7 +423,8 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles ) // collect elements readDefaults(); - + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ), @@ -440,46 +448,263 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles ) addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":echochar") ), OUString( &cEcho, 1 ) ); } + readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles ) - throw (Exception) -{ -} -//__________________________________________________________________________________________________ -void ElementDescriptor::readDateFieldModel( StyleBag * all_styles ) +void ElementDescriptor::readImageControlModel( StyleBag * all_styles ) throw (Exception) { + // collect styles + Style aStyle( 0x1 | 0x4 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (aStyle._set) + { + addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) ); + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readFileControlModel( StyleBag * all_styles ) throw (Exception) { + // collect styles + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readImageControlModel( StyleBag * all_styles ) +void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles ) throw (Exception) { + // collect styles + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) ); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currency-symbol") ) ); + readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) ); + readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); + readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) ); + readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles ) +void ElementDescriptor::readDateFieldModel( StyleBag * all_styles ) throw (Exception) { + // collect styles + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) ); + readDateFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":date-format") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) ); + readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles ) +void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles ) throw (Exception) { + // collect styles + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) ); + readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) ); + readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); + readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) ); + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles ) throw (Exception) { + // collect styles + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) ); + readTimeFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":time-format") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) ); + readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readContainerModel( StyleBag * all_styles ) +void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles ) throw (Exception) { + // collect styles + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) ); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":edit-mask") ) ); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) ); + readEvents(); } }; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index 2c23c5d3f6d9..e2bc9546f784 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_export.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dbo $ $Date: 2001-02-20 16:51:10 $ + * last change: $Author: dbo $ $Date: 2001-02-21 20:49:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() pStyle->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), _id ); // background-color - if ((_set & 0x1) != 0) + if (_set & 0x1) { OUStringBuffer buf( 16 ); buf.append( (sal_Unicode)'0' ); @@ -102,7 +102,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() } // text-color - if ((_set & 0x2) != 0) + if (_set & 0x2) { OUStringBuffer buf( 16 ); buf.append( (sal_Unicode)'0' ); @@ -113,7 +113,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() } // border - if ((_set & 0x4) != 0) + if (_set & 0x4) { switch (_border) { @@ -135,7 +135,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() } // font- - if ((_set & 0x8) != 0) + if (_set & 0x8) { awt::FontDescriptor def_descr; @@ -510,6 +510,18 @@ void ElementDescriptor::readStringAttr( OUString const & rPropName, OUString con } } //__________________________________________________________________________________________________ +void ElementDescriptor::readDoubleAttr( OUString const & rPropName, OUString const & rAttrName ) +{ + if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) + { + Any a( _xProps->getPropertyValue( rPropName ) ); + if (a.getValueTypeClass() == TypeClass_DOUBLE) + { + addAttr( rAttrName, OUString::valueOf( *(double const *)a.getValue() ) ); + } + } +} +//__________________________________________________________________________________________________ void ElementDescriptor::readLongAttr( OUString const & rPropName, OUString const & rAttrName ) { if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) @@ -562,6 +574,88 @@ void ElementDescriptor::readBoolAttr( OUString const & rPropName, OUString const } } //__________________________________________________________________________________________________ +void ElementDescriptor::readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName ) +{ + if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) + { + Any a( _xProps->getPropertyValue( rPropName ) ); + if (a.getValueTypeClass() == TypeClass_SHORT) + { + switch (*(sal_Int16 const *)a.getValue()) + { + case 0: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system short") ) ); + break; + case 1: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system short YY") ) ); + break; + case 2: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system short YYYY") ) ); + break; + case 3: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system long") ) ); + break; + case 4: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short DDMMYY") ) ); + break; + case 5: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short MMDDYY") ) ); + break; + case 6: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short YYMMDD") ) ); + break; + case 7: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short DDMMYYYY") ) ); + break; + case 8: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short MMDDYYYY") ) ); + break; + case 9: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short YYYYMMDD") ) ); + break; + case 10: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short YYMMDD DIN5008") ) ); + break; + case 11: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short YYYYMMDD DIN5008") ) ); + break; + } + } + } +} +//__________________________________________________________________________________________________ +void ElementDescriptor::readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName ) +{ + if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) + { + Any a( _xProps->getPropertyValue( rPropName ) ); + if (a.getValueTypeClass() == TypeClass_SHORT) + { + switch (*(sal_Int16 const *)a.getValue()) + { + case 0: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("24h short") ) ); + break; + case 1: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("24h long") ) ); + break; + case 2: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("12h short") ) ); + break; + case 3: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("12h long") ) ); + break; + case 4: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration short") ) ); + break; + case 5: + addAttr( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration long") ) ); + break; + } + } + } +} +//__________________________________________________________________________________________________ void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString const & rAttrName ) { if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) @@ -603,11 +697,6 @@ void ElementDescriptor::readDefaults() OSL_ENSURE( 0, "unexpected property type for \"Enabled\": not bool!" ); } - readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) ); - readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":left") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ), @@ -616,9 +705,11 @@ void ElementDescriptor::readDefaults() OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":width") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":height") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) ); } //__________________________________________________________________________________________________ -void ElementDescriptor::addEvents() +void ElementDescriptor::readEvents() throw (Exception) { Reference< script::XScriptEventsSupplier > xSupplier( _xProps, UNO_QUERY ); @@ -712,46 +803,55 @@ OUString StyleBag::getStyleId( Style const & rStyle ) { Style * pStyle = _styles[ nStylesPos ]; - if ((rStyle._set & pStyle->_set & 0x1) != 0 && - rStyle._backgroundColor != pStyle->_backgroundColor) - { - continue; - } - if ((rStyle._set & pStyle->_set & 0x2) != 0 && - rStyle._textColor != pStyle->_textColor) - { - continue; - } - if ((rStyle._set & pStyle->_set & 0x4) != 0 && - rStyle._border != pStyle->_border) - { - continue; - } - if ((rStyle._set & pStyle->_set & 0x8) != 0 && - !equals( rStyle._descr, pStyle->_descr)) - { - continue; - } + // xxx todo: have a look at this... - // merge in - if ((rStyle._set & !pStyle->_set & 0x1) != 0) - { - pStyle->_backgroundColor = rStyle._backgroundColor; - } - if ((rStyle._set & !pStyle->_set & 0x2) != 0) - { - pStyle->_textColor = rStyle._textColor; - } - if ((rStyle._set & !pStyle->_set & 0x4) != 0) - { - pStyle->_border = rStyle._border; - } - if ((rStyle._set & !pStyle->_set & 0x8) != 0) + short demanded_defaults = ~rStyle._set & rStyle._all; + // test, if defaults are not set + if ((~pStyle->_set & demanded_defaults) == demanded_defaults && + (rStyle._set & (pStyle->_all & ~pStyle->_set)) == 0) { - pStyle->_descr = rStyle._descr; - } + short bset = rStyle._set & pStyle->_set; + if ((bset & 0x1) && rStyle._backgroundColor != pStyle->_backgroundColor) + { + continue; + } + if ((bset & 0x2) && rStyle._textColor != pStyle->_textColor) + { + continue; + } + if ((bset & 0x4) && rStyle._border != pStyle->_border) + { + continue; + } + if ((bset & 0x8) && !equals( rStyle._descr, pStyle->_descr)) + { + continue; + } - return pStyle->_id; + // merge in + short bnset = rStyle._set & ~pStyle->_set; + if (bnset & 0x1) + { + pStyle->_backgroundColor = rStyle._backgroundColor; + } + if (bnset & 0x2) + { + pStyle->_textColor = rStyle._textColor; + } + if (bnset & 0x4) + { + pStyle->_border = rStyle._border; + } + if (bnset & 0x8) + { + pStyle->_descr = rStyle._descr; + } + + pStyle->_all |= rStyle._all; + pStyle->_set |= rStyle._set; + + return pStyle->_id; + } } // no appr style found, append new @@ -811,7 +911,7 @@ void ElementDescriptor::dump( Reference< xml::sax::XExtendedDocumentHandler > co } //================================================================================================== -void exportDialogModel( +SAL_DLLEXPORT void SAL_CALL exportDialogModel( Reference< container::XNameContainer > const & xDialogModel, Reference< xml::sax::XExtendedDocumentHandler > const & xOut ) throw (Exception) @@ -871,7 +971,6 @@ void exportDialogModel( pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readRadioButtonModel( &all_styles ); - pElem->addEvents(); pRadioGroup->addSubElem( xElem ); } else // no radio @@ -887,7 +986,6 @@ void exportDialogModel( pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readButtonModel( &all_styles ); - pElem->addEvents(); } else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") )) { @@ -898,7 +996,6 @@ void exportDialogModel( pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readCheckBoxModel( &all_styles ); - pElem->addEvents(); } else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") )) { @@ -909,7 +1006,6 @@ void exportDialogModel( pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readComboBoxModel( &all_styles ); - pElem->addEvents(); } else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") )) { @@ -920,7 +1016,6 @@ void exportDialogModel( pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readListBoxModel( &all_styles ); - pElem->addEvents(); } else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") )) { @@ -931,7 +1026,6 @@ void exportDialogModel( pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readGroupBoxModel( &all_styles ); - pElem->addEvents(); } else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") )) { @@ -942,7 +1036,6 @@ void exportDialogModel( pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readFixedTextModel( &all_styles ); - pElem->addEvents(); } else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlEditModel") )) { @@ -953,88 +1046,76 @@ void exportDialogModel( pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readEditModel( &all_styles ); - pElem->addEvents(); } - - - - - else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") )) + else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") )) { pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); - pElem->readCurrencyFieldModel( &all_styles ); - pElem->addEvents(); + pElem->readImageControlModel( &all_styles ); } - else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") )) + else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") )) { pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); - pElem->readDateFieldModel( &all_styles ); - pElem->addEvents(); + pElem->readFileControlModel( &all_styles ); } - else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") )) + else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") )) { pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); - pElem->readFileControlModel( &all_styles ); - pElem->addEvents(); + pElem->readCurrencyFieldModel( &all_styles ); } - else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") )) + else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") )) { pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); - pElem->readImageControlModel( &all_styles ); - pElem->addEvents(); + pElem->readDateFieldModel( &all_styles ); } else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") )) { pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); pElem->readNumericFieldModel( &all_styles ); - pElem->addEvents(); } - else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") )) + else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") )) { pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); - pElem->readPatternFieldModel( &all_styles ); - pElem->addEvents(); + pElem->readTimeFieldModel( &all_styles ); } - else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") )) + else if (aControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") )) { pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->addAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), rName ); - pElem->readTimeFieldModel( &all_styles ); - pElem->addEvents(); + pElem->readPatternFieldModel( &all_styles ); } // diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index b40a09e8c86f..1c926874fb4f 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_impmodels.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dbo $ $Date: 2001-02-20 16:51:10 $ + * last change: $Author: dbo $ $Date: 2001-02-21 20:49:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,9 +70,493 @@ using namespace ::com::sun::star::uno; namespace xmlscript { +// patternfield +//__________________________________________________________________________________________________ +Reference< xml::XImportContext > PatternFieldElement::createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ +void PatternFieldElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), + _xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("edit-mask") ), + _xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("literal-mask") ), + _xAttributes ); + ctx.importEvents( _events ); +} + +//################################################################################################## + +// timefield +//__________________________________________________________________________________________________ +Reference< xml::XImportContext > TimeFieldElement::createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ +void TimeFieldElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), + _xAttributes ); + ctx.importTimeFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("time-format") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), + _xAttributes ); + ctx.importEvents( _events ); +} + +//################################################################################################## + +// numericfield +//__________________________________________________________________________________________________ +Reference< xml::XImportContext > NumericFieldElement::createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ +void NumericFieldElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), + _xAttributes ); + ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ), + _xAttributes ); + ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), + _xAttributes ); + ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), + _xAttributes ); + ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), + _xAttributes ); + ctx.importEvents( _events ); +} + +//################################################################################################## + +// datefield +//__________________________________________________________________________________________________ +Reference< xml::XImportContext > DateFieldElement::createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ +void DateFieldElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), + _xAttributes ); + ctx.importDateFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("date-format") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), + _xAttributes ); + ctx.importEvents( _events ); +} + +//################################################################################################## + +// currencyfield +//__________________________________________________________________________________________________ +Reference< xml::XImportContext > CurrencyFieldElement::createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ +void CurrencyFieldElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), + _xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("currency-symbol") ), + _xAttributes ); + ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ), + _xAttributes ); + ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), + _xAttributes ); + ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), + _xAttributes ); + ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), + _xAttributes ); + ctx.importEvents( _events ); +} + +//################################################################################################## + +// filecontrol +//__________________________________________________________________________________________________ +Reference< xml::XImportContext > FileControlElement::createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ +void FileControlElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importEvents( _events ); +} + //################################################################################################## -// fixed text +// imagecontrol +//__________________________________________________________________________________________________ +Reference< xml::XImportContext > ImageControlElement::createChildContext( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ +void ImageControlElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("src") ), + _xAttributes ); + ctx.importEvents( _events ); +} + +//################################################################################################## + +// textfield //__________________________________________________________________________________________________ Reference< xml::XImportContext > TextElement::createChildContext( sal_Int32 nUid, OUString const & rLocalName, @@ -117,7 +601,6 @@ void TextElement::endElement() } ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), _xAttributes ); @@ -127,7 +610,6 @@ void TextElement::endElement() ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), _xAttributes ); - ctx.importEvents( _events ); } @@ -178,7 +660,9 @@ void TextFieldElement::endElement() } ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); - + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), _xAttributes ); @@ -326,7 +810,9 @@ void TitledBoxElement::endElement() } ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes ); - + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), xAttributes ); @@ -435,7 +921,9 @@ void RadioGroupElement::endElement() } ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes ); - + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), xAttributes ); @@ -578,12 +1066,14 @@ void MenuListElement::endElement() } ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); - + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ), OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ), _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("spin-button") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), _xAttributes ); ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ), @@ -651,7 +1141,9 @@ void ComboBoxElement::endElement() } ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); - + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), _xAttributes ); @@ -659,7 +1151,7 @@ void ComboBoxElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("autocomplete") ), _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("spin-button") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), _xAttributes ); ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ), OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ), @@ -724,7 +1216,9 @@ void CheckBoxElement::endElement() } ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); - + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), _xAttributes ); @@ -799,7 +1293,9 @@ void ButtonElement::endElement() } ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); - + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), _xAttributes ); @@ -865,8 +1361,41 @@ Reference< xml::XImportContext > BulletinBoardElement::createChildContext( { return new TextFieldElement( rLocalName, xAttributes, this, _pImport ); } - - + // img + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("img") )) + { + return new ImageControlElement( rLocalName, xAttributes, this, _pImport ); + } + // filecontrol + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("filecontrol") )) + { + return new FileControlElement( rLocalName, xAttributes, this, _pImport ); + } + // currency-field + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") )) + { + return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport ); + } + // date-field + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") )) + { + return new DateFieldElement( rLocalName, xAttributes, this, _pImport ); + } + // date-field + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") )) + { + return new NumericFieldElement( rLocalName, xAttributes, this, _pImport ); + } + // time-field + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") )) + { + return new TimeFieldElement( rLocalName, xAttributes, this, _pImport ); + } + // pattern-field + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") )) + { + return new PatternFieldElement( rLocalName, xAttributes, this, _pImport ); + } // bulletinboard else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) { diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 9109f45ee0cd..a0f1df001f22 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_import.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dbo $ $Date: 2001-02-20 16:51:10 $ + * last change: $Author: dbo $ $Date: 2001-02-21 20:49:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -596,6 +596,19 @@ bool ControlImportContext::importStringProperty( return false; } //__________________________________________________________________________________________________ +bool ControlImportContext::importDoubleProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) +{ + OUString aValue( xAttributes->getValueByUidName( XMLNS_DIALOGS_UID, rAttrName ) ); + if (aValue.getLength()) + { + _xControlModel->setPropertyValue( rPropName, makeAny( aValue.toDouble() ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ bool ControlImportContext::importBooleanProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) @@ -680,8 +693,121 @@ bool ControlImportContext::importAlignProperty( Reference< XInterface >(), Any() ); } - _xControlModel->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), makeAny( nAlign ) ); + _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ +bool ControlImportContext::importDateFormatProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) +{ + OUString aFormat( xAttributes->getValueByUidName( XMLNS_DIALOGS_UID, rAttrName ) ); + if (aFormat.getLength()) + { + sal_Int16 nFormat; + if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system short") )) + { + nFormat = 0; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system short YY") )) + { + nFormat = 1; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system short YYYY") )) + { + nFormat = 2; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system long") )) + { + nFormat = 3; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short DDMMYY") )) + { + nFormat = 4; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short MMDDYY") )) + { + nFormat = 5; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short YYMMDD") )) + { + nFormat = 6; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short DDMMYYYY") )) + { + nFormat = 7; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short MMDDYYYY") )) + { + nFormat = 8; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short YYYYMMDD") )) + { + nFormat = 9; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short YYMMDD DIN5008") )) + { + nFormat = 10; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short YYYYMMDD DIN5008") )) + { + nFormat = 11; + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("invalid date-format value!") ), + Reference< XInterface >(), Any() ); + } + + _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ +bool ControlImportContext::importTimeFormatProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) +{ + OUString aFormat( xAttributes->getValueByUidName( XMLNS_DIALOGS_UID, rAttrName ) ); + if (aFormat.getLength()) + { + sal_Int16 nFormat; + if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("24h short") )) + { + nFormat = 0; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("24h long") )) + { + nFormat = 1; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("12h short") )) + { + nFormat = 2; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("12h long") )) + { + nFormat = 3; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Duration short") )) + { + nFormat = 4; + } + else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Duration long") )) + { + nFormat = 5; + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("invalid time-format value!") ), + Reference< XInterface >(), Any() ); + } + + _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) ); return true; } return false; @@ -691,6 +817,14 @@ void ControlImportContext::importDefaults( sal_Int32 nBaseX, sal_Int32 nBaseY, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { + sal_Bool bDisable; + if (getBoolAttr( &bDisable, OUString( RTL_CONSTASCII_USTRINGPARAM("disabled") ), xAttributes ) && + bDisable) + { + _xControlModel->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ), makeAny( sal_False ) ); + } + if (!importLongProperty( nBaseX, OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ), OUString( RTL_CONSTASCII_USTRINGPARAM("left") ), @@ -711,15 +845,9 @@ void ControlImportContext::importDefaults( Reference< XInterface >(), Any() ); } - importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("default") ), - xAttributes ); importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), OUString( RTL_CONSTASCII_USTRINGPARAM("printable") ), xAttributes ); - importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), - xAttributes ); } //__________________________________________________________________________________________________ void ControlImportContext::importEvents( @@ -929,7 +1057,7 @@ Reference< xml::XImportContext > DialogImport::getStyle( //################################################################################################## //================================================================================================== -Reference< xml::sax::XDocumentHandler > importDialogModel( +SAL_DLLEXPORT Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel( Reference< container::XNameContainer > const & xDialogModel ) throw (Exception) { diff --git a/xmlscript/test/makefile.mk b/xmlscript/test/makefile.mk index e43a83507e9e..3368730ebf3f 100644 --- a/xmlscript/test/makefile.mk +++ b/xmlscript/test/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: dbo $ $Date: 2001-02-16 14:14:49 $ +# last change: $Author: dbo $ $Date: 2001-02-21 20:49:29 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -92,7 +92,7 @@ APP1STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(SALLIB) \ - ixmlscript.lib + ixcr$(UPD)$(DLLPOSTFIX).lib APP1DEF= $(MISC)$/imexp.def @@ -108,14 +108,14 @@ APP1DEF= $(MISC)$/imexp.def .IF "$(GUI)" == "WIN" $(MISC)$/imexp.def: makefile.mk - echo NAME imexp >$@ - echo DESCRIPTION 'XML dialogs im-/ exporter' >>$@ - echo EXETYPE WINDOWS >>$@ - echo STUB 'winSTUB.EXE' >>$@ - echo PROTMODE >>$@ - echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@ - echo DATA PRELOAD MOVEABLE MULTIPLE >>$@ - echo HEAPSIZE 8192 >>$@ - echo STACKSIZE 32768 >>$@ + echo NAME imexp >$@ + echo DESCRIPTION 'XML dialogs im-/ exporter' >>$@ + echo EXETYPE WINDOWS >>$@ + echo STUB 'winSTUB.EXE' >>$@ + echo PROTMODE >>$@ + echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@ + echo DATA PRELOAD MOVEABLE MULTIPLE >>$@ + echo HEAPSIZE 8192 >>$@ + echo STACKSIZE 32768 >>$@ .ENDIF diff --git a/xmlscript/test/test.xml b/xmlscript/test/test.xml index 8513a6b94f3e..f9c62c66198b 100644 --- a/xmlscript/test/test.xml +++ b/xmlscript/test/test.xml @@ -1,12 +1,13 @@ <window xmlns="http://openoffice.org/2000/dialog" xmlns:dlg="http://openoffice.org/2000/dialog" - label="Test-Dialog" height="600" width="600"> + label="Test-Dialog" height="800" width="800"> <dlg:styles> <dlg:style style-id="bla" background-color="0xffffff" dlg:text-color="255"/> <dlg:style style-id="bla2" background-color="0xff00ff" dlg:text-color="255193873"/> <dlg:style style-id="bla3" background-color="0" dlg:text-color="0xffffff" font-name="Arial" font-height="24"/> + <dlg:style style-id="no_border" border="none"/> </dlg:styles> <dlg:bulletinboard xmlns:ns="http://www.fake"> @@ -58,7 +59,7 @@ </menupopup> </combobox> <combobox id="combo2" value="combotext2" left="310" top="150" width="50" height="50" - spin-button="true" + spin="true" > <menupopup> <menuitem value="Citem3"/> @@ -101,13 +102,40 @@ <textfield id="field1" left="250" top="520" width="50" height="40" value="edit text here..." readonly="true" vscroll="true" multiline="true" - align="right"/> + align="right" style-id="no_border"/> <textfield id="field2" left="320" top="520" width="50" height="40" - value="edit text2 here..." hscroll="true" - multiline="true" echochar="*" + value="hidden text" hscroll="true" + echochar="*" align="left"/> + <img id="image1" left="50" top="600" width="80" height="50" + src="../../test/w3c.jpg"/> + + <filecontrol id="file1" left="150" top="600" width="100" height="100" + value="f:\script\xmlscript\test\w3c.jpg"/> +<!-- + <currencyfield id="currency1" left="250" top="600" width="100" height="20" + value="5.6075" value-min="0.5" value-max="10.0" value-step="0.1" + spin="true" thousands-separator="true" currency-symbol="$"/> + + <numericfield id="numeric1" left="400" top="100" width="100" height="20" + value="5.6075" value-min="0.5" value-max="10.0" value-step="0.1" + thousands-separator="true" /> +--> + + <datefield id="datefield1" left="400" top="50" width="100" height="20" + date-format="short DDMMYY" + spin="true"/> + + <timefield id="time1" left="400" top="150" width="100" height="20" + time-format="24h short" value-min="0" value-max="12" + strict-format="true" value="6" + spin="true"/> + + <patternfield id="pattern1" left="400" top="200" width="100" height="20" + value="pattern" strict-format="true" readonly="true"/> + </dlg:bulletinboard> </window> diff --git a/xmlscript/util/makefile.mk b/xmlscript/util/makefile.mk index e55fa3d1af4b..4490d0a90687 100644 --- a/xmlscript/util/makefile.mk +++ b/xmlscript/util/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: dbo $ $Date: 2001-02-16 14:14:51 $ +# last change: $Author: dbo $ $Date: 2001-02-21 20:49:30 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -80,7 +80,7 @@ LIB1FILES= \ $(SLB)$/xml_helper.lib \ $(SLB)$/xmldlg_imexp.lib -SHL1TARGET= $(TARGET) +SHL1TARGET=xcr$(UPD)$(DLLPOSTFIX) SHL1LIBS= \ $(LIB1TARGET) @@ -91,7 +91,7 @@ SHL1STDLIBS= \ $(SALLIB) SHL1DEPN= -SHL1IMPLIB= i$(TARGET) +SHL1IMPLIB= i$(SHL1TARGET) SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) @@ -103,4 +103,18 @@ DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt .INCLUDE : target.mk $(MISC)$/$(SHL1TARGET).flt : makefile.mk - echo __CT >>$@ +.IF "$(COM)"=="MSC" + @echo ??_7>>$@ + @echo ??_8>>$@ + @echo ??_C>>$@ + @echo ??_E>>$@ + @echo ??_F>>$@ + @echo ??_G>>$@ + @echo ??_H>>$@ + @echo ??_I>>$@ + @echo 0Imp>>$@ + @echo Impl@@>>$@ + @echo Imp@@>>$@ + @echo __CT>>$@ + @echo _STL>>$@ +.ENDIF |