diff options
author | Noel Power <noel.power@novell.com> | 2010-10-13 10:51:50 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2010-10-13 10:51:50 +0100 |
commit | 606a57481911e111dfab950cd7fb90ae80aed014 (patch) | |
tree | 62e85311b32105e6d4e165d60c9d4bbdb80c03bc /xmlscript | |
parent | a4d7dbf897e41a1afda6c2b6f0e5cc35920a1cf3 (diff) | |
parent | ed49568618442960781b63c3a47ddc65031b2fa0 (diff) |
Merge branch 'vba' fix conflics, trailing ws & tab issues
also removed some old headers ( which I need to add new ones for )
Conflicts:
basic/source/classes/sbunoobj.cxx
basic/source/classes/sbxmod.cxx
xmloff/inc/xmlnmspe.hxx
xmloff/inc/xmloff/xmltoken.hxx
xmlscript/inc/xmlscript/xmldlg_imexp.hxx
Diffstat (limited to 'xmlscript')
-rw-r--r-- | xmlscript/inc/xmlscript/xmldlg_imexp.hxx | 20 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/exp_share.hxx | 14 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/imp_share.hxx | 186 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx | 11 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 271 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 29 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 572 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 54 | ||||
-rw-r--r-- | xmlscript/util/makefile.mk | 1 |
9 files changed, 916 insertions, 242 deletions
diff --git a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx index c2d7abc951..ed3c131d10 100644 --- a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -27,6 +27,8 @@ #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_ #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_ +#include <com/sun/star/frame/XModel.hpp> + #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/io/XInputStreamProvider.hpp> #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> @@ -43,7 +45,9 @@ void SAL_CALL exportDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut, ::com::sun::star::uno::Reference< - ::com::sun::star::container::XNameContainer > const & xDialogModel ) + ::com::sun::star::container::XNameContainer > const & xDialogModel, + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (::com::sun::star::uno::Exception) ); //============================================================================== @@ -52,7 +56,9 @@ SAL_CALL importDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel, ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & xContext ) + ::com::sun::star::uno::XComponentContext > const & xContext, + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (::com::sun::star::uno::Exception) ); // additional functions for convenience @@ -63,7 +69,9 @@ SAL_CALL exportDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel, ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & xContext ) + ::com::sun::star::uno::XComponentContext > const & xContext, + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (::com::sun::star::uno::Exception) ); //============================================================================== @@ -73,7 +81,9 @@ void SAL_CALL importDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel, ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & xContext ) + ::com::sun::star::uno::XComponentContext > const & xContext, + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (::com::sun::star::uno::Exception) ); } diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index 9ea565fc54..d06ffee2ab 100644 --- a/xmlscript/source/xmldlg_imexp/exp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx @@ -171,15 +171,17 @@ public: // void readDialogModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); + void readMultiPageModel( 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 ) + void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (css::uno::Exception) ); - void readComboBoxModel( StyleBag * all_styles ) + void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (css::uno::Exception) ); void readCurrencyFieldModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); @@ -193,9 +195,9 @@ public: SAL_THROW( (css::uno::Exception) ); void readGroupBoxModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); - void readImageControlModel( StyleBag * all_styles ) + void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (css::uno::Exception) ); - void readListBoxModel( StyleBag * all_styles ) + void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (css::uno::Exception) ); void readNumericFieldModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); @@ -209,7 +211,9 @@ public: SAL_THROW( (css::uno::Exception) ); void readProgressBarModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); - void readScrollBarModel( StyleBag * all_styles ) + void readScrollBarModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) + SAL_THROW( (css::uno::Exception) ); + void readSpinButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (css::uno::Exception) ); void readFixedHyperLinkModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index ce9e43fd05..a13a205a7b 100644 --- a/xmlscript/source/xmldlg_imexp/imp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -42,6 +42,7 @@ #include <com/sun/star/awt/FontEmphasisMark.hpp> #include <com/sun/star/awt/FontRelief.hpp> #include <com/sun/star/xml/input/XRoot.hpp> +#include <com/sun/star/script/XLibraryContainer.hpp> #include <vector> @@ -62,7 +63,7 @@ inline sal_Int32 toInt32( ::rtl::OUString const & rStr ) SAL_THROW( () ) } inline bool getBoolAttr( - sal_Bool * pRet, ::rtl::OUString const & rAttrName, + sal_Bool * pRet, ::rtl::OUString const & rAttrName, css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, sal_Int32 nUid ) { @@ -90,7 +91,7 @@ inline bool getBoolAttr( } inline bool getStringAttr( - ::rtl::OUString * pRet, ::rtl::OUString const & rAttrName, + ::rtl::OUString * pRet, ::rtl::OUString const & rAttrName, css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, sal_Int32 nUid ) { @@ -99,7 +100,7 @@ inline bool getStringAttr( } inline bool getLongAttr( - sal_Int32 * pRet, ::rtl::OUString const & rAttrName, + sal_Int32 * pRet, ::rtl::OUString const & rAttrName, css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, sal_Int32 nUid ) { @@ -119,18 +120,20 @@ 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; + css::uno::Reference< css::frame::XModel > _xDoc; + css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer; sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID; - + public: inline bool isEventElement( sal_Int32 nUid, ::rtl::OUString const & rLocalName ) @@ -144,7 +147,7 @@ public: rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") ))); } - + void addStyle( ::rtl::OUString const & rStyleId, css::uno::Reference< css::xml::input::XElement > const & xStyle ) @@ -152,25 +155,29 @@ public: 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 ) + const & xDialogModel, + css::uno::Reference<css::frame::XModel> const & xDoc ) SAL_THROW( () ) : _xContext( xContext ) , _xDialogModel( xDialogModel ) - , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ) + , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc ) { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() && _xContext.is() ); } virtual ~DialogImport() SAL_THROW( () ); - + + inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; } + + css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer(); // XRoot virtual void SAL_CALL startDocument( css::uno::Reference< css::xml::input::XNamespaceMapping > @@ -195,14 +202,14 @@ public: class ElementBase : public ::cppu::WeakImplHelper1< css::xml::input::XElement > { -protected: +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, @@ -211,7 +218,7 @@ public: SAL_THROW( () ); virtual ~ElementBase() SAL_THROW( () ); - + // XElement virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent() throw (css::uno::RuntimeException); @@ -248,7 +255,7 @@ public: 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, @@ -276,10 +283,10 @@ class StyleElement // 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( @@ -288,7 +295,7 @@ public: 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( @@ -303,7 +310,7 @@ public: 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, @@ -327,13 +334,13 @@ class MenuPopupElement 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, @@ -349,12 +356,12 @@ 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( @@ -362,7 +369,7 @@ protected: 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, @@ -377,7 +384,7 @@ protected: DialogImport * _pImport; css::uno::Reference< css::beans::XPropertySet > _xControlModel; ::rtl::OUString _aId; - + public: inline ImportContext( DialogImport * pImport, @@ -387,10 +394,10 @@ public: _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, @@ -398,7 +405,7 @@ public: 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 ); @@ -406,44 +413,44 @@ public: ::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, + ::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, + ::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, + ::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, + ::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, + ::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, + ::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, + ::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, + ::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, + ::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, + ::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, + ::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, @@ -487,7 +494,7 @@ public: 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, @@ -504,7 +511,7 @@ class EventElement 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, @@ -524,7 +531,7 @@ public: 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, @@ -544,7 +551,7 @@ public: 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, @@ -566,7 +573,7 @@ public: 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, @@ -589,7 +596,7 @@ public: 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, @@ -612,7 +619,7 @@ public: 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, @@ -632,7 +639,7 @@ public: 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, @@ -655,7 +662,7 @@ public: 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, @@ -679,7 +686,7 @@ public: 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, @@ -701,7 +708,7 @@ public: 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, @@ -722,7 +729,7 @@ public: 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, @@ -743,7 +750,7 @@ public: 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, @@ -765,7 +772,7 @@ public: 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, @@ -787,7 +794,7 @@ public: 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, @@ -809,7 +816,7 @@ public: 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, @@ -831,7 +838,7 @@ public: 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, @@ -853,7 +860,7 @@ public: 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, @@ -875,7 +882,7 @@ public: 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, @@ -897,7 +904,7 @@ public: 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, @@ -919,7 +926,7 @@ public: 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, @@ -941,7 +948,7 @@ public: 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, @@ -963,7 +970,7 @@ public: 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, @@ -985,7 +992,7 @@ public: 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, @@ -996,6 +1003,49 @@ public: }; //============================================================================== +class SpinButtonElement + : 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 SpinButtonElement( + ::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 MultiPage + : 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 MultiPage( + ::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 { @@ -1007,7 +1057,7 @@ public: 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, diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx index 0a5d74ae9a..c21db9dfc2 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx @@ -41,6 +41,7 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; namespace xmlscript { @@ -70,7 +71,8 @@ Reference< io::XInputStream > InputStreamProvider::createInputStream() //================================================================================================== Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel( Reference< container::XNameContainer > const & xDialogModel, - Reference< XComponentContext > const & xContext ) + Reference< XComponentContext > const & xContext, + Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); @@ -95,7 +97,7 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel( Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY ); xSource->setOutputStream( createOutputStream( &aBytes ) ); - exportDialogModel( xHandler, xDialogModel ); + exportDialogModel( xHandler, xDialogModel, xDocument ); return new InputStreamProvider( aBytes ); } @@ -104,7 +106,8 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel( void SAL_CALL importDialogModel( Reference< io::XInputStream > xInput, Reference< container::XNameContainer > const & xDialogModel, - Reference< XComponentContext > const & xContext ) + Reference< XComponentContext > const & xContext, + Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); @@ -126,7 +129,7 @@ void SAL_CALL importDialogModel( } // error handler, entity resolver omitted for this helper function - xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) ); + xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) ); xml::sax::InputSource source; source.aInputStream = xInput; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index 2449c09377..3cd7ff985e 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -29,7 +29,16 @@ #include "precompiled_xmlscript.hxx" #include "exp_share.hxx" +#include <com/sun/star/form/binding/XListEntrySink.hpp> +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/binding/XValueBinding.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/document/XGraphicObjectResolver.hpp> +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> using namespace ::com::sun::star; @@ -39,6 +48,66 @@ using ::rtl::OUString; namespace xmlscript { +void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel ) +{ + Reference< lang::XMultiServiceFactory > xFac; + if ( xDocument.is() ) + xFac.set( xDocument, uno::UNO_QUERY ); + + Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY ); + + if ( xFac.is() && xBinding.is() ) + { + try + { + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY ); + Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY ); + if ( xBindable.is() ) + { + table::CellAddress aAddress; + xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress; + xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) ); + rtl::OUString sAddress; + xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress; + if ( sAddress.getLength() > 0 ) + rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress ); + + OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() ); + + } + } + catch( uno::Exception& ) + { + } + } + Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY ); + if ( xEntrySink.is() ) + { + Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY ); + if ( xListSource.is() ) + { + try + { + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY ); + + table::CellRangeAddress aAddress; + xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress; + + rtl::OUString sAddress; + xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) ); + xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress; + OSL_TRACE("**** cell range source list %s", + rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() ); + if ( sAddress.getLength() > 0 ); + rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress ); + } + catch( uno::Exception& ) + { + } + } + } + +} static inline bool readBorderProps( ElementDescriptor * element, Style & style ) { @@ -65,6 +134,42 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style ) } //__________________________________________________________________________________________________ +void ElementDescriptor::readMultiPageModel( StyleBag * all_styles ) +{ + // 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(); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + + 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::readButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { @@ -206,7 +311,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) +void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) SAL_THROW( (Exception) ) { // collect styles @@ -247,7 +352,8 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) ); readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) ); - + // Cell Range, Ref Cell etc. + lclExportBindableAndListSourceBits( xDocument, _xProps, *this ); // string item list Sequence< OUString > itemValues; if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) && @@ -273,7 +379,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) +void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) SAL_THROW( (Exception) ) { // collect styles @@ -308,7 +414,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) ); readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); - + lclExportBindableAndListSourceBits( xDocument, _xProps, *this ); // string item list Sequence< OUString > itemValues; if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) && @@ -348,7 +454,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) +void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) SAL_THROW( (Exception) ) { // collect styles @@ -385,6 +491,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) ); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) ); sal_Int16 nState = 0; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState) @@ -404,6 +512,7 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) break; } } + lclExportBindableAndListSourceBits( xDocument, _xProps, *this ); readEvents(); } //__________________________________________________________________________________________________ @@ -576,7 +685,7 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles ) readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readImageControlModel( StyleBag * all_styles ) +void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (Exception) ) { // collect styles @@ -595,8 +704,31 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles ) 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") ) ); + rtl::OUString sURL; + _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL; + + if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 ) + { + Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY ); + + if ( xDocStorage.is() ) + { + uno::Sequence< Any > aArgs( 1 ); + aArgs[ 0 ] <<= xDocStorage->getDocumentStorage(); + + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + uno::Reference< document::XGraphicObjectResolver > xGraphicResolver; + aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver ); + if ( xGraphicResolver.is() ) + { + sURL = xGraphicResolver->resolveGraphicObjectURL( sURL ); + } + } + } + if ( sURL.getLength() > 0 ) + { + addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL ); + } readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readEvents(); @@ -657,7 +789,7 @@ void ElementDescriptor::readTreeControlModel( StyleBag * all_styles ) 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") ), @@ -751,27 +883,27 @@ void ElementDescriptor::readDateFieldModel( StyleBag * all_styles ) 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") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":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") ) ); + 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") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + 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") ) )) @@ -806,31 +938,31 @@ void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles ) 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") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":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") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) ); readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) ); readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":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 */ ); @@ -859,7 +991,7 @@ void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), all_styles->getStyleId( aStyle ) ); } - + // collect elements readDefaults(); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), @@ -910,25 +1042,25 @@ void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles ) 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") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":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") ) ); + 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") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":edit-mask") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) ); readEvents(); } //__________________________________________________________________________________________________ @@ -952,7 +1084,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), all_styles->getStyleId( aStyle ) ); } - + // collect elements readDefaults(); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), @@ -974,7 +1106,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) 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()) { @@ -997,7 +1129,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) 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) @@ -1015,7 +1147,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) 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(); } //__________________________________________________________________________________________________ @@ -1035,11 +1167,11 @@ void ElementDescriptor::readFixedLineModel( StyleBag * all_styles ) 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") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); readEvents(); @@ -1061,7 +1193,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), all_styles->getStyleId( aStyle ) ); } - + // collect elements readDefaults(); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), @@ -1073,7 +1205,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles ) readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readScrollBarModel( StyleBag * all_styles ) +void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) SAL_THROW( (Exception) ) { // collect styles @@ -1087,11 +1219,11 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles ) 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") ) ); + 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") ), @@ -1111,6 +1243,47 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) ); readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) ); + // Cell Range, Ref Cell etc. + lclExportBindableAndListSourceBits( xDocument, _xProps, *this ); + readEvents(); +} +//__________________________________________________________________________________________________ +void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) + 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("SpinIncrement") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) ); + readLongAttr( OUSTR("SpinValueMin"), + OUSTR(XMLNS_DIALOGS_PREFIX ":minval") ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) ); + readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) ); + // Cell Range, Ref Cell etc. + lclExportBindableAndListSourceBits( xDocument, _xProps, *this ); readEvents(); } //__________________________________________________________________________________________________ @@ -1122,7 +1295,7 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles ) 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) @@ -1138,7 +1311,7 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), all_styles->getStyleId( aStyle ) ); } - + // collect elements readDefaults( false, false ); readBoolAttr( @@ -1158,10 +1331,10 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles ) bool bDecoration = sal_False; if ( (aDecorationAny >>= bDecoration) && !bDecoration ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + 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 index 2898ac1386..47b1d2f4e9 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -1325,7 +1325,8 @@ void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOu //================================================================================================== void SAL_CALL exportDialogModel( Reference< xml::sax::XExtendedDocumentHandler > const & xOut, - Reference< container::XNameContainer > const & xDialogModel ) + Reference< container::XNameContainer > const & xDialogModel, + Reference< frame::XModel > const & xDocument ) SAL_THROW( (Exception) ) { StyleBag all_styles; @@ -1373,7 +1374,7 @@ void SAL_CALL exportDialogModel( xProps, xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readRadioButtonModel( &all_styles ); + pElem->readRadioButtonModel( &all_styles, xDocument ); pRadioGroup->addSubElement( xElem ); } else // no radio @@ -1402,7 +1403,7 @@ void SAL_CALL exportDialogModel( xProps, xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readComboBoxModel( &all_styles ); + pElem->readComboBoxModel( &all_styles, xDocument ); } else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) { @@ -1410,7 +1411,7 @@ void SAL_CALL exportDialogModel( xProps, xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readListBoxModel( &all_styles ); + pElem->readListBoxModel( &all_styles, xDocument ); } else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) { @@ -1420,6 +1421,14 @@ void SAL_CALL exportDialogModel( xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->readGroupBoxModel( &all_styles ); } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ) ); + xElem = static_cast< xml::sax::XAttributeList * >( pElem ); + pElem->readMultiPageModel( &all_styles ); + } else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) { pElem = new ElementDescriptor( @@ -1451,7 +1460,7 @@ void SAL_CALL exportDialogModel( xProps, xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readImageControlModel( &all_styles ); + pElem->readImageControlModel( &all_styles, xDocument ); } else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) ) { @@ -1531,7 +1540,15 @@ void SAL_CALL exportDialogModel( xProps, xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readScrollBarModel( &all_styles ); + pElem->readScrollBarModel( &all_styles, xDocument ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ) ); + xElem = static_cast< xml::sax::XAttributeList * >( pElem ); + pElem->readSpinButtonModel( &all_styles, xDocument ); } else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) { diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index 1c43cc83d9..481e8a3a1f 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -28,17 +28,195 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmlscript.hxx" #include "imp_share.hxx" - +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/binding/XValueBinding.hpp> +#include <com/sun/star/form/binding/XListEntrySink.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/document/XGraphicObjectResolver.hpp> +#include <com/sun/star/script/vba/XVBACompatibility.hpp> - +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using ::rtl::OUString; namespace xmlscript { +Reference< xml::input::XElement > MultiPage::startChildElement( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::input::XAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + // event +rtl::OUString _label = rtl::OUString::createFromAscii("foo"); + if (_pImport->isEventElement( nUid, rLocalName )) + { + return new EventElement( + nUid, rLocalName, xAttributes, this, _pImport ); + } + 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 ); + } + else + { + + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ + +void MultiPage::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ); +// 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 + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _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(); +} + +// #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251 +// of course we need to find a common home for this helper + +bool IsPackageURL( const ::rtl::OUString& rURL ) +{ + // Some quick tests: Some may rely on the package structure! + sal_Int32 nLen = rURL.getLength(); + if( (nLen > 0 && '/' == rURL[0]) ) + // RFC2396 net_path or abs_path + return false; + else if( nLen > 1 && '.' == rURL[0] ) + { + if( '.' == rURL[1] ) + // ../: We are never going up one level, so we know + // it's not an external URI + return false; + else if( '/' == rURL[1] ) + // we are remaining on a level, so it's an package URI + return true; + } + + // Now check for a RFC2396 schema + sal_Int32 nPos = 1; + while( nPos < nLen ) + { + switch( rURL[nPos] ) + { + case '/': + // a relative path segement + return true; + case ':': + // a schema + return false; + default: + break; + // we don't care about any other characters + } + ++nPos; + } + + return true; +} + +void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx ) +{ + Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY ); + if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) ) + { + // Set up Celllink + if ( sLinkedCell.getLength() ) + { + Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY ); + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY ); + if ( xBindable.is() && xConvertor.is() ) + { + table::CellAddress aAddress; + xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) ); + xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress; + beans::NamedValue aArg1; + aArg1.Name = OUSTR("BoundCell"); + aArg1.Value <<= aAddress; + + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= aArg1; + + uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY ); + xBindable->setValueBinding( xBinding ); + + } + } + // Set up CelllRange + if ( sCellRange.getLength() ) + { + Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY ); + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY ); + if ( xListEntrySink.is() && xConvertor.is() ) + { + table::CellRangeAddress aAddress; + xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) ); + xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress; + beans::NamedValue aArg1; + aArg1.Name = OUSTR("CellRange"); + aArg1.Value <<= aAddress; + + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= aArg1; + + uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY ); + xListEntrySink->setListEntrySource( xSource ); + + } + } + } +} + +sal_Bool isVBACompatibilityMode( DialogImport* _pImport ) +{ + sal_Bool bVBAMode = sal_False; + Reference< script::vba::XVBACompatibility > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY ); + if( xVBACompat.is() ) + { + bVBAMode = xVBACompat->getVBACompatibilityMode(); + } + return bVBAMode; +} // progessmeter //__________________________________________________________________________________________________ @@ -67,7 +245,7 @@ void ProgressBarElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -77,7 +255,7 @@ void ProgressBarElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFillColorStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), @@ -119,10 +297,24 @@ Reference< xml::input::XElement > ScrollBarElement::startChildElement( void ScrollBarElement::endElement() throw (xml::sax::SAXException, RuntimeException) { + OUString sService( OUSTR("com.sun.star.awt.UnoControlScrollBarModel") ); + // we should probably limit this to vba mode also ( leave for now ) + if ( isVBACompatibilityMode( _pImport ) ) + sService = OUSTR("com.sun.star.form.component.ScrollBar"); + + OUString sLinkedCell; + try + { + sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) ); + } + catch( Exception& /*e*/ ) + { + } + ControlImportContext ctx( _pImport, getControlId( _xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ); - + sService ); + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -131,7 +323,7 @@ void ScrollBarElement::endElement() pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), @@ -164,7 +356,93 @@ void ScrollBarElement::endElement() ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ), OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ), _xAttributes ); - + + // import cell-link + OUString sCellRange; + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); + + ctx.importEvents( _events ); + // avoid ring-reference: + // vector< event elements > holding event elements holding this (via _pParent) + _events.clear(); +} + +//################################################################################################## + +// spinbutton +//__________________________________________________________________________________________________ +Reference< xml::input::XElement > SpinButtonElement::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 SpinButtonElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + OUString sLinkedCell; + try + { + sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) ); + } + catch( Exception& /*e*/ ) + { + } + + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.SpinButton") ) ); + + 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("SpinIncrement") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ), + _xAttributes ); + ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"), + _xAttributes ); + ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"), + _xAttributes ); + ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"), + _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); + ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ), + _xAttributes ); + // import cell-link + OUString sCellRange; + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); + ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -199,7 +477,7 @@ void FixedLineElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -209,7 +487,7 @@ void FixedLineElement::endElement() pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), @@ -251,7 +529,7 @@ void PatternFieldElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -263,7 +541,7 @@ void PatternFieldElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -323,7 +601,7 @@ void FormattedFieldElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -335,7 +613,7 @@ void FormattedFieldElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -360,7 +638,7 @@ void FormattedFieldElement::endElement() _xAttributes ); ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), - _xAttributes ); + _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), OUString( RTL_CONSTASCII_USTRINGPARAM("text") ), _xAttributes ); @@ -374,7 +652,7 @@ void FormattedFieldElement::endElement() _xAttributes )) ctx.getControlModel()->setPropertyValue( OUSTR("Repeat"), makeAny(true) ); - + OUString sDefault( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, @@ -397,12 +675,12 @@ void FormattedFieldElement::endElement() makeAny( sDefault ) ); } } - + // format spec ctx.getControlModel()->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ), makeAny( _pImport->getNumberFormatsSupplier() ) ); - + OUString sFormat( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, @@ -410,7 +688,7 @@ void FormattedFieldElement::endElement() if (sFormat.getLength()) { lang::Locale locale; - + OUString sLocale( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, @@ -439,7 +717,7 @@ void FormattedFieldElement::endElement() } } } - + try { Reference< util::XNumberFormats > xFormats( @@ -466,7 +744,7 @@ void FormattedFieldElement::endElement() 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) @@ -501,7 +779,7 @@ void TimeFieldElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -513,7 +791,7 @@ void TimeFieldElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -552,7 +830,7 @@ void TimeFieldElement::endElement() 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) @@ -587,7 +865,7 @@ void NumericFieldElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -599,7 +877,7 @@ void NumericFieldElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -640,7 +918,7 @@ void NumericFieldElement::endElement() OUSTR("Repeat"), makeAny(true) ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ), OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ), - _xAttributes ); + _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -675,7 +953,7 @@ void DateFieldElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -687,7 +965,7 @@ void DateFieldElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -766,7 +1044,7 @@ void CurrencyFieldElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -778,7 +1056,7 @@ void CurrencyFieldElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -794,7 +1072,7 @@ void CurrencyFieldElement::endElement() _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ), OUString( RTL_CONSTASCII_USTRINGPARAM("currency-symbol") ), - _xAttributes ); + _xAttributes ); ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ), OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ), _xAttributes ); @@ -860,7 +1138,7 @@ void FileControlElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -872,7 +1150,7 @@ void FileControlElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -882,7 +1160,7 @@ void FileControlElement::endElement() _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), - _xAttributes ); + _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), _xAttributes ); @@ -919,7 +1197,7 @@ void TreeControlElement::endElement() 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()) { @@ -928,18 +1206,18 @@ void TreeControlElement::endElement() 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 ); + _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ), OUString( RTL_CONSTASCII_USTRINGPARAM("rootdisplayed") ), _xAttributes ); - ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ), + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ), OUString( RTL_CONSTASCII_USTRINGPARAM("showshandles") ), _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ), @@ -989,7 +1267,7 @@ void ImageControlElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -998,14 +1276,42 @@ void ImageControlElement::endElement() 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 ); + rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) ); + Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY ); + + if ( xDocStorage.is() && IsPackageURL( sURL ) ) + { + uno::Sequence< Any > aArgs( 1 ); + aArgs[ 0 ] <<= xDocStorage->getDocumentStorage(); + + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + uno::Reference< document::XGraphicObjectResolver > xGraphicResolver; + aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver ); + + if ( xGraphicResolver.is() ) + { + rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) ); + aTmp += sURL; + sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp ); + Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY ); + // we must set the url while the graphic object ( held by the resolver is in scope ) + if ( xProps.is() ) + xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) ); + } + } + + else if ( sURL.getLength() > 0 ) + { + Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY ); + if ( xProps.is() ) + xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) ); + } + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), _xAttributes ); @@ -1043,7 +1349,7 @@ void TextElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -1055,7 +1361,7 @@ void TextElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), @@ -1108,7 +1414,7 @@ void FixedHyperLinkElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -1120,7 +1426,7 @@ void FixedHyperLinkElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), @@ -1182,7 +1488,7 @@ void TextFieldElement::endElement() _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()) { @@ -1193,7 +1499,7 @@ void TextFieldElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -1240,7 +1546,7 @@ void TextFieldElement::endElement() 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) @@ -1274,7 +1580,7 @@ Reference< xml::input::XElement > TitledBoxElement::startChildElement( OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), xAttributes, _pImport->XMLNS_DIALOGS_UID ); - + return new ElementBase( _pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, _pImport ); @@ -1308,7 +1614,7 @@ void TitledBoxElement::endElement() _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()) { @@ -1317,9 +1623,9 @@ void TitledBoxElement::endElement() pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement - + if (_label.getLength()) { xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), @@ -1331,19 +1637,33 @@ void TitledBoxElement::endElement() // 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() ); - + OUString sLinkedCell; + OUString sCellRange; + OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") ); + try + { + sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) ); + // we should probably limit this to vba mode also ( leave for now ) + if ( isVBACompatibilityMode( _pImport ) ) + sService = OUSTR("com.sun.star.form.component.RadioButton"); + } + catch( Exception& /*e*/ ) + { + } + + ControlImportContext ctx( _pImport, getControlId( xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ); + sService ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); - + Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); if (xStyle.is()) { @@ -1354,7 +1674,7 @@ void TitledBoxElement::endElement() pStyle->importFontStyle( xControlModel ); pStyle->importVisualEffectStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -1377,7 +1697,10 @@ void TitledBoxElement::endElement() ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), xAttributes ); - + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ), + xAttributes ); + sal_Int16 nVal = 0; sal_Bool bChecked = sal_False; if (getBoolAttr( &bChecked, @@ -1390,7 +1713,7 @@ void TitledBoxElement::endElement() } xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); - + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); ::std::vector< Reference< xml::input::XElement > > * radioEvents = static_cast< RadioElement * >( xRadio.get() )->getEvents(); ctx.importEvents( *radioEvents ); @@ -1466,12 +1789,25 @@ void RadioGroupElement::endElement() Reference< xml::input::XElement > xRadio( _radios[ nPos ] ); Reference< xml::input::XAttributes > xAttributes( xRadio->getAttributes() ); - + OUString sLinkedCell; + OUString sCellRange; + OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") ); + try + { + sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) ); + // we should probably limit this to vba mode also ( leave for now ) + if ( isVBACompatibilityMode( _pImport ) ) + sService = OUSTR("com.sun.star.form.component.RadioButton"); + } + catch( Exception& /*e*/ ) + { + } + ControlImportContext ctx( _pImport, getControlId( xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ); + sService ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); - + Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); if (xStyle.is()) { @@ -1482,7 +1818,7 @@ void RadioGroupElement::endElement() pStyle->importFontStyle( xControlModel ); pStyle->importVisualEffectStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -1505,6 +1841,9 @@ void RadioGroupElement::endElement() ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ), + xAttributes ); sal_Int16 nVal = 0; sal_Bool bChecked = sal_False; if (getBoolAttr( &bChecked, @@ -1517,7 +1856,8 @@ void RadioGroupElement::endElement() } xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); - + + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); ::std::vector< Reference< xml::input::XElement > > * radioEvents = static_cast< RadioElement * >( xRadio.get() )->getEvents(); ctx.importEvents( *radioEvents ); @@ -1556,7 +1896,7 @@ Reference< xml::input::XElement > MenuPopupElement::startChildElement( if (aValue.getLength()) { _itemValues.push_back( aValue ); - + OUString aSel( xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, @@ -1638,11 +1978,28 @@ Reference< xml::input::XElement > MenuListElement::startChildElement( void MenuListElement::endElement() throw (xml::sax::SAXException, RuntimeException) { + OUString sLinkedCell; + OUString sCellRange; + OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") ); + + // we should probably limit this to vba mode also ( leave for now ) + if ( isVBACompatibilityMode( _pImport ) ) + sListBoxService = OUSTR("com.sun.star.form.component.ListBox"); + + try + { + sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) ); + sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) ); + } + catch( Exception& /*e*/ ) + { + } ControlImportContext ctx( _pImport, getControlId( _xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ); + //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ); + sListBoxService ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -1653,7 +2010,7 @@ void MenuListElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -1673,13 +2030,16 @@ void MenuListElement::endElement() ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), _xAttributes ); - + // import cell-link and cell source range + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); if (_popup.is()) { MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() ); - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), + if ( !sCellRange.getLength() ) + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), makeAny( p->getItemValues() ) ); - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ), + if ( !sLinkedCell.getLength() ) + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ), makeAny( p->getSelectedItems() ) ); } ctx.importEvents( _events ); @@ -1725,11 +2085,28 @@ Reference< xml::input::XElement > ComboBoxElement::startChildElement( void ComboBoxElement::endElement() throw (xml::sax::SAXException, RuntimeException) { + OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") ); + + // we should probably limit this to vba mode also ( leave for now ) + if ( isVBACompatibilityMode( _pImport ) ) + sService = OUSTR("com.sun.star.form.component.ComboBox"); + + OUString sLinkedCell; + OUString sCellRange; + try + { + sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) ); + sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) ); + } + catch( Exception& /*e*/ ) + { + } + ControlImportContext ctx( _pImport, getControlId( _xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ); + sService ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -1740,7 +2117,7 @@ void ComboBoxElement::endElement() pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -1769,14 +2146,16 @@ void ComboBoxElement::endElement() ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), _xAttributes ); - - if (_popup.is()) + // import cell-link and cell source range + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); + + if (_popup.is() && !sCellRange.getLength() ) { 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) @@ -1812,7 +2191,7 @@ void CheckBoxElement::endElement() _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()) { @@ -1823,7 +2202,7 @@ void CheckBoxElement::endElement() pStyle->importFontStyle( xControlModel ); pStyle->importVisualEffectStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -1847,7 +2226,7 @@ void CheckBoxElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), _xAttributes ); - + sal_Bool bTriState = sal_False; if (getBoolAttr( &bTriState, OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ), @@ -1874,7 +2253,7 @@ void CheckBoxElement::endElement() 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) @@ -1909,7 +2288,7 @@ void ButtonElement::endElement() ControlImportContext ctx( _pImport, getControlId( _xAttributes ), OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ); - + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { @@ -1920,7 +2299,7 @@ void ButtonElement::endElement() pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } - + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), @@ -1975,7 +2354,7 @@ void ButtonElement::endElement() 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) @@ -2096,11 +2475,20 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement( { return new ScrollBarElement( rLocalName, xAttributes, this, _pImport ); } + // spinbutton + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatibilityMode( _pImport ) ) + { + return new SpinButtonElement( rLocalName, xAttributes, this, _pImport ); + } // progressmeter else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") )) { return new ProgressBarElement( rLocalName, xAttributes, this, _pImport ); } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") )) + { + return new MultiPage( rLocalName, xAttributes, this, _pImport ); + } // bulletinboard else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) { @@ -2244,7 +2632,7 @@ void WindowElement::endElement() 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()) { @@ -2254,7 +2642,7 @@ void WindowElement::endElement() pStyle->importTextLineColorStyle( xProps ); pStyle->importFontStyle( xProps ); } - + ctx.importDefaults( 0, 0, _xAttributes, false ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ), @@ -2276,11 +2664,11 @@ void WindowElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ), OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ), _xAttributes ); - ctx.importStringProperty( + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), _xAttributes ); - ctx.importEvents( _events ); + 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 index f3c0e551f1..fb57c5acb7 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -57,9 +57,13 @@ #include <com/sun/star/script/ScriptEventDescriptor.hpp> #include <com/sun/star/view/SelectionType.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp> +#include <com/sun/star/script/vba/XVBACompatibility.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; using ::rtl::OUString; namespace xmlscript @@ -276,7 +280,7 @@ bool StyleElement::importBorderStyle( _border = BORDER_SIMPLE_COLOR; _borderColor = toInt32(aValue); } - + _hasValue |= 0x4; importBorderStyle(xProps); // write values } @@ -298,7 +302,7 @@ bool StyleElement::importVisualEffectStyle( return false; } _inited |= 0x40; - + OUString aValue; if (getStringAttr( &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("look") ), _xAttributes, _pImport->XMLNS_DIALOGS_UID )) @@ -317,7 +321,7 @@ bool StyleElement::importVisualEffectStyle( } else OSL_ASSERT( 0 ); - + _hasValue |= 0x40; xProps->setPropertyValue( OUSTR("VisualEffect"), makeAny(_visualEffect) ); @@ -677,7 +681,7 @@ bool StyleElement::importFontStyle( &_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") ), @@ -1451,10 +1455,10 @@ void ImportContext::importEvents( } } 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!! + // the protocol ) and fix it up!! if ( descr.ScriptCode.indexOf( ':' ) == -1 ) { ::rtl::OUStringBuffer buf; @@ -1546,7 +1550,7 @@ void ImportContext::importEvents( _pImport->XMLNS_DIALOGS_UID == nUid && aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") ) ); - + if (!getStringAttr( &descr.ListenerType, OUString( RTL_CONSTASCII_USTRINGPARAM( "listener-type") ), @@ -1617,7 +1621,7 @@ void ImportContext::importDefaults( { try { - + _xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ), makeAny( sal_False ) ); } @@ -1855,7 +1859,7 @@ Reference< util::XNumberFormatsSupplier > const & DialogImport::getNumberFormats OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatsSupplier") ), xContext ), UNO_QUERY ); - + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); if (! _xSupplier.is()) { @@ -1888,18 +1892,42 @@ Reference< xml::input::XElement > DialogImport::getStyle( } return 0; } +//__________________________________________________________________________________________________ +Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer() +{ + if( !_xScriptLibraryContainer.is() ) + { + try + { + Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY ); + if( xProps.is() ) + _xScriptLibraryContainer.set( xProps->getPropertyValue( OUSTR("BasicLibraries") ), UNO_QUERY ); + } + catch( const Exception& ) + { + } + } + + return _xScriptLibraryContainer; +} //################################################################################################## //================================================================================================== Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel( Reference< container::XNameContainer > const & xDialogModel, - Reference< XComponentContext > const & xContext ) + Reference< XComponentContext > const & xContext, + Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { + DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument ); + uno::Reference< script::vba::XVBACompatibility > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY ); + + uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY ); + if ( xVBAModeSource.is() && xDlgProps.is() && xVBAModeSource->getVBACompatibilityMode() ) + xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) ); return ::xmlscript::createDocumentHandler( - static_cast< xml::input::XRoot * >( - new DialogImport( xContext, xDialogModel ) ) ); + static_cast< xml::input::XRoot * >( pImport ) ); } } diff --git a/xmlscript/util/makefile.mk b/xmlscript/util/makefile.mk index 3ccf63dc3b..bc259db754 100644 --- a/xmlscript/util/makefile.mk +++ b/xmlscript/util/makefile.mk @@ -54,6 +54,7 @@ SHL1LIBS= \ $(LIB1TARGET) SHL1STDLIBS= \ + $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALLIB) |