From 928159ff71d19a3910d1fd1e472a11ef1c89415b Mon Sep 17 00:00:00 2001 From: Noel Power Date: Tue, 2 Nov 2010 16:22:07 +0000 Subject: initial import of latest cws container_controls --- xmlscript/source/xmldlg_imexp/common.hxx | 1 + xmlscript/source/xmldlg_imexp/exp_share.hxx | 26 +- xmlscript/source/xmldlg_imexp/imp_share.hxx | 103 +++- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 551 +++++++++++++++------ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 390 +++++---------- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 463 +++++++---------- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 144 +++++- 7 files changed, 973 insertions(+), 705 deletions(-) (limited to 'xmlscript/source') diff --git a/xmlscript/source/xmldlg_imexp/common.hxx b/xmlscript/source/xmldlg_imexp/common.hxx index e391fb619ed4..7395c1034f95 100644 --- a/xmlscript/source/xmldlg_imexp/common.hxx +++ b/xmlscript/source/xmldlg_imexp/common.hxx @@ -40,6 +40,7 @@ const sal_Int16 BORDER_SIMPLE_COLOR = 3; } +#define XMLSCRIPT_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index ffb97055dff4..aaf6bd6aeef6 100644 --- a/xmlscript/source/xmldlg_imexp/exp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx @@ -91,16 +91,18 @@ class ElementDescriptor { css::uno::Reference< css::beans::XPropertySet > _xProps; css::uno::Reference< css::beans::XPropertyState > _xPropState; + css::uno::Reference< css::frame::XModel > _xDocument; public: inline ElementDescriptor( css::uno::Reference< css::beans::XPropertySet > const & xProps, css::uno::Reference< css::beans::XPropertyState > const & xPropState, - ::rtl::OUString const & name ) + ::rtl::OUString const & name, css::uno::Reference< css::frame::XModel > const & xDocument ) SAL_THROW( () ) : XMLElement( name ) , _xProps( xProps ) , _xPropState( xPropState ) + , _xDocument( xDocument ) {} inline ElementDescriptor( ::rtl::OUString const & name ) @@ -142,6 +144,8 @@ public: ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); void readVerticalAlignAttr( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); + void readImageURLAttr( + ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); void readImageAlignAttr( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); void readImagePositionAttr( @@ -159,6 +163,8 @@ public: void readSelectionTypeAttr( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); // + void readDataAwareAttr( + ::rtl::OUString const & rAttrName ); inline void addBoolAttr( ::rtl::OUString const & rAttrName, sal_Bool bValue ) { addAttribute( rAttrName, ::rtl::OUString::valueOf(bValue) ); } @@ -172,17 +178,23 @@ public: // void readDialogModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); + void readBullitinBoard( StyleBag * all_styles ) + SAL_THROW( (css::uno::Exception) ); void readMultiPageModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); + void readFrameModel( StyleBag * all_styles ) + SAL_THROW( (css::uno::Exception) ); + void readPageModel( 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, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) + void readRadioButtonModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); - void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) + void readComboBoxModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); void readCurrencyFieldModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); @@ -196,9 +208,9 @@ public: SAL_THROW( (css::uno::Exception) ); void readGroupBoxModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); - void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) + void readImageControlModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); - void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) + void readListBoxModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); void readNumericFieldModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); @@ -212,9 +224,9 @@ public: SAL_THROW( (css::uno::Exception) ); void readProgressBarModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); - void readScrollBarModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) + void readScrollBarModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); - void readSpinButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) + void readSpinButtonModel( StyleBag * all_styles ) 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 27929a349bfe..5523fe05440b 100644 --- a/xmlscript/source/xmldlg_imexp/imp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx @@ -45,7 +45,7 @@ #include #include #include - +#include namespace css = ::com::sun::star; @@ -117,16 +117,19 @@ inline bool getLongAttr( class ImportContext; //============================================================================== +typedef ::cppu::WeakImplHelper1< css::xml::input::XRoot > DialogImport_Base; struct DialogImport - : public ::cppu::WeakImplHelper1< css::xml::input::XRoot > + : DialogImport_Base { 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; + ::boost::shared_ptr< ::std::vector< ::rtl::OUString > > _pStyleNames; + ::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > > _pStyles; + ::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; @@ -166,13 +169,32 @@ public: css::uno::Reference const & xContext, css::uno::Reference const & xDialogModel, + ::boost::shared_ptr< ::std::vector< ::rtl::OUString > >& pStyleNames, + ::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > >& pStyles, css::uno::Reference const & xDoc ) SAL_THROW( () ) : _xContext( xContext ) + , _pStyleNames( pStyleNames ) + , _pStyles( pStyles ) + , _styleNames( *_pStyleNames ) + , _styles( *_pStyles ) , _xDialogModel( xDialogModel ) , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc ) { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() && _xContext.is() ); } + inline DialogImport( const DialogImport& rOther ) : DialogImport_Base() + , _xContext( rOther._xContext ) + , _xSupplier( rOther._xSupplier ) + , _pStyleNames( rOther._pStyleNames ) + , _pStyles( rOther._pStyles ) + , _styleNames( *_pStyleNames ) + , _styles( *_pStyles ) + , _xDialogModel( rOther._xDialogModel ) + , _xDialogModelFactory( rOther._xDialogModelFactory ) + , _xDoc( rOther._xDoc ) + , XMLNS_DIALOGS_UID( rOther.XMLNS_DIALOGS_UID ) + , XMLNS_SCRIPT_UID( rOther.XMLNS_SCRIPT_UID ) {} + virtual ~DialogImport() SAL_THROW( () ); @@ -365,6 +387,9 @@ protected: ::rtl::OUString getControlId( css::uno::Reference const & xAttributes ); + ::rtl::OUString getControlModelName( + rtl::OUString const& rDefaultModel, + css::uno::Reference const & xAttributes ); css::uno::Reference< css::xml::input::XElement > getStyle( css::uno::Reference const & xAttributes ); public: @@ -435,6 +460,8 @@ public: bool importVerticalAlignProperty( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName, css::uno::Reference const & xAttributes ); + bool importImageURLProperty( rtl::OUString const & rPropName, rtl::OUString const & rAttrName, + css::uno::Reference< css::xml::input::XAttributes > const & xAttributes ); bool importImageAlignProperty( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName, css::uno::Reference const & xAttributes ); @@ -459,6 +486,9 @@ public: bool importSelectionTypeProperty( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName, css::uno::Reference const & xAttributes ); + bool importDataAwareProperty( + ::rtl::OUString const & rPropName, + css::uno::Reference const & xAttributes ); }; //============================================================================== @@ -474,6 +504,14 @@ public: pImport->_xDialogModelFactory->createInstance( rControlName ), css::uno::UNO_QUERY_THROW ), rId ) {} + inline ControlImportContext( + DialogImport * pImport, + const css::uno::Reference< css::beans::XPropertySet >& xProps, ::rtl::OUString const & rControlName ) + : ImportContext( + pImport, + xProps, + rControlName ) + {} inline ~ControlImportContext() { _pImport->_xDialogModel->insertByName( @@ -1004,6 +1042,7 @@ public: }; //============================================================================== + class SpinButtonElement : public ControlElement { @@ -1039,14 +1078,70 @@ public: 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 ) + { + m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ), css::uno::UNO_QUERY ); + } +private: + css::uno::Reference< css::container::XNameContainer > m_xContainer; +}; + +//============================================================================== +class Frame + : public ControlElement +{ + ::rtl::OUString _label; +public: + virtual css::uno::Reference< css::xml::input::XElement > + SAL_CALL startChildElement( + sal_Int32 nUid, ::rtl::OUString const & rLocalName, + css::uno::Reference const & xAttributes ) + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + virtual void SAL_CALL endElement() + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + + inline Frame( ::rtl::OUString const & rLocalName, css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) SAL_THROW( () ) : ControlElement( rLocalName, xAttributes, pParent, pImport ) {} +private: + css::uno::Reference< css::container::XNameContainer > m_xContainer; }; +//============================================================================== +class Page + : public ControlElement +{ +public: + virtual css::uno::Reference< css::xml::input::XElement > + SAL_CALL startChildElement( + sal_Int32 nUid, ::rtl::OUString const & rLocalName, + css::uno::Reference const & xAttributes ) + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + virtual void SAL_CALL endElement() + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + + inline Page( + ::rtl::OUString const & rLocalName, + css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + SAL_THROW( () ) + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + { + m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ), css::uno::UNO_QUERY ); + } +private: + css::uno::Reference< css::container::XNameContainer > m_xContainer; +}; + + class ProgressBarElement : public ControlElement { diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index a2abb08d5c0f..2d955fd5c5d5 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -39,8 +39,7 @@ #include #include #include -#include - +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -49,66 +48,6 @@ 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 ) { @@ -138,7 +77,9 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style ) void ElementDescriptor::readMultiPageModel( StyleBag * all_styles ) { // collect styles - Style aStyle( 0x2 | 0x8 | 0x20 ); + Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) @@ -153,24 +94,101 @@ void ElementDescriptor::readMultiPageModel( StyleBag * all_styles ) // collect elements readDefaults(); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) ); + bool bDecoration = sal_True; + if ( (aDecorationAny >>= bDecoration) && !bDecoration ) + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtabs") ), OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) ); + + readEvents(); + uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY ); + if ( xPagesContainer.is() && xPagesContainer->getElementNames().getLength() ) + { + ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument ); + pElem->readBullitinBoard( all_styles ); + addSubElement( pElem ); + } +} +//__________________________________________________________________________________________________ +void ElementDescriptor::readFrameModel( StyleBag * all_styles ) +{ + // collect styles + Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); +/* + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; +*/ + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + // collect elements + readDefaults(); OUString aTitle; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle) + + if ( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle) { ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument ); title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), aTitle ); addSubElement( title ); } + uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY ); + if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() ) + { + ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument ); + pElem->readBullitinBoard( all_styles ); + addSubElement( pElem ); + } + readEvents(); +} +//__________________________________________________________________________________________________ +void ElementDescriptor::readPageModel( StyleBag * all_styles ) +{ + // collect styles + Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + rtl::OUString aTitle; + readStringAttr( + OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); + uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY ); + if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() ) + { + ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument ); + pElem->readBullitinBoard( all_styles ); + addSubElement( pElem ); + } readEvents(); } + void ElementDescriptor::readButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { @@ -204,8 +222,10 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) ); readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + + readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) ); readImageAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ), @@ -275,8 +295,8 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), @@ -312,7 +332,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) +void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles @@ -354,7 +374,9 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) ); // Cell Range, Ref Cell etc. - lclExportBindableAndListSourceBits( xDocument, _xProps, *this ); + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); + readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") ); + // string item list Sequence< OUString > itemValues; if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) && @@ -362,14 +384,14 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra { ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument ); OUString const * pItemValues = itemValues.getConstArray(); for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos ) { ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument ); item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), pItemValues[ nPos ] ); popup->addSubElement( item ); @@ -380,7 +402,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) +void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles @@ -415,7 +437,8 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram 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 ); + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); + readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") ); // string item list Sequence< OUString > itemValues; if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) && @@ -423,7 +446,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram { ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument ); OUString const * pItemValues = itemValues.getConstArray(); sal_Int32 nPos; @@ -431,7 +454,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram { ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument ); item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), pItemValues[ nPos ] ); popup->addSubElement( item ); @@ -455,7 +478,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) +void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles @@ -486,8 +509,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), @@ -513,7 +536,7 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< break; } } - lclExportBindableAndListSourceBits( xDocument, _xProps, *this ); + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); readEvents(); } //__________________________________________________________________________________________________ @@ -542,7 +565,7 @@ void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles ) { ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument ); title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), aTitle ); addSubElement( title ); @@ -683,10 +706,11 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":echochar") ), OUString( &cEcho, 1 ) ); } + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument ) +void ElementDescriptor::readImageControlModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles @@ -705,33 +729,10 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun:: readDefaults(); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) ); - 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") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) ); readEvents(); } //__________________________________________________________________________________________________ @@ -1151,6 +1152,45 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) readEvents(); } + +void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles ) + SAL_THROW( (Exception) ) +{ + // collect styles + Style aStyle( 0x1 | 0x4 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readBorderProps( this, aStyle )) + aStyle._set |= 0x4; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("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") ) ); + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); + readEvents(); +} + //__________________________________________________________________________________________________ void ElementDescriptor::readFixedLineModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) @@ -1206,7 +1246,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles ) readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument ) +void ElementDescriptor::readScrollBarModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles @@ -1244,47 +1284,7 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< fr 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 ); + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); readEvents(); } //__________________________________________________________________________________________________ @@ -1340,6 +1340,251 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles ) readEvents(); } +void ElementDescriptor::readBullitinBoard( StyleBag * all_styles ) + SAL_THROW( (Exception) ) +{ + // collect elements + ::std::vector< ElementDescriptor* > all_elements; + // read out all props + Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY ); + if ( !xDialogModel.is() ) + return; // #TODO throw??? + Sequence< OUString > aElements( xDialogModel->getElementNames() ); + OUString const * pElements = aElements.getConstArray(); + + ElementDescriptor * pRadioGroup = 0; + + sal_Int32 nPos; + for ( nPos = 0; nPos < aElements.getLength(); ++nPos ) + { + Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) ); + Reference< beans::XPropertySet > xProps; + OSL_VERIFY( aControlModel >>= xProps ); + if (! xProps.is()) + continue; + Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); + OSL_ENSURE( xPropState.is(), "no XPropertyState!" ); + if (! xPropState.is()) + continue; + Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY ); + OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" ); + if (! xServiceInfo.is()) + continue; + + ElementDescriptor * pElem = 0; + + // group up radio buttons + if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) + { + if (! pRadioGroup) // open radiogroup + { + pRadioGroup = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ), _xDocument ); + all_elements.push_back( pRadioGroup ); + } + + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ), _xDocument ); + pElem->readRadioButtonModel( all_styles ); + pRadioGroup->addSubElement( pElem ); + } + else // no radio + { + pRadioGroup = 0; // close radiogroup + + if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ), _xDocument ); + pElem->readButtonModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ), _xDocument ); + pElem->readCheckBoxModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ), _xDocument ); + pElem->readComboBoxModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ), _xDocument ); + pElem->readListBoxModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ), _xDocument ); + 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") ), _xDocument ); + pElem->readMultiPageModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":frame") ), _xDocument ); + pElem->readFrameModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ), _xDocument ); + pElem->readPageModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ), _xDocument ); + pElem->readFixedTextModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ), _xDocument ); + pElem->readEditModel( all_styles ); + } + // FixedHyperLink + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ), _xDocument ); + pElem->readFixedHyperLinkModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ), _xDocument ); + pElem->readImageControlModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ), _xDocument ); + pElem->readFileControlModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ), _xDocument ); + pElem->readTreeControlModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ), _xDocument ); + pElem->readCurrencyFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ), _xDocument ); + pElem->readDateFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ), _xDocument ); + pElem->readNumericFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) , _xDocument); + pElem->readTimeFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ), _xDocument ); + pElem->readPatternFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ), _xDocument ); + pElem->readFormattedFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ), _xDocument ); + pElem->readFixedLineModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ), _xDocument ); + pElem->readScrollBarModel( all_styles ); + } + 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") ), _xDocument ); + pElem->readSpinButtonModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ), _xDocument ); + pElem->readProgressBarModel( all_styles ); + } + // + + if (pElem) + { + all_elements.push_back( pElem ); + } + else + { + OSL_ENSURE( sal_False, "unknown control type!" ); + continue; + } + } + } + if (! all_elements.empty()) + { + for ( std::size_t n = 0; n < all_elements.size(); ++n ) + { + addSubElement( all_elements[ n ] ); + } + } +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index cec44ca50a04..4ae2ebdabc11 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -47,6 +47,8 @@ #include #include +#include + #include #include @@ -58,6 +60,17 @@ #include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -777,6 +790,33 @@ void ElementDescriptor::readVerticalAlignAttr( OUString const & rPropName, OUStr } } //__________________________________________________________________________________________________ +void ElementDescriptor::readImageURLAttr( OUString const & rPropName, OUString const & rAttrName ) +{ + if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) + { + rtl::OUString sURL; + _xProps->getPropertyValue( rPropName ) >>= sURL; + + if ( sURL.getLength() && sURL.compareToAscii( XMLSCRIPT_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( XMLSCRIPT_GRAPHOBJ_URLPREFIX ) ) == 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() ) + addAttribute( rAttrName, sURL ); + } +} +//__________________________________________________________________________________________________ void ElementDescriptor::readImageAlignAttr( OUString const & rPropName, OUString const & rAttrName ) { if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) @@ -940,6 +980,66 @@ void ElementDescriptor::readLineEndFormatAttr( OUString const & rPropName, OUStr } } //__________________________________________________________________________________________________ +void ElementDescriptor::readDataAwareAttr( OUString const & rAttrName ) +{ + 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() && rAttrName.equals( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ) ) + { + 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 ) + addAttribute( rAttrName, 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() && rAttrName.equals( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") ) ) + { + 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 ) + addAttribute( rAttrName, sAddress ); + } + catch( uno::Exception& ) + { + } + } + } +} +//__________________________________________________________________________________________________ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUString const & rAttrName ) { if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) @@ -976,6 +1076,28 @@ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUStr void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible ) { Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) ); + + // The following is a hack to allow 'form' controls to override the default + // control supported by dialogs. This should work well for both vba support and + // normal openoffice ( when normal 'Dialogs' decide to support form control models ) + // In the future VBA support might require custom models ( and not the just the form + // variant of a control that we currently use ) In this case the door is still open, + // we just need to define a new way for the 'ServiceName' to be extracted from the + // incomming model. E.g. the use of supporting service + // "com.sun.star.form.FormComponent", 'ServiceName' and XPersistObject + // is only an implementation detail here, in the future some other + // method ( perhaps a custom prop ) could be used instead. + Reference< lang::XServiceInfo > xSrvInfo( _xProps, UNO_QUERY ); + if ( xSrvInfo.is() && xSrvInfo->supportsService( OUSTR("com.sun.star.form.FormComponent" ) ) ) + { + Reference< io::XPersistObject > xPersist( _xProps, UNO_QUERY ); + if ( xPersist.is() ) + { + OUString sCtrlName = xPersist->getServiceName(); + if ( sCtrlName.getLength() ) + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":control-implementation") ), sCtrlName ); + } + } addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), * reinterpret_cast< const OUString * >( a.getValue() ) ); readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ), @@ -1331,248 +1453,17 @@ void SAL_CALL exportDialogModel( SAL_THROW( (Exception) ) { StyleBag all_styles; - ::std::vector< Reference< xml::sax::XAttributeList > > all_elements; - - // read out all props - - Sequence< OUString > aElements( xDialogModel->getElementNames() ); - OUString const * pElements = aElements.getConstArray(); - - ElementDescriptor * pRadioGroup = 0; - - sal_Int32 nPos; - for ( nPos = 0; nPos < aElements.getLength(); ++nPos ) - { - Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) ); - Reference< beans::XPropertySet > xProps; - OSL_VERIFY( aControlModel >>= xProps ); - if (! xProps.is()) - continue; - Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); - OSL_ENSURE( xPropState.is(), "no XPropertyState!" ); - if (! xPropState.is()) - continue; - Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY ); - OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" ); - if (! xServiceInfo.is()) - continue; - - ElementDescriptor * pElem = 0; - Reference< xml::sax::XAttributeList > xElem; - - // group up radio buttons - if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) - { - if (! pRadioGroup) // open radiogroup - { - pRadioGroup = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ) ); - all_elements.push_back( pRadioGroup ); - } - - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readRadioButtonModel( &all_styles, xDocument ); - pRadioGroup->addSubElement( xElem ); - } - else // no radio - { - pRadioGroup = 0; // close radiogroup + // window + Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY ); + OSL_ASSERT( xProps.is() ); + Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); + OSL_ASSERT( xPropState.is() ); - if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readButtonModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readCheckBoxModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readComboBoxModel( &all_styles, xDocument ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readListBoxModel( &all_styles, xDocument ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readGroupBoxModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.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( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFixedTextModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readEditModel( &all_styles ); - } - // FixedHyperLink - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFixedHyperLinkModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readImageControlModel( &all_styles, xDocument ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFileControlModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readTreeControlModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readCurrencyFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readDateFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readNumericFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) ) - { - pElem = new ElementDescriptor( + ElementDescriptor * pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readTimeFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readPatternFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFormattedFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFixedLineModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readScrollBarModel( &all_styles, 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") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readProgressBarModel( &all_styles ); - } - // - - OSL_ASSERT( xElem.is() ); - if (xElem.is()) - { - all_elements.push_back( xElem ); - } - else - { - OSL_ENSURE( sal_False, "unknown control type!" ); - continue; - } - } - } + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), xDocument ); + Reference< xml::sax::XAttributeList > xElem( pElem ); + pElem->readBullitinBoard( &all_styles ); xOut->startDocument(); @@ -1582,14 +1473,9 @@ void SAL_CALL exportDialogModel( xOut->unknown( aDocTypeStr ); xOut->ignorableWhitespace( OUString() ); - // window - Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); - OSL_ASSERT( xPropState.is() ); OUString aWindowName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":window") ); - ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName ); + ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName, xDocument ); Reference< xml::sax::XAttributeList > xWindow( pWindow ); pWindow->readDialogModel( &all_styles ); xOut->ignorableWhitespace( OUString() ); @@ -1599,20 +1485,14 @@ void SAL_CALL exportDialogModel( // dump out stylebag all_styles.dump( xOut ); - if (! all_elements.empty()) + if ( xDialogModel->getElementNames().getLength() ) { // open up bulletinboard OUString aBBoardName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ); xOut->ignorableWhitespace( OUString() ); - xOut->startElement( aBBoardName, Reference< xml::sax::XAttributeList >() ); - - // export control elements - for ( std::size_t n = 0; n < all_elements.size(); ++n ) - { - ElementDescriptor * pElem = static_cast< ElementDescriptor * >( all_elements[ n ].get() ); - pElem->dump( xOut.get() ); - } + xOut->startElement( aBBoardName, xElem ); + pElem->dumpSubElements( xOut.get() ); // end bulletinboard xOut->ignorableWhitespace( OUString() ); xOut->endElement( aBBoardName ); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index 901aeac8127a..4baa8f2a9710 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -49,30 +49,102 @@ using ::rtl::OUString; namespace xmlscript { -Reference< xml::input::XElement > MultiPage::startChildElement( + +Reference< xml::input::XElement > Frame::startChildElement( sal_Int32 nUid, OUString const & rLocalName, Reference< xml::input::XAttributes > const & xAttributes ) - throw (xml::sax::SAXException, RuntimeException) + throw (xml::sax::SAXException, RuntimeException) { + if ( !m_xContainer.is() ) + m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ), UNO_QUERY ); // event -rtl::OUString _label = rtl::OUString::createFromAscii("foo"); if (_pImport->isEventElement( nUid, rLocalName )) { - return new EventElement( + return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) + { + // Create new DialogImport for this container + DialogImport* pFrameImport = new DialogImport( *_pImport ); + pFrameImport->_xDialogModel = m_xContainer; + return new BulletinBoardElement( rLocalName, xAttributes, this, pFrameImport ); + } else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") )) { getStringAttr( &_label, - OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), - xAttributes, - _pImport->XMLNS_DIALOGS_UID ); + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + xAttributes, + _pImport->XMLNS_DIALOGS_UID ); return new ElementBase( _pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, _pImport ); } else + { + OSL_TRACE("****** ARGGGGG!!!! **********"); + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ + +void Frame::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + if ( !m_xContainer.is() ) + m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ), UNO_QUERY ); + Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW ); + // _pImport is what we need to add to ( e.g. the dialog in this case ) + ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) ); + + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement + if (_label.getLength()) + { + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), + makeAny( _label ) ); + } + ctx.importEvents( _events ); + // avoid ring-reference: + // vector< event elements > holding event elements holding this (via _pParent) + _events.clear(); +} + +//=== +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("bulletinboard") )) + { + // Create new DialogImport for this container + + DialogImport* pMultiPageImport = new DialogImport( *_pImport ); + pMultiPageImport->_xDialogModel = m_xContainer; + return new BulletinBoardElement( rLocalName, xAttributes, this, pMultiPageImport ); + } + else { throw xml::sax::SAXException( @@ -85,10 +157,10 @@ rtl::OUString _label = rtl::OUString::createFromAscii("foo"); 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 > xProps( m_xContainer, UNO_QUERY_THROW ); + // _pImport is what we need to add to ( e.g. the dialog in this case ) + ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes )); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -98,125 +170,76 @@ void MultiPage::endElement() pStyle->importTextColorStyle( xControlModel ); pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); + pStyle->importBackgroundColorStyle( xControlModel ); } ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement - ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), _xAttributes ); - ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), - _xAttributes ); + ctx.importBooleanProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("withtabs") ), + _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 ) +Reference< xml::input::XElement > Page::startChildElement( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::input::XAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) { - // 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; + // event + if (_pImport->isEventElement( nUid, rLocalName )) + { + return new EventElement( + nUid, rLocalName, xAttributes, this, _pImport ); + } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) + { + + DialogImport* pPageImport = new DialogImport( *_pImport ); + pPageImport->_xDialogModel = m_xContainer; + return new BulletinBoardElement( rLocalName, xAttributes, this, pPageImport ); } + else + { - return true; + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } } +//__________________________________________________________________________________________________ -void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx ) +void Page::endElement() + throw (xml::sax::SAXException, RuntimeException) { - 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; + Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW ); - uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY ); - xBindable->setValueBinding( xBinding ); + ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes )); - } - } - // 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 ); - - } - } - } -} + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); -sal_Bool isVBACompatibilityMode( DialogImport* _pImport ) -{ - sal_Bool bVBAMode = sal_False; - Reference< script::vba::XVBACompatibility > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY ); - if( xVBACompat.is() ) + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) { - bVBAMode = xVBACompat->getVBACompatibilityMode(); + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + pStyle->importBackgroundColorStyle( xControlModel ); } - return bVBAMode; + + ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), OUString( RTL_CONSTASCII_USTRINGPARAM("title") ), _xAttributes ); + ctx.importEvents( _events ); + // avoid ring-reference: + // vector< event elements > holding event elements holding this (via _pParent) + _events.clear(); } // progessmeter @@ -298,23 +321,9 @@ 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 ), - sService ); + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ), _xAttributes ) ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -358,10 +367,7 @@ void ScrollBarElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ), _xAttributes ); - // import cell-link - OUString sCellRange; - importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); - + ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -393,18 +399,9 @@ Reference< xml::input::XElement > SpinButtonElement::startChildElement( 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") ) ); + _pImport, getControlId( _xAttributes ), + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ), _xAttributes ) ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -417,33 +414,25 @@ void SpinButtonElement::endElement() ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), - _xAttributes ); + OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), + _xAttributes ); ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ), - _xAttributes ); + OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ), + _xAttributes ); ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ), - _xAttributes ); + OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ),_xAttributes ); ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ), - _xAttributes ); + OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ), _xAttributes ); ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"), - _xAttributes ); - ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"), - _xAttributes ); + _xAttributes ); + ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"), _xAttributes ); ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"), - _xAttributes ); +_xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), - _xAttributes ); + 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 ); - + OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ), _xAttributes ); + ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -746,6 +735,7 @@ void FormattedFieldElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ), _xAttributes ); + ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -1285,34 +1275,7 @@ void ImageControlElement::endElement() 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.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "src" ), _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), _xAttributes ); @@ -1645,24 +1608,10 @@ void TitledBoxElement::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 ), - sService ); + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ), xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); @@ -1689,9 +1638,7 @@ void TitledBoxElement::endElement() ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes ); ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), xAttributes ); @@ -1714,7 +1661,7 @@ void TitledBoxElement::endElement() } xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); - importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); + ctx.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes ); ::std::vector< Reference< xml::input::XElement > > * radioEvents = static_cast< RadioElement * >( xRadio.get() )->getEvents(); ctx.importEvents( *radioEvents ); @@ -1790,23 +1737,10 @@ 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 ), - sService ); + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ), xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); @@ -1833,9 +1767,7 @@ void RadioGroupElement::endElement() ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), xAttributes ); ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), xAttributes ); @@ -1858,7 +1790,8 @@ void RadioGroupElement::endElement() xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); - importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx ); + ctx.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes ); + ::std::vector< Reference< xml::input::XElement > > * radioEvents = static_cast< RadioElement * >( xRadio.get() )->getEvents(); ctx.importEvents( *radioEvents ); @@ -1979,26 +1912,10 @@ 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") ) ); - sListBoxService ); + + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ), _xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -2031,17 +1948,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 ); + bool bHasLinkedCell = ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); + bool bHasSrcRange = ctx.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes ); if (_popup.is()) { MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() ); - if ( !sCellRange.getLength() ) - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), - makeAny( p->getItemValues() ) ); - if ( !sLinkedCell.getLength() ) - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ), - makeAny( p->getSelectedItems() ) ); + if ( !bHasSrcRange ) + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), makeAny( p->getItemValues() ) ); + if ( !bHasLinkedCell ) + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ), makeAny( p->getSelectedItems() ) ); + } ctx.importEvents( _events ); // avoid ring-reference: @@ -2086,26 +2002,9 @@ 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 ), - sService ); + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ), _xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -2147,10 +2046,9 @@ void ComboBoxElement::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() && !sCellRange.getLength() ) + ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); + bool bHasSrcRange = ctx.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes ); + if (_popup.is() && !bHasSrcRange ) { MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() ); xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), @@ -2217,9 +2115,7 @@ void CheckBoxElement::endElement() ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - _xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes ); ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), _xAttributes ); @@ -2320,9 +2216,7 @@ void ButtonElement::endElement() ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ), OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ), _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - _xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes ); ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), _xAttributes ); @@ -2477,7 +2371,7 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement( return new ScrollBarElement( rLocalName, xAttributes, this, _pImport ); } // spinbutton - else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatibilityMode( _pImport ) ) + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) ) { return new SpinButtonElement( rLocalName, xAttributes, this, _pImport ); } @@ -2490,6 +2384,14 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement( { return new MultiPage( rLocalName, xAttributes, this, _pImport ); } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("frame") )) + { + return new Frame( rLocalName, xAttributes, this, _pImport ); + } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("page") )) + { + return new Page( rLocalName, xAttributes, this, _pImport ); + } // bulletinboard else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) { @@ -2665,10 +2567,7 @@ void WindowElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ), OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ), _xAttributes ); - ctx.importStringProperty( - OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - _xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 81ba97c6a955..02a74f2be0cb 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -58,10 +58,20 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; @@ -129,6 +139,20 @@ OUString ControlElement::getControlId( return aId; } +OUString ControlElement::getControlModelName( + OUString const& rDefaultModel, + Reference< xml::input::XAttributes > const & xAttributes ) +{ + OUString aModel; + aModel = xAttributes->getValueByUidName( + _pImport->XMLNS_DIALOGS_UID, + OUString( RTL_CONSTASCII_USTRINGPARAM("control-implementation") ) ); + if (! aModel.getLength()) + aModel = rDefaultModel; + return aModel; +} + + //################################################################################################## //__________________________________________________________________________________________________ @@ -820,6 +844,7 @@ bool ImportContext::importDoubleProperty( } return false; } + //__________________________________________________________________________________________________ bool ImportContext::importBooleanProperty( OUString const & rPropName, OUString const & rAttrName, @@ -971,6 +996,115 @@ bool ImportContext::importVerticalAlignProperty( return false; } //__________________________________________________________________________________________________ +bool ImportContext::importImageURLProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::input::XAttributes > const & xAttributes ) +{ + rtl::OUString sURL = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rAttrName ); + if ( sURL.getLength() ) + { + Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY ); + + uno::Reference< document::XGraphicObjectResolver > xGraphicResolver; + if ( xDocStorage.is() ) + { + uno::Sequence< Any > aArgs( 1 ); + aArgs[ 0 ] <<= xDocStorage->getDocumentStorage(); + ::comphelper::ComponentContext aContext( _pImport->getComponentContext() ); + 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; + try + { + aTmp = xGraphicResolver->resolveGraphicObjectURL( aTmp ); + if ( aTmp.getLength() ) + sURL = aTmp; + } + catch( uno::Exception& e ) + { + (void)e; + return false; + } + + } + } + if ( sURL.getLength() > 0 ) + { + Reference< beans::XPropertySet > xProps( getControlModel(), UNO_QUERY ); + if ( xProps.is() ) + { + xProps->setPropertyValue( rPropName, makeAny( sURL ) ); + return true; + } + } + } + return false; +} +//__________________________________________________________________________________________________ + bool ImportContext::importDataAwareProperty( + ::rtl::OUString const & rPropName, + Reference const & xAttributes ) +{ + OUString sLinkedCell; + OUString sCellRange; + if ( rPropName.equals( OUSTR("linked-cell" ) ) ) + sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rPropName ); + if ( rPropName.equals( OUSTR( "source-cell-range" ) ) ) + sCellRange = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rPropName ); + bool bRes = false; + 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( 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 ); + bRes = true; + } + } + // Set up CelllRange + if ( sCellRange.getLength() ) + { + Reference< form::binding::XListEntrySink > xListEntrySink( 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 ); + bRes = true; + } + } + } + return bRes; +} +//__________________________________________________________________________________________________ bool ImportContext::importImageAlignProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::input::XAttributes > const & xAttributes ) @@ -1921,11 +2055,13 @@ Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel( Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { - DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument ); - return ::xmlscript::createDocumentHandler( - static_cast< xml::input::XRoot * >( pImport ) ); + // single set of styles and stylenames apply to all containees + :: boost::shared_ptr< ::std::vector< ::rtl::OUString > > pStyleNames( new ::std::vector< ::rtl::OUString > ); + :: boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > > pStyles( new ::std::vector< css::uno::Reference< css::xml::input::XElement > > ); + return ::xmlscript::createDocumentHandler( + static_cast< xml::input::XRoot * >( + new DialogImport( xContext, xDialogModel, pStyleNames, pStyles, xDocument ) ) ); } - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit