diff options
Diffstat (limited to 'oox/inc/oox/xls')
-rw-r--r-- | oox/inc/oox/xls/biffhelper.hxx | 2 | ||||
-rw-r--r-- | oox/inc/oox/xls/excelfilter.hxx | 22 | ||||
-rwxr-xr-x | oox/inc/oox/xls/excelvbaproject.hxx | 73 | ||||
-rw-r--r-- | oox/inc/oox/xls/stylesbuffer.hxx | 19 | ||||
-rw-r--r-- | oox/inc/oox/xls/workbookhelper.hxx | 106 | ||||
-rw-r--r-- | oox/inc/oox/xls/worksheetsettings.hxx | 2 |
6 files changed, 119 insertions, 105 deletions
diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx index f425b983ada2..b4f36c113c3d 100644 --- a/oox/inc/oox/xls/biffhelper.hxx +++ b/oox/inc/oox/xls/biffhelper.hxx @@ -493,6 +493,8 @@ const sal_uInt16 BIFF_ID_TOPMARGIN = 0x0028; const sal_uInt16 BIFF_ID_TXO = 0x01B6; const sal_uInt16 BIFF_ID_UNCALCED = 0x005E; const sal_uInt16 BIFF_ID_USESELFS = 0x0160; +const sal_uInt16 BIFF_ID_VBAPROJECT = 0x00D3; +const sal_uInt16 BIFF_ID_VBAPROJECTEMPTY = 0x01BD; const sal_uInt16 BIFF_ID_VCENTER = 0x0084; const sal_uInt16 BIFF_ID_VERPAGEBREAKS = 0x001A; const sal_uInt16 BIFF_ID_WINDOW1 = 0x003D; diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx index 5da8b50d7f92..b5d7a97f33b5 100644 --- a/oox/inc/oox/xls/excelfilter.hxx +++ b/oox/inc/oox/xls/excelfilter.hxx @@ -34,22 +34,23 @@ namespace oox { namespace xls { -// ============================================================================ +class WorkbookData; -class WorkbookHelper; +// ============================================================================ class ExcelFilterBase { +public: + void registerWorkbookData( WorkbookData& rData ); + WorkbookData& getWorkbookData() const; + void unregisterWorkbookData(); + protected: explicit ExcelFilterBase(); virtual ~ExcelFilterBase(); - void setWorkbookHelper( WorkbookHelper& rHelper ); - WorkbookHelper& getWorkbookHelper() const; - void clearWorkbookHelper(); - private: - WorkbookHelper* mpHelper; /// Nonowning pointer to helper base. + WorkbookData* mpData; }; // ============================================================================ @@ -64,15 +65,13 @@ public: virtual bool importDocument() throw(); virtual bool exportDocument() throw(); - virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const; - virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const; - virtual const ::oox::drawingml::Theme* getCurrentTheme() const; virtual ::oox::vml::Drawing* getVmlDrawing(); virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles(); virtual ::oox::drawingml::chart::ChartConverter& getChartConverter(); private: + virtual GraphicHelper* implCreateGraphicHelper() const; virtual ::rtl::OUString implGetImplementationName() const; }; @@ -88,9 +87,8 @@ public: virtual bool importDocument() throw(); virtual bool exportDocument() throw(); - virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const; - private: + virtual GraphicHelper* implCreateGraphicHelper() const; virtual ::rtl::OUString implGetImplementationName() const; }; diff --git a/oox/inc/oox/xls/excelvbaproject.hxx b/oox/inc/oox/xls/excelvbaproject.hxx new file mode 100755 index 000000000000..6a517d13cd88 --- /dev/null +++ b/oox/inc/oox/xls/excelvbaproject.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx index 7eb00d4bd57d..4fa9c964108e 100644 --- a/oox/inc/oox/xls/stylesbuffer.hxx +++ b/oox/inc/oox/xls/stylesbuffer.hxx @@ -35,6 +35,7 @@ #include <com/sun/star/table/CellVertJustify.hpp> #include <com/sun/star/table/TableBorder.hpp> #include "oox/helper/containerhelper.hxx" +#include "oox/helper/graphichelper.hxx" #include "oox/drawingml/color.hxx" #include "oox/xls/numberformatsbuffer.hxx" @@ -78,6 +79,22 @@ const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; /// Relative character h // ============================================================================ +/** Special implementation of the GraphicHelper for Excel palette and scheme + colors. + */ +class ExcelGraphicHelper : public GraphicHelper, public WorkbookHelper +{ +public: + explicit ExcelGraphicHelper( const WorkbookHelper& rHelper ); + + /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */ + virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const; + /** Derived classes may implement to resolve a palette index to an RGB color. */ + virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const; +}; + +// ============================================================================ + class Color : public ::oox::drawingml::Color { public: @@ -205,7 +222,7 @@ struct ApiScriptFontName { ::rtl::OUString maName; /// Font name. sal_Int16 mnFamily; /// Font family. - sal_Int16 mnCharSet; /// Font character set. + sal_Int16 mnTextEnc; /// Font text encoding. explicit ApiScriptFontName(); }; diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx index 90c0f33c3c50..0ff8c0f9d3e5 100644 --- a/oox/inc/oox/xls/workbookhelper.hxx +++ b/oox/inc/oox/xls/workbookhelper.hxx @@ -29,9 +29,8 @@ #define OOX_XLS_WORKBOOKHELPER_HXX #include <boost/shared_ptr.hpp> -#include <osl/time.h> #include <rtl/ref.hxx> -#include <com/sun/star/uno/Reference.hxx> +#include "oox/helper/storagebase.hxx" #include "oox/xls/biffhelper.hxx" namespace com { namespace sun { namespace star { @@ -72,87 +71,8 @@ namespace oox { namespace drawingml { namespace oox { namespace xls { -// DEBUG ====================================================================== - -// Set this define to 1 to show the load/save time of a document in an assertion (nonpro only). -#define OOX_SHOW_LOADSAVE_TIME 0 - -// ---------------------------------------------------------------------------- - -#define OOX_LOADSAVE_TIMER( eTimerType ) (void)0 - -#if OSL_DEBUG_LEVEL > 0 -namespace dbg { - -// ---------------------------------------------------------------------------- - -#if OOX_SHOW_LOADSAVE_TIME > 0 - -enum TimerType -{ - TIMER_IMPORTFORMULA, - TIMER_IMPORTSHEETFRAGMENT, - TIMER_ONCREATESHEETCONTEXT, - TIMER_IMPORTROW, - TIMER_CONVERTROWFORMAT, - TIMER_CONVERTCOLUMNFORMAT, - TIMER_IMPORTCELL, - TIMER_ONENDSHEETELEMENT, - TIMER_SETCELL, - TIMER_SETCELLFORMAT, - TIMER_MERGECELLFORMAT, - TIMER_WRITECELLPROPERTIES, - TIMER_FINALIZESHEETDATA, - TIMER_FINALIZEDRAWING, - TIMER_FINALIZEBOOKDATA, - - // TIMER_TOTAL must be the last entry! - TIMER_TOTAL -}; - -// ---------------------------------------------------------------------------- - -struct TimeCount; - -class Timer -{ -public: - explicit Timer( TimeCount& rTimeCount ); - ~Timer(); -private: - TimeCount& mrTimeCount; - TimeValue maStartTime; -}; - -// ---------------------------------------------------------------------------- - -#undef OOX_LOADSAVE_TIMER -#define OOX_LOADSAVE_TIMER( TimerType ) ::oox::xls::dbg::Timer aDbgTimer##TimerType( getTimeCount( ::oox::xls::dbg::TIMER_##TimerType ) ) - -#endif - -// ---------------------------------------------------------------------------- - -struct WorkbookData; - -class WorkbookHelper -{ -protected: - explicit WorkbookHelper( WorkbookData& rBookData ); - explicit WorkbookHelper( const WorkbookHelper& rCopy ); - virtual ~WorkbookHelper(); -#if OOX_SHOW_LOADSAVE_TIME > 0 -public: - TimeCount& getTimeCount( TimerType eType ) const; -#endif -private: - WorkbookData& mrDbgBookData; -}; - -// ---------------------------------------------------------------------------- - -} // namespace dbg -#endif +class ExcelFilter; +class ExcelBiffFilter; // ============================================================================ @@ -201,14 +121,15 @@ class BiffCodecHelper; object of type WorkbookData containing global workbook settings, buffers, converters, etc. Nearly all classes in this filter implementation are derived directly or indirectly from this class. + + This class contains just a simple reference to the WorkbookData object to + prevent circular references, as the WorkbookData object contains a lot of + objects derived from this class. */ class WorkbookHelper -#if OSL_DEBUG_LEVEL > 0 - : public dbg::WorkbookHelper -#endif { public: - /*implicit*/ WorkbookHelper( WorkbookData& rBookData ); + inline /*implicit*/ WorkbookHelper( WorkbookData& rBookData ) : mrBookData( rBookData ) {} virtual ~WorkbookHelper(); // filter ----------------------------------------------------------------- @@ -229,6 +150,8 @@ public: /** Sets the index of the current sheet in the Calc document. */ void setCurrentSheetIndex( sal_Int16 nSheet ); + /** Sets the VBA project storage. */ + void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ); /** Final conversion after importing the workbook. */ void finalizeWorkbookImport(); @@ -334,7 +257,7 @@ public: /** Returns the page and print settings converter. */ PageSettingsConverter& getPageSettingsConverter() const; - // OOX specific ----------------------------------------------------------- + // OOX specific (MUST NOT be called in BIFF filter) ----------------------- /** Returns the base OOX filter object. Must not be called, if current filter is not the OOX filter. */ @@ -344,7 +267,7 @@ public: the full path to the fragment stream. */ bool importOoxFragment( const ::rtl::Reference< ::oox::core::FragmentHandler >& rxHandler ); - // BIFF specific ---------------------------------------------------------- + // BIFF specific (MUST NOT be called in OOX filter) ----------------------- /** Returns the base BIFF filter object. */ ::oox::core::BinaryFilterBase& getBiffFilter() const; @@ -392,8 +315,8 @@ struct WorkbookDataOwner class WorkbookHelperRoot : private prv::WorkbookDataOwner, public WorkbookHelper { public: - explicit WorkbookHelperRoot( ::oox::core::XmlFilterBase& rFilter ); - explicit WorkbookHelperRoot( ::oox::core::BinaryFilterBase& rFilter, BiffType eBiff ); + explicit WorkbookHelperRoot( ExcelFilter& rFilter ); + explicit WorkbookHelperRoot( ExcelBiffFilter& rFilter, BiffType eBiff ); /** Returns true, if this helper refers to a valid document. */ bool isValid() const; @@ -409,4 +332,3 @@ private: } // namespace oox #endif - diff --git a/oox/inc/oox/xls/worksheetsettings.hxx b/oox/inc/oox/xls/worksheetsettings.hxx index c96f12605911..17e22dc5342c 100644 --- a/oox/inc/oox/xls/worksheetsettings.hxx +++ b/oox/inc/oox/xls/worksheetsettings.hxx @@ -120,6 +120,8 @@ public: void importPassword( BiffInputStream& rStrm ); /** Imports protection settings from the SHEETPROTECTION record. */ void importSheetProtection( BiffInputStream& rStrm ); + /** Imports the VBA code module name from the CODENAME record. */ + void importCodeName( BiffInputStream& rStrm ); /** Imports phonetic settings from the PHONETICPR record. */ void importPhoneticPr( BiffInputStream& rStrm ); |