summaryrefslogtreecommitdiff
path: root/xmlscript/source/xmldlg_imexp
diff options
context:
space:
mode:
Diffstat (limited to 'xmlscript/source/xmldlg_imexp')
-rw-r--r--xmlscript/source/xmldlg_imexp/common.hxx42
-rw-r--r--xmlscript/source/xmldlg_imexp/exp_share.hxx245
-rw-r--r--xmlscript/source/xmldlg_imexp/imp_share.hxx1020
-rw-r--r--xmlscript/source/xmldlg_imexp/makefile.mk52
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx138
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx1169
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx1610
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx2289
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_import.cxx1905
9 files changed, 8470 insertions, 0 deletions
diff --git a/xmlscript/source/xmldlg_imexp/common.hxx b/xmlscript/source/xmldlg_imexp/common.hxx
new file mode 100644
index 000000000000..f5bc51684ebb
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/common.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_COMMON_HXX
+#define INCLUDED_COMMON_HXX
+
+#include "sal/types.h"
+
+namespace xmlscript {
+
+const sal_Int16 BORDER_NONE = 0;
+const sal_Int16 BORDER_3D = 1;
+const sal_Int16 BORDER_SIMPLE = 2;
+const sal_Int16 BORDER_SIMPLE_COLOR = 3;
+
+}
+
+#endif
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx
new file mode 100644
index 000000000000..a53d02393ae6
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "common.hxx"
+#include "misc.hxx"
+#include <xmlscript/xmldlg_imexp.hxx>
+#include <xmlscript/xml_helper.hxx>
+#include <osl/diagnose.h>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontEmphasisMark.hpp>
+#include <com/sun/star/awt/FontRelief.hpp>
+#include <vector>
+
+
+namespace css = ::com::sun::star;
+
+namespace xmlscript
+{
+
+struct Style
+{
+ sal_uInt32 _backgroundColor;
+ sal_uInt32 _textColor;
+ sal_uInt32 _textLineColor;
+ sal_Int16 _border;
+ sal_Int32 _borderColor;
+ css::awt::FontDescriptor _descr;
+ sal_uInt16 _fontRelief;
+ sal_uInt16 _fontEmphasisMark;
+ sal_uInt32 _fillColor;
+ sal_Int16 _visualEffect;
+
+ // current highest mask: 0x40
+ short _all;
+ short _set;
+
+ ::rtl::OUString _id;
+
+ inline Style( short all_ ) SAL_THROW( () )
+ : _fontRelief( css::awt::FontRelief::NONE )
+ , _fontEmphasisMark( css::awt::FontEmphasisMark::NONE )
+ , _all( all_ )
+ , _set( 0 )
+ {}
+
+ css::uno::Reference< css::xml::sax::XAttributeList > createElement();
+};
+class StyleBag
+{
+ ::std::vector< Style * > _styles;
+
+public:
+ ~StyleBag() SAL_THROW( () );
+
+ ::rtl::OUString getStyleId( Style const & rStyle ) SAL_THROW( () );
+
+ void dump( css::uno::Reference< css::xml::sax::XExtendedDocumentHandler >
+ const & xOut );
+};
+
+class ElementDescriptor
+ : public ::xmlscript::XMLElement
+{
+ css::uno::Reference< css::beans::XPropertySet > _xProps;
+ css::uno::Reference< css::beans::XPropertyState > _xPropState;
+
+public:
+ inline ElementDescriptor(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps,
+ css::uno::Reference< css::beans::XPropertyState > const & xPropState,
+ ::rtl::OUString const & name )
+ SAL_THROW( () )
+ : XMLElement( name )
+ , _xProps( xProps )
+ , _xPropState( xPropState )
+ {}
+ inline ElementDescriptor(
+ ::rtl::OUString const & name )
+ SAL_THROW( () )
+ : XMLElement( name )
+ {}
+
+ template<typename T>
+ inline void read(
+ ::rtl::OUString const & propName, ::rtl::OUString const & attrName,
+ bool forceAttribute = false );
+
+ //
+ template<typename T>
+ inline bool readProp( T * ret, ::rtl::OUString const & rPropName );
+ css::uno::Any readProp( ::rtl::OUString const & rPropName );
+ //
+ void readDefaults( bool supportPrintable = true, bool supportVisible = true );
+ //
+ void readStringAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ inline void readDoubleAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName )
+ { read<double>( rPropName, rAttrName ); }
+ inline void readLongAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ bool forceAttribute = false )
+ { read<sal_Int32>( rPropName, rAttrName, forceAttribute ); }
+ void readHexLongAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ inline void readShortAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName )
+ { read<sal_Int32>( rPropName, rAttrName ); }
+ inline void readBoolAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName )
+ { read<sal_Bool>( rPropName, rAttrName ); }
+
+ void readAlignAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readVerticalAlignAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readImageAlignAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readImagePositionAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readDateFormatAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readTimeFormatAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readOrientationAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readButtonTypeAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readLineEndFormatAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readSelectionTypeAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ //
+ inline void addBoolAttr(
+ ::rtl::OUString const & rAttrName, sal_Bool bValue )
+ { addAttribute( rAttrName, ::rtl::OUString::valueOf(bValue) ); }
+ void addNumberFormatAttr(
+ css::uno::Reference< css::beans::XPropertySet >
+ const & xFormatProperties,
+ ::rtl::OUString const & rAttrName );
+
+ //
+ void readEvents() SAL_THROW( (css::uno::Exception) );
+ //
+ void readDialogModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readButtonModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readEditModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readCheckBoxModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readRadioButtonModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readComboBoxModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readCurrencyFieldModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readDateFieldModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readFileControlModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readTreeControlModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readFixedTextModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readGroupBoxModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readImageControlModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readListBoxModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readNumericFieldModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readPatternFieldModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readFormattedFieldModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readTimeFieldModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readFixedLineModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readProgressBarModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readScrollBarModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readFixedHyperLinkModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+};
+
+template<typename T>
+inline void ElementDescriptor::read(
+ ::rtl::OUString const & propName, ::rtl::OUString const & attrName,
+ bool forceAttribute )
+{
+ if (forceAttribute ||
+ css::beans::PropertyState_DEFAULT_VALUE !=
+ _xPropState->getPropertyState( propName ))
+ {
+ css::uno::Any a( _xProps->getPropertyValue( propName ) );
+ T v = T();
+ if (a >>= v)
+ addAttribute( attrName, ::rtl::OUString::valueOf(v) );
+ else
+ OSL_ENSURE( 0, "### unexpected property type!" );
+ }
+}
+
+template<typename T>
+inline bool ElementDescriptor::readProp(
+ T * ret, ::rtl::OUString const & rPropName )
+{
+ _xProps->getPropertyValue( rPropName ) >>= *ret;
+ return css::beans::PropertyState_DEFAULT_VALUE !=
+ _xPropState->getPropertyState( rPropName );
+}
+
+}
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
new file mode 100644
index 000000000000..29966392e7a5
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -0,0 +1,1020 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "common.hxx"
+#include "misc.hxx"
+#include <xmlscript/xmldlg_imexp.hxx>
+#include <xmlscript/xmllib_imexp.hxx>
+#include <xmlscript/xmlmod_imexp.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontEmphasisMark.hpp>
+#include <com/sun/star/awt/FontRelief.hpp>
+#include <com/sun/star/xml/input/XRoot.hpp>
+#include <vector>
+
+
+namespace css = ::com::sun::star;
+
+namespace xmlscript
+{
+
+//
+inline sal_Int32 toInt32( ::rtl::OUString const & rStr ) SAL_THROW( () )
+{
+ sal_Int32 nVal;
+ if (rStr.getLength() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x')
+ nVal = rStr.copy( 2 ).toInt32( 16 );
+ else
+ nVal = rStr.toInt32();
+ return nVal;
+}
+
+inline bool getBoolAttr(
+ sal_Bool * pRet, ::rtl::OUString const & rAttrName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ sal_Int32 nUid )
+{
+ ::rtl::OUString aValue( xAttributes->getValueByUidName( nUid, rAttrName ) );
+ if (aValue.getLength())
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
+ {
+ *pRet = sal_True;
+ return true;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("false") ))
+ {
+ *pRet = sal_False;
+ return true;
+ }
+ else
+ {
+ throw css::xml::sax::SAXException(
+ rAttrName + OUSTR(": no boolean value (true|false)!"),
+ css::uno::Reference<css::uno::XInterface>(), css::uno::Any() );
+ }
+ }
+ return false;
+}
+
+inline bool getStringAttr(
+ ::rtl::OUString * pRet, ::rtl::OUString const & rAttrName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ sal_Int32 nUid )
+{
+ *pRet = xAttributes->getValueByUidName( nUid, rAttrName );
+ return (pRet->getLength() > 0);
+}
+
+inline bool getLongAttr(
+ sal_Int32 * pRet, ::rtl::OUString const & rAttrName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ sal_Int32 nUid )
+{
+ ::rtl::OUString aValue( xAttributes->getValueByUidName( nUid, rAttrName ) );
+ if (aValue.getLength())
+ {
+ *pRet = toInt32( aValue );
+ return true;
+ }
+ return false;
+}
+
+class ImportContext;
+
+//==============================================================================
+struct DialogImport
+ : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
+{
+ friend class ImportContext;
+
+ css::uno::Reference< css::uno::XComponentContext > _xContext;
+ css::uno::Reference< css::util::XNumberFormatsSupplier > _xSupplier;
+
+ ::std::vector< ::rtl::OUString > _styleNames;
+ ::std::vector< css::uno::Reference< css::xml::input::XElement > > _styles;
+
+ css::uno::Reference< css::container::XNameContainer > _xDialogModel;
+ css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
+
+ sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
+
+public:
+ inline bool isEventElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName )
+ {
+ return ((XMLNS_SCRIPT_UID == nUid &&
+ (rLocalName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("event") ) ||
+ rLocalName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("listener-event") ))) ||
+ (XMLNS_DIALOGS_UID == nUid &&
+ rLocalName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("event") )));
+ }
+
+ void addStyle(
+ ::rtl::OUString const & rStyleId,
+ css::uno::Reference< css::xml::input::XElement > const & xStyle )
+ SAL_THROW( () );
+ css::uno::Reference< css::xml::input::XElement > getStyle(
+ ::rtl::OUString const & rStyleId ) const
+ SAL_THROW( () );
+
+ inline css::uno::Reference< css::uno::XComponentContext >
+ const & getComponentContext() SAL_THROW( () ) { return _xContext; }
+ css::uno::Reference< css::util::XNumberFormatsSupplier >
+ const & getNumberFormatsSupplier();
+
+ inline DialogImport(
+ css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ css::uno::Reference<css::container::XNameContainer>
+ const & xDialogModel )
+ SAL_THROW( () )
+ : _xContext( xContext )
+ , _xDialogModel( xDialogModel )
+ , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
+ { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
+ _xContext.is() ); }
+ virtual ~DialogImport()
+ SAL_THROW( () );
+
+ // XRoot
+ virtual void SAL_CALL startDocument(
+ css::uno::Reference< css::xml::input::XNamespaceMapping >
+ const & xNamespaceMapping )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endDocument()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction(
+ ::rtl::OUString const & rTarget, ::rtl::OUString const & rData )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator(
+ css::uno::Reference< css::xml::sax::XLocator > const & xLocator )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startRootElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+};
+
+//==============================================================================
+class ElementBase
+ : public ::cppu::WeakImplHelper1< css::xml::input::XElement >
+{
+protected:
+ DialogImport * _pImport;
+ ElementBase * _pParent;
+
+ sal_Int32 _nUid;
+ ::rtl::OUString _aLocalName;
+ css::uno::Reference< css::xml::input::XAttributes > _xAttributes;
+
+public:
+ ElementBase(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () );
+ virtual ~ElementBase()
+ SAL_THROW( () );
+
+ // XElement
+ virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent()
+ throw (css::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getLocalName()
+ throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getUid()
+ throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::xml::input::XAttributes >
+ SAL_CALL getAttributes() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace(
+ ::rtl::OUString const & rWhitespaces )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL characters( ::rtl::OUString const & rChars )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction(
+ ::rtl::OUString const & Target, ::rtl::OUString const & Data )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+};
+
+//==============================================================================
+class StylesElement
+ : public ElementBase
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline StylesElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ElementBase( pImport->XMLNS_DIALOGS_UID,
+ rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class StyleElement
+ : public ElementBase
+{
+ sal_Int32 _backgroundColor;
+ sal_Int32 _textColor;
+ sal_Int32 _textLineColor;
+ sal_Int16 _border;
+ sal_Int32 _borderColor;
+ css::awt::FontDescriptor _descr;
+ sal_Int16 _fontRelief;
+ sal_Int16 _fontEmphasisMark;
+ sal_Int32 _fillColor;
+ sal_Int16 _visualEffect;
+
+ // current highest mask: 0x40
+ short _inited, _hasValue;
+
+ void setFontProperties(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps );
+
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ bool importTextColorStyle(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps );
+ bool importTextLineColorStyle(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps );
+ bool importFillColorStyle(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps );
+ bool importBackgroundColorStyle(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps );
+ bool importFontStyle(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps );
+ bool importBorderStyle(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps );
+ bool importVisualEffectStyle(
+ css::uno::Reference< css::beans::XPropertySet > const & xProps );
+
+ inline StyleElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ElementBase( pImport->XMLNS_DIALOGS_UID,
+ rLocalName, xAttributes, pParent, pImport )
+ , _fontRelief( css::awt::FontRelief::NONE )
+ , _fontEmphasisMark( css::awt::FontEmphasisMark::NONE )
+ , _inited( 0 )
+ , _hasValue( 0 )
+ {}
+};
+
+//==============================================================================
+class MenuPopupElement
+ : public ElementBase
+{
+ ::std::vector< ::rtl::OUString > _itemValues;
+ ::std::vector< sal_Int16 > _itemSelected;
+public:
+ css::uno::Sequence< ::rtl::OUString > getItemValues();
+ css::uno::Sequence< sal_Int16 > getSelectedItems();
+
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline MenuPopupElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ElementBase( pImport->XMLNS_DIALOGS_UID,
+ rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class ControlElement
+ : public ElementBase
+{
+ friend class EventElement;
+
+protected:
+ sal_Int32 _nBasePosX, _nBasePosY;
+
+ ::std::vector< css::uno::Reference< css::xml::input::XElement > > _events;
+
+ ::rtl::OUString getControlId(
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ css::uno::Reference< css::xml::input::XElement > getStyle(
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+public:
+ ::std::vector<css::uno::Reference< css::xml::input::XElement> > *getEvents()
+ SAL_THROW( () ) { return &_events; }
+
+ ControlElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () );
+};
+
+//==============================================================================
+class ImportContext
+{
+protected:
+ DialogImport * _pImport;
+ css::uno::Reference< css::beans::XPropertySet > _xControlModel;
+ ::rtl::OUString _aId;
+
+public:
+ inline ImportContext(
+ DialogImport * pImport,
+ css::uno::Reference< css::beans::XPropertySet > const & xControlModel_,
+ ::rtl::OUString const & id )
+ : _pImport( pImport ),
+ _xControlModel( xControlModel_ ),
+ _aId( id )
+ { OSL_ASSERT( _xControlModel.is() ); }
+
+ inline css::uno::Reference< css::beans::XPropertySet > getControlModel()
+ { return _xControlModel; }
+
+ void importDefaults(
+ sal_Int32 nBaseX, sal_Int32 nBaseY,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ bool supportPrintable = true );
+ void importEvents(
+ ::std::vector< css::uno::Reference< css::xml::input::XElement > >
+ const & rEvents );
+
+ bool importStringProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importDoubleProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importBooleanProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importShortProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importLongProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importLongProperty(
+ sal_Int32 nOffset,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importHexLongProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importAlignProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importVerticalAlignProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importImageAlignProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importImagePositionProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importDateFormatProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importTimeFormatProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importOrientationProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importButtonTypeProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importLineEndFormatProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importSelectionTypeProperty(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+};
+
+//==============================================================================
+class ControlImportContext : public ImportContext
+{
+public:
+ inline ControlImportContext(
+ DialogImport * pImport,
+ ::rtl::OUString const & rId, ::rtl::OUString const & rControlName )
+ : ImportContext(
+ pImport,
+ css::uno::Reference< css::beans::XPropertySet >(
+ pImport->_xDialogModelFactory->createInstance( rControlName ),
+ css::uno::UNO_QUERY_THROW ), rId )
+ {}
+ inline ~ControlImportContext()
+ {
+ _pImport->_xDialogModel->insertByName(
+ _aId, css::uno::makeAny(
+ css::uno::Reference<css::awt::XControlModel>::query(
+ _xControlModel ) ) );
+ }
+};
+
+//==============================================================================
+class WindowElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline WindowElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class EventElement
+ : public ElementBase
+{
+public:
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline EventElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ElementBase( nUid, rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class BulletinBoardElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ BulletinBoardElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () );
+};
+
+//==============================================================================
+class ButtonElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline ButtonElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class CheckBoxElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline CheckBoxElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class ComboBoxElement
+ : public ControlElement
+{
+ css::uno::Reference< css::xml::input::XElement > _popup;
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline ComboBoxElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class MenuListElement
+ : public ControlElement
+{
+ css::uno::Reference< css::xml::input::XElement > _popup;
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline MenuListElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class RadioElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline RadioElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class RadioGroupElement
+ : public ControlElement
+{
+ ::std::vector< css::uno::Reference< css::xml::input::XElement > > _radios;
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline RadioGroupElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class TitledBoxElement
+ : public BulletinBoardElement
+{
+ ::rtl::OUString _label;
+ ::std::vector< css::uno::Reference< css::xml::input::XElement > > _radios;
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline TitledBoxElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : BulletinBoardElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class TextElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline TextElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+//==============================================================================
+class FixedHyperLinkElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline FixedHyperLinkElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+//==============================================================================
+class TextFieldElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline TextFieldElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class ImageControlElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline ImageControlElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class FileControlElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline FileControlElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class TreeControlElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline TreeControlElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class CurrencyFieldElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline CurrencyFieldElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class DateFieldElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline DateFieldElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class NumericFieldElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline NumericFieldElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class TimeFieldElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline TimeFieldElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class PatternFieldElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline PatternFieldElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class FormattedFieldElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline FormattedFieldElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class FixedLineElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline FixedLineElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class ScrollBarElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline ScrollBarElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class ProgressBarElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline ProgressBarElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+}
diff --git a/xmlscript/source/xmldlg_imexp/makefile.mk b/xmlscript/source/xmldlg_imexp/makefile.mk
new file mode 100644
index 000000000000..e0583aa78d9b
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/makefile.mk
@@ -0,0 +1,52 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=xmlscript
+TARGET=xmldlg_imexp
+NO_BSYMBOLIC=TRUE
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.IF "$(L10N_framework)"==""
+#-----------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/xmldlg_import.obj \
+ $(SLO)$/xmldlg_impmodels.obj \
+ $(SLO)$/xmldlg_export.obj \
+ $(SLO)$/xmldlg_expmodels.obj \
+ $(SLO)$/xmldlg_addfunc.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+.ENDIF # L10N_framework
+
+.INCLUDE : target.mk
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
new file mode 100644
index 000000000000..22c472ac1782
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlscript.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <xmlscript/xml_helper.hxx>
+#include <xmlscript/xmldlg_imexp.hxx>
+
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace xmlscript
+{
+
+//==================================================================================================
+class InputStreamProvider
+ : public ::cppu::WeakImplHelper1< io::XInputStreamProvider >
+{
+ ByteSequence _bytes;
+
+public:
+ inline InputStreamProvider( ByteSequence const & rBytes )
+ : _bytes( rBytes )
+ {}
+
+ // XInputStreamProvider
+ virtual Reference< io::XInputStream > SAL_CALL createInputStream()
+ throw (RuntimeException);
+};
+//__________________________________________________________________________________________________
+Reference< io::XInputStream > InputStreamProvider::createInputStream()
+ throw (RuntimeException)
+{
+ return ::xmlscript::createInputStream( _bytes );
+}
+
+//==================================================================================================
+Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
+ Reference< container::XNameContainer > const & xDialogModel,
+ Reference< XComponentContext > const & xContext )
+ SAL_THROW( (Exception) )
+{
+ Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
+ if (! xSMgr.is())
+ {
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("no service manager available!") ),
+ Reference< XInterface >() );
+ }
+
+ Reference< xml::sax::XExtendedDocumentHandler > xHandler( xSMgr->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ), xContext ), UNO_QUERY );
+ OSL_ASSERT( xHandler.is() );
+ if (! xHandler.is())
+ {
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("could not create sax-writer component!") ),
+ Reference< XInterface >() );
+ }
+
+ ByteSequence aBytes;
+
+ Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY );
+ xSource->setOutputStream( createOutputStream( &aBytes ) );
+ exportDialogModel( xHandler, xDialogModel );
+
+ return new InputStreamProvider( aBytes );
+}
+
+//==================================================================================================
+void SAL_CALL importDialogModel(
+ Reference< io::XInputStream > xInput,
+ Reference< container::XNameContainer > const & xDialogModel,
+ Reference< XComponentContext > const & xContext )
+ SAL_THROW( (Exception) )
+{
+ Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
+ if (! xSMgr.is())
+ {
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("no service manager available!") ),
+ Reference< XInterface >() );
+ }
+
+ Reference< xml::sax::XParser > xParser( xSMgr->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ), xContext ), UNO_QUERY );
+ OSL_ASSERT( xParser.is() );
+ if (! xParser.is())
+ {
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("could not create sax-parser component!") ),
+ Reference< XInterface >() );
+ }
+
+ // error handler, entity resolver omitted for this helper function
+ xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
+
+ xml::sax::InputSource source;
+ source.aInputStream = xInput;
+ source.sSystemId = OUString( RTL_CONSTASCII_USTRINGPARAM("virtual file") );
+
+ xParser->parseStream( source );
+}
+
+}
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
new file mode 100644
index 000000000000..1d9e67d23d28
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -0,0 +1,1169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlscript.hxx"
+#include "exp_share.hxx"
+
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace xmlscript
+{
+
+static inline bool readBorderProps(
+ ElementDescriptor * element, Style & style )
+{
+ if (element->readProp( &style._border, OUSTR("Border") )) {
+ if (style._border == BORDER_SIMPLE /* simple */)
+ {
+ if (element->readProp( &style._borderColor, OUSTR("BorderColor") ))
+ style._border = BORDER_SIMPLE_COLOR;
+ }
+ return true;
+ }
+ return false;
+}
+
+static inline bool readFontProps( ElementDescriptor * element, Style & style )
+{
+ bool ret = element->readProp(
+ &style._descr, OUSTR("FontDescriptor") );
+ ret |= element->readProp(
+ &style._fontEmphasisMark, OUSTR("FontEmphasisMark") );
+ ret |= element->readProp(
+ &style._fontRelief, OUSTR("FontRelief") );
+ return ret;
+}
+
+//__________________________________________________________________________________________________
+void ElementDescriptor::readButtonModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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("DefaultButton") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":default") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
+ readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
+ readImageAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-align") ) );
+ if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
+ readLongAttr( OUSTR("RepeatDelay"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
+ if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Toggle") ) ))
+ addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":toggled"), OUSTR("1") );
+ readBoolAttr( OUSTR("FocusOnClick"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":grab-focus") );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
+
+
+ // State
+ sal_Int16 nState = 0;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
+ {
+ switch (nState)
+ {
+ case 0:
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+ break;
+ case 1:
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected radio state!" );
+ break;
+ }
+ }
+
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (readProp( OUSTR("VisualEffect") ) >>= aStyle._visualEffect)
+ aStyle._set |= 0x40;
+ if (aStyle._set)
+ {
+ addAttribute( 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("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
+
+ sal_Bool bTriState = sal_False;
+ if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ) ) >>= bTriState) && bTriState)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tristate") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
+ }
+ sal_Int16 nState = 0;
+ if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
+ {
+ switch (nState)
+ {
+ case 0:
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+ break;
+ case 1:
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
+ break;
+ case 2: // tristate=true exported, checked omitted => dont know!
+ OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected checkbox state!" );
+ break;
+ }
+ }
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":autocomplete") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
+ readBoolAttr( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
+
+ // string item list
+ Sequence< OUString > itemValues;
+ if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
+ itemValues.getLength() > 0)
+ {
+ ElementDescriptor * popup = new ElementDescriptor(
+ _xProps, _xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
+
+ OUString const * pItemValues = itemValues.getConstArray();
+ for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
+ {
+ ElementDescriptor * item = new ElementDescriptor(
+ _xProps, _xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
+ item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
+ pItemValues[ nPos ] );
+ popup->addSubElement( item );
+ }
+
+ addSubElement( popup );
+ }
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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("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") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+
+ // string item list
+ Sequence< OUString > itemValues;
+ if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
+ itemValues.getLength() > 0)
+ {
+ ElementDescriptor * popup = new ElementDescriptor(
+ _xProps, _xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
+
+ OUString const * pItemValues = itemValues.getConstArray();
+ sal_Int32 nPos;
+ for ( nPos = 0; nPos < itemValues.getLength(); ++nPos )
+ {
+ ElementDescriptor * item = new ElementDescriptor(
+ _xProps, _xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
+ item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
+ pItemValues[ nPos ] );
+ popup->addSubElement( item );
+ }
+
+ Sequence< sal_Int16 > selected;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ) ) >>= selected)
+ {
+ sal_Int16 const * pSelected = selected.getConstArray();
+ for ( nPos = selected.getLength(); nPos--; )
+ {
+ ElementDescriptor * item = static_cast< ElementDescriptor * >(
+ popup->getSubElement( pSelected[ nPos ] ).get() );
+ item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":selected") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
+ }
+ }
+
+ addSubElement( popup );
+ }
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (readProp( OUSTR("VisualEffect") ) >>= aStyle._visualEffect)
+ aStyle._set |= 0x40;
+ if (aStyle._set)
+ {
+ addAttribute( 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("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
+
+ sal_Int16 nState = 0;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
+ {
+ switch (nState)
+ {
+ case 0:
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+ break;
+ case 1:
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected radio state!" );
+ break;
+ }
+ }
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x2 | 0x8 | 0x20 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
+ aStyle._set |= 0x2;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+
+ OUString aTitle;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
+ {
+ ElementDescriptor * title = new ElementDescriptor(
+ _xProps, _xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+ title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
+ aTitle );
+ addSubElement( title );
+ }
+
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readFixedTextModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":nolabel") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":url") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":description") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":nolabel") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readEditModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":hard-linebreaks") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":hscroll") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":vscroll") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readLineEndFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":lineend-format") ) );
+ sal_Int16 nEcho = 0;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ) ) >>= nEcho)
+ {
+ sal_Unicode cEcho = (sal_Unicode)nEcho;
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":echochar") ),
+ OUString( &cEcho, 1 ) );
+ }
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x4 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readFileControlModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (aStyle._set)
+ {
+ addAttribute( 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") ) );
+ readSelectionTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":selectiontype") ) );
+
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rootdisplayed") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":showshandles") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":showsroothandles") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":editable") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rowheight") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ 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") ) );
+ if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
+ readLongAttr( OUSTR("RepeatDelay"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
+ readBoolAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":prepend-symbol") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ 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") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":show-century") ) );
+ 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") ) );
+ if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
+ readLongAttr( OUSTR("RepeatDelay"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":dropdown") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ 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") ) );
+ if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
+ readLongAttr( OUSTR("RepeatDelay"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ 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") ) );
+ if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
+ readLongAttr( OUSTR("RepeatDelay"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ 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") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
+ 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();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( 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( OUSTR("HideInactiveSelection"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
+ 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 ":text") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
+ if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
+ readLongAttr( OUSTR("RepeatDelay"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
+
+ Any a( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ) ) );
+ switch (a.getValueTypeClass())
+ {
+ case TypeClass_DOUBLE:
+ addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
+ OUString::valueOf( *(double const *)a.getValue() ) );
+ break;
+ case TypeClass_STRING:
+ addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
+ *(OUString const *)a.getValue() );
+ break;
+ default:
+ break;
+ }
+ readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
+ readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
+ readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+
+ // format spec
+ sal_Int32 nKey = 0;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ) ) >>= nKey)
+ {
+ Reference< util::XNumberFormatsSupplier > xSupplier;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ) ) >>= xSupplier)
+ {
+ addNumberFormatAttr(
+ xSupplier->getNumberFormats()->getByKey( nKey ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
+ }
+ }
+ readBoolAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treat-as-number") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
+
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x2 | 0x8 | 0x20 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
+ aStyle._set |= 0x2;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x4 | 0x10 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ) ) >>= aStyle._descr)
+ aStyle._set |= 0x10;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x4 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":pageincrement") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curpos") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxpos") ) );
+ readLongAttr( OUSTR("ScrollValueMin"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":minpos") );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible-size") ) );
+ readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat") );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
+ readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readDialogModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect elements
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_DIALOGS_PREFIX) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_URI) ) );
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_SCRIPT_PREFIX) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_URI) ) );
+
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
+ 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("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults( false, false );
+ readBoolAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":closeable") ) );
+ readBoolAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":moveable") ) );
+ readBoolAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":resizeable") ) );
+ readStringAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+
+ Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) );
+ bool bDecoration = sal_False;
+ if ( (aDecorationAny >>= bDecoration) && !bDecoration )
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+
+ readEvents();
+}
+
+}
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
new file mode 100644
index 000000000000..365355375808
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -0,0 +1,1610 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlscript.hxx"
+#include "exp_share.hxx"
+
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <com/sun/star/awt/CharSet.hpp>
+#include <com/sun/star/awt/FontFamily.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontType.hpp>
+#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/ImagePosition.hpp>
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/PushButtonType.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+
+#include <com/sun/star/script/XScriptEventsSupplier.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+
+#include <com/sun/star/style/VerticalAlignment.hpp>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+
+#include <com/sun/star/view/SelectionType.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace xmlscript
+{
+
+//__________________________________________________________________________________________________
+Reference< xml::sax::XAttributeList > Style::createElement()
+{
+ ElementDescriptor * pStyle = new ElementDescriptor(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style") ) );
+
+ // style-id
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), _id );
+
+ // background-color
+ if (_set & 0x1)
+ {
+ OUStringBuffer buf( 16 );
+ buf.append( (sal_Unicode)'0' );
+ buf.append( (sal_Unicode)'x' );
+ buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_backgroundColor, 16 ) );
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":background-color") ),
+ buf.makeStringAndClear() );
+ }
+
+ // text-color
+ if (_set & 0x2)
+ {
+ OUStringBuffer buf( 16 );
+ buf.append( (sal_Unicode)'0' );
+ buf.append( (sal_Unicode)'x' );
+ buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textColor, 16 ) );
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text-color") ),
+ buf.makeStringAndClear() );
+ }
+
+ // textline-color
+ if (_set & 0x20)
+ {
+ OUStringBuffer buf( 16 );
+ buf.append( (sal_Unicode)'0' );
+ buf.append( (sal_Unicode)'x' );
+ buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textLineColor, 16 ) );
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textline-color") ),
+ buf.makeStringAndClear() );
+ }
+
+ // fill-color
+ if (_set & 0x10)
+ {
+ OUStringBuffer buf( 16 );
+ buf.append( (sal_Unicode)'0' );
+ buf.append( (sal_Unicode)'x' );
+ buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_fillColor, 16 ) );
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fill-color") ),
+ buf.makeStringAndClear() );
+ }
+
+ // border
+ if (_set & 0x4)
+ {
+ switch (_border)
+ {
+ case BORDER_NONE:
+ pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
+ OUSTR("none") );
+ break;
+ case BORDER_3D:
+ pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
+ OUSTR("3d") );
+ break;
+ case BORDER_SIMPLE:
+ pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
+ OUSTR("simple") );
+ break;
+ case BORDER_SIMPLE_COLOR: {
+ OUStringBuffer buf;
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+ buf.append( OUString::valueOf(
+ (sal_Int64)(sal_uInt64)_borderColor, 16 ) );
+ pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
+ buf.makeStringAndClear() );
+ break;
+ }
+ default:
+ OSL_ENSURE( 0, "### unexpected border value!" );
+ break;
+ }
+ }
+
+ // visual effect (look)
+ if (_set & 0x40)
+ {
+ switch (_visualEffect)
+ {
+ case awt::VisualEffect::NONE:
+ pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
+ OUSTR("none") );
+ break;
+ case awt::VisualEffect::LOOK3D:
+ pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
+ OUSTR("3d") );
+ break;
+ case awt::VisualEffect::FLAT:
+ pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
+ OUSTR("simple") );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected visual effect value!" );
+ break;
+ }
+ }
+
+ // font-
+ if (_set & 0x8)
+ {
+ awt::FontDescriptor def_descr;
+
+ // dialog:font-name CDATA #IMPLIED
+ if (def_descr.Name != _descr.Name)
+ {
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-name") ),
+ _descr.Name );
+ }
+ // dialog:font-height %numeric; #IMPLIED
+ if (def_descr.Height != _descr.Height)
+ {
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-height") ),
+ OUString::valueOf( (sal_Int32)_descr.Height ) );
+ }
+ // dialog:font-width %numeric; #IMPLIED
+ if (def_descr.Width != _descr.Width)
+ {
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-width") ),
+ OUString::valueOf( (sal_Int32)_descr.Width ) );
+ }
+ // dialog:font-stylename CDATA #IMPLIED
+ if (def_descr.StyleName != _descr.StyleName)
+ {
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-stylename") ),
+ _descr.StyleName );
+ }
+ // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED
+ if (def_descr.Family != _descr.Family)
+ {
+ switch (_descr.Family)
+ {
+ case awt::FontFamily::DECORATIVE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("decorative") ) );
+ break;
+ case awt::FontFamily::MODERN:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("modern") ) );
+ break;
+ case awt::FontFamily::ROMAN:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("roman") ) );
+ break;
+ case awt::FontFamily::SCRIPT:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("script") ) );
+ break;
+ case awt::FontFamily::SWISS:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("swiss") ) );
+ break;
+ case awt::FontFamily::SYSTEM:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-family!" );
+ break;
+ }
+ }
+ // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED
+ if (def_descr.CharSet != _descr.CharSet)
+ {
+ switch (_descr.CharSet)
+ {
+ case awt::CharSet::ANSI:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ansi") ) );
+ break;
+ case awt::CharSet::MAC:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("mac") ) );
+ break;
+ case awt::CharSet::IBMPC_437:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_437") ) );
+ break;
+ case awt::CharSet::IBMPC_850:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_850") ) );
+ break;
+ case awt::CharSet::IBMPC_860:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_860") ) );
+ break;
+ case awt::CharSet::IBMPC_861:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_861") ) );
+ break;
+ case awt::CharSet::IBMPC_863:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_863") ) );
+ break;
+ case awt::CharSet::IBMPC_865:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_865") ) );
+ break;
+ case awt::CharSet::SYSTEM:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) );
+ break;
+ case awt::CharSet::SYMBOL:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("symbol") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-charset!" );
+ break;
+ }
+ }
+ // dialog:font-pitch "(fixed|variable)" #IMPLIED
+ if (def_descr.Pitch != _descr.Pitch)
+ {
+ switch (_descr.Pitch)
+ {
+ case awt::FontPitch::FIXED:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-pitch") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("fixed") ) );
+ break;
+ case awt::FontPitch::VARIABLE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-pitch") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("variable") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-pitch!" );
+ break;
+ }
+ }
+ // dialog:font-charwidth CDATA #IMPLIED
+ if (def_descr.CharacterWidth != _descr.CharacterWidth)
+ {
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charwidth") ),
+ OUString::valueOf( (float)_descr.CharacterWidth ) );
+ }
+ // dialog:font-weight CDATA #IMPLIED
+ if (def_descr.Weight != _descr.Weight)
+ {
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-weight") ),
+ OUString::valueOf( (float)_descr.Weight ) );
+ }
+ // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED
+ if (def_descr.Slant != _descr.Slant)
+ {
+ switch (_descr.Slant)
+ {
+ case awt::FontSlant_OBLIQUE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("oblique") ) );
+ break;
+ case awt::FontSlant_ITALIC:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("italic") ) );
+ break;
+ case awt::FontSlant_REVERSE_OBLIQUE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_oblique") ) );
+ break;
+ case awt::FontSlant_REVERSE_ITALIC:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_italic") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-slant!" );
+ break;
+ }
+ }
+ // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED
+ if (def_descr.Underline != _descr.Underline)
+ {
+ switch (_descr.Underline)
+ {
+ case awt::FontUnderline::SINGLE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
+ break;
+ case awt::FontUnderline::DOUBLE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("double") ) );
+ break;
+ case awt::FontUnderline::DOTTED:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("dotted") ) );
+ break;
+ case awt::FontUnderline::DASH:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("dash") ) );
+ break;
+ case awt::FontUnderline::LONGDASH:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("longdash") ) );
+ break;
+ case awt::FontUnderline::DASHDOT:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("dashdot") ) );
+ break;
+ case awt::FontUnderline::DASHDOTDOT:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("dashdotdot") ) );
+ break;
+ case awt::FontUnderline::SMALLWAVE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("smallwave") ) );
+ break;
+ case awt::FontUnderline::WAVE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("wave") ) );
+ break;
+ case awt::FontUnderline::DOUBLEWAVE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("doublewave") ) );
+ break;
+ case awt::FontUnderline::BOLD:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bold") ) );
+ break;
+ case awt::FontUnderline::BOLDDOTTED:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bolddotted") ) );
+ break;
+ case awt::FontUnderline::BOLDDASH:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bolddash") ) );
+ break;
+ case awt::FontUnderline::BOLDLONGDASH:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("boldlongdash") ) );
+ break;
+ case awt::FontUnderline::BOLDDASHDOT:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bolddashdot") ) );
+ break;
+ case awt::FontUnderline::BOLDDASHDOTDOT:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bolddashdotdot") ) );
+ break;
+ case awt::FontUnderline::BOLDWAVE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("boldwave") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-underline!" );
+ break;
+ }
+ }
+ // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED
+ if (def_descr.Strikeout != _descr.Strikeout)
+ {
+ switch (_descr.Strikeout)
+ {
+ case awt::FontStrikeout::SINGLE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
+ break;
+ case awt::FontStrikeout::DOUBLE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("double") ) );
+ break;
+ case awt::FontStrikeout::BOLD:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bold") ) );
+ break;
+ case awt::FontStrikeout::SLASH:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("slash") ) );
+ break;
+ case awt::FontStrikeout::X:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-strikeout!" );
+ break;
+ }
+ }
+ // dialog:font-orientation CDATA #IMPLIED
+ if (def_descr.Orientation != _descr.Orientation)
+ {
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-orientation") ),
+ OUString::valueOf( (float)_descr.Orientation ) );
+ }
+ // dialog:font-kerning %boolean; #IMPLIED
+ if ((def_descr.Kerning != sal_False) != (_descr.Kerning != sal_False))
+ {
+ pStyle->addBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-kerning") ),
+ _descr.Kerning );
+ }
+ // dialog:font-wordlinemode %boolean; #IMPLIED
+ if ((def_descr.WordLineMode != sal_False) != (_descr.WordLineMode != sal_False))
+ {
+ pStyle->addBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-wordlinemode") ),
+ _descr.WordLineMode );
+ }
+ // dialog:font-type "(raster|device|scalable)" #IMPLIED
+ if (def_descr.Type != _descr.Type)
+ {
+ switch (_descr.Type)
+ {
+ case awt::FontType::RASTER:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("raster") ) );
+ break;
+ case awt::FontType::DEVICE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("device") ) );
+ break;
+ case awt::FontType::SCALABLE:
+ pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("scalable") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-type!" );
+ break;
+ }
+ }
+
+ // additional attributes not in FontDescriptor struct
+ // dialog:font-relief (none|embossed|engraved) #IMPLIED
+ switch (_fontRelief)
+ {
+ case awt::FontRelief::NONE: // dont export default
+ break;
+ case awt::FontRelief::EMBOSSED:
+ pStyle->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-relief") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("embossed") ) );
+ break;
+ case awt::FontRelief::ENGRAVED:
+ pStyle->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-relief") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("engraved") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-relief!" );
+ break;
+ }
+ // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED
+ switch (_fontEmphasisMark)
+ {
+ case awt::FontEmphasisMark::NONE: // dont export default
+ break;
+ case awt::FontEmphasisMark::DOT:
+ pStyle->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("dot") ) );
+ break;
+ case awt::FontEmphasisMark::CIRCLE:
+ pStyle->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("circle") ) );
+ break;
+ case awt::FontEmphasisMark::DISC:
+ pStyle->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("disc") ) );
+ break;
+ case awt::FontEmphasisMark::ACCENT:
+ pStyle->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("accent") ) );
+ break;
+ case awt::FontEmphasisMark::ABOVE:
+ pStyle->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("above") ) );
+ break;
+ case awt::FontEmphasisMark::BELOW:
+ pStyle->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("below") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected font-emphasismark!" );
+ break;
+ }
+ }
+
+ return pStyle;
+}
+
+//##################################################################################################
+
+//__________________________________________________________________________________________________
+void ElementDescriptor::addNumberFormatAttr(
+ Reference< beans::XPropertySet > const & xFormatProperties,
+ OUString const & /*rAttrName*/ )
+{
+ Reference< beans::XPropertyState > xState( xFormatProperties, UNO_QUERY );
+ OUString sFormat;
+ lang::Locale locale;
+ OSL_VERIFY( xFormatProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatString") ) ) >>= sFormat );
+ OSL_VERIFY( xFormatProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Locale") ) ) >>= locale );
+
+ addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":format-code") ),
+ sFormat );
+
+ // format-locale
+ OUStringBuffer buf( 48 );
+ buf.append( locale.Language );
+ if (locale.Country.getLength())
+ {
+ buf.append( (sal_Unicode)';' );
+ buf.append( locale.Country );
+ if (locale.Variant.getLength())
+ {
+ buf.append( (sal_Unicode)';' );
+ buf.append( locale.Variant );
+ }
+ }
+ addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":format-locale") ),
+ buf.makeStringAndClear() );
+}
+//__________________________________________________________________________________________________
+Any ElementDescriptor::readProp( OUString const & rPropName )
+{
+ if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
+ {
+ return _xProps->getPropertyValue( rPropName );
+ }
+ return Any();
+}
+
+//______________________________________________________________________________
+void ElementDescriptor::readStringAttr(
+ OUString const & rPropName, OUString const & rAttrName )
+{
+ if (beans::PropertyState_DEFAULT_VALUE !=
+ _xPropState->getPropertyState( rPropName ))
+ {
+ Any a( _xProps->getPropertyValue( rPropName ) );
+ OUString v;
+ if (a >>= v)
+ addAttribute( rAttrName, v );
+ else
+ OSL_ENSURE( 0, "### unexpected property type!" );
+ }
+}
+
+//__________________________________________________________________________________________________
+void ElementDescriptor::readHexLongAttr( OUString const & rPropName, OUString const & rAttrName )
+{
+ if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
+ {
+ Any a( _xProps->getPropertyValue( rPropName ) );
+ if (a.getValueTypeClass() == TypeClass_LONG)
+ {
+ OUStringBuffer buf( 16 );
+ buf.append( (sal_Unicode)'0' );
+ buf.append( (sal_Unicode)'x' );
+ buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue(), 16 ) );
+ addAttribute( rAttrName, buf.makeStringAndClear() );
+ }
+ }
+}
+
+//__________________________________________________________________________________________________
+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:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short") ) );
+ break;
+ case 1:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short_YY") ) );
+ break;
+ case 2:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short_YYYY") ) );
+ break;
+ case 3:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_long") ) );
+ break;
+ case 4:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_DDMMYY") ) );
+ break;
+ case 5:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_MMDDYY") ) );
+ break;
+ case 6:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYMMDD") ) );
+ break;
+ case 7:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_DDMMYYYY") ) );
+ break;
+ case 8:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_MMDDYYYY") ) );
+ break;
+ case 9:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD") ) );
+ break;
+ case 10:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYMMDD_DIN5008") ) );
+ break;
+ case 11:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD_DIN5008") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected date format!" );
+ 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:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("24h_short") ) );
+ break;
+ case 1:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("24h_long") ) );
+ break;
+ case 2:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("12h_short") ) );
+ break;
+ case 3:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("12h_long") ) );
+ break;
+ case 4:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_short") ) );
+ break;
+ case 5:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_long") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### unexpected time format!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readAlignAttr( 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:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) );
+ break;
+ case 1:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
+ break;
+ case 2:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### illegal alignment value!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readVerticalAlignAttr( OUString const & rPropName, OUString const & rAttrName )
+{
+ if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
+ {
+ Any a( _xProps->getPropertyValue( rPropName ) );
+ if (a.getValueTypeClass() == TypeClass_ENUM && a.getValueType() == ::getCppuType( (style::VerticalAlignment*)0 ))
+ {
+ style::VerticalAlignment eAlign;
+ a >>= eAlign;
+ switch (eAlign)
+ {
+ case style::VerticalAlignment_TOP:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
+ break;
+ case style::VerticalAlignment_MIDDLE:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
+ break;
+ case style::VerticalAlignment_BOTTOM:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### illegal vertical alignment value!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readImageAlignAttr( 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:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) );
+ break;
+ case 1:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
+ break;
+ case 2:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) );
+ break;
+ case 3:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### illegal image alignment value!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readImagePositionAttr( 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::ImagePosition::LeftTop:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-top") ) );
+ break;
+ case awt::ImagePosition::LeftCenter:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-center") ) );
+ break;
+ case awt::ImagePosition::LeftBottom:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-bottom") ) );
+ break;
+ case awt::ImagePosition::RightTop:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-top") ) );
+ break;
+ case awt::ImagePosition::RightCenter:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-center") ) );
+ break;
+ case awt::ImagePosition::RightBottom:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-bottom") ) );
+ break;
+ case awt::ImagePosition::AboveLeft:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-left") ) );
+ break;
+ case awt::ImagePosition::AboveCenter:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-center") ) );
+ break;
+ case awt::ImagePosition::AboveRight:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-right") ) );
+ break;
+ case awt::ImagePosition::BelowLeft:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-left") ) );
+ break;
+ case awt::ImagePosition::BelowCenter:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-center") ) );
+ break;
+ case awt::ImagePosition::BelowRight:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-right") ) );
+ break;
+ case awt::ImagePosition::Centered:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### illegal image position value!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+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!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readOrientationAttr( OUString const & rPropName, OUString const & rAttrName )
+{
+ if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
+ {
+ Any a( _xProps->getPropertyValue( rPropName ) );
+ if (a.getValueTypeClass() == TypeClass_LONG)
+ {
+ switch (*(sal_Int32 const *)a.getValue())
+ {
+ case 0:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("horizontal") ) );
+ break;
+ case 1:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("vertical") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### illegal orientation value!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readLineEndFormatAttr( 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::LineEndFormat::CARRIAGE_RETURN:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return") ) );
+ break;
+ case awt::LineEndFormat::LINE_FEED:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("line-feed") ) );
+ break;
+ case awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return-line-feed") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### illegal line end format value!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUString const & rAttrName )
+{
+ if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
+ {
+ Any aSelectionType ( _xProps->getPropertyValue( rPropName ) );
+
+ if (aSelectionType.getValueTypeClass() == TypeClass_ENUM && aSelectionType.getValueType() == ::getCppuType( (::view::SelectionType*)0 ))
+ {
+ ::view::SelectionType eSelectionType;
+ aSelectionType >>= eSelectionType;
+
+ switch (eSelectionType)
+ {
+ case ::view::SelectionType_NONE:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("none") ) );
+ break;
+ case ::view::SelectionType_SINGLE:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
+ break;
+ case ::view::SelectionType_MULTI:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("multi") ) );
+ break;
+ case ::view::SelectionType_RANGE:
+ addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("range") ) );
+ break;
+ default:
+ OSL_ENSURE( 0, "### illegal selection type value!" );
+ break;
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
+{
+ Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) );
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ),
+ * reinterpret_cast< const OUString * >( a.getValue() ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tab-index") ) );
+
+ sal_Bool bEnabled = sal_False;
+ if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ) ) >>= bEnabled)
+ {
+ if (! bEnabled)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":disabled") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
+ }
+ }
+ else
+ {
+ OSL_ENSURE( 0, "unexpected property type for \"Enabled\": not bool!" );
+ }
+
+ sal_Bool bVisible = sal_True;
+ if (supportVisible) try
+ {
+ if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ) ) >>= bVisible)
+ {
+
+ // only write out the non default case
+ if (! bVisible)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ // force writing of pos/size
+ a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ) );
+ if (a.getValueTypeClass() == TypeClass_LONG)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":left") ),
+ OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
+ }
+ a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ) );
+ if (a.getValueTypeClass() == TypeClass_LONG)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":top") ),
+ OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
+ }
+ a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) );
+ if (a.getValueTypeClass() == TypeClass_LONG)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":width") ),
+ OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
+ }
+ a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) );
+ if (a.getValueTypeClass() == TypeClass_LONG)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":height") ),
+ OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
+ }
+
+ if (supportPrintable)
+ {
+ readBoolAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) );
+ }
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tag") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":help-text") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":help-url") ) );
+}
+
+struct StringTriple
+{
+ char const * first;
+ char const * second;
+ char const * third;
+};
+extern StringTriple const * const g_pEventTranslations;
+
+//__________________________________________________________________________________________________
+void ElementDescriptor::readEvents()
+ SAL_THROW( (Exception) )
+{
+ Reference< script::XScriptEventsSupplier > xSupplier( _xProps, UNO_QUERY );
+ if (xSupplier.is())
+ {
+ Reference< container::XNameContainer > xEvents( xSupplier->getEvents() );
+ if (xEvents.is())
+ {
+ Sequence< OUString > aNames( xEvents->getElementNames() );
+ OUString const * pNames = aNames.getConstArray();
+ for ( sal_Int32 nPos = 0; nPos < aNames.getLength(); ++nPos )
+ {
+ script::ScriptEventDescriptor descr;
+ if (xEvents->getByName( pNames[ nPos ] ) >>= descr)
+ {
+ OSL_ENSURE( descr.ListenerType.getLength() > 0 &&
+ descr.EventMethod.getLength() > 0 &&
+ descr.ScriptCode.getLength() > 0 &&
+ descr.ScriptType.getLength() > 0,
+ "### invalid event descr!" );
+
+ OUString aEventName;
+
+ if (! descr.AddListenerParam.getLength())
+ {
+ // detection of event-name
+ ::rtl::OString listenerType(
+ ::rtl::OUStringToOString(
+ descr.ListenerType,
+ RTL_TEXTENCODING_ASCII_US ) );
+ ::rtl::OString eventMethod(
+ ::rtl::OUStringToOString(
+ descr.EventMethod,
+ RTL_TEXTENCODING_ASCII_US ) );
+ StringTriple const * p = g_pEventTranslations;
+ while (p->first)
+ {
+ if (0 == ::rtl_str_compare( p->second, eventMethod.getStr() ) &&
+ 0 == ::rtl_str_compare( p->first, listenerType.getStr() ))
+ {
+ aEventName = OUString( p->third, ::rtl_str_getLength( p->third ), RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ ++p;
+ }
+ }
+
+ ElementDescriptor * pElem;
+ Reference< xml::sax::XAttributeList > xElem;
+
+ if (aEventName.getLength()) // script:event
+ {
+ pElem = new ElementDescriptor(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":event") ) );
+ xElem = pElem;
+
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":event-name") ),
+ aEventName );
+ }
+ else // script:listener-event
+ {
+ pElem = new ElementDescriptor(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-event") ) );
+ xElem = pElem;
+
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-type") ),
+ descr.ListenerType );
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-method") ),
+ descr.EventMethod );
+
+ if (descr.AddListenerParam.getLength())
+ {
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-param") ),
+ descr.AddListenerParam );
+ }
+ }
+ if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) ) )
+ {
+ // separate optional location
+ sal_Int32 nIndex = descr.ScriptCode.indexOf( (sal_Unicode)':' );
+ if (nIndex >= 0)
+ {
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":location") ),
+ descr.ScriptCode.copy( 0, nIndex ) );
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
+ descr.ScriptCode.copy( nIndex +1 ) );
+ }
+ else
+ {
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
+ descr.ScriptCode );
+ }
+ }
+ else
+ {
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
+ descr.ScriptCode );
+ }
+
+ // language
+ pElem->addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":language") ),
+ descr.ScriptType );
+
+ addSubElement( xElem );
+ }
+ else
+ {
+ OSL_ENSURE( 0, "### unexpected event type in container!" );
+ }
+ }
+ }
+ }
+}
+
+//##################################################################################################
+
+inline bool equalFont( Style const & style1, Style const & style2 )
+{
+ awt::FontDescriptor const & f1 = style1._descr;
+ awt::FontDescriptor const & f2 = style2._descr;
+ return (
+ f1.Name == f2.Name &&
+ f1.Height == f2.Height &&
+ f1.Width == f2.Width &&
+ f1.StyleName == f2.StyleName &&
+ f1.Family == f2.Family &&
+ f1.CharSet == f2.CharSet &&
+ f1.Pitch == f2.CharSet &&
+ f1.CharacterWidth == f2.CharacterWidth &&
+ f1.Weight == f2.Weight &&
+ f1.Slant == f2.Slant &&
+ f1.Underline == f2.Underline &&
+ f1.Strikeout == f2.Strikeout &&
+ f1.Orientation == f2.Orientation &&
+ (f1.Kerning != sal_False) == (f2.Kerning != sal_False) &&
+ (f1.WordLineMode != sal_False) == (f2.WordLineMode != sal_False) &&
+ f1.Type == f2.Type &&
+ style1._fontRelief == style2._fontRelief &&
+ style1._fontEmphasisMark == style2._fontEmphasisMark
+ );
+}
+//__________________________________________________________________________________________________
+OUString StyleBag::getStyleId( Style const & rStyle )
+ SAL_THROW( () )
+{
+ if (! rStyle._set) // nothin set
+ {
+ return OUString(); // everything default: no need to export a specific style
+ }
+
+ // lookup existing style
+ for ( size_t nStylesPos = 0; nStylesPos < _styles.size(); ++nStylesPos )
+ {
+ Style * pStyle = _styles[ nStylesPos ];
+
+ 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)
+ {
+ short bset = rStyle._set & pStyle->_set;
+ if ((bset & 0x1) &&
+ rStyle._backgroundColor != pStyle->_backgroundColor)
+ continue;
+ if ((bset & 0x2) &&
+ rStyle._textColor != pStyle->_textColor)
+ continue;
+ if ((bset & 0x20) &&
+ rStyle._textLineColor != pStyle->_textLineColor)
+ continue;
+ if ((bset & 0x10) &&
+ rStyle._fillColor != pStyle->_fillColor)
+ continue;
+ if ((bset & 0x4) &&
+ (rStyle._border != pStyle->_border ||
+ (rStyle._border == BORDER_SIMPLE_COLOR &&
+ rStyle._borderColor != pStyle->_borderColor)))
+ continue;
+ if ((bset & 0x8) &&
+ !equalFont( rStyle, *pStyle ))
+ continue;
+ if ((bset & 0x40) &&
+ rStyle._visualEffect != pStyle->_visualEffect)
+ continue;
+
+ // merge in
+ short bnset = rStyle._set & ~pStyle->_set;
+ if (bnset & 0x1)
+ pStyle->_backgroundColor = rStyle._backgroundColor;
+ if (bnset & 0x2)
+ pStyle->_textColor = rStyle._textColor;
+ if (bnset & 0x20)
+ pStyle->_textLineColor = rStyle._textLineColor;
+ if (bnset & 0x10)
+ pStyle->_fillColor = rStyle._fillColor;
+ if (bnset & 0x4) {
+ pStyle->_border = rStyle._border;
+ pStyle->_borderColor = rStyle._borderColor;
+ }
+ if (bnset & 0x8) {
+ pStyle->_descr = rStyle._descr;
+ pStyle->_fontRelief = rStyle._fontRelief;
+ pStyle->_fontEmphasisMark = rStyle._fontEmphasisMark;
+ }
+ if (bnset & 0x40)
+ pStyle->_visualEffect = rStyle._visualEffect;
+
+ pStyle->_all |= rStyle._all;
+ pStyle->_set |= rStyle._set;
+
+ return pStyle->_id;
+ }
+ }
+
+ // no appr style found, append new
+ Style * pStyle = new Style( rStyle );
+ pStyle->_id = OUString::valueOf( (sal_Int32)_styles.size() );
+ _styles.push_back( pStyle );
+ return pStyle->_id;
+}
+//__________________________________________________________________________________________________
+StyleBag::~StyleBag() SAL_THROW( () )
+{
+ for ( size_t nPos = 0; nPos < _styles.size(); ++nPos )
+ {
+ delete _styles[ nPos ];
+ }
+}
+//__________________________________________________________________________________________________
+void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOut )
+{
+ if (! _styles.empty())
+ {
+ OUString aStylesName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":styles") );
+ xOut->ignorableWhitespace( OUString() );
+ xOut->startElement( aStylesName, Reference< xml::sax::XAttributeList >() );
+ // export styles
+ for ( size_t nPos = 0; nPos < _styles.size(); ++nPos )
+ {
+ Reference< xml::sax::XAttributeList > xAttr( _styles[ nPos ]->createElement() );
+ static_cast< ElementDescriptor * >( xAttr.get() )->dump( xOut.get() );
+ }
+ xOut->ignorableWhitespace( OUString() );
+ xOut->endElement( aStylesName );
+ }
+}
+
+//##################################################################################################
+
+//==================================================================================================
+void SAL_CALL exportDialogModel(
+ Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
+ Reference< container::XNameContainer > const & xDialogModel )
+ SAL_THROW( (Exception) )
+{
+ StyleBag all_styles;
+ ::std::vector< Reference< xml::sax::XAttributeList > > all_elements;
+
+ // read out all props
+
+ Sequence< OUString > aElements( xDialogModel->getElementNames() );
+ OUString const * pElements = aElements.getConstArray();
+
+ ElementDescriptor * pRadioGroup = 0;
+
+ sal_Int32 nPos;
+ for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
+ {
+ Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
+ Reference< beans::XPropertySet > xProps;
+ OSL_VERIFY( aControlModel >>= xProps );
+ if (! xProps.is())
+ continue;
+ Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
+ OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
+ if (! xPropState.is())
+ continue;
+ Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
+ OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
+ if (! xServiceInfo.is())
+ continue;
+
+ ElementDescriptor * pElem = 0;
+ Reference< xml::sax::XAttributeList > xElem;
+
+ // group up radio buttons
+ if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
+ {
+ if (! pRadioGroup) // open radiogroup
+ {
+ pRadioGroup = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ) );
+ all_elements.push_back( pRadioGroup );
+ }
+
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readRadioButtonModel( &all_styles );
+ pRadioGroup->addSubElement( xElem );
+ }
+ else // no radio
+ {
+ pRadioGroup = 0; // close radiogroup
+
+ if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readButtonModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readCheckBoxModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readComboBoxModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readListBoxModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readGroupBoxModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readFixedTextModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readEditModel( &all_styles );
+ }
+ // FixedHyperLink
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readFixedHyperLinkModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readImageControlModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readFileControlModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readTreeControlModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readCurrencyFieldModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readDateFieldModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readNumericFieldModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readTimeFieldModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readPatternFieldModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readFormattedFieldModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readFixedLineModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readScrollBarModel( &all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readProgressBarModel( &all_styles );
+ }
+ //
+
+ OSL_ASSERT( xElem.is() );
+ if (xElem.is())
+ {
+ all_elements.push_back( xElem );
+ }
+ else
+ {
+ OSL_ENSURE( sal_False, "unknown control type!" );
+ continue;
+ }
+ }
+ }
+
+ xOut->startDocument();
+
+ OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM(
+ "<!DOCTYPE dlg:window PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\""
+ " \"dialog.dtd\">" ) );
+ xOut->unknown( aDocTypeStr );
+ xOut->ignorableWhitespace( OUString() );
+
+ // window
+ Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
+ OSL_ASSERT( xPropState.is() );
+
+ OUString aWindowName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":window") );
+ ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName );
+ Reference< xml::sax::XAttributeList > xWindow( pWindow );
+ pWindow->readDialogModel( &all_styles );
+ xOut->ignorableWhitespace( OUString() );
+ xOut->startElement( aWindowName, xWindow );
+ // dump out events
+ pWindow->dumpSubElements( xOut.get() );
+ // dump out stylebag
+ all_styles.dump( xOut );
+
+ if (! all_elements.empty())
+ {
+ // open up bulletinboard
+ OUString aBBoardName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") );
+ xOut->ignorableWhitespace( OUString() );
+ xOut->startElement( aBBoardName, Reference< xml::sax::XAttributeList >() );
+
+ // export control elements
+ for ( std::size_t n = 0; n < all_elements.size(); ++n )
+ {
+ ElementDescriptor * pElem = static_cast< ElementDescriptor * >( all_elements[ n ].get() );
+ pElem->dump( xOut.get() );
+ }
+
+ // end bulletinboard
+ xOut->ignorableWhitespace( OUString() );
+ xOut->endElement( aBBoardName );
+ }
+
+ // end window
+ xOut->ignorableWhitespace( OUString() );
+ xOut->endElement( aWindowName );
+
+ xOut->endDocument();
+}
+
+}
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
new file mode 100644
index 000000000000..a0968eb007d5
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -0,0 +1,2289 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlscript.hxx"
+#include "imp_share.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace xmlscript
+{
+
+// progessmeter
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > ProgressBarElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement(
+ nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void ProgressBarElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) );
+
+ Reference< xml::input::XElement > 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 );
+ pStyle->importFillColorStyle( xControlModel );
+ }
+
+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// scrollbar
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > ScrollBarElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void ScrollBarElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) );
+
+ Reference< xml::input::XElement > 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.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("pageincrement") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("curpos") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxpos") ),
+ _xAttributes );
+ ctx.importLongProperty( OUSTR("ScrollValueMin"), OUSTR("minpos"),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("visible-size") ),
+ _xAttributes );
+ ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("live-scroll") ),
+ _xAttributes );
+ ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
+ _xAttributes );
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// fixedline
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > FixedLineElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void FixedLineElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ }
+
+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// patternfield
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > PatternFieldElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, 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::input::XElement > 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->importTextLineColorStyle( 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.importBooleanProperty(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
+ _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 );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// formattedfield
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > FormattedFieldElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void FormattedFieldElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) );
+
+ Reference< xml::input::XElement > 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->importTextLineColorStyle( 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.importBooleanProperty(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
+ _xAttributes );
+ ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
+ _xAttributes );
+ ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
+ _xAttributes );
+ ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
+ _xAttributes );
+ if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
+ _xAttributes ))
+ ctx.getControlModel()->setPropertyValue(
+ OUSTR("Repeat"), makeAny(true) );
+
+ OUString sDefault(
+ _xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-default") ) ) );
+ if (sDefault.getLength())
+ {
+ double d = sDefault.toDouble();
+ if (d != 0.0 ||
+ sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0") ) ||
+ sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0.0") ))
+ {
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
+ makeAny( d ) );
+ }
+ else // treat as string
+ {
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
+ makeAny( sDefault ) );
+ }
+ }
+
+ // format spec
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ),
+ makeAny( _pImport->getNumberFormatsSupplier() ) );
+
+ OUString sFormat(
+ _xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("format-code") ) ) );
+ if (sFormat.getLength())
+ {
+ lang::Locale locale;
+
+ OUString sLocale(
+ _xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("format-locale") ) ) );
+ if (sLocale.getLength())
+ {
+ // split locale
+ sal_Int32 semi0 = sLocale.indexOf( ';' );
+ if (semi0 < 0) // no semi at all, just try language
+ {
+ locale.Language = sLocale;
+ }
+ else
+ {
+ sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 );
+ if (semi1 > semi0) // language;country;variant
+ {
+ locale.Language = sLocale.copy( 0, semi0 );
+ locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 );
+ locale.Variant = sLocale.copy( semi1 +1 );
+ }
+ else // try language;country
+ {
+ locale.Language = sLocale.copy( 0, semi0 );
+ locale.Country = sLocale.copy( semi0 +1 );
+ }
+ }
+ }
+
+ try
+ {
+ Reference< util::XNumberFormats > xFormats(
+ _pImport->getNumberFormatsSupplier()->getNumberFormats() );
+ sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True );
+ if (-1 == nKey)
+ {
+ nKey = xFormats->addNew( sFormat, locale );
+ }
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ), makeAny( nKey ) );
+ }
+ catch (util::MalformedNumberFormatException & exc)
+ {
+ OSL_ENSURE( 0, "### util::MalformedNumberFormatException occured!" );
+ // rethrow
+ throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
+ }
+ }
+ ctx.importBooleanProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("treat-as-number") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
+ _xAttributes );
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// timefield
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > TimeFieldElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, 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::input::XElement > 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->importTextLineColorStyle( 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.importBooleanProperty(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _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 );
+ if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
+ _xAttributes ))
+ ctx.getControlModel()->setPropertyValue(
+ OUSTR("Repeat"), makeAny(true) );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
+ _xAttributes );
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// numericfield
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > NumericFieldElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, 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::input::XElement > 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->importTextLineColorStyle( 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.importBooleanProperty(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _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 );
+ if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
+ _xAttributes ))
+ ctx.getControlModel()->setPropertyValue(
+ OUSTR("Repeat"), makeAny(true) );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// datefield
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > DateFieldElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, 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::input::XElement > 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->importTextLineColorStyle( 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.importBooleanProperty(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _xAttributes );
+ ctx.importDateFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("date-format") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("show-century") ),
+ _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 );
+ if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
+ _xAttributes ))
+ ctx.getControlModel()->setPropertyValue(
+ OUSTR("Repeat"), makeAny(true) );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("dropdown") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// currencyfield
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > CurrencyFieldElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, 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::input::XElement > 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->importTextLineColorStyle( 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.importBooleanProperty(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _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 );
+ if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
+ _xAttributes ))
+ ctx.getControlModel()->setPropertyValue(
+ OUSTR("Repeat"), makeAny(true) );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("prepend-symbol") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// filecontrol
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > FileControlElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, 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::input::XElement > 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->importTextLineColorStyle( 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(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+//##################################################################################################
+
+// treecontrol
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > TreeControlElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void TreeControlElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) );
+
+ Reference< xml::input::XElement > 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.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
+ _xAttributes );
+ ctx.importSelectionTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("selectiontype") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("rootdisplayed") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("showshandles") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("showsroothandles") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("editable") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invokesstopnodeediting") ),
+ _xAttributes );
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// imagecontrol
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > ImageControlElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, 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::input::XElement > 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.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// textfield
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > TextElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void TextElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) );
+
+ Reference< xml::input::XElement > 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->importTextLineColorStyle( xControlModel );
+ pStyle->importBorderStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ }
+
+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+// FixedHyperLink
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void FixedHyperLinkElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) );
+
+ Reference< xml::input::XElement > 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->importTextLineColorStyle( xControlModel );
+ pStyle->importBorderStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ }
+
+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("url") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("description") ),
+ _xAttributes );
+
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// edit
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > TextFieldElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void TextFieldElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importBackgroundColorStyle( xControlModel );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( 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.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("hard-linebreaks") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("hscroll") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("vscroll") ),
+ _xAttributes );
+ ctx.importBooleanProperty(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _xAttributes );
+ ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importLineEndFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("lineend-format") ),
+ _xAttributes );
+ OUString aValue;
+ if (getStringAttr( &aValue,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("echochar") ),
+ _xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ) &&
+ aValue.getLength() > 0)
+ {
+ OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" );
+ sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ),
+ makeAny( nChar ) );
+ }
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// titledbox
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > TitledBoxElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else if (_pImport->XMLNS_DIALOGS_UID != nUid)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // title
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
+ {
+ getStringAttr( &_label,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ xAttributes,
+ _pImport->XMLNS_DIALOGS_UID );
+
+ return new ElementBase(
+ _pImport->XMLNS_DIALOGS_UID,
+ rLocalName, xAttributes, this, _pImport );
+ }
+ // radio
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
+ {
+ // dont create radios here, => titledbox must be inserted first due to radio grouping,
+ // possible predecessors!
+ Reference< xml::input::XElement > xRet(
+ new RadioElement( rLocalName, xAttributes, this, _pImport ) );
+ _radios.push_back( xRet );
+ return xRet;
+ }
+ // event
+ else if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes );
+ }
+}
+//__________________________________________________________________________________________________
+void TitledBoxElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ {
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ }
+
+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
+
+ if (_label.getLength())
+ {
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
+ makeAny( _label ) );
+ }
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+ }
+
+ // create radios AFTER group box!
+ for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
+ {
+ Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
+ Reference< xml::input::XAttributes > xAttributes(
+ xRadio->getAttributes() );
+
+ ControlImportContext ctx(
+ _pImport, getControlId( xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+
+ Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importBackgroundColorStyle( xControlModel );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ pStyle->importVisualEffectStyle( 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("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ xAttributes );
+ ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
+ xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
+ xAttributes );
+ ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
+ xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+ xAttributes );
+
+ sal_Int16 nVal = 0;
+ sal_Bool bChecked = sal_False;
+ if (getBoolAttr( &bChecked,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
+ xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ) &&
+ bChecked)
+ {
+ nVal = 1;
+ }
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
+ makeAny( nVal ) );
+
+ ::std::vector< Reference< xml::input::XElement > > * radioEvents =
+ static_cast< RadioElement * >( xRadio.get() )->getEvents();
+ ctx.importEvents( *radioEvents );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ radioEvents->clear();
+ }
+ // avoid ring-reference:
+ // vector< radio elements > holding radio elements holding this (via _pParent)
+ _radios.clear();
+}
+
+//##################################################################################################
+
+// radio
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > RadioElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+
+//##################################################################################################
+
+// radiogroup
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > RadioGroupElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if (_pImport->XMLNS_DIALOGS_UID != nUid)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // radio
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
+ {
+ // dont create radios here, => titledbox must be inserted first due to radio grouping,
+ // possible predecessors!
+ Reference< xml::input::XElement > xRet(
+ new RadioElement( rLocalName, xAttributes, this, _pImport ) );
+ _radios.push_back( xRet );
+ return xRet;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected radio element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void RadioGroupElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
+ {
+ Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
+ Reference< xml::input::XAttributes > xAttributes(
+ xRadio->getAttributes() );
+
+ ControlImportContext ctx(
+ _pImport, getControlId( xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+
+ Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importBackgroundColorStyle( xControlModel );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ pStyle->importVisualEffectStyle( 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("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ xAttributes );
+ ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
+ xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
+ xAttributes );
+ ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
+ xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+ xAttributes );
+ sal_Int16 nVal = 0;
+ sal_Bool bChecked = sal_False;
+ if (getBoolAttr( &bChecked,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
+ xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ) &&
+ bChecked)
+ {
+ nVal = 1;
+ }
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
+ makeAny( nVal ) );
+
+ ::std::vector< Reference< xml::input::XElement > > * radioEvents =
+ static_cast< RadioElement * >( xRadio.get() )->getEvents();
+ ctx.importEvents( *radioEvents );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ radioEvents->clear();
+ }
+ // avoid ring-reference:
+ // vector< radio elements > holding radio elements holding this (via _pParent)
+ _radios.clear();
+}
+
+//##################################################################################################
+
+// menupopup
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > MenuPopupElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if (_pImport->XMLNS_DIALOGS_UID != nUid)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // menuitem
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menuitem") ))
+ {
+ OUString aValue(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ) ) );
+ OSL_ENSURE( aValue.getLength(), "### menuitem has no value?" );
+ if (aValue.getLength())
+ {
+ _itemValues.push_back( aValue );
+
+ OUString aSel(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("selected") ) ) );
+ if (aSel.getLength() && aSel.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
+ {
+ _itemSelected.push_back(
+ static_cast<sal_Int16>(_itemValues.size()) -1 );
+ }
+ }
+ return new ElementBase(
+ _pImport->XMLNS_DIALOGS_UID,
+ rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected menuitem!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+Sequence< OUString > MenuPopupElement::getItemValues()
+{
+ Sequence< OUString > aRet( _itemValues.size() );
+ OUString * pRet = aRet.getArray();
+ for ( size_t nPos = _itemValues.size(); nPos--; )
+ {
+ pRet[ nPos ] = _itemValues[ nPos ];
+ }
+ return aRet;
+}
+//__________________________________________________________________________________________________
+Sequence< sal_Int16 > MenuPopupElement::getSelectedItems()
+{
+ Sequence< sal_Int16 > aRet( _itemSelected.size() );
+ sal_Int16 * pRet = aRet.getArray();
+ for ( size_t nPos = _itemSelected.size(); nPos--; )
+ {
+ pRet[ nPos ] = _itemSelected[ nPos ];
+ }
+ return aRet;
+}
+
+//##################################################################################################
+
+// menulist
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > MenuListElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else if (_pImport->XMLNS_DIALOGS_UID != nUid)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // menupopup
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
+ {
+ _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
+ return _popup;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void MenuListElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importBackgroundColorStyle( xControlModel );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( 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("MultiSelection") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
+ _xAttributes );
+ ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
+ _xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+
+ if (_popup.is())
+ {
+ MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
+ makeAny( p->getItemValues() ) );
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
+ makeAny( p->getSelectedItems() ) );
+ }
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// combobox
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > ComboBoxElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else if (_pImport->XMLNS_DIALOGS_UID != nUid)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // menupopup
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
+ {
+ _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
+ return _popup;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void ComboBoxElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importBackgroundColorStyle( xControlModel );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( 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("Autocomplete") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("autocomplete") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
+ _xAttributes );
+ ctx.importBooleanProperty(
+ OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
+ _xAttributes );
+ ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
+ _xAttributes );
+ ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+
+ if (_popup.is())
+ {
+ MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
+ makeAny( p->getItemValues() ) );
+ }
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// checkbox
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > CheckBoxElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void CheckBoxElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importBackgroundColorStyle( xControlModel );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ pStyle->importVisualEffectStyle( 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("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
+ _xAttributes );
+ ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+ _xAttributes );
+
+
+ sal_Bool bTriState = sal_False;
+ if (getBoolAttr( &bTriState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ),
+ _xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ))
+ {
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ),
+ makeAny( bTriState ) );
+ }
+ sal_Bool bChecked = sal_False;
+ if (getBoolAttr( &bChecked,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
+ _xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ))
+ {
+ // has "checked" attribute
+ sal_Int16 nVal = (bChecked ? 1 : 0);
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
+ makeAny( nVal ) );
+ }
+ else
+ {
+ sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know!
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
+ makeAny( nVal ) );
+ }
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// button
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > ButtonElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void ButtonElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) );
+
+ Reference< xml::input::XElement > 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->importTextLineColorStyle( 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("Label") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
+ _xAttributes );
+ 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.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
+ _xAttributes );
+ ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
+ _xAttributes );
+ ctx.importImageAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-align") ),
+ _xAttributes );
+ if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
+ _xAttributes ))
+ ctx.getControlModel()->setPropertyValue(
+ OUSTR("Repeat"), makeAny(true) );
+ sal_Int32 toggled = 0;
+ if (getLongAttr( &toggled, OUSTR("toggled"), _xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ) && toggled == 1)
+ ctx.getControlModel()->setPropertyValue(OUSTR("Toggle"), makeAny(true));
+ ctx.importBooleanProperty( OUSTR("FocusOnClick"), OUSTR("grab-focus"),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+ _xAttributes );
+ // State
+ sal_Bool bChecked = sal_False;
+ if (getBoolAttr(
+ &bChecked,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
+ _xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ) &&
+ bChecked)
+ {
+ sal_Int16 nVal = 1;
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) );
+ }
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// bulletinboard
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if (_pImport->XMLNS_DIALOGS_UID != nUid)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // button
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("button") ))
+ {
+ return new ButtonElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // checkbox
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("checkbox") ))
+ {
+ return new CheckBoxElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // combobox
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("combobox") ))
+ {
+ return new ComboBoxElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // listbox
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menulist") ))
+ {
+ return new MenuListElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // radiogroup
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radiogroup") ))
+ {
+ return new RadioGroupElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // titledbox
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("titledbox") ))
+ {
+ return new TitledBoxElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // text
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("text") ))
+ {
+ return new TextElement( rLocalName, xAttributes, this, _pImport );
+ }
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("linklabel") ))
+ {
+ return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // textfield
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("textfield") ))
+ {
+ 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 );
+ }
+ // treecontrol
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("treecontrol") ))
+ {
+ return new TreeControlElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // currencyfield
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") ))
+ {
+ return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // datefield
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") ))
+ {
+ return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // datefield
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") ))
+ {
+ return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // timefield
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") ))
+ {
+ return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // patternfield
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") ))
+ {
+ return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // formattedfield
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("formattedfield") ))
+ {
+ return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // fixedline
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") ))
+ {
+ return new FixedLineElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // scrollbar
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scrollbar") ))
+ {
+ return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // progressmeter
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
+ {
+ return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // bulletinboard
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
+ {
+ return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles, bulletinboard or bulletinboard element, not: ") ) + rLocalName,
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+BulletinBoardElement::BulletinBoardElement(
+ OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+{
+ OUString aValue(
+ _xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) ) );
+ if (aValue.getLength())
+ {
+ _nBasePosX += toInt32( aValue );
+ }
+ aValue = _xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
+ if (aValue.getLength())
+ {
+ _nBasePosY += toInt32( aValue );
+ }
+}
+
+//##################################################################################################
+
+// style
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > StyleElement::startChildElement(
+ sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
+ Reference< xml::input::XAttributes > const & /*xAttributes*/ )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected sub elements of style!") ),
+ Reference< XInterface >(), Any() );
+}
+//__________________________________________________________________________________________________
+void StyleElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ Reference< xml::input::XAttributes > xStyle;
+ OUString aStyleId(
+ _xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
+ if (aStyleId.getLength())
+ {
+ _pImport->addStyle( aStyleId, this );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("missing style-id attribute!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+
+//##################################################################################################
+
+// styles
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > StylesElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if (_pImport->XMLNS_DIALOGS_UID != nUid)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // style
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("style") ))
+ {
+ return new StyleElement( rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected style element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+
+//##################################################################################################
+
+// window
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > WindowElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else if (_pImport->XMLNS_DIALOGS_UID != nUid)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // styles
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("styles") ))
+ {
+ return new StylesElement( rLocalName, xAttributes, this, _pImport );
+ }
+ // bulletinboard
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
+ {
+ return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void WindowElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ Reference< beans::XPropertySet > xProps(
+ _pImport->_xDialogModel, UNO_QUERY_THROW );
+ ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importBackgroundColorStyle( xProps );
+ pStyle->importTextColorStyle( xProps );
+ pStyle->importTextLineColorStyle( xProps );
+ pStyle->importFontStyle( xProps );
+ }
+
+ ctx.importDefaults( 0, 0, _xAttributes, false );
+ ctx.importBooleanProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("closeable") ),
+ _xAttributes );
+ ctx.importBooleanProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("moveable") ),
+ _xAttributes );
+ ctx.importBooleanProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("resizeable") ),
+ _xAttributes );
+ ctx.importStringProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("title") ),
+ _xAttributes );
+ ctx.importBooleanProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ),
+ _xAttributes );
+ ctx.importStringProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+}
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
new file mode 100644
index 000000000000..5fb2a39c6913
--- /dev/null
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -0,0 +1,1905 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlscript.hxx"
+#include "imp_share.hxx"
+
+#include <osl/diagnose.h>
+#include <tools/diagnose_ex.h>
+#include <osl/mutex.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <xmlscript/xml_import.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/awt/CharSet.hpp>
+#include <com/sun/star/awt/FontFamily.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontType.hpp>
+#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/ImagePosition.hpp>
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/PushButtonType.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+
+#include <com/sun/star/script/XScriptEventsSupplier.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+
+#include <com/sun/star/view/SelectionType.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+namespace xmlscript
+{
+
+//__________________________________________________________________________________________________
+void EventElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ static_cast< ControlElement * >( _pParent )->_events.push_back( this );
+}
+//__________________________________________________________________________________________________
+ControlElement::ControlElement(
+ OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ElementBase(
+ pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, pParent, pImport )
+{
+ if (_pParent)
+ {
+ // inherit position
+ _nBasePosX = static_cast< ControlElement * >( _pParent )->_nBasePosX;
+ _nBasePosY = static_cast< ControlElement * >( _pParent )->_nBasePosY;
+ }
+ else
+ {
+ _nBasePosX = 0;
+ _nBasePosY = 0;
+ }
+}
+
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > ControlElement::getStyle(
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aStyleId(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
+ if (aStyleId.getLength())
+ {
+ return _pImport->getStyle( aStyleId );
+ }
+ return Reference< xml::input::XElement >();
+}
+//__________________________________________________________________________________________________
+OUString ControlElement::getControlId(
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aId(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("id") ) ) );
+ if (! aId.getLength())
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("missing id attribute!") ),
+ Reference< XInterface >(), Any() );
+ }
+ return aId;
+}
+
+//##################################################################################################
+
+//__________________________________________________________________________________________________
+bool StyleElement::importTextColorStyle(
+ Reference< beans::XPropertySet > const & xProps )
+{
+ if ((_inited & 0x2) != 0)
+ {
+ if ((_hasValue & 0x2) != 0)
+ {
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ),
+ makeAny( _textColor ) );
+ return true;
+ }
+ return false;
+ }
+ _inited |= 0x2;
+
+ if (getLongAttr( &_textColor,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("text-color") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _hasValue |= 0x2;
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ),
+ makeAny( _textColor ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool StyleElement::importTextLineColorStyle(
+ Reference< beans::XPropertySet > const & xProps )
+{
+ if ((_inited & 0x20) != 0)
+ {
+ if ((_hasValue & 0x20) != 0)
+ {
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ),
+ makeAny( _textLineColor ) );
+ return true;
+ }
+ return false;
+ }
+ _inited |= 0x20;
+
+ if (getLongAttr( &_textLineColor,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("textline-color") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _hasValue |= 0x20;
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ),
+ makeAny( _textLineColor ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool StyleElement::importFillColorStyle(
+ Reference< beans::XPropertySet > const & xProps )
+{
+ if ((_inited & 0x10) != 0)
+ {
+ if ((_hasValue & 0x10) != 0)
+ {
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ), makeAny( _fillColor ) );
+ return true;
+ }
+ return false;
+ }
+ _inited |= 0x10;
+
+ if (getLongAttr(
+ &_fillColor,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("fill-color") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _hasValue |= 0x10;
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ),
+ makeAny( _fillColor ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool StyleElement::importBackgroundColorStyle(
+ Reference< beans::XPropertySet > const & xProps )
+{
+ if ((_inited & 0x1) != 0)
+ {
+ if ((_hasValue & 0x1) != 0)
+ {
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) );
+ return true;
+ }
+ return false;
+ }
+ _inited |= 0x1;
+
+ if (getLongAttr(
+ &_backgroundColor,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("background-color") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _hasValue |= 0x1;
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) );
+ return true;
+ }
+ return false;
+}
+
+//__________________________________________________________________________________________________
+bool StyleElement::importBorderStyle(
+ Reference< beans::XPropertySet > const & xProps )
+{
+ if ((_inited & 0x4) != 0)
+ {
+ if ((_hasValue & 0x4) != 0)
+ {
+ xProps->setPropertyValue(
+ OUSTR("Border"), makeAny( _border == BORDER_SIMPLE_COLOR
+ ? BORDER_SIMPLE : _border ) );
+ if (_border == BORDER_SIMPLE_COLOR)
+ xProps->setPropertyValue( OUSTR("BorderColor"),
+ makeAny(_borderColor) );
+ return true;
+ }
+ return false;
+ }
+ _inited |= 0x4;
+
+ OUString aValue;
+ if (getStringAttr(
+ &aValue, OUSTR("border"),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID )) {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
+ _border = BORDER_NONE;
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("3d") ))
+ _border = BORDER_3D;
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("simple") ))
+ _border = BORDER_SIMPLE;
+ else {
+ _border = BORDER_SIMPLE_COLOR;
+ _borderColor = toInt32(aValue);
+ }
+
+ _hasValue |= 0x4;
+ importBorderStyle(xProps); // write values
+ }
+ return false;
+}
+
+//______________________________________________________________________________
+bool StyleElement::importVisualEffectStyle(
+ Reference<beans::XPropertySet> const & xProps )
+{
+ if ((_inited & 0x40) != 0)
+ {
+ if ((_hasValue & 0x40) != 0)
+ {
+ xProps->setPropertyValue( OUSTR("VisualEffect"),
+ makeAny(_visualEffect) );
+ return true;
+ }
+ return false;
+ }
+ _inited |= 0x40;
+
+ OUString aValue;
+ if (getStringAttr( &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("look") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
+ {
+ _visualEffect = awt::VisualEffect::NONE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("3d") ))
+ {
+ _visualEffect = awt::VisualEffect::LOOK3D;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("simple") ))
+ {
+ _visualEffect = awt::VisualEffect::FLAT;
+ }
+ else
+ OSL_ASSERT( 0 );
+
+ _hasValue |= 0x40;
+ xProps->setPropertyValue( OUSTR("VisualEffect"),
+ makeAny(_visualEffect) );
+ }
+ return false;
+}
+
+//__________________________________________________________________________________________________
+void StyleElement::setFontProperties(
+ Reference< beans::XPropertySet > const & xProps )
+{
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ), makeAny( _descr ) );
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FontEmphasisMark") ), makeAny( _fontEmphasisMark ) );
+ xProps->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FontRelief") ), makeAny( _fontRelief ) );
+}
+//__________________________________________________________________________________________________
+bool StyleElement::importFontStyle(
+ Reference< beans::XPropertySet > const & xProps )
+{
+ if ((_inited & 0x8) != 0)
+ {
+ if ((_hasValue & 0x8) != 0)
+ {
+ setFontProperties( xProps );
+ return true;
+ }
+ return false;
+ }
+ _inited |= 0x8;
+
+ OUString aValue;
+ bool bFontImport;
+
+ // dialog:font-name CDATA #IMPLIED
+ bFontImport = getStringAttr(
+ &_descr.Name, OUString( RTL_CONSTASCII_USTRINGPARAM("font-name") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID );
+
+ // dialog:font-height %numeric; #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-height") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _descr.Height = (sal_Int16)toInt32( aValue );
+ bFontImport = true;
+ }
+ // dialog:font-width %numeric; #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-width") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _descr.Width = (sal_Int16)toInt32( aValue );
+ bFontImport = true;
+ }
+ // dialog:font-stylename CDATA #IMPLIED
+ bFontImport |= getStringAttr(
+ &_descr.StyleName,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("font-stylename") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID );
+
+ // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-family") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("decorative") ))
+ {
+ _descr.Family = awt::FontFamily::DECORATIVE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("modern") ))
+ {
+ _descr.Family = awt::FontFamily::MODERN;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("roman") ))
+ {
+ _descr.Family = awt::FontFamily::ROMAN;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("script") ))
+ {
+ _descr.Family = awt::FontFamily::SCRIPT;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("swiss") ))
+ {
+ _descr.Family = awt::FontFamily::SWISS;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system") ))
+ {
+ _descr.Family = awt::FontFamily::SYSTEM;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-family style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+
+ // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-charset") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ansi") ))
+ {
+ _descr.CharSet = awt::CharSet::ANSI;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("mac") ))
+ {
+ _descr.CharSet = awt::CharSet::MAC;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_437") ))
+ {
+ _descr.CharSet = awt::CharSet::IBMPC_437;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_850") ))
+ {
+ _descr.CharSet = awt::CharSet::IBMPC_850;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_860") ))
+ {
+ _descr.CharSet = awt::CharSet::IBMPC_860;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_861") ))
+ {
+ _descr.CharSet = awt::CharSet::IBMPC_861;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_863") ))
+ {
+ _descr.CharSet = awt::CharSet::IBMPC_863;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_865") ))
+ {
+ _descr.CharSet = awt::CharSet::IBMPC_865;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system") ))
+ {
+ _descr.CharSet = awt::CharSet::SYSTEM;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("symbol") ))
+ {
+ _descr.CharSet = awt::CharSet::SYMBOL;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-charset style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+
+ // dialog:font-pitch "(fixed|variable)" #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-pitch") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixed") ))
+ {
+ _descr.Pitch = awt::FontPitch::FIXED;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("variable") ))
+ {
+ _descr.Pitch = awt::FontPitch::VARIABLE;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-pitch style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+
+ // dialog:font-charwidth CDATA #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-charwidth") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _descr.CharacterWidth = aValue.toFloat();
+ bFontImport = true;
+ }
+ // dialog:font-weight CDATA #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-weight") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _descr.Weight = aValue.toFloat();
+ bFontImport = true;
+ }
+
+ // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-slant") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("oblique") ))
+ {
+ _descr.Slant = awt::FontSlant_OBLIQUE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("italic") ))
+ {
+ _descr.Slant = awt::FontSlant_ITALIC;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reverse_oblique") ))
+ {
+ _descr.Slant = awt::FontSlant_REVERSE_OBLIQUE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reverse_italic") ))
+ {
+ _descr.Slant = awt::FontSlant_REVERSE_ITALIC;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-slant style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+
+ // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-underline") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
+ {
+ _descr.Underline = awt::FontUnderline::SINGLE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("double") ))
+ {
+ _descr.Underline = awt::FontUnderline::DOUBLE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dotted") ))
+ {
+ _descr.Underline = awt::FontUnderline::DOTTED;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dash") ))
+ {
+ _descr.Underline = awt::FontUnderline::DASH;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("longdash") ))
+ {
+ _descr.Underline = awt::FontUnderline::LONGDASH;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dashdot") ))
+ {
+ _descr.Underline = awt::FontUnderline::DASHDOT;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dashdotdot") ))
+ {
+ _descr.Underline = awt::FontUnderline::DASHDOTDOT;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("smallwave") ))
+ {
+ _descr.Underline = awt::FontUnderline::SMALLWAVE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("wave") ))
+ {
+ _descr.Underline = awt::FontUnderline::WAVE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("doublewave") ))
+ {
+ _descr.Underline = awt::FontUnderline::DOUBLEWAVE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bold") ))
+ {
+ _descr.Underline = awt::FontUnderline::BOLD;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddotted") ))
+ {
+ _descr.Underline = awt::FontUnderline::BOLDDOTTED;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddash") ))
+ {
+ _descr.Underline = awt::FontUnderline::BOLDDASH;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("boldlongdash") ))
+ {
+ _descr.Underline = awt::FontUnderline::BOLDLONGDASH;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddashdot") ))
+ {
+ _descr.Underline = awt::FontUnderline::BOLDDASHDOT;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddashdotdot") ))
+ {
+ _descr.Underline = awt::FontUnderline::BOLDDASHDOTDOT;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("boldwave") ))
+ {
+ _descr.Underline = awt::FontUnderline::BOLDWAVE;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-underline style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+
+ // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-strikeout") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
+ {
+ _descr.Strikeout = awt::FontStrikeout::SINGLE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("double") ))
+ {
+ _descr.Strikeout = awt::FontStrikeout::DOUBLE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bold") ))
+ {
+ _descr.Strikeout = awt::FontStrikeout::BOLD;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("slash") ))
+ {
+ _descr.Strikeout = awt::FontStrikeout::SLASH;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("x") ))
+ {
+ _descr.Strikeout = awt::FontStrikeout::X;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-strikeout style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+
+ // dialog:font-orientation CDATA #IMPLIED
+ if (getStringAttr(
+ &aValue,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("font-orientation") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _descr.Orientation = aValue.toFloat();
+ bFontImport = true;
+ }
+ // dialog:font-kerning %boolean; #IMPLIED
+ bFontImport |= getBoolAttr(
+ &_descr.Kerning,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("font-kerning") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID );
+ // dialog:font-wordlinemode %boolean; #IMPLIED
+ bFontImport |= getBoolAttr(
+ &_descr.WordLineMode,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("font-wordlinemode") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID );
+
+ // dialog:font-type "(raster|device|scalable)" #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-type") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("raster") ))
+ {
+ _descr.Type = awt::FontType::RASTER;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("device") ))
+ {
+ _descr.Type = awt::FontType::DEVICE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scalable") ))
+ {
+ _descr.Type = awt::FontType::SCALABLE;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-type style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+
+ // additional properties which are not part of the FontDescriptor struct
+ // dialog:font-relief (none|embossed|engraved) #IMPLIED
+ if (getStringAttr(
+ &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-relief") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
+ {
+ _fontRelief = awt::FontRelief::NONE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("embossed") ))
+ {
+ _fontRelief = awt::FontRelief::EMBOSSED;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("engraved") ))
+ {
+ _fontRelief = awt::FontRelief::ENGRAVED;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-relief style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+ // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED
+ if (getStringAttr(
+ &aValue,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("font-emphasismark") ),
+ _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
+ {
+ _fontEmphasisMark = awt::FontEmphasisMark::NONE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dot") ))
+ {
+ _fontEmphasisMark = awt::FontEmphasisMark::DOT;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("circle") ))
+ {
+ _fontEmphasisMark = awt::FontEmphasisMark::CIRCLE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("disc") ))
+ {
+ _fontEmphasisMark = awt::FontEmphasisMark::DISC;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("accent") ))
+ {
+ _fontEmphasisMark = awt::FontEmphasisMark::ACCENT;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("above") ))
+ {
+ _fontEmphasisMark = awt::FontEmphasisMark::ABOVE;
+ }
+ else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("below") ))
+ {
+ _fontEmphasisMark = awt::FontEmphasisMark::BELOW;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-emphasismark style!") ),
+ Reference< XInterface >(), Any() );
+ }
+ bFontImport = true;
+ }
+
+ // ==================================================
+ if (bFontImport)
+ {
+ _hasValue |= 0x8;
+ setFontProperties( xProps );
+ }
+
+ return bFontImport;
+}
+
+//##################################################################################################
+
+//__________________________________________________________________________________________________
+bool ImportContext::importStringProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aValue(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aValue.getLength())
+ {
+ _xControlModel->setPropertyValue( rPropName, makeAny( aValue ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importDoubleProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aValue(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aValue.getLength())
+ {
+ _xControlModel->setPropertyValue( rPropName, makeAny( aValue.toDouble() ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importBooleanProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ sal_Bool bBool;
+ if (getBoolAttr(
+ &bBool, rAttrName, xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ _xControlModel->setPropertyValue( rPropName, makeAny( bBool ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importLongProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aValue(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aValue.getLength())
+ {
+ _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importLongProperty(
+ sal_Int32 nOffset,
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aValue(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aValue.getLength())
+ {
+ _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) + nOffset ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importHexLongProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aValue(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aValue.getLength())
+ {
+ _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importShortProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aValue(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aValue.getLength())
+ {
+ _xControlModel->setPropertyValue( rPropName, makeAny( (sal_Int16)toInt32( aValue ) ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importAlignProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aAlign(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aAlign.getLength())
+ {
+ sal_Int16 nAlign;
+ if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left") ))
+ {
+ nAlign = 0;
+ }
+ else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
+ {
+ nAlign = 1;
+ }
+ else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right") ))
+ {
+ nAlign = 2;
+ }
+ else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
+ {
+ nAlign = 0; // default
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid align value!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importVerticalAlignProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aAlign(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aAlign.getLength())
+ {
+ style::VerticalAlignment eAlign;
+
+ if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top") ))
+ {
+ eAlign = style::VerticalAlignment_TOP;
+ }
+ else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
+ {
+ eAlign = style::VerticalAlignment_MIDDLE;
+ }
+ else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom") ))
+ {
+ eAlign = style::VerticalAlignment_BOTTOM;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid vertical align value!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ _xControlModel->setPropertyValue( rPropName, makeAny( eAlign ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importImageAlignProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aAlign(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aAlign.getLength())
+ {
+ sal_Int16 nAlign;
+ if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left") ))
+ {
+ nAlign = 0;
+ }
+ else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top") ))
+ {
+ nAlign = 1;
+ }
+ else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right") ))
+ {
+ nAlign = 2;
+ }
+ else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom") ))
+ {
+ nAlign = 3;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid image align value!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importImagePositionProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aPosition(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aPosition.getLength())
+ {
+ sal_Int16 nPosition;
+ if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-top") ))
+ {
+ nPosition = awt::ImagePosition::LeftTop;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-center") ))
+ {
+ nPosition = awt::ImagePosition::LeftCenter;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-bottom") ))
+ {
+ nPosition = awt::ImagePosition::LeftBottom;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-top") ))
+ {
+ nPosition = awt::ImagePosition::RightTop;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-center") ))
+ {
+ nPosition = awt::ImagePosition::RightCenter;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-bottom") ))
+ {
+ nPosition = awt::ImagePosition::RightBottom;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-left") ))
+ {
+ nPosition = awt::ImagePosition::AboveLeft;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-center") ))
+ {
+ nPosition = awt::ImagePosition::AboveCenter;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-right") ))
+ {
+ nPosition = awt::ImagePosition::AboveRight;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-left") ))
+ {
+ nPosition = awt::ImagePosition::BelowLeft;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-center") ))
+ {
+ nPosition = awt::ImagePosition::BelowCenter;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-right") ))
+ {
+ nPosition = awt::ImagePosition::BelowRight;
+ }
+ else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
+ {
+ nPosition = awt::ImagePosition::Centered;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid image position value!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ _xControlModel->setPropertyValue( rPropName, makeAny( nPosition ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importButtonTypeProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString buttonType(
+ xAttributes->getValueByUidName(
+ _pImport->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::input::XAttributes > const & xAttributes )
+{
+ OUString aFormat(
+ xAttributes->getValueByUidName(
+ _pImport->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 ImportContext::importTimeFormatProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aFormat(
+ xAttributes->getValueByUidName(
+ _pImport->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;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importOrientationProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aOrient(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aOrient.getLength())
+ {
+ sal_Int32 nOrient;
+ if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("horizontal") ))
+ {
+ nOrient = 0;
+ }
+ else if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("vertical") ))
+ {
+ nOrient = 1;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid orientation value!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ _xControlModel->setPropertyValue( rPropName, makeAny( nOrient ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importLineEndFormatProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aFormat(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aFormat.getLength())
+ {
+ sal_Int16 nFormat;
+ if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("carriage-return") ))
+ {
+ nFormat = awt::LineEndFormat::CARRIAGE_RETURN;
+ }
+ else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("line-feed") ))
+ {
+ nFormat = awt::LineEndFormat::LINE_FEED;
+ }
+ else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("carriage-return-line-feed") ))
+ {
+ nFormat = awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid line end format value!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) );
+ return true;
+ }
+ return false;
+}
+//__________________________________________________________________________________________________
+bool ImportContext::importSelectionTypeProperty(
+ OUString const & rPropName, OUString const & rAttrName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+{
+ OUString aSelectionType(
+ xAttributes->getValueByUidName(
+ _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+ if (aSelectionType.getLength())
+ {
+ view::SelectionType eSelectionType;
+
+ if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
+ {
+ eSelectionType = view::SelectionType_NONE;
+ }
+ else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
+ {
+ eSelectionType = view::SelectionType_SINGLE;
+ }
+ else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multi") ))
+ {
+ eSelectionType = view::SelectionType_MULTI;
+ }
+ else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("range") ))
+ {
+ eSelectionType = view::SelectionType_RANGE;
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("invalid selection type value!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ _xControlModel->setPropertyValue( rPropName, makeAny( eSelectionType ) );
+ return true;
+ }
+ return false;
+}
+
+//==================================================================================================
+struct StringTriple
+{
+ char const * first;
+ char const * second;
+ char const * third;
+};
+static StringTriple const s_aEventTranslations[] =
+{
+ // from xmloff/source/forms/formevents.cxx
+ // 28.09.2001 tbe added on-adjustmentvaluechange
+ { "com.sun.star.form.XApproveActionListener", "approveAction", "on-approveaction" },
+ { "com.sun.star.awt.XActionListener", "actionPerformed", "on-performaction" },
+ { "com.sun.star.form.XChangeListener", "changed", "on-change" },
+ { "com.sun.star.awt.XTextListener", "textChanged", "on-textchange" },
+ { "com.sun.star.awt.XItemListener", "itemStateChanged", "on-itemstatechange" },
+ { "com.sun.star.awt.XFocusListener", "focusGained", "on-focus" },
+ { "com.sun.star.awt.XFocusListener", "focusLost", "on-blur" },
+ { "com.sun.star.awt.XKeyListener", "keyPressed", "on-keydown" },
+ { "com.sun.star.awt.XKeyListener", "keyReleased", "on-keyup" },
+ { "com.sun.star.awt.XMouseListener", "mouseEntered", "on-mouseover" },
+ { "com.sun.star.awt.XMouseMotionListener", "mouseDragged", "on-mousedrag" },
+ { "com.sun.star.awt.XMouseMotionListener", "mouseMoved", "on-mousemove" },
+ { "com.sun.star.awt.XMouseListener", "mousePressed", "on-mousedown" },
+ { "com.sun.star.awt.XMouseListener", "mouseReleased", "on-mouseup" },
+ { "com.sun.star.awt.XMouseListener", "mouseExited", "on-mouseout" },
+ { "com.sun.star.form.XResetListener", "approveReset", "on-approvereset" },
+ { "com.sun.star.form.XResetListener", "resetted", "on-reset" },
+ { "com.sun.star.form.XSubmitListener", "approveSubmit", "on-submit" },
+ { "com.sun.star.form.XUpdateListener", "approveUpdate", "on-approveupdate" },
+ { "com.sun.star.form.XUpdateListener", "updated", "on-update" },
+ { "com.sun.star.form.XLoadListener", "loaded", "on-load" },
+ { "com.sun.star.form.XLoadListener", "reloading", "on-startreload" },
+ { "com.sun.star.form.XLoadListener", "reloaded", "on-reload" },
+ { "com.sun.star.form.XLoadListener", "unloading", "on-startunload" },
+ { "com.sun.star.form.XLoadListener", "unloaded", "on-unload" },
+ { "com.sun.star.form.XConfirmDeleteListener", "confirmDelete", "on-confirmdelete" },
+ { "com.sun.star.sdb.XRowSetApproveListener", "approveRowChange", "on-approverowchange" },
+ { "com.sun.star.sdbc.XRowSetListener", "rowChanged", "on-rowchange" },
+ { "com.sun.star.sdb.XRowSetApproveListener", "approveCursorMove", "on-approvecursormove" },
+ { "com.sun.star.sdbc.XRowSetListener", "cursorMoved", "on-cursormove" },
+ { "com.sun.star.form.XDatabaseParameterListener", "approveParameter", "on-supplyparameter" },
+ { "com.sun.star.sdb.XSQLErrorListener", "errorOccured", "on-error" },
+ { "com.sun.star.awt.XAdjustmentListener", "adjustmentValueChanged", "on-adjustmentvaluechange" },
+ { 0, 0, 0 }
+};
+extern StringTriple const * const g_pEventTranslations;
+StringTriple const * const g_pEventTranslations = s_aEventTranslations;
+
+//__________________________________________________________________________________________________
+void ImportContext::importEvents(
+ ::std::vector< Reference< xml::input::XElement > > const & rEvents )
+{
+ Reference< script::XScriptEventsSupplier > xSupplier(
+ _xControlModel, UNO_QUERY );
+ if (xSupplier.is())
+ {
+ Reference< container::XNameContainer > xEvents( xSupplier->getEvents() );
+ if (xEvents.is())
+ {
+ for ( size_t nPos = 0; nPos < rEvents.size(); ++nPos )
+ {
+ script::ScriptEventDescriptor descr;
+
+ EventElement * pEventElement = static_cast< EventElement * >( rEvents[ nPos ].get() );
+ sal_Int32 nUid = pEventElement->getUid();
+ OUString aLocalName( pEventElement->getLocalName() );
+ Reference< xml::input::XAttributes > xAttributes(
+ pEventElement->getAttributes() );
+
+ // nowadays script events
+ if (_pImport->XMLNS_SCRIPT_UID == nUid)
+ {
+ if (!getStringAttr( &descr.ScriptType,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "language") ),
+ xAttributes,
+ _pImport->XMLNS_SCRIPT_UID ) ||
+ !getStringAttr( &descr.ScriptCode,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "macro-name") ),
+ xAttributes,
+ _pImport->XMLNS_SCRIPT_UID ))
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "missing language or macro-name "
+ "attribute(s) of event!") ),
+ Reference< XInterface >(), Any() );
+ }
+ if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) ) )
+ {
+ OUString aLocation;
+ if (getStringAttr( &aLocation,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "location") ),
+ xAttributes,
+ _pImport->XMLNS_SCRIPT_UID ))
+ {
+ // prepend location
+ ::rtl::OUStringBuffer buf;
+ buf.append( aLocation );
+ buf.append( (sal_Unicode)':' );
+ buf.append( descr.ScriptCode );
+ descr.ScriptCode = buf.makeStringAndClear();
+ }
+ }
+ else if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) ) ) )
+ {
+ // Check if there is a protocol, if not assume
+ // this is an early scripting framework url ( without
+ // the protocol ) and fix it up!!
+ if ( descr.ScriptCode.indexOf( ':' ) == -1 )
+ {
+ ::rtl::OUStringBuffer buf;
+ buf.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:" ) ) );
+ buf.append( descr.ScriptCode );
+ descr.ScriptCode = buf.makeStringAndClear();
+ }
+ }
+
+ // script:event element
+ if (aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") ))
+ {
+ OUString aEventName;
+ if (! getStringAttr(
+ &aEventName,
+ OUString(
+ RTL_CONSTASCII_USTRINGPARAM("event-name") ),
+ xAttributes,
+ _pImport->XMLNS_SCRIPT_UID ))
+ {
+ throw xml::sax::SAXException(
+ OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "missing event-name attribute!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ // lookup in table
+ ::rtl::OString str(
+ ::rtl::OUStringToOString(
+ aEventName, RTL_TEXTENCODING_ASCII_US ) );
+ StringTriple const * p = g_pEventTranslations;
+ while (p->first)
+ {
+ if (0 == ::rtl_str_compare( p->third, str.getStr() ))
+ {
+ descr.ListenerType = OUString(
+ p->first, ::rtl_str_getLength( p->first ),
+ RTL_TEXTENCODING_ASCII_US );
+ descr.EventMethod = OUString(
+ p->second, ::rtl_str_getLength( p->second ),
+ RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ ++p;
+ }
+
+ if (! p->first)
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("no matching event-name found!") ),
+ Reference< XInterface >(), Any() );
+ }
+ }
+ else // script:listener-event element
+ {
+ OSL_ASSERT( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("listener-event") ) );
+
+ if (!getStringAttr(
+ &descr.ListenerType,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "listener-type") ),
+ xAttributes,
+ _pImport->XMLNS_SCRIPT_UID ) ||
+ !getStringAttr(
+ &descr.EventMethod,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "listener-method") ),
+ xAttributes, _pImport->XMLNS_SCRIPT_UID ))
+ {
+ throw xml::sax::SAXException(
+ OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "missing listener-type or "
+ "listener-method attribute(s)!") ),
+ Reference< XInterface >(), Any() );
+ }
+ // optional listener param
+ getStringAttr(
+ &descr.AddListenerParam,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "listener-param") ),
+ xAttributes, _pImport->XMLNS_SCRIPT_UID );
+ }
+ }
+ else // deprecated dlg:event element
+ {
+ OSL_ASSERT(
+ _pImport->XMLNS_DIALOGS_UID == nUid &&
+ aLocalName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("event") ) );
+
+ if (!getStringAttr( &descr.ListenerType,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "listener-type") ),
+ xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ) ||
+ !getStringAttr( &descr.EventMethod,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "event-method") ),
+ xAttributes,
+ _pImport->XMLNS_DIALOGS_UID ))
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("missing listener-type or event-method attribute(s)!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ getStringAttr(
+ &descr.ScriptType,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("script-type") ),
+ xAttributes, _pImport->XMLNS_DIALOGS_UID );
+ getStringAttr(
+ &descr.ScriptCode,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("script-code") ),
+ xAttributes, _pImport->XMLNS_DIALOGS_UID );
+ getStringAttr(
+ &descr.AddListenerParam,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("param") ),
+ xAttributes, _pImport->XMLNS_DIALOGS_UID );
+ }
+
+ ::rtl::OUStringBuffer buf;
+ buf.append( descr.ListenerType );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("::") );
+ buf.append( descr.EventMethod );
+ xEvents->insertByName( buf.makeStringAndClear(), makeAny( descr ) );
+ }
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void ImportContext::importDefaults(
+ sal_Int32 nBaseX, sal_Int32 nBaseY,
+ Reference< xml::input::XAttributes > const & xAttributes,
+ bool supportPrintable )
+{
+ _xControlModel->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ),
+ makeAny( _aId ) );
+
+ importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tab-index") ),
+ xAttributes );
+
+ sal_Bool bDisable = sal_False;
+ if (getBoolAttr(
+ &bDisable, OUString( RTL_CONSTASCII_USTRINGPARAM("disabled") ),
+ xAttributes, _pImport->XMLNS_DIALOGS_UID ) &&
+ bDisable)
+ {
+ _xControlModel->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ), makeAny( sal_False ) );
+ }
+
+ sal_Bool bVisible = sal_True;
+ if (getBoolAttr(
+ &bVisible, OUString( RTL_CONSTASCII_USTRINGPARAM("visible") ),
+ xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !bVisible)
+ {
+ try
+ {
+
+ _xControlModel->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ), makeAny( sal_False ) );
+ }
+ catch( Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ if (!importLongProperty( nBaseX,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("left") ),
+ xAttributes ) ||
+ !importLongProperty( nBaseY,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("top") ),
+ xAttributes ) ||
+ !importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("width") ),
+ xAttributes ) ||
+ !importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("height") ),
+ xAttributes ))
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("missing pos size attribute(s)!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ if (supportPrintable)
+ {
+ importBooleanProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("printable") ),
+ xAttributes );
+ }
+
+ sal_Int32 nLong;
+ if (! getLongAttr(
+ &nLong,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("page") ),
+ xAttributes, _pImport->XMLNS_DIALOGS_UID ))
+ {
+ nLong = 0;
+ }
+ _xControlModel->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ),
+ makeAny( nLong ) );
+
+ importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ),
+ xAttributes );
+ importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("help-text") ),
+ xAttributes );
+ importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("help-url") ),
+ xAttributes );
+}
+
+//##################################################################################################
+
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > ElementBase::getParent()
+ throw (RuntimeException)
+{
+ return static_cast< xml::input::XElement * >( _pParent );
+}
+//__________________________________________________________________________________________________
+OUString ElementBase::getLocalName()
+ throw (RuntimeException)
+{
+ return _aLocalName;
+}
+//__________________________________________________________________________________________________
+sal_Int32 ElementBase::getUid()
+ throw (RuntimeException)
+{
+ return _nUid;
+}
+//__________________________________________________________________________________________________
+Reference< xml::input::XAttributes > ElementBase::getAttributes()
+ throw (RuntimeException)
+{
+ return _xAttributes;
+}
+//__________________________________________________________________________________________________
+void ElementBase::ignorableWhitespace(
+ OUString const & /*rWhitespaces*/ )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // not used
+}
+//__________________________________________________________________________________________________
+void ElementBase::characters( OUString const & /*rChars*/ )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // not used, all characters ignored
+}
+//__________________________________________________________________________________________________
+void ElementBase::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+}
+//______________________________________________________________________________
+void ElementBase::processingInstruction(
+ OUString const & /*Target*/, OUString const & /*Data*/ )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+}
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > ElementBase::startChildElement(
+ sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
+ Reference< xml::input::XAttributes > const & /*xAttributes*/ )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected element!") ),
+ Reference< XInterface >(), Any() );
+}
+
+//__________________________________________________________________________________________________
+ElementBase::ElementBase(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : _pImport( pImport )
+ , _pParent( pParent )
+ , _nUid( nUid )
+ , _aLocalName( rLocalName )
+ , _xAttributes( xAttributes )
+{
+ _pImport->acquire();
+
+ if (_pParent)
+ {
+ _pParent->acquire();
+ }
+}
+//__________________________________________________________________________________________________
+ElementBase::~ElementBase()
+ SAL_THROW( () )
+{
+ _pImport->release();
+
+ if (_pParent)
+ {
+ _pParent->release();
+ }
+
+#if OSL_DEBUG_LEVEL > 1
+ ::rtl::OString aStr( ::rtl::OUStringToOString(
+ _aLocalName, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_TRACE( "ElementBase::~ElementBase(): %s\n", aStr.getStr() );
+#endif
+}
+
+//##################################################################################################
+
+// XRoot
+//
+
+//______________________________________________________________________________
+void DialogImport::startDocument(
+ Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ XMLNS_DIALOGS_UID = xNamespaceMapping->getUidByUri(
+ OUSTR(XMLNS_DIALOGS_URI) );
+ XMLNS_SCRIPT_UID = xNamespaceMapping->getUidByUri(
+ OUSTR(XMLNS_SCRIPT_URI) );
+}
+//__________________________________________________________________________________________________
+void DialogImport::endDocument()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // ignored
+}
+//__________________________________________________________________________________________________
+void DialogImport::processingInstruction(
+ OUString const & /*rTarget*/, OUString const & /*rData*/ )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // ignored for now: xxx todo
+}
+//__________________________________________________________________________________________________
+void DialogImport::setDocumentLocator(
+ Reference< xml::sax::XLocator > const & /*xLocator*/ )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // ignored for now: xxx todo
+}
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > DialogImport::startRootElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > 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() );
+ }
+ // window
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("window") ))
+ {
+ return new WindowElement( rLocalName, xAttributes, 0, this );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "illegal root element (expected window) given: ") ) +
+ rLocalName, Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+DialogImport::~DialogImport()
+ SAL_THROW( () )
+{
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE( "DialogImport::~DialogImport().\n" );
+#endif
+}
+//__________________________________________________________________________________________________
+Reference< util::XNumberFormatsSupplier > const & DialogImport::getNumberFormatsSupplier()
+{
+ if (! _xSupplier.is())
+ {
+ Reference< XComponentContext > xContext( getComponentContext() );
+ Reference< util::XNumberFormatsSupplier > xSupplier(
+ xContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.NumberFormatsSupplier") ),
+ xContext ), UNO_QUERY );
+
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! _xSupplier.is())
+ {
+ _xSupplier = xSupplier;
+ }
+ }
+ return _xSupplier;
+}
+
+//__________________________________________________________________________________________________
+void DialogImport::addStyle(
+ OUString const & rStyleId,
+ Reference< xml::input::XElement > const & xStyle )
+ SAL_THROW( () )
+{
+ _styleNames.push_back( rStyleId );
+ _styles.push_back( xStyle );
+}
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > DialogImport::getStyle(
+ OUString const & rStyleId ) const
+ SAL_THROW( () )
+{
+ for ( size_t nPos = 0; nPos < _styleNames.size(); ++nPos )
+ {
+ if (_styleNames[ nPos ] == rStyleId)
+ {
+ return _styles[ nPos ];
+ }
+ }
+ return 0;
+}
+
+//##################################################################################################
+
+//==================================================================================================
+Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
+ Reference< container::XNameContainer > const & xDialogModel,
+ Reference< XComponentContext > const & xContext )
+ SAL_THROW( (Exception) )
+{
+ return ::xmlscript::createDocumentHandler(
+ static_cast< xml::input::XRoot * >(
+ new DialogImport( xContext, xDialogModel ) ) );
+}
+
+}