LibreOffice Module sc (master) 1
workbookhelper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <workbookhelper.hxx>
21
22#include <com/sun/star/container/XIndexAccess.hpp>
23#include <com/sun/star/container/XNameContainer.hpp>
24#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
25#include <com/sun/star/sheet/XDatabaseRanges.hpp>
26#include <com/sun/star/sheet/XSpreadsheet.hpp>
27#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
28#include <com/sun/star/sheet/NamedRangeFlag.hpp>
29#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
30#include <com/sun/star/document/XDocumentProperties.hpp>
31#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
32#include <com/sun/star/document/XViewDataSupplier.hpp>
34#include <o3tl/any.hxx>
35#include <osl/thread.h>
36#include <osl/diagnose.h>
40#include <oox/token/properties.hxx>
41#include <addressconverter.hxx>
42#include <connectionsbuffer.hxx>
43#include <defnamesbuffer.hxx>
45#include <excelfilter.hxx>
47#include <formulaparser.hxx>
48#include <pagesettings.hxx>
49#include <pivotcachebuffer.hxx>
50#include <pivottablebuffer.hxx>
51#include <scenariobuffer.hxx>
53#include <stylesbuffer.hxx>
54#include <tablebuffer.hxx>
55#include <themebuffer.hxx>
56#include <unitconverter.hxx>
57#include <viewsettings.hxx>
58#include <workbooksettings.hxx>
59#include <worksheetbuffer.hxx>
60#include <docsh.hxx>
61#include <document.hxx>
62#include <docuno.hxx>
63#include <rangenam.hxx>
64#include <tokenarray.hxx>
65#include <tokenuno.hxx>
66#include <dbdata.hxx>
67#include <datauno.hxx>
68#include <globalnames.hxx>
69#include <documentimport.hxx>
70#include <drwlayer.hxx>
71#include <globstr.hrc>
72#include <scresid.hxx>
73
74#include <formulabuffer.hxx>
75#include <editutil.hxx>
76#include <editeng/editstat.hxx>
78#include <o3tl/string_view.hxx>
80
81#include <memory>
82
83namespace oox::xls {
84
85using namespace ::com::sun::star::container;
86using namespace ::com::sun::star::document;
87using namespace ::com::sun::star::lang;
88using namespace ::com::sun::star::sheet;
89using namespace ::com::sun::star::style;
90using namespace ::com::sun::star::table;
91using namespace ::com::sun::star::uno;
92using namespace ::com::sun::star::beans;
93
94using ::oox::core::FilterBase;
95using ::oox::core::FragmentHandler;
96using ::oox::core::XmlFilterBase;
97
98bool IgnoreCaseCompare::operator()( std::u16string_view rName1, std::u16string_view rName2 ) const
99{
100 // TODO: compare with collator
101 return o3tl::compareToIgnoreAsciiCase(rName1, rName2 ) < 0;
102}
103
105{
106public:
107 // noncopyable ------------------------------------------------------------
108
111
112 explicit WorkbookGlobals( ExcelFilter& rFilter );
114
116 bool isValid() const { return mxDoc.is(); }
117
118 // filter -----------------------------------------------------------------
119
121 FilterBase& getBaseFilter() const { return mrBaseFilter; }
127 sal_Int16 getCurrentSheetIndex() const { return mnCurrSheet; }
130
132 void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) { mxVbaPrjStrg = rxVbaPrjStrg; }
134 void setCurrentSheetIndex( SCTAB nSheet ) { mnCurrSheet = nSheet; }
135
136 // document model ---------------------------------------------------------
137
139 {
140 return *mxEditEngine;
141 }
142
144
146
148 const Reference< XSpreadsheetDocument >& getDocument() const { return mxDoc; }
150 Reference< XNameContainer > getStyleFamily( bool bPageStyles ) const;
152 Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const;
154 WorkbookHelper::RangeDataRet createNamedRangeObject(OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden);
156 WorkbookHelper::RangeDataRet createLocalNamedRangeObject(OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden);
158 Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const ScRange& rRangeAddr );
160 Reference< XDatabaseRange > createUnnamedDatabaseRangeObject( const ScRange& rRangeAddr );
162 ScDBData* findDatabaseRangeByIndex( sal_uInt16 nIndex );
164 Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle );
166 void useInternalChartDataTable( bool bInternal );
167
168 // buffers ----------------------------------------------------------------
169
178 ThemeBuffer& getTheme() const { return *mxTheme; }
180 StylesBuffer& getStyles() const { return *mxStyles; }
188 TableBuffer& getTables() const { return *mxTables; }
197
198 // converters -------------------------------------------------------------
199
212
213 // OOXML/BIFF12 specific --------------------------------------------------
214
216 XmlFilterBase& getOoxFilter() const { return *mpOoxFilter; }
217
218 // BIFF2-BIFF8 specific ---------------------------------------------------
219
221 rtl_TextEncoding getTextEncoding() const { return meTextEnc; }
222
223private:
225 void initialize();
227 void finalize();
228
229private:
230 typedef ::std::unique_ptr< ScEditEngineDefaulter > EditEngineDefaulterPtr;
231 typedef ::std::unique_ptr< FormulaBuffer > FormulaBufferPtr;
232 typedef ::std::unique_ptr< SegmentProgressBar > ProgressBarPtr;
233 typedef ::std::unique_ptr< WorkbookSettings > WorkbookSettPtr;
234 typedef ::std::unique_ptr< ViewSettings > ViewSettingsPtr;
235 typedef ::std::unique_ptr< WorksheetBuffer > WorksheetBfrPtr;
236 typedef ::std::shared_ptr< ThemeBuffer > ThemeBfrRef;
237 typedef ::std::unique_ptr< StylesBuffer > StylesBfrPtr;
238 typedef ::std::unique_ptr< SharedStringsBuffer > SharedStrBfrPtr;
239 typedef ::std::unique_ptr< ExternalLinkBuffer > ExtLinkBfrPtr;
240 typedef ::std::unique_ptr< DefinedNamesBuffer > DefNamesBfrPtr;
241 typedef ::std::unique_ptr< TableBuffer > TableBfrPtr;
242 typedef ::std::unique_ptr< ScenarioBuffer > ScenarioBfrPtr;
243 typedef ::std::unique_ptr< ConnectionsBuffer > ConnectionsBfrPtr;
244 typedef ::std::unique_ptr< PivotCacheBuffer > PivotCacheBfrPtr;
245 typedef ::std::unique_ptr< PivotTableBuffer > PivotTableBfrPtr;
246 typedef ::std::unique_ptr< FormulaParser > FormulaParserPtr;
247 typedef ::std::unique_ptr< UnitConverter > UnitConvPtr;
248 typedef ::std::unique_ptr< AddressConverter > AddressConvPtr;
249 typedef ::std::unique_ptr< oox::drawingml::chart::ChartConverter > ExcelChartConvPtr;
250 typedef ::std::unique_ptr< PageSettingsConverter > PageSettConvPtr;
251
252 OUString maCellStyles;
253 OUString maPageStyles;
256 Reference< XSpreadsheetDocument > mxDoc;
257 FilterBase& mrBaseFilter;
261 sal_Int16 mnCurrSheet;
263
264 // buffers
279
280 // converters
286
288
289 // OOXML/BIFF12 specific
290 XmlFilterBase* mpOoxFilter;
291
292 // BIFF2-BIFF8 specific
293 rtl_TextEncoding meTextEnc;
296 std::unique_ptr<ScDocumentImport> mxDocImport;
297};
298
300 mrBaseFilter( rFilter ),
301 mrExcelFilter( rFilter ),
302 mpOoxFilter( &rFilter ),
303 mpDoc(nullptr),
304 mpDocShell(nullptr)
305{
306 // register at the filter, needed for virtual callbacks (even during construction)
308 initialize();
309}
310
312{
313 finalize();
315}
316
318{
319 return *mxDocImport;
320}
321
322Reference< XNameContainer > WorkbookGlobals::getStyleFamily( bool bPageStyles ) const
323{
324 Reference< XNameContainer > xStylesNC;
325 try
326 {
327 Reference< XStyleFamiliesSupplier > xFamiliesSup( mxDoc, UNO_QUERY_THROW );
328 Reference< XNameAccess > xFamiliesNA( xFamiliesSup->getStyleFamilies(), UNO_SET_THROW );
329 xStylesNC.set( xFamiliesNA->getByName( bPageStyles ? maPageStyles : maCellStyles ), UNO_QUERY );
330 }
331 catch( Exception& )
332 {
333 }
334 OSL_ENSURE( xStylesNC.is(), "WorkbookGlobals::getStyleFamily - cannot access style family" );
335 return xStylesNC;
336}
337
338Reference< XStyle > WorkbookGlobals::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const
339{
340 Reference< XStyle > xStyle;
341 try
342 {
343 Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
344 xStyle.set( xStylesNC->getByName( rStyleName ), UNO_QUERY );
345 }
346 catch( Exception& )
347 {
348 }
349 OSL_ENSURE( xStyle.is(), "WorkbookGlobals::getStyleObject - cannot access style object" );
350 return xStyle;
351}
352
353namespace {
354
355WorkbookHelper::RangeDataRet lcl_addNewByName(ScDocument& rDoc, ScRangeName* pNames, const OUString& rName, sal_Int16 nIndex, sal_Int32 nUnoType, bool bHidden)
356{
357 bool bDone = false;
359 if ( nUnoType & NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
360 if ( nUnoType & NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
362 if ( nUnoType & NamedRangeFlag::ROW_HEADER ) nNewType |= ScRangeData::Type::RowHeader;
363 ScTokenArray aTokenArray(rDoc);
364 ScRangeData* pNew = new ScRangeData(rDoc, rName, aTokenArray, ScAddress(), nNewType);
365 pNew->GuessPosition();
366 if ( nIndex )
367 pNew->SetIndex( nIndex );
368 // create but not insert hidden FILTER_CRITERIA named ranges to ScRangeName
369 if ( bHidden && nNewType == ScRangeData::Type::Criteria )
370 {
371 return WorkbookHelper::RangeDataRet(pNew, true);
372 }
373 if ( pNames->insert(pNew) )
374 bDone = true;
375 if (!bDone)
376 {
377 delete pNew;
378 throw RuntimeException();
379 }
380 return WorkbookHelper::RangeDataRet(pNew, false);
381}
382
383OUString findUnusedName( const ScRangeName* pRangeName, const OUString& rSuggestedName )
384{
385 OUString aNewName = rSuggestedName;
386 sal_Int32 nIndex = 0;
387 while(pRangeName->findByUpperName(ScGlobal::getCharClass().uppercase(aNewName)))
388 aNewName = rSuggestedName + OUStringChar('_') + OUString::number( nIndex++ );
389
390 return aNewName;
391}
392
393}
394
396 OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden)
397{
398 // create the name and insert it into the Calc document
399 WorkbookHelper::RangeDataRet aScRangeData(nullptr, false);
400 if( !orName.isEmpty() )
401 {
402 ScDocument& rDoc = getScDocument();
403 ScRangeName* pNames = rDoc.GetRangeName();
404 // find an unused name
405 orName = findUnusedName( pNames, orName );
406 // create the named range
407 aScRangeData = lcl_addNewByName(rDoc, pNames, orName, nIndex, nNameFlags, bHidden);
408 }
409 return aScRangeData;
410}
411
413 OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden)
414{
415 // create the name and insert it into the Calc document
416 WorkbookHelper::RangeDataRet aScRangeData(nullptr, false);
417 if( !orName.isEmpty() )
418 {
419 ScDocument& rDoc = getScDocument();
420 ScRangeName* pNames = rDoc.GetRangeName( nTab );
421 if(!pNames)
422 throw RuntimeException("invalid sheet index used");
423 // find an unused name
424 orName = findUnusedName( pNames, orName );
425 // create the named range
426 aScRangeData = lcl_addNewByName(rDoc, pNames, orName, nIndex, nNameFlags, bHidden);
427 }
428 return aScRangeData;
429}
430
431Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString& orName, const ScRange& rRangeAddr )
432{
433 // validate cell range
434 ScRange aDestRange = rRangeAddr;
435 bool bValidRange = getAddressConverter().validateCellRange( aDestRange, true, true );
436
437 // create database range and insert it into the Calc document
438 Reference< XDatabaseRange > xDatabaseRange;
439 if( bValidRange && !orName.isEmpty() ) try
440 {
441 // find an unused name
442 PropertySet aDocProps( mxDoc );
443 Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
444 orName = ContainerHelper::getUnusedName( xDatabaseRanges, orName, '_' );
445 // create the database range
446 CellRangeAddress aApiRange( aDestRange.aStart.Tab(), aDestRange.aStart.Col(), aDestRange.aStart.Row(),
447 aDestRange.aEnd.Col(), aDestRange.aEnd.Row() );
448 xDatabaseRanges->addNewByName( orName, aApiRange );
449 xDatabaseRange.set( xDatabaseRanges->getByName( orName ), UNO_QUERY );
450 }
451 catch( Exception& )
452 {
453 }
454 OSL_ENSURE( xDatabaseRange.is(), "WorkbookGlobals::createDatabaseRangeObject - cannot create database range" );
455 return xDatabaseRange;
456}
457
458Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( const ScRange& rRangeAddr )
459{
460 // validate cell range
461 ScRange aDestRange = rRangeAddr;
462 bool bValidRange = getAddressConverter().validateCellRange( aDestRange, true, true );
463
464 // create database range and insert it into the Calc document
465 Reference< XDatabaseRange > xDatabaseRange;
466 if( bValidRange ) try
467 {
468 ScDocument& rDoc = getScDocument();
469 if( rDoc.GetTableCount() <= aDestRange.aStart.Tab() )
470 throw css::lang::IndexOutOfBoundsException();
471 std::unique_ptr<ScDBData> pNewDBData(new ScDBData( STR_DB_LOCAL_NONAME, aDestRange.aStart.Tab(),
472 aDestRange.aStart.Col(), aDestRange.aStart.Row(),
473 aDestRange.aEnd.Col(), aDestRange.aEnd.Row() ));
474 rDoc.SetAnonymousDBData( aDestRange.aStart.Tab() , std::move(pNewDBData) );
475 ScDocShell* pDocSh = static_cast< ScDocShell* >(rDoc.GetDocumentShell());
476 xDatabaseRange.set(new ScDatabaseRangeObj(pDocSh, aDestRange.aStart.Tab()));
477 }
478 catch( Exception& )
479 {
480 }
481 OSL_ENSURE( xDatabaseRange.is(), "WorkbookData::createDatabaseRangeObject - cannot create database range" );
482 return xDatabaseRange;
483}
484
486{
487 ScDBCollection* pDBCollection = getScDocument().GetDBCollection();
488 if (!pDBCollection)
489 return nullptr;
490 return pDBCollection->getNamedDBs().findByIndex( nIndex );
491}
492
493Reference< XStyle > WorkbookGlobals::createStyleObject( OUString& orStyleName, bool bPageStyle )
494{
495 Reference< XStyle > xStyle;
496 try
497 {
498 Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
499 xStyle.set( mrBaseFilter.getModelFactory()->createInstance( bPageStyle ? maPageStyleServ : maCellStyleServ ), UNO_QUERY_THROW );
500 orStyleName = ContainerHelper::insertByUnusedName( xStylesNC, orStyleName, ' ', Any( xStyle ) );
501 }
502 catch( Exception& )
503 {
504 }
505 OSL_ENSURE( xStyle.is(), "WorkbookGlobals::createStyleObject - cannot create style" );
506 return xStyle;
507}
508
510{
511 if( bInternal )
513 else
514 mxChartConverter.reset( new ExcelChartConverter( *this ) );
515}
516
517// BIFF specific --------------------------------------------------------------
518
519// private --------------------------------------------------------------------
520
522{
523 maCellStyles = "CellStyles";
524 maPageStyles = "PageStyles";
525 maCellStyleServ = "com.sun.star.style.CellStyle";
526 maPageStyleServ = "com.sun.star.style.PageStyle";
527 mnCurrSheet = -1;
528 mbGeneratorKnownGood = false;
529 meTextEnc = osl_getThreadTextEncoding();
530
531 // the spreadsheet document
532 mxDoc.set( mrBaseFilter.getModel(), UNO_QUERY );
533 OSL_ENSURE( mxDoc.is(), "WorkbookGlobals::initialize - no spreadsheet document" );
534
535 if (mxDoc)
536 {
537 ScModelObj* pModel = comphelper::getFromUnoTunnel<ScModelObj>(mxDoc);
538 if (pModel)
539 mpDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject());
540 if (mpDocShell)
542 }
543
544 if (!mpDoc)
545 throw RuntimeException("Workbookhelper::getScDocument(): Failed to access ScDocument from model");
546
547 Reference< XDocumentPropertiesSupplier > xPropSupplier( mxDoc, UNO_QUERY);
548 Reference< XDocumentProperties > xDocProps = xPropSupplier->getDocumentProperties();
549 const OUString aGenerator( xDocProps->getGenerator());
550
551 if (aGenerator.startsWithIgnoreAsciiCase("Microsoft"))
552 {
554 ScCalcConfig aCalcConfig = mpDoc->GetCalcConfig();
556 mpDoc->SetCalcConfig(aCalcConfig);
557 }
558 else if (aGenerator.startsWithIgnoreAsciiCase("LibreOffice"))
559 {
561 }
562
564
565 mxFormulaBuffer.reset( new FormulaBuffer( *this ) );
566 mxWorkbookSettings.reset( new WorkbookSettings( *this ) );
567 mxViewSettings.reset( new ViewSettings( *this ) );
568 mxWorksheets.reset( new WorksheetBuffer( *this ) );
569 mxTheme = std::make_shared<ThemeBuffer>( *this );
570 mxStyles.reset( new StylesBuffer( *this ) );
571 mxSharedStrings.reset( new SharedStringsBuffer( *this ) );
572 mxExtLinks.reset( new ExternalLinkBuffer( *this ) );
573 mxDefNames.reset( new DefinedNamesBuffer( *this ) );
574 mxTables.reset( new TableBuffer( *this ) );
575 mxScenarios.reset( new ScenarioBuffer( *this ) );
576 mxConnections.reset( new ConnectionsBuffer( *this ) );
577 mxPivotCaches.reset( new PivotCacheBuffer( *this ) );
578 mxPivotTables.reset( new PivotTableBuffer( *this ) );
579
580 mxUnitConverter.reset( new UnitConverter( *this ) );
581 mxAddrConverter.reset( new AddressConverter( *this ) );
582 mxChartConverter.reset( new ExcelChartConverter( *this ) );
583 mxPageSettConverter.reset( new PageSettingsConverter( *this ) );
584
585 // initialise edit engine
586 ScDocument& rDoc = getScDocument();
587 mxEditEngine.reset( new ScEditEngineDefaulter( rDoc.GetEnginePool() ) );
588 mxEditEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
589 mxEditEngine->SetEditTextObjectPool( rDoc.GetEditPool() );
590 mxEditEngine->SetUpdateLayout( false );
591 mxEditEngine->EnableUndo( false );
592 mxEditEngine->SetControlWord( mxEditEngine->GetControlWord() & ~EEControlBits::ALLOWBIGOBJS );
593
594 // set some document properties needed during import
595 if( mrBaseFilter.isImportFilter() )
596 {
597 // enable editing read-only documents (e.g. from read-only files)
599 // #i76026# disable Undo while loading the document
600 mpDoc->EnableUndo(false);
601 // #i79826# disable calculating automatic row height while loading the document
603 // disable automatic update of linked sheets and DDE links
604 mpDoc->EnableExecuteLink(false);
605
606 mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), ScResId(STR_LOAD_DOC) ) );
608
609 //prevent unnecessary broadcasts and "half way listeners" as
610 //is done in ScDocShell::BeforeXMLLoading() for ods
612 }
613 else if( mrBaseFilter.isExportFilter() )
614 {
615 mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), ScResId(STR_SAVE_DOC) ) );
616 }
617}
618
620{
621 // set some document properties needed after import
622 if( !mrBaseFilter.isImportFilter() )
623 return;
624
625 // #i74668# do not insert default sheets
626 mpDocShell->SetEmpty(false);
627 // enable automatic update of linked sheets and DDE links
629 // #i79826# enable updating automatic row height after loading the document
631
632 // #i76026# enable Undo after loading the document
633 mpDoc->EnableUndo(true);
634
635 // disable editing read-only documents (e.g. from read-only files)
637 // #111099# open forms in alive mode (has no effect, if no controls in document)
638 ScDrawLayer* pModel = mpDoc->GetDrawLayer();
639 if (pModel)
640 pModel->SetOpenInDesignMode(false);
641}
642
643
645{
646}
647
649{
650 WorkbookGlobalsRef xBookGlob = std::make_shared<WorkbookGlobals>( rFilter );
651 if( !xBookGlob->isValid() )
652 xBookGlob.reset();
653 return xBookGlob;
654}
655
656// filter ---------------------------------------------------------------------
657
659{
660 return mrBookGlob.getBaseFilter();
661}
662
664{
665 return mrBookGlob.getProgressBar();
666}
667
669{
671}
672
674{
676}
677
679{
680 mrBookGlob.setVbaProjectStorage( rxVbaPrjStrg );
681}
682
684{
686}
687
689{
690 // workbook settings, document and sheet view settings
693
694 // Import the VBA project (after finalizing workbook settings which
695 // contains the workbook code name). Do it before processing formulas in
696 // order to correctly resolve VBA custom function names.
698 if( xVbaPrjStrg && xVbaPrjStrg->isStorage() )
699 getBaseFilter().getVbaProject().importModulesAndForms( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() );
700
701 // need to import formulas before scenarios
703
704 // Insert all pivot tables. Must be done after loading all sheets and
705 // formulas, because data pilots expect existing source data on
706 // creation.
708
709 /* Insert scenarios after all sheet processing is done, because new hidden
710 sheets are created for scenarios which would confuse code that relies
711 on certain sheet indexes. Must be done after pivot tables too. */
713
714 /* Set 'Default' page style to automatic page numbering (default is manual
715 number 1). Otherwise hidden sheets (e.g. for scenarios) which have
716 'Default' page style will break automatic page numbering for following
717 sheets. Automatic numbering is set by passing the value 0. */
718 PropertySet aDefPageStyle( getStyleObject( "Default", true ) );
719 aDefPageStyle.setProperty< sal_Int16 >( PROP_FirstPageNumber, 0 );
720
721 // Has any string ref syntax been imported?
722 // If not, we need to take action
723 ScCalcConfig aCalcConfig = getScDocument().GetCalcConfig();
724
725 if ( !aCalcConfig.mbHasStringRefSyntax )
726 {
728 getScDocument().SetCalcConfig(aCalcConfig);
729 }
730
731 // set selected sheet and positionleft/positiontop for OLE objects
732 Reference<XViewDataSupplier> xViewDataSupplier(getDocument(), UNO_QUERY);
733 if (!xViewDataSupplier.is())
734 return;
735
736 Reference<XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
737 if (!(xIndexAccess.is() && xIndexAccess->getCount() > 0))
738 return;
739
740 Sequence< PropertyValue > aSeq;
741 if (!(xIndexAccess->getByIndex(0) >>= aSeq))
742 return;
743
744 OUString sTabName;
745 Reference< XNameAccess > xSheetsNC;
746 for (const auto& rProp : std::as_const(aSeq))
747 {
748 OUString sName(rProp.Name);
749 if (sName == SC_ACTIVETABLE)
750 {
751 if(rProp.Value >>= sTabName)
752 {
753 SCTAB nTab(0);
754 if (getScDocument().GetTable(sTabName, nTab))
756 }
757 }
758 else if (sName == SC_TABLES)
759 {
760 rProp.Value >>= xSheetsNC;
761 }
762 }
763 if (!(xSheetsNC.is() && xSheetsNC->hasByName(sTabName)))
764 return;
765
766 Sequence<PropertyValue> aProperties;
767 Any aAny = xSheetsNC->getByName(sTabName);
768 if ( !(aAny >>= aProperties) )
769 return;
770
771 for (const auto& rProp : std::as_const(aProperties))
772 {
773 OUString sName(rProp.Name);
774 if (sName == SC_POSITIONLEFT)
775 {
776 SCCOL nPosLeft = *o3tl::doAccess<SCCOL>(rProp.Value);
777 getScDocument().SetPosLeft(nPosLeft);
778 }
779 else if (sName == SC_POSITIONTOP)
780 {
781 SCROW nPosTop = *o3tl::doAccess<SCROW>(rProp.Value);
782 getScDocument().SetPosTop(nPosTop);
783 }
784 }
785}
786
787// document model -------------------------------------------------------------
788
790{
791 return mrBookGlob.getScDocument();
792}
793
795{
796 return mrBookGlob.getScDocument();
797}
798
800{
801 return mrBookGlob.getDocImport();
802}
803
805{
806 return mrBookGlob.getDocImport();
807}
808
810{
811 return mrBookGlob.getEditEngine();
812}
813
814const Reference< XSpreadsheetDocument > & WorkbookHelper::getDocument() const
815{
816 return mrBookGlob.getDocument();
817}
818
819Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( sal_Int32 nSheet ) const
820{
821 Reference< XSpreadsheet > xSheet;
822 try
823 {
824 Reference< XIndexAccess > xSheetsIA( getDocument()->getSheets(), UNO_QUERY_THROW );
825 xSheet.set( xSheetsIA->getByIndex( nSheet ), UNO_QUERY_THROW );
826 }
827 catch( Exception& )
828 {
829 }
830 return xSheet;
831}
832
833Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( const OUString& rSheet ) const
834{
835 Reference< XSpreadsheet > xSheet;
836 try
837 {
838 Reference< XNameAccess > xSheetsNA( getDocument()->getSheets(), UNO_QUERY_THROW );
839 xSheet.set( xSheetsNA->getByName( rSheet ), UNO_QUERY );
840 }
841 catch( Exception& )
842 {
843 }
844 return xSheet;
845}
846
847Reference< XCellRange > WorkbookHelper::getCellRangeFromDoc( const ScRange& rRange ) const
848{
849 Reference< XCellRange > xRange;
850 try
851 {
852 Reference< XSpreadsheet > xSheet( getSheetFromDoc( rRange.aStart.Tab() ), UNO_SET_THROW );
853 xRange = xSheet->getCellRangeByPosition( rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row() );
854 }
855 catch( Exception& )
856 {
857 }
858 return xRange;
859}
860
861Reference< XNameContainer > WorkbookHelper::getCellStyleFamily() const
862{
863 return mrBookGlob.getStyleFamily( false/*bPageStyles*/ );
864}
865
866Reference< XStyle > WorkbookHelper::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const
867{
868 return mrBookGlob.getStyleObject( rStyleName, bPageStyle );
869}
870
871WorkbookHelper::RangeDataRet WorkbookHelper::createNamedRangeObject(OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden) const
872{
873 return mrBookGlob.createNamedRangeObject(orName, nIndex, nNameFlags, bHidden);
874}
875
876WorkbookHelper::RangeDataRet WorkbookHelper::createLocalNamedRangeObject(OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden) const
877{
878 return mrBookGlob.createLocalNamedRangeObject(orName, nIndex, nNameFlags, nTab, bHidden);
879}
880
881Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const ScRange& rRangeAddr ) const
882{
883 return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr );
884}
885
886Reference< XDatabaseRange > WorkbookHelper::createUnnamedDatabaseRangeObject( const ScRange& rRangeAddr ) const
887{
888 return mrBookGlob.createUnnamedDatabaseRangeObject( rRangeAddr );
889}
890
892{
894}
895
896Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle ) const
897{
898 return mrBookGlob.createStyleObject( orStyleName, bPageStyle );
899}
900
901// buffers --------------------------------------------------------------------
902
904{
906}
907
909{
911}
912
914{
916}
917
919{
920 return mrBookGlob.getWorksheets();
921}
922
924{
925 return mrBookGlob.getTheme();
926}
927
929{
930 return mrBookGlob.getStyles();
931}
932
934{
936}
937
939{
941}
942
944{
946}
947
949{
950 return mrBookGlob.getTables();
951}
952
954{
955 return mrBookGlob.getScenarios();
956}
957
959{
960 return mrBookGlob.getConnections();
961}
962
964{
965 return mrBookGlob.getPivotCaches();
966}
967
969{
970 return mrBookGlob.getPivotTables();
971}
972
973// converters -----------------------------------------------------------------
974
976{
978}
979
981{
983}
984
986{
988}
989
991{
993}
994
996{
998}
999
1001{
1003}
1004
1006{
1008}
1009
1010// OOXML/BIFF12 specific ------------------------------------------------------
1011
1012XmlFilterBase& WorkbookHelper::getOoxFilter() const
1013{
1014 return mrBookGlob.getOoxFilter();
1015}
1016
1018{
1019 return getOoxFilter().importFragment( rxHandler );
1020}
1021
1023{
1024 return getOoxFilter().importFragment(rxHandler, rParser);
1025}
1026
1027// BIFF specific --------------------------------------------------------------
1028
1029rtl_TextEncoding WorkbookHelper::getTextEncoding() const
1030{
1031 return mrBookGlob.getTextEncoding();
1032}
1033
1034} // namespace oox
1035
1036/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
constexpr OUStringLiteral SC_TABLES
constexpr OUStringLiteral SC_POSITIONLEFT
constexpr OUStringLiteral SC_ACTIVETABLE
constexpr OUStringLiteral SC_POSITIONTOP
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
void SetOpenInDesignMode(bool _bOpenDesignMode)
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
ScDBData * findByIndex(sal_uInt16 nIndex)
Definition: dbdata.cxx:1214
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:324
void SetEmpty(bool bSet)
Definition: docsh2.cxx:89
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
Accessor class to ScDocument.
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
Definition: documen2.cxx:478
const ScCalcConfig & GetCalcConfig() const
Definition: document.hxx:2618
SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab)
Definition: document.hxx:880
SC_DLLPUBLIC void EnableUndo(bool bVal)
Definition: document.cxx:6581
void EnableExecuteLink(bool bVal)
Definition: document.hxx:1602
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:473
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1083
SC_DLLPUBLIC void SetCalcConfig(const ScCalcConfig &rConfig)
Definition: document10.cxx:205
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:827
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1082
void SetInsertingFromOtherDoc(bool bVal)
Definition: document.hxx:2222
void EnableChangeReadOnly(bool bVal)
Definition: document.hxx:1604
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:174
SC_DLLPUBLIC void SetPosTop(SCROW nRow)
Definition: document.hxx:884
SC_DLLPUBLIC void SetPosLeft(SCCOL nCol)
Definition: document.hxx:882
void LockAdjustHeight()
Definition: document.hxx:1599
SC_DLLPUBLIC void UnlockAdjustHeight()
Definition: document.cxx:1808
SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, std::unique_ptr< ScDBData > pDBData)
Definition: document.cxx:321
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:316
static SC_DLLPUBLIC const CharClass & getCharClass()
Definition: global.cxx:1064
SfxObjectShell * GetEmbeddedObject() const
Definition: docuno.cxx:445
SC_DLLPUBLIC void GuessPosition()
Definition: rangenam.cxx:206
void SetIndex(sal_uInt16 nInd)
Definition: rangenam.hxx:115
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:704
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
Definition: rangenam.cxx:802
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
static OUString getUnusedName(const css::uno::Reference< css::container::XNameAccess > &rxNameAccess, const OUString &rSuggestedName, sal_Unicode cSeparator)
static OUString insertByUnusedName(const css::uno::Reference< css::container::XNameContainer > &rxNameContainer, const OUString &rSuggestedName, sal_Unicode cSeparator, const css::uno::Any &rObject)
css::uno::Any getAnyProperty(sal_Int32 nPropId) const
bool setProperty(sal_Int32 nPropId, const Type &rValue)
::oox::ole::VbaProject & getVbaProject() const
bool importFragment(const rtl::Reference< FragmentHandler > &rxHandler)
void importModulesAndForms(StorageBase &rVbaPrjStrg, const GraphicHelper &rGraphicHelper)
Converter for cell addresses and cell ranges for OOXML and BIFF filters.
bool validateCellRange(ScRange &orRange, bool bAllowOverflow, bool bTrackOverflow)
Checks the passed cell range, may try to fit it to current sheet limits.
void registerWorkbookGlobals(WorkbookGlobals &rBookGlob)
Definition: excelfilter.cxx:58
void unregisterWorkbookGlobals()
Definition: excelfilter.cxx:69
Import formula parser for OOXML and BIFF filters.
void finalizeImport()
Inserts all pivot tables into the sheet.
void finalizeImport()
Creates all scenarios in the Calc document.
Collects all strings from the shared strings substream.
Helper class that provides functions to convert values from and to different units.
void finalizeImport()
Converts all imported document view settings.
void finalize()
Finalizes the filter process (sets some needed document properties).
ScenarioBuffer & getScenarios() const
Returns the scenarios collection.
EditEngineDefaulterPtr mxEditEngine
Page/print settings converter.
::std::unique_ptr< ScenarioBuffer > ScenarioBfrPtr
ExcelChartConvPtr mxChartConverter
Cell address and cell range address converter.
const Reference< XSpreadsheetDocument > & getDocument() const
Returns a reference to the source/target spreadsheet document model.
FilterBase & getBaseFilter() const
Returns the base filter object (base class of all filters).
PivotTableBuffer & getPivotTables()
Returns the collection of pivot tables.
WorksheetBuffer & getWorksheets() const
Returns the worksheet buffer containing sheet names and properties.
rtl_TextEncoding meTextEnc
Base OOXML/BIFF12 filter object.
::std::unique_ptr< SegmentProgressBar > ProgressBarPtr
FormulaParser & getFormulaParser() const
Returns a shared import formula parser.
PivotCacheBuffer & getPivotCaches() const
Returns the collection of pivot caches.
Reference< XStyle > createStyleObject(OUString &orStyleName, bool bPageStyle)
Creates and returns a com.sun.star.style.Style object for cells or pages.
DefNamesBfrPtr mxDefNames
All external links.
std::unique_ptr< ScDocumentImport > mxDocImport
SegmentProgressBar & getProgressBar() const
Returns the filter progress bar.
::std::unique_ptr< FormulaParser > FormulaParserPtr
::std::unique_ptr< SharedStringsBuffer > SharedStrBfrPtr
bool isGeneratorKnownGood() const
Returns true when reading a file generated by a known good generator.
Reference< XDatabaseRange > createDatabaseRangeObject(OUString &orName, const ScRange &rRangeAddr)
Creates and returns a database range on-the-fly in the Calc document.
sal_Int16 mnCurrSheet
Storage containing the VBA project.
AddressConvPtr mxAddrConverter
General unit converter.
WorksheetBfrPtr mxWorksheets
Workbook and sheet view settings.
StorageRef mxVbaPrjStrg
The progress bar.
TableBfrPtr mxTables
All defined names.
WorkbookHelper::RangeDataRet createNamedRangeObject(OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden)
Creates and returns a defined name on-the-fly in the Calc document.
DefinedNamesBuffer & getDefinedNames() const
Returns the defined names read from the workbook globals.
::std::unique_ptr< WorkbookSettings > WorkbookSettPtr
::std::unique_ptr< ViewSettings > ViewSettingsPtr
Reference< XStyle > getStyleObject(const OUString &rStyleName, bool bPageStyle) const
Returns the specified cell or page style from the Calc document.
::std::unique_ptr< AddressConverter > AddressConvPtr
FormulaParser * createFormulaParser()
Returns an unshared import formula parser.
PivotCacheBfrPtr mxPivotCaches
All external data connections.
Reference< XSpreadsheetDocument > mxDoc
Service name for a page style.
::std::unique_ptr< PivotCacheBuffer > PivotCacheBfrPtr
PivotTableBfrPtr mxPivotTables
All pivot caches in the document.
void useInternalChartDataTable(bool bInternal)
Helper to switch chart data table - specifically for xlsx imports.
ThemeBuffer & getTheme() const
Returns the office theme object read from the theme substorage.
::std::unique_ptr< PivotTableBuffer > PivotTableBfrPtr
Reference< XNameContainer > getStyleFamily(bool bPageStyles) const
Returns the cell or page styles container from the Calc document.
const StorageRef & getVbaProjectStorage() const
Returns the VBA project storage.
oox::drawingml::chart::ChartConverter * getChartConverter() const
Returns the chart object converter.
::std::unique_ptr< TableBuffer > TableBfrPtr
StylesBfrPtr mxStyles
Formatting theme from theme substream.
bool isValid() const
Returns true, if this helper refers to a valid document.
::std::unique_ptr< ConnectionsBuffer > ConnectionsBfrPtr
XmlFilterBase & getOoxFilter() const
Returns the base OOXML/BIFF12 filter object.
Reference< XDatabaseRange > createUnnamedDatabaseRangeObject(const ScRange &rRangeAddr)
Creates and returns an unnamed database range on-the-fly in the Calc document.
::std::shared_ptr< ThemeBuffer > ThemeBfrRef
OUString maPageStyleServ
Service name for a cell style.
::std::unique_ptr< UnitConverter > UnitConvPtr
WorkbookSettings & getWorkbookSettings() const
Returns the global workbook settings object.
OUString maCellStyleServ
Style family name for page styles.
void initialize()
Initializes some basic members and sets needed document properties.
ProgressBarPtr mxProgressBar
Base object for registration of this structure.
::std::unique_ptr< FormulaBuffer > FormulaBufferPtr
::std::unique_ptr< WorksheetBuffer > WorksheetBfrPtr
sal_Int16 getCurrentSheetIndex() const
Returns the index of the current Calc sheet, if filter currently processes a sheet.
FilterBase & mrBaseFilter
Document model.
ViewSettingsPtr mxViewSettings
Global workbook settings.
FormulaBufferPtr mxFormulaBuffer
Whether reading a file generated by Excel or Calc.
::std::unique_ptr< oox::drawingml::chart::ChartConverter > ExcelChartConvPtr
::std::unique_ptr< ExternalLinkBuffer > ExtLinkBfrPtr
AddressConverter & getAddressConverter() const
Returns the converter for string to cell address/range conversion.
ScDocument * mpDoc
BIFF byte string text encoding.
rtl_TextEncoding getTextEncoding() const
Returns the text encoding used to import/export byte strings.
UnitConvPtr mxUnitConverter
Import formula parser.
WorkbookGlobals(const WorkbookGlobals &)=delete
ExternalLinkBuffer & getExternalLinks() const
Returns the external links read from the external links substream.
StylesBuffer & getStyles() const
Returns all cell formatting objects read from the styles substream.
::std::unique_ptr< StylesBuffer > StylesBfrPtr
::std::unique_ptr< DefinedNamesBuffer > DefNamesBfrPtr
void setCurrentSheetIndex(SCTAB nSheet)
Sets the index of the current Calc sheet, if filter currently processes a sheet.
TableBuffer & getTables() const
Returns the tables collection (equivalent to Calc's database ranges).
WorkbookSettPtr mxWorkbookSettings
const WorkbookGlobals & operator=(const WorkbookGlobals &)=delete
ConnectionsBfrPtr mxConnections
All scenarios.
ViewSettings & getViewSettings() const
Returns the workbook and sheet view settings object.
SharedStrBfrPtr mxSharedStrings
All cell style objects from styles substream.
ScDocumentImport & getDocImport()
ConnectionsBuffer & getConnections() const
Returns the collection of external data connections.
SharedStringsBuffer & getSharedStrings() const
Returns the shared strings read from the shared strings substream.
PageSettingsConverter & getPageSettingsConverter() const
Returns the page/print settings converter.
ExtLinkBfrPtr mxExtLinks
All strings from shared strings substream.
::std::unique_ptr< PageSettingsConverter > PageSettConvPtr
ExcelFilter & mrExcelFilter
Base filter object.
ScDBData * findDatabaseRangeByIndex(sal_uInt16 nIndex)
Finds the (already existing) database range of the given formula token index.
bool mbGeneratorKnownGood
Current sheet index in Calc document.
PageSettConvPtr mxPageSettConverter
Chart object converter.
FormulaParserPtr mxFmlaParser
All pivot tables in the document.
ScenarioBfrPtr mxScenarios
All tables (database ranges).
OUString maPageStyles
Style family name for cell styles.
void setVbaProjectStorage(const StorageRef &rxVbaPrjStrg)
Sets the VBA project storage used to import VBA source code and forms.
WorkbookHelper::RangeDataRet createLocalNamedRangeObject(OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden)
Creates and returns a defined name on the-fly in the correct Calc sheet.
FormulaBuffer & getFormulaBuffer() const
ThemeBfrRef mxTheme
Sheet info buffer.
::std::unique_ptr< ScEditEngineDefaulter > EditEngineDefaulterPtr
ScEditEngineDefaulter & getEditEngine() const
UnitConverter & getUnitConverter() const
Returns the measurement unit converter.
void useInternalChartDataTable(bool bInternal)
bool isGeneratorKnownGood() const
Returns true when reading a file generated by a known good generator.
oox::drawingml::chart::ChartConverter * getChartConverter() const
Returns the chart object converter.
css::uno::Reference< css::style::XStyle > createStyleObject(OUString &orStyleName, bool bPageStyle) const
Creates and returns a com.sun.star.style.Style object for cells or pages.
SharedStringsBuffer & getSharedStrings() const
Returns the shared strings read from the shared strings substream.
ScEditEngineDefaulter & getEditEngine() const
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc(sal_Int32 nSheet) const
Returns a reference to the specified spreadsheet in the document model.
static WorkbookGlobalsRef constructGlobals(ExcelFilter &rFilter)
rtl_TextEncoding getTextEncoding() const
Returns the text encoding used to import/export byte strings.
bool importOoxFragment(const rtl::Reference< oox::core::FragmentHandler > &rxHandler)
Imports a fragment using the passed fragment handler, which contains the full path to the fragment st...
::oox::core::XmlFilterBase & getOoxFilter() const
Returns the base OOXML/BIFF12 filter object.
std::pair< ScRangeData *, bool > RangeDataRet
WorksheetBuffer & getWorksheets() const
Returns the worksheet buffer containing sheet names and properties.
PivotCacheBuffer & getPivotCaches() const
Returns the collection of pivot caches.
ScenarioBuffer & getScenarios() const
Returns the scenarios collection.
PageSettingsConverter & getPageSettingsConverter() const
Returns the page and print settings converter.
void setCurrentSheetIndex(SCTAB nSheet)
Sets the index of the current Calc sheet, if filter currently processes a sheet.
AddressConverter & getAddressConverter() const
Returns the converter for string to cell address/range conversion.
css::uno::Reference< css::sheet::XDatabaseRange > createDatabaseRangeObject(OUString &orName, const ScRange &rRangeAddr) const
Creates and returns a database range on-the-fly in the Calc document.
WorkbookSettings & getWorkbookSettings() const
Returns the global workbook settings object.
WorkbookGlobals & mrBookGlob
sal_Int16 getCurrentSheetIndex() const
Returns the index of the current Calc sheet, if filter currently processes a sheet.
css::uno::Reference< css::container::XNameContainer > getCellStyleFamily() const
Returns the cell styles container from the Calc document.
StylesBuffer & getStyles() const
Returns all cell formatting objects read from the styles substream.
css::uno::Reference< css::table::XCellRange > getCellRangeFromDoc(const ScRange &rRange) const
Returns the XCellRange interface for the passed cell range address.
ScDBData * findDatabaseRangeByIndex(sal_uInt16 nIndex) const
Finds the (already existing) database range of the given formula token index.
RangeDataRet createLocalNamedRangeObject(OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden) const
Creates and returns a defined name on-the-fly in the sheet.
FormulaBuffer & getFormulaBuffer() const
PivotTableBuffer & getPivotTables() const
Returns the collection of pivot tables.
DefinedNamesBuffer & getDefinedNames() const
Returns the defined names read from the workbook globals.
ViewSettings & getViewSettings() const
Returns the workbook and sheet view settings object.
ScDocumentImport & getDocImport()
ThemeBuffer & getTheme() const
Returns the office theme object read from the theme substorage.
css::uno::Reference< css::sheet::XDatabaseRange > createUnnamedDatabaseRangeObject(const ScRange &rRangeAddr) const
Creates and returns an unnamed database range on-the-fly in the Calc document.
UnitConverter & getUnitConverter() const
Returns the measurement unit converter.
FormulaParser * createFormulaParser() const
Returns an unshared import formula parser (import filter only!).
void setVbaProjectStorage(const StorageRef &rxVbaPrjStrg)
Sets the VBA project storage used to import VBA source code and forms.
::oox::core::FilterBase & getBaseFilter() const
Returns the base filter object (base class of all filters).
void finalizeWorkbookImport()
Final conversion after importing the workbook.
css::uno::Reference< css::style::XStyle > getStyleObject(const OUString &rStyleName, bool bPageStyle) const
Returns the specified cell or page style from the Calc document.
TableBuffer & getTables() const
Returns the tables collection (equivalent to Calc's database ranges).
ConnectionsBuffer & getConnections() const
Returns the collection of external data connections.
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument() const
Returns a reference to the source/target spreadsheet document model.
SegmentProgressBar & getProgressBar() const
Returns the filter progress bar.
FormulaParser & getFormulaParser() const
Returns a shared import formula parser (import filter only!).
ExternalLinkBuffer & getExternalLinks() const
Returns the external links read from the external links substream.
RangeDataRet createNamedRangeObject(OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden) const
Creates and returns a defined name on-the-fly in the Calc document.
void finalizeImport()
Converts the imported workbook settings.
Stores information about all sheets in a spreadsheet document.
constexpr OUStringLiteral STR_DB_LOCAL_NONAME
Definition: globalnames.hxx:14
sal_Int32 nIndex
Sequence< sal_Int8 > aSeq
const char * sName
@ Exception
int compareToIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
std::shared_ptr< WorkbookGlobals > WorkbookGlobalsRef
std::shared_ptr< StorageBase > StorageRef
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
Configuration options for formula interpreter.
Definition: calcconfig.hxx:44
void SetStringRefSyntax(formula::FormulaGrammar::AddressConvention eConv)
Definition: calcconfig.cxx:163
formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax
Definition: calcconfig.hxx:53
bool operator()(std::u16string_view rName1, std::u16string_view rName2) const
@ COLUMN_HEADER
Definition: tabview.hxx:59
@ ROW_HEADER
Definition: tabview.hxx:60
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
constexpr OUStringLiteral PROP_FirstPageNumber