diff options
-rw-r--r-- | xmlscript/dtd/dialog.dtd | 3 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/exp_share.hxx | 5 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/imp_share.hxx | 7 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 8 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 33 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 7 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 42 | ||||
-rw-r--r-- | xmlscript/test/test.xml | 2 |
8 files changed, 92 insertions, 15 deletions
diff --git a/xmlscript/dtd/dialog.dtd b/xmlscript/dtd/dialog.dtd index 5b2c322d6aef..d1751b8e8d62 100644 --- a/xmlscript/dtd/dialog.dtd +++ b/xmlscript/dtd/dialog.dtd @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - $Id: dialog.dtd,v 1.20 2001-10-16 13:59:35 dbo Exp $ + $Id: dialog.dtd,v 1.21 2001-10-22 08:52:19 dbo Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -175,6 +175,7 @@ dlg:value CDATA #IMPLIED dlg:default %boolean; #IMPLIED dlg:tabstop %boolean; #IMPLIED + dlg:button-type (standard|ok|cancel|help) #IMPLIED > <!ELEMENT dlg:checkbox ((%event;)*)> diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index ba8b64bd3e9a..e405aa162458 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.11 $ + * $Revision: 1.12 $ * - * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $ + * last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -148,6 +148,7 @@ public: void readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName ); void readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName ); void readOrientationAttr( OUString const & rPropName, OUString const & rAttrName ); + void readButtonTypeAttr( OUString const & rPropName, OUString const & rAttrName ); // inline void addBoolAttr( OUString const & rAttrName, sal_Bool bValue ) SAL_THROW( () ); void addNumberFormatAttr( diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index 8d7062ab1e71..5870f57497f6 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.16 $ + * $Revision: 1.17 $ * - * last change: $Author: dbo $ $Date: 2001-09-25 11:13:15 $ + * last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -410,6 +410,9 @@ public: bool importOrientationProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); + bool importButtonTypeProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); }; //================================================================================================== class ControlImportContext : public ImportContext diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index 513161361c73..b3474e1aa0f3 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.17 $ + * $Revision: 1.18 $ * - * last change: $Author: dbo $ $Date: 2001-10-15 13:51:53 $ + * last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,8 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":default") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) ); readEvents(); } //__________________________________________________________________________________________________ @@ -124,7 +126,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) ); } sal_Int16 nState; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState) + if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState) { switch (nState) { diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index c0faa9aa48e0..00a65054f041 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.25 $ + * $Revision: 1.26 $ * - * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $ + * last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,7 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontWidth.hpp> +#include <com/sun/star/awt/PushButtonType.hpp> #include <com/sun/star/script/XScriptEventsSupplier.hpp> #include <com/sun/star/script/ScriptEventDescriptor.hpp> @@ -675,6 +676,34 @@ void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString cons } } //__________________________________________________________________________________________________ +void ElementDescriptor::readButtonTypeAttr( 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 awt::PushButtonType_STANDARD: + addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("standard") ) ); + break; + case awt::PushButtonType_OK: + addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("ok") ) ); + break; + case awt::PushButtonType_CANCEL: + addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("cancel") ) ); + break; + case awt::PushButtonType_HELP: + addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("help") ) ); + break; + default: + OSL_ENSURE( 0, "### illegal button-type value!" ); + } + } + } +} +//__________________________________________________________________________________________________ void ElementDescriptor::readOrientationAttr( OUString const & rPropName, OUString const & rAttrName ) { if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index cb28cdd11d0c..05e11244af44 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.24 $ + * $Revision: 1.25 $ * - * last change: $Author: dbo $ $Date: 2001-10-15 13:51:53 $ + * last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1528,6 +1528,9 @@ void ButtonElement::endElement() ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ), OUString( RTL_CONSTASCII_USTRINGPARAM("default") ), _xAttributes ); + ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ), + _xAttributes ); ctx.importEvents( _events ); } diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index e8ebb821f2bc..2763df3605f6 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.20 $ + * $Revision: 1.21 $ * - * last change: $Author: tbe $ $Date: 2001-09-28 14:56:15 $ + * last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,6 +77,7 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontWidth.hpp> +#include <com/sun/star/awt/PushButtonType.hpp> #include <com/sun/star/script/XScriptEventsSupplier.hpp> #include <com/sun/star/script/ScriptEventDescriptor.hpp> @@ -725,6 +726,43 @@ bool ImportContext::importAlignProperty( return false; } //__________________________________________________________________________________________________ +bool ImportContext::importButtonTypeProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) +{ + OUString buttonType( xAttributes->getValueByUidName( XMLNS_DIALOGS_UID, rAttrName ) ); + if (buttonType.getLength()) + { + sal_Int16 nButtonType; + if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("standard") )) + { + nButtonType = awt::PushButtonType_STANDARD; + } + else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ok") )) + { + nButtonType = awt::PushButtonType_OK; + } + else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("cancel") )) + { + nButtonType = awt::PushButtonType_CANCEL; + } + else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("help") )) + { + nButtonType = awt::PushButtonType_HELP; + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("invalid button-type value!") ), + Reference< XInterface >(), Any() ); + } + + _xControlModel->setPropertyValue( rPropName, makeAny( nButtonType ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ bool ImportContext::importDateFormatProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) diff --git a/xmlscript/test/test.xml b/xmlscript/test/test.xml index 897ff5e30f4f..78af60f899ea 100644 --- a/xmlscript/test/test.xml +++ b/xmlscript/test/test.xml @@ -25,7 +25,7 @@ <script:listener-event script:macro-name="ExecutingMacro" script:location="application" script:language="StarBasic" script:listener-type="com.sun.star.awt.XMouseListener" script:listener-method="mousePressed" script:listener-param="parameter0, so this will never ever be a script:event, but always a script:listener-event element!"/> </button> - <button dlg:id="button3" ns:value="hallo2" dlg:left="250" ns:top="50" width="50" height="50" style-id="bla" xmlns:ns="http://openoffice.org/2000/dialog"/> + <button dlg:id="button3" ns:value="help button" dlg:left="250" ns:top="50" width="50" height="50" style-id="bla" button-type="help" xmlns:ns="http://openoffice.org/2000/dialog"/> <checkbox id="check1" help-text="helphelphelp!!!" help-url="http://www.xml.org" value="checked" left="50" top="150" width="100" height="20" checked="true"/> <checkbox id="check2" value="dontknow" left="50" top="170" width="100" height="20" tristate="true"/> |