sc/source/filter/excel/exctools.cxx | 5 ----- sc/source/filter/excel/frmbase.cxx | 29 ++++++++++++++++------------- sc/source/filter/excel/impop.cxx | 12 ++++++------ sc/source/filter/excel/xiroot.cxx | 9 +++++---- sc/source/filter/inc/formel.hxx | 5 +++-- sc/source/filter/inc/root.hxx | 4 ---- sc/source/filter/inc/xiroot.hxx | 3 +++ 7 files changed, 33 insertions(+), 34 deletions(-)
New commits: commit a3510e31065245987e5314c821d5688e0d73442f Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Feb 10 14:24:51 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Feb 10 21:54:18 2022 +0100 remove hardcoded MAXCOL/MAXROW in ScRangeListTabs Change-Id: Id26c4456429d25dbf1bf97e8cac28f86cb81563d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129786 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx index d7144c5edea2..73ef59dadc72 100644 --- a/sc/source/filter/excel/frmbase.cxx +++ b/sc/source/filter/excel/frmbase.cxx @@ -21,7 +21,8 @@ #include <osl/diagnose.h> -ScRangeListTabs::ScRangeListTabs() +ScRangeListTabs::ScRangeListTabs( const XclImpRoot& rRoot ) +: XclImpRoot( rRoot ) { } @@ -32,15 +33,16 @@ ScRangeListTabs::~ScRangeListTabs() void ScRangeListTabs::Append( const ScAddress& aSRD, SCTAB nTab ) { ScAddress a = aSRD; + ScDocument& rDoc = GetRoot().GetDoc(); if (a.Tab() > MAXTAB) a.SetTab(MAXTAB); - if (a.Col() > MAXCOL) - a.SetCol(MAXCOL); + if (a.Col() > rDoc.MaxCol()) + a.SetCol(rDoc.MaxCol()); - if (a.Row() > MAXROW) - a.SetRow(MAXROW); + if (a.Row() > rDoc.MaxRow()) + a.SetRow(rDoc.MaxRow()); if( nTab == SCTAB_MAX) return; @@ -69,6 +71,7 @@ void ScRangeListTabs::Append( const ScAddress& aSRD, SCTAB nTab ) void ScRangeListTabs::Append( const ScRange& aCRD, SCTAB nTab ) { ScRange a = aCRD; + ScDocument& rDoc = GetRoot().GetDoc(); // ignore 3D ranges if (a.aStart.Tab() != a.aEnd.Tab()) @@ -79,23 +82,23 @@ void ScRangeListTabs::Append( const ScRange& aCRD, SCTAB nTab ) else if (a.aStart.Tab() < 0) a.aStart.SetTab(0); - if (a.aStart.Col() > MAXCOL) - a.aStart.SetCol(MAXCOL); + if (a.aStart.Col() > rDoc.MaxCol()) + a.aStart.SetCol(rDoc.MaxCol()); else if (a.aStart.Col() < 0) a.aStart.SetCol(0); - if (a.aStart.Row() > MAXROW) - a.aStart.SetRow(MAXROW); + if (a.aStart.Row() > rDoc.MaxRow()) + a.aStart.SetRow(rDoc.MaxRow()); else if (a.aStart.Row() < 0) a.aStart.SetRow(0); - if (a.aEnd.Col() > MAXCOL) - a.aEnd.SetCol(MAXCOL); + if (a.aEnd.Col() > rDoc.MaxCol()) + a.aEnd.SetCol(rDoc.MaxCol()); else if (a.aEnd.Col() < 0) a.aEnd.SetCol(0); - if (a.aEnd.Row() > MAXROW) - a.aEnd.SetRow(MAXROW); + if (a.aEnd.Row() > rDoc.MaxRow()) + a.aEnd.SetRow(rDoc.MaxRow()); else if (a.aEnd.Row() < 0) a.aEnd.SetRow(0); diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx index 4469a487fe2b..af04654de2cd 100644 --- a/sc/source/filter/excel/xiroot.cxx +++ b/sc/source/filter/excel/xiroot.cxx @@ -85,8 +85,8 @@ XclImpRoot::XclImpRoot( XclImpRootData& rImpRootData ) : mrImpData.mxPageSett = std::make_shared<XclImpPageSettings>( GetRoot() ); mrImpData.mxDocViewSett = std::make_shared<XclImpDocViewSettings>( GetRoot() ); mrImpData.mxTabViewSett = std::make_shared<XclImpTabViewSettings>( GetRoot() ); - mrImpData.mpPrintRanges = std::make_unique<ScRangeListTabs>(); - mrImpData.mpPrintTitles = std::make_unique<ScRangeListTabs>(); + mrImpData.mpPrintRanges = std::make_unique<ScRangeListTabs>( GetRoot() ); + mrImpData.mpPrintTitles = std::make_unique<ScRangeListTabs>( GetRoot() ); } void XclImpRoot::SetCodePage( sal_uInt16 nCodePage ) diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx index d9dcec6ec15b..2c01a560e842 100644 --- a/sc/source/filter/inc/formel.hxx +++ b/sc/source/filter/inc/formel.hxx @@ -22,6 +22,7 @@ #include <tools/stream.hxx> #include "tokstack.hxx" +#include "xiroot.hxx" #include <memory> #include <vector> @@ -51,7 +52,7 @@ enum FORMULA_TYPE FT_CondFormat }; -class ScRangeListTabs +class ScRangeListTabs : protected XclImpRoot { typedef ::std::vector<ScRange> RangeListType; typedef ::std::map<SCTAB, RangeListType> TabRangeType; @@ -60,7 +61,7 @@ class ScRangeListTabs RangeListType::const_iterator maItrCurEnd; public: - ScRangeListTabs (); + ScRangeListTabs( const XclImpRoot& rRoot ); ~ScRangeListTabs(); void Append( const ScAddress& aSRD, SCTAB nTab ); commit 6a6a147ecebfbc4f0c8a3d626737104155426393 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Feb 10 14:09:41 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Feb 10 21:54:01 2022 +0100 move ScRangeListTabs members from RootData to XclImpRoot A comment suggests that it's the thing to do, and I'll need access to GetRoot() from ScRangeListTabs in another change. Change-Id: Ic0cf4b1cae7f5e1f9ad265d5a98651c51068c88c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129785 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx index 8456c0be5ff4..6e9d9177785f 100644 --- a/sc/source/filter/excel/exctools.cxx +++ b/sc/source/filter/excel/exctools.cxx @@ -38,9 +38,6 @@ RootData::RootData() eDateiTyp = BiffX; pFmlaConverter = nullptr; - pPrintRanges.reset( new ScRangeListTabs ); - pPrintTitles.reset( new ScRangeListTabs ); - pTabId = nullptr; pUserBViewList = nullptr; @@ -55,8 +52,6 @@ RootData::~RootData() pShrfmlaBuff.reset(); pExtNameBuff.reset(); pAutoFilterBuffer.reset(); - pPrintRanges.reset(); - pPrintTitles.reset(); } XclImpOutlineBuffer::XclImpOutlineBuffer( SCSIZE nNewSize ) : diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 2a2346d81ea3..c23f8f164309 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -1334,18 +1334,18 @@ void ImportExcel::PostDocLoad() const SCTAB nLast = rD.GetTableCount(); const ScRange* p; - if( pExcRoot->pPrintRanges->HasRanges() ) + if( GetRoot().GetPrintAreaBuffer().HasRanges() ) { for( SCTAB n = 0 ; n < nLast ; n++ ) { - p = pExcRoot->pPrintRanges->First(n); + p = GetRoot().GetPrintAreaBuffer().First(n); if( p ) { rD.ClearPrintRanges( n ); while( p ) { rD.AddPrintRange( n, *p ); - p = pExcRoot->pPrintRanges->Next(); + p = GetRoot().GetPrintAreaBuffer().Next(); } } else @@ -1357,12 +1357,12 @@ void ImportExcel::PostDocLoad() GetTracer().TracePrintRange(); } - if( !pExcRoot->pPrintTitles->HasRanges() ) + if( !GetRoot().GetTitleAreaBuffer().HasRanges() ) return; for( SCTAB n = 0 ; n < nLast ; n++ ) { - p = pExcRoot->pPrintTitles->First(n); + p = GetRoot().GetTitleAreaBuffer().First(n); if( p ) { bool bRowVirgin = true; @@ -1382,7 +1382,7 @@ void ImportExcel::PostDocLoad() bColVirgin = false; } - p = pExcRoot->pPrintTitles->Next(); + p = GetRoot().GetTitleAreaBuffer().Next(); } } } diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx index 2ab8b0c324fd..4469a487fe2b 100644 --- a/sc/source/filter/excel/xiroot.cxx +++ b/sc/source/filter/excel/xiroot.cxx @@ -21,6 +21,7 @@ #include <addincol.hxx> #include <colrowst.hxx> #include <document.hxx> +#include <formel.hxx> #include <scextopt.hxx> #include <xihelper.hxx> #include <xiformula.hxx> @@ -84,6 +85,8 @@ XclImpRoot::XclImpRoot( XclImpRootData& rImpRootData ) : mrImpData.mxPageSett = std::make_shared<XclImpPageSettings>( GetRoot() ); mrImpData.mxDocViewSett = std::make_shared<XclImpDocViewSettings>( GetRoot() ); mrImpData.mxTabViewSett = std::make_shared<XclImpTabViewSettings>( GetRoot() ); + mrImpData.mpPrintRanges = std::make_unique<ScRangeListTabs>(); + mrImpData.mpPrintTitles = std::make_unique<ScRangeListTabs>(); } void XclImpRoot::SetCodePage( sal_uInt16 nCodePage ) @@ -165,14 +168,12 @@ XclImpXFRangeBuffer& XclImpRoot::GetXFRangeBuffer() const ScRangeListTabs& XclImpRoot::GetPrintAreaBuffer() const { - // TODO still in old RootData - return *GetOldRoot().pPrintRanges; + return *mrImpData.mpPrintRanges; } ScRangeListTabs& XclImpRoot::GetTitleAreaBuffer() const { - // TODO still in old RootData - return *GetOldRoot().pPrintTitles; + return *mrImpData.mpPrintTitles; } XclImpTabInfo& XclImpRoot::GetTabInfo() const diff --git a/sc/source/filter/inc/root.hxx b/sc/source/filter/inc/root.hxx index 0566b8e33217..0e4697dcd364 100644 --- a/sc/source/filter/inc/root.hxx +++ b/sc/source/filter/inc/root.hxx @@ -32,8 +32,6 @@ class ExcelToSc; class XclImpColRowSettings; class XclImpAutoFilterBuffer; -class ScRangeListTabs; - class XclExpChTrTabId; class XclExpUserBViewList; @@ -53,8 +51,6 @@ struct RootData // -> incarnation in each case in the ImportExcel object! // Biff8 std::unique_ptr<XclImpAutoFilterBuffer> pAutoFilterBuffer; // ranges for autofilter and advanced filter - std::unique_ptr<ScRangeListTabs> pPrintRanges; - std::unique_ptr<ScRangeListTabs> pPrintTitles; // extensions for export XclExpChTrTabId* pTabId; // pointer to rec list, do not destroy diff --git a/sc/source/filter/inc/xiroot.hxx b/sc/source/filter/inc/xiroot.hxx index aeb0bafeec51..d290a01db01d 100644 --- a/sc/source/filter/inc/xiroot.hxx +++ b/sc/source/filter/inc/xiroot.hxx @@ -113,6 +113,9 @@ struct XclImpRootData : public XclRootData std::shared_ptr<ScDocumentImport> mxDocImport; + std::unique_ptr<ScRangeListTabs> mpPrintRanges; + std::unique_ptr<ScRangeListTabs> mpPrintTitles; + bool mbHasCodePage; /// true = CODEPAGE record exists. bool mbHasBasic; /// true = document contains VB project.