[Libreoffice-commits] core.git: sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Aug 8 06:49:03 UTC 2020
sc/source/filter/excel/excdoc.cxx | 26 -
sc/source/filter/excel/excimp8.cxx | 60 +--
sc/source/filter/excel/excrecds.cxx | 260 +++++++--------
sc/source/filter/excel/impop.cxx | 226 ++++++-------
sc/source/filter/excel/xechart.cxx | 573 +++++++++++++++++-----------------
sc/source/filter/excel/xecontent.cxx | 164 ++++-----
sc/source/filter/excel/xeescher.cxx | 86 ++---
sc/source/filter/excel/xeformula.cxx | 92 ++---
sc/source/filter/excel/xelink.cxx | 76 ++--
sc/source/filter/excel/xename.cxx | 34 +-
sc/source/filter/excel/xepivot.cxx | 470 ++++++++++++++-------------
sc/source/filter/excel/xepivotxml.cxx | 47 +-
sc/source/filter/excel/xestream.cxx | 58 +--
sc/source/filter/excel/xestring.cxx | 58 +--
sc/source/filter/excel/xestyle.cxx | 36 +-
sc/source/filter/excel/xetable.cxx | 130 +++----
sc/source/filter/excel/xeview.cxx | 36 +-
sc/source/filter/excel/xichart.cxx | 527 +++++++++++++++----------------
sc/source/filter/excel/xicontent.cxx | 58 +--
sc/source/filter/excel/xiescher.cxx | 343 ++++++++++----------
sc/source/filter/excel/xipage.cxx | 30 -
sc/source/filter/excel/xipivot.cxx | 199 +++++------
sc/source/filter/excel/xiroot.cxx | 30 -
sc/source/filter/excel/xistream.cxx | 52 +--
sc/source/filter/excel/xistyle.cxx | 218 ++++++------
sc/source/filter/excel/xlchart.cxx | 193 +++++------
sc/source/filter/excel/xlformula.cxx | 26 -
27 files changed, 2074 insertions(+), 2034 deletions(-)
New commits:
commit 66d0815d790918b35dd413b64c467dc168d720bb
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Aug 7 15:54:53 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Aug 8 08:48:28 2020 +0200
loplugin:flatten in sc/filter/excel
Change-Id: I48ab5b20a3345cd40d4715c3ff025d2df3b491fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100337
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 4eb91066b865..6bb415559869 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -643,21 +643,21 @@ void ExcTable::FillAsEmptyTable( SCTAB nCodeNameIdx )
{
InitializeTable( mnScTab );
- if( HasVbaStorage() && (nCodeNameIdx < GetExtDocOptions().GetCodeNameCount()) )
+ if( !(HasVbaStorage() && (nCodeNameIdx < GetExtDocOptions().GetCodeNameCount())) )
+ return;
+
+ if( GetBiff() <= EXC_BIFF5 )
{
- if( GetBiff() <= EXC_BIFF5 )
- {
- Add( new ExcBof );
- }
- else
- {
- Add( new ExcBof8 );
- Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
- }
- // sheet view settings: WINDOW2, SCL, PANE, SELECTION
- aRecList.AppendNewRecord( new XclExpTabViewSettings( GetRoot(), mnScTab ) );
- Add( new ExcEof );
+ Add( new ExcBof );
}
+ else
+ {
+ Add( new ExcBof8 );
+ Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
+ }
+ // sheet view settings: WINDOW2, SCL, PANE, SELECTION
+ aRecList.AppendNewRecord( new XclExpTabViewSettings( GetRoot(), mnScTab ) );
+ Add( new ExcEof );
}
void ExcTable::Write( XclExpStream& rStrm )
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 91f01290c154..0fef106161be 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -320,7 +320,10 @@ void ImportExcel8::ReadBasic()
SfxObjectShell* pShell = GetDocShell();
tools::SvRef<SotStorage> xRootStrg = GetRootStorage();
const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get();
- if( pShell && xRootStrg.is() ) try
+ if( !pShell || !xRootStrg.is() )
+ return;
+
+ try
{
// #FIXME need to get rid of this, we can also do this from within oox
// via the "ooo.vba.VBAGlobals" service
@@ -357,7 +360,7 @@ void ImportExcel8::ReadBasic()
aVbaPrj.setOleOverridesSink( xOleNameOverrideSink );
aVbaPrj.importVbaProject( *vbaStg );
GetObjectManager().SetOleNameOverrideInfo( xOleNameOverrideSink );
- }
+ }
}
catch( uno::Exception& )
{
@@ -401,19 +404,20 @@ void ImportExcel8::PostDocLoad()
}
// read doc info (no docshell while pasting from clipboard)
- if( SfxObjectShell* pShell = GetDocShell() )
+ SfxObjectShell* pShell = GetDocShell();
+ if(!pShell)
+ return;
+
+ // BIFF5+ without storage is possible
+ tools::SvRef<SotStorage> xRootStrg = GetRootStorage();
+ if( xRootStrg.is() ) try
+ {
+ uno::Reference< document::XDocumentPropertiesSupplier > xDPS( pShell->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocProps( xDPS->getDocumentProperties(), uno::UNO_SET_THROW );
+ sfx2::LoadOlePropertySet( xDocProps, xRootStrg.get() );
+ }
+ catch( uno::Exception& )
{
- // BIFF5+ without storage is possible
- tools::SvRef<SotStorage> xRootStrg = GetRootStorage();
- if( xRootStrg.is() ) try
- {
- uno::Reference< document::XDocumentPropertiesSupplier > xDPS( pShell->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XDocumentProperties > xDocProps( xDPS->getDocumentProperties(), uno::UNO_SET_THROW );
- sfx2::LoadOlePropertySet( xDocProps, xRootStrg.get() );
- }
- catch( uno::Exception& )
- {
- }
}
// #i45843# Pivot tables are now handled outside of PostDocLoad, so they are available
@@ -496,21 +500,21 @@ void XclImpAutoFilterData::SetCellAttribs()
void XclImpAutoFilterData::InsertQueryParam()
{
- if (pCurrDBData)
- {
- ScRange aAdvRange;
- bool bHasAdv = pCurrDBData->GetAdvancedQuerySource( aAdvRange );
- if( bHasAdv )
- pExcRoot->pIR->GetDoc().CreateQueryParam(aAdvRange, aParam);
+ if (!pCurrDBData)
+ return;
- pCurrDBData->SetQueryParam( aParam );
- if( bHasAdv )
- pCurrDBData->SetAdvancedQuerySource( &aAdvRange );
- else
- {
- pCurrDBData->SetAutoFilter( true );
- SetCellAttribs();
- }
+ ScRange aAdvRange;
+ bool bHasAdv = pCurrDBData->GetAdvancedQuerySource( aAdvRange );
+ if( bHasAdv )
+ pExcRoot->pIR->GetDoc().CreateQueryParam(aAdvRange, aParam);
+
+ pCurrDBData->SetQueryParam( aParam );
+ if( bHasAdv )
+ pCurrDBData->SetAdvancedQuerySource( &aAdvRange );
+ else
+ {
+ pCurrDBData->SetAutoFilter( true );
+ SetCellAttribs();
}
}
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 494bedaf6b03..3298d4244dff 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -421,74 +421,74 @@ XclExpSheetProtection::XclExpSheetProtection(bool bValue, SCTAB nTab ) :
void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm )
{
- ScDocument& rDoc = rStrm.GetRoot().GetDoc();
- const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnTab);
- if ( pTabProtect )
- {
- const ScOoxPasswordHash& rPH = pTabProtect->getPasswordHash();
- // Do not write any hash attributes if there is no password.
- ScOoxPasswordHash aPH;
- if (rPH.hasPassword())
- aPH = rPH;
-
- Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL);
- OString sHash;
- if (aHash.getLength() >= 2)
- {
- sHash = OString::number(
- ( static_cast<sal_uInt8>(aHash[0]) << 8
- | static_cast<sal_uInt8>(aHash[1]) ),
- 16 );
- }
- sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
- rWorksheet->singleElement( XML_sheetProtection,
- XML_algorithmName, aPH.maAlgorithmName.isEmpty() ? nullptr : aPH.maAlgorithmName.toUtf8().getStr(),
- XML_hashValue, aPH.maHashValue.isEmpty() ? nullptr : aPH.maHashValue.toUtf8().getStr(),
- XML_saltValue, aPH.maSaltValue.isEmpty() ? nullptr : aPH.maSaltValue.toUtf8().getStr(),
- XML_spinCount, aPH.mnSpinCount ? OString::number( aPH.mnSpinCount).getStr() : nullptr,
- XML_sheet, ToPsz( true ),
- XML_password, sHash.isEmpty()? nullptr : sHash.getStr(),
- XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? nullptr : ToPsz( true ),
- XML_scenarios, pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ? nullptr : ToPsz( true ),
- XML_formatCells, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? ToPsz( false ) : nullptr,
- XML_formatColumns, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? ToPsz( false ) : nullptr,
- XML_formatRows, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? ToPsz( false ) : nullptr,
- XML_insertColumns, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? ToPsz( false ) : nullptr,
- XML_insertRows, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? ToPsz( false ) : nullptr,
- XML_insertHyperlinks, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? ToPsz( false ) : nullptr,
- XML_deleteColumns, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? ToPsz( false ) : nullptr,
- XML_deleteRows, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? ToPsz( false ) : nullptr,
- XML_selectLockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? nullptr : ToPsz( true ),
- XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? ToPsz( false ) : nullptr,
- XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? ToPsz( false ) : nullptr,
- XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? ToPsz( false ) : nullptr,
- XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? nullptr : ToPsz( true ) );
-
- const ::std::vector<ScEnhancedProtection>& rProts( pTabProtect->getEnhancedProtection());
- if (!rProts.empty())
- {
- rWorksheet->startElement(XML_protectedRanges);
- for (const auto& rProt : rProts)
- {
- SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(),
- "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF security descriptor");
- rWorksheet->singleElement( XML_protectedRange,
- XML_name, rProt.maTitle.isEmpty() ? nullptr : rProt.maTitle.toUtf8().getStr(),
- XML_securityDescriptor, rProt.maSecurityDescriptorXML.isEmpty() ? nullptr : rProt.maSecurityDescriptorXML.toUtf8().getStr(),
- /* XXX 'password' is not part of OOXML, but Excel2013
- * writes it if loaded from BIFF, in which case
- * 'algorithmName', 'hashValue', 'saltValue' and
- * 'spinCount' are absent; so do we if it was present. */
- XML_password, rProt.mnPasswordVerifier ? OString::number( rProt.mnPasswordVerifier, 16).getStr() : nullptr,
- XML_algorithmName, rProt.maPasswordHash.maAlgorithmName.isEmpty() ? nullptr : rProt.maPasswordHash.maAlgorithmName.toUtf8().getStr(),
- XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(),
- XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(),
- XML_spinCount, rProt.maPasswordHash.mnSpinCount ? OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr,
- XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
- }
- rWorksheet->endElement( XML_protectedRanges);
- }
+ ScDocument& rDoc = rStrm.GetRoot().GetDoc();
+ const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnTab);
+ if ( !pTabProtect )
+ return;
+
+ const ScOoxPasswordHash& rPH = pTabProtect->getPasswordHash();
+ // Do not write any hash attributes if there is no password.
+ ScOoxPasswordHash aPH;
+ if (rPH.hasPassword())
+ aPH = rPH;
+
+ Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL);
+ OString sHash;
+ if (aHash.getLength() >= 2)
+ {
+ sHash = OString::number(
+ ( static_cast<sal_uInt8>(aHash[0]) << 8
+ | static_cast<sal_uInt8>(aHash[1]) ),
+ 16 );
+ }
+ sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+ rWorksheet->singleElement( XML_sheetProtection,
+ XML_algorithmName, aPH.maAlgorithmName.isEmpty() ? nullptr : aPH.maAlgorithmName.toUtf8().getStr(),
+ XML_hashValue, aPH.maHashValue.isEmpty() ? nullptr : aPH.maHashValue.toUtf8().getStr(),
+ XML_saltValue, aPH.maSaltValue.isEmpty() ? nullptr : aPH.maSaltValue.toUtf8().getStr(),
+ XML_spinCount, aPH.mnSpinCount ? OString::number( aPH.mnSpinCount).getStr() : nullptr,
+ XML_sheet, ToPsz( true ),
+ XML_password, sHash.isEmpty()? nullptr : sHash.getStr(),
+ XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? nullptr : ToPsz( true ),
+ XML_scenarios, pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ? nullptr : ToPsz( true ),
+ XML_formatCells, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? ToPsz( false ) : nullptr,
+ XML_formatColumns, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? ToPsz( false ) : nullptr,
+ XML_formatRows, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? ToPsz( false ) : nullptr,
+ XML_insertColumns, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? ToPsz( false ) : nullptr,
+ XML_insertRows, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? ToPsz( false ) : nullptr,
+ XML_insertHyperlinks, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? ToPsz( false ) : nullptr,
+ XML_deleteColumns, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? ToPsz( false ) : nullptr,
+ XML_deleteRows, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? ToPsz( false ) : nullptr,
+ XML_selectLockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? nullptr : ToPsz( true ),
+ XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? ToPsz( false ) : nullptr,
+ XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? ToPsz( false ) : nullptr,
+ XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? ToPsz( false ) : nullptr,
+ XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? nullptr : ToPsz( true ) );
+
+ const ::std::vector<ScEnhancedProtection>& rProts( pTabProtect->getEnhancedProtection());
+ if (rProts.empty())
+ return;
+
+ rWorksheet->startElement(XML_protectedRanges);
+ for (const auto& rProt : rProts)
+ {
+ SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(),
+ "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF security descriptor");
+ rWorksheet->singleElement( XML_protectedRange,
+ XML_name, rProt.maTitle.isEmpty() ? nullptr : rProt.maTitle.toUtf8().getStr(),
+ XML_securityDescriptor, rProt.maSecurityDescriptorXML.isEmpty() ? nullptr : rProt.maSecurityDescriptorXML.toUtf8().getStr(),
+ /* XXX 'password' is not part of OOXML, but Excel2013
+ * writes it if loaded from BIFF, in which case
+ * 'algorithmName', 'hashValue', 'saltValue' and
+ * 'spinCount' are absent; so do we if it was present. */
+ XML_password, rProt.mnPasswordVerifier ? OString::number( rProt.mnPasswordVerifier, 16).getStr() : nullptr,
+ XML_algorithmName, rProt.maPasswordHash.maAlgorithmName.isEmpty() ? nullptr : rProt.maPasswordHash.maAlgorithmName.toUtf8().getStr(),
+ XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(),
+ XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(),
+ XML_spinCount, rProt.maPasswordHash.mnSpinCount ? OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr,
+ XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
}
+ rWorksheet->endElement( XML_protectedRanges);
}
XclExpPassHash::XclExpPassHash(const Sequence<sal_Int8>& aHash) :
@@ -848,86 +848,86 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const
bAdvanced = pData->GetAdvancedQuerySource( aAdvRange );
bFound = (pData->HasQueryParam() || pData->HasAutoFilter() || bAdvanced);
}
- if( bFound )
- {
- ScQueryParam aParam;
- pData->GetQueryParam( aParam );
+ if( !bFound )
+ return;
- ScRange aRange( aParam.nCol1, aParam.nRow1, aParam.nTab,
- aParam.nCol2, aParam.nRow2, aParam.nTab );
- SCCOL nColCnt = aParam.nCol2 - aParam.nCol1 + 1;
+ ScQueryParam aParam;
+ pData->GetQueryParam( aParam );
- maRef = aRange;
+ ScRange aRange( aParam.nCol1, aParam.nRow1, aParam.nTab,
+ aParam.nCol2, aParam.nRow2, aParam.nTab );
+ SCCOL nColCnt = aParam.nCol2 - aParam.nCol1 + 1;
- // #i2394# built-in defined names must be sorted by containing sheet name
- if (!pDefinedData)
- rNameMgr.InsertBuiltInName( EXC_BUILTIN_FILTERDATABASE, aRange );
+ maRef = aRange;
- // advanced filter
- if( bAdvanced )
- {
- // filter criteria, excel allows only same table
- if( !pDefinedData && aAdvRange.aStart.Tab() == nTab )
- rNameMgr.InsertBuiltInName( EXC_BUILTIN_CRITERIA, aAdvRange );
+ // #i2394# built-in defined names must be sorted by containing sheet name
+ if (!pDefinedData)
+ rNameMgr.InsertBuiltInName( EXC_BUILTIN_FILTERDATABASE, aRange );
- // filter destination range, excel allows only same table
- if( !aParam.bInplace )
- {
- ScRange aDestRange( aParam.nDestCol, aParam.nDestRow, aParam.nDestTab );
- aDestRange.aEnd.IncCol( nColCnt - 1 );
- if( !pDefinedData && aDestRange.aStart.Tab() == nTab )
- rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange );
- }
+ // advanced filter
+ if( bAdvanced )
+ {
+ // filter criteria, excel allows only same table
+ if( !pDefinedData && aAdvRange.aStart.Tab() == nTab )
+ rNameMgr.InsertBuiltInName( EXC_BUILTIN_CRITERIA, aAdvRange );
- m_pFilterMode = new XclExpFiltermode;
+ // filter destination range, excel allows only same table
+ if( !aParam.bInplace )
+ {
+ ScRange aDestRange( aParam.nDestCol, aParam.nDestRow, aParam.nDestTab );
+ aDestRange.aEnd.IncCol( nColCnt - 1 );
+ if( !pDefinedData && aDestRange.aStart.Tab() == nTab )
+ rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange );
}
- // AutoFilter
- else
+
+ m_pFilterMode = new XclExpFiltermode;
+ }
+ // AutoFilter
+ else
+ {
+ bool bConflict = false;
+ bool bContLoop = true;
+ bool bHasOr = false;
+ SCCOLROW nFirstField = aParam.GetEntry( 0 ).nField;
+
+ // create AUTOFILTER records for filtered columns
+ for( SCSIZE nEntry = 0; !bConflict && bContLoop && (nEntry < aParam.GetEntryCount()); nEntry++ )
{
- bool bConflict = false;
- bool bContLoop = true;
- bool bHasOr = false;
- SCCOLROW nFirstField = aParam.GetEntry( 0 ).nField;
+ const ScQueryEntry& rEntry = aParam.GetEntry( nEntry );
- // create AUTOFILTER records for filtered columns
- for( SCSIZE nEntry = 0; !bConflict && bContLoop && (nEntry < aParam.GetEntryCount()); nEntry++ )
+ bContLoop = rEntry.bDoQuery;
+ if( bContLoop )
{
- const ScQueryEntry& rEntry = aParam.GetEntry( nEntry );
+ XclExpAutofilter* pFilter = GetByCol( static_cast<SCCOL>(rEntry.nField) - aRange.aStart.Col() );
- bContLoop = rEntry.bDoQuery;
- if( bContLoop )
- {
- XclExpAutofilter* pFilter = GetByCol( static_cast<SCCOL>(rEntry.nField) - aRange.aStart.Col() );
+ if( nEntry > 0 )
+ bHasOr |= (rEntry.eConnect == SC_OR);
- if( nEntry > 0 )
- bHasOr |= (rEntry.eConnect == SC_OR);
-
- bConflict = (nEntry > 1) && bHasOr;
- if( !bConflict )
- bConflict = (nEntry == 1) && (rEntry.eConnect == SC_OR) &&
- (nFirstField != rEntry.nField);
- if( !bConflict )
- bConflict = pFilter->AddEntry( rEntry );
- }
+ bConflict = (nEntry > 1) && bHasOr;
+ if( !bConflict )
+ bConflict = (nEntry == 1) && (rEntry.eConnect == SC_OR) &&
+ (nFirstField != rEntry.nField);
+ if( !bConflict )
+ bConflict = pFilter->AddEntry( rEntry );
}
+ }
- // additional tests for conflicts
- for( size_t nPos = 0, nSize = maFilterList.GetSize(); !bConflict && (nPos < nSize); ++nPos )
- {
- XclExpAutofilterRef xFilter = maFilterList.GetRecord( nPos );
- bConflict = xFilter->HasCondition() && xFilter->HasTop10();
- }
+ // additional tests for conflicts
+ for( size_t nPos = 0, nSize = maFilterList.GetSize(); !bConflict && (nPos < nSize); ++nPos )
+ {
+ XclExpAutofilterRef xFilter = maFilterList.GetRecord( nPos );
+ bConflict = xFilter->HasCondition() && xFilter->HasTop10();
+ }
- if( bConflict )
- maFilterList.RemoveAllRecords();
+ if( bConflict )
+ maFilterList.RemoveAllRecords();
- if( !maFilterList.IsEmpty() )
- m_pFilterMode = new XclExpFiltermode;
- m_pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt );
+ if( !maFilterList.IsEmpty() )
+ m_pFilterMode = new XclExpFiltermode;
+ m_pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt );
- if (maFilterList.IsEmpty () && !bConflict)
- mbAutoFilter = true;
- }
+ if (maFilterList.IsEmpty () && !bConflict)
+ mbAutoFilter = true;
}
}
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index b3d5a369f271..9020ace75db9 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -164,18 +164,18 @@ void ImportExcel::ReadFileSharing()
nRecommendReadOnly = maStrm.ReaduInt16();
nPasswordHash = maStrm.ReaduInt16();
- if( (nRecommendReadOnly != 0) || (nPasswordHash != 0) )
- {
- if( SfxItemSet* pItemSet = GetMedium().GetItemSet() )
- pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
+ if((nRecommendReadOnly == 0) && (nPasswordHash == 0))
+ return;
- if( SfxObjectShell* pShell = GetDocShell() )
- {
- if( nRecommendReadOnly != 0 )
- pShell->SetLoadReadonly( true );
- if( nPasswordHash != 0 )
- pShell->SetModifyPasswordHash( nPasswordHash );
- }
+ if( SfxItemSet* pItemSet = GetMedium().GetItemSet() )
+ pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
+
+ if( SfxObjectShell* pShell = GetDocShell() )
+ {
+ if( nRecommendReadOnly != 0 )
+ pShell->SetLoadReadonly( true );
+ if( nPasswordHash != 0 )
+ pShell->SetModifyPasswordHash( nPasswordHash );
}
}
@@ -318,28 +318,28 @@ void ImportExcel::ReadLabel()
maStrm >> aXclPos;
ScAddress aScPos( ScAddress::UNINITIALIZED );
- if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
- {
- /* Record ID BIFF XF type String type
- 0x0004 2-7 3 byte 8-bit length, byte string
- 0x0004 8 3 byte 16-bit length, unicode string
- 0x0204 2-7 2 byte 16-bit length, byte string
- 0x0204 8 2 byte 16-bit length, unicode string */
- bool bBiff2 = maStrm.GetRecId() == EXC_ID2_LABEL;
- sal_uInt16 nXFIdx = ReadXFIndex( aScPos, bBiff2 );
- XclStrFlags nFlags = (bBiff2 && (GetBiff() <= EXC_BIFF5)) ? XclStrFlags::EightBitLength : XclStrFlags::NONE;
- XclImpString aString;
-
- // #i63105# use text encoding from FONT record
- rtl_TextEncoding eOldTextEnc = GetTextEncoding();
- if( const XclImpFont* pFont = GetXFBuffer().GetFont( nXFIdx ) )
- SetTextEncoding( pFont->GetFontEncoding() );
- aString.Read( maStrm, nFlags );
- SetTextEncoding( eOldTextEnc );
+ if( !GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
+ return;
- GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
- XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, GetRoot(), aString, nXFIdx);
- }
+ /* Record ID BIFF XF type String type
+ 0x0004 2-7 3 byte 8-bit length, byte string
+ 0x0004 8 3 byte 16-bit length, unicode string
+ 0x0204 2-7 2 byte 16-bit length, byte string
+ 0x0204 8 2 byte 16-bit length, unicode string */
+ bool bBiff2 = maStrm.GetRecId() == EXC_ID2_LABEL;
+ sal_uInt16 nXFIdx = ReadXFIndex( aScPos, bBiff2 );
+ XclStrFlags nFlags = (bBiff2 && (GetBiff() <= EXC_BIFF5)) ? XclStrFlags::EightBitLength : XclStrFlags::NONE;
+ XclImpString aString;
+
+ // #i63105# use text encoding from FONT record
+ rtl_TextEncoding eOldTextEnc = GetTextEncoding();
+ if( const XclImpFont* pFont = GetXFBuffer().GetFont( nXFIdx ) )
+ SetTextEncoding( pFont->GetFontEncoding() );
+ aString.Read( maStrm, nFlags );
+ SetTextEncoding( eOldTextEnc );
+
+ GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
+ XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, GetRoot(), aString, nXFIdx);
}
void ImportExcel::ReadBoolErr()
@@ -348,26 +348,26 @@ void ImportExcel::ReadBoolErr()
maStrm >> aXclPos;
ScAddress aScPos( ScAddress::UNINITIALIZED );
- if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
- {
- sal_uInt16 nXFIdx = ReadXFIndex( aScPos, maStrm.GetRecId() == EXC_ID2_BOOLERR );
- sal_uInt8 nValue, nType;
- nValue = maStrm.ReaduInt8();
- nType = maStrm.ReaduInt8();
+ if( !GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
+ return;
- if( nType == EXC_BOOLERR_BOOL )
- GetXFRangeBuffer().SetBoolXF( aScPos, nXFIdx );
- else
- GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
+ sal_uInt16 nXFIdx = ReadXFIndex( aScPos, maStrm.GetRecId() == EXC_ID2_BOOLERR );
+ sal_uInt8 nValue, nType;
+ nValue = maStrm.ReaduInt8();
+ nType = maStrm.ReaduInt8();
- double fValue;
- std::unique_ptr<ScTokenArray> pScTokArr = ErrorToFormula( nType != EXC_BOOLERR_BOOL, nValue, fValue );
- ScFormulaCell* pCell = pScTokArr
- ? new ScFormulaCell(pD, aScPos, std::move(pScTokArr))
- : new ScFormulaCell(pD, aScPos);
- pCell->SetHybridDouble( fValue );
- GetDocImport().setFormulaCell(aScPos, pCell);
- }
+ if( nType == EXC_BOOLERR_BOOL )
+ GetXFRangeBuffer().SetBoolXF( aScPos, nXFIdx );
+ else
+ GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
+
+ double fValue;
+ std::unique_ptr<ScTokenArray> pScTokArr = ErrorToFormula( nType != EXC_BOOLERR_BOOL, nValue, fValue );
+ ScFormulaCell* pCell = pScTokArr
+ ? new ScFormulaCell(pD, aScPos, std::move(pScTokArr))
+ : new ScFormulaCell(pD, aScPos);
+ pCell->SetHybridDouble( fValue );
+ GetDocImport().setFormulaCell(aScPos, pCell);
}
void ImportExcel::ReadRk()
@@ -399,26 +399,26 @@ void ImportExcel::Row25()
nRow = aIn.ReaduInt16();
aIn.Ignore( 4 );
- if( GetRoot().GetDoc().ValidRow( nRow ) )
- {
- nRowHeight = aIn.ReaduInt16(); // specify direct in Twips
- aIn.Ignore( 2 );
+ if( !GetRoot().GetDoc().ValidRow( nRow ) )
+ return;
- if( GetBiff() == EXC_BIFF2 )
- {// -------------------- BIFF2
- pColRowBuff->SetHeight( nRow, nRowHeight );
- }
- else
- {// -------------------- BIFF5
- sal_uInt16 nGrbit;
+ nRowHeight = aIn.ReaduInt16(); // specify direct in Twips
+ aIn.Ignore( 2 );
- aIn.Ignore( 2 ); // reserved
- nGrbit = aIn.ReaduInt16();
+ if( GetBiff() == EXC_BIFF2 )
+ {// -------------------- BIFF2
+ pColRowBuff->SetHeight( nRow, nRowHeight );
+ }
+ else
+ {// -------------------- BIFF5
+ sal_uInt16 nGrbit;
- sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
- pRowOutlineBuff->SetLevel( nRow, nLevel, ::get_flag( nGrbit, EXC_ROW_COLLAPSED ) );
- pColRowBuff->SetRowSettings( nRow, nRowHeight, nGrbit );
- }
+ aIn.Ignore( 2 ); // reserved
+ nGrbit = aIn.ReaduInt16();
+
+ sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
+ pRowOutlineBuff->SetLevel( nRow, nLevel, ::get_flag( nGrbit, EXC_ROW_COLLAPSED ) );
+ pColRowBuff->SetRowSettings( nRow, nRowHeight, nGrbit );
}
}
@@ -904,19 +904,19 @@ void ImportExcel::Rstring()
nXFIdx = aIn.ReaduInt16();
ScAddress aScPos( ScAddress::UNINITIALIZED );
- if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
- {
- // unformatted Unicode string with separate formatting information
- XclImpString aString;
- aString.Read( maStrm );
+ if( !GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
+ return;
- // character formatting runs
- if( !aString.IsRich() )
- aString.ReadFormats( maStrm );
+ // unformatted Unicode string with separate formatting information
+ XclImpString aString;
+ aString.Read( maStrm );
- GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
- XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, *this, aString, nXFIdx);
- }
+ // character formatting runs
+ if( !aString.IsRich() )
+ aString.ReadFormats( maStrm );
+
+ GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
+ XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, *this, aString, nXFIdx);
}
void ImportExcel::Cellmerging()
@@ -955,25 +955,25 @@ void ImportExcel::Row34()
SCROW nScRow = static_cast< SCROW >( nRow );
- if( GetRoot().GetDoc().ValidRow( nScRow ) )
- {
- nRowHeight = aIn.ReaduInt16(); // specify direct in Twips
- aIn.Ignore( 4 );
+ if( !GetRoot().GetDoc().ValidRow( nScRow ) )
+ return;
- nRowHeight = nRowHeight & 0x7FFF; // Bit 15: Row Height not changed manually
- if( !nRowHeight )
- nRowHeight = (GetBiff() == EXC_BIFF2) ? 0x25 : 0x225;
+ nRowHeight = aIn.ReaduInt16(); // specify direct in Twips
+ aIn.Ignore( 4 );
- nGrbit = aIn.ReaduInt16();
- nXF = aIn.ReaduInt16();
+ nRowHeight = nRowHeight & 0x7FFF; // Bit 15: Row Height not changed manually
+ if( !nRowHeight )
+ nRowHeight = (GetBiff() == EXC_BIFF2) ? 0x25 : 0x225;
- sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
- pRowOutlineBuff->SetLevel( nScRow, nLevel, ::get_flag( nGrbit, EXC_ROW_COLLAPSED ) );
- pColRowBuff->SetRowSettings( nScRow, nRowHeight, nGrbit );
+ nGrbit = aIn.ReaduInt16();
+ nXF = aIn.ReaduInt16();
- if( nGrbit & EXC_ROW_USEDEFXF )
- GetXFRangeBuffer().SetRowDefXF( nScRow, nXF & EXC_ROW_XFMASK );
- }
+ sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
+ pRowOutlineBuff->SetLevel( nScRow, nLevel, ::get_flag( nGrbit, EXC_ROW_COLLAPSED ) );
+ pColRowBuff->SetRowSettings( nScRow, nRowHeight, nGrbit );
+
+ if( nGrbit & EXC_ROW_USEDEFXF )
+ GetXFRangeBuffer().SetRowDefXF( nScRow, nXF & EXC_ROW_XFMASK );
}
void ImportExcel::Bof3()
@@ -1315,32 +1315,32 @@ void ImportExcel::PostDocLoad()
GetTracer().TracePrintRange();
}
- if( pExcRoot->pPrintTitles->HasRanges() )
+ if( !pExcRoot->pPrintTitles->HasRanges() )
+ return;
+
+ for( SCTAB n = 0 ; n < nLast ; n++ )
{
- for( SCTAB n = 0 ; n < nLast ; n++ )
+ p = pExcRoot->pPrintTitles->First(n);
+ if( p )
{
- p = pExcRoot->pPrintTitles->First(n);
- if( p )
+ bool bRowVirgin = true;
+ bool bColVirgin = true;
+
+ while( p )
{
- bool bRowVirgin = true;
- bool bColVirgin = true;
+ if( p->aStart.Col() == 0 && p->aEnd.Col() == pD->MaxCol() && bRowVirgin )
+ {
+ pD->SetRepeatRowRange( n, std::unique_ptr<ScRange>(new ScRange(*p)) );
+ bRowVirgin = false;
+ }
- while( p )
+ if( p->aStart.Row() == 0 && p->aEnd.Row() == pD->MaxRow() && bColVirgin )
{
- if( p->aStart.Col() == 0 && p->aEnd.Col() == pD->MaxCol() && bRowVirgin )
- {
- pD->SetRepeatRowRange( n, std::unique_ptr<ScRange>(new ScRange(*p)) );
- bRowVirgin = false;
- }
-
- if( p->aStart.Row() == 0 && p->aEnd.Row() == pD->MaxRow() && bColVirgin )
- {
- pD->SetRepeatColRange( n, std::unique_ptr<ScRange>(new ScRange(*p)) );
- bColVirgin = false;
- }
-
- p = pExcRoot->pPrintTitles->Next();
+ pD->SetRepeatColRange( n, std::unique_ptr<ScRange>(new ScRange(*p)) );
+ bColVirgin = false;
}
+
+ p = pExcRoot->pPrintTitles->Next();
}
}
}
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index dd3e81a8b97b..ff3f8c2ea30e 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -253,26 +253,26 @@ void XclExpChRootData::RegisterFutureRecBlock( const XclChFrBlock& rFrBlock )
void XclExpChRootData::InitializeFutureRecBlock( XclExpStream& rStrm )
{
// first call from a future record writes all missing CHFRBLOCKBEGIN records
- if( !maUnwrittenFrBlocks.empty() )
+ if( maUnwrittenFrBlocks.empty() )
+ return;
+
+ // write the leading CHFRINFO record
+ if( maWrittenFrBlocks.empty() )
{
- // write the leading CHFRINFO record
- if( maWrittenFrBlocks.empty() )
- {
- rStrm.StartRecord( EXC_ID_CHFRINFO, 20 );
- rStrm << EXC_ID_CHFRINFO << EXC_FUTUREREC_EMPTYFLAGS << EXC_CHFRINFO_EXCELXP2003 << EXC_CHFRINFO_EXCELXP2003 << sal_uInt16( 3 );
- rStrm << sal_uInt16( 0x0850 ) << sal_uInt16( 0x085A ) << sal_uInt16( 0x0861 ) << sal_uInt16( 0x0861 ) << sal_uInt16( 0x086A ) << sal_uInt16( 0x086B );
- rStrm.EndRecord();
- }
- // write all unwritten CHFRBLOCKBEGIN records
- for( const auto& rUnwrittenFrBlock : maUnwrittenFrBlocks )
- {
- OSL_ENSURE( rUnwrittenFrBlock.mnType != EXC_CHFRBLOCK_TYPE_UNKNOWN, "XclExpChRootData::InitializeFutureRecBlock - unknown future record block type" );
- lclWriteChFrBlockRecord( rStrm, rUnwrittenFrBlock, true );
- }
- // move all record infos to vector of written blocks
- maWrittenFrBlocks.insert( maWrittenFrBlocks.end(), maUnwrittenFrBlocks.begin(), maUnwrittenFrBlocks.end() );
- maUnwrittenFrBlocks.clear();
+ rStrm.StartRecord( EXC_ID_CHFRINFO, 20 );
+ rStrm << EXC_ID_CHFRINFO << EXC_FUTUREREC_EMPTYFLAGS << EXC_CHFRINFO_EXCELXP2003 << EXC_CHFRINFO_EXCELXP2003 << sal_uInt16( 3 );
+ rStrm << sal_uInt16( 0x0850 ) << sal_uInt16( 0x085A ) << sal_uInt16( 0x0861 ) << sal_uInt16( 0x0861 ) << sal_uInt16( 0x086A ) << sal_uInt16( 0x086B );
+ rStrm.EndRecord();
+ }
+ // write all unwritten CHFRBLOCKBEGIN records
+ for( const auto& rUnwrittenFrBlock : maUnwrittenFrBlocks )
+ {
+ OSL_ENSURE( rUnwrittenFrBlock.mnType != EXC_CHFRBLOCK_TYPE_UNKNOWN, "XclExpChRootData::InitializeFutureRecBlock - unknown future record block type" );
+ lclWriteChFrBlockRecord( rStrm, rUnwrittenFrBlock, true );
}
+ // move all record infos to vector of written blocks
+ maWrittenFrBlocks.insert( maWrittenFrBlocks.end(), maUnwrittenFrBlocks.begin(), maUnwrittenFrBlocks.end() );
+ maUnwrittenFrBlocks.clear();
}
void XclExpChRootData::FinalizeFutureRecBlock( XclExpStream& rStrm )
@@ -436,19 +436,19 @@ void XclExpChGroupBase::Save( XclExpStream& rStrm )
// header record
XclExpRecord::Save( rStrm );
// group records
- if( HasSubRecords() )
- {
- // register the future record context corresponding to this record group
- RegisterFutureRecBlock( maFrBlock );
- // CHBEGIN record
- XclExpEmptyRecord( EXC_ID_CHBEGIN ).Save( rStrm );
- // embedded records
- WriteSubRecords( rStrm );
- // finalize the future records, must be done before the closing CHEND
- FinalizeFutureRecBlock( rStrm );
- // CHEND record
- XclExpEmptyRecord( EXC_ID_CHEND ).Save( rStrm );
- }
+ if( !HasSubRecords() )
+ return;
+
+ // register the future record context corresponding to this record group
+ RegisterFutureRecBlock( maFrBlock );
+ // CHBEGIN record
+ XclExpEmptyRecord( EXC_ID_CHBEGIN ).Save( rStrm );
+ // embedded records
+ WriteSubRecords( rStrm );
+ // finalize the future records, must be done before the closing CHEND
+ FinalizeFutureRecBlock( rStrm );
+ // CHEND record
+ XclExpEmptyRecord( EXC_ID_CHEND ).Save( rStrm );
}
bool XclExpChGroupBase::HasSubRecords() const
@@ -734,19 +734,19 @@ void XclExpChFrameBase::ConvertFrameBase( const XclExpChRoot& rRoot,
mxLineFmt = new XclExpChLineFormat( rRoot );
mxLineFmt->Convert( rRoot, rPropSet, eObjType );
// area format (only for frame objects)
- if( rRoot.GetFormatInfo( eObjType ).mbIsFrame )
+ if( !rRoot.GetFormatInfo( eObjType ).mbIsFrame )
+ return;
+
+ mxAreaFmt = new XclExpChAreaFormat( rRoot );
+ bool bComplexFill = mxAreaFmt->Convert( rRoot, rPropSet, eObjType );
+ if( (rRoot.GetBiff() == EXC_BIFF8) && bComplexFill )
{
- mxAreaFmt = new XclExpChAreaFormat( rRoot );
- bool bComplexFill = mxAreaFmt->Convert( rRoot, rPropSet, eObjType );
- if( (rRoot.GetBiff() == EXC_BIFF8) && bComplexFill )
- {
- mxEscherFmt = new XclExpChEscherFormat( rRoot );
- mxEscherFmt->Convert( rPropSet, eObjType );
- if( mxEscherFmt->IsValid() )
- mxAreaFmt->SetAuto( false );
- else
- mxEscherFmt.clear();
- }
+ mxEscherFmt = new XclExpChEscherFormat( rRoot );
+ mxEscherFmt->Convert( rPropSet, eObjType );
+ if( mxEscherFmt->IsValid() )
+ mxAreaFmt->SetAuto( false );
+ else
+ mxEscherFmt.clear();
}
}
@@ -1511,30 +1511,30 @@ XclExpCh3dDataFormat::XclExpCh3dDataFormat() :
void XclExpCh3dDataFormat::Convert( const ScfPropertySet& rPropSet )
{
sal_Int32 nApiType(0);
- if( rPropSet.GetProperty( nApiType, EXC_CHPROP_GEOMETRY3D ) )
+ if( !rPropSet.GetProperty( nApiType, EXC_CHPROP_GEOMETRY3D ) )
+ return;
+
+ using namespace cssc2::DataPointGeometry3D;
+ switch( nApiType )
{
- using namespace cssc2::DataPointGeometry3D;
- switch( nApiType )
- {
- case CUBOID:
- maData.mnBase = EXC_CH3DDATAFORMAT_RECT;
- maData.mnTop = EXC_CH3DDATAFORMAT_STRAIGHT;
- break;
- case PYRAMID:
- maData.mnBase = EXC_CH3DDATAFORMAT_RECT;
- maData.mnTop = EXC_CH3DDATAFORMAT_SHARP;
- break;
- case CYLINDER:
- maData.mnBase = EXC_CH3DDATAFORMAT_CIRC;
- maData.mnTop = EXC_CH3DDATAFORMAT_STRAIGHT;
- break;
- case CONE:
- maData.mnBase = EXC_CH3DDATAFORMAT_CIRC;
- maData.mnTop = EXC_CH3DDATAFORMAT_SHARP;
- break;
- default:
- OSL_FAIL( "XclExpCh3dDataFormat::Convert - unknown 3D bar format" );
- }
+ case CUBOID:
+ maData.mnBase = EXC_CH3DDATAFORMAT_RECT;
+ maData.mnTop = EXC_CH3DDATAFORMAT_STRAIGHT;
+ break;
+ case PYRAMID:
+ maData.mnBase = EXC_CH3DDATAFORMAT_RECT;
+ maData.mnTop = EXC_CH3DDATAFORMAT_SHARP;
+ break;
+ case CYLINDER:
+ maData.mnBase = EXC_CH3DDATAFORMAT_CIRC;
+ maData.mnTop = EXC_CH3DDATAFORMAT_STRAIGHT;
+ break;
+ case CONE:
+ maData.mnBase = EXC_CH3DDATAFORMAT_CIRC;
+ maData.mnTop = EXC_CH3DDATAFORMAT_SHARP;
+ break;
+ default:
+ OSL_FAIL( "XclExpCh3dDataFormat::Convert - unknown 3D bar format" );
}
}
@@ -2116,48 +2116,48 @@ XclExpChType::XclExpChType( const XclExpChRoot& rRoot ) :
void XclExpChType::Convert( Reference< XDiagram > const & xDiagram, Reference< XChartType > const & xChartType,
sal_Int32 nApiAxesSetIdx, bool bSwappedAxesSet, bool bHasXLabels )
{
- if( xChartType.is() )
+ if( !xChartType.is() )
+ return;
+
+ maTypeInfo = GetChartTypeInfo( xChartType->getChartType() );
+ // special handling for some chart types
+ switch( maTypeInfo.meTypeCateg )
{
- maTypeInfo = GetChartTypeInfo( xChartType->getChartType() );
- // special handling for some chart types
- switch( maTypeInfo.meTypeCateg )
+ case EXC_CHTYPECATEG_BAR:
{
- case EXC_CHTYPECATEG_BAR:
- {
- maTypeInfo = GetChartTypeInfo( bSwappedAxesSet ? EXC_CHTYPEID_HORBAR : EXC_CHTYPEID_BAR );
- ::set_flag( maData.mnFlags, EXC_CHBAR_HORIZONTAL, bSwappedAxesSet );
- ScfPropertySet aTypeProp( xChartType );
- Sequence< sal_Int32 > aInt32Seq;
- maData.mnOverlap = 0;
- if( aTypeProp.GetProperty( aInt32Seq, EXC_CHPROP_OVERLAPSEQ ) && (nApiAxesSetIdx < aInt32Seq.getLength()) )
- maData.mnOverlap = limit_cast< sal_Int16 >( -aInt32Seq[ nApiAxesSetIdx ], -100, 100 );
- maData.mnGap = 150;
- if( aTypeProp.GetProperty( aInt32Seq, EXC_CHPROP_GAPWIDTHSEQ ) && (nApiAxesSetIdx < aInt32Seq.getLength()) )
- maData.mnGap = limit_cast< sal_uInt16 >( aInt32Seq[ nApiAxesSetIdx ], 0, 500 );
- }
- break;
- case EXC_CHTYPECATEG_RADAR:
- ::set_flag( maData.mnFlags, EXC_CHRADAR_AXISLABELS, bHasXLabels );
- break;
- case EXC_CHTYPECATEG_PIE:
- {
- ScfPropertySet aTypeProp( xChartType );
- bool bDonut = aTypeProp.GetBoolProperty( EXC_CHPROP_USERINGS );
- maTypeInfo = GetChartTypeInfo( bDonut ? EXC_CHTYPEID_DONUT : EXC_CHTYPEID_PIE );
- maData.mnPieHole = bDonut ? 50 : 0;
- // #i85166# starting angle of first pie slice
- ScfPropertySet aDiaProp( xDiagram );
- maData.mnRotation = XclExpChRoot::ConvertPieRotation( aDiaProp );
- }
- break;
- case EXC_CHTYPECATEG_SCATTER:
- if( GetBiff() == EXC_BIFF8 )
- ::set_flag( maData.mnFlags, EXC_CHSCATTER_BUBBLES, maTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES );
- break;
- default:;
+ maTypeInfo = GetChartTypeInfo( bSwappedAxesSet ? EXC_CHTYPEID_HORBAR : EXC_CHTYPEID_BAR );
+ ::set_flag( maData.mnFlags, EXC_CHBAR_HORIZONTAL, bSwappedAxesSet );
+ ScfPropertySet aTypeProp( xChartType );
+ Sequence< sal_Int32 > aInt32Seq;
+ maData.mnOverlap = 0;
+ if( aTypeProp.GetProperty( aInt32Seq, EXC_CHPROP_OVERLAPSEQ ) && (nApiAxesSetIdx < aInt32Seq.getLength()) )
+ maData.mnOverlap = limit_cast< sal_Int16 >( -aInt32Seq[ nApiAxesSetIdx ], -100, 100 );
+ maData.mnGap = 150;
+ if( aTypeProp.GetProperty( aInt32Seq, EXC_CHPROP_GAPWIDTHSEQ ) && (nApiAxesSetIdx < aInt32Seq.getLength()) )
+ maData.mnGap = limit_cast< sal_uInt16 >( aInt32Seq[ nApiAxesSetIdx ], 0, 500 );
}
- SetRecId( maTypeInfo.mnRecId );
+ break;
+ case EXC_CHTYPECATEG_RADAR:
+ ::set_flag( maData.mnFlags, EXC_CHRADAR_AXISLABELS, bHasXLabels );
+ break;
+ case EXC_CHTYPECATEG_PIE:
+ {
+ ScfPropertySet aTypeProp( xChartType );
+ bool bDonut = aTypeProp.GetBoolProperty( EXC_CHPROP_USERINGS );
+ maTypeInfo = GetChartTypeInfo( bDonut ? EXC_CHTYPEID_DONUT : EXC_CHTYPEID_PIE );
+ maData.mnPieHole = bDonut ? 50 : 0;
+ // #i85166# starting angle of first pie slice
+ ScfPropertySet aDiaProp( xDiagram );
+ maData.mnRotation = XclExpChRoot::ConvertPieRotation( aDiaProp );
+ }
+ break;
+ case EXC_CHTYPECATEG_SCATTER:
+ if( GetBiff() == EXC_BIFF8 )
+ ::set_flag( maData.mnFlags, EXC_CHSCATTER_BUBBLES, maTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES );
+ break;
+ default:;
}
+ SetRecId( maTypeInfo.mnRecId );
}
void XclExpChType::SetStacked( bool bPercent )
@@ -2420,67 +2420,67 @@ void XclExpChTypeGroup::ConvertSeries(
sal_Int32 nGroupAxesSetIdx, bool bPercent, bool bConnectBars )
{
Reference< XDataSeriesContainer > xSeriesCont( xChartType, UNO_QUERY );
- if( xSeriesCont.is() )
- {
- std::vector< Reference< XDataSeries > > aSeriesVec;
+ if( !xSeriesCont.is() )
+ return;
- // copy data series attached to the current axes set to the vector
- const Sequence< Reference< XDataSeries > > aSeriesSeq = xSeriesCont->getDataSeries();
- for( const Reference< XDataSeries >& rSeries : aSeriesSeq )
- {
- ScfPropertySet aSeriesProp( rSeries );
- sal_Int32 nSeriesAxesSetIdx(0);
- if( aSeriesProp.GetProperty( nSeriesAxesSetIdx, EXC_CHPROP_ATTAXISINDEX ) && (nSeriesAxesSetIdx == nGroupAxesSetIdx) )
- aSeriesVec.push_back( rSeries );
- }
+ std::vector< Reference< XDataSeries > > aSeriesVec;
- // Are there any series in the current axes set?
- if( !aSeriesVec.empty() )
- {
- // stacking direction (stacked/percent/deep 3d) from first series
- ScfPropertySet aSeriesProp( aSeriesVec.front() );
- cssc2::StackingDirection eStacking;
- if( !aSeriesProp.GetProperty( eStacking, EXC_CHPROP_STACKINGDIR ) )
- eStacking = cssc2::StackingDirection_NO_STACKING;
-
- // stacked or percent chart
- if( maTypeInfo.mbSupportsStacking && (eStacking == cssc2::StackingDirection_Y_STACKING) )
- {
- // percent overrides simple stacking
- maType.SetStacked( bPercent );
+ // copy data series attached to the current axes set to the vector
+ const Sequence< Reference< XDataSeries > > aSeriesSeq = xSeriesCont->getDataSeries();
+ for( const Reference< XDataSeries >& rSeries : aSeriesSeq )
+ {
+ ScfPropertySet aSeriesProp( rSeries );
+ sal_Int32 nSeriesAxesSetIdx(0);
+ if( aSeriesProp.GetProperty( nSeriesAxesSetIdx, EXC_CHPROP_ATTAXISINDEX ) && (nSeriesAxesSetIdx == nGroupAxesSetIdx) )
+ aSeriesVec.push_back( rSeries );
+ }
- // connected data points (only in stacked bar charts)
- if (bConnectBars && (maTypeInfo.meTypeCateg == EXC_CHTYPECATEG_BAR))
- {
- sal_uInt16 nKey = EXC_CHCHARTLINE_CONNECT;
- m_ChartLines.insert(std::make_pair(nKey, std::make_unique<XclExpChLineFormat>(GetChRoot())));
- }
- }
- else
- {
- // reverse series order for some unstacked 2D chart types
- if( maTypeInfo.mbReverseSeries && !Is3dChart() )
- ::std::reverse( aSeriesVec.begin(), aSeriesVec.end() );
- }
+ // Are there any series in the current axes set?
+ if( aSeriesVec.empty() )
+ return;
- // deep 3d chart or clustered 3d chart (stacked is not clustered)
- if( (eStacking == cssc2::StackingDirection_NO_STACKING) && Is3dWallChart() )
- mxChart3d->SetClustered();
+ // stacking direction (stacked/percent/deep 3d) from first series
+ ScfPropertySet aSeriesProp( aSeriesVec.front() );
+ cssc2::StackingDirection eStacking;
+ if( !aSeriesProp.GetProperty( eStacking, EXC_CHPROP_STACKINGDIR ) )
+ eStacking = cssc2::StackingDirection_NO_STACKING;
- // varied point colors
- ::set_flag( maData.mnFlags, EXC_CHTYPEGROUP_VARIEDCOLORS, aSeriesProp.GetBoolProperty( EXC_CHPROP_VARYCOLORSBY ) );
+ // stacked or percent chart
+ if( maTypeInfo.mbSupportsStacking && (eStacking == cssc2::StackingDirection_Y_STACKING) )
+ {
+ // percent overrides simple stacking
+ maType.SetStacked( bPercent );
- // process all series
- for( const auto& rxSeries : aSeriesVec )
- {
- // create Excel series object, stock charts need special processing
- if( maTypeInfo.meTypeId == EXC_CHTYPEID_STOCK )
- CreateAllStockSeries( xChartType, rxSeries );
- else
- CreateDataSeries( xDiagram, rxSeries );
- }
+ // connected data points (only in stacked bar charts)
+ if (bConnectBars && (maTypeInfo.meTypeCateg == EXC_CHTYPECATEG_BAR))
+ {
+ sal_uInt16 nKey = EXC_CHCHARTLINE_CONNECT;
+ m_ChartLines.insert(std::make_pair(nKey, std::make_unique<XclExpChLineFormat>(GetChRoot())));
}
}
+ else
+ {
+ // reverse series order for some unstacked 2D chart types
+ if( maTypeInfo.mbReverseSeries && !Is3dChart() )
+ ::std::reverse( aSeriesVec.begin(), aSeriesVec.end() );
+ }
+
+ // deep 3d chart or clustered 3d chart (stacked is not clustered)
+ if( (eStacking == cssc2::StackingDirection_NO_STACKING) && Is3dWallChart() )
+ mxChart3d->SetClustered();
+
+ // varied point colors
+ ::set_flag( maData.mnFlags, EXC_CHTYPEGROUP_VARIEDCOLORS, aSeriesProp.GetBoolProperty( EXC_CHPROP_VARYCOLORSBY ) );
+
+ // process all series
+ for( const auto& rxSeries : aSeriesVec )
+ {
+ // create Excel series object, stock charts need special processing
+ if( maTypeInfo.meTypeId == EXC_CHTYPEID_STOCK )
+ CreateAllStockSeries( xChartType, rxSeries );
+ else
+ CreateDataSeries( xDiagram, rxSeries );
+ }
}
void XclExpChTypeGroup::ConvertCategSequence( Reference< XLabeledDataSequence > const & xCategSeq )
@@ -2551,21 +2551,21 @@ void XclExpChTypeGroup::CreateAllStockSeries(
m_ChartLines.insert(std::make_pair(nKey, std::make_unique<XclExpChLineFormat>(GetChRoot())));
}
// dropbars
- if( bHasOpen && bHasClose )
- {
- // dropbar type is dependent on position in the file - always create both
- Reference< XPropertySet > xWhitePropSet, xBlackPropSet;
- // white dropbar format
- aTypeProp.GetProperty( xWhitePropSet, EXC_CHPROP_WHITEDAY );
- ScfPropertySet aWhiteProp( xWhitePropSet );
- mxUpBar = new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_WHITEDROPBAR );
- mxUpBar->Convert( aWhiteProp );
- // black dropbar format
- aTypeProp.GetProperty( xBlackPropSet, EXC_CHPROP_BLACKDAY );
- ScfPropertySet aBlackProp( xBlackPropSet );
- mxDownBar = new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_BLACKDROPBAR );
- mxDownBar->Convert( aBlackProp );
- }
+ if( !(bHasOpen && bHasClose) )
+ return;
+
+ // dropbar type is dependent on position in the file - always create both
+ Reference< XPropertySet > xWhitePropSet, xBlackPropSet;
+ // white dropbar format
+ aTypeProp.GetProperty( xWhitePropSet, EXC_CHPROP_WHITEDAY );
+ ScfPropertySet aWhiteProp( xWhitePropSet );
+ mxUpBar = new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_WHITEDROPBAR );
+ mxUpBar->Convert( aWhiteProp );
+ // black dropbar format
+ aTypeProp.GetProperty( xBlackPropSet, EXC_CHPROP_BLACKDAY );
+ ScfPropertySet aBlackProp( xBlackPropSet );
+ mxDownBar = new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_BLACKDROPBAR );
+ mxDownBar->Convert( aBlackProp );
}
bool XclExpChTypeGroup::CreateStockSeries( Reference< XDataSeries > const & xDataSeries,
@@ -2685,20 +2685,20 @@ void XclExpChLabelRange::Save( XclExpStream& rStrm )
XclExpRecord::Save( rStrm );
// the CHDATERANGE record with date axis settings (BIFF8 only)
- if( GetBiff() == EXC_BIFF8 )
- {
- rStrm.StartRecord( EXC_ID_CHDATERANGE, 18 );
- rStrm << maDateData.mnMinDate
- << maDateData.mnMaxDate
- << maDateData.mnMajorStep
- << maDateData.mnMajorUnit
- << maDateData.mnMinorStep
- << maDateData.mnMinorUnit
- << maDateData.mnBaseUnit
- << maDateData.mnCross
- << maDateData.mnFlags;
- rStrm.EndRecord();
- }
+ if( GetBiff() != EXC_BIFF8 )
+ return;
+
+ rStrm.StartRecord( EXC_ID_CHDATERANGE, 18 );
+ rStrm << maDateData.mnMinDate
+ << maDateData.mnMaxDate
+ << maDateData.mnMajorStep
+ << maDateData.mnMajorUnit
+ << maDateData.mnMinorStep
+ << maDateData.mnMinorUnit
+ << maDateData.mnBaseUnit
+ << maDateData.mnCross
+ << maDateData.mnFlags;
+ rStrm.EndRecord();
}
void XclExpChLabelRange::WriteBody( XclExpStream& rStrm )
@@ -2754,24 +2754,24 @@ void XclExpChValueRange::ConvertAxisPosition( const ScfPropertySet& rPropSet )
{
cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE;
double fCrossingPos = 0.0;
- if( rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION ) && rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE ) )
+ if( !(rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION ) && rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE )) )
+ return;
+
+ switch( eAxisPos )
{
- switch( eAxisPos )
- {
- case cssc::ChartAxisPosition_ZERO:
- case cssc::ChartAxisPosition_START:
- ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS );
- break;
- case cssc::ChartAxisPosition_END:
- ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_MAXCROSS );
- break;
- case cssc::ChartAxisPosition_VALUE:
- ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS, false );
- maData.mfCross = ::get_flagvalue< double >( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE, log( fCrossingPos ) / log( 10.0 ), fCrossingPos );
- break;
- default:
- ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS );
- }
+ case cssc::ChartAxisPosition_ZERO:
+ case cssc::ChartAxisPosition_START:
+ ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS );
+ break;
+ case cssc::ChartAxisPosition_END:
+ ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_MAXCROSS );
+ break;
+ case cssc::ChartAxisPosition_VALUE:
+ ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS, false );
+ maData.mfCross = ::get_flagvalue< double >( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE, log( fCrossingPos ) / log( 10.0 ), fCrossingPos );
+ break;
+ default:
+ ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS );
}
}
@@ -2997,41 +2997,44 @@ void XclExpChAxis::Convert( Reference< XAxis > const & xAxis, Reference< XAxis >
// grid -------------------------------------------------------------------
- if( xAxis.is() )
+ if( !xAxis.is() )
+ return;
+
+ // main grid
+ ScfPropertySet aGridProp( xAxis->getGridProperties() );
+ if( aGridProp.GetBoolProperty( EXC_CHPROP_SHOW ) )
+ mxMajorGrid = lclCreateLineFormat( GetChRoot(), aGridProp, EXC_CHOBJTYPE_GRIDLINE );
+ // sub grid
+ Sequence< Reference< XPropertySet > > aSubGridPropSeq = xAxis->getSubGridProperties();
+ if( aSubGridPropSeq.hasElements() )
{
- // main grid
- ScfPropertySet aGridProp( xAxis->getGridProperties() );
- if( aGridProp.GetBoolProperty( EXC_CHPROP_SHOW ) )
- mxMajorGrid = lclCreateLineFormat( GetChRoot(), aGridProp, EXC_CHOBJTYPE_GRIDLINE );
- // sub grid
- Sequence< Reference< XPropertySet > > aSubGridPropSeq = xAxis->getSubGridProperties();
- if( aSubGridPropSeq.hasElements() )
- {
- ScfPropertySet aSubGridProp( aSubGridPropSeq[ 0 ] );
- if( aSubGridProp.GetBoolProperty( EXC_CHPROP_SHOW ) )
- mxMinorGrid = lclCreateLineFormat( GetChRoot(), aSubGridProp, EXC_CHOBJTYPE_GRIDLINE );
- }
+ ScfPropertySet aSubGridProp( aSubGridPropSeq[ 0 ] );
+ if( aSubGridProp.GetBoolProperty( EXC_CHPROP_SHOW ) )
+ mxMinorGrid = lclCreateLineFormat( GetChRoot(), aSubGridProp, EXC_CHOBJTYPE_GRIDLINE );
}
}
void XclExpChAxis::ConvertWall( css::uno::Reference< css::chart2::XDiagram > const & xDiagram )
{
- if( xDiagram.is() ) switch( GetAxisType() )
+ if( !xDiagram.is() )
+ return;
+
+ switch( GetAxisType() )
{
- case EXC_CHAXIS_X:
- {
- ScfPropertySet aWallProp( xDiagram->getWall() );
- mxWallFrame = lclCreateFrame( GetChRoot(), aWallProp, EXC_CHOBJTYPE_WALL3D );
- }
- break;
- case EXC_CHAXIS_Y:
- {
- ScfPropertySet aFloorProp( xDiagram->getFloor() );
- mxWallFrame = lclCreateFrame( GetChRoot(), aFloorProp, EXC_CHOBJTYPE_FLOOR3D );
- }
- break;
- default:
- mxWallFrame.clear();
+ case EXC_CHAXIS_X:
+ {
+ ScfPropertySet aWallProp( xDiagram->getWall() );
+ mxWallFrame = lclCreateFrame( GetChRoot(), aWallProp, EXC_CHOBJTYPE_WALL3D );
+ }
+ break;
+ case EXC_CHAXIS_Y:
+ {
+ ScfPropertySet aFloorProp( xDiagram->getFloor() );
+ mxWallFrame = lclCreateFrame( GetChRoot(), aFloorProp, EXC_CHOBJTYPE_FLOOR3D );
+ }
+ break;
+ default:
+ mxWallFrame.clear();
}
}
@@ -3315,51 +3318,51 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
mxPrimAxesSet = std::make_shared<XclExpChAxesSet>( GetChRoot(), EXC_CHAXESSET_PRIMARY );
mxSecnAxesSet = std::make_shared<XclExpChAxesSet>( GetChRoot(), EXC_CHAXESSET_SECONDARY );
- if( xChartDoc.is() )
- {
- Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram();
+ if( !xChartDoc.is() )
+ return;
- // global chart properties (only 'include hidden cells' attribute for now)
- ScfPropertySet aDiagramProp( xDiagram );
- bool bIncludeHidden = aDiagramProp.GetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS );
- ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISIBLEONLY, !bIncludeHidden );
+ Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram();
- // initialize API conversion (remembers xChartDoc and rChartRect internally)
- InitConversion( xChartDoc, rChartRect );
+ // global chart properties (only 'include hidden cells' attribute for now)
+ ScfPropertySet aDiagramProp( xDiagram );
+ bool bIncludeHidden = aDiagramProp.GetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS );
+ ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISIBLEONLY, !bIncludeHidden );
- // chart frame
- ScfPropertySet aFrameProp( xChartDoc->getPageBackground() );
- mxFrame = lclCreateFrame( GetChRoot(), aFrameProp, EXC_CHOBJTYPE_BACKGROUND );
+ // initialize API conversion (remembers xChartDoc and rChartRect internally)
+ InitConversion( xChartDoc, rChartRect );
- // chart title
- Reference< XTitled > xTitled( xChartDoc, UNO_QUERY );
- OUString aSubTitle;
- lcl_getChartSubTitle(xChartDoc, aSubTitle);
- mxTitle = lclCreateTitle( GetChRoot(), xTitled, EXC_CHOBJLINK_TITLE,
- !aSubTitle.isEmpty() ? &aSubTitle : nullptr );
+ // chart frame
+ ScfPropertySet aFrameProp( xChartDoc->getPageBackground() );
+ mxFrame = lclCreateFrame( GetChRoot(), aFrameProp, EXC_CHOBJTYPE_BACKGROUND );
- // diagrams (axes sets)
- sal_uInt16 nFreeGroupIdx = mxPrimAxesSet->Convert( xDiagram, 0 );
- if( !mxPrimAxesSet->Is3dChart() )
- mxSecnAxesSet->Convert( xDiagram, nFreeGroupIdx );
+ // chart title
+ Reference< XTitled > xTitled( xChartDoc, UNO_QUERY );
+ OUString aSubTitle;
+ lcl_getChartSubTitle(xChartDoc, aSubTitle);
+ mxTitle = lclCreateTitle( GetChRoot(), xTitled, EXC_CHOBJLINK_TITLE,
+ !aSubTitle.isEmpty() ? &aSubTitle : nullptr );
- // treatment of missing values
- ScfPropertySet aDiaProp( xDiagram );
- sal_Int32 nMissingValues = 0;
- if( aDiaProp.GetProperty( nMissingValues, EXC_CHPROP_MISSINGVALUETREATMENT ) )
+ // diagrams (axes sets)
+ sal_uInt16 nFreeGroupIdx = mxPrimAxesSet->Convert( xDiagram, 0 );
+ if( !mxPrimAxesSet->Is3dChart() )
+ mxSecnAxesSet->Convert( xDiagram, nFreeGroupIdx );
+
+ // treatment of missing values
+ ScfPropertySet aDiaProp( xDiagram );
+ sal_Int32 nMissingValues = 0;
+ if( aDiaProp.GetProperty( nMissingValues, EXC_CHPROP_MISSINGVALUETREATMENT ) )
+ {
+ using namespace cssc::MissingValueTreatment;
+ switch( nMissingValues )
{
- using namespace cssc::MissingValueTreatment;
- switch( nMissingValues )
- {
- case LEAVE_GAP: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; break;
- case USE_ZERO: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_ZERO; break;
- case CONTINUE: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_INTERPOLATE; break;
- }
+ case LEAVE_GAP: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; break;
+ case USE_ZERO: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_ZERO; break;
+ case CONTINUE: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_INTERPOLATE; break;
}
-
- // finish API conversion
- FinishConversion();
}
+
+ // finish API conversion
+ FinishConversion();
}
XclExpChSeriesRef XclExpChChart::CreateSeries()
@@ -3427,24 +3430,24 @@ XclExpChartDrawing::XclExpChartDrawing( const XclExpRoot& rRoot,
const Reference< XModel >& rxModel, const Size& rChartSize ) :
XclExpRoot( rRoot )
{
- if( !rChartSize.IsEmpty() )
- {
- ScfPropertySet aPropSet( rxModel );
- Reference< XShapes > xShapes;
- if( aPropSet.GetProperty( xShapes, EXC_CHPROP_ADDITIONALSHAPES ) && xShapes.is() && (xShapes->getCount() > 0) )
- {
- /* Create a new independent object manager with own DFF stream for the
- DGCONTAINER, pass global manager as parent for shared usage of
- global DFF data (picture container etc.). */
- mxObjMgr = std::make_shared<XclExpEmbeddedObjectManager>( GetObjectManager(), rChartSize, EXC_CHART_TOTALUNITS, EXC_CHART_TOTALUNITS );
- // initialize the drawing object list
- mxObjMgr->StartSheet();
- // process the draw page (convert all shapes)
- mxObjRecs = mxObjMgr->ProcessDrawing( xShapes );
- // finalize the DFF stream
- mxObjMgr->EndDocument();
- }
- }
+ if( rChartSize.IsEmpty() )
+ return;
+
+ ScfPropertySet aPropSet( rxModel );
+ Reference< XShapes > xShapes;
+ if( !(aPropSet.GetProperty( xShapes, EXC_CHPROP_ADDITIONALSHAPES ) && xShapes.is() && (xShapes->getCount() > 0)) )
+ return;
+
+ /* Create a new independent object manager with own DFF stream for the
+ DGCONTAINER, pass global manager as parent for shared usage of
+ global DFF data (picture container etc.). */
+ mxObjMgr = std::make_shared<XclExpEmbeddedObjectManager>( GetObjectManager(), rChartSize, EXC_CHART_TOTALUNITS, EXC_CHART_TOTALUNITS );
+ // initialize the drawing object list
+ mxObjMgr->StartSheet();
+ // process the draw page (convert all shapes)
+ mxObjRecs = mxObjMgr->ProcessDrawing( xShapes );
+ // finalize the DFF stream
+ mxObjMgr->EndDocument();
}
XclExpChartDrawing::~XclExpChartDrawing()
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 88e2018b16ab..3fdd33784ede 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -285,21 +285,21 @@ sal_uInt32 XclExpMergedcells::GetBaseXFId( const ScAddress& rPos ) const
void XclExpMergedcells::Save( XclExpStream& rStrm )
{
- if( GetBiff() == EXC_BIFF8 )
+ if( GetBiff() != EXC_BIFF8 )
+ return;
+
+ XclRangeList aXclRanges;
+ GetAddressConverter().ConvertRangeList( aXclRanges, maMergedRanges, true );
+ size_t nFirstRange = 0;
+ size_t nRemainingRanges = aXclRanges.size();
+ while( nRemainingRanges > 0 )
{
- XclRangeList aXclRanges;
- GetAddressConverter().ConvertRangeList( aXclRanges, maMergedRanges, true );
- size_t nFirstRange = 0;
- size_t nRemainingRanges = aXclRanges.size();
- while( nRemainingRanges > 0 )
- {
- size_t nRangeCount = ::std::min< size_t >( nRemainingRanges, EXC_MERGEDCELLS_MAXCOUNT );
- rStrm.StartRecord( EXC_ID_MERGEDCELLS, 2 + 8 * nRangeCount );
- aXclRanges.WriteSubList( rStrm, nFirstRange, nRangeCount );
- rStrm.EndRecord();
- nFirstRange += nRangeCount;
- nRemainingRanges -= nRangeCount;
- }
+ size_t nRangeCount = ::std::min< size_t >( nRemainingRanges, EXC_MERGEDCELLS_MAXCOUNT );
+ rStrm.StartRecord( EXC_ID_MERGEDCELLS, 2 + 8 * nRangeCount );
+ aXclRanges.WriteSubList( rStrm, nFirstRange, nRangeCount );
+ rStrm.EndRecord();
+ nFirstRange += nRangeCount;
+ nRemainingRanges -= nRangeCount;
}
}
@@ -1293,86 +1293,86 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
{
const ScRangeList& aScRanges = rCondFormat.GetRange();
GetAddressConverter().ConvertRangeList( maXclRanges, aScRanges, true );
- if( !maXclRanges.empty() )
- {
- std::vector<XclExpExtCondFormatData> aExtEntries;
- ScAddress aOrigin = aScRanges.Combine().aStart;
- for( size_t nIndex = 0, nCount = rCondFormat.size(); nIndex < nCount; ++nIndex )
- if( const ScFormatEntry* pFormatEntry = rCondFormat.GetEntry( nIndex ) )
+ if( maXclRanges.empty() )
+ return;
+
+ std::vector<XclExpExtCondFormatData> aExtEntries;
+ ScAddress aOrigin = aScRanges.Combine().aStart;
+ for( size_t nIndex = 0, nCount = rCondFormat.size(); nIndex < nCount; ++nIndex )
+ if( const ScFormatEntry* pFormatEntry = rCondFormat.GetEntry( nIndex ) )
+ {
+ if(pFormatEntry->GetType() == ScFormatEntry::Type::Condition)
+ maCFList.AppendNewRecord( new XclExpCF( GetRoot(), static_cast<const ScCondFormatEntry&>(*pFormatEntry), ++rIndex, aOrigin ) );
+ else if(pFormatEntry->GetType() == ScFormatEntry::Type::ExtCondition)
{
- if(pFormatEntry->GetType() == ScFormatEntry::Type::Condition)
- maCFList.AppendNewRecord( new XclExpCF( GetRoot(), static_cast<const ScCondFormatEntry&>(*pFormatEntry), ++rIndex, aOrigin ) );
- else if(pFormatEntry->GetType() == ScFormatEntry::Type::ExtCondition)
+ const ScCondFormatEntry& rFormat = static_cast<const ScCondFormatEntry&>(*pFormatEntry);
+ XclExpExtCondFormatData aExtEntry;
+ aExtEntry.nPriority = ++rIndex;
+ aExtEntry.aGUID = generateGUIDString();
+ aExtEntry.pEntry = &rFormat;
+ aExtEntries.push_back(aExtEntry);
+ }
+ else if(pFormatEntry->GetType() == ScFormatEntry::Type::Colorscale)
+ maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), ++rIndex ) );
+ else if(pFormatEntry->GetType() == ScFormatEntry::Type::Databar)
+ {
+ const ScDataBarFormat& rFormat = static_cast<const ScDataBarFormat&>(*pFormatEntry);
+ XclExpExtCondFormatData aExtEntry;
+ aExtEntry.nPriority = -1;
+ aExtEntry.aGUID = generateGUIDString();
+ aExtEntry.pEntry = &rFormat;
+ aExtEntries.push_back(aExtEntry);
+
+ maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), rFormat, ++rIndex, aExtEntry.aGUID));
+ }
+ else if(pFormatEntry->GetType() == ScFormatEntry::Type::Iconset)
+ {
+ // don't export iconSet entries that are not in OOXML
+ const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(*pFormatEntry);
+ bool bNeedsExt = false;
+ switch (rIconSet.GetIconSetData()->eIconSetType)
{
- const ScCondFormatEntry& rFormat = static_cast<const ScCondFormatEntry&>(*pFormatEntry);
- XclExpExtCondFormatData aExtEntry;
- aExtEntry.nPriority = ++rIndex;
- aExtEntry.aGUID = generateGUIDString();
- aExtEntry.pEntry = &rFormat;
- aExtEntries.push_back(aExtEntry);
+ case IconSet_3Smilies:
+ case IconSet_3ColorSmilies:
+ case IconSet_3Stars:
+ case IconSet_3Triangles:
+ case IconSet_5Boxes:
+ {
+ bNeedsExt = true;
+ }
+ break;
+ default:
+ break;
}
- else if(pFormatEntry->GetType() == ScFormatEntry::Type::Colorscale)
- maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), ++rIndex ) );
- else if(pFormatEntry->GetType() == ScFormatEntry::Type::Databar)
+
+ bNeedsExt |= rIconSet.GetIconSetData()->mbCustom;
+
+ if (bNeedsExt)
{
- const ScDataBarFormat& rFormat = static_cast<const ScDataBarFormat&>(*pFormatEntry);
XclExpExtCondFormatData aExtEntry;
- aExtEntry.nPriority = -1;
+ aExtEntry.nPriority = ++rIndex;
aExtEntry.aGUID = generateGUIDString();
- aExtEntry.pEntry = &rFormat;
+ aExtEntry.pEntry = &rIconSet;
aExtEntries.push_back(aExtEntry);
-
- maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), rFormat, ++rIndex, aExtEntry.aGUID));
}
- else if(pFormatEntry->GetType() == ScFormatEntry::Type::Iconset)
- {
- // don't export iconSet entries that are not in OOXML
- const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(*pFormatEntry);
- bool bNeedsExt = false;
- switch (rIconSet.GetIconSetData()->eIconSetType)
- {
- case IconSet_3Smilies:
- case IconSet_3ColorSmilies:
- case IconSet_3Stars:
- case IconSet_3Triangles:
- case IconSet_5Boxes:
- {
- bNeedsExt = true;
- }
- break;
- default:
- break;
- }
-
- bNeedsExt |= rIconSet.GetIconSetData()->mbCustom;
-
- if (bNeedsExt)
- {
- XclExpExtCondFormatData aExtEntry;
- aExtEntry.nPriority = ++rIndex;
- aExtEntry.aGUID = generateGUIDString();
- aExtEntry.pEntry = &rIconSet;
- aExtEntries.push_back(aExtEntry);
- }
- else
- maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), rIconSet, ++rIndex ) );
- }
- else if(pFormatEntry->GetType() == ScFormatEntry::Type::Date)
- maCFList.AppendNewRecord( new XclExpDateFormat( GetRoot(), static_cast<const ScCondDateFormatEntry&>(*pFormatEntry), ++rIndex ) );
+ else
+ maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), rIconSet, ++rIndex ) );
}
- aScRanges.Format( msSeqRef, ScRefFlags::VALID, GetDoc(), formula::FormulaGrammar::CONV_XL_OOX, ' ', true );
+ else if(pFormatEntry->GetType() == ScFormatEntry::Type::Date)
+ maCFList.AppendNewRecord( new XclExpDateFormat( GetRoot(), static_cast<const ScCondDateFormatEntry&>(*pFormatEntry), ++rIndex ) );
+ }
+ aScRanges.Format( msSeqRef, ScRefFlags::VALID, GetDoc(), formula::FormulaGrammar::CONV_XL_OOX, ' ', true );
- if(!aExtEntries.empty() && xExtLst)
+ if(!aExtEntries.empty() && xExtLst)
+ {
+ XclExpExt* pParent = xExtLst->GetItem( XclExpExtDataBarType );
+ if( !pParent )
{
- XclExpExt* pParent = xExtLst->GetItem( XclExpExtDataBarType );
- if( !pParent )
- {
- xExtLst->AddRecord( new XclExpExtCondFormat( *xExtLst ) );
- pParent = xExtLst->GetItem( XclExpExtDataBarType );
- }
- static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ))->AddRecord(
- new XclExpExtConditionalFormatting( *pParent, aExtEntries, aScRanges));
+ xExtLst->AddRecord( new XclExpExtCondFormat( *xExtLst ) );
+ pParent = xExtLst->GetItem( XclExpExtDataBarType );
}
+ static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ))->AddRecord(
+ new XclExpExtConditionalFormatting( *pParent, aExtEntries, aScRanges));
}
}
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 0e78fbf251da..a2a69aea4e48 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -406,40 +406,40 @@ void XclExpImgData::Save( XclExpStream& rStrm )
aBmp.Convert( BmpConversion::N24Bit );
Bitmap::ScopedReadAccess pAccess(aBmp);
- if( pAccess )
- {
- sal_Int32 nWidth = ::std::min< sal_Int32 >( pAccess->Width(), 0xFFFF );
- sal_Int32 nHeight = ::std::min< sal_Int32 >( pAccess->Height(), 0xFFFF );
- if( (nWidth > 0) && (nHeight > 0) )
- {
- sal_uInt8 nPadding = static_cast< sal_uInt8 >( nWidth & 0x03 );
- sal_uInt32 nTmpSize = static_cast< sal_uInt32 >( (nWidth * 3 + nPadding) * nHeight + 12 );
+ if( !pAccess )
+ return;
- rStrm.StartRecord( mnRecId, nTmpSize + 4 );
+ sal_Int32 nWidth = ::std::min< sal_Int32 >( pAccess->Width(), 0xFFFF );
+ sal_Int32 nHeight = ::std::min< sal_Int32 >( pAccess->Height(), 0xFFFF );
+ if( (nWidth <= 0) || (nHeight <= 0) )
+ return;
- rStrm << EXC_IMGDATA_BMP // BMP format
- << EXC_IMGDATA_WIN // Windows
- << nTmpSize // size after _this_ field
- << sal_uInt32( 12 ) // BITMAPCOREHEADER size
- << static_cast< sal_uInt16 >( nWidth ) // width
- << static_cast< sal_uInt16 >( nHeight ) // height
- << sal_uInt16( 1 ) // planes
- << sal_uInt16( 24 ); // bits per pixel
+ sal_uInt8 nPadding = static_cast< sal_uInt8 >( nWidth & 0x03 );
+ sal_uInt32 nTmpSize = static_cast< sal_uInt32 >( (nWidth * 3 + nPadding) * nHeight + 12 );
- for( sal_Int32 nY = nHeight - 1; nY >= 0; --nY )
- {
- Scanline pScanline = pAccess->GetScanline( nY );
- for( sal_Int32 nX = 0; nX < nWidth; ++nX )
- {
- const BitmapColor& rBmpColor = pAccess->GetPixelFromData( pScanline, nX );
- rStrm << rBmpColor.GetBlue() << rBmpColor.GetGreen() << rBmpColor.GetRed();
- }
- rStrm.WriteZeroBytes( nPadding );
- }
+ rStrm.StartRecord( mnRecId, nTmpSize + 4 );
- rStrm.EndRecord();
+ rStrm << EXC_IMGDATA_BMP // BMP format
+ << EXC_IMGDATA_WIN // Windows
+ << nTmpSize // size after _this_ field
+ << sal_uInt32( 12 ) // BITMAPCOREHEADER size
+ << static_cast< sal_uInt16 >( nWidth ) // width
+ << static_cast< sal_uInt16 >( nHeight ) // height
+ << sal_uInt16( 1 ) // planes
+ << sal_uInt16( 24 ); // bits per pixel
+
+ for( sal_Int32 nY = nHeight - 1; nY >= 0; --nY )
+ {
+ Scanline pScanline = pAccess->GetScanline( nY );
+ for( sal_Int32 nX = 0; nX < nWidth; ++nX )
+ {
+ const BitmapColor& rBmpColor = pAccess->GetPixelFromData( pScanline, nX );
+ rStrm << rBmpColor.GetBlue() << rBmpColor.GetGreen() << rBmpColor.GetRed();
}
+ rStrm.WriteZeroBytes( nPadding );
}
+
+ rStrm.EndRecord();
}
void XclExpImgData::SaveXml( XclExpXmlStream& rStrm )
@@ -495,22 +495,22 @@ void XclExpControlHelper::ConvertSheetLinks( Reference< XShape > const & xShape
// *** source range *** ---------------------------------------------------
Reference< XListEntrySink > xEntrySink( xCtrlModel, UNO_QUERY );
- if( xEntrySink.is() )
+ if( !xEntrySink.is() )
+ return;
+
+ Reference< XServiceInfo > xServInfo( xEntrySink->getListEntrySource(), UNO_QUERY );
+ if( !(xServInfo.is() && xServInfo->supportsService( SC_SERVICENAME_LISTSOURCE )) )
+ return;
+
+ ScfPropertySet aSinkProp( xServInfo );
+ CellRangeAddress aApiRange;
+ if( aSinkProp.GetProperty( aApiRange, SC_UNONAME_CELLRANGE ) )
{
- Reference< XServiceInfo > xServInfo( xEntrySink->getListEntrySource(), UNO_QUERY );
- if( xServInfo.is() && xServInfo->supportsService( SC_SERVICENAME_LISTSOURCE ) )
- {
- ScfPropertySet aSinkProp( xServInfo );
- CellRangeAddress aApiRange;
- if( aSinkProp.GetProperty( aApiRange, SC_UNONAME_CELLRANGE ) )
- {
- ScRange aSrcRange;
- ScUnoConversion::FillScRange( aSrcRange, aApiRange );
- if( (aSrcRange.aStart.Tab() == aSrcRange.aEnd.Tab()) && GetTabInfo().IsExportTab( aSrcRange.aStart.Tab() ) )
- mxSrcRange = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_CONTROL, aSrcRange );
- mnEntryCount = static_cast< sal_uInt16 >( aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1 );
- }
- }
+ ScRange aSrcRange;
+ ScUnoConversion::FillScRange( aSrcRange, aApiRange );
+ if( (aSrcRange.aStart.Tab() == aSrcRange.aEnd.Tab()) && GetTabInfo().IsExportTab( aSrcRange.aStart.Tab() ) )
+ mxSrcRange = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_CONTROL, aSrcRange );
+ mnEntryCount = static_cast< sal_uInt16 >( aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1 );
}
}
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index addce9cefd95..ab942848c013 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -194,19 +194,19 @@ bool XclExpFuncData::IsExcelOnlyParam() const
void XclExpFuncData::IncParamInfoIdx()
{
- if( mpParamInfo )
- {
- // move pointer to next entry, if something explicit follows
- if( (o3tl::make_unsigned( mpParamInfo - mrFuncInfo.mpParamInfos + 1 ) < EXC_FUNCINFO_PARAMINFO_COUNT) && (mpParamInfo[ 1 ].meValid != EXC_PARAM_NONE) )
- ++mpParamInfo;
- // if last parameter type is 'Excel-only' or 'Calc-only', do not repeat it
- else if( IsExcelOnlyParam() || IsCalcOnlyParam() )
- mpParamInfo = nullptr;
- // points to last info, but parameter pairs expected, move to previous info
- else if( mrFuncInfo.IsParamPairs() )
- --mpParamInfo;
- // otherwise: repeat last parameter class
- }
+ if( !mpParamInfo )
+ return;
+
+ // move pointer to next entry, if something explicit follows
+ if( (o3tl::make_unsigned( mpParamInfo - mrFuncInfo.mpParamInfos + 1 ) < EXC_FUNCINFO_PARAMINFO_COUNT) && (mpParamInfo[ 1 ].meValid != EXC_PARAM_NONE) )
+ ++mpParamInfo;
+ // if last parameter type is 'Excel-only' or 'Calc-only', do not repeat it
+ else if( IsExcelOnlyParam() || IsCalcOnlyParam() )
+ mpParamInfo = nullptr;
+ // points to last info, but parameter pairs expected, move to previous info
+ else if( mrFuncInfo.IsParamPairs() )
+ --mpParamInfo;
+ // otherwise: repeat last parameter class
}
void XclExpFuncData::FinishParam( sal_uInt16 nTokPos )
@@ -617,26 +617,26 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA
void XclExpFmlaCompImpl::RecalcTokenClasses()
{
+ if( !mxData->mbOk )
+ return;
+
+ mxData->mbOk = mxData->maOpPosStack.size() == 1;
+ OSL_ENSURE( mxData->mbOk, "XclExpFmlaCompImpl::RecalcTokenClasses - position of root token expected on stack" );
if( mxData->mbOk )
{
- mxData->mbOk = mxData->maOpPosStack.size() == 1;
- OSL_ENSURE( mxData->mbOk, "XclExpFmlaCompImpl::RecalcTokenClasses - position of root token expected on stack" );
- if( mxData->mbOk )
- {
- /* Cell and array formulas start with VAL conversion and VALTYPE
- parameter type, defined names start with ARR conversion and
- REFTYPE parameter type for the root token. */
- bool bNameFmla = mxData->mrCfg.meClassType == EXC_CLASSTYPE_NAME;
- XclFuncParamConv eParamConv = bNameFmla ? EXC_PARAMCONV_ARR : EXC_PARAMCONV_VAL;
- XclExpClassConv eClassConv = bNameFmla ? EXC_CLASSCONV_ARR : EXC_CLASSCONV_VAL;
- XclExpTokenConvInfo aConvInfo = { PopOperandPos(), eParamConv, !bNameFmla };
- RecalcTokenClass( aConvInfo, eParamConv, eClassConv, bNameFmla );
- }
-
- // clear operand vectors (calls to the expensive InsertZeros() may follow)
- mxData->maOpListVec.clear();
- mxData->maOpPosStack.clear();
+ /* Cell and array formulas start with VAL conversion and VALTYPE
+ parameter type, defined names start with ARR conversion and
+ REFTYPE parameter type for the root token. */
+ bool bNameFmla = mxData->mrCfg.meClassType == EXC_CLASSTYPE_NAME;
+ XclFuncParamConv eParamConv = bNameFmla ? EXC_PARAMCONV_ARR : EXC_PARAMCONV_VAL;
+ XclExpClassConv eClassConv = bNameFmla ? EXC_CLASSCONV_ARR : EXC_CLASSCONV_VAL;
+ XclExpTokenConvInfo aConvInfo = { PopOperandPos(), eParamConv, !bNameFmla };
+ RecalcTokenClass( aConvInfo, eParamConv, eClassConv, bNameFmla );
}
+
+ // clear operand vectors (calls to the expensive InsertZeros() may follow)
+ mxData->maOpListVec.clear();
+ mxData->maOpPosStack.clear();
}
void XclExpFmlaCompImpl::RecalcTokenClass( const XclExpTokenConvInfo& rConvInfo,
@@ -1434,23 +1434,23 @@ void XclExpFmlaCompImpl::ProcessFunction( const XclExpScToken& rTokData )
void XclExpFmlaCompImpl::PrepareFunction( const XclExpFuncData& rFuncData )
{
// For OOXML these are not rewritten anymore.
- if (GetOutput() != EXC_OUTPUT_XML_2007)
+ if (GetOutput() == EXC_OUTPUT_XML_2007)
+ return;
+
+ switch( rFuncData.GetOpCode() )
{
- switch( rFuncData.GetOpCode() )
- {
- case ocCosecant: // simulate CSC(x) by (1/SIN(x))
- case ocSecant: // simulate SEC(x) by (1/COS(x))
- case ocCot: // simulate COT(x) by (1/TAN(x))
- case ocCosecantHyp: // simulate CSCH(x) by (1/SINH(x))
- case ocSecantHyp: // simulate SECH(x) by (1/COSH(x))
- case ocCotHyp: // simulate COTH(x) by (1/TANH(x))
- AppendIntToken( 1 );
- break;
- case ocArcCot: // simulate ACOT(x) by (PI/2-ATAN(x))
- AppendNumToken( F_PI2 );
- break;
- default:;
- }
+ case ocCosecant: // simulate CSC(x) by (1/SIN(x))
+ case ocSecant: // simulate SEC(x) by (1/COS(x))
+ case ocCot: // simulate COT(x) by (1/TAN(x))
+ case ocCosecantHyp: // simulate CSCH(x) by (1/SINH(x))
+ case ocSecantHyp: // simulate SECH(x) by (1/COSH(x))
+ case ocCotHyp: // simulate COTH(x) by (1/TANH(x))
+ AppendIntToken( 1 );
+ break;
+ case ocArcCot: // simulate ACOT(x) by (PI/2-ATAN(x))
+ AppendNumToken( F_PI2 );
+ break;
+ default:;
}
}
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 519ceec9a8ff..52ca00f0f465 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -2290,21 +2290,21 @@ sal_uInt16 XclExpLinkManagerImpl5::AppendInternal( XclExpExtSheetRef const & xEx
void XclExpLinkManagerImpl5::CreateInternal()
{
- if( maIntTabMap.empty() )
+ if( !maIntTabMap.empty() )
+ return;
+
+ // create EXTERNSHEET records for all internal exported sheets
+ XclExpTabInfo& rTabInfo = GetTabInfo();
+ for( SCTAB nScTab = 0, nScCnt = rTabInfo.GetScTabCount(); nScTab < nScCnt; ++nScTab )
{
- // create EXTERNSHEET records for all internal exported sheets
- XclExpTabInfo& rTabInfo = GetTabInfo();
- for( SCTAB nScTab = 0, nScCnt = rTabInfo.GetScTabCount(); nScTab < nScCnt; ++nScTab )
+ if( rTabInfo.IsExportTab( nScTab ) )
{
- if( rTabInfo.IsExportTab( nScTab ) )
- {
- XclExpExtSheetRef xRec;
- if( nScTab == GetCurrScTab() )
- xRec = new XclExpExternSheet( GetRoot(), EXC_EXTSH_OWNTAB );
- else
- xRec = new XclExpExternSheet( GetRoot(), rTabInfo.GetScTabName( nScTab ) );
- maIntTabMap[ nScTab ] = AppendInternal( xRec );
- }
+ XclExpExtSheetRef xRec;
+ if( nScTab == GetCurrScTab() )
+ xRec = new XclExpExternSheet( GetRoot(), EXC_EXTSH_OWNTAB );
+ else
+ xRec = new XclExpExternSheet( GetRoot(), rTabInfo.GetScTabName( nScTab ) );
+ maIntTabMap[ nScTab ] = AppendInternal( xRec );
}
}
}
@@ -2393,20 +2393,20 @@ void XclExpLinkManagerImpl8::StoreCellRange( const ScSingleRefData& rRef1, const
{
ScAddress aAbs1 = rRef1.toAbs(&GetRoot().GetDoc(), rPos);
ScAddress aAbs2 = rRef2.toAbs(&GetRoot().GetDoc(), rPos);
- if (!rRef1.IsDeleted() && !rRef2.IsDeleted() && (aAbs1.Tab() >= 0) && (aAbs2.Tab() >= 0))
+ if (!(!rRef1.IsDeleted() && !rRef2.IsDeleted() && (aAbs1.Tab() >= 0) && (aAbs2.Tab() >= 0)))
+ return;
+
+ const XclExpTabInfo& rTabInfo = GetTabInfo();
+ SCTAB nFirstScTab = aAbs1.Tab();
+ SCTAB nLastScTab = aAbs2.Tab();
+ ScRange aRange(aAbs1.Col(), aAbs1.Row(), 0, aAbs2.Col(), aAbs2.Row(), 0);
+ for (SCTAB nScTab = nFirstScTab; nScTab <= nLastScTab; ++nScTab)
{
- const XclExpTabInfo& rTabInfo = GetTabInfo();
- SCTAB nFirstScTab = aAbs1.Tab();
- SCTAB nLastScTab = aAbs2.Tab();
- ScRange aRange(aAbs1.Col(), aAbs1.Row(), 0, aAbs2.Col(), aAbs2.Row(), 0);
- for (SCTAB nScTab = nFirstScTab; nScTab <= nLastScTab; ++nScTab)
+ if( rTabInfo.IsExternalTab( nScTab ) )
{
- if( rTabInfo.IsExternalTab( nScTab ) )
- {
- aRange.aStart.SetTab( nScTab );
- aRange.aEnd.SetTab( nScTab );
- maSBBuffer.StoreCellRange( aRange );
- }
+ aRange.aStart.SetTab( nScTab );
+ aRange.aEnd.SetTab( nScTab );
+ maSBBuffer.StoreCellRange( aRange );
}
}
}
@@ -2472,20 +2472,20 @@ bool XclExpLinkManagerImpl8::InsertExtName( sal_uInt16& rnExtSheet, sal_uInt16&
void XclExpLinkManagerImpl8::Save( XclExpStream& rStrm )
{
- if( !maXtiVec.empty() )
- {
- // SUPBOOKs, XCTs, CRNs, EXTERNNAMEs
- maSBBuffer.Save( rStrm );
+ if( maXtiVec.empty() )
+ return;
- // EXTERNSHEET
- sal_uInt16 nCount = ulimit_cast< sal_uInt16 >( maXtiVec.size() );
- rStrm.StartRecord( EXC_ID_EXTERNSHEET, 2 + 6 * nCount );
- rStrm << nCount;
- rStrm.SetSliceSize( 6 );
- for( const auto& rXti : maXtiVec )
- rXti.Save( rStrm );
- rStrm.EndRecord();
- }
+ // SUPBOOKs, XCTs, CRNs, EXTERNNAMEs
+ maSBBuffer.Save( rStrm );
+
+ // EXTERNSHEET
+ sal_uInt16 nCount = ulimit_cast< sal_uInt16 >( maXtiVec.size() );
+ rStrm.StartRecord( EXC_ID_EXTERNSHEET, 2 + 6 * nCount );
+ rStrm << nCount;
+ rStrm.SetSliceSize( 6 );
+ for( const auto& rXti : maXtiVec )
+ rXti.Save( rStrm );
+ rStrm.EndRecord();
}
void XclExpLinkManagerImpl8::SaveXml( XclExpXmlStream& rStrm )
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 155968d4bac0..5d32147ecb23 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -242,26 +242,26 @@ void XclExpName::SetTokenArray( const XclTokenArrayRef& xTokArr )
void XclExpName::SetLocalTab( SCTAB nScTab )
{
OSL_ENSURE( GetTabInfo().IsExportTab( nScTab ), "XclExpName::SetLocalTab - invalid sheet index" );
- if( GetTabInfo().IsExportTab( nScTab ) )
- {
- mnScTab = nScTab;
- GetGlobalLinkManager().FindExtSheet( mnExtSheet, mnXclTab, nScTab );
+ if( !GetTabInfo().IsExportTab( nScTab ) )
+ return;
- // special handling for NAME record
- switch( GetBiff() )
- {
- case EXC_BIFF5: // EXTERNSHEET index is positive in NAME record
- mnExtSheet = ~mnExtSheet + 1;
- break;
- case EXC_BIFF8: // EXTERNSHEET index not used, but must be created in link table
- mnExtSheet = 0;
- break;
- default: DBG_ERROR_BIFF();
- }
+ mnScTab = nScTab;
+ GetGlobalLinkManager().FindExtSheet( mnExtSheet, mnXclTab, nScTab );
- // Excel sheet index is 1-based
- ++mnXclTab;
+ // special handling for NAME record
+ switch( GetBiff() )
+ {
+ case EXC_BIFF5: // EXTERNSHEET index is positive in NAME record
+ mnExtSheet = ~mnExtSheet + 1;
+ break;
+ case EXC_BIFF8: // EXTERNSHEET index not used, but must be created in link table
+ mnExtSheet = 0;
+ break;
+ default: DBG_ERROR_BIFF();
}
+
+ // Excel sheet index is 1-based
+ ++mnXclTab;
}
void XclExpName::SetHidden( bool bHidden )
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index f9bd6c09b511..8200d281e501 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -508,34 +508,35 @@ sal_uInt16 XclExpPCField::InsertGroupItem( XclExpPCItem* pNewItem )
void XclExpPCField::InsertNumDateGroupItems( const ScDPObject& rDPObj, const ScDPNumGroupInfo& rNumInfo, sal_Int32 nDatePart )
{
OSL_ENSURE( rDPObj.GetSheetDesc(), "XclExpPCField::InsertNumDateGroupItems - cannot generate element list" );
- if( const ScSheetSourceDesc* pSrcDesc = rDPObj.GetSheetDesc() )
+ const ScSheetSourceDesc* pSrcDesc = rDPObj.GetSheetDesc();
+ if(!pSrcDesc)
+ return;
+
+ // get the string collection with original source elements
+ const ScDPSaveData* pSaveData = rDPObj.GetSaveData();
+ const ScDPDimensionSaveData* pDimData = nullptr;
+ if (pSaveData)
+ pDimData = pSaveData->GetExistingDimensionData();
+
+ const ScDPCache* pCache = pSrcDesc->CreateCache(pDimData);
+ if (!pCache)
+ return;
+
+ ScSheetDPData aDPData(&GetDoc(), *pSrcDesc, *pCache);
+ long nDim = GetFieldIndex();
+ // get the string collection with generated grouping elements
+ ScDPNumGroupDimension aTmpDim( rNumInfo );
+ if( nDatePart != 0 )
+ aTmpDim.SetDateDimension();
+ const std::vector<SCROW>& aMemberIds = aTmpDim.GetNumEntries(
+ static_cast<SCCOL>(nDim), pCache);
+ for (SCROW nMemberId : aMemberIds)
{
- // get the string collection with original source elements
- const ScDPSaveData* pSaveData = rDPObj.GetSaveData();
- const ScDPDimensionSaveData* pDimData = nullptr;
- if (pSaveData)
- pDimData = pSaveData->GetExistingDimensionData();
-
- const ScDPCache* pCache = pSrcDesc->CreateCache(pDimData);
- if (!pCache)
- return;
-
- ScSheetDPData aDPData(&GetDoc(), *pSrcDesc, *pCache);
- long nDim = GetFieldIndex();
- // get the string collection with generated grouping elements
- ScDPNumGroupDimension aTmpDim( rNumInfo );
- if( nDatePart != 0 )
- aTmpDim.SetDateDimension();
- const std::vector<SCROW>& aMemberIds = aTmpDim.GetNumEntries(
- static_cast<SCCOL>(nDim), pCache);
- for (SCROW nMemberId : aMemberIds)
+ const ScDPItemData* pData = aDPData.GetMemberById(nDim, nMemberId);
+ if ( pData )
{
- const ScDPItemData* pData = aDPData.GetMemberById(nDim, nMemberId);
- if ( pData )
- {
- OUString aStr = pCache->GetFormattedString(nDim, *pData, false);
- InsertGroupItem(new XclExpPCItem(aStr));
- }
+ OUString aStr = pCache->GetFormattedString(nDim, *pData, false);
+ InsertGroupItem(new XclExpPCItem(aStr));
}
}
}
@@ -617,59 +618,60 @@ XclExpPivotCache::XclExpPivotCache( const XclExpRoot& rRoot, const ScDPObject& r
mbValid( false )
{
// source from sheet only
- if( const ScSheetSourceDesc* pSrcDesc = rDPObj.GetSheetDesc() )
- {
- /* maOrigSrcRange: Range received from the DataPilot object.
- maExpSrcRange: Range written to the DCONREF record.
- maDocSrcRange: Range used to get source data from Calc document.
- This range may be shorter than maExpSrcRange to improve export
- performance (#i22541#). */
- maOrigSrcRange = maExpSrcRange = maDocSrcRange = pSrcDesc->GetSourceRange();
- maSrcRangeName = pSrcDesc->GetRangeName();
-
- // internal sheet data only
- SCTAB nScTab = maExpSrcRange.aStart.Tab();
- if( (nScTab == maExpSrcRange.aEnd.Tab()) && GetTabInfo().IsExportTab( nScTab ) )
- {
- // ValidateRange() restricts source range to valid Excel limits
- if( GetAddressConverter().ValidateRange( maExpSrcRange, true ) )
- {
- // #i22541# skip empty cell areas (performance)
- SCCOL nDocCol1, nDocCol2;
- SCROW nDocRow1, nDocRow2;
- GetDoc().GetDataStart( nScTab, nDocCol1, nDocRow1 );
- GetDoc().GetPrintArea( nScTab, nDocCol2, nDocRow2, false );
- SCCOL nSrcCol1 = maExpSrcRange.aStart.Col();
- SCROW nSrcRow1 = maExpSrcRange.aStart.Row();
- SCCOL nSrcCol2 = maExpSrcRange.aEnd.Col();
- SCROW nSrcRow2 = maExpSrcRange.aEnd.Row();
-
- // #i22541# do not store index list for too big ranges
- if( 2 * (nDocRow2 - nDocRow1) < (nSrcRow2 - nSrcRow1) )
- ::set_flag( maPCInfo.mnFlags, EXC_SXDB_SAVEDATA, false );
-
- // adjust row indexes, keep one row of empty area to surely have the empty cache item
- if( nSrcRow1 < nDocRow1 )
- nSrcRow1 = nDocRow1 - 1;
- if( nSrcRow2 > nDocRow2 )
- nSrcRow2 = nDocRow2 + 1;
-
- maDocSrcRange.aStart.SetCol( ::std::max( nDocCol1, nSrcCol1 ) );
- maDocSrcRange.aStart.SetRow( nSrcRow1 );
- maDocSrcRange.aEnd.SetCol( ::std::min( nDocCol2, nSrcCol2 ) );
- maDocSrcRange.aEnd.SetRow( nSrcRow2 );
-
- GetDoc().GetName( nScTab, maTabName );
- maPCInfo.mnSrcRecs = static_cast< sal_uInt32 >( maExpSrcRange.aEnd.Row() - maExpSrcRange.aStart.Row() );
- maPCInfo.mnStrmId = nListIdx + 1;
- maPCInfo.mnSrcType = EXC_SXDB_SRC_SHEET;
-
- AddFields( rDPObj );
-
- mbValid = true;
- }
- }
- }
+ const ScSheetSourceDesc* pSrcDesc = rDPObj.GetSheetDesc();
+ if(!pSrcDesc)
+ return;
+
+ /* maOrigSrcRange: Range received from the DataPilot object.
+ maExpSrcRange: Range written to the DCONREF record.
+ maDocSrcRange: Range used to get source data from Calc document.
+ This range may be shorter than maExpSrcRange to improve export
+ performance (#i22541#). */
+ maOrigSrcRange = maExpSrcRange = maDocSrcRange = pSrcDesc->GetSourceRange();
+ maSrcRangeName = pSrcDesc->GetRangeName();
+
+ // internal sheet data only
+ SCTAB nScTab = maExpSrcRange.aStart.Tab();
+ if( !((nScTab == maExpSrcRange.aEnd.Tab()) && GetTabInfo().IsExportTab( nScTab )) )
+ return;
+
+ // ValidateRange() restricts source range to valid Excel limits
+ if( !GetAddressConverter().ValidateRange( maExpSrcRange, true ) )
+ return;
+
+ // #i22541# skip empty cell areas (performance)
+ SCCOL nDocCol1, nDocCol2;
+ SCROW nDocRow1, nDocRow2;
+ GetDoc().GetDataStart( nScTab, nDocCol1, nDocRow1 );
+ GetDoc().GetPrintArea( nScTab, nDocCol2, nDocRow2, false );
+ SCCOL nSrcCol1 = maExpSrcRange.aStart.Col();
+ SCROW nSrcRow1 = maExpSrcRange.aStart.Row();
+ SCCOL nSrcCol2 = maExpSrcRange.aEnd.Col();
+ SCROW nSrcRow2 = maExpSrcRange.aEnd.Row();
+
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list