Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "workbookhelper.hxx"
30 : :
31 : : #include <com/sun/star/container/XIndexAccess.hpp>
32 : : #include <com/sun/star/container/XNameContainer.hpp>
33 : : #include <com/sun/star/document/XActionLockable.hpp>
34 : : #include <com/sun/star/sheet/XDatabaseRange.hpp>
35 : : #include <com/sun/star/sheet/XDatabaseRanges.hpp>
36 : : #include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp>
37 : : #include <com/sun/star/sheet/XNamedRange.hpp>
38 : : #include <com/sun/star/sheet/XNamedRanges.hpp>
39 : : #include <com/sun/star/sheet/XSpreadsheet.hpp>
40 : : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
41 : : #include <com/sun/star/sheet/NamedRangeFlag.hpp>
42 : : #include <com/sun/star/style/XStyle.hpp>
43 : : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
44 : : #include <com/sun/star/table/CellAddress.hpp>
45 : : #include <com/sun/star/container/XNamed.hpp>
46 : : #include <osl/thread.h>
47 : : #include "oox/drawingml/theme.hxx"
48 : : #include "oox/helper/progressbar.hxx"
49 : : #include "oox/helper/propertyset.hxx"
50 : : #include "oox/ole/vbaproject.hxx"
51 : : #include "addressconverter.hxx"
52 : : #include "biffinputstream.hxx"
53 : : #include "biffcodec.hxx"
54 : : #include "connectionsbuffer.hxx"
55 : : #include "defnamesbuffer.hxx"
56 : : #include "excelchartconverter.hxx"
57 : : #include "excelfilter.hxx"
58 : : #include "externallinkbuffer.hxx"
59 : : #include "formulaparser.hxx"
60 : : #include "pagesettings.hxx"
61 : : #include "pivotcachebuffer.hxx"
62 : : #include "pivottablebuffer.hxx"
63 : : #include "scenariobuffer.hxx"
64 : : #include "sharedstringsbuffer.hxx"
65 : : #include "stylesbuffer.hxx"
66 : : #include "tablebuffer.hxx"
67 : : #include "themebuffer.hxx"
68 : : #include "unitconverter.hxx"
69 : : #include "viewsettings.hxx"
70 : : #include "workbooksettings.hxx"
71 : : #include "worksheetbuffer.hxx"
72 : : #include "scmod.hxx"
73 : : #include "docsh.hxx"
74 : : #include "document.hxx"
75 : : #include "docuno.hxx"
76 : : #include "rangenam.hxx"
77 : : #include "tokenarray.hxx"
78 : : #include "tokenuno.hxx"
79 : : #include "convuno.hxx"
80 : : #include "dbdata.hxx"
81 : : #include "datauno.hxx"
82 : : #include "globalnames.hxx"
83 : :
84 : : #include "formulabuffer.hxx"
85 : : namespace oox {
86 : : namespace xls {
87 : :
88 : : // ============================================================================
89 : :
90 : : using namespace ::com::sun::star::awt;
91 : : using namespace ::com::sun::star::container;
92 : : using namespace ::com::sun::star::document;
93 : : using namespace ::com::sun::star::lang;
94 : : using namespace ::com::sun::star::sheet;
95 : : using namespace ::com::sun::star::style;
96 : : using namespace ::com::sun::star::table;
97 : : using namespace ::com::sun::star::uno;
98 : :
99 : : using ::oox::core::FilterBase;
100 : : using ::oox::core::FragmentHandler;
101 : : using ::oox::core::XmlFilterBase;
102 : : using ::oox::drawingml::Theme;
103 : : using ::rtl::OUString;
104 : :
105 : : // ============================================================================
106 : :
107 : 2184 : bool IgnoreCaseCompare::operator()( const OUString& rName1, const OUString& rName2 ) const
108 : : {
109 : : // there is no wrapper in rtl::OUString, TODO: compare with collator
110 : : return ::rtl_ustr_compareIgnoreAsciiCase_WithLength(
111 : 2184 : rName1.getStr(), rName1.getLength(), rName2.getStr(), rName2.getLength() ) < 0;
112 : : }
113 : :
114 : : // ============================================================================
115 : :
116 : : class WorkbookGlobals
117 : : {
118 : : public:
119 : : explicit WorkbookGlobals( ExcelFilter& rFilter );
120 : : ~WorkbookGlobals();
121 : :
122 : : /** Returns true, if this helper refers to a valid document. */
123 : 24 : inline bool isValid() const { return mxDoc.is(); }
124 : :
125 : : // filter -----------------------------------------------------------------
126 : :
127 : : /** Returns the base filter object (base class of all filters). */
128 : 1134 : inline FilterBase& getBaseFilter() const { return mrBaseFilter; }
129 : : /** Returns the filter progress bar. */
130 : 192 : inline SegmentProgressBar& getProgressBar() const { return *mxProgressBar; }
131 : : /** Returns the file type of the current filter. */
132 : 861 : inline FilterType getFilterType() const { return meFilterType; }
133 : : /** Returns true, if the file is a multi-sheet document, or false if single-sheet. */
134 : 0 : inline bool isWorkbookFile() const { return mbWorkbook; }
135 : : /** Returns the VBA project storage. */
136 : 24 : inline StorageRef getVbaProjectStorage() const { return mxVbaPrjStrg; }
137 : : /** Returns the index of the current Calc sheet, if filter currently processes a sheet. */
138 : 0 : inline sal_Int16 getCurrentSheetIndex() const { return mnCurrSheet; }
139 : :
140 : : /** Sets the VBA project storage used to import VBA source code and forms. */
141 : 0 : inline void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) { mxVbaPrjStrg = rxVbaPrjStrg; }
142 : : /** Sets the index of the current Calc sheet, if filter currently processes a sheet. */
143 : 120 : inline void setCurrentSheetIndex( sal_Int16 nSheet ) { mnCurrSheet = nSheet; }
144 : :
145 : : // document model ---------------------------------------------------------
146 : :
147 : 1623 : inline ScDocument& getScDocument() const
148 : : {
149 [ + + ]: 1623 : if ( !mpDoc )
150 : : {
151 [ + - ]: 24 : if ( mxDoc.get() )
152 : : {
153 [ - + ]: 24 : ScModelObj* pModel = dynamic_cast< ScModelObj* >( mxDoc.get() );
154 : 24 : ScDocShell* pDocShell = NULL;
155 [ + - ]: 24 : if ( pModel )
156 : 24 : pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
157 [ + - ]: 24 : if ( pDocShell )
158 : 24 : mpDoc = pDocShell->GetDocument();
159 : : }
160 : : }
161 [ - + ]: 1623 : if ( !mpDoc )
162 [ # # ][ # # ]: 0 : throw RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Workbookhelper::getScDocument(): Failed to access ScDocument from model" ) ), Reference< XInterface >() );
163 : 1623 : return *mpDoc;
164 : : }
165 : :
166 : : /** Returns a reference to the source/target spreadsheet document model. */
167 : 633 : inline Reference< XSpreadsheetDocument > getDocument() const { return mxDoc; }
168 : : /** Returns the cell or page styles container from the Calc document. */
169 : : Reference< XNameContainer > getStyleFamily( bool bPageStyles ) const;
170 : : /** Returns the specified cell or page style from the Calc document. */
171 : : Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const;
172 : : /** Creates and returns a defined name on-the-fly in the Calc document. */
173 : : ScRangeData* createNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags ) const;
174 : : /** Creates and returns a defined name on the-fly in the correct Calc sheet. */
175 : : ScRangeData* createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const;
176 : : /** Creates and returns a database range on-the-fly in the Calc document. */
177 : : Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const;
178 : : /** Creates and returns an unnamed database range on-the-fly in the Calc document. */
179 : : Reference< XDatabaseRange > createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const;
180 : : /** Creates and returns a com.sun.star.style.Style object for cells or pages. */
181 : : Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle ) const;
182 : :
183 : : // buffers ----------------------------------------------------------------
184 : :
185 : 222 : inline FormulaBuffer& getFormulaBuffer() const { return *mxFormulaBuffer; }
186 : : /** Returns the global workbook settings object. */
187 : 96 : inline WorkbookSettings& getWorkbookSettings() const { return *mxWorkbookSettings; }
188 : : /** Returns the workbook and sheet view settings object. */
189 : 204 : inline ViewSettings& getViewSettings() const { return *mxViewSettings; }
190 : : /** Returns the worksheet buffer containing sheet names and properties. */
191 : 183 : inline WorksheetBuffer& getWorksheets() const { return *mxWorksheets; }
192 : : /** Returns the office theme object read from the theme substorage. */
193 : 546 : inline ThemeBuffer& getTheme() const { return *mxTheme; }
194 : : /** Returns all cell formatting objects read from the styles substream. */
195 : 2901 : inline StylesBuffer& getStyles() const { return *mxStyles; }
196 : : /** Returns the shared strings read from the shared strings substream. */
197 : 294 : inline SharedStringsBuffer& getSharedStrings() const { return *mxSharedStrings; }
198 : : /** Returns the external links read from the external links substream. */
199 : 18 : inline ExternalLinkBuffer& getExternalLinks() const { return *mxExtLinks; }
200 : : /** Returns the defined names read from the workbook globals. */
201 : 117 : inline DefinedNamesBuffer& getDefinedNames() const { return *mxDefNames; }
202 : : /** Returns the tables collection (equivalent to Calc's database ranges). */
203 : 24 : inline TableBuffer& getTables() const { return *mxTables; }
204 : : /** Returns the scenarios collection. */
205 : 24 : inline ScenarioBuffer& getScenarios() const { return *mxScenarios; }
206 : : /** Returns the collection of external data connections. */
207 : 0 : inline ConnectionsBuffer& getConnections() const { return *mxConnections; }
208 : : /** Returns the collection of pivot caches. */
209 : 0 : inline PivotCacheBuffer& getPivotCaches() const { return *mxPivotCaches; }
210 : : /** Returns the collection of pivot tables. */
211 : 24 : inline PivotTableBuffer& getPivotTables() { return *mxPivotTables; }
212 : :
213 : : // converters -------------------------------------------------------------
214 : :
215 : : /** Returns the import formula parser. */
216 : 201 : inline FormulaParser& getFormulaParser() const { return *mxFmlaParser; }
217 : : /** Returns the measurement unit converter. */
218 : 1155 : inline UnitConverter& getUnitConverter() const { return *mxUnitConverter; }
219 : : /** Returns the converter for string to cell address/range conversion. */
220 : 963 : inline AddressConverter& getAddressConverter() const { return *mxAddrConverter; }
221 : : /** Returns the chart object converter. */
222 : 0 : inline ExcelChartConverter* getChartConverter() const { return mxChartConverter.get(); }
223 : : /** Returns the page/print settings converter. */
224 : 60 : inline PageSettingsConverter& getPageSettingsConverter() const { return *mxPageSettConverter; }
225 : :
226 : : // OOXML/BIFF12 specific --------------------------------------------------
227 : :
228 : : /** Returns the base OOXML/BIFF12 filter object. */
229 : 372 : inline XmlFilterBase& getOoxFilter() const { return *mpOoxFilter; }
230 : :
231 : : // BIFF2-BIFF8 specific ---------------------------------------------------
232 : :
233 : : /** Returns the BIFF type in binary filter. */
234 : 24 : inline BiffType getBiff() const { return meBiff; }
235 : : /** Returns the text encoding used to import/export byte strings. */
236 : 0 : inline rtl_TextEncoding getTextEncoding() const { return meTextEnc; }
237 : : /** Returns the codec helper that stores the encoder/decoder object. */
238 : 0 : inline BiffCodecHelper& getCodecHelper() { return *mxCodecHelper; }
239 : :
240 : : private:
241 : : /** Initializes some basic members and sets needed document properties. */
242 : : void initialize( bool bWorkbookFile );
243 : : /** Finalizes the filter process (sets some needed document properties). */
244 : : void finalize();
245 : :
246 : : private:
247 : : typedef ::std::auto_ptr< FormulaBuffer > FormulaBufferPtr;
248 : : typedef ::std::auto_ptr< SegmentProgressBar > ProgressBarPtr;
249 : : typedef ::std::auto_ptr< WorkbookSettings > WorkbookSettPtr;
250 : : typedef ::std::auto_ptr< ViewSettings > ViewSettingsPtr;
251 : : typedef ::std::auto_ptr< WorksheetBuffer > WorksheetBfrPtr;
252 : : typedef ::boost::shared_ptr< ThemeBuffer > ThemeBfrRef;
253 : : typedef ::std::auto_ptr< StylesBuffer > StylesBfrPtr;
254 : : typedef ::std::auto_ptr< SharedStringsBuffer > SharedStrBfrPtr;
255 : : typedef ::std::auto_ptr< ExternalLinkBuffer > ExtLinkBfrPtr;
256 : : typedef ::std::auto_ptr< DefinedNamesBuffer > DefNamesBfrPtr;
257 : : typedef ::std::auto_ptr< TableBuffer > TableBfrPtr;
258 : : typedef ::std::auto_ptr< ScenarioBuffer > ScenarioBfrPtr;
259 : : typedef ::std::auto_ptr< ConnectionsBuffer > ConnectionsBfrPtr;
260 : : typedef ::std::auto_ptr< PivotCacheBuffer > PivotCacheBfrPtr;
261 : : typedef ::std::auto_ptr< PivotTableBuffer > PivotTableBfrPtr;
262 : : typedef ::std::auto_ptr< FormulaParser > FormulaParserPtr;
263 : : typedef ::std::auto_ptr< UnitConverter > UnitConvPtr;
264 : : typedef ::std::auto_ptr< AddressConverter > AddressConvPtr;
265 : : typedef ::std::auto_ptr< ExcelChartConverter > ExcelChartConvPtr;
266 : : typedef ::std::auto_ptr< PageSettingsConverter > PageSettConvPtr;
267 : : typedef ::std::auto_ptr< BiffCodecHelper > BiffCodecHelperPtr;
268 : :
269 : : OUString maCellStyles; /// Style family name for cell styles.
270 : : OUString maPageStyles; /// Style family name for page styles.
271 : : OUString maCellStyleServ; /// Service name for a cell style.
272 : : OUString maPageStyleServ; /// Service name for a page style.
273 : : Reference< XSpreadsheetDocument > mxDoc; /// Document model.
274 : : FilterBase& mrBaseFilter; /// Base filter object.
275 : : ExcelFilterBase& mrExcelBase; /// Base object for registration of this structure.
276 : : FilterType meFilterType; /// File type of the filter.
277 : : ProgressBarPtr mxProgressBar; /// The progress bar.
278 : : StorageRef mxVbaPrjStrg; /// Storage containing the VBA project.
279 : : sal_Int16 mnCurrSheet; /// Current sheet index in Calc document.
280 : : bool mbWorkbook; /// True = multi-sheet file.
281 : :
282 : : // buffers
283 : : FormulaBufferPtr mxFormulaBuffer;
284 : : WorkbookSettPtr mxWorkbookSettings; /// Global workbook settings.
285 : : ViewSettingsPtr mxViewSettings; /// Workbook and sheet view settings.
286 : : WorksheetBfrPtr mxWorksheets; /// Sheet info buffer.
287 : : ThemeBfrRef mxTheme; /// Formatting theme from theme substream.
288 : : StylesBfrPtr mxStyles; /// All cell style objects from styles substream.
289 : : SharedStrBfrPtr mxSharedStrings; /// All strings from shared strings substream.
290 : : ExtLinkBfrPtr mxExtLinks; /// All external links.
291 : : DefNamesBfrPtr mxDefNames; /// All defined names.
292 : : TableBfrPtr mxTables; /// All tables (database ranges).
293 : : ScenarioBfrPtr mxScenarios; /// All scenarios.
294 : : ConnectionsBfrPtr mxConnections; /// All external data connections.
295 : : PivotCacheBfrPtr mxPivotCaches; /// All pivot caches in the document.
296 : : PivotTableBfrPtr mxPivotTables; /// All pivot tables in the document.
297 : :
298 : : // converters
299 : : FormulaParserPtr mxFmlaParser; /// Import formula parser.
300 : : UnitConvPtr mxUnitConverter; /// General unit converter.
301 : : AddressConvPtr mxAddrConverter; /// Cell address and cell range address converter.
302 : : ExcelChartConvPtr mxChartConverter; /// Chart object converter.
303 : : PageSettConvPtr mxPageSettConverter; /// Page/print settings converter.
304 : :
305 : : // OOXML/BIFF12 specific
306 : : XmlFilterBase* mpOoxFilter; /// Base OOXML/BIFF12 filter object.
307 : :
308 : : // BIFF2-BIFF8 specific
309 : : BiffCodecHelperPtr mxCodecHelper; /// Encoder/decoder helper.
310 : : BiffType meBiff; /// BIFF version for BIFF import/export.
311 : : rtl_TextEncoding meTextEnc; /// BIFF byte string text encoding.
312 : : bool mbHasCodePage; /// True = CODEPAGE record exists in imported stream.
313 : : mutable ScDocument* mpDoc;
314 : : };
315 : :
316 : : // ----------------------------------------------------------------------------
317 : :
318 : 24 : WorkbookGlobals::WorkbookGlobals( ExcelFilter& rFilter ) :
319 : : mrBaseFilter( rFilter ),
320 : : mrExcelBase( rFilter ),
321 : : meFilterType( FILTER_OOXML ),
322 : : mpOoxFilter( &rFilter ),
323 : : meBiff( BIFF_UNKNOWN ),
324 [ + - ][ + - ]: 24 : mpDoc( NULL )
325 : : {
326 : : // register at the filter, needed for virtual callbacks (even during construction)
327 [ + - ]: 24 : mrExcelBase.registerWorkbookGlobals( *this );
328 [ + - ]: 24 : initialize( true );
329 : 24 : }
330 : :
331 [ + - ][ + - ]: 24 : WorkbookGlobals::~WorkbookGlobals()
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
332 : : {
333 [ + - ]: 24 : finalize();
334 [ + - ]: 24 : mrExcelBase.unregisterWorkbookGlobals();
335 : 24 : }
336 : :
337 : : // document model -------------------------------------------------------------
338 : :
339 : 132 : Reference< XNameContainer > WorkbookGlobals::getStyleFamily( bool bPageStyles ) const
340 : : {
341 : 132 : Reference< XNameContainer > xStylesNC;
342 : : try
343 : : {
344 [ + - ]: 132 : Reference< XStyleFamiliesSupplier > xFamiliesSup( mxDoc, UNO_QUERY_THROW );
345 [ + - ][ + - ]: 132 : Reference< XNameAccess > xFamiliesNA( xFamiliesSup->getStyleFamilies(), UNO_QUERY_THROW );
[ + - ]
346 [ + + ][ + - ]: 132 : xStylesNC.set( xFamiliesNA->getByName( bPageStyles ? maPageStyles : maCellStyles ), UNO_QUERY );
[ + - ][ # # ]
[ + - ]
347 : : }
348 [ # # ]: 0 : catch( Exception& )
349 : : {
350 : : }
351 : : OSL_ENSURE( xStylesNC.is(), "WorkbookGlobals::getStyleFamily - cannot access style family" );
352 : 132 : return xStylesNC;
353 : : }
354 : :
355 : 24 : Reference< XStyle > WorkbookGlobals::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const
356 : : {
357 : 24 : Reference< XStyle > xStyle;
358 : : try
359 : : {
360 [ + - ][ + - ]: 24 : Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
361 [ + - ][ + - ]: 24 : xStyle.set( xStylesNC->getByName( rStyleName ), UNO_QUERY );
[ # # ][ + - ]
362 : : }
363 [ # # ]: 0 : catch( Exception& )
364 : : {
365 : : }
366 : : OSL_ENSURE( xStyle.is(), "WorkbookGlobals::getStyleObject - cannot access style object" );
367 : 24 : return xStyle;
368 : : }
369 : 36 : ScRangeData* lcl_addNewByNameAndTokens( ScDocument& rDoc, ScRangeName* pNames, const OUString& rName, const Sequence<FormulaToken>& rTokens, sal_Int16 nIndex, sal_Int32 nUnoType )
370 : : {
371 : 36 : bool bDone = false;
372 : 36 : sal_uInt16 nNewType = RT_NAME;
373 [ - + ]: 36 : if ( nUnoType & NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA;
374 [ - + ]: 36 : if ( nUnoType & NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA;
375 [ - + ]: 36 : if ( nUnoType & NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER;
376 [ - + ]: 36 : if ( nUnoType & NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER;
377 [ + - ]: 36 : ScTokenArray aTokenArray;
378 [ + - ]: 36 : (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
379 [ + - ][ + - ]: 36 : ScRangeData* pNew = new ScRangeData( &rDoc, rName, aTokenArray, ScAddress(), nNewType );
380 [ + - ]: 36 : pNew->GuessPosition();
381 [ + + ]: 36 : if ( nIndex )
382 : 33 : pNew->SetIndex( nIndex );
383 [ + - ][ + - ]: 36 : if ( pNames->insert(pNew) )
384 : 36 : bDone = true;
385 [ - + ]: 36 : if (!bDone)
386 [ # # ]: 0 : throw RuntimeException();
387 [ + - ]: 36 : return pNew;
388 : : }
389 : :
390 : : namespace {
391 : :
392 : 36 : rtl::OUString findUnusedName( const ScRangeName* pRangeName, const rtl::OUString& rSuggestedName )
393 : : {
394 : 36 : rtl::OUString aNewName = rSuggestedName;
395 : 36 : sal_Int32 nIndex = 0;
396 [ + - ][ + - ]: 36 : while(pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(aNewName)))
[ - + ]
397 [ # # ][ # # ]: 0 : aNewName = rtl::OUStringBuffer(rSuggestedName).append( '_' ).append( nIndex++ ).makeStringAndClear();
[ # # ][ # # ]
398 : :
399 : 36 : return aNewName;
400 : : }
401 : :
402 : : }
403 : :
404 : 21 : ScRangeData* WorkbookGlobals::createNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags ) const
405 : : {
406 : : // create the name and insert it into the Calc document
407 : 21 : ScRangeData* pScRangeData = NULL;
408 [ + - ]: 21 : if( !orName.isEmpty() )
409 : : {
410 : 21 : ScDocument& rDoc = getScDocument();
411 : 21 : ScRangeName* pNames = rDoc.GetRangeName();
412 : : // find an unused name
413 : 21 : orName = findUnusedName( pNames, orName );
414 : : // create the named range
415 : 21 : pScRangeData = lcl_addNewByNameAndTokens( rDoc, pNames, orName, rTokens, nIndex, nNameFlags );
416 : : }
417 : 21 : return pScRangeData;
418 : : }
419 : :
420 : :
421 : 15 : ScRangeData* WorkbookGlobals::createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken >& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const
422 : : {
423 : : // create the name and insert it into the Calc document
424 : 15 : ScRangeData* pScRangeData = NULL;
425 [ + - ]: 15 : if( !orName.isEmpty() )
426 : : {
427 : 15 : ScDocument& rDoc = getScDocument();
428 : 15 : ScRangeName* pNames = rDoc.GetRangeName( nTab );
429 : : // find an unused name
430 : 15 : orName = findUnusedName( pNames, orName );
431 : : // create the named range
432 : 15 : pScRangeData = lcl_addNewByNameAndTokens( rDoc, pNames, orName, rTokens, nIndex, nNameFlags );
433 : : }
434 : 15 : return pScRangeData;
435 : : }
436 : :
437 : 0 : Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const
438 : : {
439 : : // validate cell range
440 : 0 : CellRangeAddress aDestRange = rRangeAddr;
441 [ # # ]: 0 : bool bValidRange = getAddressConverter().validateCellRange( aDestRange, true, true );
442 : :
443 : : // create database range and insert it into the Calc document
444 : 0 : Reference< XDatabaseRange > xDatabaseRange;
445 [ # # ][ # # ]: 0 : if( bValidRange && !orName.isEmpty() ) try
[ # # ]
446 : : {
447 : : // find an unused name
448 [ # # ]: 0 : PropertySet aDocProps( mxDoc );
449 [ # # ][ # # ]: 0 : Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
450 [ # # ]: 0 : Reference< XNameAccess > xNameAccess( xDatabaseRanges, UNO_QUERY_THROW );
451 [ # # ]: 0 : orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
452 : : // create the database range
453 [ # # ][ # # ]: 0 : xDatabaseRanges->addNewByName( orName, aDestRange );
454 [ # # ][ # # ]: 0 : xDatabaseRange.set( xDatabaseRanges->getByName( orName ), UNO_QUERY );
[ # # ][ # # ]
[ # # ]
455 : : }
456 [ # # ]: 0 : catch( Exception& )
457 : : {
458 : : }
459 : : OSL_ENSURE( xDatabaseRange.is(), "WorkbookGlobals::createDatabaseRangeObject - cannot create database range" );
460 : 0 : return xDatabaseRange;
461 : : }
462 : :
463 : 3 : Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const
464 : : {
465 : : // validate cell range
466 : 3 : CellRangeAddress aDestRange = rRangeAddr;
467 [ + - ]: 3 : bool bValidRange = getAddressConverter().validateCellRange( aDestRange, true, true );
468 : :
469 : : // create database range and insert it into the Calc document
470 : 3 : Reference< XDatabaseRange > xDatabaseRange;
471 [ + - ]: 3 : if( bValidRange ) try
472 : : {
473 [ + - ]: 3 : ScDocument& rDoc = getScDocument();
474 [ + - ][ - + ]: 3 : if( rDoc.GetTableCount() <= aDestRange.Sheet )
475 [ # # ]: 0 : throw ::com::sun::star::lang::IndexOutOfBoundsException();
476 : 3 : ScRange aScRange;
477 : 3 : ScUnoConversion::FillScRange(aScRange, aDestRange);
478 : 3 : ScDBData* pNewDBData = new ScDBData( STR_DB_LOCAL_NONAME, aScRange.aStart.Tab(),
479 : 3 : aScRange.aStart.Col(), aScRange.aStart.Row(),
480 [ + - ][ + - ]: 6 : aScRange.aEnd.Col(), aScRange.aEnd.Row() );
481 [ + - ]: 3 : rDoc.SetAnonymousDBData( aScRange.aStart.Tab() , pNewDBData );
482 : 3 : ScDocShell* pDocSh = static_cast< ScDocShell* >(rDoc.GetDocumentShell());
483 [ + - ][ + - ]: 3 : xDatabaseRange.set(new ScDatabaseRangeObj(pDocSh, aScRange.aStart.Tab()));
[ # # ][ + - ]
484 : : }
485 [ # # ]: 0 : catch( Exception& )
486 : : {
487 : : }
488 : : OSL_ENSURE( xDatabaseRange.is(), "WorkbookData::createDatabaseRangeObject - cannot create database range" );
489 : 3 : return xDatabaseRange;
490 : : }
491 : :
492 : 60 : Reference< XStyle > WorkbookGlobals::createStyleObject( OUString& orStyleName, bool bPageStyle ) const
493 : : {
494 : 60 : Reference< XStyle > xStyle;
495 : : try
496 : : {
497 [ + - ][ + - ]: 60 : Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
498 [ + - ][ + - ]: 60 : xStyle.set( mrBaseFilter.getModelFactory()->createInstance( bPageStyle ? maPageStyleServ : maCellStyleServ ), UNO_QUERY_THROW );
[ + - ][ + - ]
[ + - ]
499 [ + - ][ # # ]: 60 : orStyleName = ContainerHelper::insertByUnusedName( xStylesNC, orStyleName, ' ', Any( xStyle ), false );
[ + - ]
500 : : }
501 [ # # ]: 0 : catch( Exception& )
502 : : {
503 : : }
504 : : OSL_ENSURE( xStyle.is(), "WorkbookGlobals::createStyleObject - cannot create style" );
505 : 60 : return xStyle;
506 : : }
507 : :
508 : : // BIFF specific --------------------------------------------------------------
509 : :
510 : : // private --------------------------------------------------------------------
511 : :
512 : 24 : void WorkbookGlobals::initialize( bool bWorkbookFile )
513 : : {
514 : 24 : maCellStyles = CREATE_OUSTRING( "CellStyles" );
515 : 24 : maPageStyles = CREATE_OUSTRING( "PageStyles" );
516 : 24 : maCellStyleServ = CREATE_OUSTRING( "com.sun.star.style.CellStyle" );
517 : 24 : maPageStyleServ = CREATE_OUSTRING( "com.sun.star.style.PageStyle" );
518 : 24 : mnCurrSheet = -1;
519 : 24 : mbWorkbook = bWorkbookFile;
520 : 24 : meTextEnc = osl_getThreadTextEncoding();
521 : 24 : mbHasCodePage = false;
522 : :
523 : : // the spreadsheet document
524 : 24 : mxDoc.set( mrBaseFilter.getModel(), UNO_QUERY );
525 : : OSL_ENSURE( mxDoc.is(), "WorkbookGlobals::initialize - no spreadsheet document" );
526 : :
527 [ + - ][ + - ]: 24 : mxFormulaBuffer.reset( new FormulaBuffer( *this ) );
528 [ + - ][ + - ]: 24 : mxWorkbookSettings.reset( new WorkbookSettings( *this ) );
529 [ + - ][ + - ]: 24 : mxViewSettings.reset( new ViewSettings( *this ) );
530 [ + - ][ + - ]: 24 : mxWorksheets.reset( new WorksheetBuffer( *this ) );
531 [ + - ][ + - ]: 24 : mxTheme.reset( new ThemeBuffer( *this ) );
[ + - ]
532 [ + - ][ + - ]: 24 : mxStyles.reset( new StylesBuffer( *this ) );
533 [ + - ][ + - ]: 24 : mxSharedStrings.reset( new SharedStringsBuffer( *this ) );
534 [ + - ][ + - ]: 24 : mxExtLinks.reset( new ExternalLinkBuffer( *this ) );
535 [ + - ][ + - ]: 24 : mxDefNames.reset( new DefinedNamesBuffer( *this ) );
536 [ + - ][ + - ]: 24 : mxTables.reset( new TableBuffer( *this ) );
537 [ + - ][ + - ]: 24 : mxScenarios.reset( new ScenarioBuffer( *this ) );
538 [ + - ][ + - ]: 24 : mxConnections.reset( new ConnectionsBuffer( *this ) );
539 [ + - ][ + - ]: 24 : mxPivotCaches.reset( new PivotCacheBuffer( *this ) );
540 [ + - ][ + - ]: 24 : mxPivotTables.reset( new PivotTableBuffer( *this ) );
541 : :
542 [ + - ][ + - ]: 24 : mxUnitConverter.reset( new UnitConverter( *this ) );
543 [ + - ][ + - ]: 24 : mxAddrConverter.reset( new AddressConverter( *this ) );
544 [ + - ][ + - ]: 24 : mxChartConverter.reset( new ExcelChartConverter( *this ) );
545 [ + - ][ + - ]: 24 : mxPageSettConverter.reset( new PageSettingsConverter( *this ) );
546 : :
547 : : // set some document properties needed during import
548 [ + - ]: 24 : if( mrBaseFilter.isImportFilter() )
549 : : {
550 [ + - ]: 24 : PropertySet aPropSet( mxDoc );
551 : : // enable editing read-only documents (e.g. from read-only files)
552 [ + - ]: 24 : aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, true );
553 : : // #i76026# disable Undo while loading the document
554 [ + - ]: 24 : aPropSet.setProperty( PROP_IsUndoEnabled, false );
555 : : // #i79826# disable calculating automatic row height while loading the document
556 [ + - ]: 24 : aPropSet.setProperty( PROP_IsAdjustHeightEnabled, false );
557 : : // disable automatic update of linked sheets and DDE links
558 [ + - ]: 24 : aPropSet.setProperty( PROP_IsExecuteLinkEnabled, false );
559 : : // #i79890# disable automatic update of defined names
560 [ + - ][ + - ]: 24 : Reference< XActionLockable > xLockable( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY );
561 [ + - ]: 24 : if( xLockable.is() )
562 [ + - ][ + - ]: 24 : xLockable->addActionLock();
563 : :
564 : : //! TODO: localize progress bar text
565 [ + - ][ + - ]: 24 : mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), CREATE_OUSTRING( "Loading..." ) ) );
[ + - ][ + - ]
566 [ + - ][ + - ]: 24 : mxFmlaParser.reset( new FormulaParser( *this ) );
567 : :
568 : : //prevent unnecessary broadcasts and "half way listeners" as
569 : : //is done in ScDocShell::BeforeXMLLoading() for ods
570 [ + - ][ + - ]: 24 : getScDocument().SetInsertingFromOtherDoc(true);
571 : : }
572 [ # # ]: 0 : else if( mrBaseFilter.isExportFilter() )
573 : : {
574 : : //! TODO: localize progress bar text
575 [ # # ][ # # ]: 0 : mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), CREATE_OUSTRING( "Saving..." ) ) );
576 : : }
577 : : // filter specific
578 [ - + - - ]: 24 : switch( getFilterType() )
579 : : {
580 : : case FILTER_BIFF:
581 [ # # ][ # # ]: 0 : mxCodecHelper.reset( new BiffCodecHelper( *this ) );
582 : 0 : break;
583 : :
584 : : case FILTER_OOXML:
585 : 24 : break;
586 : :
587 : : case FILTER_UNKNOWN:
588 : 0 : break;
589 : : }
590 : 24 : }
591 : :
592 : 24 : void WorkbookGlobals::finalize()
593 : : {
594 : : // set some document properties needed after import
595 [ + - ]: 24 : if( mrBaseFilter.isImportFilter() )
596 : : {
597 [ + - ]: 24 : PropertySet aPropSet( mxDoc );
598 : : // #i74668# do not insert default sheets
599 [ + - ]: 24 : aPropSet.setProperty( PROP_IsLoaded, true );
600 : : // #i79890# enable automatic update of defined names (before IsAdjustHeightEnabled!)
601 [ + - ][ + - ]: 24 : Reference< XActionLockable > xLockable( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY );
602 [ + - ]: 24 : if( xLockable.is() )
603 [ + - ][ + - ]: 24 : xLockable->removeActionLock();
604 : : // enable automatic update of linked sheets and DDE links
605 [ + - ]: 24 : aPropSet.setProperty( PROP_IsExecuteLinkEnabled, true );
606 : : // #i79826# enable updating automatic row height after loading the document
607 [ + - ]: 24 : aPropSet.setProperty( PROP_IsAdjustHeightEnabled, true );
608 : :
609 [ + - ]: 24 : getFormulaBuffer().finalizeImport();
610 : :
611 : : // Insert all pivot tables. Must be done after loading all sheets and
612 : : // formulas, because data pilots expect existing source data on
613 : : // creation.
614 [ + - ]: 24 : getPivotTables().finalizeImport();
615 : :
616 : : // #i76026# enable Undo after loading the document
617 [ + - ]: 24 : aPropSet.setProperty( PROP_IsUndoEnabled, true );
618 : : // disable editing read-only documents (e.g. from read-only files)
619 [ + - ]: 24 : aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, false );
620 : : // #111099# open forms in alive mode (has no effect, if no controls in document)
621 [ + - ]: 24 : aPropSet.setProperty( PROP_ApplyFormDesignMode, false );
622 : :
623 : : //stop preventing establishment of listeners as is done in
624 : : //ScDocShell::AfterXMLLoading() for ods
625 [ + - ][ + - ]: 24 : getScDocument().SetInsertingFromOtherDoc(false);
626 : : }
627 : 24 : }
628 : :
629 : : // ============================================================================
630 : :
631 : 7665 : WorkbookHelper::~WorkbookHelper()
632 : : {
633 [ - + ]: 7665 : }
634 : :
635 : 24 : /*static*/ WorkbookGlobalsRef WorkbookHelper::constructGlobals( ExcelFilter& rFilter )
636 : : {
637 [ + - ][ + - ]: 24 : WorkbookGlobalsRef xBookGlob( new WorkbookGlobals( rFilter ) );
638 [ - + ]: 24 : if( !xBookGlob->isValid() )
639 [ # # ]: 0 : xBookGlob.reset();
640 : 24 : return xBookGlob;
641 : : }
642 : :
643 : : // filter ---------------------------------------------------------------------
644 : :
645 : 1134 : FilterBase& WorkbookHelper::getBaseFilter() const
646 : : {
647 : 1134 : return mrBookGlob.getBaseFilter();
648 : : }
649 : :
650 : 837 : FilterType WorkbookHelper::getFilterType() const
651 : : {
652 : 837 : return mrBookGlob.getFilterType();
653 : : }
654 : :
655 : 192 : SegmentProgressBar& WorkbookHelper::getProgressBar() const
656 : : {
657 : 192 : return mrBookGlob.getProgressBar();
658 : : }
659 : :
660 : 0 : bool WorkbookHelper::isWorkbookFile() const
661 : : {
662 : 0 : return mrBookGlob.isWorkbookFile();
663 : : }
664 : :
665 : 0 : sal_Int16 WorkbookHelper::getCurrentSheetIndex() const
666 : : {
667 : 0 : return mrBookGlob.getCurrentSheetIndex();
668 : : }
669 : :
670 : 0 : void WorkbookHelper::setVbaProjectStorage( const StorageRef& rxVbaPrjStrg )
671 : : {
672 : 0 : mrBookGlob.setVbaProjectStorage( rxVbaPrjStrg );
673 : 0 : }
674 : :
675 : 120 : void WorkbookHelper::setCurrentSheetIndex( sal_Int16 nSheet )
676 : : {
677 : 120 : mrBookGlob.setCurrentSheetIndex( nSheet );
678 : 120 : }
679 : :
680 : 24 : void WorkbookHelper::finalizeWorkbookImport()
681 : : {
682 : : // workbook settings, document and sheet view settings
683 [ + - ]: 24 : mrBookGlob.getWorkbookSettings().finalizeImport();
684 [ + - ]: 24 : mrBookGlob.getViewSettings().finalizeImport();
685 : :
686 : : /* Insert scenarios after all sheet processing is done, because new hidden
687 : : sheets are created for scenarios which would confuse code that relies
688 : : on certain sheet indexes. Must be done after pivot tables too. */
689 [ + - ]: 24 : mrBookGlob.getScenarios().finalizeImport();
690 : :
691 : : /* Set 'Default' page style to automatic page numbering (default is manual
692 : : number 1). Otherwise hidden sheets (e.g. for scenarios) which have
693 : : 'Default' page style will break automatic page numbering for following
694 : : sheets. Automatic numbering is set by passing the value 0. */
695 [ + - ][ + - ]: 24 : PropertySet aDefPageStyle( getStyleObject( CREATE_OUSTRING( "Default" ), true ) );
[ + - ]
696 [ + - ]: 24 : aDefPageStyle.setProperty< sal_Int16 >( PROP_FirstPageNumber, 0 );
697 : :
698 : : /* Import the VBA project (after finalizing workbook settings which
699 : : contains the workbook code name). */
700 [ + - ]: 24 : StorageRef xVbaPrjStrg = mrBookGlob.getVbaProjectStorage();
701 [ - + ][ # # ]: 24 : if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
[ # # ][ - + ]
702 [ # # ][ # # ]: 24 : getBaseFilter().getVbaProject().importVbaProject( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() );
[ # # ][ + - ]
[ + - ]
703 : 24 : }
704 : :
705 : : // document model -------------------------------------------------------------
706 : :
707 : 1536 : ScDocument& WorkbookHelper::getScDocument() const
708 : : {
709 : 1536 : return mrBookGlob.getScDocument();
710 : : }
711 : :
712 : 633 : Reference< XSpreadsheetDocument > WorkbookHelper::getDocument() const
713 : : {
714 : 633 : return mrBookGlob.getDocument();
715 : : }
716 : :
717 : 144 : Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( sal_Int16 nSheet ) const
718 : : {
719 : 144 : Reference< XSpreadsheet > xSheet;
720 : : try
721 : : {
722 [ + - ][ + - ]: 144 : Reference< XIndexAccess > xSheetsIA( getDocument()->getSheets(), UNO_QUERY_THROW );
[ + - ][ + - ]
723 [ + - ][ + - ]: 144 : xSheet.set( xSheetsIA->getByIndex( nSheet ), UNO_QUERY_THROW );
[ # # ][ + - ]
724 : : }
725 [ # # ]: 0 : catch( Exception& )
726 : : {
727 : : }
728 : 144 : return xSheet;
729 : : }
730 : :
731 : 0 : Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( const OUString& rSheet ) const
732 : : {
733 : 0 : Reference< XSpreadsheet > xSheet;
734 : : try
735 : : {
736 [ # # ][ # # ]: 0 : Reference< XNameAccess > xSheetsNA( getDocument()->getSheets(), UNO_QUERY_THROW );
[ # # ][ # # ]
737 [ # # ][ # # ]: 0 : xSheet.set( xSheetsNA->getByName( rSheet ), UNO_QUERY );
[ # # ][ # # ]
738 : : }
739 [ # # ]: 0 : catch( Exception& )
740 : : {
741 : : }
742 : 0 : return xSheet;
743 : : }
744 : :
745 : 24 : Reference< XCellRange > WorkbookHelper::getCellRangeFromDoc( const CellRangeAddress& rRange ) const
746 : : {
747 : 24 : Reference< XCellRange > xRange;
748 : : try
749 : : {
750 [ + - ][ + - ]: 24 : Reference< XSpreadsheet > xSheet( getSheetFromDoc( rRange.Sheet ), UNO_SET_THROW );
751 [ + - ][ + - ]: 24 : xRange = xSheet->getCellRangeByPosition( rRange.StartColumn, rRange.StartRow, rRange.EndColumn, rRange.EndRow );
[ # # ][ + - ]
752 : : }
753 [ # # ]: 0 : catch( Exception& )
754 : : {
755 : : }
756 : 24 : return xRange;
757 : : }
758 : :
759 : 48 : Reference< XNameContainer > WorkbookHelper::getStyleFamily( bool bPageStyles ) const
760 : : {
761 : 48 : return mrBookGlob.getStyleFamily( bPageStyles );
762 : : }
763 : :
764 : 24 : Reference< XStyle > WorkbookHelper::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const
765 : : {
766 : 24 : return mrBookGlob.getStyleObject( rStyleName, bPageStyle );
767 : : }
768 : :
769 : 21 : ScRangeData* WorkbookHelper::createNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags ) const
770 : : {
771 : 21 : return mrBookGlob.createNamedRangeObject( orName, rTokens, nIndex, nNameFlags );
772 : : }
773 : :
774 : 15 : ScRangeData* WorkbookHelper::createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const
775 : : {
776 : 15 : return mrBookGlob.createLocalNamedRangeObject( orName, rTokens, nIndex, nNameFlags, nTab );
777 : : }
778 : :
779 : 0 : Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const
780 : : {
781 : 0 : return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr );
782 : : }
783 : :
784 : 3 : Reference< XDatabaseRange > WorkbookHelper::createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const
785 : : {
786 : 3 : return mrBookGlob.createUnnamedDatabaseRangeObject( rRangeAddr );
787 : : }
788 : :
789 : 60 : Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle ) const
790 : : {
791 : 60 : return mrBookGlob.createStyleObject( orStyleName, bPageStyle );
792 : : }
793 : :
794 : : // buffers --------------------------------------------------------------------
795 : :
796 : 198 : FormulaBuffer& WorkbookHelper::getFormulaBuffer() const
797 : : {
798 : 198 : return mrBookGlob.getFormulaBuffer();
799 : : }
800 : :
801 : 72 : WorkbookSettings& WorkbookHelper::getWorkbookSettings() const
802 : : {
803 : 72 : return mrBookGlob.getWorkbookSettings();
804 : : }
805 : :
806 : 180 : ViewSettings& WorkbookHelper::getViewSettings() const
807 : : {
808 : 180 : return mrBookGlob.getViewSettings();
809 : : }
810 : :
811 : 183 : WorksheetBuffer& WorkbookHelper::getWorksheets() const
812 : : {
813 : 183 : return mrBookGlob.getWorksheets();
814 : : }
815 : :
816 : 546 : ThemeBuffer& WorkbookHelper::getTheme() const
817 : : {
818 : 546 : return mrBookGlob.getTheme();
819 : : }
820 : :
821 : 2901 : StylesBuffer& WorkbookHelper::getStyles() const
822 : : {
823 : 2901 : return mrBookGlob.getStyles();
824 : : }
825 : :
826 : 294 : SharedStringsBuffer& WorkbookHelper::getSharedStrings() const
827 : : {
828 : 294 : return mrBookGlob.getSharedStrings();
829 : : }
830 : :
831 : 18 : ExternalLinkBuffer& WorkbookHelper::getExternalLinks() const
832 : : {
833 : 18 : return mrBookGlob.getExternalLinks();
834 : : }
835 : :
836 : 117 : DefinedNamesBuffer& WorkbookHelper::getDefinedNames() const
837 : : {
838 : 117 : return mrBookGlob.getDefinedNames();
839 : : }
840 : :
841 : 24 : TableBuffer& WorkbookHelper::getTables() const
842 : : {
843 : 24 : return mrBookGlob.getTables();
844 : : }
845 : :
846 : 0 : ScenarioBuffer& WorkbookHelper::getScenarios() const
847 : : {
848 : 0 : return mrBookGlob.getScenarios();
849 : : }
850 : :
851 : 0 : ConnectionsBuffer& WorkbookHelper::getConnections() const
852 : : {
853 : 0 : return mrBookGlob.getConnections();
854 : : }
855 : :
856 : 0 : PivotCacheBuffer& WorkbookHelper::getPivotCaches() const
857 : : {
858 : 0 : return mrBookGlob.getPivotCaches();
859 : : }
860 : :
861 : 0 : PivotTableBuffer& WorkbookHelper::getPivotTables() const
862 : : {
863 : 0 : return mrBookGlob.getPivotTables();
864 : : }
865 : :
866 : : // converters -----------------------------------------------------------------
867 : :
868 : 201 : FormulaParser& WorkbookHelper::getFormulaParser() const
869 : : {
870 : 201 : return mrBookGlob.getFormulaParser();
871 : : }
872 : :
873 : 1155 : UnitConverter& WorkbookHelper::getUnitConverter() const
874 : : {
875 : 1155 : return mrBookGlob.getUnitConverter();
876 : : }
877 : :
878 : 960 : AddressConverter& WorkbookHelper::getAddressConverter() const
879 : : {
880 : 960 : return mrBookGlob.getAddressConverter();
881 : : }
882 : :
883 : 0 : ExcelChartConverter* WorkbookHelper::getChartConverter() const
884 : : {
885 : 0 : return mrBookGlob.getChartConverter();
886 : : }
887 : :
888 : 60 : PageSettingsConverter& WorkbookHelper::getPageSettingsConverter() const
889 : : {
890 : 60 : return mrBookGlob.getPageSettingsConverter();
891 : : }
892 : :
893 : : // OOXML/BIFF12 specific ------------------------------------------------------
894 : :
895 : 372 : XmlFilterBase& WorkbookHelper::getOoxFilter() const
896 : : {
897 : : OSL_ENSURE( mrBookGlob.getFilterType() == FILTER_OOXML, "WorkbookHelper::getOoxFilter - invalid call" );
898 : 372 : return mrBookGlob.getOoxFilter();
899 : : }
900 : :
901 : 123 : bool WorkbookHelper::importOoxFragment( const ::rtl::Reference< FragmentHandler >& rxHandler )
902 : : {
903 : 123 : return getOoxFilter().importFragment( rxHandler );
904 : : }
905 : :
906 : : // BIFF specific --------------------------------------------------------------
907 : :
908 : 24 : BiffType WorkbookHelper::getBiff() const
909 : : {
910 : 24 : return mrBookGlob.getBiff();
911 : : }
912 : :
913 : 0 : rtl_TextEncoding WorkbookHelper::getTextEncoding() const
914 : : {
915 : 0 : return mrBookGlob.getTextEncoding();
916 : : }
917 : :
918 : 0 : BiffCodecHelper& WorkbookHelper::getCodecHelper() const
919 : : {
920 : 0 : return mrBookGlob.getCodecHelper();
921 : : }
922 : :
923 : : // ============================================================================
924 : :
925 : : } // namespace xls
926 [ + - ][ + - ]: 24 : } // namespace oox
927 : :
928 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|