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>
33#include <o3tl/any.hxx>
34#include <osl/thread.h>
35#include <osl/diagnose.h>
39#include <oox/token/properties.hxx>
40#include <addressconverter.hxx>
41#include <connectionsbuffer.hxx>
42#include <defnamesbuffer.hxx>
44#include <excelfilter.hxx>
46#include <formulaparser.hxx>
47#include <pagesettings.hxx>
48#include <pivotcachebuffer.hxx>
49#include <pivottablebuffer.hxx>
50#include <scenariobuffer.hxx>
52#include <stylesbuffer.hxx>
53#include <tablebuffer.hxx>
54#include <themebuffer.hxx>
55#include <unitconverter.hxx>
56#include <viewsettings.hxx>
57#include <workbooksettings.hxx>
58#include <worksheetbuffer.hxx>
59#include <docsh.hxx>
60#include <document.hxx>
61#include <docuno.hxx>
62#include <rangenam.hxx>
63#include <tokenarray.hxx>
64#include <tokenuno.hxx>
65#include <dbdata.hxx>
66#include <datauno.hxx>
67#include <globalnames.hxx>
68#include <documentimport.hxx>
69#include <drwlayer.hxx>
70#include <globstr.hrc>
71#include <scresid.hxx>
72
73#include <formulabuffer.hxx>
74#include <editutil.hxx>
75#include <editeng/editstat.hxx>
77#include <o3tl/string_view.hxx>
79
80#include <memory>
81
82namespace oox::xls {
83
84using namespace ::com::sun::star::container;
85using namespace ::com::sun::star::document;
86using namespace ::com::sun::star::lang;
87using namespace ::com::sun::star::sheet;
88using namespace ::com::sun::star::style;
89using namespace ::com::sun::star::table;
90using namespace ::com::sun::star::uno;
91using namespace ::com::sun::star::beans;
92
93using ::oox::core::FilterBase;
94using ::oox::core::FragmentHandler;
95using ::oox::core::XmlFilterBase;
96
97bool IgnoreCaseCompare::operator()( std::u16string_view rName1, std::u16string_view rName2 ) const
98{
99 // TODO: compare with collator
100 return o3tl::compareToIgnoreAsciiCase(rName1, rName2 ) < 0;
101}
102
104{
105public:
106 // noncopyable ------------------------------------------------------------
107
110
111 explicit WorkbookGlobals( ExcelFilter& rFilter );
113
115 bool isValid() const { return mxDoc.is(); }
116
117 // filter -----------------------------------------------------------------
118
120 FilterBase& getBaseFilter() const { return mrBaseFilter; }
126 sal_Int16 getCurrentSheetIndex() const { return mnCurrSheet; }
129
131 void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) { mxVbaPrjStrg = rxVbaPrjStrg; }
133 void setCurrentSheetIndex( SCTAB nSheet ) { mnCurrSheet = nSheet; }
134
135 // document model ---------------------------------------------------------
136
138 {
139 return *mxEditEngine;
140 }
141
143
145
147 const Reference< XSpreadsheetDocument >& getDocument() const { return mxDoc; }
149 Reference< XNameContainer > getStyleFamily( bool bPageStyles ) const;
151 Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const;
153 WorkbookHelper::RangeDataRet createNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden );
155 WorkbookHelper::RangeDataRet createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden );
157 Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const ScRange& rRangeAddr );
159 Reference< XDatabaseRange > createUnnamedDatabaseRangeObject( const ScRange& rRangeAddr );
161 ScDBData* findDatabaseRangeByIndex( sal_uInt16 nIndex );
163 Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle );
165 void useInternalChartDataTable( bool bInternal );
166
167 // buffers ----------------------------------------------------------------
168
177 ThemeBuffer& getTheme() const { return *mxTheme; }
179 StylesBuffer& getStyles() const { return *mxStyles; }
187 TableBuffer& getTables() const { return *mxTables; }
196
197 // converters -------------------------------------------------------------
198
211
212 // OOXML/BIFF12 specific --------------------------------------------------
213
215 XmlFilterBase& getOoxFilter() const { return *mpOoxFilter; }
216
217 // BIFF2-BIFF8 specific ---------------------------------------------------
218
220 rtl_TextEncoding getTextEncoding() const { return meTextEnc; }
221
222private:
224 void initialize();
226 void finalize();
227
228private:
229 typedef ::std::unique_ptr< ScEditEngineDefaulter > EditEngineDefaulterPtr;
230 typedef ::std::unique_ptr< FormulaBuffer > FormulaBufferPtr;
231 typedef ::std::unique_ptr< SegmentProgressBar > ProgressBarPtr;
232 typedef ::std::unique_ptr< WorkbookSettings > WorkbookSettPtr;
233 typedef ::std::unique_ptr< ViewSettings > ViewSettingsPtr;
234 typedef ::std::unique_ptr< WorksheetBuffer > WorksheetBfrPtr;
235 typedef ::std::shared_ptr< ThemeBuffer > ThemeBfrRef;
236 typedef ::std::unique_ptr< StylesBuffer > StylesBfrPtr;
237 typedef ::std::unique_ptr< SharedStringsBuffer > SharedStrBfrPtr;
238 typedef ::std::unique_ptr< ExternalLinkBuffer > ExtLinkBfrPtr;
239 typedef ::std::unique_ptr< DefinedNamesBuffer > DefNamesBfrPtr;
240 typedef ::std::unique_ptr< TableBuffer > TableBfrPtr;
241 typedef ::std::unique_ptr< ScenarioBuffer > ScenarioBfrPtr;
242 typedef ::std::unique_ptr< ConnectionsBuffer > ConnectionsBfrPtr;
243 typedef ::std::unique_ptr< PivotCacheBuffer > PivotCacheBfrPtr;
244 typedef ::std::unique_ptr< PivotTableBuffer > PivotTableBfrPtr;
245 typedef ::std::unique_ptr< FormulaParser > FormulaParserPtr;
246 typedef ::std::unique_ptr< UnitConverter > UnitConvPtr;
247 typedef ::std::unique_ptr< AddressConverter > AddressConvPtr;
248 typedef ::std::unique_ptr< oox::drawingml::chart::ChartConverter > ExcelChartConvPtr;
249 typedef ::std::unique_ptr< PageSettingsConverter > PageSettConvPtr;
250
251 OUString maCellStyles;
252 OUString maPageStyles;
255 Reference< XSpreadsheetDocument > mxDoc;
256 FilterBase& mrBaseFilter;
260 sal_Int16 mnCurrSheet;
262
263 // buffers
278
279 // converters
285
287
288 // OOXML/BIFF12 specific
289 XmlFilterBase* mpOoxFilter;
290
291 // BIFF2-BIFF8 specific
292 rtl_TextEncoding meTextEnc;
295 std::unique_ptr<ScDocumentImport> mxDocImport;
296};
297
299 mrBaseFilter( rFilter ),
300 mrExcelFilter( rFilter ),
301 mpOoxFilter( &rFilter ),
302 mpDoc(nullptr),
303 mpDocShell(nullptr)
304{
305 // register at the filter, needed for virtual callbacks (even during construction)
307 initialize();
308}
309
311{
312 finalize();
314}
315
317{
318 return *mxDocImport;
319}
320
321Reference< XNameContainer > WorkbookGlobals::getStyleFamily( bool bPageStyles ) const
322{
323 Reference< XNameContainer > xStylesNC;
324 try
325 {
326 Reference< XStyleFamiliesSupplier > xFamiliesSup( mxDoc, UNO_QUERY_THROW );
327 Reference< XNameAccess > xFamiliesNA( xFamiliesSup->getStyleFamilies(), UNO_SET_THROW );
328 xStylesNC.set( xFamiliesNA->getByName( bPageStyles ? maPageStyles : maCellStyles ), UNO_QUERY );
329 }
330 catch( Exception& )
331 {
332 }
333 OSL_ENSURE( xStylesNC.is(), "WorkbookGlobals::getStyleFamily - cannot access style family" );
334 return xStylesNC;
335}
336
337Reference< XStyle > WorkbookGlobals::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const
338{
339 Reference< XStyle > xStyle;
340 try
341 {
342 Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
343 xStyle.set( xStylesNC->getByName( rStyleName ), UNO_QUERY );
344 }
345 catch( Exception& )
346 {
347 }
348 OSL_ENSURE( xStyle.is(), "WorkbookGlobals::getStyleObject - cannot access style object" );
349 return xStyle;
350}
351
352namespace {
353
354WorkbookHelper::RangeDataRet lcl_addNewByNameAndTokens( ScDocument& rDoc, ScRangeName* pNames, const OUString& rName, const Sequence<FormulaToken>& rTokens, sal_Int16 nIndex, sal_Int32 nUnoType, bool bHidden )
355{
356 bool bDone = false;
358 if ( nUnoType & NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
359 if ( nUnoType & NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
361 if ( nUnoType & NamedRangeFlag::ROW_HEADER ) nNewType |= ScRangeData::Type::RowHeader;
362 ScTokenArray aTokenArray(rDoc);
363 (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
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, const Sequence< FormulaToken>& rTokens, 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_addNewByNameAndTokens( rDoc, pNames, orName, rTokens, nIndex, nNameFlags, bHidden );
408 }
409 return aScRangeData;
410}
411
413 OUString& orName, const Sequence< FormulaToken >& rTokens, 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_addNewByNameAndTokens( rDoc, pNames, orName, rTokens, 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 = dynamic_cast<ScModelObj*>(mxDoc.get());
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, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden ) const
872{
873 return mrBookGlob.createNamedRangeObject( orName, rTokens, nIndex, nNameFlags, bHidden );
874}
875
876WorkbookHelper::RangeDataRet WorkbookHelper::createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden ) const
877{
878 return mrBookGlob.createLocalNamedRangeObject( orName, rTokens, 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:1186
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:316
void SetEmpty(bool bSet)
Definition: docsh2.cxx:92
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
Accessor class to ScDocument.
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
Definition: documen2.cxx:472
const ScCalcConfig & GetCalcConfig() const
Definition: document.hxx:2614
SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab)
Definition: document.hxx:879
SC_DLLPUBLIC void EnableUndo(bool bVal)
Definition: document.cxx:6585
void EnableExecuteLink(bool bVal)
Definition: document.hxx:1601
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:467
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1082
SC_DLLPUBLIC void SetCalcConfig(const ScCalcConfig &rConfig)
Definition: document10.cxx:203
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:826
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1081
void SetInsertingFromOtherDoc(bool bVal)
Definition: document.hxx:2218
void EnableChangeReadOnly(bool bVal)
Definition: document.hxx:1603
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:174
SC_DLLPUBLIC void SetPosTop(SCROW nRow)
Definition: document.hxx:883
SC_DLLPUBLIC void SetPosLeft(SCCOL nCol)
Definition: document.hxx:881
void LockAdjustHeight()
Definition: document.hxx:1598
SC_DLLPUBLIC void UnlockAdjustHeight()
Definition: document.cxx:1810
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:1062
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 SC_DLLPUBLIC bool ConvertToTokenArray(ScDocument &rDoc, ScTokenArray &rTokenArray, const css::uno::Sequence< css::sheet::FormulaToken > &rSequence)
Definition: tokenuno.cxx:374
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.
WorkbookHelper::RangeDataRet createNamedRangeObject(OUString &orName, const Sequence< FormulaToken > &rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden)
Creates and returns a defined name on-the-fly in the Calc document.
WorksheetBfrPtr mxWorksheets
Workbook and sheet view settings.
StorageRef mxVbaPrjStrg
The progress bar.
TableBfrPtr mxTables
All defined names.
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
WorkbookHelper::RangeDataRet createLocalNamedRangeObject(OUString &orName, const Sequence< FormulaToken > &rTokens, 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.
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.
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.
RangeDataRet createLocalNamedRangeObject(OUString &orName, const css::uno::Sequence< css::sheet::FormulaToken > &rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden) const
Creates and returns a defined name on-the-fly in the sheet.
ScDBData * findDatabaseRangeByIndex(sal_uInt16 nIndex) const
Finds the (already existing) database range of the given formula token index.
FormulaBuffer & getFormulaBuffer() const
PivotTableBuffer & getPivotTables() const
Returns the collection of pivot tables.
RangeDataRet createNamedRangeObject(OUString &orName, const css::uno::Sequence< css::sheet::FormulaToken > &rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden) const
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.
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.
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