diff options
author | Noel Grandin <noel@peralex.com> | 2014-06-18 12:14:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-06-24 11:34:21 +0200 |
commit | e2080e70fe8b085f18e868e46340454720fa94ca (patch) | |
tree | 4038d1d57b41b68a47d5ebbbe6ad390648ec6303 /sc/source/ui/view | |
parent | f910280b8704ed9c289150a4ca3c8d60e15d0d97 (diff) |
new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can
be returning a reference.
e.g.
class A {
struct X x;
public X* getX() { return &x; }
}
which can be:
public X& getX() { return x; }
Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
Diffstat (limited to 'sc/source/ui/view')
50 files changed, 1527 insertions, 1532 deletions
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index eca9ed891a6d..ac091beea9c6 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -277,7 +277,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) void ScCellShell::GetCellState( SfxItemSet& rSet ) { ScDocShell* pDocShell = GetViewData()->GetDocShell(); - ScDocument* pDoc = GetViewData()->GetDocShell()->GetDocument(); + ScDocument& rDoc = GetViewData()->GetDocShell()->GetDocument(); ScAddress aCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); @@ -291,25 +291,25 @@ void ScCellShell::GetCellState( SfxItemSet& rSet ) { case SID_THESAURUS: { - CellType eType = pDoc->GetCellType( aCursor ); + CellType eType = rDoc.GetCellType( aCursor ); bDisable = ( eType != CELLTYPE_STRING && eType != CELLTYPE_EDIT); if (!bDisable) { // test for available languages - sal_uInt16 nLang = ScViewUtil::GetEffLanguage( pDoc, aCursor ); + sal_uInt16 nLang = ScViewUtil::GetEffLanguage( &rDoc, aCursor ); bDisable = !ScModule::HasThesaurusLanguage( nLang ); } } break; case SID_OPENDLG_FUNCTION: { - ScMarkData aMarkData=GetViewData()->GetMarkData(); + ScMarkData aMarkData = GetViewData()->GetMarkData(); aMarkData.MarkToSimple(); ScRange aRange; aMarkData.GetMarkArea(aRange); if(aMarkData.IsMarked()) { - if (!pDoc->IsBlockEditable( aCursor.Tab(), aRange.aStart.Col(),aRange.aStart.Row(), + if (!rDoc.IsBlockEditable( aCursor.Tab(), aRange.aStart.Col(),aRange.aStart.Row(), aRange.aEnd.Col(),aRange.aEnd.Row() )) { bDisable = true; @@ -329,7 +329,7 @@ void ScCellShell::GetCellState( SfxItemSet& rSet ) break; } if (!bDisable && bNeedEdit) - if (!pDoc->IsBlockEditable( aCursor.Tab(), aCursor.Col(),aCursor.Row(), + if (!rDoc.IsBlockEditable( aCursor.Tab(), aCursor.Col(),aCursor.Row(), aCursor.Col(),aCursor.Row() )) bDisable = true; if (bDisable) @@ -523,8 +523,8 @@ void ScCellShell::GetClipState( SfxItemSet& rSet ) SCCOL nCol = GetViewData()->GetCurX(); SCROW nRow = GetViewData()->GetCurY(); SCTAB nTab = GetViewData()->GetTabNo(); - ScDocument* pDoc = GetViewData()->GetDocShell()->GetDocument(); - if (!pDoc->IsBlockEditable( nTab, nCol,nRow, nCol,nRow )) + ScDocument& rDoc = GetViewData()->GetDocShell()->GetDocument(); + if (!rDoc.IsBlockEditable( nTab, nCol,nRow, nCol,nRow )) bDisable = true; if (!checkDestRanges(*GetViewData())) diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 52ad408ae387..55fa4be7083d 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -994,7 +994,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); ScViewData* pData = GetViewData(); ScDocShell* pDocSh = pData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCCOL nPosX = pData->GetCurX(); SCROW nPosY = pData->GetCurY(); SCTAB nTab = pData->GetTabNo(); @@ -1014,7 +1014,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) // or filter,sort,subtotal (also without import) bool bOk = false; ScDBData* pDBData = pTabViewShell->GetDBData(false,SC_DB_OLD); - if (pDBData && pDoc->GetChangeTrack() == NULL) + if (pDBData && rDoc.GetChangeTrack() == NULL) { if ( pDBData->HasImportParam() ) bOk = !pDBData->HasImportSelection(); @@ -1052,7 +1052,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) { //! move ReadOnly check to idl flags - if ( pDocSh->IsReadOnly() || pDoc->GetChangeTrack()!=NULL || + if ( pDocSh->IsReadOnly() || rDoc.GetChangeTrack()!=NULL || GetViewData()->IsMultiMarked() ) { rSet.DisableItem( nWhich ); @@ -1065,7 +1065,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) // only imported data without selection ScDBData* pDBData = pTabViewShell->GetDBData(false,SC_DB_OLD); if (!pDBData || !pDBData->HasImportParam() || pDBData->HasImportSelection() || - pDoc->GetChangeTrack()!=NULL) + rDoc.GetChangeTrack()!=NULL) { rSet.DisableItem( nWhich ); } @@ -1095,7 +1095,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) { if (!bAutoFilterTested) { - bAutoFilter = pDoc->HasAutoFilter( nPosX, nPosY, nTab ); + bAutoFilter = rDoc.HasAutoFilter( nPosX, nPosY, nTab ); bAutoFilterTested = true; } if ( nWhich == SID_AUTO_FILTER ) @@ -1106,7 +1106,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) { rSet.DisableItem( nWhich ); } - else if (pDoc->GetDPAtBlock(aDummy)) + else if (rDoc.GetDPAtBlock(aDummy)) { rSet.DisableItem( nWhich ); } @@ -1143,8 +1143,8 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) } ScDBData* pDBData = bSelected - ? pDoc->GetDBAtArea( nStartTab, nStartCol, nStartRow, nEndCol, nEndRow ) - : pDoc->GetDBAtCursor( nStartCol, nStartRow, nStartTab ); + ? rDoc.GetDBAtArea( nStartTab, nStartCol, nStartRow, nEndCol, nEndRow ) + : rDoc.GetDBAtCursor( nStartCol, nStartRow, nStartTab ); if ( pDBData ) { diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 704fda74ce72..4356a354111d 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -52,7 +52,7 @@ ScDBFunc::~ScDBFunc() void ScDBFunc::GotoDBArea( const OUString& rDBName ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScDBCollection* pDBCol = pDoc->GetDBCollection(); ScDBData* pData = pDBCol->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rDBName)); if (pData) @@ -79,10 +79,10 @@ void ScDBFunc::GotoDBArea( const OUString& rDBName ) ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection eSel ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScDBData* pData = NULL; ScRange aRange; - ScMarkType eMarkType = GetViewData()->GetSimpleArea(aRange); + ScMarkType eMarkType = GetViewData().GetSimpleArea(aRange); if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED ) { bool bShrinkColumnsOnly = false; @@ -103,7 +103,7 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e { // One cell only, if it is not marked obtain entire used data // area. - const ScMarkData& rMarkData = GetViewData()->GetMarkData(); + const ScMarkData& rMarkData = GetViewData().GetMarkData(); if (!(rMarkData.IsMarked() || rMarkData.IsMultiMarked())) eSel = SC_DBSEL_KEEP; } @@ -113,10 +113,10 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e case SC_DBSEL_SHRINK_TO_SHEET_DATA: { // Shrink the selection to sheet data area. - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); - if (pDoc->ShrinkToDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2)) + if (rDoc.ShrinkToDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2)) { aRange.aStart.SetCol(nCol1); aRange.aEnd.SetCol(nCol2); @@ -129,11 +129,11 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e case SC_DBSEL_ROW_DOWN: { // Shrink the selection to actual used area. - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); bool bShrunk; - pDoc->ShrinkToUsedDataArea( bShrunk, aRange.aStart.Tab(), + rDoc.ShrinkToUsedDataArea( bShrunk, aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly); if (bShrunk) { @@ -151,8 +151,8 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e } else if ( eMode != SC_DB_OLD ) pData = pDocSh->GetDBData( - ScRange( GetViewData()->GetCurX(), GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ), + ScRange( GetViewData().GetCurX(), GetViewData().GetCurY(), + GetViewData().GetTabNo() ), eMode, SC_DBSEL_KEEP ); if (!pData) @@ -169,21 +169,21 @@ ScDBData* ScDBFunc::GetDBData( bool bMark, ScGetDBMode eMode, ScGetDBSelection e ScDBData* ScDBFunc::GetAnonymousDBData() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScRange aRange; - ScMarkType eMarkType = GetViewData()->GetSimpleArea(aRange); + ScMarkType eMarkType = GetViewData().GetSimpleArea(aRange); if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED) return NULL; // Expand to used data area if not explicitly marked. - const ScMarkData& rMarkData = GetViewData()->GetMarkData(); + const ScMarkData& rMarkData = GetViewData().GetMarkData(); if (!rMarkData.IsMarked() && !rMarkData.IsMultiMarked()) { SCCOL nCol1 = aRange.aStart.Col(); SCCOL nCol2 = aRange.aEnd.Col(); SCROW nRow1 = aRange.aStart.Row(); SCROW nRow2 = aRange.aEnd.Row(); - pDocSh->GetDocument()->GetDataArea(aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, false, false); + pDocSh->GetDocument().GetDataArea(aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, false, false); aRange.aStart.SetCol(nCol1); aRange.aStart.SetRow(nRow1); aRange.aEnd.SetCol(nCol2); @@ -198,12 +198,12 @@ ScDBData* ScDBFunc::GetAnonymousDBData() void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const std::vector<ScRange> &rDelAreaList ) { - ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScDocShell* pDocShell = GetViewData().GetDocShell(); ScDocShellModificator aModificator( *pDocShell ); - ScDocument* pDoc = pDocShell->GetDocument(); - ScDBCollection* pOldColl = pDoc->GetDBCollection(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDBCollection* pOldColl = rDoc.GetDBCollection(); ScDBCollection* pUndoColl = NULL; - const bool bRecord (pDoc->IsUndoEnabled()); + const bool bRecord (rDoc.IsUndoEnabled()); std::vector<ScRange>::const_iterator iter; for (iter = rDelAreaList.begin(); iter != rDelAreaList.end(); ++iter) @@ -222,9 +222,9 @@ void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const std:: // register target in SBA no longer necessary - pDoc->CompileDBFormula( true ); // CreateFormulaString - pDoc->SetDBCollection( new ScDBCollection( rNewColl ) ); - pDoc->CompileDBFormula( false ); // CompileFormulaString + rDoc.CompileDBFormula( true ); // CreateFormulaString + rDoc.SetDBCollection( new ScDBCollection( rNewColl ) ); + rDoc.CompileDBFormula( false ); // CompileFormulaString pOldColl = NULL; pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PAINT_GRID); aModificator.SetDocumentModified(); @@ -246,10 +246,10 @@ void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const std:: void ScDBFunc::UISort( const ScSortParam& rSortParam, bool bRecord ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); - ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rSortParam.nCol1, rSortParam.nRow1, + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rSortParam.nCol1, rSortParam.nRow1, rSortParam.nCol2, rSortParam.nRow2 ); if (!pDBData) { @@ -273,8 +273,8 @@ void ScDBFunc::UISort( const ScSortParam& rSortParam, bool bRecord ) void ScDBFunc::Sort( const ScSortParam& rSortParam, bool bRecord, bool bPaint ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); ScDBDocFunc aDBDocFunc( *pDocSh ); bool bSuccess = aDBDocFunc.Sort( nTab, rSortParam, bRecord, bPaint, false ); if ( bSuccess && !rSortParam.bInplace ) @@ -294,8 +294,8 @@ void ScDBFunc::Sort( const ScSortParam& rSortParam, bool bRecord, bool bPaint ) void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource, bool bRecord ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); ScDBDocFunc aDBDocFunc( *pDocSh ); bool bSuccess = aDBDocFunc.Query( nTab, rQueryParam, pAdvSource, bRecord, false ); @@ -305,8 +305,8 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource if (bCopy) { // mark target range (data base range has been set up if applicable) - ScDocument* pDoc = pDocSh->GetDocument(); - ScDBData* pDestData = pDoc->GetDBAtCursor( + ScDocument& rDoc = pDocSh->GetDocument(); + ScDBData* pDestData = rDoc.GetDBAtCursor( rQueryParam.nDestCol, rQueryParam.nDestRow, rQueryParam.nDestTab, true ); if (pDestData) @@ -323,7 +323,7 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource SelectionChanged(); // for attribute states (filtered rows are ignored) } - GetViewData()->GetBindings().Invalidate( SID_UNFILTER ); + GetViewData().GetBindings().Invalidate( SID_UNFILTER ); } } @@ -331,11 +331,11 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, const ScRange* pAdvSource void ScDBFunc::ToggleAutoFilter() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScDocShellModificator aModificator( *pDocSh ); ScQueryParam aParam; - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); pDBData->SetByRow( true ); //! undo, retrieve beforehand ?? @@ -344,7 +344,7 @@ void ScDBFunc::ToggleAutoFilter() SCCOL nCol; SCROW nRow = aParam.nRow1; - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); sal_Int16 nFlag; bool bHasAuto = true; bool bHeader = pDBData->HasHeader(); @@ -404,7 +404,7 @@ void ScDBFunc::ToggleAutoFilter() { if (!bHeader) { - if ( MessBox( GetViewData()->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), + if ( MessBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), // "StarCalc" ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) // header from first row? ).Execute() == RET_YES ) @@ -433,7 +433,7 @@ void ScDBFunc::ToggleAutoFilter() } else { - ErrorBox aErrorBox( GetViewData()->GetDialogParent(), WinBits( WB_OK | WB_DEF_OK ), + ErrorBox aErrorBox( GetViewData().GetDialogParent(), WinBits( WB_OK | WB_DEF_OK ), ScGlobal::GetRscString( STR_ERR_AUTOFILTER ) ); aErrorBox.Execute(); } @@ -443,7 +443,7 @@ void ScDBFunc::ToggleAutoFilter() { aModificator.SetDocumentModified(); - SfxBindings& rBindings = GetViewData()->GetBindings(); + SfxBindings& rBindings = GetViewData().GetBindings(); rBindings.Invalidate( SID_AUTO_FILTER ); rBindings.Invalidate( SID_AUTOFILTER_HIDE ); } @@ -453,10 +453,10 @@ void ScDBFunc::ToggleAutoFilter() void ScDBFunc::HideAutoFilter() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScDocShellModificator aModificator( *pDocSh ); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScQueryParam aParam; ScDBData* pDBData = GetDBData( false ); @@ -468,9 +468,9 @@ void ScDBFunc::HideAutoFilter() for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++) { - sal_Int16 nFlag = ((ScMergeFlagAttr*) pDoc-> + sal_Int16 nFlag = ((ScMergeFlagAttr*) rDoc. GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue(); - pDoc->ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); + rDoc.ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); } ScRange aRange; @@ -483,7 +483,7 @@ void ScDBFunc::HideAutoFilter() pDocSh->PostPaint(ScRange(nCol1, nRow1, nTab, nCol2, nRow1, nTab), PAINT_GRID ); aModificator.SetDocumentModified(); - SfxBindings& rBindings = GetViewData()->GetBindings(); + SfxBindings& rBindings = GetViewData().GetBindings(); rBindings.Invalidate( SID_AUTO_FILTER ); rBindings.Invalidate( SID_AUTOFILTER_HIDE ); } @@ -492,8 +492,8 @@ void ScDBFunc::HideAutoFilter() bool ScDBFunc::ImportData( const ScImportParam& rParam, bool bRecord ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScEditableTester aTester( pDoc, GetViewData()->GetTabNo(), rParam.nCol1,rParam.nRow1, + ScDocument* pDoc = GetViewData().GetDocument(); + ScEditableTester aTester( pDoc, GetViewData().GetTabNo(), rParam.nCol1,rParam.nRow1, rParam.nCol2,rParam.nRow2 ); if ( !aTester.IsEditable() ) { @@ -501,8 +501,8 @@ bool ScDBFunc::ImportData( const ScImportParam& rParam, bool bRecord ) return false; } - ScDBDocFunc aDBDocFunc( *GetViewData()->GetDocShell() ); - return aDBDocFunc.DoImport( GetViewData()->GetTabNo(), rParam, NULL, bRecord ); + ScDBDocFunc aDBDocFunc( *GetViewData().GetDocShell() ); + return aDBDocFunc.DoImport( GetViewData().GetTabNo(), rParam, NULL, bRecord ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/dbfunc2.cxx b/sc/source/ui/view/dbfunc2.cxx index 6261a5460d70..0e3012a4c712 100644 --- a/sc/source/ui/view/dbfunc2.cxx +++ b/sc/source/ui/view/dbfunc2.cxx @@ -27,13 +27,13 @@ void ScDBFunc::UpdateCharts( bool bAllCharts ) { sal_uInt16 nFound = 0; - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); if ( pDoc->GetDrawLayer() ) - nFound = DoUpdateCharts( ScAddress( pViewData->GetCurX(), - pViewData->GetCurY(), - pViewData->GetTabNo()), + nFound = DoUpdateCharts( ScAddress( rViewData.GetCurX(), + rViewData.GetCurY(), + rViewData.GetTabNo()), pDoc, bAllCharts ); diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 76d6cc2b6b7b..f60471e57491 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -96,9 +96,9 @@ using ::std::vector; void ScDBFunc::MakeOutline( bool bColumns, bool bRecord ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); aFunc.MakeOutline( aRange, bColumns, bRecord, false ); } @@ -111,9 +111,9 @@ void ScDBFunc::MakeOutline( bool bColumns, bool bRecord ) void ScDBFunc::RemoveOutline( bool bColumns, bool bRecord ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); aFunc.RemoveOutline( aRange, bColumns, bRecord, false ); } @@ -131,14 +131,13 @@ void ScDBFunc::TestRemoveOutline( bool& rCol, bool& rRow ) SCCOL nStartCol, nEndCol; SCROW nStartRow, nEndRow; SCTAB nStartTab, nEndTab; - if (GetViewData()->GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE) { SCTAB nTab = nStartTab; - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab ); if (pTable) { - ScOutlineArray* pArray; ScOutlineEntry* pEntry; SCCOLROW nStart; SCCOLROW nEnd; @@ -149,8 +148,8 @@ void ScDBFunc::TestRemoveOutline( bool& rCol, bool& rRow ) if ( !bRowMarked || bColMarked ) // nicht wenn ganze Zeilen markiert { - pArray = pTable->GetColArray(); - ScSubOutlineIterator aColIter( pArray ); + ScOutlineArray& rArray = pTable->GetColArray(); + ScSubOutlineIterator aColIter( &rArray ); while ((pEntry=aColIter.GetNext()) != NULL && !bColFound) { nStart = pEntry->GetStart(); @@ -164,8 +163,8 @@ void ScDBFunc::TestRemoveOutline( bool& rCol, bool& rRow ) if ( !bColMarked || bRowMarked ) // nicht wenn ganze Spalten markiert { - pArray = pTable->GetRowArray(); - ScSubOutlineIterator aRowIter( pArray ); + ScOutlineArray& rArray = pTable->GetRowArray(); + ScSubOutlineIterator aRowIter( &rArray ); while ((pEntry=aRowIter.GetNext()) != NULL && !bRowFound) { nStart = pEntry->GetStart(); @@ -183,8 +182,8 @@ void ScDBFunc::TestRemoveOutline( bool& rCol, bool& rRow ) void ScDBFunc::RemoveAllOutlines( bool bRecord ) { - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); bool bOk = aFunc.RemoveAllOutlines( nTab, bRecord ); @@ -197,16 +196,16 @@ void ScDBFunc::RemoveAllOutlines( bool bRecord ) void ScDBFunc::AutoOutline( bool bRecord ) { - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); ScRange aRange( 0,0,nTab, MAXCOL,MAXROW,nTab ); // ganze Tabelle, wenn nichts markiert - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); if ( rMark.IsMarked() || rMark.IsMultiMarked() ) { rMark.MarkToMulti(); rMark.GetMultiMarkArea( aRange ); } - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); aFunc.AutoOutline( aRange, bRecord ); } @@ -215,8 +214,8 @@ void ScDBFunc::AutoOutline( bool bRecord ) void ScDBFunc::SelectLevel( bool bColumns, sal_uInt16 nLevel, bool bRecord, bool bPaint ) { - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); bool bOk = aFunc.SelectLevel( nTab, bColumns, nLevel, bRecord, bPaint ); @@ -229,8 +228,8 @@ void ScDBFunc::SelectLevel( bool bColumns, sal_uInt16 nLevel, bool bRecord, bool void ScDBFunc::ShowOutline( bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord, bool bPaint ) { - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); bool bOk = aFunc.ShowOutline( nTab, bColumns, nLevel, nEntry, bRecord, bPaint ); @@ -243,8 +242,8 @@ void ScDBFunc::ShowOutline( bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, void ScDBFunc::HideOutline( bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord, bool bPaint ) { - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); bool bOk = aFunc.HideOutline( nTab, bColumns, nLevel, nEntry, bRecord, bPaint ); @@ -266,22 +265,21 @@ bool ScDBFunc::OutlinePossible(bool bHide) SCROW nEndRow; SCTAB nEndTab; - if (GetViewData()->GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE) { - ScDocument* pDoc = GetViewData()->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocument* pDoc = GetViewData().GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab ); if (pTable) { - ScOutlineArray* pArray; ScOutlineEntry* pEntry; SCCOLROW nStart; SCCOLROW nEnd; // Spalten - pArray = pTable->GetColArray(); - ScSubOutlineIterator aColIter( pArray ); + ScOutlineArray& rColArray = pTable->GetColArray(); + ScSubOutlineIterator aColIter( &rColArray ); while ((pEntry=aColIter.GetNext()) != NULL && !bEnable) { nStart = pEntry->GetStart(); @@ -302,8 +300,8 @@ bool ScDBFunc::OutlinePossible(bool bHide) // Zeilen - pArray = pTable->GetRowArray(); - ScSubOutlineIterator aRowIter( pArray ); + ScOutlineArray& rRowArray = pTable->GetRowArray(); + ScSubOutlineIterator aRowIter( &rRowArray ); while ((pEntry=aRowIter.GetNext()) != NULL) { nStart = pEntry->GetStart(); @@ -332,9 +330,9 @@ bool ScDBFunc::OutlinePossible(bool bHide) void ScDBFunc::ShowMarkedOutlines( bool bRecord ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); bool bDone = aFunc.ShowMarkedOutlines( aRange, bRecord ); if (bDone) @@ -349,9 +347,9 @@ void ScDBFunc::ShowMarkedOutlines( bool bRecord ) void ScDBFunc::HideMarkedOutlines( bool bRecord ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScOutlineDocFunc aFunc(*pDocSh); bool bDone = aFunc.HideMarkedOutlines( aRange, bRecord ); if (bDone) @@ -370,14 +368,14 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, { bool bDo = !rParam.bRemoveOnly; // sal_False = nur loeschen - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); - SCTAB nTab = GetViewData()->GetTabNo(); - if (bRecord && !pDoc->IsUndoEnabled()) + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); + SCTAB nTab = GetViewData().GetTabNo(); + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; - ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1, + ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1, rParam.nCol2, rParam.nRow2 ); if (!pDBData) { @@ -385,26 +383,26 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, return; } - ScEditableTester aTester( pDoc, nTab, 0,rParam.nRow1+1, MAXCOL,MAXROW ); + ScEditableTester aTester( &rDoc, nTab, 0,rParam.nRow1+1, MAXCOL,MAXROW ); if (!aTester.IsEditable()) { ErrorMessage(aTester.GetMessageId()); return; } - if (pDoc->HasAttrib( rParam.nCol1, rParam.nRow1+1, nTab, + if (rDoc.HasAttrib( rParam.nCol1, rParam.nRow1+1, nTab, rParam.nCol2, rParam.nRow2, nTab, HASATTR_MERGED | HASATTR_OVERLAPPED )) { ErrorMessage(STR_MSSG_INSERTCELLS_0); // nicht in zusammengefasste einfuegen return; } - WaitObject aWait( GetViewData()->GetDialogParent() ); + WaitObject aWait( GetViewData().GetDialogParent() ); bool bOk = true; if (rParam.bReplace) - if (pDoc->TestRemoveSubTotals( nTab, rParam )) + if (rDoc.TestRemoveSubTotals( nTab, rParam )) { - bOk = ( MessBox( GetViewData()->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), + bOk = ( MessBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), // "StarCalc" "Daten loeschen?" ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_1 ) ).Execute() @@ -424,9 +422,9 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, if (bRecord) // alte Daten sichern { bool bOldFilter = bDo && rParam.bDoSort; - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab ); + ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab ); if (pTable) { pUndoTab = new ScOutlineTable( *pTable ); @@ -435,48 +433,48 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, SCCOLROW nOutStartRow; SCCOLROW nOutEndCol; SCCOLROW nOutEndRow; - pTable->GetColArray()->GetRange( nOutStartCol, nOutEndCol ); - pTable->GetRowArray()->GetRange( nOutStartRow, nOutEndRow ); + pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol ); + pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow ); - pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true ); - pDoc->CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), MAXROW, nTab, IDF_NONE, false, pUndoDoc ); - pDoc->CopyToDocument( 0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, IDF_NONE, false, pUndoDoc ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); + rDoc.CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), MAXROW, nTab, IDF_NONE, false, pUndoDoc ); + rDoc.CopyToDocument( 0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, IDF_NONE, false, pUndoDoc ); } else - pUndoDoc->InitUndo( pDoc, nTab, nTab, false, bOldFilter ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, bOldFilter ); // Datenbereich sichern - incl. Filter-Ergebnis - pDoc->CopyToDocument( 0,rParam.nRow1+1,nTab, MAXCOL,rParam.nRow2,nTab, + rDoc.CopyToDocument( 0,rParam.nRow1+1,nTab, MAXCOL,rParam.nRow2,nTab, IDF_ALL, false, pUndoDoc ); // alle Formeln wegen Referenzen - pDoc->CopyToDocument( 0,0,0, MAXCOL,MAXROW,nTabCount-1, + rDoc.CopyToDocument( 0,0,0, MAXCOL,MAXROW,nTabCount-1, IDF_FORMULA, false, pUndoDoc ); // DB- und andere Bereiche - ScRangeName* pDocRange = pDoc->GetRangeName(); + ScRangeName* pDocRange = rDoc.GetRangeName(); if (!pDocRange->empty()) pUndoRange = new ScRangeName( *pDocRange ); - ScDBCollection* pDocDB = pDoc->GetDBCollection(); + ScDBCollection* pDocDB = rDoc.GetDBCollection(); if (!pDocDB->empty()) pUndoDB = new ScDBCollection( *pDocDB ); } - ScOutlineTable* pOut = pDoc->GetOutlineTable( nTab ); + ScOutlineTable* pOut = rDoc.GetOutlineTable( nTab ); if (pOut) { // Remove all existing outlines in the specified range. - ScOutlineArray* pRowArray = pOut->GetRowArray(); - sal_uInt16 nDepth = pRowArray->GetDepth(); + ScOutlineArray& rRowArray = pOut->GetRowArray(); + sal_uInt16 nDepth = rRowArray.GetDepth(); for (sal_uInt16 i = 0; i < nDepth; ++i) { bool bSize; - pRowArray->Remove(aNewParam.nRow1, aNewParam.nRow2, bSize); + rRowArray.Remove(aNewParam.nRow1, aNewParam.nRow2, bSize); } } if (rParam.bReplace) - pDoc->RemoveSubTotals( nTab, aNewParam ); + rDoc.RemoveSubTotals( nTab, aNewParam ); bool bSuccess = true; if (bDo) { @@ -494,11 +492,11 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, Sort( aSortParam, false, false ); } - bSuccess = pDoc->DoSubTotals( nTab, aNewParam ); + bSuccess = rDoc.DoSubTotals( nTab, aNewParam ); } ScRange aDirtyRange( aNewParam.nCol1, aNewParam.nRow1, nTab, aNewParam.nCol2, aNewParam.nRow2, nTab ); - pDoc->SetDirty( aDirtyRange ); + rDoc.SetDirty( aDirtyRange ); if (bRecord) { @@ -518,7 +516,7 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, // merken pDBData->SetSubTotalParam( aNewParam ); pDBData->SetArea( nTab, aNewParam.nCol1,aNewParam.nRow1, aNewParam.nCol2,aNewParam.nRow2 ); - pDoc->CompileDBFormula(); + rDoc.CompileDBFormula(); DoneBlockMode(); InitOwnBlockMode(); @@ -541,7 +539,7 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, void ScDBFunc::Consolidate( const ScConsolidateParam& rParam, bool bRecord ) { - ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScDocShell* pDocShell = GetViewData().GetDocShell(); pDocShell->DoConsolidate( rParam, bRecord ); SetTabNo( rParam.nTab, true ); } @@ -569,14 +567,14 @@ bool ScDBFunc::MakePivotTable( return false; } - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument* pDoc = GetViewData().GetDocument(); bool bUndo = pDoc->IsUndoEnabled(); ScRange aDestRange = rDest; if ( bNewTable ) { - SCTAB nSrcTab = GetViewData()->GetTabNo(); + SCTAB nSrcTab = GetViewData().GetTabNo(); OUString aName( ScGlobal::GetRscString(STR_PIVOT_TABLE) ); OUString aStr; @@ -599,7 +597,7 @@ bool ScDBFunc::MakePivotTable( new ScUndoInsertTab( pDocSh, nNewTab, bAppend, lcl_MakePivotTabName( aName, i ) )); } - GetViewData()->InsertTab( nNewTab ); + GetViewData().InsertTab( nNewTab ); SetTabNo(nNewTab, true); aDestRange = ScRange( 0, 0, nNewTab ); @@ -645,11 +643,11 @@ bool ScDBFunc::MakePivotTable( void ScDBFunc::DeletePivotTable() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScDPObject* pDPObj = pDoc->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScDPObject* pDPObj = rDoc.GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), + GetViewData().GetTabNo() ); if ( pDPObj ) { ScDBDocFunc aFunc( *pDocSh ); @@ -662,12 +660,12 @@ void ScDBFunc::DeletePivotTable() void ScDBFunc::RecalcPivotTable() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument* pDoc = GetViewData().GetDocument(); - ScDPObject* pDPObj = pDoc->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = pDoc->GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), + GetViewData().GetTabNo() ); if (pDPObj) { // Remove existing data cache for the data that this datapilot uses, @@ -683,8 +681,8 @@ void ScDBFunc::RecalcPivotTable() void ScDBFunc::GetSelectedMemberList(ScDPUniqueStringSet& rEntries, long& rDimension) { - ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); if ( !pDPObj ) return; @@ -693,7 +691,7 @@ void ScDBFunc::GetSelectedMemberList(ScDPUniqueStringSet& rEntries, long& rDimen long nStartLevel = -1; ScRangeListRef xRanges; - GetViewData()->GetMultiArea( xRanges ); // incl. cursor if nothing is selected + GetViewData().GetMultiArea( xRanges ); // incl. cursor if nothing is selected size_t nRangeCount = xRanges->size(); bool bContinue = true; @@ -749,10 +747,10 @@ bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& bool bFound = false; - SCCOL nCurX = GetViewData()->GetCurX(); - SCROW nCurY = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocument* pDoc = GetViewData()->GetDocument(); + SCCOL nCurX = GetViewData().GetCurX(); + SCROW nCurY = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocument* pDoc = GetViewData().GetDocument(); ScDPObject* pDPObj = pDoc->GetDPAtCursor( nCurX, nCurY, nTab ); if ( pDPObj ) @@ -827,7 +825,7 @@ bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& // in a normal dimension with date content ScRange aSelRange; - if ( (GetViewData()->GetSimpleArea( aSelRange ) == SC_MARK_SIMPLE) && + if ( (GetViewData().GetSimpleArea( aSelRange ) == SC_MARK_SIMPLE) && aSelRange.aStart == aSelRange.aEnd ) { SCCOL nSelCol = aSelRange.aStart.Col(); @@ -862,10 +860,10 @@ bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ) bool bFound = false; - SCCOL nCurX = GetViewData()->GetCurX(); - SCROW nCurY = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocument* pDoc = GetViewData()->GetDocument(); + SCCOL nCurX = GetViewData().GetCurX(); + SCROW nCurY = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocument* pDoc = GetViewData().GetDocument(); ScDPObject* pDPObj = pDoc->GetDPAtCursor( nCurX, nCurY, nTab ); if ( pDPObj ) @@ -903,7 +901,7 @@ bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ) // in a normal dimension with numeric content ScRange aSelRange; - if ( (GetViewData()->GetSimpleArea( aSelRange ) == SC_MARK_SIMPLE) && + if ( (GetViewData().GetSimpleArea( aSelRange ) == SC_MARK_SIMPLE) && aSelRange.aStart == aSelRange.aEnd ) { if ( pDoc->HasValueData( aSelRange.aStart.Col(), aSelRange.aStart.Row(), @@ -926,8 +924,8 @@ bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ) void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nParts ) { - ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); if (!pDPObj) return; @@ -1016,7 +1014,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar } // apply changes - ScDBDocFunc aFunc( *GetViewData()->GetDocShell() ); + ScDBDocFunc aFunc( *GetViewData().GetDocShell() ); pDPObj->SetSaveData( aData ); aFunc.RefreshPivotTableGroups(pDPObj); @@ -1026,8 +1024,8 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar void ScDBFunc::NumGroupDataPilot( const ScDPNumGroupInfo& rInfo ) { - ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); if (!pDPObj) return; @@ -1058,7 +1056,7 @@ void ScDBFunc::NumGroupDataPilot( const ScDPNumGroupInfo& rInfo ) } // apply changes - ScDBDocFunc aFunc( *GetViewData()->GetDocShell() ); + ScDBDocFunc aFunc( *GetViewData().GetDocShell() ); pDPObj->SetSaveData( aData ); aFunc.RefreshPivotTableGroups(pDPObj); @@ -1068,8 +1066,8 @@ void ScDBFunc::NumGroupDataPilot( const ScDPNumGroupInfo& rInfo ) void ScDBFunc::GroupDataPilot() { - ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); if (!pDPObj) return; @@ -1198,7 +1196,7 @@ void ScDBFunc::GroupDataPilot() } // apply changes - ScDBDocFunc aFunc( *GetViewData()->GetDocShell() ); + ScDBDocFunc aFunc( *GetViewData().GetDocShell() ); pDPObj->SetSaveData( aData ); aFunc.RefreshPivotTableGroups(pDPObj); @@ -1208,8 +1206,8 @@ void ScDBFunc::GroupDataPilot() void ScDBFunc::UngroupDataPilot() { - ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); if (!pDPObj) return; @@ -1274,7 +1272,7 @@ void ScDBFunc::UngroupDataPilot() } // apply changes - ScDBDocFunc aFunc( *GetViewData()->GetDocShell() ); + ScDBDocFunc aFunc( *GetViewData().GetDocShell() ); pDPObj->SetSaveData( aData ); aFunc.RefreshPivotTableGroups(pDPObj); @@ -1331,7 +1329,7 @@ void ScDBFunc::DataPilotInput( const ScAddress& rPos, const OUString& rString ) { using namespace ::com::sun::star::sheet; - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScDPObject* pDPObj = pDoc->GetDPAtCursor( rPos.Col(), rPos.Row(), rPos.Tab() ); if (!pDPObj) return; @@ -1585,7 +1583,7 @@ void ScDBFunc::DataPilotInput( const ScAddress& rPos, const OUString& rString ) if ( bChange ) { // apply changes - ScDBDocFunc aFunc( *GetViewData()->GetDocShell() ); + ScDBDocFunc aFunc( *GetViewData().GetDocShell() ); pDPObj->SetSaveData( aData ); aFunc.UpdatePivotTable(*pDPObj, true, false); } @@ -1624,7 +1622,7 @@ struct ScOUStringCollate bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16* pUserListId ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScDPObject* pDPObj = pDoc->GetDPAtCursor(rPos.Col(), rPos.Row(), rPos.Tab()); if (!pDPObj) return false; @@ -1760,7 +1758,7 @@ bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16 boost::scoped_ptr<ScDPObject> pNewObj(new ScDPObject(*pDPObj)); pNewObj->SetSaveData(aNewSaveData); - ScDBDocFunc aFunc(*GetViewData()->GetDocShell()); + ScDBDocFunc aFunc(*GetViewData().GetDocShell()); return aFunc.DataPilotUpdate(pDPObj, pNewObj.get(), true, false); } @@ -1768,7 +1766,7 @@ bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16 bool ScDBFunc::DataPilotMove( const ScRange& rSource, const ScAddress& rDest ) { bool bRet = false; - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScDPObject* pDPObj = pDoc->GetDPAtCursor( rSource.aStart.Col(), rSource.aStart.Row(), rSource.aStart.Tab() ); if ( pDPObj && pDPObj == pDoc->GetDPAtCursor( rDest.Col(), rDest.Row(), rDest.Tab() ) ) { @@ -1845,7 +1843,7 @@ bool ScDBFunc::DataPilotMove( const ScRange& rSource, const ScAddress& rDest ) pDim->SetSortInfo( &aSortInfo ); // apply changes - ScDBDocFunc aFunc( *GetViewData()->GetDocShell() ); + ScDBDocFunc aFunc( *GetViewData().GetDocShell() ); boost::scoped_ptr<ScDPObject> pNewObj(new ScDPObject( *pDPObj )); pNewObj->SetSaveData( aData ); aFunc.DataPilotUpdate( pDPObj, pNewObj.get(), true, false ); //! bApi for drag&drop? @@ -1865,8 +1863,8 @@ bool ScDBFunc::HasSelectionForDrillDown( sal_uInt16& rOrientation ) { bool bRet = false; - ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); if ( pDPObj ) { ScDPUniqueStringSet aEntries; @@ -1900,8 +1898,8 @@ bool ScDBFunc::HasSelectionForDrillDown( sal_uInt16& rOrientation ) void ScDBFunc::SetDataPilotDetails(bool bShow, const OUString* pNewDimensionName) { - ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); if ( pDPObj ) { ScDPUniqueStringSet aEntries; @@ -1974,7 +1972,7 @@ void ScDBFunc::SetDataPilotDetails(bool bShow, const OUString* pNewDimensionName } // apply changes - ScDBDocFunc aFunc( *GetViewData()->GetDocShell() ); + ScDBDocFunc aFunc( *GetViewData().GetDocShell() ); boost::scoped_ptr<ScDPObject> pNewObj(new ScDPObject( *pDPObj )); pNewObj->SetSaveData( aData ); aFunc.DataPilotUpdate( pDPObj, pNewObj.get(), true, false ); @@ -1989,7 +1987,7 @@ void ScDBFunc::SetDataPilotDetails(bool bShow, const OUString* pNewDimensionName void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet::DataPilotFieldFilter>& rFilters ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if (pDoc->GetDocumentShell()->IsReadOnly()) { ErrorMessage(STR_READONLYERR); @@ -2010,7 +2008,7 @@ void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet sal_Int32 nColSize = aTabData[0].getLength(); - SCTAB nNewTab = GetViewData()->GetTabNo(); + SCTAB nNewTab = GetViewData().GetTabNo(); boost::scoped_ptr<ScDocument> pInsDoc(new ScDocument(SCDOCMODE_CLIP)); pInsDoc->ResetClip( pDoc, nNewTab ); @@ -2058,7 +2056,7 @@ void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet pInsDoc->GetCellArea( nNewTab, nEndCol, nEndRow ); pInsDoc->SetClipArea( ScRange( 0, 0, nNewTab, nEndCol, nEndRow, nNewTab ) ); - ::svl::IUndoManager* pMgr = GetViewData()->GetDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = GetViewData().GetDocShell()->GetUndoManager(); OUString aUndo = ScGlobal::GetRscString( STR_UNDO_DOOUTLINE ); pMgr->EnterListAction( aUndo, aUndo ); @@ -2076,10 +2074,10 @@ void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet void ScDBFunc::RepeatDB( bool bRecord ) { - SCCOL nCurX = GetViewData()->GetCurX(); - SCROW nCurY = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocument* pDoc = GetViewData()->GetDocument(); + SCCOL nCurX = GetViewData().GetCurX(); + SCROW nCurY = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocument* pDoc = GetViewData().GetDocument(); ScDBData* pDBData = GetDBData(); if (bRecord && !pDoc->IsUndoEnabled()) bRecord = false; @@ -2139,8 +2137,8 @@ void ScDBFunc::RepeatDB( bool bRecord ) SCCOLROW nOutStartRow; SCCOLROW nOutEndCol; SCCOLROW nOutEndRow; - pTable->GetColArray()->GetRange( nOutStartCol, nOutEndCol ); - pTable->GetRowArray()->GetRange( nOutStartRow, nOutEndRow ); + pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol ); + pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow ); pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true ); pDoc->CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), MAXROW, nTab, IDF_NONE, false, pUndoDoc ); @@ -2224,8 +2222,8 @@ void ScDBFunc::RepeatDB( bool bRecord ) } } - GetViewData()->GetDocShell()->GetUndoManager()->AddUndoAction( - new ScUndoRepeatDB( GetViewData()->GetDocShell(), nTab, + GetViewData().GetDocShell()->GetUndoManager()->AddUndoAction( + new ScUndoRepeatDB( GetViewData().GetDocShell(), nTab, nStartCol, nStartRow, nEndCol, nEndRow, nNewEndRow, nCurX, nCurY, @@ -2234,7 +2232,7 @@ void ScDBFunc::RepeatDB( bool bRecord ) pOld, pNew ) ); } - GetViewData()->GetDocShell()->PostPaint( + GetViewData().GetDocShell()->PostPaint( ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE); } diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index d5e280d66a1c..ab48a9ceec16 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -371,8 +371,8 @@ void ScDrawView::DoCopy() // Copy data referenced by the chart objects to the draw clip // document. We need to do this before GetMarkedObjModel() below. ScDocShellRef xDocSh = *ScGlobal::pDrawClipDocShellRef; - ScDocument* pClipDoc = xDocSh->GetDocument(); - copyChartRefDataToClipDoc(pDoc, pClipDoc, aRanges); + ScDocument& rClipDoc = xDocSh->GetDocument(); + copyChartRefDataToClipDoc(pDoc, &rClipDoc, aRanges); } SdrModel* pModel = GetMarkedObjModel(); ScDrawLayer::SetGlobalDrawPersist(NULL); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index a0817d8bc512..900b21d9b345 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -151,9 +151,9 @@ ScFormatShell::~ScFormatShell() void ScFormatShell::GetStyleState( SfxItemSet& rSet ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - SfxStyleSheetBasePool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument* pDoc = GetViewData()->GetDocument(); + ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + SfxStyleSheetBasePool* pStylePool = pDoc->GetStyleSheetPool(); bool bProtected = false; SCTAB nTabCount = pDoc->GetTableCount(); @@ -264,12 +264,12 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) const SCTAB nCurTab = GetViewData()->GetTabNo(); ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScTabViewShell* pTabViewShell= GetViewData()->GetViewShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScMarkData& rMark = GetViewData()->GetMarkData(); ScModule* pScMod = SC_MOD(); OUString aRefName; - bool bUndo = pDoc->IsUndoEnabled(); - SfxStyleSheetBasePool* pStylePool = pDoc->GetStyleSheetPool(); + bool bUndo = rDoc.IsUndoEnabled(); + SfxStyleSheetBasePool* pStylePool = rDoc.GetStyleSheetPool(); if ( (nSlotId == SID_STYLE_PREVIEW) || (nSlotId == SID_STYLE_END_PREVIEW) ) @@ -287,7 +287,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( eFamily == SFX_STYLE_FAMILY_PARA ) // CellStyles { ScMarkData aFuncMark( pViewData->GetMarkData() ); - ScViewUtil::UnmarkFiltered( aFuncMark, pDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); aFuncMark.MarkToMulti(); if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() ) @@ -298,10 +298,10 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) ScRange aRange( nCol, nRow, nTab ); aFuncMark.SetMarkArea( aRange ); } - pDoc->SetPreviewSelection( aFuncMark ); + rDoc.SetPreviewSelection( aFuncMark ); ScStyleSheet* pPreviewStyle = static_cast<ScStyleSheet*>( pStylePool->Find( aStyleName, eFamily ) ); - pDoc->SetPreviewCellStyle( pPreviewStyle ); - ScPatternAttr aAttr( *pDoc->GetSelectionPattern( aFuncMark ) ); + rDoc.SetPreviewCellStyle( pPreviewStyle ); + ScPatternAttr aAttr( *rDoc.GetSelectionPattern( aFuncMark ) ); aAttr.SetStyleSheet( pPreviewStyle ); SfxItemSet aItemSet( GetPool() ); @@ -310,7 +310,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) SfxItemSet& rNewSet = aNewAttrs.GetItemSet(); rNewSet.Put( aItemSet, false ); - pDoc->ApplySelectionPattern( aNewAttrs, pDoc->GetPreviewSelection() ); + rDoc.ApplySelectionPattern( aNewAttrs, rDoc.GetPreviewSelection() ); pTabViewShell->UpdateSelectionArea( aFuncMark, &aAttr ); } } @@ -319,20 +319,20 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // No mark at all happens when creating a new document, in which // case the selection pattern obtained would be empty (created of // GetPool()) anyway and nothing needs to be applied. - ScMarkData aPreviewMark( pDoc->GetPreviewSelection()); + ScMarkData aPreviewMark( rDoc.GetPreviewSelection()); if (aPreviewMark.IsMarked() || aPreviewMark.IsMultiMarked()) { - ScPatternAttr aAttr( *pDoc->GetSelectionPattern( aPreviewMark ) ); - if ( ScStyleSheet* pPreviewStyle = pDoc->GetPreviewCellStyle() ) + ScPatternAttr aAttr( *rDoc.GetSelectionPattern( aPreviewMark ) ); + if ( ScStyleSheet* pPreviewStyle = rDoc.GetPreviewCellStyle() ) aAttr.SetStyleSheet( pPreviewStyle ); - pDoc->SetPreviewCellStyle(NULL); + rDoc.SetPreviewCellStyle(NULL); SfxItemSet aItemSet( GetPool() ); ScPatternAttr aNewAttrs( GetViewData()->GetDocument()->GetPool() ); SfxItemSet& rNewSet = aNewAttrs.GetItemSet(); rNewSet.Put( aItemSet, false ); - pDoc->ApplySelectionPattern( aNewAttrs, aPreviewMark ); + rDoc.ApplySelectionPattern( aNewAttrs, aPreviewMark ); pTabViewShell->UpdateSelectionArea( aPreviewMark, &aAttr ); } } @@ -554,7 +554,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // ScViewData* pViewData = GetViewData(); SCCOL nCol = pViewData->GetCurX(); SCROW nRow = pViewData->GetCurY(); - pAttrItem = pDoc->GetPattern( nCol, nRow, nCurTab ); + pAttrItem = rDoc.GetPattern( nCol, nRow, nCurTab ); SfxItemSet aAttrSet = pAttrItem->GetItemSet(); aAttrSet.ClearItem( ATTR_MERGE ); @@ -592,7 +592,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // enthalten. //!!! bei Gelenheit mal eine Methode, die // das fuer einen bestimmten Style macht - pDoc->StylesToNames(); + rDoc.StylesToNames(); bConvertBack = true; pStylePool->Remove(pStyleSheet); } @@ -608,9 +608,9 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( bConvertBack ) // Namen zu Style-Pointer - pDoc->UpdStlShtPtrsFrmNms(); + rDoc.UpdStlShtPtrsFrmNms(); else - pDoc->GetPool()->CellStyleCreated( aStyleName ); + rDoc.GetPool()->CellStyleCreated( aStyleName ); // Attribute uebernehmen und Style anwenden pStyleSheet->GetItemSet().Put( aAttrSet ); @@ -665,7 +665,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) nRetMask = sal_uInt16( NULL != pStyleSheet ); if ( pStyleSheet ) { - if ( pDoc->RemovePageStyleInUse( pStyleSheet->GetName() ) ) + if ( rDoc.RemovePageStyleInUse( pStyleSheet->GetName() ) ) { ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(true), nCurTab ).UpdatePages(); rBindings.Invalidate( SID_STATUS_PAGESTYLE ); @@ -700,14 +700,14 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( pStyleSheet && !pScMod->GetIsWaterCan() ) { ScUndoApplyPageStyle* pUndoAction = 0; - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end(); for (; itr != itrEnd && *itr < nTabCount; ++itr) { - OUString aOldName = pDoc->GetPageStyle( *itr ); + OUString aOldName = rDoc.GetPageStyle( *itr ); if ( aOldName != aStyleName ) { - pDoc->SetPageStyle( *itr, aStyleName ); + rDoc.SetPageStyle( *itr, aStyleName ); ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(true), *itr ).UpdatePages(); if( !pUndoAction ) pUndoAction = new ScUndoApplyPageStyle( pDocSh, aStyleName ); @@ -729,14 +729,14 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) case SID_STYLE_NEW_BY_EXAMPLE: { - const OUString& rStrCurStyle = pDoc->GetPageStyle( nCurTab ); + const OUString& rStrCurStyle = rDoc.GetPageStyle( nCurTab ); if ( rStrCurStyle != aStyleName ) { SfxStyleSheetBase* pCurStyle = pStylePool->Find( rStrCurStyle, eFamily ); SfxItemSet aAttrSet = pCurStyle->GetItemSet(); SCTAB nInTab; - bool bUsed = pDoc->IsPageStyleInUse( aStyleName, &nInTab ); + bool bUsed = rDoc.IsPageStyleInUse( aStyleName, &nInTab ); // wenn bereits vorhanden, erstmal entfernen... if ( pStyleSheet ) @@ -807,7 +807,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) LanguageType eLang = ((SvxLanguageItem*)&rSet.Get( ATTR_LANGUAGE_FORMAT ))->GetLanguage(); - sal_uLong nLangFormat = pDoc->GetFormatTable()-> + sal_uLong nLangFormat = rDoc.GetFormatTable()-> GetFormatForLanguageIfBuiltIn( nFormat, eLang ); if ( nLangFormat != nFormat ) { @@ -820,7 +820,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) } boost::scoped_ptr<SvxNumberInfoItem> pNumberInfoItem( - pTabViewShell->MakeNumberInfoItem(pDoc, GetViewData())); + pTabViewShell->MakeNumberInfoItem(&rDoc, GetViewData())); pDocSh->PutItem( *pNumberInfoItem ); nRsc = RID_SCDLG_STYLES_PAR; @@ -886,12 +886,12 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) bool bNumFormatChanged; if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged, aOldSet, rNewSet ) ) - pDoc->InvalidateTextWidth( NULL, NULL, bNumFormatChanged ); + rDoc.InvalidateTextWidth( NULL, NULL, bNumFormatChanged ); - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTab<nTabCount; nTab++) - if (pDoc->IsStreamValid(nTab)) - pDoc->SetStreamValid(nTab, false); + if (rDoc.IsStreamValid(nTab)) + rDoc.SetStreamValid(nTab, false); sal_uLong nOldFormat = ((const SfxUInt32Item&)aOldSet. Get( ATTR_VALUE_FORMAT )).GetValue(); @@ -899,7 +899,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) Get( ATTR_VALUE_FORMAT )).GetValue(); if ( nNewFormat != nOldFormat ) { - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); const SvNumberformat* pOld = pFormatter->GetEntry( nOldFormat ); const SvNumberformat* pNew = pFormatter->GetEntry( nNewFormat ); if ( pOld && pNew && pOld->GetLanguage() != pNew->GetLanguage() ) @@ -907,7 +907,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) pNew->GetLanguage(), ATTR_LANGUAGE_FORMAT ) ); } - pDoc->GetPool()->CellStyleCreated( pStyleSheet->GetName() ); + rDoc.GetPool()->CellStyleCreated( pStyleSheet->GetName() ); } else { @@ -915,13 +915,13 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) OUString aNewName = pStyleSheet->GetName(); if ( aNewName != aOldName && - pDoc->RenamePageStyleInUse( aOldName, aNewName ) ) + rDoc.RenamePageStyleInUse( aOldName, aNewName ) ) { rBindings.Invalidate( SID_STATUS_PAGESTYLE ); rBindings.Invalidate( FID_RESET_PRINTZOOM ); } - pDoc->ModifyStyleSheet( *pStyleSheet, *pOutSet ); + rDoc.ModifyStyleSheet( *pStyleSheet, *pOutSet ); rBindings.Invalidate( FID_RESET_PRINTZOOM ); } @@ -1604,10 +1604,10 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); SfxBindings& rBindings = pViewData->GetBindings(); const SfxItemSet* pNewAttrs = rReq.GetArgs(); - sal_uInt16 nSlot = rReq.GetSlot(); + sal_uInt16 nSlot = rReq.GetSlot(); pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox ScDocument* pDoc = GetViewData()->GetDocument(); @@ -2414,7 +2414,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) // sal_uLong nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get( // ATTR_VALUE_FORMAT )).GetValue(); // - // SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + // SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); // const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat ); // if ( pFormatEntry ) // aFormatCode = pFormatEntry->GetFormatstring(); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 219f79442a1c..20d2558439a1 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2129,7 +2129,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) ScViewFunc* pView = pViewData->GetView(); pView->StopRefMode(); pViewData->ResetFillMode(); - pView->GetFunctionSet()->SetAnchorFlag( false ); // #i5819# don't use AutoFill anchor flag for selection + pView->GetFunctionSet().SetAnchorFlag( false ); // #i5819# don't use AutoFill anchor flag for selection if ( bIsDel ) { @@ -2165,7 +2165,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) ScTabView* pView = pViewData->GetView(); pView->StopRefMode(); pViewData->ResetFillMode(); - pView->GetFunctionSet()->SetAnchorFlag( false ); + pView->GetFunctionSet().SetAnchorFlag( false ); if ( aEndPos != aBlockRange.aEnd ) { @@ -2179,7 +2179,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) ScTabView* pView = pViewData->GetView(); pView->StopRefMode(); pViewData->ResetFillMode(); - pView->GetFunctionSet()->SetAnchorFlag( false ); + pView->GetFunctionSet().SetAnchorFlag( false ); pViewData->GetDocShell()->UpdateOle(pViewData); } @@ -4653,14 +4653,14 @@ void ScGridWindow::UpdateFormulas() SCROW nPosY = nY1; ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); - pDoc->ExtendHidden( nX1, nY1, nX2, nY2, nTab ); + rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab ); Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); long nMirrorWidth = GetSizePixel().Width(); - bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); if ( bLayoutRTL ) { long nEndPixel = pViewData->GetScrPos( nX2+1, nPosY, eWhich ).X(); @@ -4675,11 +4675,11 @@ void ScGridWindow::UpdateFormulas() double nPPTY = pViewData->GetPPTY(); ScTableInfo aTabInfo; - pDoc->FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, nPPTX, nPPTY, false, false ); + rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, nPPTX, nPPTY, false, false ); Fraction aZoomX = pViewData->GetZoomX(); Fraction aZoomY = pViewData->GetZoomY(); - ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, + ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); aOutputData.SetMirrorWidth( nMirrorWidth ); @@ -4897,18 +4897,18 @@ static void lcl_PaintOneRange( ScDocShell* pDocSh, const ScRange& rRange, sal_uI bool bHiddenEdge = false; SCROW nTmp; - ScDocument* pDoc = pDocSh->GetDocument(); - while ( nCol1 > 0 && pDoc->ColHidden(nCol1, nTab1) ) + ScDocument& rDoc = pDocSh->GetDocument(); + while ( nCol1 > 0 && rDoc.ColHidden(nCol1, nTab1) ) { --nCol1; bHiddenEdge = true; } - while ( nCol2 < MAXCOL && pDoc->ColHidden(nCol2, nTab1) ) + while ( nCol2 < MAXCOL && rDoc.ColHidden(nCol2, nTab1) ) { ++nCol2; bHiddenEdge = true; } - nTmp = pDoc->FirstVisibleRow(0, nRow1, nTab1); + nTmp = rDoc.FirstVisibleRow(0, nRow1, nTab1); if (!ValidRow(nTmp)) nTmp = 0; if (nTmp < nRow1) @@ -4916,7 +4916,7 @@ static void lcl_PaintOneRange( ScDocShell* pDocSh, const ScRange& rRange, sal_uI nRow1 = nTmp; bHiddenEdge = true; } - nTmp = pDoc->FirstVisibleRow(nRow2, MAXROW, nTab1); + nTmp = rDoc.FirstVisibleRow(nRow2, MAXROW, nTab1); if (!ValidRow(nTmp)) nTmp = MAXROW; if (nTmp > nRow2) @@ -4953,9 +4953,9 @@ static void lcl_PaintRefChanged( ScDocShell* pDocSh, const ScRange& rOldUn, cons aNew.Justify(); if ( aOld.aStart == aOld.aEnd ) //! Tab ignorieren? - pDocSh->GetDocument()->ExtendMerge(aOld); + pDocSh->GetDocument().ExtendMerge(aOld); if ( aNew.aStart == aNew.aEnd ) //! Tab ignorieren? - pDocSh->GetDocument()->ExtendMerge(aNew); + pDocSh->GetDocument().ExtendMerge(aNew); SCCOL nOldCol1 = aOld.aStart.Col(); SCROW nOldRow1 = aOld.aStart.Row(); @@ -5193,9 +5193,9 @@ SvxAdjust toSvxAdjust( const ScPatternAttr& rPat ) boost::shared_ptr<ScFieldEditEngine> createEditEngine( ScDocShell* pDocSh, const ScPatternAttr& rPat ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); - boost::shared_ptr<ScFieldEditEngine> pEngine(new ScFieldEditEngine(pDoc, pDoc->GetEditPool())); + boost::shared_ptr<ScFieldEditEngine> pEngine(new ScFieldEditEngine(&rDoc, rDoc.GetEditPool())); ScSizeDeviceProvider aProv(pDocSh); pEngine->SetRefDevice(aProv.GetDevice()); pEngine->SetRefMapMode(MAP_100TH_MM); @@ -5251,14 +5251,14 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, SCTAB nTab = pViewData->GetTabNo(); ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); OUString sURL; ScRefCellValue aCell; - bool bFound = lcl_GetHyperlinkCell(pDoc, nPosX, nPosY, nTab, aCell, sURL); + bool bFound = lcl_GetHyperlinkCell(&rDoc, nPosX, nPosY, nTab, aCell, sURL); if( !bFound ) return false; - const ScPatternAttr* pPattern = pDoc->GetPattern( nPosX, nPosY, nTab ); + const ScPatternAttr* pPattern = rDoc.GetPattern( nPosX, nPosY, nTab ); // bForceToTop = sal_False, use the cell's real position Rectangle aEditRect = pViewData->GetEditArea( eWhich, nPosX, nPosY, this, pPattern, false ); if (rPos.Y() < aEditRect.Top()) @@ -5309,7 +5309,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, if (sURL.isEmpty()) pTextObj.reset(aCell.mpFormula->CreateURLObject()); else - pTextObj.reset(ScEditUtil::CreateURLObjectFromURL(*pDoc, sURL, sURL)); + pTextObj.reset(ScEditUtil::CreateURLObjectFromURL(rDoc, sURL, sURL)); if (pTextObj.get()) pEngine->SetText(*pTextObj); @@ -5366,11 +5366,11 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol SCTAB nTab = pViewData->GetTabNo(); ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScAddress aCellPos(nCol1, nRow, nTab); ScRefCellValue aCell; - aCell.assign(*pDoc, aCellPos); + aCell.assign(rDoc, aCellPos); if (aCell.meType != CELLTYPE_STRING && aCell.meType != CELLTYPE_EDIT) return false; @@ -5378,7 +5378,7 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol if (!pRanges) return false; - const ScPatternAttr* pPattern = pDoc->GetPattern(nCol1, nRow, nTab); + const ScPatternAttr* pPattern = rDoc.GetPattern(nCol1, nRow, nTab); Rectangle aEditRect = pViewData->GetEditArea(eWhich, nCol1, nRow, this, pPattern, false); if (rPos.Y() < aEditRect.Top()) diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index d308eee6a2b7..9c79f0c7372e 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -926,9 +926,9 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) { ScViewFunc* pViewFunc = pViewData->GetView(); ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); - bool bUndo (pDoc->IsUndoEnabled()); + bool bUndo (rDoc.IsUndoEnabled()); if ( bBreak ) { @@ -945,7 +945,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) bool bGrow = !bHide && nNew > nPagebreakBreak; if ( bColumn ) { - if (pDoc->HasColBreak(static_cast<SCCOL>(nPagebreakBreak), nTab) & BREAK_MANUAL) + if (rDoc.HasColBreak(static_cast<SCCOL>(nPagebreakBreak), nTab) & BREAK_MANUAL) { ScAddress aOldAddr( static_cast<SCCOL>(nPagebreakBreak), nPosY, nTab ); pViewFunc->DeletePageBreak( true, true, &aOldAddr, false ); @@ -958,7 +958,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) if ( bGrow ) { // vorigen Break auf hart, und Skalierung aendern - bool bManualBreak = (pDoc->HasColBreak(static_cast<SCCOL>(nPagebreakPrev), nTab) & BREAK_MANUAL); + bool bManualBreak = (rDoc.HasColBreak(static_cast<SCCOL>(nPagebreakPrev), nTab) & BREAK_MANUAL); if ( static_cast<SCCOL>(nPagebreakPrev) > aPagebreakSource.aStart.Col() && !bManualBreak ) { ScAddress aPrev( static_cast<SCCOL>(nPagebreakPrev), nPosY, nTab ); @@ -972,7 +972,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) } else { - if (pDoc->HasRowBreak(nPagebreakBreak, nTab) & BREAK_MANUAL) + if (rDoc.HasRowBreak(nPagebreakBreak, nTab) & BREAK_MANUAL) { ScAddress aOldAddr( nPosX, nPagebreakBreak, nTab ); pViewFunc->DeletePageBreak( false, true, &aOldAddr, false ); @@ -985,7 +985,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) if ( bGrow ) { // vorigen Break auf hart, und Skalierung aendern - bool bManualBreak = (pDoc->HasRowBreak(nPagebreakPrev, nTab) & BREAK_MANUAL); + bool bManualBreak = (rDoc.HasRowBreak(nPagebreakPrev, nTab) & BREAK_MANUAL); if ( nPagebreakPrev > aPagebreakSource.aStart.Row() && !bManualBreak ) { ScAddress aPrev( nPosX, nPagebreakPrev, nTab ); @@ -1015,12 +1015,12 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) // Druckbereich setzen OUString aNewRanges; - sal_uInt16 nOldCount = pDoc->GetPrintRangeCount( nTab ); + sal_uInt16 nOldCount = rDoc.GetPrintRangeCount( nTab ); if ( nOldCount ) { for (sal_uInt16 nPos=0; nPos<nOldCount; nPos++) { - const ScRange* pOld = pDoc->GetPrintRange( nTab, nPos ); + const ScRange* pOld = rDoc.GetPrintRange( nTab, nPos ); if ( pOld ) { OUString aTemp; @@ -1040,7 +1040,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) else if (!bHide) aNewRanges = aPagebreakDrag.Format(SCA_VALID); - pViewFunc->SetPrintRanges( pDoc->IsPrintEntireSheet( nTab ), &aNewRanges, NULL, NULL, false ); + pViewFunc->SetPrintRanges( rDoc.IsPrintEntireSheet( nTab ), &aNewRanges, NULL, NULL, false ); } } diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 69de77b6ebcf..d31da8a24148 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -416,14 +416,14 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod ++nPaintCount; // merken, dass gemalt wird (wichtig beim Invertieren) ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); - pDoc->ExtendHidden( nX1, nY1, nX2, nY2, nTab ); + rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab ); Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); long nMirrorWidth = GetSizePixel().Width(); - bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); long nLayoutSign = bLayoutRTL ? -1 : 1; if ( bLayoutRTL ) { @@ -439,7 +439,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod SCROW nCurY = pViewData->GetCurY(); SCCOL nCurEndX = nCurX; SCROW nCurEndY = nCurY; - pDoc->ExtendMerge( nCurX, nCurY, nCurEndX, nCurEndY, nTab ); + rDoc.ExtendMerge( nCurX, nCurY, nCurEndX, nCurEndY, nTab ); bool bCurVis = nCursorHideCount==0 && ( nCurEndX+1 >= nX1 && nCurX <= nX2+1 && nCurEndY+1 >= nY1 && nCurY <= nY2+1 ); @@ -449,7 +449,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod { SCCOL nHdlX = aAutoMarkPos.Col(); SCROW nHdlY = aAutoMarkPos.Row(); - pDoc->ExtendMerge( nHdlX, nHdlY, nHdlX, nHdlY, nTab ); + rDoc.ExtendMerge( nHdlX, nHdlY, nHdlX, nHdlY, nTab ); bCurVis = ( nHdlX+1 >= nX1 && nHdlX <= nX2 && nHdlY+1 >= nY1 && nHdlY <= nY2 ); // links und oben ist nicht betroffen @@ -466,13 +466,13 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod // Datenblock ScTableInfo aTabInfo; - pDoc->FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, + rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, nPPTX, nPPTY, false, bFormulaMode, &pViewData->GetMarkData() ); Fraction aZoomX = pViewData->GetZoomX(); Fraction aZoomY = pViewData->GetZoomY(); - ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, + ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); @@ -486,7 +486,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod { // use printer for text formatting - OutputDevice* pFmtDev = pDoc->GetPrinter(); + OutputDevice* pFmtDev = rDoc.GetPrinter(); pFmtDev->SetMapMode( pViewData->GetLogicMode(eWhich) ); aOutputData.SetFmtDevice( pFmtDev ); } @@ -514,7 +514,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod aOutputData.SetGridColor ( aGridColor ); aOutputData.SetShowNullValues ( rOpts.GetOption( VOPT_NULLVALS ) ); aOutputData.SetShowFormulas ( bFormulaMode ); - aOutputData.SetShowSpellErrors ( pDoc->GetDocOptions().IsAutoSpell() ); + aOutputData.SetShowSpellErrors ( rDoc.GetDocOptions().IsAutoSpell() ); aOutputData.SetMarkClipped ( bMarkClipped ); aOutputData.SetUseStyleColor( true ); // always set in table view @@ -657,7 +657,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod pContentDev->SetMapMode(aCurrentMapMode); } - if ( pDoc->HasBackgroundDraw( nTab, aDrawingRectLogic ) ) + if ( rDoc.HasBackgroundDraw( nTab, aDrawingRectLogic ) ) { pContentDev->SetMapMode(MAP_PIXEL); aOutputData.DrawClear(); @@ -721,10 +721,10 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod //! Test, ob ChangeTrack-Anzeige aktiv ist //! Szenario-Rahmen per View-Optionen abschaltbar? - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); const std::vector<ScHighlightEntry> &rHigh = pViewData->GetView()->GetHighlightRanges(); - bool bHasScenario = ( nTab+1<nTabCount && pDoc->IsScenario(nTab+1) && !pDoc->IsScenario(nTab) ); - bool bHasChange = ( pDoc->GetChangeTrack() != NULL ); + bool bHasScenario = ( nTab+1<nTabCount && rDoc.IsScenario(nTab+1) && !rDoc.IsScenario(nTab) ); + bool bHasChange = ( rDoc.GetChangeTrack() != NULL ); if ( bHasChange || bHasScenario || !rHigh.empty() ) { @@ -870,8 +870,8 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod CheckNeedsRepaint(); // Flag drawn formula cells "unchanged". - pDoc->ResetChanged(ScRange(nX1,nY1,nTab,nX2,nY2,nTab)); - pDoc->ClearFormulaContext(); + rDoc.ResetChanged(ScRange(nX1,nY1,nTab,nX2,nY2,nTab)); + rDoc.ClearFormulaContext(); } void ScGridWindow::CheckNeedsRepaint() diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index dcf157e05ee9..44643d60062b 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -611,9 +611,9 @@ bool ScHeaderControl::IsSelectionAllowed(SCCOLROW nPos) const if (!pViewSh) return false; - ScViewData* pViewData = pViewSh->GetViewData(); - sal_uInt16 nTab = pViewData->GetTabNo(); - ScDocument* pDoc = pViewData->GetDocument(); + ScViewData& rViewData = pViewSh->GetViewData(); + sal_uInt16 nTab = rViewData.GetTabNo(); + ScDocument* pDoc = rViewData.GetDocument(); const ScTableProtection* pProtect = pDoc->GetTabProtection(nTab); bool bSelectAllowed = true; if ( pProtect && pProtect->isProtected() ) @@ -827,10 +827,10 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt ) if ( rCEvt.IsMouseEvent() ) { // #i18735# select the column/row under the mouse pointer - ScViewData* pViewData = pViewSh->GetViewData(); + ScViewData& rViewData = pViewSh->GetViewData(); SelectWindow(); // also deselects drawing objects, stops draw text edit - if ( pViewData->HasEditView( pViewData->GetActivePart() ) ) + if ( rViewData.HasEditView( rViewData.GetActivePart() ) ) SC_MOD()->InputEnterHandler(); // always end edit mode MouseEvent aMEvt( rCEvt.GetMousePosPixel() ); @@ -840,7 +840,7 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt ) // Selecting this cell is not allowed, neither is context menu. return; - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = rViewData.GetTabNo(); ScRange aNewRange; if ( bVertical ) aNewRange = ScRange( 0, sal::static_int_cast<SCROW>(nPos), nTab, @@ -851,7 +851,7 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt ) // see if any part of the range is already selected ScRangeList aRanges; - pViewData->GetMarkData().FillRangeListWithMarks( &aRanges, false ); + rViewData.GetMarkData().FillRangeListWithMarks( &aRanges, false ); bool bSelected = aRanges.Intersects(aNewRange); // select the range if no part of it was selected diff --git a/sc/source/ui/view/olinewin.cxx b/sc/source/ui/view/olinewin.cxx index 162271b7d738..be76dde7a1b1 100644 --- a/sc/source/ui/view/olinewin.cxx +++ b/sc/source/ui/view/olinewin.cxx @@ -157,7 +157,7 @@ const ScOutlineArray* ScOutlineWindow::GetOutlineArray() const { const ScOutlineTable* pTable = GetDoc().GetOutlineTable( GetTab() ); if ( !pTable ) return NULL; - return mbHoriz ? pTable->GetColArray() : pTable->GetRowArray(); + return mbHoriz ? &pTable->GetColArray() : &pTable->GetRowArray(); } const ScOutlineEntry* ScOutlineWindow::GetOutlineEntry( size_t nLevel, size_t nEntry ) const diff --git a/sc/source/ui/view/pfuncache.cxx b/sc/source/ui/view/pfuncache.cxx index 062716a3a2da..404d4dc3a1c1 100644 --- a/sc/source/ui/view/pfuncache.cxx +++ b/sc/source/ui/view/pfuncache.cxx @@ -47,8 +47,8 @@ ScPrintFuncCache::ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark, pSelRange = &aRange; } - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); // avoid repeated progress bars if row heights for all sheets are needed if ( nTabCount > 1 && rMark.GetSelectCount() == nTabCount ) @@ -94,8 +94,8 @@ void ScPrintFuncCache::InitLocations( const ScMarkData& rMark, OutputDevice* pDe long nRenderer = 0; // 0-based physical page number across sheets long nTabStart = 0; - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); for (; itr != itrEnd && (*itr) < nTabCount; ++itr) { @@ -112,7 +112,7 @@ void ScPrintFuncCache::InitLocations( const ScMarkData& rMark, OutputDevice* pDe aPage.SetTotalRange( Range(0,RANGE_MAX) ); aPage.Select( aPageRange ); - ScPreviewLocationData aLocData( pDoc, pDev ); + ScPreviewLocationData aLocData( &rDoc, pDev ); aFunc.DoPrint( aPage, nTabStart, nDisplayStart, false, &aLocData ); ScRange aCellRange; @@ -150,8 +150,8 @@ bool ScPrintFuncCache::IsSameSelection( const ScPrintSelectionStatus& rStatus ) SCTAB ScPrintFuncCache::GetTabForPage( long nPage ) const { - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); SCTAB nTab = 0; while ( nTab < nTabCount && nPage >= nPages[nTab] ) nPage -= nPages[nTab++]; @@ -173,10 +173,10 @@ long ScPrintFuncCache::GetDisplayStart( SCTAB nTab ) const //! merge with lcl_GetDisplayStart in preview? long nDisplayStart = 0; - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); for (SCTAB i=0; i<nTab; i++) { - if ( pDoc->NeedPageResetAfterTab(i) ) + if ( rDoc.NeedPageResetAfterTab(i) ) nDisplayStart = 0; else { diff --git a/sc/source/ui/view/pgbrksh.cxx b/sc/source/ui/view/pgbrksh.cxx index 5265c93a1cb7..d98f8e9ba24c 100644 --- a/sc/source/ui/view/pgbrksh.cxx +++ b/sc/source/ui/view/pgbrksh.cxx @@ -47,10 +47,10 @@ ScPageBreakShell::ScPageBreakShell( ScTabViewShell* pViewSh ) : SfxShell(pViewSh) { SetPool( &pViewSh->GetPool() ); - ScViewData* pViewData = pViewSh->GetViewData(); - ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + ScViewData& rViewData = pViewSh->GetViewData(); + ::svl::IUndoManager* pMgr = rViewData.GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); - if ( !pViewData->GetDocument()->IsUndoEnabled() ) + if ( !rViewData.GetDocument()->IsUndoEnabled() ) { pMgr->SetMaxUndoActionCount( 0 ); } diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx index ff4b004989ed..3e425ccb5a53 100644 --- a/sc/source/ui/view/pivotsh.cxx +++ b/sc/source/ui/view/pivotsh.cxx @@ -57,10 +57,10 @@ ScPivotShell::ScPivotShell( ScTabViewShell* pViewSh ) : pViewShell( pViewSh ) { SetPool( &pViewSh->GetPool() ); - ScViewData* pViewData = pViewSh->GetViewData(); - ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + ScViewData& rViewData = pViewSh->GetViewData(); + ::svl::IUndoManager* pMgr = rViewData.GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); - if ( !pViewData->GetDocument()->IsUndoEnabled() ) + if ( !rViewData.GetDocument()->IsUndoEnabled() ) { pMgr->SetMaxUndoActionCount( 0 ); } @@ -100,10 +100,10 @@ void ScPivotShell::Execute( SfxRequest& rReq ) nSrcTab = pDesc->GetSourceRange().aStart.Tab(); } - ScViewData* pViewData = pViewShell->GetViewData(); + ScViewData& rViewData = pViewShell->GetViewData(); SfxItemSet aArgSet( pViewShell->GetPool(), SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, pViewData, &aQueryParam ) ); + aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, &rViewData, &aQueryParam ) ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); @@ -114,7 +114,7 @@ void ScPivotShell::Execute( SfxRequest& rReq ) if( pDlg->Execute() == RET_OK ) { - ScSheetSourceDesc aNewDesc(pViewData->GetDocument()); + ScSheetSourceDesc aNewDesc(rViewData.GetDocument()); if( pDesc ) aNewDesc = *pDesc; @@ -123,9 +123,9 @@ void ScPivotShell::Execute( SfxRequest& rReq ) ScDPObject aNewObj( *pDPObj ); aNewObj.SetSheetDesc( aNewDesc ); - ScDBDocFunc aFunc( *pViewData->GetDocShell() ); + ScDBDocFunc aFunc( *rViewData.GetDocShell() ); aFunc.DataPilotUpdate( pDPObj, &aNewObj, true, false ); - pViewData->GetView()->CursorPosChanged(); // shells may be switched + rViewData.GetView()->CursorPosChanged(); // shells may be switched } } } @@ -135,9 +135,9 @@ void ScPivotShell::Execute( SfxRequest& rReq ) void ScPivotShell::GetState( SfxItemSet& rSet ) { - ScDocShell* pDocSh = pViewShell->GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - bool bDisable = pDocSh->IsReadOnly() || pDoc->GetChangeTrack(); + ScDocShell* pDocSh = pViewShell->GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + bool bDisable = pDocSh->IsReadOnly() || rDoc.GetChangeTrack(); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); @@ -169,7 +169,7 @@ void ScPivotShell::GetState( SfxItemSet& rSet ) ScDPObject* ScPivotShell::GetCurrDPObject() { - const ScViewData& rViewData = *pViewShell->GetViewData(); + const ScViewData& rViewData = pViewShell->GetViewData(); return rViewData.GetDocument()->GetDPAtCursor( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() ); } diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 3b3c0ace8d63..cc9f8eb2b00e 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -152,8 +152,8 @@ ScPreview::~ScPreview() void ScPreview::UpdateDrawView() // nTab must be right { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDrawLayer* pModel = pDoc->GetDrawLayer(); // is not 0 + ScDocument& rDoc = pDocShell->GetDocument(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); // is not 0 // #114135# if ( pModel ) @@ -201,8 +201,8 @@ void ScPreview::TestLastPage() for (sal_uInt16 i=0; i<nTab; i++) nTabStart += nPages[i]; - ScDocument* pDoc = pDocShell->GetDocument(); - nDisplayStart = lcl_GetDisplayStart( nTab, pDoc, nPages ); + ScDocument& rDoc = pDocShell->GetDocument(); + nDisplayStart = lcl_GetDisplayStart( nTab, &rDoc, nPages ); } else // empty Document { @@ -224,8 +224,8 @@ void ScPreview::CalcPages() { WaitObject aWait( this ); - ScDocument* pDoc = pDocShell->GetDocument(); - nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + nTabCount = rDoc.GetTableCount(); SCTAB nStart = nTabsTested; if (!bValid) @@ -284,7 +284,7 @@ void ScPreview::CalcPages() } } - nDisplayStart = lcl_GetDisplayStart( nTab, pDoc, nPages ); + nDisplayStart = lcl_GetDisplayStart( nTab, &rDoc, nPages ); if (nTabCount > nTabsTested) nTabsTested = nTabCount; @@ -329,8 +329,8 @@ void ScPreview::RecalcPages() // only nPageNo is changed } } - ScDocument* pDoc = pDocShell->GetDocument(); - nDisplayStart = lcl_GetDisplayStart( nTab, pDoc, nPages ); + ScDocument& rDoc = pDocShell->GetDocument(); + nDisplayStart = lcl_GetDisplayStart( nTab, &rDoc, nPages ); } TestLastPage(); // to test, if after last page @@ -382,8 +382,8 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) bool bHeaderOn = false; bool bFooterOn = false; - ScDocument* pDoc = pDocShell->GetDocument(); - bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + ScDocument& rDoc = pDocShell->GetDocument(); + bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); Size aLocalPageSize; if ( bValidPage ) @@ -506,7 +506,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) const ScPatternAttr& rDefPattern = static_cast<const ScPatternAttr&>( - pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)); + rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN)); boost::scoped_ptr<ScEditEngineDefaulter> pEditEng( new ScEditEngineDefaulter(EditEngine::CreatePool(), true)); @@ -687,7 +687,7 @@ const ScPreviewLocationData& ScPreview::GetLocationData() { if ( !pLocationData ) { - pLocationData = new ScPreviewLocationData( pDocShell->GetDocument(), this ); + pLocationData = new ScPreviewLocationData( &pDocShell->GetDocument(), this ); bLocationValid = false; } if ( !bLocationValid ) @@ -773,7 +773,7 @@ void ScPreview::SetPageNo( long nPage ) long ScPreview::GetFirstPage(SCTAB nTabP) { - SCTAB nDocTabCount = pDocShell->GetDocument()->GetTableCount(); + SCTAB nDocTabCount = pDocShell->GetDocument().GetTableCount(); if (nTabP >= nDocTabCount) nTabP = nDocTabCount-1; @@ -829,7 +829,7 @@ sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly) aWinSize.Width() -= 2 * aMarginSize.Width(); aWinSize.Height() -= 2 * aMarginSize.Height(); - Size aLocalPageSize = lcl_GetDocPageSize( pDocShell->GetDocument(), nTab ); + Size aLocalPageSize = lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab ); if ( aLocalPageSize.Width() && aLocalPageSize.Height() ) { long nZoomX = (long) ( aWinSize.Width() * 100 / ( aLocalPageSize.Width() * nWinScaleX )); @@ -1069,18 +1069,18 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); - long nWidth = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Width(); - long nHeight = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Height(); + long nWidth = (long) lcl_GetDocPageSize(&pDocShell->GetDocument(), nTab).Width(); + long nHeight = (long) lcl_GetDocPageSize(&pDocShell->GetDocument(), nTab).Height(); if( rMEvt.IsLeft() && GetPointer() == POINTER_HSIZEBAR ) { SetPointer( Pointer( POINTER_ARROW ) ); - ScDocument * pDoc = pDocShell->GetDocument(); - OUString aOldName = pDoc->GetPageStyle( nTab ); - bool bUndo = pDoc->IsUndoEnabled(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + OUString aOldName = rDoc.GetPageStyle( nTab ); + bool bUndo = rDoc.IsUndoEnabled(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE ); if ( pStyleSheet ) @@ -1173,10 +1173,10 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) } if( bMoveRulerAction ) { - ScDocument * pDoc = pDocShell->GetDocument(); - bool bUndo = pDoc->IsUndoEnabled(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); - SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ); + ScDocument& rDoc = pDocShell->GetDocument(); + bool bUndo = rDoc.IsUndoEnabled(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pStylePool->Find( rDoc.GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ); OSL_ENSURE( pStyleSheet, "PageStyle not found" ); if ( pStyleSheet ) { @@ -1264,8 +1264,8 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if( rMEvt.IsLeft() && GetPointer() == POINTER_HSPLIT ) { SetPointer(POINTER_ARROW); - ScDocument* pDoc = pDocShell->GetDocument(); - bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + ScDocument& rDoc = pDocShell->GetDocument(); + bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); bool bMoveRulerAction = true; if( aButtonDownPt.X() == aButtonUpPt.X() ) { @@ -1284,13 +1284,13 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if( !bLayoutRTL ) { nNewColWidth = (long) ( PixelToLogic( Point( rMEvt.GetPosPixel().X() - nRight[ nColNumberButttonDown ], 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale; - nNewColWidth += pDocShell->GetDocument()->GetColWidth( nColNumberButttonDown, nTab ); + nNewColWidth += pDocShell->GetDocument().GetColWidth( nColNumberButttonDown, nTab ); } else { nNewColWidth = (long) ( PixelToLogic( Point( nRight[ nColNumberButttonDown ] - rMEvt.GetPosPixel().X(), 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale; - nNewColWidth += pDocShell->GetDocument()->GetColWidth( nColNumberButttonDown, nTab ); + nNewColWidth += pDocShell->GetDocument().GetColWidth( nColNumberButttonDown, nTab ); } if( nNewColWidth >= 0 ) @@ -1324,8 +1324,8 @@ void ScPreview::MouseMove( const MouseEvent& rMEvt ) long nTopMargin = 0; long nBottomMargin = 0; - long nWidth = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Width(); - long nHeight = (long) lcl_GetDocPageSize(pDocShell->GetDocument(), nTab).Height(); + long nWidth = (long) lcl_GetDocPageSize(&pDocShell->GetDocument(), nTab).Width(); + long nHeight = (long) lcl_GetDocPageSize(&pDocShell->GetDocument(), nTab).Height(); if ( nPageNo < nTotalPages ) { @@ -1587,8 +1587,8 @@ void ScPreview::DragMove( long nDragMovePos, sal_uInt16 nFlags ) void ScPreview::DrawInvert( long nDragPos, sal_uInt16 nFlags ) { - long nHeight = (long) lcl_GetDocPageSize( pDocShell->GetDocument(), nTab ).Height(); - long nWidth = (long) lcl_GetDocPageSize( pDocShell->GetDocument(), nTab ).Width(); + long nHeight = (long) lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab ).Height(); + long nWidth = (long) lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab ).Width(); if( nFlags == POINTER_HSIZEBAR || nFlags == POINTER_HSPLIT ) { Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1,(long)( ( nHeight * HMM_PER_TWIPS ) - aOffset.Y())); diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 2fe8b19669ef..a1ad80126ae1 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -136,7 +136,7 @@ void ScPreviewShell::Construct( Window* pParent ) SetWindow( pPreview ); StartListening(*pDocShell,true); StartListening(*SFX_APP(),true); // #i62045# #i62046# application is needed for Calc's own hints - SfxBroadcaster* pDrawBC = pDocShell->GetDocument()->GetDrawBroadcaster(); + SfxBroadcaster* pDrawBC = pDocShell->GetDocument().GetDrawBroadcaster(); if (pDrawBC) StartListening(*pDrawBC); @@ -165,10 +165,10 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, //! or completely forget aSourceData on ScTablesHint? ScTabViewShell* pTabViewShell = ((ScTabViewShell*)pOldSh); - const ScViewData* pData = pTabViewShell->GetViewData(); - pData->WriteUserDataSequence( aSourceData ); - pPreview->SetSelectedTabs(pData->GetMarkData()); - InitStartTable( pData->GetTabNo() ); + const ScViewData& rData = pTabViewShell->GetViewData(); + rData.WriteUserDataSequence( aSourceData ); + pPreview->SetSelectedTabs(rData.GetMarkData()); + InitStartTable( rData.GetTabNo() ); // also have to store the TabView's DesignMode state // (only if draw view exists) @@ -189,7 +189,7 @@ ScPreviewShell::~ScPreviewShell() BroadcastAccessibility( SfxSimpleHint( SFX_HINT_DYING ) ); DELETEZ(pAccessibilityBroadcaster); - SfxBroadcaster* pDrawBC = pDocShell->GetDocument()->GetDrawBroadcaster(); + SfxBroadcaster* pDrawBC = pDocShell->GetDocument().GetDrawBroadcaster(); if (pDrawBC) EndListening(*pDrawBC); EndListening(*SFX_APP()); @@ -240,11 +240,11 @@ void ScPreviewShell::OuterResizePixel( const Point &rOfs, const Size &rSize ) bool ScPreviewShell::GetPageSize( Size& aPageSize ) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTab = pPreview->GetTab(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); - SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pStylePool->Find( rDoc.GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ); OSL_ENSURE(pStyleSheet,"No style sheet"); if (!pStyleSheet) return false; @@ -738,8 +738,8 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) { const SfxPoolItem* pItem; SCTAB nTab = pPreview->GetTab(); - OUString aOldName = pDocShell->GetDocument()->GetPageStyle( pPreview->GetTab() ); - ScStyleSheetPool* pStylePool = pDocShell->GetDocument()->GetStyleSheetPool(); + OUString aOldName = pDocShell->GetDocument().GetPageStyle( pPreview->GetTab() ); + ScStyleSheetPool* pStylePool = pDocShell->GetDocument().GetStyleSheetPool(); SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE ); OSL_ENSURE( pStyleSheet, "PageStyle not found! :-/" ); @@ -852,8 +852,8 @@ void ScPreviewShell::GetState( SfxItemSet& rSet ) rSet.DisableItem( nWhich ); else { - OUString aOldName = pDocShell->GetDocument()->GetPageStyle( pPreview->GetTab() ); - ScStyleSheetPool* pStylePool = pDocShell->GetDocument()->GetStyleSheetPool(); + OUString aOldName = pDocShell->GetDocument().GetPageStyle( pPreview->GetTab() ); + ScStyleSheetPool* pStylePool = pDocShell->GetDocument().GetStyleSheetPool(); SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE ); OSL_ENSURE( pStyleSheet, "PageStyle not found! :-/" ); @@ -894,10 +894,10 @@ void ScPreviewShell::GetState( SfxItemSet& rSet ) void ScPreviewShell::FillFieldData( ScHeaderFieldData& rData ) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTab = pPreview->GetTab(); OUString aTmp; - pDoc->GetName(nTab, aTmp); + rDoc.GetName(nTab, aTmp); rData.aTabName = aTmp; if( pDocShell->getDocProperties()->getTitle().getLength() != 0 ) @@ -1200,7 +1200,7 @@ const ScPreviewLocationData& ScPreviewShell::GetLocationData() return pPreview->GetLocationData(); } -ScDocument* ScPreviewShell::GetDocument() +ScDocument& ScPreviewShell::GetDocument() { return pDocShell->GetDocument(); } diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx index bc8b5f2fc43b..f33443f49ac0 100644 --- a/sc/source/ui/view/prevwsh2.cxx +++ b/sc/source/ui/view/prevwsh2.cxx @@ -43,7 +43,7 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; case SC_HINT_DRWLAYER_NEW: { - SfxBroadcaster* pDrawBC = pDocShell->GetDocument()->GetDrawBroadcaster(); + SfxBroadcaster* pDrawBC = pDocShell->GetDocument().GetDrawBroadcaster(); if (pDrawBC) StartListening(*pDrawBC); } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 9988884e7c5e..9362c0838244 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -167,7 +167,7 @@ static long lcl_LineTotal(const ::editeng::SvxBorderLine* pLine) void ScPrintFunc::Construct( const ScPrintOptions* pOptions ) { pDocShell->UpdatePendingRowHeights( nPrintTab ); - pDoc = pDocShell->GetDocument(); + pDoc = &pDocShell->GetDocument(); SfxPrinter* pDocPrinter = pDoc->GetPrinter(); // use the printer, even for preview if (pDocPrinter) diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 66012a845943..3d1481cacf5c 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -243,7 +243,7 @@ ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper( Window* pParentP, PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); OSL_ENSURE( pViewShell, "missing view shell :-(" ); pWindow = pViewShell ? - new ScAcceptChgDlg( pBindings, this, pParentP, pViewShell->GetViewData() ) : + new ScAcceptChgDlg( pBindings, this, pParentP, &pViewShell->GetViewData() ) : NULL; if(pWindow!=NULL) { @@ -261,7 +261,7 @@ void ScAcceptChgDlgWrapper::ReInitDlg() if(pWindow!=NULL && pViewShell) { - ((ScAcceptChgDlg*)pWindow)->ReInit(pViewShell->GetViewData()); + ((ScAcceptChgDlg*)pWindow)->ReInit(&pViewShell->GetViewData()); } } diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index 378e469b8bc5..2ba0735db856 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -734,7 +734,7 @@ void ScViewFunctionSet::DeselectAll() ScViewSelectionEngine::ScViewSelectionEngine( Window* pWindow, ScTabView* pView, ScSplitPos eSplitPos ) : - SelectionEngine( pWindow, pView->GetFunctionSet() ), + SelectionEngine( pWindow, &pView->GetFunctionSet() ), eWhich( eSplitPos ) { SetSelectionMode( MULTIPLE_SELECTION ); diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index 03e407373f4e..65fc6dcd9863 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -166,7 +166,7 @@ void ScSpellDialogChildWindow::Init() if( (mpViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() )) == 0 ) return; - mpViewData = mpViewShell->GetViewData(); + mpViewData = &mpViewShell->GetViewData(); // exit edit mode - TODO support spelling in edit mode if( mpViewData->HasEditView( mpViewData->GetActivePart() ) ) @@ -175,7 +175,7 @@ void ScSpellDialogChildWindow::Init() mxOldSel.reset( new ScSelectionState( *mpViewData ) ); mpDocShell = mpViewData->GetDocShell(); - mpDoc = mpDocShell->GetDocument(); + mpDoc = &mpDocShell->GetDocument(); const ScAddress& rCursor = mxOldSel->GetCellCursor(); SCCOL nCol = rCursor.Col(); diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index e243cc829493..602f9fbd26ea 100644 --- a/sc/source/ui/view/spelleng.cxx +++ b/sc/source/ui/view/spelleng.cxx @@ -51,7 +51,7 @@ ScConversionEngineBase::ScConversionEngineBase( ScEditEngineDefaulter( pEnginePoolP ), mrViewData( rViewData ), mrDocShell( *rViewData.GetDocShell() ), - mrDoc( *rViewData.GetDocShell()->GetDocument() ), + mrDoc( rViewData.GetDocShell()->GetDocument() ), maSelState( rViewData ), mpUndoDoc( pUndoDoc ), mpRedoDoc( pRedoDoc ), diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index e6092771e0f2..df49a4263adf 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -467,7 +467,7 @@ void ScTabControl::StartDrag( sal_Int8 /* nAction */, const Point& rPosPixel ) void ScTabControl::DoDrag( const Region& /* rRegion */ ) { ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); ScRange aTabRange( 0, 0, nTab, MAXCOL, MAXROW, nTab ); @@ -477,7 +477,7 @@ void ScTabControl::DoDrag( const Region& /* rRegion */ ) ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP ); ScClipParam aClipParam(aTabRange, false); - pDoc->CopyToClip(aClipParam, pClipDoc, &aTabMark, false); + rDoc.CopyToClip(aClipParam, pClipDoc, &aTabMark, false); TransferableObjectDescriptor aObjDesc; pDocSh->FillTransferableObjectDescriptor( aObjDesc ); @@ -504,7 +504,7 @@ static sal_uInt16 lcl_DocShellNr( ScDocument* pDoc ) { if ( pShell->Type() == TYPE(ScDocShell) ) { - if ( ((ScDocShell*)pShell)->GetDocument() == pDoc ) + if ( &((ScDocShell*)pShell)->GetDocument() == pDoc ) return nShellCnt; ++nShellCnt; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 0777d419637d..88d623b95570 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -167,8 +167,8 @@ static bool lcl_HasColOutline( const ScViewData& rViewData ) const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo()); if (pTable) { - const ScOutlineArray* pArray = pTable->GetColArray(); - if ( pArray->GetDepth() > 0 ) + const ScOutlineArray& rArray = pTable->GetColArray(); + if ( rArray.GetDepth() > 0 ) return true; } return false; @@ -179,8 +179,8 @@ static bool lcl_HasRowOutline( const ScViewData& rViewData ) const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo()); if (pTable) { - const ScOutlineArray* pArray = pTable->GetRowArray(); - if ( pArray->GetDepth() > 0 ) + const ScOutlineArray& rArray = pTable->GetRowArray(); + if ( rArray.GetDepth() > 0 ) return true; } return false; @@ -706,8 +706,8 @@ void ScTabView::UpdateVarZoom() if ( eZoomType != SVX_ZOOM_PERCENT && !bInZoomUpdate ) { bInZoomUpdate = true; - const Fraction& rOldX = GetViewData()->GetZoomX(); - const Fraction& rOldY = GetViewData()->GetZoomY(); + const Fraction& rOldX = GetViewData().GetZoomX(); + const Fraction& rOldY = GetViewData().GetZoomY(); long nOldPercent = ( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator(); sal_uInt16 nNewZoom = CalcZoom( eZoomType, (sal_uInt16)nOldPercent ); Fraction aNew( nNewZoom, 100 ); diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 501459f3211a..54b0ec871946 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -1436,10 +1436,10 @@ void ScTabView::UpdatePageBreakData( bool bForcePaint ) if (aViewData.IsPagebreakMode()) { ScDocShell* pDocSh = aViewData.GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = aViewData.GetTabNo(); - sal_uInt16 nCount = pDoc->GetPrintRangeCount(nTab); + sal_uInt16 nCount = rDoc.GetPrintRangeCount(nTab); if (!nCount) nCount = 1; pNewData = new ScPageBreakData(nCount); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index c37cd4c3104a..9589c102fa73 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -1838,7 +1838,7 @@ void ScTabView::UpdateEditView() EditView* pEditView = aViewData.GetEditView( (ScSplitPos) i ); aViewData.SetEditEngine( (ScSplitPos) i, static_cast<ScEditEngineDefaulter*>(pEditView->GetEditEngine()), - pGridWin[i], GetViewData()->GetCurX(), GetViewData()->GetCurY() ); + pGridWin[i], GetViewData().GetCurX(), GetViewData().GetCurY() ); if ( (ScSplitPos)i == eActive ) pEditView->ShowCursor( false ); } @@ -2182,9 +2182,9 @@ void ScTabView::DoChartSelection( { Color aSelColor( rHilightRanges[i].PreferredColor ); ScRangeList aRangeList; - ScDocument* pDoc = aViewData.GetDocShell()->GetDocument(); + ScDocument& rDoc = aViewData.GetDocShell()->GetDocument(); if( ScRangeStringConverter::GetRangeListFromString( - aRangeList, rHilightRanges[i].RangeRepresentation, pDoc, pDoc->GetAddressConvention(), sep )) + aRangeList, rHilightRanges[i].RangeRepresentation, &rDoc, rDoc.GetAddressConvention(), sep )) { size_t nListSize = aRangeList.size(); for ( size_t j = 0; j < nListSize; ++j ) diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index 01e61d9a2099..7d6e1bf79275 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -108,7 +108,7 @@ SFX_IMPL_NAMED_VIEWFACTORY( ScTabViewShell, "Default" ) OUString ScTabViewShell::GetFormula(ScAddress& rAddress) { OUString sFormula; - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScRefCellValue aCell; aCell.assign(*pDoc, rAddress); if (!aCell.isEmpty() && aCell.meType == CELLTYPE_FORMULA) diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index a2810c1b942a..064c120a2f9c 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -78,7 +78,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) MakeDrawLayer(); - ScTabView* pTabView = GetViewData()->GetView(); + ScTabView* pTabView = GetViewData().GetView(); SfxBindings& rBindings = GetViewFrame()->GetBindings(); Window* pWin = pTabView->GetActiveWin(); @@ -181,7 +181,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) // Execute fuer die Form-Shell, um im Controller zu deselektieren if ( nNewId == SID_FM_CREATE_CONTROL ) { - GetViewData()->GetDispatcher().Execute(SID_FM_LEAVE_CREATE); + GetViewData().GetDispatcher().Execute(SID_FM_LEAVE_CREATE); GetViewFrame()->GetBindings().InvalidateAll(false); //! was fuer einen Slot braucht der komische Controller wirklich, um das anzuzeigen???? } @@ -195,7 +195,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) if ( nDrawSfxId == SID_FM_CREATE_CONTROL && nNewId != nDrawSfxId ) { // Wechsel von Control- zu Zeichenfunktion -> im Control-Controller deselektieren - GetViewData()->GetDispatcher().Execute(SID_FM_LEAVE_CREATE); + GetViewData().GetDispatcher().Execute(SID_FM_LEAVE_CREATE); GetViewFrame()->GetBindings().InvalidateAll(false); //! was fuer einen Slot braucht der komische Controller wirklich, um das anzuzeigen???? } @@ -443,7 +443,7 @@ void ScTabViewShell::GetDrawState(SfxItemSet &rSet) bool ScTabViewShell::SelectObject( const OUString& rName ) { - ScDrawView* pView = GetViewData()->GetScDrawView(); + ScDrawView* pView = GetViewData().GetScDrawView(); if (!pView) return false; diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 58665e25b376..8e7b24e4e642 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -214,8 +214,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_FORMATPAGE: case SID_STATUS_PAGESTYLE: case SID_HFEDIT: - GetViewData()->GetDocShell()-> - ExecutePageStyle( *this, rReq, GetViewData()->GetTabNo() ); + GetViewData().GetDocShell()-> + ExecutePageStyle( *this, rReq, GetViewData().GetTabNo() ); break; case SID_JUMPTOMARK: @@ -251,13 +251,13 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) } bool bFound = false; - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - ScMarkData& rMark = pViewData->GetMarkData(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + ScMarkData& rMark = rViewData.GetMarkData(); ScRange aScRange; ScAddress aScAddress; sal_uInt16 nResult = lcl_ParseRange(aScRange, aAddress, pDoc, nSlot); - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = rViewData.GetTabNo(); bool bMark = true; // Is this a range ? @@ -311,7 +311,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) // 1-basierte Zeilennummer aScAddress.SetRow( (SCROW)(nNumeric - 1) ); - aScAddress.SetCol( pViewData->GetCurX() ); + aScAddress.SetCol( rViewData.GetCurX() ); aScAddress.SetTab( nTab ); aScRange = ScRange( aScAddress, aScAddress ); bMark = false; @@ -328,7 +328,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bFound = true; SCCOL nCol = aScRange.aStart.Col(); SCROW nRow = aScRange.aStart.Row(); - bool bNothing = ( pViewData->GetCurX()==nCol && pViewData->GetCurY()==nRow ); + bool bNothing = ( rViewData.GetCurX()==nCol && rViewData.GetCurY()==nRow ); // markieren if( bMark ) @@ -374,7 +374,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) } else { - pViewData->ResetOldCursor(); + rViewData.ResetOldCursor(); SetCursor( nCol, nRow ); rBindings.Invalidate( SID_CURRENTCELL ); rBindings.Update( nSlot ); @@ -431,7 +431,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { // Tabelle fuer Basic ist 1-basiert SCTAB nTab = ((const SfxUInt16Item&)pReqArgs->Get(nSlot)).GetValue() - 1; - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if ( nTab < pDoc->GetTableCount() ) { SetTabNo( nTab ); @@ -527,7 +527,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bWantPageBreak = (nSlot == FID_PAGEBREAKMODE) == bItemValue; } - if( GetViewData()->IsPagebreakMode() != bWantPageBreak ) + if( GetViewData().IsPagebreakMode() != bWantPageBreak ) { SetPagebreakMode( bWantPageBreak ); UpdatePageBreakData(); @@ -561,11 +561,11 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case FID_TOGGLESYNTAX: { - bool bSet = !GetViewData()->IsSyntaxMode(); + bool bSet = !GetViewData().IsSyntaxMode(); const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SFX_ITEM_SET ) bSet = ((const SfxBoolItem*)pItem)->GetValue(); - GetViewData()->SetSyntaxMode( bSet ); + GetViewData().SetSyntaxMode( bSet ); PaintGrid(); rBindings.Invalidate( FID_TOGGLESYNTAX ); rReq.AppendItem( SfxBoolItem( nSlot, bSet ) ); @@ -574,11 +574,11 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) break; case FID_TOGGLEHEADERS: { - bool bSet = !GetViewData()->IsHeaderMode(); + bool bSet = !GetViewData().IsHeaderMode(); const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SFX_ITEM_SET ) bSet = ((const SfxBoolItem*)pItem)->GetValue(); - GetViewData()->SetHeaderMode( bSet ); + GetViewData().SetHeaderMode( bSet ); RepeatResize(); rBindings.Invalidate( FID_TOGGLEHEADERS ); rReq.AppendItem( SfxBoolItem( nSlot, bSet ) ); @@ -588,8 +588,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case FID_TOGGLEFORMULA: { - ScViewData* pViewData = GetViewData(); - const ScViewOptions& rOpts = pViewData->GetOptions(); + ScViewData& rViewData = GetViewData(); + const ScViewOptions& rOpts = rViewData.GetOptions(); bool bFormulaMode = !rOpts.GetOption( VOPT_FORMULAS ); const SfxPoolItem *pItem; if( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SFX_ITEM_SET ) @@ -597,9 +597,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) ScViewOptions rSetOpts = ScViewOptions( rOpts ); rSetOpts.SetOption( VOPT_FORMULAS, bFormulaMode ); - pViewData->SetOptions( rSetOpts ); + rViewData.SetOptions( rSetOpts ); - pViewData->GetDocShell()->PostPaintGridAll(); + rViewData.GetDocShell()->PostPaintGridAll(); rBindings.Invalidate( FID_TOGGLEFORMULA ); rReq.AppendItem( SfxBoolItem( nSlot, bFormulaMode ) ); @@ -629,7 +629,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); SvxZoomType eOldZoomType = GetZoomType(); SvxZoomType eNewZoomType = eOldZoomType; - const Fraction& rOldY = GetViewData()->GetZoomY(); // Y wird angezeigt + const Fraction& rOldY = GetViewData().GetZoomY(); // Y wird angezeigt sal_uInt16 nOldZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator()); sal_uInt16 nZoom = nOldZoom; @@ -648,7 +648,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) SfxItemSet aSet ( GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM ); SvxZoomItem aZoomItem( eOldZoomType, nOldZoom, SID_ATTR_ZOOM ); boost::scoped_ptr<AbstractSvxZoomDialog> pDlg; - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); sal_uInt16 nBtnFlags = SVX_ZOOM_ENABLE_50 | SVX_ZOOM_ENABLE_75 | SVX_ZOOM_ENABLE_100 @@ -715,7 +715,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if ( nZoom != nOldZoom && !bCancel ) { - if (!GetViewData()->IsPagebreakMode()) + if (!GetViewData().IsPagebreakMode()) { ScAppOptions aNewOpt = pScMod->GetAppOptions(); aNewOpt.SetZoom( nZoom ); @@ -744,7 +744,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if( nCurrentZoom ) { SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom ); - if (!GetViewData()->IsPagebreakMode()) + if (!GetViewData().IsPagebreakMode()) { ScAppOptions aNewOpt = pScMod->GetAppOptions(); aNewOpt.SetZoom( nCurrentZoom ); @@ -775,7 +775,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_SELECT_TABLES: { - ScViewData& rViewData = *GetViewData(); + ScViewData& rViewData = GetViewData(); ScDocument& rDoc = *rViewData.GetDocument(); ScMarkData& rMark = rViewData.GetMarkData(); SCTAB nTabCount = rDoc.GetTableCount(); @@ -872,8 +872,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_WINDOW_SPLIT: { - ScSplitMode eHSplit = GetViewData()->GetHSplitMode(); - ScSplitMode eVSplit = GetViewData()->GetVSplitMode(); + ScSplitMode eHSplit = GetViewData().GetHSplitMode(); + ScSplitMode eVSplit = GetViewData().GetVSplitMode(); if ( eHSplit == SC_SPLIT_NORMAL || eVSplit == SC_SPLIT_NORMAL ) // aufheben RemoveSplit(); else if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // normal @@ -888,8 +888,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_WINDOW_FIX: { - ScSplitMode eHSplit = GetViewData()->GetHSplitMode(); - ScSplitMode eVSplit = GetViewData()->GetVSplitMode(); + ScSplitMode eHSplit = GetViewData().GetHSplitMode(); + ScSplitMode eVSplit = GetViewData().GetVSplitMode(); if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // aufheben RemoveSplit(); else @@ -926,9 +926,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case FID_CHG_COMMENT: { - ScViewData* pData = GetViewData(); - ScAddress aCursorPos( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() ); - ScDocShell* pDocSh = pData->GetDocShell(); + ScViewData& rData = GetViewData(); + ScAddress aCursorPos( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() ); + ScDocShell* pDocSh = rData.GetDocShell(); ScChangeAction* pAction = pDocSh->GetChangeAction( aCursorPos ); if ( pAction ) @@ -956,14 +956,14 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) // angelegt werden muss if (!GetScDrawView()) { - GetViewData()->GetDocShell()->MakeDrawLayer(); + GetViewData().GetDocShell()->MakeDrawLayer(); rBindings.InvalidateAll(false); } break; case FID_PROTECT_DOC: { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if( pReqArgs ) { @@ -1030,8 +1030,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case FID_PROTECT_TABLE: { - ScDocument* pDoc = GetViewData()->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocument* pDoc = GetViewData().GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); bool bOldProtection = pDoc->IsTabProtected(nTab); if( pReqArgs ) diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 08cf2c5001a3..6067ac1600b1 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -121,7 +121,7 @@ void ScTabViewShell::Activate(bool bMDI) pScMod->ViewShellChanged(); ActivateView( true, bFirstActivate ); - ActivateOlk( GetViewData() ); + ActivateOlk( &GetViewData() ); // AutoCorrect umsetzen, falls der Writer seins neu angelegt hat UpdateDrawTextOutliner(); @@ -174,11 +174,11 @@ void ScTabViewShell::Activate(bool bMDI) // bridge, it's done in ImplSetReallyVisible), there are problems if Window::Show // is called during the ViewShell ctor and reschedules asynchronous calls // (for example from the FmFormShell ctor). - ScExtDocOptions* pExtOpt = GetViewData()->GetDocument()->GetExtDocOptions(); + ScExtDocOptions* pExtOpt = GetViewData().GetDocument()->GetExtDocOptions(); if ( pExtOpt && pExtOpt->IsChanged() ) { - GetViewData()->ReadExtOptions(*pExtOpt); // Excel view settings - SetTabNo( GetViewData()->GetTabNo(), true ); + GetViewData().ReadExtOptions(*pExtOpt); // Excel view settings + SetTabNo( GetViewData().GetTabNo(), true ); pExtOpt->SetChanged( false ); } } @@ -188,7 +188,7 @@ void ScTabViewShell::Activate(bool bMDI) ScInputHandler* pHdl = pScMod->GetInputHdl(this); if (pHdl) { - pHdl->SetRefScale( GetViewData()->GetZoomX(), GetViewData()->GetZoomY() ); + pHdl->SetRefScale( GetViewData().GetZoomX(), GetViewData().GetZoomY() ); } // Aenderungs-Dialog aktualisieren @@ -234,7 +234,7 @@ void ScTabViewShell::Deactivate(bool bMDI) { HideTip(); - ScDocument* pDoc=GetViewData()->GetDocument(); + ScDocument* pDoc=GetViewData().GetDocument(); ScChangeTrack* pChanges=pDoc->GetChangeTrack(); @@ -255,11 +255,11 @@ void ScTabViewShell::Deactivate(bool bMDI) bool bOldDontSwitch = bDontSwitch; bDontSwitch = true; - DeActivateOlk( GetViewData() ); + DeActivateOlk( &GetViewData() ); ActivateView( false, false ); if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace - GetViewData()->GetDocShell()->UpdateOle(GetViewData(), true); + GetViewData().GetDocShell()->UpdateOle(&GetViewData(), true); if ( pHdl ) pHdl->NotifyChange( NULL, true ); // Timer-verzoegert wg. Dokumentwechsel @@ -300,7 +300,7 @@ bool ScTabViewShell::PrepareClose(bool bUI) { // "clean" end of text edit, including note handling, subshells and draw func switching, // as in FuDraw and ScTabView::DrawDeselectAll - GetViewData()->GetDispatcher().Execute( pPoor->GetSlotID(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); + GetViewData().GetDispatcher().Execute( pPoor->GetSlotID(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); } ScDrawView* pDrView = GetScDrawView(); if ( pDrView ) @@ -324,7 +324,7 @@ bool ScTabViewShell::PrepareClose(bool bUI) void ScTabViewShell::UpdateOleZoom() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); if ( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) { //TODO/LATER: is there a difference between the two GetVisArea methods? @@ -384,7 +384,7 @@ void ScTabViewShell::InnerResizePixel( const Point &rOfs, const Size &rSize ) UpdateOleZoom(); // Zoom fuer In-Place berechnen - GetViewData()->GetDocShell()->SetDocumentModified(); + GetViewData().GetDocShell()->SetDocumentModified(); } void ScTabViewShell::OuterResizePixel( const Point &rOfs, const Size &rSize ) @@ -419,7 +419,7 @@ void ScTabViewShell::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoo if ( aNewY > aFrac400 ) aNewY = aFrac400; - GetViewData()->UpdateScreenZoom( aNewX, aNewY ); + GetViewData().UpdateScreenZoom( aNewX, aNewY ); SetZoom( aNewX, aNewY, true ); PaintGrid(); @@ -437,12 +437,12 @@ void ScTabViewShell::QueryObjAreaPixel( Rectangle& rRect ) const Window* pWin = ((ScTabViewShell*)this)->GetActiveWin(); Size aLogicSize = pWin->PixelToLogic( aPixelSize ); - const ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - ScSplitPos ePos = pViewData->GetActivePart(); - SCCOL nCol = pViewData->GetPosX(WhichH(ePos)); - SCROW nRow = pViewData->GetPosY(WhichV(ePos)); - SCTAB nTab = pViewData->GetTabNo(); + const ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + ScSplitPos ePos = rViewData.GetActivePart(); + SCCOL nCol = rViewData.GetPosX(WhichH(ePos)); + SCROW nRow = rViewData.GetPosY(WhichV(ePos)); + SCTAB nTab = rViewData.GetTabNo(); bool bNegativePage = pDoc->IsNegativePage( nTab ); Rectangle aLogicRect = pDoc->GetMMRect( nCol, nRow, nCol, nRow, nTab ); @@ -453,7 +453,7 @@ void ScTabViewShell::QueryObjAreaPixel( Rectangle& rRect ) const } aLogicRect.SetSize( aLogicSize ); - pViewData->GetDocShell()->SnapVisArea( aLogicRect ); + rViewData.GetDocShell()->SnapVisArea( aLogicRect ); rRect.SetSize( pWin->LogicToPixel( aLogicRect.GetSize() ) ); } @@ -483,23 +483,23 @@ void ScTabViewShell::ShowCursor(bool /* bOn */) void ScTabViewShell::WriteUserData(OUString& rData, bool /* bBrowse */) { - GetViewData()->WriteUserData(rData); + GetViewData().WriteUserData(rData); } void ScTabViewShell::WriteUserDataSequence (uno::Sequence < beans::PropertyValue >& rSettings, bool /* bBrowse */ ) { - GetViewData()->WriteUserDataSequence (rSettings); + GetViewData().WriteUserDataSequence (rSettings); } void ScTabViewShell::ReadUserData(const OUString& rData, bool /* bBrowse */) { - if ( !GetViewData()->GetDocShell()->IsPreview() ) + if ( !GetViewData().GetDocShell()->IsPreview() ) DoReadUserData( rData ); } void ScTabViewShell::ReadUserDataSequence (const uno::Sequence < beans::PropertyValue >& rSettings, bool /* bBrowse */ ) { - if ( !GetViewData()->GetDocShell()->IsPreview() ) + if ( !GetViewData().GetDocShell()->IsPreview() ) DoReadUserDataSequence( rSettings ); } @@ -508,10 +508,10 @@ void ScTabViewShell::DoReadUserDataSequence( const uno::Sequence < beans::Proper Window* pOldWin = GetActiveWin(); bool bFocus = pOldWin && pOldWin->HasFocus(); - GetViewData()->ReadUserDataSequence(rSettings); - SetTabNo( GetViewData()->GetTabNo(), true ); + GetViewData().ReadUserDataSequence(rSettings); + SetTabNo( GetViewData().GetTabNo(), true ); - if ( GetViewData()->IsPagebreakMode() ) + if ( GetViewData().IsPagebreakMode() ) SetCurSubShell( GetCurObjectSelectionType(), true ); Window* pNewWin = GetActiveWin(); @@ -523,8 +523,8 @@ void ScTabViewShell::DoReadUserDataSequence( const uno::Sequence < beans::Proper WindowChanged(); // Drawing-Layer (z.B. #56771#) } - if (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX || - GetViewData()->GetVSplitMode() == SC_SPLIT_FIX) + if (GetViewData().GetHSplitMode() == SC_SPLIT_FIX || + GetViewData().GetVSplitMode() == SC_SPLIT_FIX) { InvalidateSplit(); } @@ -573,7 +573,7 @@ bool isGL3DDiagram( const css::uno::Reference<css::chart2::XDiagram>& xDiagram ) void ScTabViewShell::AddOpenGLChartWindows() { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScGridWindow* pParentWindow = GetActiveWin(); std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> > aCharts = pDoc->GetAllCharts(); @@ -611,10 +611,10 @@ void ScTabViewShell::DoReadUserData( const OUString& rData ) Window* pOldWin = GetActiveWin(); bool bFocus = pOldWin && pOldWin->HasFocus(); - GetViewData()->ReadUserData(rData); - SetTabNo( GetViewData()->GetTabNo(), true ); + GetViewData().ReadUserData(rData); + SetTabNo( GetViewData().GetTabNo(), true ); - if ( GetViewData()->IsPagebreakMode() ) + if ( GetViewData().IsPagebreakMode() ) SetCurSubShell( GetCurObjectSelectionType(), true ); Window* pNewWin = GetActiveWin(); @@ -626,8 +626,8 @@ void ScTabViewShell::DoReadUserData( const OUString& rData ) WindowChanged(); // Drawing-Layer (z.B. #56771#) } - if (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX || - GetViewData()->GetVSplitMode() == SC_SPLIT_FIX) + if (GetViewData().GetHSplitMode() == SC_SPLIT_FIX || + GetViewData().GetVSplitMode() == SC_SPLIT_FIX) { InvalidateSplit(); } @@ -713,11 +713,11 @@ void ScTabViewShell::SetDrawShell( bool bActive ) { ResetDrawDragMode(); // Mirror / Rotate aus - if (bWasDraw && (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX || - GetViewData()->GetVSplitMode() == SC_SPLIT_FIX)) + if (bWasDraw && (GetViewData().GetHSplitMode() == SC_SPLIT_FIX || + GetViewData().GetVSplitMode() == SC_SPLIT_FIX)) { // Aktiven Teil an Cursor anpassen, etc. - MoveCursorAbs( GetViewData()->GetCurX(), GetViewData()->GetCurY(), + MoveCursorAbs( GetViewData().GetCurX(), GetViewData().GetCurY(), SC_FOLLOW_NONE, false, false, true ); } } @@ -830,7 +830,7 @@ void ScTabViewShell::SetEditShell(EditView* pView, bool bActive ) if (pEditShell) pEditShell->SetEditView( pView ); else - pEditShell = new ScEditShell( pView, GetViewData() ); + pEditShell = new ScEditShell( pView, &GetViewData() ); SetCurSubShell(OST_Editing); } @@ -843,18 +843,18 @@ void ScTabViewShell::SetEditShell(EditView* pView, bool bActive ) void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) { - ScViewData* pViewData = GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScViewData& rViewData = GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); if(bDontSwitch) return; if(!pCellShell) //Wird eh immer gebraucht. { - pCellShell = new ScCellShell( GetViewData() ); + pCellShell = new ScCellShell( &GetViewData() ); pCellShell->SetRepeatTarget( &aTarget ); } - bool bPgBrk=pViewData->IsPagebreakMode(); + bool bPgBrk = rViewData.IsPagebreakMode(); if(bPgBrk && !pPageBreakShell) { @@ -898,7 +898,7 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) if ( !pDrawTextShell ) { pDocSh->MakeDrawLayer(); - pDrawTextShell = new ScDrawTextObjectBar( GetViewData() ); + pDrawTextShell = new ScDrawTextObjectBar( &GetViewData() ); } AddSubShell(*pDrawTextShell); } @@ -922,7 +922,7 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) if ( !pDrawShell ) { pDocSh->MakeDrawLayer(); - pDrawShell = new ScDrawShell( GetViewData() ); + pDrawShell = new ScDrawShell( &GetViewData() ); pDrawShell->SetRepeatTarget( &aTarget ); } AddSubShell(*pDrawShell); @@ -935,7 +935,7 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) if ( !pDrawFormShell ) { pDocSh->MakeDrawLayer(); - pDrawFormShell = new ScDrawFormShell( GetViewData() ); + pDrawFormShell = new ScDrawFormShell( &GetViewData() ); pDrawFormShell->SetRepeatTarget( &aTarget ); } AddSubShell(*pDrawFormShell); @@ -948,7 +948,7 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) if ( !pChartShell ) { pDocSh->MakeDrawLayer(); - pChartShell = new ScChartShell( GetViewData() ); + pChartShell = new ScChartShell( &GetViewData() ); pChartShell->SetRepeatTarget( &aTarget ); } AddSubShell(*pChartShell); @@ -961,7 +961,7 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) if ( !pOleObjectShell ) { pDocSh->MakeDrawLayer(); - pOleObjectShell = new ScOleObjectShell( GetViewData() ); + pOleObjectShell = new ScOleObjectShell( &GetViewData() ); pOleObjectShell->SetRepeatTarget( &aTarget ); } AddSubShell(*pOleObjectShell); @@ -974,7 +974,7 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) if ( !pGraphicShell) { pDocSh->MakeDrawLayer(); - pGraphicShell = new ScGraphicShell( GetViewData() ); + pGraphicShell = new ScGraphicShell( &GetViewData() ); pGraphicShell->SetRepeatTarget( &aTarget ); } AddSubShell(*pGraphicShell); @@ -987,7 +987,7 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) if ( !pMediaShell) { pDocSh->MakeDrawLayer(); - pMediaShell = new ScMediaShell( GetViewData() ); + pMediaShell = new ScMediaShell( &GetViewData() ); pMediaShell->SetRepeatTarget( &aTarget ); } AddSubShell(*pMediaShell); @@ -1017,7 +1017,7 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) { pDocSh->MakeDrawLayer(); // die Wartezeit lieber jetzt als beim Klick - pAuditingShell = new ScAuditingShell( GetViewData() ); + pAuditingShell = new ScAuditingShell( &GetViewData() ); pAuditingShell->SetRepeatTarget( &aTarget ); } AddSubShell(*pAuditingShell); @@ -1097,14 +1097,14 @@ void ScTabViewShell::SetDrawTextUndo( ::svl::IUndoManager* pNewUndoMgr ) { // Default: Undo-Manager der DocShell if (!pNewUndoMgr) - pNewUndoMgr = GetViewData()->GetDocShell()->GetUndoManager(); + pNewUndoMgr = GetViewData().GetDocShell()->GetUndoManager(); if (pDrawTextShell) { pDrawTextShell->SetUndoManager(pNewUndoMgr); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); if ( pNewUndoMgr == pDocSh->GetUndoManager() && - !pDocSh->GetDocument()->IsUndoEnabled() ) + !pDocSh->GetDocument().IsUndoEnabled() ) { pNewUndoMgr->SetMaxUndoActionCount( 0 ); } @@ -1123,12 +1123,12 @@ ScTabViewShell* ScTabViewShell::GetActiveViewShell() SfxPrinter* ScTabViewShell::GetPrinter( bool bCreate ) { // Drucker ist immer da (wird fuer die FontListe schon beim Starten angelegt) - return GetViewData()->GetDocShell()->GetPrinter(bCreate); + return GetViewData().GetDocShell()->GetPrinter(bCreate); } sal_uInt16 ScTabViewShell::SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags, bool ) { - return GetViewData()->GetDocShell()->SetPrinter( pNewPrinter, nDiffFlags ); + return GetViewData().GetDocShell()->SetPrinter( pNewPrinter, nDiffFlags ); } bool ScTabViewShell::HasPrintOptionsPage() const @@ -1162,7 +1162,7 @@ IMPL_LINK_NOARG(ScTabViewShell, SimpleRefClose) // If range selection was started with an active embedded object, // switch back to original sheet (while the dialog is still open). - SetTabNo( GetViewData()->GetRefTabNo() ); + SetTabNo( GetViewData().GetRefTabNo() ); } ScSimpleRefDlgWrapper::SetAutoReOpen( true ); @@ -1279,13 +1279,13 @@ bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) HideNoteMarker(); // Notiz-Anzeige // don't do extra HideCursor/ShowCursor calls if EnterHandler will switch to a different sheet - bool bOnRefSheet = ( GetViewData()->GetRefTabNo() == GetViewData()->GetTabNo() ); + bool bOnRefSheet = ( GetViewData().GetRefTabNo() == GetViewData().GetTabNo() ); bool bHideCursor = ( ( nCode == KEY_RETURN && bInPlace ) || nCode == KEY_TAB ) && bOnRefSheet; if (bHideCursor) HideAllCursors(); - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if ( pDoc ) pDoc->KeyInput( rKEvt ); // TimerDelays etc. @@ -1345,7 +1345,7 @@ bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) if ( eFunc == KEYFUNC_CUT ) { ScRange aDummy; - ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy ); + ScMarkType eMarkType = GetViewData().GetSimpleArea( aDummy ); if (eMarkType != SC_MARK_SIMPLE) { ErrorMessage(STR_NOMULTISELECT); @@ -1400,10 +1400,10 @@ bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) if (nMode == SC_ENTER_NORMAL) { if( bShift ) - GetViewData()->GetDispatcher().Execute( SID_CURSORENTERUP, + GetViewData().GetDispatcher().Execute( SID_CURSORENTERUP, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); else - GetViewData()->GetDispatcher().Execute( SID_CURSORENTERDOWN, + GetViewData().GetDispatcher().Execute( SID_CURSORENTERDOWN, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); } else @@ -1455,7 +1455,7 @@ bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) } if ( nSlotId ) { - GetViewData()->GetDispatcher().Execute( nSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); + GetViewData().GetDispatcher().Execute( nSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); bUsed = true; } } @@ -1499,7 +1499,7 @@ bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) { sal_uInt16 nMode = GetLockedModifiers(); LockModifiers(KEY_MOD1); - GetViewData()->GetDispatcher().Execute( nSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); + GetViewData().GetDispatcher().Execute( nSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); LockModifiers(nMode); bUsed = true; } @@ -1571,12 +1571,12 @@ bool ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent ) void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) { SfxApplication* pSfxApp = SFX_APP(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); bReadOnly = pDocSh->IsReadOnly(); bIsActive = false; - EnableAutoSpell(pDoc->GetDocOptions().IsAutoSpell()); + EnableAutoSpell(rDoc.GetDocOptions().IsAutoSpell()); SetName(OUString("View")); // fuer SBX Color aColBlack( COL_BLACK ); @@ -1586,7 +1586,7 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) pCurFrameLine = new ::editeng::SvxBorderLine(&aColBlack, 20, table::BorderLineStyle::SOLID); pPivotSource = new ScArea; - StartListening(*GetViewData()->GetDocShell(),true); + StartListening(*GetViewData().GetDocShell(),true); StartListening(*GetViewFrame(),true); StartListening(*pSfxApp,true); // #i62045# #i62046# application is needed for Calc's own hints @@ -1599,29 +1599,29 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) //TODO/LATER: is there a difference between the two GetVisArea methods? Rectangle aVisArea = ((const SfxObjectShell*)pDocSh)->GetVisArea(); - SCTAB nVisTab = pDoc->GetVisibleTab(); - if (!pDoc->HasTable(nVisTab)) + SCTAB nVisTab = rDoc.GetVisibleTab(); + if (!rDoc.HasTable(nVisTab)) { nVisTab = 0; - pDoc->SetVisibleTab(nVisTab); + rDoc.SetVisibleTab(nVisTab); } SetTabNo( nVisTab ); - bool bNegativePage = pDoc->IsNegativePage( nVisTab ); + bool bNegativePage = rDoc.IsNegativePage( nVisTab ); // show the right cells - GetViewData()->SetScreenPos( bNegativePage ? aVisArea.TopRight() : aVisArea.TopLeft() ); + GetViewData().SetScreenPos( bNegativePage ? aVisArea.TopRight() : aVisArea.TopLeft() ); if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace { pDocSh->SetInplace( true ); // schon so initialisiert - if (pDoc->IsEmbedded()) - pDoc->ResetEmbedded(); // keine blaue Markierung + if (rDoc.IsEmbedded()) + rDoc.ResetEmbedded(); // keine blaue Markierung } else if ( bFirstView ) { pDocSh->SetInplace( false ); - GetViewData()->RefreshZoom(); // recalculate PPT - if (!pDoc->IsEmbedded()) - pDoc->SetEmbedded( pDoc->GetVisibleTab(), aVisArea ); // VisArea markieren + GetViewData().RefreshZoom(); // recalculate PPT + if (!rDoc.IsEmbedded()) + rDoc.SetEmbedded( rDoc.GetVisibleTab(), aVisArea ); // VisArea markieren } } @@ -1649,14 +1649,14 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) // DrawView darf nicht im TabView - ctor angelegt werden, // wenn die ViewShell noch nicht kostruiert ist... - if (pDoc->GetDrawLayer()) + if (rDoc.GetDrawLayer()) MakeDrawView( nForceDesignMode ); ViewOptionsHasChanged(false); // legt auch evtl. DrawView an ::svl::IUndoManager* pMgr = pDocSh->GetUndoManager(); SetUndoManager( pMgr ); pFormShell->SetUndoManager( pMgr ); - if ( !pDoc->IsUndoEnabled() ) + if ( !rDoc.IsUndoEnabled() ) { pMgr->SetMaxUndoActionCount( 0 ); } @@ -1666,11 +1666,11 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) if ( bFirstView ) // first view? { - pDoc->SetDocVisible( true ); // used when creating new sheets + rDoc.SetDocVisible( true ); // used when creating new sheets if ( pDocSh->IsEmpty() ) { // set first sheet's RTL flag (following will already be initialized because of SetDocVisible) - pDoc->SetLayoutRTL( 0, ScGlobal::IsSystemRTL() ); + rDoc.SetLayoutRTL( 0, ScGlobal::IsSystemRTL() ); // append additional sheets (not for OLE object) if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) @@ -1680,7 +1680,7 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) SCTAB nInitTabCount = rOpt.GetInitTabCount(); for (SCTAB i=1; i<nInitTabCount; i++) - pDoc->MakeTable(i,false); + rDoc.MakeTable(i,false); } pDocSh->SetEmpty( false ); // #i6232# make sure this is done only once @@ -1693,19 +1693,19 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) pDocSh->IsUpdateEnabled() ) // #105575#; update only in the first creation of the ViewShell { // Check if there are any external data. - bool bLink = pDoc->GetExternalRefManager()->hasExternalData(); + bool bLink = rDoc.GetExternalRefManager()->hasExternalData(); if (!bLink) { // #i100042# sheet links can still exist independently from external formula references - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB i=0; i<nTabCount && !bLink; i++) - if (pDoc->IsLinked(i)) + if (rDoc.IsLinked(i)) bLink = true; } if (!bLink) { - const sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager(); - if (rMgr.hasDdeLinks() || pDoc->HasAreaLinks()) + const sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager(); + if (rMgr.hasDdeLinks() || rDoc.HasAreaLinks()) bLink = true; } if (bLink) @@ -1721,7 +1721,7 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) } bool bReImport = false; // importierte Daten aktualisieren - ScDBCollection* pDBColl = pDoc->GetDBCollection(); + ScDBCollection* pDBColl = rDoc.GetDBCollection(); if ( pDBColl ) { const ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs(); @@ -1790,12 +1790,12 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, nForceDesignMode = pPreviewShell->GetSourceDesignMode(); ScPreview* p = pPreviewShell->GetPreview(); if (p) - GetViewData()->GetMarkData().SetSelectedTabs(p->GetSelectedTabs()); + GetViewData().GetMarkData().SetSelectedTabs(p->GetSelectedTabs()); } Construct( nForceDesignMode ); - if ( GetViewData()->GetDocShell()->IsPreview() ) + if ( GetViewData().GetDocShell()->IsPreview() ) { // preview for template dialog: always show whole page SetZoomType( SVX_ZOOM_WHOLEPAGE, true ); // zoom value is recalculated at next Resize @@ -1823,7 +1823,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, ScTabViewShell::~ScTabViewShell() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); EndListening(*pDocSh); EndListening(*GetViewFrame()); EndListening(*SFX_APP()); // #i62045# #i62046# needed now - SfxViewShell no longer does it @@ -1874,11 +1874,11 @@ void ScTabViewShell::SetDialogDPObject( const ScDPObject* pObj ) void ScTabViewShell::FillFieldData( ScHeaderFieldData& rData ) { - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocShell = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); OUString aTmp; - pDoc->GetName(nTab, aTmp); + rDoc.GetName(nTab, aTmp); rData.aTabName = aTmp; if( pDocShell->getDocProperties()->getTitle().getLength() != 0 ) @@ -1903,7 +1903,7 @@ void ScTabViewShell::SetChartArea( const ScRangeListRef& rSource, const Rectangl bChartAreaValid = true; aChartSource = rSource; aChartPos = rDest; - nChartDestTab = GetViewData()->GetTabNo(); + nChartDestTab = GetViewData().GetTabNo(); } bool ScTabViewShell::GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx index 636fcfb721a4..43bd5976df8b 100644 --- a/sc/source/ui/view/tabvwsh5.cxx +++ b/sc/source/ui/view/tabvwsh5.cxx @@ -59,7 +59,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) else { GetSelEngine()->Reset(); - GetFunctionSet()->SetAnchorFlag(true); + GetFunctionSet().SetAnchorFlag(true); // AnchorFlag, damit gleich mit Control angehaengt werden kann } } @@ -73,8 +73,8 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) case SFX_HINT_DOCCHANGED: { - ScDocument* pDoc = GetViewData()->GetDocument(); - if (!pDoc->HasTable( GetViewData()->GetTabNo() )) + ScDocument* pDoc = GetViewData().GetDocument(); + if (!pDoc->HasTable( GetViewData().GetTabNo() )) { SetTabNo(0); } @@ -107,12 +107,12 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // dieser Hint kommt, den Design-Modus immer dann umschalten, wenn der // ReadOnly-Status sich wirklich geaendert hat: - if ( GetViewData()->GetSfxDocShell()->IsReadOnly() != bReadOnly ) + if ( GetViewData().GetSfxDocShell()->IsReadOnly() != bReadOnly ) { - bReadOnly = GetViewData()->GetSfxDocShell()->IsReadOnly(); + bReadOnly = GetViewData().GetSfxDocShell()->IsReadOnly(); SfxBoolItem aItem( SID_FM_DESIGN_MODE, !bReadOnly); - GetViewData()->GetDispatcher().Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_ASYNCHRON, + GetViewData().GetDispatcher().Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_ASYNCHRON, &aItem, 0L ); UpdateInputContext(); @@ -124,7 +124,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) break; case SC_HINT_FORCESETTAB: - SetTabNo( GetViewData()->GetTabNo(), true ); + SetTabNo( GetViewData().GetTabNo(), true ); break; default: @@ -135,7 +135,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { ScPaintHint* pHint = (ScPaintHint*) &rHint; sal_uInt16 nParts = pHint->GetParts(); - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); if (pHint->GetStartTab() <= nTab && pHint->GetEndTab() >= nTab) { if (nParts & PAINT_EXTRAS) // zuerst, falls Tabelle weg ist !!! @@ -144,7 +144,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // if the current sheet has pending row height updates (sheet links refreshed), // execute them before invalidating the window - GetViewData()->GetDocShell()->UpdatePendingRowHeights( GetViewData()->GetTabNo() ); + GetViewData().GetDocShell()->UpdatePendingRowHeights( GetViewData().GetTabNo() ); if (nParts & PAINT_SIZE) RepeatResize(); //! InvalidateBorder ??? @@ -171,7 +171,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // ScEditViewHint kommt nur an aktiver View an ScEditViewHint* pHint = (ScEditViewHint*) &rHint; - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); if ( pHint->GetTab() == nTab ) { SCCOL nCol = pHint->GetCol(); @@ -183,14 +183,14 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) StopEditShell(); // sollte nicht gesetzt sein - ScSplitPos eActive = GetViewData()->GetActivePart(); - if ( GetViewData()->HasEditView(eActive) ) + ScSplitPos eActive = GetViewData().GetActivePart(); + if ( GetViewData().HasEditView(eActive) ) { // MakeEditView geht schief, wenn der Cursor ausserhalb des // Bildschirms steht. GetEditView gibt dann eine nicht aktive // View zurueck, darum die Abfrage HasEditView. - EditView* pView = GetViewData()->GetEditView(eActive); // ist nicht 0 + EditView* pView = GetViewData().GetEditView(eActive); // ist nicht 0 SetEditShell(pView, true); } @@ -200,7 +200,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) else if (rHint.ISA(ScTablesHint)) // Tabelle eingefuegt / geloescht { // aktuelle Tabelle zuerst holen (kann bei DeleteTab an ViewData geaendert werden) - SCTAB nActiveTab = GetViewData()->GetTabNo(); + SCTAB nActiveTab = GetViewData().GetTabNo(); const ScTablesHint& rTabHint = (const ScTablesHint&)rHint; SCTAB nTab1 = rTabHint.GetTab1(); @@ -209,24 +209,24 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) switch (nId) { case SC_TAB_INSERTED: - GetViewData()->InsertTab( nTab1 ); + GetViewData().InsertTab( nTab1 ); break; case SC_TAB_DELETED: - GetViewData()->DeleteTab( nTab1 ); + GetViewData().DeleteTab( nTab1 ); break; case SC_TAB_MOVED: - GetViewData()->MoveTab( nTab1, nTab2 ); + GetViewData().MoveTab( nTab1, nTab2 ); break; case SC_TAB_COPIED: - GetViewData()->CopyTab( nTab1, nTab2 ); + GetViewData().CopyTab( nTab1, nTab2 ); break; case SC_TAB_HIDDEN: break; case SC_TABS_INSERTED: - GetViewData()->InsertTabs( nTab1, nTab2 ); + GetViewData().InsertTabs( nTab1, nTab2 ); break; case SC_TABS_DELETED: - GetViewData()->DeleteTabs( nTab1, nTab2 ); + GetViewData().DeleteTabs( nTab1, nTab2 ); break; default: OSL_FAIL("unbekannter ScTablesHint"); @@ -281,7 +281,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) break; } - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if ( nNewTab >= pDoc->GetTableCount() ) nNewTab = pDoc->GetTableCount() - 1; diff --git a/sc/source/ui/view/tabvwsh8.cxx b/sc/source/ui/view/tabvwsh8.cxx index 65a310fd0798..9b348188d49c 100644 --- a/sc/source/ui/view/tabvwsh8.cxx +++ b/sc/source/ui/view/tabvwsh8.cxx @@ -43,7 +43,7 @@ void ScTabViewShell::SetDefaultFrameLine( const ::editeng::SvxBorderLine* pLine bool ScTabViewShell::HasSelection( bool bText ) const { bool bHas = false; - ScViewData* pData = (ScViewData*)GetViewData(); // const weggecasted + ScViewData* pData = (ScViewData*)&GetViewData(); // const weggecasted if ( bText ) { // Text enthalten: Anzahl2 >= 1 diff --git a/sc/source/ui/view/tabvwsh9.cxx b/sc/source/ui/view/tabvwsh9.cxx index 122e24cac482..83d7530a49d8 100644 --- a/sc/source/ui/view/tabvwsh9.cxx +++ b/sc/source/ui/view/tabvwsh9.cxx @@ -155,7 +155,7 @@ void ScTabViewShell::ExecImageMap( SfxRequest& rReq ) else pIMapInfo->SetImageMap( rImageMap ); - GetViewData()->GetDocShell()->SetDrawModified(); + GetViewData().GetDocShell()->SetDrawModified(); } } } diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 8cb4244e8f9a..c01343fe3ff2 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -66,8 +66,8 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, sal_uInt16 nErrCode ) OUString aStr; ScSubTotalFunc eFunc = (ScSubTotalFunc) SC_MOD()->GetAppOptions().GetStatusFunc(); - ScViewData* pViewData = GetViewData(); - ScMarkData& rMark = pViewData->GetMarkData(); + ScViewData& rViewData = GetViewData(); + ScMarkData& rMark = rViewData.GetMarkData(); bool bIgnoreError = (rMark.IsMarked() || rMark.IsMultiMarked()); if (bIgnoreError && (eFunc == SUBTOTAL_FUNC_CNT || eFunc == SUBTOTAL_FUNC_CNT2)) @@ -97,10 +97,10 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, sal_uInt16 nErrCode ) } if (nGlobStrId) { - ScDocument* pDoc = pViewData->GetDocument(); - SCCOL nPosX = pViewData->GetCurX(); - SCROW nPosY = pViewData->GetCurY(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument* pDoc = rViewData.GetDocument(); + SCCOL nPosX = rViewData.GetCurX(); + SCROW nPosY = rViewData.GetCurY(); + SCTAB nTab = rViewData.GetTabNo(); aStr = ScGlobal::GetRscString(nGlobStrId); aStr += "="; @@ -146,14 +146,14 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, sal_uInt16 nErrCode ) void ScTabViewShell::GetState( SfxItemSet& rSet ) { - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - ScDocShell* pDocShell = pViewData->GetDocShell(); - ScMarkData& rMark = pViewData->GetMarkData(); - SCCOL nPosX = pViewData->GetCurX(); - SCROW nPosY = pViewData->GetCurY(); - SCTAB nTab = pViewData->GetTabNo(); - sal_uInt16 nMyId = 0; + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + ScDocShell* pDocShell = rViewData.GetDocShell(); + ScMarkData& rMark = rViewData.GetMarkData(); + SCCOL nPosX = rViewData.GetCurX(); + SCROW nPosY = rViewData.GetCurY(); + SCTAB nTab = rViewData.GetTabNo(); + sal_uInt16 nMyId = 0; SfxViewFrame* pThisFrame = GetViewFrame(); bool bOle = GetViewFrame()->GetFrame().IsInPlace(); @@ -169,7 +169,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) { case FID_CHG_COMMENT: { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScAddress aPos( nPosX, nPosY, nTab ); if ( pDocSh->IsReadOnly() || !pDocSh->GetChangeAction(aPos) || pDocSh->IsDocShared() ) rSet.DisableItem( nWhich ); @@ -198,7 +198,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) case SID_STATUS_PAGESTYLE: case SID_HFEDIT: - GetViewData()->GetDocShell()->GetStatePageStyle( *this, rSet, nTab ); + GetViewData().GetDocShell()->GetStatePageStyle( *this, rSet, nTab ); break; case SID_SEARCH_ITEM: @@ -216,7 +216,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) sal_uInt16 nOptions = 0xffff; // No replacement if ReadOnly - if (GetViewData()->GetDocShell()->IsReadOnly()) + if (GetViewData().GetDocShell()->IsReadOnly()) nOptions &= ~( SEARCH_OPTIONS_REPLACE | SEARCH_OPTIONS_REPLACE_ALL ); rSet.Put( SfxUInt16Item( nWhich, nOptions ) ); } @@ -224,7 +224,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) case SID_CURRENTCELL: { - ScAddress aScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), 0 ); + ScAddress aScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), 0 ); OUString aAddr(aScAddress.Format(SCA_ABS, NULL, pDoc->GetAddressConvention())); SfxStringItem aPosItem( SID_CURRENTCELL, aAddr ); @@ -234,11 +234,11 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) case SID_CURRENTTAB: // Table for Basic is 1-based - rSet.Put( SfxUInt16Item( nWhich, static_cast<sal_uInt16>(GetViewData()->GetTabNo()) + 1 ) ); + rSet.Put( SfxUInt16Item( nWhich, static_cast<sal_uInt16>(GetViewData().GetTabNo()) + 1 ) ); break; case SID_CURRENTDOC: - rSet.Put( SfxStringItem( nWhich, GetViewData()->GetDocShell()->GetTitle() ) ); + rSet.Put( SfxStringItem( nWhich, GetViewData().GetDocShell()->GetTitle() ) ); break; case FID_TOGGLEINPUTLINE: @@ -288,7 +288,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) rSet.DisableItem( nWhich ); else { - const Fraction& rOldY = GetViewData()->GetZoomY(); + const Fraction& rOldY = GetViewData().GetZoomY(); sal_uInt16 nZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator()); rSet.Put( SvxZoomItem( SVX_ZOOM_PERCENT, nZoom, nWhich ) ); @@ -301,7 +301,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) rSet.DisableItem( nWhich ); else { - const Fraction& rOldY = GetViewData()->GetZoomY(); + const Fraction& rOldY = GetViewData().GetZoomY(); sal_uInt16 nCurrentZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator()); if( nCurrentZoom ) @@ -315,16 +315,16 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) break; case FID_TOGGLESYNTAX: - rSet.Put(SfxBoolItem(nWhich, GetViewData()->IsSyntaxMode())); + rSet.Put(SfxBoolItem(nWhich, GetViewData().IsSyntaxMode())); break; case FID_TOGGLEHEADERS: - rSet.Put(SfxBoolItem(nWhich, GetViewData()->IsHeaderMode())); + rSet.Put(SfxBoolItem(nWhich, GetViewData().IsHeaderMode())); break; case FID_TOGGLEFORMULA: { - const ScViewOptions& rOpts = pViewData->GetOptions(); + const ScViewOptions& rOpts = rViewData.GetOptions(); bool bFormulaMode = rOpts.GetOption( VOPT_FORMULAS ); rSet.Put(SfxBoolItem(nWhich, bFormulaMode )); } @@ -340,8 +340,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) } else { - rSet.Put(SfxBoolItem(FID_NORMALVIEWMODE, !GetViewData()->IsPagebreakMode())); - rSet.Put(SfxBoolItem(FID_PAGEBREAKMODE, GetViewData()->IsPagebreakMode())); + rSet.Put(SfxBoolItem(FID_NORMALVIEWMODE, !GetViewData().IsPagebreakMode())); + rSet.Put(SfxBoolItem(FID_PAGEBREAKMODE, GetViewData().IsPagebreakMode())); } break; @@ -378,7 +378,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) case SID_AUTO_OUTLINE: { - if (pDoc->GetChangeTrack()!=NULL || GetViewData()->IsMultiMarked()) + if (pDoc->GetChangeTrack()!=NULL || GetViewData().IsMultiMarked()) { rSet.DisableItem( nWhich ); } @@ -387,7 +387,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) case SID_OUTLINE_DELETEALL: { - SCTAB nOlTab = GetViewData()->GetTabNo(); + SCTAB nOlTab = GetViewData().GetTabNo(); ScOutlineTable* pOlTable = pDoc->GetOutlineTable( nOlTab ); if (pOlTable == NULL) rSet.DisableItem( nWhich ); @@ -396,14 +396,14 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) case SID_WINDOW_SPLIT: rSet.Put(SfxBoolItem(nWhich, - pViewData->GetHSplitMode() == SC_SPLIT_NORMAL || - pViewData->GetVSplitMode() == SC_SPLIT_NORMAL )); + rViewData.GetHSplitMode() == SC_SPLIT_NORMAL || + rViewData.GetVSplitMode() == SC_SPLIT_NORMAL )); break; case SID_WINDOW_FIX: rSet.Put(SfxBoolItem(nWhich, - pViewData->GetHSplitMode() == SC_SPLIT_FIX || - pViewData->GetVSplitMode() == SC_SPLIT_FIX )); + rViewData.GetHSplitMode() == SC_SPLIT_FIX || + rViewData.GetVSplitMode() == SC_SPLIT_FIX )); break; case FID_CHG_SHOW: @@ -442,7 +442,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) break; case SID_READONLY_MODE: - rSet.Put( SfxBoolItem( nWhich, GetViewData()->GetDocShell()->IsReadOnly() ) ); + rSet.Put( SfxBoolItem( nWhich, GetViewData().GetDocShell()->IsReadOnly() ) ); break; case FID_TAB_DESELECTALL: @@ -458,7 +458,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); SvxBoxItem aLineOuter( ATTR_BORDER ); SvxBoxInfoItem aLineInner( ATTR_BORDER_INNER ); @@ -492,7 +492,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName // Get border items and put them in the set: GetSelectionFrame( aLineOuter, aLineInner ); //Fix border incorrect for RTL fdo#62399 - if( pDoc->IsLayoutRTL( GetViewData()->GetTabNo() ) ) + if( pDoc->IsLayoutRTL( GetViewData().GetTabNo() ) ) { SvxBoxItem aNewFrame( aLineOuter ); SvxBoxInfoItem aTempInfo( aLineInner ); @@ -516,7 +516,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName pOldSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, pOldAttrs->GetNumberFormat( pDoc->GetFormatTable() ) ) ); - pNumberInfoItem.reset(MakeNumberInfoItem(pDoc, GetViewData())); + pNumberInfoItem.reset(MakeNumberInfoItem(pDoc, &GetViewData())); pOldSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO ); pOldSet->Put(*pNumberInfoItem ); @@ -565,21 +565,18 @@ bool ScTabViewShell::IsRefInputMode() const if ( !pHdl->GetSelIsRef() && aString.getLength() > 1 && ( aString[0] == '+' || aString[0] == '-' ) ) { - const ScViewData* pViewData = GetViewData(); - if ( pViewData ) + const ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + if ( pDoc ) { - ScDocument* pDoc = pViewData->GetDocument(); - if ( pDoc ) + const ScAddress aPos( rViewData.GetCurPos() ); + ScCompiler aComp( pDoc, aPos ); + aComp.SetGrammar(pDoc->GetGrammar()); + aComp.SetCloseBrackets( false ); + boost::scoped_ptr<ScTokenArray> pArr(aComp.CompileString(aString)); + if ( pArr && pArr->MayReferenceFollow() ) { - const ScAddress aPos( pViewData->GetCurPos() ); - ScCompiler aComp( pDoc, aPos ); - aComp.SetGrammar(pDoc->GetGrammar()); - aComp.SetCloseBrackets( false ); - boost::scoped_ptr<ScTokenArray> pArr(aComp.CompileString(aString)); - if ( pArr && pArr->MayReferenceFollow() ) - { - return true; - } + return true; } } } @@ -614,21 +611,21 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt { OUString aString; const EditTextObject* pObject = NULL; - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); CellType eType; - SCCOL nPosX = pViewData->GetCurX(); - SCROW nPosY = pViewData->GetCurY(); - SCTAB nTab = pViewData->GetTabNo(); + SCCOL nPosX = rViewData.GetCurX(); + SCROW nPosY = rViewData.GetCurY(); + SCTAB nTab = rViewData.GetTabNo(); SCTAB nStartTab = 0; SCTAB nEndTab = 0; SCCOL nStartCol = 0; SCROW nStartRow = 0; SCCOL nEndCol = 0; SCROW nEndRow = 0; - ScAddress aPos = pViewData->GetCurPos(); + ScAddress aPos = rViewData.GetCurPos(); - pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab, + rViewData.GetSimpleArea( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ); PutInOrder( nStartCol, nEndCol ); @@ -711,24 +708,24 @@ void ScTabViewShell::ExecuteSave( SfxRequest& rReq ) // Finish entering in any case, even if a formula is being processed SC_MOD()->InputEnterHandler(); - if ( GetViewData()->GetDocShell()->IsDocShared() ) + if ( GetViewData().GetDocShell()->IsDocShared() ) { - GetViewData()->GetDocShell()->SetDocumentModified(); + GetViewData().GetDocShell()->SetDocumentModified(); } // otherwise as normal - GetViewData()->GetDocShell()->ExecuteSlot( rReq ); + GetViewData().GetDocShell()->ExecuteSlot( rReq ); } void ScTabViewShell::GetSaveState( SfxItemSet& rSet ) { - SfxShell* pDocSh = GetViewData()->GetDocShell(); + SfxShell* pDocSh = GetViewData().GetDocShell(); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); while( nWhich ) { - if ( nWhich != SID_SAVEDOC || !GetViewData()->GetDocShell()->IsDocShared() ) + if ( nWhich != SID_SAVEDOC || !GetViewData().GetDocShell()->IsDocShared() ) { // get state from DocShell pDocSh->GetSlotState( nWhich, NULL, &rSet ); @@ -739,7 +736,7 @@ void ScTabViewShell::GetSaveState( SfxItemSet& rSet ) void ScTabViewShell::ExecDrawOpt( SfxRequest& rReq ) { - ScViewOptions aViewOptions = GetViewData()->GetOptions(); + ScViewOptions aViewOptions = GetViewData().GetOptions(); ScGridOptions aGridOptions = aViewOptions.GetGridOptions(); SfxBindings& rBindings = GetViewFrame()->GetBindings(); @@ -775,14 +772,14 @@ void ScTabViewShell::ExecDrawOpt( SfxRequest& rReq ) break; } - GetViewData()->SetOptions(aViewOptions); + GetViewData().SetOptions(aViewOptions); } void ScTabViewShell::GetDrawOptState( SfxItemSet& rSet ) { SfxBoolItem aBool; - const ScViewOptions& rViewOptions = GetViewData()->GetOptions(); + const ScViewOptions& rViewOptions = GetViewData().GetOptions(); const ScGridOptions& rGridOptions = rViewOptions.GetGridOptions(); aBool.SetValue(rGridOptions.GetGridVisible()); diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 3871bc8dce35..6db2356d9130 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -210,7 +210,7 @@ bool ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) } //! SetDocumentName sollte schon im Sfx passieren ??? //TODO/LATER: how "SetDocumentName"? - //xIPObj->SetDocumentName( GetViewData()->GetDocShell()->GetTitle() ); + //xIPObj->SetDocumentName( GetViewData().GetDocShell()->GetTitle() ); return ( !(nErr & ERRCODE_ERROR_MASK) ); } @@ -273,16 +273,16 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) // Rahmen fuer Chart einfuegen wird abgebrochen: FuPoor* pPoor = GetDrawFuncPtr(); if ( pPoor && pPoor->GetSlotID() == SID_DRAW_CHART ) - GetViewData()->GetDispatcher().Execute(SID_DRAW_CHART, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); + GetViewData().GetDispatcher().Execute(SID_DRAW_CHART, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); MakeDrawLayer(); SfxBindings& rBindings = GetViewFrame()->GetBindings(); - ScTabView* pTabView = GetViewData()->GetView(); + ScTabView* pTabView = GetViewData().GetView(); Window* pWin = pTabView->GetActiveWin(); ScDrawView* pView = pTabView->GetScDrawView(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); SdrModel* pDrModel = pView->GetModel(); switch ( nSlot ) @@ -362,7 +362,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) case SID_LINKS: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( pWin, pDoc->GetLinkManager() ); + SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( pWin, rDoc.GetLinkManager() ); if ( pDlg ) { pDlg->Execute(); @@ -438,8 +438,8 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) { bool bOle = GetViewFrame()->GetFrame().IsInPlace(); - bool bTabProt = GetViewData()->GetDocument()->IsTabProtected(GetViewData()->GetTabNo()); - ScDocShell* pDocShell = ( GetViewData() ? GetViewData()->GetDocShell() : NULL ); + bool bTabProt = GetViewData().GetDocument()->IsTabProtected(GetViewData().GetTabNo()); + ScDocShell* pDocShell = GetViewData().GetDocShell(); bool bShared = pDocShell && pDocShell->IsDocShared(); SfxWhichIter aIter(rSet); @@ -483,7 +483,7 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) case SID_LINKS: { - if (GetViewData()->GetDocument()->GetLinkManager()->GetLinks().empty()) + if (GetViewData().GetDocument()->GetLinkManager()->GetLinks().empty()) rSet.DisableItem( SID_LINKS ); } break; @@ -495,11 +495,11 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) void ScTabViewShell::ExecuteUndo(SfxRequest& rReq) { - SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0); + SfxShell* pSh = GetViewData().GetDispatcher().GetShell(0); ::svl::IUndoManager* pUndoManager = pSh->GetUndoManager(); const SfxItemSet* pReqArgs = rReq.GetArgs(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); sal_uInt16 nSlot = rReq.GetSlot(); switch ( nSlot ) @@ -549,7 +549,7 @@ void ScTabViewShell::ExecuteUndo(SfxRequest& rReq) void ScTabViewShell::GetUndoState(SfxItemSet &rSet) { - SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0); + SfxShell* pSh = GetViewData().GetDispatcher().GetShell(0); ::svl::IUndoManager* pUndoManager = pSh->GetUndoManager(); SfxWhichIter aIter(rSet); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 9d858a658b68..99da797cda2e 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -126,7 +126,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( // the dialog has been opened in a different view // -> lock the dispatcher for this view (modal mode) - GetViewData()->GetDispatcher().Lock( true ); // lock is reset when closing dialog + GetViewData().GetDispatcher().Lock( true ); // lock is reset when closing dialog return NULL; } @@ -135,7 +135,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( if(pCW) pCW->SetHideNotDelete(true); - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); switch( nSlotId ) { @@ -143,17 +143,17 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { if (!mbInSwitch) { - pResult = new ScNameDlg( pB, pCW, pParent, GetViewData(), - ScAddress( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ) ); + pResult = new ScNameDlg( pB, pCW, pParent, &GetViewData(), + ScAddress( GetViewData().GetCurX(), + GetViewData().GetCurY(), + GetViewData().GetTabNo() ) ); } else { - pResult = new ScNameDlg( pB, pCW, pParent, GetViewData(), - ScAddress( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ), &maRangeMap); + pResult = new ScNameDlg( pB, pCW, pParent, &GetViewData(), + ScAddress( GetViewData().GetCurX(), + GetViewData().GetCurY(), + GetViewData().GetTabNo() ), &maRangeMap); static_cast<ScNameDlg*>(pResult)->SetEntry( maName, maScope); mbInSwitch = false; } @@ -166,10 +166,10 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { std::map<OUString, ScRangeName*> aRangeMap; pDoc->GetRangeNameMap(aRangeMap); - pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData(), aRangeMap, - ScAddress( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ), true ); + pResult = new ScNameDefDlg( pB, pCW, pParent, &GetViewData(), aRangeMap, + ScAddress( GetViewData().GetCurX(), + GetViewData().GetCurY(), + GetViewData().GetTabNo() ), true ); } else { @@ -179,17 +179,17 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { aRangeMap.insert(std::pair<OUString, ScRangeName*>(itr->first, itr->second)); } - pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData(), aRangeMap, - ScAddress( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ), false ); + pResult = new ScNameDefDlg( pB, pCW, pParent, &GetViewData(), aRangeMap, + ScAddress( GetViewData().GetCurX(), + GetViewData().GetCurY(), + GetViewData().GetTabNo() ), false ); } } break; case SID_DEFINE_COLROWNAMERANGES: { - pResult = new ScColRowNameRangesDlg( pB, pCW, pParent, GetViewData() ); + pResult = new ScColRowNameRangesDlg( pB, pCW, pParent, &GetViewData() ); } break; @@ -209,7 +209,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( SCROW nStartRow, nEndRow; SCTAB nStartTab, nEndTab; - GetViewData()->GetSimpleArea( nStartCol, nStartRow, nStartTab, + GetViewData().GetSimpleArea( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ); PutInOrder( nStartCol, nEndCol ); @@ -235,11 +235,11 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { // wenn auf einem bestehenden Bereich aufgerufen, den markieren GetDBData( true, SC_DB_OLD ); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + const ScMarkData& rMark = GetViewData().GetMarkData(); if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) MarkDataArea( false ); - pResult = new ScDbNameDlg( pB, pCW, pParent, GetViewData() ); + pResult = new ScDbNameDlg( pB, pCW, pParent, &GetViewData() ); } break; @@ -258,7 +258,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( pDBData->GetArea(aArea); MarkRange(aArea, false); - ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam ); + ScQueryItem aItem( SCITEM_QUERYDATA, &GetViewData(), &aQueryParam ); ScRange aAdvSource; if (pDBData->GetAdvancedQuerySource(aAdvSource)) aItem.SetAdvancedQuerySource( &aAdvSource ); @@ -266,7 +266,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( aArgSet.Put( aItem ); // aktuelle Tabelle merken (wg. RefInput im Dialog) - GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() ); + GetViewData().SetRefTabNo( GetViewData().GetTabNo() ); pResult = new ScSpecialFilterDlg( pB, pCW, pParent, aArgSet ); } @@ -289,11 +289,11 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( MarkRange(aArea, false); aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, - GetViewData(), + &GetViewData(), &aQueryParam ) ); // aktuelle Tabelle merken (wg. RefInput im Dialog) - GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() ); + GetViewData().SetRefTabNo( GetViewData().GetTabNo() ); pResult = new ScFilterDlg( pB, pCW, pParent, aArgSet ); } @@ -301,91 +301,91 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( case SID_OPENDLG_TABOP: { - ScViewData* pViewData = GetViewData(); - ScRefAddress aCurPos ( pViewData->GetCurX(), - pViewData->GetCurY(), - pViewData->GetTabNo(), + ScViewData& rViewData = GetViewData(); + ScRefAddress aCurPos ( rViewData.GetCurX(), + rViewData.GetCurY(), + rViewData.GetTabNo(), false, false, false ); - pResult = new ScTabOpDlg( pB, pCW, pParent, pViewData->GetDocument(), aCurPos ); + pResult = new ScTabOpDlg( pB, pCW, pParent, rViewData.GetDocument(), aCurPos ); } break; case SID_OPENDLG_SOLVE: { - ScViewData* pViewData = GetViewData(); - ScAddress aCurPos( pViewData->GetCurX(), - pViewData->GetCurY(), - pViewData->GetTabNo()); - pResult = new ScSolverDlg( pB, pCW, pParent, pViewData->GetDocument(), aCurPos ); + ScViewData& rViewData = GetViewData(); + ScAddress aCurPos( rViewData.GetCurX(), + rViewData.GetCurY(), + rViewData.GetTabNo()); + pResult = new ScSolverDlg( pB, pCW, pParent, rViewData.GetDocument(), aCurPos ); } break; case SID_RANDOM_NUMBER_GENERATOR_DIALOG: { - pResult = new ScRandomNumberGeneratorDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScRandomNumberGeneratorDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_SAMPLING_DIALOG: { - pResult = new ScSamplingDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScSamplingDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_DESCRIPTIVE_STATISTICS_DIALOG: { - pResult = new ScDescriptiveStatisticsDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScDescriptiveStatisticsDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_ANALYSIS_OF_VARIANCE_DIALOG: { - pResult = new ScAnalysisOfVarianceDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScAnalysisOfVarianceDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_CORRELATION_DIALOG: { - pResult = new ScCorrelationDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScCorrelationDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_COVARIANCE_DIALOG: { - pResult = new ScCovarianceDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScCovarianceDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_EXPONENTIAL_SMOOTHING_DIALOG: { - pResult = new ScExponentialSmoothingDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScExponentialSmoothingDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_MOVING_AVERAGE_DIALOG: { - pResult = new ScMovingAverageDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScMovingAverageDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_TTEST_DIALOG: { - pResult = new ScTTestDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScTTestDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_FTEST_DIALOG: { - pResult = new ScFTestDialog( pB, pCW, pParent, GetViewData() ); + pResult = new ScFTestDialog( pB, pCW, pParent, &GetViewData() ); } break; case SID_OPENDLG_OPTSOLVER: { - ScViewData* pViewData = GetViewData(); - ScAddress aCurPos( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo()); - pResult = new ScOptSolverDlg( pB, pCW, pParent, pViewData->GetDocShell(), aCurPos ); + ScViewData& rViewData = GetViewData(); + ScAddress aCurPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo()); + pResult = new ScOptSolverDlg( pB, pCW, pParent, rViewData.GetDocShell(), aCurPos ); } break; @@ -396,10 +396,10 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( if( pDialogDPObject ) { // Check for an existing datapilot output. - ScViewData* pViewData = GetViewData(); - pViewData->SetRefTabNo( pViewData->GetTabNo() ); - ScDPObject* pObj = pDoc->GetDPAtCursor(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo()); - pResult = new ScPivotLayoutDialog(pB, pCW, pParent, pViewData, pDialogDPObject, pObj == NULL); + ScViewData& rViewData = GetViewData(); + rViewData.SetRefTabNo( rViewData.GetTabNo() ); + ScDPObject* pObj = pDoc->GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo()); + pResult = new ScPivotLayoutDialog(pB, pCW, pParent, &rViewData, pDialogDPObject, pObj == NULL); } } break; @@ -414,7 +414,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { // Dialog schaut selber, was in der Zelle steht - pResult = new ScFormulaDlg( pB, pCW, pParent, GetViewData(),ScGlobal::GetStarCalcFunctionMgr() ); + pResult = new ScFormulaDlg( pB, pCW, pParent, &GetViewData(),ScGlobal::GetStarCalcFunctionMgr() ); } break; @@ -430,7 +430,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { // Dialog schaut selber, was in der Zelle steht - pResult = new ScHighlightChgDlg( pB, pCW, pParent, GetViewData() ); + pResult = new ScHighlightChgDlg( pB, pCW, pParent, &GetViewData() ); } break; @@ -438,9 +438,9 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { // Dialog schaut selber, was in der Zelle steht - ScViewData* pViewData = GetViewData(); - pViewData->SetRefTabNo( pViewData->GetTabNo() ); - pResult = new ScSimpleRefDlg( pB, pCW, pParent, pViewData ); + ScViewData& rViewData = GetViewData(); + rViewData.SetRefTabNo( rViewData.GetTabNo() ); + pResult = new ScSimpleRefDlg( pB, pCW, pParent, &rViewData ); } break; diff --git a/sc/source/ui/view/tabvwshd.cxx b/sc/source/ui/view/tabvwshd.cxx index f3431d332125..828b3e0fd8b5 100644 --- a/sc/source/ui/view/tabvwshd.cxx +++ b/sc/source/ui/view/tabvwshd.cxx @@ -55,7 +55,7 @@ Window* ScTabViewShell::GetDialogParent() } } - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); if ( pDocSh->IsOle() ) { // TODO/LATER: how to GetEditWindow in embedded document?! diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index 2629d49c5eae..6904328d25d4 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -54,9 +54,9 @@ OUString ScTabViewShell::GetSelectionText( bool bWholeWord ) { ScRange aRange; - if ( GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) + if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if ( bInFormatDialog && aRange.aStart.Row() != aRange.aEnd.Row() ) { // Range auf eine Datenzeile begrenzen @@ -95,7 +95,7 @@ OUString ScTabViewShell::GetSelectionText( bool bWholeWord ) } ScImportExport aObj( pDoc, aRange ); - aObj.SetFormulas( GetViewData()->GetOptions().GetOption( VOPT_FORMULAS ) ); + aObj.SetFormulas( GetViewData().GetOptions().GetOption( VOPT_FORMULAS ) ); OUString aExportOUString; aObj.ExportString( aExportOUString ); aStrSelection = convertLineEnd(aExportOUString, LINEEND_CR); @@ -125,7 +125,7 @@ void ScTabViewShell::InsertURL( const OUString& rName, const OUString& rURL, con if ( bAsText ) { - if ( GetViewData()->IsActive() ) + if ( GetViewData().IsActive() ) { // if the view is active, always use InsertURLField, which starts EditMode // and selects the URL, so it can be changed from the URL bar / dialog @@ -138,8 +138,8 @@ void ScTabViewShell::InsertURL( const OUString& rName, const OUString& rURL, con // -> use InsertBookmark to directly manipulate cell content // bTryReplace=sal_True -> if cell contains only one URL, replace it - SCCOL nPosX = GetViewData()->GetCurX(); - SCROW nPosY = GetViewData()->GetCurY(); + SCCOL nPosX = GetViewData().GetCurX(); + SCROW nPosY = GetViewData().GetCurY(); InsertBookmark( rName, rURL, nPosX, nPosY, &rTarget, true ); } } @@ -168,9 +168,9 @@ void ScTabViewShell::InsertURLField( const OUString& rName, const OUString& rURL aURLField.SetTargetFrame( rTarget ); SvxFieldItem aURLItem( aURLField, EE_FEATURE_FIELD ); - ScViewData* pViewData = GetViewData(); + ScViewData& rViewData = GetViewData(); ScModule* pScMod = SC_MOD(); - ScInputHandler* pHdl = pScMod->GetInputHdl( pViewData->GetViewShell() ); + ScInputHandler* pHdl = pScMod->GetInputHdl( rViewData.GetViewShell() ); bool bSelectFirst = false; if ( !pScMod->IsEditMode() ) @@ -239,7 +239,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) SvxSearchDialog* pSearchDlg = (SvxSearchDialog*)(pChildWindow->GetWindow()); if( pSearchDlg ) { - ScTabView* pTabView = GetViewData()->GetView(); + ScTabView* pTabView = GetViewData().GetView(); if( pTabView ) { Window* pWin = pTabView->GetActiveWin(); @@ -298,7 +298,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) // Request ausfuehren (dabei wird das SearchItem gespeichert) aSearchItem.SetWhich(SID_SEARCH_ITEM); - GetViewData()->GetDispatcher().Execute( FID_SEARCH_NOW, + GetViewData().GetDispatcher().Execute( FID_SEARCH_NOW, rReq.IsAPI() ? SFX_CALLMODE_API|SFX_CALLMODE_SYNCHRON : SFX_CALLMODE_STANDARD, &aSearchItem, 0L ); @@ -309,7 +309,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) SvxSearchDialog* pSearchDlg = (SvxSearchDialog*)(pChildWindow->GetWindow()); if( pSearchDlg ) { - ScTabView* pTabView = GetViewData()->GetView(); + ScTabView* pTabView = GetViewData().GetView(); if( pTabView ) { Window* pWin = pTabView->GetActiveWin(); @@ -324,7 +324,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) } else { - GetViewData()->GetDispatcher().Execute( + GetViewData().GetDispatcher().Execute( SID_SEARCH_DLG, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD ); } } @@ -335,7 +335,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) SvxSearchItem aSearchItem = ScGlobal::GetSearchItem(); aSearchItem.SetWhich(SID_SEARCH_ITEM); - GetViewData()->GetDispatcher().Execute( FID_SEARCH_NOW, + GetViewData().GetDispatcher().Execute( FID_SEARCH_NOW, rReq.IsAPI() ? SFX_CALLMODE_API|SFX_CALLMODE_SYNCHRON : SFX_CALLMODE_STANDARD, &aSearchItem, 0L ); diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 01b33721543d..06701689f913 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -57,12 +57,12 @@ using namespace com::sun::star; void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); - SCTAB nCurrentTab = pViewData->GetTabNo(); + SCTAB nCurrentTab = rViewData.GetTabNo(); SCTAB nTabCount = pDoc->GetTableCount(); - sal_uInt16 nSlot = rReq.GetSlot(); + sal_uInt16 nSlot = rReq.GetSlot(); const SfxItemSet* pReqArgs = rReq.GetArgs(); HideListBox(); // Autofilter-DropDown-Listbox @@ -86,7 +86,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { if ( pDoc->IsDocEditable() ) { - ScMarkData& rMark = pViewData->GetMarkData(); + ScMarkData& rMark = rViewData.GetMarkData(); HideTable( rMark ); } } @@ -103,7 +103,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { if ( pDoc->IsDocEditable() ) { - ScMarkData& rMark = pViewData->GetMarkData(); + ScMarkData& rMark = rViewData.GetMarkData(); HideTable( rMark ); } } @@ -165,7 +165,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) case FID_INS_TABLE: case FID_INS_TABLE_EXT: { - ScMarkData& rMark = pViewData->GetMarkData(); + ScMarkData& rMark = rViewData.GetMarkData(); SCTAB nTabSelCount = rMark.GetSelectCount(); SCTAB nTabNr = nCurrentTab; @@ -199,7 +199,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - boost::scoped_ptr<AbstractScInsertTableDlg> pDlg(pFact->CreateScInsertTableDlg(GetDialogParent(), *pViewData, + boost::scoped_ptr<AbstractScInsertTableDlg> pDlg(pFact->CreateScInsertTableDlg(GetDialogParent(), rViewData, nTabSelCount, nSlot == FID_INS_TABLE_EXT)); OSL_ENSURE(pDlg, "Dialog create fail!"); if ( RET_OK == pDlg->Execute() ) @@ -306,8 +306,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) if ( nSlot == FID_TAB_MENU_RENAME ) nSlot = FID_TAB_RENAME; // Execute ist gleich - SCTAB nTabNr = pViewData->GetTabNo(); - ScMarkData& rMark = pViewData->GetMarkData(); + SCTAB nTabNr = rViewData.GetTabNo(); + ScMarkData& rMark = rViewData.GetMarkData(); SCTAB nTabSelCount = rMark.GetSelectCount(); if ( !pDoc->IsDocEditable() ) @@ -363,7 +363,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) case FID_TAB_RENAME: aDlgTitle = OUString(ScResId(SCSTR_RENAMETAB)); - pDoc->GetName( pViewData->GetTabNo(), aName ); + pDoc->GetName( rViewData.GetTabNo(), aName ); pHelpId = HID_SC_RENAME_NAME; break; } @@ -431,7 +431,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) bool bDoIt = false; sal_uInt16 nDoc = 0; - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = rViewData.GetTabNo(); bool bCpy = false; OUString aDocName; OUString aTabName; @@ -470,9 +470,9 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) if (aDocName.equals(pScSh->GetTitle())) { nDoc = i; - ScDocument* pDestDoc = pScSh->GetDocument(); - nTableCount = pDestDoc->GetTableCount(); - bDoIt = pDestDoc->IsDocEditable(); + ScDocument& rDestDoc = pScSh->GetDocument(); + nTableCount = rDestDoc.GetTableCount(); + bDoIt = rDestDoc.IsDocEditable(); break; } @@ -493,7 +493,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) else { OUString aDefaultName; - pDoc->GetName( pViewData->GetTabNo(), aDefaultName ); + pDoc->GetName( rViewData.GetTabNo(), aDefaultName ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); @@ -503,7 +503,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) OSL_ENSURE(pDlg, "Dialog create fail!"); SCTAB nTableCount = pDoc->GetTableCount(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); SCTAB nTabSelCount = rMark.GetSelectCount(); @@ -536,7 +536,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) if (pSh) { aFoundDocName = pSh->GetTitle(); - if ( !pSh->GetDocument()->IsDocEditable() ) + if ( !pSh->GetDocument().IsDocEditable() ) { ErrorMessage(STR_READONLYERR); bDoIt = false; @@ -580,7 +580,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) SCTAB nNewTab = nCurrentTab; SCTAB nFirstTab=0; bool bTabFlag=false; - ScMarkData& rMark = pViewData->GetMarkData(); + ScMarkData& rMark = rViewData.GetMarkData(); std::vector<SCTAB> TheTabs; for(SCTAB i=0;i<nTabCount;i++) { @@ -594,7 +594,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } if(nNewTab>=nTabCount) nNewTab=nFirstTab; - pViewData->SetTabNo(nNewTab); + rViewData.SetTabNo(nNewTab); DeleteTables(TheTabs); TheTabs.clear(); rReq.Done(); @@ -604,11 +604,11 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) case FID_TAB_RTL: { - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocShell* pDocSh = rViewData.GetDocShell(); ScDocFunc &rFunc = pDocSh->GetDocFunc(); bool bSet = !pDoc->IsLayoutRTL( nCurrentTab ); - const ScMarkData& rMark = pViewData->GetMarkData(); + const ScMarkData& rMark = rViewData.GetMarkData(); if ( rMark.GetSelectCount() != 0 ) { // handle several sheets @@ -630,8 +630,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) case FID_TAB_TOGGLE_GRID: { - bool bShowGrid = pViewData->GetShowGrid(); - pViewData->SetShowGrid(!bShowGrid); + bool bShowGrid = rViewData.GetShowGrid(); + rViewData.SetShowGrid(!bShowGrid); SfxBindings& rBindings = GetViewFrame()->GetBindings(); rBindings.Invalidate( FID_TAB_TOGGLE_GRID ); PaintGrid(); @@ -644,8 +644,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { if ( nSlot == FID_TAB_MENU_SET_TAB_BG_COLOR ) nSlot = FID_TAB_SET_TAB_BG_COLOR; - SCTAB nTabNr = pViewData->GetTabNo(); - ScMarkData& rMark = pViewData->GetMarkData(); + SCTAB nTabNr = rViewData.GetTabNo(); + ScMarkData& rMark = rViewData.GetMarkData(); SCTAB nTabSelCount = rMark.GetSelectCount(); if ( !pDoc->IsDocEditable() ) break; @@ -751,9 +751,9 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } break; - case FID_TAB_EVENTS: + case FID_TAB_EVENTS: { - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocShell* pDocSh = rViewData.GetDocShell(); uno::Reference<container::XNameReplace> xEvents( new ScSheetEventsObj( pDocSh, nCurrentTab ) ); uno::Reference<frame::XFrame> xFrame = GetViewFrame()->GetFrame().GetFrameInterface(); SvxAbstractDialogFactory* pDlgFactory = SvxAbstractDialogFactory::Create(); @@ -769,19 +769,19 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } break; - default: + default: OSL_FAIL("Unbekannte Message bei ViewShell"); break; - } } +} - void ScTabViewShell::GetStateTable( SfxItemSet& rSet ) - { - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - ScDocShell* pDocShell = pViewData->GetDocShell(); - ScMarkData& rMark = GetViewData()->GetMarkData(); - SCTAB nTab = pViewData->GetTabNo(); +void ScTabViewShell::GetStateTable( SfxItemSet& rSet ) +{ + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + ScDocShell* pDocShell = rViewData.GetDocShell(); + ScMarkData& rMark = GetViewData().GetMarkData(); + SCTAB nTab = rViewData.GetTabNo(); SCTAB nTabCount = pDoc->GetTableCount(); SCTAB nTabSelCount = rMark.GetSelectCount(); @@ -904,7 +904,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) break; case FID_TAB_TOGGLE_GRID: - rSet.Put( SfxBoolItem(nWhich, pViewData->GetShowGrid()) ); + rSet.Put( SfxBoolItem(nWhich, rViewData.GetShowGrid()) ); break; } nWhich = aIter.NextWhich(); diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx index a2457bd312b8..e38b495f9fe7 100644 --- a/sc/source/ui/view/tabvwshg.cxx +++ b/sc/source/ui/view/tabvwshg.cxx @@ -43,9 +43,9 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR { // Tabelle geschuetzt ? - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + SCTAB nTab = rViewData.GetTabNo(); if ( pDoc->IsTabProtected(nTab) ) { ErrorMessage(STR_PROTECTIONERR); @@ -54,7 +54,7 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR MakeDrawLayer(); - ScTabView* pView = pViewData->GetView(); + ScTabView* pView = rViewData.GetView(); ScDrawView* pDrView = pView->GetScDrawView(); SdrModel* pModel = pDrView->GetModel(); diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx index 3853aad088f3..5ce836ce3b64 100644 --- a/sc/source/ui/view/tabvwshh.cxx +++ b/sc/source/ui/view/tabvwshh.cxx @@ -177,7 +177,7 @@ void ScTabViewShell::GetObjectState( SfxItemSet& rSet ) uno::Reference < embed::XEmbeddedObject > xOLE = lcl_GetSelectedObj( GetSdrView() ); if (xOLE.is()) { - aName = GetViewData()->GetSfxDocShell()->GetEmbeddedObjectContainer().GetEmbeddedObjectName( xOLE ); + aName = GetViewData().GetSfxDocShell()->GetEmbeddedObjectContainer().GetEmbeddedObjectName( xOLE ); } rSet.Put( SfxStringItem( nWhich, aName ) ); } @@ -224,7 +224,7 @@ void ScTabViewShell::AddAccessibilityObject( SfxListener& rObject ) pAccessibilityBroadcaster = new SfxBroadcaster; rObject.StartListening( *pAccessibilityBroadcaster ); - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if (pDoc) pDoc->AddUnoObject(rObject); } @@ -234,7 +234,7 @@ void ScTabViewShell::RemoveAccessibilityObject( SfxListener& rObject ) if (pAccessibilityBroadcaster) { rObject.EndListening( *pAccessibilityBroadcaster ); - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if (pDoc) pDoc->RemoveUnoObject(rObject); } @@ -257,7 +257,7 @@ bool ScTabViewShell::HasAccessibilityObjects() bool ScTabViewShell::ExecuteRetypePassDlg(ScPasswordHash eDesiredHash) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); boost::scoped_ptr<ScRetypePassDlg> pDlg(new ScRetypePassDlg(GetDialogParent())); pDlg->SetDataFromDocument(*pDoc); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 14d41550082e..a1a5c709ff98 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -354,7 +354,7 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) : if (pDocShell) { - pDoc = pDocShell->GetDocument(); + pDoc = &pDocShell->GetDocument(); *pOptions = pDoc->GetViewOptions(); } @@ -445,7 +445,7 @@ ScDocument* ScViewData::GetDocument() const if (pDoc) return pDoc; else if (pDocShell) - return pDocShell->GetDocument(); + return &pDocShell->GetDocument(); OSL_FAIL("kein Document an ViewData"); return NULL; diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 85ec4034a554..3a9724ccef62 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -103,23 +103,23 @@ void VBA_DeleteModule( ScDocShell& rDocSh, const OUString& sModuleName ); bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); if (!pMarkData) - pMarkData = &GetViewData()->GetMarkData(); + pMarkData = &GetViewData().GetMarkData(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); std::vector<sc::ColRowSpan> aMarkedRows = pMarkData->GetMarkedRowSpans(); if (aMarkedRows.empty()) { - SCROW nCurRow = GetViewData()->GetCurY(); + SCROW nCurRow = GetViewData().GetCurY(); aMarkedRows.push_back(sc::ColRowSpan(nCurRow, nCurRow)); } - double nPPTX = GetViewData()->GetPPTX(); - double nPPTY = GetViewData()->GetPPTY(); - Fraction aZoomX = GetViewData()->GetZoomX(); - Fraction aZoomY = GetViewData()->GetZoomY(); + double nPPTX = GetViewData().GetPPTX(); + double nPPTY = GetViewData().GetPPTY(); + Fraction aZoomX = GetViewData().GetZoomX(); + Fraction aZoomY = GetViewData().GetZoomY(); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) @@ -142,7 +142,7 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData ) { SCROW nStartNo = itRows->mnStart; SCROW nEndNo = itRows->mnEnd; - if (pDoc->SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab)) + if (rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab)) { if (!bChanged) nPaintY = nStartNo; @@ -155,7 +155,7 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData ) } if ( bPaint && bAnyChanged ) - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); return bAnyChanged; } @@ -163,16 +163,16 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData ) bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bPaint ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); - double nPPTX = GetViewData()->GetPPTX(); - double nPPTY = GetViewData()->GetPPTY(); - Fraction aZoomX = GetViewData()->GetZoomX(); - Fraction aZoomY = GetViewData()->GetZoomY(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); + double nPPTX = GetViewData().GetPPTX(); + double nPPTY = GetViewData().GetPPTY(); + Fraction aZoomX = GetViewData().GetZoomX(); + Fraction aZoomY = GetViewData().GetZoomY(); sal_uInt16 nOldPixel = 0; if (nStartRow == nEndRow) - nOldPixel = (sal_uInt16) (pDoc->GetRowHeight(nStartRow,nTab) * nPPTY); + nOldPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) @@ -182,11 +182,11 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bPaint ) aZoomX = aZoomY = Fraction( 1, 1 ); } sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice()); - bool bChanged = pDoc->SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab); + bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab); if (bChanged && ( nStartRow == nEndRow )) { - sal_uInt16 nNewPixel = (sal_uInt16) (pDoc->GetRowHeight(nStartRow,nTab) * nPPTY); + sal_uInt16 nNewPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY); if ( nNewPixel == nOldPixel ) bChanged = false; } @@ -383,11 +383,11 @@ static bool lcl_GetAutoSumForRowRange( ScDocument* pDoc, ScRangeList& rRangeList bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocument* pDoc = GetViewData().GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); SCCOL nStartCol = nCol; SCROW nStartRow = nRow; @@ -493,7 +493,7 @@ void ScViewFunc::EnterAutoSum(const ScRangeList& rRangeList, bool bSubTotal, con bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor, bool bContinue ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); const SCTAB nTab = rRange.aStart.Tab(); SCCOL nStartCol = rRange.aStart.Col(); SCROW nStartRow = rRange.aStart.Row(); @@ -692,8 +692,8 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSubTotal, const ScAddress& rAddr ) { - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); ::boost::scoped_ptr<ScTokenArray> pArray(new ScTokenArray); pArray->AddOpCode(bSubTotal ? ocSubTotal : ocSum); @@ -737,10 +737,10 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat { // test for multi selection - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); + ScMarkData& rMark = GetViewData().GetMarkData(); if ( rMark.IsMultiMarked() ) { rMark.MarkToSimple(); @@ -757,7 +757,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat } } - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); OUString aNewStr = rString; if ( pData ) { @@ -821,14 +821,14 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat void ScViewFunc::InsertPageBreak( bool bColumn, bool bRecord, const ScAddress* pPos, bool bSetModified ) { - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); ScAddress aCursor; if (pPos) aCursor = *pPos; else - aCursor = ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), nTab ); + aCursor = ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), nTab ); - bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc(). + bool bSuccess = GetViewData().GetDocShell()->GetDocFunc(). InsertPageBreak( bColumn, aCursor, bRecord, bSetModified, false ); if ( bSuccess && bSetModified ) @@ -839,14 +839,14 @@ void ScViewFunc::InsertPageBreak( bool bColumn, bool bRecord, const ScAddress* p void ScViewFunc::DeletePageBreak( bool bColumn, bool bRecord, const ScAddress* pPos, bool bSetModified ) { - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); ScAddress aCursor; if (pPos) aCursor = *pPos; else - aCursor = ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), nTab ); + aCursor = ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), nTab ); - bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc(). + bool bSuccess = GetViewData().GetDocShell()->GetDocFunc(). RemovePageBreak( bColumn, aCursor, bRecord, bSetModified, false ); if ( bSuccess && bSetModified ) @@ -855,22 +855,22 @@ void ScViewFunc::DeletePageBreak( bool bColumn, bool bRecord, const ScAddress* p void ScViewFunc::RemoveManualBreaks() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); - bool bUndo(pDoc->IsUndoEnabled()); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); + bool bUndo(rDoc.IsUndoEnabled()); if (bUndo) { ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true ); - pDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pUndoDoc ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); + rDoc.CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pUndoDoc ); pDocSh->GetUndoManager()->AddUndoAction( new ScUndoRemoveBreaks( pDocSh, nTab, pUndoDoc ) ); } - pDoc->RemoveManualBreaks(nTab); - pDoc->UpdatePageBreaks(nTab); + rDoc.RemoveManualBreaks(nTab); + rDoc.UpdatePageBreaks(nTab); UpdatePageBreakData( true ); pDocSh->SetDocumentModified(); @@ -879,17 +879,17 @@ void ScViewFunc::RemoveManualBreaks() void ScViewFunc::SetPrintZoom(sal_uInt16 nScale, sal_uInt16 nPages) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); pDocSh->SetPrintZoom( nTab, nScale, nPages ); } void ScViewFunc::AdjustPrintZoom() { ScRange aRange; - if ( GetViewData()->GetSimpleArea( aRange ) != SC_MARK_SIMPLE ) - GetViewData()->GetMarkData().GetMultiMarkArea( aRange ); - GetViewData()->GetDocShell()->AdjustPrintZoom( aRange ); + if ( GetViewData().GetSimpleArea( aRange ) != SC_MARK_SIMPLE ) + GetViewData().GetMarkData().GetMultiMarkArea( aRange ); + GetViewData().GetDocShell()->AdjustPrintZoom( aRange ); } void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, @@ -898,15 +898,15 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, { // on all selected tables - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); SCTAB nTab; - bool bUndo (pDoc->IsUndoEnabled()); + bool bUndo (rDoc.IsUndoEnabled()); - ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver(); + ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver(); - ScAddress::Details aDetails(pDoc->GetAddressConvention(), 0, 0); + ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0); ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end(); for (; itr != itrEnd; ++itr) @@ -917,11 +917,11 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, // print ranges if( !bAddPrint ) - pDoc->ClearPrintRanges( nTab ); + rDoc.ClearPrintRanges( nTab ); if( bEntireSheet ) { - pDoc->SetPrintEntireSheet( nTab ); + rDoc.SetPrintEntireSheet( nTab ); } else if ( pPrint ) { @@ -932,16 +932,16 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, for (sal_uInt16 i=0; i<nTCount; i++) { OUString aToken = pPrint->getToken(i, sep); - if ( aRange.ParseAny( aToken, pDoc, aDetails ) & SCA_VALID ) - pDoc->AddPrintRange( nTab, aRange ); + if ( aRange.ParseAny( aToken, &rDoc, aDetails ) & SCA_VALID ) + rDoc.AddPrintRange( nTab, aRange ); } } } else // NULL = use selection (print range is always set), use empty string to delete all ranges { - if ( GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) + if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) { - pDoc->AddPrintRange( nTab, aRange ); + rDoc.AddPrintRange( nTab, aRange ); } else if ( rMark.IsMultiMarked() ) { @@ -951,7 +951,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, for (size_t i = 0, n = pList->size(); i < n; ++i) { ScRange* pR = (*pList)[i]; - pDoc->AddPrintRange(nTab, *pR); + rDoc.AddPrintRange(nTab, *pR); } } } @@ -961,10 +961,10 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, if ( pRepCol ) { if ( pRepCol->isEmpty() ) - pDoc->SetRepeatColRange( nTab, NULL ); + rDoc.SetRepeatColRange( nTab, NULL ); else - if ( aRange.ParseAny( *pRepCol, pDoc, aDetails ) & SCA_VALID ) - pDoc->SetRepeatColRange( nTab, &aRange ); + if ( aRange.ParseAny( *pRepCol, &rDoc, aDetails ) & SCA_VALID ) + rDoc.SetRepeatColRange( nTab, &aRange ); } // repeat rows @@ -972,18 +972,18 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, if ( pRepRow ) { if ( pRepRow->isEmpty() ) - pDoc->SetRepeatRowRange( nTab, NULL ); + rDoc.SetRepeatRowRange( nTab, NULL ); else - if ( aRange.ParseAny( *pRepRow, pDoc, aDetails ) & SCA_VALID ) - pDoc->SetRepeatRowRange( nTab, &aRange ); + if ( aRange.ParseAny( *pRepRow, &rDoc, aDetails ) & SCA_VALID ) + rDoc.SetRepeatRowRange( nTab, &aRange ); } } // undo (for all tables) if (bUndo) { - SCTAB nCurTab = GetViewData()->GetTabNo(); - ScPrintRangeSaver* pNewRanges = pDoc->CreatePrintRangeSaver(); + SCTAB nCurTab = GetViewData().GetTabNo(); + ScPrintRangeSaver* pNewRanges = rDoc.CreatePrintRangeSaver(); pDocSh->GetUndoManager()->AddUndoAction( new ScUndoPrintRange( pDocSh, nCurTab, pOldRanges, pNewRanges ) ); } @@ -996,7 +996,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, for (; itr != itrEnd; ++itr) ScPrintFunc( pDocSh, pDocSh->GetPrinter(), *itr ).UpdatePages(); - SfxBindings& rBindings = GetViewData()->GetBindings(); + SfxBindings& rBindings = GetViewData().GetBindings(); rBindings.Invalidate( SID_DELETE_PRINTAREA ); pDocSh->SetDocumentModified(); @@ -1009,11 +1009,11 @@ bool ScViewFunc::TestMergeCells() // pre-test (for menu) { // simple test: true if there's a selection but no multi selection and not filtered - const ScMarkData& rMark = GetViewData()->GetMarkData(); + const ScMarkData& rMark = GetViewData().GetMarkData(); if ( rMark.IsMarked() || rMark.IsMultiMarked() ) { ScRange aDummy; - return GetViewData()->GetSimpleArea( aDummy) == SC_MARK_SIMPLE; + return GetViewData().GetSimpleArea( aDummy) == SC_MARK_SIMPLE; } else return false; @@ -1031,7 +1031,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bRecord, bool bC return false; } - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); rMark.MarkToSimple(); if (!rMark.IsMarked()) { @@ -1039,8 +1039,8 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bRecord, bool bC return false; } - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); ScRange aMarkRange; rMark.GetMarkArea( aMarkRange ); @@ -1056,7 +1056,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bRecord, bool bC return true; } - if ( pDoc->HasAttrib( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab, + if ( rDoc.HasAttrib( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) { // "Don't nest merging !" ErrorMessage(STR_MSSG_MERGECELLS_0); @@ -1072,8 +1072,8 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bRecord, bool bC SCTAB i = *itr; aMergeOption.maTabs.insert(i); - if (!pDoc->IsBlockEmpty(i, nStartCol, nStartRow+1, nStartCol, nEndRow) || - !pDoc->IsBlockEmpty(i, nStartCol+1, nStartRow, nEndCol, nEndRow)) + if (!rDoc.IsBlockEmpty(i, nStartCol, nStartRow+1, nStartCol, nEndRow) || + !rDoc.IsBlockEmpty(i, nStartCol+1, nStartRow, nEndCol, nEndRow)) bAskDialog = true; } @@ -1083,7 +1083,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bRecord, bool bC { if (!bApi) { - MessBox aBox( GetViewData()->GetDialogParent(), + MessBox aBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO_CANCEL | WB_DEF_NO), ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), ScGlobal::GetRscString( STR_MERGE_NOTEMPTY ) ); @@ -1106,7 +1106,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bRecord, bool bC //DoneBlockMode( sal_False); Unmark(); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); UpdateInputLine(); } } @@ -1119,9 +1119,9 @@ bool ScViewFunc::TestRemoveMerge() { bool bMerged = false; ScRange aRange; - if (GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if ( pDoc->HasAttrib( aRange, HASATTR_MERGED ) ) bMerged = true; } @@ -1164,13 +1164,13 @@ bool ScViewFunc::RemoveMerge( bool bRecord ) ErrorMessage(aTester.GetMessageId()); return false; } - else if (GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE) + else if (GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScRange aExtended( aRange ); pDoc->ExtendMerge( aExtended ); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + const ScMarkData& rMark = GetViewData().GetMarkData(); ScCellMergeOption aOption(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row()); bool bExtended = false; do @@ -1198,7 +1198,7 @@ bool ScViewFunc::RemoveMerge( bool bRecord ) MarkRange( aExtended ); if (bOk) - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); } return true; //! bOk ?? } @@ -1206,14 +1206,14 @@ bool ScViewFunc::RemoveMerge( bool bRecord ) void ScViewFunc::FillSimple( FillDir eDir, bool bRecord ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + const ScMarkData& rMark = GetViewData().GetMarkData(); bool bSuccess = pDocSh->GetDocFunc().FillSimple( aRange, &rMark, eDir, bRecord, false ); if (bSuccess) { - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); UpdateScrollBars(); } } @@ -1225,16 +1225,16 @@ void ScViewFunc::FillSeries( FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, double fStart, double fStep, double fMax, bool bRecord ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + const ScMarkData& rMark = GetViewData().GetMarkData(); bool bSuccess = pDocSh->GetDocFunc(). FillSeries( aRange, &rMark, eDir, eCmd, eDateCmd, fStart, fStep, fMax, bRecord, false ); if (bSuccess) { - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); UpdateScrollBars(); HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, aRange); @@ -1247,17 +1247,17 @@ void ScViewFunc::FillSeries( FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, void ScViewFunc::FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount, bool bRecord ) { - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); ScRange aRange( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab ); ScRange aSourceRange( aRange ); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + const ScMarkData& rMark = GetViewData().GetMarkData(); bool bSuccess = pDocSh->GetDocFunc(). FillAuto( aRange, &rMark, eDir, nCount, bRecord, false ); if (bSuccess) { MarkRange( aRange, false ); // aRange was modified in FillAuto - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); UpdateScrollBars(); if (ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh)) @@ -1297,11 +1297,11 @@ void ScViewFunc::FillTab( sal_uInt16 nFlags, sal_uInt16 nFunction, bool bSkipEmp return; } - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); - SCTAB nTab = GetViewData()->GetTabNo(); - bool bUndo(pDoc->IsUndoEnabled()); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); + SCTAB nTab = GetViewData().GetTabNo(); + bool bUndo(rDoc.IsUndoEnabled()); ScRange aMarkRange; rMark.MarkToSimple(); @@ -1311,14 +1311,14 @@ void ScViewFunc::FillTab( sal_uInt16 nFlags, sal_uInt16 nFunction, bool bSkipEmp else if (rMark.IsMarked()) rMark.GetMarkArea( aMarkRange ); else - aMarkRange = ScRange( GetViewData()->GetCurX(), GetViewData()->GetCurY(), nTab ); + aMarkRange = ScRange( GetViewData().GetCurX(), GetViewData().GetCurY(), nTab ); ScDocument* pUndoDoc = NULL; if (bUndo) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end(); for (; itr != itrEnd; ++itr) @@ -1328,17 +1328,17 @@ void ScViewFunc::FillTab( sal_uInt16 nFlags, sal_uInt16 nFunction, bool bSkipEmp pUndoDoc->AddUndoTab( i, i ); aMarkRange.aStart.SetTab( i ); aMarkRange.aEnd.SetTab( i ); - pDoc->CopyToDocument( aMarkRange, IDF_ALL, bMulti, pUndoDoc ); + rDoc.CopyToDocument( aMarkRange, IDF_ALL, bMulti, pUndoDoc ); } } if (bMulti) - pDoc->FillTabMarked( nTab, rMark, nFlags, nFunction, bSkipEmpty, bAsLink ); + rDoc.FillTabMarked( nTab, rMark, nFlags, nFunction, bSkipEmpty, bAsLink ); else { aMarkRange.aStart.SetTab( nTab ); aMarkRange.aEnd.SetTab( nTab ); - pDoc->FillTab( aMarkRange, rMark, nFlags, nFunction, bSkipEmpty, bAsLink ); + rDoc.FillTab( aMarkRange, rMark, nFlags, nFunction, bSkipEmpty, bAsLink ); } if (bUndo) @@ -1370,16 +1370,16 @@ void ScViewFunc::FillTab( sal_uInt16 nFlags, sal_uInt16 nFunction, bool bSkipEmp void ScViewFunc::FillCrossDblClick() { ScRange aRange; - GetViewData()->GetSimpleArea( aRange ); + GetViewData().GetSimpleArea( aRange ); aRange.Justify(); - SCTAB nTab = GetViewData()->GetCurPos().Tab(); + SCTAB nTab = GetViewData().GetCurPos().Tab(); SCCOL nStartX = aRange.aStart.Col(); SCROW nStartY = aRange.aStart.Row(); SCCOL nEndX = aRange.aEnd.Col(); SCROW nEndY = aRange.aEnd.Row(); - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); // Make sure the selection is not empty if ( pDoc->IsBlockEmpty( nTab, nStartX, nStartY, nEndX, nEndY ) ) @@ -1429,20 +1429,20 @@ void ScViewFunc::FillCrossDblClick() void ScViewFunc::TransliterateText( sal_Int32 nType ) { - ScMarkData aFuncMark = GetViewData()->GetMarkData(); + ScMarkData aFuncMark = GetViewData().GetMarkData(); if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() ) { // no selection -> use cursor position - ScAddress aCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + ScAddress aCursor( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ); aFuncMark.SetMarkArea( ScRange( aCursor ) ); } - bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc(). + bool bSuccess = GetViewData().GetDocShell()->GetDocFunc(). TransliterateText( aFuncMark, nType, true, false ); if (bSuccess) { - GetViewData()->GetViewShell()->UpdateInputHandler(); + GetViewData().GetViewShell()->UpdateInputHandler(); } } @@ -1458,11 +1458,11 @@ ScAutoFormatData* ScViewFunc::CreateAutoFormatData() SCCOL nEndCol; SCROW nEndRow; SCTAB nEndTab; - if (GetViewData()->GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE) { if ( nEndCol-nStartCol >= 3 && nEndRow-nStartRow >= 3 ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); pData = new ScAutoFormatData; pDoc->GetAutoFormatData( nStartTab, nStartCol,nStartRow,nEndCol,nEndRow, *pData ); } @@ -1474,14 +1474,14 @@ ScAutoFormatData* ScViewFunc::CreateAutoFormatData() void ScViewFunc::AutoFormat( sal_uInt16 nFormatNo, bool bRecord ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScMarkData& rMark = GetViewData().GetMarkData(); bool bSuccess = pDocSh->GetDocFunc().AutoFormat( aRange, &rMark, nFormatNo, bRecord, false ); if (bSuccess) - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); } else ErrorMessage(STR_NOMULTISELECT); @@ -1493,23 +1493,23 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, bool bAddUndo, bool bIsApi ) { SvxSearchDialogWrapper::SetSearchLabel(SL_Empty); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); - if (bAddUndo && !pDoc->IsUndoEnabled()) + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); + if (bAddUndo && !rDoc.IsUndoEnabled()) bAddUndo = false; SCCOL nCol, nOldCol; SCROW nRow, nOldRow; SCTAB nTab, nOldTab; - nCol = nOldCol = GetViewData()->GetCurX(); - nRow = nOldRow = GetViewData()->GetCurY(); - nTab = nOldTab = GetViewData()->GetTabNo(); + nCol = nOldCol = GetViewData().GetCurX(); + nRow = nOldRow = GetViewData().GetCurY(); + nTab = nOldTab = GetViewData().GetTabNo(); sal_uInt16 nCommand = pSearchItem->GetCommand(); bool bAllTables = pSearchItem->IsAllTables(); std::set<SCTAB> aOldSelectedTables; - SCTAB nLastTab = pDoc->GetTableCount() - 1; + SCTAB nLastTab = rDoc.GetTableCount() - 1; SCTAB nStartTab, nEndTab; if ( bAllTables ) { @@ -1541,7 +1541,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, if ( nCommand == SVX_SEARCHCMD_REPLACE_ALL ) { pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); - pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab ); + pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab ); } } @@ -1566,14 +1566,14 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, { GetFrameWin()->EnterWait(); ScRangeList aMatchedRanges; - if (pDoc->SearchAndReplace(*pSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr, pUndoDoc.get())) + if (rDoc.SearchAndReplace(*pSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr, pUndoDoc.get())) { bFound = true; bFirst = true; if (bAddUndo) { - GetViewData()->GetDocShell()->GetUndoManager()->AddUndoAction( - new ScUndoReplace( GetViewData()->GetDocShell(), *pUndoMark, + GetViewData().GetDocShell()->GetUndoManager()->AddUndoAction( + new ScUndoReplace( GetViewData().GetDocShell(), *pUndoMark, nCol, nRow, nTab, aUndoStr, pUndoDoc.release(), pSearchItem ) ); } @@ -1589,7 +1589,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, { sc::SearchResultsDlg* pDlg = static_cast<sc::SearchResultsDlg*>(pWnd->GetWindow()); if (pDlg) - pDlg->FillResults(pDoc, aMatchedRanges); + pDlg->FillResults(&rDoc, aMatchedRanges); } } @@ -1666,7 +1666,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, if ( bFound ) { - if ( nTab != GetViewData()->GetTabNo() ) + if ( nTab != GetViewData().GetTabNo() ) SetTabNo( nTab ); // if nothing is marked, DoneBlockMode, then marking can start @@ -1694,7 +1694,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, ScRangeList aMatchedRanges; ScTable::UpdateSearchItemAddressForReplace( aSearchItem, nCol, nRow ); - if ( pDoc->SearchAndReplace( aSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr, NULL ) && + if ( rDoc.SearchAndReplace( aSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr, NULL ) && ( nTab == nOldTab ) && ( nCol != nOldCol || nRow != nOldRow ) ) { @@ -1717,7 +1717,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, void ScViewFunc::Solve( const ScSolveParam& rParam ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); SCCOL nDestCol = rParam.aRefVariableCell.Col(); SCROW nDestRow = rParam.aRefVariableCell.Row(); @@ -1775,7 +1775,7 @@ void ScViewFunc::Solve( const ScSolveParam& rParam ) aMsgStr += ScGlobal::GetRscString( STR_MSSG_SOLVE_4 ); } - MessBox aBox( GetViewData()->GetDialogParent(), + MessBox aBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_NO), ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), aMsgStr ); sal_uInt16 nRetVal = aBox.Execute(); @@ -1783,7 +1783,7 @@ void ScViewFunc::Solve( const ScSolveParam& rParam ) if ( RET_YES == nRetVal ) EnterValue( nDestCol, nDestRow, nDestTab, nSolveResult ); - GetViewData()->GetViewShell()->UpdateInputHandler( true ); + GetViewData().GetViewShell()->UpdateInputHandler( true ); } } @@ -1792,10 +1792,10 @@ void ScViewFunc::Solve( const ScSolveParam& rParam ) void ScViewFunc::TabOp( const ScTabOpParam& rParam, bool bRecord ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScMarkData& rMark = GetViewData().GetMarkData(); pDocSh->GetDocFunc().TabOp( aRange, &rMark, rParam, bRecord, false ); } else @@ -1806,16 +1806,16 @@ void ScViewFunc::TabOp( const ScTabOpParam& rParam, bool bRecord ) void ScViewFunc::MakeScenario( const OUString& rName, const OUString& rComment, const Color& rColor, sal_uInt16 nFlags ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScMarkData& rMark = GetViewData()->GetMarkData(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScMarkData& rMark = GetViewData().GetMarkData(); + SCTAB nTab = GetViewData().GetTabNo(); SCTAB nNewTab = pDocSh->MakeScenario( nTab, rName, rComment, rColor, nFlags, rMark ); if (nFlags & SC_SCENARIO_COPYALL) SetTabNo( nNewTab, true ); // SC_SCENARIO_COPYALL -> visible else { - SfxBindings& rBindings = GetViewData()->GetBindings(); + SfxBindings& rBindings = GetViewData().GetBindings(); rBindings.Invalidate( SID_STATUS_DOCPOS ); // Statusbar rBindings.Invalidate( SID_ROWCOL_SELCOUNT ); // Statusbar rBindings.Invalidate( SID_TABLES_COUNT ); @@ -1836,7 +1836,7 @@ void ScViewFunc::ExtendScenario() // Undo: apply attributes - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); ScPatternAttr aPattern( pDoc->GetPool() ); aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) ); aPattern.GetItemSet().Put( ScProtectionAttr( true ) ); @@ -1846,8 +1846,8 @@ void ScViewFunc::ExtendScenario() void ScViewFunc::UseScenario( const OUString& rName ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); DoneBlockMode(); InitOwnBlockMode(); @@ -1859,7 +1859,7 @@ void ScViewFunc::UseScenario( const OUString& rName ) bool ScViewFunc::InsertTable( const OUString& rName, SCTAB nTab, bool bRecord ) { // Order Tabl/Name is inverted for DocFunc - bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc(). + bool bSuccess = GetViewData().GetDocShell()->GetDocFunc(). InsertTable( nTab, rName, bRecord, false ); if (bSuccess) SetTabNo( nTab, true ); @@ -1873,25 +1873,25 @@ bool ScViewFunc::InsertTable( const OUString& rName, SCTAB nTab, bool bRecord ) bool ScViewFunc::InsertTables(std::vector<OUString>& aNames, SCTAB nTab, SCTAB nCount, bool bRecord ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - if (bRecord && !pDoc->IsUndoEnabled()) + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; WaitObject aWait( GetFrameWin() ); if (bRecord) { - pDoc->BeginDrawUndo(); // InsertTab creates a SdrUndoNewPage + rDoc.BeginDrawUndo(); // InsertTab creates a SdrUndoNewPage } bool bFlag=false; if(aNames.empty()) { - pDoc->CreateValidTabNames(aNames, nCount); + rDoc.CreateValidTabNames(aNames, nCount); } - if (pDoc->InsertTabs(nTab, aNames, false)) + if (rDoc.InsertTabs(nTab, aNames, false)) { pDocSh->Broadcast( ScTablesHint( SC_TABS_INSERTED, nTab, nCount ) ); bFlag = true; @@ -1920,23 +1920,23 @@ bool ScViewFunc::InsertTables(std::vector<OUString>& aNames, SCTAB nTab, bool ScViewFunc::AppendTable( const OUString& rName, bool bRecord ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - if (bRecord && !pDoc->IsUndoEnabled()) + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; WaitObject aWait( GetFrameWin() ); if (bRecord) - pDoc->BeginDrawUndo(); // InsertTab creates a SdrUndoNewPage + rDoc.BeginDrawUndo(); // InsertTab creates a SdrUndoNewPage - if (pDoc->InsertTab( SC_TAB_APPEND, rName )) + if (rDoc.InsertTab( SC_TAB_APPEND, rName )) { - SCTAB nTab = pDoc->GetTableCount()-1; + SCTAB nTab = rDoc.GetTableCount()-1; if (bRecord) pDocSh->GetUndoManager()->AddUndoAction( new ScUndoInsertTab( pDocSh, nTab, true, rName)); - GetViewData()->InsertTab( nTab ); + GetViewData().InsertTab( nTab ); SetTabNo( nTab, true ); pDocSh->PostPaintExtras(); pDocSh->SetDocumentModified(); @@ -1952,14 +1952,14 @@ bool ScViewFunc::AppendTable( const OUString& rName, bool bRecord ) bool ScViewFunc::DeleteTable( SCTAB nTab, bool bRecord ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); bool bSuccess = pDocSh->GetDocFunc().DeleteTable( nTab, bRecord, false ); if (bSuccess) { SCTAB nNewTab = nTab; - if ( nNewTab >= pDoc->GetTableCount() ) + if ( nNewTab >= rDoc.GetTableCount() ) --nNewTab; SetTabNo( nNewTab, true ); } @@ -1970,31 +1970,31 @@ bool ScViewFunc::DeleteTable( SCTAB nTab, bool bRecord ) //this method doesn't support undo for now, merge it when it with the other method later bool ScViewFunc::DeleteTables( const SCTAB nTab, SCTAB nSheets ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - bool bVbaEnabled = pDoc->IsInVBAMode(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + bool bVbaEnabled = rDoc.IsInVBAMode(); SCTAB nNewTab = nTab; WaitObject aWait( GetFrameWin() ); - while ( nNewTab > 0 && !pDoc->IsVisible( nNewTab ) ) + while ( nNewTab > 0 && !rDoc.IsVisible( nNewTab ) ) --nNewTab; - if (pDoc->DeleteTabs(nTab, nSheets)) + if (rDoc.DeleteTabs(nTab, nSheets)) { if( bVbaEnabled ) { for (SCTAB aTab = 0; aTab < nSheets; ++aTab) { OUString sCodeName; - bool bHasCodeName = pDoc->GetCodeName( nTab + aTab, sCodeName ); + bool bHasCodeName = rDoc.GetCodeName( nTab + aTab, sCodeName ); if ( bHasCodeName ) VBA_DeleteModule( *pDocSh, sCodeName ); } } pDocSh->Broadcast( ScTablesHint( SC_TABS_DELETED, nTab, nSheets ) ); - if ( nNewTab >= pDoc->GetTableCount() ) - nNewTab = pDoc->GetTableCount() - 1; + if ( nNewTab >= rDoc.GetTableCount() ) + nNewTab = rDoc.GetTableCount() - 1; SetTabNo( nNewTab, true ); pDocSh->PostPaintExtras(); @@ -2011,17 +2011,17 @@ bool ScViewFunc::DeleteTables( const SCTAB nTab, SCTAB nSheets ) bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - bool bVbaEnabled = pDoc->IsInVBAMode(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + bool bVbaEnabled = rDoc.IsInVBAMode(); SCTAB nNewTab = TheTabs.front(); WaitObject aWait( GetFrameWin() ); - if (bRecord && !pDoc->IsUndoEnabled()) + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; if ( bVbaEnabled ) bRecord = false; - while ( nNewTab > 0 && !pDoc->IsVisible( nNewTab ) ) + while ( nNewTab > 0 && !rDoc.IsVisible( nNewTab ) ) --nNewTab; bool bWasLinked = false; @@ -2030,46 +2030,46 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord ) if (bRecord) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - SCTAB nCount = pDoc->GetTableCount(); + SCTAB nCount = rDoc.GetTableCount(); OUString aOldName; for(unsigned int i=0; i<TheTabs.size(); ++i) { SCTAB nTab = TheTabs[i]; if (i==0) - pUndoDoc->InitUndo( pDoc, nTab,nTab, true,true ); // incl. column/fow flags + pUndoDoc->InitUndo( &rDoc, nTab,nTab, true,true ); // incl. column/fow flags else pUndoDoc->AddUndoTab( nTab,nTab, true,true ); // incl. column/fow flags - pDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, pUndoDoc ); - pDoc->GetName( nTab, aOldName ); + rDoc.CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, pUndoDoc ); + rDoc.GetName( nTab, aOldName ); pUndoDoc->RenameTab( nTab, aOldName, false ); - if (pDoc->IsLinked(nTab)) + if (rDoc.IsLinked(nTab)) { bWasLinked = true; - pUndoDoc->SetLink( nTab, pDoc->GetLinkMode(nTab), pDoc->GetLinkDoc(nTab), - pDoc->GetLinkFlt(nTab), pDoc->GetLinkOpt(nTab), - pDoc->GetLinkTab(nTab), - pDoc->GetLinkRefreshDelay(nTab) ); + pUndoDoc->SetLink( nTab, rDoc.GetLinkMode(nTab), rDoc.GetLinkDoc(nTab), + rDoc.GetLinkFlt(nTab), rDoc.GetLinkOpt(nTab), + rDoc.GetLinkTab(nTab), + rDoc.GetLinkRefreshDelay(nTab) ); } - if ( pDoc->IsScenario(nTab) ) + if ( rDoc.IsScenario(nTab) ) { pUndoDoc->SetScenario( nTab, true ); OUString aComment; Color aColor; sal_uInt16 nScenFlags; - pDoc->GetScenarioData( nTab, aComment, aColor, nScenFlags ); + rDoc.GetScenarioData( nTab, aComment, aColor, nScenFlags ); pUndoDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags ); - bool bActive = pDoc->IsActiveScenario( nTab ); + bool bActive = rDoc.IsActiveScenario( nTab ); pUndoDoc->SetActiveScenario( nTab, bActive ); } - pUndoDoc->SetVisible( nTab, pDoc->IsVisible( nTab ) ); - pUndoDoc->SetTabBgColor( nTab, pDoc->GetTabBgColor(nTab) ); - pUndoDoc->SetSheetEvents( nTab, pDoc->GetSheetEvents( nTab ) ); - pUndoDoc->SetLayoutRTL( nTab, pDoc->IsLayoutRTL( nTab ) ); + pUndoDoc->SetVisible( nTab, rDoc.IsVisible( nTab ) ); + pUndoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) ); + pUndoDoc->SetSheetEvents( nTab, rDoc.GetSheetEvents( nTab ) ); + pUndoDoc->SetLayoutRTL( nTab, rDoc.IsLayoutRTL( nTab ) ); - if ( pDoc->IsTabProtected( nTab ) ) - pUndoDoc->SetTabProtection(nTab, pDoc->GetTabProtection(nTab)); + if ( rDoc.IsTabProtected( nTab ) ) + pUndoDoc->SetTabProtection(nTab, rDoc.GetTabProtection(nTab)); // Drawing-Layer is responsible for its Undo !!! // pUndoDoc->TransferDrawPage(pDoc, nTab,nTab); @@ -2077,9 +2077,9 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord ) pUndoDoc->AddUndoTab( 0, nCount-1 ); // all Tabs for references - pDoc->BeginDrawUndo(); // DeleteTab creates a SdrUndoDelPage + rDoc.BeginDrawUndo(); // DeleteTab creates a SdrUndoDelPage - pUndoData = new ScRefUndoData( pDoc ); + pUndoData = new ScRefUndoData( &rDoc ); } bool bDelDone = false; @@ -2087,8 +2087,8 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord ) for(int i=TheTabs.size()-1; i>=0; --i) { OUString sCodeName; - bool bHasCodeName = pDoc->GetCodeName( TheTabs[i], sCodeName ); - if (pDoc->DeleteTab(TheTabs[i])) + bool bHasCodeName = rDoc.GetCodeName( TheTabs[i], sCodeName ); + if (rDoc.DeleteTab(TheTabs[i])) { bDelDone = true; if( bVbaEnabled ) @@ -2104,22 +2104,22 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord ) if (bRecord) { pDocSh->GetUndoManager()->AddUndoAction( - new ScUndoDeleteTab( GetViewData()->GetDocShell(), TheTabs, + new ScUndoDeleteTab( GetViewData().GetDocShell(), TheTabs, pUndoDoc, pUndoData )); } if (bDelDone) { - if ( nNewTab >= pDoc->GetTableCount() ) - nNewTab = pDoc->GetTableCount() - 1; + if ( nNewTab >= rDoc.GetTableCount() ) + nNewTab = rDoc.GetTableCount() - 1; SetTabNo( nNewTab, true ); if (bWasLinked) { pDocSh->UpdateLinks(); // update Link-Manager - GetViewData()->GetBindings().Invalidate(SID_LINKS); + GetViewData().GetBindings().Invalidate(SID_LINKS); } pDocSh->PostPaintExtras(); @@ -2143,12 +2143,12 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord ) bool ScViewFunc::RenameTable( const OUString& rName, SCTAB nTab ) { // order Table/Name is inverted for DocFunc - bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc(). + bool bSuccess = GetViewData().GetDocShell()->GetDocFunc(). RenameTable( nTab, rName, true, false ); if (bSuccess) { // the table name might be part of a formula - GetViewData()->GetViewShell()->UpdateInputHandler(); + GetViewData().GetViewShell()->UpdateInputHandler(); } return bSuccess; } @@ -2156,20 +2156,20 @@ bool ScViewFunc::RenameTable( const OUString& rName, SCTAB nTab ) bool ScViewFunc::SetTabBgColor( const Color& rColor, SCTAB nTab ) { - bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc().SetTabBgColor( nTab, rColor, true, false ); + bool bSuccess = GetViewData().GetDocShell()->GetDocFunc().SetTabBgColor( nTab, rColor, true, false ); if (bSuccess) { - GetViewData()->GetViewShell()->UpdateInputHandler(); + GetViewData().GetViewShell()->UpdateInputHandler(); } return bSuccess; } bool ScViewFunc::SetTabBgColor( ScUndoTabColorInfo::List& rUndoSetTabBgColorInfoList ) { - bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc().SetTabBgColor( rUndoSetTabBgColorInfoList, true, false ); + bool bSuccess = GetViewData().GetDocShell()->GetDocFunc().SetTabBgColor( rUndoSetTabBgColorInfoList, true, false ); if (bSuccess) { - GetViewData()->GetViewShell()->UpdateInputHandler(); + GetViewData().GetViewShell()->UpdateInputHandler(); } return bSuccess; } @@ -2178,10 +2178,10 @@ void ScViewFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter, const OUString& rOptions, const OUString& rSource, sal_uLong nRefresh ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - SCCOL nPosX = GetViewData()->GetCurX(); - SCROW nPosY = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + SCCOL nPosX = GetViewData().GetCurX(); + SCROW nPosY = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); ScAddress aPos( nPosX, nPosY, nTab ); pDocSh->GetDocFunc().InsertAreaLink( rFile, rFilter, rOptions, rSource, aPos, nRefresh, false, false ); @@ -2199,17 +2199,17 @@ void ScViewFunc::InsertTableLink( const OUString& rFile, if (!aLoader.IsError()) { ScDocShell* pSrcSh = aLoader.GetDocShell(); - ScDocument* pSrcDoc = pSrcSh->GetDocument(); + ScDocument& rSrcDoc = pSrcSh->GetDocument(); SCTAB nTab = MAXTAB+1; if (rTabName.isEmpty()) // no name given -> first table nTab = 0; else { OUString aTemp; - SCTAB nCount = pSrcDoc->GetTableCount(); + SCTAB nCount = rSrcDoc.GetTableCount(); for (SCTAB i=0; i<nCount; i++) { - pSrcDoc->GetName( i, aTemp ); + rSrcDoc.GetName( i, aTemp ); if ( aTemp.equals(rTabName) ) nTab = i; } @@ -2217,7 +2217,7 @@ void ScViewFunc::InsertTableLink( const OUString& rFile, if ( nTab <= MAXTAB ) ImportTables( pSrcSh, 1, &nTab, true, - GetViewData()->GetTabNo() ); + GetViewData().GetTabNo() ); } } @@ -2226,30 +2226,30 @@ void ScViewFunc::InsertTableLink( const OUString& rFile, void ScViewFunc::ImportTables( ScDocShell* pSrcShell, SCTAB nCount, const SCTAB* pSrcTabs, bool bLink,SCTAB nTab ) { - ScDocument* pSrcDoc = pSrcShell->GetDocument(); + ScDocument& rSrcDoc = pSrcShell->GetDocument(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - bool bUndo(pDoc->IsUndoEnabled()); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + bool bUndo(rDoc.IsUndoEnabled()); bool bError = false; bool bRefs = false; bool bName = false; - if (pSrcDoc->GetDrawLayer()) + if (rSrcDoc.GetDrawLayer()) pDocSh->MakeDrawLayer(); if (bUndo) - pDoc->BeginDrawUndo(); // drawing layer must do its own undo actions + rDoc.BeginDrawUndo(); // drawing layer must do its own undo actions SCTAB nInsCount = 0; SCTAB i; for( i=0; i<nCount; i++ ) { // insert sheets first and update all references OUString aName; - pSrcDoc->GetName( pSrcTabs[i], aName ); - pDoc->CreateValidTabName( aName ); - if ( !pDoc->InsertTab( nTab+i, aName ) ) + rSrcDoc.GetName( pSrcTabs[i], aName ); + rDoc.CreateValidTabName( aName ); + if ( !rDoc.InsertTab( nTab+i, aName ) ) { bError = true; // total error break; // for @@ -2283,7 +2283,7 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, if (bLink) { - sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager(); + sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager(); SfxMedium* pMed = pSrcShell->GetMedium(); OUString aFileName = pMed->GetName(); @@ -2292,14 +2292,14 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, aFilterName = pMed->GetFilter()->GetFilterName(); OUString aOptions = ScDocumentLoader::GetOptions(*pMed); - bool bWasThere = pDoc->HasLink( aFileName, aFilterName, aOptions ); + bool bWasThere = rDoc.HasLink( aFileName, aFilterName, aOptions ); sal_uLong nRefresh = 0; OUString aTabStr; for (i=0; i<nInsCount; i++) { - pSrcDoc->GetName( pSrcTabs[i], aTabStr ); - pDoc->SetLink( nTab+i, SC_LINK_NORMAL, + rSrcDoc.GetName( pSrcTabs[i], aTabStr ); + rDoc.SetLink( nTab+i, SC_LINK_NORMAL, aFileName, aFilterName, aOptions, aTabStr, nRefresh ); } @@ -2311,7 +2311,7 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, pLink->Update(); pLink->SetInCreate( false ); - SfxBindings& rBindings = GetViewData()->GetBindings(); + SfxBindings& rBindings = GetViewData().GetBindings(); rBindings.Invalidate( SID_LINKS ); } } @@ -2324,7 +2324,7 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, } for (i=0; i<nInsCount; i++) - GetViewData()->InsertTab(nTab); + GetViewData().InsertTab(nTab); SetTabNo(nTab,true); pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS ); @@ -2348,8 +2348,8 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, void ScViewFunc::MoveTable( sal_uInt16 nDestDocNo, SCTAB nDestTab, bool bCopy, const OUString* pNewTabName ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScDocShell* pDocShell = GetViewData().GetDocShell(); ScDocument* pDestDoc = NULL; ScDocShell* pDestShell = NULL; ScTabViewShell* pDestViewSh = NULL; @@ -2367,7 +2367,7 @@ void ScViewFunc::MoveTable( SfxStringItem aItem( SID_FILE_NAME, aUrl ); SfxStringItem aTarget( SID_TARGETNAME, OUString("_blank") ); - const SfxPoolItem* pRetItem = GetViewData()->GetDispatcher().Execute( + const SfxPoolItem* pRetItem = GetViewData().GetDispatcher().Execute( SID_OPENDOC, SFX_CALLMODE_API|SFX_CALLMODE_SYNCHRON, &aItem, &aTarget, 0L ); if ( pRetItem ) { @@ -2392,7 +2392,7 @@ void ScViewFunc::MoveTable( return; } - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); if (bRename && rMark.GetSelectCount() != 1) { // Custom sheet name is provided, but more than one sheet is selected. @@ -2400,9 +2400,9 @@ void ScViewFunc::MoveTable( return; } - pDestDoc = pDestShell->GetDocument(); + pDestDoc = &pDestShell->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); if (pDestDoc != pDoc) { @@ -2428,7 +2428,7 @@ void ScViewFunc::MoveTable( TheTabs.push_back(i); for(SCTAB j=i+1;j<nTabCount;j++) { - if((!pDoc->IsVisible(j))&&(pDoc->IsScenario(j))) + if((!pDoc->IsVisible(j)) && pDoc->IsScenario(j)) { pDoc->GetName( j, aTabName); TheTabs.push_back(j); @@ -2587,7 +2587,7 @@ void ScViewFunc::MoveTable( for(SCTAB j=i+1;j<nTabCount;j++) { - if((!pDoc->IsVisible(j))&&(pDoc->IsScenario(j))) + if((!pDoc->IsVisible(j)) && pDoc->IsScenario(j)) { pDoc->GetName( j, aTabName); pTabNames->push_back(aTabName); @@ -2665,7 +2665,7 @@ void ScViewFunc::MoveTable( // No need to keep this around when we are not renaming. pTabNames.reset(); - nTab = GetViewData()->GetTabNo(); + nTab = GetViewData().GetTabNo(); if (bUndo) { @@ -2700,9 +2700,9 @@ void ScViewFunc::MoveTable( void ScViewFunc::ShowTable( const std::vector<OUString>& rNames ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - bool bUndo(pDoc->IsUndoEnabled()); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + bool bUndo(rDoc.IsUndoEnabled()); std::vector<SCTAB> undoTabs; OUString aName; @@ -2713,9 +2713,9 @@ void ScViewFunc::ShowTable( const std::vector<OUString>& rNames ) for (std::vector<OUString>::const_iterator itr=rNames.begin(), itrEnd = rNames.end(); itr!=itrEnd; ++itr) { aName = *itr; - if (pDoc->GetTable(aName, nPos)) + if (rDoc.GetTable(aName, nPos)) { - pDoc->SetVisible( nPos, true ); + rDoc.SetVisible( nPos, true ); SetTabNo( nPos, true ); SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); if (!bFound) @@ -2738,17 +2738,17 @@ void ScViewFunc::ShowTable( const std::vector<OUString>& rNames ) void ScViewFunc::HideTable( const ScMarkData& rMark ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - bool bUndo(pDoc->IsUndoEnabled()); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + bool bUndo(rDoc.IsUndoEnabled()); SCTAB nVisible = 0; - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); SCTAB nTabSelCount = rMark.GetSelectCount(); // check to make sure we won't hide all sheets. we need at least one visible at all times. for ( SCTAB i=0; i < nTabCount && nVisible <= nTabSelCount ; i++ ) - if (pDoc->IsVisible(i)) + if (rDoc.IsVisible(i)) ++nVisible; if (nVisible > nTabSelCount) @@ -2761,9 +2761,9 @@ void ScViewFunc::HideTable( const ScMarkData& rMark ) for (it=selectedTabs.begin(); it!=selectedTabs.end(); ++it) { nTab = *it; - if (pDoc->IsVisible( nTab )) + if (rDoc.IsVisible( nTab )) { - pDoc->SetVisible( nTab, false ); + rDoc.SetVisible( nTab, false ); // Update views pDocSh->Broadcast( ScTablesHint( SC_TAB_HIDDEN, nTab ) ); SetTabNo( nTab, true ); @@ -2795,7 +2795,7 @@ void ScViewFunc::InsertSpecialChar( const OUString& rStr, const Font& rFont ) } const sal_Unicode* pChar = rStr.getStr(); - ScTabViewShell* pViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pViewShell = GetViewData().GetViewShell(); SvxFontItem aFontItem( rFont.GetFamily(), rFont.GetName(), rFont.GetStyleName(), @@ -2805,7 +2805,7 @@ void ScViewFunc::InsertSpecialChar( const OUString& rStr, const Font& rFont ) // if string contains WEAK characters, set all fonts sal_uInt8 nScript; - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); if ( pDoc->HasStringWeakCharacters( rStr ) ) nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX; else @@ -2868,10 +2868,10 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, return; } - ScDocument* pDoc = GetViewData()->GetDocument(); - ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered + ScDocument* pDoc = GetViewData().GetDocument(); + ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered ScViewUtil::UnmarkFiltered( aFuncMark, pDoc ); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); const ScPatternAttr* pSelAttrs = GetSelectionPattern(); const SfxItemSet& rSelItemSet = pSelAttrs->GetItemSet(); @@ -2962,7 +2962,7 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, nEndCol, nEndRow, nEndTab, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE ); - pDocSh->UpdateOle( GetViewData() ); + pDocSh->UpdateOle( &GetViewData() ); pDocSh->SetDocumentModified(); } } @@ -2971,7 +2971,7 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, void ScViewFunc::SetValidation( const ScValidationData& rNew ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); sal_uLong nIndex = pDoc->AddValidationEntry(rNew); // for it there is no Undo SfxUInt32Item aItem( ATTR_VALIDDATA, nIndex ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index be5d96c68218..627e870e519e 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -90,11 +90,11 @@ void ScViewFunc::CutToClip( ScDocument* pClipDoc, bool bIncludeObjects ) } ScRange aRange; // zu loeschender Bereich - if ( GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) + if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScMarkData& rMark = GetViewData().GetMarkData(); const bool bRecord(pDoc->IsUndoEnabled()); // Undo/Redo ScDocShellModificator aModificator( *pDocSh ); @@ -142,7 +142,7 @@ void ScViewFunc::CutToClip( ScDocument* pClipDoc, bool bIncludeObjects ) new ScUndoCut( pDocSh, aRange, aOldEnd, rMark, pUndoDoc ) ); aModificator.SetDocumentModified(); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); CellContentChanged(); } @@ -155,8 +155,8 @@ void ScViewFunc::CutToClip( ScDocument* pClipDoc, bool bIncludeObjects ) bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, bool bCut, bool bApi, bool bIncludeObjects, bool bStopEdit ) { ScRange aRange; - ScMarkType eMarkType = GetViewData()->GetSimpleArea( aRange ); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkType eMarkType = GetViewData().GetSimpleArea( aRange ); + ScMarkData& rMark = GetViewData().GetMarkData(); bool bDone = false; if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED ) @@ -194,8 +194,8 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b ScClipParam aClipParam( aRange, bCut ); aClipParam.maRanges = rRanges; - ScDocument* pDoc = GetViewData()->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); if ( !aClipParam.isMultiRange() ) { @@ -257,7 +257,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b if ( bSysClip ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); TransferableObjectDescriptor aObjDesc; pDocSh->FillTransferableObjectDescriptor( aObjDesc ); aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass(); @@ -367,7 +367,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b pChangeTrack->ResetLastCut(); // kein CutMode mehr { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); TransferableObjectDescriptor aObjDesc; pDocSh->FillTransferableObjectDescriptor( aObjDesc ); aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass(); @@ -402,10 +402,10 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b ScTransferObj* ScViewFunc::CopyToTransferable() { ScRange aRange; - if ( GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) + if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); if ( !pDoc->HasSelectedBlockMatrixFragment( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), @@ -422,7 +422,7 @@ ScTransferObj* ScViewFunc::CopyToTransferable() ScDrawLayer::SetGlobalDrawPersist(NULL); pClipDoc->ExtendMerge( aRange, true ); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); TransferableObjectDescriptor aObjDesc; pDocSh->FillTransferableObjectDescriptor( aObjDesc ); aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass(); @@ -439,17 +439,17 @@ ScTransferObj* ScViewFunc::CopyToTransferable() void ScViewFunc::PasteDraw() { - ScViewData* pViewData = GetViewData(); - SCCOL nPosX = pViewData->GetCurX(); - SCROW nPosY = pViewData->GetCurY(); + ScViewData& rViewData = GetViewData(); + SCCOL nPosX = rViewData.GetCurX(); + SCROW nPosY = rViewData.GetCurY(); Window* pWin = GetActiveWin(); - Point aPos = pWin->PixelToLogic( pViewData->GetScrPos( nPosX, nPosY, - pViewData->GetActivePart() ) ); + Point aPos = pWin->PixelToLogic( rViewData.GetScrPos( nPosX, nPosY, + rViewData.GetActivePart() ) ); ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard( pWin ); if (pDrawClip) { OUString aSrcShellID = pDrawClip->GetShellID(); - OUString aDestShellID = SfxObjectShell::CreateShellID(pViewData->GetDocShell()); + OUString aDestShellID = SfxObjectShell::CreateShellID(rViewData.GetDocShell()); PasteDraw(aPos, pDrawClip->GetModel(), false, aSrcShellID, aDestShellID); } } @@ -582,14 +582,14 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran } else if (pDrawClip) { - ScViewData* pViewData = GetViewData(); - SCCOL nPosX = pViewData->GetCurX(); - SCROW nPosY = pViewData->GetCurY(); + ScViewData& rViewData = GetViewData(); + SCCOL nPosX = rViewData.GetCurX(); + SCROW nPosY = rViewData.GetCurY(); Window* pWin = GetActiveWin(); - Point aPos = pWin->PixelToLogic( pViewData->GetScrPos( nPosX, nPosY, pViewData->GetActivePart() ) ); + Point aPos = pWin->PixelToLogic( rViewData.GetScrPos( nPosX, nPosY, rViewData.GetActivePart() ) ); PasteDraw( aPos, pDrawClip->GetModel(), false, - pDrawClip->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell())); + pDrawClip->GetShellID(), SfxObjectShell::CreateShellID(rViewData.GetDocShell())); } else { @@ -654,7 +654,7 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran return; PasteDataFormat( nFormatId, aDataHelper.GetTransferable(), - GetViewData()->GetCurX(), GetViewData()->GetCurY(), + GetViewData().GetCurX(), GetViewData().GetCurY(), NULL, false, false ); } } @@ -682,7 +682,7 @@ bool ScViewFunc::PasteFromSystem( sal_uLong nFormatId, bool bApi ) return false; bRet = PasteDataFormat( nFormatId, aDataHelper.GetTransferable(), - GetViewData()->GetCurX(), GetViewData()->GetCurY(), + GetViewData().GetCurX(), GetViewData().GetCurY(), NULL, false, !bApi ); // allow warning dialog if ( !bRet && !bApi ) @@ -837,7 +837,7 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, eMoveMode, nUndoFlags); } - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); if (rMark.IsMultiMarked()) { // Source data is single-range but destination is multi-range. @@ -900,8 +900,8 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, SCROW nDestSizeY; pClipDoc->GetClipArea( nDestSizeX, nDestSizeY, bIncludeFiltered ); - ScDocument* pDoc = GetViewData()->GetDocument(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ::svl::IUndoManager* pUndoMgr = pDocSh->GetUndoManager(); const bool bRecord(pDoc->IsUndoEnabled()); @@ -909,7 +909,7 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, ScRange aMarkRange; ScMarkData aFilteredMark( rMark); // local copy for all modifications - ScMarkType eMarkType = GetViewData()->GetSimpleArea( aMarkRange, aFilteredMark); + ScMarkType eMarkType = GetViewData().GetSimpleArea( aMarkRange, aFilteredMark); bool bMarkIsFiltered = (eMarkType == SC_MARK_SIMPLE_FILTERED); bool bNoPaste = ((eMarkType != SC_MARK_SIMPLE && !bMarkIsFiltered) || (bMarkIsFiltered && (eMoveMode != INS_NONE || bAsLink))); @@ -920,9 +920,9 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, { // Create a selection with clipboard row count and check that for // filtered. - nStartCol = GetViewData()->GetCurX(); - nStartRow = GetViewData()->GetCurY(); - nStartTab = GetViewData()->GetTabNo(); + nStartCol = GetViewData().GetCurX(); + nStartRow = GetViewData().GetCurY(); + nStartTab = GetViewData().GetTabNo(); nEndCol = nStartCol + nDestSizeX; nEndRow = nStartRow + nDestSizeY; nEndTab = nStartTab; @@ -1002,7 +1002,7 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, { ScWaitCursorOff aWaitOff( GetFrameWin() ); OUString aMessage = ScGlobal::GetRscString( STR_PASTE_BIGGER ); - QueryBox aBox( GetViewData()->GetDialogParent(), + QueryBox aBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_NO), aMessage ); if ( aBox.Execute() != RET_YES ) { @@ -1045,9 +1045,9 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, } else { - nStartCol = GetViewData()->GetCurX(); - nStartRow = GetViewData()->GetCurY(); - nStartTab = GetViewData()->GetTabNo(); + nStartCol = GetViewData().GetCurX(); + nStartRow = GetViewData().GetCurY(); + nStartTab = GetViewData().GetTabNo(); nEndCol = nStartCol + nDestSizeX; nEndRow = nStartRow + nDestSizeY; nEndTab = nStartTab; @@ -1089,7 +1089,7 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, { ScRangeList aTestRanges; aTestRanges.Append(aUserRange); - if (!checkDestRangeForOverwrite(aTestRanges, pDoc, aFilteredMark, GetViewData()->GetDialogParent())) + if (!checkDestRangeForOverwrite(aTestRanges, pDoc, aFilteredMark, GetViewData().GetDialogParent())) return false; } } @@ -1200,7 +1200,7 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, pDocSh->UpdatePaintExt( nExtFlags, nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ); // content before the change - if (GetViewData()->IsActive()) + if (GetViewData().IsActive()) { DoneBlockMode(); InitOwnBlockMode(); @@ -1402,7 +1402,7 @@ bool ScViewFunc::PasteMultiRangesFromClip( bool bSkipEmpty, bool bTranspose, bool bAsLink, bool bAllowDialogs, InsCellCmd eMoveMode, sal_uInt16 nUndoFlags) { - ScViewData& rViewData = *GetViewData(); + ScViewData& rViewData = GetViewData(); ScDocument* pDoc = rViewData.GetDocument(); ScDocShell* pDocSh = rViewData.GetDocShell(); ScMarkData aMark(rViewData.GetMarkData()); @@ -1580,7 +1580,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges( return false; } - ScViewData& rViewData = *GetViewData(); + ScViewData& rViewData = GetViewData(); ScClipParam& rClipParam = pClipDoc->GetClipParam(); if (rClipParam.mbCutMode) { @@ -1722,9 +1722,9 @@ bool ScViewFunc::PasteFromClipToMultiRanges( void ScViewFunc::PostPasteFromClip(const ScRangeList& rPasteRanges, const ScMarkData& rMark) { - ScViewData* pViewData = GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - pDocSh->UpdateOle(pViewData); + ScViewData& rViewData = GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + pDocSh->UpdateOle(&rViewData); SelectionChanged(); @@ -1755,12 +1755,12 @@ void ScViewFunc::PostPasteFromClip(const ScRangeList& rPasteRanges, const ScMark bool ScViewFunc::MoveBlockTo( const ScRange& rSource, const ScAddress& rDestPos, bool bCut, bool bRecord, bool bPaint, bool bApi ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); HideAllCursors(); // wegen zusammengefassten bool bSuccess = true; SCTAB nDestTab = rDestPos.Tab(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + const ScMarkData& rMark = GetViewData().GetMarkData(); if ( rSource.aStart.Tab() == nDestTab && rSource.aEnd.Tab() == nDestTab && rMark.GetSelectCount() > 1 ) { // moving within one table and several tables selected -> apply to all selected tables @@ -1775,7 +1775,7 @@ bool ScViewFunc::MoveBlockTo( const ScRange& rSource, const ScAddress& rDestPos, ScRange aLocalSource = rSource; ScAddress aLocalDest = rDestPos; - SCTAB nTabCount = pDocSh->GetDocument()->GetTableCount(); + SCTAB nTabCount = pDocSh->GetDocument().GetTableCount(); SCTAB nStartTab = 0; while ( nStartTab < nTabCount && bSuccess ) { @@ -1821,7 +1821,7 @@ bool ScViewFunc::MoveBlockTo( const ScRange& rSource, const ScAddress& rDestPos, if ( !bIncludeFiltered ) { // find number of non-filtered rows - SCROW nPastedCount = pDocSh->GetDocument()->CountNonFilteredRows( + SCROW nPastedCount = pDocSh->GetDocument().CountNonFilteredRows( rSource.aStart.Row(), rSource.aEnd.Row(), rSource.aStart.Tab()); if ( nPastedCount == 0 ) @@ -1831,7 +1831,7 @@ bool ScViewFunc::MoveBlockTo( const ScRange& rSource, const ScAddress& rDestPos, MarkRange( ScRange( rDestPos, aDestEnd ), false ); //! sal_False ??? - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); SelectionChanged(); ResetAutoSpell(); } @@ -1860,7 +1860,7 @@ bool ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, b // Ausfuehren per Paste - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); boost::scoped_ptr<ScDocument> pClipDoc(new ScDocument( SCDOCMODE_CLIP )); pDoc->CopyTabToClip( rSource.aStart.Col(), rSource.aStart.Row(), rSource.aEnd.Col(), rSource.aEnd.Row(), @@ -1868,7 +1868,7 @@ bool ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, b // Zielbereich markieren (Cursor setzen, keine Markierung) - if ( GetViewData()->GetTabNo() != rDestPos.Tab() ) + if ( GetViewData().GetTabNo() != rDestPos.Tab() ) SetTabNo( rDestPos.Tab() ); MoveCursorAbs( rDestPos.Col(), rDestPos.Row(), SC_FOLLOW_NONE, false, false ); @@ -1886,9 +1886,9 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow , boost::ptr_vector<boost::nullable<Edit> >& aEdits, sal_uInt16 aColLength ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScMarkData& rMark = GetViewData().GetMarkData(); ScDocShellModificator aModificator( *pDocSh ); ::svl::IUndoManager* pUndoMgr = pDocSh->GetUndoManager(); if ( pDoc ) @@ -1897,7 +1897,7 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow , ScDocument* pUndoDoc = NULL; ScDocument* pRedoDoc = NULL; ScRefUndoData* pUndoData = NULL; - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); SCTAB nStartTab = nTab; SCTAB nEndTab = nTab; @@ -1955,7 +1955,7 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow , pDocSh->PostPaint( ScRange(nStartCol, nCurrentRow, nStartTab, nUndoEndCol, nUndoEndRow, nEndTab), nPaint, nExtFlags); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); } } diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 73432c6c9f3b..9298b6913a71 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -87,13 +87,13 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, HideAllCursors(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); - const bool bRecord (pDoc->IsUndoEnabled()); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); + const bool bRecord (rDoc.IsUndoEnabled()); - const ScPatternAttr* pPattern = pDoc->GetPattern( nStartCol, nStartRow, nTab ); - boost::scoped_ptr<ScTabEditEngine> pEngine(new ScTabEditEngine( *pPattern, pDoc->GetEnginePool() )); + const ScPatternAttr* pPattern = rDoc.GetPattern( nStartCol, nStartRow, nTab ); + boost::scoped_ptr<ScTabEditEngine> pEngine(new ScTabEditEngine( *pPattern, rDoc.GetEnginePool() )); pEngine->EnableUndo( false ); Window* pActWin = GetActiveWin(); @@ -120,15 +120,15 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, if (bRecord) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab ); - pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL, false, pUndoDoc ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); + rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL, false, pUndoDoc ); } SCROW nRow = nStartRow; // Temporarily turn off undo generation for this lot - bool bUndoEnabled = pDoc->IsUndoEnabled(); - pDoc->EnableUndo( false ); + bool bUndoEnabled = rDoc.IsUndoEnabled(); + rDoc.EnableUndo( false ); for( sal_Int32 n = 0; n < nParCnt; n++ ) { boost::scoped_ptr<EditTextObject> pObject(pEngine->CreateTextObject(n)); @@ -136,13 +136,13 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, if( ++nRow > MAXROW ) break; } - pDoc->EnableUndo(bUndoEnabled); + rDoc.EnableUndo(bUndoEnabled); if (bRecord) { ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO ); - pRedoDoc->InitUndo( pDoc, nTab, nTab ); - pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL|IDF_NOCAPTIONS, false, pRedoDoc ); + pRedoDoc->InitUndo( &rDoc, nTab, nTab ); + rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL|IDF_NOCAPTIONS, false, pRedoDoc ); ScRange aMarkRange(nStartCol, nStartRow, nTab, nStartCol, nEndRow, nTab); ScMarkData aDestMark; @@ -160,9 +160,9 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, else { HideAllCursors(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScImportExport aImpEx( pDocSh->GetDocument(), - ScAddress( nStartCol, nStartRow, GetViewData()->GetTabNo() ) ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScImportExport aImpEx( &pDocSh->GetDocument(), + ScAddress( nStartCol, nStartRow, GetViewData().GetTabNo() ) ); OUString aStr; SotStorageStreamRef xStream; @@ -173,14 +173,14 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, aImpEx.ImportString( aStr, SOT_FORMAT_RTF ); AdjustRowHeight( nStartRow, aImpEx.GetRange().aEnd.Row() ); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); ShowAllCursors(); } } void ScViewFunc::DoRefConversion( bool bRecord ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); SCTAB nTabCount = pDoc->GetTableCount(); if (bRecord && !pDoc->IsUndoEnabled()) bRecord = false; @@ -194,8 +194,8 @@ void ScViewFunc::DoRefConversion( bool bRecord ) rMark.GetMarkArea( aMarkRange ); else { - aMarkRange = ScRange( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + aMarkRange = ScRange( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); } ScEditableTester aTester( pDoc, aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(),rMark ); @@ -205,7 +205,7 @@ void ScViewFunc::DoRefConversion( bool bRecord ) return; } - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); bool bOk = false; ScDocument* pUndoDoc = NULL; @@ -229,7 +229,7 @@ void ScViewFunc::DoRefConversion( bool bRecord ) } ScRangeListRef xRanges; - GetViewData()->GetMultiArea( xRanges ); + GetViewData().GetMultiArea( xRanges ); size_t nCount = xRanges->size(); ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end(); @@ -294,7 +294,7 @@ void ScViewFunc::DoRefConversion( bool bRecord ) } pDocSh->PostPaint( aMarkRange, PAINT_GRID ); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); pDocSh->SetDocumentModified(); CellContentChanged(); @@ -307,33 +307,33 @@ void ScViewFunc::DoThesaurus( bool bRecord ) SCCOL nCol; SCROW nRow; SCTAB nTab; - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); - ScSplitPos eWhich = GetViewData()->GetActivePart(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); + ScSplitPos eWhich = GetViewData().GetActivePart(); EESpellState eState; EditView* pEditView = NULL; boost::scoped_ptr<ESelection> pEditSel; boost::scoped_ptr<ScEditEngineDefaulter> pThesaurusEngine; - bool bIsEditMode = GetViewData()->HasEditView(eWhich); - if (bRecord && !pDoc->IsUndoEnabled()) + bool bIsEditMode = GetViewData().HasEditView(eWhich); + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; if (bIsEditMode) // Edit-Mode aktiv { - GetViewData()->GetEditView(eWhich, pEditView, nCol, nRow); + GetViewData().GetEditView(eWhich, pEditView, nCol, nRow); pEditSel.reset(new ESelection(pEditView->GetSelection())); SC_MOD()->InputEnterHandler(); - GetViewData()->GetBindings().Update(); // sonst kommt der Sfx durcheinander... + GetViewData().GetBindings().Update(); // sonst kommt der Sfx durcheinander... } else { - nCol = GetViewData()->GetCurX(); - nRow = GetViewData()->GetCurY(); + nCol = GetViewData().GetCurX(); + nRow = GetViewData().GetCurY(); } - nTab = GetViewData()->GetTabNo(); + nTab = GetViewData().GetTabNo(); ScAddress aPos(nCol, nRow, nTab); - ScEditableTester aTester( pDoc, nCol, nRow, nCol, nRow, rMark ); + ScEditableTester aTester( &rDoc, nCol, nRow, nCol, nRow, rMark ); if (!aTester.IsEditable()) { ErrorMessage(aTester.GetMessageId()); @@ -341,7 +341,7 @@ void ScViewFunc::DoThesaurus( bool bRecord ) } ScCellValue aOldText; - aOldText.assign(*pDoc, aPos); + aOldText.assign(rDoc, aPos); if (aOldText.meType != CELLTYPE_STRING && aOldText.meType != CELLTYPE_EDIT) { ErrorMessage(STR_THESAURUS_NO_STRING); @@ -350,15 +350,15 @@ void ScViewFunc::DoThesaurus( bool bRecord ) uno::Reference<linguistic2::XSpellChecker1> xSpeller = LinguMgr::GetSpellChecker(); - pThesaurusEngine.reset(new ScEditEngineDefaulter(pDoc->GetEnginePool())); - pThesaurusEngine->SetEditTextObjectPool( pDoc->GetEditPool() ); - pThesaurusEngine->SetRefDevice(GetViewData()->GetActiveWin()); + pThesaurusEngine.reset(new ScEditEngineDefaulter(rDoc.GetEnginePool())); + pThesaurusEngine->SetEditTextObjectPool( rDoc.GetEditPool() ); + pThesaurusEngine->SetRefDevice(GetViewData().GetActiveWin()); pThesaurusEngine->SetSpeller(xSpeller); MakeEditView(pThesaurusEngine.get(), nCol, nRow ); const ScPatternAttr* pPattern = NULL; boost::scoped_ptr<SfxItemSet> pEditDefaults( new SfxItemSet(pThesaurusEngine->GetEmptyItemSet())); - pPattern = pDoc->GetPattern(nCol, nRow, nTab); + pPattern = rDoc.GetPattern(nCol, nRow, nTab); if (pPattern) { pPattern->FillEditItemSet( pEditDefaults.get() ); @@ -368,9 +368,9 @@ void ScViewFunc::DoThesaurus( bool bRecord ) if (aOldText.meType == CELLTYPE_EDIT) pThesaurusEngine->SetText(*aOldText.mpEditText); else - pThesaurusEngine->SetText(aOldText.getString(pDoc)); + pThesaurusEngine->SetText(aOldText.getString(&rDoc)); - pEditView = GetViewData()->GetEditView(GetViewData()->GetActivePart()); + pEditView = GetViewData().GetEditView(GetViewData().GetActivePart()); if (pEditSel) pEditView->SetSelection(*pEditSel); else @@ -385,10 +385,10 @@ void ScViewFunc::DoThesaurus( bool bRecord ) if (eState == EE_SPELL_ERRORFOUND) // sollte spaeter durch Wrapper geschehen! { - LanguageType eLnge = ScViewUtil::GetEffLanguage( pDoc, ScAddress( nCol, nRow, nTab ) ); + LanguageType eLnge = ScViewUtil::GetEffLanguage( &rDoc, ScAddress( nCol, nRow, nTab ) ); OUString aErr = SvtLanguageTable::GetLanguageString(eLnge); aErr += ScGlobal::GetRscString( STR_SPELLING_NO_LANG ); - InfoBox aBox( GetViewData()->GetDialogParent(), aErr ); + InfoBox aBox( GetViewData().GetDialogParent(), aErr ); aBox.Execute(); } if (pThesaurusEngine->IsModified()) @@ -399,22 +399,22 @@ void ScViewFunc::DoThesaurus( bool bRecord ) { // The cell will own the text object instance. EditTextObject* pText = pThesaurusEngine->CreateTextObject(); - pDoc->SetEditText(ScAddress(nCol,nRow,nTab), pText); + rDoc.SetEditText(ScAddress(nCol,nRow,nTab), pText); aNewText.set(*pText); } else { OUString aStr = pThesaurusEngine->GetText(); - aNewText.set(pDoc->GetSharedStringPool().intern(aStr)); - pDoc->SetString(nCol, nRow, nTab, aStr); + aNewText.set(rDoc.GetSharedStringPool().intern(aStr)); + rDoc.SetString(nCol, nRow, nTab, aStr); } pDocSh->SetDocumentModified(); if (bRecord) { - GetViewData()->GetDocShell()->GetUndoManager()->AddUndoAction( + GetViewData().GetDocShell()->GetUndoManager()->AddUndoAction( new ScUndoThesaurus( - GetViewData()->GetDocShell(), nCol, nRow, nTab, aOldText, aNewText)); + GetViewData().GetDocShell(), nCol, nRow, nTab, aOldText, aNewText)); } } @@ -433,14 +433,14 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, bool bR SCCOL nCol; SCROW nRow; SCTAB nTab; - ScViewData& rViewData = *GetViewData(); + ScViewData& rViewData = GetViewData(); ScDocShell* pDocSh = rViewData.GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScMarkData& rMark = rViewData.GetMarkData(); ScSplitPos eWhich = rViewData.GetActivePart(); EditView* pEditView = NULL; bool bIsEditMode = rViewData.HasEditView(eWhich); - if (bRecord && !pDoc->IsUndoEnabled()) + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; if (bIsEditMode) // Edit-Mode aktiv { @@ -460,7 +460,7 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, bool bR bool bMarked = rMark.IsMultiMarked(); if (bMarked) { - ScEditableTester aTester( pDoc, rMark ); + ScEditableTester aTester( &rDoc, rMark ); if (!aTester.IsEditable()) { ErrorMessage(aTester.GetMessageId()); @@ -473,9 +473,9 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, bool bR if (bRecord) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); pRedoDoc = new ScDocument( SCDOCMODE_UNDO ); - pRedoDoc->InitUndo( pDoc, nTab, nTab ); + pRedoDoc->InitUndo( &rDoc, nTab, nTab ); if ( rMark.GetSelectCount() > 1 ) { @@ -491,8 +491,8 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, bool bR // ab hier kein return mehr - bool bOldEnabled = pDoc->IsIdleEnabled(); - pDoc->EnableIdle(false); // stop online spelling + bool bOldEnabled = rDoc.IsIdleEnabled(); + rDoc.EnableIdle(false); // stop online spelling // *** create and init the edit engine *** -------------------------------- @@ -501,12 +501,12 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, bool bR { case SC_CONVERSION_SPELLCHECK: pEngine.reset(new ScSpellingEngine( - pDoc->GetEnginePool(), rViewData, pUndoDoc, pRedoDoc, LinguMgr::GetSpellChecker() )); + rDoc.GetEnginePool(), rViewData, pUndoDoc, pRedoDoc, LinguMgr::GetSpellChecker() )); break; case SC_CONVERSION_HANGULHANJA: case SC_CONVERSION_CHINESE_TRANSL: pEngine.reset(new ScTextConversionEngine( - pDoc->GetEnginePool(), rViewData, rConvParam, pUndoDoc, pRedoDoc )); + rDoc.GetEnginePool(), rViewData, rConvParam, pUndoDoc, pRedoDoc )); break; default: OSL_FAIL( "ScViewFunc::DoSheetConversion - unknown conversion type" ); @@ -545,7 +545,7 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, bool bR } sc::SetFormulaDirtyContext aCxt; - pDoc->SetAllFormulasDirty(aCxt); + rDoc.SetAllFormulasDirty(aCxt); pDocSh->SetDocumentModified(); } @@ -562,7 +562,7 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, bool bR pEngine.reset(); pDocSh->PostPaintGridAll(); rViewData.GetViewShell()->UpdateInputHandler(); - pDoc->EnableIdle(bOldEnabled); + rDoc.EnableIdle(bOldEnabled); } // Pasten von FORMAT_FILE-Items @@ -578,7 +578,7 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink if( ::avmedia::MediaWindow::isMediaURL( aStrURL, ""/*TODO?*/ ) ) { const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, aStrURL ); - return ( 0 != GetViewData()->GetDispatcher().Execute( + return ( 0 != GetViewData().GetDispatcher().Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L ) ); } @@ -599,7 +599,7 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink if ( pFlt && !nErr ) { // Code aus dem SFX geklaut! - SfxDispatcher &rDispatcher = GetViewData()->GetDispatcher(); + SfxDispatcher &rDispatcher = GetViewData().GetDispatcher(); SfxStringItem aFileNameItem( SID_FILE_NAME, aStrURL ); SfxStringItem aFilterItem( SID_FILTER_NAME, pFlt->GetName() ); // #i69524# add target, as in SfxApplication when the Open dialog is used @@ -638,8 +638,8 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink if (bLink) // bei bLink alles, was nicht Grafik ist, als URL { Rectangle aRect( rPos, Size(0,0) ); - ScRange aRange = GetViewData()->GetDocument()-> - GetRange( GetViewData()->GetTabNo(), aRect ); + ScRange aRange = GetViewData().GetDocument()-> + GetRange( GetViewData().GetTabNo(), aRect ); SCCOL nPosX = aRange.aStart.Col(); SCROW nPosY = aRange.aStart.Row(); @@ -666,7 +666,7 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink // If an OLE object can't be created, insert a URL button - GetViewData()->GetViewShell()->InsertURLButton( aStrURL, aStrURL, EMPTY_OUSTRING, &rPos ); + GetViewData().GetViewShell()->InsertURLButton( aStrURL, aStrURL, EMPTY_OUSTRING, &rPos ); return true; } } @@ -689,24 +689,24 @@ void ScViewFunc::InsertBookmark( const OUString& rDescription, const OUString& r SCCOL nPosX, SCROW nPosY, const OUString* pTarget, bool bTryReplace ) { - ScViewData* pViewData = GetViewData(); - if ( pViewData->HasEditView( pViewData->GetActivePart() ) && - nPosX >= pViewData->GetEditStartCol() && nPosX <= pViewData->GetEditEndCol() && - nPosY >= pViewData->GetEditStartRow() && nPosY <= pViewData->GetEditEndRow() ) + ScViewData& rViewData = GetViewData(); + if ( rViewData.HasEditView( rViewData.GetActivePart() ) && + nPosX >= rViewData.GetEditStartCol() && nPosX <= rViewData.GetEditEndCol() && + nPosY >= rViewData.GetEditStartRow() && nPosY <= rViewData.GetEditEndRow() ) { // in die gerade editierte Zelle einfuegen OUString aTargetFrame; if (pTarget) aTargetFrame = *pTarget; - pViewData->GetViewShell()->InsertURLField( rDescription, rURL, aTargetFrame ); + rViewData.GetViewShell()->InsertURLField( rDescription, rURL, aTargetFrame ); return; } // in nicht editierte Zelle einfuegen - ScDocument* pDoc = GetViewData()->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocument* pDoc = GetViewData().GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); ScAddress aCellPos( nPosX, nPosY, nTab ); EditEngine aEngine( pDoc->GetEnginePool() ); @@ -746,10 +746,10 @@ void ScViewFunc::InsertBookmark( const OUString& rDescription, const OUString& r bool ScViewFunc::HasBookmarkAtCursor( SvxHyperlinkItem* pContent ) { - ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); - ScDocument* pDoc = GetViewData()->GetDocShell()->GetDocument(); + ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ); + ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument(); - const EditTextObject* pData = pDoc->GetEditText(aPos); + const EditTextObject* pData = rDoc.GetEditText(aPos); if (!pData) return false; diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 9d398119e296..9ee7fa5dbcea 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -75,7 +75,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, const uno::Reference<datatransfer::XTransferable>& rxTransferable, SCCOL nPosX, SCROW nPosY, Point* pLogicPos, bool bLink, bool bAllowDialogs ) { - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); pDoc->SetPastingDrawFromOtherDoc( true ); Point aPos; // inserting position (1/100 mm) @@ -90,7 +90,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, { // Window MapMode isn't drawing MapMode if DrawingLayer hasn't been created yet - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); long nXT = 0; for (SCCOL i=0; i<nPosX; i++) nXT += pDoc->GetColWidth(i,nTab); @@ -135,9 +135,9 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, ScDocShellRef xDocShRef = new ScDocShell(SFX_CREATE_MODE_EMBEDDED); if (xDocShRef->DoLoad(pMedium)) { - ScDocument* pSrcDoc = xDocShRef->GetDocument(); - SCTAB nSrcTab = pSrcDoc->GetVisibleTab(); - if (!pSrcDoc->HasTable(nSrcTab)) + ScDocument& rSrcDoc = xDocShRef->GetDocument(); + SCTAB nSrcTab = rSrcDoc.GetVisibleTab(); + if (!rSrcDoc.HasTable(nSrcTab)) nSrcTab = 0; ScMarkData aSrcMark; @@ -146,15 +146,15 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, SCCOL nFirstCol, nLastCol; SCROW nFirstRow, nLastRow; - if ( pSrcDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow ) ) - pSrcDoc->GetCellArea( nSrcTab, nLastCol, nLastRow ); + if ( rSrcDoc.GetDataStart( nSrcTab, nFirstCol, nFirstRow ) ) + rSrcDoc.GetCellArea( nSrcTab, nLastCol, nLastRow ); else { nFirstCol = nLastCol = 0; nFirstRow = nLastRow = 0; } ScClipParam aClipParam(ScRange(nFirstCol, nFirstRow, nSrcTab, nLastCol, nLastRow, nSrcTab), false); - pSrcDoc->CopyToClip(aClipParam, pClipDoc.get(), &aSrcMark); + rSrcDoc.CopyToClip(aClipParam, pClipDoc.get(), &aSrcMark); ScGlobal::SetClipDocName( xDocShRef->GetTitle( SFX_TITLE_FULLNAME ) ); SetCursor( nPosX, nPosY ); @@ -171,7 +171,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, else { OUString aName; - uno::Reference < embed::XEmbeddedObject > xObj = GetViewData()->GetViewShell()->GetObjectShell()-> + uno::Reference < embed::XEmbeddedObject > xObj = GetViewData().GetViewShell()->GetObjectShell()-> GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName ); if ( xObj.is() ) { @@ -217,7 +217,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, if (xStm.is()) { - xObj = GetViewData()->GetDocShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName ); + xObj = GetViewData().GetDocShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName ); } else { @@ -236,7 +236,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, // for example whether the object should be an iconified one xObj = aInfo.Object; if ( xObj.is() ) - GetViewData()->GetDocShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName ); + GetViewData().GetDocShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName ); } catch( uno::Exception& ) {} @@ -294,8 +294,8 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, } else { - ScAddress aCellPos( nPosX, nPosY, GetViewData()->GetTabNo() ); - ScImportExport aObj( GetViewData()->GetDocument(), aCellPos ); + ScAddress aCellPos( nPosX, nPosY, GetViewData().GetTabNo() ); + ScImportExport aObj( GetViewData().GetDocument(), aCellPos ); aObj.SetImportBroadcast(true); OUString aStr; @@ -368,7 +368,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, bRet = aObj.ImportString( aStr, nFormatId ); InvalidateAttribs(); - GetViewData()->UpdateInputHandler(); + GetViewData().UpdateInputHandler(); } } else if (nFormatId == SOT_FORMATSTR_ID_SBA_DATAEXCHANGE) @@ -385,8 +385,8 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, aDescAny <<= aProperties; SfxUsrAnyItem aDataDesc(SID_SBA_IMPORT, aDescAny); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + SCTAB nTab = GetViewData().GetTabNo(); ClickCursor(nPosX, nPosY, false); // set cursor position @@ -408,7 +408,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, SfxBoolItem aAreaNew(FN_PARAM_2, bAreaIsNew); // asynchronous, to avoid doing the whole import in drop handler - SfxDispatcher& rDisp = GetViewData()->GetDispatcher(); + SfxDispatcher& rDisp = GetViewData().GetDispatcher(); rDisp.Execute(SID_SBA_IMPORT, SFX_CALLMODE_ASYNCHRON, &aDataDesc, &aTarget, &aAreaNew, (void*)0 ); @@ -455,7 +455,7 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, pScDrawView->InsertObjectSafe(pObj, *pScDrawView->GetSdrPageView()); - GetViewData()->GetViewShell()->SetDrawShell( true ); + GetViewData().GetViewShell()->SetDrawShell( true ); bRet = true; } } @@ -705,7 +705,7 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r // uses Calc A1 syntax even when another formula syntax is specified // in the UI. EnterMatrix("='" - + OUString(ScGlobal::GetAbsDocName(*pTopic, GetViewData()->GetDocument()->GetDocumentShell())) + + OUString(ScGlobal::GetAbsDocName(*pTopic, GetViewData().GetDocument()->GetDocumentShell())) + "'#" + *pItem , ::formula::FormulaGrammar::GRAM_NATIVE); return true; @@ -728,9 +728,9 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r // mark range - SCTAB nTab = GetViewData()->GetTabNo(); - SCCOL nCurX = GetViewData()->GetCurX(); - SCROW nCurY = GetViewData()->GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); + SCCOL nCurX = GetViewData().GetCurX(); + SCROW nCurY = GetViewData().GetCurY(); HideAllCursors(); DoneBlockMode(); InitBlockMode( nCurX, nCurY, nTab ); diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index abfb11abf96a..74fe5592d660 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -51,56 +51,56 @@ using ::std::vector; void ScViewFunc::DetectiveAddPred() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - pDocSh->GetDocFunc().DetectiveAddPred( GetViewData()->GetCurPos() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + pDocSh->GetDocFunc().DetectiveAddPred( GetViewData().GetCurPos() ); RecalcPPT(); //! use broadcast in DocFunc instead? } void ScViewFunc::DetectiveDelPred() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - pDocSh->GetDocFunc().DetectiveDelPred( GetViewData()->GetCurPos() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + pDocSh->GetDocFunc().DetectiveDelPred( GetViewData().GetCurPos() ); RecalcPPT(); } void ScViewFunc::DetectiveAddSucc() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - pDocSh->GetDocFunc().DetectiveAddSucc( GetViewData()->GetCurPos() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + pDocSh->GetDocFunc().DetectiveAddSucc( GetViewData().GetCurPos() ); RecalcPPT(); } void ScViewFunc::DetectiveDelSucc() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - pDocSh->GetDocFunc().DetectiveDelSucc( GetViewData()->GetCurPos() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + pDocSh->GetDocFunc().DetectiveDelSucc( GetViewData().GetCurPos() ); RecalcPPT(); } void ScViewFunc::DetectiveAddError() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - pDocSh->GetDocFunc().DetectiveAddError( GetViewData()->GetCurPos() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + pDocSh->GetDocFunc().DetectiveAddError( GetViewData().GetCurPos() ); RecalcPPT(); } void ScViewFunc::DetectiveDelAll() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - pDocSh->GetDocFunc().DetectiveDelAll( GetViewData()->GetTabNo() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + pDocSh->GetDocFunc().DetectiveDelAll( GetViewData().GetTabNo() ); RecalcPPT(); } void ScViewFunc::DetectiveMarkInvalid() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - pDocSh->GetDocFunc().DetectiveMarkInvalid( GetViewData()->GetTabNo() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + pDocSh->GetDocFunc().DetectiveMarkInvalid( GetViewData().GetTabNo() ); RecalcPPT(); } void ScViewFunc::DetectiveRefresh() { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); pDocSh->GetDocFunc().DetectiveRefresh(); RecalcPPT(); } @@ -117,12 +117,12 @@ static void lcl_jumpToRange(const ScRange& rRange, ScViewData* pView, ScDocument void ScViewFunc::MarkAndJumpToRanges(const ScRangeList& rRanges) { - ScViewData* pView = GetViewData(); - ScDocShell* pDocSh = pView->GetDocShell(); + ScViewData& rView = GetViewData(); + ScDocShell* pDocSh = rView.GetDocShell(); ScRangeList aRanges(rRanges); ScRangeList aRangesToMark; - ScAddress aCurPos = pView->GetCurPos(); + ScAddress aCurPos = rView.GetCurPos(); size_t ListSize = aRanges.size(); for ( size_t i = 0; i < ListSize; ++i ) { @@ -138,7 +138,7 @@ void ScViewFunc::MarkAndJumpToRanges(const ScRangeList& rRanges) // Jump to the first range of all precedent ranges. const ScRange* p = aRangesToMark.front(); - lcl_jumpToRange(*p, pView, pDocSh->GetDocument()); + lcl_jumpToRange(*p, &rView, &pDocSh->GetDocument()); ListSize = aRangesToMark.size(); for ( size_t i = 0; i < ListSize; ++i ) @@ -150,11 +150,11 @@ void ScViewFunc::MarkAndJumpToRanges(const ScRangeList& rRanges) void ScViewFunc::DetectiveMarkPred() { - ScViewData* pView = GetViewData(); - ScDocShell* pDocSh = pView->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData& rMarkData = pView->GetMarkData(); - ScAddress aCurPos = pView->GetCurPos(); + ScViewData& rView = GetViewData(); + ScDocShell* pDocSh = rView.GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData& rMarkData = rView.GetMarkData(); + ScAddress aCurPos = rView.GetCurPos(); ScRangeList aRanges; if (rMarkData.IsMarked() || rMarkData.IsMultiMarked()) rMarkData.FillRangeListWithMarks(&aRanges, false); @@ -175,7 +175,7 @@ void ScViewFunc::DetectiveMarkPred() // jump to the destination. sal_uInt16 nFileId = p->GetIndex(); - ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); + ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager(); const OUString* pPath = pRefMgr->getExternalFileName(nFileId); ScRange aRange; @@ -203,7 +203,7 @@ void ScViewFunc::DetectiveMarkPred() { // The first precedent range is on a different sheet. Jump to it // immediately and forget the rest. - lcl_jumpToRange(aRange, pView, pDoc); + lcl_jumpToRange(aRange, &rView, &rDoc); return; } } @@ -215,10 +215,10 @@ void ScViewFunc::DetectiveMarkPred() void ScViewFunc::DetectiveMarkSucc() { - ScViewData* pView = GetViewData(); - ScDocShell* pDocSh = pView->GetDocShell(); - ScMarkData& rMarkData = pView->GetMarkData(); - ScAddress aCurPos = pView->GetCurPos(); + ScViewData& rView = GetViewData(); + ScDocShell* pDocSh = rView.GetDocShell(); + ScMarkData& rMarkData = rView.GetMarkData(); + ScAddress aCurPos = rView.GetCurPos(); ScRangeList aRanges; if (rMarkData.IsMarked() || rMarkData.IsMultiMarked()) rMarkData.FillRangeListWithMarks(&aRanges, false); @@ -239,12 +239,12 @@ void ScViewFunc::DetectiveMarkSucc() void ScViewFunc::InsertCurrentTime(short nCellFmt, const OUString& rUndoStr) { - ScViewData* pViewData = GetViewData(); - ScAddress aCurPos = pViewData->GetCurPos(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScViewData& rViewData = GetViewData(); + ScAddress aCurPos = rViewData.GetCurPos(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); ::svl::IUndoManager* pUndoMgr = pDocSh->GetUndoManager(); - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); Date aActDate( Date::SYSTEM ); double fDate = aActDate - *pFormatter->GetNullDate(); Time aActTime( Time::SYSTEM ); @@ -257,7 +257,7 @@ void ScViewFunc::InsertCurrentTime(short nCellFmt, const OUString& rUndoStr) // Set the new cell format only when it differs from the current cell // format type. - sal_uInt32 nCurNumFormat = pDoc->GetNumberFormat(aCurPos); + sal_uInt32 nCurNumFormat = rDoc.GetNumberFormat(aCurPos); const SvNumberformat* pEntry = pFormatter->GetEntry(nCurNumFormat); if (!pEntry || !(pEntry->GetType() & nCellFmt)) SetNumberFormat(nCellFmt); @@ -268,7 +268,7 @@ void ScViewFunc::ShowNote( bool bShow ) { if( bShow ) HideNoteMarker(); - const ScViewData& rViewData = *GetViewData(); + const ScViewData& rViewData = GetViewData(); ScAddress aPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() ); // show note moved to ScDocFunc, to be able to use it in notesuno.cxx rViewData.GetDocShell()->GetDocFunc().ShowNote( aPos, bShow ); @@ -278,21 +278,21 @@ void ScViewFunc::EditNote() { // for editing display and activate - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); ScAddress aPos( nCol, nRow, nTab ); // start drawing undo to catch undo action for insertion of the caption object pDocSh->MakeDrawLayer(); - ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); pDrawLayer->BeginCalcUndo(true); // generated undo action is processed in FuText::StopEditMode // get existing note or create a new note (including caption drawing object) - if( ScPostIt* pNote = pDoc->GetOrCreateNote( aPos ) ) + if( ScPostIt* pNote = rDoc.GetOrCreateNote( aPos ) ) { // hide temporary note caption HideNoteMarker(); @@ -311,7 +311,7 @@ void ScViewFunc::EditNote() static_cast< FuSelection* >( pDraw )->ActivateNoteHandles( pCaption ); // activate object (as in FuSelection::TestComment) - GetViewData()->GetDispatcher().Execute( SID_DRAW_NOTEEDIT, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD ); + GetViewData().GetDispatcher().Execute( SID_DRAW_NOTEEDIT, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD ); // now get the created FuText and set into EditMode FuPoor* pPoor = GetDrawFuncPtr(); if ( pPoor && (pPoor->GetSlotID() == SID_DRAW_NOTEEDIT) ) // has no RTTI diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 8799d59c191d..77093e4b12c1 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -84,14 +84,14 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, // MapMode at Outliner-RefDevice has to be right (as in FuText::MakeOutliner) //! merge with FuText::MakeOutliner? MapMode aOldMapMode; - OutputDevice* pRef = GetViewData()->GetDocument()->GetDrawLayer()->GetRefDevice(); + OutputDevice* pRef = GetViewData().GetDocument()->GetDrawLayer()->GetRefDevice(); if (pRef) { aOldMapMode = pRef->GetMapMode(); pRef->SetMapMode( MapMode(MAP_100TH_MM) ); } - bool bNegativePage = GetViewData()->GetDocument()->IsNegativePage( GetViewData()->GetTabNo() ); + bool bNegativePage = GetViewData().GetDocument()->IsNegativePage( GetViewData().GetTabNo() ); SdrView* pDragEditView = NULL; ScModule* pScMod = SC_MOD(); @@ -138,7 +138,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, else { SdrModel* pDrawModel = pDragEditView->GetModel(); - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); SdrPage* pDestPage = pDrawModel->GetPage( static_cast< sal_uInt16 >( nTab ) ); OSL_ENSURE(pDestPage,"who is this, Page?"); @@ -173,15 +173,15 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, pScDrawView->AddUndo(new SdrUndoInsertObj( *pNeuObj )); if (ScDrawLayer::IsCellAnchored(*pNeuObj)) - ScDrawLayer::SetCellAnchoredFromPosition(*pNeuObj, *GetViewData()->GetDocument(), nTab); + ScDrawLayer::SetCellAnchoredFromPosition(*pNeuObj, *GetViewData().GetDocument(), nTab); } } if (bPasteIsMove) pDragEditView->DeleteMarked(); - ScDocument* pDocument = GetViewData()->GetDocument(); - ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScDocument* pDocument = GetViewData().GetDocument(); + ScDocShell* pDocShell = GetViewData().GetDocShell(); ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : NULL ); if ( pDocument && pDestPage && pModelObj && pDrawTrans ) { @@ -199,18 +199,18 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0)); aView.MarkAllObj(pPv); Size aSize = aView.GetAllMarkedRect().GetSize(); - lcl_AdjustInsertPos( GetViewData(), aPos, aSize ); + lcl_AdjustInsertPos( &GetViewData(), aPos, aSize ); // don't change marking if OLE object is active // (at Drop from OLE object it would be deactivated in the middle of ExecuteDrag!) sal_uLong nOptions = 0; - SfxInPlaceClient* pClient = GetViewData()->GetViewShell()->GetIPClient(); + SfxInPlaceClient* pClient = GetViewData().GetViewShell()->GetIPClient(); if ( pClient && pClient->IsObjectInPlaceActive() ) nOptions |= SDRINSERT_DONTMARK; ::std::vector< OUString > aExcludedChartNames; - SCTAB nTab = GetViewData()->GetTabNo(); + SCTAB nTab = GetViewData().GetTabNo(); SdrPage* pPage = pScDrawView->GetModel()->GetPage( static_cast< sal_uInt16 >( nTab ) ); OSL_ENSURE( pPage, "Page?" ); if ( pPage ) @@ -221,12 +221,12 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, // #89247# Set flag for ScDocument::UpdateChartListeners() which is // called during paste. if ( !bSameDocClipboard ) - GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( true ); + GetViewData().GetDocument()->SetPastingDrawFromOtherDoc( true ); pScDrawView->Paste(*pModel, aPos, NULL, nOptions, rSrcShellID, rDestShellID); if ( !bSameDocClipboard ) - GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( false ); + GetViewData().GetDocument()->SetPastingDrawFromOtherDoc( false ); // Paste puts all objects on the active (front) layer // controls must be on SC_LAYER_CONTROLS @@ -240,17 +240,17 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, pObject->NbcSetLayer(SC_LAYER_CONTROLS); if (ScDrawLayer::IsCellAnchored(*pObject)) - ScDrawLayer::SetCellAnchoredFromPosition(*pObject, *GetViewData()->GetDocument(), nTab); + ScDrawLayer::SetCellAnchoredFromPosition(*pObject, *GetViewData().GetDocument(), nTab); pObject = aIter.Next(); } } // all graphics objects must have names - GetViewData()->GetDocument()->EnsureGraphicNames(); + GetViewData().GetDocument()->EnsureGraphicNames(); - ScDocument* pDocument = GetViewData()->GetDocument(); - ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScDocument* pDocument = GetViewData().GetDocument(); + ScDocShell* pDocShell = GetViewData().GetDocShell(); ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : NULL ); ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard( NULL ); if ( pDocument && pPage && pModelObj && ( pTransferObj || pDrawTrans ) ) @@ -271,7 +271,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, if (pRef) pRef->SetMapMode( aOldMapMode ); - // GetViewData()->GetViewShell()->SetDrawShell( true ); + // GetViewData().GetViewShell()->SetDrawShell( true ); // It is not sufficient to just set the DrawShell if we pasted, for // example, a chart. SetDrawShellOrSub() would only work for D&D in the // same document but not if inserting from the clipboard, therefore @@ -288,7 +288,7 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X { OUString aName; //TODO/MBA: is that OK? - comphelper::EmbeddedObjectContainer& aCnt = GetViewData()->GetViewShell()->GetObjectShell()->GetEmbeddedObjectContainer(); + comphelper::EmbeddedObjectContainer& aCnt = GetViewData().GetViewShell()->GetObjectShell()->GetEmbeddedObjectContainer(); if ( !aCnt.HasEmbeddedObject( xObj ) ) aCnt.InsertEmbeddedObject( xObj, aName ); else @@ -347,7 +347,7 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X // don't call AdjustInsertPos Point aInsPos = rPos; - if ( GetViewData()->GetDocument()->IsNegativePage( GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument()->IsNegativePage( GetViewData().GetTabNo() ) ) aInsPos.X() -= aSize.Width(); Rectangle aRect( aInsPos, aSize ); @@ -356,7 +356,7 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X SdrPageView* pPV = pDrView->GetSdrPageView(); pDrView->InsertObjectSafe( pSdrObj, *pPV ); // don't mark if OLE - GetViewData()->GetViewShell()->SetDrawShell( true ); + GetViewData().GetViewShell()->SetDrawShell( true ); return true; } else @@ -428,10 +428,10 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic, Size aSize = pWin->LogicToLogic( rGraphic.GetPrefSize(), &aSourceMap, &aDestMap ); - if ( GetViewData()->GetDocument()->IsNegativePage( GetViewData()->GetTabNo() ) ) + if ( GetViewData().GetDocument()->IsNegativePage( GetViewData().GetTabNo() ) ) aPos.X() -= aSize.Width(); - GetViewData()->GetViewShell()->SetDrawShell( true ); + GetViewData().GetViewShell()->SetDrawShell( true ); Rectangle aRect(aPos, aSize); SdrGrafObj* pGrafObj = new SdrGrafObj(rGraphic, aRect); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 9ce469a3d909..a996f3735bcd 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -107,7 +107,7 @@ void ScViewFunc::StartFormatArea() // start only with single cell (marked or cursor position) ScRange aMarkRange; - bool bOk = (GetViewData()->GetSimpleArea( aMarkRange ) == SC_MARK_SIMPLE); + bool bOk = (GetViewData().GetSimpleArea( aMarkRange ) == SC_MARK_SIMPLE); if ( bOk && aMarkRange.aStart != aMarkRange.aEnd ) bOk = false; @@ -189,12 +189,12 @@ bool ScViewFunc::TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrC void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrChanged, bool bAddUndo ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - if (bAddUndo && !pDoc->IsUndoEnabled()) + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + if (bAddUndo && !rDoc.IsUndoEnabled()) bAddUndo = false; - const ScPatternAttr* pSource = pDoc->GetPattern( + const ScPatternAttr* pSource = rDoc.GetPattern( aFormatSource.Col(), aFormatSource.Row(), nTab ); if ( !((const ScMergeAttr&)pSource->GetItem(ATTR_MERGE)).IsMerged() ) { @@ -202,10 +202,10 @@ void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, ScMarkData aMark; aMark.SetMarkArea( aRange ); - ScDocFunc &rFunc = GetViewData()->GetDocFunc(); + ScDocFunc &rFunc = GetViewData().GetDocFunc(); // pOldPattern is only valid until call to ApplyAttributes! - const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab ); + const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab ); const ScStyleSheet* pSrcStyle = pSource->GetStyleSheet(); if ( pSrcStyle && pSrcStyle != pOldPattern->GetStyleSheet() ) rFunc.ApplyStyle( aMark, pSrcStyle->GetName(), true, false ); @@ -221,14 +221,14 @@ void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); - double nPPTX = GetViewData()->GetPPTX(); - double nPPTY = GetViewData()->GetPPTY(); - Fraction aZoomX = GetViewData()->GetZoomX(); - Fraction aZoomY = GetViewData()->GetZoomY(); + double nPPTX = GetViewData().GetPPTX(); + double nPPTY = GetViewData().GetPPTY(); + Fraction aZoomX = GetViewData().GetZoomX(); + Fraction aZoomY = GetViewData().GetZoomY(); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) @@ -238,7 +238,7 @@ sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula aZoomX = aZoomY = Fraction( 1, 1 ); } - sal_uInt16 nTwips = pDoc->GetOptimalColWidth( nCol, nTab, aProv.GetDevice(), + sal_uInt16 nTwips = rDoc.GetOptimalColWidth( nCol, nTab, aProv.GetDevice(), nPPTX, nPPTY, aZoomX, aZoomY, bFormula, &rMark ); return nTwips; } @@ -246,15 +246,15 @@ sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula bool ScViewFunc::SelectionEditable( bool* pOnlyNotBecauseOfMatrix /* = NULL */ ) { bool bRet; - ScDocument* pDoc = GetViewData()->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); if (rMark.IsMarked() || rMark.IsMultiMarked()) bRet = pDoc->IsSelectionEditable( rMark, pOnlyNotBecauseOfMatrix ); else { - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); bRet = pDoc->IsBlockEditable( nTab, nCol, nRow, nCol, nRow, pOnlyNotBecauseOfMatrix ); } @@ -336,13 +336,13 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString, const EditTextObject* pData ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); bool bRecord = pDoc->IsUndoEnabled(); SCTAB i; - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocFunc &rFunc = GetViewData()->GetDocFunc(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocFunc &rFunc = GetViewData().GetDocFunc(); ScDocShellModificator aModificator( *pDocSh ); ScEditableTester aTester( pDoc, nCol,nRow, nCol,nRow, rMark ); @@ -441,7 +441,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, { OUString aMessage( ScResId( SCSTR_FORMULA_AUTOCORRECTION ) ); aMessage += aCorrectedFormula; - nResult = QueryBox( GetViewData()->GetDialogParent(), + nResult = QueryBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), aMessage ).Execute(); } @@ -559,7 +559,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, if (bAutoFormat) DoAutoAttributes(nCol, nRow, nTab, bNumFmtChanged, bRecord); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow); @@ -574,8 +574,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocument* pDoc = GetViewData().GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); if ( pDoc && pDocSh ) { @@ -600,7 +600,7 @@ void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& r } pDocSh->PostPaintCell( aPos ); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); aModificator.SetDocumentModified(); } else @@ -611,14 +611,14 @@ void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& r void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextObject& rData, bool bTestSimple ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScMarkData& rMark = GetViewData()->GetMarkData(); - ScDocument* pDoc = pDocSh->GetDocument(); - bool bRecord = pDoc->IsUndoEnabled(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScMarkData& rMark = GetViewData().GetMarkData(); + ScDocument& rDoc = pDocSh->GetDocument(); + bool bRecord = rDoc.IsUndoEnabled(); ScDocShellModificator aModificator( *pDocSh ); - ScEditableTester aTester( pDoc, nTab, nCol,nRow, nCol,nRow ); + ScEditableTester aTester( &rDoc, nTab, nCol,nRow, nCol,nRow ); if (aTester.IsEditable()) { @@ -629,8 +629,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, boost::scoped_ptr<ScPatternAttr> pCellAttrs; OUString aString; - const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab ); - ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() ); + const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab ); + ScTabEditEngine aEngine( *pOldPattern, rDoc.GetEnginePool() ); aEngine.SetText(rData); if (bTestSimple) // test, if simple string without attribute @@ -674,7 +674,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, { ScUndoEnterData::Value aOldValue; aOldValue.mnTab = *itr; - aOldValue.maCell.assign(*pDoc, ScAddress(nCol, nRow, *itr)); + aOldValue.maCell.assign(rDoc, ScAddress(nCol, nRow, *itr)); aOldValues.push_back(aOldValue); } @@ -686,7 +686,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, if (bCommon) - pDoc->ApplyPattern(nCol,nRow,nTab,*pCellAttrs); //! undo + rDoc.ApplyPattern(nCol,nRow,nTab,*pCellAttrs); //! undo if (bSimple) { @@ -701,7 +701,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, for (; itr != itrEnd; ++itr) { ScAddress aPos(nCol, nRow, *itr); - pDoc->SetEditText(aPos, rData, pDoc->GetEditPool()); + rDoc.SetEditText(aPos, rData, rDoc.GetEditPool()); } if ( bRecord ) @@ -720,13 +720,13 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, ShowAllCursors(); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow); aModificator.SetDocumentModified(); } - lcl_PostRepaintCondFormat( pDoc->GetCondFormat( nCol, nRow, nTab ), pDocSh ); + lcl_PostRepaintCondFormat( rDoc.GetCondFormat( nCol, nRow, nTab ), pDocSh ); } else { @@ -737,26 +737,26 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, void ScViewFunc::EnterDataAtCursor( const OUString& rString ) { - SCCOL nPosX = GetViewData()->GetCurX(); - SCROW nPosY = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); + SCCOL nPosX = GetViewData().GetCurX(); + SCROW nPosY = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); EnterData( nPosX, nPosY, nTab, rString ); } void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar::Grammar eGram ) { - ScViewData* pData = GetViewData(); - const ScMarkData& rMark = pData->GetMarkData(); + ScViewData& rData = GetViewData(); + const ScMarkData& rMark = rData.GetMarkData(); if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) { // nothing marked -> temporarily calculate block // with size of result formula to get the size - ScDocument* pDoc = pData->GetDocument(); - SCCOL nCol = pData->GetCurX(); - SCROW nRow = pData->GetCurY(); - SCTAB nTab = pData->GetTabNo(); + ScDocument* pDoc = rData.GetDocument(); + SCCOL nCol = rData.GetCurX(); + SCROW nRow = rData.GetCurY(); + SCTAB nTab = rData.GetTabNo(); ScFormulaCell aFormCell( pDoc, ScAddress(nCol,nRow,nTab), rString, eGram, MM_FORMULA ); SCSIZE nSizeX; @@ -774,13 +774,13 @@ void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar } ScRange aRange; - if (pData->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (rData.GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = pData->GetDocShell(); + ScDocShell* pDocSh = rData.GetDocShell(); bool bSuccess = pDocSh->GetDocFunc().EnterMatrix( aRange, &rMark, NULL, rString, false, false, EMPTY_OUSTRING, eGram ); if (bSuccess) - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); } else ErrorMessage(STR_NOMULTISELECT); @@ -790,14 +790,14 @@ sal_uInt8 ScViewFunc::GetSelectionScriptType() { sal_uInt8 nScript = 0; - ScDocument* pDoc = GetViewData()->GetDocument(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + const ScMarkData& rMark = GetViewData().GetMarkData(); if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) { // no selection -> cursor - nScript = pDoc->GetScriptType( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo()); + nScript = pDoc->GetScriptType( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo()); } else { @@ -817,8 +817,8 @@ const ScPatternAttr* ScViewFunc::GetSelectionPattern() // Don't use UnmarkFiltered in slot state functions, for performance reasons. // The displayed state is always that of the whole selection including filtered rows. - const ScMarkData& rMark = GetViewData()->GetMarkData(); - ScDocument* pDoc = GetViewData()->GetDocument(); + const ScMarkData& rMark = GetViewData().GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); if ( rMark.IsMarked() || rMark.IsMultiMarked() ) { // MarkToMulti is no longer necessary for pDoc->GetSelectionPattern @@ -827,9 +827,9 @@ const ScPatternAttr* ScViewFunc::GetSelectionPattern() } else { - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); ScMarkData aTempMark( rMark ); // copy sheet selection aTempMark.SetMarkArea( ScRange( nCol, nRow, nTab ) ); @@ -841,8 +841,8 @@ const ScPatternAttr* ScViewFunc::GetSelectionPattern() void ScViewFunc::GetSelectionFrame( SvxBoxItem& rLineOuter, SvxBoxInfoItem& rLineInner ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocument* pDoc = GetViewData().GetDocument(); + const ScMarkData& rMark = GetViewData().GetMarkData(); if ( rMark.IsMarked() || rMark.IsMultiMarked() ) { @@ -858,9 +858,9 @@ void ScViewFunc::GetSelectionFrame( SvxBoxItem& rLineOuter, else { const ScPatternAttr* pAttrs = - pDoc->GetPattern( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo() ); + pDoc->GetPattern( GetViewData().GetCurX(), + GetViewData().GetCurY(), + GetViewData().GetTabNo() ); rLineOuter = (const SvxBoxItem&) (pAttrs->GetItem( ATTR_BORDER )); rLineInner = (const SvxBoxInfoItem&)(pAttrs->GetItem( ATTR_BORDER_INNER )); @@ -901,7 +901,7 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet, if ( nNewFormat != nOldFormat ) { SvNumberFormatter* pFormatter = - GetViewData()->GetDocument()->GetFormatTable(); + GetViewData().GetDocument()->GetFormatTable(); const SvNumberformat* pOldEntry = pFormatter->GetEntry( nOldFormat ); LanguageType eOldLang = pOldEntry ? pOldEntry->GetLanguage() : LANGUAGE_DONTKNOW; @@ -1000,7 +1000,7 @@ void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem ) return; } - ScPatternAttr aNewAttrs( new SfxItemSet( *GetViewData()->GetDocument()->GetPool(), + ScPatternAttr aNewAttrs( new SfxItemSet( *GetViewData().GetDocument()->GetPool(), ATTR_PATTERN_START, ATTR_PATTERN_END ) ); aNewAttrs.GetItemSet().Put( rAttrItem ); @@ -1020,8 +1020,8 @@ void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem ) void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem* pNewOuter, const SvxBoxInfoItem* pNewInner, bool bRecord ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered + ScDocument* pDoc = GetViewData().GetDocument(); + ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered ScViewUtil::UnmarkFiltered( aFuncMark, pDoc ); if (bRecord && !pDoc->IsUndoEnabled()) bRecord = false; @@ -1035,15 +1035,15 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem aFuncMark.GetMarkArea( aMarkRange ); else { - aMarkRange = ScRange( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); + aMarkRange = ScRange( GetViewData().GetCurX(), + GetViewData().GetCurY(), GetViewData().GetTabNo() ); DoneBlockMode(); InitOwnBlockMode(); aFuncMark.SetMarkArea(aMarkRange); MarkDataChanged(); } - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScDocShellModificator aModificator( *pDocSh ); @@ -1082,7 +1082,7 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem pDoc->ApplySelectionPattern( rAttr, aFuncMark ); pDocSh->PostPaint( aMarkRange, PAINT_GRID, nExt ); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); aModificator.SetDocumentModified(); CellContentChanged(); @@ -1094,13 +1094,13 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bRecord, bool bCursorOnly ) { - ScViewData* pViewData = GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData aFuncMark( pViewData->GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, pDoc ); + ScViewData& rViewData = GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered + ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); - if (bRecord && !pDoc->IsUndoEnabled()) + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; // State from old ItemSet doesn't matter for paint flags, as any change will be @@ -1125,9 +1125,9 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bOnlyTab = (!aFuncMark.IsMultiMarked() && !bCursorOnly && aFuncMark.GetSelectCount() > 1); if (bOnlyTab) { - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); - SCTAB nTab = pViewData->GetTabNo(); + SCCOL nCol = rViewData.GetCurX(); + SCROW nRow = rViewData.GetCurY(); + SCTAB nTab = rViewData.GetTabNo(); aFuncMark.SetMarkArea(ScRange(nCol,nRow,nTab)); aFuncMark.MarkToMulti(); } @@ -1138,7 +1138,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, { ScRange aMarkRange; aFuncMark.GetMultiMarkArea( aMarkRange ); - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end(); for (; itr != itrEnd; ++itr) { @@ -1164,12 +1164,12 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, aCopyRange.aEnd.SetTab(nTabCount-1); ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab ); + pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab ); itr = aFuncMark.begin(); for (; itr != itrEnd; ++itr) if (*itr != nStartTab) pUndoDoc->AddUndoTab( *itr, *itr ); - pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &aFuncMark ); + rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &aFuncMark ); aFuncMark.MarkToMulti(); @@ -1180,37 +1180,37 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, pEditDataArray = pUndoAttr->GetDataArray(); } - pDoc->ApplySelectionPattern( rAttr, aFuncMark, pEditDataArray ); + rDoc.ApplySelectionPattern( rAttr, aFuncMark, pEditDataArray ); pDocSh->PostPaint( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab, PAINT_GRID, nExtFlags | SC_PF_TESTMERGE ); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); aModificator.SetDocumentModified(); CellContentChanged(); } else // single cell - simpler undo { - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); - SCTAB nTab = pViewData->GetTabNo(); + SCCOL nCol = rViewData.GetCurX(); + SCROW nRow = rViewData.GetCurY(); + SCTAB nTab = rViewData.GetTabNo(); EditTextObject* pOldEditData = NULL; EditTextObject* pNewEditData = NULL; ScAddress aPos(nCol, nRow, nTab); - if (pDoc->GetCellType(aPos) == CELLTYPE_EDIT) + if (rDoc.GetCellType(aPos) == CELLTYPE_EDIT) { - pOldEditData = pDoc->GetEditText(aPos)->Clone(); - pDoc->RemoveEditTextCharAttribs(aPos, rAttr); - pNewEditData = pDoc->GetEditText(aPos)->Clone(); + pOldEditData = rDoc.GetEditText(aPos)->Clone(); + rDoc.RemoveEditTextCharAttribs(aPos, rAttr); + pNewEditData = rDoc.GetEditText(aPos)->Clone(); } aChangeRanges.Append(aPos); - boost::scoped_ptr<ScPatternAttr> pOldPat(new ScPatternAttr(*pDoc->GetPattern( nCol, nRow, nTab ))); + boost::scoped_ptr<ScPatternAttr> pOldPat(new ScPatternAttr(*rDoc.GetPattern( nCol, nRow, nTab ))); - pDoc->ApplyPattern( nCol, nRow, nTab, rAttr ); + rDoc.ApplyPattern( nCol, nRow, nTab, rAttr ); - const ScPatternAttr* pNewPat = pDoc->GetPattern( nCol, nRow, nTab ); + const ScPatternAttr* pNewPat = rDoc.GetPattern( nCol, nRow, nTab ); if (bRecord) { @@ -1222,7 +1222,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, pOldPat.reset(); // is copied in undo (Pool) pDocSh->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PAINT_GRID, nExtFlags | SC_PF_TESTMERGE ); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); aModificator.SetDocumentModified(); CellContentChanged(); } @@ -1272,7 +1272,7 @@ void ScViewFunc::ApplyUserItemSet( const SfxItemSet& rItemSet ) return; } - ScPatternAttr aNewAttrs( GetViewData()->GetDocument()->GetPool() ); + ScPatternAttr aNewAttrs( GetViewData().GetDocument()->GetPool() ); SfxItemSet& rNewSet = aNewAttrs.GetItemSet(); rNewSet.Put( rItemSet, false ); ApplySelectionPattern( aNewAttrs ); @@ -1286,16 +1286,16 @@ const SfxStyleSheet* ScViewFunc::GetStyleSheetFromMarked() // The displayed state is always that of the whole selection including filtered rows. const ScStyleSheet* pSheet = NULL; - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - ScMarkData& rMark = pViewData->GetMarkData(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + ScMarkData& rMark = rViewData.GetMarkData(); if ( rMark.IsMarked() || rMark.IsMultiMarked() ) pSheet = pDoc->GetSelectionStyle( rMark ); // MarkToMulti isn't necessary else - pSheet = pDoc->GetStyle( pViewData->GetCurX(), - pViewData->GetCurY(), - pViewData->GetTabNo() ); + pSheet = pDoc->GetStyle( rViewData.GetCurX(), + rViewData.GetCurY(), + rViewData.GetTabNo() ); return pSheet; } @@ -1313,13 +1313,13 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, bool bRecord if ( !pStyleSheet) return; - ScViewData* pViewData = GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData aFuncMark( pViewData->GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, pDoc ); - SCTAB nTabCount = pDoc->GetTableCount(); - if (bRecord && !pDoc->IsUndoEnabled()) + ScViewData& rViewData = GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered + ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + SCTAB nTabCount = rDoc.GetTableCount(); + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; ScDocShellModificator aModificator( *pDocSh ); @@ -1332,9 +1332,9 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, bool bRecord if ( bRecord ) { - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = rViewData.GetTabNo(); ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end(); for (; itr != itrEnd; ++itr) if (*itr != nTab) @@ -1343,7 +1343,7 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, bool bRecord ScRange aCopyRange = aMarkRange; aCopyRange.aStart.SetTab(0); aCopyRange.aEnd.SetTab(nTabCount-1); - pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, &aFuncMark ); + rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, &aFuncMark ); aFuncMark.MarkToMulti(); OUString aName = pStyleSheet->GetName(); @@ -1351,30 +1351,30 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, bool bRecord new ScUndoSelectionStyle( pDocSh, aFuncMark, aMarkRange, aName, pUndoDoc ) ); } - pDoc->ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, aFuncMark ); + rDoc.ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, aFuncMark ); if (!AdjustBlockHeight()) - pViewData->GetDocShell()->PostPaint( aMarkRange, PAINT_GRID ); + rViewData.GetDocShell()->PostPaint( aMarkRange, PAINT_GRID ); aFuncMark.MarkToSimple(); } else { - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); - SCTAB nTab = pViewData->GetTabNo(); + SCCOL nCol = rViewData.GetCurX(); + SCROW nRow = rViewData.GetCurY(); + SCTAB nTab = rViewData.GetTabNo(); if ( bRecord ) { ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end(); for (; itr != itrEnd; ++itr) if (*itr != nTab) pUndoDoc->AddUndoTab( *itr, *itr ); ScRange aCopyRange( nCol, nRow, 0, nCol, nRow, nTabCount-1 ); - pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, false, pUndoDoc ); + rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, false, pUndoDoc ); ScRange aMarkRange ( nCol, nRow, nTab ); ScMarkData aUndoMark = aFuncMark; @@ -1387,10 +1387,10 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, bool bRecord ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end(); for (; itr != itrEnd; ++itr) - pDoc->ApplyStyle( nCol, nRow, *itr, (ScStyleSheet&)*pStyleSheet ); + rDoc.ApplyStyle( nCol, nRow, *itr, (ScStyleSheet&)*pStyleSheet ); if (!AdjustBlockHeight()) - pViewData->GetDocShell()->PostPaintCell( nCol, nRow, nTab ); + rViewData.GetDocShell()->PostPaintCell( nCol, nRow, nTab ); } @@ -1405,19 +1405,19 @@ void ScViewFunc::RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) if ( !pStyleSheet) return; - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + ScDocShell* pDocSh = rViewData.GetDocShell(); ScDocShellModificator aModificator( *pDocSh ); VirtualDevice aVirtDev; aVirtDev.SetMapMode(MAP_PIXEL); pDoc->StyleSheetChanged( pStyleSheet, true, &aVirtDev, - pViewData->GetPPTX(), - pViewData->GetPPTY(), - pViewData->GetZoomX(), - pViewData->GetZoomY() ); + rViewData.GetPPTX(), + rViewData.GetPPTY(), + rViewData.GetZoomX(), + rViewData.GetZoomY() ); pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT ); aModificator.SetDocumentModified(); @@ -1432,19 +1432,19 @@ void ScViewFunc::UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) if ( !pStyleSheet) return; - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + ScDocShell* pDocSh = rViewData.GetDocShell(); ScDocShellModificator aModificator( *pDocSh ); VirtualDevice aVirtDev; aVirtDev.SetMapMode(MAP_PIXEL); pDoc->StyleSheetChanged( pStyleSheet, false, &aVirtDev, - pViewData->GetPPTX(), - pViewData->GetPPTY(), - pViewData->GetZoomX(), - pViewData->GetZoomY() ); + rViewData.GetPPTX(), + rViewData.GetPPTY(), + rViewData.GetZoomX(), + rViewData.GetZoomY() ); pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT ); aModificator.SetDocumentModified(); @@ -1459,14 +1459,14 @@ void ScViewFunc::UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste ) { ScRange aRange; - if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + const ScMarkData& rMark = GetViewData().GetMarkData(); bool bSuccess = pDocSh->GetDocFunc().InsertCells( aRange, &rMark, eCmd, bRecord, false, bPartOfPaste ); if (bSuccess) { - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); CellContentChanged(); ResetAutoSpell(); @@ -1492,10 +1492,10 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste ) void ScViewFunc::DeleteCells( DelCellCmd eCmd, bool bRecord ) { ScRange aRange; - if ( GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) + if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - const ScMarkData& rMark = GetViewData()->GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + const ScMarkData& rMark = GetViewData().GetMarkData(); #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT // #i94841# [Collaboration] if deleting rows is rejected, the content is sometimes wrong @@ -1523,7 +1523,7 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, bool bRecord ) pDocSh->GetDocFunc().DeleteCells( aRange, &rMark, eCmd, bRecord, false ); } - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); CellContentChanged(); ResetAutoSpell(); @@ -1536,8 +1536,8 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, bool bRecord ) } // put cursor directly behind deleted range - SCCOL nCurX = GetViewData()->GetCurX(); - SCROW nCurY = GetViewData()->GetCurY(); + SCCOL nCurX = GetViewData().GetCurX(); + SCROW nCurY = GetViewData().GetCurY(); if ( eCmd==DEL_CELLSLEFT || eCmd==DEL_DELCOLS ) nCurX = aRange.aStart.Col(); else @@ -1559,14 +1559,14 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, bool bRecord ) void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) { - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); ScDocShellModificator aModificator( *pDocSh ); - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocument* pDoc = pDocSh->GetDocument(); - ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, pDoc ); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocument& rDoc = pDocSh->GetDocument(); + ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered + ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); - if (!pDoc->IsUndoEnabled()) + if (!rDoc.IsUndoEnabled()) bRecord = false; std::vector<sc::ColRowSpan> aSpans; @@ -1577,7 +1577,7 @@ void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) if (aSpans.empty()) { - SCCOLROW nCurPos = bRows ? GetViewData()->GetCurY() : GetViewData()->GetCurX(); + SCCOLROW nCurPos = bRows ? GetViewData().GetCurY() : GetViewData().GetCurX(); aSpans.push_back(sc::ColRowSpan(nCurPos, nCurPos)); } @@ -1611,7 +1611,7 @@ void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) if (i == 0) { // test to the end of the sheet - ScEditableTester aTester( pDoc, nTab, nStartCol, nStartRow, MAXCOL, MAXROW ); + ScEditableTester aTester( &rDoc, nTab, nStartCol, nStartRow, MAXCOL, MAXROW ); if (!aTester.IsEditable()) nErrorId = aTester.GetMessageId(); } @@ -1621,8 +1621,8 @@ void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) SCROW nMergeStartY = nStartRow; SCCOL nMergeEndX = nEndCol; SCROW nMergeEndY = nEndRow; - pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab ); - pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab ); + rDoc.ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab ); + rDoc.ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab ); if ( nMergeStartX != nStartCol || nMergeStartY != nStartRow ) { @@ -1654,28 +1654,28 @@ void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) if (bRecord) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab, !bRows, bRows ); // row height + pUndoDoc->InitUndo( &rDoc, nTab, nTab, !bRows, bRows ); // row height for (size_t i = 0, n = aSpans.size(); i < n; ++i) { SCCOLROW nStart = aSpans[i].mnStart; SCCOLROW nEnd = aSpans[i].mnEnd; if (bRows) - pDoc->CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, IDF_ALL,false,pUndoDoc ); + rDoc.CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, IDF_ALL,false,pUndoDoc ); else - pDoc->CopyToDocument( static_cast<SCCOL>(nStart),0,nTab, + rDoc.CopyToDocument( static_cast<SCCOL>(nStart),0,nTab, static_cast<SCCOL>(nEnd),MAXROW,nTab, IDF_ALL,false,pUndoDoc ); } // all Formulas because of references - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); pUndoDoc->AddUndoTab( 0, nTabCount-1, false, false ); - pDoc->CopyToDocument( 0,0,0, MAXCOL,MAXROW,MAXTAB, IDF_FORMULA,false,pUndoDoc ); + rDoc.CopyToDocument( 0,0,0, MAXCOL,MAXROW,MAXTAB, IDF_FORMULA,false,pUndoDoc ); - pUndoData = new ScRefUndoData( pDoc ); + pUndoData = new ScRefUndoData( &rDoc ); - pDoc->BeginDrawUndo(); + rDoc.BeginDrawUndo(); } std::vector<sc::ColRowSpan>::const_reverse_iterator ri = aSpans.rbegin(), riEnd = aSpans.rend(); @@ -1685,9 +1685,9 @@ void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) SCCOLROW nStart = ri->mnStart; if (bRows) - pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, nStart, static_cast<SCSIZE>(nEnd-nStart+1) ); + rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, nStart, static_cast<SCSIZE>(nEnd-nStart+1) ); else - pDoc->DeleteCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) ); + rDoc.DeleteCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) ); } if (bNeedRefresh) @@ -1698,8 +1698,8 @@ void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) SCCOL nEndCol = MAXCOL; SCROW nEndRow = MAXROW; - pDoc->RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER ); - pDoc->ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true ); + rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER ); + rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true ); } if (bRecord) @@ -1731,8 +1731,8 @@ void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) CellContentChanged(); // put cursor directly behind the first deleted range - SCCOL nCurX = GetViewData()->GetCurX(); - SCROW nCurY = GetViewData()->GetCurY(); + SCCOL nCurX = GetViewData().GetCurX(); + SCROW nCurY = GetViewData().GetCurY(); if ( bRows ) nCurY = aSpans[0].mnStart; else @@ -1746,9 +1746,9 @@ void ScViewFunc::DeleteMulti( bool bRows, bool bRecord ) void ScViewFunc::DeleteContents( sal_uInt16 nFlags, bool bRecord ) { - ScViewData* pViewData = GetViewData(); - pViewData->SetPasteMode( SC_PASTE_NONE ); - pViewData->GetViewShell()->UpdateCopySourceOverlay(); + ScViewData& rViewData = GetViewData(); + rViewData.SetPasteMode( SC_PASTE_NONE ); + rViewData.GetViewShell()->UpdateCopySourceOverlay(); // not editable because of matrix only? attribute OK nonetheless bool bOnlyNotBecauseOfMatrix; @@ -1766,9 +1766,9 @@ void ScViewFunc::DeleteContents( sal_uInt16 nFlags, bool bRecord ) ScRange aMarkRange; bool bSimple = false; - ScDocument* pDoc = GetViewData()->GetDocument(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered + ScDocument* pDoc = GetViewData().GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered ScViewUtil::UnmarkFiltered( aFuncMark, pDoc ); if (bRecord && !pDoc->IsUndoEnabled()) @@ -1778,9 +1778,9 @@ void ScViewFunc::DeleteContents( sal_uInt16 nFlags, bool bRecord ) if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() ) { - aMarkRange.aStart.SetCol(GetViewData()->GetCurX()); - aMarkRange.aStart.SetRow(GetViewData()->GetCurY()); - aMarkRange.aStart.SetTab(GetViewData()->GetTabNo()); + aMarkRange.aStart.SetCol(GetViewData().GetCurX()); + aMarkRange.aStart.SetRow(GetViewData().GetCurY()); + aMarkRange.aStart.SetTab(GetViewData().GetTabNo()); aMarkRange.aEnd = aMarkRange.aStart; if ( pDoc->HasAttrib( aMarkRange, HASATTR_MERGED ) ) { @@ -1919,7 +1919,7 @@ void ScViewFunc::DeleteContents( sal_uInt16 nFlags, bool bRecord ) if (!AdjustRowHeight( aExtendedRange.aStart.Row(), aExtendedRange.aEnd.Row() )) pDocSh->PostPaint( aExtendedRange, PAINT_GRID, nExtFlags ); - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); if (ScModelObj *pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh)) { @@ -1959,14 +1959,14 @@ void ScViewFunc::SetWidthOrHeight( // use view's mark if none specified if ( !pMarkData ) - pMarkData = &GetViewData()->GetMarkData(); + pMarkData = &GetViewData().GetMarkData(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nFirstTab = pMarkData->GetFirstSelected(); - SCTAB nCurTab = GetViewData()->GetTabNo(); + SCTAB nCurTab = GetViewData().GetTabNo(); SCTAB nTab; - if (bRecord && !pDoc->IsUndoEnabled()) + if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; ScDocShellModificator aModificator( *pDocSh ); @@ -1980,13 +1980,13 @@ void ScViewFunc::SetWidthOrHeight( bool bOnlyMatrix; if (bWidth) { - bAllowed = pDoc->IsBlockEditable( + bAllowed = rDoc.IsBlockEditable( *itr, rRanges[i].mnStart, 0, rRanges[i].mnEnd, MAXROW, &bOnlyMatrix ) || bOnlyMatrix; } else { - bAllowed = pDoc->IsBlockEditable( + bAllowed = rDoc.IsBlockEditable( *itr, 0, rRanges[i].mnStart, MAXCOL,rRanges[i].mnEnd, &bOnlyMatrix) || bOnlyMatrix; } } @@ -2006,7 +2006,7 @@ void ScViewFunc::SetWidthOrHeight( bool bFormula = false; if ( eMode == SC_SIZE_OPTIMAL ) { - const ScViewOptions& rOpts = GetViewData()->GetOptions(); + const ScViewOptions& rOpts = GetViewData().GetOptions(); bFormula = rOpts.GetOption( VOPT_FORMULAS ); } @@ -2016,7 +2016,7 @@ void ScViewFunc::SetWidthOrHeight( if ( bRecord ) { - pDoc->BeginDrawUndo(); // Drawing Updates + rDoc.BeginDrawUndo(); // Drawing Updates pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); itr = pMarkData->begin(); @@ -2025,27 +2025,27 @@ void ScViewFunc::SetWidthOrHeight( if (bWidth) { if ( *itr == nFirstTab ) - pUndoDoc->InitUndo( pDoc, *itr, *itr, true, false ); + pUndoDoc->InitUndo( &rDoc, *itr, *itr, true, false ); else pUndoDoc->AddUndoTab( *itr, *itr, true, false ); - pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, *itr, + rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, *itr, static_cast<SCCOL>(nEnd), MAXROW, *itr, IDF_NONE, false, pUndoDoc ); } else { if ( *itr == nFirstTab ) - pUndoDoc->InitUndo( pDoc, *itr, *itr, false, true ); + pUndoDoc->InitUndo( &rDoc, *itr, *itr, false, true ); else pUndoDoc->AddUndoTab( *itr, *itr, false, true ); - pDoc->CopyToDocument( 0, nStart, *itr, MAXCOL, nEnd, *itr, IDF_NONE, false, pUndoDoc ); + rDoc.CopyToDocument( 0, nStart, *itr, MAXCOL, nEnd, *itr, IDF_NONE, false, pUndoDoc ); } } aUndoRanges = rRanges; //! outlines from all tab? - ScOutlineTable* pTable = pDoc->GetOutlineTable( nCurTab ); + ScOutlineTable* pTable = rDoc.GetOutlineTable( nCurTab ); if (pTable) pUndoTab = new ScOutlineTable( *pTable ); } @@ -2078,22 +2078,22 @@ void ScViewFunc::SetWidthOrHeight( for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow) { SCROW nLastRow = nRow; - if (pDoc->RowHidden(nRow, nTab, NULL, &nLastRow)) + if (rDoc.RowHidden(nRow, nTab, NULL, &nLastRow)) { nRow = nLastRow; continue; } - sal_uInt8 nOld = pDoc->GetRowFlags(nRow, nTab); + sal_uInt8 nOld = rDoc.GetRowFlags(nRow, nTab); if (nOld & CR_MANUALSIZE) - pDoc->SetRowFlags(nRow, nTab, nOld & ~CR_MANUALSIZE); + rDoc.SetRowFlags(nRow, nTab, nOld & ~CR_MANUALSIZE); } } - double nPPTX = GetViewData()->GetPPTX(); - double nPPTY = GetViewData()->GetPPTY(); - Fraction aZoomX = GetViewData()->GetZoomX(); - Fraction aZoomY = GetViewData()->GetZoomY(); + double nPPTX = GetViewData().GetPPTX(); + double nPPTY = GetViewData().GetPPTY(); + Fraction aZoomX = GetViewData().GetZoomX(); + Fraction aZoomY = GetViewData().GetZoomY(); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) @@ -2106,9 +2106,9 @@ void ScViewFunc::SetWidthOrHeight( sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice()); aCxt.setForceAutoSize(bAll); aCxt.setExtraHeight(nSizeTwips); - pDoc->SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab); + rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab); if (bAll) - pDoc->ShowRows( nStartNo, nEndNo, nTab, true ); + rDoc.ShowRows( nStartNo, nEndNo, nTab, true ); // Manual-Flag already (re)set in SetOptimalHeight in case of bAll=sal_True // (set for Extra-Height, else reset). @@ -2117,30 +2117,30 @@ void ScViewFunc::SetWidthOrHeight( { if (nSizeTwips) { - pDoc->SetRowHeightRange( nStartNo, nEndNo, nTab, nSizeTwips ); - pDoc->SetManualHeight( nStartNo, nEndNo, nTab, true ); // height was set manually + rDoc.SetRowHeightRange( nStartNo, nEndNo, nTab, nSizeTwips ); + rDoc.SetManualHeight( nStartNo, nEndNo, nTab, true ); // height was set manually } - pDoc->ShowRows( nStartNo, nEndNo, nTab, nSizeTwips != 0 ); + rDoc.ShowRows( nStartNo, nEndNo, nTab, nSizeTwips != 0 ); } else if ( eMode==SC_SIZE_SHOW ) { - pDoc->ShowRows( nStartNo, nEndNo, nTab, true ); + rDoc.ShowRows( nStartNo, nEndNo, nTab, true ); } } else // column width { for (SCCOL nCol=static_cast<SCCOL>(nStartNo); nCol<=static_cast<SCCOL>(nEndNo); nCol++) { - if ( eMode != SC_SIZE_VISOPT || !pDoc->ColHidden(nCol, nTab) ) + if ( eMode != SC_SIZE_VISOPT || !rDoc.ColHidden(nCol, nTab) ) { sal_uInt16 nThisSize = nSizeTwips; if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT ) nThisSize = nSizeTwips + GetOptimalColWidth( nCol, nTab, bFormula ); if ( nThisSize ) - pDoc->SetColWidth( nCol, nTab, nThisSize ); + rDoc.SetColWidth( nCol, nTab, nThisSize ); - pDoc->ShowCol( nCol, nTab, bShow ); + rDoc.ShowCol( nCol, nTab, bShow ); } } } @@ -2149,17 +2149,17 @@ void ScViewFunc::SetWidthOrHeight( if (bWidth) { - if ( pDoc->UpdateOutlineCol( static_cast<SCCOL>(nStartNo), + if ( rDoc.UpdateOutlineCol( static_cast<SCCOL>(nStartNo), static_cast<SCCOL>(nEndNo), nTab, bShow ) ) bOutline = true; } else { - if ( pDoc->UpdateOutlineRow( nStartNo, nEndNo, nTab, bShow ) ) + if ( rDoc.UpdateOutlineRow( nStartNo, nEndNo, nTab, bShow ) ) bOutline = true; } } - pDoc->SetDrawPageSize(nTab); + rDoc.SetDrawPageSize(nTab); } @@ -2176,13 +2176,13 @@ void ScViewFunc::SetWidthOrHeight( // fdo#36247 Ensure that the drawing layer's map mode scaling factors match // the new heights and widths. - GetViewData()->GetView()->RefreshZoom(); + GetViewData().GetView()->RefreshZoom(); itr = pMarkData->begin(); for (; itr != itrEnd; ++itr) - pDoc->UpdatePageBreaks( *itr ); + rDoc.UpdatePageBreaks( *itr ); - GetViewData()->GetView()->UpdateScrollBars(); + GetViewData().GetView()->UpdateScrollBars(); if (bPaint) { @@ -2192,7 +2192,7 @@ void ScViewFunc::SetWidthOrHeight( nTab = *itr; if (bWidth) { - if (pDoc->HasAttrib( static_cast<SCCOL>(nStart),0,nTab, + if (rDoc.HasAttrib( static_cast<SCCOL>(nStart),0,nTab, static_cast<SCCOL>(nEnd),MAXROW,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED )) nStart = 0; @@ -2203,7 +2203,7 @@ void ScViewFunc::SetWidthOrHeight( } else { - if (pDoc->HasAttrib( 0,nStart,nTab, MAXCOL,nEnd,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED )) + if (rDoc.HasAttrib( 0,nStart,nTab, MAXCOL,nEnd,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED )) nStart = 0; if (nStart != 0) --nStart; @@ -2211,7 +2211,7 @@ void ScViewFunc::SetWidthOrHeight( } } - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); if( !pDocSh->IsReadOnly() ) aModificator.SetDocumentModified(); } @@ -2245,14 +2245,14 @@ void ScViewFunc::SetWidthOrHeight( void ScViewFunc::SetMarkedWidthOrHeight( bool bWidth, ScSizeMode eMode, sal_uInt16 nSizeTwips, bool bRecord, bool bPaint ) { - ScMarkData& rMark = GetViewData()->GetMarkData(); + ScMarkData& rMark = GetViewData().GetMarkData(); rMark.MarkToMulti(); if (!rMark.IsMultiMarked()) { - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); DoneBlockMode(); InitOwnBlockMode(); rMark.SetMultiMarkArea( ScRange( nCol,nRow,nTab ), true ); @@ -2276,17 +2276,17 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) ScModule* pScMod = SC_MOD(); bool bAnyEdit = pScMod->IsInputMode(); - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); bool bAllowed, bOnlyMatrix; if ( eDir == DIR_LEFT || eDir == DIR_RIGHT ) - bAllowed = pDoc->IsBlockEditable( nTab, nCol,0, nCol,MAXROW, &bOnlyMatrix ); + bAllowed = rDoc.IsBlockEditable( nTab, nCol,0, nCol,MAXROW, &bOnlyMatrix ); else - bAllowed = pDoc->IsBlockEditable( nTab, 0,nRow, MAXCOL,nRow, &bOnlyMatrix ); + bAllowed = rDoc.IsBlockEditable( nTab, 0,nRow, MAXCOL,nRow, &bOnlyMatrix ); if ( !bAllowed && !bOnlyMatrix ) { ErrorMessage(STR_PROTECTIONERR); @@ -2295,8 +2295,8 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) HideAllCursors(); - sal_uInt16 nWidth = pDoc->GetColWidth( nCol, nTab ); - sal_uInt16 nHeight = pDoc->GetRowHeight( nRow, nTab ); + sal_uInt16 nWidth = rDoc.GetColWidth( nCol, nTab ); + sal_uInt16 nHeight = rDoc.GetRowHeight( nRow, nTab ); std::vector<sc::ColRowSpan> aRange(1, sc::ColRowSpan(0,0)); if ( eDir == DIR_LEFT || eDir == DIR_RIGHT ) { @@ -2305,12 +2305,12 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) if ( bAnyEdit ) { // when editing the actual entered width - ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData()->GetViewShell() ); + ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData().GetViewShell() ); if (pHdl) { long nEdit = pHdl->GetTextSize().Width(); // in 0.01 mm - const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab ); + const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab ); const SvxMarginItem& rMItem = (const SvxMarginItem&)pPattern->GetItem(ATTR_MARGIN); sal_uInt16 nMargin = rMItem.GetLeftMargin() + rMItem.GetRightMargin(); @@ -2325,10 +2325,10 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) } else { - double nPPTX = GetViewData()->GetPPTX(); - double nPPTY = GetViewData()->GetPPTY(); - Fraction aZoomX = GetViewData()->GetZoomX(); - Fraction aZoomY = GetViewData()->GetZoomY(); + double nPPTX = GetViewData().GetPPTX(); + double nPPTY = GetViewData().GetPPTY(); + Fraction aZoomX = GetViewData().GetZoomX(); + Fraction aZoomY = GetViewData().GetZoomY(); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) @@ -2338,7 +2338,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) aZoomX = aZoomY = Fraction( 1, 1 ); } - long nPixel = pDoc->GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(), + long nPixel = rDoc.GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(), nPPTX, nPPTY, aZoomX, aZoomY, true ); sal_uInt16 nTwips = (sal_uInt16)( nPixel / nPPTX ); if (nTwips != 0) @@ -2364,7 +2364,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) if (!bAnyEdit) { - const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab ); + const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab ); bool bNeedHeight = ((const SfxBoolItem&)pPattern->GetItem( ATTR_LINEBREAK )).GetValue() || ((const SvxHorJustifyItem&)pPattern-> @@ -2399,9 +2399,9 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) if ( bAnyEdit ) { UpdateEditView(); - if ( pDoc->HasAttrib( nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_NEEDHEIGHT ) ) + if ( rDoc.HasAttrib( nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_NEEDHEIGHT ) ) { - ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData()->GetViewShell() ); + ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData().GetViewShell() ); if (pHdl) pHdl->SetModified(); // so that the height is adjusted with Enter } @@ -2415,11 +2415,11 @@ void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect ) if (nTab == TABLEID_DOC) return; - ScMarkData& rMark = GetViewData()->GetMarkData(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); ScDocFunc &rFunc = pDocSh->GetDocFunc(); - bool bUndo(pDoc->IsUndoEnabled()); + bool bUndo(rDoc.IsUndoEnabled()); // modifying several tabs is handled here @@ -2441,11 +2441,11 @@ void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect ) void ScViewFunc::Protect( SCTAB nTab, const OUString& rPassword ) { - ScMarkData& rMark = GetViewData()->GetMarkData(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); ScDocFunc &rFunc = pDocSh->GetDocFunc(); - bool bUndo(pDoc->IsUndoEnabled()); + bool bUndo(rDoc.IsUndoEnabled()); if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 ) rFunc.Protect( nTab, rPassword, false ); @@ -2472,12 +2472,12 @@ void ScViewFunc::Protect( SCTAB nTab, const OUString& rPassword ) bool ScViewFunc::Unprotect( SCTAB nTab, const OUString& rPassword ) { - ScMarkData& rMark = GetViewData()->GetMarkData(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScMarkData& rMark = GetViewData().GetMarkData(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); ScDocFunc &rFunc = pDocSh->GetDocFunc(); bool bChanged = false; - bool bUndo (pDoc->IsUndoEnabled()); + bool bUndo (rDoc.IsUndoEnabled()); if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 ) bChanged = rFunc.Unprotect( nTab, rPassword, false ); @@ -2508,12 +2508,12 @@ bool ScViewFunc::Unprotect( SCTAB nTab, const OUString& rPassword ) void ScViewFunc::SetNoteText( const ScAddress& rPos, const OUString& rNoteText ) { - GetViewData()->GetDocShell()->GetDocFunc().SetNoteText( rPos, rNoteText, false ); + GetViewData().GetDocShell()->GetDocFunc().SetNoteText( rPos, rNoteText, false ); } void ScViewFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, const OUString* pAuthor, const OUString* pDate ) { - GetViewData()->GetDocShell()->GetDocFunc().ReplaceNote( rPos, rNoteText, pAuthor, pDate, false ); + GetViewData().GetDocShell()->GetDocFunc().ReplaceNote( rPos, rNoteText, pAuthor, pDate, false ); } void ScViewFunc::SetNumberFormat( short nFormatType, sal_uLong nAdd ) @@ -2527,8 +2527,8 @@ void ScViewFunc::SetNumberFormat( short nFormatType, sal_uLong nAdd ) } sal_uInt32 nNumberFormat = 0; - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); LanguageType eLanguage = ScGlobal::eLnge; ScPatternAttr aNewAttrs( pDoc->GetPool() ); @@ -2536,9 +2536,9 @@ void ScViewFunc::SetNumberFormat( short nFormatType, sal_uLong nAdd ) // always take language from cursor position, even if there is a selection sal_uInt32 nCurrentNumberFormat; - pDoc->GetNumberFormat( pViewData->GetCurX(), - pViewData->GetCurY(), - pViewData->GetTabNo(), + pDoc->GetNumberFormat( rViewData.GetCurX(), + rViewData.GetCurY(), + rViewData.GetTabNo(), nCurrentNumberFormat ); const SvNumberformat* pEntry = pNumberFormatter->GetEntry( nCurrentNumberFormat ); if (pEntry) @@ -2562,15 +2562,15 @@ void ScViewFunc::SetNumFmtByStr( const OUString& rCode ) return; } - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); + ScViewData& rViewData = GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); // language always from cursor position sal_uInt32 nCurrentNumberFormat; - pDoc->GetNumberFormat( pViewData->GetCurX(), pViewData->GetCurY(), - pViewData->GetTabNo(), nCurrentNumberFormat ); + pDoc->GetNumberFormat( rViewData.GetCurX(), rViewData.GetCurY(), + rViewData.GetTabNo(), nCurrentNumberFormat ); const SvNumberformat* pEntry = pFormatter->GetEntry( nCurrentNumberFormat ); LanguageType eLanguage = pEntry ? pEntry->GetLanguage() : ScGlobal::eLnge; @@ -2610,12 +2610,12 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement ) return; } - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = GetViewData().GetDocument(); SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - SCCOL nCol = GetViewData()->GetCurX(); - SCROW nRow = GetViewData()->GetCurY(); - SCTAB nTab = GetViewData()->GetTabNo(); + SCCOL nCol = GetViewData().GetCurX(); + SCROW nRow = GetViewData().GetCurY(); + SCTAB nTab = GetViewData().GetTabNo(); sal_uInt32 nOldFormat; pDoc->GetNumberFormat( nCol, nRow, nTab, nOldFormat ); @@ -2721,29 +2721,29 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement ) void ScViewFunc::ChangeIndent( bool bIncrement ) { - ScViewData* pViewData = GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScMarkData& rMark = pViewData->GetMarkData(); + ScViewData& rViewData = GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + ScMarkData& rMark = rViewData.GetMarkData(); ScMarkData aWorkMark = rMark; - ScViewUtil::UnmarkFiltered( aWorkMark, pDocSh->GetDocument() ); + ScViewUtil::UnmarkFiltered( aWorkMark, &pDocSh->GetDocument() ); aWorkMark.MarkToMulti(); if (!aWorkMark.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(); aWorkMark.SetMultiMarkArea( ScRange(nCol,nRow,nTab) ); } bool bSuccess = pDocSh->GetDocFunc().ChangeIndent( aWorkMark, bIncrement, false ); if (bSuccess) { - pDocSh->UpdateOle(pViewData); + pDocSh->UpdateOle(&rViewData); StartFormatArea(); // stuff for sidebar panels - SfxBindings& rBindings = GetViewData()->GetBindings(); + SfxBindings& rBindings = GetViewData().GetBindings(); rBindings.Invalidate( SID_H_ALIGNCELL ); rBindings.Invalidate( SID_ATTR_ALIGN_INDENT ); } @@ -2756,14 +2756,14 @@ bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol, //! undo... bool bOk = false; - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); - ScRangeName* pList = pDoc->GetRangeName(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); + ScRangeName* pList = rDoc.GetRangeName(); RangeType nType = RT_NAME; - ScRangeData* pNewEntry = new ScRangeData( pDoc, rName, rSymbol, - ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), + ScRangeData* pNewEntry = new ScRangeData( &rDoc, rName, rSymbol, + ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), nTab), nType ); OUString aUpType = rType.toAsciiUpperCase(); if ( aUpType.indexOf( 'P' ) != -1 ) @@ -2780,7 +2780,7 @@ bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol, { ScDocShellModificator aModificator( *pDocSh ); - pDoc->PreprocessRangeNameUpdate(); + rDoc.PreprocessRangeNameUpdate(); // input available yet? Then remove beforehand (=change) ScRangeData* pData = pList->findByUpperName(ScGlobal::pCharClass->uppercase(rName)); @@ -2794,7 +2794,7 @@ bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol, bOk = true; pNewEntry = NULL; // never delete, insert took ownership - pDoc->PostprocessRangeNameUpdate(); + rDoc.PostprocessRangeNameUpdate(); aModificator.SetDocumentModified(); SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); @@ -2808,8 +2808,8 @@ void ScViewFunc::CreateNames( sal_uInt16 nFlags ) { bool bDone = false; ScRange aRange; - if ( GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE ) - bDone = GetViewData()->GetDocShell()->GetDocFunc().CreateNames( aRange, nFlags, false ); + if ( GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE ) + bDone = GetViewData().GetDocShell()->GetDocFunc().CreateNames( aRange, nFlags, false ); if (!bDone) ErrorMessage(STR_CREATENAME_MARKERR); @@ -2822,10 +2822,10 @@ sal_uInt16 ScViewFunc::GetCreateNameFlags() SCCOL nStartCol, nEndCol; SCROW nStartRow, nEndRow; SCTAB nDummy; - if (GetViewData()->GetSimpleArea(nStartCol,nStartRow,nDummy,nEndCol,nEndRow,nDummy) == SC_MARK_SIMPLE) + if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nDummy,nEndCol,nEndRow,nDummy) == SC_MARK_SIMPLE) { - ScDocument* pDoc = GetViewData()->GetDocument(); - SCTAB nTab = GetViewData()->GetTabNo(); + ScDocument* pDoc = GetViewData().GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); bool bOk; SCCOL i; SCROW j; @@ -2879,15 +2879,15 @@ sal_uInt16 ScViewFunc::GetCreateNameFlags() void ScViewFunc::InsertNameList() { - ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); + ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ); + ScDocShell* pDocSh = GetViewData().GetDocShell(); if ( pDocSh->GetDocFunc().InsertNameList( aPos, false ) ) - pDocSh->UpdateOle(GetViewData()); + pDocSh->UpdateOle(&GetViewData()); } void ScViewFunc::UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* pAttr ) { - ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScDocShell* pDocShell = GetViewData().GetDocShell(); ScRange aMarkRange; if (rSel.IsMultiMarked() ) rSel.GetMultiMarkArea( aMarkRange ); @@ -2919,7 +2919,7 @@ void ScViewFunc::UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* pAt pDocShell->PostPaint( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab, PAINT_GRID, nExtFlags | SC_PF_TESTMERGE ); - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); pTabViewShell->CellContentChanged(); pTabViewShell->AdjustBlockHeight(false, const_cast<ScMarkData*>(&rSel)); } |