summaryrefslogtreecommitdiff
path: root/oox/inc/oox
diff options
context:
space:
mode:
Diffstat (limited to 'oox/inc/oox')
-rw-r--r--[-rwxr-xr-x]oox/inc/oox/ole/vbamodule.hxx19
-rw-r--r--oox/inc/oox/ole/vbaproject.hxx21
-rwxr-xr-xoox/inc/oox/xls/excelvbaproject.hxx68
3 files changed, 105 insertions, 3 deletions
diff --git a/oox/inc/oox/ole/vbamodule.hxx b/oox/inc/oox/ole/vbamodule.hxx
index 3b529ceee129..377c7abc335a 100755..100644
--- a/oox/inc/oox/ole/vbamodule.hxx
+++ b/oox/inc/oox/ole/vbamodule.hxx
@@ -68,11 +68,26 @@ public:
/** Imports all records for this module until the MODULEEND record. */
void importDirRecords( BinaryInputStream& rDirStrm );
- /** Imports the Basic source code into the passed Basic library. */
- void importSourceCode(
+
+ /** Imports the VBA source code into the passed Basic library. */
+ void createAndImportModule(
StorageBase& rVbaStrg,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+ /** Creates an empty Basic module in the passed Basic library. */
+ void createEmptyModule(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+
+private:
+ /** Reads and returns the VBA source code from the passed storage. */
+ ::rtl::OUString readSourceCode( StorageBase& rVbaStrg ) const;
+
+ /** Creates a new Basic module and inserts it into the passed Basic library. */
+ void createModule(
+ const ::rtl::OUString& rVBASourceCode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
private:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx
index 1d2fca29dbab..e8d9aa7c0f5d 100644
--- a/oox/inc/oox/ole/vbaproject.hxx
+++ b/oox/inc/oox/ole/vbaproject.hxx
@@ -97,6 +97,18 @@ public:
/** Returns true, if the document contains the specified dialog. */
bool hasDialog( const ::rtl::OUString& rDialogName ) const;
+protected:
+ /** Registers a dummy module that will be created when the VBA project is
+ imported. */
+ void addDummyModule( const ::rtl::OUString& rName, sal_Int32 nType );
+ /** Creates all dummy modules in the document. */
+ void createDummyModules();
+
+ /** Called when the import process of the VBA project has been started. */
+ virtual void prepareImport();
+ /** Called when the import process of the VBA project is finished. */
+ virtual void finalizeImport();
+
private:
VbaProject( const VbaProject& );
VbaProject& operator=( const VbaProject& );
@@ -113,12 +125,18 @@ private:
/** Creates and returns the dialog library of the document used for import. */
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
createDialogLibrary();
+
/** Imports the VBA code modules and forms. */
- void importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr );
+ void importVba(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr );
/** Copies the entire VBA project storage to the passed document model. */
void copyStorage( StorageBase& rVbaPrjStrg );
private:
+ typedef ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap;
+
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
mxGlobalFactory; /// Global service factory.
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
@@ -127,6 +145,7 @@ private:
mxBasicLib; /// The Basic library of the document used for import.
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
mxDialogLib; /// The dialog library of the document used for import.
+ DummyModuleMap maDummyModules; /// Additional empty modules created on import.
const ::rtl::OUString maLibName; /// Name for Basic and dialog library used for import.
};
diff --git a/oox/inc/oox/xls/excelvbaproject.hxx b/oox/inc/oox/xls/excelvbaproject.hxx
new file mode 100755
index 000000000000..121e6a1667cd
--- /dev/null
+++ b/oox/inc/oox/xls/excelvbaproject.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * 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 ExcelVbaProject : public ::oox::ole::VbaProject
+{
+public:
+ explicit ExcelVbaProject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument );
+
+ /** Generates VBA modules for sheets that do not specify a codename. */
+ void createMissingModules();
+
+protected:
+ /** Adds dummy modules for sheets without imported code name. */
+ virtual void prepareImport();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >
+ mxDocument;
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif