summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorHenning Brinkmann <hbrinkm@openoffice.org>2010-12-01 13:49:43 +0100
committerHenning Brinkmann <hbrinkm@openoffice.org>2010-12-01 13:49:43 +0100
commit6c59cba1f07e5e4fa13417aa3d5e690031c92f30 (patch)
treef3d0b84a43e5a039059a6559a1875e303fa795c6 /oox
parenteb51984cee2d08c943680983ecdc5fede61a4c94 (diff)
parent9c16b686c71855df1bbcbf1bcc4b175c48abb49c (diff)
merged DEV300_m94
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/drawingml/fillproperties.hxx2
-rw-r--r--oox/inc/oox/helper/graphichelper.hxx4
-rw-r--r--[-rwxr-xr-x]oox/inc/oox/ole/vbahelper.hxx123
-rw-r--r--[-rwxr-xr-x]oox/inc/oox/ole/vbaproject.hxx151
-rw-r--r--oox/inc/oox/ppt/slidepersist.hxx2
-rwxr-xr-xoox/inc/oox/xls/excelvbaproject.hxx73
-rw-r--r--oox/prj/d.lst2
-rw-r--r--oox/source/core/facreg.cxx39
-rw-r--r--[-rwxr-xr-x]oox/source/core/filterbase.cxx32
-rw-r--r--oox/source/drawingml/chart/titlecontext.cxx2
-rw-r--r--oox/source/drawingml/fillproperties.cxx21
-rw-r--r--oox/source/drawingml/fillpropertiesgroupcontext.cxx10
-rw-r--r--oox/source/helper/graphichelper.cxx25
-rw-r--r--[-rwxr-xr-x]oox/source/ole/vbacontrol.cxx28
-rw-r--r--[-rwxr-xr-x]oox/source/ole/vbahelper.cxx171
-rw-r--r--[-rwxr-xr-x]oox/source/ole/vbamodule.cxx42
-rw-r--r--[-rwxr-xr-x]oox/source/ole/vbaproject.cxx124
-rw-r--r--oox/source/ppt/slidefragmenthandler.cxx7
-rw-r--r--oox/source/ppt/slidepersist.cxx7
-rw-r--r--oox/source/token/properties.txt1
-rw-r--r--oox/source/vml/vmlshapecontext.cxx2
-rw-r--r--oox/source/xls/defnamesbuffer.cxx8
-rw-r--r--oox/source/xls/excelfilter.cxx45
-rwxr-xr-xoox/source/xls/excelvbaproject.cxx214
-rw-r--r--oox/source/xls/externallinkfragment.cxx2
-rw-r--r--oox/source/xls/makefile.mk1
-rw-r--r--oox/source/xls/workbookhelper.cxx8
-rw-r--r--oox/util/makefile.mk8
-rw-r--r--oox/util/oox.component58
29 files changed, 273 insertions, 939 deletions
diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx
index 42457e6f4dde..d62651ebdc20 100644
--- a/oox/inc/oox/drawingml/fillproperties.hxx
+++ b/oox/inc/oox/drawingml/fillproperties.hxx
@@ -117,6 +117,8 @@ struct BlipFillProperties
OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
moFillRect; /// Stretch fill offsets.
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
+ moClipRect;
OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs).
OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs).
OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent).
diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx
index 37002940cb17..1c112efcf923 100644
--- a/oox/inc/oox/helper/graphichelper.hxx
+++ b/oox/inc/oox/helper/graphichelper.hxx
@@ -148,6 +148,10 @@ public:
@return The URL of the created and internally cached graphic object. */
::rtl::OUString importEmbeddedGraphicObject( const ::rtl::OUString& rStreamName ) const;
+ /** calculates the orignal size of a graphic which is necessary to be able to calculate cropping values
+ @return The original Graphic size in 100thmm */
+ ::com::sun::star::awt::Size getOriginalSize( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) const;
+
// ------------------------------------------------------------------------
private:
typedef ::std::map< sal_Int32, sal_Int32 > SystemPalette;
diff --git a/oox/inc/oox/ole/vbahelper.hxx b/oox/inc/oox/ole/vbahelper.hxx
index 76dc1c736025..c1e7297d0c5b 100755..100644
--- a/oox/inc/oox/ole/vbahelper.hxx
+++ b/oox/inc/oox/ole/vbahelper.hxx
@@ -30,11 +30,6 @@
#include "oox/helper/binarystreambase.hxx"
-namespace com { namespace sun { namespace star {
- namespace container { class XNameContainer; }
- namespace document { class XEventsSupplier; }
-} } }
-
namespace oox { class BinaryInputStream; }
namespace oox {
@@ -102,124 +97,6 @@ public:
::rtl::OUString& rValue,
const ::rtl::OUString& rKeyValue );
- /** Removes whitespace characters from the beginning of the passed string.
-
- @param rCodeLine (in/out parameter) The string to be modified.
-
- @return True = at least one whitespace character found and removed
- from rCodeLine. False = rCodeLine is empty or does not start with
- a whitespace character.
- */
- static bool eatWhitespace( ::rtl::OUString& rCodeLine );
-
- /** Removes the passed keyword from the beginning of the passed string.
-
- @param rCodeLine (in/out parameter) The string to be modified.
-
- @param rKeyword The keyword to be removed from the beginning of the
- rCodeLine string.
-
- @return True = rCodeLine starts with the passed keyword (case
- insensitive), and is followed by whitespace characters, or it ends
- right after the keyword. The keyword and the following whitespace
- characters have been removed from rCodeLine. False = rCodeLine is
- empty or does not start with the specified keyword, or the keyword
- is not followed by whitespace characters.
- */
- static bool eatKeyword( ::rtl::OUString& rCodeLine, const ::rtl::OUString& rKeyword );
-
- /** Returns the VBA source code of the specified module, or an empty
- string, if the module does not exist.
-
- @param rxBasicLib The container for all VBA code modules.
- @param rModuleName The name of the VBA code module.
- */
- static ::rtl::OUString getSourceCode(
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
- const ::rtl::OUString& rModuleName );
-
- /** Checks, if a macro with the specified name exists in the passed VBA
- source code.
-
- @param rSourceCode The VBA source code.
- @param rMacroName The name of the macro.
- */
- static bool hasMacro(
- const ::rtl::OUString& rSourceCode,
- const ::rtl::OUString& rMacroName );
-
- /** Checks, if a macro with the specified name exists in the specified
- module.
-
- @param rxBasicLib The container for all VBA code modules.
- @param rModuleName The name of the VBA module to check for the macro.
- @param rMacroName The name of the macro.
- */
- static bool hasMacro(
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
- const ::rtl::OUString& rModuleName,
- const ::rtl::OUString& rMacroName );
-
- /** Tries to insert a VBA macro into the specified code module.
-
- @descr If the specified macro does not exist, it will be generated as
- following, using the passed parameters. If the parameter rMacroType
- is left empty, a sub procedure macro will be generated:
-
- Private Sub <rMacroName> ( <rMacroArgs> )
- <rMacroCode>
- End Sub
-
- If the parameter rMacroType is not empty, a function macro
- will be generated. Note that the parameter rMacroCode has to
- provide the code that returns the function value.
-
- Private Function <rMacroName> ( <rMacroArgs> ) As <rMacroType>
- <rMacroCode>
- End Function
-
- The source code in rMacroCode may contain a special placeholder
- $MACRO that will be replaced by the macro name passed in rMacroName
- before the macro will be inserted into the module.
-
- @param rModuleName The name of the VBA module to be used.
- @param rMacroName The name of the VBA macro to be inserted.
- @param rMacroArgs The argument list of the VBA macro.
- @param rMacroType Macro return type (empty for sub procedure).
- @param rMacroCode The VBA source code for the macro.
-
- @return True, if the specified VBA macro has been inserted. False, if
- there already exists a macro with the specified name, or if any
- error has occurred, for example, Office configuration forbids to
- generate executable VBA code or the specified module does not
- exist.
- */
- static bool insertMacro(
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
- const ::rtl::OUString& rModuleName,
- const ::rtl::OUString& rMacroName,
- const ::rtl::OUString& rMacroArgs,
- const ::rtl::OUString& rMacroType,
- const ::rtl::OUString& rMacroCode );
-
- /** Tries to attach a VBA macro to an event of the passed events supplier.
-
- @descr The function checks if the specified macro exists and attaches
- it to the event of the passed events supplier.
-
- @param rxEventsSupp The events supplier for the event to be attached.
- @param rEventName The event name used in the office API.
- @param rLibraryName The name of the Basic library containing the macro.
- @param rModuleName The name of the VBA module containing the macro.
- @param rMacroName The name of the VBA macro to attach to the event.
- */
- static bool attachMacroToEvent(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventsSupplier >& rxEventsSupp,
- const ::rtl::OUString& rEventName,
- const ::rtl::OUString& rLibraryName,
- const ::rtl::OUString& rModuleName,
- const ::rtl::OUString& rMacroName );
-
private:
VbaHelper();
~VbaHelper();
diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx
index 0422ccbd0cf8..1d2fca29dbab 100755..100644
--- a/oox/inc/oox/ole/vbaproject.hxx
+++ b/oox/inc/oox/ole/vbaproject.hxx
@@ -97,157 +97,6 @@ public:
/** Returns true, if the document contains the specified dialog. */
bool hasDialog( const ::rtl::OUString& rDialogName ) const;
- // Insert VBA code modules and VBA macros into modules --------------------
-
- /** Tries to insert a VBA macro into the specified code module.
-
- @descr If the specified macro does not exist, it will be generated as
- following, using the passed parameters. If the parameter rMacroType
- is left empty, a sub procedure macro will be generated:
-
- Private Sub <rMacroName> ( <rMacroArgs> )
- <rMacroCode>
- End Sub
-
- If the parameter rMacroType is not empty, a function macro
- will be generated. Note that the parameter rMacroCode has to
- provide the code that returns the function value.
-
- Private Function <rMacroName> ( <rMacroArgs> ) As <rMacroType>
- <rMacroCode>
- End Function
-
- The source code in rMacroCode may contain a special placeholder
- $MACRO that will be replaced by the macro name passed in rMacroName
- before the macro will be inserted into the module.
-
- @param rModuleName The name of the VBA module to be used.
- @param rMacroName The name of the VBA macro to be inserted.
- @param rMacroArgs The argument list of the VBA macro.
- @param rMacroType Macro return type (empty for sub procedure).
- @param rMacroCode The VBA source code for the macro.
-
- @return True, if the specified VBA macro has been inserted. False, if
- there already exists a macro with the specified name, or if any
- error has occurred, for example, Office configuration forbids to
- generate executable VBA code or the specified module does not
- exist.
- */
- bool insertMacro(
- const ::rtl::OUString& rModuleName,
- const ::rtl::OUString& rMacroName,
- const ::rtl::OUString& rMacroArgs,
- const ::rtl::OUString& rMacroType,
- const ::rtl::OUString& rMacroCode );
-
- // Attach VBA macros to generic or document events ------------------------
-
- /** Tries to attach the specified VBA macro to an event directly.
-
- @descr The function checks if the specified macro exists and attaches
- it to the event of the passed events supplier.
-
- @param rxEventsSupp The events supplier for the event to be attached.
- @param rEventName The event name used in the office API.
- @param rModuleName The name of the VBA module containing the macro.
- @param rMacroName The name of the VBA macro to attach to the event.
-
- @return True, if the specified VBA macro exists and could be attached
- to the specified event.
- */
- bool attachMacroToEvent(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventsSupplier >& rxEventsSupp,
- const ::rtl::OUString& rEventName,
- const ::rtl::OUString& rModuleName,
- const ::rtl::OUString& rMacroName );
-
- /** Tries to attach the specified VBA macro to a document event directly.
-
- @descr The function checks if the specified macro exists and attaches
- it to the document event.
-
- @param rEventName The document event name used in the office API.
- @param rModuleName The name of the VBA module containing the macro.
- @param rMacroName The name of the VBA macro to attach to the event.
-
- @return True, if the specified VBA macro exists and could be attached
- to the specified document event.
- */
- bool attachMacroToDocumentEvent(
- const ::rtl::OUString& rEventName,
- const ::rtl::OUString& rModuleName,
- const ::rtl::OUString& rMacroName );
-
- /** Tries to attach the specified VBA macro to an event via a generated
- proxy macro that implements necessary conversion between VBA and UNO.
-
- @descr The function checks if the specified VBA macro exists, then it
- tries to generate a proxy macro using the parameters passed to this
- function, appends it to the code module, and attaches it to the
- event.
-
- The proxy macro will execute the code specified in the rProxyCode
- parameter. This code may contain special placeholders that will be
- replaced before the proxy macro will be inserted into the module:
- - $MACRO will be replaced by the original VBA macro name passed
- in the rMacroName parameter.
- - $PROXY will be replaced by the name of the proxy macro
- generated by this function.
-
- @param rxEventsSupp The events supplier for the event to be attached.
- @param rEventName The event name used in the office API.
- @param rModuleName The name of the VBA module containing the macro.
- @param rMacroName The name of the VBA macro to attach to the event.
- @param rProxyArgs The argument list of the generated proxy macro.
- @param rProxyType Proxy macro return type (empty for procedure).
- @param rProxyCode Proxy macro source code.
-
- @return True, if the specified VBA macro exists and could be attached
- to the specified event.
- */
- bool attachMacroToEvent(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventsSupplier >& rxEventsSupp,
- const ::rtl::OUString& rEventName,
- const ::rtl::OUString& rModuleName,
- const ::rtl::OUString& rMacroName,
- const ::rtl::OUString& rProxyArgs,
- const ::rtl::OUString& rProxyType,
- const ::rtl::OUString& rProxyCode );
-
- /** Tries to attach the specified VBA macro to a document event via a
- proxy macro that implements necessary conversion between VBA and UNO.
-
- @descr The function checks if the specified VBA macro exists, then it
- tries to generate a proxy macro using the parameters passed to this
- function, appends it to the code module, and attaches it to the
- document event.
-
- The proxy macro will execute the code specified in the rProxyCode
- parameter. This code may contain special placeholders that will be
- replaced before the proxy macro will be inserted into the module:
- - $MACRO will be replaced by the original VBA macro name passed
- in the rMacroName parameter.
- - $PROXY will be replaced by the name of the proxy macro
- generated by this function.
-
- @param rEventName The document event name used in the office API.
- @param rModuleName The name of the VBA module containing the macro.
- @param rMacroName The name of the VBA macro to attach to the event.
- @param rProxyArgs The argument list of the generated proxy macro.
- @param rProxyType Proxy macro return type (empty for procedure).
- @param rProxyCode Proxy macro source code.
-
- @return True, if the specified VBA macro exists and could be attached
- to the specified event.
- */
- bool attachMacroToDocumentEvent(
- const ::rtl::OUString& rEventName,
- const ::rtl::OUString& rModuleName,
- const ::rtl::OUString& rMacroName,
- const ::rtl::OUString& rProxyArgs,
- const ::rtl::OUString& rProxyType,
- const ::rtl::OUString& rProxyCode );
-
private:
VbaProject( const VbaProject& );
VbaProject& operator=( const VbaProject& );
diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx
index 31156a56ee84..bcb0c5803d61 100644
--- a/oox/inc/oox/ppt/slidepersist.hxx
+++ b/oox/inc/oox/ppt/slidepersist.hxx
@@ -91,6 +91,7 @@ public:
void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr pFillPropertiesPtr ){ mpBackgroundPropertiesPtr = pFillPropertiesPtr; }
oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; }
+ oox::drawingml::Color& getBackgroundColorRef() { return maBackgroundColorRef; }
sal_Bool isMasterPage() const { return mbMaster; }
sal_Bool isNotesPage() const { return mbNotes; }
@@ -130,6 +131,7 @@ private:
SlidePersistPtr mpMasterPagePtr;
oox::drawingml::ShapePtr maShapesPtr;
+ oox::drawingml::Color maBackgroundColorRef;
oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr;
::std::list< boost::shared_ptr< TimeNode > > maTimeNodeList;
diff --git a/oox/inc/oox/xls/excelvbaproject.hxx b/oox/inc/oox/xls/excelvbaproject.hxx
deleted file mode 100755
index 6a517d13cd88..000000000000
--- a/oox/inc/oox/xls/excelvbaproject.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_XLS_EXCELVBAPROJECT_HXX
-#define OOX_XLS_EXCELVBAPROJECT_HXX
-
-#include "oox/ole/vbaproject.hxx"
-#include "oox/dllapi.h"
-
-namespace com { namespace sun { namespace star {
- namespace sheet { class XSpreadsheetDocument; }
-} } }
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-/** Special implementation of the VBA project for the Excel filters. */
-class OOX_DLLPUBLIC VbaProject : public ::oox::ole::VbaProject
-{
-public:
- explicit VbaProject(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument );
-
- /** Attaches all document and sheet events to existing VBA macros. */
- void attachToEvents();
-
-private:
- /** Attaches VBA macros to all supported document events. */
- void attachToDocumentEvents( const ::rtl::OUString& rCodeName );
-
- /** Attaches VBA macros to all supported sheet events. */
- void attachToSheetEvents(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventsSupplier >& rxEventsSupp,
- const ::rtl::OUString& rCodeName );
-
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >
- mxDocument;
-};
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
-#endif
diff --git a/oox/prj/d.lst b/oox/prj/d.lst
index 482a270926a3..ff13b324d65c 100644
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@ -36,8 +36,8 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls
..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx
..\inc\oox\vml\vmldrawing.hxx %_DEST%\inc%_EXT%\oox\vml\vmldrawing.hxx
..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx
-..\inc\oox\xls\excelvbaproject.hxx %_DEST%\inc%_EXT%\oox\xls\excelvbaproject.hxx
dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
..\xml\components.xml %_DEST%\xml%_EXT%\components.xml
+..\%__SRC%\misc\oox.component %_DEST%\xml%_EXT%\oox.component
diff --git a/oox/source/core/facreg.cxx b/oox/source/core/facreg.cxx
index de6212984093..ed54ae81e7e5 100644
--- a/oox/source/core/facreg.cxx
+++ b/oox/source/core/facreg.cxx
@@ -77,45 +77,6 @@ OOX_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Ch
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-void SAL_CALL writeInfo( registry::XRegistryKey * pRegistryKey, const OUString& rImplementationName, const uno::Sequence< OUString >& rServices )
-{
- uno::Reference< registry::XRegistryKey > xNewKey(
- pRegistryKey->createKey(
- OUString( sal_Unicode( '/' ) ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) );
-
- for( sal_Int32 i = 0; i < rServices.getLength(); i++ )
- xNewKey->createKey( rServices.getConstArray()[i]);
-}
-
-#define WRITEINFO(className)\
- writeInfo( pKey, className##_getImplementationName(), className##_getSupportedServiceNames() )
-
-OOX_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void * , void * pRegistryKey )
-{
- if( pRegistryKey )
- {
- try
- {
- registry::XRegistryKey *pKey = reinterpret_cast< registry::XRegistryKey * >( pRegistryKey );
-
- WRITEINFO( ::oox::core::FilterDetect );
- WRITEINFO( ::oox::ppt::PowerPointImport );
- WRITEINFO( ::oox::xls::BiffDetector );
- WRITEINFO( ::oox::xls::ExcelFilter );
- WRITEINFO( ::oox::xls::ExcelBiffFilter );
- WRITEINFO( ::oox::shape::ShapeContextHandler );
- WRITEINFO( ::oox::shape::FastTokenHandlerService );
- WRITEINFO( ::oox::docprop::OOXMLDocPropImportImpl );
- WRITEINFO( ::oox::xls::OOXMLFormulaParser );
- }
- catch (registry::InvalidRegistryException &)
- {
- OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
- }
- }
- return sal_True;
-}
-
#define SINGLEFACTORY(classname)\
if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
{\
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index fb9e43c732de..9b7b00988dd0 100755..100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -74,8 +74,18 @@ namespace core {
namespace {
+struct UrlPool
+{
+ ::osl::Mutex maMutex;
+ ::std::set< OUString > maUrls;
+};
+
+struct StaticUrlPool : public ::rtl::Static< UrlPool, StaticUrlPool > {};
+
+// ----------------------------------------------------------------------------
+
/** This guard prevents recursive loading/saving of the same document. */
-class DocumentOpenedGuard : public ::osl::Mutex
+class DocumentOpenedGuard
{
public:
explicit DocumentOpenedGuard( const OUString& rUrl );
@@ -87,31 +97,28 @@ private:
DocumentOpenedGuard( const DocumentOpenedGuard& );
DocumentOpenedGuard& operator=( const DocumentOpenedGuard& );
- typedef ::std::set< OUString > UrlSet;
- struct UrlPool : public ::rtl::Static< UrlSet, UrlPool > {};
-
- UrlSet& mrUrls;
OUString maUrl;
bool mbValid;
};
-DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl ) :
- mrUrls( UrlPool::get() )
+DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl )
{
- ::osl::MutexGuard aGuard( *this );
- mbValid = (rUrl.getLength() == 0) || (mrUrls.count( rUrl ) == 0);
+ UrlPool& rUrlPool = StaticUrlPool::get();
+ ::osl::MutexGuard aGuard( rUrlPool.maMutex );
+ mbValid = (rUrl.getLength() == 0) || (rUrlPool.maUrls.count( rUrl ) == 0);
if( mbValid && (rUrl.getLength() > 0) )
{
- mrUrls.insert( rUrl );
+ rUrlPool.maUrls.insert( rUrl );
maUrl = rUrl;
}
}
DocumentOpenedGuard::~DocumentOpenedGuard()
{
- ::osl::MutexGuard aGuard( *this );
+ UrlPool& rUrlPool = StaticUrlPool::get();
+ ::osl::MutexGuard aGuard( rUrlPool.maMutex );
if( maUrl.getLength() > 0 )
- mrUrls.erase( maUrl );
+ rUrlPool.maUrls.erase( maUrl );
}
} // namespace
@@ -563,4 +570,3 @@ GraphicHelper* FilterBase::implCreateGraphicHelper() const
} // namespace core
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/titlecontext.cxx b/oox/source/drawingml/chart/titlecontext.cxx
index 963ccdad595a..5ff71109b710 100644
--- a/oox/source/drawingml/chart/titlecontext.cxx
+++ b/oox/source/drawingml/chart/titlecontext.cxx
@@ -68,7 +68,7 @@ ContextHandlerRef TextContext::onCreateContext( sal_Int32 nElement, const Attrib
}
break;
}
- return false;
+ return 0;
}
void TextContext::onEndElement( const OUString& rChars )
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 168055935104..08d001f09a62 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
#include <com/sun/star/drawing/ColorMode.hpp>
@@ -435,6 +436,26 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic );
if( aGraphicUrl.getLength() > 0 )
rPropMap[ PROP_GraphicURL ] <<= aGraphicUrl;
+
+ // cropping
+ if ( maBlipProps.moClipRect.has() )
+ {
+ geometry::IntegerRectangle2D oClipRect( maBlipProps.moClipRect.get() );
+ awt::Size aOriginalSize( rGraphicHelper.getOriginalSize( xGraphic ) );
+ if ( aOriginalSize.Width && aOriginalSize.Height )
+ {
+ text::GraphicCrop aGraphCrop( 0, 0, 0, 0 );
+ if ( oClipRect.X1 )
+ aGraphCrop.Left = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X1 ) / 100000 );
+ if ( oClipRect.Y1 )
+ aGraphCrop.Top = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y1 ) / 100000 );
+ if ( oClipRect.X2 )
+ aGraphCrop.Right = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X2 ) / 100000 );
+ if ( oClipRect.Y2 )
+ aGraphCrop.Bottom = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 100000 );
+ rPropMap[ PROP_GraphicCrop ] <<= aGraphCrop;
+ }
+ }
}
// color effect
diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
index b9d7fa7e1142..cb2037294786 100644
--- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx
+++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
@@ -225,7 +225,15 @@ Reference< XFastContextHandler > BlipFillContext::createFastChildContext(
return new BlipContext( *this, rxAttribs, mrBlipProps );
case A_TOKEN( srcRect ):
- // TODO
+ {
+ rtl::OUString aDefault( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "0" ) ) );
+ ::com::sun::star::geometry::IntegerRectangle2D aClipRect;
+ aClipRect.X1 = GetPercent( aAttribs.getString( XML_l, aDefault ) );
+ aClipRect.Y1 = GetPercent( aAttribs.getString( XML_t, aDefault ) );
+ aClipRect.X2 = GetPercent( aAttribs.getString( XML_r, aDefault ) );
+ aClipRect.Y2 = GetPercent( aAttribs.getString( XML_b, aDefault ) );
+ mrBlipProps.moClipRect = aClipRect;
+ }
break;
case A_TOKEN( tile ):
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index 455778f939f7..ae664cf86668 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -38,6 +38,7 @@
#include <comphelper/seqstream.hxx>
#include "tokens.hxx"
#include "oox/helper/containerhelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
using ::rtl::OUString;
using ::com::sun::star::awt::DeviceInfo;
@@ -52,6 +53,7 @@ using ::com::sun::star::graphic::GraphicObject;
using ::com::sun::star::graphic::XGraphic;
using ::com::sun::star::graphic::XGraphicObject;
using ::com::sun::star::graphic::XGraphicProvider;
+using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::uno::Exception;
@@ -352,6 +354,29 @@ OUString GraphicHelper::importEmbeddedGraphicObject( const OUString& rStreamName
return xGraphic.is() ? createGraphicObject( xGraphic ) : OUString();
}
+Size GraphicHelper::getOriginalSize( const Reference< XGraphic >& xGraphic ) const
+{
+ Size aSize100thMM( 0, 0 );
+ Reference< XPropertySet > xGraphicPropertySet( xGraphic, UNO_QUERY_THROW );
+ if ( xGraphicPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size100thMM" ) ) ) >>= aSize100thMM )
+ {
+ if ( !aSize100thMM.Width && !aSize100thMM.Height )
+ { // MAPMODE_PIXEL USED :-(
+ Size aSourceSizePixel( 0, 0 );
+ if ( xGraphicPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SizePixel" ) ) ) >>= aSourceSizePixel )
+ {
+ const DeviceInfo& rDeviceInfo = getDeviceInfo();
+ if ( rDeviceInfo.PixelPerMeterX && rDeviceInfo.PixelPerMeterY )
+ {
+ aSize100thMM.Width = static_cast< sal_Int32 >( ( aSourceSizePixel.Width * 100000.0 ) / rDeviceInfo.PixelPerMeterX );
+ aSize100thMM.Height = static_cast< sal_Int32 >( ( aSourceSizePixel.Height * 100000.0 ) / rDeviceInfo.PixelPerMeterY );
+ }
+ }
+ }
+ }
+ return aSize100thMM;
+}
+
// ============================================================================
} // namespace oox
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 6ea28f424a83..2a36cb4ff3ca 100755..100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -722,6 +722,30 @@ OUString lclGetQuotedString( const OUString& rCodeLine )
return aBuffer.makeStringAndClear();
}
+bool lclEatWhitespace( OUString& rCodeLine )
+{
+ sal_Int32 nIndex = 0;
+ while( (nIndex < rCodeLine.getLength()) && ((rCodeLine[ nIndex ] == ' ') || (rCodeLine[ nIndex ] == '\t')) )
+ ++nIndex;
+ if( nIndex > 0 )
+ {
+ rCodeLine = rCodeLine.copy( nIndex );
+ return true;
+ }
+ return false;
+}
+
+bool lclEatKeyword( OUString& rCodeLine, const OUString& rKeyword )
+{
+ if( rCodeLine.matchIgnoreAsciiCase( rKeyword ) )
+ {
+ rCodeLine = rCodeLine.copy( rKeyword.getLength() );
+ // success, if code line ends after keyword, or if whitespace follows
+ return (rCodeLine.getLength() == 0) || lclEatWhitespace( rCodeLine );
+ }
+ return false;
+}
+
} // namespace
// ----------------------------------------------------------------------------
@@ -755,10 +779,10 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib,
while( !bBeginFound && !aFrameTextStrm.isEof() )
{
aLine = aFrameTextStrm.readLine().trim();
- bBeginFound = VbaHelper::eatKeyword( aLine, aBegin );
+ bBeginFound = lclEatKeyword( aLine, aBegin );
}
// check for the specific GUID that represents VBA forms
- if( !bBeginFound || !VbaHelper::eatKeyword( aLine, CREATE_OUSTRING( "{C62A69F0-16DC-11CE-9E98-00AA00574A4F}" ) ) )
+ if( !bBeginFound || !lclEatKeyword( aLine, CREATE_OUSTRING( "{C62A69F0-16DC-11CE-9E98-00AA00574A4F}" ) ) )
return;
// remaining line is the form name
diff --git a/oox/source/ole/vbahelper.cxx b/oox/source/ole/vbahelper.cxx
index 7293e357e746..3bf72d30bfa5 100755..100644
--- a/oox/source/ole/vbahelper.cxx
+++ b/oox/source/ole/vbahelper.cxx
@@ -27,27 +27,15 @@
#include "oox/ole/vbahelper.hxx"
#include <rtl/ustrbuf.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/document/XEventsSupplier.hpp>
-#include <comphelper/string.hxx>
#include "oox/helper/binaryinputstream.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::container::XNameReplace;
-using ::com::sun::star::document::XEventsSupplier;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_SET_THROW;
-
namespace oox {
namespace ole {
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::com::sun::star::uno;
+
// ============================================================================
/*static*/ OUString VbaHelper::getBasicScriptUrl(
@@ -91,157 +79,6 @@ namespace ole {
return false;
}
-/*static*/ bool VbaHelper::eatWhitespace( OUString& rCodeLine )
-{
- sal_Int32 nIndex = 0;
- while( (nIndex < rCodeLine.getLength()) && ((rCodeLine[ nIndex ] == ' ') || (rCodeLine[ nIndex ] == '\t')) )
- ++nIndex;
- if( nIndex > 0 )
- {
- rCodeLine = rCodeLine.copy( nIndex );
- return true;
- }
- return false;
-}
-
-/*static*/ bool VbaHelper::eatKeyword( OUString& rCodeLine, const OUString& rKeyword )
-{
- if( rCodeLine.matchIgnoreAsciiCase( rKeyword ) )
- {
- rCodeLine = rCodeLine.copy( rKeyword.getLength() );
- // success, if code line ends after keyword, or if whitespace follows
- return (rCodeLine.getLength() == 0) || eatWhitespace( rCodeLine );
- }
- return false;
-}
-
-/*static*/ OUString VbaHelper::getSourceCode( const Reference< XNameContainer >& rxBasicLib, const OUString& rModuleName )
-{
- OUString aSourceCode;
- if( rxBasicLib.is() ) try
- {
- rxBasicLib->getByName( rModuleName ) >>= aSourceCode;
- }
- catch( Exception& )
- {
- }
- return aSourceCode;
-}
-
-namespace {
-
-bool lclGetLine( OUString& rCodeLine, sal_Int32& rnIndex, const OUString& rSourceCode )
-{
- if( rnIndex < rSourceCode.getLength() )
- {
- sal_Int32 nPosLF = rSourceCode.indexOf( '\n', rnIndex );
- if( nPosLF >= rnIndex )
- {
- rCodeLine = rSourceCode.copy( rnIndex, nPosLF - rnIndex ).trim();
- rnIndex = nPosLF + 1;
- return true;
- }
- }
- return false;
-}
-
-} // namespace
-
-/*static*/ bool VbaHelper::hasMacro( const OUString& rSourceCode, const OUString& rMacroName )
-{
- // scan all text lines for '[Public|Private] [Static] Sub <macroname> (...)'
- const OUString aPublic = CREATE_OUSTRING( "Public" );
- const OUString aPrivate = CREATE_OUSTRING( "Private" );
- const OUString aStatic = CREATE_OUSTRING( "Static" );
- const OUString aSub = CREATE_OUSTRING( "Sub" );
-
- OUString aCodeLine;
- sal_Int32 nIndex = 0;
- while( lclGetLine( aCodeLine, nIndex, rSourceCode ) )
- {
- // eat optional 'Private' or 'Public', but do not accept both keywords in a row (therefore the ||)
- eatKeyword( aCodeLine, aPublic ) || eatKeyword( aCodeLine, aPrivate );
- // eat optional 'Static'
- eatKeyword( aCodeLine, aStatic );
- // eat 'Sub' keyword, check if macro name follows
- if( eatKeyword( aCodeLine, aSub ) && aCodeLine.matchIgnoreAsciiCase( rMacroName ) )
- {
- // eat macro name and following whitespace
- aCodeLine = aCodeLine.copy( rMacroName.getLength() );
- eatWhitespace( aCodeLine );
- // opening bracket must follow the macro name
- if( (aCodeLine.getLength() >= 2) && (aCodeLine[ 0 ] == '(') )
- return true;
- }
- }
- return false;
-}
-
-/*static*/ bool VbaHelper::hasMacro( const Reference< XNameContainer >& rxBasicLib,
- const OUString& rModuleName, const OUString& rMacroName )
-{
- return hasMacro( getSourceCode( rxBasicLib, rModuleName ), rMacroName );
-}
-
-/*static*/ bool VbaHelper::insertMacro( const Reference< XNameContainer >& rxBasicLib, const OUString& rModuleName,
- const OUString& rMacroName, const OUString& rMacroArgs, const OUString& rMacroType, const OUString& rMacroCode )
-{
- if( rxBasicLib.is() ) try
- {
- // receive module source code and check that the specified macro does not exist
- OUString aSourceCode = getSourceCode( rxBasicLib, rModuleName );
- if( !hasMacro( aSourceCode, rMacroName ) )
- {
- bool bFunction = rMacroType.getLength() > 0;
- const sal_Char* pcSubFunc = bFunction ? "Function" : "Sub";
- OUStringBuffer aBuffer( aSourceCode );
- // generate the source code for the new macro
- aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\nPrivate " ) ).
- appendAscii( pcSubFunc ).append( sal_Unicode( ' ' ) ).
- append( rMacroName ).append( sal_Unicode( '(' ) );
- if( rMacroArgs.getLength() > 0 )
- aBuffer.append( sal_Unicode( ' ' ) ).append( rMacroArgs ).append( sal_Unicode( ' ' ) );
- aBuffer.append( sal_Unicode( ')' ) );
- if( bFunction )
- aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " As " ) ).append( rMacroType );
- aBuffer.append( sal_Unicode( '\n' ) );
- // replace all $MACRO placeholders with macro name
- if( rMacroCode.getLength() > 0 )
- {
- OUString aMacroCode = ::comphelper::string::searchAndReplaceAsciiL( rMacroCode, RTL_CONSTASCII_STRINGPARAM( "$MACRO" ), rMacroName );
- aBuffer.append( aMacroCode ).append( sal_Unicode( '\n' ) );
- }
- aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "End " ) ).appendAscii( pcSubFunc ).append( sal_Unicode( '\n' ) );
- rxBasicLib->replaceByName( rModuleName, Any( aBuffer.makeStringAndClear() ) );
- return true;
- }
- }
- catch( Exception& )
- {
- }
- return false;
-}
-
-/*static*/ bool VbaHelper::attachMacroToEvent( const Reference< XEventsSupplier >& rxEventsSupp,
- const OUString& rEventName, const OUString& rLibraryName, const OUString& rModuleName, const OUString& rMacroName )
-{
- if( rxEventsSupp.is() ) try
- {
- Reference< XNameReplace > xEvents( rxEventsSupp->getEvents(), UNO_SET_THROW );
- Sequence< PropertyValue > aEvent( 2 );
- aEvent[ 0 ].Name = CREATE_OUSTRING( "EventType" );
- aEvent[ 0 ].Value <<= CREATE_OUSTRING( "Script" );
- aEvent[ 1 ].Name = CREATE_OUSTRING( "Script" );
- aEvent[ 1 ].Value <<= getBasicScriptUrl( rLibraryName, rModuleName, rMacroName );
- xEvents->replaceByName( rEventName, Any( aEvent ) );
- return true;
- }
- catch( Exception& )
- {
- }
- return false;
-}
-
// ============================================================================
} // namespace ole
diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx
index e9388e54215a..9886f2cc5968 100755..100644
--- a/oox/source/ole/vbamodule.cxx
+++ b/oox/source/ole/vbamodule.cxx
@@ -29,7 +29,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
#include <com/sun/star/script/ModuleType.hpp>
-#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/storagebase.hxx"
#include "oox/helper/textinputstream.hxx"
@@ -38,18 +38,12 @@
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::script::ModuleInfo;
-using ::com::sun::star::script::XVBAModuleInfo;
-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;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-
-namespace ApiModuleType = ::com::sun::star::script::ModuleType;
+
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::script::vba;
+using namespace ::com::sun::star::uno;
namespace oox {
namespace ole {
@@ -60,7 +54,7 @@ VbaModule::VbaModule( const Reference< XModel >& rxDocModel, const OUString& rNa
mxDocModel( rxDocModel ),
maName( rName ),
meTextEnc( eTextEnc ),
- mnType( ApiModuleType::UNKNOWN ),
+ mnType( ModuleType::UNKNOWN ),
mnOffset( SAL_MAX_UINT32 ),
mbReadOnly( false ),
mbPrivate( false ),
@@ -107,13 +101,13 @@ void VbaModule::importDirRecords( BinaryInputStream& rDirStrm )
break;
case VBA_ID_MODULETYPEPROCEDURAL:
OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
- OSL_ENSURE( mnType == ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
- mnType = ApiModuleType::NORMAL;
+ OSL_ENSURE( mnType == ModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
+ mnType = ModuleType::NORMAL;
break;
case VBA_ID_MODULETYPEDOCUMENT:
OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
- OSL_ENSURE( mnType == ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
- mnType = ApiModuleType::DOCUMENT;
+ OSL_ENSURE( mnType == ModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
+ mnType = ModuleType::DOCUMENT;
break;
case VBA_ID_MODULEREADONLY:
OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
@@ -130,7 +124,7 @@ void VbaModule::importDirRecords( BinaryInputStream& rDirStrm )
}
OSL_ENSURE( maName.getLength() > 0, "VbaModule::importDirRecords - missing module name" );
OSL_ENSURE( maStreamName.getLength() > 0, "VbaModule::importDirRecords - missing module stream name" );
- OSL_ENSURE( mnType != ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - missing module type" );
+ OSL_ENSURE( mnType != ModuleType::UNKNOWN, "VbaModule::importDirRecords - missing module type" );
OSL_ENSURE( mnOffset < SAL_MAX_UINT32, "VbaModule::importDirRecords - missing module stream offset" );
}
@@ -155,18 +149,18 @@ void VbaModule::importSourceCode( StorageBase& rVbaStrg,
aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
switch( mnType )
{
- case ApiModuleType::NORMAL:
+ case ModuleType::NORMAL:
aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAModule" ) );
break;
- case ApiModuleType::CLASS:
+ case ModuleType::CLASS:
aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAClassModule" ) );
break;
- case ApiModuleType::FORM:
+ case ModuleType::FORM:
aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAFormModule" ) );
// hack from old filter, document Basic should know the XModel, but it doesn't
aModuleInfo.ModuleObject.set( mxDocModel, UNO_QUERY );
break;
- case ApiModuleType::DOCUMENT:
+ case ModuleType::DOCUMENT:
aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBADocumentModule" ) );
// get the VBA object associated to the document module
if( rxDocObjectNA.is() ) try
@@ -184,7 +178,7 @@ void VbaModule::importSourceCode( StorageBase& rVbaStrg,
if( mbExecutable )
{
aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Option VBASupport 1\n" ) );
- if( mnType == ApiModuleType::CLASS )
+ if( mnType == ModuleType::CLASS )
aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Option ClassModule\n" ) );
}
else
diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx
index a370fb3d168e..deff066a5ed5 100755..100644
--- a/oox/source/ole/vbaproject.cxx
+++ b/oox/source/ole/vbaproject.cxx
@@ -26,14 +26,13 @@
************************************************************************/
#include "oox/ole/vbaproject.hxx"
-#include <com/sun/star/document/XEventsSupplier.hpp>
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/XLibraryContainer.hpp>
-#include <com/sun/star/script/XVBACompat.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <rtl/tencinfo.h>
#include <rtl/ustrbuf.h>
#include <comphelper/configurationhelper.hxx>
@@ -52,27 +51,17 @@
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::document::XEventsSupplier;
-using ::com::sun::star::document::XStorageBasedDocument;
-using ::com::sun::star::embed::XStorage;
-using ::com::sun::star::embed::XTransactedObject;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::io::XStream;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::script::XLibraryContainer;
-using ::com::sun::star::script::XVBACompat;
-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;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::uno::XInterface;
using ::comphelper::ConfigurationHelper;
-namespace ApiModuleType = ::com::sun::star::script::ModuleType;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::script::vba;
+using namespace ::com::sun::star::uno;
namespace oox {
namespace ole {
@@ -184,70 +173,6 @@ bool VbaProject::hasDialog( const OUString& rDialogName ) const
return mxDialogLib.is() && mxDialogLib->hasByName( rDialogName );
}
-// Insert VBA code modules and VBA macros into modules ------------------------
-
-bool VbaProject::insertMacro( const OUString& rModuleName,
- const OUString& rMacroName, const OUString& rMacroArgs,
- const OUString& rMacroType, const OUString& rMacroCode )
-{
- return
- // do nothing if macros are imported as comments
- isImportVbaExecutable() &&
- // try to insert the macro (will check that the macro does not exist yet)
- VbaHelper::insertMacro( mxBasicLib, rModuleName, rMacroName, rMacroArgs, rMacroType, rMacroCode );
-}
-
-// Attach VBA macros to generic or document events ----------------------------
-
-bool VbaProject::attachMacroToEvent( const Reference< XEventsSupplier >& rxEventsSupp,
- const OUString& rEventName, const OUString& rModuleName, const OUString& rMacroName )
-{
- return
- // do not attach if macros are imported as comments
- isImportVbaExecutable() &&
- // check that the specified macro exists in the module
- VbaHelper::hasMacro( mxBasicLib, rModuleName, rMacroName ) &&
- // attach the macro to the events supplier
- VbaHelper::attachMacroToEvent( rxEventsSupp, rEventName, maLibName, rModuleName, rMacroName );
-}
-
-bool VbaProject::attachMacroToDocumentEvent( const OUString& rEventName,
- const OUString& rModuleName, const OUString& rMacroName )
-{
- Reference< XEventsSupplier > xEventsSupp( mxDocModel, UNO_QUERY );
- return attachMacroToEvent( xEventsSupp, rEventName, rModuleName, rMacroName );
-}
-
-bool VbaProject::attachMacroToEvent( const Reference< XEventsSupplier >& rxEventsSupp,
- const OUString& rEventName, const OUString& rModuleName, const OUString& rMacroName,
- const OUString& rProxyArgs, const OUString& rProxyType, const OUString& rProxyCode )
-{
- // receive module source code, and check that the specified macro exists in the module
- OUString aSourceCode = VbaHelper::getSourceCode( mxBasicLib, rModuleName );
- if( isImportVbaExecutable() && VbaHelper::hasMacro( aSourceCode, rMacroName ) )
- {
- // create the name of the proxy macro, and the macro source code
- OUString aProxyName = OUStringBuffer( rMacroName ).append( sal_Unicode( '_' ) ).
- append( rEventName ).appendAscii( "_Proxy" ).makeStringAndClear();
- // replace $MACRO and $PROXY placeholders in proxy source code
- OUString aProxyCode = ::comphelper::string::searchAndReplaceAsciiL( rProxyCode, RTL_CONSTASCII_STRINGPARAM( "$MACRO" ), rMacroName );
- aProxyCode = ::comphelper::string::searchAndReplaceAsciiL( aProxyCode, RTL_CONSTASCII_STRINGPARAM( "$PROXY" ), aProxyName );
- // insert the new macro into the code module and attach it to the event
- return
- VbaHelper::insertMacro( mxBasicLib, rModuleName, aProxyName, rProxyArgs, rProxyType, aProxyCode ) &&
- VbaHelper::attachMacroToEvent( rxEventsSupp, rEventName, maLibName, rModuleName, aProxyName );
- }
- return false;
-}
-
-bool VbaProject::attachMacroToDocumentEvent(
- const OUString& rEventName, const OUString& rModuleName, const OUString& rMacroName,
- const OUString& rProxyArgs, const OUString& rProxyType, const OUString& rProxyCode )
-{
- Reference< XEventsSupplier > xEventsSupp( mxDocModel, UNO_QUERY );
- return attachMacroToEvent( xEventsSupp, rEventName, rModuleName, rMacroName, rProxyArgs, rProxyType, rProxyCode );
-}
-
// private --------------------------------------------------------------------
Reference< XLibraryContainer > VbaProject::getLibraryContainer( sal_Int32 nPropId )
@@ -394,23 +319,23 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
bExitLoop = (nLineLen >= 2) && (aLine[ 0 ] == '[') && (aLine[ nLineLen - 1 ] == ']');
if( !bExitLoop && VbaHelper::extractKeyValue( aKey, aValue, aLine ) )
{
- sal_Int32 nType = ApiModuleType::UNKNOWN;
+ sal_Int32 nType = ModuleType::UNKNOWN;
if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Document" ) ) )
{
- nType = ApiModuleType::DOCUMENT;
+ nType = ModuleType::DOCUMENT;
// strip automation server version from module names
sal_Int32 nSlashPos = aValue.indexOf( '/' );
if( nSlashPos >= 0 )
aValue = aValue.copy( 0, nSlashPos );
}
else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Module" ) ) )
- nType = ApiModuleType::NORMAL;
+ nType = ModuleType::NORMAL;
else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Class" ) ) )
- nType = ApiModuleType::CLASS;
+ nType = ModuleType::CLASS;
else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "BaseClass" ) ) )
- nType = ApiModuleType::FORM;
+ nType = ModuleType::FORM;
- if( (nType != ApiModuleType::UNKNOWN) && (aValue.getLength() > 0) )
+ if( (nType != ModuleType::UNKNOWN) && (aValue.getLength() > 0) )
{
OSL_ENSURE( aModules.has( aValue ), "VbaProject::importVba - module not found" );
if( VbaModule* pModule = aModules.get( aValue ).get() )
@@ -426,13 +351,23 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
specified. */
if( !aModules.empty() ) try
{
- // get the basic library
+ // get the model factory and the basic library
+ Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW );
Reference< XNameContainer > xBasicLib( createBasicLibrary(), UNO_SET_THROW );
// set library container to VBA compatibility mode
try
{
- Reference< XVBACompat >( getLibraryContainer( PROP_BasicLibraries ), UNO_QUERY_THROW )->setVBACompatModeOn( sal_True );
+ Reference< XVBACompatibility >( getLibraryContainer( PROP_BasicLibraries ), UNO_QUERY_THROW )->setVBACompatibilityMode( sal_True );
+ }
+ catch( Exception& )
+ {
+ }
+
+ // create the VBAGlobals object, the model will store it in the Basic manager
+ try
+ {
+ xModelFactory->createInstance( CREATE_OUSTRING( "ooo.vba.VBAGlobals" ) );
}
catch( Exception& )
{
@@ -442,7 +377,6 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
Reference< XNameAccess > xDocObjectNA;
try
{
- Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW );
xDocObjectNA.set( xModelFactory->createInstance( CREATE_OUSTRING( "ooo.vba.VBAObjectModuleObjectProvider" ) ), UNO_QUERY );
}
catch( Exception& )
@@ -475,7 +409,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
{
// resolve module name from storage name (which equals the module stream name)
VbaModule* pModule = aModulesByStrm.get( *aIt ).get();
- OSL_ENSURE( pModule && (pModule->getType() == ApiModuleType::FORM),
+ OSL_ENSURE( pModule && (pModule->getType() == ModuleType::FORM),
"VbaProject::importVba - form substorage without form module" );
OUString aModuleName;
if( pModule )
diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx
index 69f32e01e7eb..7e77f5a54938 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -145,7 +145,14 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s
mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr );
}
break;
+
case NMSP_PPT|XML_bgRef: // a:CT_StyleMatrixReference
+ {
+ FillPropertiesPtr pFillPropertiesPtr( new FillProperties(
+ *mpSlidePersistPtr->getTheme()->getFillStyle( xAttribs->getOptionalValue( XML_idx ).toInt32() ) ) );
+ xRet.set( new ColorContext( *this, mpSlidePersistPtr->getBackgroundColorRef() ) );
+ mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr );
+ }
break;
case NMSP_PPT|XML_clrMap: // CT_ColorMapping
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index ce99ffc49f19..8555ba371b77 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -173,12 +173,17 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase )
{
try
{
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT;
+ if ( maBackgroundColorRef.isUsed() )
+ nPhClr = maBackgroundColorRef.getColor( rFilterBase.getGraphicHelper() );
+
PropertyMap aPropMap;
static const rtl::OUString sBackground( RTL_CONSTASCII_USTRINGPARAM( "Background" ) );
uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xPropertySet( aPropMap.makePropertySet() );
PropertySet aPropSet( xPropertySet );
- mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), rFilterBase.getGraphicHelper() );
+ mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(),
+ rFilterBase.getGraphicHelper(), oox::drawingml::FillProperties::DEFAULT_IDS, 0, nPhClr );
xPagePropSet->setPropertyValue( sBackground, Any( xPropertySet ) );
}
catch( Exception )
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index da1aeb2ed265..ba51c3577a8e 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -166,6 +166,7 @@ Geometry3D
GradientName
Graphic
GraphicColorMode
+GraphicCrop
GraphicSize
GraphicURL
GridColor
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index ec7da1d4d900..08115d4f8d25 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -170,7 +170,7 @@ ShapeContextBase::ShapeContextBase( ContextHandler2Helper& rParent ) :
case VML_TOKEN( image ):
return new ShapeContext( rParent, rAttribs, rShapes.createShape< ComplexShape >() );
}
- return false;
+ return 0;
}
// ============================================================================
diff --git a/oox/source/xls/defnamesbuffer.cxx b/oox/source/xls/defnamesbuffer.cxx
index 69214034fee7..a02375e2b869 100644
--- a/oox/source/xls/defnamesbuffer.cxx
+++ b/oox/source/xls/defnamesbuffer.cxx
@@ -486,8 +486,9 @@ void DefinedName::importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcShee
void DefinedName::createNameObject()
{
- // do not create hidden names and names for (macro) functions
- if( maModel.mbHidden || maModel.mbFunction )
+ // do not create names for (macro) functions
+ // #163146# do not ignore hidden names (may be regular names created by VBA scripts)
+ if( /*maModel.mbHidden ||*/ maModel.mbFunction )
return;
// convert original name to final Calc name
@@ -498,10 +499,13 @@ void DefinedName::createNameObject()
else
maCalcName = maModel.maName; //! TODO convert to valid name
+ // #163146# do not rename sheet-local names by default, this breaks VBA scripts
+#if 0
// append sheet index for local names in multi-sheet documents
if( isWorkbookFile() && !isGlobalName() )
maCalcName = OUStringBuffer( maCalcName ).append( sal_Unicode( '_' ) ).
append( static_cast< sal_Int32 >( mnCalcSheet + 1 ) ).makeStringAndClear();
+#endif
// special flags for this name
sal_Int32 nNameFlags = 0;
diff --git a/oox/source/xls/excelfilter.cxx b/oox/source/xls/excelfilter.cxx
index 71475790851f..5affbfff44a7 100644
--- a/oox/source/xls/excelfilter.cxx
+++ b/oox/source/xls/excelfilter.cxx
@@ -115,19 +115,18 @@ ExcelFilter::~ExcelFilter()
bool ExcelFilter::importDocument() throw()
{
- /* to activate the XLSX/XLSB dumper, define the environment variable
- OOO_XLSBDUMPER and insert the full path to the file
- file:///<path-to-oox-module>/source/dump/xlsbdumper.ini. */
+ /* To activate the XLSX/XLSB dumper, insert the full path to the file
+ file:///<path-to-oox-module>/source/dump/xlsbdumper.ini
+ into the environment variable OOO_XLSBDUMPER and start the office with
+ this variable (nonpro only). */
OOX_DUMP_FILE( ::oox::dump::xlsb::Dumper );
- bool bRet = false;
OUString aWorkbookPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "officeDocument" ) );
- if( aWorkbookPath.getLength() > 0 )
- {
- WorkbookHelperRoot aHelper( *this );
- bRet = aHelper.isValid() && importFragment( new OoxWorkbookFragment( aHelper, aWorkbookPath ) );
- }
- return bRet;
+ if( aWorkbookPath.getLength() == 0 )
+ return false;
+
+ WorkbookHelperRoot aHelper( *this );
+ return aHelper.isValid() && importFragment( new OoxWorkbookFragment( aHelper, aWorkbookPath ) );
}
bool ExcelFilter::exportDocument() throw()
@@ -198,31 +197,30 @@ ExcelBiffFilter::~ExcelBiffFilter()
bool ExcelBiffFilter::importDocument() throw()
{
- /* to activate the BIFF dumper, define the environment variable
- OOO_BIFFDUMPER and insert the full path to the file
- file:///<path-to-oox-module>/source/dump/biffdumper.ini. */
+ /* To activate the BIFF dumper, insert the full path to the file
+ file:///<path-to-oox-module>/source/dump/biffdumper.ini
+ into the environment variable OOO_BIFFDUMPER and start the office with
+ this variable (nonpro only). */
OOX_DUMP_FILE( ::oox::dump::biff::Dumper );
/* The boolean argument "UseBiffFilter" passed through XInitialisation
- decides whether to use the BIFF file dumper implemented in this filter
- only (false or missing), or to import/export the document (true). */
+ decides whether to import/export the document with this filter (true),
+ or to only use the BIFF file dumper implemented in this filter (false
+ or missing) */
Any aUseBiffFilter = getArgument( CREATE_OUSTRING( "UseBiffFilter" ) );
bool bUseBiffFilter = false;
if( !(aUseBiffFilter >>= bUseBiffFilter) || !bUseBiffFilter )
return true;
- bool bRet = false;
-
// detect BIFF version and workbook stream name
OUString aWorkbookName;
BiffType eBiff = BiffDetector::detectStorageBiffVersion( aWorkbookName, getStorage() );
OSL_ENSURE( eBiff != BIFF_UNKNOWN, "ExcelBiffFilter::ExcelBiffFilter - invalid file format" );
- if( eBiff != BIFF_UNKNOWN )
- {
- WorkbookHelperRoot aHelper( *this, eBiff );
- bRet = aHelper.isValid() && BiffWorkbookFragment( aHelper, aWorkbookName ).importFragment();
- }
- return bRet;
+ if( eBiff == BIFF_UNKNOWN )
+ return false;
+
+ WorkbookHelperRoot aHelper( *this, eBiff );
+ return aHelper.isValid() && BiffWorkbookFragment( aHelper, aWorkbookName ).importFragment();
}
bool ExcelBiffFilter::exportDocument() throw()
@@ -244,4 +242,3 @@ OUString ExcelBiffFilter::implGetImplementationName() const
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/excelvbaproject.cxx b/oox/source/xls/excelvbaproject.cxx
deleted file mode 100755
index fc3caf7e59aa..000000000000
--- a/oox/source/xls/excelvbaproject.cxx
+++ /dev/null
@@ -1,214 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/xls/excelvbaproject.hxx"
-#include <com/sun/star/container/XEnumeration.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/document/XEventsSupplier.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include "properties.hxx"
-#include "oox/helper/helper.hxx"
-#include "oox/helper/propertyset.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::container::XEnumeration;
-using ::com::sun::star::container::XEnumerationAccess;
-using ::com::sun::star::document::XEventsSupplier;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::sheet::XSpreadsheetDocument;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-VbaProject::VbaProject( const Reference< XMultiServiceFactory >& rxGlobalFactory, const Reference< XSpreadsheetDocument >& rxDocument ) :
- ::oox::ole::VbaProject( rxGlobalFactory, Reference< XModel >( rxDocument, UNO_QUERY ), CREATE_OUSTRING( "Calc" ) ),
- mxDocument( rxDocument )
-{
-}
-
-void VbaProject::attachToEvents()
-{
- // do nothing is code is not executable
- if( !isImportVbaExecutable() )
- return;
-
- // document events
- PropertySet aDocProp( mxDocument );
- OUString aCodeName;
- aDocProp.getProperty( aCodeName, PROP_CodeName );
- attachToDocumentEvents( aCodeName );
-
- // sheet events
- if( mxDocument.is() ) try
- {
- Reference< XEnumerationAccess > xSheetsEA( mxDocument->getSheets(), UNO_QUERY_THROW );
- Reference< XEnumeration > xSheetsEnum( xSheetsEA->createEnumeration(), UNO_SET_THROW );
- // own try/catch for every sheet
- while( xSheetsEnum->hasMoreElements() ) try
- {
- // TODO: once we have chart sheets we need a switch/case on sheet type
- Reference< XEventsSupplier > xEventsSupp( xSheetsEnum->nextElement(), UNO_QUERY_THROW );
- PropertySet aSheetProp( xEventsSupp );
- aSheetProp.getProperty( aCodeName, PROP_CodeName );
- attachToSheetEvents( xEventsSupp, aCodeName );
- }
- catch( Exception& )
- {
- }
- }
- catch( Exception& )
- {
- }
-}
-
-// private --------------------------------------------------------------------
-
-void VbaProject::attachToDocumentEvents( const OUString& rCodeName )
-{
- if( (rCodeName.getLength() == 0) || !hasModule( rCodeName ) )
- return;
-
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnLoad" ), rCodeName, CREATE_OUSTRING( "Workbook_Open" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnFocus" ), rCodeName, CREATE_OUSTRING( "Workbook_Activate" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnUnfocus" ), rCodeName, CREATE_OUSTRING( "Workbook_Deactivate" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSave" ), rCodeName, CREATE_OUSTRING( "Workbook_BeforeSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False, False" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveAs" ), rCodeName, CREATE_OUSTRING( "Workbook_BeforeSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO True, False" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveDone" ), rCodeName, CREATE_OUSTRING( "Workbook_AfterSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO True" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveAsDone" ), rCodeName, CREATE_OUSTRING( "Workbook_AfterSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO True" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveFailed" ), rCodeName, CREATE_OUSTRING( "Workbook_AfterSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveAsFailed" ), rCodeName, CREATE_OUSTRING( "Workbook_AfterSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnPrint" ), rCodeName, CREATE_OUSTRING( "Workbook_BeforePrint" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False" ) );
- attachMacroToDocumentEvent( CREATE_OUSTRING( "OnPrepareUnload" ), rCodeName, CREATE_OUSTRING( "Workbook_BeforeClose" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False" ) );
-}
-
-void VbaProject::attachToSheetEvents( const Reference< XEventsSupplier >& rxEventsSupp, const OUString& rCodeName )
-{
- if( !rxEventsSupp.is() || (rCodeName.getLength() == 0) || !hasModule( rCodeName ) )
- return;
-
- // attach macros to simple sheet events directly
- attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnFocus" ), rCodeName, CREATE_OUSTRING( "Worksheet_Activate" ) );
- attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnUnfocus" ), rCodeName, CREATE_OUSTRING( "Worksheet_Deactivate" ) );
- attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnCalculate" ), rCodeName, CREATE_OUSTRING( "Worksheet_Calculate" ) );
-
- /* Attach macros to complex sheet events. The events pass a cell range or
- a collection of cell ranges depending on the event type and sheet
- selection. The generated proxy macros need to convert these UNO renges
- to VBA compatible ranges.
- */
-
-#define VBA_MACRONAME_RANGECONV "Local_GetVbaRangeFromUnoRange"
-#define VBA_MACRONAME_TARGETCONV "Local_GetVbaTargetFromUnoTarget"
-
- /* If this variable turns to true, the macros that convert UNO cell ranges
- to VBA Range objects have to be inserted.
- */
- bool bNeedsTargetHelper = false;
-
- /* Insert the proxy macros attached to sheet events that notify something
- has changed (changed selection and changed cell contents). These events
- cannot be cancelled. The proxy macro converts the passed UNO cell range
- or collection of cell ranges to a VBA Range object, and calls the VBA
- event handler.
- */
- OUString aChangeProxyArgs = CREATE_OUSTRING( "ByVal unoTarget As Object" );
- OUString aChangeProxyCode = CREATE_OUSTRING(
- "\tDim vbaTarget As Range : Set vbaTarget = " VBA_MACRONAME_TARGETCONV "( unoTarget )\n"
- "\tIf Not vbaTarget Is Nothing Then $MACRO vbaTarget" );
- bNeedsTargetHelper |= attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnChange" ), rCodeName, CREATE_OUSTRING( "Worksheet_Change" ), aChangeProxyArgs, OUString(), aChangeProxyCode );
- bNeedsTargetHelper |= attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnSelect" ), rCodeName, CREATE_OUSTRING( "Worksheet_SelectionChange" ), aChangeProxyArgs, OUString(), aChangeProxyCode );
-
- /* Insert the proxy macros attached to sheet events that notify an ongoing
- mouse click event (double click and right click). These events can be
- cancelled by returning false (in VBA: as a Boolean output parameter, in
- UNO: as return value of the Basic function). The proxy macro converts
- the passed UNO cell range or collection of cell ranges to a VBA Range
- object, calls the VBA event handler, and returns the Boolean value
- provided by the VBA event handler.
- */
- OUString aClickProxyArgs = CREATE_OUSTRING( "ByVal unoTarget As Object" );
- OUString aClickProxyRetT = CREATE_OUSTRING( "Boolean" );
- OUString aClickProxyCode = CREATE_OUSTRING(
- "\tDim Cancel As Boolean : Cancel = False\n"
- "\tDim vbaTarget As Range : Set vbaTarget = " VBA_MACRONAME_TARGETCONV "( unoTarget )\n"
- "\tIf Not vbaTarget Is Nothing Then $MACRO vbaTarget, Cancel\n"
- "\t$PROXY = Cancel" );
- bNeedsTargetHelper |= attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnDoubleClick" ), rCodeName, CREATE_OUSTRING( "Worksheet_BeforeDoubleClick" ), aClickProxyArgs, aClickProxyRetT, aClickProxyCode );
- bNeedsTargetHelper |= attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnRightClick" ), rCodeName, CREATE_OUSTRING( "Worksheet_BeforeRightClick" ), aClickProxyArgs, aClickProxyRetT, aClickProxyCode );
-
- if( bNeedsTargetHelper )
- {
- /* Generate a helper function that converts a
- com.sun.star.sheet.SheetCellRange object to a VBA Range object.
- */
- OUString aRangeConvName = CREATE_OUSTRING( VBA_MACRONAME_RANGECONV );
- OUString aRangeConvArgs = CREATE_OUSTRING( "ByVal unoRange As com.sun.star.sheet.SheetCellRange" );
- OUString aRangeConvRetT = CREATE_OUSTRING( "Range" );
- OUString aRangeConvCode = CREATE_OUSTRING(
- "\tDim unoAddress As com.sun.star.table.CellRangeAddress : Set unoAddress = unoRange.RangeAddress\n"
- "\tDim vbaSheet As Worksheet : Set vbaSheet = Application.ThisWorkbook.Sheets( unoAddress.Sheet + 1 )\n"
- "\tSet $MACRO = vbaSheet.Range( vbaSheet.Cells( unoAddress.StartRow + 1, unoAddress.StartColumn + 1 ), vbaSheet.Cells( unoAddress.EndRow + 1, unoAddress.EndColumn + 1 ) )" );
- insertMacro( rCodeName, aRangeConvName, aRangeConvArgs, aRangeConvRetT, aRangeConvCode );
-
- /* Generate a helper function that converts a generic range selection
- object (com.sun.star.sheet.SheetCellRange or
- com.sun.star.sheet.SheetCellRanges) to a VBA Range object.
- */
- OUString aTargetConvName = CREATE_OUSTRING( VBA_MACRONAME_TARGETCONV );
- OUString aTargetConvArgs = CREATE_OUSTRING( "ByVal unoTarget As Object" );
- OUString aTargetConvRetT = CREATE_OUSTRING( "Range" );
- OUString aTargetConvCode = CREATE_OUSTRING(
- "\tDim vbaTarget As Range\n"
- "\tIf unoTarget.supportsService( \"com.sun.star.sheet.SheetCellRange\" ) Then\n"
- "\t\tSet vbaTarget = " VBA_MACRONAME_RANGECONV "( unoTarget )\n"
- "\tElseIf unoTarget.supportsService( \"com.sun.star.sheet.SheetCellRanges\" ) Then\n"
- "\t\tDim unoRangeEnum As Object : Set unoRangeEnum = unoTarget.createEnumeration\n"
- "\t\tIf unoRangeEnum.hasMoreElements Then Set vbaTarget = " VBA_MACRONAME_RANGECONV "( unoRangeEnum.nextElement )\n"
- "\t\tWhile unoRangeEnum.hasMoreElements\n"
- "\t\t\tSet vbaTarget = Application.Union( vbaTarget, " VBA_MACRONAME_RANGECONV "( unoRangeEnum.nextElement ) )\n"
- "\t\tWend\n"
- "\tEnd If\n"
- "\tSet $MACRO = vbaTarget" );
- insertMacro( rCodeName, aTargetConvName, aTargetConvArgs, aTargetConvRetT, aTargetConvCode );
- }
-#undef VBA_MACRONAME_RANGECONV
-#undef VBA_MACRONAME_TARGETCONV
-}
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
diff --git a/oox/source/xls/externallinkfragment.cxx b/oox/source/xls/externallinkfragment.cxx
index 15aaf8bc5412..e1bff95ff724 100644
--- a/oox/source/xls/externallinkfragment.cxx
+++ b/oox/source/xls/externallinkfragment.cxx
@@ -255,7 +255,7 @@ ContextHandlerRef OoxExternalLinkFragment::onCreateContext( sal_Int32 nElement,
if( nElement == XLS_TOKEN( oleItem ) ) mxExtName = mrExtLink.importOleItem( rAttribs );
break;
}
- return false;
+ return 0;
}
void OoxExternalLinkFragment::onEndElement( const OUString& rChars )
diff --git a/oox/source/xls/makefile.mk b/oox/source/xls/makefile.mk
index b5ede953bbfe..cdb2e18c262d 100644
--- a/oox/source/xls/makefile.mk
+++ b/oox/source/xls/makefile.mk
@@ -59,7 +59,6 @@ SLOFILES = \
$(SLO)$/excelchartconverter.obj \
$(SLO)$/excelfilter.obj \
$(SLO)$/excelhandlers.obj \
- $(SLO)$/excelvbaproject.obj \
$(SLO)$/externallinkbuffer.obj \
$(SLO)$/externallinkfragment.obj \
$(SLO)$/formulabase.obj \
diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx
index afeed95accca..5684fbd8ae75 100644
--- a/oox/source/xls/workbookhelper.cxx
+++ b/oox/source/xls/workbookhelper.cxx
@@ -43,6 +43,7 @@
#include "properties.hxx"
#include "oox/helper/progressbar.hxx"
#include "oox/helper/propertyset.hxx"
+#include "oox/ole/vbaproject.hxx"
#include "oox/drawingml/theme.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
@@ -50,7 +51,6 @@
#include "oox/xls/defnamesbuffer.hxx"
#include "oox/xls/excelchartconverter.hxx"
#include "oox/xls/excelfilter.hxx"
-#include "oox/xls/excelvbaproject.hxx"
#include "oox/xls/externallinkbuffer.hxx"
#include "oox/xls/formulaparser.hxx"
#include "oox/xls/pagesettings.hxx"
@@ -687,14 +687,12 @@ void WorkbookHelper::finalizeWorkbookImport()
aDefPageStyle.setProperty< sal_Int16 >( PROP_FirstPageNumber, 0 );
/* Import the VBA project (after finalizing workbook settings which
- contains the workbook code name), and attach VBA macros to document and
- sheet events. */
+ contains the workbook code name). */
StorageRef xVbaPrjStrg = mrBookData.getVbaProjectStorage();
if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
{
- VbaProject aVbaProject( getGlobalFactory(), getDocument() );
+ ::oox::ole::VbaProject aVbaProject( getGlobalFactory(), getBaseFilter().getModel(), CREATE_OUSTRING( "Calc" ) );
aVbaProject.importVbaProject( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() );
- aVbaProject.attachToEvents();
}
}
diff --git a/oox/util/makefile.mk b/oox/util/makefile.mk
index 8bbf8a3650f2..329ced792164 100644
--- a/oox/util/makefile.mk
+++ b/oox/util/makefile.mk
@@ -94,3 +94,11 @@ DEFLIB1NAME =$(TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/oox.component
+
+$(MISC)/oox.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ oox.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt oox.component
diff --git a/oox/util/oox.component b/oox/util/oox.component
new file mode 100644
index 000000000000..686ee6f1728e
--- /dev/null
+++ b/oox/util/oox.component
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.Impress.oox.PowerPointImport">
+ <service name="com.sun.star.comp.ooxpptx"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.BiffDetector">
+ <service name="com.sun.star.frame.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.ExcelBiffFilter">
+ <service name="com.sun.star.comp.oox.ExcelBiffFilter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.ExcelFilter">
+ <service name="com.sun.star.comp.oox.ExcelFilter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.FastTokenHandlerService">
+ <service name="com.sun.star.xml.sax.FastTokenHandler"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.FormatDetector">
+ <service name="com.sun.star.frame.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.OOXMLFormulaParser">
+ <service name="com.sun.star.sheet.FilterFormulaParser"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.ShapeContextHandler">
+ <service name="com.sun.star.xml.sax.FastShapeContextHandler"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.docprop.OOXMLDocumentPropertiesImporter">
+ <service name="com.sun.star.document.OOXMLDocumentPropertiesImporter"/>
+ </implementation>
+</component>