[Libreoffice-commits] .: Branch 'integration/dev300_m98' - filter/source oox/inc oox/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Fri Mar 4 12:27:55 PST 2011
filter/source/graphicfilter/egif/makefile.mk | 3
filter/source/graphicfilter/eps/makefile.mk | 1
filter/source/msfilter/mstoolbar.cxx | 6
filter/source/msfilter/msvbahelper.cxx | 4
filter/source/pdf/pdfexport.cxx | 23 -
oox/inc/oox/helper/containerhelper.hxx | 311 ---------------------------
oox/inc/oox/helper/refmap.hxx | 9
oox/inc/oox/ole/vbacontrol.hxx | 8
oox/inc/oox/ole/vbaproject.hxx | 68 +++++
oox/inc/oox/ole/vbaprojectfilter.hxx | 1
oox/source/core/filterbase.cxx | 4
oox/source/core/xmlfilterbase.cxx | 26 +-
oox/source/ole/axcontrol.cxx | 1
oox/source/ole/olehelper.cxx | 3
oox/source/ole/olestorage.cxx | 3
oox/source/ole/vbacontrol.cxx | 282 ++++++++++++++----------
oox/source/ole/vbamodule.cxx | 1
oox/source/ole/vbaproject.cxx | 46 +++
oox/source/token/makefile.mk | 1
oox/source/token/namespaces.txt | 1
oox/source/xls/commentsbuffer.cxx | 38 +--
21 files changed, 337 insertions(+), 503 deletions(-)
New commits:
commit 988804fa448879a75f1cc3cf50fdeda0f575efbb
Author: Jan Holesovsky <kendy at suse.cz>
Date: Fri Mar 4 21:26:43 2011 +0100
Much more compiles now, but still not everything :-(
diff --git a/filter/source/graphicfilter/egif/makefile.mk b/filter/source/graphicfilter/egif/makefile.mk
index 3a26053..c437c5e 100644
--- a/filter/source/graphicfilter/egif/makefile.mk
+++ b/filter/source/graphicfilter/egif/makefile.mk
@@ -43,8 +43,7 @@ CDEFS+= -DEDITDEBUG
.ENDIF
SRS1NAME=$(TARGET)
-SRC1FILES = dlgegif.src \
- egifstr.src
+SRC1FILES = dlgegif.src
.IF "$(L10N_framework)"==""
SLOFILES= \
$(EXCEPTIONSFILES) \
diff --git a/filter/source/graphicfilter/eps/makefile.mk b/filter/source/graphicfilter/eps/makefile.mk
index 8ed7f16..b6f7281 100644
--- a/filter/source/graphicfilter/eps/makefile.mk
+++ b/filter/source/graphicfilter/eps/makefile.mk
@@ -44,7 +44,6 @@ CDEFS+= -DEDITDEBUG
.ENDIF
SRS1NAME=$(TARGET)
-SRC1FILES = epsstr.src
.IF "$(L10N_framework)"==""
EXCEPTIONSFILES=$(SLO)$/eps.obj
SLOFILES = $(SLO)$/eps.obj
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 3ddeb9e..cdb63bb 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -490,9 +490,9 @@ TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std
if ( extraInfo.getOnAction().getLength() )
{
aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
- ooo::vba::VBAMacroResolvedInfo aMacroInf = ooo::vba::resolveVBAMacro( &helper.GetDocShell(), extraInfo.getOnAction(), true );
- if ( aMacroInf.IsResolved() )
- aProp.Value = helper.createCommandFromMacro( aMacroInf.ResolvedMacro() );
+ ooo::vba::MacroResolvedInfo aMacroInf = ooo::vba::resolveVBAMacro( &helper.GetDocShell(), extraInfo.getOnAction(), true );
+ if ( aMacroInf.mbFound )
+ aProp.Value = helper.createCommandFromMacro( aMacroInf.msResolvedMacro );
else
aProp.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UnResolvedMacro[" )).concat( extraInfo.getOnAction() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "]" )) );
sControlData.push_back( aProp );
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 5192005..2da4294 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -257,8 +257,8 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString&
// recursively
// assume for now that the document name is *this* document
- String sDocUrlOrPath = sMacroUrl.copy( 0, nDocSepIndex );
- sMacroUrl = sMacroUrl.copy( nDocSepIndex + 1 );
+ String sDocUrlOrPath = aMacroName.copy( 0, nDocSepIndex );
+ aMacroName = aMacroName.copy( nDocSepIndex + 1 );
OSL_TRACE("doc search, current shell is 0x%x", pShell );
SfxObjectShell* pFoundShell = NULL;
if( bSearchGlobalTemplates )
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 5872788..d977133 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -439,18 +439,17 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
}
// getting the string for the producer
String aProducer;
- ::utl::ConfigManager* pMgr = ::utl::ConfigManager::GetConfigManager();
- if ( pMgr )
- {
- Any aProductName = pMgr->GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
- ::rtl::OUString sProductName;
- aProductName >>= sProductName;
- aProducer = sProductName;
- aProductName = pMgr->GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION );
- aProductName >>= sProductName;
- aProducer.AppendAscii(" ");
- aProducer += String( sProductName );
- }
+ ::utl::ConfigManager& rMgr = ::utl::ConfigManager::GetConfigManager();
+
+ Any aProductName = rMgr.GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
+ ::rtl::OUString sProductName;
+ aProductName >>= sProductName;
+ aProducer = sProductName;
+ aProductName = rMgr.GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION );
+ aProductName >>= sProductName;
+ aProducer.AppendAscii(" ");
+ aProducer += String( sProductName );
+
aContext.DocumentInfo.Producer = aProducer;
aContext.DocumentInfo.Creator = aCreator;
diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx
index af06e8e..1e7c29d 100644
--- a/oox/inc/oox/helper/containerhelper.hxx
+++ b/oox/inc/oox/helper/containerhelper.hxx
@@ -48,317 +48,6 @@ namespace oox {
// ============================================================================
-/** Template for a vector of ref-counted objects with additional accessor functions.
-
- An instance of the class RefVector< Type > stores elements of the type
- ::boost::shared_ptr< Type >. The new accessor functions has() and get()
- work correctly for indexes out of the current range, there is no need to
- check the passed index before.
- */
-template< typename ObjType >
-class RefVector : public ::std::vector< ::boost::shared_ptr< ObjType > >
-{
-public:
- typedef ::std::vector< ::boost::shared_ptr< ObjType > > container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::size_type size_type;
-
-public:
- /** Returns true, if the object with the passed index exists. Returns
- false, if the vector element exists but is an empty reference. */
- inline bool has( sal_Int32 nIndex ) const
- {
- const value_type* pxRef = getRef( nIndex );
- return pxRef && pxRef->get();
- }
-
- /** Returns a reference to the object with the passed index, or 0 on error. */
- inline value_type get( sal_Int32 nIndex ) const
- {
- if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef;
- return value_type();
- }
-
- /** Returns the index of the last element, or -1, if the vector is empty.
- Does *not* check whether the last element is an empty reference. */
- inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; }
-
- /** Calls the passed functor for every contained object, automatically
- skips all elements that are empty references. */
- template< typename FunctorType >
- inline void forEach( FunctorType aFunctor ) const
- {
- ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType >
- inline void forEachMem( FuncType pFunc ) const
- {
- forEach( ::boost::bind( pFunc, _1 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType >
- inline void forEachMem( FuncType pFunc, ParamType aParam ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
- }
- /** Calls the passed functor for every contained object. Passes the index as
- first argument and the object reference as second argument to rFunctor. */
- template< typename FunctorType >
- inline void forEachWithIndex( const FunctorType& rFunctor ) const
- {
- ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the vector index to the member function. */
- template< typename FuncType >
- inline void forEachMemWithIndex( FuncType pFunc ) const
- {
- forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the vector index as first argument to the member function. */
- template< typename FuncType, typename ParamType >
- inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const
- {
- forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the vector index as first argument to the member function. */
- template< typename FuncType, typename ParamType1, typename ParamType2 >
- inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
- {
- forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the vector index as first argument to the member function. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
- inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
- {
- forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
- }
-
- /** Searches for an element by using the passed functor that takes a
- constant reference of the object type (const ObjType&). */
- template< typename FunctorType >
- inline value_type findIf( const FunctorType& rFunctor ) const
- {
- typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) );
- return (aIt == this->end()) ? value_type() : *aIt;
- }
-
-private:
- template< typename FunctorType >
- struct ForEachFunctor
- {
- FunctorType maFunctor;
- inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
- inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); }
- };
-
- template< typename FunctorType >
- struct ForEachFunctorWithIndex
- {
- FunctorType maFunctor;
- sal_Int32 mnIndex;
- inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {}
- inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; }
- };
-
- template< typename FunctorType >
- struct FindFunctor
- {
- FunctorType maFunctor;
- inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
- inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); }
- };
-
- inline const value_type* getRef( sal_Int32 nIndex ) const
- {
- return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ?
- &(*this)[ static_cast< size_type >( nIndex ) ] : 0;
- }
-};
-
-// ============================================================================
-
-/** Template for a map of ref-counted objects with additional accessor functions.
-
- An instance of the class RefMap< Type > stores elements of the type
- ::boost::shared_ptr< Type >. The new accessor functions has() and get()
- work correctly for nonexisting keys, there is no need to check the passed
- key before.
- */
-template< typename KeyType, typename ObjType, typename CompType = ::std::less< KeyType > >
-class RefMap : public ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType >
-{
-public:
- typedef ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > container_type;
- typedef typename container_type::key_type key_type;
- typedef typename container_type::mapped_type mapped_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::key_compare key_compare;
-
-public:
- /** Returns true, if the object accossiated to the passed key exists.
- Returns false, if the key exists but points to an empty reference. */
- inline bool has( key_type nKey ) const
- {
- const mapped_type* pxRef = getRef( nKey );
- return pxRef && pxRef->get();
- }
-
- /** Returns a reference to the object accossiated to the passed key, or an
- empty reference on error. */
- inline mapped_type get( key_type nKey ) const
- {
- if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef;
- return mapped_type();
- }
-
- /** Calls the passed functor for every contained object, automatically
- skips all elements that are empty references. */
- template< typename FunctorType >
- inline void forEach( const FunctorType& rFunctor ) const
- {
- ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType >
- inline void forEachMem( FuncType pFunc ) const
- {
- forEach( ::boost::bind( pFunc, _1 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType >
- inline void forEachMem( FuncType pFunc, ParamType aParam ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
- }
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
- }
- /** Calls the passed functor for every contained object. Passes the key as
- first argument and the object reference as second argument to rFunctor. */
- template< typename FunctorType >
- inline void forEachWithKey( const FunctorType& rFunctor ) const
- {
- ::std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the object key as argument to the member function. */
- template< typename FuncType >
- inline void forEachMemWithKey( FuncType pFunc ) const
- {
- forEachWithKey( ::boost::bind( pFunc, _2, _1 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the object key as first argument to the member function. */
- template< typename FuncType, typename ParamType >
- inline void forEachMemWithKey( FuncType pFunc, ParamType aParam ) const
- {
- forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the object key as first argument to the member function. */
- template< typename FuncType, typename ParamType1, typename ParamType2 >
- inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
- {
- forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the object key as first argument to the member function. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
- inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
- {
- forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
- }
-
-private:
- template< typename FunctorType >
- struct ForEachFunctor
- {
- FunctorType maFunctor;
- inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
- inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); }
- };
-
- template< typename FunctorType >
- struct ForEachFunctorWithKey
- {
- FunctorType maFunctor;
- inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
- inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); }
- };
-
- inline const mapped_type* getRef( key_type nKey ) const
- {
- typename container_type::const_iterator aIt = find( nKey );
- return (aIt == this->end()) ? 0 : &aIt->second;
- }
-};
-
-// ============================================================================
/** Template for a 2-dimensional array of objects.
diff --git a/oox/inc/oox/helper/refmap.hxx b/oox/inc/oox/helper/refmap.hxx
index eec7228..7aecea7 100755
--- a/oox/inc/oox/helper/refmap.hxx
+++ b/oox/inc/oox/helper/refmap.hxx
@@ -110,6 +110,15 @@ public:
{
forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
}
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
+ }
+
/** Calls the passed functor for every contained object. Passes the key as
first argument and the object reference as second argument to rFunctor. */
template< typename FunctorType >
diff --git a/oox/inc/oox/ole/vbacontrol.hxx b/oox/inc/oox/ole/vbacontrol.hxx
index a2e8dcf..9f4f0b6 100644
--- a/oox/inc/oox/ole/vbacontrol.hxx
+++ b/oox/inc/oox/ole/vbacontrol.hxx
@@ -167,13 +167,7 @@ private:
/** Imports the site models of all embedded controls from the 'f' stream. */
bool importEmbeddedSiteModels( BinaryInputStream& rInStrm );
/* Final processing of all embedded controls after import. */
- void finalizeEmbeddedControls();
-
- /** Moves the control relative to its current position by the passed distance. */
- void moveRelative( const AxPairData& rDistance );
- /** Moves all embedded controls from their relative position in this
- control to an absolute position in the parent of this control. */
- void moveEmbeddedToAbsoluteParent();
+ void finalizeEmbeddedControls( StorageBase& rStrg );
/** Functor for comparing controls by their tab index. */
static bool compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight );
diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx
index 6099da6..c01f97f 100644
--- a/oox/inc/oox/ole/vbaproject.hxx
+++ b/oox/inc/oox/ole/vbaproject.hxx
@@ -73,6 +73,69 @@ private:
// ============================================================================
+/** Base class for objects that attach a amcro to a specific action.
+
+ Purpose is to collect objects that need to attach a VBA macro to an action.
+ The VBA project will be loaded at a very late point of the document import
+ process, because it depends on an initialized core document model (e.g.
+ spreadsheet codenames). Some objects that want to attach a VBA macro to an
+ action (e.g. mouse click action for drawing shapes) are loaded long before
+ the VBA project. The drawback is that in most cases macros are specified
+ without module name, or the VBA project name is part of the macro name.
+ In the former case, all code modules have to be scanned for the macro to be
+ able to create a valid script URL.
+
+ The import code will register these requests to attach a VBA macro with an
+ instance of a class derived from this base class. The derived class will
+ store all information needed to finally attach the macro to the action,
+ once the VBA project has been imported.
+ */
+class VbaMacroAttacherBase
+{
+public:
+ explicit VbaMacroAttacherBase( const ::rtl::OUString& rMacroName );
+ virtual ~VbaMacroAttacherBase();
+
+ /** Resolves the internal macro name to the related macro URL, and attaches
+ the macro to the object. */
+ void resolveAndAttachMacro(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAMacroResolver >& rxResolver );
+
+private:
+ /** Called after the VBA project has been imported. Derived classes will
+ attach the passed script to the object represented by this instance. */
+ virtual void attachMacro( const ::rtl::OUString& rScriptUrl ) = 0;
+
+private:
+ ::rtl::OUString maMacroName;
+};
+
+typedef ::boost::shared_ptr< VbaMacroAttacherBase > VbaMacroAttacherRef;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig
+{
+public:
+ explicit VbaProject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const ::rtl::OUString& rConfigCompName );
+ virtual ~VbaProject();
+
+ /** Imports the entire VBA project from the passed storage.
+
+ @param rVbaPrjStrg The root storage of the entire VBA project.
+ */
+ void importVbaProject(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ /** Registers a macro atatcher object. For details, see description of the
+ VbaMacroAttacherBase class. */
+ void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher );
+
/** Returns true, if the document contains at least one code module. */
bool hasModules() const;
/** Returns true, if the document contains the specified code module. */
@@ -117,10 +180,14 @@ private:
const GraphicHelper& rGraphicHelper,
bool bDefaultColorBgr );
+ /** Attaches VBA macros to objects registered via registerMacroAttacher(). */
+ void attachMacros();
+
/** Copies the entire VBA project storage to the passed document model. */
void copyStorage( StorageBase& rVbaPrjStrg );
private:
+ typedef RefVector< VbaMacroAttacherBase > MacroAttacherVector;
typedef ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
@@ -133,6 +200,7 @@ private:
mxDialogLib; /// The dialog library of the document used for import.
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
mxOleOverridesSink;
+ MacroAttacherVector maMacroAttachers; /// Objects that want to attach a VBA macro to an action.
DummyModuleMap maDummyModules; /// Additional empty modules created on import.
::rtl::OUString maPrjName; /// Name of the VBA project.
};
diff --git a/oox/inc/oox/ole/vbaprojectfilter.hxx b/oox/inc/oox/ole/vbaprojectfilter.hxx
index 97b11e5..c8a0a1b 100644
--- a/oox/inc/oox/ole/vbaprojectfilter.hxx
+++ b/oox/inc/oox/ole/vbaprojectfilter.hxx
@@ -63,7 +63,6 @@ public:
explicit WordVbaProjectFilter(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
throw( ::com::sun::star::uno::RuntimeException );
->>>>>>> stage/ooo/dev300_m98_fixed
private:
virtual ::rtl::OUString implGetImplementationName() const;
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 62f870a..b1f3977 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -29,6 +29,7 @@
#include "oox/core/filterbase.hxx"
#include <set>
+#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
@@ -56,6 +57,7 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
using ::comphelper::MediaDescriptor;
using ::comphelper::SequenceAsHashMap;
@@ -581,7 +583,7 @@ void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDesc
OUString sFilterName = mxImpl->maMediaDesc.getUnpackedValueOrDefault( CREATE_OUSTRING( "FilterName" ), OUString() );
try
{
- Reference< XNameAccess > xFilters( getGlobalFactory()->createInstance(
+ Reference< XNameAccess > xFilters( getServiceFactory()->createInstance(
CREATE_OUSTRING( "com.sun.star.document.FilterFactory" ) ), UNO_QUERY_THROW );
Any aValues = xFilters->getByName( sFilterName );
Sequence<PropertyValue > aPropSeq;
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 2cd9935..3802450 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -47,6 +47,14 @@
#include "oox/helper/propertyset.hxx"
#include "oox/helper/zipstorage.hxx"
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#include <oox/core/filterdetect.hxx>
+#include <comphelper/storagehelper.hxx>
+
namespace oox {
namespace core {
@@ -69,14 +77,6 @@ using ::rtl::OUStringBuffer;
using ::sax_fastparser::FSHelperPtr;
using ::sax_fastparser::FastSerializerHelper;
-#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/mediadescriptor.hxx>
-#include <oox/core/filterdetect.hxx>
-#include <comphelper/storagehelper.hxx>
-
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::document::XOOXMLDocumentPropertiesImporter;
using ::com::sun::star::document::XDocumentPropertiesSupplier;
@@ -148,7 +148,6 @@ XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxCo
XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
FilterBase( rxContext ),
mxImpl( new XmlFilterBaseImpl( rxContext ) ),
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing" ), NMSP_CDR );
mnRelId( 1 ),
mnMaxDocId( 0 )
{
@@ -162,16 +161,16 @@ XmlFilterBase::~XmlFilterBase()
void XmlFilterBase::importDocumentProperties() throw()
{
- Reference< XMultiServiceFactory > xFactory( getGlobalFactory(), UNO_QUERY );
+ Reference< XMultiServiceFactory > xFactory( getServiceFactory(), UNO_QUERY );
MediaDescriptor aMediaDesc( getMediaDescriptor() );
Reference< XInputStream > xInputStream;
- ::oox::core::FilterDetect aDetector( xFactory );
+ Reference< XComponentContext > xContext( getComponentContext() );
+ ::oox::core::FilterDetect aDetector( xContext );
xInputStream = aDetector.extractUnencryptedPackage( aMediaDesc );
Reference< XComponent > xModel( getModel(), UNO_QUERY );
- Reference< XComponentContext > xContext = lcl_getComponentContext(getGlobalFactory());
Reference< XStorage > xDocumentStorage (
::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( OFOPXML_STORAGE_FORMAT_STRING, xInputStream ) );
- Reference< XInterface > xTemp = xContext->getServiceManager()->createInstanceWithContext(
+ Reference< XInterface > xTemp = getComponentFactory()->createInstanceWithContext(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.OOXMLDocumentPropertiesImporter")),
xContext);
Reference< XOOXMLDocumentPropertiesImporter > xImporter( xTemp, UNO_QUERY );
@@ -553,4 +552,4 @@ StorageRef XmlFilterBase::implCreateStorage( const Reference< XStream >& rxOutSt
} // namespace core
} // namespace oox
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 95c421a..1eea102 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -542,7 +542,6 @@ OUString ControlModelBase::getServiceName() const
case API_CONTROL_PAGE: return CREATE_OUSTRING( "com.sun.star.awt.UnoPageModel" );
case API_CONTROL_MULTIPAGE: return CREATE_OUSTRING( "com.sun.star.awt.UnoMultiPageModel" );
case API_CONTROL_DIALOG: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlDialogModel" );
- case API_CONTROL_DIALOG: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlDialogModel" );
default: OSL_ENSURE( false, "ControlModelBase::getServiceName - no AWT model service supported" );
}
else switch( eCtrlType )
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index fe72939..eee7b50 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -29,7 +29,7 @@
#include "oox/ole/olehelper.hxx"
#include <rtl/ustrbuf.hxx>
-#include "tokens.hxx"
+#include "oox/token/tokens.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/graphichelper.hxx"
#include "oox/token/tokens.hxx"
@@ -314,4 +314,4 @@ StdFontInfo::StdFontInfo( const ::rtl::OUString& rName, sal_uInt32 nHeight,
} // namespace ole
} // namespace oox
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx
index c476320..710c34f 100644
--- a/oox/source/ole/olestorage.cxx
+++ b/oox/source/ole/olestorage.cxx
@@ -36,9 +36,10 @@
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <cppuhelper/implbase2.hxx>
-#include "oox/helper/helper.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/helper.hxx"
using ::rtl::OUString;
using ::com::sun::star::container::XNameContainer;
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 58914bf..8e811a5 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -452,7 +452,7 @@ void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rCla
group together), and move all children of all embedded frames
(group boxes) to this control (UNO group boxes cannot contain
other controls). */
- finalizeEmbeddedControls();
+ finalizeEmbeddedControls( rStrg );
}
}
}
@@ -559,138 +559,182 @@ bool VbaFormControl::importEmbeddedSiteModels( BinaryInputStream& rInStrm )
return bValid;
}
-void VbaFormControl::finalizeEmbeddedControls()
+void VbaFormControl::finalizeEmbeddedControls( StorageBase& rStrg )
{
- /* This function performs two tasks:
+ /* Store all embedded controls in a temporary vector, so "exit on error"
+ will leave this control empty. */
+ VbaFormControlVector aControls;
+ aControls.swap( maControls );
- 1) Reorder the controls appropriately (sort all option buttons of an
- option group together to make grouping work).
- 2) Move all children of all embedded frames (group boxes) to this
- control (UNO group boxes cannot contain other controls).
- */
-
- // first, sort all controls by original tab index
- ::std::sort( maControls.begin(), maControls.end(), &compareByTabIndex );
-
- /* Collect the programmatical names of all embedded controls (needed to be
- able to set unused names to new dummy controls created below). Also
- collect the names of all children of embedded frames (group boxes).
- Luckily, names of controls must be unique in the entire form, not just
- in the current container. */
- VbaControlNamesSet aControlNames;
- VbaControlNameInserter aInserter( aControlNames );
- maControls.forEach( aInserter );
- for( VbaFormControlVector::iterator aIt = maControls.begin(), aEnd = maControls.end(); aIt != aEnd; ++aIt )
- if( (*aIt)->mxCtrlModel.get() && ((*aIt)->mxCtrlModel->getControlType() == API_CONTROL_GROUPBOX) )
- (*aIt)->maControls.forEach( aInserter );
-
- /* Reprocess the sorted list and collect all option button controls that
- are part of the same option group (determined by group name). All
- controls will be stored in a vector of vectors, that collects every
- option button group in one vector element, and other controls between
- these option groups (or leading or trailing controls) in other vector
- elements. If an option button group follows another group, a dummy
- separator control has to be inserted. */
- typedef RefVector< VbaFormControlVector > VbaFormControlVectorVector;
- VbaFormControlVectorVector aControlGroups;
-
- typedef RefMap< OUString, VbaFormControlVector > VbaFormControlVectorMap;
- VbaFormControlVectorMap aOptionGroups;
-
- typedef VbaFormControlVectorMap::mapped_type VbaFormControlVectorRef;
- bool bLastWasOptionButton = false;
- for( VbaFormControlVector::iterator aIt = maControls.begin(), aEnd = maControls.end(); aIt != aEnd; ++aIt )
+ /* If this is a multipage control, it stores additional data in the 'x'
+ stream of its storage. It contains the control identifiers of the form
+ page controls that contain the embedded controls of each page.
+ Additionally, the order of these pages is stored there (they are not
+ nessecarily in the order they are persisted in). */
+ if( AxMultiPageModel* pMultiPageModel = dynamic_cast< AxMultiPageModel* >( mxCtrlModel.get() ) )
{
- VbaFormControlRef xControl = *aIt;
- const ControlModelBase* pCtrlModel = xControl->mxCtrlModel.get();
+ // read additional attributes from the 'x' stream
+ BinaryXInputStream aXStrm( rStrg.openInputStream( CREATE_OUSTRING( "x" ) ), true );
+ OSL_ENSURE( !aXStrm.isEof(), "VbaFormControl::finalizeEmbeddedControls - missing 'x' stream" );
+ if( aXStrm.isEof() ) return;
- if( const AxOptionButtonModel* pOptButtonModel = dynamic_cast< const AxOptionButtonModel* >( pCtrlModel ) )
+ // skip the page property structures related to all controls
+ for( size_t nSiteIdx = 0, nSiteCount = aControls.size(); nSiteIdx < nSiteCount; ++nSiteIdx )
{
- // check if a new option group needs to be created
- const OUString& rGroupName = pOptButtonModel->getGroupName();
- VbaFormControlVectorRef& rxOptionGroup = aOptionGroups[ rGroupName ];
- if( !rxOptionGroup )
- {
- /* If last control was an option button too, we have two
- option groups following each other, so a dummy separator
- control is needed. */
- if( bLastWasOptionButton )
- {
- VbaFormControlVectorRef xDummyGroup( new VbaFormControlVector );
- aControlGroups.push_back( xDummyGroup );
- OUString aName = aControlNames.generateDummyName();
- VbaFormControlRef xDummyControl( new VbaDummyFormControl( aName ) );
- xDummyGroup->push_back( xDummyControl );
- }
- rxOptionGroup.reset( new VbaFormControlVector );
- aControlGroups.push_back( rxOptionGroup );
- }
- /* Append the option button to the control group (which is now
- referred by the vector aControlGroups and by the map
- aOptionGroups). */
- rxOptionGroup->push_back( xControl );
- bLastWasOptionButton = true;
+ AxBinaryPropertyReader aReader( aXStrm );
+ aReader.skipUndefinedProperty();
+ aReader.skipIntProperty< sal_uInt32 >(); // transition effect
+ aReader.skipIntProperty< sal_uInt32 >(); // transition period
+ if( !aReader.finalizeImport() ) return;
}
- else
- {
- // open a new control group, if the last group is an option group
- if( bLastWasOptionButton || aControlGroups.empty() )
- {
- VbaFormControlVectorRef xControlGroup( new VbaFormControlVector );
- aControlGroups.push_back( xControlGroup );
- }
- // append the control to the last control group
- VbaFormControlVector& rLastGroup = *aControlGroups.back();
- rLastGroup.push_back( xControl );
- bLastWasOptionButton = false;
- // if control is a group box, move all its children to this control
- if( pCtrlModel && (pCtrlModel->getControlType() == API_CONTROL_GROUPBOX) )
+ // read the multipage property structure containing a list of page IDs
+ sal_Int32 nPageCount = 0;
+ sal_Int32 nTabStripId = 0;
+ AxBinaryPropertyReader aReader( aXStrm );
+ aReader.skipUndefinedProperty();
+ aReader.readIntProperty< sal_Int32 >( nPageCount );
+ aReader.readIntProperty< sal_Int32 >( nTabStripId );
+ if( !aReader.finalizeImport() ) return;
+ // read the array containing all page identifiers in current order
+ typedef ::std::vector< sal_Int32 > AxPageIdVector;
+ AxPageIdVector aPageIds;
+ for( sal_Int32 nPage = 0; !aXStrm.isEof() && (nPage < nPageCount); ++nPage )
+ aPageIds.push_back( aXStrm.readInt32() );
+ if( aXStrm.isEof() ) return;
+
+ // check the page count value
+ bool bValidPageCount = (0 < nPageCount) && (static_cast< size_t >( nPageCount + 1 ) == aControls.size());
+ OSL_ENSURE( bValidPageCount, "VbaFormControl::finalizeEmbeddedControls - invalid number of pages" );
+ if( !bValidPageCount ) return;
+
+ /* Check that this multipage contains the expected controls:
+ - a tabstrip control, specified by nTabStripId,
+ - form page controls (containing the embedded controls of each page). */
+
+ // the controls may be in arbitrary order, first map them by ID
+ RefMap< sal_Int32, VbaFormControl > aControlsById;
+ for( VbaFormControlVector::iterator aIt = aControls.begin(), aEnd = aControls.end(); aIt != aEnd; ++aIt )
+ {
+ VbaFormControlRef xControl = *aIt;
+ sal_Int32 nId = xControl->getControlId();
+ OSL_ENSURE( (nId > 0) && !aControlsById.has( nId ), "VbaFormControl::finalizeEmbeddedControls - invalid control ID" );
+ aControlsById[ nId ] = xControl;
+ }
+ // store tabstrip in the multipage, it will care about property conversion
+ AxTabStripModelRef xTabStripModel;
+ VbaFormControlRef xControl = aControlsById.get( nTabStripId );
+ if( xControl.get() )
+ xTabStripModel = ::boost::dynamic_pointer_cast< AxTabStripModel >( xControl->mxCtrlModel );
+ OSL_ENSURE( xTabStripModel.get(), "VbaFormControl::finalizeEmbeddedControls - missing tabstrip control" );
+ if( !xTabStripModel ) return;
+ pMultiPageModel->setTabStripModel( xTabStripModel );
+ aControlsById.erase( nTabStripId );
+ // store all pages in maControls in the correct order specified by aPageIds
+ sal_Int32 nTabIndex = 0;
+ for( AxPageIdVector::iterator aIt = aPageIds.begin(), aEnd = aPageIds.end(); aIt != aEnd; ++aIt, ++nTabIndex )
+ {
+ VbaFormControlRef rControl = aControlsById.get( *aIt );
+ AxFormPageModel* pFormPageModel = rControl.get() ? dynamic_cast< AxFormPageModel* >( rControl->mxCtrlModel.get() ) : 0;
+ OSL_ENSURE( pFormPageModel, "VbaFormControl::finalizeEmbeddedControls - missing formpage control" );
+ // do not exit on error but try to collect as much pages as possible
+ if( pFormPageModel )
{
- /* Move all embedded controls of the group box relative to the
- position of the group box. */
- xControl->moveEmbeddedToAbsoluteParent();
- /* Insert all children of the group box into the last control
- group (following the group box). */
- rLastGroup.insert( rLastGroup.end(), xControl->maControls.begin(), xControl->maControls.end() );
- xControl->maControls.clear();
- // check if last control of the group box is an option button
- bLastWasOptionButton = dynamic_cast< const AxOptionButtonModel* >( rLastGroup.back()->mxCtrlModel.get() ) != 0;
+ // get the tab caption from tabstrip control and set it at the formpage
+ OUString aCaption = xTabStripModel->getCaption( nTabIndex );
+ pFormPageModel->importProperty( XML_Caption, aCaption );
+ // store the control in maControls
+ maControls.push_back( rControl );
+ aControlsById.erase( *aIt );
}
}
}
-
- // flatten the vector of vectors of form controls to a single vector
- maControls.clear();
- for( VbaFormControlVectorVector::iterator aIt = aControlGroups.begin(), aEnd = aControlGroups.end(); aIt != aEnd; ++aIt )
- maControls.insert( maControls.end(), (*aIt)->begin(), (*aIt)->end() );
-}
-
-void VbaFormControl::moveRelative( const AxPairData& rDistance )
-{
- if( mxSiteModel.get() )
- mxSiteModel->moveRelative( rDistance );
-}
-
-void VbaFormControl::moveEmbeddedToAbsoluteParent()
-{
- if( mxSiteModel.get() && !maControls.empty() )
+ else
{
- // distance to move is equal to position of this control in its parent
- AxPairData aDistance = mxSiteModel->getPosition();
-
- /* For group boxes: add half of the font height to Y position (VBA
- positions relative to frame border line, not to 'top' of frame). */
- const AxFontDataModel* pFontModel = dynamic_cast< const AxFontDataModel* >( mxCtrlModel.get() );
- if( pFontModel && (pFontModel->getControlType() == API_CONTROL_GROUPBOX) )
+ /* Reorder the controls appropriately (sort all option buttons of an
+ option group together to make grouping work), and erase all plain
+ tabstrip controls (currently not supported in UNO dialogs). */
+
+ // first, sort all controls by original tab index
+ ::std::sort( aControls.begin(), aControls.end(), &compareByTabIndex );
+
+ /* Collect the programmatical names of all embedded controls (needed to be
+ able to set unused names to new dummy controls created below). */
+ VbaControlNamesSet aControlNames;
+ VbaControlNameInserter aInserter( aControlNames );
+ aControls.forEach( aInserter );
+
+ /* Reprocess the sorted list and collect all option button controls that
+ are part of the same option group (determined by group name). All
+ controls will be stored in a vector of vectors, that collects every
+ option button group in one vector element, and other controls between
+ these option groups (or leading or trailing controls) in other vector
+ elements. If an option button group follows another group, a dummy
+ separator control has to be inserted. */
+ typedef RefVector< VbaFormControlVector > VbaFormControlVectorVector;
+ VbaFormControlVectorVector aControlGroups;
+
+ typedef RefMap< OUString, VbaFormControlVector > VbaFormControlVectorMap;
+ VbaFormControlVectorMap aOptionGroups;
+
+ typedef VbaFormControlVectorMap::mapped_type VbaFormControlVectorRef;
+ bool bLastWasOptionButton = false;
+ for( VbaFormControlVector::iterator aIt = aControls.begin(), aEnd = aControls.end(); aIt != aEnd; ++aIt )
{
- // convert points to 1/100 mm (1 pt = 1/72 inch = 2.54/72 cm = 2540/72 1/100 mm)
- sal_Int32 nFontHeight = static_cast< sal_Int32 >( pFontModel->getFontHeight() * 2540 / 72 );
- aDistance.second += nFontHeight / 2;
+ VbaFormControlRef xControl = *aIt;
+ const ControlModelBase* pCtrlModel = xControl->mxCtrlModel.get();
+ if ( !pCtrlModel ) // skip unsupported controls
+ continue;
+ if( const AxOptionButtonModel* pOptButtonModel = dynamic_cast< const AxOptionButtonModel* >( pCtrlModel ) )
+ {
+ // check if a new option group needs to be created
+ const OUString& rGroupName = pOptButtonModel->getGroupName();
+ VbaFormControlVectorRef& rxOptionGroup = aOptionGroups[ rGroupName ];
+ if( !rxOptionGroup )
+ {
+ /* If last control was an option button too, we have two
+ option groups following each other, so a dummy separator
+ control is needed. */
+ if( bLastWasOptionButton )
+ {
+ VbaFormControlVectorRef xDummyGroup( new VbaFormControlVector );
+ aControlGroups.push_back( xDummyGroup );
+ OUString aName = aControlNames.generateDummyName();
+ VbaFormControlRef xDummyControl( new VbaDummyFormControl( aName ) );
+ xDummyGroup->push_back( xDummyControl );
+ }
+ rxOptionGroup.reset( new VbaFormControlVector );
+ aControlGroups.push_back( rxOptionGroup );
+ }
+ /* Append the option button to the control group (which is now
+ referred by the vector aControlGroups and by the map
+ aOptionGroups). */
+ rxOptionGroup->push_back( xControl );
+ bLastWasOptionButton = true;
+ }
+ else
+ {
+ // skip unsupported controls (tabstrips and page controls)
+ ApiControlType eCtrlType = pCtrlModel->getControlType();
+ if( (eCtrlType != API_CONTROL_TABSTRIP) && (eCtrlType != API_CONTROL_PAGE) )
+ {
+ // open a new control group, if the last group is an option group
+ if( bLastWasOptionButton || aControlGroups.empty() )
+ {
+ VbaFormControlVectorRef xControlGroup( new VbaFormControlVector );
+ aControlGroups.push_back( xControlGroup );
+ }
+ // append the control to the last control group
+ VbaFormControlVector& rLastGroup = *aControlGroups.back();
+ rLastGroup.push_back( xControl );
+ bLastWasOptionButton = false;
+ }
+ }
}
- // move the embedded controls
- maControls.forEachMem( &VbaFormControl::moveRelative, ::boost::cref( aDistance ) );
+ // flatten the vector of vectors of form controls to a single vector
+ for( VbaFormControlVectorVector::iterator aIt = aControlGroups.begin(), aEnd = aControlGroups.end(); aIt != aEnd; ++aIt )
+ maControls.insert( maControls.end(), (*aIt)->begin(), (*aIt)->end() );
}
}
@@ -838,7 +882,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, mxCompContext ), UNO_SET_THROW );
+ Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, mxCompContext, mxDocModel ), UNO_SET_THROW );
OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" );
ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) );
}
diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx
index c2f187e..51ecc5a 100644
--- a/oox/source/ole/vbamodule.cxx
+++ b/oox/source/ole/vbamodule.cxx
@@ -28,6 +28,7 @@
#include "oox/ole/vbamodule.hxx"
#include <hash_map>
+#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/script/ModuleInfo.hpp>
diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx
index 7f4d17e..b886b21 100644
--- a/oox/source/ole/vbaproject.cxx
+++ b/oox/source/ole/vbaproject.cxx
@@ -130,6 +130,29 @@ bool VbaFilterConfig::isExportVba() const
// ============================================================================
+VbaMacroAttacherBase::VbaMacroAttacherBase( const OUString& rMacroName ) :
+ maMacroName( rMacroName )
+{
+ OSL_ENSURE( maMacroName.getLength() > 0, "VbaMacroAttacherBase::VbaMacroAttacherBase - empty macro name" );
+}
+
+VbaMacroAttacherBase::~VbaMacroAttacherBase()
+{
+}
+
+void VbaMacroAttacherBase::resolveAndAttachMacro( const Reference< XVBAMacroResolver >& rxResolver )
+{
+ try
+ {
+ attachMacro( rxResolver->resolveVBAMacroToScriptURL( maMacroName ) );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// ============================================================================
+
VbaProject::VbaProject( const Reference< XComponentContext >& rxContext,
const Reference< XModel >& rxDocModel, const OUString& rConfigCompName ) :
VbaFilterConfig( rxContext, rConfigCompName ),
@@ -160,6 +183,12 @@ void VbaProject::importVbaProject( StorageBase& rVbaPrjStrg, const GraphicHelper
}
}
+void VbaProject::registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher )
+{
+ OSL_ENSURE( rxAttacher.get(), "VbaProject::registerMacroAttacher - unexpected empty reference" );
+ maMacroAttachers.push_back( rxAttacher );
+}
+
bool VbaProject::hasModules() const
{
return mxBasicLib.is() && mxBasicLib->hasElements();
@@ -477,6 +506,23 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
finalizeImport();
}
+void VbaProject::attachMacros()
+{
+ if( !maMacroAttachers.empty() && mxCompContext.is() ) try
+ {
+ Reference< XMultiComponentFactory > xFactory( mxCompContext->getServiceManager(), UNO_SET_THROW );
+ Sequence< Any > aArgs( 2 );
+ aArgs[ 0 ] <<= mxDocModel;
+ aArgs[ 1 ] <<= maPrjName;
+ Reference< XVBAMacroResolver > xResolver( xFactory->createInstanceWithArgumentsAndContext(
+ CREATE_OUSTRING( "com.sun.star.script.vba.VBAMacroResolver" ), aArgs, mxCompContext ), UNO_QUERY_THROW );
+ maMacroAttachers.forEachMem( &VbaMacroAttacherBase::resolveAndAttachMacro, ::boost::cref( xResolver ) );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
void VbaProject::copyStorage( StorageBase& rVbaPrjStrg )
{
if( mxCompContext.is() ) try
diff --git a/oox/source/token/makefile.mk b/oox/source/token/makefile.mk
index 387fee1..ff42967 100644
--- a/oox/source/token/makefile.mk
+++ b/oox/source/token/makefile.mk
@@ -49,7 +49,6 @@ SLOFILES = \
.INCLUDE : target.mk
GENHEADERPATH = $(INCCOM)$/oox$/token
- @@-$(RM) $@
$(MISC)$/tokenhash.gperf $(INCCOM)$/tokennames.inc $(GENHEADERPATH)$/tokens.hxx $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx :
@@noop $(assign do_phony:=.PHONY)
diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt
index fe44728..81b5680 100644
--- a/oox/source/token/namespaces.txt
+++ b/oox/source/token/namespaces.txt
@@ -3,7 +3,6 @@
xml http://www.w3.org/XML/1998/namespace
schema http://schemas.openxmlformats.org/schemaLibrary/2006/main
-CDR
# package ---------------------------------------------------------------------
diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx
index cd2d062..ff815bf 100644
--- a/oox/source/xls/commentsbuffer.cxx
+++ b/oox/source/xls/commentsbuffer.cxx
@@ -36,7 +36,7 @@
#include "oox/vml/vmlshape.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/drawingfragment.hxx"
-#include "properties.hxx"
+#include "oox/token/tokens.hxx"
#include "svx/sdtaitm.hxx"
#include "oox/xls/unitconverter.hxx"
@@ -48,6 +48,19 @@ using ::com::sun::star::text::XTextRange;
using ::com::sun::star::awt::Size;
using ::com::sun::star::awt::Point;
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
static sal_Int32 lcl_ToHorizAlign( sal_Int32 nAlign )
{
@@ -81,20 +94,6 @@ static sal_Int32 lcl_ToVertAlign( sal_Int32 nAlign )
return SDRTEXTVERTADJUST_TOP;
}
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-using namespace ::com::sun::star::drawing;
-using namespace ::com::sun::star::sheet;
-using namespace ::com::sun::star::table;
-using namespace ::com::sun::star::uno;
-
-using ::rtl::OUString;
-
-// ============================================================================
-
CommentModel::CommentModel() :
mnAuthorId( -1 )
{
@@ -169,14 +168,6 @@ void Comment::importAnchor( bool bFrom, sal_Int32 nWhich, const OUString &rChars
}
}
-void Comment::importComment( RecordInputStream& rStrm )
-{
- BinRange aBinRange;
- rStrm >> maModel.mnAuthorId >> aBinRange;
- // cell range will be checked while inserting the comment into the document
- getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, aBinRange, getSheetIndex() );
-}
-
RichStringRef Comment::createText()
{
maModel.mxText.reset( new RichString( *this ) );
@@ -268,4 +259,4 @@ void CommentsBuffer::finalizeImport()
} // namespace xls
} // namespace oox
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list