diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-10 19:58:32 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-11 10:15:30 +0100 |
commit | c43d66e94e730299b5f1c9f924db7e33fbbc166d (patch) | |
tree | 9cdf0719782f87620ca87aa2222561dc88e0dfc0 /sc | |
parent | 5adc93a9a9426ef79054751be2904896f787a8a2 (diff) |
ScFormatShell::pViewData is never null
Change-Id: I29831bae8656aea014dd278c5ee87eb5f9af8db5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109062
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/formatsh.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/unoobj/viewuno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 118 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 274 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 137 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh3.cxx | 62 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh4.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 126 |
8 files changed, 371 insertions, 374 deletions
diff --git a/sc/source/ui/inc/formatsh.hxx b/sc/source/ui/inc/formatsh.hxx index ad1c55b506b6..ced5663ee341 100644 --- a/sc/source/ui/inc/formatsh.hxx +++ b/sc/source/ui/inc/formatsh.hxx @@ -29,11 +29,11 @@ enum class SvNumFormatType : sal_Int16; class ScFormatShell: public SfxShell { - ScViewData* pViewData; + ScViewData& rViewData; protected: - ScViewData* GetViewData(){return pViewData;} - const ScViewData* GetViewData() const {return pViewData;} + ScViewData& GetViewData() { return rViewData; } + const ScViewData& GetViewData() const { return rViewData; } public: SFX_DECL_INTERFACE(SCID_FORMAT_SHELL) @@ -43,7 +43,7 @@ private: static void InitInterface_Impl(); public: - ScFormatShell(ScViewData* pData); + ScFormatShell(ScViewData& rData); virtual ~ScFormatShell() override; void ExecuteNumFormat( SfxRequest& rReq ); diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 5390a7d0b903..957370396254 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -1648,7 +1648,7 @@ void ScTabViewObj::SelectionChanged() // Note: executing this slot through the dispatcher // will cause the style dialog to be raised so we go // direct here - ScFormatShell aShell( &GetViewShell()->GetViewData() ); + ScFormatShell aShell( GetViewShell()->GetViewData() ); SfxAllItemSet reqList( SfxGetpApp()->GetPool() ); SfxRequest aReq( SID_STYLE_END_PREVIEW, SfxCallMode::SLOT, reqList ); aShell.ExecuteStyle( aReq ); diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index cd46db595914..f4194d3b4706 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -70,7 +70,7 @@ void ScCellShell::InitInterface_Impl() } ScCellShell::ScCellShell(ScViewData& rData, const VclPtr<vcl::Window>& frameWin) : - ScFormatShell(&rData), + ScFormatShell(rData), pImpl( new CellShell_Impl() ), bPastePossible(false), pFrameWin(frameWin) @@ -83,7 +83,7 @@ ScCellShell::~ScCellShell() { if ( pImpl->m_xClipEvtLstnr.is() ) { - pImpl->m_xClipEvtLstnr->RemoveListener( GetViewData()->GetActiveWin() ); + pImpl->m_xClipEvtLstnr->RemoveListener( GetViewData().GetActiveWin() ); // The listener may just now be waiting for the SolarMutex and call the link // afterwards, in spite of RemoveListener. So the link has to be reset, too. @@ -98,15 +98,15 @@ ScCellShell::~ScCellShell() void ScCellShell::GetBlockState( SfxItemSet& rSet ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); ScRange aMarkRange; - ScMarkType eMarkType = GetViewData()->GetSimpleArea( aMarkRange ); + ScMarkType eMarkType = GetViewData().GetSimpleArea( aMarkRange ); bool bSimpleArea = (eMarkType == SC_MARK_SIMPLE); bool bOnlyNotBecauseOfMatrix; bool bEditable = pTabViewShell->SelectionEditable( &bOnlyNotBecauseOfMatrix ); - ScDocument& rDoc = GetViewData()->GetDocument(); - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument& rDoc = GetViewData().GetDocument(); + ScDocShell* pDocShell = GetViewData().GetDocShell(); + ScMarkData& rMark = GetViewData().GetMarkData(); SCCOL nCol1, nCol2; SCROW nRow1, nRow2; nCol1 = aMarkRange.aStart.Col(); @@ -125,7 +125,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) case FID_FILL_TO_BOTTOM: // fill to top / bottom { bDisable = !bSimpleArea || (nRow1 == 0 && nRow2 == 0); - if (!bDisable && GetViewData()->SelectionForbidsCellFill()) + if (!bDisable && GetViewData().SelectionForbidsCellFill()) bDisable = true; if ( !bDisable && bEditable ) { // do not damage matrix @@ -137,7 +137,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) case FID_FILL_TO_TOP: { bDisable = (!bSimpleArea) || (nRow1 == rDoc.MaxRow() && nRow2 == rDoc.MaxRow()); - if (!bDisable && GetViewData()->SelectionForbidsCellFill()) + if (!bDisable && GetViewData().SelectionForbidsCellFill()) bDisable = true; if ( !bDisable && bEditable ) { // do not damage matrix @@ -149,7 +149,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) case FID_FILL_TO_RIGHT: // fill to left / right { bDisable = !bSimpleArea || (nCol1 == 0 && nCol2 == 0); - if (!bDisable && GetViewData()->SelectionForbidsCellFill()) + if (!bDisable && GetViewData().SelectionForbidsCellFill()) bDisable = true; if ( !bDisable && bEditable ) { // do not damage matrix @@ -161,7 +161,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) case FID_FILL_TO_LEFT: { bDisable = (!bSimpleArea) || (nCol1 == rDoc.MaxCol() && nCol2 == rDoc.MaxCol()); - if (!bDisable && GetViewData()->SelectionForbidsCellFill()) + if (!bDisable && GetViewData().SelectionForbidsCellFill()) bDisable = true; if ( !bDisable && bEditable ) { // do not damage matrix @@ -172,7 +172,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) break; case SID_RANDOM_NUMBER_GENERATOR_DIALOG: - bDisable = !bSimpleArea || GetViewData()->SelectionForbidsCellFill(); + bDisable = !bSimpleArea || GetViewData().SelectionForbidsCellFill(); break; case SID_SAMPLING_DIALOG: case SID_DESCRIPTIVE_STATISTICS_DIALOG: @@ -191,7 +191,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) else bDisable = (!bSimpleArea) || (nCol1 == nCol2 && nRow1 == nRow2); - if (!bDisable && GetViewData()->SelectionForbidsCellFill()) + if (!bDisable && GetViewData().SelectionForbidsCellFill()) bDisable = true; if ( !bDisable && bEditable && nWhich == FID_FILL_SERIES ) @@ -223,7 +223,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) case SID_PASTE_ONLY_TEXT: case SID_PASTE_ONLY_FORMULA: case SID_PASTE_TEXTIMPORT_DIALOG: - bDisable = GetViewData()->SelectionForbidsCellFill(); + bDisable = GetViewData().SelectionForbidsCellFill(); break; case FID_INS_ROW: @@ -234,7 +234,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) if (nWhich == FID_INS_ROWS_AFTER) eAction = sc::ColRowEditAction::InsertRowsAfter; - bDisable = (!bSimpleArea) || GetViewData()->SimpleColMarked(); + bDisable = (!bSimpleArea) || GetViewData().SimpleColMarked(); if (!bEditable && nCol1 == 0 && nCol2 == rDoc.MaxCol()) { // See if row insertions are allowed. @@ -243,7 +243,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) break; } case FID_INS_CELLSDOWN: - bDisable = (!bSimpleArea) || GetViewData()->SimpleColMarked(); + bDisable = (!bSimpleArea) || GetViewData().SimpleColMarked(); break; case FID_INS_COLUMN: @@ -254,7 +254,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) if (nWhich == FID_INS_COLUMNS_AFTER) eAction = sc::ColRowEditAction::InsertColumnsAfter; - bDisable = (!bSimpleArea) || GetViewData()->SimpleRowMarked(); + bDisable = (!bSimpleArea) || GetViewData().SimpleRowMarked(); if (!bEditable && nRow1 == 0 && nRow2 == rDoc.MaxRow()) { // See if row insertions are allowed. @@ -263,7 +263,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) break; } case FID_INS_CELLSRIGHT: - bDisable = (!bSimpleArea) || GetViewData()->SimpleRowMarked(); + bDisable = (!bSimpleArea) || GetViewData().SimpleRowMarked(); break; case SID_COPY: // copy @@ -301,7 +301,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) case SID_TRANSLITERATE_FULLWIDTH: case SID_TRANSLITERATE_HIRAGANA: case SID_TRANSLITERATE_KATAKANA: - ScViewUtil::HideDisabledSlot( rSet, GetViewData()->GetBindings(), nWhich ); + ScViewUtil::HideDisabledSlot( rSet, GetViewData().GetBindings(), nWhich ); break; case SID_CONVERT_FORMULA_TO_VALUE: { @@ -330,10 +330,10 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) void ScCellShell::GetCellState( SfxItemSet& rSet ) { - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - ScDocument& rDoc = GetViewData()->GetDocShell()->GetDocument(); - ScAddress aCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ); + ScDocShell* pDocShell = GetViewData().GetDocShell(); + ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument(); + ScAddress aCursor( GetViewData().GetCurX(), GetViewData().GetCurY(), + GetViewData().GetTabNo() ); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); while ( nWhich ) @@ -356,7 +356,7 @@ void ScCellShell::GetCellState( SfxItemSet& rSet ) break; case SID_OPENDLG_FUNCTION: { - ScMarkData aMarkData = GetViewData()->GetMarkData(); + ScMarkData aMarkData = GetViewData().GetMarkData(); aMarkData.MarkToSimple(); ScRange aRange; aMarkData.GetMarkArea(aRange); @@ -374,7 +374,7 @@ void ScCellShell::GetCellState( SfxItemSet& rSet ) break; case SID_INSERT_POSTIT: { - ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ); if( rDoc.GetNote(aPos) ) { bDisable = true; @@ -391,7 +391,7 @@ void ScCellShell::GetCellState( SfxItemSet& rSet ) break; case SID_EDIT_POSTIT: { - ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ); bDisable = rDoc.GetNote(aPos) == nullptr; } break; @@ -442,7 +442,7 @@ static bool lcl_TestFormat( SvxClipboardFormatItem& rFormats, const Transferable void ScCellShell::GetPossibleClipboardFormats( SvxClipboardFormatItem& rFormats ) { - vcl::Window* pWin = GetViewData()->GetActiveWin(); + vcl::Window* pWin = GetViewData().GetActiveWin(); bool bDraw = ScDrawTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin)) != nullptr; TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) ); @@ -510,7 +510,7 @@ static bool lcl_IsCellPastePossible( const TransferableDataHelper& rData ) bool ScCellShell::HasClipboardFormat( SotClipboardFormatId nFormatId ) { - vcl::Window* pWin = GetViewData()->GetActiveWin(); + vcl::Window* pWin = GetViewData().GetActiveWin(); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin )); return aDataHelper.HasFormat( nFormatId ); } @@ -519,7 +519,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper, { bPastePossible = lcl_IsCellPastePossible( *pDataHelper ); - SfxBindings& rBindings = GetViewData()->GetBindings(); + SfxBindings& rBindings = GetViewData().GetBindings(); rBindings.Invalidate( SID_PASTE ); rBindings.Invalidate( SID_PASTE_SPECIAL ); rBindings.Invalidate( SID_PASTE_UNFORMATTED ); @@ -587,7 +587,7 @@ void ScCellShell::GetClipState( SfxItemSet& rSet ) { // create listener pImpl->m_xClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScCellShell, ClipboardChanged ) ); - vcl::Window* pWin = GetViewData()->GetActiveWin(); + vcl::Window* pWin = GetViewData().GetActiveWin(); pImpl->m_xClipEvtLstnr->AddListener( pWin ); // get initial state @@ -601,14 +601,14 @@ void ScCellShell::GetClipState( SfxItemSet& rSet ) if (!bDisable) { - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocument& rDoc = GetViewData()->GetDocShell()->GetDocument(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument(); if (!rDoc.IsBlockEditable( nTab, nCol,nRow, nCol,nRow )) bDisable = true; - if (!bDisable && !checkDestRanges(*GetViewData())) + if (!bDisable && !checkDestRanges(GetViewData())) bDisable = true; } @@ -639,7 +639,7 @@ void ScCellShell::GetHLinkState( SfxItemSet& rSet ) // if the cell at the cursor contains only a link, return that link SvxHyperlinkItem aHLinkItem; - if ( !GetViewData()->GetView()->HasBookmarkAtCursor( &aHLinkItem ) ) + if ( !GetViewData().GetView()->HasBookmarkAtCursor( &aHLinkItem ) ) { //! put selected text into item? } @@ -649,14 +649,14 @@ void ScCellShell::GetHLinkState( SfxItemSet& rSet ) void ScCellShell::GetState(SfxItemSet &rSet) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScViewData* pData = GetViewData(); - ScDocument& rDoc = pData->GetDocument(); - ScMarkData& rMark = pData->GetMarkData(); - SCCOL nPosX = pData->GetCurX(); - SCROW nPosY = pData->GetCurY(); - SCTAB nTab = pData->GetTabNo(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScViewData& rData = GetViewData(); + ScDocument& rDoc = rData.GetDocument(); + ScMarkData& rMark = rData.GetMarkData(); + SCCOL nPosX = rData.GetCurX(); + SCROW nPosY = rData.GetCurY(); + SCTAB nTab = rData.GetTabNo(); SCTAB nTabCount = rDoc.GetTableCount(); SCTAB nTabSelCount = rMark.GetSelectCount(); @@ -675,7 +675,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) case SID_RANGE_ADDRESS: { ScRange aRange; - if ( pData->GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) + if ( rData.GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) { OUString aStr(aRange.Format(rDoc, ScRefFlags::VALID | ScRefFlags::TAB_3D)); rSet.Put( SfxStringItem( nWhich, aStr ) ); @@ -758,7 +758,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) case SID_ROWCOL_SELCOUNT: { ScRange aMarkRange; - GetViewData()->GetSimpleArea( aMarkRange ); + GetViewData().GetSimpleArea( aMarkRange ); SCCOL nCol1, nCol2; SCROW nRow1, nRow2; nCol1 = aMarkRange.aStart.Col(); @@ -946,20 +946,20 @@ void ScCellShell::GetState(SfxItemSet &rSet) case SID_OUTLINE_MAKE: { - if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ) ) { //! test for data pilot operation } - else if (rDoc.GetChangeTrack()!=nullptr || GetViewData()->IsMultiMarked()) + else if (rDoc.GetChangeTrack()!=nullptr || GetViewData().IsMultiMarked()) { rSet.DisableItem( nWhich ); } } break; case SID_OUTLINE_SHOW: - if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ) ) { //! test for data pilot operation } @@ -968,8 +968,8 @@ void ScCellShell::GetState(SfxItemSet &rSet) break; case SID_OUTLINE_HIDE: - if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ) ) { //! test for data pilot operation } @@ -979,8 +979,8 @@ void ScCellShell::GetState(SfxItemSet &rSet) case SID_OUTLINE_REMOVE: { - if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ) ) { //! test for data pilot operation } @@ -1055,7 +1055,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) { // Check selection range ScRangeListRef aRangesRef; - pData->GetMultiArea(aRangesRef); + rData.GetMultiArea(aRangesRef); ScRangeList aRanges = *aRangesRef; std::vector<sc::NoteEntry> aNotes; rDoc.GetNotesInRange(aRanges, aNotes); @@ -1156,7 +1156,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) case SID_CHINESE_CONVERSION: case SID_HANGUL_HANJA_CONVERSION: - ScViewUtil::HideDisabledSlot( rSet, pData->GetBindings(), nWhich ); + ScViewUtil::HideDisabledSlot( rSet, rData.GetBindings(), nWhich ); break; case FID_USE_NAME: @@ -1166,7 +1166,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) else { ScRange aRange; - if ( pData->GetSimpleArea( aRange ) != SC_MARK_SIMPLE ) + if ( rData.GetSimpleArea( aRange ) != SC_MARK_SIMPLE ) rSet.DisableItem( nWhich ); } } @@ -1198,7 +1198,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) case SID_SPELL_DIALOG: { - if ( pData && rDoc.IsTabProtected( pData->GetTabNo() ) ) + if (rDoc.IsTabProtected(rData.GetTabNo())) { bool bVisible = false; SfxViewFrame* pViewFrame = ( pTabViewShell ? pTabViewShell->GetViewFrame() : nullptr ); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 75f2e670ae91..89f2434e68ea 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -171,7 +171,7 @@ void SetTabNoAndCursor( const ScViewData* rViewData, const OUString& rCellId ) void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { ScModule* pScMod = SC_MOD(); - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings(); const SfxItemSet* pReqArgs = rReq.GetArgs(); sal_uInt16 nSlot = rReq.GetSlot(); @@ -179,7 +179,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox // finish input - if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) ) + if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) ) { switch ( nSlot ) { @@ -273,13 +273,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else { - if ( GetViewData()->SimpleColMarked() ) + if ( GetViewData().SimpleColMarked() ) eCmd = INS_INSCOLS_BEFORE; - else if ( GetViewData()->SimpleRowMarked() ) + else if ( GetViewData().SimpleRowMarked() ) eCmd = INS_INSROWS_BEFORE; else { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); bool bTheFlag=(rDoc.GetChangeTrack()!=nullptr); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); @@ -340,16 +340,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else { - if ( GetViewData()->SimpleColMarked() ) + if ( GetViewData().SimpleColMarked() ) eCmd = DelCellCmd::Cols; - else if ( GetViewData()->SimpleRowMarked() ) + else if ( GetViewData().SimpleRowMarked() ) eCmd = DelCellCmd::Rows; else { ScRange aRange; - ScDocument& rDoc = GetViewData()->GetDocument(); - bool bTheFlag=GetViewData()->IsMultiMarked() || - (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE_FILTERED) || + ScDocument& rDoc = GetViewData().GetDocument(); + bool bTheFlag=GetViewData().IsMultiMarked() || + (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE_FILTERED) || (rDoc.GetChangeTrack() != nullptr); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); @@ -416,8 +416,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScopedVclPtr<AbstractScDeleteContentsDlg> pDlg(pFact->CreateScDeleteContentsDlg(pTabViewShell->GetFrameWeld())); - ScDocument& rDoc = GetViewData()->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocument& rDoc = GetViewData().GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); if ( rDoc.IsTabProtected(nTab) ) pDlg->DisableObjects(); if (pDlg->Execute() == RET_OK) @@ -518,7 +518,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case FID_FILL_SERIES: { - if (GetViewData()->SelectionForbidsCellFill()) + if (GetViewData().SelectionForbidsCellFill()) // Slot should be already disabled, but in case it wasn't // don't even attempt to do the evaluation and popup a // dialog. @@ -539,7 +539,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) double fMaxVal = MAXDOUBLE; bool bDoIt = false; - GetViewData()->GetSimpleArea( nStartCol, nStartRow, nStartTab, + GetViewData().GetSimpleArea( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ); if( nStartCol!=nEndCol ) @@ -554,7 +554,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) eFillDir=FILL_TO_BOTTOM; } - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); if( pReqArgs ) @@ -803,10 +803,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) SCCOL nEndCol; SCROW nEndRow; - GetViewData()->GetFillData( nStartCol, nStartRow, nEndCol, nEndRow ); - SCCOL nFillCol = GetViewData()->GetRefEndX(); - SCROW nFillRow = GetViewData()->GetRefEndY(); - ScDocument& rDoc = GetViewData()->GetDocument(); + GetViewData().GetFillData( nStartCol, nStartRow, nEndCol, nEndRow ); + SCCOL nFillCol = GetViewData().GetRefEndX(); + SCROW nFillRow = GetViewData().GetRefEndY(); + ScDocument& rDoc = GetViewData().GetDocument(); if( pReqArgs != nullptr ) { @@ -825,7 +825,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } SCTAB nStartTab, nEndTab; - GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab, + GetViewData().GetSimpleArea( nStartCol,nStartRow,nStartTab, nEndCol,nEndRow,nEndTab ); } else // call via mouse @@ -836,9 +836,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { SCCOL nMergeCol = nStartCol; SCROW nMergeRow = nStartRow; - if ( GetViewData()->GetDocument().ExtendMerge( + if ( GetViewData().GetDocument().ExtendMerge( nStartCol, nStartRow, nMergeCol, nMergeRow, - GetViewData()->GetTabNo() ) ) + GetViewData().GetTabNo() ) ) { if ( nFillCol >= nStartCol && nFillCol <= nMergeCol && nFillRow == nStartRow ) nFillCol = nStartCol; @@ -1058,8 +1058,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) // SID_AUTO_OUTLINE, SID_OUTLINE_DELETEALL in Execute (in docsh.idl) case SID_OUTLINE_HIDE: - if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ) ) pTabViewShell->SetDataPilotDetails( false ); else pTabViewShell->HideMarkedOutlines(); @@ -1068,8 +1068,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_OUTLINE_SHOW: { - ScDPObject* pDPObj = GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); if ( pDPObj ) { Sequence<sheet::DataPilotFieldFilter> aFilters; @@ -1087,7 +1087,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else if ( !pDPObj->IsServiceData() && pDPObj->GetDataFieldPositionData( - ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ), + ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ), aFilters ) ) pTabViewShell->ShowDataPilotSourceData( *pDPObj, aFilters ); else @@ -1104,8 +1104,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) bool bColumns = false; bool bOk = true; - if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ) ) { ScDPNumGroupInfo aNumInfo; aNumInfo.mbEnable = true; @@ -1115,7 +1115,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( pTabViewShell->HasSelectionForDateGroup( aNumInfo, nParts ) ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - const Date& rNullDate( GetViewData()->GetDocument().GetFormatTable()->GetNullDate() ); + const Date& rNullDate( GetViewData().GetDocument().GetFormatTable()->GetNullDate() ); ScopedVclPtr<AbstractScDPDateGroupDlg> pDlg( pFact->CreateScDPDateGroupDlg( pTabViewShell->GetFrameWeld(), aNumInfo, nParts, rNullDate ) ); @@ -1157,9 +1157,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else // Dialog, when not whole rows/columns are marked { - if ( GetViewData()->SimpleColMarked() && !GetViewData()->SimpleRowMarked() ) + if ( GetViewData().SimpleColMarked() && !GetViewData().SimpleRowMarked() ) bColumns = true; - else if ( !GetViewData()->SimpleColMarked() && GetViewData()->SimpleRowMarked() ) + else if ( !GetViewData().SimpleColMarked() && GetViewData().SimpleRowMarked() ) bColumns = false; else { @@ -1200,8 +1200,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) bool bColumns = false; bool bOk = true; - if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ) ) { pTabViewShell->UngroupDataPilot(); bOk = false; @@ -1272,10 +1272,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_COPY: // for graphs in DrawShell { - weld::WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData().GetDialogParent() ); pTabViewShell->CopyToClip( nullptr, false, false, true ); rReq.Done(); - GetViewData()->SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border ); + GetViewData().SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border ); pTabViewShell->ShowCursor(); pTabViewShell->UpdateCopySourceOverlay(); } @@ -1283,10 +1283,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_CUT: // for graphs in DrawShell { - weld::WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData().GetDialogParent() ); pTabViewShell->CutToClip(); rReq.Done(); - GetViewData()->SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border ); + GetViewData().SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border ); pTabViewShell->ShowCursor(); pTabViewShell->UpdateCopySourceOverlay(); } @@ -1294,14 +1294,14 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_PASTE: { - ScClipUtil::PasteFromClipboard ( GetViewData(), pTabViewShell, true ); + ScClipUtil::PasteFromClipboard( &GetViewData(), pTabViewShell, true ); rReq.Done(); } break; case SID_CLIPBOARD_FORMAT_ITEMS: { - weld::WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData().GetDialogParent() ); SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; const SfxPoolItem* pItem; @@ -1311,7 +1311,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( nFormat != SotClipboardFormatId::NONE ) { - css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(ScTabViewShell::GetClipData(GetViewData()->GetActiveWin())); + css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(ScTabViewShell::GetClipData(GetViewData().GetActiveWin())); bool bCells = ( ScTransferObj::GetOwnClipboard(xTransferable) != nullptr ); bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(xTransferable) != nullptr ); bool bOle = ( nFormat == SotClipboardFormatId::EMBED_SOURCE ); @@ -1333,10 +1333,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case FID_INS_CELL_CONTENTS: { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); bool bOtherDoc = !rDoc.IsClipboardSource(); // keep a reference in case the clipboard is changed during dialog or PasteFromClip - const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData()->GetActiveWin())); + const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData().GetActiveWin())); if ( pOwnClip ) { InsertDeleteFlags nFlags = InsertDeleteFlags::NONE; @@ -1386,8 +1386,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) // fdo#56098 disable shift if necessary if (!bOtherDoc) { - ScViewData* pData = GetViewData(); - if ( pData->GetMarkData().GetTableSelect( pData->GetTabNo() ) ) + ScViewData& rData = GetViewData(); + if ( rData.GetMarkData().GetTableSelect( rData.GetTabNo() ) ) { SCCOL nStartX, nEndX, nClipStartX, nClipSizeX, nRangeSizeX; SCROW nStartY, nEndY, nClipStartY, nClipSizeY, nRangeSizeY; @@ -1395,15 +1395,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pOwnClip->GetDocument()->GetClipStart( nClipStartX, nClipStartY ); pOwnClip->GetDocument()->GetClipArea( nClipSizeX, nClipSizeY, true ); - if ( pData->GetSimpleArea( nStartX, nStartY, nStartTab, + if ( rData.GetSimpleArea( nStartX, nStartY, nStartTab, nEndX, nEndY, nEndTab ) != SC_MARK_SIMPLE || nStartTab != nEndTab ) { // the destination is not a simple range, // assume the destination as the current cell - nStartX = nEndX = pData->GetCurX(); - nStartY = nEndY = pData->GetCurY(); - nStartTab = pData->GetTabNo(); + nStartX = nEndX = rData.GetCurX(); + nStartY = nEndY = rData.GetCurY(); + nStartTab = rData.GetTabNo(); } // we now have clip- and range dimensions // the size of the destination area is the larger of the two @@ -1427,13 +1427,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) CellShiftDisabledFlags nDisableShiftY = CellShiftDisabledFlags::NONE; //check if horizontal shift will fit - if ( !pData->GetDocument().IsBlockEmpty( nStartTab, + if ( !rData.GetDocument().IsBlockEmpty( nStartTab, rDoc.MaxCol() - nRangeSizeX, nStartY, rDoc.MaxCol(), nStartY + nRangeSizeY ) ) nDisableShiftX = CellShiftDisabledFlags::Right; //check if vertical shift will fit - if ( !pData->GetDocument().IsBlockEmpty( nStartTab, + if ( !rData.GetDocument().IsBlockEmpty( nStartTab, nStartX, rDoc.MaxRow() - nRangeSizeY, nStartX + nRangeSizeX, rDoc.MaxRow() ) ) nDisableShiftY = CellShiftDisabledFlags::Down; @@ -1460,7 +1460,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( nFlags != InsertDeleteFlags::NONE ) { { - weld::WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData().GetDialogParent() ); if ( bAsLink && bOtherDoc ) pTabViewShell->PasteFromSystem(SotClipboardFormatId::LINK); // DDE insert else @@ -1492,7 +1492,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_PASTE_ONLY_TEXT: case SID_PASTE_ONLY_FORMULA: { - if ( ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData()->GetActiveWin())) ) // own cell data + if ( ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData().GetActiveWin())) ) // own cell data { rReq.SetSlot( FID_INS_CELL_CONTENTS ); OUString aFlags; @@ -1513,7 +1513,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } case SID_PASTE_TEXTIMPORT_DIALOG: { - vcl::Window* pWin = GetViewData()->GetActiveWin(); + vcl::Window* pWin = GetViewData().GetActiveWin(); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard(pWin)); const uno::Reference<datatransfer::XTransferable>& xTransferable @@ -1533,18 +1533,18 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScRange aRange; SCCOL nPosX = 0; SCROW nPosY = 0; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { nPosX = aRange.aStart.Col(); nPosY = aRange.aStart.Row(); } else { - nPosX = GetViewData()->GetCurX(); - nPosY = GetViewData()->GetCurY(); + nPosX = GetViewData().GetCurX(); + nPosY = GetViewData().GetCurY(); } - ScAddress aCellPos(nPosX, nPosY, GetViewData()->GetTabNo()); - auto pObj = std::make_shared<ScImportExport>(GetViewData()->GetDocument(), aCellPos); + ScAddress aCellPos(nPosX, nPosY, GetViewData().GetTabNo()); + auto pObj = std::make_shared<ScImportExport>(GetViewData().GetDocument(), aCellPos); pObj->SetOverwriting(true); if (pDlg->Execute()) { ScAsciiOptions aOptions; @@ -1569,7 +1569,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) // differentiate between own cell data and draw objects/external data // this makes FID_INS_CELL_CONTENTS superfluous { - vcl::Window* pWin = GetViewData()->GetActiveWin(); + vcl::Window* pWin = GetViewData().GetActiveWin(); css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(ScTabViewShell::GetClipData(pWin)); // Clipboard-ID given as parameter? Basic "PasteSpecial(Format)" @@ -1581,7 +1581,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) SotClipboardFormatId nFormat = static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()); bool bRet=true; { - weld::WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData().GetDialogParent() ); bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(xTransferable) != nullptr ); if ( bDraw && nFormat == SotClipboardFormatId::EMBED_SOURCE ) pTabViewShell->PasteDraw(); @@ -1642,7 +1642,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if (nFormat != SotClipboardFormatId::NONE) { { - weld::WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData().GetDialogParent() ); if ( bDraw && nFormat == SotClipboardFormatId::EMBED_SOURCE ) pTabViewShell->PasteDraw(); else @@ -1670,7 +1670,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) // differentiate between own cell data and draw objects/external data // this makes FID_INS_CELL_CONTENTS superfluous { - weld::WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData().GetDialogParent() ); // we should differentiate between SotClipboardFormatId::STRING and SotClipboardFormatId::STRING_TSVC, // and paste the SotClipboardFormatId::STRING_TSVC if it is available. @@ -1901,7 +1901,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) static_cast<const ScConsolidateItem*>(pItem)->GetData(); pTabViewShell->Consolidate( rParam ); - GetViewData()->GetDocument().SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam>(new ScConsolidateParam(rParam)) ); + GetViewData().GetDocument().SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam>(new ScConsolidateParam(rParam)) ); rReq.Done(); } @@ -2010,17 +2010,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } ScRangeList aRangeList; - ScViewData* pData = GetViewData(); - pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false); + ScViewData& rData = GetViewData(); + rData.GetMarkData().FillRangeListWithMarks(&aRangeList, false); - ScDocument& rDoc = GetViewData()->GetDocument(); - if(rDoc.IsTabProtected(pData->GetTabNo())) + ScDocument& rDoc = GetViewData().GetDocument(); + if(rDoc.IsTabProtected(rData.GetTabNo())) { pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED ); break; } - ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo()); + ScAddress aPos(rData.GetCurX(), rData.GetCurY(), rData.GetTabNo()); if(aRangeList.empty()) { aRangeList.push_back(ScRange(aPos)); @@ -2080,7 +2080,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pFormat->AddEntry(pEntry); // use the new conditional formatting - GetViewData()->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nIndex, std::move(pFormat), aPos.Tab(), aRangeList); + GetViewData().GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nIndex, std::move(pFormat), aPos.Tab(), aRangeList); break; } @@ -2109,7 +2109,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) else { // Queue message to open Conditional Format Manager Dialog. - GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT_MANAGER, SfxCallMode::ASYNCHRON ); + GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT_MANAGER, SfxCallMode::ASYNCHRON ); break; } } @@ -2226,7 +2226,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractScNamePasteDlg> pDlg(pFact->CreateScNamePasteDlg(pTabViewShell->GetFrameWeld(), GetViewData()->GetDocShell())); + ScopedVclPtr<AbstractScNamePasteDlg> pDlg(pFact->CreateScNamePasteDlg(pTabViewShell->GetFrameWeld(), GetViewData().GetDocShell())); switch( pDlg->Execute() ) { case BTN_PASTE_LIST: @@ -2263,7 +2263,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const SfxStringItem& rTextItem = static_cast<const SfxStringItem&>(pReqArgs->Get( SID_RANGE_NOTETEXT )); // always cursor position - ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ); pTabViewShell->SetNoteText( aPos, rTextItem.GetValue() ); rReq.Done(); } @@ -2287,10 +2287,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if (!aCellId.isEmpty()) { - SetTabNoAndCursor( GetViewData(), aCellId ); + SetTabNoAndCursor( &GetViewData(), aCellId ); } - ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ); pTabViewShell->ReplaceNote( aPos, pTextItem->GetValue(), pAuthorItem ? &pAuthorItem->GetValue() : nullptr, pDateItem ? &pDateItem->GetValue() : nullptr ); @@ -2305,8 +2305,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case FID_NOTE_VISIBLE: { - ScDocument& rDoc = GetViewData()->GetDocument(); - ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDocument& rDoc = GetViewData().GetDocument(); + ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ); if( ScPostIt* pNote = rDoc.GetNote(aPos) ) { bool bShow; @@ -2333,17 +2333,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case FID_SHOW_NOTE: { bool bShowNote = nSlot == FID_SHOW_NOTE; - ScViewData* pData = GetViewData(); - ScDocument& rDoc = pData->GetDocument(); - ScMarkData& rMark = pData->GetMarkData(); + ScViewData& rData = GetViewData(); + ScDocument& rDoc = rData.GetDocument(); + ScMarkData& rMark = rData.GetMarkData(); if (!rMark.IsMarked() && !rMark.IsMultiMarked()) { // Check current cell - ScAddress aPos( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() ); + ScAddress aPos( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() ); if( rDoc.GetNote(aPos) ) { - pData->GetDocShell()->GetDocFunc().ShowNote( aPos, bShowNote ); + rData.GetDocShell()->GetDocFunc().ShowNote( aPos, bShowNote ); } } else @@ -2351,11 +2351,11 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) // Check selection range bool bDone = false; ScRangeListRef aRangesRef; - pData->GetMultiArea(aRangesRef); + rData.GetMultiArea(aRangesRef); const ScRangeList aRanges = *aRangesRef; OUString aUndo = ScResId( bShowNote ? STR_UNDO_SHOWNOTE : STR_UNDO_HIDENOTE ); - pData->GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pData->GetViewShell()->GetViewShellId() ); + rData.GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, rData.GetViewShell()->GetViewShellId() ); for (auto const& rTab : rMark.GetSelectedTabs()) { @@ -2375,13 +2375,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const SCTAB nRangeTab = rRange->aStart.Tab(); if (rDoc.IsBlockEditable( nRangeTab, rAdr.Col(), rAdr.Row(), rAdr.Col(), rAdr.Row() )) { - pData->GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote ); + rData.GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote ); bDone = true; } } } - pData->GetDocShell()->GetUndoManager()->LeaveListAction(); + rData.GetDocShell()->GetUndoManager()->LeaveListAction(); if ( bDone ) { @@ -2399,13 +2399,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case FID_HIDE_ALL_NOTES: { bool bShowNote = nSlot == FID_SHOW_ALL_NOTES; - ScViewData* pData = GetViewData(); - ScMarkData& rMark = pData->GetMarkData(); - ScDocument& rDoc = pData->GetDocument(); + ScViewData& rData = GetViewData(); + ScMarkData& rMark = rData.GetMarkData(); + ScDocument& rDoc = rData.GetDocument(); std::vector<sc::NoteEntry> aNotes; OUString aUndo = ScResId( bShowNote ? STR_UNDO_SHOWALLNOTES : STR_UNDO_HIDEALLNOTES ); - pData->GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pData->GetViewShell()->GetViewShellId() ); + rData.GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, rData.GetViewShell()->GetViewShellId() ); for (auto const& rTab : rMark.GetSelectedTabs()) { @@ -2415,18 +2415,18 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) for (const sc::NoteEntry& rNote : aNotes) { const ScAddress& rAdr = rNote.maPos; - pData->GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote ); + rData.GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote ); } - pData->GetDocShell()->GetUndoManager()->LeaveListAction(); + rData.GetDocShell()->GetUndoManager()->LeaveListAction(); } break; case SID_TOGGLE_NOTES: { - ScViewData* pData = GetViewData(); - ScMarkData& rMark = pData->GetMarkData(); - ScDocument& rDoc = pData->GetDocument(); + ScViewData& rData = GetViewData(); + ScMarkData& rMark = rData.GetMarkData(); + ScDocument& rDoc = rData.GetDocument(); ScRangeList aRanges; std::vector<sc::NoteEntry> aNotes; @@ -2438,15 +2438,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) bool bShowNote = (eState == ALLHIDDEN || eState == MIXED); OUString aUndo = ScResId( bShowNote ? STR_UNDO_SHOWALLNOTES : STR_UNDO_HIDEALLNOTES ); - pData->GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pData->GetViewShell()->GetViewShellId() ); + rData.GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, rData.GetViewShell()->GetViewShellId() ); for(const auto& rNote : aNotes) { const ScAddress& rAdr = rNote.maPos; - pData->GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote ); + rData.GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote ); } - pData->GetDocShell()->GetUndoManager()->LeaveListAction(); + rData.GetDocShell()->GetUndoManager()->LeaveListAction(); if (!pReqArgs) rReq.AppendItem( SfxBoolItem( SID_TOGGLE_NOTES, bShowNote ) ); @@ -2466,7 +2466,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const OUString& aCellId = pIdItem->GetValue(); if (!aCellId.isEmpty()) { - SetTabNoAndCursor( GetViewData(), aCellId ); + SetTabNoAndCursor( &GetViewData(), aCellId ); } } @@ -2477,9 +2477,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case FID_DELETE_ALL_NOTES: { - ScViewData* pData = GetViewData(); - ScMarkData& rMark = pData->GetMarkData(); - ScDocument& rDoc = pData->GetDocument(); + ScViewData& rData = GetViewData(); + ScMarkData& rMark = rData.GetMarkData(); + ScDocument& rDoc = rData.GetDocument(); ScMarkData aNewMark(rDoc.GetSheetLimits()); ScRangeList aRangeList; @@ -2489,7 +2489,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } aNewMark.MarkFromRangeList( aRangeList, true ); - pData->GetDocShell()->GetDocFunc().DeleteContents(aNewMark, InsertDeleteFlags::NOTE, true, false ); + rData.GetDocShell()->GetDocFunc().DeleteContents(aNewMark, InsertDeleteFlags::NOTE, true, false ); } break; @@ -2585,16 +2585,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - ScViewData* pData = GetViewData(); - ScDocument& rDoc = pData->GetDocument(); + ScViewData& rData = GetViewData(); + ScDocument& rDoc = rData.GetDocument(); - if (rDoc.IsTabProtected(pData->GetTabNo())) + if (rDoc.IsTabProtected(rData.GetTabNo())) { pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED ); break; } - ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo()); + ScAddress aPos(rData.GetCurX(), rData.GetCurY(), rData.GetTabNo()); ScConditionalFormatList* pList = nullptr; @@ -2615,11 +2615,11 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if (pDlgItem) pDlg->SetModified(); - pDlg->StartExecuteAsync([this, pDlg, pData, pTabViewShell, pDlgItem, aPos](sal_Int32 nRet){ + pDlg->StartExecuteAsync([this, pDlg, &rData, pTabViewShell, pDlgItem, aPos](sal_Int32 nRet){ std::unique_ptr<ScConditionalFormatList> pCondFormatList = pDlg->GetConditionalFormatList(); if(nRet == RET_OK && pDlg->CondFormatsChanged()) { - pData->GetDocShell()->GetDocFunc().SetConditionalFormatList(pCondFormatList.release(), aPos.Tab()); + rData.GetDocShell()->GetDocFunc().SetConditionalFormatList(pCondFormatList.release(), aPos.Tab()); } else if(nRet == DLG_RET_ADD) { @@ -2628,7 +2628,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pTabViewShell->GetPool().Put(ScCondFormatDlgItem( std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), -1, true)); // Queue message to open Conditional Format Dialog - GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON ); + GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON ); } else if (nRet == DLG_RET_EDIT) { @@ -2640,7 +2640,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), nIndex, true)); // Queue message to open Conditional Format Dialog - GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON ); + GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON ); } else pCondFormatList.reset(); @@ -2756,10 +2756,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_SELECT_UNPROTECTED_CELLS: { - ScViewData* pData = GetViewData(); - SCTAB aTab = pData->GetTabNo(); - ScMarkData& rMark = pData->GetMarkData(); - ScDocument& rDoc = pData->GetDocument(); + ScViewData& rData = GetViewData(); + SCTAB aTab = rData.GetTabNo(); + ScMarkData& rMark = rData.GetMarkData(); + ScDocument& rDoc = rData.GetDocument(); ScRangeList rRangeList; rDoc.GetUnprotectedCells(rRangeList, aTab); @@ -2779,7 +2779,7 @@ void ScCellShell::ExecuteTrans( SfxRequest& rReq ) TransliterationFlags nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() ); if ( nType != TransliterationFlags::NONE ) { - GetViewData()->GetView()->TransliterateText( nType ); + GetViewData().GetView()->TransliterateText( nType ); rReq.Done(); } } @@ -2787,7 +2787,7 @@ void ScCellShell::ExecuteTrans( SfxRequest& rReq ) void ScCellShell::ExecuteRotateTrans( const SfxRequest& rReq ) { if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE ) - GetViewData()->GetView()->TransliterateText( m_aRotateCase.getNextMode() ); + GetViewData().GetView()->TransliterateText( m_aRotateCase.getNextMode() ); } void ScCellShell::ExecuteExternalSource( @@ -2799,8 +2799,8 @@ void ScCellShell::ExecuteExternalSource( ScRange aLinkRange; bool bMove = false; - ScViewData* pData = GetViewData(); - ScMarkData& rMark = pData->GetMarkData(); + ScViewData& rData = GetViewData(); + ScMarkData& rMark = rData.GetMarkData(); rMark.MarkToSimple(); if ( rMark.IsMarked() ) { @@ -2808,9 +2808,9 @@ void ScCellShell::ExecuteExternalSource( bMove = true; // insert/delete cells to fit range } else - aLinkRange = ScRange( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() ); + aLinkRange = ScRange( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() ); - pData->GetDocFunc().InsertAreaLink( _rFile, _rFilter, _rOptions, _rSource, + rData.GetDocFunc().InsertAreaLink( _rFile, _rFilter, _rOptions, _rSource, aLinkRange, _nRefresh, bMove, false ); _rRequest.Done(); } @@ -2864,14 +2864,14 @@ void RunPivotLayoutDialog(ScModule* pScMod, void ScCellShell::ExecuteDataPilotDialog() { ScModule* pScMod = SC_MOD(); - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - ScViewData* pData = GetViewData(); - ScDocument& rDoc = pData->GetDocument(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); + ScViewData& rData = GetViewData(); + ScDocument& rDoc = rData.GetDocument(); // ScPivot is no longer used... ScDPObject* pDPObj = rDoc.GetDPAtCursor( - pData->GetCurX(), pData->GetCurY(), - pData->GetTabNo() ); + rData.GetCurX(), rData.GetCurY(), + rData.GetTabNo() ); if ( pDPObj ) // on an existing table? { std::unique_ptr<ScDPObject> pNewDPObject; @@ -2885,13 +2885,13 @@ void ScCellShell::ExecuteDataPilotDialog() { // select database range or data pTabViewShell->GetDBData( true, SC_DB_OLD ); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) pTabViewShell->MarkDataArea( false ); // output to cursor position for non-sheet data - ScAddress aDestPos( pData->GetCurX(), pData->GetCurY(), - pData->GetTabNo() ); + ScAddress aDestPos( rData.GetCurX(), rData.GetCurY(), + rData.GetTabNo() ); // first select type of source data @@ -2992,7 +2992,7 @@ void ScCellShell::ExecuteDataPilotDialog() { //! use database ranges (select before type dialog?) ScRange aRange; - ScMarkType eType = GetViewData()->GetSimpleArea(aRange); + ScMarkType eType = GetViewData().GetSimpleArea(aRange); if ( (eType & SC_MARK_SIMPLE) == SC_MARK_SIMPLE ) { // Shrink the range to the data area. @@ -3063,7 +3063,7 @@ void ScCellShell::ExecuteDataPilotDialog() void ScCellShell::ExecuteXMLSourceDialog() { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); if (!pTabViewShell) return; @@ -3077,7 +3077,7 @@ void ScCellShell::ExecuteXMLSourceDialog() void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); const SfxItemSet* pArgs = rReq.GetArgs(); if ( pArgs ) { @@ -3118,7 +3118,7 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) aSubTotalParam.bIncludePattern = true; } - aArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, GetViewData(), &aSubTotalParam ) ); + aArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, &GetViewData(), &aSubTotalParam ) ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); pDlg.disposeAndReset(pFact->CreateScSubTotalDlg(pTabViewShell->GetFrameWeld(), &aArgSet)); pDlg->SetCurPageId("1stgroup"); @@ -3143,7 +3143,7 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) aSubTotalParam.bRemoveOnly = true; aSubTotalParam.bReplace = true; aArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, - GetViewData(), + &GetViewData(), &aSubTotalParam ) ); } @@ -3151,12 +3151,12 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) rReq.Done( *pOutSet ); } else - GetViewData()->GetDocShell()->CancelAutoDBRange(); + GetViewData().GetDocShell()->CancelAutoDBRange(); } void ScCellShell::ExecuteFillSingleEdit() { - ScAddress aCurPos = GetViewData()->GetCurPos(); + ScAddress aCurPos = GetViewData().GetCurPos(); OUString aInit; @@ -3164,7 +3164,7 @@ void ScCellShell::ExecuteFillSingleEdit() { // Get the initial text value from the above cell. - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); ScAddress aPrevPos = aCurPos; aPrevPos.IncRow(-1); ScRefCellValue aCell(rDoc, aPrevPos); diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 514733f9fb35..b8ba37cc9244 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -69,12 +69,10 @@ using namespace com::sun::star; -static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange, bool bDoEmptyCheckOnly ) +static bool lcl_GetTextToColumnsRange( const ScViewData& rData, ScRange& rRange, bool bDoEmptyCheckOnly ) { - OSL_ENSURE( pData, "lcl_GetTextToColumnsRange: pData is null!" ); - bool bRet = false; - const ScMarkData& rMark = pData->GetMarkData(); + const ScMarkData& rMark = rData.GetMarkData(); if ( rMark.IsMarked() ) { @@ -89,14 +87,14 @@ static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange, } else { - const SCCOL nCol = pData->GetCurX(); - const SCROW nRow = pData->GetCurY(); - const SCTAB nTab = pData->GetTabNo(); + const SCCOL nCol = rData.GetCurX(); + const SCROW nRow = rData.GetCurY(); + const SCTAB nTab = rData.GetTabNo(); rRange = ScRange( nCol, nRow, nTab, nCol, nRow, nTab ); bRet = true; } - const ScDocument& rDoc = pData->GetDocument(); + const ScDocument& rDoc = rData.GetDocument(); if ( bDoEmptyCheckOnly ) { @@ -125,12 +123,12 @@ static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange, return bRet; } -static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortParam ) +static bool lcl_GetSortParam( const ScViewData& rData, const ScSortParam& rSortParam ) { - ScTabViewShell* pTabViewShell = pData->GetViewShell(); + ScTabViewShell* pTabViewShell = rData.GetViewShell(); ScDBData* pDBData = pTabViewShell->GetDBData(); - ScDocument& rDoc = pData->GetDocument(); - SCTAB nTab = pData->GetTabNo(); + ScDocument& rDoc = rData.GetDocument(); + SCTAB nTab = rData.GetTabNo(); ScDirection eFillDir = DIR_TOP; bool bSort = true; ScRange aExternalRange; @@ -158,7 +156,7 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP aExternalRange.PutInOrder(); } else - aExternalRange = ScRange( pData->GetCurX(), pData->GetCurY(), nTab ); + aExternalRange = ScRange( rData.GetCurX(), rData.GetCurY(), nTab ); SCROW nStartRow = aExternalRange.aStart.Row(); SCCOL nStartCol = aExternalRange.aStart.Col(); @@ -196,7 +194,7 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP else { bSort = false; - pData->GetDocShell()->CancelAutoDBRange(); + rData.GetDocShell()->CancelAutoDBRange(); } pTabViewShell->ClearHighlightRanges(); @@ -226,14 +224,14 @@ namespace void ScCellShell::ExecuteDB( SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); sal_uInt16 nSlotId = rReq.GetSlot(); const SfxItemSet* pReqArgs = rReq.GetArgs(); ScModule* pScMod = SC_MOD(); pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox - if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) ) + if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) ) { pScMod->InputEnterHandler(); pTabViewShell->UpdateInputHandler(); @@ -338,7 +336,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) ScRange aRange; pDBData->GetArea(aRange); - GetViewData()->GetDocShell()->RefreshPivotTables(aRange); + GetViewData().GetDocShell()->RefreshPivotTables(aRange); } } rReq.Done(); @@ -375,15 +373,15 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) //the patch comes from maoyg ScSortParam aSortParam; ScDBData* pDBData = pTabViewShell->GetDBData(); - ScViewData* pData = GetViewData(); + ScViewData& rData = GetViewData(); pDBData->GetSortParam( aSortParam ); - if( lcl_GetSortParam( pData, aSortParam ) ) + if( lcl_GetSortParam( rData, aSortParam ) ) { - SCCOL nCol = GetViewData()->GetCurX(); - SCCOL nTab = GetViewData()->GetTabNo(); - ScDocument& rDoc = GetViewData()->GetDocument(); + SCCOL nCol = GetViewData().GetCurX(); + SCCOL nTab = GetViewData().GetTabNo(); + ScDocument& rDoc = GetViewData().GetDocument(); pDBData->GetSortParam( aSortParam ); bool bHasHeader = rDoc.HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab ); @@ -426,16 +424,16 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) { ScSortParam aSortParam; ScDBData* pDBData = pTabViewShell->GetDBData(); - ScViewData* pData = GetViewData(); + ScViewData& rData = GetViewData(); pDBData->GetSortParam( aSortParam ); - if( lcl_GetSortParam( pData, aSortParam ) ) + if( lcl_GetSortParam( rData, aSortParam ) ) { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); pDBData->GetSortParam( aSortParam ); - bool bHasHeader = rDoc.HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() ); + bool bHasHeader = rDoc.HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, rData.GetTabNo() ); if( bHasHeader ) aSortParam.bHasHeader = bHasHeader; @@ -495,28 +493,28 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) { ScSortParam aSortParam; ScDBData* pDBData = pTabViewShell->GetDBData(); - ScViewData* pData = GetViewData(); + ScViewData& rData = GetViewData(); pDBData->GetSortParam( aSortParam ); - if( lcl_GetSortParam( pData, aSortParam ) ) + if( lcl_GetSortParam( rData, aSortParam ) ) { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); SfxItemSet aArgSet( GetPool(), svl::Items<SCITEM_SORTDATA, SCITEM_SORTDATA>{} ); pDBData->GetSortParam( aSortParam ); - bool bHasHeader = rDoc.HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() ); + bool bHasHeader = rDoc.HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, rData.GetTabNo() ); if( bHasHeader ) aSortParam.bHasHeader = bHasHeader; - aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) ); + aArgSet.Put( ScSortItem( SCITEM_SORTDATA, &GetViewData(), &aSortParam ) ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); std::shared_ptr<ScAsyncTabController> pDlg(pFact->CreateScSortDlg(pTabViewShell->GetFrameWeld(), &aArgSet)); pDlg->SetCurPageId("criteria"); // 1=sort field tab 2=sort options tab VclAbstractDialog::AsyncContext aContext; - aContext.maEndDialogFn = [pDlg, pData, pTabViewShell](sal_Int32 nResult) + aContext.maEndDialogFn = [pDlg, &rData, pTabViewShell](sal_Int32 nResult) { if ( nResult == RET_OK ) { @@ -530,7 +528,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } else { - pData->GetDocShell()->CancelAutoDBRange(); + rData.GetDocShell()->CancelAutoDBRange(); } }; @@ -590,8 +588,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) { const ScQueryItem& rQueryItem = static_cast<const ScQueryItem&>(*pItem); - SCTAB nCurTab = GetViewData()->GetTabNo(); - SCTAB nRefTab = GetViewData()->GetRefTabNo(); + SCTAB nCurTab = GetViewData().GetTabNo(); + SCTAB nRefTab = GetViewData().GetRefTabNo(); // If RefInput switched to a different sheet from the data sheet, // switch back: @@ -643,8 +641,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( SCITEM_PIVOTDATA, true, &pItem ) ) { - SCTAB nCurTab = GetViewData()->GetTabNo(); - SCTAB nRefTab = GetViewData()->GetRefTabNo(); + SCTAB nCurTab = GetViewData().GetTabNo(); + SCTAB nRefTab = GetViewData().GetRefTabNo(); // If RefInput switched to a different sheet from the data sheet, // switch back: @@ -699,7 +697,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } else { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); ScDBCollection* pDBCol = rDoc.GetDBCollection(); if ( pDBCol ) @@ -725,8 +723,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) break; case SID_DATA_STREAMS: { - sc::DataStreamDlg aDialog(GetViewData()->GetDocShell(), pTabViewShell->GetFrameWeld()); - ScDocument& rDoc = GetViewData()->GetDocument(); + sc::DataStreamDlg aDialog(GetViewData().GetDocShell(), pTabViewShell->GetFrameWeld()); + ScDocument& rDoc = GetViewData().GetDocument(); sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager(); sc::DataStream* pStrm = rMgr.getDataStream(); if (pStrm) @@ -738,7 +736,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) break; case SID_DATA_STREAMS_PLAY: { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager(); sc::DataStream* pStrm = rMgr.getDataStream(); if (pStrm) @@ -747,7 +745,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) break; case SID_DATA_STREAMS_STOP: { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager(); sc::DataStream* pStrm = rMgr.getDataStream(); if (pStrm) @@ -758,7 +756,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) { auto xDoc = o3tl::make_shared<ScDocument>(); xDoc->InsertTab(0, "test"); - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); ScDataProviderDlg aDialog(pTabViewShell->GetDialogParent(), xDoc, &rDoc); if (aDialog.run() == RET_OK) { @@ -768,7 +766,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) break; case SID_DATA_PROVIDER_REFRESH: { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); auto& rDataMapper = rDoc.GetExternalDataMapper(); for (auto& rDataSource : rDataMapper.getDataSources()) { @@ -802,10 +800,10 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) ScValidErrorStyle eErrStyle = SC_VALERR_STOP; OUString aErrTitle, aErrText; - ScDocument& rDoc = GetViewData()->GetDocument(); - SCCOL nCurX = GetViewData()->GetCurX(); - SCROW nCurY = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocument& rDoc = GetViewData().GetDocument(); + SCCOL nCurX = GetViewData().GetCurX(); + SCROW nCurY = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); ScAddress aCursorPos( nCurX, nCurY, nTab ); sal_uLong nIndex = rDoc.GetAttr( nCurX, nCurY, nTab, ATTR_VALIDDATA )->GetValue(); @@ -849,7 +847,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } // cell range picker - vcl::Window* pWin = GetViewData()->GetActiveWin(); + vcl::Window* pWin = GetViewData().GetActiveWin(); weld::Window* pParentWin = pWin ? pWin->GetFrameWeld() : nullptr; auto xDlg = std::make_shared<ScValidationDlg>(pParentWin, &aArgSet, pTabViewShell); ScValidationRegisteredDlg aRegisterThatDlgExists(pParentWin, xDlg); @@ -957,13 +955,12 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) case SID_TEXT_TO_COLUMNS: { - ScViewData* pData = GetViewData(); - OSL_ENSURE( pData, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pData is null!" ); + ScViewData& rData = GetViewData(); ScRange aRange; - if ( lcl_GetTextToColumnsRange( pData, aRange, false ) ) + if ( lcl_GetTextToColumnsRange( rData, aRange, false ) ) { - ScDocument& rDoc = pData->GetDocument(); + ScDocument& rDoc = rData.GetDocument(); ScImportExport aExport( rDoc, aRange ); aExport.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::None, 0, false ) ); @@ -982,11 +979,11 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pDlg->Execute() == RET_OK ) { - ScDocShell* pDocSh = pData->GetDocShell(); + ScDocShell* pDocSh = rData.GetDocShell(); OSL_ENSURE( pDocSh, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDocSh is null!" ); OUString aUndo = ScResId( STR_UNDO_TEXTTOCOLUMNS ); - pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pData->GetViewShell()->GetViewShellId() ); + pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, rData.GetViewShell()->GetViewShellId() ); ScImportExport aImport( rDoc, aRange.aStart ); ScAsciiOptions aOptions; @@ -1009,13 +1006,13 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) void ScCellShell::GetDBState( SfxItemSet& rSet ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - ScViewData* pData = GetViewData(); - ScDocShell* pDocSh = pData->GetDocShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); + ScViewData& rData = GetViewData(); + ScDocShell* pDocSh = rData.GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); - SCCOL nPosX = pData->GetCurX(); - SCROW nPosY = pData->GetCurY(); - SCTAB nTab = pData->GetTabNo(); + SCCOL nPosX = rData.GetCurX(); + SCROW nPosY = rData.GetCurY(); + SCTAB nTab = rData.GetTabNo(); bool bAutoFilter = false; bool bAutoFilterTested = false; @@ -1052,7 +1049,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) case SID_SPECIAL_FILTER: { ScRange aDummy; - ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy); + ScMarkType eMarkType = GetViewData().GetSimpleArea( aDummy); if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED) { rSet.DisableItem( nWhich ); @@ -1070,7 +1067,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) //! move ReadOnly check to idl flags if ( pDocSh->IsReadOnly() || rDoc.GetChangeTrack()!=nullptr || - GetViewData()->IsMultiMarked() ) + GetViewData().IsMultiMarked() ) { rSet.DisableItem( nWhich ); } @@ -1117,7 +1114,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) if ( nWhich == SID_AUTO_FILTER ) { ScRange aDummy; - ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy); + ScMarkType eMarkType = GetViewData().GetSimpleArea( aDummy); if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED) { rSet.DisableItem( nWhich ); @@ -1142,7 +1139,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) SCTAB nStartTab, nEndTab; bool bAnyQuery = false; - bool bSelected = (GetViewData()->GetSimpleArea( + bool bSelected = (GetViewData().GetSimpleArea( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ) == SC_MARK_SIMPLE); @@ -1153,9 +1150,9 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) } else { - nStartCol = GetViewData()->GetCurX(); - nStartRow = GetViewData()->GetCurY(); - nStartTab = GetViewData()->GetTabNo(); + nStartCol = GetViewData().GetCurX(); + nStartRow = GetViewData().GetCurY(); + nStartTab = GetViewData().GetTabNo(); } ScDBData* pDBData = bSelected @@ -1187,7 +1184,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) break; case SID_DATA_PROVIDER_REFRESH: { - ScDocument& rViewDoc = GetViewData()->GetDocument(); + ScDocument& rViewDoc = GetViewData().GetDocument(); auto& rDataMapper = rViewDoc.GetExternalDataMapper(); if (rDataMapper.getDataSources().empty()) rSet.DisableItem(nWhich); @@ -1204,7 +1201,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) case SID_TEXT_TO_COLUMNS: { ScRange aRange; - if ( !lcl_GetTextToColumnsRange( pData, aRange, true ) ) + if ( !lcl_GetTextToColumnsRange( rData, aRange, true ) ) { rSet.DisableItem( nWhich ); } diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 5112b80fcc69..c371d2adf102 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -50,7 +50,7 @@ #include <memory> -#define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() ) +#define IS_EDITMODE() GetViewData().HasEditView( GetViewData().GetActivePart() ) using sc::HMMToTwips; using sc::TwipsToEvenHMM; @@ -154,7 +154,7 @@ void lcl_lokGetWholeFunctionList() void ScCellShell::Execute( SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings(); ScModule* pScMod = SC_MOD(); const SfxItemSet* pReqArgs = rReq.GetArgs(); @@ -271,9 +271,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) // Enter // NOTE: This also means we want to set the modified state // regardless of the DontCommit parameter's value. - if (comphelper::LibreOfficeKit::isActive() && !GetViewData()->GetDocShell()->IsModified()) + if (comphelper::LibreOfficeKit::isActive() && !GetViewData().GetDocShell()->IsModified()) { - GetViewData()->GetDocShell()->SetModified(); + GetViewData().GetDocShell()->SetModified(); rBindings.Invalidate(SID_SAVEDOC); rBindings.Invalidate(SID_DOC_MODIFIED); } @@ -288,9 +288,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pTabViewShell ); if (bCommit) { - pTabViewShell->EnterData( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo(), + pTabViewShell->EnterData( GetViewData().GetCurX(), + GetViewData().GetCurY(), + GetViewData().GetTabNo(), aStr ); } else if (pHdl) @@ -329,7 +329,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { OUString aStr = static_cast<const SfxStringItem&>(pReqArgs-> Get( SID_INSERT_MATRIX )).GetValue(); - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); pTabViewShell->EnterMatrix( aStr, rDoc.GetGrammar() ); rReq.Done(); } @@ -371,9 +371,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) if (nSlot == FID_INPUTLINE_ENTER) { if ( - aCursorPos.Col() == GetViewData()->GetCurX() && - aCursorPos.Row() == GetViewData()->GetCurY() && - aCursorPos.Tab() == GetViewData()->GetTabNo() + aCursorPos.Col() == GetViewData().GetCurX() && + aCursorPos.Row() == GetViewData().GetCurY() && + aCursorPos.Tab() == GetViewData().GetTabNo() ) { SfxStringItem aItem( SID_ENTER_STRING, aString ); @@ -399,7 +399,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else { - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); pTabViewShell->EnterMatrix( aString, rDoc.GetGrammar() ); rReq.Done(); } @@ -533,9 +533,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) case SID_SCENARIOS: { - ScDocument& rDoc = GetViewData()->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocument& rDoc = GetViewData().GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); + SCTAB nTab = GetViewData().GetTabNo(); if ( rDoc.IsScenario(nTab) ) { @@ -665,7 +665,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) std::vector<sc::ColRowSpan> aRanges; SCCOLROW nRow = static_cast<const SfxInt32Item*>(pRow)->GetValue() - 1; nHeight = static_cast<const SfxUInt16Item*>(pHeight)->GetValue(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); if ( rMark.IsRowMarked( static_cast<SCROW>(nRow) ) ) { @@ -690,11 +690,11 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else { - ScViewData* pData = GetViewData(); + ScViewData& rData = GetViewData(); FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); - sal_uInt16 nCurHeight = pData->GetDocument(). - GetRowHeight( pData->GetCurY(), - pData->GetTabNo() ); + sal_uInt16 nCurHeight = rData.GetDocument(). + GetRowHeight( rData.GetCurY(), + rData.GetTabNo() ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScopedVclPtr<AbstractScMetricInputDlg> pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "RowHeightDialog", @@ -764,7 +764,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) std::vector<sc::ColRowSpan> aRanges; SCCOLROW nColumn = static_cast<const SfxUInt16Item*>(pColumn)->GetValue() - 1; nWidth = static_cast<const SfxUInt16Item*>(pWidth)->GetValue(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); if ( rMark.IsColumnMarked( static_cast<SCCOL>(nColumn) ) ) { @@ -790,10 +790,10 @@ void ScCellShell::Execute( SfxRequest& rReq ) else { FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); - ScViewData* pData = GetViewData(); - sal_uInt16 nCurHeight = pData->GetDocument(). - GetColWidth( pData->GetCurX(), - pData->GetTabNo() ); + ScViewData& rData = GetViewData(); + sal_uInt16 nCurHeight = rData.GetDocument(). + GetColWidth( rData.GetCurX(), + rData.GetTabNo() ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScopedVclPtr<AbstractScMetricInputDlg> pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "ColWidthDialog", nCurHeight, @@ -881,7 +881,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) case FID_MERGE_OFF: case FID_MERGE_TOGGLE: { - if ( !GetViewData()->GetDocument().GetChangeTrack() ) + if ( !GetViewData().GetDocument().GetChangeTrack() ) { // test whether to merge or to split bool bMerge = false; @@ -949,11 +949,11 @@ void ScCellShell::Execute( SfxRequest& rReq ) SCROW nEndRow; SCTAB nEndTab; - const ScMarkData& rMark = GetViewData()->GetMarkData(); + const ScMarkData& rMark = GetViewData().GetMarkData(); if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) pTabViewShell->MarkDataArea(); - GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab, + GetViewData().GetSimpleArea( nStartCol,nStartRow,nStartTab, nEndCol,nEndRow,nEndTab ); if ( ( std::abs(nEndCol-nStartCol) > 1 ) @@ -978,7 +978,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) std::unique_ptr<ScAutoFormatData> pNewEntry(pTabViewShell->CreateAutoFormatData()); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractScAutoFormatDlg> pDlg(pFact->CreateScAutoFormatDlg(pDlgParent, ScGlobal::GetOrCreateAutoFormat(), pNewEntry.get(), GetViewData())); + ScopedVclPtr<AbstractScAutoFormatDlg> pDlg(pFact->CreateScAutoFormatDlg(pDlgParent, ScGlobal::GetOrCreateAutoFormat(), pNewEntry.get(), &GetViewData())); if ( pDlg->Execute() == RET_OK ) { @@ -1009,7 +1009,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) case SID_CANCEL: { - if (GetViewData()->HasEditView(GetViewData()->GetActivePart())) + if (GetViewData().HasEditView(GetViewData().GetActivePart())) pScMod->InputCancelHandler(); else if (pTabViewShell->HasPaintBrush()) pTabViewShell->ResetBrushDocument(); // abort format paint brush @@ -1043,7 +1043,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) case SID_STATUS_DOCPOS: // Launch navigator. - GetViewData()->GetDispatcher().Execute( + GetViewData().GetDispatcher().Execute( SID_NAVIGATOR, SfxCallMode::SYNCHRON|SfxCallMode::RECORD ); break; diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx index 3243400faaf1..c77841eaa5fd 100644 --- a/sc/source/ui/view/cellsh4.cxx +++ b/sc/source/ui/view/cellsh4.cxx @@ -35,10 +35,10 @@ const VclPtr<vcl::Window>& ScCellShell::GetFrameWin() const void ScCellShell::ExecuteCursor( SfxRequest& rReq ) { - ScViewData* pData = GetViewData(); - ScTabViewShell* pTabViewShell = pData->GetViewShell(); + ScViewData& rData = GetViewData(); + ScTabViewShell* pTabViewShell = rData.GetViewShell(); const SfxItemSet* pReqArgs = rReq.GetArgs(); - sal_uInt16 nSlotId = rReq.GetSlot(); + sal_uInt16 nSlotId = rReq.GetSlot(); SCCOLROW nRepeat = 1; bool bSel = false; bool bKeep = false; @@ -107,7 +107,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq ) } SCCOLROW nRTLSign = 1; - if ( pData->GetDocument().IsLayoutRTL( pData->GetTabNo() ) ) + if ( rData.GetDocument().IsLayoutRTL( rData.GetTabNo() ) ) { //! evaluate cursor movement option? nRTLSign = -1; @@ -244,7 +244,7 @@ void ScCellShell::GetStateCursor( SAL_UNUSED_PARAMETER SfxItemSet& /* rSet */ ) void ScCellShell::ExecuteCursorSel( SfxRequest& rReq ) { sal_uInt16 nSlotId = rReq.GetSlot(); - ScTabViewShell* pViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pViewShell = GetViewData().GetViewShell(); ScInputHandler* pInputHdl = pViewShell->GetInputHandler(); pViewShell->HideAllCursors(); if (pInputHdl && pInputHdl->IsInputMode()) @@ -266,7 +266,7 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq ) SCROW nMovY = nRepeat; // Horizontal direction depends on whether or not the UI language is RTL. SCCOL nMovX = nRepeat; - if (GetViewData()->GetDocument().IsLayoutRTL(GetViewData()->GetTabNo())) + if (GetViewData().GetDocument().IsLayoutRTL(GetViewData().GetTabNo())) { // mirror horizontal movement for right-to-left mode. nMovX = -nRepeat; @@ -321,7 +321,7 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq ) void ScCellShell::ExecuteMove( SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); sal_uInt16 nSlotId = rReq.GetSlot(); const SfxItemSet* pReqArgs = rReq.GetArgs(); @@ -403,7 +403,7 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq ) break; case SID_ALIGNCURSOR: - pTabViewShell->AlignToCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), SC_FOLLOW_JUMP ); + pTabViewShell->AlignToCursor( GetViewData().GetCurX(), GetViewData().GetCurY(), SC_FOLLOW_JUMP ); break; case SID_MARKDATAAREA: @@ -465,7 +465,7 @@ void ScCellShell::ExecutePageSel( SfxRequest& rReq ) void ScCellShell::ExecutePage( SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); const SfxItemSet* pReqArgs = rReq.GetArgs(); sal_uInt16 nSlotId = rReq.GetSlot(); bool bSel = false; diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 8e6b9d26a5be..9ac8862d36af 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -128,16 +128,16 @@ void ScFormatShell::InitInterface_Impl() ToolbarId::Objectbar_Format); } -ScFormatShell::ScFormatShell(ScViewData* pData) : - SfxShell(pData->GetViewShell()), - pViewData(pData) +ScFormatShell::ScFormatShell(ScViewData& rData) : + SfxShell(rData.GetViewShell()), + rViewData(rData) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); SetPool( &pTabViewShell->GetPool() ); - SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + SfxUndoManager* pMgr = rViewData.GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); - if ( !pViewData->GetDocument().IsUndoEnabled() ) + if ( !rViewData.GetDocument().IsUndoEnabled() ) { pMgr->SetMaxUndoActionCount( 0 ); } @@ -150,8 +150,8 @@ ScFormatShell::~ScFormatShell() void ScFormatShell::GetStyleState( SfxItemSet& rSet ) { - ScDocument& rDoc = GetViewData()->GetDocument(); - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScDocument& rDoc = GetViewData().GetDocument(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); SfxStyleSheetBasePool* pStylePool = rDoc.GetStyleSheetPool(); bool bProtected = false; @@ -191,7 +191,7 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet ) case SID_STYLE_FAMILY4: // page style sheets { - SCTAB nCurTab = GetViewData()->GetTabNo(); + SCTAB nCurTab = GetViewData().GetTabNo(); OUString aPageStyle = rDoc.GetPageStyle( nCurTab ); SfxStyleSheet* pStyleSheet = pStylePool ? static_cast<SfxStyleSheet*>(pStylePool-> Find( aPageStyle, SfxStyleFamily::Page )) : nullptr; @@ -252,16 +252,16 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( !pArgs && nSlotId != SID_STYLE_NEW_BY_EXAMPLE && nSlotId != SID_STYLE_UPDATE_BY_EXAMPLE ) { // in case of vertical toolbar - pViewData->GetDispatcher().Execute( SID_STYLE_DESIGNER, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); + rViewData.GetDispatcher().Execute( SID_STYLE_DESIGNER, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); return; } - SfxBindings& rBindings = pViewData->GetBindings(); - const SCTAB nCurTab = GetViewData()->GetTabNo(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScTabViewShell* pTabViewShell= GetViewData()->GetViewShell(); + SfxBindings& rBindings = rViewData.GetBindings(); + const SCTAB nCurTab = GetViewData().GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScTabViewShell* pTabViewShell= GetViewData().GetViewShell(); ScDocument& rDoc = pDocSh->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); ScModule* pScMod = SC_MOD(); OUString aRefName; bool bUndo = rDoc.IsUndoEnabled(); @@ -282,15 +282,15 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue(); if ( eFamily == SfxStyleFamily::Para ) // CellStyles { - ScMarkData aFuncMark( pViewData->GetMarkData() ); + ScMarkData aFuncMark( rViewData.GetMarkData() ); ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); aFuncMark.MarkToMulti(); if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() ) { - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); - SCTAB nTab = pViewData->GetTabNo(); + SCCOL nCol = rViewData.GetCurX(); + SCROW nRow = rViewData.GetCurY(); + SCTAB nTab = rViewData.GetTabNo(); ScRange aRange( nCol, nRow, nTab ); aFuncMark.SetMarkArea( aRange ); } @@ -302,7 +302,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) SfxItemSet aItemSet( GetPool() ); - ScPatternAttr aNewAttrs( GetViewData()->GetDocument().GetPool() ); + ScPatternAttr aNewAttrs( GetViewData().GetDocument().GetPool() ); SfxItemSet& rNewSet = aNewAttrs.GetItemSet(); rNewSet.Put( aItemSet, false ); @@ -325,7 +325,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) SfxItemSet aItemSet( GetPool() ); - ScPatternAttr aNewAttrs( GetViewData()->GetDocument().GetPool() ); + ScPatternAttr aNewAttrs( GetViewData().GetDocument().GetPool() ); SfxItemSet& rNewSet = aNewAttrs.GetItemSet(); rNewSet.Put( aItemSet, false ); rDoc.ApplySelectionPattern( aNewAttrs, aPreviewMark ); @@ -553,8 +553,8 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // If attributes are to be removed from the selection, still need to be // cautious not to adopt items from templates // (GetSelectionPattern also collects items from originals) (# 44748 #) - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); + SCCOL nCol = rViewData.GetCurX(); + SCROW nRow = rViewData.GetCurY(); pAttrItem = rDoc.GetPattern( nCol, nRow, nCurTab ); SfxItemSet aAttrSet = pAttrItem->GetItemSet(); @@ -817,7 +817,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) } std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem( - ScTabViewShell::MakeNumberInfoItem(rDoc, GetViewData())); + ScTabViewShell::MakeNumberInfoItem(rDoc, &GetViewData())); pDocSh->PutItem( *pNumberInfoItem ); bPage = false; @@ -976,7 +976,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) { ScModule* pScMod = SC_MOD(); - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); const SfxItemSet* pReqArgs = rReq.GetArgs(); sal_uInt16 nSlot = rReq.GetSlot(); SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings(); @@ -984,7 +984,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox // End input - if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) ) + if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) ) { switch ( nSlot ) { @@ -1062,7 +1062,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) if ( pReqArgs->HasItem( SID_NUMBER_CURRENCY, &pItem ) ) { sal_uInt32 nNewFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue(); - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); const SfxItemSet& rOldSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); @@ -1116,7 +1116,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) break; case SID_NUMBER_THOUSANDS: { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); sal_uInt32 nCurrentNumberFormat; bool bThousand(false); @@ -1125,7 +1125,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) sal_uInt16 nLeadZeroes(0); LanguageType eLanguage = ScGlobal::eLnge; - rDoc.GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat); + rDoc.GetNumberFormat(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo(), nCurrentNumberFormat); const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat); if (pEntry) @@ -1151,11 +1151,11 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) if(pReqArgs) { const SfxPoolItem* pItem; - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); sal_uInt32 nCurrentNumberFormat; - rDoc.GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat); + rDoc.GetNumberFormat(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo(), nCurrentNumberFormat); const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat); if(!pEntry) @@ -1232,7 +1232,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) // considered. const SfxItemSet& rOldSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - SfxItemPool* pDocPool = GetViewData()->GetDocument().GetPool(); + SfxItemPool* pDocPool = GetViewData().GetDocument().GetPool(); SfxItemSet aNewSet( *pDocPool, svl::Items<ATTR_PATTERN_START, ATTR_PATTERN_END>{} ); aNewSet.Put( *pItem ); pTabViewShell->ApplyAttributes( &aNewSet, &rOldSet ); @@ -1295,8 +1295,8 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) void ScFormatShell::ExecuteAlignment( SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - SfxBindings& rBindings = pViewData->GetBindings(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); + SfxBindings& rBindings = rViewData.GetBindings(); const SfxItemSet* pSet = rReq.GetArgs(); sal_uInt16 nSlot = rReq.GetSlot(); @@ -1388,8 +1388,8 @@ void ScFormatShell::ExecuteAlignment( SfxRequest& rReq ) void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - SfxBindings& rBindings = pViewData->GetBindings(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); + SfxBindings& rBindings = rViewData.GetBindings(); const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern(); const SfxItemSet* pSet = rReq.GetArgs(); sal_uInt16 nSlot = rReq.GetSlot(); @@ -1653,13 +1653,13 @@ namespace void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - SfxBindings& rBindings = pViewData->GetBindings(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); + SfxBindings& rBindings = rViewData.GetBindings(); const SfxItemSet* pNewAttrs = rReq.GetArgs(); sal_uInt16 nSlot = rReq.GetSlot(); pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox - ScDocument& rDoc = GetViewData()->GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); if ( !pNewAttrs ) { switch ( nSlot ) @@ -1764,16 +1764,16 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) SvtScriptType nScript = pTabViewShell->GetSelectionScriptType(); aSetItem.PutItemForScriptType( nScript, rFont ); - ScMarkData aFuncMark( pViewData->GetMarkData() ); + ScMarkData aFuncMark( rViewData.GetMarkData() ); ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); rDoc.SetPreviewFont( aSetItem.GetItemSet().Clone() ); aFuncMark.MarkToMulti(); if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() ) { - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); - SCTAB nTab = pViewData->GetTabNo(); + SCCOL nCol = rViewData.GetCurX(); + SCROW nRow = rViewData.GetCurY(); + SCTAB nTab = rViewData.GetTabNo(); ScRange aRange( nCol, nRow, nTab ); aFuncMark.SetMarkArea( aRange ); } @@ -2043,7 +2043,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) void ScFormatShell::GetAttrState( SfxItemSet& rSet ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); const SvxBrushItem& rBrushItem = rAttrSet.Get( ATTR_BACKGROUND ); SfxWhichIter aIter( rSet ); @@ -2263,7 +2263,7 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); rSet.Put( rAttrSet, false ); // Include ItemStates in copy @@ -2438,7 +2438,7 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) void ScFormatShell::GetBorderState( SfxItemSet& rSet ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER)); std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER)); @@ -2452,7 +2452,7 @@ void ScFormatShell::GetBorderState( SfxItemSet& rSet ) void ScFormatShell::GetAlignState( SfxItemSet& rSet ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); @@ -2501,8 +2501,8 @@ void ScFormatShell::GetAlignState( SfxItemSet& rSet ) void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - ScDocument& rDoc = pViewData->GetDocument(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); + ScDocument& rDoc = rViewData.GetDocument(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); const SfxItemState eItemState = rAttrSet.GetItemState( ATTR_VALUE_FORMAT ); sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue(); @@ -2685,10 +2685,10 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) void ScFormatShell::ExecuteTextDirection( const SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox bool bEditMode = false; - if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) ) + if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) ) { bEditMode=true; SC_MOD()->InputEnterHandler(); @@ -2701,7 +2701,7 @@ void ScFormatShell::ExecuteTextDirection( const SfxRequest& rReq ) case SID_TEXTDIRECTION_TOP_TO_BOTTOM: { bool bVert = (nSlot == SID_TEXTDIRECTION_TOP_TO_BOTTOM); - ScPatternAttr aAttr( GetViewData()->GetDocument().GetPool() ); + ScPatternAttr aAttr( GetViewData().GetDocument().GetPool() ); SfxItemSet& rItemSet = aAttr.GetItemSet(); rItemSet.Put( ScVerticalStackCell( bVert ) ); rItemSet.Put( SfxBoolItem( ATTR_VERTICAL_ASIAN, bVert ) ); @@ -2725,7 +2725,7 @@ void ScFormatShell::ExecuteTextDirection( const SfxRequest& rReq ) void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); bool bVertDontCare = @@ -2742,8 +2742,8 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet ) { SvxFrameDirection eCellDir = rAttrSet.Get( ATTR_WRITINGDIR ).GetValue(); if ( eCellDir == SvxFrameDirection::Environment ) - eBidiDir = GetViewData()->GetDocument(). - GetEditTextDirection( GetViewData()->GetTabNo() ); + eBidiDir = GetViewData().GetDocument(). + GetEditTextDirection( GetViewData().GetTabNo() ); else if ( eCellDir == SvxFrameDirection::Horizontal_RL_TB ) eBidiDir = EEHorizontalTextDirection::R2L; else @@ -2797,7 +2797,7 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet ) void ScFormatShell::ExecFormatPaintbrush( const SfxRequest& rReq ) { - ScViewFunc* pView = pViewData->GetView(); + ScViewFunc* pView = rViewData.GetView(); if ( pView->HasPaintBrush() ) { // cancel paintbrush mode @@ -2812,7 +2812,7 @@ void ScFormatShell::ExecFormatPaintbrush( const SfxRequest& rReq ) // in case of multi selection, deselect all and use the cursor position ScRange aDummy; - if ( pViewData->GetSimpleArea(aDummy) != SC_MARK_SIMPLE ) + if ( rViewData.GetSimpleArea(aDummy) != SC_MARK_SIMPLE ) pView->Unmark(); ScDocumentUniquePtr pBrushDoc(new ScDocument( SCDOCMODE_CLIP )); @@ -2823,17 +2823,17 @@ void ScFormatShell::ExecFormatPaintbrush( const SfxRequest& rReq ) void ScFormatShell::StateFormatPaintbrush( SfxItemSet& rSet ) { - if ( pViewData->HasEditView( pViewData->GetActivePart() ) ) + if ( rViewData.HasEditView( rViewData.GetActivePart() ) ) rSet.DisableItem( SID_FORMATPAINTBRUSH ); else - rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, pViewData->GetView()->HasPaintBrush() ) ); + rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, rViewData.GetView()->HasPaintBrush() ) ); } SvNumFormatType ScFormatShell::GetCurrentNumberFormatType() { SvNumFormatType nType = SvNumFormatType::ALL; - ScDocument& rDoc = GetViewData()->GetDocument(); - ScMarkData aMark(GetViewData()->GetMarkData()); + ScDocument& rDoc = GetViewData().GetDocument(); + ScMarkData aMark(GetViewData().GetMarkData()); const SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); if (!pFormatter) return nType; @@ -2879,8 +2879,8 @@ SvNumFormatType ScFormatShell::GetCurrentNumberFormatType() else { sal_uInt32 nNumFmt; - rDoc.GetNumberFormat( pViewData->GetCurX(), pViewData->GetCurY(), - pViewData->GetTabNo(), nNumFmt ); + rDoc.GetNumberFormat( rViewData.GetCurX(), rViewData.GetCurY(), + rViewData.GetTabNo(), nNumFmt ); nType = pFormatter->GetType( nNumFmt ); } return nType; |