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; }
134
136 void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) { mxVbaPrjStrg = rxVbaPrjStrg; }
138 void setCurrentSheetIndex( SCTAB nSheet ) { mnCurrSheet = nSheet; }
139
140 // document model ---------------------------------------------------------
141
143 {
144 return *mxEditEngine;
145 }
146
148
150
152 const Reference< XSpreadsheetDocument >& getDocument() const { return mxDoc; }
154 Reference< XNameContainer > getStyleFamily( bool bPageStyles ) const;
156 Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const;
158 WorkbookHelper::RangeDataRet createNamedRangeObject(OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden);
160 WorkbookHelper::RangeDataRet createLocalNamedRangeObject(OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden);
162 Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const ScRange& rRangeAddr );
164 Reference< XDatabaseRange > createUnnamedDatabaseRangeObject( const ScRange& rRangeAddr );
166 ScDBData* findDatabaseRangeByIndex( sal_uInt16 nIndex );
168 Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle );
170 void useInternalChartDataTable( bool bInternal );
171
172 // buffers ----------------------------------------------------------------
173
182 ThemeBuffer& getTheme() const { return *mxTheme; }
184 StylesBuffer& getStyles() const { return *mxStyles; }
192 TableBuffer& getTables() const { return *mxTables; }
201
202 // converters -------------------------------------------------------------
203
216
217 // OOXML/BIFF12 specific --------------------------------------------------
218
220 XmlFilterBase& getOoxFilter() const { return *mpOoxFilter; }
221
222 // BIFF2-BIFF8 specific ---------------------------------------------------
223
225 rtl_TextEncoding getTextEncoding() const { return meTextEnc; }
226
227private:
229 void initialize();
231 void finalize();
232
233 void ImplDestroy();
234
235private:
236 typedef ::std::unique_ptr< ScEditEngineDefaulter > EditEngineDefaulterPtr;
237 typedef ::std::unique_ptr< FormulaBuffer > FormulaBufferPtr;
238 typedef ::std::unique_ptr< SegmentProgressBar > ProgressBarPtr;
239 typedef ::std::unique_ptr< WorkbookSettings > WorkbookSettPtr;
240 typedef ::std::unique_ptr< ViewSettings > ViewSettingsPtr;
241 typedef ::std::unique_ptr< WorksheetBuffer > WorksheetBfrPtr;
242 typedef ::std::shared_ptr< ThemeBuffer > ThemeBfrRef;
243 typedef ::std::unique_ptr< StylesBuffer > StylesBfrPtr;
244 typedef ::std::unique_ptr< SharedStringsBuffer > SharedStrBfrPtr;
245 typedef ::std::unique_ptr< ExternalLinkBuffer > ExtLinkBfrPtr;
246 typedef ::std::unique_ptr< DefinedNamesBuffer > DefNamesBfrPtr;
247 typedef ::std::unique_ptr< TableBuffer > TableBfrPtr;
248 typedef ::std::unique_ptr< ScenarioBuffer > ScenarioBfrPtr;
249 typedef ::std::unique_ptr< ConnectionsBuffer > ConnectionsBfrPtr;
250 typedef ::std::unique_ptr< PivotCacheBuffer > PivotCacheBfrPtr;
251 typedef ::std::unique_ptr< PivotTableBuffer > PivotTableBfrPtr;
252 typedef ::std::unique_ptr< FormulaParser > FormulaParserPtr;
253 typedef ::std::unique_ptr< UnitConverter > UnitConvPtr;
254 typedef ::std::unique_ptr< AddressConverter > AddressConvPtr;
255 typedef ::std::unique_ptr< oox::drawingml::chart::ChartConverter > ExcelChartConvPtr;
256 typedef ::std::unique_ptr< PageSettingsConverter > PageSettConvPtr;
257
258 OUString maCellStyles;
259 OUString maPageStyles;
262 Reference< XSpreadsheetDocument > mxDoc;
263 FilterBase& mrBaseFilter;
267 sal_Int16 mnCurrSheet;
270
271 // buffers
286
287 // converters
293
295
296 // OOXML/BIFF12 specific
297 XmlFilterBase* mpOoxFilter;
298
299 // BIFF2-BIFF8 specific
300 rtl_TextEncoding meTextEnc;
303 std::unique_ptr<ScDocumentImport> mxDocImport;
304};
305
307 mrBaseFilter( rFilter ),
308 mrExcelFilter( rFilter ),
309 mpOoxFilter( &rFilter ),
310 mpDoc(nullptr),
311 mpDocShell(nullptr)
312{
313 // register at the filter, needed for virtual callbacks (even during construction)
315 initialize();
316}
317
319{
320 finalize();
322}
323
325{
327}
328
330{
331 return *mxDocImport;
332}
333
334Reference< XNameContainer > WorkbookGlobals::getStyleFamily( bool bPageStyles ) const
335{
336 Reference< XNameContainer > xStylesNC;
337 try
338 {
339 Reference< XStyleFamiliesSupplier > xFamiliesSup( mxDoc, UNO_QUERY_THROW );
340 Reference< XNameAccess > xFamiliesNA( xFamiliesSup->getStyleFamilies(), UNO_SET_THROW );
341 xStylesNC.set( xFamiliesNA->getByName( bPageStyles ? maPageStyles : maCellStyles ), UNO_QUERY );
342 }
343 catch( Exception& )
344 {
345 }
346 OSL_ENSURE( xStylesNC.is(), "WorkbookGlobals::getStyleFamily - cannot access style family" );
347 return xStylesNC;
348}
349
350Reference< XStyle > WorkbookGlobals::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const
351{
352 Reference< XStyle > xStyle;
353 try
354 {
355 Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
356 xStyle.set( xStylesNC->getByName( rStyleName ), UNO_QUERY );
357 }
358 catch( Exception& )
359 {
360 }
361 OSL_ENSURE( xStyle.is(), "WorkbookGlobals::getStyleObject - cannot access style object" );
362 return xStyle;
363}
364
365namespace {
366
367WorkbookHelper::RangeDataRet lcl_addNewByName(ScDocument& rDoc, ScRangeName* pNames, const OUString& rName, sal_Int16 nIndex, sal_Int32 nUnoType, bool bHidden)
368{
369 bool bDone = false;
371 if ( nUnoType & NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
372 if ( nUnoType & NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
374 if ( nUnoType & NamedRangeFlag::ROW_HEADER ) nNewType |= ScRangeData::Type::RowHeader;
375 ScTokenArray aTokenArray(rDoc);
376 ScRangeData* pNew = new ScRangeData(rDoc, rName, aTokenArray, ScAddress(), nNewType);
377 pNew->GuessPosition();
378 if ( nIndex )
379 pNew->SetIndex( nIndex );
380 // create but not insert hidden FILTER_CRITERIA named ranges to ScRangeName
381 if ( bHidden && nNewType == ScRangeData::Type::Criteria )
382 {
383 return WorkbookHelper::RangeDataRet(pNew, true);
384 }
385 if ( pNames->insert(pNew) )
386 bDone = true;
387 if (!bDone)
388 {
389 delete pNew;
390 throw RuntimeException();
391 }
392 return WorkbookHelper::RangeDataRet(pNew, false);
393}
394
395OUString findUnusedName( const ScRangeName* pRangeName, const OUString& rSuggestedName )
396{
397 OUString aNewName = rSuggestedName;
398 sal_Int32 nIndex = 0;
399 while(pRangeName->findByUpperName(ScGlobal::getCharClass().uppercase(aNewName)))
400 aNewName = rSuggestedName + OUStringChar('_') + OUString::number( nIndex++ );
401
402 return aNewName;
403}
404
405}
406
408 OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden)
409{
410 // create the name and insert it into the Calc document
411 WorkbookHelper::RangeDataRet aScRangeData(nullptr, false);
412 if( !orName.isEmpty() )
413 {
414 ScDocument& rDoc = getScDocument();
415 ScRangeName* pNames = rDoc.GetRangeName();
416 // find an unused name
417 orName = findUnusedName( pNames, orName );
418 // create the named range
419 aScRangeData = lcl_addNewByName(rDoc, pNames, orName, nIndex, nNameFlags, bHidden);
420 }
421 return aScRangeData;
422}
423
425 OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden)
426{
427 // create the name and insert it into the Calc document
428 WorkbookHelper::RangeDataRet aScRangeData(nullptr, false);
429 if( !orName.isEmpty() )
430 {
431 ScDocument& rDoc = getScDocument();
432 ScRangeName* pNames = rDoc.GetRangeName( nTab );
433 if(!pNames)
434 throw RuntimeException("invalid sheet index used");
435 // find an unused name
436 orName = findUnusedName( pNames, orName );
437 // create the named range
438 aScRangeData = lcl_addNewByName(rDoc, pNames, orName, nIndex, nNameFlags, bHidden);
439 }
440 return aScRangeData;
441}
442
443Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString& orName, const ScRange& rRangeAddr )
444{
445 // validate cell range
446 ScRange aDestRange = rRangeAddr;
447 bool bValidRange = getAddressConverter().validateCellRange( aDestRange, true, true );
448
449 // create database range and insert it into the Calc document
450 Reference< XDatabaseRange > xDatabaseRange;
451 if( bValidRange && !orName.isEmpty() ) try
452 {
453 // find an unused name
454 PropertySet aDocProps( mxDoc );
455 Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
456 orName = ContainerHelper::getUnusedName( xDatabaseRanges, orName, '_' );
457 // create the database range
458 CellRangeAddress aApiRange( aDestRange.aStart.Tab(), aDestRange.aStart.Col(), aDestRange.aStart.Row(),
459 aDestRange.aEnd.Col(), aDestRange.aEnd.Row() );
460 xDatabaseRanges->addNewByName( orName, aApiRange );
461 xDatabaseRange.set( xDatabaseRanges->getByName( orName ), UNO_QUERY );
462 }
463 catch( Exception& )
464 {
465 }
466 OSL_ENSURE( xDatabaseRange.is(), "WorkbookGlobals::createDatabaseRangeObject - cannot create database range" );
467 return xDatabaseRange;
468}
469
470Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( const ScRange& rRangeAddr )
471{
472 // validate cell range
473 ScRange aDestRange = rRangeAddr;
474 bool bValidRange = getAddressConverter().validateCellRange( aDestRange, true, true );
475
476 // create database range and insert it into the Calc document
477 Reference< XDatabaseRange > xDatabaseRange;
478 if( bValidRange ) try
479 {
480 ScDocument& rDoc = getScDocument();
481 if( rDoc.GetTableCount() <= aDestRange.aStart.Tab() )
482 throw css::lang::IndexOutOfBoundsException();
483 std::unique_ptr<ScDBData> pNewDBData(new ScDBData( STR_DB_LOCAL_NONAME, aDestRange.aStart.Tab(),
484 aDestRange.aStart.Col(), aDestRange.aStart.Row(),
485 aDestRange.aEnd.Col(), aDestRange.aEnd.Row() ));
486 rDoc.SetAnonymousDBData( aDestRange.aStart.Tab() , std::move(pNewDBData) );
487 ScDocShell* pDocSh = static_cast< ScDocShell* >(rDoc.GetDocumentShell());
488 xDatabaseRange.set(new ScDatabaseRangeObj(pDocSh, aDestRange.aStart.Tab()));
489 }
490 catch( Exception& )
491 {
492 }
493 OSL_ENSURE( xDatabaseRange.is(), "WorkbookData::createDatabaseRangeObject - cannot create database range" );
494 return xDatabaseRange;
495}
496
498{
499 ScDBCollection* pDBCollection = getScDocument().GetDBCollection();
500 if (!pDBCollection)
501 return nullptr;
502 return pDBCollection->getNamedDBs().findByIndex( nIndex );
503}
504
505Reference< XStyle > WorkbookGlobals::createStyleObject( OUString& orStyleName, bool bPageStyle )
506{
507 Reference< XStyle > xStyle;
508 try
509 {
510 Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
511 xStyle.set( mrBaseFilter.getModelFactory()->createInstance( bPageStyle ? maPageStyleServ : maCellStyleServ ), UNO_QUERY_THROW );
512 orStyleName = ContainerHelper::insertByUnusedName( xStylesNC, orStyleName, ' ', Any( xStyle ) );
513 }
514 catch( Exception& )
515 {
516 }
517 OSL_ENSURE( xStyle.is(), "WorkbookGlobals::createStyleObject - cannot create style" );
518 return xStyle;
519}
520
522{
523 if( bInternal )
525 else
526 mxChartConverter.reset( new ExcelChartConverter( *this ) );
527}
528
529// BIFF specific --------------------------------------------------------------
530
531// private --------------------------------------------------------------------
532
534{
535 maCellStyles = "CellStyles";
536 maPageStyles = "PageStyles";
537 maCellStyleServ = "com.sun.star.style.CellStyle";
538 maPageStyleServ = "com.sun.star.style.PageStyle";
539 mnCurrSheet = -1;
540 mbGeneratorKnownGood = false;
542 meTextEnc = osl_getThreadTextEncoding();
543
544 // the spreadsheet document
545 mxDoc.set( mrBaseFilter.getModel(), UNO_QUERY );
546 OSL_ENSURE( mxDoc.is(), "WorkbookGlobals::initialize - no spreadsheet document" );
547
548 if (mxDoc)
549 {
550 ScModelObj* pModel = comphelper::getFromUnoTunnel<ScModelObj>(mxDoc);
551 if (pModel)
552 mpDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject());
553 if (mpDocShell)
555 }
556
557 if (!mpDoc)
558 throw RuntimeException("Workbookhelper::getScDocument(): Failed to access ScDocument from model");
559
560 Reference< XDocumentPropertiesSupplier > xPropSupplier( mxDoc, UNO_QUERY);
561 Reference< XDocumentProperties > xDocProps = xPropSupplier->getDocumentProperties();
562 const OUString aGenerator( xDocProps->getGenerator());
563
564 if (aGenerator.startsWithIgnoreAsciiCase("Microsoft"))
565 {
567 ScCalcConfig aCalcConfig = mpDoc->GetCalcConfig();
569 mpDoc->SetCalcConfig(aCalcConfig);
570 }
571 else if (aGenerator.startsWithIgnoreAsciiCase("LibreOffice"))
572 {
574 }
576
578
579 mxFormulaBuffer.reset( new FormulaBuffer( *this ) );
580 mxWorkbookSettings.reset( new WorkbookSettings( *this ) );
581 mxViewSettings.reset( new ViewSettings( *this ) );
582 mxWorksheets.reset( new WorksheetBuffer( *this ) );
583 mxTheme = std::make_shared<ThemeBuffer>( *this );
584 mxStyles.reset( new StylesBuffer( *this ) );
585 mxSharedStrings.reset( new SharedStringsBuffer( *this ) );
586 mxExtLinks.reset( new ExternalLinkBuffer( *this ) );
587 mxDefNames.reset( new DefinedNamesBuffer( *this ) );
588 mxTables.reset( new TableBuffer( *this ) );
589 mxScenarios.reset( new ScenarioBuffer( *this ) );
590 mxConnections.reset( new ConnectionsBuffer( *this ) );
591 mxPivotCaches.reset( new PivotCacheBuffer( *this ) );
592 mxPivotTables.reset( new PivotTableBuffer( *this ) );
593
594 mxUnitConverter.reset( new UnitConverter( *this ) );
595 mxAddrConverter.reset( new AddressConverter( *this ) );
596 mxChartConverter.reset( new ExcelChartConverter( *this ) );
597 mxPageSettConverter.reset( new PageSettingsConverter( *this ) );
598
599 // initialise edit engine
600 ScDocument& rDoc = getScDocument();
601 mxEditEngine.reset( new ScEditEngineDefaulter( rDoc.GetEnginePool() ) );
602 mxEditEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
603 mxEditEngine->SetEditTextObjectPool( rDoc.GetEditPool() );
604 mxEditEngine->SetUpdateLayout( false );
605 mxEditEngine->EnableUndo( false );
606 mxEditEngine->SetControlWord( mxEditEngine->GetControlWord() & ~EEControlBits::ALLOWBIGOBJS );
607
608 // set some document properties needed during import
609 if( mrBaseFilter.isImportFilter() )
610 {
611 // enable editing read-only documents (e.g. from read-only files)
613 // #i76026# disable Undo while loading the document
614 mpDoc->EnableUndo(false);
615 // #i79826# disable calculating automatic row height while loading the document
617 // disable automatic update of linked sheets and DDE links
618 mpDoc->EnableExecuteLink(false);
619
620 mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), ScResId(STR_LOAD_DOC) ) );
622
623 //prevent unnecessary broadcasts and "half way listeners" as
624 //is done in ScDocShell::BeforeXMLLoading() for ods
626 }
627 else if( mrBaseFilter.isExportFilter() )
628 {
629 mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), ScResId(STR_SAVE_DOC) ) );
630 }
631}
632
634{
635 // set some document properties needed after import
636 if( !mrBaseFilter.isImportFilter() )
637 return;
638
639 // #i74668# do not insert default sheets
640 mpDocShell->SetEmpty(false);
641 // enable automatic update of linked sheets and DDE links
643 // #i79826# enable updating automatic row height after loading the document
645 mpDocShell->UpdateAllRowHeights(/*bOnlyUsedRows=*/true);
646
647 // #i76026# enable Undo after loading the document
648 mpDoc->EnableUndo(true);
649
650 // disable editing read-only documents (e.g. from read-only files)
652 // #111099# open forms in alive mode (has no effect, if no controls in document)
653 ScDrawLayer* pModel = mpDoc->GetDrawLayer();
654 if (pModel)
655 pModel->SetOpenInDesignMode(false);
656}
657
658
660{
661}
662
664{
665 WorkbookGlobalsRef xBookGlob = std::make_shared<WorkbookGlobals>( rFilter );
666 if( !xBookGlob->isValid() )
667 xBookGlob.reset();
668 return xBookGlob;
669}
670
671// filter ---------------------------------------------------------------------
672
674{
675 return mrBookGlob.getBaseFilter();
676}
677
679{
680 return mrBookGlob.getProgressBar();
681}
682
684{
686}
687
689{
691}
692
694{
696}
697
699{
701}
702
704{
705 mrBookGlob.setVbaProjectStorage( rxVbaPrjStrg );
706}
707
709{
711}
712
714{
715 // workbook settings, document and sheet view settings
718
719 // Import the VBA project (after finalizing workbook settings which
720 // contains the workbook code name). Do it before processing formulas in
721 // order to correctly resolve VBA custom function names.
723 if( xVbaPrjStrg && xVbaPrjStrg->isStorage() )
724 getBaseFilter().getVbaProject().importModulesAndForms( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() );
725
726 // need to import formulas before scenarios
728
729 // Insert all pivot tables. Must be done after loading all sheets and
730 // formulas, because data pilots expect existing source data on
731 // creation.
733
734 /* Insert scenarios after all sheet processing is done, because new hidden
735 sheets are created for scenarios which would confuse code that relies
736 on certain sheet indexes. Must be done after pivot tables too. */
738
739 /* Set 'Default' page style to automatic page numbering (default is manual
740 number 1). Otherwise hidden sheets (e.g. for scenarios) which have
741 'Default' page style will break automatic page numbering for following
742 sheets. Automatic numbering is set by passing the value 0. */
743 PropertySet aDefPageStyle( getStyleObject( "Default", true ) );
744 aDefPageStyle.setProperty< sal_Int16 >( PROP_FirstPageNumber, 0 );
745
746 // Has any string ref syntax been imported?
747 // If not, we need to take action
748 ScCalcConfig aCalcConfig = getScDocument().GetCalcConfig();
749
750 if ( !aCalcConfig.mbHasStringRefSyntax )
751 {
753 getScDocument().SetCalcConfig(aCalcConfig);
754 }
755
756 // set selected sheet and positionleft/positiontop for OLE objects
757 Reference<XViewDataSupplier> xViewDataSupplier(getDocument(), UNO_QUERY);
758 if (!xViewDataSupplier.is())
759 return;
760
761 Reference<XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
762 if (!(xIndexAccess.is() && xIndexAccess->getCount() > 0))
763 return;
764
765 Sequence< PropertyValue > aSeq;
766 if (!(xIndexAccess->getByIndex(0) >>= aSeq))
767 return;
768
769 OUString sTabName;
770 Reference< XNameAccess > xSheetsNC;
771 for (const auto& rProp : std::as_const(aSeq))
772 {
773 OUString sName(rProp.Name);
774 if (sName == SC_ACTIVETABLE)
775 {
776 if(rProp.Value >>= sTabName)
777 {
778 SCTAB nTab(0);
779 if (getScDocument().GetTable(sTabName, nTab))
781 }
782 }
783 else if (sName == SC_TABLES)
784 {
785 rProp.Value >>= xSheetsNC;
786 }
787 }
788 if (!(xSheetsNC.is() && xSheetsNC->hasByName(sTabName)))
789 return;
790
791 Sequence<PropertyValue> aProperties;
792 Any aAny = xSheetsNC->getByName(sTabName);
793 if ( !(aAny >>= aProperties) )
794 return;
795
796 for (const auto& rProp : std::as_const(aProperties))
797 {
798 OUString sName(rProp.Name);
799 if (sName == SC_POSITIONLEFT)
800 {
801 SCCOL nPosLeft = *o3tl::doAccess<SCCOL>(rProp.Value);
802 getScDocument().SetPosLeft(nPosLeft);
803 }
804 else if (sName == SC_POSITIONTOP)
805 {
806 SCROW nPosTop = *o3tl::doAccess<SCROW>(rProp.Value);
807 getScDocument().SetPosTop(nPosTop);
808 }
809 }
810}
811
812// document model -------------------------------------------------------------
813
815{
816 return mrBookGlob.getScDocument();
817}
818
820{
821 return mrBookGlob.getScDocument();
822}
823
825{
826 return mrBookGlob.getDocImport();
827}
828
830{
831 return mrBookGlob.getDocImport();
832}
833
835{
836 return mrBookGlob.getEditEngine();
837}
838
839const Reference< XSpreadsheetDocument > & WorkbookHelper::getDocument() const
840{
841 return mrBookGlob.getDocument();
842}
843
844Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( sal_Int32 nSheet ) const
845{
846 Reference< XSpreadsheet > xSheet;
847 try
848 {
849 Reference< XIndexAccess > xSheetsIA( getDocument()->getSheets(), UNO_QUERY_THROW );
850 xSheet.set( xSheetsIA->getByIndex( nSheet ), UNO_QUERY_THROW );
851 }
852 catch( Exception& )
853 {
854 }
855 return xSheet;
856}
857
858Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( const OUString& rSheet ) const
859{
860 Reference< XSpreadsheet > xSheet;
861 try
862 {
863 Reference< XNameAccess > xSheetsNA( getDocument()->getSheets(), UNO_QUERY_THROW );
864 xSheet.set( xSheetsNA->getByName( rSheet ), UNO_QUERY );
865 }
866 catch( Exception& )
867 {
868 }
869 return xSheet;
870}
871
872Reference< XCellRange > WorkbookHelper::getCellRangeFromDoc( const ScRange& rRange ) const
873{
874 Reference< XCellRange > xRange;
875 try
876 {
877 Reference< XSpreadsheet > xSheet( getSheetFromDoc( rRange.aStart.Tab() ), UNO_SET_THROW );
878 xRange = xSheet->getCellRangeByPosition( rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row() );
879 }
880 catch( Exception& )
881 {
882 }
883 return xRange;
884}
885
886Reference< XNameContainer > WorkbookHelper::getCellStyleFamily() const
887{
888 return mrBookGlob.getStyleFamily( false/*bPageStyles*/ );
889}
890
891Reference< XStyle > WorkbookHelper::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const
892{
893 return mrBookGlob.getStyleObject( rStyleName, bPageStyle );
894}
895
896WorkbookHelper::RangeDataRet WorkbookHelper::createNamedRangeObject(OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden) const
897{
898 return mrBookGlob.createNamedRangeObject(orName, nIndex, nNameFlags, bHidden);
899}
900
901WorkbookHelper::RangeDataRet WorkbookHelper::createLocalNamedRangeObject(OUString& orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden) const
902{
903 return mrBookGlob.createLocalNamedRangeObject(orName, nIndex, nNameFlags, nTab, bHidden);
904}
905
906Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const ScRange& rRangeAddr ) const
907{
908 return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr );
909}
910
911Reference< XDatabaseRange > WorkbookHelper::createUnnamedDatabaseRangeObject( const ScRange& rRangeAddr ) const
912{
913 return mrBookGlob.createUnnamedDatabaseRangeObject( rRangeAddr );
914}
915
917{
919}
920
921Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle ) const
922{
923 return mrBookGlob.createStyleObject( orStyleName, bPageStyle );
924}
925
926// buffers --------------------------------------------------------------------
927
929{
931}
932
934{
936}
937
939{
941}
942
944{
945 return mrBookGlob.getWorksheets();
946}
947
949{
950 return mrBookGlob.getTheme();
951}
952
954{
955 return mrBookGlob.getStyles();
956}
957
959{
961}
962
964{
966}
967
969{
971}
972
974{
975 return mrBookGlob.getTables();
976}
977
979{
980 return mrBookGlob.getScenarios();
981}
982
984{
985 return mrBookGlob.getConnections();
986}
987
989{
990 return mrBookGlob.getPivotCaches();
991}
992
994{
995 return mrBookGlob.getPivotTables();
996}
997
998// converters -----------------------------------------------------------------
999
1001{
1003}
1004
1006{
1008}
1009
1011{
1013}
1014
1016{
1018}
1019
1021{
1023}
1024
1026{
1028}
1029
1031{
1033}
1034
1035// OOXML/BIFF12 specific ------------------------------------------------------
1036
1037XmlFilterBase& WorkbookHelper::getOoxFilter() const
1038{
1039 return mrBookGlob.getOoxFilter();
1040}
1041
1043{
1044 return getOoxFilter().importFragment( rxHandler );
1045}
1046
1048{
1049 return getOoxFilter().importFragment(rxHandler, rParser);
1050}
1051
1052// BIFF specific --------------------------------------------------------------
1053
1054rtl_TextEncoding WorkbookHelper::getTextEncoding() const
1055{
1056 return mrBookGlob.getTextEncoding();
1057}
1058
1059} // namespace oox
1060
1061/* 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
void UpdateAllRowHeights(const ScMarkData *pTabMark=nullptr)
Definition: docsh5.cxx:423
Accessor class to ScDocument.
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
Definition: documen2.cxx:478
const ScCalcConfig & GetCalcConfig() const
Definition: document.hxx:2619
SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab)
Definition: document.hxx:880
SC_DLLPUBLIC void EnableUndo(bool bVal)
Definition: document.cxx:6456
void EnableExecuteLink(bool bVal)
Definition: document.hxx:1603
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:473
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1084
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:1083
void SetInsertingFromOtherDoc(bool bVal)
Definition: document.hxx:2223
void EnableChangeReadOnly(bool bVal)
Definition: document.hxx:1605
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:171
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:1600
SC_DLLPUBLIC void UnlockAdjustHeight()
Definition: document.cxx:1781
SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, std::unique_ptr< ScDBData > pDBData)
Definition: document.cxx:302
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
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.
bool hasCalculatedFormulaCells() const
Returns true if any formula cell appears to have a calculated value not 0.0 nor "",...
::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
Assumed to have calculated formula cells.
::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.
bool mbHasCalculatedFormulaCells
Whether reading a file generated by Excel or Calc.
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.
void setCalculatedFormulaCells()
Set if any formula cell is calculated.
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.
bool hasCalculatedFormulaCells() const
Returns true if any formula cell is calculated.
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.
#define suppress_fun_call_w_exception(expr)
OUString sName
constexpr OUStringLiteral STR_DB_LOCAL_NONAME
Definition: globalnames.hxx:14
sal_Int32 nIndex
Sequence< sal_Int8 > aSeq
@ 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