[Libreoffice-commits] core.git: sc/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 16 09:32:22 UTC 2020
sc/source/ui/inc/viewdata.hxx | 52 ++--
sc/source/ui/view/viewdata.cxx | 463 ++++++++++++++++++-----------------------
2 files changed, 237 insertions(+), 278 deletions(-)
New commits:
commit d30af8c77940b9e7d03a21a595d3eeaf703ddea3
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Sep 16 10:07:56 2020 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Sep 16 11:31:31 2020 +0200
Remove more redundant checks
... follow-up for bf3d1b8e8f89bfdb409c70cfea126f36474d4772.
Changes pointer to ScDocument into reference; makes some unique_ptrs
inlined; simplifies construction of ScViewData to remove the need in
additional initialization after internal ctor.
Change-Id: I54055ce8243628c3bf9a3e40c557e0098e5801ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102833
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index d923e7341461..f84c0903ba3d 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -274,14 +274,13 @@ private:
double nPPTX, nPPTY; // Scaling factors
::std::vector<std::unique_ptr<ScViewDataTable>> maTabData;
- std::unique_ptr<ScMarkData> mpMarkData;
+ ScMarkData maMarkData;
ScViewDataTable* pThisTab; // Data of the displayed sheet
ScDocShell* pDocShell;
- ScDocument* pDoc;
- ScDBFunc* pView;
- ScTabViewShell* pViewShell;
+ ScDocument& mrDoc;
+ ScTabViewShell* pView;
std::unique_ptr<EditView> pEditView[4]; // Belongs to the window
- std::unique_ptr<ScViewOptions> pOptions;
+ ScViewOptions maOptions;
EditView* pSpellingView;
Size aScenButSize;
@@ -345,8 +344,7 @@ private:
SAL_DLLPRIVATE void EnsureTabDataSize(size_t nSize);
SAL_DLLPRIVATE void UpdateCurrentTab();
- ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh );
- void InitData(ScDocument& rDocument);
+ ScViewData(ScDocument* pDoc, ScDocShell* pDocSh, ScTabViewShell* pViewSh);
public:
ScViewData( ScDocShell& rDocSh, ScTabViewShell* pViewSh );
@@ -355,8 +353,8 @@ public:
ScDocShell* GetDocShell() const { return pDocShell; }
ScDocFunc& GetDocFunc() const;
- ScDBFunc* GetView() const { return pView; }
- ScTabViewShell* GetViewShell() const { return pViewShell; }
+ ScDBFunc* GetView() const;
+ ScTabViewShell* GetViewShell() const { return pView; }
SfxObjectShell* GetSfxDocShell() const { return pDocShell; }
SfxBindings& GetBindings(); // from ViewShell's ViewFrame
SfxDispatcher& GetDispatcher(); // from ViewShell's ViewFrame
@@ -379,7 +377,7 @@ public:
void WriteUserDataSequence(css::uno::Sequence <css::beans::PropertyValue>& rSettings) const;
void ReadUserDataSequence(const css::uno::Sequence <css::beans::PropertyValue>& rSettings);
- ScDocument& GetDocument() const;
+ ScDocument& GetDocument() const { return mrDoc; }
bool IsActive() const { return bActive; }
void Activate(bool bActivate) { bActive = bActivate; }
@@ -395,8 +393,8 @@ public:
void SetRefTabNo( SCTAB nNewTab ) { nRefTabNo = nNewTab; }
SCTAB GetTabNo() const { return nTabNo; }
- SCCOL MaxCol() const { return pDoc->MaxCol(); }
- SCROW MaxRow() const { return pDoc->MaxRow(); }
+ SCCOL MaxCol() const { return mrDoc.MaxCol(); }
+ SCROW MaxRow() const { return mrDoc.MaxRow(); }
ScSplitPos GetActivePart() const { return pThisTab->eWhichActive; }
SCCOL GetPosX( ScHSplitPos eWhich, SCTAB nForTab = -1 ) const;
SCROW GetPosY( ScVSplitPos eWhich, SCTAB nForTab = -1 ) const;
@@ -536,23 +534,23 @@ public:
inline void GetMoveCursor( SCCOL& rCurX, SCROW& rCurY );
- const ScViewOptions& GetOptions() const { return *pOptions; }
+ const ScViewOptions& GetOptions() const { return maOptions; }
void SetOptions( const ScViewOptions& rOpt );
- bool IsGridMode () const { return pOptions->GetOption( VOPT_GRID ); }
- void SetGridMode ( bool bNewMode ) { pOptions->SetOption( VOPT_GRID, bNewMode ); }
- bool IsSyntaxMode () const { return pOptions->GetOption( VOPT_SYNTAX ); }
- void SetSyntaxMode ( bool bNewMode ) { pOptions->SetOption( VOPT_SYNTAX, bNewMode ); }
- bool IsHeaderMode () const { return pOptions->GetOption( VOPT_HEADER ); }
- void SetHeaderMode ( bool bNewMode ) { pOptions->SetOption( VOPT_HEADER, bNewMode ); }
- bool IsTabMode () const { return pOptions->GetOption( VOPT_TABCONTROLS ); }
- void SetTabMode ( bool bNewMode ) { pOptions->SetOption( VOPT_TABCONTROLS, bNewMode ); }
- bool IsVScrollMode () const { return pOptions->GetOption( VOPT_VSCROLL ); }
- void SetVScrollMode ( bool bNewMode ) { pOptions->SetOption( VOPT_VSCROLL, bNewMode ); }
- bool IsHScrollMode () const { return pOptions->GetOption( VOPT_HSCROLL ); }
- void SetHScrollMode ( bool bNewMode ) { pOptions->SetOption( VOPT_HSCROLL, bNewMode ); }
- bool IsOutlineMode () const { return pOptions->GetOption( VOPT_OUTLINER ); }
- void SetOutlineMode ( bool bNewMode ) { pOptions->SetOption( VOPT_OUTLINER, bNewMode ); }
+ bool IsGridMode () const { return maOptions.GetOption(VOPT_GRID); }
+ void SetGridMode ( bool bNewMode ) { maOptions.SetOption(VOPT_GRID, bNewMode); }
+ bool IsSyntaxMode () const { return maOptions.GetOption(VOPT_SYNTAX); }
+ void SetSyntaxMode ( bool bNewMode ) { maOptions.SetOption(VOPT_SYNTAX, bNewMode); }
+ bool IsHeaderMode () const { return maOptions.GetOption(VOPT_HEADER); }
+ void SetHeaderMode ( bool bNewMode ) { maOptions.SetOption(VOPT_HEADER, bNewMode); }
+ bool IsTabMode () const { return maOptions.GetOption(VOPT_TABCONTROLS); }
+ void SetTabMode ( bool bNewMode ) { maOptions.SetOption(VOPT_TABCONTROLS, bNewMode); }
+ bool IsVScrollMode () const { return maOptions.GetOption(VOPT_VSCROLL); }
+ void SetVScrollMode ( bool bNewMode ) { maOptions.SetOption(VOPT_VSCROLL, bNewMode); }
+ bool IsHScrollMode () const { return maOptions.GetOption(VOPT_HSCROLL); }
+ void SetHScrollMode ( bool bNewMode ) { maOptions.SetOption(VOPT_HSCROLL, bNewMode); }
+ bool IsOutlineMode () const { return maOptions.GetOption(VOPT_OUTLINER); }
+ void SetOutlineMode ( bool bNewMode ) { maOptions.SetOption(VOPT_OUTLINER, bNewMode); }
/// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea.
void ForcePageUpDownOffset(long nTwips) { m_nLOKPageUpDownOffset = nTwips; }
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 2a220afaf693..d95a5cf12d9d 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -744,28 +744,37 @@ ScSplitPos ScViewDataTable::SanitizeWhichActive() const
const ScSheetLimits gaNoShellSheetLimits(MAXCOL, MAXROW);
ScViewData::ScViewData(ScDocShell& rDocSh, ScTabViewShell* pViewSh)
- : ScViewData(&rDocSh, pViewSh)
+ : ScViewData(nullptr, &rDocSh, pViewSh)
{
}
ScViewData::ScViewData(ScDocument& rDoc)
- : ScViewData(nullptr, nullptr)
+ : ScViewData(&rDoc, nullptr, nullptr)
{
- InitData(rDoc);
}
-ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
+static ScViewOptions DefaultOptions()
+{
+ ScViewOptions aOptions;
+ aOptions.SetOption(VOPT_GRID, true);
+ aOptions.SetOption(VOPT_SYNTAX, false);
+ aOptions.SetOption(VOPT_HEADER, true);
+ aOptions.SetOption(VOPT_TABCONTROLS, true);
+ aOptions.SetOption(VOPT_VSCROLL, true);
+ aOptions.SetOption(VOPT_HSCROLL, true);
+ aOptions.SetOption(VOPT_OUTLINER, true);
+ return aOptions;
+}
+
+// Either pDoc or pDocSh must be valid
+ScViewData::ScViewData(ScDocument* pDoc, ScDocShell* pDocSh, ScTabViewShell* pViewSh) :
nPPTX(0.0),
nPPTY(0.0),
- mpMarkData(pDocSh?
- new ScMarkData(pDocSh->GetDocument().GetSheetLimits()) :
- new ScMarkData(gaNoShellSheetLimits)
- ),
+ maMarkData (pDocSh ? pDocSh->GetDocument().GetSheetLimits() : gaNoShellSheetLimits),
pDocShell ( pDocSh ),
- pDoc ( nullptr ),
+ mrDoc (pDoc ? *pDoc : pDocSh->GetDocument()),
pView ( pViewSh ),
- pViewShell ( pViewSh ),
- pOptions ( new ScViewOptions ),
+ maOptions (pDocSh ? pDocSh->GetDocument().GetViewOptions() : DefaultOptions()),
pSpellingView ( nullptr ),
aLogicMode ( MapUnit::Map100thMM ),
eDefZoomType( SvxZoomType::PERCENT ),
@@ -799,15 +808,8 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
bGrowing (false),
m_nLOKPageUpDownOffset( 0 )
{
- mpMarkData->SelectOneTable(0); // Sync with nTabNo
-
- SetGridMode ( true );
- SetSyntaxMode ( false );
- SetHeaderMode ( true );
- SetTabMode ( true );
- SetVScrollMode ( true );
- SetHScrollMode ( true );
- SetOutlineMode ( true );
+ assert(bool(pDoc) != bool(pDocSh)); // either one or the other, not both
+ maMarkData.SelectOneTable(0); // Sync with nTabNo
aScrSize = Size( long( STD_COL_WIDTH * PIXEL_PER_TWIPS * OLE_STD_CELLS_X ),
static_cast<long>( ScGlobal::nStdRowHeight * PIXEL_PER_TWIPS * OLE_STD_CELLS_Y ) );
@@ -818,16 +820,10 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
nEditEndRow = nEditRow = 0;
nTabStartCol = SC_TABSTART_NONE;
- if (pDocShell)
- {
- pDoc = &pDocShell->GetDocument();
- *pOptions = pDoc->GetViewOptions();
- }
-
// don't show hidden tables
- if (pDoc && !pDoc->IsVisible(nTabNo))
+ if (!mrDoc.IsVisible(nTabNo))
{
- while ( !pDoc->IsVisible(nTabNo) && pDoc->HasTable(nTabNo+1) )
+ while (!mrDoc.IsVisible(nTabNo) && mrDoc.HasTable(nTabNo + 1))
{
++nTabNo;
maTabData.emplace_back(nullptr);
@@ -836,46 +832,25 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
pThisTab = maTabData[nTabNo].get();
}
- if (pDoc)
- {
- SCTAB nTableCount = pDoc->GetTableCount();
- EnsureTabDataSize(nTableCount);
+ SCTAB nTableCount = mrDoc.GetTableCount();
+ EnsureTabDataSize(nTableCount);
- for ( auto & xTabData : maTabData )
- {
- if (xTabData)
- xTabData->InitData( *pDoc );
- }
- }
-
- CalcPPT();
-}
-
-void ScViewData::InitData(ScDocument& rDocument)
-{
- pDoc = &rDocument;
- *pOptions = pDoc->GetViewOptions();
- for ( auto & xTabData : maTabData )
+ for (auto& xTabData : maTabData)
{
if (xTabData)
- xTabData->InitData( rDocument );
+ xTabData->InitData(mrDoc);
}
-}
-ScDocument& ScViewData::GetDocument() const
-{
- if (pDoc)
- return *pDoc;
- assert(pDocShell && "we must have one of pDoc and pDocShell");
- return pDocShell->GetDocument();
+ CalcPPT();
}
ScViewData::~ScViewData() COVERITY_NOEXCEPT_FALSE
{
KillEditView();
- pOptions.reset();
}
+ScDBFunc* ScViewData::GetView() const { return pView; }
+
void ScViewData::UpdateCurrentTab()
{
assert(0 <= nTabNo && o3tl::make_unsigned(nTabNo) < maTabData.size());
@@ -886,7 +861,7 @@ void ScViewData::UpdateCurrentTab()
pThisTab = maTabData[--nTabNo].get();
else
{
- maTabData[0].reset(new ScViewDataTable(pDoc));
+ maTabData[0].reset(new ScViewDataTable(&mrDoc));
pThisTab = maTabData[0].get();
}
}
@@ -901,7 +876,7 @@ void ScViewData::InsertTab( SCTAB nTab )
CreateTabData( nTab );
UpdateCurrentTab();
- mpMarkData->InsertTab( nTab );
+ maMarkData.InsertTab(nTab);
collectUIInformation({{}}, "InsertTab");
}
@@ -920,7 +895,7 @@ void ScViewData::InsertTabs( SCTAB nTab, SCTAB nNewSheets )
for (SCTAB i = nTab; i < nTab + nNewSheets; ++i)
{
CreateTabData( i );
- mpMarkData->InsertTab( i );
+ maMarkData.InsertTab(i);
}
UpdateCurrentTab();
}
@@ -936,14 +911,14 @@ void ScViewData::DeleteTab( SCTAB nTab )
nTabNo = maTabData.size() - 1;
}
UpdateCurrentTab();
- mpMarkData->DeleteTab( nTab );
+ maMarkData.DeleteTab(nTab);
}
void ScViewData::DeleteTabs( SCTAB nTab, SCTAB nSheets )
{
for (SCTAB i = 0; i < nSheets; ++i)
{
- mpMarkData->DeleteTab( nTab + i );
+ maMarkData.DeleteTab(nTab + i);
}
maTabData.erase(maTabData.begin() + nTab, maTabData.begin()+ nTab+nSheets);
if (o3tl::make_unsigned(nTabNo) >= maTabData.size())
@@ -957,7 +932,7 @@ void ScViewData::DeleteTabs( SCTAB nTab, SCTAB nSheets )
void ScViewData::CopyTab( SCTAB nSrcTab, SCTAB nDestTab )
{
if (nDestTab==SC_TAB_APPEND)
- nDestTab = pDoc->GetTableCount() - 1; // something had to have been copied
+ nDestTab = mrDoc.GetTableCount() - 1; // something had to have been copied
if (nDestTab > MAXTAB)
{
@@ -976,13 +951,13 @@ void ScViewData::CopyTab( SCTAB nSrcTab, SCTAB nDestTab )
maTabData.insert(maTabData.begin() + nDestTab, nullptr);
UpdateCurrentTab();
- mpMarkData->InsertTab( nDestTab );
+ maMarkData.InsertTab(nDestTab);
}
void ScViewData::MoveTab( SCTAB nSrcTab, SCTAB nDestTab )
{
if (nDestTab==SC_TAB_APPEND)
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = mrDoc.GetTableCount() - 1;
std::unique_ptr<ScViewDataTable> pTab;
if (nSrcTab < static_cast<SCTAB>(maTabData.size()))
{
@@ -999,8 +974,8 @@ void ScViewData::MoveTab( SCTAB nSrcTab, SCTAB nDestTab )
}
UpdateCurrentTab();
- mpMarkData->DeleteTab( nSrcTab );
- mpMarkData->InsertTab( nDestTab ); // adapted if needed
+ maMarkData.DeleteTab(nSrcTab);
+ maMarkData.InsertTab(nDestTab); // adapted if needed
}
void ScViewData::CreateTabData( std::vector< SCTAB >& rvTabs )
@@ -1040,7 +1015,7 @@ void ScViewData::SetZoomType( SvxZoomType eNew, bool bAll )
std::vector< SCTAB > vTabs; // Empty for all tabs
if ( !bAll ) // get selected tabs
{
- ScMarkData::iterator itr = mpMarkData->begin(), itrEnd = mpMarkData->end();
+ ScMarkData::iterator itr = maMarkData.begin(), itrEnd = maMarkData.end();
vTabs.insert(vTabs.begin(), itr, itrEnd);
}
SetZoomType( eNew, vTabs );
@@ -1114,7 +1089,7 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAl
std::vector< SCTAB > vTabs;
if ( !bAll ) // get selected tabs
{
- ScMarkData::iterator itr = mpMarkData->begin(), itrEnd = mpMarkData->end();
+ ScMarkData::iterator itr = maMarkData.begin(), itrEnd = maMarkData.end();
vTabs.insert(vTabs.begin(), itr, itrEnd);
}
SetZoom( rNewX, rNewY, vTabs );
@@ -1182,7 +1157,7 @@ ScMarkType ScViewData::GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB&
// handling itself)
ScRange aRange;
- ScMarkData aNewMark(*mpMarkData); // use a local copy for MarkToSimple
+ ScMarkData aNewMark(maMarkData); // use a local copy for MarkToSimple
ScMarkType eMarkType = GetSimpleArea( aRange, aNewMark);
aRange.GetVars( rStartCol, rStartRow, rStartTab, rEndCol, rEndRow, rEndTab);
return eMarkType;
@@ -1192,7 +1167,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange& rRange ) const
{
// parameter bMergeMark is no longer needed, see above
- ScMarkData aNewMark(*mpMarkData); // use a local copy for MarkToSimple
+ ScMarkData aNewMark(maMarkData); // use a local copy for MarkToSimple
return GetSimpleArea( rRange, aNewMark);
}
@@ -1200,7 +1175,7 @@ void ScViewData::GetMultiArea( ScRangeListRef& rRange ) const
{
// parameter bMergeMark is no longer needed, see GetSimpleArea
- ScMarkData aNewMark(*mpMarkData); // use a local copy for MarkToSimple
+ ScMarkData aNewMark(maMarkData); // use a local copy for MarkToSimple
bool bMulti = aNewMark.IsMultiMarked();
if (bMulti)
@@ -1230,7 +1205,7 @@ bool ScViewData::SimpleColMarked()
SCROW nEndRow;
SCTAB nEndTab;
if (GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE)
- if (nStartRow==0 && nEndRow==pDoc->MaxRow())
+ if (nStartRow == 0 && nEndRow == mrDoc.MaxRow())
return true;
return false;
@@ -1245,7 +1220,7 @@ bool ScViewData::SimpleRowMarked()
SCROW nEndRow;
SCTAB nEndTab;
if (GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE)
- if (nStartCol==0 && nEndCol==pDoc->MaxCol())
+ if (nStartCol == 0 && nEndCol == mrDoc.MaxCol())
return true;
return false;
@@ -1406,14 +1381,11 @@ void ScViewData::SetCurYForTab( SCCOL nNewCurY, SCTAB nTabIndex )
void ScViewData::SetMaxTiledCol( SCCOL nNewMaxCol )
{
- if (nNewMaxCol < 0)
- nNewMaxCol = 0;
- if (nNewMaxCol > pDoc->MaxCol())
- nNewMaxCol = pDoc->MaxCol();
+ nNewMaxCol = std::clamp(nNewMaxCol, SCCOL(0), mrDoc.MaxCol());
const SCTAB nTab = GetTabNo();
auto GetColWidthPx = [this, nTab](SCCOL nCol) {
- const sal_uInt16 nSize = this->pDoc->GetColWidth(nCol, nTab);
+ const sal_uInt16 nSize = this->mrDoc.GetColWidth(nCol, nTab);
const long nSizePx = ScViewData::ToPixel(nSize, nPPTX);
return nSizePx;
};
@@ -1438,7 +1410,7 @@ void ScViewData::SetMaxTiledRow( SCROW nNewMaxRow )
const SCTAB nTab = GetTabNo();
auto GetRowHeightPx = [this, nTab](SCROW nRow) {
- const sal_uInt16 nSize = this->pDoc->GetRowHeight(nRow, nTab);
+ const sal_uInt16 nSize = this->mrDoc.GetRowHeight(nRow, nTab);
const long nSizePx = ScViewData::ToPixel(nSize, nPPTY);
return nSizePx;
};
@@ -1460,7 +1432,7 @@ tools::Rectangle ScViewData::GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW
{
Point aCellTopLeft = bInPrintTwips ?
GetPrintTwipsPos(nPosX, nPosY) : GetScrPos(nPosX, nPosY, eWhich, true);
- return ScEditUtil( pDoc, nPosX, nPosY, nTabNo, aCellTopLeft,
+ return ScEditUtil(&mrDoc, nPosX, nPosY, nTabNo, aCellTopLeft,
pWin, nPPTX, nPPTY, GetZoomX(), GetZoomY(), bInPrintTwips ).
GetEditArea( pPattern, bForceToTop );
}
@@ -1469,7 +1441,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
ScEditEngineDefaulter* pNewEngine,
vcl::Window* pWin, SCCOL nNewX, SCROW nNewY )
{
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTabNo );
+ bool bLayoutRTL = mrDoc.IsLayoutRTL(nTabNo);
ScHSplitPos eHWhich = WhichH(eWhich);
ScVSplitPos eVWhich = WhichV(eWhich);
bool bLOKActive = comphelper::LibreOfficeKit::isActive();
@@ -1505,7 +1477,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
{
// We can broadcast the view-cursor message in print-twips for all views.
pEditView[eWhich]->SetBroadcastLOKViewCursor(bLOKPrintTwips);
- pEditView[eWhich]->RegisterViewShell(pViewShell);
+ pEditView[eWhich]->RegisterViewShell(pView);
}
}
@@ -1536,7 +1508,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
bEditActive[eWhich] = true;
- const ScPatternAttr* pPattern = pDoc->GetPattern( nNewX, nNewY, nTabNo );
+ const ScPatternAttr* pPattern = mrDoc.GetPattern(nNewX, nNewY, nTabNo);
SvxCellHorJustify eJust = pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue();
bool bBreak = ( eJust == SvxCellHorJustify::Block ) ||
@@ -1544,14 +1516,14 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
bool bAsianVertical = pNewEngine->IsVertical(); // set by InputHandler
- tools::Rectangle aPixRect = ScEditUtil( pDoc, nNewX,nNewY,nTabNo, GetScrPos(nNewX,nNewY,eWhich),
+ tools::Rectangle aPixRect = ScEditUtil(&mrDoc, nNewX, nNewY, nTabNo, GetScrPos(nNewX, nNewY, eWhich),
pWin, nPPTX,nPPTY,GetZoomX(),GetZoomY() ).
GetEditArea( pPattern, true );
tools::Rectangle aPTwipsRect;
if (bLOKPrintTwips)
{
- aPTwipsRect = ScEditUtil(pDoc, nNewX, nNewY, nTabNo, GetPrintTwipsPos(nNewX, nNewY),
+ aPTwipsRect = ScEditUtil(&mrDoc, nNewX, nNewY, nTabNo, GetPrintTwipsPos(nNewX, nNewY),
pWin, nPPTX, nPPTY, GetZoomX(), GetZoomY(), true /* bInPrintTwips */).
GetEditArea(pPattern, true);
}
@@ -1680,7 +1652,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
// (and same line breaks) as for output.
Fraction aFract(1,1);
- tools::Rectangle aUtilRect = ScEditUtil( pDoc,nNewX,nNewY,nTabNo, Point(0,0), pWin,
+ tools::Rectangle aUtilRect = ScEditUtil(&mrDoc, nNewX, nNewY, nTabNo, Point(0, 0), pWin,
HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( pPattern, false );
aPaperSize.setWidth( aUtilRect.GetWidth() );
if (bLOKPrintTwips)
@@ -2131,7 +2103,7 @@ void ScViewData::EditGrowY( bool bInitial )
// to be clipped before extending to following rows, to avoid obscuring cells for
// reference input (next row is likely to be useful in formulas).
long nAllowedExtra = SC_GROWY_SMALL_EXTRA;
- if ( nEditEndRow == nEditRow && !( pDoc->GetRowFlags( nEditRow, nTabNo ) & CRFlags::ManualSize ) &&
+ if (nEditEndRow == nEditRow && !(mrDoc.GetRowFlags(nEditRow, nTabNo) & CRFlags::ManualSize) &&
pEngine->GetParagraphCount() <= 1 )
{
// If the (only) paragraph starts with a '=', it's a formula.
@@ -2238,7 +2210,7 @@ void ScViewData::CreateTabData( SCTAB nNewTab )
if (!maTabData[nNewTab])
{
- maTabData[nNewTab].reset( new ScViewDataTable(pDoc) );
+ maTabData[nNewTab].reset(new ScViewDataTable(&mrDoc));
maTabData[nNewTab]->eZoomType = eDefZoomType;
maTabData[nNewTab]->aZoomX = aDefZoomX;
@@ -2250,7 +2222,7 @@ void ScViewData::CreateTabData( SCTAB nNewTab )
void ScViewData::CreateSelectedTabData()
{
- for (const auto& rTab : *mpMarkData)
+ for (const auto& rTab : maMarkData)
CreateTabData(rTab);
}
@@ -2384,11 +2356,11 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
{
for (SCCOL nX = nStartPosX; nX < nWhereX && (bAllowNeg || bIsTiledRendering || nScrPosX <= aScrSize.Width()); nX++)
{
- if ( nX > pDoc->MaxCol() )
+ if (nX > mrDoc.MaxCol())
nScrPosX = 0x7FFFFFFF;
else
{
- nTSize = pDoc->GetColWidth( nX, nForTab );
+ nTSize = mrDoc.GetColWidth(nX, nForTab);
if (nTSize)
{
long nSizeXPix = ToPixel( nTSize, nPPTX );
@@ -2402,7 +2374,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
for (SCCOL nX = nStartPosX; nX > nWhereX;)
{
--nX;
- nTSize = pDoc->GetColWidth( nX, nForTab );
+ nTSize = mrDoc.GetColWidth(nX, nForTab);
if (nTSize)
{
long nSizeXPix = ToPixel( nTSize, nPPTX );
@@ -2432,17 +2404,17 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
{
if (bAllowNeg || bIsTiledRendering || nScrPosY <= aScrSize.Height())
{
- if ( nWhereY-1 > pDoc->MaxRow() )
+ if (nWhereY - 1 > mrDoc.MaxRow())
nScrPosY = 0x7FFFFFFF;
else if (bAllowNeg || bIsTiledRendering)
{
- sal_uLong nSizeYPix = pDoc->GetScaledRowHeight( nStartPosY, nWhereY-1, nForTab, nPPTY );
+ sal_uLong nSizeYPix = mrDoc.GetScaledRowHeight(nStartPosY, nWhereY - 1, nForTab, nPPTY);
nScrPosY += nSizeYPix;
}
else
{
sal_uLong nMaxHeight = aScrSize.getHeight() - nScrPosY;
- sal_uLong nSizeYPix = pDoc->GetScaledRowHeight( nStartPosY, nWhereY-1, nForTab, nPPTY, &nMaxHeight );
+ sal_uLong nSizeYPix = mrDoc.GetScaledRowHeight(nStartPosY, nWhereY - 1, nForTab, nPPTY, &nMaxHeight);
nScrPosY += nSizeYPix;
}
}
@@ -2452,7 +2424,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
for (SCROW nY = nStartPosY; nY > nWhereY;)
{
--nY;
- nTSize = pDoc->GetRowHeight( nY, nForTab );
+ nTSize = mrDoc.GetRowHeight(nY, nForTab);
if (nTSize)
{
long nSizeYPix = ToPixel( nTSize, nPPTY );
@@ -2462,7 +2434,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
}
}
- if ( pDoc->IsLayoutRTL( nForTab ) )
+ if (mrDoc.IsLayoutRTL(nForTab))
{
// mirror horizontal position
nScrPosX = aScrSize.Width() - 1 - nScrPosX;
@@ -2475,9 +2447,9 @@ Point ScViewData::GetPrintTwipsPos(SCCOL nCol, SCROW nRow) const
{
// hidden ones are given 0 sizes by these by default.
// TODO: rewrite this to loop over spans (matters for jumbosheets).
- long nPosX = nCol ? pDoc->GetColWidth(0, nCol - 1, nTabNo) : 0;
+ long nPosX = nCol ? mrDoc.GetColWidth(0, nCol - 1, nTabNo) : 0;
// This is now fast as it loops over spans.
- long nPosY = nRow ? pDoc->GetRowHeight(0, nRow - 1, nTabNo) : 0;
+ long nPosY = nRow ? mrDoc.GetRowHeight(0, nRow - 1, nTabNo) : 0;
// TODO: adjust for RTL layout case.
return Point(nPosX, nPosY);
@@ -2569,11 +2541,11 @@ SCCOL ScViewData::CellsAtX( SCCOL nPosX, SCCOL nDir, ScHSplitPos eWhichX, sal_uI
for ( ; nScrPosX<=nScrSizeX && !bOut; nX = sal::static_int_cast<SCCOL>(nX + nDir) )
{
SCCOL nColNo = nX;
- if ( nColNo < 0 || nColNo > pDoc->MaxCol() )
+ if (nColNo < 0 || nColNo > mrDoc.MaxCol())
bOut = true;
else
{
- sal_uInt16 nTSize = pDoc->GetColWidth( nColNo, nTabNo );
+ sal_uInt16 nTSize = mrDoc.GetColWidth(nColNo, nTabNo);
if (nTSize)
{
long nSizeXPix = ToPixel( nTSize, nPPTX );
@@ -2607,9 +2579,9 @@ SCROW ScViewData::CellsAtY( SCROW nPosY, SCROW nDir, ScVSplitPos eWhichY, sal_uI
// forward
nY = nPosY;
long nScrPosY = 0;
- AddPixelsWhile( nScrPosY, nScrSizeY, nY, pDoc->MaxRow(), nPPTY, pDoc, nTabNo);
+ AddPixelsWhile(nScrPosY, nScrSizeY, nY, mrDoc.MaxRow(), nPPTY, &mrDoc, nTabNo);
// Original loop ended on last evaluated +1 or if that was MaxRow even on MaxRow+2.
- nY += (nY == pDoc->MaxRow() ? 2 : 1);
+ nY += (nY == mrDoc.MaxRow() ? 2 : 1);
nY -= nPosY;
}
else
@@ -2617,7 +2589,7 @@ SCROW ScViewData::CellsAtY( SCROW nPosY, SCROW nDir, ScVSplitPos eWhichY, sal_uI
// backward
nY = nPosY-1;
long nScrPosY = 0;
- AddPixelsWhileBackward( nScrPosY, nScrSizeY, nY, 0, nPPTY, pDoc, nTabNo);
+ AddPixelsWhileBackward(nScrPosY, nScrSizeY, nY, 0, nPPTY, &mrDoc, nTabNo);
// Original loop ended on last evaluated -1 or if that was 0 even on -2.
nY -= (nY == 0 ? 2 : 1);
nY = (nPosY-1)-nY;
@@ -2649,26 +2621,26 @@ SCROW ScViewData::PrevCellsY( ScVSplitPos eWhichY ) const
bool ScViewData::GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix ) const
{
- const ScMergeAttr* pMerge = pDoc->GetAttr( nX,nY,nTabNo, ATTR_MERGE );
+ const ScMergeAttr* pMerge = mrDoc.GetAttr(nX, nY, nTabNo, ATTR_MERGE);
if ( pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1 )
{
long nOutWidth = 0;
long nOutHeight = 0;
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=0; i<nCountX; i++)
- nOutWidth += ToPixel( pDoc->GetColWidth(nX+i,nTabNo), nPPTX );
+ nOutWidth += ToPixel(mrDoc.GetColWidth(nX + i, nTabNo), nPPTX);
SCROW nCountY = pMerge->GetRowMerge();
for (SCROW nRow = nY; nRow <= nY+nCountY-1; ++nRow)
{
SCROW nLastRow = nRow;
- if (pDoc->RowHidden(nRow, nTabNo, nullptr, &nLastRow))
+ if (mrDoc.RowHidden(nRow, nTabNo, nullptr, &nLastRow))
{
nRow = nLastRow;
continue;
}
- sal_uInt16 nHeight = pDoc->GetRowHeight(nRow, nTabNo);
+ sal_uInt16 nHeight = mrDoc.GetRowHeight(nRow, nTabNo);
nOutHeight += ToPixel(nHeight, nPPTY);
}
@@ -2678,24 +2650,24 @@ bool ScViewData::GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& r
}
else
{
- rSizeXPix = ToPixel( pDoc->GetColWidth( nX, nTabNo ), nPPTX );
- rSizeYPix = ToPixel( pDoc->GetRowHeight( nY, nTabNo ), nPPTY );
+ rSizeXPix = ToPixel(mrDoc.GetColWidth(nX, nTabNo), nPPTX);
+ rSizeYPix = ToPixel(mrDoc.GetRowHeight(nY, nTabNo), nPPTY);
return false;
}
}
bool ScViewData::GetMergeSizePrintTwips(SCCOL nX, SCROW nY, long& rSizeXTwips, long& rSizeYTwips) const
{
- const ScMergeAttr* pMerge = pDoc->GetAttr(nX, nY, nTabNo, ATTR_MERGE);
+ const ScMergeAttr* pMerge = mrDoc.GetAttr(nX, nY, nTabNo, ATTR_MERGE);
SCCOL nCountX = pMerge->GetColMerge();
if (!nCountX)
nCountX = 1;
- rSizeXTwips = pDoc->GetColWidth(nX, nX + nCountX - 1, nTabNo);
+ rSizeXTwips = mrDoc.GetColWidth(nX, nX + nCountX - 1, nTabNo);
SCROW nCountY = pMerge->GetRowMerge();
if (!nCountY)
nCountY = 1;
- rSizeYTwips = pDoc->GetRowHeight(nY, nY + nCountY - 1, nTabNo);
+ rSizeYTwips = mrDoc.GetRowHeight(nY, nY + nCountY - 1, nTabNo);
return (nCountX > 1 || nCountY > 1);
}
@@ -2719,7 +2691,7 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
ScHSplitPos eHWhich = WhichH(eWhich);
ScVSplitPos eVWhich = WhichV(eWhich);
- if ( pDoc->IsLayoutRTL( nForTab ) )
+ if (mrDoc.IsLayoutRTL(nForTab))
{
// mirror horizontal position
if (pView)
@@ -2736,9 +2708,9 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
if (nClickX > 0)
{
- while ( rPosX<=pDoc->MaxCol() && nClickX >= nScrX )
+ while (rPosX <= mrDoc.MaxCol() && nClickX >= nScrX)
{
- nScrX += ToPixel( pDoc->GetColWidth( rPosX, nForTab ), nPPTX );
+ nScrX += ToPixel(mrDoc.GetColWidth(rPosX, nForTab), nPPTX);
++rPosX;
}
--rPosX;
@@ -2748,19 +2720,19 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
while ( rPosX>0 && nClickX < nScrX )
{
--rPosX;
- nScrX -= ToPixel( pDoc->GetColWidth( rPosX, nForTab ), nPPTX );
+ nScrX -= ToPixel(mrDoc.GetColWidth(rPosX, nForTab), nPPTX);
}
}
if (nClickY > 0)
- AddPixelsWhile( nScrY, nClickY, rPosY, pDoc->MaxRow(), nPPTY, pDoc, nForTab );
+ AddPixelsWhile(nScrY, nClickY, rPosY, mrDoc.MaxRow(), nPPTY, &mrDoc, nForTab);
else
{
/* TODO: could need some "SubPixelsWhileBackward" method */
while ( rPosY>0 && nClickY < nScrY )
{
--rPosY;
- nScrY -= ToPixel( pDoc->GetRowHeight( rPosY, nForTab ), nPPTY );
+ nScrY -= ToPixel(mrDoc.GetRowHeight(rPosY, nForTab), nPPTY);
}
}
@@ -2780,10 +2752,8 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
++rPosY;
}
- if (rPosX<0) rPosX=0;
- if (rPosX>pDoc->MaxCol()) rPosX=pDoc->MaxCol();
- if (rPosY<0) rPosY=0;
- if (rPosY>pDoc->MaxRow()) rPosY=pDoc->MaxRow();
+ rPosX = std::clamp(rPosX, SCCOL(0), mrDoc.MaxCol());
+ rPosY = std::clamp(rPosY, SCROW(0), mrDoc.MaxRow());
if (!(bTestMerge && bForCurTab))
return;
@@ -2791,32 +2761,33 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
// public method to adapt position
SCCOL nOrigX = rPosX;
SCROW nOrigY = rPosY;
- pDoc->SkipOverlapped(rPosX, rPosY, nTabNo);
+ mrDoc.SkipOverlapped(rPosX, rPosY, nTabNo);
bool bHOver = (nOrigX != rPosX);
bool bVOver = (nOrigY != rPosY);
if ( !(bRepair && ( bHOver || bVOver )) )
return;
- const ScMergeAttr* pMerge = pDoc->GetAttr( rPosX, rPosY, nTabNo, ATTR_MERGE );
+ const ScMergeAttr* pMerge = mrDoc.GetAttr(rPosX, rPosY, nTabNo, ATTR_MERGE);
if ( ( bHOver && pMerge->GetColMerge() <= 1 ) ||
( bVOver && pMerge->GetRowMerge() <= 1 ) )
{
OSL_FAIL("merge error found");
- pDoc->RemoveFlagsTab( 0,0, pDoc->MaxCol(),pDoc->MaxRow(), nTabNo, ScMF::Hor | ScMF::Ver );
- SCCOL nEndCol = pDoc->MaxCol();
- SCROW nEndRow = pDoc->MaxRow();
- pDoc->ExtendMerge( 0,0, nEndCol,nEndRow, nTabNo, true );
+ mrDoc.RemoveFlagsTab(0, 0, mrDoc.MaxCol(), mrDoc.MaxRow(), nTabNo, ScMF::Hor | ScMF::Ver);
+ SCCOL nEndCol = mrDoc.MaxCol();
+ SCROW nEndRow = mrDoc.MaxRow();
+ mrDoc.ExtendMerge(0, 0, nEndCol, nEndRow, nTabNo, true);
if (pDocShell)
- pDocShell->PostPaint( ScRange(0,0,nTabNo,pDoc->MaxCol(),pDoc->MaxRow(),nTabNo), PaintPartFlags::Grid );
+ pDocShell->PostPaint(ScRange(0, 0, nTabNo, mrDoc.MaxCol(), mrDoc.MaxRow(), nTabNo),
+ PaintPartFlags::Grid);
}
}
void ScViewData::GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
SCCOL nPosX, SCROW nPosY, bool& rLeft, bool& rTop )
{
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTabNo );
+ bool bLayoutRTL = mrDoc.IsLayoutRTL(nTabNo);
long nLayoutSign = bLayoutRTL ? -1 : 1;
Point aCellStart = GetScrPos( nPosX, nPosY, eWhich, true );
@@ -2840,14 +2811,14 @@ void ScViewData::SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX )
if ( nNewPosX > nOldPosX )
for ( i=nOldPosX; i<nNewPosX; i++ )
{
- long nThis = pDoc->GetColWidth( i,nTabNo );
+ long nThis = mrDoc.GetColWidth(i, nTabNo);
nTPosX -= nThis;
nPixPosX -= ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTX);
}
else
for ( i=nNewPosX; i<nOldPosX; i++ )
{
- long nThis = pDoc->GetColWidth( i,nTabNo );
+ long nThis = mrDoc.GetColWidth(i, nTabNo);
nTPosX += nThis;
nPixPosX += ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTX);
}
@@ -2879,7 +2850,7 @@ void ScViewData::SetPosY( ScVSplitPos eWhich, SCROW nNewPosY )
if ( nNewPosY > nOldPosY )
for ( i=nOldPosY; i<nNewPosY; i++ )
{
- long nThis = pDoc->GetRowHeight( i, nTabNo, nullptr, &nHeightEndRow );
+ long nThis = mrDoc.GetRowHeight(i, nTabNo, nullptr, &nHeightEndRow);
SCROW nRows = std::min( nNewPosY, nHeightEndRow + 1) - i;
i = nHeightEndRow;
nTPosY -= nThis * nRows;
@@ -2888,7 +2859,7 @@ void ScViewData::SetPosY( ScVSplitPos eWhich, SCROW nNewPosY )
else
for ( i=nNewPosY; i<nOldPosY; i++ )
{
- long nThis = pDoc->GetRowHeight( i, nTabNo, nullptr, &nHeightEndRow );
+ long nThis = mrDoc.GetRowHeight(i, nTabNo, nullptr, &nHeightEndRow);
SCROW nRows = std::min( nOldPosY, nHeightEndRow + 1) - i;
i = nHeightEndRow;
nTPosY += nThis * nRows;
@@ -2916,13 +2887,13 @@ void ScViewData::RecalcPixPos() // after zoom changes
long nPixPosX = 0;
SCCOL nPosX = pThisTab->nPosX[eWhich];
for (SCCOL i=0; i<nPosX; i++)
- nPixPosX -= ToPixel(pDoc->GetColWidth(i,nTabNo), nPPTX);
+ nPixPosX -= ToPixel(mrDoc.GetColWidth(i, nTabNo), nPPTX);
pThisTab->nPixPosX[eWhich] = nPixPosX;
long nPixPosY = 0;
SCROW nPosY = pThisTab->nPosY[eWhich];
for (SCROW j=0; j<nPosY; j++)
- nPixPosY -= ToPixel(pDoc->GetRowHeight(j,nTabNo), nPPTY);
+ nPixPosY -= ToPixel(mrDoc.GetRowHeight(j, nTabNo), nPPTY);
pThisTab->nPixPosY[eWhich] = nPixPosY;
}
}
@@ -2955,7 +2926,7 @@ void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
for (nCol=nCol1; nCol<=nCol2; nCol++)
{
- nTSize = pDoc->GetColWidth( nCol, nTabNo );
+ nTSize = mrDoc.GetColWidth(nCol, nTabNo);
if (nTSize)
{
nSizePix = ToPixel( nTSize, nPPTX );
@@ -2965,7 +2936,7 @@ void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
for (nRow=nRow1; nRow<=nRow2; nRow++)
{
- nTSize = pDoc->GetRowHeight( nRow, nTabNo );
+ nTSize = mrDoc.GetRowHeight(nRow, nTabNo);
if (nTSize)
{
nSizePix = ToPixel( nTSize, nPPTY );
@@ -2985,14 +2956,14 @@ void ScViewData::SetScreenPos( const Point& rVisAreaStart )
nSize = 0;
nTwips = static_cast<long>(rVisAreaStart.X() / HMM_PER_TWIPS);
- if ( pDoc->IsLayoutRTL( nTabNo ) )
+ if (mrDoc.IsLayoutRTL(nTabNo))
nTwips = -nTwips;
SCCOL nX1 = 0;
bEnd = false;
while (!bEnd)
{
- nAdd = static_cast<long>(pDoc->GetColWidth(nX1,nTabNo));
- if (nSize+nAdd <= nTwips+1 && nX1<pDoc->MaxCol())
+ nAdd = static_cast<long>(mrDoc.GetColWidth(nX1, nTabNo));
+ if (nSize + nAdd <= nTwips + 1 && nX1 < mrDoc.MaxCol())
{
nSize += nAdd;
++nX1;
@@ -3007,8 +2978,8 @@ void ScViewData::SetScreenPos( const Point& rVisAreaStart )
bEnd = false;
while (!bEnd)
{
- nAdd = static_cast<long>(pDoc->GetRowHeight(nY1,nTabNo));
- if (nSize+nAdd <= nTwips+1 && nY1<pDoc->MaxRow())
+ nAdd = static_cast<long>(mrDoc.GetRowHeight(nY1, nTabNo));
+ if (nSize + nAdd <= nTwips + 1 && nY1 < mrDoc.MaxRow())
{
nSize += nAdd;
++nY1;
@@ -3043,30 +3014,30 @@ ScDocFunc& ScViewData::GetDocFunc() const
SfxBindings& ScViewData::GetBindings()
{
- assert(pViewShell && "GetBindings() without ViewShell");
- return pViewShell->GetViewFrame()->GetBindings();
+ assert(pView && "GetBindings() without ViewShell");
+ return pView->GetViewFrame()->GetBindings();
}
SfxDispatcher& ScViewData::GetDispatcher()
{
- assert(pViewShell && "GetDispatcher() without ViewShell");
- return *pViewShell->GetViewFrame()->GetDispatcher();
+ assert(pView && "GetDispatcher() without ViewShell");
+ return *pView->GetViewFrame()->GetDispatcher();
}
ScMarkData& ScViewData::GetMarkData()
{
- return *mpMarkData;
+ return maMarkData;
}
const ScMarkData& ScViewData::GetMarkData() const
{
- return *mpMarkData;
+ return maMarkData;
}
weld::Window* ScViewData::GetDialogParent()
{
- assert(pViewShell && "GetDialogParent() without ViewShell");
- return pViewShell->GetDialogParent();
+ assert(pView && "GetDialogParent() without ViewShell");
+ return pView->GetDialogParent();
}
ScGridWindow* ScViewData::GetActiveWin()
@@ -3125,15 +3096,15 @@ void ScViewData::CalcPPT()
// try to adjust horizontal scale so the most common column width has minimal rounding errors,
// to avoid differences between cell and drawing layer output
- if ( pDoc && pDoc->HasDetectiveObjects(nTabNo) )
+ if (mrDoc.HasDetectiveObjects(nTabNo))
{
SCCOL nEndCol = 0;
SCROW nDummy = 0;
- pDoc->GetTableArea( nTabNo, nEndCol, nDummy );
+ mrDoc.GetTableArea(nTabNo, nEndCol, nDummy);
if (nEndCol<20)
nEndCol = 20; // same end position as when determining draw scale
- sal_uInt16 nTwips = pDoc->GetCommonWidth( nEndCol, nTabNo );
+ sal_uInt16 nTwips = mrDoc.GetCommonWidth(nEndCol, nTabNo);
if ( nTwips )
{
double fOriginal = nTwips * nPPTX;
@@ -3184,7 +3155,7 @@ void ScViewData::WriteUserData(OUString& rData)
rData += ";" + OUString::number( nTabNo ) + ";" TAG_TABBARWIDTH +
OUString::number( pView->GetTabBarWidth() );
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = mrDoc.GetTableCount();
for (SCTAB i=0; i<nTabCount; i++)
{
rData += ";"; // Numbering must not get mixed up under any circumstances
@@ -3253,7 +3224,7 @@ void ScViewData::ReadUserData(const OUString& rData)
// sheet may have become invalid (for instance last version):
SCTAB nNewTab = static_cast<SCTAB>(rData.getToken(0, ';', nMainIdx).toUInt32());
- if (pDoc->HasTable( nNewTab ))
+ if (mrDoc.HasTable(nNewTab))
SetTabNo(nNewTab);
// if available, get tab bar width:
@@ -3278,7 +3249,7 @@ void ScViewData::ReadUserData(const OUString& rData)
aTabOpt = rData.getToken(0, ';', nMainIdx);
EnsureTabDataSize(nPos + 1);
if (!maTabData[nPos])
- maTabData[nPos].reset( new ScViewDataTable(pDoc) );
+ maTabData[nPos].reset(new ScViewDataTable(&mrDoc));
sal_Unicode cTabSep = 0;
if (comphelper::string::getTokenCount(aTabOpt, SC_OLD_TABSEP) >= 11)
@@ -3290,15 +3261,15 @@ void ScViewData::ReadUserData(const OUString& rData)
if (cTabSep)
{
nIdx = 0;
- maTabData[nPos]->nCurX = pDoc->SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()));
- maTabData[nPos]->nCurY = pDoc->SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
+ maTabData[nPos]->nCurX = mrDoc.SanitizeCol(static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()));
+ maTabData[nPos]->nCurY = mrDoc.SanitizeRow(aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
maTabData[nPos]->eHSplitMode = static_cast<ScSplitMode>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
maTabData[nPos]->eVSplitMode = static_cast<ScSplitMode>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
sal_Int32 nTmp{ aTabOpt.getToken(0, cTabSep, nIdx).toInt32() };
if ( maTabData[nPos]->eHSplitMode == SC_SPLIT_FIX )
{
- maTabData[nPos]->nFixPosX = pDoc->SanitizeCol( static_cast<SCCOL>(nTmp));
+ maTabData[nPos]->nFixPosX = mrDoc.SanitizeCol(static_cast<SCCOL>(nTmp));
UpdateFixX(nPos);
}
else
@@ -3307,17 +3278,17 @@ void ScViewData::ReadUserData(const OUString& rData)
nTmp = aTabOpt.getToken(0, cTabSep, nIdx).toInt32();
if ( maTabData[nPos]->eVSplitMode == SC_SPLIT_FIX )
{
- maTabData[nPos]->nFixPosY = pDoc->SanitizeRow(nTmp);
+ maTabData[nPos]->nFixPosY = mrDoc.SanitizeRow(nTmp);
UpdateFixY(nPos);
}
else
maTabData[nPos]->nVSplitPos = nTmp;
maTabData[nPos]->eWhichActive = static_cast<ScSplitPos>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
- maTabData[nPos]->nPosX[0] = pDoc->SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()));
- maTabData[nPos]->nPosX[1] = pDoc->SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()));
- maTabData[nPos]->nPosY[0] = pDoc->SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
- maTabData[nPos]->nPosY[1] = pDoc->SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
+ maTabData[nPos]->nPosX[0] = mrDoc.SanitizeCol(static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()));
+ maTabData[nPos]->nPosX[1] = mrDoc.SanitizeCol(static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()));
+ maTabData[nPos]->nPosY[0] = mrDoc.SanitizeRow(aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
+ maTabData[nPos]->nPosY[1] = mrDoc.SanitizeRow(aTabOpt.getToken(0, cTabSep, nIdx).toInt32());
maTabData[nPos]->eWhichActive = maTabData[nPos]->SanitizeWhichActive();
}
@@ -3425,12 +3396,9 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
// grid color
rTabSett.maGridColor = COL_AUTO;
- if( pOptions )
- {
- const Color& rGridColor = pOptions->GetGridColor();
- if( rGridColor != SC_STD_GRIDCOLOR )
- rTabSett.maGridColor = rGridColor;
- }
+ const Color& rGridColor = maOptions.GetGridColor();
+ if (rGridColor != SC_STD_GRIDCOLOR)
+ rTabSett.maGridColor = rGridColor;
rTabSett.mbShowGrid = pViewTab->bShowGrid;
// view mode and zoom
@@ -3468,7 +3436,7 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
if( const ScExtTabSettings* pTabSett = rDocOpt.GetTabSettings( nTab ) )
{
if( !maTabData[ nTab ] )
- maTabData[ nTab ].reset( new ScViewDataTable(pDoc) );
+ maTabData[nTab].reset(new ScViewDataTable(&mrDoc));
const ScExtTabSettings& rTabSett = *pTabSett;
ScViewDataTable& rViewTab = *maTabData[ nTab ];
@@ -3586,13 +3554,10 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
if( nTab == GetTabNo() )
{
// grid color -- #i47435# set automatic grid color explicitly
- if( pOptions )
- {
- Color aGridColor( rTabSett.maGridColor );
- if( aGridColor == COL_AUTO )
- aGridColor = SC_STD_GRIDCOLOR;
- pOptions->SetGridColor( aGridColor, EMPTY_OUSTRING );
- }
+ Color aGridColor(rTabSett.maGridColor);
+ if (aGridColor == COL_AUTO)
+ aGridColor = SC_STD_GRIDCOLOR;
+ maOptions.SetGridColor(aGridColor, EMPTY_OUSTRING);
// view mode and default zoom (for new sheets) from current sheet
if( rTabSett.mnNormalZoom )
@@ -3618,7 +3583,7 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
// + 1, because we have to put the view id in the sequence
beans::PropertyValue* pSettings = rSettings.getArray();
- sal_uInt16 nViewID(pViewShell->GetViewFrame()->GetCurViewId());
+ sal_uInt16 nViewID(pView->GetViewFrame()->GetCurViewId());
pSettings[SC_VIEW_ID].Name = SC_VIEWID;
pSettings[SC_VIEW_ID].Value <<= SC_VIEW + OUString::number(nViewID);
@@ -3667,45 +3632,42 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
pSettings[SC_PAGE_BREAK_PREVIEW].Name = SC_SHOWPAGEBREAKPREVIEW;
pSettings[SC_PAGE_BREAK_PREVIEW].Value <<= bPagebreak;
- if (pOptions)
- {
- pSettings[SC_SHOWZERO].Name = SC_UNO_SHOWZERO;
- pSettings[SC_SHOWZERO].Value <<= pOptions->GetOption( VOPT_NULLVALS );
- pSettings[SC_SHOWNOTES].Name = SC_UNO_SHOWNOTES;
- pSettings[SC_SHOWNOTES].Value <<= pOptions->GetOption( VOPT_NOTES );
- pSettings[SC_SHOWGRID].Name = SC_UNO_SHOWGRID;
- pSettings[SC_SHOWGRID].Value <<= pOptions->GetOption( VOPT_GRID );
- pSettings[SC_GRIDCOLOR].Name = SC_UNO_GRIDCOLOR;
- OUString aColorName;
- Color aColor = pOptions->GetGridColor(&aColorName);
- pSettings[SC_GRIDCOLOR].Value <<= aColor;
- pSettings[SC_SHOWPAGEBR].Name = SC_UNO_SHOWPAGEBR;
- pSettings[SC_SHOWPAGEBR].Value <<= pOptions->GetOption( VOPT_PAGEBREAKS );
- pSettings[SC_COLROWHDR].Name = SC_UNO_COLROWHDR;
- pSettings[SC_COLROWHDR].Value <<= pOptions->GetOption( VOPT_HEADER );
- pSettings[SC_SHEETTABS].Name = SC_UNO_SHEETTABS;
- pSettings[SC_SHEETTABS].Value <<= pOptions->GetOption( VOPT_TABCONTROLS );
- pSettings[SC_OUTLSYMB].Name = SC_UNO_OUTLSYMB;
- pSettings[SC_OUTLSYMB].Value <<= pOptions->GetOption( VOPT_OUTLINER );
- pSettings[SC_VALUE_HIGHLIGHTING].Name = SC_UNO_VALUEHIGH;
- pSettings[SC_VALUE_HIGHLIGHTING].Value <<= pOptions->GetOption( VOPT_SYNTAX );
-
- const ScGridOptions& aGridOpt = pOptions->GetGridOptions();
- pSettings[SC_SNAPTORASTER].Name = SC_UNO_SNAPTORASTER;
- pSettings[SC_SNAPTORASTER].Value <<= aGridOpt.GetUseGridSnap();
- pSettings[SC_RASTERVIS].Name = SC_UNO_RASTERVIS;
- pSettings[SC_RASTERVIS].Value <<= aGridOpt.GetGridVisible();
- pSettings[SC_RASTERRESX].Name = SC_UNO_RASTERRESX;
- pSettings[SC_RASTERRESX].Value <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDrawX() );
- pSettings[SC_RASTERRESY].Name = SC_UNO_RASTERRESY;
- pSettings[SC_RASTERRESY].Value <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDrawY() );
- pSettings[SC_RASTERSUBX].Name = SC_UNO_RASTERSUBX;
- pSettings[SC_RASTERSUBX].Value <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDivisionX() );
- pSettings[SC_RASTERSUBY].Name = SC_UNO_RASTERSUBY;
- pSettings[SC_RASTERSUBY].Value <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDivisionY() );
- pSettings[SC_RASTERSYNC].Name = SC_UNO_RASTERSYNC;
- pSettings[SC_RASTERSYNC].Value <<= aGridOpt.GetSynchronize();
- }
+ pSettings[SC_SHOWZERO].Name = SC_UNO_SHOWZERO;
+ pSettings[SC_SHOWZERO].Value <<= maOptions.GetOption(VOPT_NULLVALS);
+ pSettings[SC_SHOWNOTES].Name = SC_UNO_SHOWNOTES;
+ pSettings[SC_SHOWNOTES].Value <<= maOptions.GetOption(VOPT_NOTES);
+ pSettings[SC_SHOWGRID].Name = SC_UNO_SHOWGRID;
+ pSettings[SC_SHOWGRID].Value <<= maOptions.GetOption(VOPT_GRID);
+ pSettings[SC_GRIDCOLOR].Name = SC_UNO_GRIDCOLOR;
+ OUString aColorName;
+ Color aColor = maOptions.GetGridColor(&aColorName);
+ pSettings[SC_GRIDCOLOR].Value <<= aColor;
+ pSettings[SC_SHOWPAGEBR].Name = SC_UNO_SHOWPAGEBR;
+ pSettings[SC_SHOWPAGEBR].Value <<= maOptions.GetOption(VOPT_PAGEBREAKS);
+ pSettings[SC_COLROWHDR].Name = SC_UNO_COLROWHDR;
+ pSettings[SC_COLROWHDR].Value <<= maOptions.GetOption(VOPT_HEADER);
+ pSettings[SC_SHEETTABS].Name = SC_UNO_SHEETTABS;
+ pSettings[SC_SHEETTABS].Value <<= maOptions.GetOption(VOPT_TABCONTROLS);
+ pSettings[SC_OUTLSYMB].Name = SC_UNO_OUTLSYMB;
+ pSettings[SC_OUTLSYMB].Value <<= maOptions.GetOption(VOPT_OUTLINER);
+ pSettings[SC_VALUE_HIGHLIGHTING].Name = SC_UNO_VALUEHIGH;
+ pSettings[SC_VALUE_HIGHLIGHTING].Value <<= maOptions.GetOption(VOPT_SYNTAX);
+
+ const ScGridOptions& aGridOpt = maOptions.GetGridOptions();
+ pSettings[SC_SNAPTORASTER].Name = SC_UNO_SNAPTORASTER;
+ pSettings[SC_SNAPTORASTER].Value <<= aGridOpt.GetUseGridSnap();
+ pSettings[SC_RASTERVIS].Name = SC_UNO_RASTERVIS;
+ pSettings[SC_RASTERVIS].Value <<= aGridOpt.GetGridVisible();
+ pSettings[SC_RASTERRESX].Name = SC_UNO_RASTERRESX;
+ pSettings[SC_RASTERRESX].Value <<= static_cast<sal_Int32>(aGridOpt.GetFieldDrawX());
+ pSettings[SC_RASTERRESY].Name = SC_UNO_RASTERRESY;
+ pSettings[SC_RASTERRESY].Value <<= static_cast<sal_Int32>(aGridOpt.GetFieldDrawY());
+ pSettings[SC_RASTERSUBX].Name = SC_UNO_RASTERSUBX;
+ pSettings[SC_RASTERSUBX].Value <<= static_cast<sal_Int32>(aGridOpt.GetFieldDivisionX());
+ pSettings[SC_RASTERSUBY].Name = SC_UNO_RASTERSUBY;
+ pSettings[SC_RASTERSUBY].Value <<= static_cast<sal_Int32>(aGridOpt.GetFieldDivisionY());
+ pSettings[SC_RASTERSYNC].Name = SC_UNO_RASTERSYNC;
+ pSettings[SC_RASTERSYNC].Value <<= aGridOpt.GetSynchronize();
// Common SdrModel processing
GetDocument().GetDrawLayer()->WriteUserDataSequence(rSettings);
@@ -3742,7 +3704,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
{
EnsureTabDataSize(nTab + 1);
if (!maTabData[nTab])
- maTabData[nTab].reset( new ScViewDataTable(pDoc) );
+ maTabData[nTab].reset(new ScViewDataTable(&mrDoc));
bool bHasZoom = false;
maTabData[nTab]->ReadUserDataSequence(aTabSettings, *this, nTab, bHasZoom);
@@ -3797,11 +3759,11 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
else if (sName == SC_SHOWPAGEBREAKPREVIEW)
bPageMode = ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value );
else if ( sName == SC_UNO_SHOWZERO )
- pOptions->SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
+ maOptions.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
else if ( sName == SC_UNO_SHOWNOTES )
- pOptions->SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
+ maOptions.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
else if ( sName == SC_UNO_SHOWGRID )
- pOptions->SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
+ maOptions.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
else if ( sName == SC_UNO_GRIDCOLOR )
{
Color aColor;
@@ -3810,40 +3772,40 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
// #i47435# set automatic grid color explicitly
if( aColor == COL_AUTO )
aColor = SC_STD_GRIDCOLOR;
- pOptions->SetGridColor(aColor, OUString());
+ maOptions.SetGridColor(aColor, OUString());
}
}
else if ( sName == SC_UNO_SHOWPAGEBR )
- pOptions->SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
+ maOptions.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
else if ( sName == SC_UNO_COLROWHDR )
- pOptions->SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
+ maOptions.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
else if ( sName == SC_UNO_SHEETTABS )
- pOptions->SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
+ maOptions.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
else if ( sName == SC_UNO_OUTLSYMB )
- pOptions->SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
+ maOptions.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
else if ( sName == SC_UNO_SHOWOBJ )
{
// #i80528# placeholders not supported anymore
if ( rSetting.Value >>= nTemp16 )
- pOptions->SetObjMode( VOBJ_TYPE_OLE, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW );
+ maOptions.SetObjMode(VOBJ_TYPE_OLE, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW);
}
else if ( sName == SC_UNO_SHOWCHARTS )
{
// #i80528# placeholders not supported anymore
if ( rSetting.Value >>= nTemp16 )
- pOptions->SetObjMode( VOBJ_TYPE_CHART, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW );
+ maOptions.SetObjMode(VOBJ_TYPE_CHART, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW);
}
else if ( sName == SC_UNO_SHOWDRAW )
{
// #i80528# placeholders not supported anymore
if ( rSetting.Value >>= nTemp16 )
- pOptions->SetObjMode( VOBJ_TYPE_DRAW, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW );
+ maOptions.SetObjMode(VOBJ_TYPE_DRAW, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW);
}
else if ( sName.compareToAscii( SC_UNO_VALUEHIGH ) == 0 )
- pOptions->SetOption( VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
+ maOptions.SetOption(VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
else
{
- ScGridOptions aGridOpt(pOptions->GetGridOptions());
+ ScGridOptions aGridOpt(maOptions.GetGridOptions());
if ( sName == SC_UNO_SNAPTORASTER )
aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
else if ( sName == SC_UNO_RASTERVIS )
@@ -3861,7 +3823,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
// Fallback to common SdrModel processing
else GetDocument().GetDrawLayer()->ReadUserDataSequenceValue(&rSetting);
- pOptions->SetGridOptions(aGridOpt);
+ maOptions.SetGridOptions(aGridOpt);
}
}
@@ -3880,7 +3842,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
SetPagebreakMode( bPageMode );
// #i47426# write view options to document, needed e.g. for Excel export
- pDoc->SetViewOptions( *pOptions );
+ mrDoc.SetViewOptions(maOptions);
if (comphelper::LibreOfficeKit::isActive())
DeriveLOKFreezeAllSheets();
@@ -3889,14 +3851,14 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
void ScViewData::SetOptions( const ScViewOptions& rOpt )
{
// if visibility of horizontal ScrollBar is changed, TabBar may have to be resized...
- bool bHScrollChanged = ( rOpt.GetOption(VOPT_HSCROLL) != pOptions->GetOption(VOPT_HSCROLL) );
+ bool bHScrollChanged = (rOpt.GetOption(VOPT_HSCROLL) != maOptions.GetOption(VOPT_HSCROLL));
// if graphics are turned on or off, animation has to be started or stopped
// graphics are controlled by VOBJ_TYPE_OLE
- bool bGraphicsChanged = ( pOptions->GetObjMode(VOBJ_TYPE_OLE) !=
+ bool bGraphicsChanged = (maOptions.GetObjMode(VOBJ_TYPE_OLE) !=
rOpt.GetObjMode(VOBJ_TYPE_OLE) );
- *pOptions = rOpt;
+ maOptions = rOpt;
OSL_ENSURE( pView, "No View" );
if( pView )
@@ -3913,8 +3875,8 @@ Point ScViewData::GetMousePosPixel()
void ScViewData::UpdateInputHandler( bool bForce )
{
- if (pViewShell)
- pViewShell->UpdateInputHandler( bForce );
+ if (pView)
+ pView->UpdateInputHandler(bForce);
}
bool ScViewData::IsOle() const
@@ -4117,7 +4079,7 @@ void ScViewData::AddPixelsWhileBackward( long & rScrY, long nEndPixels,
SCCOLROW ScViewData::GetLOKSheetFreezeIndex(bool bIsCol) const
{
- SCCOLROW nFreezeIndex = bIsCol ? pDoc->GetLOKFreezeCol(nTabNo) : pDoc->GetLOKFreezeRow(nTabNo);
+ SCCOLROW nFreezeIndex = bIsCol ? mrDoc.GetLOKFreezeCol(nTabNo) : mrDoc.GetLOKFreezeRow(nTabNo);
return nFreezeIndex >= 0 ? nFreezeIndex : 0;
}
@@ -4133,9 +4095,8 @@ bool ScViewData::SetLOKSheetFreezeIndex(const SCCOLROW nFreezeIndex, bool bIsCol
return false;
}
- return bIsCol ?
- pDoc->SetLOKFreezeCol(static_cast<SCCOL>(nFreezeIndex), nForTab) :
- pDoc->SetLOKFreezeRow(static_cast<SCROW>(nFreezeIndex), nForTab);
+ return bIsCol ? mrDoc.SetLOKFreezeCol(static_cast<SCCOL>(nFreezeIndex), nForTab)
+ : mrDoc.SetLOKFreezeRow(static_cast<SCROW>(nFreezeIndex), nForTab);
}
bool ScViewData::RemoveLOKFreeze()
@@ -4166,8 +4127,8 @@ void ScViewData::DeriveLOKFreezeIfNeeded(SCTAB nForTab)
bool bConvertToFreezeX = false;
bool bConvertToFreezeY = false;
- SCCOL nFreezeCol = pDoc->GetLOKFreezeCol(nForTab);
- SCROW nFreezeRow = pDoc->GetLOKFreezeRow(nForTab);
+ SCCOL nFreezeCol = mrDoc.GetLOKFreezeCol(nForTab);
+ SCROW nFreezeRow = mrDoc.GetLOKFreezeRow(nForTab);
if (nFreezeCol == -1)
{
@@ -4206,16 +4167,16 @@ void ScViewData::DeriveLOKFreezeIfNeeded(SCTAB nForTab)
nFreezeRow = nRow;
}
- pDoc->SetLOKFreezeCol(nFreezeCol, nForTab);
- pDoc->SetLOKFreezeRow(nFreezeRow, nForTab);
+ mrDoc.SetLOKFreezeCol(nFreezeCol, nForTab);
+ mrDoc.SetLOKFreezeRow(nFreezeRow, nForTab);
}
void ScViewData::OverrideWithLOKFreeze(ScSplitMode& eExHSplitMode, ScSplitMode& eExVSplitMode,
SCCOL& nExFixPosX, SCROW& nExFixPosY,
long& nExHSplitPos, long& nExVSplitPos, SCTAB nForTab) const
{
- SCCOL nFreezeCol = pDoc->GetLOKFreezeCol(nForTab);
- SCROW nFreezeRow = pDoc->GetLOKFreezeRow(nForTab);
+ SCCOL nFreezeCol = mrDoc.GetLOKFreezeCol(nForTab);
+ SCROW nFreezeRow = mrDoc.GetLOKFreezeRow(nForTab);
bool bConvertToScrPosX = false;
bool bConvertToScrPosY = false;
More information about the Libreoffice-commits
mailing list