From 4d9f54e9f020c91c7fda048bcf3f7549d58bc2b4 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 11 Aug 2010 14:24:53 +0200 Subject: dr77: move code that binds controls to sheet source, ported from cws container_controls --- oox/source/ole/vbacontrol.cxx | 53 ++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'oox/source/ole/vbacontrol.cxx') diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 6ea28f424a83..206bff087e00 100755 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -26,17 +26,16 @@ ************************************************************************/ #include "oox/ole/vbacontrol.hxx" + #include #include -#include #include #include #include #include #include +#include #include -#include "properties.hxx" -#include "tokens.hxx" #include "oox/helper/attributelist.hxx" #include "oox/helper/binaryinputstream.hxx" #include "oox/helper/propertymap.hxx" @@ -44,25 +43,26 @@ #include "oox/helper/storagebase.hxx" #include "oox/helper/textinputstream.hxx" #include "oox/ole/vbahelper.hxx" - -using ::rtl::OUString; -using ::rtl::OUStringBuffer; -using ::com::sun::star::awt::XControlModel; -using ::com::sun::star::container::XNameContainer; -using ::com::sun::star::io::XInputStreamProvider; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::uno::Any; -using ::com::sun::star::uno::Exception; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::UNO_QUERY_THROW; -using ::com::sun::star::uno::UNO_SET_THROW; -using ::com::sun::star::uno::XComponentContext; +#include "properties.hxx" +#include "tokens.hxx" namespace oox { namespace ole { // ============================================================================ +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + +// ============================================================================ + namespace { const sal_uInt16 VBA_SITE_CLASSIDINDEX = 0x8000; @@ -220,8 +220,8 @@ bool VbaSiteModel::importBinaryModel( BinaryInputStream& rInStrm ) aReader.skipUndefinedProperty(); aReader.readStringProperty( maToolTip ); aReader.skipStringProperty(); // license key - aReader.readStringProperty( maLinkedCell ); - aReader.readStringProperty( maSourceRange ); + aReader.readStringProperty( maControlSource ); + aReader.readStringProperty( maRowSource ); return aReader.finalizeImport(); } @@ -337,6 +337,11 @@ void VbaSiteModel::convertProperties( PropertyMap& rPropMap, } } +void VbaSiteModel::bindToSources( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv ) const +{ + rConv.bindToSources( rxCtrlModel, maControlSource, maRowSource ); +} + // ============================================================================ VbaFormControl::VbaFormControl() @@ -727,18 +732,20 @@ OUString lclGetQuotedString( const OUString& rCodeLine ) // ---------------------------------------------------------------------------- VbaUserForm::VbaUserForm( const Reference< XMultiServiceFactory >& rxGlobalFactory, - const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) : - ControlConverter( rGraphicHelper, bDefaultColorBgr ), - mxGlobalFactory( rxGlobalFactory ) + const Reference< XModel >& rxDocModel, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) : + mxGlobalFactory( rxGlobalFactory ), + mxDocModel( rxDocModel ), + maConverter( rxDocModel, rGraphicHelper, bDefaultColorBgr ) { OSL_ENSURE( mxGlobalFactory.is(), "VbaUserForm::VbaUserForm - missing service factory" ); + OSL_ENSURE( mxDocModel.is(), "VbaUserForm::VbaUserForm - missing document model" ); } void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc ) { OSL_ENSURE( rxDialogLib.is(), "VbaUserForm::importForm - missing dialog library" ); - if( !mxGlobalFactory.is() || !rxDialogLib.is() ) + if( !mxGlobalFactory.is() || !mxDocModel.is() || !rxDialogLib.is() ) return; // check that the '03VBFrame' stream exists, this is required for forms @@ -800,7 +807,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, Reference< XNameContainer > xDialogNC( xDialogModel, UNO_QUERY_THROW ); // convert properties and embedded controls - if( convertProperties( xDialogModel, *this, 0 ) ) + if( convertProperties( xDialogModel, maConverter, 0 ) ) { // export the dialog to XML and insert it into the dialog library PropertySet aFactoryProps( mxGlobalFactory ); -- cgit From c29c922edb2ae9454e86e9f99d55ba005132194e Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 30 Aug 2010 16:10:01 +0200 Subject: dr77: change all exported services in oox module from MultiServiceFactory to ComponentContext --- oox/source/ole/vbacontrol.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'oox/source/ole/vbacontrol.cxx') diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 206bff087e00..9532cbcd8678 100755 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -731,13 +731,13 @@ OUString lclGetQuotedString( const OUString& rCodeLine ) // ---------------------------------------------------------------------------- -VbaUserForm::VbaUserForm( const Reference< XMultiServiceFactory >& rxGlobalFactory, +VbaUserForm::VbaUserForm( const Reference< XComponentContext >& rxContext, const Reference< XModel >& rxDocModel, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) : - mxGlobalFactory( rxGlobalFactory ), + mxCompContext( rxContext ), mxDocModel( rxDocModel ), maConverter( rxDocModel, rGraphicHelper, bDefaultColorBgr ) { - OSL_ENSURE( mxGlobalFactory.is(), "VbaUserForm::VbaUserForm - missing service factory" ); + OSL_ENSURE( mxCompContext.is(), "VbaUserForm::VbaUserForm - missing component context" ); OSL_ENSURE( mxDocModel.is(), "VbaUserForm::VbaUserForm - missing document model" ); } @@ -745,7 +745,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc ) { OSL_ENSURE( rxDialogLib.is(), "VbaUserForm::importForm - missing dialog library" ); - if( !mxGlobalFactory.is() || !mxDocModel.is() || !rxDialogLib.is() ) + if( !mxCompContext.is() || !mxDocModel.is() || !rxDialogLib.is() ) return; // check that the '03VBFrame' stream exists, this is required for forms @@ -803,16 +803,15 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, { // create the dialog model OUString aServiceName = mxCtrlModel->getServiceName(); - Reference< XControlModel > xDialogModel( mxGlobalFactory->createInstance( aServiceName ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( mxCompContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XControlModel > xDialogModel( xFactory->createInstance( aServiceName ), UNO_QUERY_THROW ); Reference< XNameContainer > xDialogNC( xDialogModel, UNO_QUERY_THROW ); // convert properties and embedded controls if( convertProperties( xDialogModel, maConverter, 0 ) ) { // export the dialog to XML and insert it into the dialog library - PropertySet aFactoryProps( mxGlobalFactory ); - Reference< XComponentContext > xCompContext( aFactoryProps.getAnyProperty( PROP_DefaultContext ), UNO_QUERY_THROW ); - Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, xCompContext ), UNO_SET_THROW ); + Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, mxCompContext ), UNO_SET_THROW ); OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" ); ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) ); } -- cgit From 6cafb68322fa85a54a6fa1ca47239af459f519ce Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 8 Nov 2010 13:47:01 +0100 Subject: dr77: optimizations in generation of XML tokens, XML namespaces, property names; code cleanup --- oox/source/ole/vbacontrol.cxx | 2 -- 1 file changed, 2 deletions(-) (limited to 'oox/source/ole/vbacontrol.cxx') diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 684b40d1ad19..dc86c2dd82e5 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -43,8 +43,6 @@ #include "oox/helper/storagebase.hxx" #include "oox/helper/textinputstream.hxx" #include "oox/ole/vbahelper.hxx" -#include "properties.hxx" -#include "tokens.hxx" namespace oox { namespace ole { -- cgit From 32bb320ed0e4c52a7adf84d13a8066877adceb54 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 9 Nov 2010 10:52:14 +0100 Subject: dr77: more cleanup: remove RecordInputStream, cleanup ContainerHelper --- oox/source/ole/vbacontrol.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'oox/source/ole/vbacontrol.cxx') diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index dc86c2dd82e5..39deb77576d9 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -38,6 +38,7 @@ #include #include "oox/helper/attributelist.hxx" #include "oox/helper/binaryinputstream.hxx" +#include "oox/helper/containerhelper.hxx" #include "oox/helper/propertymap.hxx" #include "oox/helper/propertyset.hxx" #include "oox/helper/storagebase.hxx" -- cgit From 84660a54284fe27d294daa11490edbaa81b32376 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Sun, 13 Mar 2011 05:36:33 -0500 Subject: fix mis-merge in oox --- oox/source/ole/vbacontrol.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'oox/source/ole/vbacontrol.cxx') diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 5b4a6346397d..8fd6a2cd50e4 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -804,8 +804,10 @@ VbaUserForm::VbaUserForm( const Reference< XComponentContext >& rxContext, OSL_ENSURE( mxDocModel.is(), "VbaUserForm::VbaUserForm - missing document model" ); } -void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, - StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc ) +void VbaUserForm::importForm( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel, + const Reference< XNameContainer >& rxDialogLib, + StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc ) { OSL_ENSURE( rxDialogLib.is(), "VbaUserForm::importForm - missing dialog library" ); if( !mxCompContext.is() || !mxDocModel.is() || !rxDialogLib.is() ) @@ -874,7 +876,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, if( convertProperties( xDialogModel, maConverter, 0 ) ) { // export the dialog to XML and insert it into the dialog library - Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, xCompContext, rxDocModel ), UNO_SET_THROW ); + Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, mxCompContext, rxDocModel ), UNO_SET_THROW ); OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" ); ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) ); } -- cgit