summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx12
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx77
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx20
-rw-r--r--sc/source/ui/Accessibility/AccessiblePageHeader.cxx31
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewCell.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewTable.cxx12
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx112
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx97
-rw-r--r--sc/source/ui/app/client.cxx6
-rw-r--r--sc/source/ui/app/drwtrans.cxx21
-rw-r--r--sc/source/ui/app/inputhdl.cxx120
-rw-r--r--sc/source/ui/app/inputwin.cxx82
-rw-r--r--sc/source/ui/app/scmod.cxx70
-rw-r--r--sc/source/ui/app/seltrans.cxx20
-rw-r--r--sc/source/ui/app/transobj.cxx46
-rw-r--r--sc/source/ui/dbgui/consdlg.cxx12
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx2
-rw-r--r--sc/source/ui/dbgui/scuiimoptdlg.cxx2
-rw-r--r--sc/source/ui/docshell/arealink.cxx60
-rw-r--r--sc/source/ui/docshell/datastream.cxx7
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx302
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx66
-rw-r--r--sc/source/ui/docshell/docfunc.cxx1056
-rw-r--r--sc/source/ui/docshell/docsh.cxx42
-rw-r--r--sc/source/ui/docshell/docsh3.cxx10
-rw-r--r--sc/source/ui/docshell/docsh4.cxx127
-rw-r--r--sc/source/ui/docshell/docsh5.cxx20
-rw-r--r--sc/source/ui/docshell/docsh6.cxx4
-rw-r--r--sc/source/ui/docshell/docsh8.cxx14
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx36
-rw-r--r--sc/source/ui/docshell/olinefun.cxx259
-rw-r--r--sc/source/ui/docshell/servobj.cxx26
-rw-r--r--sc/source/ui/docshell/tablink.cxx93
-rw-r--r--sc/source/ui/drawfunc/drawsh5.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuconstr.cxx20
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx12
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx12
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx60
-rw-r--r--sc/source/ui/drawfunc/fupoor.cxx10
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx14
-rw-r--r--sc/source/ui/drawfunc/fusel2.cxx12
-rw-r--r--sc/source/ui/drawfunc/futext.cxx12
-rw-r--r--sc/source/ui/drawfunc/futext2.cxx4
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx2
-rw-r--r--sc/source/ui/formdlg/formula.cxx8
-rw-r--r--sc/source/ui/inc/consdlg.hxx2
-rw-r--r--sc/source/ui/inc/datastream.hxx1
-rw-r--r--sc/source/ui/inc/docsh.hxx2
-rw-r--r--sc/source/ui/inc/optsolver.hxx2
-rw-r--r--sc/source/ui/inc/prevwsh.hxx2
-rw-r--r--sc/source/ui/inc/tabview.hxx6
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx4
-rw-r--r--sc/source/ui/miscdlgs/datafdlg.cxx16
-rw-r--r--sc/source/ui/miscdlgs/datastreamdlg.cxx8
-rw-r--r--sc/source/ui/miscdlgs/instbdlg.cxx2
-rw-r--r--sc/source/ui/miscdlgs/linkarea.cxx2
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx2
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx22
-rw-r--r--sc/source/ui/miscdlgs/redcom.cxx16
-rw-r--r--sc/source/ui/namedlg/namepast.cxx4
-rw-r--r--sc/source/ui/navipi/content.cxx24
-rw-r--r--sc/source/ui/navipi/navipi.cxx4
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx2
-rw-r--r--sc/source/ui/optdlg/tpview.cxx2
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx4
-rw-r--r--sc/source/ui/pagedlg/tphf.cxx6
-rw-r--r--sc/source/ui/undo/undobase.cxx92
-rw-r--r--sc/source/ui/undo/undoblk.cxx332
-rw-r--r--sc/source/ui/undo/undoblk2.cxx22
-rw-r--r--sc/source/ui/undo/undoblk3.cxx296
-rw-r--r--sc/source/ui/undo/undocell.cxx130
-rw-r--r--sc/source/ui/undo/undocell2.cxx4
-rw-r--r--sc/source/ui/undo/undodat.cxx366
-rw-r--r--sc/source/ui/undo/undorangename.cxx14
-rw-r--r--sc/source/ui/undo/undostyl.cxx20
-rw-r--r--sc/source/ui/undo/undotab.cxx266
-rw-r--r--sc/source/ui/undo/undoutil.cxx4
-rw-r--r--sc/source/ui/unoobj/addruno.cxx20
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx768
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx82
-rw-r--r--sc/source/ui/unoobj/confuno.cxx550
-rw-r--r--sc/source/ui/unoobj/cursuno.cxx24
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx46
-rw-r--r--sc/source/ui/unoobj/datauno.cxx68
-rw-r--r--sc/source/ui/unoobj/defltuno.cxx88
-rw-r--r--sc/source/ui/unoobj/dispuno.cxx6
-rw-r--r--sc/source/ui/unoobj/docuno.cxx288
-rw-r--r--sc/source/ui/unoobj/drdefuno.cxx6
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx10
-rw-r--r--sc/source/ui/unoobj/eventuno.cxx10
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx4
-rw-r--r--sc/source/ui/unoobj/forbiuno.cxx12
-rw-r--r--sc/source/ui/unoobj/linkuno.cxx213
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx130
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx6
-rw-r--r--sc/source/ui/unoobj/servuno.cxx44
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx84
-rw-r--r--sc/source/ui/unoobj/targuno.cxx8
-rw-r--r--sc/source/ui/unoobj/textuno.cxx22
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx34
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx262
-rw-r--r--sc/source/ui/vba/excelvbahelper.cxx18
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx26
-rw-r--r--sc/source/ui/vba/vbachart.cxx10
-rw-r--r--sc/source/ui/vba/vbaeventshelper.cxx2
-rw-r--r--sc/source/ui/vba/vbaname.cxx4
-rw-r--r--sc/source/ui/vba/vbanames.cxx6
-rw-r--r--sc/source/ui/vba/vbapagesetup.cxx4
-rw-r--r--sc/source/ui/vba/vbarange.cxx157
-rw-r--r--sc/source/ui/vba/vbarange.hxx2
-rw-r--r--sc/source/ui/vba/vbatextboxshape.cxx2
-rw-r--r--sc/source/ui/vba/vbawindow.cxx30
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx10
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx30
-rw-r--r--sc/source/ui/vba/vbaworksheets.cxx4
-rw-r--r--sc/source/ui/view/cellsh.cxx16
-rw-r--r--sc/source/ui/view/cellsh2.cxx16
-rw-r--r--sc/source/ui/view/dbfunc.cxx94
-rw-r--r--sc/source/ui/view/dbfunc2.cxx10
-rw-r--r--sc/source/ui/view/dbfunc3.cxx254
-rw-r--r--sc/source/ui/view/drawvie4.cxx4
-rw-r--r--sc/source/ui/view/formatsh.cxx78
-rw-r--r--sc/source/ui/view/gridwin.cxx48
-rw-r--r--sc/source/ui/view/gridwin2.cxx18
-rw-r--r--sc/source/ui/view/gridwin4.cxx30
-rw-r--r--sc/source/ui/view/hdrcont.cxx14
-rw-r--r--sc/source/ui/view/olinewin.cxx2
-rw-r--r--sc/source/ui/view/pfuncache.cxx18
-rw-r--r--sc/source/ui/view/pgbrksh.cxx6
-rw-r--r--sc/source/ui/view/pivotsh.cxx24
-rw-r--r--sc/source/ui/view/preview.cxx66
-rw-r--r--sc/source/ui/view/prevwsh.cxx32
-rw-r--r--sc/source/ui/view/prevwsh2.cxx2
-rw-r--r--sc/source/ui/view/printfun.cxx2
-rw-r--r--sc/source/ui/view/reffact.cxx4
-rw-r--r--sc/source/ui/view/select.cxx2
-rw-r--r--sc/source/ui/view/spelldialog.cxx4
-rw-r--r--sc/source/ui/view/spelleng.cxx2
-rw-r--r--sc/source/ui/view/tabcont.cxx6
-rw-r--r--sc/source/ui/view/tabview.cxx12
-rw-r--r--sc/source/ui/view/tabview2.cxx4
-rw-r--r--sc/source/ui/view/tabview3.cxx6
-rw-r--r--sc/source/ui/view/tabvwsh.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh2.cxx8
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx70
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx192
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx42
-rw-r--r--sc/source/ui/view/tabvwsh8.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh9.cxx2
-rw-r--r--sc/source/ui/view/tabvwsha.cxx127
-rw-r--r--sc/source/ui/view/tabvwshb.cxx24
-rw-r--r--sc/source/ui/view/tabvwshc.cxx116
-rw-r--r--sc/source/ui/view/tabvwshd.cxx2
-rw-r--r--sc/source/ui/view/tabvwshe.cxx26
-rw-r--r--sc/source/ui/view/tabvwshf.cxx76
-rw-r--r--sc/source/ui/view/tabvwshg.cxx8
-rw-r--r--sc/source/ui/view/tabvwshh.cxx8
-rw-r--r--sc/source/ui/view/viewdata.cxx4
-rw-r--r--sc/source/ui/view/viewfun2.cxx532
-rw-r--r--sc/source/ui/view/viewfun3.cxx116
-rw-r--r--sc/source/ui/view/viewfun4.cxx154
-rw-r--r--sc/source/ui/view/viewfun5.cxx44
-rw-r--r--sc/source/ui/view/viewfun6.cxx90
-rw-r--r--sc/source/ui/view/viewfun7.cxx42
-rw-r--r--sc/source/ui/view/viewfunc.cxx598
165 files changed, 5371 insertions, 5493 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index fdfb27a4b89a..8022fa6d6893 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -173,10 +173,10 @@ Rectangle ScAccessibleCell::GetBoundingBox() const
if (mpViewShell)
{
long nSizeX, nSizeY;
- mpViewShell->GetViewData()->GetMergeSizePixel(
+ mpViewShell->GetViewData().GetMergeSizePixel(
maCellAddress.Col(), maCellAddress.Row(), nSizeX, nSizeY);
aCellRect.SetSize(Size(nSizeX, nSizeY));
- aCellRect.SetPos(mpViewShell->GetViewData()->GetScrPos(maCellAddress.Col(), maCellAddress.Row(), meSplitPos, true));
+ aCellRect.SetPos(mpViewShell->GetViewData().GetScrPos(maCellAddress.Col(), maCellAddress.Row(), meSplitPos, true));
Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
if (pWindow)
@@ -373,9 +373,9 @@ bool ScAccessibleCell::IsSelected()
}
bool bResult(false);
- if (mpViewShell && mpViewShell->GetViewData())
+ if (mpViewShell)
{
- const ScMarkData& rMarkdata = mpViewShell->GetViewData()->GetMarkData();
+ const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
bResult = rMarkdata.IsCellMarked(maCellAddress.Col(), maCellAddress.Row());
}
return bResult;
@@ -384,8 +384,8 @@ bool ScAccessibleCell::IsSelected()
ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell)
{
ScDocument* pDoc = NULL;
- if (pViewShell && pViewShell->GetViewData())
- pDoc = pViewShell->GetViewData()->GetDocument();
+ if (pViewShell)
+ pDoc = pViewShell->GetViewData().GetDocument();
return pDoc;
}
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 3c48184dcfb3..981822210371 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -358,14 +358,14 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* pAccessibleDocument, Sc
}
if (pViewShell)
{
- ScViewData *pViewData = pViewShell->GetViewData();
- SfxBroadcaster* pDrawBC = pViewData ? pViewData->GetDocument()->GetDrawBroadcaster() : NULL;
+ ScViewData& rViewData = pViewShell->GetViewData();
+ SfxBroadcaster* pDrawBC = rViewData.GetDocument()->GetDrawBroadcaster();
if (pDrawBC)
{
StartListening(*pDrawBC);
- maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(pViewData->GetDocument()->GetDrawLayer()) );
- maShapeTreeInfo.SetSdrView(pViewData->GetScDrawView());
+ maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument()->GetDrawLayer()) );
+ maShapeTreeInfo.SetSdrView(rViewData.GetScDrawView());
maShapeTreeInfo.SetController(NULL);
maShapeTreeInfo.SetWindow(pViewShell->GetWindowByPos(meSplitPos));
maShapeTreeInfo.SetViewForwarder(mpAccessibleDocument);
@@ -378,8 +378,7 @@ ScChildrenShapes::~ScChildrenShapes()
std::for_each(maZOrderedShapes.begin(), maZOrderedShapes.end(), Destroy());
if (mpViewShell)
{
- ScViewData *pViewData = mpViewShell->GetViewData();
- SfxBroadcaster* pDrawBC = pViewData ? pViewData->GetDocument()->GetDrawBroadcaster() : NULL;
+ SfxBroadcaster* pDrawBC = mpViewShell->GetViewData().GetDocument()->GetDrawBroadcaster();
if (pDrawBC)
EndListening(*pDrawBC);
}
@@ -389,14 +388,14 @@ void ScChildrenShapes::SetDrawBroadcaster()
{
if (mpViewShell)
{
- ScViewData *pViewData = mpViewShell->GetViewData();
- SfxBroadcaster* pDrawBC = pViewData ? pViewData->GetDocument()->GetDrawBroadcaster() : NULL;
+ ScViewData& rViewData = mpViewShell->GetViewData();
+ SfxBroadcaster* pDrawBC = rViewData.GetDocument()->GetDrawBroadcaster();
if (pDrawBC)
{
StartListening(*pDrawBC, true);
- maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(pViewData->GetDocument()->GetDrawLayer()) );
- maShapeTreeInfo.SetSdrView(pViewData->GetScDrawView());
+ maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument()->GetDrawLayer()) );
+ maShapeTreeInfo.SetSdrView(rViewData.GetScDrawView());
maShapeTreeInfo.SetController(NULL);
maShapeTreeInfo.SetWindow(mpViewShell->GetWindowByPos(meSplitPos));
maShapeTreeInfo.SetViewForwarder(mpAccessibleDocument);
@@ -892,8 +891,8 @@ SdrPage* ScChildrenShapes::GetDrawPage() const
SdrPage* pDrawPage = NULL;
if (mpViewShell)
{
- ScViewData *pViewData = mpViewShell->GetViewData();
- ScDocument* pDoc = pViewData ? pViewData->GetDocument() : NULL;
+ ScViewData& rViewData = mpViewShell->GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
if (pDoc && pDoc->GetDrawLayer())
{
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
@@ -1049,8 +1048,7 @@ bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawing::X
bool bIsFocuseMarked = true;
if( mpViewShell && mnShapesSelected == 1 && bWinFocus)
{
- ScViewData *pViewData = mpViewShell->GetViewData();
- ScDrawView* pScDrawView = pViewData ? pViewData->GetScDrawView() : NULL;
+ ScDrawView* pScDrawView = mpViewShell->GetViewData().GetScDrawView();
if( pScDrawView )
{
if( pScDrawView->GetMarkedObjectList().GetMarkCount() == 1 )
@@ -1431,10 +1429,10 @@ ScAccessibleDocument::ScAccessibleDocument(
AddChild( pChildWin->GetAccessible(), false );
}
}
- ScViewData *pViewData = pViewShell->GetViewData();
- if (pViewData && pViewData->HasEditView(eSplitPos))
+ ScViewData& rViewData = pViewShell->GetViewData();
+ if (rViewData.HasEditView(eSplitPos))
{
- uno::Reference<XAccessible> xAcc = new ScAccessibleEditObject(this, pViewData->GetEditView(eSplitPos),
+ uno::Reference<XAccessible> xAcc = new ScAccessibleEditObject(this, rViewData.GetEditView(eSplitPos),
pViewShell->GetWindowByPos(eSplitPos), GetCurrentCellName(), GetCurrentCellDescription(),
ScAccessibleEditObject::CellInEditMode);
AddChild(xAcc, false);
@@ -1599,13 +1597,13 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
else if ((rRef.GetId() == SC_HINT_ACC_ENTEREDITMODE)) // this event comes only on creating edit field of a cell
{
- ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
- if (pViewData && pViewData->HasEditView(meSplitPos))
+ if (mpViewShell->GetViewData().HasEditView(meSplitPos))
{
- const EditEngine* pEditEng = pViewData->GetEditView(meSplitPos)->GetEditEngine();
+ ScViewData& rViewData = mpViewShell->GetViewData();
+ const EditEngine* pEditEng = rViewData.GetEditView(meSplitPos)->GetEditEngine();
if (pEditEng && pEditEng->GetUpdateMode())
{
- mpTempAccEdit = new ScAccessibleEditObject(this, pViewData->GetEditView(meSplitPos),
+ mpTempAccEdit = new ScAccessibleEditObject(this, rViewData.GetEditView(meSplitPos),
mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
OUString(ScResId(STR_ACC_EDITLINE_DESCR)), ScAccessibleEditObject::CellInEditMode);
uno::Reference<XAccessible> xAcc = mpTempAccEdit;
@@ -1774,8 +1772,8 @@ void SAL_CALL ScAccessibleDocument::grabFocus( )
{
xAccessibleComponent->grabFocus();
// grab only focus if it does not have the focus and it is not hidden
- if (mpViewShell && mpViewShell->GetViewData() &&
- (mpViewShell->GetViewData()->GetActivePart() != meSplitPos) &&
+ if (mpViewShell &&
+ (mpViewShell->GetViewData().GetActivePart() != meSplitPos) &&
mpViewShell->GetWindowByPos(meSplitPos)->IsVisible())
{
mpViewShell->ActivatePart(meSplitPos);
@@ -2127,14 +2125,10 @@ Rectangle ScAccessibleDocument::GetVisibleArea_Impl() const
if (mpViewShell)
{
- ScViewData *pViewData = mpViewShell->GetViewData();
- if (pViewData)
- {
- Point aPoint(pViewData->GetPixPos(meSplitPos)); // returns a negative Point
- aPoint.setX(-aPoint.getX());
- aPoint.setY(-aPoint.getY());
- aVisRect.SetPos(aPoint);
- }
+ Point aPoint(mpViewShell->GetViewData().GetPixPos(meSplitPos)); // returns a negative Point
+ aPoint.setX(-aPoint.getX());
+ aPoint.setY(-aPoint.getY());
+ aVisRect.SetPos(aPoint);
ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
if (pWin)
@@ -2260,9 +2254,8 @@ Rectangle ScAccessibleDocument::GetBoundingBox() const
SCTAB ScAccessibleDocument::getVisibleTable() const
{
SCTAB nVisibleTable(0);
- ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
- if (pViewData)
- nVisibleTable = pViewData->GetTabNo();
+ if (mpViewShell)
+ nVisibleTable = mpViewShell->GetViewData().GetTabNo();
return nVisibleTable;
}
@@ -2292,12 +2285,11 @@ void ScAccessibleDocument::FreeAccessibleSpreadsheet()
bool ScAccessibleDocument::IsTableSelected() const
{
bool bResult (false);
- ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
- if(pViewData)
+ if(mpViewShell)
{
SCTAB nTab(getVisibleTable());
//#103800#; use a copy of MarkData
- ScMarkData aMarkData(pViewData->GetMarkData());
+ ScMarkData aMarkData(mpViewShell->GetViewData().GetMarkData());
aMarkData.MarkToMulti();
if (aMarkData.IsAllMarked(ScRange(ScAddress(0, 0, nTab),ScAddress(MAXCOL, MAXROW, nTab))))
bResult = true;
@@ -2357,11 +2349,10 @@ void ScAccessibleDocument::RemoveChild(const uno::Reference<XAccessible>& xAcc,
OUString ScAccessibleDocument::GetCurrentCellName() const
{
OUString sName(SC_RESSTR(STR_ACC_CELL_NAME));
- ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
- if (pViewData)
+ if (mpViewShell)
{
// Document not needed, because only the cell address, but not the tablename is needed
- OUString sAddress(pViewData->GetCurPos().Format(SCA_VALID, NULL));
+ OUString sAddress(mpViewShell->GetViewData().GetCurPos().Format(SCA_VALID, NULL));
sName = sName.replaceFirst("%1", sAddress);
}
return sName;
@@ -2374,14 +2365,12 @@ OUString ScAccessibleDocument::GetCurrentCellDescription() const
ScDocument *ScAccessibleDocument::GetDocument() const
{
- ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
- return pViewData ? pViewData->GetDocument() : NULL;
+ return mpViewShell ? mpViewShell->GetViewData().GetDocument() : NULL;
}
ScAddress ScAccessibleDocument::GetCurCellAddress() const
{
- ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
- return pViewData ? pViewData->GetCurPos() : ScAddress();
+ return mpViewShell ? mpViewShell->GetViewData().GetCurPos() : ScAddress();
}
uno::Any SAL_CALL ScAccessibleDocument::getExtendedAttributes()
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 040a2a1d0a72..8c24d1dd4659 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -485,7 +485,7 @@ inline ScDocument* ScNotesChildren::GetDocument() const
{
ScDocument* pDoc = NULL;
if (mpViewShell)
- pDoc = mpViewShell->GetDocument();
+ pDoc = &mpViewShell->GetDocument();
return pDoc;
}
@@ -723,7 +723,7 @@ ScShapeChildren::ScShapeChildren(ScPreviewShell* pViewShell, ScAccessibleDocumen
{
if (pViewShell)
{
- SfxBroadcaster* pDrawBC = pViewShell->GetDocument()->GetDrawBroadcaster();
+ SfxBroadcaster* pDrawBC = pViewShell->GetDocument().GetDrawBroadcaster();
if (pDrawBC)
StartListening(*pDrawBC);
}
@@ -733,7 +733,7 @@ ScShapeChildren::~ScShapeChildren()
{
if (mpViewShell)
{
- SfxBroadcaster* pDrawBC = mpViewShell->GetDocument()->GetDrawBroadcaster();
+ SfxBroadcaster* pDrawBC = mpViewShell->GetDocument().GetDrawBroadcaster();
if (pDrawBC)
EndListening(*pDrawBC);
}
@@ -743,7 +743,7 @@ void ScShapeChildren::SetDrawBroadcaster()
{
if (mpViewShell)
{
- SfxBroadcaster* pDrawBC = mpViewShell->GetDocument()->GetDrawBroadcaster();
+ SfxBroadcaster* pDrawBC = mpViewShell->GetDocument().GetDrawBroadcaster();
if (pDrawBC)
StartListening(*pDrawBC, true);
}
@@ -1163,10 +1163,10 @@ SdrPage* ScShapeChildren::GetDrawPage() const
{
SCTAB nTab( mpViewShell->GetLocationData().GetPrintTab() );
SdrPage* pDrawPage = NULL;
- ScDocument* pDoc = mpViewShell->GetDocument();
- if (pDoc && pDoc->GetDrawLayer())
+ ScDocument& rDoc = mpViewShell->GetDocument();
+ if (rDoc.GetDrawLayer())
{
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
pDrawPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(static_cast<sal_Int16>(nTab)));
}
@@ -1688,11 +1688,9 @@ throw (::com::sun::star::uno::RuntimeException, std::exception)
SolarMutexGuard g;
OUString aName = ScResId(STR_ACC_DOC_SPREADSHEET);
- ScDocument* pScDoc = mpViewShell->GetDocument();
- if (!pScDoc)
- return aName;
+ ScDocument& rScDoc = mpViewShell->GetDocument();
- SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
+ SfxObjectShell* pObjSh = rScDoc.GetDocumentShell();
if (!pObjSh)
return aName;
diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
index a8f88fbdea21..b2828b781832 100644
--- a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
@@ -227,25 +227,22 @@ sal_Int32 SAL_CALL ScAccessiblePageHeader::getAccessibleChildCount() throw (uno:
if((mnChildCount < 0) && mpViewShell)
{
mnChildCount = 0;
- ScDocument* pDoc = mpViewShell->GetDocument();
- if (pDoc)
- {
- // find out how many regions (left,center, right) are with content
+ ScDocument& rDoc = mpViewShell->GetDocument();
+ // find out how many regions (left,center, right) are with content
- SfxStyleSheetBase* pStyle = pDoc->GetStyleSheetPool()->Find(pDoc->GetPageStyle(mpViewShell->GetLocationData().GetPrintTab()), SFX_STYLE_FAMILY_PAGE);
- if (pStyle)
- {
- sal_uInt16 nPageWhichId(0);
- if (mbHeader)
- nPageWhichId = mpViewShell->GetLocationData().IsHeaderLeft() ? ATTR_PAGE_HEADERLEFT : ATTR_PAGE_HEADERRIGHT;
- else
- nPageWhichId = mpViewShell->GetLocationData().IsFooterLeft() ? ATTR_PAGE_FOOTERLEFT : ATTR_PAGE_FOOTERRIGHT;
+ SfxStyleSheetBase* pStyle = rDoc.GetStyleSheetPool()->Find(rDoc.GetPageStyle(mpViewShell->GetLocationData().GetPrintTab()), SFX_STYLE_FAMILY_PAGE);
+ if (pStyle)
+ {
+ sal_uInt16 nPageWhichId(0);
+ if (mbHeader)
+ nPageWhichId = mpViewShell->GetLocationData().IsHeaderLeft() ? ATTR_PAGE_HEADERLEFT : ATTR_PAGE_HEADERRIGHT;
+ else
+ nPageWhichId = mpViewShell->GetLocationData().IsFooterLeft() ? ATTR_PAGE_FOOTERLEFT : ATTR_PAGE_FOOTERRIGHT;
- const ScPageHFItem& rPageItem = static_cast<const ScPageHFItem&>(pStyle->GetItemSet().Get(nPageWhichId));
- AddChild(rPageItem.GetLeftArea(), 0, SVX_ADJUST_LEFT);
- AddChild(rPageItem.GetCenterArea(), 1, SVX_ADJUST_CENTER);
- AddChild(rPageItem.GetRightArea(), 2, SVX_ADJUST_RIGHT);
- }
+ const ScPageHFItem& rPageItem = static_cast<const ScPageHFItem&>(pStyle->GetItemSet().Get(nPageWhichId));
+ AddChild(rPageItem.GetLeftArea(), 0, SVX_ADJUST_LEFT);
+ AddChild(rPageItem.GetCenterArea(), 1, SVX_ADJUST_CENTER);
+ AddChild(rPageItem.GetRightArea(), 2, SVX_ADJUST_RIGHT);
}
}
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
index 23650ecbc8e8..d2cc20171cf3 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
@@ -45,7 +45,7 @@ ScAccessiblePreviewCell::ScAccessiblePreviewCell( const ::com::sun::star::uno::R
::com::sun::star::accessibility::XAccessible>& rxParent,
ScPreviewShell* pViewShell, /* const */ ScAddress& rCellAddress,
sal_Int32 nIndex ) :
- ScAccessibleCellBase( rxParent, ( pViewShell ? pViewShell->GetDocument() : NULL ), rCellAddress, nIndex ),
+ ScAccessibleCellBase( rxParent, ( pViewShell ? &pViewShell->GetDocument() : NULL ), rCellAddress, nIndex ),
mpViewShell( pViewShell ),
mpTextHelper(NULL)
{
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
index 1dd15c14f54c..78f1b3af1fca 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
@@ -204,8 +204,8 @@ sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleRowExtentAt( sal_Int32
}
else
{
- ScDocument* pDoc = mpViewShell->GetDocument();
- const ScMergeAttr* pItem = (const ScMergeAttr*)pDoc->GetAttr(
+ ScDocument& rDoc = mpViewShell->GetDocument();
+ const ScMergeAttr* pItem = (const ScMergeAttr*)rDoc.GetAttr(
static_cast<SCCOL>(rColInfo.nDocIndex), static_cast<SCROW>(rRowInfo.nDocIndex), mpTableInfo->GetTab(), ATTR_MERGE );
if ( pItem && pItem->GetRowMerge() > 0 )
nRows = pItem->GetRowMerge();
@@ -238,8 +238,8 @@ sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleColumnExtentAt( sal_In
}
else
{
- ScDocument* pDoc = mpViewShell->GetDocument();
- const ScMergeAttr* pItem = (const ScMergeAttr*)pDoc->GetAttr(
+ ScDocument& rDoc = mpViewShell->GetDocument();
+ const ScMergeAttr* pItem = (const ScMergeAttr*)rDoc.GetAttr(
static_cast<SCCOL>(rColInfo.nDocIndex), static_cast<SCROW>(rRowInfo.nDocIndex), mpTableInfo->GetTab(), ATTR_MERGE );
if ( pItem && pItem->GetColMerge() > 0 )
nColumns = pItem->GetColMerge();
@@ -614,14 +614,14 @@ OUString SAL_CALL ScAccessiblePreviewTable::createAccessibleName()
{
OUString sName(SC_RESSTR(STR_ACC_TABLE_NAME));
- if (mpViewShell && mpViewShell->GetDocument())
+ if (mpViewShell)
{
FillTableInfo();
if ( mpTableInfo )
{
OUString sCoreName;
- if (mpViewShell->GetDocument()->GetName( mpTableInfo->GetTab(), sCoreName ))
+ if (mpViewShell->GetDocument().GetName( mpTableInfo->GetTab(), sCoreName ))
sName = sName.replaceFirst("%1", sCoreName);
}
}
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 4e3c8db27f57..ef9b834054e5 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -300,7 +300,7 @@ void ScAccessibleSpreadsheet::ConstructScAccessibleSpreadsheet(
{
mpViewShell->AddAccessibilityObject(*this);
- const ScViewData& rViewData = *mpViewShell->GetViewData();
+ const ScViewData& rViewData = mpViewShell->GetViewData();
const ScMarkData& rMarkData = rViewData.GetMarkData();
maActiveCell = rViewData.GetCurPos();
mbHasSelection = rMarkData.GetTableSelect(maActiveCell.Tab()) &&
@@ -425,9 +425,9 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
{
if (mpViewShell)
{
- ScViewData *pViewData = mpViewShell->GetViewData();
+ ScViewData& rViewData = mpViewShell->GetViewData();
- m_bFormulaMode = pViewData->IsRefMode() || SC_MOD()->IsFormulaMode();
+ m_bFormulaMode = rViewData.IsRefMode() || SC_MOD()->IsFormulaMode();
if ( m_bFormulaMode )
{
NotifyRefMode();
@@ -445,7 +445,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
AccessibleEventObject aEvent;
aEvent.Source = uno::Reference< XAccessible >(this);
- ScAddress aNewCell = pViewData->GetCurPos();
+ ScAddress aNewCell = rViewData.GetCurPos();
if(aNewCell.Tab() != maActiveCell.Tab())
{
aEvent.EventId = AccessibleEventId::PAGE_CHANGED;
@@ -462,14 +462,14 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
{//single Focus
bNewPosCellFocus=true;
}
- ScMarkData &refScMarkData = pViewData->GetMarkData();
+ ScMarkData &refScMarkData = rViewData.GetMarkData();
// MT IA2: Not used
// int nSelCount = refScMarkData.GetSelectCount();
bool bIsMark =refScMarkData.IsMarked();
bool bIsMultMark = refScMarkData.IsMultiMarked();
bool bNewMarked = refScMarkData.GetTableSelect(aNewCell.Tab()) && ( bIsMark || bIsMultMark );
// sal_Bool bNewCellSelected = isAccessibleSelected(aNewCell.Row(), aNewCell.Col());
- sal_uInt16 nTab = pViewData->GetTabNo();
+ sal_uInt16 nTab = rViewData.GetTabNo();
ScRange aMarkRange;
refScMarkData.GetMarkArea(aMarkRange);
aEvent.OldValue <<= ::com::sun::star::uno::Any();
@@ -554,7 +554,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
else
{
ScRange aDelRange;
- bool bIsDel = pViewData->GetDelMark( aDelRange );
+ bool bIsDel = rViewData.GetDelMark( aDelRange );
if ( (!bIsDel || (bIsDel && aMarkRange != aDelRange)) &&
bNewMarked &&
nNewMarkCount > 0 &&
@@ -605,8 +605,8 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
CommitTableModelChange(maRange.aStart.Row(), maRange.aStart.Col(), maRange.aEnd.Row(), maRange.aEnd.Col(), AccessibleTableModelChangeType::UPDATE);
else
mbDelIns = false;
- ScViewData *pViewData = mpViewShell->GetViewData();
- ScAddress aNewCell = pViewData->GetCurPos();
+ ScViewData& rViewData = mpViewShell->GetViewData();
+ ScAddress aNewCell = rViewData.GetCurPos();
if( maActiveCell == aNewCell)
{
ScDocument* pScDoc= GetDocument(mpViewShell);
@@ -822,10 +822,10 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib
{
return aSequence;
}
- if (mpViewShell && mpViewShell->GetViewData())
+ if (mpViewShell)
{
aSequence.realloc(maRange.aEnd.Row() - maRange.aStart.Row() + 1);
- const ScMarkData& rMarkdata = mpViewShell->GetViewData()->GetMarkData();
+ const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
sal_Int32* pSequence = aSequence.getArray();
sal_Int32 nCount(0);
for (SCROW i = maRange.aStart.Row(); i <= maRange.aEnd.Row(); ++i)
@@ -853,10 +853,10 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib
{
return aSequence;
}
- if (mpViewShell && mpViewShell->GetViewData())
+ if (mpViewShell)
{
aSequence.realloc(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
- const ScMarkData& rMarkdata = mpViewShell->GetViewData()->GetMarkData();
+ const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
sal_Int32* pSequence = aSequence.getArray();
sal_Int32 nCount(0);
for (SCCOL i = maRange.aStart.Col(); i <= maRange.aEnd.Col(); ++i)
@@ -888,9 +888,9 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleRowSelected( sal_Int32 nR
throw lang::IndexOutOfBoundsException();
bool bResult(false);
- if (mpViewShell && mpViewShell->GetViewData())
+ if (mpViewShell)
{
- const ScMarkData& rMarkdata = mpViewShell->GetViewData()->GetMarkData();
+ const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
bResult = rMarkdata.IsRowMarked((SCROW)nRow);
}
return bResult;
@@ -910,9 +910,9 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleColumnSelected( sal_Int32
throw lang::IndexOutOfBoundsException();
bool bResult(false);
- if (mpViewShell && mpViewShell->GetViewData())
+ if (mpViewShell)
{
- const ScMarkData& rMarkdata = mpViewShell->GetViewData()->GetMarkData();
+ const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
bResult = rMarkdata.IsColumnMarked((SCCOL)nColumn);
}
return bResult;
@@ -922,7 +922,7 @@ rtl::Reference<ScAccessibleCell> ScAccessibleSpreadsheet::GetAccessibleCellAt(sa
{
if (IsFormulaMode())
{
- ScAddress aCellAddress(static_cast<SCCOL>(nColumn), nRow, mpViewShell->GetViewData()->GetTabNo());
+ ScAddress aCellAddress(static_cast<SCCOL>(nColumn), nRow, mpViewShell->GetViewData().GetTabNo());
if ((aCellAddress == m_aFormulaActiveCell) && m_pAccFormulaCell.is())
{
return m_pAccFormulaCell;
@@ -978,7 +978,7 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleSelected( sal_Int32 nRow,
bool bResult(false);
if (mpViewShell)
{
- const ScMarkData& rMarkdata = mpViewShell->GetViewData()->GetMarkData();
+ const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
bResult = rMarkdata.IsCellMarked(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow));
}
return bResult;
@@ -998,9 +998,9 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleAtP
{
SCsCOL nX;
SCsROW nY;
- mpViewShell->GetViewData()->GetPosFromPixel( rPoint.X, rPoint.Y, meSplitPos, nX, nY);
- try{
- xAccessible = getAccessibleCellAt(nY, nX);
+ mpViewShell->GetViewData().GetPosFromPixel( rPoint.X, rPoint.Y, meSplitPos, nX, nY);
+ try {
+ xAccessible = getAccessibleCellAt(nY, nX);
}
catch(const ::com::sun::star::lang::IndexOutOfBoundsException &)
{
@@ -1126,11 +1126,11 @@ void SAL_CALL ScAccessibleSpreadsheet::selectAllAccessibleChildren( )
{
if (IsFormulaMode())
{
- ScViewData *pViewData = mpViewShell->GetViewData();
- mpViewShell->InitRefMode( 0, 0, pViewData->GetTabNo(), SC_REFTYPE_REF );
- pViewData->SetRefStart(0,0,pViewData->GetTabNo());
- pViewData->SetRefEnd(MAXCOL,MAXROW,pViewData->GetTabNo());
- mpViewShell->UpdateRef(MAXCOL, MAXROW, pViewData->GetTabNo());
+ ScViewData& rViewData = mpViewShell->GetViewData();
+ mpViewShell->InitRefMode( 0, 0, rViewData.GetTabNo(), SC_REFTYPE_REF );
+ rViewData.SetRefStart(0, 0, rViewData.GetTabNo());
+ rViewData.SetRefEnd(MAXCOL, MAXROW, rViewData.GetTabNo());
+ mpViewShell->UpdateRef(MAXCOL, MAXROW, rViewData.GetTabNo());
}
else
mpViewShell->SelectAll();
@@ -1155,7 +1155,7 @@ sal_Int32 SAL_CALL
if (!mpMarkedRanges)
{
mpMarkedRanges = new ScRangeList();
- ScMarkData aMarkData(mpViewShell->GetViewData()->GetMarkData());
+ ScMarkData aMarkData(mpViewShell->GetViewData().GetMarkData());
aMarkData.FillRangeListWithMarks(mpMarkedRanges, false);
}
// is possible, because there shouldn't be overlapped ranges in it
@@ -1187,7 +1187,7 @@ uno::Reference<XAccessible > SAL_CALL
if (!mpMarkedRanges)
{
mpMarkedRanges = new ScRangeList();
- mpViewShell->GetViewData()->GetMarkData().FillRangeListWithMarks(mpMarkedRanges, false);
+ mpViewShell->GetViewData().GetMarkData().FillRangeListWithMarks(mpMarkedRanges, false);
}
if (mpMarkedRanges)
{
@@ -1223,14 +1223,14 @@ void SAL_CALL ScAccessibleSpreadsheet::deselectAccessibleChild( sal_Int32 nChild
if (IsFormulaMode())
{
if(IsScAddrFormulaSel(
- ScAddress(static_cast<SCCOL>(nCol), nRow,mpViewShell->GetViewData()->GetTabNo()))
+ ScAddress(static_cast<SCCOL>(nCol), nRow,mpViewShell->GetViewData().GetTabNo()))
)
{
SelectCell(nRow, nCol, true);
}
return ;
}
- if (mpViewShell->GetViewData()->GetMarkData().IsCellMarked(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow)))
+ if (mpViewShell->GetViewData().GetMarkData().IsCellMarked(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow)))
SelectCell(nRow, nCol, true);
}
}
@@ -1245,10 +1245,10 @@ void ScAccessibleSpreadsheet::SelectCell(sal_Int32 nRow, sal_Int32 nCol, bool bD
}
else
{
- ScViewData *pViewData = mpViewShell->GetViewData();
+ ScViewData& rViewData = mpViewShell->GetViewData();
- mpViewShell->InitRefMode( static_cast<SCCOL>(nCol), nRow, pViewData->GetTabNo(), SC_REFTYPE_REF );
- mpViewShell->UpdateRef(static_cast<SCCOL>(nCol), nRow, pViewData->GetTabNo());
+ mpViewShell->InitRefMode( static_cast<SCCOL>(nCol), nRow, rViewData.GetTabNo(), SC_REFTYPE_REF );
+ mpViewShell->UpdateRef(static_cast<SCCOL>(nCol), nRow, rViewData.GetTabNo());
}
return ;
}
@@ -1400,7 +1400,7 @@ bool ScAccessibleSpreadsheet::IsFocused()
bool bFocused(false);
if (mpViewShell)
{
- if (mpViewShell->GetViewData()->GetActivePart() == meSplitPos)
+ if (mpViewShell->GetViewData().GetActivePart() == meSplitPos)
bFocused = mpViewShell->GetActiveWin()->HasFocus();
}
return bFocused;
@@ -1417,7 +1417,7 @@ bool ScAccessibleSpreadsheet::IsCompleteSheetSelected()
if(mpViewShell)
{
//#103800#; use a copy of MarkData
- ScMarkData aMarkData(mpViewShell->GetViewData()->GetMarkData());
+ ScMarkData aMarkData(mpViewShell->GetViewData().GetMarkData());
aMarkData.MarkToMulti();
if (aMarkData.IsAllMarked(maRange))
bResult = true;
@@ -1429,7 +1429,7 @@ ScDocument* ScAccessibleSpreadsheet::GetDocument(ScTabViewShell* pViewShell)
{
ScDocument* pDoc = NULL;
if (pViewShell)
- pDoc = pViewShell->GetViewData()->GetDocument();
+ pDoc = pViewShell->GetViewData().GetDocument();
return pDoc;
}
@@ -1441,7 +1441,7 @@ Rectangle ScAccessibleSpreadsheet::GetVisArea(ScTabViewShell* pViewShell, ScSpli
Window* pWindow = pViewShell->GetWindowByPos(eSplitPos);
if (pWindow)
{
- aVisArea.SetPos(pViewShell->GetViewData()->GetPixPos(eSplitPos));
+ aVisArea.SetPos(pViewShell->GetViewData().GetPixPos(eSplitPos));
aVisArea.SetSize(pWindow->GetSizePixel());
}
}
@@ -1455,8 +1455,8 @@ Rectangle ScAccessibleSpreadsheet::GetVisCells(const Rectangle& rVisArea)
SCsCOL nStartX, nEndX;
SCsROW nStartY, nEndY;
- mpViewShell->GetViewData()->GetPosFromPixel( 1, 1, meSplitPos, nStartX, nStartY);
- mpViewShell->GetViewData()->GetPosFromPixel( rVisArea.GetWidth(), rVisArea.GetHeight(), meSplitPos, nEndX, nEndY);
+ mpViewShell->GetViewData().GetPosFromPixel( 1, 1, meSplitPos, nStartX, nStartY);
+ mpViewShell->GetViewData().GetPosFromPixel( rVisArea.GetWidth(), rVisArea.GetHeight(), meSplitPos, nEndX, nEndY);
return Rectangle(nStartX, nStartY, nEndX, nEndY);
}
@@ -1558,15 +1558,15 @@ void ScAccessibleSpreadsheet::FireFirstCellFocus()
void ScAccessibleSpreadsheet::NotifyRefMode()
{
- ScViewData *pViewData = mpViewShell->GetViewData();
- if (!pViewData->IsRefMode())
+ ScViewData& rViewData = mpViewShell->GetViewData();
+ if (!rViewData.IsRefMode())
// Not in reference mode. Bail out.
return;
- sal_uInt16 nRefStartX =pViewData->GetRefStartX();
- sal_Int32 nRefStartY=pViewData->GetRefStartY();
- sal_uInt16 nRefEndX=pViewData->GetRefEndX();
- sal_Int32 nRefEndY=pViewData->GetRefEndY();
+ sal_uInt16 nRefStartX = rViewData.GetRefStartX();
+ sal_Int32 nRefStartY = rViewData.GetRefStartY();
+ sal_uInt16 nRefEndX = rViewData.GetRefEndX();
+ sal_Int32 nRefEndY = rViewData.GetRefEndY();
ScAddress aFormulaAddr;
if(!GetFormulaCurrentFocusCell(aFormulaAddr))
{
@@ -1678,7 +1678,7 @@ bool ScAccessibleSpreadsheet::IsScAddrFormulaSel(const ScAddress &addr) const
{
if( addr.Col() >= m_nMinX && addr.Col() <= m_nMaxX &&
addr.Row() >= m_nMinY && addr.Row() <= m_nMaxY &&
- addr.Tab() == mpViewShell->GetViewData()->GetTabNo() )
+ addr.Tab() == mpViewShell->GetViewData().GetTabNo() )
{
return true;
}
@@ -1702,7 +1702,7 @@ ScAddress ScAccessibleSpreadsheet::GetChildIndexAddress(sal_Int32 nIndex) const
return ScAddress(
static_cast<SCCOL>((nIndex - nIndex % nRowAll) / nRowAll + + m_nMinX),
nIndex % nRowAll + m_nMinY,
- mpViewShell->GetViewData()->GetTabNo()
+ mpViewShell->GetViewData().GetTabNo()
);
}
@@ -1719,29 +1719,29 @@ sal_Int32 ScAccessibleSpreadsheet::GetAccessibleIndexFormula( sal_Int32 nRow, sa
bool ScAccessibleSpreadsheet::IsFormulaMode()
{
- ScViewData *pViewData = mpViewShell->GetViewData();
- m_bFormulaMode = pViewData->IsRefMode() || SC_MOD()->IsFormulaMode();
+ ScViewData& rViewData = mpViewShell->GetViewData();
+ m_bFormulaMode = rViewData.IsRefMode() || SC_MOD()->IsFormulaMode();
return m_bFormulaMode ;
}
bool ScAccessibleSpreadsheet::GetFormulaCurrentFocusCell(ScAddress &addr)
{
- ScViewData *pViewData = mpViewShell->GetViewData();
+ ScViewData& rViewData = mpViewShell->GetViewData();
sal_uInt16 nRefX=0;
sal_Int32 nRefY=0;
if(m_bFormulaLastMode)
{
- nRefX=pViewData->GetRefEndX();
- nRefY=pViewData->GetRefEndY();
+ nRefX=rViewData.GetRefEndX();
+ nRefY=rViewData.GetRefEndY();
}
else
{
- nRefX=pViewData->GetRefStartX();
- nRefY=pViewData->GetRefStartY();
+ nRefX=rViewData.GetRefStartX();
+ nRefY=rViewData.GetRefStartY();
}
if( /* Always true: nRefX >= 0 && */ nRefX <= MAXCOL && nRefY >= 0 && nRefY <= MAXROW)
{
- addr = ScAddress(nRefX,nRefY,pViewData->GetTabNo());
+ addr = ScAddress(nRefX,nRefY,rViewData.GetTabNo());
return true;
}
return false;
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 00bb8646f5c9..a1c28d3b07ab 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -94,9 +94,9 @@ Rectangle ScViewForwarder::GetVisArea() const
ScVSplitPos eWhichV = ((meSplitPos == SC_SPLIT_TOPLEFT) || (meSplitPos == SC_SPLIT_TOPRIGHT)) ?
SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
- Point aBaseCellPos(mpViewShell->GetViewData()->GetScrPos(mpViewShell->GetViewData()->GetPosX(eWhichH),
- mpViewShell->GetViewData()->GetPosY(eWhichV), meSplitPos, true));
- Point aCellPos(mpViewShell->GetViewData()->GetScrPos(maCellPos.Col(), maCellPos.Row(), meSplitPos, true));
+ Point aBaseCellPos(mpViewShell->GetViewData().GetScrPos(mpViewShell->GetViewData().GetPosX(eWhichH),
+ mpViewShell->GetViewData().GetPosY(eWhichV), meSplitPos, true));
+ Point aCellPos(mpViewShell->GetViewData().GetScrPos(maCellPos.Col(), maCellPos.Row(), meSplitPos, true));
aVisArea.SetPos(aCellPos - aBaseCellPos);
}
}
@@ -755,25 +755,22 @@ void ScAccessibleCellTextData::GetCellText(const ScAddress& rCellPos, OUString&
{
// #104893#; don't use the input string
// ScCellTextData::GetCellText(rCellPos, rText);
- ScDocument* pDoc = pDocShell->GetDocument();
- if (pDoc)
+ ScDocument& rDoc = pDocShell->GetDocument();
+ // #104893#; use the displayed string
+ rText = rDoc.GetString(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab());
+ if (mpViewShell)
{
- // #104893#; use the displayed string
- rText = pDoc->GetString(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab());
- if (mpViewShell)
+ const ScViewOptions& aOptions = mpViewShell->GetViewData().GetOptions();
+ CellType aCellType;
+ rDoc.GetCellType(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), aCellType);
+ if (aCellType == CELLTYPE_FORMULA && aOptions.GetOption( VOPT_FORMULAS ))
{
- const ScViewOptions& aOptions = mpViewShell->GetViewData()->GetOptions();
- CellType aCellType;
- pDoc->GetCellType(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), aCellType);
- if (aCellType == CELLTYPE_FORMULA && aOptions.GetOption( VOPT_FORMULAS ))
- {
- pDoc->GetFormula( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText);
- }
- else if (!aOptions.GetOption( VOPT_NULLVALS ))
- {
- if ((aCellType == CELLTYPE_VALUE || aCellType == CELLTYPE_FORMULA) && pDoc->GetValue(rCellPos) == 0.0)
- rText = "";
- }
+ rDoc.GetFormula( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText);
+ }
+ else if (!aOptions.GetOption( VOPT_NULLVALS ))
+ {
+ if ((aCellType == CELLTYPE_VALUE || aCellType == CELLTYPE_FORMULA) && rDoc.GetValue(rCellPos) == 0.0)
+ rText = "";
}
}
}
@@ -782,11 +779,11 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
{
ScCellTextData::GetTextForwarder(); // creates Forwarder and EditEngine
- ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL );
- if ( pDoc && pEditEngine && mpViewShell )
+ if ( pDocShell && pEditEngine && mpViewShell )
{
+ ScDocument& rDoc = pDocShell->GetDocument();
long nSizeX, nSizeY;
- mpViewShell->GetViewData()->GetMergeSizePixel(
+ mpViewShell->GetViewData().GetMergeSizePixel(
aCellPos.Col(), aCellPos.Row(), nSizeX, nSizeY);
Size aSize(nSizeX, nSizeY);
@@ -794,12 +791,12 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
// #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
long nIndent = 0;
const SvxHorJustifyItem* pHorJustifyItem = static_cast< const SvxHorJustifyItem* >(
- pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY ) );
+ rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY ) );
SvxCellHorJustify eHorJust = ( pHorJustifyItem ? static_cast< SvxCellHorJustify >( pHorJustifyItem->GetValue() ) : SVX_HOR_JUSTIFY_STANDARD );
if ( eHorJust == SVX_HOR_JUSTIFY_LEFT )
{
const SfxUInt16Item* pIndentItem = static_cast< const SfxUInt16Item* >(
- pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_INDENT ) );
+ rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_INDENT ) );
if ( pIndentItem )
{
nIndent = static_cast< long >( pIndentItem->GetValue() );
@@ -807,10 +804,10 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
}
const SvxMarginItem* pMarginItem = static_cast< const SvxMarginItem* >(
- pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_MARGIN ) );
- ScViewData* pViewData = mpViewShell->GetViewData();
- double nPPTX = ( pViewData ? pViewData->GetPPTX() : 0 );
- double nPPTY = ( pViewData ? pViewData->GetPPTY() : 0 );
+ rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_MARGIN ) );
+ ScViewData& rViewData = mpViewShell->GetViewData();
+ double nPPTX = rViewData.GetPPTX();
+ double nPPTY = rViewData.GetPPTY();
long nLeftM = ( pMarginItem ? static_cast< long >( ( pMarginItem->GetLeftMargin() + nIndent ) * nPPTX ) : 0 );
long nTopM = ( pMarginItem ? static_cast< long >( pMarginItem->GetTopMargin() * nPPTY ) : 0 );
long nRightM = ( pMarginItem ? static_cast< long >( pMarginItem->GetRightMargin() * nPPTX ) : 0 );
@@ -836,7 +833,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
the cell bounding box in ScAccessibleCell::GetBoundingBox()
(see sc/source/ui/Accessibility/AccessibleCell.cxx). */
const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >(
- pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) );
+ rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) );
if( pItem && (pItem->GetValue() != 0) )
{
pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
@@ -847,7 +844,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
{
// #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
const SfxBoolItem* pLineBreakItem = static_cast< const SfxBoolItem* >(
- pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_LINEBREAK ) );
+ rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_LINEBREAK ) );
bool bLineBreak = ( pLineBreakItem && pLineBreakItem->GetValue() );
if ( !bLineBreak )
{
@@ -859,7 +856,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
pEditEngine->SetPaperSize( aSize );
// #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
- if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD && pDoc->HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) )
+ if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD && rDoc.HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) )
{
pEditEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
}
@@ -897,7 +894,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
long nOffsetY = 0;
const SvxVerJustifyItem* pVerJustifyItem = static_cast< const SvxVerJustifyItem* >(
- pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) );
+ rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) );
SvxCellVerJustify eVerJust = ( pVerJustifyItem ? static_cast< SvxCellVerJustify >( pVerJustifyItem->GetValue() ) : SVX_VER_JUSTIFY_STANDARD );
switch ( eVerJust )
{
@@ -962,7 +959,7 @@ ScDocShell* ScAccessibleCellTextData::GetDocShell(ScTabViewShell* pViewShell)
{
ScDocShell* pDocSh = NULL;
if (pViewShell)
- pDocSh = pViewShell->GetViewData()->GetDocShell();
+ pDocSh = pViewShell->GetViewData().GetDocShell();
return pDocSh;
}
@@ -1310,8 +1307,8 @@ SvxViewForwarder* ScAccessiblePreviewCellTextData::GetViewForwarder()
ScDocShell* ScAccessiblePreviewCellTextData::GetDocShell(ScPreviewShell* pViewShell)
{
ScDocShell* pDocSh = NULL;
- if (pViewShell && pViewShell->GetDocument())
- pDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell();
+ if (pViewShell)
+ pDocSh = (ScDocShell*) pViewShell->GetDocument().GetDocumentShell();
return pDocSh;
}
@@ -1363,8 +1360,8 @@ SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder()
{
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pEditEngine = pDoc->CreateFieldEditEngine();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ pEditEngine = rDoc.CreateFieldEditEngine();
}
else
{
@@ -1418,8 +1415,8 @@ SvxViewForwarder* ScAccessiblePreviewHeaderCellTextData::GetViewForwarder()
ScDocShell* ScAccessiblePreviewHeaderCellTextData::GetDocShell(ScPreviewShell* pViewShell)
{
ScDocShell* pDocSh = NULL;
- if (pViewShell && pViewShell->GetDocument())
- pDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell();
+ if (pViewShell)
+ pDocSh = (ScDocShell*) pViewShell->GetDocument().GetDocumentShell();
return pDocSh;
}
@@ -1436,10 +1433,10 @@ ScAccessibleHeaderTextData::ScAccessibleHeaderTextData(ScPreviewShell* pViewShel
mbDataValid(false),
meAdjust(eAdjust)
{
- if (pViewShell && pViewShell->GetDocument())
- mpDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell();
+ if (pViewShell)
+ mpDocSh = (ScDocShell*) pViewShell->GetDocument().GetDocumentShell();
if (mpDocSh)
- mpDocSh->GetDocument()->AddUnoObject(*this);
+ mpDocSh->GetDocument().AddUnoObject(*this);
}
ScAccessibleHeaderTextData::~ScAccessibleHeaderTextData()
@@ -1447,7 +1444,7 @@ ScAccessibleHeaderTextData::~ScAccessibleHeaderTextData()
SolarMutexGuard aGuard; // needed for EditEngine dtor
if (mpDocSh)
- mpDocSh->GetDocument()->RemoveUnoObject(*this);
+ mpDocSh->GetDocument().RemoveUnoObject(*this);
if (mpEditEngine)
mpEditEngine->SetNotifyHdl(Link());
delete mpEditEngine;
@@ -1550,10 +1547,10 @@ ScAccessibleNoteTextData::ScAccessibleNoteTextData(ScPreviewShell* pViewShell,
mbMarkNote(bMarkNote),
mbDataValid(false)
{
- if (pViewShell && pViewShell->GetDocument())
- mpDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell();
+ if (pViewShell)
+ mpDocSh = (ScDocShell*) pViewShell->GetDocument().GetDocumentShell();
if (mpDocSh)
- mpDocSh->GetDocument()->AddUnoObject(*this);
+ mpDocSh->GetDocument().AddUnoObject(*this);
}
ScAccessibleNoteTextData::~ScAccessibleNoteTextData()
@@ -1561,7 +1558,7 @@ ScAccessibleNoteTextData::~ScAccessibleNoteTextData()
SolarMutexGuard aGuard; // needed for EditEngine dtor
if (mpDocSh)
- mpDocSh->GetDocument()->RemoveUnoObject(*this);
+ mpDocSh->GetDocument().RemoveUnoObject(*this);
if (mpEditEngine)
mpEditEngine->SetNotifyHdl(Link());
delete mpEditEngine;
@@ -1594,8 +1591,8 @@ SvxTextForwarder* ScAccessibleNoteTextData::GetTextForwarder()
{
if ( mpDocSh )
{
- ScDocument* pDoc = mpDocSh->GetDocument();
- mpEditEngine = pDoc->CreateFieldEditEngine();
+ ScDocument& rDoc = mpDocSh->GetDocument();
+ mpEditEngine = rDoc.CreateFieldEditEngine();
}
else
{
diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx
index 089790d626e2..0982b2ed42e7 100644
--- a/sc/source/ui/app/client.cxx
+++ b/sc/source/ui/app/client.cxx
@@ -98,7 +98,7 @@ void ScClient::RequestNewObjectArea( Rectangle& aLogicRect )
aLogicRect.SetPos( aOldRect.TopLeft() );
}
- sal_uInt16 nTab = pViewSh->GetViewData()->GetTabNo();
+ sal_uInt16 nTab = pViewSh->GetViewData().GetTabNo();
SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(static_cast<sal_Int16>(nTab)));
if ( pPage && aLogicRect != aOldRect )
{
@@ -176,7 +176,7 @@ void ScClient::ObjectAreaChanged()
// SfxViewShell* pSfxViewSh = GetViewShell();
// ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pSfxViewSh );
if (pViewSh)
- pViewSh->GetViewData()->GetDocShell()->SetDrawModified();
+ pViewSh->GetViewData().GetDocShell()->SetDrawModified();
}
if (pDrawObj)
@@ -236,7 +236,7 @@ void ScClient::ViewChanged()
pDrawObj->SetLogicRect( aLogicRect );
// set document modified (SdrModel::SetChanged is not used)
- pViewSh->GetViewData()->GetDocShell()->SetDrawModified();
+ pViewSh->GetViewData().GetDocShell()->SetDrawModified();
}
}
}
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 5288b1d7ac5f..426763a9b8b7 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -225,14 +225,11 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain
if ( pContainerShell )
{
- ScDocument* pDoc = pContainerShell->GetDocument();
- if ( pDoc )
+ ScDocument& rDoc = pContainerShell->GetDocument();
+ nSourceDocID = rDoc.GetDocumentID();
+ if ( pPage )
{
- nSourceDocID = pDoc->GetDocumentID();
- if ( pPage )
- {
- ScChartHelper::FillProtectedChartRangesVector( m_aProtectedChartRangesVector, pDoc, pPage );
- }
+ ScChartHelper::FillProtectedChartRangesVector( m_aProtectedChartRangesVector, &rDoc, pPage );
}
}
}
@@ -745,10 +742,10 @@ void ScDrawTransferObj::InitDocShell()
pDocSh->DoInitNew(NULL);
- ScDocument* pDestDoc = pDocSh->GetDocument();
- pDestDoc->InitDrawLayer( pDocSh );
+ ScDocument& rDestDoc = pDocSh->GetDocument();
+ rDestDoc.InitDrawLayer( pDocSh );
- SdrModel* pDestModel = pDestDoc->GetDrawLayer();
+ SdrModel* pDestModel = rDestDoc.GetDrawLayer();
// #i71538# use complete SdrViews
// SdrExchangeView aDestView( pDestModel );
SdrView aDestView( pDestModel );
@@ -779,9 +776,9 @@ void ScDrawTransferObj::InitDocShell()
Rectangle aDestArea( aTmpPoint, aSrcSize );
pDocSh->SetVisArea( aDestArea );
- ScViewOptions aViewOpt( pDestDoc->GetViewOptions() );
+ ScViewOptions aViewOpt( rDestDoc.GetViewOptions() );
aViewOpt.SetOption( VOPT_GRID, false );
- pDestDoc->SetViewOptions( aViewOpt );
+ rDestDoc.SetViewOptions( aViewOpt );
ScViewData aViewData( pDocSh, NULL );
aViewData.SetTabNo( 0 );
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index be0220d0fd7f..819e580e733e 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -202,9 +202,9 @@ void removeChars(OUString& rStr, sal_Unicode c)
void ScInputHandler::InitRangeFinder( const OUString& rFormula )
{
DeleteRangeFinder();
- ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
- const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDoc);
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ const sal_Unicode cSheetSep = lcl_getSheetSeparator(&rDoc);
if ( !pActiveViewSh || !SC_MOD()->GetInputOptions().GetRangeFinder() )
return;
@@ -250,7 +250,7 @@ handle_r1c1:
// integer. we need to clean up this code.
if( nPos < nLen && nPos > 0 &&
'-' == pChar[nPos] && '[' == pChar[nPos-1] &&
- formula::FormulaGrammar::CONV_XL_R1C1 == pDoc->GetAddressConvention() )
+ formula::FormulaGrammar::CONV_XL_R1C1 == rDoc.GetAddressConvention() )
{
nPos++;
goto handle_r1c1;
@@ -259,13 +259,13 @@ handle_r1c1:
if ( nPos > nStart )
{
OUString aTest = rFormula.copy( nStart, nPos-nStart );
- const ScAddress::Details aAddrDetails( pDoc, aCursorPos );
- sal_uInt16 nFlags = aRange.ParseAny( aTest, pDoc, aAddrDetails );
+ const ScAddress::Details aAddrDetails( &rDoc, aCursorPos );
+ sal_uInt16 nFlags = aRange.ParseAny( aTest, &rDoc, aAddrDetails );
if ( nFlags & SCA_VALID )
{
// Set tables if not specified
if ( (nFlags & SCA_TAB_3D) == 0 )
- aRange.aStart.SetTab( pActiveViewSh->GetViewData()->GetTabNo() );
+ aRange.aStart.SetTab( pActiveViewSh->GetViewData().GetTabNo() );
if ( (nFlags & SCA_TAB2_3D) == 0 )
aRange.aEnd.SetTab( aRange.aStart.Tab() );
@@ -343,7 +343,7 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
ScRange aJustified = rNew;
aJustified.Justify(); // Always display Ref in the Formula the right way
- ScDocument* pDoc = pDocView->GetViewData()->GetDocument();
+ ScDocument* pDoc = pDocView->GetViewData().GetDocument();
const ScAddress::Details aAddrDetails( pDoc, aCursorPos );
OUString aNewStr(aJustified.Format(pData->nFlags, pDoc, aAddrDetails));
ESelection aOldSel( 0, nOldStart, 0, nOldEnd );
@@ -381,7 +381,7 @@ void ScInputHandler::DeleteRangeFinder()
ScTabViewShell* pPaintView = pRefViewSh ? pRefViewSh : pActiveViewSh;
if ( pRangeFindList && pPaintView )
{
- ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
pRangeFindList->SetHidden(true);
pDocSh->Broadcast( SfxSimpleHint( SC_HINT_SHOWRANGEFINDER ) ); // Steal
DELETEZ(pRangeFindList);
@@ -597,7 +597,7 @@ void ScInputHandler::UpdateRefDevice()
nCtrl &= ~EE_CNTRL_FORMAT100; // when formatting for screen, use the actual MapMode
pEngine->SetControlWord( nCtrl );
if ( bTextWysiwyg && pActiveViewSh )
- pEngine->SetRefDevice( pActiveViewSh->GetViewData()->GetDocument()->GetPrinter() );
+ pEngine->SetRefDevice( pActiveViewSh->GetViewData().GetDocument()->GetPrinter() );
else
pEngine->SetRefDevice( NULL );
@@ -618,8 +618,8 @@ void ScInputHandler::ImplCreateEditEngine()
{
if ( pActiveViewSh )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument();
- pEngine = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool());
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
+ pEngine = new ScFieldEditEngine(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool());
}
else
pEngine = new ScFieldEditEngine(NULL, EditEngine::CreatePool(), NULL, true);
@@ -653,8 +653,8 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab )
{
if ( pActiveViewSh )
{
- ScViewData* pViewData = pActiveViewSh->GetViewData();
- bool bOnlineSpell = pViewData->GetDocument()->GetDocOptions().IsAutoSpell();
+ ScViewData& rViewData = pActiveViewSh->GetViewData();
+ bool bOnlineSpell = rViewData.GetDocument()->GetDocOptions().IsAutoSpell();
// SetDefaultLanguage is independent of the language attributes,
// ScGlobal::GetEditDefaultLanguage is always used.
@@ -681,10 +681,10 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab )
if ( nCntrl != nOld )
pEngine->SetControlWord(nCntrl);
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument* pDoc = rViewData.GetDocument();
pDoc->ApplyAsianEditSettings( *pEngine );
pEngine->SetDefaultHorizontalTextDirection(
- (EEHorizontalTextDirection)pDoc->GetEditTextDirection( pViewData->GetTabNo() ) );
+ (EEHorizontalTextDirection)pDoc->GetEditTextDirection( rViewData.GetTabNo() ) );
pEngine->SetFirstWordCapitalization( false );
}
@@ -711,7 +711,7 @@ void ScInputHandler::GetFormulaData()
{
if ( pActiveViewSh )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument();
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
if ( pFormulaData )
pFormulaData->clear();
@@ -749,8 +749,8 @@ void ScInputHandler::GetFormulaData()
}
}
miAutoPosFormula = pFormulaData->end();
- pDoc->GetFormulaEntries( *pFormulaData );
- pDoc->GetFormulaEntries( *pFormulaDataPara );
+ rDoc.GetFormulaEntries( *pFormulaData );
+ rDoc.GetFormulaEntries( *pFormulaDataPara );
}
}
@@ -796,9 +796,9 @@ void ScInputHandler::HideTipBelow()
void ScInputHandler::ShowArgumentsTip( const OUString& rParagraph, OUString& rSelText, const ESelection& rSel,
bool bTryFirstSel )
{
- ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
- const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
+ const sal_Unicode cSheetSep = lcl_getSheetSeparator(&pDocSh->GetDocument());
FormulaHelper aHelper(ScGlobal::GetStarCalcFunctionMgr());
bool bFound = false;
while( !bFound )
@@ -1272,8 +1272,8 @@ void ScInputHandler::FormulaPreview()
OUString aPart = pActiveView->GetSelected();
if (aPart.isEmpty())
aPart = pEngine->GetText(0);
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument();
- aValue = lcl_Calculate( aPart, pDoc, aCursorPos );
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
+ aValue = lcl_Calculate( aPart, &rDoc, aCursorPos );
}
if (!aValue.isEmpty())
@@ -1404,7 +1404,7 @@ void ScInputHandler::GetColData()
{
if ( pActiveViewSh )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument();
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
if ( pColumnData )
pColumnData->clear();
@@ -1412,7 +1412,7 @@ void ScInputHandler::GetColData()
pColumnData = new ScTypedCaseStrSet;
std::vector<ScTypedStrData> aEntries;
- pDoc->GetDataEntries(
+ rDoc.GetDataEntries(
aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), true, aEntries, true);
if (!aEntries.empty())
pColumnData->insert(aEntries.begin(), aEntries.end());
@@ -1661,7 +1661,7 @@ void ScInputHandler::UpdateActiveView()
// panes of a split view.
Window* pShellWin = pActiveViewSh ?
- pActiveViewSh->GetWindowByPos( pActiveViewSh->GetViewData()->GetEditActivePart() ) :
+ pActiveViewSh->GetWindowByPos( pActiveViewSh->GetViewData().GetEditActivePart() ) :
NULL;
sal_uInt16 nCount = pEngine->GetViewCount();
@@ -1720,8 +1720,8 @@ void ScInputHandler::UpdateAdjust( sal_Unicode cTyped )
bNumber = (cTyped>='0' && cTyped<='9'); // Ony ciphers are numbers
else if ( pActiveViewSh )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument();
- bNumber = ( pDoc->GetCellType( aCursorPos ) == CELLTYPE_VALUE );
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
+ bNumber = ( rDoc.GetCellType( aCursorPos ) == CELLTYPE_VALUE );
}
eSvxAdjust = bNumber ? SVX_ADJUST_RIGHT : SVX_ADJUST_LEFT;
}
@@ -1801,15 +1801,15 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
UpdateActiveView();
SyncViews();
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument();
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
- const ScMarkData& rMark = pActiveViewSh->GetViewData()->GetMarkData();
+ const ScMarkData& rMark = pActiveViewSh->GetViewData().GetMarkData();
ScEditableTester aTester;
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
- aTester.TestSelection( pDoc, rMark );
+ aTester.TestSelection( &rDoc, rMark );
else
aTester.TestSelectedBlock(
- pDoc, aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Col(), aCursorPos.Row(), rMark );
+ &rDoc, aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Col(), aCursorPos.Row(), rMark );
bool bStartInputMode = true;
@@ -1821,7 +1821,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
// activation is requested (double-click or F2) or a click in input
// line.
bool bShowError = (!bInputActivated || aTester.GetMessageId() != STR_PROTECTIONERR) &&
- !pActiveViewSh->GetViewData()->GetDocShell()->IsReadOnly();
+ !pActiveViewSh->GetViewData().GetDocShell()->IsReadOnly();
if (bShowError)
{
eMode = SC_INPUT_NONE;
@@ -1849,7 +1849,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
pEngine->SetUpdateMode( false );
// Take over attributes in EditEngine
- const ScPatternAttr* pPattern = pDoc->GetPattern( aCursorPos.Col(),
+ const ScPatternAttr* pPattern = rDoc.GetPattern( aCursorPos.Col(),
aCursorPos.Row(),
aCursorPos.Tab() );
if (pPattern != pLastPattern)
@@ -1862,7 +1862,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
{
sal_uLong nFormat = ((const SfxUInt32Item*)pItem)->GetValue();
bCellHasPercentFormat = ( NUMBERFORMAT_PERCENT ==
- pDoc->GetFormatTable()->GetType( nFormat ) );
+ rDoc.GetFormatTable()->GetType( nFormat ) );
}
else
bCellHasPercentFormat = false; // Default: no percent
@@ -2033,7 +2033,7 @@ IMPL_LINK_NOARG(ScInputHandler, ModifyHdl)
bool ScInputHandler::DataChanging( sal_Unicode cTyped, bool bFromCommand )
{
if (pActiveViewSh)
- pActiveViewSh->GetViewData()->SetPasteMode( SC_PASTE_NONE );
+ pActiveViewSh->GetViewData().SetPasteMode( SC_PASTE_NONE );
bInOwnChange = true; // disable ModifyHdl (reset in DataChanged)
if ( eMode == SC_INPUT_NONE )
@@ -2094,7 +2094,7 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified )
EditView* pActiveView = pTopView ? pTopView : pTableView;
if (pActiveView && pActiveViewSh)
{
- ScViewData* pViewData = pActiveViewSh->GetViewData();
+ ScViewData& rViewData = pActiveViewSh->GetViewData();
bool bNeedGrow = ( nEditAdjust != SVX_ADJUST_LEFT ); // Always right-aligned
if (!bNeedGrow)
@@ -2106,13 +2106,13 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified )
}
if (!bNeedGrow)
{
- bNeedGrow = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
+ bNeedGrow = rViewData.GetDocument()->IsLayoutRTL( rViewData.GetTabNo() );
}
if (bNeedGrow)
{
// Adjust inplace view
- pViewData->EditGrowY();
- pViewData->EditGrowX();
+ rViewData.EditGrowY();
+ rViewData.EditGrowX();
}
}
@@ -2266,7 +2266,7 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText )
if (eNewMode != SC_INPUT_NONE && pActiveViewSh)
// Disable paste mode when edit mode starts.
- pActiveViewSh->GetViewData()->SetPasteMode( SC_PASTE_NONE );
+ pActiveViewSh->GetViewData().SetPasteMode( SC_PASTE_NONE );
bInOwnChange = true; // disable ModifyHdl (reset below)
@@ -2282,7 +2282,7 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText )
if (StartTable(0, false, eMode == SC_INPUT_TABLE))
{
if (pActiveViewSh)
- pActiveViewSh->GetViewData()->GetDocShell()->PostEditView( pEngine, aCursorPos );
+ pActiveViewSh->GetViewData().GetDocShell()->PostEditView( pEngine, aCursorPos );
}
}
@@ -2399,7 +2399,7 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
// Test if valid (always with simple string)
if ( bModified && nValidation && pActiveViewSh )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocument();
+ ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
const ScValidationData* pData = pDoc->GetValidationEntry( nValidation );
if (pData && pData->HasErrMsg())
{
@@ -2423,7 +2423,7 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
// Check for input into DataPilot table
if ( bModified && pActiveViewSh && !bForget )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocument();
+ ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
ScDPObject* pDPObj = pDoc->GetDPAtCursor( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
if ( pDPObj )
{
@@ -2443,7 +2443,7 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
// it still has to be treated as number, not EditEngine object.
if ( pActiveViewSh )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocument();
+ ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
// #i67990# don't use pLastPattern in EnterHandler
const ScPatternAttr* pPattern = pDoc->GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
if (pPattern)
@@ -2508,7 +2508,7 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
if ( pCommonAttrs )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocument();
+ ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
pCellAttrs = new ScPatternAttr( pDoc->GetPool() );
pCellAttrs->GetFromEditItemSet( pCommonAttrs );
delete pCommonAttrs;
@@ -2752,7 +2752,7 @@ bool ScInputHandler::IsModalMode( SfxObjectShell* pDocSh )
{
// References to unnamed document; that doesn't work
return bFormulaMode && pRefViewSh
- && pRefViewSh->GetViewData()->GetDocument()->GetDocumentShell() != pDocSh
+ && pRefViewSh->GetViewData().GetDocument()->GetDocumentShell() != pDocSh
&& !pDocSh->HasName();
}
@@ -2779,7 +2779,7 @@ void ScInputHandler::SetReference( const ScRange& rRef, ScDocument* pDoc )
HideTip();
bool bOtherDoc = ( pRefViewSh &&
- pRefViewSh->GetViewData()->GetDocument() != pDoc );
+ pRefViewSh->GetViewData().GetDocument() != pDoc );
if (bOtherDoc)
if (!pDoc->GetDocumentShell()->HasName())
{
@@ -3075,7 +3075,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false
if (bNewView ) // Create anew
{
if (pActiveViewSh)
- pActiveViewSh->GetViewData()->GetDocShell()->PostEditView( pEngine, aCursorPos );
+ pActiveViewSh->GetViewData().GetDocShell()->PostEditView( pEngine, aCursorPos );
UpdateActiveView();
if (eMode==SC_INPUT_NONE)
if (pTableView || pTopView)
@@ -3248,7 +3248,7 @@ bool ScInputHandler::InputCommand( const CommandEvent& rCEvt, bool bForce )
if (bNewView) // create new edit view
{
if (pActiveViewSh)
- pActiveViewSh->GetViewData()->GetDocShell()->PostEditView( pEngine, aCursorPos );
+ pActiveViewSh->GetViewData().GetDocShell()->PostEditView( pEngine, aCursorPos );
UpdateActiveView();
if (eMode==SC_INPUT_NONE)
if (pTableView || pTopView)
@@ -3371,8 +3371,8 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
const EditTextObject* pData = pState->GetEditData();
OUString aString = pState->GetString();
bool bTxtMod = false;
- ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
+ ScDocument& rDoc = pDocSh->GetDocument();
aCursorPos = pState->GetPos();
@@ -3411,12 +3411,12 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
if ( pInputWin ) // Named range input
{
OUString aPosStr;
- const ScAddress::Details aAddrDetails( pDoc, aCursorPos );
+ const ScAddress::Details aAddrDetails( &rDoc, aCursorPos );
// Is the range a name?
//! Find by Timer?
if ( pActiveViewSh )
- pActiveViewSh->GetViewData()->GetDocument()->
+ pActiveViewSh->GetViewData().GetDocument()->
GetRangeAtBlock( ScRange( rSPos, rEPos ), &aPosStr );
if ( aPosStr.isEmpty() ) // Not a name -> format
@@ -3428,10 +3428,10 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
{
ScRange r(rSPos, rEPos);
nFlags |= (nFlags << 4);
- aPosStr = r.Format(SCA_VALID | nFlags, pDoc, aAddrDetails);
+ aPosStr = r.Format(SCA_VALID | nFlags, &rDoc, aAddrDetails);
}
else
- aPosStr = aCursorPos.Format(SCA_VALID | nFlags, pDoc, aAddrDetails);
+ aPosStr = aCursorPos.Format(SCA_VALID | nFlags, &rDoc, aAddrDetails);
}
// Disable the accessible VALUE_CHANGE event
@@ -3587,12 +3587,12 @@ void ScInputHandler::InputChanged( EditView* pView, bool bFromNotify )
if ( pActiveViewSh )
{
- ScViewData* pViewData = pActiveViewSh->GetViewData();
+ ScViewData& rViewData = pActiveViewSh->GetViewData();
if ( bNewView )
- pViewData->GetDocShell()->PostEditView( pEngine, aCursorPos );
+ rViewData.GetDocShell()->PostEditView( pEngine, aCursorPos );
- pViewData->EditGrowY();
- pViewData->EditGrowX();
+ rViewData.EditGrowY();
+ rViewData.EditGrowX();
}
SyncViews( pView );
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index c2ca1f7e8351..12fd5728b3ae 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -310,7 +310,7 @@ bool ScInputWindow::UseSubTotal(ScRangeList* pRangeList) const
ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
if ( pViewSh )
{
- ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
size_t nRangeCount (pRangeList->size());
size_t nRangeIndex (0);
while (!bSubTotal && nRangeIndex < nRangeCount)
@@ -402,12 +402,12 @@ void ScInputWindow::Select()
ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
if ( pViewSh )
{
- const ScMarkData& rMark = pViewSh->GetViewData()->GetMarkData();
+ const ScMarkData& rMark = pViewSh->GetViewData().GetMarkData();
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
{
ScRangeList aMarkRangeList;
rMark.FillRangeListWithMarks( &aMarkRangeList, false );
- ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
// check if one of the marked ranges is empty
bool bEmpty = false;
@@ -464,7 +464,7 @@ void ScInputWindow::Select()
ScRangeList aRangeList;
const bool bDataFound = pViewSh->GetAutoSumArea( aRangeList );
const bool bSubTotal( UseSubTotal( &aRangeList ) );
- ScAddress aAddr = pViewSh->GetViewData()->GetCurPos();
+ ScAddress aAddr = pViewSh->GetViewData().GetCurPos();
const OUString aFormula = pViewSh->GetAutoSumFormula( aRangeList, bSubTotal, aAddr );
SetFuncString( aFormula );
@@ -515,8 +515,8 @@ void ScInputWindow::Select()
const OUString& rString = aTextWindow.GetTextString();
const sal_Int32 nLen = rString.getLength();
- ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
- CellType eCellType = pDoc->GetCellType( pViewSh->GetViewData()->GetCurPos() );
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
+ CellType eCellType = pDoc->GetCellType( pViewSh->GetViewData().GetCurPos() );
switch ( eCellType )
{
case CELLTYPE_VALUE:
@@ -1357,8 +1357,8 @@ void ScMultiTextWnd::InitEditEngine()
ScDocShell* pDocSh = NULL;
if ( pViewSh )
{
- pDocSh = pViewSh->GetViewData()->GetDocShell();
- ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
+ pDocSh = pViewSh->GetViewData().GetDocShell();
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
pNew = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool());
}
else
@@ -1424,8 +1424,8 @@ void ScMultiTextWnd::InitEditEngine()
// repaint now to have the EditEngine's version visible
if (pDocSh)
{
- ScDocument* pDoc = pDocSh->GetDocument(); // any document
- sal_uInt8 nScript = pDoc->GetStringScriptType( aString );
+ ScDocument& rDoc = pDocSh->GetDocument(); // any document
+ sal_uInt8 nScript = rDoc.GetStringScriptType( aString );
if ( nScript & SCRIPTTYPE_COMPLEX )
Invalidate();
}
@@ -1609,12 +1609,12 @@ void ScTextWnd::Command( const CommandEvent& rCEvt )
ScTabViewShell* pEndViewSh = ScTabViewShell::GetActiveViewShell();
if ( pEndViewSh != pStartViewSh && pStartViewSh != NULL )
{
- ScViewData* pViewData = pStartViewSh->GetViewData();
+ ScViewData& rViewData = pStartViewSh->GetViewData();
ScInputHandler* pHdl = pScMod->GetInputHdl( pStartViewSh );
- if ( pHdl && pViewData->HasEditView( pViewData->GetActivePart() ) )
+ if ( pHdl && rViewData.HasEditView( rViewData.GetActivePart() ) )
{
pHdl->CancelHandler();
- pViewData->GetView()->ShowCursor(); // Missing for KillEditView, due to being inactive
+ rViewData.GetView()->ShowCursor(); // Missing for KillEditView, due to being inactive
}
}
}
@@ -1734,7 +1734,7 @@ void ScTextWnd::StartEditEngine()
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if ( pViewSh )
{
- ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
pNew = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool());
}
else
@@ -1800,8 +1800,8 @@ void ScTextWnd::StartEditEngine()
// SfxObjectShell* pObjSh = SfxObjectShell::Current();
if ( pObjSh && pObjSh->ISA(ScDocShell) )
{
- ScDocument* pDoc = ((ScDocShell*)pObjSh)->GetDocument(); // any document
- sal_uInt8 nScript = pDoc->GetStringScriptType( aString );
+ ScDocument& rDoc = ((ScDocShell*)pObjSh)->GetDocument(); // any document
+ sal_uInt8 nScript = rDoc.GetStringScriptType( aString );
if ( nScript & SCRIPTTYPE_COMPLEX )
Invalidate();
}
@@ -1900,9 +1900,9 @@ void ScTextWnd::SetTextString( const OUString& rNewString )
if ( pObjSh && pObjSh->ISA(ScDocShell) )
{
// any document can be used (used only for its break iterator)
- ScDocument* pDoc = ((ScDocShell*)pObjSh)->GetDocument();
- nOldScript = pDoc->GetStringScriptType( aString );
- nNewScript = pDoc->GetStringScriptType( rNewString );
+ ScDocument& rDoc = ((ScDocShell*)pObjSh)->GetDocument();
+ nOldScript = rDoc.GetStringScriptType( aString );
+ nNewScript = rDoc.GetStringScriptType( rNewString );
}
bPaintAll = ( nOldScript & SCRIPTTYPE_COMPLEX ) || ( nNewScript & SCRIPTTYPE_COMPLEX );
}
@@ -1978,7 +1978,7 @@ void ScTextWnd::MakeDialogEditView()
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if ( pViewSh )
{
- ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
+ ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
pNew = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool());
}
else
@@ -2139,14 +2139,14 @@ void ScPosWnd::FillRangeNames()
SfxObjectShell* pObjSh = SfxObjectShell::Current();
if ( pObjSh && pObjSh->ISA(ScDocShell) )
{
- ScDocument* pDoc = ((ScDocShell*)pObjSh)->GetDocument();
+ ScDocument& rDoc = ((ScDocShell*)pObjSh)->GetDocument();
InsertEntry(ScGlobal::GetRscString( STR_MANAGE_NAMES ));
SetSeparatorPos(0);
ScRange aDummy;
std::set<OUString> aSet;
- ScRangeName* pRangeNames = pDoc->GetRangeName();
+ ScRangeName* pRangeNames = rDoc.GetRangeName();
if (!pRangeNames->empty())
{
ScRangeName::const_iterator itrBeg = pRangeNames->begin(), itrEnd = pRangeNames->end();
@@ -2156,13 +2156,13 @@ void ScPosWnd::FillRangeNames()
aSet.insert(itr->second->GetName());
}
}
- for (SCTAB i = 0; i < pDoc->GetTableCount(); ++i)
+ for (SCTAB i = 0; i < rDoc.GetTableCount(); ++i)
{
- ScRangeName* pLocalRangeName = pDoc->GetRangeName(i);
+ ScRangeName* pLocalRangeName = rDoc.GetRangeName(i);
if (pLocalRangeName && !pLocalRangeName->empty())
{
OUString aTableName;
- pDoc->GetName(i, aTableName);
+ rDoc.GetName(i, aTableName);
for (ScRangeName::const_iterator itr = pLocalRangeName->begin(); itr != pLocalRangeName->end(); ++itr)
{
if (itr->second->IsValidReference(aDummy))
@@ -2256,9 +2256,9 @@ static ScNameInputType lcl_GetInputType( const OUString& rText )
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if ( pViewSh )
{
- ScViewData* pViewData = pViewSh->GetViewData();
- ScDocument* pDoc = pViewData->GetDocument();
- SCTAB nTab = pViewData->GetTabNo();
+ ScViewData& rViewData = pViewSh->GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
+ SCTAB nTab = rViewData.GetTabNo();
formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
// test in same order as in SID_CURRENTCELL execute
@@ -2286,7 +2286,7 @@ static ScNameInputType lcl_GetInputType( const OUString& rText )
eRet = SC_NAME_INPUT_SHEET;
else if ( ScRangeData::IsNameValid( rText, pDoc ) ) // nothing found, create new range?
{
- if ( pViewData->GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
+ if ( rViewData.GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
eRet = SC_NAME_INPUT_DEFINE;
else
eRet = SC_NAME_INPUT_BAD_SELECTION;
@@ -2401,9 +2401,9 @@ void ScPosWnd::DoEnter()
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if ( pViewSh )
{
- ScViewData* pViewData = pViewSh->GetViewData();
- ScDocShell* pDocShell = pViewData->GetDocShell();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScViewData& rViewData = pViewSh->GetViewData();
+ ScDocShell* pDocShell = rViewData.GetDocShell();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScNameInputType eType = lcl_GetInputType( aText );
if ( eType == SC_NAME_INPUT_BAD_NAME || eType == SC_NAME_INPUT_BAD_SELECTION )
@@ -2413,15 +2413,15 @@ void ScPosWnd::DoEnter()
}
else if ( eType == SC_NAME_INPUT_DEFINE )
{
- ScRangeName* pNames = pDoc->GetRangeName();
+ ScRangeName* pNames = rDoc.GetRangeName();
ScRange aSelection;
if ( pNames && !pNames->findByUpperName(ScGlobal::pCharClass->uppercase(aText)) &&
- (pViewData->GetSimpleArea( aSelection ) == SC_MARK_SIMPLE) )
+ (rViewData.GetSimpleArea( aSelection ) == SC_MARK_SIMPLE) )
{
ScRangeName aNewRanges( *pNames );
- ScAddress aCursor( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() );
- OUString aContent(aSelection.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
- ScRangeData* pNew = new ScRangeData( pDoc, aText, aContent, aCursor );
+ ScAddress aCursor( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
+ OUString aContent(aSelection.Format(SCR_ABS_3D, &rDoc, rDoc.GetAddressConvention()));
+ ScRangeData* pNew = new ScRangeData( &rDoc, aText, aContent, aCursor );
if ( aNewRanges.insert(pNew) )
{
pDocShell->GetDocFunc().ModifyRangeNames( aNewRanges );
@@ -2444,15 +2444,15 @@ void ScPosWnd::DoEnter()
{
// Note that SID_CURRENTCELL always expects address to
// be in Calc A1 format. Convert the text.
- ScRange aRange(0,0,pViewData->GetTabNo());
- aRange.ParseAny(aText, pDoc, pDoc->GetAddressConvention());
- aText = aRange.Format(SCR_ABS_3D, pDoc, ::formula::FormulaGrammar::CONV_OOO);
+ ScRange aRange(0,0, rViewData.GetTabNo());
+ aRange.ParseAny(aText, &rDoc, rDoc.GetAddressConvention());
+ aText = aRange.Format(SCR_ABS_3D, &rDoc, ::formula::FormulaGrammar::CONV_OOO);
}
SfxStringItem aPosItem( SID_CURRENTCELL, aText );
SfxBoolItem aUnmarkItem( FN_PARAM_1, true ); // remove existing selection
- pViewSh->GetViewData()->GetDispatcher().Execute( SID_CURRENTCELL,
+ pViewSh->GetViewData().GetDispatcher().Execute( SID_CURRENTCELL,
SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD,
&aPosItem, &aUnmarkItem, 0L );
}
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index b070c3697f7e..cfaa93ca15a5 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -234,9 +234,9 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3
{
ScDocShell* pDocSh = ((ScDocShell*)pObjSh);
if ( bArrows )
- ScDetectiveFunc( pDocSh->GetDocument(), 0 ).UpdateAllArrowColors();
+ ScDetectiveFunc( &pDocSh->GetDocument(), 0 ).UpdateAllArrowColors();
if ( bComments )
- ScDetectiveFunc::UpdateAllComments( *pDocSh->GetDocument() );
+ ScDetectiveFunc::UpdateAllComments( pDocSh->GetDocument() );
}
pObjSh = SfxObjectShell::GetNext( *pObjSh );
}
@@ -283,7 +283,7 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3
pDocSh->CalcOutputFactor();
- SCTAB nTabCount = pDocSh->GetDocument()->GetTableCount();
+ SCTAB nTabCount = pDocSh->GetDocument().GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
pDocSh->AdjustRowHeight( 0, MAXROW, nTab );
}
@@ -400,7 +400,7 @@ void ScModule::Execute( SfxRequest& rReq )
{ // Toggle
ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
if ( pDocSh )
- bSet = !pDocSh->GetDocument()->GetDocOptions().IsAutoSpell();
+ bSet = !pDocSh->GetDocument().GetDocOptions().IsAutoSpell();
else
bSet = !GetDocOptions().IsAutoSpell();
}
@@ -502,12 +502,12 @@ void ScModule::Execute( SfxRequest& rReq )
if ( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( GetPool().GetWhich(nSlot), true, &pItem ) )
{
ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
- ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL;
- if ( pDoc )
+ if ( pDocSh )
{
+ ScDocument& rDoc = pDocSh->GetDocument();
LanguageType eNewLang = ((SvxLanguageItem*)pItem)->GetLanguage();
LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
LanguageType eOld = ( nSlot == SID_ATTR_CHAR_CJK_LANGUAGE ) ? eCjk :
( ( nSlot == SID_ATTR_CHAR_CTL_LANGUAGE ) ? eCtl : eLatin );
if ( eNewLang != eOld )
@@ -519,7 +519,7 @@ void ScModule::Execute( SfxRequest& rReq )
else
eLatin = eNewLang;
- pDoc->SetLanguage( eLatin, eCjk, eCtl );
+ rDoc.SetLanguage( eLatin, eCjk, eCtl );
ScInputHandler* pInputHandler = GetInputHdl();
if ( pInputHandler )
@@ -598,21 +598,17 @@ void ScModule::GetState( SfxItemSet& rSet )
rSet.Put( SfxUInt16Item( nWhich, sal::static_int_cast<sal_uInt16>(GetAppOptions().GetAppMetric()) ) );
break;
case SID_AUTOSPELL_CHECK:
- rSet.Put( SfxBoolItem( nWhich, pDocSh->GetDocument()->GetDocOptions().IsAutoSpell()) );
+ rSet.Put( SfxBoolItem( nWhich, pDocSh->GetDocument().GetDocOptions().IsAutoSpell()) );
break;
case SID_ATTR_LANGUAGE:
case ATTR_CJK_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CJK_LANGUAGE
case ATTR_CTL_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CTL_LANGUAGE
{
- ScDocument* pDoc = pDocSh->GetDocument();
- if ( pDoc )
- {
- LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
- LanguageType eLang = ( nWhich == ATTR_CJK_FONT_LANGUAGE ) ? eCjk :
- ( ( nWhich == ATTR_CTL_FONT_LANGUAGE ) ? eCtl : eLatin );
- rSet.Put( SvxLanguageItem( eLang, nWhich ) );
- }
+ LanguageType eLatin, eCjk, eCtl;
+ pDocSh->GetDocument().GetLanguage( eLatin, eCjk, eCtl );
+ LanguageType eLang = ( nWhich == ATTR_CJK_FONT_LANGUAGE ) ? eCjk :
+ ( ( nWhich == ATTR_CTL_FONT_LANGUAGE ) ? eCtl : eLatin );
+ rSet.Put( SvxLanguageItem( eLang, nWhich ) );
}
break;
}
@@ -971,7 +967,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
- ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL;
+ ScDocument* pDoc = pDocSh ? &pDocSh->GetDocument() : NULL;
const SfxPoolItem* pItem = NULL;
bool bRepaint = false;
bool bUpdateMarks = false;
@@ -1062,16 +1058,16 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
if ( pViewSh )
{
- ScViewData* pViewData = pViewSh->GetViewData();
- const ScViewOptions& rOldOpt = pViewData->GetOptions();
+ ScViewData& rViewData = pViewSh->GetViewData();
+ const ScViewOptions& rOldOpt = rViewData.GetOptions();
bool bAnchorList = ( rOldOpt.GetOption( VOPT_ANCHOR ) !=
rNewOpt.GetOption( VOPT_ANCHOR ) );
if ( rOldOpt != rNewOpt )
{
- pViewData->SetOptions( rNewOpt ); // Changes rOldOpt
- pViewData->GetDocument()->SetViewOptions( rNewOpt );
+ rViewData.SetOptions( rNewOpt ); // Changes rOldOpt
+ rViewData.GetDocument()->SetViewOptions( rNewOpt );
if (pDocSh)
pDocSh->SetDocumentModified();
bRepaint = true;
@@ -1095,15 +1091,15 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
if ( pViewSh )
{
- ScViewData* pViewData = pViewSh->GetViewData();
- ScViewOptions aNewViewOpt( pViewData->GetOptions() );
+ ScViewData& rViewData = pViewSh->GetViewData();
+ ScViewOptions aNewViewOpt( rViewData.GetOptions() );
const ScGridOptions& rOldGridOpt = aNewViewOpt.GetGridOptions();
if ( rOldGridOpt != aNewGridOpt )
{
aNewViewOpt.SetGridOptions( aNewGridOpt );
- pViewData->SetOptions( aNewViewOpt );
- pViewData->GetDocument()->SetViewOptions( aNewViewOpt );
+ rViewData.SetOptions( aNewViewOpt );
+ rViewData.GetDocument()->SetViewOptions( aNewViewOpt );
pDocSh->SetDocumentModified();
bRepaint = true;
}
@@ -1329,7 +1325,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
{
ScDocShell* pOneDocSh = ((ScDocShell*)pObjSh);
pOneDocSh->CalcOutputFactor();
- SCTAB nTabCount = pOneDocSh->GetDocument()->GetTableCount();
+ SCTAB nTabCount = pOneDocSh->GetDocument().GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
pOneDocSh->AdjustRowHeight( 0, MAXROW, nTab );
}
@@ -1349,8 +1345,8 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
pHdl->UpdateRefDevice();
// update view scale
- ScViewData* pViewData = pOneViewSh->GetViewData();
- pOneViewSh->SetZoom( pViewData->GetZoomX(), pViewData->GetZoomY(), false );
+ ScViewData& rViewData = pOneViewSh->GetViewData();
+ pOneViewSh->SetZoom( rViewData.GetZoomX(), rViewData.GetZoomY(), false );
// repaint
pOneViewSh->PaintGrid();
@@ -1893,14 +1889,14 @@ IMPL_LINK_NOARG(ScModule, IdleHandler)
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
- bAutoSpell = pDoc->GetDocOptions().IsAutoSpell();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ bAutoSpell = rDoc.GetDocOptions().IsAutoSpell();
if (pDocSh->IsReadOnly())
bAutoSpell = false;
- sc::DocumentLinkManager& rLinkMgr = pDoc->GetDocLinkManager();
+ sc::DocumentLinkManager& rLinkMgr = rDoc.GetDocLinkManager();
bool bLinks = rLinkMgr.idleCheckLinks();
- bool bWidth = pDoc->IdleCalcTextWidth();
+ bool bWidth = rDoc.IdleCalcTextWidth();
bMore = bLinks || bWidth; // Still something at all?
@@ -2008,13 +2004,13 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId )
ScDocShell* pDocSh = PTR_CAST(ScDocShell,
SfxObjectShell::Current());
ScDocOptions aCalcOpt = pDocSh
- ? pDocSh->GetDocument()->GetDocOptions()
+ ? pDocSh->GetDocument().GetDocOptions()
: GetDocOptions();
ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,
SfxViewShell::Current());
ScViewOptions aViewOpt = pViewSh
- ? pViewSh->GetViewData()->GetOptions()
+ ? pViewSh->GetViewData().GetOptions()
: GetViewOptions();
ScUserListItem aULItem( SCITEM_USERLIST );
@@ -2085,7 +2081,7 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId )
if (pDocSh)
{
ScCalcConfig aConfig( aOptions.GetCalcConfig());
- aConfig.MergeDocumentSpecific( pDocSh->GetDocument()->GetCalcConfig());
+ aConfig.MergeDocumentSpecific( pDocSh->GetDocument().GetCalcConfig());
aOptions.SetCalcConfig( aConfig);
}
pRet->Put( ScTpFormulaItem( SID_SCFORMULAOPTIONS, aOptions ) );
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index 2008695ecf53..04c32072217d 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -111,14 +111,14 @@ ScSelectionTransferObj* ScSelectionTransferObj::CreateFromView( ScTabView* pView
if ( eMode == SC_SELTRANS_INVALID ) // no drawing object selected
{
ScRange aRange;
- ScViewData* pViewData = pView->GetViewData();
- const ScMarkData& rMark = pViewData->GetMarkData();
+ ScViewData& rViewData = pView->GetViewData();
+ const ScMarkData& rMark = rViewData.GetMarkData();
// allow MultiMarked because GetSimpleArea may be able to merge into a simple range
// (GetSimpleArea modifies a local copy of MarkData)
// Also allow simple filtered area.
ScMarkType eMarkType;
if ( ( rMark.IsMarked() || rMark.IsMultiMarked() ) &&
- (((eMarkType = pViewData->GetSimpleArea( aRange )) == SC_MARK_SIMPLE) ||
+ (((eMarkType = rViewData.GetSimpleArea( aRange )) == SC_MARK_SIMPLE) ||
(eMarkType == SC_MARK_SIMPLE_FILTERED)) )
{
// only for "real" selection, cursor alone isn't used
@@ -269,19 +269,19 @@ void ScSelectionTransferObj::CreateCellData()
OSL_ENSURE( !pCellData, "CreateCellData twice" );
if ( pView )
{
- ScViewData* pViewData = pView->GetViewData();
- ScMarkData aNewMark( pViewData->GetMarkData() ); // use local copy for MarkToSimple
+ ScViewData& rViewData = pView->GetViewData();
+ ScMarkData aNewMark( rViewData.GetMarkData() ); // use local copy for MarkToSimple
aNewMark.MarkToSimple();
// similar to ScViewFunctionSet::BeginDrag
if ( aNewMark.IsMarked() && !aNewMark.IsMultiMarked() )
{
- ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
ScRange aSelRange;
aNewMark.GetMarkArea( aSelRange );
ScDocShellRef aDragShellRef;
- if ( pDocSh->GetDocument()->HasOLEObjectsInArea( aSelRange, &aNewMark ) )
+ if ( pDocSh->GetDocument().HasOLEObjectsInArea( aSelRange, &aNewMark ) )
{
aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
aDragShellRef->DoInitNew(NULL);
@@ -292,7 +292,7 @@ void ScSelectionTransferObj::CreateCellData()
// bApi = sal_True -> no error messages
// #i18364# bStopEdit = sal_False -> don't end edit mode
// (this may be called from pasting into the edit line)
- bool bCopied = pViewData->GetView()->CopyToClip( pClipDoc, false, true, true, false );
+ bool bCopied = rViewData.GetView()->CopyToClip( pClipDoc, false, true, true, false );
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -351,8 +351,8 @@ void ScSelectionTransferObj::CreateDrawData()
SdrModel* pModel = pDrawView->GetMarkedObjModel();
ScDrawLayer::SetGlobalDrawPersist(NULL);
- ScViewData* pViewData = pView->GetViewData();
- ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScViewData& rViewData = pView->GetViewData();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
TransferableObjectDescriptor aObjDesc;
pDocSh->FillTransferableObjectDescriptor( aObjDesc );
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 1d3bb94e2906..f0c6c73e20bf 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -555,7 +555,7 @@ ScDocument* ScTransferObj::GetSourceDocument()
{
ScDocShell* pSourceDocSh = GetSourceDocShell();
if (pSourceDocSh)
- return pSourceDocSh->GetDocument();
+ return &pSourceDocSh->GetDocument();
return NULL;
}
@@ -595,17 +595,17 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
pDocSh->DoInitNew(NULL);
- ScDocument* pDestDoc = pDocSh->GetDocument();
+ ScDocument& rDestDoc = pDocSh->GetDocument();
ScMarkData aDestMark;
aDestMark.SelectTable( 0, true );
- pDestDoc->SetDocOptions( pDoc->GetDocOptions() ); // #i42666#
+ rDestDoc.SetDocOptions( pDoc->GetDocOptions() ); // #i42666#
OUString aTabName;
pDoc->GetName( aBlock.aStart.Tab(), aTabName );
- pDestDoc->RenameTab( 0, aTabName, false ); // no UpdateRef (empty)
+ rDestDoc.RenameTab( 0, aTabName, false ); // no UpdateRef (empty)
- pDestDoc->CopyStdStylesFrom( pDoc );
+ rDestDoc.CopyStdStylesFrom( pDoc );
SCCOL nStartX = aBlock.aStart.Col();
SCROW nStartY = aBlock.aStart.Row();
@@ -617,24 +617,24 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
SCCOL nCol;
SCTAB nSrcTab = aBlock.aStart.Tab();
- pDestDoc->SetLayoutRTL(0, pDoc->IsLayoutRTL(nSrcTab));
+ rDestDoc.SetLayoutRTL(0, pDoc->IsLayoutRTL(nSrcTab));
for (nCol=nStartX; nCol<=nEndX; nCol++)
if ( pDoc->ColHidden(nCol, nSrcTab) )
- pDestDoc->ShowCol( nCol, 0, false );
+ rDestDoc.ShowCol( nCol, 0, false );
else
- pDestDoc->SetColWidth( nCol, 0, pDoc->GetColWidth( nCol, nSrcTab ) );
+ rDestDoc.SetColWidth( nCol, 0, pDoc->GetColWidth( nCol, nSrcTab ) );
for (SCROW nRow = nStartY; nRow <= nEndY; ++nRow)
{
if ( pDoc->RowHidden(nRow, nSrcTab) )
- pDestDoc->ShowRow( nRow, 0, false );
+ rDestDoc.ShowRow( nRow, 0, false );
else
{
- pDestDoc->SetRowHeight( nRow, 0, pDoc->GetOriginalHeight( nRow, nSrcTab ) );
+ rDestDoc.SetRowHeight( nRow, 0, pDoc->GetOriginalHeight( nRow, nSrcTab ) );
// if height was set manually, that flag has to be copied, too
bool bManual = pDoc->IsManualRowHeight(nRow, nSrcTab);
- pDestDoc->SetManualHeight(nRow, nRow, 0, bManual);
+ rDestDoc.SetManualHeight(nRow, nRow, 0, bManual);
}
}
@@ -649,15 +649,15 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
bool bWasCut = pDoc->IsCutMode();
if (!bWasCut)
pDoc->SetClipArea( aDestRange, true ); // Cut
- pDestDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL, NULL, pDoc, false );
+ rDestDoc.CopyFromClip( aDestRange, aDestMark, IDF_ALL, NULL, pDoc, false );
pDoc->SetClipArea( aDestRange, bWasCut );
- StripRefs( pDoc, nStartX,nStartY, nEndX,nEndY, pDestDoc, 0,0 );
+ StripRefs( pDoc, nStartX,nStartY, nEndX,nEndY, &rDestDoc, 0,0 );
ScRange aMergeRange = aDestRange;
- pDestDoc->ExtendMerge( aMergeRange, true );
+ rDestDoc.ExtendMerge( aMergeRange, true );
- pDoc->CopyDdeLinks( pDestDoc ); // copy values of DDE Links
+ pDoc->CopyDdeLinks( &rDestDoc ); // copy values of DDE Links
// page format (grid etc) and page size (maximum size for ole object)
@@ -671,7 +671,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
aPaperSize = ((const SvxSizeItem&) rSourceSet.Get(ATTR_PAGE_SIZE)).GetSize();
// CopyStyleFrom kopiert SetItems mit richtigem Pool
- ScStyleSheetPool* pDestPool = pDestDoc->GetStyleSheetPool();
+ ScStyleSheetPool* pDestPool = rDestDoc.GetStyleSheetPool();
pDestPool->CopyStyleFrom( pStylePool, aStyleName, SFX_STYLE_FAMILY_PAGE );
}
@@ -680,7 +680,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
aViewData.SetCurX( nStartX );
aViewData.SetCurY( nStartY );
- pDestDoc->SetViewOptions( pDoc->GetViewOptions() );
+ rDestDoc.SetViewOptions( pDoc->GetViewOptions() );
// Size
//! get while copying sizes
@@ -689,8 +689,8 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
long nPosY = 0;
for (nCol=0; nCol<nStartX; nCol++)
- nPosX += pDestDoc->GetColWidth( nCol, 0 );
- nPosY += pDestDoc->GetRowHeight( 0, nStartY-1, 0 );
+ nPosX += rDestDoc.GetColWidth( nCol, 0 );
+ nPosY += rDestDoc.GetRowHeight( 0, nStartY-1, 0 );
nPosX = (long) ( nPosX * HMM_PER_TWIPS );
nPosY = (long) ( nPosY * HMM_PER_TWIPS );
@@ -702,14 +702,14 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
long nSizeY = 0;
for (nCol=nStartX; nCol<=nEndX; nCol++)
{
- long nAdd = pDestDoc->GetColWidth( nCol, 0 );
+ long nAdd = rDestDoc.GetColWidth( nCol, 0 );
if ( bLimitToPageSize && nSizeX+nAdd > aPaperSize.Width() && nSizeX ) // above limit?
break;
nSizeX += nAdd;
}
for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
{
- long nAdd = pDestDoc->GetRowHeight( nRow, 0 );
+ long nAdd = rDestDoc.GetRowHeight( nRow, 0 );
if ( bLimitToPageSize && nSizeY+nAdd > aPaperSize.Height() && nSizeY ) // above limit?
break;
nSizeY += nAdd;
@@ -727,8 +727,8 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
pDocSh->UpdateOle(&aViewData, true);
//! SetDocumentModified?
- if ( pDestDoc->IsChartListenerCollectionNeedsUpdate() )
- pDestDoc->UpdateChartListenerCollection();
+ if ( rDestDoc.IsChartListenerCollectionNeedsUpdate() )
+ rDestDoc.UpdateChartListenerCollection();
}
}
diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index 3bd36c39c5ff..67a973255831 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -69,10 +69,10 @@ ScConsolidateDlg::ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, Window
rArgSet.Get( rArgSet.GetPool()->
GetWhich( SID_CONSOLIDATE ) )
).GetData() ),
- pViewData ( ((ScTabViewShell*)SfxViewShell::Current())->
+ rViewData ( ((ScTabViewShell*)SfxViewShell::Current())->
GetViewData() ),
pDoc ( ((ScTabViewShell*)SfxViewShell::Current())->
- GetViewData()->GetDocument() ),
+ GetViewData().GetDocument() ),
pRangeUtil ( new ScRangeUtil ),
pAreaData ( NULL ),
nAreaDataCount ( 0 ),
@@ -113,7 +113,7 @@ ScConsolidateDlg::~ScConsolidateDlg()
void ScConsolidateDlg::Init()
{
- OSL_ENSURE( pViewData && pDoc && pRangeUtil, "Error in Ctor" );
+ OSL_ENSURE( pDoc && pRangeUtil, "Error in Ctor" );
OUString aStr;
sal_uInt16 i=0;
@@ -299,11 +299,11 @@ void ScConsolidateDlg::Deactivate()
bool ScConsolidateDlg::VerifyEdit( formula::RefEdit* pEd )
{
- if ( !pRangeUtil || !pDoc || !pViewData ||
+ if ( !pRangeUtil || !pDoc ||
((pEd != pEdDataArea) && (pEd != pEdDestArea)) )
return false;
- SCTAB nTab = pViewData->GetTabNo();
+ SCTAB nTab = rViewData.GetTabNo();
bool bEditOk = false;
OUString theCompleteStr;
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
@@ -357,7 +357,7 @@ IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl)
if ( nDataAreaCount > 0 )
{
ScRefAddress aDestAddress;
- SCTAB nTab = pViewData->GetTabNo();
+ SCTAB nTab = rViewData.GetTabNo();
OUString aDestPosStr( pEdDestArea->GetText() );
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index d3a0c9c5a8e8..b253b28d9a78 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -148,7 +148,7 @@ void ScNewScenarioDlg::SetScenarioData( const OUString& rName, const OUString& r
IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl)
{
OUString aName = comphelper::string::strip(m_pEdName->GetText(), ' ');
- ScDocument* pDoc = ((ScTabViewShell*)SfxViewShell::Current())->GetViewData()->GetDocument();
+ ScDocument* pDoc = ((ScTabViewShell*)SfxViewShell::Current())->GetViewData().GetDocument();
m_pEdName->SetText( aName );
diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx
index 3eda96fc61f7..6333016fc1b9 100644
--- a/sc/source/ui/dbgui/scuiimoptdlg.cxx
+++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx
@@ -215,7 +215,7 @@ ScImportOptionsDlg::ScImportOptionsDlg(
m_pCbFormulas->Show();
ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current());
bool bFormulas = (pViewSh ?
- pViewSh->GetViewData()->GetOptions().GetOption( VOPT_FORMULAS) :
+ pViewSh->GetViewData().GetOptions().GetOption( VOPT_FORMULAS) :
false);
m_pCbFormulas->Check( bFormulas );
}
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index cb7344e411b7..6bfb499821ae 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -75,7 +75,7 @@ ScAreaLink::ScAreaLink( SfxObjectShell* pShell, const OUString& rFile,
OSL_ENSURE(pShell->ISA(ScDocShell), "ScAreaLink mit falscher ObjectShell");
pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell );
SetRefreshHandler( LINK( this, ScAreaLink, RefreshHdl ) );
- SetRefreshControl( pImpl->m_pDocSh->GetDocument()->GetRefreshTimerControlAddress() );
+ SetRefreshControl( &pImpl->m_pDocSh->GetDocument().GetRefreshTimerControlAddress() );
}
ScAreaLink::~ScAreaLink()
@@ -109,7 +109,7 @@ void ScAreaLink::Edit(Window* pParent, const Link& /* rEndEditHdl */ )
if (bInCreate)
return SUCCESS;
- sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument().GetLinkManager();
if (pLinkManager!=NULL)
{
OUString aFile, aArea, aFilter;
@@ -143,8 +143,8 @@ void ScAreaLink::Closed()
{
// Verknuepfung loeschen: Undo
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
if (bAddUndo && bUndo)
{
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction( new ScUndoRemoveAreaLink( pImpl->m_pDocSh,
@@ -155,8 +155,8 @@ void ScAreaLink::Closed()
}
SCTAB nDestTab = aDestArea.aStart.Tab();
- if (pDoc->IsStreamValid(nDestTab))
- pDoc->SetStreamValid(nDestTab, false);
+ if (rDoc.IsStreamValid(nDestTab))
+ rDoc.SetStreamValid(nDestTab, false);
SvBaseLink::Closed();
}
@@ -242,10 +242,10 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
if (!pFilter)
return false;
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- pDoc->SetInLinkUpdate( true );
+ bool bUndo (rDoc.IsUndoEnabled());
+ rDoc.SetInLinkUpdate( true );
// wenn neuer Filter ausgewaehlt wurde, Optionen vergessen
if ( rNewFilter != aFilterName )
@@ -258,7 +258,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
SfxObjectShellLock aRef = pSrcShell;
pSrcShell->DoLoad(pMed);
- ScDocument* pSrcDoc = pSrcShell->GetDocument();
+ ScDocument& rSrcDoc = pSrcShell->GetDocument();
// Optionen koennten gesetzt worden sein
OUString aNewOpt = ScDocumentLoader::GetOptions(*pMed);
@@ -269,7 +269,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
OUString aTempArea;
if( rNewFilter == ScDocShell::GetWebQueryFilterName() )
- aTempArea = ScFormatFilter::Get().GetHTMLRangeNameList( pSrcDoc, rNewArea );
+ aTempArea = ScFormatFilter::Get().GetHTMLRangeNameList( &rSrcDoc, rNewArea );
else
aTempArea = rNewArea;
@@ -284,7 +284,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
{
OUString aToken( aTempArea.getToken( 0, ';', nStringIx ) );
ScRange aTokenRange;
- if( FindExtRange( aTokenRange, pSrcDoc, aToken ) )
+ if( FindExtRange( aTokenRange, &rSrcDoc, aToken ) )
{
// columns: find maximum
nWidth = std::max( nWidth, (SCCOL)(aTokenRange.aEnd.Col() - aTokenRange.aStart.Col() + 1) );
@@ -310,7 +310,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
//! check CanFitBlock only if bDoInsert is set?
bool bCanDo = ValidColRow( aNewRange.aEnd.Col(), aNewRange.aEnd.Row() ) &&
- pDoc->CanFitBlock( aOldRange, aNewRange );
+ rDoc.CanFitBlock( aOldRange, aNewRange );
if (bCanDo)
{
ScDocShellModificator aModificator( *pImpl->m_pDocSh );
@@ -332,18 +332,18 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
{
if ( nNewEndX != nOldEndX || nNewEndY != nOldEndY ) // Bereich veraendert?
{
- pUndoDoc->InitUndo( pDoc, 0, pDoc->GetTableCount()-1 );
- pDoc->CopyToDocument( 0,0,0,MAXCOL,MAXROW,MAXTAB,
+ pUndoDoc->InitUndo( &rDoc, 0, rDoc.GetTableCount()-1 );
+ rDoc.CopyToDocument( 0,0,0,MAXCOL,MAXROW,MAXTAB,
IDF_FORMULA, false, pUndoDoc ); // alle Formeln
}
else
- pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab ); // nur Zieltabelle
+ rDoc.CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
}
else // ohne Einfuegen
{
- pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab ); // nur Zieltabelle
+ rDoc.CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
}
}
@@ -351,9 +351,9 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
// DeleteAreaTab loescht auch MERGE_FLAG Attribute
if (bDoInsert)
- pDoc->FitBlock( aOldRange, aNewRange ); // incl. loeschen
+ rDoc.FitBlock( aOldRange, aNewRange ); // incl. loeschen
else
- pDoc->DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE );
+ rDoc.DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE );
// Daten kopieren
@@ -366,7 +366,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
{
OUString aToken( aTempArea.getToken( 0, ';', nStringIx ) );
ScRange aTokenRange;
- if( FindExtRange( aTokenRange, pSrcDoc, aToken ) )
+ if( FindExtRange( aTokenRange, &rSrcDoc, aToken ) )
{
SCTAB nSrcTab = aTokenRange.aStart.Tab();
ScMarkData aSourceMark;
@@ -374,14 +374,14 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
aSourceMark.SetMarkArea( aTokenRange );
ScClipParam aClipParam(aTokenRange, false);
- pSrcDoc->CopyToClip(aClipParam, &aClipDoc, &aSourceMark);
+ rSrcDoc.CopyToClip(aClipParam, &aClipDoc, &aSourceMark);
if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
//! ResetAttrib am Dokument !!!
- ScPatternAttr aPattern( pSrcDoc->GetPool() );
+ ScPatternAttr aPattern( rSrcDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeAttr() ); // Defaults
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
aClipDoc.ApplyPatternAreaTab( 0,0, MAXCOL,MAXROW, nSrcTab, aPattern );
@@ -392,7 +392,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
ScMarkData aDestMark;
aDestMark.SelectOneTable( nDestTab );
aDestMark.SetMarkArea( aNewTokenRange );
- pDoc->CopyFromClip( aNewTokenRange, aDestMark, IDF_ALL, NULL, &aClipDoc, false );
+ rDoc.CopyFromClip( aNewTokenRange, aDestMark, IDF_ALL, NULL, &aClipDoc, false );
aNewTokenRange.aStart.SetRow( aNewTokenRange.aEnd.Row() + 2 );
}
}
@@ -400,7 +400,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
else
{
OUString aErr = ScGlobal::GetRscString(STR_LINKERROR);
- pDoc->SetString( aDestPos.Col(), aDestPos.Row(), aDestPos.Tab(), aErr );
+ rDoc.SetString( aDestPos.Col(), aDestPos.Row(), aDestPos.Tab(), aErr );
}
// Undo eintragen
@@ -408,8 +408,8 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
if ( bAddUndo && bUndo)
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndo( pDoc, nDestTab, nDestTab );
- pDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
+ pRedoDoc->InitUndo( &rDoc, nDestTab, nDestTab );
+ rDoc.CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
new ScUndoUpdateAreaLink( pImpl->m_pDocSh,
@@ -468,7 +468,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
aRef->DoClose();
- pDoc->SetInLinkUpdate( false );
+ rDoc.SetInLinkUpdate( false );
if (bCanDo)
{
@@ -476,7 +476,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
//! also notify Uno objects if file name was changed!
ScLinkRefreshedHint aHint;
aHint.SetAreaLink( aDestPos );
- pDoc->BroadcastUno( aHint );
+ rDoc.BroadcastUno( aHint );
}
return bCanDo;
diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx
index 5b9951c6769a..84f4db54704f 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -306,7 +306,7 @@ DataStream* DataStream::Set(
sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings)
{
DataStream* pLink = new DataStream(pShell, rURL, rRange, nLimit, eMove, nSettings);
- sc::DocumentLinkManager& rMgr = pShell->GetDocument()->GetDocLinkManager();
+ sc::DocumentLinkManager& rMgr = pShell->GetDocument().GetDocLinkManager();
rMgr.setDataStream(pLink);
return pLink;
}
@@ -314,8 +314,7 @@ DataStream* DataStream::Set(
DataStream::DataStream(ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings) :
mpDocShell(pShell),
- mpDoc(mpDocShell->GetDocument()),
- maDocAccess(*mpDoc),
+ maDocAccess(mpDocShell->GetDocument()),
meOrigMove(NO_MOVE),
meMove(NO_MOVE),
mbRunning(false),
@@ -546,7 +545,7 @@ void DataStream::Text2Doc()
if (meMove == RANGE_DOWN)
{
++mnCurRow;
-// mpDocShell->GetViewData()->GetView()->AlignToCursor(
+// mpDocShell->GetViewData().GetView()->AlignToCursor(
// maStartRange.aStart.Col(), mnCurRow, SC_FOLLOW_JUMP);
}
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index deaf24481a34..d6c9a0df990a 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -58,9 +58,9 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection* pDocColl = pDoc->GetDBCollection();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection* pDocColl = rDoc.GetDBCollection();
+ bool bUndo (rDoc.IsUndoEnabled());
ScDBCollection* pUndoColl = NULL;
if (bUndo)
@@ -73,13 +73,13 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool
// #i55926# While loading XML, formula cells only have a single string token,
// so CompileDBFormula would never find any name (index) tokens, and would
// unnecessarily loop through all cells.
- bool bCompile = !pDoc->IsImportingXML();
+ bool bCompile = !rDoc.IsImportingXML();
bool bOk;
if ( bCompile )
- pDoc->CompileDBFormula( true ); // CreateFormulaString
+ rDoc.CompileDBFormula( true ); // CreateFormulaString
if ( rName == STR_DB_LOCAL_NONAME )
{
- pDoc->SetAnonymousDBData(rRange.aStart.Tab() , pNew);
+ rDoc.SetAnonymousDBData(rRange.aStart.Tab() , pNew);
bOk = true;
}
else
@@ -87,7 +87,7 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool
bOk = pDocColl->getNamedDBs().insert(pNew);
}
if ( bCompile )
- pDoc->CompileDBFormula( false ); // CompileFormulaString
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
if (!bOk)
{
@@ -111,9 +111,9 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool
bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
{
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection* pDocColl = pDoc->GetDBCollection();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection* pDocColl = rDoc.GetDBCollection();
+ bool bUndo = rDoc.IsUndoEnabled();
ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
const ScDBData* p = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rName));
@@ -125,9 +125,9 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
if (bUndo)
pUndoColl = new ScDBCollection( *pDocColl );
- pDoc->CompileDBFormula( true ); // CreateFormulaString
+ rDoc.CompileDBFormula( true ); // CreateFormulaString
rDBs.erase(*p);
- pDoc->CompileDBFormula( false ); // CompileFormulaString
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
if (bUndo)
{
@@ -147,9 +147,9 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
{
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection* pDocColl = pDoc->GetDBCollection();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection* pDocColl = rDoc.GetDBCollection();
+ bool bUndo = rDoc.IsUndoEnabled();
ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
const ScDBData* pOld = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rOld));
const ScDBData* pNew = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rNew));
@@ -161,16 +161,16 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
ScDBCollection* pUndoColl = new ScDBCollection( *pDocColl );
- pDoc->CompileDBFormula(true); // CreateFormulaString
+ rDoc.CompileDBFormula(true); // CreateFormulaString
rDBs.erase(*pOld);
bool bInserted = rDBs.insert(pNewData);
if (!bInserted) // Fehler -> alten Zustand wiederherstellen
{
delete pNewData;
- pDoc->SetDBCollection(pUndoColl); // gehoert dann dem Dokument
+ rDoc.SetDBCollection(pUndoColl); // gehoert dann dem Dokument
}
- pDoc->CompileDBFormula( false ); // CompileFormulaString
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
if (bInserted) // Einfuegen hat geklappt
{
@@ -195,9 +195,9 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
bool ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
{
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection* pDocColl = pDoc->GetDBCollection();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection* pDocColl = rDoc.GetDBCollection();
+ bool bUndo = rDoc.IsUndoEnabled();
ScDBData* pData = NULL;
if (rNewData.GetName() == STR_DB_LOCAL_NONAME)
@@ -205,7 +205,7 @@ bool ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
ScRange aRange;
rNewData.GetArea(aRange);
SCTAB nTab = aRange.aStart.Tab();
- pData = pDoc->GetAnonymousDBData(nTab);
+ pData = rDoc.GetAnonymousDBData(nTab);
}
else
pData = pDocColl->getNamedDBs().findByUpperName(rNewData.GetUpperName());
@@ -224,7 +224,7 @@ bool ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
*pData = rNewData;
if (bAreaChanged)
- pDoc->CompileDBFormula();
+ rDoc.CompileDBFormula();
if (bUndo)
{
@@ -245,17 +245,17 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
//! auch fuer ScDBFunc::RepeatDB benutzen!
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScDBData* pDBData = NULL;
if (bIsUnnamed)
{
- pDBData = pDoc->GetAnonymousDBData( aTab );
+ pDBData = rDoc.GetAnonymousDBData( aTab );
}
else
{
- ScDBCollection* pColl = pDoc->GetDBCollection();
+ ScDBCollection* pColl = rDoc.GetDBCollection();
if (pColl)
pDBData = pColl->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rDBName));
}
@@ -281,7 +281,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
ScRange aNewQuery;
if (bQuery && !aQueryParam.bInplace)
{
- ScDBData* pDest = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ ScDBData* pDest = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
aQueryParam.nDestTab, true );
if (pDest && pDest->IsDoSize())
{
@@ -306,9 +306,9 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
if (bRecord)
{
- 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 );
@@ -316,31 +316,31 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
// column/row state
SCCOLROW nOutStartCol, nOutEndCol;
SCCOLROW nOutStartRow, 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,
+ 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 );
- pDoc->CopyToDocument( 0, static_cast<SCROW>(nOutStartRow),
+ rDoc.CopyToDocument( 0, static_cast<SCROW>(nOutStartRow),
nTab, MAXCOL, static_cast<SCROW>(nOutEndRow), nTab,
IDF_NONE, false, pUndoDoc );
}
else
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
// Datenbereich sichern - incl. Filter-Ergebnis
- pDoc->CopyToDocument( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab, IDF_ALL, false, pUndoDoc );
+ rDoc.CopyToDocument( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab, IDF_ALL, false, pUndoDoc );
// alle Formeln wegen Referenzen
- pDoc->CopyToDocument( 0,0,0, MAXCOL,MAXROW,nTabCount-1, IDF_FORMULA, false, pUndoDoc );
+ 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 );
}
@@ -390,7 +390,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
const ScRange* pNew = NULL;
if (bQuerySize)
{
- ScDBData* pDest = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ ScDBData* pDest = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
aQueryParam.nDestTab, true );
if (pDest)
{
@@ -427,13 +427,13 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
SCTAB nSrcTab = nTab;
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
- ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rSortParam.nCol1, rSortParam.nRow1,
+ ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rSortParam.nCol1, rSortParam.nRow1,
rSortParam.nCol2, rSortParam.nRow2 );
if (!pDBData)
{
@@ -459,13 +459,13 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
}
nTab = rSortParam.nDestTab;
- pDestData = pDoc->GetDBAtCursor( rSortParam.nDestCol, rSortParam.nDestRow,
+ pDestData = rDoc.GetDBAtCursor( rSortParam.nDestCol, rSortParam.nDestRow,
rSortParam.nDestTab, true );
if (pDestData)
pDestData->GetArea(aOldDest);
}
- ScEditableTester aTester( pDoc, nTab, aLocalParam.nCol1,aLocalParam.nRow1,
+ ScEditableTester aTester( &rDoc, nTab, aLocalParam.nCol1,aLocalParam.nRow1,
aLocalParam.nCol2,aLocalParam.nRow2 );
if (!aTester.IsEditable())
{
@@ -474,7 +474,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
return false;
}
- if ( aLocalParam.bIncludePattern && pDoc->HasAttrib(
+ if ( aLocalParam.bIncludePattern && rDoc.HasAttrib(
aLocalParam.nCol1, aLocalParam.nRow1, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
@@ -495,14 +495,14 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
// Calculate the script types for all cells in the sort range beforehand.
// This will speed up the row height adjustment that takes place after the
// sort.
- pDoc->UpdateScriptTypes(
+ rDoc.UpdateScriptTypes(
ScAddress(aLocalParam.nCol1,nStartRow,nTab),
aLocalParam.nCol2-aLocalParam.nCol1+1,
aLocalParam.nRow2-nStartRow+1);
// No point adjusting row heights after the sort when all rows have the same height.
bool bUniformRowHeight =
- pDoc->HasUniformRowHeight(nTab, nStartRow, aLocalParam.nRow2);
+ rDoc.HasUniformRowHeight(nTab, nStartRow, aLocalParam.nRow2);
bool bRepeatQuery = false; // bestehenden Filter wiederholen?
ScQueryParam aQueryParam;
@@ -527,14 +527,14 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
// Zeilenhoehen immer (wegen automatischer Anpassung)
//! auf ScBlockUndo umstellen
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
/* #i59745# Do not copy note captions to undo document. All existing
caption objects will be repositioned while sorting which is tracked
in drawing undo. When undo is executed, the old positions will be
restored, and the cells with the old notes (which still refer to the
existing captions) will be copied back into the source document. */
- pDoc->CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nTab,
+ rDoc.CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab,
IDF_ALL|IDF_NOCAPTIONS, false, pUndoDoc );
@@ -547,18 +547,18 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
caption objects are reinserted with drawing undo, and the cells
with the old notes (which still refer to the existing captions)
will be copied back into the source document. */
- pDoc->CopyToDocument( aOldDest, IDF_ALL|IDF_NOCAPTIONS, false, pUndoDoc );
+ rDoc.CopyToDocument( aOldDest, IDF_ALL|IDF_NOCAPTIONS, false, pUndoDoc );
pR = &aOldDest;
}
// Zeilenhoehen immer (wegen automatischer Anpassung)
//! auf ScBlockUndo umstellen
// if (bRepeatQuery)
- pDoc->CopyToDocument( 0, aLocalParam.nRow1, nTab, MAXCOL, aLocalParam.nRow2, nTab,
+ rDoc.CopyToDocument( 0, aLocalParam.nRow1, nTab, MAXCOL, aLocalParam.nRow2, nTab,
IDF_NONE, false, pUndoDoc );
ScDBCollection* pUndoDB = NULL;
- ScDBCollection* pDocDB = pDoc->GetDBCollection();
+ ScDBCollection* pDocDB = rDoc.GetDBCollection();
if (!pDocDB->empty())
pUndoDB = new ScDBCollection( *pDocDB );
@@ -573,7 +573,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
if ( bCopy )
{
if (pDestData)
- pDoc->DeleteAreaTab(aOldDest, IDF_CONTENTS); // Zielbereich vorher loeschen
+ rDoc.DeleteAreaTab(aOldDest, IDF_CONTENTS); // Zielbereich vorher loeschen
ScRange aSource( rSortParam.nCol1,rSortParam.nRow1,nSrcTab,
rSortParam.nCol2,rSortParam.nRow2,nSrcTab );
@@ -586,7 +586,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
if (aLocalParam.GetSortKeyCount() && aLocalParam.maKeyState[0].bDoSort)
{
ScProgress aProgress(&rDocShell, ScGlobal::GetRscString(STR_PROGRESS_SORTING), 0);
- pDoc->Sort( nTab, aLocalParam, bRepeatQuery, &aProgress );
+ rDoc.Sort( nTab, aLocalParam, bRepeatQuery, &aProgress );
}
bool bSave = true;
@@ -641,7 +641,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
ScRange aDirtyRange(
aLocalParam.nCol1, nStartRow, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab);
- pDoc->SetDirty( aDirtyRange );
+ rDoc.SetDirty( aDirtyRange );
if (bPaint)
{
@@ -683,10 +683,10 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rQueryParam.nCol1, rQueryParam.nRow1,
+ ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rQueryParam.nCol1, rQueryParam.nRow1,
rQueryParam.nCol2, rQueryParam.nRow2 );
if (!pDBData)
{
@@ -736,7 +736,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
return false;
}
- ScEditableTester aTester( pDoc, nDestTab, aLocalParam.nCol1,aLocalParam.nRow1,
+ ScEditableTester aTester( &rDoc, nDestTab, aLocalParam.nCol1,aLocalParam.nRow1,
aLocalParam.nCol2,aLocalParam.nRow2);
if (!aTester.IsEditable())
{
@@ -745,7 +745,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
return false;
}
- pDestData = pDoc->GetDBAtCursor( rQueryParam.nDestCol, rQueryParam.nDestRow,
+ pDestData = rDoc.GetDBAtCursor( rQueryParam.nDestCol, rQueryParam.nDestRow,
rQueryParam.nDestTab, true );
if (pDestData)
{
@@ -765,12 +765,12 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
SCROW nTestRow = rQueryParam.nDestRow +
( aLocalParam.bHasHeader ? 1 : 0 );
while ( nTestCol <= MAXCOL &&
- pDoc->GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
+ rDoc.GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
++nTestCol, ++nFormulaCols;
}
bKeepFmt = pDestData->IsKeepFmt();
- if ( bDoSize && !pDoc->CanFitBlock( aOldDest, aDestTotal ) )
+ if ( bDoSize && !rDoc.CanFitBlock( aOldDest, aDestTotal ) )
{
if (!bApi)
rDocShell.ErrorMessage(STR_MSSG_DOSUBTOTALS_2); // kann keine Zeilen einfuegen
@@ -802,30 +802,30 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bCopy)
{
- pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab, false, true );
- pDoc->CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
+ pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab, false, true );
+ rDoc.CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
aLocalParam.nCol2, aLocalParam.nRow2, nDestTab,
IDF_ALL, false, pUndoDoc );
// Attribute sichern, falls beim Filtern mitkopiert
if (pDestData)
{
- pDoc->CopyToDocument( aOldDest, IDF_ALL, false, pUndoDoc );
+ rDoc.CopyToDocument( aOldDest, IDF_ALL, false, pUndoDoc );
pOld = &aOldDest;
}
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, rQueryParam.nRow1, nTab, MAXCOL, rQueryParam.nRow2, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, rQueryParam.nRow1, nTab, MAXCOL, rQueryParam.nRow2, nTab,
IDF_NONE, false, pUndoDoc );
}
- ScDBCollection* pDocDB = pDoc->GetDBCollection();
+ ScDBCollection* pDocDB = rDoc.GetDBCollection();
if (!pDocDB->empty())
pUndoDB = new ScDBCollection( *pDocDB );
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
ScDocument* pAttribDoc = NULL;
@@ -845,18 +845,18 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
aAttribRange.aEnd.SetCol( aAttribRange.aEnd.Col() + nFormulaCols );
pAttribDoc = new ScDocument( SCDOCMODE_UNDO );
- pAttribDoc->InitUndo( pDoc, nDestTab, nDestTab, false, true );
- pDoc->CopyToDocument( aAttribRange, IDF_ATTRIB, false, pAttribDoc );
+ pAttribDoc->InitUndo( &rDoc, nDestTab, nDestTab, false, true );
+ rDoc.CopyToDocument( aAttribRange, IDF_ATTRIB, false, pAttribDoc );
}
if ( bDoSize )
- pDoc->FitBlock( aOldDest, aDestTotal );
+ rDoc.FitBlock( aOldDest, aDestTotal );
else
- pDoc->DeleteAreaTab(aOldDest, IDF_ALL); // einfach loeschen
+ rDoc.DeleteAreaTab(aOldDest, IDF_ALL); // einfach loeschen
}
// Filtern am Dokument ausfuehren
- SCSIZE nCount = pDoc->Query( nTab, rQueryParam, bKeepSub );
+ SCSIZE nCount = rDoc.Query( nTab, rQueryParam, bKeepSub );
if (bCopy)
{
aLocalParam.nRow2 = aLocalParam.nRow1 + nCount;
@@ -870,7 +870,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
ScRange aNewDest( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
aLocalParam.nCol2, aLocalParam.nRow2, nDestTab );
- pDoc->FitBlock( aDestTotal, aNewDest, false ); // sal_False - nicht loeschen
+ rDoc.FitBlock( aDestTotal, aNewDest, false ); // sal_False - nicht loeschen
if ( nFormulaCols > 0 )
{
@@ -881,7 +881,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
aLocalParam.nCol2+nFormulaCols, aLocalParam.nRow2, nDestTab );
ScRange aOldForm = aNewForm;
aOldForm.aEnd.SetRow( aOldDest.aEnd.Row() );
- pDoc->FitBlock( aOldForm, aNewForm, false );
+ rDoc.FitBlock( aOldForm, aNewForm, false );
ScMarkData aMark;
aMark.SelectOneTable(nDestTab);
@@ -889,10 +889,10 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
sal_uLong nProgCount = nFormulaCols;
nProgCount *= aLocalParam.nRow2 - nFStartY;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aLocalParam.nCol2+1, nFStartY,
+ rDoc.Fill( aLocalParam.nCol2+1, nFStartY,
aLocalParam.nCol2+nFormulaCols, nFStartY, &aProgress, aMark,
aLocalParam.nRow2 - nFStartY,
FILL_TO_BOTTOM, FILL_SIMPLE );
@@ -906,7 +906,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
{
ScRange aHdrRange = aAttribRange;
aHdrRange.aEnd.SetRow( aHdrRange.aStart.Row() );
- pAttribDoc->CopyToDocument( aHdrRange, IDF_ATTRIB, false, pDoc );
+ pAttribDoc->CopyToDocument( aHdrRange, IDF_ATTRIB, false, &rDoc );
}
// Daten
@@ -919,11 +919,11 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
OSL_ENSURE(pSrcPattern,"Pattern ist 0");
if (pSrcPattern)
{
- pDoc->ApplyPatternAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
+ rDoc.ApplyPatternAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
nDestTab, *pSrcPattern );
const ScStyleSheet* pStyle = pSrcPattern->GetStyleSheet();
if (pStyle)
- pDoc->ApplyStyleAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
+ rDoc.ApplyStyleAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
nDestTab, *pStyle );
}
}
@@ -974,13 +974,13 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
if (!bCopy)
{
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
}
// #i23299# Subtotal functions depend on cell's filtered states.
ScRange aDirtyRange(0 , aLocalParam.nRow1, nDestTab, MAXCOL, aLocalParam.nRow2, nDestTab);
- pDoc->SetSubTotalCellsDirty(aDirtyRange);
+ rDoc.SetSubTotalCellsDirty(aDirtyRange);
if ( bRecord )
{
@@ -1028,10 +1028,10 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
bool bDo = !rParam.bRemoveOnly; // sal_False = nur loeschen
bool bRet = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ 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)
{
@@ -1039,7 +1039,7 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
return false;
}
- ScEditableTester aTester( pDoc, nTab, 0,rParam.nRow1+1, MAXCOL,MAXROW );
+ ScEditableTester aTester( &rDoc, nTab, 0,rParam.nRow1+1, MAXCOL,MAXROW );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1047,7 +1047,7 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
return false;
}
- 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 ))
{
if (!bApi)
@@ -1057,7 +1057,7 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
bool bOk = true;
if (rParam.bReplace)
- if (pDoc->TestRemoveSubTotals( nTab, rParam ))
+ if (rDoc.TestRemoveSubTotals( nTab, rParam ))
{
bOk = ( MessBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
// "StarCalc" "Daten loeschen?"
@@ -1081,9 +1081,9 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
{
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 );
@@ -1091,40 +1091,40 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
// column/row state
SCCOLROW nOutStartCol, nOutEndCol;
SCCOLROW nOutStartRow, 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 );
}
-// pDoc->SetOutlineTable( nTab, NULL );
- ScOutlineTable* pOut = pDoc->GetOutlineTable( nTab );
+// rDoc.SetOutlineTable( nTab, NULL );
+ ScOutlineTable* pOut = rDoc.GetOutlineTable( nTab );
if (pOut)
- pOut->GetRowArray()->RemoveAll(); // nur Zeilen-Outlines loeschen
+ pOut->GetRowArray().RemoveAll(); // nur Zeilen-Outlines loeschen
if (rParam.bReplace)
- pDoc->RemoveSubTotals( nTab, aNewParam );
+ rDoc.RemoveSubTotals( nTab, aNewParam );
bool bSuccess = true;
if (bDo)
{
@@ -1142,12 +1142,12 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
Sort( nTab, aSortParam, false, false, bApi );
}
- bSuccess = pDoc->DoSubTotals( nTab, aNewParam );
- pDoc->SetDrawPageSize(nTab);
+ bSuccess = rDoc.DoSubTotals( nTab, aNewParam );
+ rDoc.SetDrawPageSize(nTab);
}
ScRange aDirtyRange( aNewParam.nCol1, aNewParam.nRow1, nTab,
aNewParam.nCol2, aNewParam.nRow2, nTab );
- pDoc->SetDirty( aDirtyRange );
+ rDoc.SetDirty( aDirtyRange );
if (bRecord)
{
@@ -1169,7 +1169,7 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
// merken
pDBData->SetSubTotalParam( aNewParam );
pDBData->SetArea( nTab, aNewParam.nCol1,aNewParam.nRow1, aNewParam.nCol2,aNewParam.nRow2 );
- pDoc->CompileDBFormula();
+ rDoc.CompileDBFormula();
rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL,MAXROW,nTab),
PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE);
@@ -1199,8 +1199,8 @@ bool lcl_EmptyExcept( ScDocument* pDoc, const ScRange& rRange, const ScRange& rE
bool isEditable(ScDocShell& rDocShell, const ScRangeList& rRanges, bool bApi)
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (!rDocShell.IsEditable() || pDoc->GetChangeTrack())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (!rDocShell.IsEditable() || rDoc.GetChangeTrack())
{
// not recorded -> disallow
if (!bApi)
@@ -1212,7 +1212,7 @@ bool isEditable(ScDocShell& rDocShell, const ScRangeList& rRanges, bool bApi)
for (size_t i = 0, n = rRanges.size(); i < n; ++i)
{
const ScRange* p = rRanges[i];
- ScEditableTester aTester(pDoc, *p);
+ ScEditableTester aTester(&rDoc, *p);
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1237,7 +1237,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
bool checkNewOutputRange(ScDPObject& rDPObj, ScDocShell& rDocShell, ScRange& rNewOut, bool bApi)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
bool bOverflow = false;
rNewOut = rDPObj.GetNewOutputRange(bOverflow);
@@ -1265,7 +1265,7 @@ bool checkNewOutputRange(ScDPObject& rDPObj, ScDocShell& rDocShell, ScRange& rNe
return false;
}
- ScEditableTester aTester(pDoc, rNewOut);
+ ScEditableTester aTester(&rDoc, rNewOut);
if (!aTester.IsEditable())
{
// destination area isn't editable
@@ -1318,12 +1318,12 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
ScDPObject aUndoDPObj(*pOldObj); // for undo or revert on failure
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
if (bRecord)
- createUndoDoc(pOldUndoDoc, pDoc, pOldObj->GetOutRange());
+ createUndoDoc(pOldUndoDoc, &rDoc, pOldObj->GetOutRange());
pNewObj->WriteSourceDataTo(*pOldObj); // copy source data
@@ -1339,7 +1339,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
// make sure the table has a name (not set by dialog)
if (pOldObj->GetName().isEmpty())
- pOldObj->SetName( pDoc->GetDPCollection()->CreateNewName() );
+ pOldObj->SetName( rDoc.GetDPCollection()->CreateNewName() );
ScRange aNewOut;
if (!checkNewOutputRange(*pOldObj, rDocShell, aNewOut, bApi))
@@ -1352,7 +1352,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
if (!bApi)
{
// OutRange of pOldObj (pDestObj) is still old area
- if (!lcl_EmptyExcept(pDoc, aNewOut, pOldObj->GetOutRange()))
+ if (!lcl_EmptyExcept(&rDoc, aNewOut, pOldObj->GetOutRange()))
{
QueryBox aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
@@ -1366,7 +1366,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, pDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
pOldObj->Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1379,7 +1379,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
}
// notify API objects
- pDoc->BroadcastUno( ScDataPilotModifiedHint(pOldObj->GetName()) );
+ rDoc.BroadcastUno( ScDataPilotModifiedHint(pOldObj->GetName()) );
aModificator.SetDocumentModified();
return true;
@@ -1401,8 +1401,8 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
if (bRecord)
pUndoDPObj.reset(new ScDPObject(rDPObj)); // copy old settings for undo
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
// delete table
@@ -1411,16 +1411,16 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
SCTAB nTab = aRange.aStart.Tab();
if (bRecord)
- createUndoDoc(pOldUndoDoc, pDoc, aRange);
+ createUndoDoc(pOldUndoDoc, &rDoc, aRange);
- pDoc->DeleteAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.DeleteAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
nTab, IDF_ALL );
- pDoc->RemoveFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.RemoveFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
nTab, SC_MF_AUTO );
- pDoc->GetDPCollection()->FreeTable(&rDPObj); // object is deleted here
+ rDoc.GetDPCollection()->FreeTable(&rDPObj); // object is deleted here
rDocShell.PostPaintGridAll(); //! only necessary parts
rDocShell.PostPaint(aRange, PAINT_GRID);
@@ -1451,8 +1451,8 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
std::auto_ptr<ScDocument> pNewUndoDoc;
SAL_WNODEPRECATED_DECLARATIONS_POP
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
// output range must be set at pNewObj
@@ -1465,10 +1465,10 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
// #i94570# When changing the output position in the dialog, a new table is created
// with the settings from the old table, including the name.
// So we have to check for duplicate names here (before inserting).
- if (pDoc->GetDPCollection()->GetByName(rDestObj.GetName()))
+ if (rDoc.GetDPCollection()->GetByName(rDestObj.GetName()))
rDestObj.SetName(OUString()); // ignore the invalid name, create a new name below
- if (!pDoc->GetDPCollection()->InsertNewTable(pDestObj.release()))
+ if (!rDoc.GetDPCollection()->InsertNewTable(pDestObj.release()))
// Insertion into collection failed.
return false;
@@ -1478,7 +1478,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
// make sure the table has a name (not set by dialog)
if (rDestObj.GetName().isEmpty())
- rDestObj.SetName(pDoc->GetDPCollection()->CreateNewName());
+ rDestObj.SetName(rDoc.GetDPCollection()->CreateNewName());
bool bOverflow = false;
ScRange aNewOut = rDestObj.GetNewOutputRange(bOverflow);
@@ -1492,7 +1492,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
}
{
- ScEditableTester aTester(pDoc, aNewOut);
+ ScEditableTester aTester(&rDoc, aNewOut);
if (!aTester.IsEditable())
{
// destination area isn't editable
@@ -1506,7 +1506,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
// test if new output area is empty except for old area
if (!bApi)
{
- bool bEmpty = pDoc->IsBlockEmpty(
+ bool bEmpty = rDoc.IsBlockEmpty(
aNewOut.aStart.Tab(), aNewOut.aStart.Col(), aNewOut.aStart.Row(),
aNewOut.aEnd.Col(), aNewOut.aEnd.Row());
@@ -1525,7 +1525,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, pDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
rDestObj.Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1537,7 +1537,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
}
// notify API objects
- pDoc->BroadcastUno(ScDataPilotModifiedHint(rDestObj.GetName()));
+ rDoc.BroadcastUno(ScDataPilotModifiedHint(rDestObj.GetName()));
aModificator.SetDocumentModified();
return true;
@@ -1558,12 +1558,12 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
ScDPObject aUndoDPObj(rDPObj); // For undo or revert on failure.
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
if (bRecord)
- createUndoDoc(pOldUndoDoc, pDoc, rDPObj.GetOutRange());
+ createUndoDoc(pOldUndoDoc, &rDoc, rDPObj.GetOutRange());
rDPObj.SetAllowMove(false);
rDPObj.ReloadGroupTableData();
@@ -1574,7 +1574,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
// make sure the table has a name (not set by dialog)
if (rDPObj.GetName().isEmpty())
- rDPObj.SetName( pDoc->GetDPCollection()->CreateNewName() );
+ rDPObj.SetName( rDoc.GetDPCollection()->CreateNewName() );
ScRange aNewOut;
if (!checkNewOutputRange(rDPObj, rDocShell, aNewOut, bApi))
@@ -1586,7 +1586,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
// test if new output area is empty except for old area
if (!bApi)
{
- if (!lcl_EmptyExcept(pDoc, aNewOut, rDPObj.GetOutRange()))
+ if (!lcl_EmptyExcept(&rDoc, aNewOut, rDPObj.GetOutRange()))
{
QueryBox aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
@@ -1599,7 +1599,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, pDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
rDPObj.Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1612,14 +1612,14 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
}
// notify API objects
- pDoc->BroadcastUno( ScDataPilotModifiedHint(rDPObj.GetName()) );
+ rDoc.BroadcastUno( ScDataPilotModifiedHint(rDPObj.GetName()) );
aModificator.SetDocumentModified();
return true;
}
sal_uLong ScDBDocFunc::RefreshPivotTables(ScDPObject* pDPObj, bool bApi)
{
- ScDPCollection* pDPs = rDocShell.GetDocument()->GetDPCollection();
+ ScDPCollection* pDPs = rDocShell.GetDocument().GetDPCollection();
if (!pDPs)
return 0;
@@ -1645,7 +1645,7 @@ void ScDBDocFunc::RefreshPivotTableGroups(ScDPObject* pDPObj)
if (!pDPObj)
return;
- ScDPCollection* pDPs = rDocShell.GetDocument()->GetDPCollection();
+ ScDPCollection* pDPs = rDocShell.GetDocument().GetDPCollection();
if (!pDPs)
return;
@@ -1681,8 +1681,8 @@ void ScDBDocFunc::UpdateImport( const OUString& rTarget, const svx::ODataAccessD
{
// rTarget is the name of a database range
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection& rDBColl = *pDoc->GetDBCollection();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection& rDBColl = *rDoc.GetDBCollection();
const ScDBData* pData = rDBColl.getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rTarget));
if (!pData)
{
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 6f7d16161c78..8aec5c0c9feb 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -119,17 +119,17 @@ bool ScDBDocFunc::DoImportUno( const ScAddress& rPos,
bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
const svx::ODataAccessDescriptor* pDescriptor, bool bRecord, bool bAddrInsert )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScChangeTrack *pChangeTrack = NULL;
ScRange aChangedRange;
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScDBData* pDBData = NULL;
if ( !bAddrInsert )
{
- pDBData = pDoc->GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1,
+ pDBData = rDoc.GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1,
rParam.nCol2, rParam.nRow2 );
if (!pDBData)
{
@@ -187,7 +187,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
// ImportDoc - also used for Redo
ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO );
- pImportDoc->InitUndo( pDoc, nTab, nTab );
+ pImportDoc->InitUndo( &rDoc, nTab, nTab );
// get data from database into import document
@@ -413,7 +413,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
SCCOL nTestCol = rParam.nCol2 + 1; // right of the data
SCROW nTestRow = rParam.nRow1 + 1; // below the title row
while ( nTestCol <= MAXCOL &&
- pDoc->GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
+ rDoc.GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
++nTestCol, ++nFormulaCols;
}
@@ -421,14 +421,14 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
{
// old and new range editable?
ScEditableTester aTester;
- aTester.TestBlock( pDoc, nTab, rParam.nCol1,rParam.nRow1,rParam.nCol2,rParam.nRow2 );
- aTester.TestBlock( pDoc, nTab, rParam.nCol1,rParam.nRow1,nEndCol,nEndRow );
+ aTester.TestBlock( &rDoc, nTab, rParam.nCol1,rParam.nRow1,rParam.nCol2,rParam.nRow2 );
+ aTester.TestBlock( &rDoc, nTab, rParam.nCol1,rParam.nRow1,nEndCol,nEndRow );
if ( !aTester.IsEditable() )
{
nErrStringId = aTester.GetMessageId();
bSuccess = false;
}
- else if ( (pChangeTrack = pDoc->GetChangeTrack()) != NULL )
+ else if ( (pChangeTrack = rDoc.GetChangeTrack()) != NULL )
aChangedRange = ScRange(rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab );
}
@@ -439,7 +439,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
ScRange aNew( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab );
- if (!pDoc->CanFitBlock( aOld, aNew ))
+ if (!rDoc.CanFitBlock( aOld, aNew ))
{
nErrStringId = STR_MSSG_DOSUBTOTALS_2; // can't insert cells
bSuccess = false;
@@ -460,14 +460,14 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
SCCOL nMinEndCol = std::min( rParam.nCol2, nEndCol ); // not too much
nMinEndCol = sal::static_int_cast<SCCOL>( nMinEndCol + nFormulaCols ); // only if column count unchanged
pImportDoc->DeleteAreaTab( 0,0, MAXCOL,MAXROW, nTab, IDF_ATTRIB );
- pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
+ rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nMinEndCol, rParam.nRow1, nTab,
IDF_ATTRIB, false, pImportDoc );
SCROW nDataStartRow = rParam.nRow1+1;
for (SCCOL nCopyCol=rParam.nCol1; nCopyCol<=nMinEndCol; nCopyCol++)
{
- const ScPatternAttr* pSrcPattern = pDoc->GetPattern(
+ const ScPatternAttr* pSrcPattern = rDoc.GetPattern(
nCopyCol, nDataStartRow, nTab );
pImportDoc->ApplyPatternAreaTab( nCopyCol, nDataStartRow, nCopyCol, nEndRow,
nTab, *pSrcPattern );
@@ -479,7 +479,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
}
// don't set cell protection attribute if table is protected
- if (pDoc->IsTabProtected(nTab))
+ if (rDoc.IsTabProtected(nTab))
{
ScPatternAttr aPattern(pImportDoc->GetPool());
aPattern.GetItemSet().Put( ScProtectionAttr( false,false,false,false ) );
@@ -498,7 +498,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if ( bRecord )
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
if ( !bAddrInsert )
pUndoDBData = new ScDBData( *pDBData );
@@ -513,15 +513,15 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
sal_uInt16 nCopyFlags = IDF_ALL & ~IDF_NOTE;
// nFormulaCols is set only if column count is unchanged
- pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
+ rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
nCopyFlags, false, pUndoDoc );
if ( rParam.nCol2 > nEndCol )
- pDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
+ rDoc.CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
nUndoEndCol, nUndoEndRow, nTab,
nCopyFlags, false, pUndoDoc );
if ( rParam.nRow2 > nEndRow )
- pDoc->CopyToDocument( rParam.nCol1, nEndRow+1, nTab,
+ rDoc.CopyToDocument( rParam.nCol1, nEndRow+1, nTab,
nUndoEndCol+nFormulaCols, nUndoEndRow, nTab,
nCopyFlags, false, pUndoDoc );
}
@@ -537,48 +537,48 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
ScRange aDelRange( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2, rParam.nRow2, nTab );
- pDoc->DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln
+ rDoc.DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln
ScRange aOld( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
ScRange aNew( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab );
- pDoc->FitBlock( aOld, aNew, false ); // Formeln nicht loeschen
+ rDoc.FitBlock( aOld, aNew, false ); // Formeln nicht loeschen
}
else if ( nEndCol < rParam.nCol2 ) // DeleteArea calls PutInOrder
- pDoc->DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
+ rDoc.DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
aNewMark, IDF_CONTENTS & ~IDF_NOTE );
// CopyToDocument doesn't remove contents
- pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE );
+ rDoc.DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE );
// remove each column from ImportDoc after copying to reduce memory usage
- bool bOldAutoCalc = pDoc->GetAutoCalc();
- pDoc->SetAutoCalc( false ); // outside of the loop
+ bool bOldAutoCalc = rDoc.GetAutoCalc();
+ rDoc.SetAutoCalc( false ); // outside of the loop
for (SCCOL nCopyCol = rParam.nCol1; nCopyCol <= nEndCol; nCopyCol++)
{
pImportDoc->CopyToDocument( nCopyCol, rParam.nRow1, nTab, nCopyCol, nEndRow, nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
pImportDoc->DeleteAreaTab( nCopyCol, rParam.nRow1, nCopyCol, nEndRow, nTab, IDF_CONTENTS );
}
- pDoc->SetAutoCalc( bOldAutoCalc );
+ rDoc.SetAutoCalc( bOldAutoCalc );
if (nFormulaCols > 0) // copy formulas
{
if (bKeepFormat) // formats for formulas
pImportDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
- IDF_ATTRIB, false, pDoc );
+ IDF_ATTRIB, false, &rDoc );
// fill formulas
ScMarkData aMark;
aMark.SelectOneTable(nTab);
sal_uLong nProgCount = nFormulaCols;
nProgCount *= nEndRow-rParam.nRow1-1;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( nEndCol+1, rParam.nRow1+1, nEndCol+nFormulaCols, rParam.nRow1+1,
+ rDoc.Fill( nEndCol+1, rParam.nRow1+1, nEndCol+nFormulaCols, rParam.nRow1+1,
&aProgress, aMark, nEndRow-rParam.nRow1-1, FILL_TO_BOTTOM, FILL_SIMPLE );
}
@@ -587,10 +587,10 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if (!bMoveCells) // move has happened above
{
if ( rParam.nCol2 > nEndCol )
- pDoc->DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
+ rDoc.DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
aNewMark, IDF_CONTENTS );
if ( rParam.nRow2 > nEndRow )
- pDoc->DeleteArea( rParam.nCol1, nEndRow+1, rParam.nCol2, rParam.nRow2,
+ rDoc.DeleteArea( rParam.nCol1, nEndRow+1, rParam.nCol2, rParam.nRow2,
aNewMark, IDF_CONTENTS );
}
@@ -601,7 +601,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
pDBData->SetByRow( true );
pDBData->SetArea( nTab, rParam.nCol1,rParam.nRow1, nEndCol,nEndRow );
pDBData->SetImportSelection( bRealSelection );
- pDoc->CompileDBFormula();
+ rDoc.CompileDBFormula();
}
if (bRecord)
@@ -610,7 +610,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
pImportDoc = NULL;
if (nFormulaCols > 0) // include filled formulas for redo
- pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
+ rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
@@ -624,12 +624,12 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
}
sc::SetFormulaDirtyContext aCxt;
- pDoc->SetAllFormulasDirty(aCxt);
+ rDoc.SetAllFormulasDirty(aCxt);
rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
aModificator.SetDocumentModified();
ScDBRangeRefreshedHint aHint( rParam );
- pDoc->BroadcastUno( aHint );
+ rDoc.BroadcastUno( aHint );
if (pWaitWin)
pWaitWin->LeaveWait();
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index b67ef09bbfbf..fbac2b51c6ef 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -102,7 +102,7 @@ using ::std::vector;
IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction )
{
// #i101118# if drawing layer collects the undo actions, add it there
- ScDrawLayer* pDrawLayer = rDocShell.GetDocument()->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocShell.GetDocument().GetDrawLayer();
if( pDrawLayer && pDrawLayer->IsRecording() )
pDrawLayer->AddCalcUndo( pUndoAction );
else
@@ -110,11 +110,11 @@ IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction )
rDocShell.SetDrawModified();
// the affected sheet isn't known, so all stream positions are invalidated
- ScDocument* pDoc = rDocShell.GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ 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);
return 0;
}
@@ -134,13 +134,13 @@ static void lcl_PaintAbove( ScDocShell& rDocShell, const ScRange& rRange )
bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if ( pDoc->IsImportingXML() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if ( rDoc.IsImportingXML() )
{
// for XML import, all row heights are updated together after importing
return false;
}
- if ( !pDoc->IsAdjustHeightEnabled() )
+ if ( !rDoc.IsAdjustHeightEnabled() )
{
return false;
}
@@ -153,7 +153,7 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
Fraction aOne(1,1);
sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
- bool bChanged = pDoc->SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
+ bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
if ( bPaint && bChanged )
rDocShell.PostPaint(ScRange(0, nStartRow, nTab, MAXCOL, MAXROW, nTab),
@@ -168,23 +168,23 @@ bool ScDocFunc::DetectiveAddPred(const ScAddress& rPos)
ScDocShellModificator aModificator( rDocShell );
rDocShell.MakeDrawLayer();
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
SCCOL nCol = rPos.Col();
SCROW nRow = rPos.Row();
SCTAB nTab = rPos.Tab();
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).ShowPred( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowPred( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_ADDPRED );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -203,10 +203,10 @@ bool ScDocFunc::DetectiveAddPred(const ScAddress& rPos)
bool ScDocFunc::DetectiveDelPred(const ScAddress& rPos)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo(rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return false;
@@ -218,14 +218,14 @@ bool ScDocFunc::DetectiveDelPred(const ScAddress& rPos)
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).DeletePred( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeletePred( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_DELPRED );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -247,24 +247,24 @@ bool ScDocFunc::DetectiveAddSucc(const ScAddress& rPos)
ScDocShellModificator aModificator( rDocShell );
rDocShell.MakeDrawLayer();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo(rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
SCCOL nCol = rPos.Col();
SCROW nRow = rPos.Row();
SCTAB nTab = rPos.Tab();
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).ShowSucc( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowSucc( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_ADDSUCC );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -283,10 +283,10 @@ bool ScDocFunc::DetectiveAddSucc(const ScAddress& rPos)
bool ScDocFunc::DetectiveDelSucc(const ScAddress& rPos)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return false;
@@ -298,14 +298,14 @@ bool ScDocFunc::DetectiveDelSucc(const ScAddress& rPos)
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).DeleteSucc( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeleteSucc( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_DELSUCC );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -327,24 +327,24 @@ bool ScDocFunc::DetectiveAddError(const ScAddress& rPos)
ScDocShellModificator aModificator( rDocShell );
rDocShell.MakeDrawLayer();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
SCCOL nCol = rPos.Col();
SCROW nRow = rPos.Row();
SCTAB nTab = rPos.Tab();
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).ShowError( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowError( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_ADDERROR );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -366,10 +366,10 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab)
ScDocShellModificator aModificator( rDocShell );
rDocShell.MakeDrawLayer();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
Window* pWaitWin = rDocShell.GetActiveDialogParent();
if (pWaitWin)
@@ -377,7 +377,7 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab)
if (bUndo)
pModel->BeginCalcUndo(false);
bool bOverflow;
- bool bDone = ScDetectiveFunc( pDoc,nTab ).MarkInvalid( bOverflow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).MarkInvalid( bOverflow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
@@ -405,10 +405,10 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab)
bool ScDocFunc::DetectiveDelAll(SCTAB nTab)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return false;
@@ -416,18 +416,18 @@ bool ScDocFunc::DetectiveDelAll(SCTAB nTab)
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).DeleteAll( SC_DET_DETECTIVE );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeleteAll( SC_DET_DETECTIVE );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
- ScDetOpList* pOldList = pDoc->GetDetOpList();
+ ScDetOpList* pOldList = rDoc.GetDetOpList();
ScDetOpList* pUndoList = NULL;
if (bUndo)
pUndoList = pOldList ? new ScDetOpList(*pOldList) : NULL;
- pDoc->ClearDetectiveOperations();
+ rDoc.ClearDetectiveOperations();
if (bUndo)
{
@@ -448,22 +448,22 @@ bool ScDocFunc::DetectiveDelAll(SCTAB nTab)
bool ScDocFunc::DetectiveRefresh( bool bAutomatic )
{
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDetOpList* pList = pDoc->GetDetOpList();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDetOpList* pList = rDoc.GetDetOpList();
if ( pList && pList->Count() )
{
rDocShell.MakeDrawLayer();
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (bUndo)
pModel->BeginCalcUndo(false);
// Loeschen auf allen Tabellen
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- ScDetectiveFunc( pDoc,nTab ).DeleteAll( SC_DET_ARROWS ); // don't remove circles
+ ScDetectiveFunc( &rDoc,nTab ).DeleteAll( SC_DET_ARROWS ); // don't remove circles
// Wiederholen
@@ -474,7 +474,7 @@ bool ScDocFunc::DetectiveRefresh( bool bAutomatic )
if (pData)
{
ScAddress aPos = pData->GetPos();
- ScDetectiveFunc aFunc( pDoc, aPos.Tab() );
+ ScDetectiveFunc aFunc( &rDoc, aPos.Tab() );
SCCOL nCol = aPos.Col();
SCROW nRow = aPos.Row();
switch (pData->GetOperation())
@@ -522,13 +522,13 @@ static void lcl_collectAllPredOrSuccRanges(
const ScRangeList& rSrcRanges, vector<ScTokenRef>& rRefTokens, ScDocShell& rDocShell,
bool bPred)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
vector<ScTokenRef> aRefTokens;
ScRangeList aSrcRanges(rSrcRanges);
if (aSrcRanges.empty())
return;
ScRange* p = aSrcRanges.front();
- ScDetectiveFunc aDetFunc(pDoc, p->aStart.Tab());
+ ScDetectiveFunc aDetFunc(&rDoc, p->aStart.Tab());
ScRangeList aDestRanges;
for (size_t i = 0, n = aSrcRanges.size(); i < n; ++i)
{
@@ -568,12 +568,12 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
return false;
}
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScEditableTester aTester( pDoc, rMark );
+ ScEditableTester aTester( &rDoc, rMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -591,7 +591,7 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
aMultiMark.MarkToMulti();
aMultiMark.GetMultiMarkArea( aMarkRange );
ScRange aExtendedRange(aMarkRange);
- if ( pDoc->ExtendMerge( aExtendedRange, true ) )
+ if ( rDoc.ExtendMerge( aExtendedRange, true ) )
bMulti = false;
// keine Objekte auf geschuetzten Tabellen
@@ -599,10 +599,10 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
if ( nFlags & IDF_OBJECTS )
{
bObjects = true;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
- if (pDoc->IsTabProtected(*itr))
+ if (rDoc.IsTabProtected(*itr))
bObjects = false;
}
@@ -618,14 +618,14 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
bool bDrawUndo = bObjects || (nFlags & IDF_NOTE);
if (bRecord && bDrawUndo)
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
if (bObjects)
{
if (bMulti)
- pDoc->DeleteObjectsInSelection( aMultiMark );
+ rDoc.DeleteObjectsInSelection( aMultiMark );
else
- pDoc->DeleteObjectsInArea( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
+ rDoc.DeleteObjectsInArea( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(),
aMultiMark );
}
@@ -633,7 +633,7 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
if ( bRecord )
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, aMarkRange.aStart.Tab(), aMarkRange.aEnd.Tab() );
+ pUndoDoc->InitUndo( &rDoc, aMarkRange.aStart.Tab(), aMarkRange.aEnd.Tab() );
// bei "Format/Standard" alle Attribute kopieren, weil CopyToDocument
// nur mit IDF_HARDATTR zu langsam ist:
@@ -646,11 +646,11 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
nUndoDocFlags |= IDF_CONTENTS; // copy all cells with their notes
// note captions are handled in drawing undo
nUndoDocFlags |= IDF_NOCAPTIONS;
- pDoc->CopyToDocument( aExtendedRange, nUndoDocFlags, bMulti, pUndoDoc, &aMultiMark );
+ rDoc.CopyToDocument( aExtendedRange, nUndoDocFlags, bMulti, pUndoDoc, &aMultiMark );
}
//! HideAllCursors(); // falls Zusammenfassung aufgehoben wird
- pDoc->DeleteSelection( nFlags, aMultiMark );
+ rDoc.DeleteSelection( nFlags, aMultiMark );
// add undo action after drawing undo is complete (objects and note captions)
if( bRecord )
@@ -673,11 +673,11 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScEditableTester aTester( pDoc, rMark );
+ ScEditableTester aTester( &rDoc, rMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -694,10 +694,10 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
if (bRecord)
{
SCTAB nStartTab = aMarkRange.aStart.Tab();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nStartTab)
@@ -706,13 +706,13 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
ScRange aCopyRange = aMarkRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_CONTENTS, true, pUndoDoc, &aMultiMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_CONTENTS, true, pUndoDoc, &aMultiMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoTransliterate( &rDocShell, aMultiMark, pUndoDoc, nType ) );
}
- pDoc->TransliterateText( aMultiMark, nType );
+ rDoc.TransliterateText( aMultiMark, nType );
if (!AdjustRowHeight( aMarkRange ))
rDocShell.PostPaint( aMarkRange, PAINT_GRID );
@@ -725,10 +725,10 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const OUString& rText, bool bApi )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- ScEditableTester aTester( pDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
+ bool bUndo(rDoc.IsUndoEnabled());
+ ScEditableTester aTester( &rDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -736,7 +736,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
return false;
}
- bool bEditDeleted = (pDoc->GetCellType(rPos) == CELLTYPE_EDIT);
+ bool bEditDeleted = (rDoc.GetCellType(rPos) == CELLTYPE_EDIT);
ScUndoEnterData::ValuesType aOldValues;
if (bUndo)
@@ -744,10 +744,10 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
ScUndoEnterData::Value aOldValue;
aOldValue.mnTab = rPos.Tab();
- aOldValue.maCell.assign(*pDoc, rPos);
+ aOldValue.maCell.assign(rDoc, rPos);
const SfxPoolItem* pItem;
- const ScPatternAttr* pPattern = pDoc->GetPattern( rPos.Col(),rPos.Row(),rPos.Tab() );
+ const ScPatternAttr* pPattern = rDoc.GetPattern( rPos.Col(),rPos.Row(),rPos.Tab() );
if ( SFX_ITEM_SET == pPattern->GetItemSet().GetItemState(
ATTR_VALUE_FORMAT,false,&pItem) )
{
@@ -760,7 +760,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
aOldValues.push_back(aOldValue);
}
- o_rbNumFmtSet = pDoc->SetString( rPos.Col(), rPos.Row(), rPos.Tab(), rText );
+ o_rbNumFmtSet = rDoc.SetString( rPos.Col(), rPos.Row(), rPos.Tab(), rText );
if (bUndo)
{
@@ -769,7 +769,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
new ScUndoEnterData(&rDocShell, rPos, aOldValues, rText, NULL));
}
- if ( bEditDeleted || pDoc->HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) )
+ if ( bEditDeleted || rDoc.HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) )
AdjustRowHeight( ScRange(rPos) );
rDocShell.PostPaintCell( rPos );
@@ -785,22 +785,22 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
bool ScDocFunc::SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
- bool bHeight = pDoc->HasAttrib(rPos, HASATTR_NEEDHEIGHT);
+ bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT);
ScCellValue aOldVal;
if (bUndo)
- aOldVal.assign(*pDoc, rPos);
+ aOldVal.assign(rDoc, rPos);
- pDoc->SetValue(rPos, fVal);
+ rDoc.SetValue(rPos, fVal);
if (bUndo)
{
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
- aNewVal.assign(*pDoc, rPos);
+ aNewVal.assign(rDoc, rPos);
pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
}
@@ -829,18 +829,18 @@ bool ScDocFunc::SetValueCells( const ScAddress& rPos, const std::vector<double>&
aRange.aEnd.SetRow(nLastRow);
ScDocShellModificator aModificator(rDocShell);
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (pDoc->IsUndoEnabled())
+ if (rDoc.IsUndoEnabled())
{
sc::UndoSetCells* pUndoObj = new sc::UndoSetCells(&rDocShell, rPos);
- pDoc->TransferCellValuesTo(rPos, aVals.size(), pUndoObj->GetOldValues());
+ rDoc.TransferCellValuesTo(rPos, aVals.size(), pUndoObj->GetOldValues());
pUndoObj->SetNewValues(aVals);
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
pUndoMgr->AddUndoAction(pUndoObj);
}
- pDoc->SetValues(rPos, aVals);
+ rDoc.SetValues(rPos, aVals);
rDocShell.PostPaint(aRange, PAINT_GRID);
aModificator.SetDocumentModified();
@@ -855,24 +855,24 @@ bool ScDocFunc::SetValueCells( const ScAddress& rPos, const std::vector<double>&
bool ScDocFunc::SetStringCell( const ScAddress& rPos, const OUString& rStr, bool bInteraction )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
- bool bHeight = pDoc->HasAttrib(rPos, HASATTR_NEEDHEIGHT);
+ bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT);
ScCellValue aOldVal;
if (bUndo)
- aOldVal.assign(*pDoc, rPos);
+ aOldVal.assign(rDoc, rPos);
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(rPos, rStr, &aParam);
+ rDoc.SetString(rPos, rStr, &aParam);
if (bUndo)
{
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
- aNewVal.assign(*pDoc, rPos);
+ aNewVal.assign(rDoc, rPos);
pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
}
@@ -892,22 +892,22 @@ bool ScDocFunc::SetStringCell( const ScAddress& rPos, const OUString& rStr, bool
bool ScDocFunc::SetEditCell( const ScAddress& rPos, const EditTextObject& rStr, bool bInteraction )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
- bool bHeight = pDoc->HasAttrib(rPos, HASATTR_NEEDHEIGHT);
+ bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT);
ScCellValue aOldVal;
if (bUndo)
- aOldVal.assign(*pDoc, rPos);
+ aOldVal.assign(rDoc, rPos);
- pDoc->SetEditText(rPos, rStr.Clone());
+ rDoc.SetEditText(rPos, rStr.Clone());
if (bUndo)
{
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
- aNewVal.assign(*pDoc, rPos);
+ aNewVal.assign(rDoc, rPos);
pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
}
@@ -926,11 +926,11 @@ bool ScDocFunc::SetEditCell( const ScAddress& rPos, const EditTextObject& rStr,
bool ScDocFunc::SetStringOrEditCell( const ScAddress& rPos, const OUString& rStr, bool bInteraction )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
if (ScStringUtil::isMultiline(rStr))
{
- ScFieldEditEngine& rEngine = pDoc->GetEditEngine();
+ ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
rEngine.SetText(rStr);
boost::scoped_ptr<EditTextObject> pEditText(rEngine.CreateTextObject());
return SetEditCell(rPos, *pEditText, bInteraction);
@@ -946,34 +946,34 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo
SAL_WNODEPRECATED_DECLARATIONS_POP
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
- bool bHeight = pDoc->HasAttrib(rPos, HASATTR_NEEDHEIGHT);
+ bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT);
ScCellValue aOldVal;
if (bUndo)
- aOldVal.assign(*pDoc, rPos);
+ aOldVal.assign(rDoc, rPos);
- pCell = pDoc->SetFormulaCell(rPos, xCell.release());
+ pCell = rDoc.SetFormulaCell(rPos, xCell.release());
// For performance reasons API calls may disable calculation while
// operating and recalculate once when done. If through user interaction
// and AutoCalc is disabled, calculate the formula (without its
// dependencies) once so the result matches the current document's content.
- if (bInteraction && !pDoc->GetAutoCalc() && pCell)
+ if (bInteraction && !rDoc.GetAutoCalc() && pCell)
{
// calculate just the cell once and set Dirty again
pCell->Interpret();
pCell->SetDirtyVar();
- pDoc->PutInFormulaTree( pCell);
+ rDoc.PutInFormulaTree( pCell);
}
if (bUndo)
{
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
- aNewVal.assign(*pDoc, rPos);
+ aNewVal.assign(rDoc, rPos);
pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
}
@@ -993,7 +993,7 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo
void ScDocFunc::NotifyInputHandler( const ScAddress& rPos )
{
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if ( pViewSh && pViewSh->GetViewData()->GetDocShell() == &rDocShell )
+ if ( pViewSh && pViewSh->GetViewData().GetDocShell() == &rDocShell )
{
ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
if ( pInputHdl && pInputHdl->GetCursorPos() == rPos )
@@ -1025,7 +1025,7 @@ bool ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
// PutData ruft PutCell oder SetNormalString
bool bRet = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScEditAttrTester aTester( &rEngine );
bool bEditCell = aTester.NeedsObject();
if ( bEditCell )
@@ -1033,7 +1033,7 @@ bool ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
// #i61702# With bLoseContent set, the content of rEngine isn't restored
// (used in loading XML, where after the removeActionLock call the API object's
// EditEngine isn't accessed again.
- bool bLoseContent = pDoc->IsImportingXML();
+ bool bLoseContent = rDoc.IsImportingXML();
bool bUpdateMode(rEngine.GetUpdateMode());
if (bUpdateMode)
@@ -1097,9 +1097,9 @@ bool ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
if ( bRet && aTester.NeedsCellAttr() )
{
const SfxItemSet& rEditAttr = aTester.GetAttribs();
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetFromEditItemSet( &rEditAttr );
- aPattern.DeleteUnchanged( pDoc->GetPattern( rPos.Col(), rPos.Row(), rPos.Tab() ) );
+ aPattern.DeleteUnchanged( rDoc.GetPattern( rPos.Col(), rPos.Row(), rPos.Tab() ) );
aPattern.GetItemSet().ClearItem( ATTR_HOR_JUSTIFY ); // wasn't removed above if no edit object
if ( aPattern.GetItemSet().Count() > 0 )
{
@@ -1132,19 +1132,19 @@ bool ScDocFunc::SetCellText(
{
if ( bEnglish )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
::boost::scoped_ptr<ScExternalRefManager::ApiGuard> pExtRefGuard;
if (bApi)
- pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(pDoc));
+ pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(&rDoc));
ScInputStringType aRes =
- ScStringUtil::parseInputString(*pDoc->GetFormatTable(), rText, LANGUAGE_ENGLISH_US);
+ ScStringUtil::parseInputString(*rDoc.GetFormatTable(), rText, LANGUAGE_ENGLISH_US);
switch (aRes.meType)
{
case ScInputStringType::Formula:
- bSet = SetFormulaCell(rPos, new ScFormulaCell(pDoc, rPos, aRes.maText, eGrammar), !bApi);
+ bSet = SetFormulaCell(rPos, new ScFormulaCell(&rDoc, rPos, aRes.maText, eGrammar), !bApi);
break;
case ScInputStringType::Number:
bSet = SetValueCell(rPos, aRes.mfValue, !bApi);
@@ -1173,7 +1173,7 @@ bool ScDocFunc::SetCellText(
bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
{
- ScDocument& rDoc = *rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScPostIt* pNote = rDoc.GetNote( rPos );
if( !pNote || (bShow == pNote->IsCaptionShown()) ) return false;
@@ -1194,8 +1194,8 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const OUString& rText, bool
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- ScEditableTester aTester( pDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScEditableTester aTester( &rDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1205,13 +1205,13 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const OUString& rText, bool
OUString aNewText = convertLineEnd(rText, GetSystemLineEnd()); //! ist das noetig ???
- if( ScPostIt* pNote = (!aNewText.isEmpty()) ? pDoc->GetOrCreateNote( rPos ) : pDoc->GetNote(rPos) )
+ if( ScPostIt* pNote = (!aNewText.isEmpty()) ? rDoc.GetOrCreateNote( rPos ) : rDoc.GetNote(rPos) )
pNote->SetText( rPos, aNewText );
//! Undo !!!
- if (pDoc->IsStreamValid(rPos.Tab()))
- pDoc->SetStreamValid(rPos.Tab(), false);
+ if (rDoc.IsStreamValid(rPos.Tab()))
+ rDoc.SetStreamValid(rPos.Tab(), false);
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -1224,7 +1224,7 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, c
bool bDone = false;
ScDocShellModificator aModificator( rDocShell );
- ScDocument& rDoc = *rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScEditableTester aTester( &rDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
if (aTester.IsEditable())
{
@@ -1282,15 +1282,15 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, c
bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if ( bRecord && !pDoc->IsUndoEnabled() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if ( bRecord && !rDoc.IsUndoEnabled() )
bRecord = false;
- bool bImportingXML = pDoc->IsImportingXML();
+ bool bImportingXML = rDoc.IsImportingXML();
// Cell formats can still be set if the range isn't editable only because of matrix formulas.
// #i62483# When loading XML, the check can be skipped altogether.
bool bOnlyNotBecauseOfMatrix;
- if ( !bImportingXML && !pDoc->IsSelectionEditable( rMark, &bOnlyNotBecauseOfMatrix )
+ if ( !bImportingXML && !rDoc.IsSelectionEditable( rMark, &bOnlyNotBecauseOfMatrix )
&& !bOnlyNotBecauseOfMatrix )
{
if (!bApi)
@@ -1312,8 +1312,8 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
if ( bRecord )
{
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, aMultiRange.aStart.Tab(), aMultiRange.aEnd.Tab() );
- pDoc->CopyToDocument( aMultiRange, IDF_ATTRIB, bMulti, pUndoDoc, &rMark );
+ pUndoDoc->InitUndo( &rDoc, aMultiRange.aStart.Tab(), aMultiRange.aEnd.Tab() );
+ rDoc.CopyToDocument( aMultiRange, IDF_ATTRIB, bMulti, pUndoDoc, &rMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoSelectionAttr(
@@ -1327,7 +1327,7 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
sal_uInt16 nExtFlags = 0;
if ( !bImportingXML )
rDocShell.UpdatePaintExt( nExtFlags, aMultiRange ); // content before the change
- pDoc->ApplySelectionPattern( rPattern, rMark );
+ rDoc.ApplySelectionPattern( rPattern, rMark );
if ( !bImportingXML )
rDocShell.UpdatePaintExt( nExtFlags, aMultiRange ); // content after the change
@@ -1345,15 +1345,15 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if ( bRecord && !pDoc->IsUndoEnabled() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if ( bRecord && !rDoc.IsUndoEnabled() )
bRecord = false;
- bool bImportingXML = pDoc->IsImportingXML();
+ bool bImportingXML = rDoc.IsImportingXML();
// Cell formats can still be set if the range isn't editable only because of matrix formulas.
// #i62483# When loading XML, the check can be skipped altogether.
bool bOnlyNotBecauseOfMatrix;
- if ( !bImportingXML && !pDoc->IsSelectionEditable( rMark, &bOnlyNotBecauseOfMatrix )
+ if ( !bImportingXML && !rDoc.IsSelectionEditable( rMark, &bOnlyNotBecauseOfMatrix )
&& !bOnlyNotBecauseOfMatrix )
{
if (!bApi)
@@ -1361,7 +1361,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
return false;
}
- ScStyleSheet* pStyleSheet = (ScStyleSheet*) pDoc->GetStyleSheetPool()->Find(
+ ScStyleSheet* pStyleSheet = (ScStyleSheet*) rDoc.GetStyleSheetPool()->Find(
rStyleName, SFX_STYLE_FAMILY_PARA );
if (!pStyleSheet)
return false;
@@ -1379,8 +1379,8 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
{
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
SCTAB nStartTab = aMultiRange.aStart.Tab();
- SCTAB nTabCount = pDoc->GetTableCount();
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ SCTAB nTabCount = rDoc.GetTableCount();
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nStartTab)
@@ -1389,7 +1389,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
ScRange aCopyRange = aMultiRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &rMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &rMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoSelectionStyle(
@@ -1397,7 +1397,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
}
- pDoc->ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, rMark );
+ rDoc.ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, rMark );
if (!AdjustRowHeight( aMultiRange ))
rDocShell.PostPaint( aMultiRange, PAINT_GRID, 0 );
@@ -1602,8 +1602,8 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
return false;
}
- ScDocument* pDoc = rDocShell.GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCCOL nPaintStartCol = nStartCol;
SCROW nPaintStartRow = nStartRow;
SCCOL nPaintEndCol = nEndCol;
@@ -1617,11 +1617,11 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nCursorRow = 0;
if( pViewSh )
{
- nCursorCol = pViewSh->GetViewData()->GetCurX();
- nCursorRow = pViewSh->GetViewData()->GetCurY();
+ nCursorCol = pViewSh->GetViewData().GetCurX();
+ nCursorRow = pViewSh->GetViewData().GetCurY();
}
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -1632,7 +1632,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB nCount = 0;
for( i=0; i<nTabCount; i++ )
{
- if( !pDoc->IsScenario(i) )
+ if( !rDoc.IsScenario(i) )
{
nCount++;
if( nCount == nEndTab+1 )
@@ -1647,7 +1647,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScMarkData aFullMark( aMark ); // including scenario sheets
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
aFullMark.SelectTable( j, true );
SCTAB nSelCount = aMark.GetSelectCount();
@@ -1662,10 +1662,10 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aExtendMergeRange( rRange );
- if( rRange.aStart == rRange.aEnd && pDoc->HasAttrib(rRange, HASATTR_MERGED) )
+ if( rRange.aStart == rRange.aEnd && rDoc.HasAttrib(rRange, HASATTR_MERGED) )
{
- pDoc->ExtendMerge( aExtendMergeRange );
- pDoc->ExtendOverlapped( aExtendMergeRange );
+ rDoc.ExtendMerge( aExtendMergeRange );
+ rDoc.ExtendOverlapped( aExtendMergeRange );
nMergeTestEndCol = aExtendMergeRange.aEnd.Col();
nMergeTestEndRow = aExtendMergeRange.aEnd.Row();
nPaintEndCol = nMergeTestEndCol;
@@ -1691,7 +1691,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nEditTestEndCol = (eCmd==INS_INSCOLS) ? MAXCOL : nMergeTestEndCol;
SCROW nEditTestEndRow = (eCmd==INS_INSROWS) ? MAXROW : nMergeTestEndRow;
- ScEditableTester aTester( pDoc, nMergeTestStartCol, nMergeTestStartRow, nEditTestEndCol, nEditTestEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nMergeTestStartCol, nMergeTestStartRow, nEditTestEndCol, nEditTestEndRow, aMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1700,7 +1700,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
// Check if this insertion is allowed with respect to pivot table.
- if (!canInsertCellsByPivot(rRange, aMark, eCmd, pDoc))
+ if (!canInsertCellsByPivot(rRange, aMark, eCmd, &rDoc))
{
if (!bApi)
rDocShell.ErrorMessage(STR_NO_INSERT_DELETE_OVER_PIVOT_TABLE);
@@ -1714,13 +1714,13 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord )
{
pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, false, false );
+ pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, false, false );
// pRefUndoDoc is filled in InsertCol / InsertRow
- pUndoData = new ScRefUndoData( pDoc );
+ pUndoData = new ScRefUndoData( &rDoc );
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
// #i8302 : we unmerge overwhelming ranges, before insertion all the actions are put in the same ListAction
@@ -1735,7 +1735,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && nTabCount; ++itr)
{
i = *itr;
- if( pDoc->HasAttrib( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) )
+ if( rDoc.HasAttrib( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
if (eCmd==INS_CELLSRIGHT)
bNeedRefresh = true;
@@ -1745,8 +1745,8 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nMergeEndCol = nMergeTestEndCol;
SCROW nMergeEndRow = nMergeTestEndRow;
- pDoc->ExtendMerge( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
- pDoc->ExtendOverlapped( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
+ rDoc.ExtendMerge( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
+ rDoc.ExtendOverlapped( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
if(( eCmd == INS_CELLSDOWN && ( nMergeStartCol != nMergeTestStartCol || nMergeEndCol != nMergeTestEndCol )) ||
(eCmd == INS_CELLSRIGHT && ( nMergeStartRow != nMergeTestStartRow || nMergeEndRow != nMergeTestEndRow )) )
@@ -1762,7 +1762,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nTestRow1 = -1;
SCROW nTestRow2 = -1;
- ScDocAttrIterator aTestIter( pDoc, i, nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow );
+ ScDocAttrIterator aTestIter( &rDoc, i, nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow );
ScRange aExtendRange( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i );
const ScPatternAttr* pPattern = NULL;
const ScMergeAttr* pMergeFlag = NULL;
@@ -1775,16 +1775,16 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
{
ScRange aRange( nTestCol, nTestRow1, i );
- pDoc->ExtendOverlapped(aRange);
- pDoc->ExtendMerge(aRange, true);
+ rDoc.ExtendOverlapped(aRange);
+ rDoc.ExtendMerge(aRange, true);
if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
{
for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ )
{
ScRange aTestRange( nTestCol, nTestRow, i );
- pDoc->ExtendOverlapped( aTestRange );
- pDoc->ExtendMerge( aTestRange, true);
+ rDoc.ExtendOverlapped( aTestRange );
+ rDoc.ExtendMerge( aTestRange, true);
ScRange aMergeRange( aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
if( !aExtendRange.In( aMergeRange ) )
{
@@ -1841,7 +1841,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
for( ::std::vector<ScRange>::const_iterator iIter( qIncreaseRange.begin()); iIter != qIncreaseRange.end(); ++iIter )
{
ScRange aRange( *iIter );
- if( pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ if( rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
{
UnmergeCells( aRange, true );
}
@@ -1862,22 +1862,22 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
switch (eCmd)
{
case INS_CELLSDOWN:
- bSuccess = pDoc->InsertRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
+ bSuccess = rDoc.InsertRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
nPaintEndRow = MAXROW;
break;
case INS_INSROWS:
- bSuccess = pDoc->InsertRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
+ bSuccess = rDoc.InsertRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
nPaintStartCol = 0;
nPaintEndCol = MAXCOL;
nPaintEndRow = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case INS_CELLSRIGHT:
- bSuccess = pDoc->InsertCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
+ bSuccess = rDoc.InsertCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
nPaintEndCol = MAXCOL;
break;
case INS_INSCOLS:
- bSuccess = pDoc->InsertCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
+ bSuccess = rDoc.InsertCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
nPaintStartRow = 0;
nPaintEndRow = MAXROW;
nPaintEndCol = MAXCOL;
@@ -1904,7 +1904,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nCount = 0;
- for( SCTAB j=*itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j=*itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nCount ++;
pScenarios[nUndoPos] = nCount;
@@ -1927,7 +1927,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
while( !qIncreaseRange.empty() )
{
ScRange aRange = qIncreaseRange.back();
- if( !pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ if( !rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
{
switch (eCmd)
{
@@ -1958,22 +1958,22 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
i = *itr;
- pDoc->SetDrawPageSize(i);
+ rDoc.SetDrawPageSize(i);
if (bNeedRefresh)
- pDoc->ExtendMerge( nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow, i, true );
+ rDoc.ExtendMerge( nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow, i, true );
else
- pDoc->RefreshAutoFilter( nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow, i );
+ rDoc.RefreshAutoFilter( nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow, i );
if ( eCmd == INS_INSROWS || eCmd == INS_INSCOLS )
- pDoc->UpdatePageBreaks( i );
+ rDoc.UpdatePageBreaks( i );
sal_uInt16 nExtFlags = 0;
rDocShell.UpdatePaintExt( nExtFlags, nPaintStartCol, nPaintStartRow, i, nPaintEndCol, nPaintEndRow, i );
SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = i+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nScenarioCount ++;
bool bAdjusted = ( eCmd == INS_INSROWS ) ? AdjustRowHeight(ScRange(0, nStartRow, i, MAXCOL, nEndRow, i+nScenarioCount )) :
@@ -2042,15 +2042,15 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
return false;
}
- ScDocument* pDoc = rDocShell.GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCCOL nPaintStartCol = nStartCol;
SCROW nPaintStartRow = nStartRow;
SCCOL nPaintEndCol = nEndCol;
SCROW nPaintEndRow = nEndRow;
sal_uInt16 nPaintFlags = PAINT_GRID;
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -2061,7 +2061,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB nCount = 0;
for(SCTAB i=0; i<nTabCount; i++ )
{
- if( !pDoc->IsScenario(i) )
+ if( !rDoc.IsScenario(i) )
{
nCount++;
if( nCount == nEndTab+1 )
@@ -2076,7 +2076,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScMarkData aFullMark( aMark ); // including scenario sheets
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
aFullMark.SelectTable( j, true );
SCTAB nSelCount = aMark.GetSelectCount();
@@ -2088,10 +2088,10 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aExtendMergeRange( rRange );
- if( rRange.aStart == rRange.aEnd && pDoc->HasAttrib(rRange, HASATTR_MERGED) )
+ if( rRange.aStart == rRange.aEnd && rDoc.HasAttrib(rRange, HASATTR_MERGED) )
{
- pDoc->ExtendMerge( aExtendMergeRange );
- pDoc->ExtendOverlapped( aExtendMergeRange );
+ rDoc.ExtendMerge( aExtendMergeRange );
+ rDoc.ExtendOverlapped( aExtendMergeRange );
nUndoEndCol = aExtendMergeRange.aEnd.Col();
nUndoEndRow = aExtendMergeRange.aEnd.Row();
nPaintEndCol = nUndoEndCol;
@@ -2116,7 +2116,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEditTestEndY = nUndoEndRow;
if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP )
nEditTestEndY = MAXROW;
- ScEditableTester aTester( pDoc, nUndoStartCol, nUndoStartRow, nEditTestEndX, nEditTestEndY, aMark );
+ ScEditableTester aTester( &rDoc, nUndoStartCol, nUndoStartRow, nEditTestEndX, nEditTestEndY, aMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -2124,7 +2124,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
return false;
}
- if (!canDeleteCellsByPivot(rRange, aMark, eCmd, pDoc))
+ if (!canDeleteCellsByPivot(rRange, aMark, eCmd, &rDoc))
{
if (!bApi)
rDocShell.ErrorMessage(STR_NO_INSERT_DELETE_OVER_PIVOT_TABLE);
@@ -2150,15 +2150,15 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB i = *itr;
- if ( pDoc->HasAttrib( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ if ( rDoc.HasAttrib( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
SCCOL nMergeStartCol = nUndoStartCol;
SCROW nMergeStartRow = nUndoStartRow;
SCCOL nMergeEndCol = nMergeTestEndCol;
SCROW nMergeEndRow = nMergeTestEndRow;
- pDoc->ExtendMerge( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
- pDoc->ExtendOverlapped( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
+ rDoc.ExtendMerge( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
+ rDoc.ExtendOverlapped( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
if( ( eCmd == DEL_CELLSUP && ( nMergeStartCol != nUndoStartCol || nMergeEndCol != nMergeTestEndCol))||
( eCmd == DEL_CELLSLEFT && ( nMergeStartRow != nUndoStartRow || nMergeEndRow != nMergeTestEndRow)))
{
@@ -2174,7 +2174,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nTestRow1 = -1;
SCROW nTestRow2 = -1;
- ScDocAttrIterator aTestIter( pDoc, i, nUndoStartCol, nUndoStartRow, nMergeTestEndCol, nMergeTestEndRow );
+ ScDocAttrIterator aTestIter( &rDoc, i, nUndoStartCol, nUndoStartRow, nMergeTestEndCol, nMergeTestEndRow );
ScRange aExtendRange( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i );
const ScPatternAttr* pPattern = NULL;
const ScMergeAttr* pMergeFlag = NULL;
@@ -2187,16 +2187,16 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
{
ScRange aRange( nTestCol, nTestRow1, i );
- pDoc->ExtendOverlapped( aRange );
- pDoc->ExtendMerge( aRange, true );
+ rDoc.ExtendOverlapped( aRange );
+ rDoc.ExtendMerge( aRange, true );
if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
{
for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ )
{
ScRange aTestRange( nTestCol, nTestRow, i );
- pDoc->ExtendOverlapped( aTestRange );
- pDoc->ExtendMerge( aTestRange, true );
+ rDoc.ExtendOverlapped( aTestRange );
+ rDoc.ExtendMerge( aTestRange, true );
ScRange aMergeRange( aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
if( !aExtendRange.In( aMergeRange ) )
{
@@ -2258,7 +2258,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
for( ::std::vector<ScRange>::const_iterator iIter( qDecreaseRange.begin()); iIter != qDecreaseRange.end(); ++iIter )
{
ScRange aRange( *iIter );
- if( pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ if( rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
{
UnmergeCells( aRange, true );
}
@@ -2290,25 +2290,25 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
// so it's no longer necessary to copy more than the deleted range into pUndoDoc.
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, 0, nTabCount-1, (eCmd==DEL_DELCOLS), (eCmd==DEL_DELROWS) );
+ pUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, (eCmd==DEL_DELCOLS), (eCmd==DEL_DELROWS) );
itr = aMark.begin();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nScenarioCount = 0;
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nScenarioCount ++;
- pDoc->CopyToDocument( nUndoStartCol, nUndoStartRow, *itr, nUndoEndCol, nUndoEndRow, *itr+nScenarioCount,
+ rDoc.CopyToDocument( nUndoStartCol, nUndoStartRow, *itr, nUndoEndCol, nUndoEndRow, *itr+nScenarioCount,
IDF_ALL | IDF_NOCAPTIONS, false, pUndoDoc );
}
pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, false, false );
+ pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, false, false );
- pUndoData = new ScRefUndoData( pDoc );
+ pUndoData = new ScRefUndoData( &rDoc );
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
sal_uInt16 nExtFlags = 0;
@@ -2322,22 +2322,22 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
switch (eCmd)
{
case DEL_CELLSUP:
- pDoc->DeleteRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, NULL, &aFullMark );
+ rDoc.DeleteRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, NULL, &aFullMark );
nPaintEndRow = MAXROW;
break;
case DEL_DELROWS:
- pDoc->DeleteRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
+ rDoc.DeleteRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
nPaintStartCol = 0;
nPaintEndCol = MAXCOL;
nPaintEndRow = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case DEL_CELLSLEFT:
- pDoc->DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, NULL, &aFullMark );
+ rDoc.DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, NULL, &aFullMark );
nPaintEndCol = MAXCOL;
break;
case DEL_DELCOLS:
- pDoc->DeleteCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
+ rDoc.DeleteCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
nPaintStartRow = 0;
nPaintEndRow = MAXROW;
nPaintEndCol = MAXCOL;
@@ -2371,7 +2371,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nCount = 0;
- for( SCTAB j=*itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j=*itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nCount ++;
pScenarios[nUndoPos] = nCount;
@@ -2431,7 +2431,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
break;
}
- if( !pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ if( !rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
{
ScCellMergeOption aMergeOption(aRange);
MergeCells( aMergeOption, false, true, true );
@@ -2451,37 +2451,37 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nMergeTestEndCol = MAXCOL;
if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP )
nMergeTestEndRow = MAXROW;
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- pDoc->ApplyPatternArea( nExtendStartCol, nExtendStartRow, nMergeTestEndCol, nMergeTestEndRow, aMark, aPattern );
+ rDoc.ApplyPatternArea( nExtendStartCol, nExtendStartRow, nMergeTestEndCol, nMergeTestEndRow, aMark, aPattern );
itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nScenarioCount = 0;
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nScenarioCount ++;
ScRange aMergedRange( nExtendStartCol, nExtendStartRow, *itr, nMergeTestEndCol, nMergeTestEndRow, *itr+nScenarioCount );
- pDoc->ExtendMerge( aMergedRange, true );
+ rDoc.ExtendMerge( aMergedRange, true );
}
}
itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
- pDoc->SetDrawPageSize(*itr);
+ rDoc.SetDrawPageSize(*itr);
if ( eCmd == DEL_DELCOLS || eCmd == DEL_DELROWS )
- pDoc->UpdatePageBreaks( *itr );
+ rDoc.UpdatePageBreaks( *itr );
rDocShell.UpdatePaintExt( nExtFlags, nPaintStartCol, nPaintStartRow, *itr, nPaintEndCol, nPaintEndRow, *itr );
SCTAB nScenarioCount = 0;
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nScenarioCount ++;
// ganze Zeilen loeschen: nichts anpassen
@@ -2527,13 +2527,13 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
// zugehoerige Szenarien auch anpassen - nur wenn innerhalb einer Tabelle verschoben wird!
bool bScenariosAdded = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- SCTAB nTabCount = pDoc->GetTableCount();
- if ( nDestTab == nStartTab && !pDoc->IsScenario(nEndTab) )
- while ( nEndTab+1 < nTabCount && pDoc->IsScenario(nEndTab+1) )
+ SCTAB nTabCount = rDoc.GetTableCount();
+ if ( nDestTab == nStartTab && !rDoc.IsScenario(nEndTab) )
+ while ( nEndTab+1 < nTabCount && rDoc.IsScenario(nEndTab+1) )
{
++nEndTab;
bScenariosAdded = true;
@@ -2551,7 +2551,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
aSourceMark.SetMarkArea( rSource );
ScDocShellRef aDragShellRef;
- if ( pDoc->HasOLEObjectsInArea( rSource ) )
+ if ( rDoc.HasOLEObjectsInArea( rSource ) )
{
aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
aDragShellRef->DoInitNew(NULL);
@@ -2559,7 +2559,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
ScClipParam aClipParam(ScRange(nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nStartTab), bCut);
- pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true);
+ rDoc.CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true);
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -2570,7 +2570,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
{
SCCOL nTmpEndCol = nOldEndCol;
SCROW nTmpEndRow = nOldEndRow;
- if (pDoc->ExtendMerge( nStartCol, nStartRow, nTmpEndCol, nTmpEndRow, nTab ))
+ if (rDoc.ExtendMerge( nStartCol, nStartRow, nTmpEndCol, nTmpEndRow, nTab ))
bClipOver = true;
if ( nTmpEndCol > nEndCol ) nEndCol = nTmpEndCol;
if ( nTmpEndRow > nEndRow ) nEndRow = nTmpEndRow;
@@ -2607,10 +2607,10 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScEditableTester aTester;
for (nTab=nDestTab; nTab<=nDestEndTab; nTab++)
- aTester.TestBlock( pDoc, nTab, nDestCol,nDestRow, nUndoEndCol,nUndoEndRow );
+ aTester.TestBlock( &rDoc, nTab, nDestCol,nDestRow, nUndoEndCol,nUndoEndRow );
if (bCut)
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
- aTester.TestBlock( pDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ aTester.TestBlock( &rDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
if (!aTester.IsEditable())
{
@@ -2623,7 +2623,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
// Test auf zusammengefasste - beim Verschieben erst nach dem Loeschen
if (bClipOver && !bCut)
- if (pDoc->HasAttrib( nDestCol,nDestRow,nDestTab, nUndoEndCol,nUndoEndRow,nDestEndTab,
+ if (rDoc.HasAttrib( nDestCol,nDestRow,nDestTab, nUndoEndCol,nUndoEndRow,nDestEndTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ))
{ // "Zusammenfassen nicht verschachteln !"
if (!bApi)
@@ -2653,25 +2653,25 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
sal_uInt16 nUndoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
if (bCut)
{
- pDoc->CopyToDocument( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
+ rDoc.CopyToDocument( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
nUndoFlags, false, pUndoDoc );
pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, false, false );
+ pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, false, false );
}
if ( nDestTab != nStartTab )
pUndoDoc->AddUndoTab( nDestTab, nDestEndTab, bWholeCols, bWholeRows );
- pDoc->CopyToDocument( nDestCol, nDestRow, nDestTab,
+ rDoc.CopyToDocument( nDestCol, nDestRow, nDestTab,
nDestEndCol, nDestEndRow, nDestEndTab,
nUndoFlags, false, pUndoDoc );
- pUndoData = new ScRefUndoData( pDoc );
+ pUndoData = new ScRefUndoData( &rDoc );
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
bool bSourceHeight = false; // Hoehen angepasst?
@@ -2680,24 +2680,24 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScMarkData aDelMark; // only for tables
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
{
- pDoc->DeleteAreaTab( nStartCol,nStartRow, nOldEndCol,nOldEndRow, nTab, IDF_ALL );
+ rDoc.DeleteAreaTab( nStartCol,nStartRow, nOldEndCol,nOldEndRow, nTab, IDF_ALL );
aDelMark.SelectTable( nTab, true );
}
- pDoc->DeleteObjectsInArea( nStartCol,nStartRow, nOldEndCol,nOldEndRow, aDelMark );
+ rDoc.DeleteObjectsInArea( nStartCol,nStartRow, nOldEndCol,nOldEndRow, aDelMark );
// Test auf zusammengefasste
if (bClipOver)
- if (pDoc->HasAttrib( nDestCol,nDestRow,nDestTab,
+ if (rDoc.HasAttrib( nDestCol,nDestRow,nDestTab,
nUndoEndCol,nUndoEndRow,nDestEndTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
- pDoc->CopyFromClip( rSource, aSourceMark, IDF_ALL, pRefUndoDoc, pClipDoc );
+ rDoc.CopyFromClip( rSource, aSourceMark, IDF_ALL, pRefUndoDoc, pClipDoc );
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
{
SCCOL nTmpEndCol = nEndCol;
SCROW nTmpEndRow = nEndRow;
- pDoc->ExtendMerge( nStartCol, nStartRow, nTmpEndCol, nTmpEndRow, nTab, true );
+ rDoc.ExtendMerge( nStartCol, nStartRow, nTmpEndCol, nTmpEndRow, nTab, true );
}
// Fehlermeldung erst nach dem Wiederherstellen des Inhalts
@@ -2725,7 +2725,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
function ScDocument::UpdateReference() is called which calls
ScDrawLayer::MoveCells() which may move away inserted objects to wrong
positions (e.g. if source and destination range overlaps).*/
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_ALL & ~(IDF_OBJECTS),
+ rDoc.CopyFromClip( aPasteDest, aDestMark, IDF_ALL & ~(IDF_OBJECTS),
NULL, pClipDoc, true, false, bIncludeFiltered );
@@ -2742,7 +2742,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
and row heights. There are no cell notes or drawing objects, if the
clipdoc does not contain a drawing layer.*/
if ( pClipDoc->GetDrawLayer() )
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_OBJECTS,
+ rDoc.CopyFromClip( aPasteDest, aDestMark, IDF_OBJECTS,
pRefUndoDoc, pClipDoc, true, false, bIncludeFiltered );
if (bRecord)
@@ -2773,14 +2773,14 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
{
SCCOL nTmpEndCol = nDestEndCol;
SCROW nTmpEndRow = nDestEndRow;
- pDoc->ExtendMerge( nDestCol, nDestRow, nTmpEndCol, nTmpEndRow, nTab, true );
+ rDoc.ExtendMerge( nDestCol, nDestRow, nTmpEndCol, nTmpEndRow, nTab, true );
if (nTmpEndCol > nDestPaintEndCol) nDestPaintEndCol = nTmpEndCol;
if (nTmpEndRow > nDestPaintEndRow) nDestPaintEndRow = nTmpEndRow;
}
if (bCut)
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
- pDoc->RefreshAutoFilter( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
+ rDoc.RefreshAutoFilter( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
if (bPaint)
{
@@ -2962,29 +2962,29 @@ bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
// Strange loop, also basic is loaded too early ( InsertTable )
// is called via the xml import for sheets in described in ODF
bool bInsertDocModule = false;
- if( !rDocShell.GetDocument()->IsImportingXML() )
+ if( !rDocShell.GetDocument().IsImportingXML() )
{
- bInsertDocModule = pDoc && pDoc->IsInVBAMode();
+ bInsertDocModule = rDoc.IsInVBAMode();
}
- if ( bInsertDocModule || ( bRecord && !pDoc->IsUndoEnabled() ) )
+ if ( bInsertDocModule || ( bRecord && !rDoc.IsUndoEnabled() ) )
bRecord = false;
if (bRecord)
- pDoc->BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
+ rDoc.BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
bool bAppend = ( nTab >= nTabCount );
if ( bAppend )
nTab = nTabCount; // wichtig fuer Undo
- if (pDoc->InsertTab( nTab, rName ))
+ if (rDoc.InsertTab( nTab, rName ))
{
if (bRecord)
rDocShell.GetUndoManager()->AddUndoAction(
@@ -2994,7 +2994,7 @@ bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
if( bInsertDocModule )
{
OUString sSource, sCodeName;
- VBA_InsertModule( *pDoc, nTab, sCodeName, sSource );
+ VBA_InsertModule( rDoc, nTab, sCodeName, sSource );
}
rDocShell.Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab ) );
@@ -3016,55 +3016,55 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ )
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bVbaEnabled = pDoc && pDoc->IsInVBAMode();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bVbaEnabled = rDoc.IsInVBAMode();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
if ( bVbaEnabled )
bRecord = false;
- bool bWasLinked = pDoc->IsLinked(nTab);
+ bool bWasLinked = rDoc.IsLinked(nTab);
ScDocument* pUndoDoc = NULL;
ScRefUndoData* pUndoData = NULL;
if (bRecord)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true ); // nur nTab mit Flags
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); // nur nTab mit Flags
pUndoDoc->AddUndoTab( 0, nCount-1 ); // alle Tabs fuer Referenzen
- pDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, pUndoDoc );
+ rDoc.CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, pUndoDoc );
OUString aOldName;
- pDoc->GetName( nTab, aOldName );
+ rDoc.GetName( nTab, aOldName );
pUndoDoc->RenameTab( nTab, aOldName, false );
if (bWasLinked)
- 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->SetVisible( nTab, rDoc.IsVisible( nTab ) );
+ pUndoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
+ pUndoDoc->SetSheetEvents( nTab, rDoc.GetSheetEvents( nTab ) );
// Drawing-Layer muss sein Undo selbst in der Hand behalten !!!
- pDoc->BeginDrawUndo(); // DeleteTab erzeugt ein SdrUndoDelPage
+ rDoc.BeginDrawUndo(); // DeleteTab erzeugt ein SdrUndoDelPage
- pUndoData = new ScRefUndoData( pDoc );
+ pUndoData = new ScRefUndoData( &rDoc );
}
- if (pDoc->DeleteTab(nTab))
+ if (rDoc.DeleteTab(nTab))
{
if (bRecord)
{
@@ -3077,7 +3077,7 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ )
if( bVbaEnabled )
{
OUString sCodeName;
- if( pDoc->GetCodeName( nTab, sCodeName ) )
+ if( rDoc.GetCodeName( nTab, sCodeName ) )
{
VBA_DeleteModule( rDocShell, sCodeName );
}
@@ -3112,12 +3112,12 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ )
bool ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- if ( pDoc->IsVisible( nTab ) == bVisible )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
+ if ( rDoc.IsVisible( nTab ) == bVisible )
return true; // nichts zu tun - ok
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR);
@@ -3126,14 +3126,14 @@ bool ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
ScDocShellModificator aModificator( rDocShell );
- if ( !bVisible && !pDoc->IsImportingXML() ) // #i57869# allow hiding in any order for loading
+ if ( !bVisible && !rDoc.IsImportingXML() ) // #i57869# allow hiding in any order for loading
{
// nicht alle Tabellen ausblenden
sal_uInt16 nVisCount = 0;
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB i=0; i<nCount && nVisCount<2; i++)
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
++nVisCount;
if (nVisCount <= 1)
@@ -3144,7 +3144,7 @@ bool ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
}
}
- pDoc->SetVisible( nTab, bVisible );
+ rDoc.SetVisible( nTab, bVisible );
if (bUndo)
{
std::vector<SCTAB> undoTabs;
@@ -3165,16 +3165,16 @@ bool ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
bool ScDocFunc::SetLayoutRTL( SCTAB nTab, bool bRTL, bool /* bApi */ )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- if ( pDoc->IsLayoutRTL( nTab ) == bRTL )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
+ if ( rDoc.IsLayoutRTL( nTab ) == bRTL )
return true; // nothing to do - ok
//! protection (sheet or document?)
ScDocShellModificator aModificator( rDocShell );
- pDoc->SetLayoutRTL( nTab, bRTL );
+ rDoc.SetLayoutRTL( nTab, bRTL );
if (bUndo)
{
@@ -3196,10 +3196,10 @@ bool ScDocFunc::SetLayoutRTL( SCTAB nTab, bool bRTL, bool /* bApi */ )
bool ScDocFunc::RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR);
@@ -3210,8 +3210,8 @@ bool ScDocFunc::RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
bool bSuccess = false;
OUString sOldName;
- pDoc->GetName(nTab, sOldName);
- if (pDoc->RenameTab( nTab, rName ))
+ rDoc.GetName(nTab, sOldName);
+ if (rDoc.RenameTab( nTab, rName ))
{
if (bRecord)
{
@@ -3230,10 +3230,10 @@ bool ScDocFunc::RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- if ( !pDoc->IsDocEditable() || pDoc->IsTabProtected(nTab) )
+ if ( !rDoc.IsDocEditable() || rDoc.IsTabProtected(nTab) )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Check to see what this string is...
@@ -3241,11 +3241,11 @@ bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bo
}
Color aOldTabBgColor;
- aOldTabBgColor = pDoc->GetTabBgColor(nTab);
+ aOldTabBgColor = rDoc.GetTabBgColor(nTab);
bool bSuccess = false;
- pDoc->SetTabBgColor(nTab, rColor);
- if ( pDoc->GetTabBgColor(nTab) == rColor)
+ rDoc.SetTabBgColor(nTab, rColor);
+ if ( rDoc.GetTabBgColor(nTab) == rColor)
bSuccess = true;
if (bSuccess)
{
@@ -3267,11 +3267,11 @@ bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bo
bool ScDocFunc::SetTabBgColor(
ScUndoTabColorInfo::List& rUndoTabColorList, bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Get a better String Error...
@@ -3287,12 +3287,12 @@ bool ScDocFunc::SetTabBgColor(
{
ScUndoTabColorInfo& rInfo = rUndoTabColorList[i];
nTab = rInfo.mnTabId;
- if ( !pDoc->IsTabProtected(nTab) )
+ if ( !rDoc.IsTabProtected(nTab) )
{
aNewTabBgColor = rInfo.maNewTabBgColor;
- rInfo.maOldTabBgColor = pDoc->GetTabBgColor(nTab);
- pDoc->SetTabBgColor(nTab, aNewTabBgColor);
- if ( pDoc->GetTabBgColor(nTab) != aNewTabBgColor)
+ rInfo.maOldTabBgColor = rDoc.GetTabBgColor(nTab);
+ rDoc.SetTabBgColor(nTab, aNewTabBgColor);
+ if ( rDoc.GetTabBgColor(nTab) != aNewTabBgColor)
{
bSuccess = false;
break;
@@ -3337,9 +3337,9 @@ static sal_uInt16 lcl_GetOptimalColWidth( ScDocShell& rDocShell, SCCOL nCol, SCT
double nPPTX = aProv.GetPPTX();
double nPPTY = aProv.GetPPTY();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
Fraction aOne(1,1);
- sal_uInt16 nTwips = pDoc->GetOptimalColWidth( nCol, nTab, pDev, nPPTX, nPPTY, aOne, aOne,
+ sal_uInt16 nTwips = rDoc.GetOptimalColWidth( nCol, nTab, pDev, nPPTX, nPPTY, aOne, aOne,
bFormula, NULL );
return nTwips;
@@ -3354,12 +3354,12 @@ bool ScDocFunc::SetWidthOrHeight(
if (rRanges.empty())
return true;
- ScDocument* pDoc = rDocShell.GetDocument();
- if ( bRecord && !pDoc->IsUndoEnabled() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if ( bRecord && !rDoc.IsUndoEnabled() )
bRecord = false;
// import into read-only document is possible
- if ( !pDoc->IsChangeReadOnlyEnabled() && !rDocShell.IsEditable() )
+ if ( !rDoc.IsChangeReadOnlyEnabled() && !rDocShell.IsEditable() )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR); //! eigene Meldung?
@@ -3382,23 +3382,23 @@ bool ScDocFunc::SetWidthOrHeight(
if ( bRecord )
{
- pDoc->BeginDrawUndo(); // Drawing Updates
+ rDoc.BeginDrawUndo(); // Drawing Updates
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bWidth)
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, false );
- pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab, static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, false );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab, static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, static_cast<SCROW>(nStart), nTab, MAXCOL, static_cast<SCROW>(nEnd), nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, static_cast<SCROW>(nStart), nTab, MAXCOL, static_cast<SCROW>(nEnd), nTab, IDF_NONE, false, pUndoDoc );
}
aUndoRanges = rRanges;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
pUndoTab = new ScOutlineTable( *pTable );
}
@@ -3422,11 +3422,11 @@ bool ScDocFunc::SetWidthOrHeight(
// dann SetOptimalHeight mit bShrink = FALSE
for (SCROW nRow=nStartNo; nRow<=nEndNo; nRow++)
{
- sal_uInt8 nOld = pDoc->GetRowFlags(nRow,nTab);
+ sal_uInt8 nOld = rDoc.GetRowFlags(nRow,nTab);
SCROW nLastRow = -1;
- bool bHidden = pDoc->RowHidden(nRow, nTab, NULL, &nLastRow);
+ bool bHidden = rDoc.RowHidden(nRow, nTab, NULL, &nLastRow);
if ( !bHidden && ( nOld & CR_MANUALSIZE ) )
- pDoc->SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
+ rDoc.SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
}
}
@@ -3434,10 +3434,10 @@ bool ScDocFunc::SetWidthOrHeight(
Fraction aOne(1,1);
sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
aCxt.setForceAutoSize(bAll);
- 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 wird bei bAll=sal_True schon in SetOptimalHeight gesetzt
// (an bei Extra-Height, sonst aus).
@@ -3446,22 +3446,22 @@ bool ScDocFunc::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
}
if ( eMode != SC_SIZE_ORIGINAL )
- 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 // Spaltenbreiten
{
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;
@@ -3469,10 +3469,10 @@ bool ScDocFunc::SetWidthOrHeight(
nThisSize = nSizeTwips +
lcl_GetOptimalColWidth( rDocShell, nCol, nTab, bFormula );
if ( nThisSize )
- pDoc->SetColWidth( nCol, nTab, nThisSize );
+ rDoc.SetColWidth( nCol, nTab, nThisSize );
if ( eMode != SC_SIZE_ORIGINAL )
- pDoc->ShowCol( nCol, nTab, bShow );
+ rDoc.ShowCol( nCol, nTab, bShow );
}
}
}
@@ -3482,16 +3482,16 @@ bool ScDocFunc::SetWidthOrHeight(
if ( eMode != SC_SIZE_ORIGINAL )
{
if (bWidth)
- bOutline = bOutline || pDoc->UpdateOutlineCol(
+ bOutline = bOutline || rDoc.UpdateOutlineCol(
static_cast<SCCOL>(nStartNo),
static_cast<SCCOL>(nEndNo), nTab, bShow );
else
- bOutline = bOutline || pDoc->UpdateOutlineRow(
+ bOutline = bOutline || rDoc.UpdateOutlineRow(
static_cast<SCROW>(nStartNo),
static_cast<SCROW>(nEndNo), nTab, bShow );
}
}
- pDoc->SetDrawPageSize(nTab);
+ rDoc.SetDrawPageSize(nTab);
if (!bOutline)
DELETEZ(pUndoTab);
@@ -3506,7 +3506,7 @@ bool ScDocFunc::SetWidthOrHeight(
aUndoRanges, pUndoTab, eMode, nSizeTwips, bWidth));
}
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
rDocShell.PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_ALL);
aModificator.SetDocumentModified();
@@ -3520,8 +3520,8 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
SCTAB nTab = rPos.Tab();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -3532,8 +3532,8 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
return false; // erste Spalte / Zeile
ScBreakType nBreak = bColumn ?
- pDoc->HasColBreak(static_cast<SCCOL>(nPos), nTab) :
- pDoc->HasRowBreak(static_cast<SCROW>(nPos), nTab);
+ rDoc.HasColBreak(static_cast<SCCOL>(nPos), nTab) :
+ rDoc.HasRowBreak(static_cast<SCROW>(nPos), nTab);
if (nBreak & BREAK_MANUAL)
return true;
@@ -3542,15 +3542,15 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
new ScUndoPageBreak( &rDocShell, rPos.Col(), rPos.Row(), nTab, bColumn, true ) );
if (bColumn)
- pDoc->SetColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
+ rDoc.SetColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
else
- pDoc->SetRowBreak(static_cast<SCROW>(nPos), nTab, false, true);
+ rDoc.SetRowBreak(static_cast<SCROW>(nPos), nTab, false, true);
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
if (bColumn)
{
@@ -3584,8 +3584,8 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
SCTAB nTab = rPos.Tab();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -3595,9 +3595,9 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
ScBreakType nBreak;
if (bColumn)
- nBreak = pDoc->HasColBreak(static_cast<SCCOL>(nPos), nTab);
+ nBreak = rDoc.HasColBreak(static_cast<SCCOL>(nPos), nTab);
else
- nBreak = pDoc->HasRowBreak(static_cast<SCROW>(nPos), nTab);
+ nBreak = rDoc.HasRowBreak(static_cast<SCROW>(nPos), nTab);
if ((nBreak & BREAK_MANUAL) == 0)
// There is no manual break.
return false;
@@ -3607,14 +3607,14 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
new ScUndoPageBreak( &rDocShell, rPos.Col(), rPos.Row(), nTab, bColumn, false ) );
if (bColumn)
- pDoc->RemoveColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
+ rDoc.RemoveColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
else
- pDoc->RemoveRowBreak(static_cast<SCROW>(nPos), nTab, false, true);
+ rDoc.RemoveRowBreak(static_cast<SCROW>(nPos), nTab, false, true);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
if (bColumn)
{
@@ -3645,12 +3645,12 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
void ScDocFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- pDoc->SetTabProtection(nTab, &rProtect);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetTabProtection(nTab, &rProtect);
+ if (rDoc.IsUndoEnabled())
{
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
OSL_ENSURE(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
if (pProtect)
{
@@ -3672,17 +3672,17 @@ void ScDocFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
bool ScDocFunc::Protect( SCTAB nTab, const OUString& rPassword, bool /*bApi*/ )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
if (nTab == TABLEID_DOC)
{
// document protection
ScDocProtection aProtection;
aProtection.setProtected(true);
aProtection.setPassword(rPassword);
- pDoc->SetDocProtection(&aProtection);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetDocProtection(&aProtection);
+ if (rDoc.IsUndoEnabled())
{
- ScDocProtection* pProtect = pDoc->GetDocProtection();
+ ScDocProtection* pProtect = rDoc.GetDocProtection();
OSL_ENSURE(pProtect, "ScDocFunc::Unprotect: ScDocProtection pointer is NULL!");
if (pProtect)
{
@@ -3703,10 +3703,10 @@ bool ScDocFunc::Protect( SCTAB nTab, const OUString& rPassword, bool /*bApi*/ )
ScTableProtection aProtection;
aProtection.setProtected(true);
aProtection.setPassword(rPassword);
- pDoc->SetTabProtection(nTab, &aProtection);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetTabProtection(nTab, &aProtection);
+ if (rDoc.IsUndoEnabled())
{
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
OSL_ENSURE(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
if (pProtect)
{
@@ -3730,13 +3730,13 @@ bool ScDocFunc::Protect( SCTAB nTab, const OUString& rPassword, bool /*bApi*/ )
bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
if (nTab == TABLEID_DOC)
{
// document protection
- ScDocProtection* pDocProtect = pDoc->GetDocProtection();
+ ScDocProtection* pDocProtect = rDoc.GetDocProtection();
if (!pDocProtect || !pDocProtect->isProtected())
// already unprotected (should not happen)!
return true;
@@ -3756,8 +3756,8 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
return false;
}
- pDoc->SetDocProtection(NULL);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetDocProtection(NULL);
+ if (rDoc.IsUndoEnabled())
{
pProtectCopy->setProtected(false);
rDocShell.GetUndoManager()->AddUndoAction(
@@ -3769,7 +3769,7 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
{
// sheet protection
- ScTableProtection* pTabProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pTabProtect = rDoc.GetTabProtection(nTab);
if (!pTabProtect || !pTabProtect->isProtected())
// already unprotected (should not happen)!
return true;
@@ -3788,8 +3788,8 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
return false;
}
- pDoc->SetTabProtection(nTab, NULL);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetTabProtection(nTab, NULL);
+ if (rDoc.IsUndoEnabled())
{
pProtectCopy->setProtected(false);
rDocShell.GetUndoManager()->AddUndoAction(
@@ -3809,9 +3809,9 @@ bool ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScEditableTester aTester( pDoc, rMark );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScEditableTester aTester( &rDoc, rMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -3835,14 +3835,14 @@ bool ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b
SCTAB nEndTab = aMarkRange.aEnd.Tab();
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( aMarkRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&aMultiMark );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ rDoc.CopyToDocument( aMarkRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&aMultiMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoClearItems( &rDocShell, aMultiMark, pUndoDoc, pWhich ) );
}
- pDoc->ClearSelectionItems( pWhich, aMultiMark );
+ rDoc.ClearSelectionItems( pWhich, aMultiMark );
rDocShell.PostPaint( aMarkRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
aModificator.SetDocumentModified();
@@ -3856,9 +3856,9 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- ScEditableTester aTester( pDoc, rMark );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
+ ScEditableTester aTester( &rDoc, rMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -3872,10 +3872,10 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
if (bUndo)
{
SCTAB nStartTab = aMarkRange.aStart.Tab();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nStartTab)
@@ -3884,13 +3884,13 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
ScRange aCopyRange = aMarkRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&rMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&rMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoIndent( &rDocShell, rMark, pUndoDoc, bIncrement ) );
}
- pDoc->ChangeSelectionIndent( bIncrement, rMark );
+ rDoc.ChangeSelectionIndent( bIncrement, rMark );
rDocShell.PostPaint( aMarkRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
aModificator.SetDocumentModified();
@@ -3924,7 +3924,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -3932,7 +3932,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
if (pTabMark)
@@ -3944,19 +3944,19 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
}
ScAutoFormat* pAutoFormat = ScGlobal::GetOrCreateAutoFormat();
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( nFormatNo < pAutoFormat->size() && aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
bool bSize = pAutoFormat->findByIndex(nFormatNo)->GetIncludeWidthHeight();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScDocument* pUndoDoc = NULL;
if ( bRecord )
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab, bSize, bSize );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab, bSize, bSize );
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nStartTab)
@@ -3965,18 +3965,18 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aCopyRange = rRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aStart.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, false, pUndoDoc, &aMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, false, pUndoDoc, &aMark );
if (bSize)
{
- pDoc->CopyToDocument( nStartCol,0,0, nEndCol,MAXROW,nTabCount-1,
+ rDoc.CopyToDocument( nStartCol,0,0, nEndCol,MAXROW,nTabCount-1,
IDF_NONE, false, pUndoDoc, &aMark );
- pDoc->CopyToDocument( 0,nStartRow,0, MAXCOL,nEndRow,nTabCount-1,
+ rDoc.CopyToDocument( 0,nStartRow,0, MAXCOL,nEndRow,nTabCount-1,
IDF_NONE, false, pUndoDoc, &aMark );
}
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
- pDoc->AutoFormat( nStartCol, nStartRow, nEndCol, nEndRow, nFormatNo, aMark );
+ rDoc.AutoFormat( nStartCol, nStartRow, nEndCol, nEndRow, nFormatNo, aMark );
if (bSize)
{
@@ -4029,7 +4029,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -4037,7 +4037,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
ScMarkData aMark;
if (pTabMark)
@@ -4048,7 +4048,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
aMark.SelectTable( nTab, true );
}
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
@@ -4059,35 +4059,35 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
{
//! auch bei Undo selektierte Tabellen beruecksichtigen
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ rDoc.CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
}
// use TokenArray if given, string (and flags) otherwise
if ( pTokenArray )
{
- pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
+ rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_OUSTRING, pTokenArray, eGrammar);
}
- else if ( pDoc->IsImportingXML() )
+ else if ( rDoc.IsImportingXML() )
{
ScTokenArray* pCode = lcl_ScDocFunc_CreateTokenArrayXML( rString, rFormulaNmsp, eGrammar );
- pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
+ rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_OUSTRING, pCode, eGrammar);
delete pCode;
- pDoc->IncXMLImportedFormulaCount( rString.getLength() );
+ rDoc.IncXMLImportedFormulaCount( rString.getLength() );
}
else if (bEnglish)
{
- ScCompiler aComp( pDoc, rRange.aStart);
+ ScCompiler aComp( &rDoc, rRange.aStart);
aComp.SetGrammar(eGrammar);
ScTokenArray* pCode = aComp.CompileString( rString );
- pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
+ rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_OUSTRING, pCode, eGrammar);
delete pCode;
}
else
- pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
+ rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, rString, NULL, eGrammar);
if (bUndo)
@@ -4115,7 +4115,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -4123,7 +4123,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -4135,17 +4135,17 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
aMark.SelectTable( nTab, true );
}
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
- pDoc->SetDirty( rRange );
+ rDoc.SetDirty( rRange );
if ( bRecord )
{
//! auch bei Undo selektierte Tabellen beruecksichtigen
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ rDoc.CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoTabOp( &rDocShell,
@@ -4157,7 +4157,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
rParam.aRefColCell,
rParam.meMode) );
}
- pDoc->InsertTableOp(rParam, nStartCol, nStartRow, nEndCol, nEndRow, aMark);
+ rDoc.InsertTableOp(rParam, nStartCol, nStartRow, nEndCol, nEndRow, aMark);
rDocShell.PostPaintGridAll();
aModificator.SetDocumentModified();
bSuccess = true;
@@ -4253,7 +4253,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
FillDir eDir, bool bRecord, bool bApi )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
bool bSuccess = false;
ScRange aRange = rRange;
@@ -4266,7 +4266,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = aRange.aEnd.Row();
SCTAB nEndTab = aRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -4278,7 +4278,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
aMark.SelectTable( nTab, true );
}
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
@@ -4310,11 +4310,11 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocument* pUndoDoc = NULL;
if ( bRecord )
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nDestStartTab)
@@ -4323,7 +4323,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aCopyRange = aDestArea;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_AUTOFILL, false, pUndoDoc, &aMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_AUTOFILL, false, pUndoDoc, &aMark );
}
sal_uLong nProgCount;
@@ -4332,10 +4332,10 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
else
nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
nProgCount *= nCount;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
+ rDoc.Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, FILL_SIMPLE );
AdjustRowHeight(aRange);
@@ -4366,7 +4366,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -4374,7 +4374,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -4386,7 +4386,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
aMark.SelectTable( nTab, true );
}
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
@@ -4394,7 +4394,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aSourceArea = rRange;
ScRange aDestArea = rRange;
- SCSIZE nCount = pDoc->GetEmptyLinesInBlock(
+ SCSIZE nCount = rDoc.GetEmptyLinesInBlock(
aSourceArea.aStart.Col(), aSourceArea.aStart.Row(), aSourceArea.aStart.Tab(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), aSourceArea.aEnd.Tab(),
DirFromFillDir(eDir) );
@@ -4425,17 +4425,17 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocument* pUndoDoc = NULL;
if ( bRecord )
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nDestStartTab)
pUndoDoc->AddUndoTab( *itr, *itr );
- pDoc->CopyToDocument(
+ rDoc.CopyToDocument(
aDestArea.aStart.Col(), aDestArea.aStart.Row(), 0,
aDestArea.aEnd.Col(), aDestArea.aEnd.Row(), nTabCount-1,
IDF_AUTOFILL, false, pUndoDoc, &aMark );
@@ -4449,7 +4449,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nValX = (eDir == FILL_TO_LEFT) ? aDestArea.aEnd.Col() : aDestArea.aStart.Col();
SCROW nValY = (eDir == FILL_TO_TOP ) ? aDestArea.aEnd.Row() : aDestArea.aStart.Row();
SCTAB nTab = aDestArea.aStart.Tab();
- pDoc->SetValue( nValX, nValY, nTab, fStart );
+ rDoc.SetValue( nValX, nValY, nTab, fStart );
}
sal_uLong nProgCount;
@@ -4458,10 +4458,10 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
else
nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
nProgCount *= nCount;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
+ rDoc.Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax );
AdjustRowHeight(rRange);
@@ -4497,7 +4497,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -4505,7 +4505,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -4554,7 +4554,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
//! Quellbereich darf geschuetzt sein !!!
//! aber kein Matrixfragment enthalten !!!
- ScEditableTester aTester( pDoc, aDestArea );
+ ScEditableTester aTester( &rDoc, aDestArea );
if ( !aTester.IsEditable() )
{
if (!bApi)
@@ -4562,7 +4562,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
return false;
}
- if ( pDoc->HasSelectedBlockMatrixFragment( nStartCol, nStartRow,
+ if ( rDoc.HasSelectedBlockMatrixFragment( nStartCol, nStartRow,
nEndCol, nEndRow, aMark ) )
{
if (!bApi)
@@ -4575,18 +4575,18 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
ScDocument* pUndoDoc = NULL;
if ( bRecord )
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && nTabCount; ++itr)
if (*itr != nDestStartTab)
pUndoDoc->AddUndoTab( *itr, *itr );
// do not clone note captions in undo document
- pDoc->CopyToDocument(
+ rDoc.CopyToDocument(
aDestArea.aStart.Col(), aDestArea.aStart.Row(), 0,
aDestArea.aEnd.Col(), aDestArea.aEnd.Row(), nTabCount-1,
IDF_AUTOFILL, false, pUndoDoc, &aMark );
@@ -4598,10 +4598,10 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
else
nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
nProgCount *= nCount;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
+ rDoc.Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax );
@@ -4637,16 +4637,16 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
return true;
}
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
set<SCTAB>::const_iterator itrBeg = rOption.maTabs.begin(), itrEnd = rOption.maTabs.end();
SCTAB nTab1 = *itrBeg, nTab2 = *rOption.maTabs.rbegin();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
for (set<SCTAB>::const_iterator itr = itrBeg; itr != itrEnd; ++itr)
{
- ScEditableTester aTester( pDoc, *itr, nStartCol, nStartRow, nEndCol, nEndRow );
+ ScEditableTester aTester( &rDoc, *itr, nStartCol, nStartRow, nEndCol, nEndRow );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -4654,7 +4654,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
return false;
}
- if ( pDoc->HasAttrib( nStartCol, nStartRow, *itr, nEndCol, nEndRow, *itr,
+ if ( rDoc.HasAttrib( nStartCol, nStartRow, *itr, nEndCol, nEndRow, *itr,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
// "Zusammenfassen nicht verschachteln !"
@@ -4670,8 +4670,8 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
{
SCTAB nTab = *itr;
bool bNeedContents = bContents &&
- ( !pDoc->IsBlockEmpty( nTab, nStartCol,nStartRow+1, nStartCol,nEndRow, true ) ||
- !pDoc->IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ) );
+ ( !rDoc.IsBlockEmpty( nTab, nStartCol,nStartRow+1, nStartCol,nEndRow, true ) ||
+ !rDoc.IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ) );
if (bRecord)
{
@@ -4679,28 +4679,28 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
bool bHasNotes = false;
for( ScAddress aPos( nStartCol, nStartRow, nTab ); !bHasNotes && (aPos.Col() <= nEndCol); aPos.IncCol() )
for( aPos.SetRow( nStartRow ); !bHasNotes && (aPos.Row() <= nEndRow); aPos.IncRow() )
- bHasNotes = ((aPos.Col() != nStartCol) || (aPos.Row() != nStartRow)) && (pDoc->HasNote(aPos));
+ bHasNotes = ((aPos.Col() != nStartCol) || (aPos.Row() != nStartRow)) && (rDoc.HasNote(aPos));
if (!pUndoDoc)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo(pDoc, nTab1, nTab2);
+ pUndoDoc->InitUndo(&rDoc, nTab1, nTab2);
}
// note captions are collected by drawing undo
- pDoc->CopyToDocument( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
+ rDoc.CopyToDocument( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
IDF_ALL|IDF_NOCAPTIONS, false, pUndoDoc );
if( bHasNotes )
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
if (bNeedContents)
- pDoc->DoMergeContents( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
- pDoc->DoMerge( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ rDoc.DoMergeContents( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ rDoc.DoMerge( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
if (rOption.mbCenter)
{
- pDoc->ApplyAttr( nStartCol, nStartRow, nTab, SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
- pDoc->ApplyAttr( nStartCol, nStartRow, nTab, SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) );
+ rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
+ rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) );
}
if ( !AdjustRowHeight( ScRange( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab ) ) )
@@ -4709,7 +4709,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
if (bNeedContents || rOption.mbCenter)
{
ScRange aRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab);
- pDoc->SetDirty(aRange);
+ rDoc.SetDirty(aRange);
}
bNeedContentsUndo |= bNeedContents;
@@ -4717,7 +4717,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
if (pUndoDoc)
{
- SdrUndoGroup* pDrawUndo = pDoc->GetDrawLayer() ? pDoc->GetDrawLayer()->GetCalcUndo() : NULL;
+ SdrUndoGroup* pDrawUndo = rDoc.GetDrawLayer() ? rDoc.GetDrawLayer()->GetCalcUndo() : NULL;
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoMerge(&rDocShell, rOption, bNeedContentsUndo, pUndoDoc, pDrawUndo) );
}
@@ -4754,9 +4754,9 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord )
return true;
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScDocument* pUndoDoc = NULL;
@@ -4765,36 +4765,36 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord )
{
SCTAB nTab = *itr;
ScRange aRange = rOption.getSingleRange(nTab);
- if ( !pDoc->HasAttrib(aRange, HASATTR_MERGED) )
+ if ( !rDoc.HasAttrib(aRange, HASATTR_MERGED) )
continue;
ScRange aExtended = aRange;
- pDoc->ExtendMerge(aExtended);
+ rDoc.ExtendMerge(aExtended);
ScRange aRefresh = aExtended;
- pDoc->ExtendOverlapped(aRefresh);
+ rDoc.ExtendOverlapped(aRefresh);
if (bRecord)
{
if (!pUndoDoc)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo(pDoc, *rOption.maTabs.begin(), *rOption.maTabs.rbegin());
+ pUndoDoc->InitUndo(&rDoc, *rOption.maTabs.begin(), *rOption.maTabs.rbegin());
}
- pDoc->CopyToDocument(aExtended, IDF_ATTRIB, false, pUndoDoc);
+ rDoc.CopyToDocument(aExtended, IDF_ATTRIB, false, pUndoDoc);
}
- const SfxPoolItem& rDefAttr = pDoc->GetPool()->GetDefaultItem( ATTR_MERGE );
- ScPatternAttr aPattern( pDoc->GetPool() );
+ const SfxPoolItem& rDefAttr = rDoc.GetPool()->GetDefaultItem( ATTR_MERGE );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( rDefAttr );
- pDoc->ApplyPatternAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.ApplyPatternAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(), nTab,
aPattern );
- pDoc->RemoveFlagsTab( aExtended.aStart.Col(), aExtended.aStart.Row(),
+ rDoc.RemoveFlagsTab( aExtended.aStart.Col(), aExtended.aStart.Row(),
aExtended.aEnd.Col(), aExtended.aEnd.Row(), nTab,
SC_MF_HOR | SC_MF_VER );
- pDoc->ExtendMerge( aRefresh, true );
+ rDoc.ExtendMerge( aRefresh, true );
if ( !AdjustRowHeight( aExtended ) )
rDocShell.PostPaint( aExtended, PAINT_GRID );
@@ -4820,19 +4820,19 @@ bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA
ScDocShellModificator aModificator( rDocShell );
OSL_ENSURE( pNewRanges, "pNewRanges is 0" );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
if (bUndo)
{
ScRangeName* pOld;
if (nTab >=0)
{
- pOld = pDoc->GetRangeName(nTab);
+ pOld = rDoc.GetRangeName(nTab);
}
else
{
- pOld = pDoc->GetRangeName();
+ pOld = rDoc.GetRangeName();
}
ScRangeName* pUndoRanges = new ScRangeName(*pOld);
ScRangeName* pRedoRanges = new ScRangeName(*pNewRanges);
@@ -4843,16 +4843,16 @@ bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA
// #i55926# While loading XML, formula cells only have a single string token,
// so CompileNameFormula would never find any name (index) tokens, and would
// unnecessarily loop through all cells.
- bool bCompile = ( !pDoc->IsImportingXML() && pDoc->GetNamedRangesLockCount() == 0 );
+ bool bCompile = ( !rDoc.IsImportingXML() && rDoc.GetNamedRangesLockCount() == 0 );
if ( bCompile )
- pDoc->PreprocessRangeNameUpdate();
+ rDoc.PreprocessRangeNameUpdate();
if (nTab >= 0)
- pDoc->SetRangeName( nTab, pNewRanges ); // takes ownership
+ rDoc.SetRangeName( nTab, pNewRanges ); // takes ownership
else
- pDoc->SetRangeName( pNewRanges ); // takes ownership
+ rDoc.SetRangeName( pNewRanges ); // takes ownership
if ( bCompile )
- pDoc->PostprocessRangeNameUpdate();
+ rDoc.PostprocessRangeNameUpdate();
if (bModifyDoc)
{
@@ -4866,19 +4866,19 @@ bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA
void ScDocFunc::ModifyAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& rRangeMap )
{
ScDocShellModificator aModificator(rDocShell);
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (pDoc->IsUndoEnabled())
+ if (rDoc.IsUndoEnabled())
{
std::map<OUString, ScRangeName*> aOldRangeMap;
- pDoc->GetRangeNameMap(aOldRangeMap);
+ rDoc.GetRangeNameMap(aOldRangeMap);
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoAllRangeNames(&rDocShell, aOldRangeMap, rRangeMap));
}
- pDoc->PreprocessRangeNameUpdate();
- pDoc->SetAllRangeNames(rRangeMap);
- pDoc->PostprocessRangeNameUpdate();
+ rDoc.PreprocessRangeNameUpdate();
+ rDoc.SetAllRangeNames(rRangeMap);
+ rDoc.PostprocessRangeNameUpdate();
aModificator.SetDocumentModified();
SFX_APP()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED));
@@ -4892,14 +4892,14 @@ void ScDocFunc::CreateOneName( ScRangeName& rList,
if (rCancel)
return;
- ScDocument* pDoc = rDocShell.GetDocument();
- if (!pDoc->HasValueData( nPosX, nPosY, nTab ))
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (!rDoc.HasValueData( nPosX, nPosY, nTab ))
{
- OUString aName = pDoc->GetString(nPosX, nPosY, nTab);
+ OUString aName = rDoc.GetString(nPosX, nPosY, nTab);
ScRangeData::MakeValidName(aName);
if (!aName.isEmpty())
{
- OUString aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(SCR_ABS_3D, pDoc));
+ OUString aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(SCR_ABS_3D, &rDoc));
bool bInsert = false;
ScRangeData* pOld = rList.findByUpperName(ScGlobal::pCharClass->uppercase(aName));
@@ -4937,7 +4937,7 @@ void ScDocFunc::CreateOneName( ScRangeName& rList,
if (bInsert)
{
- ScRangeData* pData = new ScRangeData( pDoc, aName, aContent,
+ ScRangeData* pData = new ScRangeData( &rDoc, aName, aContent,
ScAddress( nPosX, nPosY, nTab));
if (!rList.insert(pData))
{
@@ -4973,12 +4973,12 @@ bool ScDocFunc::CreateNames( const ScRange& rRange, sal_uInt16 nFlags, bool bApi
if (bValid)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScRangeName* pNames;
if (aTab >=0)
- pNames = pDoc->GetRangeName(nTab);
+ pNames = rDoc.GetRangeName(nTab);
else
- pNames = pDoc->GetRangeName();
+ pNames = rDoc.GetRangeName();
if (!pNames)
return false; // soll nicht sein
@@ -5043,13 +5043,13 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
ScDocShellModificator aModificator( rDocShell );
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- const bool bRecord = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ const bool bRecord = rDoc.IsUndoEnabled();
SCTAB nTab = rStartPos.Tab();
ScDocument* pUndoDoc = NULL;
//local names have higher priority than global names
- ScRangeName* pLocalList = pDoc->GetRangeName(nTab);
+ ScRangeName* pLocalList = rDoc.GetRangeName(nTab);
sal_uInt16 nValidCount = 0;
ScRangeName::iterator itrLocalBeg = pLocalList->begin(), itrLocalEnd = pLocalList->end();
for (ScRangeName::iterator itr = itrLocalBeg; itr != itrLocalEnd; ++itr)
@@ -5058,7 +5058,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
if (!r.HasType(RT_DATABASE))
++nValidCount;
}
- ScRangeName* pList = pDoc->GetRangeName();
+ ScRangeName* pList = rDoc.GetRangeName();
ScRangeName::iterator itrBeg = pList->begin(), itrEnd = pList->end();
for (ScRangeName::iterator itr = itrBeg; itr != itrEnd; ++itr)
{
@@ -5074,17 +5074,17 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
SCCOL nEndCol = nStartCol + 1;
SCROW nEndRow = nStartRow + static_cast<SCROW>(nValidCount) - 1;
- ScEditableTester aTester( pDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ ScEditableTester aTester( &rDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
if (aTester.IsEditable())
{
if (bRecord)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
IDF_ALL, false, pUndoDoc );
- pDoc->BeginDrawUndo(); // wegen Hoehenanpassung
+ rDoc.BeginDrawUndo(); // wegen Hoehenanpassung
}
boost::scoped_array<ScRangeData*> ppSortArray(new ScRangeData* [ nValidCount ]);
@@ -5116,8 +5116,8 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
aFormula = "=" + aContent.toString();
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(ScAddress(nStartCol,nOutRow,nTab), aName, &aParam);
- pDoc->SetString(ScAddress(nEndCol,nOutRow,nTab), aFormula, &aParam);
+ rDoc.SetString(ScAddress(nStartCol,nOutRow,nTab), aName, &aParam);
+ rDoc.SetString(ScAddress(nEndCol,nOutRow,nTab), aFormula, &aParam);
++nOutRow;
}
@@ -5126,8 +5126,8 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
if (bRecord)
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
+ pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
IDF_ALL, false, pRedoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
@@ -5150,17 +5150,17 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
bool ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rOldRange.aStart.Col();
SCROW nStartRow = rOldRange.aStart.Row();
SCTAB nTab = rOldRange.aStart.Tab();
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
bool bRet = false;
OUString aFormula;
- pDoc->GetFormula( nStartCol, nStartRow, nTab, aFormula );
+ rDoc.GetFormula( nStartCol, nStartRow, nTab, aFormula );
if ( aFormula.startsWith("{") && aFormula.endsWith("}") )
{
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_RESIZEMATRIX );
@@ -5197,10 +5197,10 @@ bool ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter,
const ScRange& rDestRange, sal_uLong nRefresh,
bool bFitBlock, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
// #i52120# if other area links exist at the same start position,
// remove them first (file format specifies only one link definition
@@ -5264,7 +5264,7 @@ bool ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter,
}
// Update hat sein eigenes Undo
- if (pDoc->IsExecuteLinkEnabled())
+ if (rDoc.IsExecuteLinkEnabled())
{
pLink->SetDoInsert(bFitBlock); // beim ersten Update ggf. nichts einfuegen
pLink->Update(); // kein SetInCreate -> Update ausfuehren
@@ -5298,18 +5298,18 @@ void SetConditionalFormatAttributes(ScDocument* pDoc, const ScRangeList& rRanges
void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFormat* pFormat, SCTAB nTab, const ScRangeList& rRanges )
{
ScDocShellModificator aModificator(rDocShell);
- ScDocument* pDoc = rDocShell.GetDocument();
- if(pDoc->IsTabProtected(nTab))
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if(rDoc.IsTabProtected(nTab))
return;
- bool bUndo = pDoc->IsUndoEnabled();
+ bool bUndo = rDoc.IsUndoEnabled();
ScDocument* pUndoDoc = NULL;
ScRange aCombinedRange = rRanges.Combine();
ScRange aCompleteRange;
if(bUndo)
{
pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
if(pFormat)
{
@@ -5317,12 +5317,12 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
}
if(nOldFormat)
{
- ScConditionalFormat* pOldFormat = pDoc->GetCondFormList(nTab)->GetFormat(nOldFormat);
+ ScConditionalFormat* pOldFormat = rDoc.GetCondFormList(nTab)->GetFormat(nOldFormat);
if(pOldFormat)
aCompleteRange.ExtendTo(pOldFormat->GetRange().Combine());
}
- pDoc->CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
+ rDoc.CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
IDF_ALL, false, pUndoDoc );
}
@@ -5330,15 +5330,15 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
boost::scoped_ptr<ScRange> pRepaintRange;
if(nOldFormat)
{
- ScConditionalFormat* pOldFormat = pDoc->GetCondFormList(nTab)->GetFormat(nOldFormat);
+ ScConditionalFormat* pOldFormat = rDoc.GetCondFormList(nTab)->GetFormat(nOldFormat);
if(pOldFormat)
{
pRepaintRange.reset(new ScRange( pOldFormat->GetRange().Combine() ));
- RemoveCondFormatAttributes(pDoc, pOldFormat, nTab);
+ RemoveCondFormatAttributes(&rDoc, pOldFormat, nTab);
}
- pDoc->DeleteConditionalFormat(nOldFormat, nTab);
- pDoc->SetStreamValid(nTab, false);
+ rDoc.DeleteConditionalFormat(nOldFormat, nTab);
+ rDoc.SetStreamValid(nTab, false);
}
if(pFormat)
{
@@ -5347,17 +5347,17 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
else
pRepaintRange.reset(new ScRange(aCombinedRange));
- sal_uLong nIndex = pDoc->AddCondFormat(pFormat, nTab);
+ sal_uLong nIndex = rDoc.AddCondFormat(pFormat, nTab);
- SetConditionalFormatAttributes(pDoc, rRanges, nIndex, nTab);
- pDoc->SetStreamValid(nTab, false);
+ SetConditionalFormatAttributes(&rDoc, rRanges, nIndex, nTab);
+ rDoc.SetStreamValid(nTab, false);
}
if(bUndo)
{
ScDocument* pRedoDoc = new ScDocument(SCDOCMODE_UNDO);
- pRedoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
+ pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ rDoc.CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
IDF_ALL, false, pRedoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
@@ -5374,15 +5374,15 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB nTab )
{
ScDocShellModificator aModificator(rDocShell);
- ScDocument* pDoc = rDocShell.GetDocument();
- if(pDoc->IsTabProtected(nTab))
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if(rDoc.IsTabProtected(nTab))
return;
// first remove all old entries
- ScConditionalFormatList* pOldList = pDoc->GetCondFormList(nTab);
+ ScConditionalFormatList* pOldList = rDoc.GetCondFormList(nTab);
for(ScConditionalFormatList::const_iterator itr = pOldList->begin(), itrEnd = pOldList->end(); itr != itrEnd; ++itr)
{
- RemoveCondFormatAttributes(pDoc, &(*itr), nTab);
+ RemoveCondFormatAttributes(&rDoc, &(*itr), nTab);
}
// then set new entries
@@ -5390,13 +5390,13 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
{
sal_uLong nIndex = itr->GetKey();
const ScRangeList& rRange = itr->GetRange();
- SetConditionalFormatAttributes(pDoc, rRange, nIndex, nTab);
+ SetConditionalFormatAttributes(&rDoc, rRange, nIndex, nTab);
}
- pDoc->SetCondFormList(pList, nTab);
+ rDoc.SetCondFormList(pList, nTab);
rDocShell.PostPaintGridAll();
- pDoc->SetStreamValid(nTab, false);
+ rDoc.SetStreamValid(nTab, false);
aModificator.SetDocumentModified();
SFX_APP()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED));
}
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 7ed1836346d0..8c1ea5b0b2db 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -213,7 +213,7 @@ void ScDocShell::DoEnterHandler()
{
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if (pViewSh)
- if (pViewSh->GetViewData()->GetDocShell() == this)
+ if (pViewSh->GetViewData().GetDocShell() == this)
SC_MOD()->InputEnterHandler();
}
@@ -223,7 +223,7 @@ SCTAB ScDocShell::GetSaveTab()
ScTabViewShell* pSh = GetBestViewShell();
if (pSh)
{
- const ScMarkData& rMark = pSh->GetViewData()->GetMarkData();
+ const ScMarkData& rMark = pSh->GetViewData().GetMarkData();
nTab = rMark.GetFirstSelected();
}
return nTab;
@@ -423,7 +423,7 @@ void processDataStream( ScDocShell& rShell, const sc::ImportPostProcessData& rDa
sc::DataStream* pStrm = new sc::DataStream(&rShell, r.maURL, aTopRange, nLimit, eMove, 0);
pStrm->SetRefreshOnEmptyLine(r.mbRefreshOnEmpty);
- sc::DocumentLinkManager& rMgr = rShell.GetDocument()->GetDocLinkManager();
+ sc::DocumentLinkManager& rMgr = rShell.GetDocument().GetDocLinkManager();
rMgr.setDataStream(pStrm);
}
@@ -933,7 +933,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
break;
case SFX_EVENT_SAVEASDOC:
{
- if ( GetDocument()->GetExternalRefManager()->containsUnsavedReferences() )
+ if ( GetDocument().GetExternalRefManager()->containsUnsavedReferences() )
{
WarningBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO ),
ScGlobal::GetRscString( STR_UNSAVED_EXT_REF ) );
@@ -2223,7 +2223,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
ScExtDocOptions* pExtDocOpt = aDocument.GetExtDocOptions();
if( !pExtDocOpt )
aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
- pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
+ pViewShell->GetViewData().WriteExtOptions( *pExtDocOpt );
/* #i104990# If the imported document contains a medium
password, determine if we can save it, otherwise ask the users
@@ -3068,43 +3068,43 @@ void ScDocShell::UseSheetSaveEntries()
ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS )
:
rDocShell( rDS ),
- mpProtector(new ScRefreshTimerProtector(rDS.GetDocument()->GetRefreshTimerControlAddress()))
+ mpProtector(new ScRefreshTimerProtector(rDS.GetDocument().GetRefreshTimerControlAddress()))
{
- ScDocument* pDoc = rDocShell.GetDocument();
- bAutoCalcShellDisabled = pDoc->IsAutoCalcShellDisabled();
- bIdleEnabled = pDoc->IsIdleEnabled();
- pDoc->SetAutoCalcShellDisabled( true );
- pDoc->EnableIdle(false);
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bAutoCalcShellDisabled = rDoc.IsAutoCalcShellDisabled();
+ bIdleEnabled = rDoc.IsIdleEnabled();
+ rDoc.SetAutoCalcShellDisabled( true );
+ rDoc.EnableIdle(false);
}
ScDocShellModificator::~ScDocShellModificator()
{
- ScDocument* pDoc = rDocShell.GetDocument();
- pDoc->SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ rDoc.SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
if ( !bAutoCalcShellDisabled && rDocShell.IsDocumentModifiedPending() )
rDocShell.SetDocumentModified(); // last one shuts off the lights
- pDoc->EnableIdle(bIdleEnabled);
+ rDoc.EnableIdle(bIdleEnabled);
}
void ScDocShellModificator::SetDocumentModified()
{
- ScDocument* pDoc = rDocShell.GetDocument();
- pDoc->ClearFormulaContext();
- if ( !pDoc->IsImportingXML() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ rDoc.ClearFormulaContext();
+ if ( !rDoc.IsImportingXML() )
{
// AutoCalcShellDisabled temporaer restaurieren
- bool bDisabled = pDoc->IsAutoCalcShellDisabled();
- pDoc->SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
+ bool bDisabled = rDoc.IsAutoCalcShellDisabled();
+ rDoc.SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
rDocShell.SetDocumentModified();
- pDoc->SetAutoCalcShellDisabled( bDisabled );
+ rDoc.SetAutoCalcShellDisabled( bDisabled );
}
else
{
// uno broadcast is necessary for api to work
// -> must also be done during xml import
- pDoc->BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ rDoc.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
}
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 22d295e68295..d7862d17195e 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -72,7 +72,7 @@ void ScDocShell::PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddre
// Test: nur aktive ViewShell
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if (pViewSh && pViewSh->GetViewData()->GetDocShell() == this)
+ if (pViewSh && pViewSh->GetViewData().GetDocShell() == this)
{
ScEditViewHint aHint( pEditEngine, rCursorPos );
pViewSh->Notify( *this, aHint );
@@ -554,7 +554,7 @@ sal_uInt16 ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, sal_uInt16 nDiffFlag
ScChangeAction* ScDocShell::GetChangeAction( const ScAddress& rPos )
{
- ScChangeTrack* pTrack = GetDocument()->GetChangeTrack();
+ ScChangeTrack* pTrack = GetDocument().GetChangeTrack();
if (!pTrack)
return NULL;
@@ -612,7 +612,7 @@ void ScDocShell::SetChangeComment( ScChangeAction* pAction, const OUString& rCom
SetDocumentModified();
// Dialog-Notify
- ScChangeTrack* pTrack = GetDocument()->GetChangeTrack();
+ ScChangeTrack* pTrack = GetDocument().GetChangeTrack();
if (pTrack)
{
sal_uLong nNumber = pAction->GetActionNumber();
@@ -879,7 +879,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
bool bHasRejected = false;
OUString aOldUser = pThisTrack->GetUser();
pThisTrack->SetUseFixDateTime( true );
- ScMarkData& rMarkData = pViewSh->GetViewData()->GetMarkData();
+ ScMarkData& rMarkData = pViewSh->GetViewData().GetMarkData();
ScMarkData aOldMarkData( rMarkData );
pSourceAction = pFirstMergeAction;
while ( pSourceAction && pSourceAction->GetActionNumber() <= nLastMergeAction )
@@ -1151,7 +1151,7 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
return false;
}
- ScDocument& rSharedDoc = *( pSharedDocShell->GetDocument() );
+ ScDocument& rSharedDoc = pSharedDocShell->GetDocument();
ScChangeTrack* pSharedTrack = rSharedDoc.GetChangeTrack();
if ( !pSharedTrack )
{
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index dd9eaf8a585a..04751134d07b 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -254,7 +254,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
case SID_CHART_ADDSOURCE:
if (pReqArgs)
{
- ScDocument* pDoc = GetDocument();
+ ScDocument& rDoc = GetDocument();
const SfxPoolItem* pItem;
OUString aChartName, aRangeName;
@@ -285,12 +285,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
bRowInit = true;
}
- ScAddress::Details aDetails(pDoc->GetAddressConvention(), 0, 0);
- bool bValid = ( aSingleRange.ParseAny( aRangeName, pDoc, aDetails ) & SCA_VALID ) != 0;
+ ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0);
+ bool bValid = ( aSingleRange.ParseAny( aRangeName, &rDoc, aDetails ) & SCA_VALID ) != 0;
if (!bValid)
{
aRangeListRef = new ScRangeList;
- aRangeListRef->Parse( aRangeName, pDoc );
+ aRangeListRef->Parse( aRangeName, &rDoc );
if ( !aRangeListRef->empty() )
{
bMultiRange = true;
@@ -410,9 +410,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
break;
case SID_UPDATETABLINKS:
{
- ScDocument* pDoc = GetDocument();
+ ScDocument& rDoc = GetDocument();
- ScLkUpdMode nSet=pDoc->GetLinkMode();
+ ScLkUpdMode nSet = rDoc.GetLinkMode();
sal_uInt16 nDlgRet=RET_NO;
if(nSet==LM_UNKNOWN)
@@ -557,70 +557,67 @@ void ScDocShell::Execute( SfxRequest& rReq )
case FID_CHG_RECORD:
{
- ScDocument* pDoc = GetDocument();
- if(pDoc!=NULL)
+ ScDocument& rDoc = GetDocument();
+ // get argument (recorded macro)
+ SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FID_CHG_RECORD, false );
+ bool bDo = true;
+
+ // xmlsec05/06:
+ // getting real parent window when called from Security-Options TP
+ Window* pParent = NULL;
+ const SfxPoolItem* pParentItem;
+ if( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( SID_ATTR_XWINDOW, false, &pParentItem ) )
+ pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr();
+
+ // desired state
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
+ bool bActivateTracking = (pChangeTrack == 0); // toggle
+ if ( pItem )
+ bActivateTracking = pItem->GetValue(); // from argument
+
+ if ( !bActivateTracking )
{
- // get argument (recorded macro)
- SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FID_CHG_RECORD, false );
- bool bDo = true;
-
- // xmlsec05/06:
- // getting real parent window when called from Security-Options TP
- Window* pParent = NULL;
- const SfxPoolItem* pParentItem;
- if( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( SID_ATTR_XWINDOW, false, &pParentItem ) )
- pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr();
-
- // desired state
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
- bool bActivateTracking = (pChangeTrack == 0); // toggle
- if ( pItem )
- bActivateTracking = pItem->GetValue(); // from argument
-
- if ( !bActivateTracking )
+ if ( !pItem )
{
- if ( !pItem )
- {
- // no dialog on playing the macro
- WarningBox aBox( pParent ? pParent : GetActiveDialogParent(),
- WinBits(WB_YES_NO | WB_DEF_NO),
- ScGlobal::GetRscString( STR_END_REDLINING ) );
- bDo = ( aBox.Execute() == RET_YES );
- }
+ // no dialog on playing the macro
+ WarningBox aBox( pParent ? pParent : GetActiveDialogParent(),
+ WinBits(WB_YES_NO | WB_DEF_NO),
+ ScGlobal::GetRscString( STR_END_REDLINING ) );
+ bDo = ( aBox.Execute() == RET_YES );
+ }
+ if ( bDo )
+ {
+ if ( pChangeTrack->IsProtected() )
+ bDo = ExecuteChangeProtectionDialog( NULL );
if ( bDo )
{
- if ( pChangeTrack->IsProtected() )
- bDo = ExecuteChangeProtectionDialog( NULL );
- if ( bDo )
- {
- pDoc->EndChangeTracking();
- PostPaintGridAll();
- }
+ rDoc.EndChangeTracking();
+ PostPaintGridAll();
}
}
- else
- {
- pDoc->StartChangeTracking();
- ScChangeViewSettings aChangeViewSet;
- aChangeViewSet.SetShowChanges(true);
- pDoc->SetChangeViewSettings(aChangeViewSet);
- }
+ }
+ else
+ {
+ rDoc.StartChangeTracking();
+ ScChangeViewSettings aChangeViewSet;
+ aChangeViewSet.SetShowChanges(true);
+ rDoc.SetChangeViewSettings(aChangeViewSet);
+ }
- if ( bDo )
- {
- UpdateAcceptChangesDialog();
+ if ( bDo )
+ {
+ UpdateAcceptChangesDialog();
- // Slots invalidieren
- if (pBindings)
- pBindings->InvalidateAll(false);
- if ( !pItem )
- rReq.AppendItem( SfxBoolItem( FID_CHG_RECORD, bActivateTracking ) );
- rReq.Done();
- }
- else
- rReq.Ignore();
+ // Slots invalidieren
+ if (pBindings)
+ pBindings->InvalidateAll(false);
+ if ( !pItem )
+ rReq.AppendItem( SfxBoolItem( FID_CHG_RECORD, bActivateTracking ) );
+ rReq.Done();
}
+ else
+ rReq.Ignore();
}
break;
@@ -746,9 +743,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
}
#endif
if ( nSlot == SID_DOCUMENT_COMPARE )
- CompareDocument( *pOtherDocSh->GetDocument() );
+ CompareDocument( pOtherDocSh->GetDocument() );
else
- MergeDocument( *pOtherDocSh->GetDocument() );
+ MergeDocument( pOtherDocSh->GetDocument() );
// show "accept changes" dialog
//! get view for this document!
@@ -822,7 +819,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if ( pSh )
{
//! SetTabNo in DeleteTable weglassen?
- SCTAB nDispTab = pSh->GetViewData()->GetTabNo();
+ SCTAB nDispTab = pSh->GetViewData().GetTabNo();
pSh->DeleteTable( nTab );
pSh->SetTabNo(nDispTab);
rReq.Done();
@@ -2186,7 +2183,7 @@ ScViewData* ScDocShell::GetViewData()
{
SfxViewShell* pCur = SfxViewShell::Current();
ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,pCur);
- return pViewSh ? pViewSh->GetViewData() : NULL;
+ return pViewSh ? &pViewSh->GetViewData() : NULL;
}
SCTAB ScDocShell::GetCurTab()
@@ -2202,7 +2199,7 @@ ScTabViewShell* ScDocShell::GetBestViewShell( bool bOnlyVisible )
{
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
// falsches Doc?
- if( pViewSh && pViewSh->GetViewData()->GetDocShell() != this )
+ if( pViewSh && pViewSh->GetViewData().GetDocShell() != this )
pViewSh = NULL;
if( !pViewSh )
{
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index c52e287efd37..88cab9572471 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -822,40 +822,40 @@ sal_uLong ScDocShell::TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
SCTAB nDestPos, bool bInsertNew,
bool bNotifyAndPaint )
{
- ScDocument* pSrcDoc = rSrcDocShell.GetDocument();
+ ScDocument& rSrcDoc = rSrcDocShell.GetDocument();
// set the transferred area to the copyparam to make adjusting formulas possible
ScClipParam aParam;
ScRange aRange(0, 0, nSrcPos, MAXCOL, MAXROW, nSrcPos);
aParam.maRanges.Append(aRange);
- pSrcDoc->SetClipParam(aParam);
+ rSrcDoc.SetClipParam(aParam);
- sal_uLong nErrVal = aDocument.TransferTab( pSrcDoc, nSrcPos, nDestPos,
+ sal_uLong nErrVal = aDocument.TransferTab( &rSrcDoc, nSrcPos, nDestPos,
bInsertNew ); // no insert
// TransferTab doesn't copy drawing objects with bInsertNew=FALSE
if ( nErrVal > 0 && !bInsertNew)
- aDocument.TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
+ aDocument.TransferDrawPage( &rSrcDoc, nSrcPos, nDestPos );
- if(nErrVal>0 && pSrcDoc->IsScenario( nSrcPos ))
+ if(nErrVal>0 && rSrcDoc.IsScenario( nSrcPos ))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pSrcDoc->GetScenarioData( nSrcPos, aComment,aColor, nFlags);
+ rSrcDoc.GetScenarioData( nSrcPos, aComment,aColor, nFlags);
aDocument.SetScenario(nDestPos,true);
aDocument.SetScenarioData(nDestPos,aComment,aColor,nFlags);
- bool bActive = pSrcDoc->IsActiveScenario(nSrcPos);
+ bool bActive = rSrcDoc.IsActiveScenario(nSrcPos);
aDocument.SetActiveScenario(nDestPos, bActive );
- bool bVisible=pSrcDoc->IsVisible(nSrcPos);
+ bool bVisible = rSrcDoc.IsVisible(nSrcPos);
aDocument.SetVisible(nDestPos,bVisible );
}
- if ( nErrVal > 0 && pSrcDoc->IsTabProtected( nSrcPos ) )
- aDocument.SetTabProtection(nDestPos, pSrcDoc->GetTabProtection(nSrcPos));
+ if ( nErrVal > 0 && rSrcDoc.IsTabProtected( nSrcPos ) )
+ aDocument.SetTabProtection(nDestPos, rSrcDoc.GetTabProtection(nSrcPos));
if ( bNotifyAndPaint )
{
Broadcast( ScTablesHint( SC_TAB_INSERTED, nDestPos ) );
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 7dd8d0eaf46e..1e21b7541ea7 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -151,7 +151,7 @@ void ScDocShell::SetVisAreaOrSize( const Rectangle& rVisArea, bool bModifyStart
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if (pViewSh)
{
- if (pViewSh->GetViewData()->GetDocShell() == this)
+ if (pViewSh->GetViewData().GetDocShell() == this)
pViewSh->UpdateOleZoom();
}
}
@@ -279,7 +279,7 @@ void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellS
if ( !bCellStyles && !bPageStyles ) // nothing to do
return;
- ScStyleSheetPool* pSourcePool = rSource.GetDocument()->GetStyleSheetPool();
+ ScStyleSheetPool* pSourcePool = rSource.GetDocument().GetStyleSheetPool();
ScStyleSheetPool* pDestPool = aDocument.GetStyleSheetPool();
SfxStyleFamily eFamily = bCellStyles ?
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index ddb2e575d112..a37f78fdbc30 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -486,8 +486,8 @@ void lcl_GetColumnTypes(
OUString* pColNames, sal_Int32* pColTypes, sal_Int32* pColLengths,
sal_Int32* pColScales, bool& bHasMemo, rtl_TextEncoding eCharSet )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- SvNumberFormatter* pNumFmt = pDoc->GetFormatTable();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ SvNumberFormatter* pNumFmt = rDoc.GetFormatTable();
SCTAB nTab = rDataRange.aStart.Tab();
SCCOL nFirstCol = rDataRange.aStart.Col();
@@ -514,7 +514,7 @@ void lcl_GetColumnTypes(
// Type etc.: L; D; C[,W]; N[,W[,P]]
if ( bHasFieldNames )
{
- aString = pDoc->GetString(nCol, nFirstRow, nTab);
+ aString = rDoc.GetString(nCol, nFirstRow, nTab);
aString = aString.toAsciiUpperCase();
sal_Int32 nToken = comphelper::string::getTokenCount(aString, ',');
if ( nToken > 1 )
@@ -615,13 +615,13 @@ void lcl_GetColumnTypes(
if ( !bTypeDefined )
{ // Field type.
ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nCol, nFirstDataRow, nTab));
+ aCell.assign(rDoc, ScAddress(nCol, nFirstDataRow, nTab));
if (aCell.isEmpty() || aCell.hasString())
nDbType = sdbc::DataType::VARCHAR;
else
{
sal_uInt32 nFormat;
- pDoc->GetNumberFormat( nCol, nFirstDataRow, nTab, nFormat );
+ rDoc.GetNumberFormat( nCol, nFirstDataRow, nTab, nFormat );
switch ( pNumFmt->GetType( nFormat ) )
{
case NUMBERFORMAT_LOGICAL :
@@ -646,7 +646,7 @@ void lcl_GetColumnTypes(
// Field length.
if ( nDbType == sdbc::DataType::VARCHAR && !nFieldLen )
{ // Determine maximum field width.
- nFieldLen = pDoc->GetMaxStringLen( nTab, nCol, nFirstDataRow,
+ nFieldLen = rDoc.GetMaxStringLen( nTab, nCol, nFirstDataRow,
nLastRow, eCharSet );
if ( nFieldLen == 0 )
nFieldLen = 1;
@@ -655,7 +655,7 @@ void lcl_GetColumnTypes(
{ // Determine maximum field width and precision.
sal_Int32 nLen;
sal_uInt16 nPrec;
- nLen = pDoc->GetMaxNumberStringLen( nPrec, nTab, nCol,
+ nLen = rDoc.GetMaxNumberStringLen( nPrec, nTab, nCol,
nFirstDataRow, nLastRow );
// dBaseIII precision limit: 15
if ( nPrecision > 15 )
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index fae875483756..5269d78b58c4 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2239,7 +2239,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
if (pFileName->equalsIgnoreAsciiCase(pMedium->GetName()))
{
// Found !
- pSrcDoc = pShell->GetDocument();
+ pSrcDoc = &pShell->GetDocument();
break;
}
}
@@ -2254,7 +2254,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
aSrcDoc.maShell = pShell;
maUnsavedDocShells.insert(DocShellMap::value_type(nFileId, aSrcDoc));
StartListening(*pShell);
- pSrcDoc = pShell->GetDocument();
+ pSrcDoc = &pShell->GetDocument();
break;
}
}
@@ -2279,7 +2279,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
SfxObjectShell* p = itr->second.maShell;
itr->second.maLastAccess = Time( Time::SYSTEM );
- return static_cast<ScDocShell*>(p)->GetDocument();
+ return &static_cast<ScDocShell*>(p)->GetDocument();
}
itrEnd = maUnsavedDocShells.end();
@@ -2290,7 +2290,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
SfxObjectShell* p = itr->second.maShell;
itr->second.maLastAccess = Time( Time::SYSTEM );
- return static_cast<ScDocShell*>(p)->GetDocument();
+ return &static_cast<ScDocShell*>(p)->GetDocument();
}
const OUString* pFile = getExternalFileName(nFileId);
@@ -2313,7 +2313,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
return NULL;
}
- return cacheNewDocShell(nFileId, aSrcDoc);
+ return &cacheNewDocShell(nFileId, aSrcDoc);
}
SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUString& rFilter)
@@ -2376,17 +2376,17 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
// increment the recursive link count of the source document.
ScExtDocOptions* pExtOpt = mpDoc->GetExtDocOptions();
sal_uInt32 nLinkCount = pExtOpt ? pExtOpt->GetDocSettings().mnLinkCnt : 0;
- ScDocument* pSrcDoc = pNewShell->GetDocument();
- pSrcDoc->EnableExecuteLink(false); // to prevent circular access of external references.
- pSrcDoc->EnableUndo(false);
- pSrcDoc->EnableAdjustHeight(false);
- pSrcDoc->EnableUserInteraction(false);
+ ScDocument& rSrcDoc = pNewShell->GetDocument();
+ rSrcDoc.EnableExecuteLink(false); // to prevent circular access of external references.
+ rSrcDoc.EnableUndo(false);
+ rSrcDoc.EnableAdjustHeight(false);
+ rSrcDoc.EnableUserInteraction(false);
- ScExtDocOptions* pExtOptNew = pSrcDoc->GetExtDocOptions();
+ ScExtDocOptions* pExtOptNew = rSrcDoc.GetExtDocOptions();
if (!pExtOptNew)
{
pExtOptNew = new ScExtDocOptions;
- pSrcDoc->SetExtDocOptions(pExtOptNew);
+ rSrcDoc.SetExtDocOptions(pExtOptNew);
}
pExtOptNew->GetDocSettings().mnLinkCnt = nLinkCount + 1;
@@ -2406,7 +2406,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
return aRef;
}
-ScDocument* ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell )
+ScDocument& ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell )
{
if (mbDocTimerEnabled && maDocShells.empty())
// If this is the first source document insertion, start up the timer.
@@ -2414,9 +2414,9 @@ ScDocument* ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell
maDocShells.insert(DocShellMap::value_type(nFileId, rSrcShell));
SfxObjectShell& rShell = *rSrcShell.maShell;
- ScDocument* pSrcDoc = static_cast<ScDocShell&>(rShell).GetDocument();
- initDocInCache(maRefCache, pSrcDoc, nFileId);
- return pSrcDoc;
+ ScDocument& rSrcDoc = static_cast<ScDocShell&>(rShell).GetDocument();
+ initDocInCache(maRefCache, &rSrcDoc, nFileId);
+ return rSrcDoc;
}
bool ScExternalRefManager::isFileLoadable(const OUString& rFile) const
@@ -2742,13 +2742,13 @@ bool ScExternalRefManager::refreshSrcDocument(sal_uInt16 nFileId)
return false;
ScDocShell& rDocSh = static_cast<ScDocShell&>(*xDocShell);
- ScDocument* pSrcDoc = rDocSh.GetDocument();
+ ScDocument& rSrcDoc = rDocSh.GetDocument();
// Clear the existing cache, and refill it. Make sure we keep the
// existing cache table instances here.
maRefCache.clearCacheTables(nFileId);
RefCacheFiller aAction(mpDoc->GetSharedStringPool(), maRefCache, nFileId);
- aCachedArea.executeColumnAction(*pSrcDoc, aAction);
+ aCachedArea.executeColumnAction(rSrcDoc, aAction);
DocShellMap::iterator it = maDocShells.find(nFileId);
if (it != maDocShells.end())
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 57656d4f7bdc..3aa5cf6b0c64 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -46,7 +46,7 @@ static void lcl_InvalidateOutliner( SfxBindings* pBindings )
static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab,
bool bColumns, SCCOLROW nStart, SCCOLROW nEnd )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
sal_uInt16 nParts = PAINT_GRID;
SCCOL nStartCol = 0;
@@ -65,7 +65,7 @@ static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab,
nStartRow = nStart;
nEndRow = nEnd;
}
- if (pDoc->HasAttrib( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
+ if (rDoc.HasAttrib( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
nStartCol = 0;
@@ -83,24 +83,24 @@ bool ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool b
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab, true );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab, true );
ScOutlineTable* pUndoTab = NULL;
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
if (bRecord)
pUndoTab = new ScOutlineTable( *pTable );
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
bool bRes;
bool bSize = false;
if ( bColumns )
- bRes = pArray->Insert( nStartCol, nEndCol, bSize );
+ bRes = rArray.Insert( nStartCol, nEndCol, bSize );
else
- bRes = pArray->Insert( nStartRow, nEndRow, bSize );
+ bRes = rArray.Insert( nStartRow, nEndRow, bSize );
if ( bRes )
{
@@ -112,8 +112,8 @@ bool ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool b
pUndoTab, bColumns, true ) );
}
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
sal_uInt16 nParts = 0; // Datenbereich nicht geaendert
if ( bColumns )
@@ -148,25 +148,25 @@ bool ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
ScOutlineTable* pUndoTab = NULL;
if (bRecord)
pUndoTab = new ScOutlineTable( *pTable );
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
bool bRes;
bool bSize = false;
if ( bColumns )
- bRes = pArray->Remove( nStartCol, nEndCol, bSize );
+ bRes = rArray.Remove( nStartCol, nEndCol, bSize );
else
- bRes = pArray->Remove( nStartRow, nEndRow, bSize );
+ bRes = rArray.Remove( nStartRow, nEndRow, bSize );
if ( bRes )
{
@@ -178,8 +178,8 @@ bool ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool
pUndoTab, bColumns, false ) );
}
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
sal_uInt16 nParts = 0; // Datenbereich nicht geaendert
if ( bColumns )
@@ -209,27 +209,27 @@ bool ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool
bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord )
{
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
if (bRecord)
{
SCCOLROW nCol1, nCol2, nRow1, nRow2;
- pTable->GetColArray()->GetRange( nCol1, nCol2 );
- pTable->GetRowArray()->GetRange( nRow1, nRow2 );
+ pTable->GetColArray().GetRange( nCol1, nCol2 );
+ pTable->GetRowArray().GetRange( nRow1, nRow2 );
SCCOL nStartCol = static_cast<SCCOL>(nCol1);
SCROW nStartRow = nRow1;
SCCOL nEndCol = static_cast<SCCOL>(nCol2);
SCROW nEndRow = nRow2;
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
- pDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
@@ -240,14 +240,14 @@ bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord )
pUndoDoc, pUndoTab ) );
}
- SelectLevel( nTab, true, pTable->GetColArray()->GetDepth(), false, false );
- SelectLevel( nTab, false, pTable->GetRowArray()->GetDepth(), false, false );
- pDoc->SetOutlineTable( nTab, NULL );
+ SelectLevel( nTab, true, pTable->GetColArray().GetDepth(), false, false );
+ SelectLevel( nTab, false, pTable->GetRowArray().GetDepth(), false, false );
+ rDoc.SetOutlineTable( nTab, NULL );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab,
PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE );
@@ -267,11 +267,11 @@ bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
ScDocument* pUndoDoc = NULL;
ScOutlineTable* pUndoTab = NULL;
@@ -283,26 +283,26 @@ bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
pUndoTab = new ScOutlineTable( *pTable );
SCCOLROW nCol1, nCol2, nRow1, nRow2;
- pTable->GetColArray()->GetRange( nCol1, nCol2 );
- pTable->GetRowArray()->GetRange( nRow1, nRow2 );
+ pTable->GetColArray().GetRange( nCol1, nCol2 );
+ pTable->GetRowArray().GetRange( nRow1, nRow2 );
SCCOL nOutStartCol = static_cast<SCCOL>(nCol1);
SCROW nOutStartRow = nRow1;
SCCOL nOutEndCol = static_cast<SCCOL>(nCol2);
SCROW nOutEndRow = nRow2;
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( nOutStartCol, 0, nTab, 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( nOutStartCol, 0, nTab, nOutEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, IDF_NONE, false, pUndoDoc );
}
// einblenden
- SelectLevel( nTab, true, pTable->GetColArray()->GetDepth(), false, false );
- SelectLevel( nTab, false, pTable->GetRowArray()->GetDepth(), false, false );
- pDoc->SetOutlineTable( nTab, NULL );
+ SelectLevel( nTab, true, pTable->GetColArray().GetDepth(), false, false );
+ SelectLevel( nTab, false, pTable->GetRowArray().GetDepth(), false, false );
+ rDoc.SetOutlineTable( nTab, NULL );
}
- pDoc->DoAutoOutline( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
+ rDoc.DoAutoOutline( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
if (bRecord)
{
@@ -313,8 +313,8 @@ bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
pUndoDoc, pUndoTab ) );
}
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_LEFT | PAINT_TOP | PAINT_SIZE );
rDocShell.SetDocumentModified();
@@ -326,19 +326,17 @@ bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel,
bool bRecord, bool bPaint )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab ); // ist schon da
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab ); // ist schon da
if (!pTable)
return false;
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
- if (!pArray)
- return false;
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
SCCOLROW nStart, nEnd;
- pArray->GetRange( nStart, nEnd );
+ rArray.GetRange( nStart, nEnd );
if ( bRecord )
{
@@ -346,15 +344,15 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bColumns)
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, false );
- pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, false );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
}
rDocShell.GetUndoManager()->AddUndoAction(
@@ -364,7 +362,7 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
bColumns, nLevel ) );
}
- ScSubOutlineIterator aIter( pArray ); // alle Eintraege
+ ScSubOutlineIterator aIter( &rArray ); // alle Eintraege
ScOutlineEntry* pEntry;
while ((pEntry=aIter.GetNext()) != NULL)
{
@@ -390,22 +388,22 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
for (SCCOLROW i=nThisStart; i<=nThisEnd; i++)
{
if ( bColumns )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, bShow );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, bShow );
else
{
// show several rows together, don't show filtered rows
SCROW nFilterEnd = i;
- bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ bool bFiltered = rDoc.RowFiltered( i, nTab, NULL, &nFilterEnd );
nFilterEnd = std::min( nThisEnd, nFilterEnd );
if ( !bShow || !bFiltered )
- pDoc->ShowRows( i, nFilterEnd, nTab, bShow );
+ rDoc.ShowRows( i, nFilterEnd, nTab, bShow );
i = nFilterEnd;
}
}
}
- pDoc->SetDrawPageSize(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.UpdatePageBreaks( nTab );
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
@@ -426,15 +424,14 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
- ScOutlineArray* pArray;
ScOutlineEntry* pEntry;
SCCOLROW nStart;
SCCOLROW nEnd;
@@ -446,9 +443,9 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
{
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
- pDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoOutlineBlock( &rDocShell,
@@ -460,8 +457,8 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
nMin=MAXCOL;
nMax=0;
- pArray = pTable->GetColArray();
- ScSubOutlineIterator aColIter( pArray );
+ ScOutlineArray& rColArray = pTable->GetColArray();
+ ScSubOutlineIterator aColIter( &rColArray );
while ((pEntry=aColIter.GetNext()) != NULL)
{
nStart = pEntry->GetStart();
@@ -475,14 +472,14 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
}
}
for ( i=nMin; i<=nMax; i++ )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, true );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, true );
// Zeilen
nMin=MAXROW;
nMax=0;
- pArray = pTable->GetRowArray();
- ScSubOutlineIterator aRowIter( pArray );
+ ScOutlineArray& rRowArray = pTable->GetRowArray();
+ ScSubOutlineIterator aRowIter( &rRowArray );
while ((pEntry=aRowIter.GetNext()) != NULL)
{
nStart = pEntry->GetStart();
@@ -499,15 +496,15 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
{
// show several rows together, don't show filtered rows
SCROW nFilterEnd = i;
- bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ bool bFiltered = rDoc.RowFiltered( i, nTab, NULL, &nFilterEnd );
nFilterEnd = std::min( nMax, nFilterEnd );
if ( !bFiltered )
- pDoc->ShowRows( i, nFilterEnd, nTab, true );
+ rDoc.ShowRows( i, nFilterEnd, nTab, true );
i = nFilterEnd;
}
- pDoc->SetDrawPageSize(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.UpdatePageBreaks( nTab );
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
rDocShell.SetDocumentModified();
@@ -529,11 +526,11 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
@@ -547,24 +544,24 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
SCCOLROW nEffStartCol = nStartCol;
SCCOLROW nEffEndCol = nEndCol;
- ScOutlineArray* pColArray = pTable->GetColArray();
- pColArray->FindTouchedLevel( nStartCol, nEndCol, nColLevel );
- pColArray->ExtendBlock( nColLevel, nEffStartCol, nEffEndCol );
+ ScOutlineArray& rColArray = pTable->GetColArray();
+ rColArray.FindTouchedLevel( nStartCol, nEndCol, nColLevel );
+ rColArray.ExtendBlock( nColLevel, nEffStartCol, nEffEndCol );
SCCOLROW nEffStartRow = nStartRow;
SCCOLROW nEffEndRow = nEndRow;
- ScOutlineArray* pRowArray = pTable->GetRowArray();
- pRowArray->FindTouchedLevel( nStartRow, nEndRow, nRowLevel );
- pRowArray->ExtendBlock( nRowLevel, nEffStartRow, nEffEndRow );
+ ScOutlineArray& rRowArray = pTable->GetRowArray();
+ rRowArray.FindTouchedLevel( nStartRow, nEndRow, nRowLevel );
+ rRowArray.ExtendBlock( nRowLevel, nEffStartRow, nEffEndRow );
if ( bRecord )
{
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( static_cast<SCCOL>(nEffStartCol), 0, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nEffStartCol), 0, nTab,
static_cast<SCCOL>(nEffEndCol), MAXROW, nTab, IDF_NONE,
false, pUndoDoc );
- pDoc->CopyToDocument( 0, nEffStartRow, nTab, MAXCOL, nEffEndRow, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nEffStartRow, nTab, MAXCOL, nEffEndRow, nTab, IDF_NONE, false, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoOutlineBlock( &rDocShell,
@@ -574,10 +571,10 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
// Spalten
- nCount = pColArray->GetCount(nColLevel);
+ nCount = rColArray.GetCount(nColLevel);
for ( i=0; i<nCount; i++ )
{
- pEntry = pColArray->GetEntry(nColLevel,i);
+ pEntry = rColArray.GetEntry(nColLevel,i);
nStart = pEntry->GetStart();
nEnd = pEntry->GetEnd();
@@ -587,10 +584,10 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
// Zeilen
- nCount = pRowArray->GetCount(nRowLevel);
+ nCount = rRowArray.GetCount(nRowLevel);
for ( i=0; i<nCount; i++ )
{
- pEntry = pRowArray->GetEntry(nRowLevel,i);
+ pEntry = rRowArray.GetEntry(nRowLevel,i);
nStart = pEntry->GetStart();
nEnd = pEntry->GetEnd();
@@ -598,8 +595,8 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
HideOutline( nTab, false, nRowLevel, i, false, false );
}
- pDoc->SetDrawPageSize(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.UpdatePageBreaks( nTab );
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
@@ -615,13 +612,13 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
bool bRecord, bool bPaint )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
- ScOutlineEntry* pEntry = pArray->GetEntry( nLevel, nEntry );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
+ ScOutlineEntry* pEntry = rArray.GetEntry( nLevel, nEntry );
SCCOLROW nStart = pEntry->GetStart();
SCCOLROW nEnd = pEntry->GetEnd();
@@ -630,15 +627,15 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bColumns)
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, false );
- pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, false );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
}
rDocShell.GetUndoManager()->AddUndoAction(
@@ -652,20 +649,20 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
for ( i = nStart; i <= nEnd; i++ )
{
if ( bColumns )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, true );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, true );
else
{
// show several rows together, don't show filtered rows
SCROW nFilterEnd = i;
- bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ bool bFiltered = rDoc.RowFiltered( i, nTab, NULL, &nFilterEnd );
nFilterEnd = std::min( nEnd, nFilterEnd );
if ( !bFiltered )
- pDoc->ShowRows( i, nFilterEnd, nTab, true );
+ rDoc.ShowRows( i, nFilterEnd, nTab, true );
i = nFilterEnd;
}
}
- ScSubOutlineIterator aIter( pArray, nLevel, nEntry );
+ ScSubOutlineIterator aIter( &rArray, nLevel, nEntry );
while ((pEntry=aIter.GetNext()) != NULL)
{
if ( pEntry->IsHidden() )
@@ -674,17 +671,17 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
SCCOLROW nSubEnd = pEntry->GetEnd();
if ( bColumns )
for ( i = nSubStart; i <= nSubEnd; i++ )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, false );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, false );
else
- pDoc->ShowRows( nSubStart, nSubEnd, nTab, false );
+ rDoc.ShowRows( nSubStart, nSubEnd, nTab, false );
}
}
- pArray->SetVisibleBelow( nLevel, nEntry, true, true );
+ rArray.SetVisibleBelow( nLevel, nEntry, true, true );
- pDoc->SetDrawPageSize(nTab);
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
@@ -699,13 +696,13 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
bool bRecord, bool bPaint )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
- ScOutlineEntry* pEntry = pArray->GetEntry( nLevel, nEntry );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
+ ScOutlineEntry* pEntry = rArray.GetEntry( nLevel, nEntry );
SCCOLROW nStart = pEntry->GetStart();
SCCOLROW nEnd = pEntry->GetEnd();
@@ -714,15 +711,15 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bColumns)
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, false );
- pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, false );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
}
rDocShell.GetUndoManager()->AddUndoAction(
@@ -735,15 +732,15 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
SCCOLROW i;
if ( bColumns )
for ( i = nStart; i <= nEnd; i++ )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, false );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, false );
else
- pDoc->ShowRows( nStart, nEnd, nTab, false );
+ rDoc.ShowRows( nStart, nEnd, nTab, false );
- pArray->SetVisibleBelow( nLevel, nEntry, false );
+ rArray.SetVisibleBelow( nLevel, nEntry, false );
- pDoc->SetDrawPageSize(nTab);
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index 2cafae98e2ea..416e6359311e 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -33,8 +33,8 @@ static bool lcl_FillRangeFromName( ScRange& rRange, ScDocShell* pDocSh, const OU
{
if (pDocSh)
{
- ScDocument* pDoc = pDocSh->GetDocument();
- ScRangeName* pNames = pDoc->GetRangeName();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ ScRangeName* pNames = rDoc.GetRangeName();
if (pNames)
{
const ScRangeData* pData = pNames->findByUpperName(ScGlobal::pCharClass->uppercase(rName));
@@ -78,17 +78,17 @@ ScServerObject::ScServerObject( ScDocShell* pShell, const OUString& rItem ) :
else
{
// parse ref
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = ScDocShell::GetCurTab();
aRange.aStart.SetTab( nTab );
// For DDE link, we always must parse references using OOO A1 convention.
- if ( aRange.Parse( rItem, pDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
+ if ( aRange.Parse( rItem, &rDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
{
// area reference
}
- else if ( aRange.aStart.Parse( rItem, pDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
+ else if ( aRange.aStart.Parse( rItem, &rDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
{
// cell reference
aRange.aEnd = aRange.aStart;
@@ -99,8 +99,8 @@ ScServerObject::ScServerObject( ScDocShell* pShell, const OUString& rItem ) :
}
}
- pDocSh->GetDocument()->GetLinkManager()->InsertServer( this );
- pDocSh->GetDocument()->StartListeningArea( aRange, &aForwarder );
+ pDocSh->GetDocument().GetLinkManager()->InsertServer( this );
+ pDocSh->GetDocument().StartListeningArea( aRange, &aForwarder );
StartListening(*pDocSh); // um mitzubekommen, wenn die DocShell geloescht wird
StartListening(*SFX_APP()); // for SC_HINT_AREAS_CHANGED
@@ -118,8 +118,8 @@ void ScServerObject::Clear()
ScDocShell* pTemp = pDocSh;
pDocSh = NULL;
- pTemp->GetDocument()->EndListeningArea( aRange, &aForwarder );
- pTemp->GetDocument()->GetLinkManager()->RemoveServer( this );
+ pTemp->GetDocument().EndListeningArea( aRange, &aForwarder );
+ pTemp->GetDocument().GetLinkManager()->RemoveServer( this );
EndListening(*pTemp);
EndListening(*SFX_APP());
}
@@ -154,18 +154,18 @@ bool ScServerObject::GetData(
// refresh the listeners now (this is called from a timer)
EndListeningAll();
- pDocSh->GetDocument()->StartListeningArea( aRange, &aForwarder );
+ pDocSh->GetDocument().StartListeningArea( aRange, &aForwarder );
StartListening(*pDocSh);
StartListening(*SFX_APP());
bRefreshListener = false;
}
OUString aDdeTextFmt = pDocSh->GetDdeTextFmt();
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
if( FORMAT_STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ))
{
- ScImportExport aObj( pDoc, aRange );
+ ScImportExport aObj( &rDoc, aRange );
if( aDdeTextFmt[0] == 'F' )
aObj.SetFormulas( true );
if( aDdeTextFmt.equalsAscii( "SYLK" ) ||
@@ -188,7 +188,7 @@ bool ScServerObject::GetData(
return aObj.ExportData( rMimeType, rData );
}
- ScImportExport aObj( pDoc, aRange );
+ ScImportExport aObj( &rDoc, aRange );
aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, ' ', false ) );
if( aObj.IsRef() )
return aObj.ExportData( rMimeType, rData );
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index f1af923f6f84..9059a27a67f1 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -89,7 +89,7 @@ ScTableLink::ScTableLink(SfxObjectShell* pShell, const OUString& rFile,
{
pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell );
SetRefreshHandler( LINK( this, ScTableLink, RefreshHdl ) );
- SetRefreshControl( pImpl->m_pDocSh->GetDocument()->GetRefreshTimerControlAddress() );
+ SetRefreshControl( &pImpl->m_pDocSh->GetDocument().GetRefreshTimerControlAddress() );
}
ScTableLink::~ScTableLink()
@@ -98,11 +98,11 @@ ScTableLink::~ScTableLink()
StopRefreshTimer();
OUString aEmpty;
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
- if (pDoc->IsLinked(nTab) && aFileName.equals(pDoc->GetLinkDoc(nTab)))
- pDoc->SetLink( nTab, SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
+ if (rDoc.IsLinked(nTab) && aFileName.equals(rDoc.GetLinkDoc(nTab)))
+ rDoc.SetLink( nTab, SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
delete pImpl;
}
@@ -123,7 +123,7 @@ void ScTableLink::Edit( Window* pParent, const Link& rEndEditHdl )
::sfx2::SvBaseLink::UpdateResult ScTableLink::DataChanged(
const OUString&, const ::com::sun::star::uno::Any& )
{
- sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument().GetLinkManager();
if (pLinkManager!=NULL)
{
OUString aFile, aFilter;
@@ -142,8 +142,8 @@ void ScTableLink::Edit( Window* pParent, const Link& rEndEditHdl )
void ScTableLink::Closed()
{
// Verknuepfung loeschen: Undo
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
if (bAddUndo && bUndo)
{
@@ -160,7 +160,7 @@ void ScTableLink::Closed()
bool ScTableLink::IsUsed() const
{
- return pImpl->m_pDocSh->GetDocument()->HasLink( aFileName, aFilterName, aOptions );
+ return pImpl->m_pDocSh->GetDocument().HasLink( aFileName, aFilterName, aOptions );
}
bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
@@ -178,10 +178,10 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
if (!pFilter)
return false;
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- pDoc->SetInLinkUpdate( true );
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
+ rDoc.SetInLinkUpdate( true );
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
// wenn neuer Filter ausgewaehlt wurde, Optionen vergessen
if (!aFilterName.equals(rNewFilter))
@@ -221,36 +221,36 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
ScDocShellModificator aModificator( *pImpl->m_pDocSh );
bool bNotFound = false;
- ScDocument* pSrcDoc = pSrcShell->GetDocument();
+ ScDocument& rSrcDoc = pSrcShell->GetDocument();
// from text filters that don't set the table name,
// use the one table regardless of link table name
- bool bAutoTab = (pSrcDoc->GetTableCount() == 1) &&
+ bool bAutoTab = (rSrcDoc.GetTableCount() == 1) &&
ScDocShell::HasAutomaticTableName( rNewFilter );
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
{
- sal_uInt8 nMode = pDoc->GetLinkMode(nTab);
- if (nMode && aFileName.equals(pDoc->GetLinkDoc(nTab)))
+ sal_uInt8 nMode = rDoc.GetLinkMode(nTab);
+ if (nMode && aFileName.equals(rDoc.GetLinkDoc(nTab)))
{
- OUString aTabName = pDoc->GetLinkTab(nTab);
+ OUString aTabName = rDoc.GetLinkTab(nTab);
// Undo
if (bAddUndo && bUndo)
{
if (bFirst)
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
else
pUndoDoc->AddUndoTab( nTab, nTab, true, true );
bFirst = false;
ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
- pDoc->CopyToDocument(aRange, IDF_ALL, false, pUndoDoc);
- pUndoDoc->TransferDrawPage( pDoc, nTab, nTab );
+ rDoc.CopyToDocument(aRange, IDF_ALL, false, pUndoDoc);
+ pUndoDoc->TransferDrawPage( &rDoc, nTab, nTab );
pUndoDoc->SetLink( nTab, nMode, aFileName, aFilterName,
aOptions, aTabName, GetRefreshDelay() );
- pUndoDoc->SetTabBgColor( nTab, pDoc->GetTabBgColor(nTab) );
+ pUndoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
}
// Tabellenname einer ExtDocRef anpassen
@@ -258,11 +258,11 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
if ( bNewUrlName && nMode == SC_LINK_VALUE )
{
OUString aName;
- pDoc->GetName( nTab, aName );
+ rDoc.GetName( nTab, aName );
if ( ScGlobal::GetpTransliteration()->isEqual(
ScGlobal::GetDocTabName( aFileName, aTabName ), aName ) )
{
- pDoc->RenameTab( nTab,
+ rDoc.RenameTab( nTab,
ScGlobal::GetDocTabName( aNewUrl, aTabName ),
false, true ); // kein RefUpdate, kein ValidTabName
}
@@ -274,22 +274,22 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
bool bFound = false;
/* #i71497# check if external document is loaded successfully,
otherwise we may find the empty default sheet "Sheet1" in
- pSrcDoc, even if the document does not exist. */
+ rSrcDoc, even if the document does not exist. */
if( pMed->GetError() == 0 )
{
// no sheet name -> use first sheet
if ( !aTabName.isEmpty() && !bAutoTab )
- bFound = pSrcDoc->GetTable( aTabName, nSrcTab );
+ bFound = rSrcDoc.GetTable( aTabName, nSrcTab );
else
bFound = true;
}
if (bFound)
- pDoc->TransferTab( pSrcDoc, nSrcTab, nTab, false, // nicht neu einfuegen
+ rDoc.TransferTab( &rSrcDoc, nSrcTab, nTab, false, // nicht neu einfuegen
(nMode == SC_LINK_VALUE) ); // nur Werte?
else
{
- pDoc->DeleteAreaTab( 0,0,MAXCOL,MAXROW, nTab, IDF_ALL );
+ rDoc.DeleteAreaTab( 0,0,MAXCOL,MAXROW, nTab, IDF_ALL );
bool bShowError = true;
if ( nMode == SC_LINK_VALUE )
@@ -299,7 +299,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
ScRangeList aErrorCells; // cells on the linked sheets that need error values
- ScCellIterator aIter(pDoc, ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB)); // all sheets
+ ScCellIterator aIter(&rDoc, ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB)); // all sheets
for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
{
if (aIter.getType() != CELLTYPE_FORMULA)
@@ -339,7 +339,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
for (SCCOL nCol=nStartCol; nCol<=nEndCol; nCol++)
{
ScAddress aDestPos( nCol, nRow, nTab );
- pDoc->SetFormula(aDestPos, aTokenArr);
+ rDoc.SetFormula(aDestPos, aTokenArr);
}
}
@@ -352,11 +352,11 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
{
// Normal link or no references: put error message on sheet.
- pDoc->SetString( 0,0,nTab, ScGlobal::GetRscString(STR_LINKERROR) );
- pDoc->SetString( 0,1,nTab, ScGlobal::GetRscString(STR_LINKERRORFILE) );
- pDoc->SetString( 1,1,nTab, aNewUrl );
- pDoc->SetString( 0,2,nTab, ScGlobal::GetRscString(STR_LINKERRORTAB) );
- pDoc->SetString( 1,2,nTab, aTabName );
+ rDoc.SetString( 0,0,nTab, ScGlobal::GetRscString(STR_LINKERROR) );
+ rDoc.SetString( 0,1,nTab, ScGlobal::GetRscString(STR_LINKERRORFILE) );
+ rDoc.SetString( 1,1,nTab, aNewUrl );
+ rDoc.SetString( 0,2,nTab, ScGlobal::GetRscString(STR_LINKERRORTAB) );
+ rDoc.SetString( 1,2,nTab, aTabName );
}
bNotFound = true;
@@ -365,7 +365,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
if ( bNewUrlName || !aFilterName.equals(rNewFilter) ||
!aOptions.equals(aNewOpt) || pNewOptions ||
nNewRefresh != GetRefreshDelay() )
- pDoc->SetLink( nTab, nMode, aNewUrl, rNewFilter, aNewOpt,
+ rDoc.SetLink( nTab, nMode, aNewUrl, rNewFilter, aNewOpt,
aTabName, nNewRefresh );
}
}
@@ -403,13 +403,13 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
//! Fehler ausgeben ?
}
- pDoc->SetInLinkUpdate( false );
+ rDoc.SetInLinkUpdate( false );
// notify Uno objects (for XRefreshListener)
//! also notify Uno objects if file name was changed!
ScLinkRefreshedHint aHint;
aHint.SetSheetLink( aFileName );
- pDoc->BroadcastUno( aHint );
+ rDoc.BroadcastUno( aHint );
return true;
}
@@ -535,17 +535,14 @@ ScDocumentLoader::ScDocumentLoader( const OUString& rFileName,
pDocShell = new ScDocShell( SFX_CREATE_MODE_INTERNAL );
aRef = pDocShell;
- ScDocument* pDoc = pDocShell->GetDocument();
- if( pDoc )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScExtDocOptions* pExtDocOpt = rDoc.GetExtDocOptions();
+ if( !pExtDocOpt )
{
- ScExtDocOptions* pExtDocOpt = pDoc->GetExtDocOptions();
- if( !pExtDocOpt )
- {
- pExtDocOpt = new ScExtDocOptions;
- pDoc->SetExtDocOptions( pExtDocOpt );
- }
- pExtDocOpt->GetDocSettings().mnLinkCnt = nRekCnt;
+ pExtDocOpt = new ScExtDocOptions;
+ rDoc.SetExtDocOptions( pExtDocOpt );
}
+ pExtDocOpt->GetDocSettings().mnLinkCnt = nRekCnt;
pDocShell->DoLoad( pMedium );
@@ -577,7 +574,7 @@ void ScDocumentLoader::ReleaseDocRef()
ScDocument* ScDocumentLoader::GetDocument()
{
- return pDocShell ? pDocShell->GetDocument() : 0;
+ return pDocShell ? &pDocShell->GetDocument() : 0;
}
bool ScDocumentLoader::IsError() const
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index 10644e41548e..62417f593359 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -537,7 +537,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
}
// ChartListenerCollectionNeedsUpdate is needed for Navigator update
- pDocSh->GetDocument()->SetChartListenerCollectionNeedsUpdate( true );
+ pDocSh->GetDocument().SetChartListenerCollectionNeedsUpdate( true );
pDocSh->SetDrawModified();
}
}
@@ -574,7 +574,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
pSelected->SetDescription(aDescription);
// ChartListenerCollectionNeedsUpdate is needed for Navigator update
- pDocSh->GetDocument()->SetChartListenerCollectionNeedsUpdate( true );
+ pDocSh->GetDocument().SetChartListenerCollectionNeedsUpdate( true );
pDocSh->SetDrawModified();
}
}
diff --git a/sc/source/ui/drawfunc/fuconstr.cxx b/sc/source/ui/drawfunc/fuconstr.cxx
index bcb26657dd24..2aff287c54b2 100644
--- a/sc/source/ui/drawfunc/fuconstr.cxx
+++ b/sc/source/ui/drawfunc/fuconstr.cxx
@@ -71,9 +71,9 @@ sal_uInt8 FuConstruct::Command(const CommandEvent& rCEvt)
Point FuConstruct::CurrentGridSyncOffsetAndPos( Point& rInOutPos )
{
Point aRetGridOff;
- ScViewData* pViewData = pViewShell->GetViewData();
- ScDocument* pDoc = pViewData ? pViewData->GetDocument() : NULL;
- if ( pViewData && pDoc )
+ ScViewData& rViewData = pViewShell->GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
+ if ( pDoc )
{
// rInOutPos mightn't be where you think it is if there is zoom
// involved. Lets calculate where aPos would be at 100% zoom
@@ -86,10 +86,10 @@ Point FuConstruct::CurrentGridSyncOffsetAndPos( Point& rInOutPos )
Point aOldPos( pDoc->GetColOffset( aOldStt.Col(), aOldStt.Tab() ), pDoc->GetRowOffset( aOldStt.Row(), aOldStt.Tab() ) );
aOldPos.X() = sc::TwipsToHMM( aOldPos.X() );
aOldPos.Y() = sc::TwipsToHMM( aOldPos.Y() );
- ScSplitPos eWhich = pViewData->GetActivePart();
- ScGridWindow* pGridWin = (ScGridWindow*)pViewData->GetActiveWin();
+ ScSplitPos eWhich = rViewData.GetActivePart();
+ ScGridWindow* pGridWin = (ScGridWindow*)rViewData.GetActiveWin();
// and equiv screen pos
- Point aScreenPos = pViewShell->GetViewData()->GetScrPos( aOldStt.Col(), aOldStt.Row(), eWhich, true );
+ Point aScreenPos = pViewShell->GetViewData().GetScrPos( aOldStt.Col(), aOldStt.Row(), eWhich, true );
MapMode aDrawMode = pGridWin->GetDrawMapMode();
Point aCurPosHmm = pGridWin->PixelToLogic(aScreenPos, aDrawMode );
Point aOff = ( rInOutPos - aCurPosHmm );
@@ -237,11 +237,11 @@ bool FuConstruct::MouseButtonUp(const MouseEvent& rMEvt)
bool bVertical = ( pOPO && pOPO->IsVertical() );
sal_uInt16 nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT;
- pViewShell->GetViewData()->GetDispatcher().
+ pViewShell->GetViewData().GetDispatcher().
Execute(nTextSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
// jetzt den erzeugten FuText holen und in den EditModus setzen
- FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
+ FuPoor* pPoor = pViewShell->GetViewData().GetView()->GetDrawFuncPtr();
if ( pPoor && pPoor->GetSlotID() == nTextSlotId ) // hat keine RTTI
{
FuText* pText = (FuText*)pPoor;
@@ -288,7 +288,7 @@ bool FuConstruct::SimpleMouseButtonUp(const MouseEvent& rMEvt)
{
pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
- SfxDispatcher& rDisp = pViewShell->GetViewData()->GetDispatcher();
+ SfxDispatcher& rDisp = pViewShell->GetViewData().GetDispatcher();
if ( pView->AreObjectsMarked() )
rDisp.Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
else
@@ -323,7 +323,7 @@ bool FuConstruct::KeyInput(const KeyEvent& rKEvt)
}
else // Zeichenmodus beenden
{
- pViewShell->GetViewData()->GetDispatcher().
+ pViewShell->GetViewData().GetDispatcher().
Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
break;
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index ddeb4a691aa3..59a9a5e1ab6b 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -107,8 +107,8 @@ void FuDraw::ResetModifiers()
if (!pView)
return;
- ScViewData* pViewData = pViewShell->GetViewData();
- const ScViewOptions& rOpt = pViewData->GetOptions();
+ ScViewData& rViewData = pViewShell->GetViewData();
+ const ScViewOptions& rOpt = rViewData.GetOptions();
const ScGridOptions& rGrid = rOpt.GetGridOptions();
bool bGridOpt = rGrid.GetUseGridSnap();
@@ -196,15 +196,15 @@ static bool lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell* pViewShell, const
sal_uInt16 nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT;
// don't switch shells if text shell is already active
- FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
+ FuPoor* pPoor = pViewShell->GetViewData().GetView()->GetDrawFuncPtr();
if ( !pPoor || pPoor->GetSlotID() != nTextSlotId )
{
- pViewShell->GetViewData()->GetDispatcher().
+ pViewShell->GetViewData().GetDispatcher().
Execute(nTextSlotId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
}
// get the resulting FuText and set in edit mode
- pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
+ pPoor = pViewShell->GetViewData().GetView()->GetDrawFuncPtr();
if ( pPoor && pPoor->GetSlotID() == nTextSlotId ) // no RTTI
{
FuText* pText = (FuText*)pPoor;
@@ -219,7 +219,7 @@ static bool lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell* pViewShell, const
bool FuDraw::KeyInput(const KeyEvent& rKEvt)
{
bool bReturn = false;
- ScViewData& rViewData = *pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
switch ( rKEvt.GetKeyCode().GetCode() )
{
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 096219e379e3..1c44ded93288 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -147,8 +147,8 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
SdrPage* pPage = pPV->GetPage();
Point aInsertPos = pViewSh->GetInsertPos();
- ScViewData* pData = pViewSh->GetViewData();
- if ( pData->GetDocument()->IsNegativePage( pData->GetTabNo() ) )
+ ScViewData& rData = pViewSh->GetViewData();
+ if ( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) )
aInsertPos.X() -= aLogicSize.Width(); // move position to left edge
ScLimitSizeOnDrawPage( aLogicSize, aInsertPos, pPage->GetSize() );
@@ -182,7 +182,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
{
SdrPageView* pPV = pView->GetSdrPageView();
SdrPage* pPage = pPV->GetPage();
- ScViewData* pData = pViewSh->GetViewData();
+ ScViewData& rData = pViewSh->GetViewData();
Point aInsertPos( pViewSh->GetInsertPos() );
Size aSize;
@@ -198,7 +198,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
ScLimitSizeOnDrawPage( aSize, aInsertPos, pPage->GetSize() );
- if( pData->GetDocument()->IsNegativePage( pData->GetTabNo() ) )
+ if( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) )
aInsertPos.X() -= aSize.Width();
OUString realURL;
@@ -209,14 +209,14 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
else
{
uno::Reference<frame::XModel> const xModel(
- pData->GetDocument()->GetDocumentShell()->GetModel());
+ rData.GetDocument()->GetDocumentShell()->GetModel());
bool const bRet = ::avmedia::EmbedMedia(xModel, rMediaURL, realURL);
if (!bRet) { return; }
}
SdrMediaObj* pObj = new SdrMediaObj( Rectangle( aInsertPos, aSize ) );
- pObj->SetModel(pData->GetDocument()->GetDrawLayer()); // set before setURL
+ pObj->SetModel(rData.GetDocument()->GetDrawLayer()); // set before setURL
pObj->setURL( realURL, ""/*TODO?*/ );
pView->InsertObjectAtView( pObj, *pPV, bApi ? SDRINSERT_DONTMARK : 0 );
}
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index f92797c23ab8..f91725ff81f1 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -87,7 +87,7 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
const OUString& rRangeParam )
{
ScDocShell* pDocShell = pViewData->GetDocShell();
- ScDocument* pScDoc = pDocShell->GetDocument();
+ ScDocument& rScDoc = pDocShell->GetDocument();
OUString aRangeString( rRangeParam );
if ( aRangeString.isEmpty() )
@@ -113,7 +113,7 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
pDoc->LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 );
ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- aRangeString = aRange.Format(SCR_ABS_3D, pScDoc);
+ aRangeString = aRange.Format(SCR_ABS_3D, &rScDoc);
}
}
}
@@ -129,7 +129,7 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
OSL_ASSERT( xReceiver.is());
if( xReceiver.is() )
{
- uno::Reference< chart2::data::XDataProvider > xDataProvider = new ScChart2DataProvider( pScDoc );
+ uno::Reference< chart2::data::XDataProvider > xDataProvider = new ScChart2DataProvider( &rScDoc );
xReceiver->attachDataProvider( xDataProvider );
uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pDocShell->GetModel(), uno::UNO_QUERY );
@@ -142,17 +142,17 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
// use ScChartPositioner to auto-detect column/row headers (like ScChartArray in old version)
ScRangeListRef aRangeListRef( new ScRangeList );
- aRangeListRef->Parse( aRangeString, pScDoc, SCA_VALID, pScDoc->GetAddressConvention() );
+ aRangeListRef->Parse( aRangeString, &rScDoc, SCA_VALID, rScDoc.GetAddressConvention() );
if ( !aRangeListRef->empty() )
{
- pScDoc->LimitChartIfAll( aRangeListRef ); // limit whole columns/rows to used area
+ rScDoc.LimitChartIfAll( aRangeListRef ); // limit whole columns/rows to used area
// update string from modified ranges. The ranges must be in the current formula syntax.
OUString aTmpStr;
- aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );
+ aRangeListRef->Format( aTmpStr, SCR_ABS_3D, &rScDoc, rScDoc.GetAddressConvention() );
aRangeString = aTmpStr;
- ScChartPositioner aChartPositioner( pScDoc, aRangeListRef );
+ ScChartPositioner aChartPositioner( &rScDoc, aRangeListRef );
const ScChartPositionMap* pPositionMap( aChartPositioner.GetPositionMap() );
if( pPositionMap )
{
@@ -356,12 +356,12 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie
// Chart initialisieren ?
if ( SvtModuleOptions().IsChart() && SotExchange::IsChart( SvGlobalName( xObj->getClassID() ) ) )
- lcl_ChartInit( xObj, pViewSh->GetViewData(), OUString() );
+ lcl_ChartInit( xObj, &pViewSh->GetViewData(), OUString() );
- ScViewData* pData = pViewSh->GetViewData();
+ ScViewData& rData = pViewSh->GetViewData();
Point aPnt = pViewSh->GetInsertPos();
- if ( pData->GetDocument()->IsNegativePage( pData->GetTabNo() ) )
+ if ( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) )
aPnt.X() -= aSize.Width(); // move position to left edge
Rectangle aRect (aPnt, aSize);
SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect);
@@ -443,21 +443,21 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
// get range
OUString aRangeString;
ScRange aPositionRange; // cell range for chart positioning
- ScMarkData aMark = pViewSh->GetViewData()->GetMarkData();
+ ScMarkData aMark = pViewSh->GetViewData().GetMarkData();
if( pReqArgs )
{
const SfxPoolItem* pItem;
if( pReqArgs->HasItem( FN_PARAM_5, &pItem ) )
aRangeString = OUString( ((const SfxStringItem*)pItem)->GetValue());
- aPositionRange = pViewSh->GetViewData()->GetCurPos();
+ aPositionRange = pViewSh->GetViewData().GetCurPos();
}
else
{
bool bAutomaticMark = false;
if ( !aMark.IsMarked() && !aMark.IsMultiMarked() )
{
- pViewSh->GetViewData()->GetView()->MarkDataArea( true );
+ pViewSh->GetViewData().GetView()->MarkDataArea( true );
bAutomaticMark = true;
}
@@ -467,7 +467,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
ScRangeList aRanges;
aMultiMark.FillRangeListWithMarks( &aRanges, false );
OUString aStr;
- ScDocument* pDocument = pViewSh->GetViewData()->GetDocument();
+ ScDocument* pDocument = pViewSh->GetViewData().GetDocument();
aRanges.Format( aStr, SCR_ABS_3D, pDocument, pDocument->GetAddressConvention() );
aRangeString = aStr;
@@ -482,7 +482,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
}
if(bAutomaticMark)
- pViewSh->GetViewData()->GetView()->Unmark();
+ pViewSh->GetViewData().GetView()->Unmark();
}
@@ -540,12 +540,12 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
xObj->setVisualAreaSize( nAspect, aSz );
}
- ScViewData* pData = pViewSh->GetViewData();
- ScDocShell* pScDocSh = pData->GetDocShell();
- ScDocument* pScDoc = pScDocSh->GetDocument();
- bool bUndo (pScDoc->IsUndoEnabled());
+ ScViewData& rData = pViewSh->GetViewData();
+ ScDocShell* pScDocSh = rData.GetDocShell();
+ ScDocument& rScDoc = pScDocSh->GetDocument();
+ bool bUndo (rScDoc.IsUndoEnabled());
- Window* pParentWindow = pData->GetActiveWin();
+ Window* pParentWindow = rData.GetActiveWin();
OpenGLWindow* pChildWindow = new OpenGLWindow(pParentWindow);
Size aWindowSize = pChildWindow->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) );
pChildWindow->SetSizePixel(aWindowSize);
@@ -576,9 +576,9 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
// -> wenn gesetzt, neue Tabelle, sonst aktuelle Tabelle
if ( ((const SfxBoolItem*)pItem)->GetValue() )
- nToTable = static_cast<sal_uInt16>(pScDoc->GetTableCount());
+ nToTable = static_cast<sal_uInt16>(rScDoc.GetTableCount());
else
- nToTable = static_cast<sal_uInt16>(pData->GetTabNo());
+ nToTable = static_cast<sal_uInt16>(rData.GetTabNo());
}
}
else
@@ -589,15 +589,15 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
}
// auf neue Tabelle ausgeben?
- if ( nToTable == pScDoc->GetTableCount() )
+ if ( nToTable == rScDoc.GetTableCount() )
{
// dann los...
OUString aTabName;
- SCTAB nNewTab = pScDoc->GetTableCount();
+ SCTAB nNewTab = rScDoc.GetTableCount();
- pScDoc->CreateValidTabName( aTabName );
+ rScDoc.CreateValidTabName( aTabName );
- if ( pScDoc->InsertTab( nNewTab, aTabName ) )
+ if ( rScDoc.InsertTab( nNewTab, aTabName ) )
{
bool bAppend = true;
@@ -617,13 +617,13 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
OSL_FAIL( "Could not create new table :-/" );
}
}
- else if ( nToTable != pData->GetTabNo() )
+ else if ( nToTable != rData.GetTabNo() )
{
pViewSh->SetTabNo( nToTable, true );
}
}
- lcl_ChartInit( xObj, pData, aRangeString ); // set source range, auto-detect column/row headers
+ lcl_ChartInit( xObj, &rData, aRangeString ); // set source range, auto-detect column/row headers
// Objekt-Position
@@ -760,7 +760,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
// reset marked cell area
- pViewSh->GetViewData()->GetViewShell()->SetMarkData(aMark);
+ pViewSh->GetViewData().GetViewShell()->SetMarkData(aMark);
}
else
{
@@ -812,7 +812,7 @@ FuInsertChartFromFile::FuInsertChartFromFile( ScTabViewShell* pViewSh, Window* p
awt::Size aSz = xObj->getVisualAreaSize( nAspect );
Size aSize( aSz.Width, aSz.Height );
- ScRange aPositionRange = pViewSh->GetViewData()->GetCurPos();
+ ScRange aPositionRange = pViewSh->GetViewData().GetCurPos();
Point aStart = pViewSh->GetChartInsertPos( aSize, aPositionRange );
Rectangle aRect (aStart, aSize);
SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index cade7aec847a..07ce80ef9831 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -97,18 +97,18 @@ void FuPoor::ForceScroll(const Point& aPixPos)
if ( aPixPos.Y() <= 0 ) dy = -1;
if ( aPixPos.Y() >= aSize.Height() ) dy = 1;
- ScViewData* pViewData = pViewShell->GetViewData();
- if ( pViewData->GetDocument()->IsNegativePage( pViewData->GetTabNo() ) )
+ ScViewData& rViewData = pViewShell->GetViewData();
+ if ( rViewData.GetDocument()->IsNegativePage( rViewData.GetTabNo() ) )
dx = -dx;
- ScSplitPos eWhich = pViewData->GetActivePart();
- if ( dx > 0 && pViewData->GetHSplitMode() == SC_SPLIT_FIX && WhichH(eWhich) == SC_SPLIT_LEFT )
+ ScSplitPos eWhich = rViewData.GetActivePart();
+ if ( dx > 0 && rViewData.GetHSplitMode() == SC_SPLIT_FIX && WhichH(eWhich) == SC_SPLIT_LEFT )
{
pViewShell->ActivatePart( ( eWhich == SC_SPLIT_TOPLEFT ) ?
SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT );
dx = 0;
}
- if ( dy > 0 && pViewData->GetVSplitMode() == SC_SPLIT_FIX && WhichV(eWhich) == SC_SPLIT_TOP )
+ if ( dy > 0 && rViewData.GetVSplitMode() == SC_SPLIT_FIX && WhichV(eWhich) == SC_SPLIT_TOP )
{
pViewShell->ActivatePart( ( eWhich == SC_SPLIT_TOPLEFT ) ?
SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT );
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 402cb4ac1331..904ef4e301fb 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -216,7 +216,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
new uno::Sequence< uno::Any >(0);
pObjSh->CallXScript( pInfo->GetMacro(),
*pInArgs, aRet, aOutArgsIndex, aOutArgs, true, &aCaller );
- pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
+ pViewShell->FakeButtonUp( pViewShell->GetViewData().GetActivePart() );
return true; // kein CaptureMouse etc.
}
}
@@ -250,7 +250,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
if ( !sURL.isEmpty() )
{
ScGlobal::OpenURL( sURL, sTarget );
- pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
+ pViewShell->FakeButtonUp( pViewShell->GetViewData().GetActivePart() );
return true; // kein CaptureMouse etc.
}
@@ -388,7 +388,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
bool bCopy = false;
- ScViewData* pViewData = ( pViewShell ? pViewShell->GetViewData() : NULL );
+ ScViewData* pViewData = ( pViewShell ? &pViewShell->GetViewData() : NULL );
ScDocument* pDocument = ( pViewData ? pViewData->GetDocument() : NULL );
SdrPageView* pPageView = ( pView ? pView->GetSdrPageView() : NULL );
SdrPage* pPage = ( pPageView ? pPageView->GetPage() : NULL );
@@ -448,7 +448,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
{
SdrMark* pMark = rMarkList.GetMark(0);
pObj = pMark->GetMarkedSdrObj();
- FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
+ FuPoor* pPoor = pViewShell->GetViewData().GetView()->GetDrawFuncPtr();
FuText* pText = static_cast<FuText*>(pPoor);
pText->StopDragMode(pObj );
}
@@ -545,11 +545,11 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
bool bVertical = ( pOPO && pOPO->IsVertical() );
sal_uInt16 nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT;
- pViewShell->GetViewData()->GetDispatcher().
+ pViewShell->GetViewData().GetDispatcher().
Execute(nTextSlotId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
// jetzt den erzeugten FuText holen und in den EditModus setzen
- FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
+ FuPoor* pPoor = pViewShell->GetViewData().GetView()->GetDrawFuncPtr();
if ( pPoor && pPoor->GetSlotID() == nTextSlotId ) // hat keine RTTI
{
FuText* pText = (FuText*)pPoor;
@@ -581,7 +581,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
// darum hier die harte IsLeft-Abfrage
if ( !bReturn && rMEvt.IsLeft() )
if (pViewShell->IsDrawSelMode())
- pViewShell->GetViewData()->GetDispatcher().
+ pViewShell->GetViewData().GetDispatcher().
Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
if ( bCopy && pViewData && pDocument && pPage )
diff --git a/sc/source/ui/drawfunc/fusel2.cxx b/sc/source/ui/drawfunc/fusel2.cxx
index 6b3a5157804e..75efe90b36ab 100644
--- a/sc/source/ui/drawfunc/fusel2.cxx
+++ b/sc/source/ui/drawfunc/fusel2.cxx
@@ -62,20 +62,20 @@ bool FuSelection::TestDetective( SdrPageView* pPV, const Point& rPos )
Size(pView->GetHitTolerancePixel(),0)).Width();
if (SdrObjectPrimitiveHit(*pObject, rPos, nHitLog, *pPV, 0, false))
{
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
ScSplitPos ePos = pViewShell->FindWindow( pWindow );
Point aLineStart = pObject->GetPoint(0);
Point aLineEnd = pObject->GetPoint(1);
Point aPixel = pWindow->LogicToPixel( aLineStart );
SCsCOL nStartCol;
SCsROW nStartRow;
- pViewData->GetPosFromPixel( aPixel.X(), aPixel.Y(), ePos, nStartCol, nStartRow );
+ rViewData.GetPosFromPixel( aPixel.X(), aPixel.Y(), ePos, nStartCol, nStartRow );
aPixel = pWindow->LogicToPixel( aLineEnd );
SCsCOL nEndCol;
SCsROW nEndRow;
- pViewData->GetPosFromPixel( aPixel.X(), aPixel.Y(), ePos, nEndCol, nEndRow );
- SCsCOL nCurX = (SCsCOL) pViewData->GetCurX();
- SCsROW nCurY = (SCsROW) pViewData->GetCurY();
+ rViewData.GetPosFromPixel( aPixel.X(), aPixel.Y(), ePos, nEndCol, nEndRow );
+ SCsCOL nCurX = (SCsCOL) rViewData.GetCurX();
+ SCsROW nCurY = (SCsROW) rViewData.GetCurY();
bool bStart = ( Diff( rPos,aLineStart ) > Diff( rPos,aLineEnd ) );
if ( nCurX == nStartCol && nCurY == nStartRow )
bStart = false;
@@ -124,7 +124,7 @@ bool FuSelection::IsNoteCaptionClicked( const Point& rPos ) const
SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
if( pPageView )
{
- const ScViewData& rViewData = *pViewShell->GetViewData();
+ const ScViewData& rViewData = pViewShell->GetViewData();
ScDocument& rDoc = *rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
ScDocShell* pDocSh = rViewData.GetDocShell();
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index c0822fa1b023..8afd5210c215 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -309,7 +309,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
// Notizen editieren -> keine neuen Textobjekte erzeugen,
// stattdessen Textmodus verlassen
- pViewShell->GetViewData()->GetDispatcher().
+ pViewShell->GetViewData().GetDispatcher().
Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
else
@@ -332,7 +332,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
else if (pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_BEFOREMARK))
{
pView->UnmarkAllObj();
- ScViewData& rViewData = *pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
pView->MarkObj(pObj,pPV,false,false);
@@ -357,7 +357,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
if (!bStraightEnter)
{
pView->UnmarkAll();
- ScViewData& rViewData = *pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -442,7 +442,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
{
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObj = pMark->GetMarkedSdrObj();
- FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
+ FuPoor* pPoor = pViewShell->GetViewData().GetView()->GetDrawFuncPtr();
FuText* pText = static_cast<FuText*>(pPoor);
pText->StopDragMode(pObj );
}
@@ -512,7 +512,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
{
pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
- SfxDispatcher& rDisp = pViewShell->GetViewData()->GetDispatcher();
+ SfxDispatcher& rDisp = pViewShell->GetViewData().GetDispatcher();
if ( pView->AreObjectsMarked() )
rDisp.Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
else
@@ -532,7 +532,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
{
pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
- SfxDispatcher& rDisp = pViewShell->GetViewData()->GetDispatcher();
+ SfxDispatcher& rDisp = pViewShell->GetViewData().GetDispatcher();
if ( pView->AreObjectsMarked() )
rDisp.Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
else
diff --git a/sc/source/ui/drawfunc/futext2.cxx b/sc/source/ui/drawfunc/futext2.cxx
index 86e5c515f8e6..4e0e9368e43e 100644
--- a/sc/source/ui/drawfunc/futext2.cxx
+++ b/sc/source/ui/drawfunc/futext2.cxx
@@ -26,10 +26,10 @@
SdrOutliner* FuText::MakeOutliner()
{
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
SdrOutliner* pOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, pDrDoc);
- pViewData->UpdateOutlinerFlags(*pOutl);
+ rViewData.UpdateOutlinerFlags(*pOutl);
// Die EditEngine benutzt beim RTF Export (Clipboard / Drag&Drop)
// den MapMode des RefDevices, um die Fontgroesse zu setzen
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index 29112e429ff4..884d89fbf965 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -60,7 +60,7 @@ void FuText::StopEditMode(bool /*bTextDirection*/)
if ( pObject->GetLayer() == SC_LAYER_INTERN )
pView->LockInternalLayer();
- ScViewData& rViewData = *pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
ScDocument& rDoc = *rViewData.GetDocument();
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
OSL_ENSURE( pDrawLayer && (pDrawLayer == pDrDoc), "FuText::StopEditMode - missing or different drawing layers" );
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 5ff5a5471736..3dbe12584259 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -449,7 +449,7 @@ bool ScFormulaDlg::IsDocAllowed(SfxObjectShell* pDocSh) const
{
// not allowed: different from this doc, and no name
// pDocSh is always a ScDocShell
- if ( pDocSh && ((ScDocShell*)pDocSh)->GetDocument() != pDoc && !pDocSh->HasName() )
+ if ( pDocSh && &((ScDocShell*)pDocSh)->GetDocument() != pDoc && !pDocSh->HasName() )
return false;
return true; // everything else is allowed
@@ -579,15 +579,15 @@ void ScFormulaDlg::switchBack()
ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
if ( pScViewShell )
{
- ScViewData* pVD=pScViewShell->GetViewData();
+ ScViewData& rVD=pScViewShell->GetViewData();
SCTAB nExecTab = aCursorPos.Tab();
- if ( nExecTab != pVD->GetTabNo() )
+ if ( nExecTab != rVD.GetTabNo() )
pScViewShell->SetTabNo( nExecTab );
SCROW nRow=aCursorPos.Row();
SCCOL nCol=aCursorPos.Col();
- if(pVD->GetCurX()!=nCol || pVD->GetCurY()!=nRow)
+ if(rVD.GetCurX()!=nCol || rVD.GetCurY()!=nRow)
pScViewShell->SetCursor(nCol,nRow);
}
}
diff --git a/sc/source/ui/inc/consdlg.hxx b/sc/source/ui/inc/consdlg.hxx
index 30ce8f61a292..95bae7849df9 100644
--- a/sc/source/ui/inc/consdlg.hxx
+++ b/sc/source/ui/inc/consdlg.hxx
@@ -77,7 +77,7 @@ private:
OUString aStrUndefined;
ScConsolidateParam theConsData;
- ScViewData* pViewData;
+ ScViewData& rViewData;
ScDocument* pDoc;
ScRangeUtil* pRangeUtil;
ScAreaData* pAreaData;
diff --git a/sc/source/ui/inc/datastream.hxx b/sc/source/ui/inc/datastream.hxx
index d7320ecefe04..6450bb579d2b 100644
--- a/sc/source/ui/inc/datastream.hxx
+++ b/sc/source/ui/inc/datastream.hxx
@@ -105,7 +105,6 @@ private:
private:
ScDocShell* mpDocShell;
- ScDocument* mpDoc;
DocumentStreamAccess maDocAccess;
OUString msURL;
sal_Int32 mnLimit;
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 16d84bb09852..2f8c1ee40870 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -239,7 +239,7 @@ public:
void GetDocStat( ScDocStat& rDocStat );
- ScDocument* GetDocument() { return &aDocument; }
+ ScDocument& GetDocument() { return aDocument; }
ScDocFunc& GetDocFunc() { return *pDocFunc; }
void SetDocFunc( ScDocFunc *pDF ) { pDocFunc = pDF; }
diff --git a/sc/source/ui/inc/optsolver.hxx b/sc/source/ui/inc/optsolver.hxx
index db7e199cda6a..769bb1998292 100644
--- a/sc/source/ui/inc/optsolver.hxx
+++ b/sc/source/ui/inc/optsolver.hxx
@@ -159,7 +159,7 @@ private:
OUString maConditionError;
ScDocShell* mpDocShell;
- ScDocument* mpDoc;
+ ScDocument& mrDoc;
const SCTAB mnCurTab;
formula::RefEdit* mpEdActive;
bool mbDlgLostFocus;
diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx
index 7c6d7a8f7f44..a28c2f18f4a2 100644
--- a/sc/source/ui/inc/prevwsh.hxx
+++ b/sc/source/ui/inc/prevwsh.hxx
@@ -120,7 +120,7 @@ public:
bool HasAccessibilityObjects();
const ScPreviewLocationData& GetLocationData();
- ScDocument* GetDocument();
+ ScDocument& GetDocument();
SC_DLLPUBLIC ScPreview* GetPreview() { return pPreview; }
};
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 698087d38d4d..b44db7012d11 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -287,10 +287,10 @@ public:
void DrawMarkRect( const Rectangle& rRect );
- ScViewData* GetViewData() { return &aViewData; }
- const ScViewData* GetViewData() const { return &aViewData; }
+ ScViewData& GetViewData() { return aViewData; }
+ const ScViewData& GetViewData() const { return aViewData; }
- ScViewFunctionSet* GetFunctionSet() { return &aFunctionSet; }
+ ScViewFunctionSet& GetFunctionSet() { return aFunctionSet; }
ScViewSelectionEngine* GetSelEngine() { return pSelEngine; }
bool SelMouseButtonDown( const MouseEvent& rMEvt );
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index e11cd1b247fb..7e9a2f40ba29 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -290,8 +290,8 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit, formula::R
pViewShell->ActiveGrabFocus();
if( pRefEdit )
{
- const ScViewData* pViewData = pViewShell->GetViewData();
- ScDocument* pDoc = pViewData->GetDocument();
+ const ScViewData& rViewData = pViewShell->GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
ScRangeList aRangeList;
if( ParseWithNames( aRangeList, pRefEdit->GetText(), pDoc ) )
{
diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx
index a4d8207e24f0..433d1946a306 100644
--- a/sc/source/ui/miscdlgs/datafdlg.cxx
+++ b/sc/source/ui/miscdlgs/datafdlg.cxx
@@ -39,13 +39,13 @@ ScDataFormDlg::ScDataFormDlg(Window* pParent, ScTabViewShell* pTabViewShellOri)
//read header form current document, and add new controls
OSL_ENSURE( pTabViewShell, "pTabViewShell is NULL! :-/" );
- ScViewData* pViewData = pTabViewShell->GetViewData();
+ ScViewData& rViewData = pTabViewShell->GetViewData();
- pDoc = pViewData->GetDocument();
+ pDoc = rViewData.GetDocument();
if (pDoc)
{
ScRange aRange;
- pViewData->GetSimpleArea( aRange );
+ rViewData.GetSimpleArea( aRange );
ScAddress aStart = aRange.aStart;
ScAddress aEnd = aRange.aEnd;
@@ -54,7 +54,7 @@ ScDataFormDlg::ScDataFormDlg(Window* pParent, ScTabViewShell* pTabViewShellOri)
nStartRow = aStart.Row();
nEndRow = aEnd.Row();
- nTab = pViewData->GetTabNo();
+ nTab = rViewData.GetTabNo();
//if there is no selection
if ((nStartCol == nEndCol) && (nStartRow == nEndRow))
bNoSelection = true;
@@ -241,8 +241,8 @@ IMPL_LINK( ScDataFormDlg, Impl_DataModifyHdl, Edit*, pEdit)
IMPL_LINK_NOARG(ScDataFormDlg, Impl_NewHdl)
{
- ScViewData* pViewData = pTabViewShell->GetViewData();
- ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScViewData& rViewData = pTabViewShell->GetViewData();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
if ( pDoc )
{
bool bHasData = false;
@@ -310,8 +310,8 @@ IMPL_LINK_NOARG(ScDataFormDlg, Impl_RestoreHdl)
IMPL_LINK_NOARG(ScDataFormDlg, Impl_DeleteHdl)
{
- ScViewData* pViewData = pTabViewShell->GetViewData();
- ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScViewData& rViewData = pTabViewShell->GetViewData();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
if (pDoc)
{
ScRange aRange(nStartCol, nCurrentRow, nTab, nEndCol, nCurrentRow, nTab);
diff --git a/sc/source/ui/miscdlgs/datastreamdlg.cxx b/sc/source/ui/miscdlgs/datastreamdlg.cxx
index 2b6f023ff9c7..5dc52bde35a8 100644
--- a/sc/source/ui/miscdlgs/datastreamdlg.cxx
+++ b/sc/source/ui/miscdlgs/datastreamdlg.cxx
@@ -98,9 +98,9 @@ void DataStreamDlg::UpdateEnable()
ScRange DataStreamDlg::GetStartRange()
{
OUString aStr = m_pEdRange->GetText();
- ScDocument* pDoc = mpDocShell->GetDocument();
+ ScDocument& rDoc = mpDocShell->GetDocument();
ScRange aRange;
- sal_uInt16 nRes = aRange.Parse(aStr, pDoc, pDoc->GetAddressConvention());
+ sal_uInt16 nRes = aRange.Parse(aStr, &rDoc, rDoc.GetAddressConvention());
if ((nRes & SCA_VALID) != SCA_VALID || !aRange.IsValid())
{
// Invalid range.
@@ -118,12 +118,12 @@ ScRange DataStreamDlg::GetStartRange()
void DataStreamDlg::Init( const DataStream& rStrm )
{
m_pCbUrl->SetText(rStrm.GetURL());
- ScDocument* pDoc = mpDocShell->GetDocument();
+ ScDocument& rDoc = mpDocShell->GetDocument();
ScRange aRange = rStrm.GetRange();
ScRange aTopRange = aRange;
aTopRange.aEnd.SetRow(aTopRange.aStart.Row());
- OUString aStr = aTopRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention());
+ OUString aStr = aTopRange.Format(SCR_ABS_3D, &rDoc, rDoc.GetAddressConvention());
m_pEdRange->SetText(aStr);
SCROW nRows = aRange.aEnd.Row() - aRange.aStart.Row() + 1;
diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx
index 51d292d6ba26..22e2c47d82b8 100644
--- a/sc/source/ui/miscdlgs/instbdlg.cxx
+++ b/sc/source/ui/miscdlgs/instbdlg.cxx
@@ -336,7 +336,7 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg
if ( !pDocShTables->GetError() ) // nur Errors
{
- FillTables_Impl( pDocShTables->GetDocument() );
+ FillTables_Impl( &pDocShTables->GetDocument() );
m_pFtPath->SetText( pDocShTables->GetTitle( SFX_TITLE_FULLNAME ) );
}
else
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx
index 2fb4a91ab9f4..8d413077173d 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -266,7 +266,7 @@ void ScLinkedAreaDlg::UpdateSourceRanges()
m_pLbRanges->Clear();
if ( pSourceShell )
{
- ScAreaNameIterator aIter( pSourceShell->GetDocument() );
+ ScAreaNameIterator aIter( &pSourceShell->GetDocument() );
ScRange aDummy;
OUString aName;
while ( aIter.Next( aName, aDummy ) )
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 9d57e0574323..46311bdb201b 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -243,7 +243,7 @@ void ScMoveTableDlg::InitDocListBox()
}
pLbDoc->InsertEntry( aEntryName, i );
- pLbDoc->SetEntryData( i, (void*)pScSh->GetDocument() );
+ pLbDoc->SetEntryData( i, (void*)&pScSh->GetDocument() );
i++;
}
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index a72a0fe6bf5b..7844e5ef49d1 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -155,7 +155,7 @@ ScOptSolverDlg::ScOptSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pP
, maConditionError(ScGlobal::GetRscString(STR_INVALIDCONDITION))
, mpDocShell(pDocSh)
- , mpDoc(pDocSh->GetDocument())
+ , mrDoc(pDocSh->GetDocument())
, mnCurTab(aCursorPos.Tab())
, mpEdActive(NULL)
, mbDlgLostFocus(false)
@@ -366,8 +366,8 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos)
{
m_pRbMax->Check();
OUString aCursorStr;
- if ( !mpDoc->GetRangeAtBlock( ScRange(rCursorPos), &aCursorStr ) )
- aCursorStr = rCursorPos.Format(SCA_ABS, NULL, mpDoc->GetAddressConvention());
+ if ( !mrDoc.GetRangeAtBlock( ScRange(rCursorPos), &aCursorStr ) )
+ aCursorStr = rCursorPos.Format(SCA_ABS, NULL, mrDoc.GetAddressConvention());
m_pEdObjectiveCell->SetRefString( aCursorStr );
if ( nImplCount > 0 )
maEngine = maImplNames[0]; // use first implementation
@@ -735,8 +735,8 @@ void ScOptSolverDlg::ShowError( bool bCondition, formula::RefEdit* pFocus )
bool ScOptSolverDlg::ParseRef( ScRange& rRange, const OUString& rInput, bool bAllowRange )
{
ScRangeUtil aRangeUtil;
- ScAddress::Details aDetails(mpDoc->GetAddressConvention(), 0, 0);
- sal_uInt16 nFlags = rRange.ParseAny( rInput, mpDoc, aDetails );
+ ScAddress::Details aDetails(mrDoc.GetAddressConvention(), 0, 0);
+ sal_uInt16 nFlags = rRange.ParseAny( rInput, &mrDoc, aDetails );
if ( nFlags & SCA_VALID )
{
if ( (nFlags & SCA_TAB_3D) == 0 )
@@ -745,7 +745,7 @@ bool ScOptSolverDlg::ParseRef( ScRange& rRange, const OUString& rInput, bool bAl
rRange.aEnd.SetTab( rRange.aStart.Tab() );
return ( bAllowRange || rRange.aStart == rRange.aEnd );
}
- else if ( aRangeUtil.MakeRangeFromName( rInput, mpDoc, mnCurTab, rRange, RUTL_NAMES, aDetails ) )
+ else if ( aRangeUtil.MakeRangeFromName( rInput, &mrDoc, mnCurTab, rRange, RUTL_NAMES, aDetails ) )
return ( bAllowRange || rRange.aStart == rRange.aEnd );
return false; // not recognized
@@ -800,7 +800,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
// "changing cells" can be several ranges
ScRangeList aVarRanges;
- if ( !ParseWithNames( aVarRanges, m_pEdVariableCells->GetText(), mpDoc ) )
+ if ( !ParseWithNames( aVarRanges, m_pEdVariableCells->GetText(), &mrDoc ) )
{
ShowError( false, m_pEdVariableCells );
return false;
@@ -863,7 +863,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
{
sal_uInt32 nFormat = 0; //! explicit language?
double fValue = 0.0;
- if ( mpDoc->GetFormatTable()->IsNumberFormat( aConstrIter->aRightStr, nFormat, fValue ) )
+ if ( mrDoc.GetFormatTable()->IsNumberFormat( aConstrIter->aRightStr, nFormat, fValue ) )
aConstraint.Right <<= fValue;
else if ( aConstraint.Operator != sheet::SolverConstraintOperator_INTEGER &&
aConstraint.Operator != sheet::SolverConstraintOperator_BINARY )
@@ -911,7 +911,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
{
sal_uInt32 nFormat = 0; //! explicit language?
double fValue = 0.0;
- if ( mpDoc->GetFormatTable()->IsNumberFormat( aValStr, nFormat, fValue ) )
+ if ( mrDoc.GetFormatTable()->IsNumberFormat( aValStr, nFormat, fValue ) )
aConstraint.Right <<= fValue;
else
{
@@ -933,7 +933,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
{
ScAddress aCellPos;
ScUnoConversion::FillScAddress( aCellPos, aVariables[nVarPos] );
- aOldValues[nVarPos] = mpDoc->GetValue( aCellPos );
+ aOldValues[nVarPos] = mrDoc.GetValue( aCellPos );
}
// create and initialize solver
@@ -993,7 +993,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
//! else error?
// take formatted result from document (result value from component is ignored)
- OUString aResultStr = mpDoc->GetString(
+ OUString aResultStr = mrDoc.GetString(
static_cast<SCCOL>(aObjective.Column), static_cast<SCROW>(aObjective.Row),
static_cast<SCTAB>(aObjective.Sheet));
diff --git a/sc/source/ui/miscdlgs/redcom.cxx b/sc/source/ui/miscdlgs/redcom.cxx
index 89e37f823d2d..2a69e4ba013a 100644
--- a/sc/source/ui/miscdlgs/redcom.cxx
+++ b/sc/source/ui/miscdlgs/redcom.cxx
@@ -58,8 +58,8 @@ ScChangeAction *ScRedComDialog::FindPrev(ScChangeAction *pAction)
{
if(pAction!=NULL && pDocShell !=NULL)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeViewSettings* pSettings = pDoc->GetChangeViewSettings();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeViewSettings* pSettings = rDoc.GetChangeViewSettings();
pAction=pAction->GetPrev();
@@ -67,7 +67,7 @@ ScChangeAction *ScRedComDialog::FindPrev(ScChangeAction *pAction)
{
if( pAction->GetState()==SC_CAS_VIRGIN &&
pAction->IsDialogRoot() &&
- ScViewUtil::IsActionShown(*pAction,*pSettings,*pDoc)) break;
+ ScViewUtil::IsActionShown(*pAction,*pSettings,rDoc)) break;
pAction=pAction->GetPrev();
}
@@ -79,8 +79,8 @@ ScChangeAction *ScRedComDialog::FindNext(ScChangeAction *pAction)
{
if(pAction!=NULL && pDocShell !=NULL)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeViewSettings* pSettings = pDoc->GetChangeViewSettings();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeViewSettings* pSettings = rDoc.GetChangeViewSettings();
pAction=pAction->GetNext();
@@ -88,7 +88,7 @@ ScChangeAction *ScRedComDialog::FindNext(ScChangeAction *pAction)
{
if( pAction->GetState()==SC_CAS_VIRGIN &&
pAction->IsDialogRoot() &&
- ScViewUtil::IsActionShown(*pAction,*pSettings,*pDoc)) break;
+ ScViewUtil::IsActionShown(*pAction,*pSettings,rDoc)) break;
pAction=pAction->GetNext();
}
@@ -102,7 +102,7 @@ void ScRedComDialog::ReInit(ScChangeAction *pAction)
if(pChangeAction!=NULL && pDocShell !=NULL)
{
OUString aTitle;
- pChangeAction->GetDescription( aTitle, pDocShell->GetDocument());
+ pChangeAction->GetDescription( aTitle, &pDocShell->GetDocument());
pDlg->SetText(aTitle);
aComment=pChangeAction->GetComment();
@@ -142,7 +142,7 @@ void ScRedComDialog::SelectCell()
const ScChangeAction* pAction=pChangeAction;
const ScBigRange& rRange = pAction->GetBigRange();
- if(rRange.IsValid(pDocShell->GetDocument()))
+ if(rRange.IsValid(&pDocShell->GetDocument()))
{
ScViewData* pViewData=ScDocShell::GetViewData();
ScRange aRef=rRange.MakeRange();
diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx
index 52fde2ef009e..85cb1e55d8ef 100644
--- a/sc/source/ui/namedlg/namepast.cxx
+++ b/sc/source/ui/namedlg/namepast.cxx
@@ -37,9 +37,9 @@ ScNamePasteDlg::ScNamePasteDlg( Window * pParent, ScDocShell* pShell, bool )
get(m_pBtnPaste, "paste");
get(m_pBtnClose, "close");
- ScDocument* pDoc = pShell->GetDocument();
+ ScDocument& rDoc = pShell->GetDocument();
std::map<OUString, ScRangeName*> aCopyMap;
- pDoc->GetRangeNameMap(aCopyMap);
+ rDoc.GetRangeNameMap(aCopyMap);
std::map<OUString, ScRangeName*>::iterator itr = aCopyMap.begin(), itrEnd = aCopyMap.end();
for (; itr != itrEnd; ++itr)
{
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index ed7336adb394..3441da2dcce4 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -493,7 +493,7 @@ void ScContentTree::KeyInput( const KeyEvent& rKEvt )
if (pScNavigatorDlg!=NULL)
pScTabViewShell=pScNavigatorDlg->GetTabViewShell();
if(pScTabViewShell !=NULL)
- pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView();
+ pScDrawView =pScTabViewShell->GetViewData().GetScDrawView();
if(pScDrawView!=NULL)
{
pScDrawView->SelectCurrentViewObject(aText );
@@ -717,7 +717,7 @@ ScDocument* ScContentTree::GetSourceDocument()
{
ScDocShell* pSh = GetManualOrCurrent();
if (pSh)
- return pSh->GetDocument();
+ return &pSh->GetDocument();
}
return NULL;
@@ -979,7 +979,7 @@ void ScContentTree::GetDrawNames( sal_uInt16 nType )
if (pScNavigatorDlg!=NULL)
pScTabViewShell=pScNavigatorDlg->GetTabViewShell();
if(pScTabViewShell !=NULL)
- pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView();
+ pScDrawView =pScTabViewShell->GetViewData().GetScDrawView();
if(pScDrawView!=NULL)
{
bool bMarked =pScDrawView->GetObjectIsMarked(pObject);
@@ -1224,8 +1224,8 @@ static bool lcl_GetRange( ScDocument* pDoc, sal_uInt16 nType, const OUString& rN
static void lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, sal_uInt16 nType, Window* pWin )
{
- ScDocument* pSrcDoc = pSrcShell->GetDocument();
- ScDrawLayer* pModel = pSrcDoc->GetDrawLayer();
+ ScDocument& rSrcDoc = pSrcShell->GetDocument();
+ ScDrawLayer* pModel = rSrcDoc.GetDrawLayer();
if (pModel)
{
bool bOle = ( nType == SC_CONTENT_OLEOBJECT );
@@ -1266,14 +1266,14 @@ static void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, sal_u
aMark.SelectTable( rRange.aStart.Tab(), true );
aMark.SetMarkArea( rRange );
- ScDocument* pSrcDoc = pSrcShell->GetDocument();
- if ( !pSrcDoc->HasSelectedBlockMatrixFragment( rRange.aStart.Col(), rRange.aStart.Row(),
+ ScDocument& rSrcDoc = pSrcShell->GetDocument();
+ if ( !rSrcDoc.HasSelectedBlockMatrixFragment( rRange.aStart.Col(), rRange.aStart.Row(),
rRange.aEnd.Col(), rRange.aEnd.Row(),
aMark ) )
{
ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
ScClipParam aClipParam(rRange, false);
- pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark);
+ rSrcDoc.CopyToClip(aClipParam, pClipDoc, &aMark);
// pClipDoc->ExtendMerge( rRange, sal_True );
TransferableObjectDescriptor aObjDesc;
@@ -1325,7 +1325,7 @@ void ScContentTree::DoDrag()
if (pDocSh->HasName())
aDocName = pDocSh->GetMedium()->GetName();
else
- pLocalDoc = pDocSh->GetDocument(); // Drop nur in dieses Dokument
+ pLocalDoc = &pDocSh->GetDocument(); // Drop nur in dieses Dokument
}
}
@@ -1392,11 +1392,11 @@ void ScContentTree::DoDrag()
if ( pSrcShell )
{
- ScDocument* pSrcDoc = pSrcShell->GetDocument();
+ ScDocument& rSrcDoc = pSrcShell->GetDocument();
if ( nType == SC_CONTENT_RANGENAME || nType == SC_CONTENT_DBAREA )
{
ScRange aRange;
- if ( lcl_GetRange( pSrcDoc, nType, aText, aRange ) )
+ if ( lcl_GetRange( &rSrcDoc, nType, aText, aRange ) )
{
lcl_DoDragCells( pSrcShell, aRange, SC_DROP_NAVIGATOR, this );
}
@@ -1404,7 +1404,7 @@ void ScContentTree::DoDrag()
else if ( nType == SC_CONTENT_TABLE )
{
SCTAB nTab;
- if ( pSrcDoc->GetTable( aText, nTab ) )
+ if ( rSrcDoc.GetTable( aText, nTab ) )
{
ScRange aRange( 0,0,nTab, MAXCOL,MAXROW,nTab );
lcl_DoDragCells( pSrcShell, aRange, SC_DROP_NAVIGATOR | SC_DROP_TABLE, this );
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index cf3cdc8ac163..7d0696b5b2ed 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -1021,7 +1021,7 @@ ScNavigatorSettings* ScNavigatorDlg::GetNavigatorSettings()
bool ScNavigatorDlg::GetViewData()
{
ScTabViewShell* pViewSh = GetTabViewShell();
- pViewData = pViewSh ? pViewSh->GetViewData() : NULL;
+ pViewData = pViewSh ? &pViewSh->GetViewData() : NULL;
return ( pViewData != NULL );
}
@@ -1272,7 +1272,7 @@ void ScNavigatorDlg::MarkDataArea()
pViewSh->MarkDataArea();
ScRange aMarkRange;
- pViewSh->GetViewData()->GetMarkData().GetMarkArea(aMarkRange);
+ pViewSh->GetViewData().GetMarkData().GetMarkArea(aMarkRange);
pMarkArea->nColStart = aMarkRange.aStart.Col();
pMarkArea->nRowStart = aMarkRange.aStart.Row();
pMarkArea->nColEnd = aMarkRange.aEnd.Col();
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 71515ca1916d..b1d78151b3ad 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -112,7 +112,7 @@ void ScTpUserLists::Init()
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
- pViewData = pViewSh->GetViewData();
+ pViewData = &pViewSh->GetViewData();
pDoc = pViewData->GetDocument();
pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index 9c74b954f0d9..9d8a16370b5c 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -419,7 +419,7 @@ SfxTabPage* ScTpLayoutOptions::Create( Window* pParent,
ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current());
if(pDocSh!=NULL)
- pNew->SetDocument(pDocSh->GetDocument());
+ pNew->SetDocument(&pDocSh->GetDocument());
return pNew;
}
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index 097a1bb1e510..88f652c98732 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -123,11 +123,11 @@ ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, Window*
OSL_ENSURE( pScDocSh, "Current DocumentShell not found :-(" );
- pDoc = pScDocSh->GetDocument();
+ pDoc = &pScDocSh->GetDocument();
if ( pScViewSh )
{
- pViewData = pScViewSh->GetViewData();
+ pViewData = &pScViewSh->GetViewData();
nCurTab = pViewData->GetTabNo();
}
diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx
index e819be7a9dac..3e8ac5cd7724 100644
--- a/sc/source/ui/pagedlg/tphf.cxx
+++ b/sc/source/ui/pagedlg/tphf.cxx
@@ -62,10 +62,10 @@ ScHFPage::ScHFPage( Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId )
if ( pViewSh )
{
- ScViewData* pViewData = pViewSh->GetViewData();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScViewData& rViewData = pViewSh->GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
- aStrPageStyle = pDoc->GetPageStyle( pViewData->GetTabNo() );
+ aStrPageStyle = pDoc->GetPageStyle( rViewData.GetTabNo() );
}
m_pBtnEdit->SetClickHdl ( LINK( this, ScHFPage, BtnHdl ) );
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 6a2510b6c2cc..55d80ad42a7c 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -146,8 +146,8 @@ void ScSimpleUndo::EndRedo()
void ScSimpleUndo::BroadcastChanges( const ScRange& rRange )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->BroadcastCells(rRange, SC_HINT_DATACHANGED);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.BroadcastCells(rRange, SC_HINT_DATACHANGED);
}
namespace {
@@ -181,14 +181,14 @@ public:
void ScSimpleUndo::BroadcastChanges( const DataSpansType& rSpans )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- SpanBroadcaster aBroadcaster(*pDoc);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SpanBroadcaster aBroadcaster(rDoc);
DataSpansType::const_iterator it = rSpans.begin(), itEnd = rSpans.end();
for (; it != itEnd; ++it)
{
const sc::ColumnSpanSet& rSet = *it->second;
- rSet.executeColumnAction(*pDoc, aBroadcaster);
+ rSet.executeColumnAction(rDoc, aBroadcaster);
}
}
@@ -206,7 +206,7 @@ void ScSimpleUndo::ShowTable( const ScRange& rRange )
{
SCTAB nStart = rRange.aStart.Tab();
SCTAB nEnd = rRange.aEnd.Tab();
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
if ( nTab < nStart || nTab > nEnd ) // if not in range:
pViewShell->SetTabNo( nStart ); // at beginning of the range
}
@@ -218,7 +218,7 @@ ScBlockUndo::ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange,
aBlockRange( rRange ),
eMode( eBlockMode )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScBlockUndo::~ScBlockUndo()
@@ -229,7 +229,7 @@ ScBlockUndo::~ScBlockUndo()
void ScBlockUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
- EnableDrawAdjust( pDocShell->GetDocument(), false );
+ EnableDrawAdjust( &pDocShell->GetDocument(), false );
}
void ScBlockUndo::EndUndo()
@@ -237,8 +237,8 @@ void ScBlockUndo::EndUndo()
if (eMode == SC_UNDO_AUTOHEIGHT)
AdjustHeight();
- EnableDrawAdjust( pDocShell->GetDocument(), true );
- DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
+ EnableDrawAdjust( &pDocShell->GetDocument(), true );
+ DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
ShowBlock();
ScSimpleUndo::EndUndo();
@@ -255,7 +255,7 @@ void ScBlockUndo::EndRedo()
bool ScBlockUndo::AdjustHeight()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
VirtualDevice aVirtDev;
Fraction aZoomX( 1, 1 );
@@ -264,11 +264,11 @@ bool ScBlockUndo::AdjustHeight()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- ScViewData* pData = pViewShell->GetViewData();
- nPPTX = pData->GetPPTX();
- nPPTY = pData->GetPPTY();
- aZoomX = pData->GetZoomX();
- aZoomY = pData->GetZoomY();
+ ScViewData& rData = pViewShell->GetViewData();
+ nPPTX = rData.GetPPTX();
+ nPPTY = rData.GetPPTY();
+ aZoomX = rData.GetZoomX();
+ aZoomY = rData.GetZoomY();
}
else
{
@@ -278,7 +278,7 @@ bool ScBlockUndo::AdjustHeight()
}
sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, &aVirtDev);
- bool bRet = pDoc->SetOptimalHeight(
+ bool bRet = rDoc.SetOptimalHeight(
aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab());
if (bRet)
@@ -300,7 +300,7 @@ void ScBlockUndo::ShowBlock()
ShowTable( aBlockRange ); // with multiple sheets in range each of them is good
pViewShell->MoveCursorAbs( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
SC_FOLLOW_JUMP, false, false );
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
ScRange aRange = aBlockRange;
aRange.aStart.SetTab( nTab );
aRange.aEnd.SetTab( nTab );
@@ -316,7 +316,7 @@ ScMultiBlockUndo::ScMultiBlockUndo(
maBlockRanges(rRanges),
meMode(eBlockMode)
{
- mpDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ mpDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScMultiBlockUndo::~ScMultiBlockUndo()
@@ -327,7 +327,7 @@ ScMultiBlockUndo::~ScMultiBlockUndo()
void ScMultiBlockUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
- EnableDrawAdjust(pDocShell->GetDocument(), false);
+ EnableDrawAdjust(&pDocShell->GetDocument(), false);
}
void ScMultiBlockUndo::EndUndo()
@@ -335,8 +335,8 @@ void ScMultiBlockUndo::EndUndo()
if (meMode == SC_UNDO_AUTOHEIGHT)
AdjustHeight();
- EnableDrawAdjust(pDocShell->GetDocument(), true);
- DoSdrUndoAction(mpDrawUndo, pDocShell->GetDocument());
+ EnableDrawAdjust(&pDocShell->GetDocument(), true);
+ DoSdrUndoAction(mpDrawUndo, &pDocShell->GetDocument());
ShowBlock();
ScSimpleUndo::EndUndo();
@@ -353,7 +353,7 @@ void ScMultiBlockUndo::EndRedo()
void ScMultiBlockUndo::AdjustHeight()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
VirtualDevice aVirtDev;
Fraction aZoomX( 1, 1 );
@@ -362,11 +362,11 @@ void ScMultiBlockUndo::AdjustHeight()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- ScViewData* pData = pViewShell->GetViewData();
- nPPTX = pData->GetPPTX();
- nPPTY = pData->GetPPTY();
- aZoomX = pData->GetZoomX();
- aZoomY = pData->GetZoomY();
+ ScViewData& rData = pViewShell->GetViewData();
+ nPPTX = rData.GetPPTX();
+ nPPTY = rData.GetPPTY();
+ aZoomX = rData.GetZoomX();
+ aZoomY = rData.GetZoomY();
}
else
{
@@ -379,7 +379,7 @@ void ScMultiBlockUndo::AdjustHeight()
for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
{
const ScRange& r = *maBlockRanges[i];
- bool bRet = pDoc->SetOptimalHeight(aCxt, r.aStart.Row(), r.aEnd.Row(), r.aStart.Tab());
+ bool bRet = rDoc.SetOptimalHeight(aCxt, r.aStart.Row(), r.aEnd.Row(), r.aStart.Tab());
if (bRet)
pDocShell->PostPaint(
@@ -405,7 +405,7 @@ void ScMultiBlockUndo::ShowBlock()
ShowTable(aRange);
pViewShell->MoveCursorAbs(
aRange.aStart.Col(), aRange.aStart.Row(), SC_FOLLOW_JUMP, false, false);
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
aRange.aStart.SetTab(nTab);
aRange.aEnd.SetTab(nTab);
pViewShell->MarkRange(aRange, false, false);
@@ -426,10 +426,10 @@ ScMoveUndo::ScMoveUndo( ScDocShell* pDocSh, ScDocument* pRefDoc, ScRefUndoData*
pRefUndoData( pRefData ),
eMode( eRefMode )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (pRefUndoData)
- pRefUndoData->DeleteUnchanged(pDoc);
- pDrawUndo = GetSdrUndoAction( pDoc );
+ pRefUndoData->DeleteUnchanged(&rDoc);
+ pDrawUndo = GetSdrUndoAction( &rDoc );
}
ScMoveUndo::~ScMoveUndo()
@@ -441,11 +441,11 @@ ScMoveUndo::~ScMoveUndo()
void ScMoveUndo::UndoRef()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRange aRange(0,0,0, MAXCOL,MAXROW,pRefUndoDoc->GetTableCount()-1);
- pRefUndoDoc->CopyToDocument( aRange, IDF_FORMULA, false, pDoc, NULL, false );
+ pRefUndoDoc->CopyToDocument( aRange, IDF_FORMULA, false, &rDoc, NULL, false );
if (pRefUndoData)
- pRefUndoData->DoUndo( pDoc, (eMode == SC_UNDO_REFFIRST) );
+ pRefUndoData->DoUndo( &rDoc, (eMode == SC_UNDO_REFFIRST) );
// HACK: ScDragDropUndo is the only one with REFFIRST.
// If not, results possibly in a too frequent adjustment
// of ChartRefs. Not that pretty, but not too bad either..
@@ -455,7 +455,7 @@ void ScMoveUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
- EnableDrawAdjust( pDocShell->GetDocument(), false );
+ EnableDrawAdjust( &pDocShell->GetDocument(), false );
if (pRefUndoDoc && eMode == SC_UNDO_REFFIRST)
UndoRef();
@@ -463,12 +463,12 @@ void ScMoveUndo::BeginUndo()
void ScMoveUndo::EndUndo()
{
- DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() ); // must also be called when pointer is null
+ DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() ); // must also be called when pointer is null
if (pRefUndoDoc && eMode == SC_UNDO_REFLAST)
UndoRef();
- EnableDrawAdjust( pDocShell->GetDocument(), true );
+ EnableDrawAdjust( &pDocShell->GetDocument(), true );
ScSimpleUndo::EndUndo();
}
@@ -496,7 +496,7 @@ void ScDBFuncUndo::SetDrawUndoAction( SdrUndoAction* pDrawUndo )
void ScDBFuncUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
- DoSdrUndoAction( mpDrawUndo, pDocShell->GetDocument() );
+ DoSdrUndoAction( mpDrawUndo, &pDocShell->GetDocument() );
}
void ScDBFuncUndo::EndUndo()
@@ -505,9 +505,9 @@ void ScDBFuncUndo::EndUndo()
if ( pAutoDBRange )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTab = pDoc->GetVisibleTab();
- ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTab = rDoc.GetVisibleTab();
+ ScDBData* pNoNameData = rDoc.GetAnonymousDBData(nTab);
if (pNoNameData )
{
SCCOL nRangeX1;
@@ -524,7 +524,7 @@ void ScDBFuncUndo::EndUndo()
{
// restore AutoFilter buttons
pAutoDBRange->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
- pDoc->ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
+ rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID );
}
}
@@ -538,8 +538,8 @@ void ScDBFuncUndo::BeginRedo()
{
// move the database range to this function's position again (see ScDocShell::GetDBData)
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDBData* pNoNameData = pDoc->GetAnonymousDBData(aOriginalRange.aStart.Tab());
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDBData* pNoNameData = rDoc.GetAnonymousDBData(aOriginalRange.aStart.Tab());
if ( pNoNameData )
{
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index aaa58ec792be..65e4875b97d7 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -149,7 +149,7 @@ bool ScUndoInsertCells::Merge( SfxUndoAction* pNextAction )
void ScUndoInsertCells::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
pChangeTrack->AppendInsert( aEffRange );
@@ -161,12 +161,12 @@ void ScUndoInsertCells::SetChangeTrack()
void ScUndoInsertCells::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB i;
if ( bUndo )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
}
@@ -182,10 +182,10 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
if (bUndo)
- pDoc->DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ rDoc.DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
else
- pDoc->InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ rDoc.InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
}
break;
@@ -194,10 +194,10 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
if (bUndo)
- pDoc->DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ rDoc.DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
else
- pDoc->InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ rDoc.InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
}
break;
@@ -212,12 +212,12 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
aWorkRange.aEnd.SetCol(MAXCOL);
for( i=0; i<nCount; i++ )
{
- if ( pDoc->HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
+ if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED ) )
{
SCCOL nEndCol = aWorkRange.aEnd.Col();
SCROW nEndRow = aWorkRange.aEnd.Row();
- pDoc->ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
+ rDoc.ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
}
}
@@ -283,9 +283,9 @@ void ScUndoInsertCells::Undo()
DoChange( true );
EndUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
- pDoc->SetDrawPageSize(pTabs[i]);
+ rDoc.SetDrawPageSize(pTabs[i]);
}
void ScUndoInsertCells::Redo()
@@ -298,9 +298,9 @@ void ScUndoInsertCells::Redo()
if ( pPasteUndo )
pPasteUndo->Redo(); // redo paste last
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
- pDoc->SetDrawPageSize(pTabs[i]);
+ rDoc.SetDrawPageSize(pTabs[i]);
}
void ScUndoInsertCells::Repeat(SfxRepeatTarget& rTarget)
@@ -363,7 +363,7 @@ OUString ScUndoDeleteCells::GetComment() const
void ScUndoDeleteCells::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->AppendDeleteRange( aEffRange, pRefUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -373,12 +373,12 @@ void ScUndoDeleteCells::SetChangeTrack()
void ScUndoDeleteCells::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB i;
if ( bUndo )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
}
@@ -392,10 +392,10 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
if (bUndo)
- pDoc->InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ rDoc.InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
else
- pDoc->DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ rDoc.DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
}
break;
@@ -404,10 +404,10 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
if (bUndo)
- pDoc->InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ rDoc.InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
else
- pDoc->DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ rDoc.DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
}
break;
@@ -421,7 +421,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
for( i=0; i<nCount && bUndo; i++ )
{
pRefUndoDoc->CopyToDocument( aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
- IDF_ALL | IDF_NOCAPTIONS, false, pDoc );
+ IDF_ALL | IDF_NOCAPTIONS, false, &rDoc );
}
ScRange aWorkRange( aEffRange );
@@ -430,7 +430,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
- if ( pDoc->HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
+ if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
// #i51445# old merge flag attributes must be deleted also for single cells,
@@ -444,16 +444,16 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
aWorkRange.aEnd.SetRow(MAXROW);
ScMarkData aMarkData;
aMarkData.SelectOneTable( aWorkRange.aStart.Tab() );
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- pDoc->ApplyPatternArea( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(),
+ rDoc.ApplyPatternArea( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(),
aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(),
aMarkData, aPattern );
}
SCCOL nEndCol = aWorkRange.aEnd.Col();
SCROW nEndRow = aWorkRange.aEnd.Row();
- pDoc->ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
+ rDoc.ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
}
}
@@ -526,9 +526,9 @@ void ScUndoDeleteCells::Undo()
}
}
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
- pDoc->SetDrawPageSize(pTabs[i]);
+ rDoc.SetDrawPageSize(pTabs[i]);
}
void ScUndoDeleteCells::Redo()
@@ -543,9 +543,9 @@ void ScUndoDeleteCells::Redo()
if (pViewShell)
pViewShell->DoneBlockMode(); // current way
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
- pDoc->SetDrawPageSize(pTabs[i]);
+ rDoc.SetDrawPageSize(pTabs[i]);
}
void ScUndoDeleteCells::Repeat(SfxRepeatTarget& rTarget)
@@ -603,11 +603,11 @@ void ScUndoDeleteMulti::DoChange() const
if (mbRefresh)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
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 );
}
pDocShell->PostPaint( nStartCol, nStartRow, nTab, MAXCOL, MAXROW, nTab, nPaint );
@@ -621,7 +621,7 @@ void ScUndoDeleteMulti::DoChange() const
void ScUndoDeleteMulti::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
nStartChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -660,7 +660,7 @@ void ScUndoDeleteMulti::Undo()
WaitObject aWait( pDocShell->GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// reverse delete -> forward insert
std::vector<sc::ColRowSpan>::const_iterator it = maSpans.begin(), itEnd = maSpans.end();
@@ -669,9 +669,9 @@ void ScUndoDeleteMulti::Undo()
SCCOLROW nStart = it->mnStart;
SCCOLROW nEnd = it->mnEnd;
if (mbRows)
- pDoc->InsertRow( 0,nTab, MAXCOL,nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
+ rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
else
- pDoc->InsertCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
+ rDoc.InsertCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
}
it = maSpans.begin();
@@ -680,13 +680,13 @@ void ScUndoDeleteMulti::Undo()
SCCOLROW nStart = it->mnStart;
SCCOLROW nEnd = it->mnEnd;
if (mbRows)
- pRefUndoDoc->CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, IDF_ALL,false,pDoc );
+ pRefUndoDoc->CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, IDF_ALL,false, &rDoc );
else
pRefUndoDoc->CopyToDocument( static_cast<SCCOL>(nStart),0,nTab,
- static_cast<SCCOL>(nEnd),MAXROW,nTab, IDF_ALL,false,pDoc );
+ static_cast<SCCOL>(nEnd),MAXROW,nTab, IDF_ALL,false, &rDoc );
}
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -704,7 +704,7 @@ void ScUndoDeleteMulti::Redo()
WaitObject aWait( pDocShell->GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// reverse delete
std::vector<sc::ColRowSpan>::const_reverse_iterator ri = maSpans.rbegin(), riEnd = maSpans.rend();
@@ -713,9 +713,9 @@ void ScUndoDeleteMulti::Redo()
SCCOLROW nEnd = ri->mnEnd;
SCCOLROW nStart = ri->mnStart;
if (mbRows)
- 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) );
}
SetChangeTrack();
@@ -762,7 +762,7 @@ OUString ScUndoCut::GetComment() const
void ScUndoCut::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction, SC_CACM_CUT );
@@ -772,7 +772,7 @@ void ScUndoCut::SetChangeTrack()
void ScUndoCut::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
sal_uInt16 nExtFlags = 0;
// do not undo/redo objects and note captions, they are handled via drawing undo
@@ -781,12 +781,12 @@ void ScUndoCut::DoChange( const bool bUndo )
if (bUndo) // only for Undo
{
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aCopyRange = aExtendedRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, false, pDoc );
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, false, &rDoc );
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -795,7 +795,7 @@ void ScUndoCut::DoChange( const bool bUndo )
else // only for Redo
{
pDocShell->UpdatePaintExt( nExtFlags, aExtendedRange );
- pDoc->DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
+ rDoc.DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(), aMarkData, nUndoFlags );
SetChangeTrack();
}
@@ -822,10 +822,10 @@ void ScUndoCut::Undo()
void ScUndoCut::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- EnableDrawAdjust( pDoc, false ); //! include in ScBlockUndo?
+ ScDocument& rDoc = pDocShell->GetDocument();
+ EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
DoChange( false );
- EnableDrawAdjust( pDoc, true ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
}
@@ -856,7 +856,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell, const ScRangeList& rRanges,
bRedoFilled( bRedoIsFilled )
{
if ( pRefUndoData )
- pRefUndoData->DeleteUnchanged( pDocShell->GetDocument() );
+ pRefUndoData->DeleteUnchanged( &pDocShell->GetDocument() );
if ( pOptions )
aPasteOptions = *pOptions; // used only for Repeat
@@ -879,7 +879,7 @@ OUString ScUndoPaste::GetComment() const
void ScUndoPaste::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
{
for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
@@ -894,13 +894,13 @@ void ScUndoPaste::SetChangeTrack()
void ScUndoPaste::DoChange(bool bUndo)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// RefUndoData for redo is created before first undo
// (with DeleteUnchanged after the DoUndo call)
bool bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
if ( bCreateRedoData )
- pRefRedoData = new ScRefUndoData( pDoc );
+ pRefRedoData = new ScRefUndoData( &rDoc );
ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData : pRefRedoData;
@@ -918,7 +918,7 @@ void ScUndoPaste::DoChange(bool bUndo)
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
if ( bUndo && !bRedoFilled )
{
if (!pRedoDoc)
@@ -935,7 +935,7 @@ void ScUndoPaste::DoChange(bool bUndo)
}
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndoSelected( pDoc, aMarkData, bColInfo, bRowInfo );
+ pRedoDoc->InitUndoSelected( &rDoc, aMarkData, bColInfo, bRowInfo );
}
// read "redo" data from the document in the first undo
// all sheets - CopyToDocument skips those that don't exist in pRedoDoc
@@ -944,7 +944,7 @@ void ScUndoPaste::DoChange(bool bUndo)
ScRange aCopyRange = *maBlockRanges[i];
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, nUndoFlags, false, pRedoDoc );
+ rDoc.CopyToDocument( aCopyRange, nUndoFlags, false, pRedoDoc );
bRedoFilled = true;
}
}
@@ -952,11 +952,11 @@ void ScUndoPaste::DoChange(bool bUndo)
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt(nExtFlags, maBlockRanges.Combine());
- pDoc->ForgetNoteCaptions(maBlockRanges);
+ rDoc.ForgetNoteCaptions(maBlockRanges);
aMarkData.MarkToMulti();
- pDoc->DeleteSelection(nUndoFlags, aMarkData, false); // no broadcasting here
+ rDoc.DeleteSelection(nUndoFlags, aMarkData, false); // no broadcasting here
for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
- pDoc->BroadcastCells(*maBlockRanges[i], SC_HINT_DATACHANGED);
+ rDoc.BroadcastCells(*maBlockRanges[i], SC_HINT_DATACHANGED);
aMarkData.MarkToSimple();
@@ -969,7 +969,7 @@ void ScUndoPaste::DoChange(bool bUndo)
ScRange aRange = *maBlockRanges[i];
aRange.aStart.SetTab(nFirstSelected);
aRange.aEnd.SetTab(nFirstSelected);
- pRedoDoc->UndoToDocument(aRange, nUndoFlags, false, pDoc);
+ pRedoDoc->UndoToDocument(aRange, nUndoFlags, false, &rDoc);
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
@@ -978,21 +978,21 @@ void ScUndoPaste::DoChange(bool bUndo)
aRange.aStart.SetTab(*itr);
aRange.aEnd.SetTab(*itr);
- pRedoDoc->CopyToDocument( aRange, nUndoFlags, false, pDoc );
+ pRedoDoc->CopyToDocument( aRange, nUndoFlags, false, &rDoc );
}
}
}
if (pWorkRefData)
{
- pWorkRefData->DoUndo( pDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection
+ pWorkRefData->DoUndo( &rDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection
if (!maBlockRanges.empty() &&
- pDoc->RefreshAutoFilter(0, 0, MAXCOL, MAXROW, maBlockRanges[0]->aStart.Tab()))
+ rDoc.RefreshAutoFilter(0, 0, MAXCOL, MAXROW, maBlockRanges[0]->aStart.Tab()))
bPaintAll = true;
}
if ( bCreateRedoData && pRefRedoData )
- pRefRedoData->DeleteUnchanged( pDoc );
+ pRefRedoData->DeleteUnchanged( &rDoc );
if (bUndo) // Undo: UndoToDocument after handling RefData
{
@@ -1004,14 +1004,14 @@ void ScUndoPaste::DoChange(bool bUndo)
{
aRange.aStart.SetTab(*itr);
aRange.aEnd.SetTab(*itr);
- pUndoDoc->UndoToDocument(aRange, nUndoFlags, false, pDoc);
+ pUndoDoc->UndoToDocument(aRange, nUndoFlags, false, &rDoc);
}
}
}
if ( bUndo )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
}
@@ -1023,7 +1023,7 @@ void ScUndoPaste::DoChange(bool bUndo)
for (size_t i = 0, n = aDrawRanges.size(); i < n; ++i)
{
ScRange& rDrawRange = *aDrawRanges[i];
- pDoc->ExtendMerge(rDrawRange, true); // only needed for single sheet (text/rtf etc.)
+ rDoc.ExtendMerge(rDrawRange, true); // only needed for single sheet (text/rtf etc.)
if (bPaintAll)
{
rDrawRange.aStart.SetCol(0);
@@ -1081,10 +1081,10 @@ void ScUndoPaste::Undo()
void ScUndoPaste::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- EnableDrawAdjust( pDoc, false ); //! include in ScBlockUndo?
+ ScDocument& rDoc = pDocShell->GetDocument();
+ EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
DoChange( false );
- EnableDrawAdjust( pDoc, true ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
}
@@ -1130,7 +1130,7 @@ ScUndoDragDrop::ScUndoDragDrop( ScDocShell* pNewDocShell,
if ( !bIncludeFiltered )
{
// find number of non-filtered rows
- SCROW nPastedCount = pDocShell->GetDocument()->CountNonFilteredRows(
+ SCROW nPastedCount = pDocShell->GetDocument().CountNonFilteredRows(
aSrcRange.aStart.Row(), aSrcRange.aEnd.Row(), aSrcRange.aStart.Tab());
if ( nPastedCount == 0 )
@@ -1157,7 +1157,7 @@ OUString ScUndoDragDrop::GetComment() const
void ScUndoDragDrop::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
if ( bCut )
@@ -1178,17 +1178,17 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
{
sal_uInt16 nPaint = PAINT_GRID;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (pViewShell)
{
VirtualDevice aVirtDev;
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
sc::RowHeightContext aCxt(
- pViewData->GetPPTX(), pViewData->GetPPTY(), pViewData->GetZoomX(), pViewData->GetZoomY(),
+ rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), rViewData.GetZoomY(),
&aVirtDev);
- if (pDoc->SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab()))
+ if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab()))
{
aRange.aStart.SetCol(0);
aRange.aEnd.SetCol(MAXCOL);
@@ -1223,26 +1223,26 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
void ScUndoDragDrop::DoUndo( ScRange aRange )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
// Database range before data, so that the Autofilter button match up in ExtendMerge
ScRange aPaintRange = aRange;
- pDoc->ExtendMerge( aPaintRange ); // before deleting
+ rDoc.ExtendMerge( aPaintRange ); // before deleting
pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
// do not undo objects and note captions, they are handled via drawing undo
sal_uInt16 nUndoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
- pDoc->DeleteAreaTab( aRange, nUndoFlags );
- pRefUndoDoc->CopyToDocument( aRange, nUndoFlags, false, pDoc );
- if ( pDoc->HasAttrib( aRange, HASATTR_MERGED ) )
- pDoc->ExtendMerge( aRange, true );
+ rDoc.DeleteAreaTab( aRange, nUndoFlags );
+ pRefUndoDoc->CopyToDocument( aRange, nUndoFlags, false, &rDoc );
+ if ( rDoc.HasAttrib( aRange, HASATTR_MERGED ) )
+ rDoc.ExtendMerge( aRange, true );
aPaintRange.aEnd.SetCol( std::max( aPaintRange.aEnd.Col(), aRange.aEnd.Col() ) );
aPaintRange.aEnd.SetRow( std::max( aPaintRange.aEnd.Row(), aRange.aEnd.Row() ) );
@@ -1261,18 +1261,18 @@ void ScUndoDragDrop::Undo()
if (bCut)
{
// Notify all listeners of the destination range, and have them update their references.
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nColDelta = aSrcRange.aStart.Col() - aDestRange.aStart.Col();
SCROW nRowDelta = aSrcRange.aStart.Row() - aDestRange.aStart.Row();
SCTAB nTabDelta = aSrcRange.aStart.Tab() - aDestRange.aStart.Tab();
sc::RefMovedHint aHint(aDestRange, ScAddress(nColDelta, nRowDelta, nTabDelta));
- pDoc->BroadcastRefMoved(aHint);
+ rDoc.BroadcastRefMoved(aHint);
- ScValidationDataList* pValidList = pDoc->GetValidationList();
+ ScValidationDataList* pValidList = rDoc.GetValidationList();
if (pValidList)
{
// Update the references of validation entries.
- sc::RefUpdateContext aCxt(*pDoc);
+ sc::RefUpdateContext aCxt(rDoc);
aCxt.meMode = URM_MOVE;
aCxt.maRange = aSrcRange;
aCxt.mnColDelta = nColDelta;
@@ -1300,10 +1300,10 @@ void ScUndoDragDrop::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
boost::scoped_ptr<ScDocument> pClipDoc(new ScDocument( SCDOCMODE_CLIP ));
- EnableDrawAdjust( pDoc, false ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
// do not undo/redo objects and note captions, they are handled via drawing undo
sal_uInt16 nRedoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
@@ -1329,15 +1329,15 @@ void ScUndoDragDrop::Redo()
// do not clone objects and note captions into clipdoc (see above)
// but at least copy notes
ScClipParam aClipParam(aSrcRange, bCut);
- pDoc->CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, false, bKeepScenarioFlags, false, true);
+ rDoc.CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, false, bKeepScenarioFlags, false, true);
if (bCut)
{
ScRange aSrcPaintRange = aSrcRange;
- pDoc->ExtendMerge( aSrcPaintRange ); // before deleting
+ rDoc.ExtendMerge( aSrcPaintRange ); // before deleting
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aSrcPaintRange );
- pDoc->DeleteAreaTab( aSrcRange, nRedoFlags );
+ rDoc.DeleteAreaTab( aSrcRange, nRedoFlags );
PaintArea( aSrcPaintRange, nExtFlags );
}
@@ -1347,11 +1347,11 @@ void ScUndoDragDrop::Redo()
bool bIncludeFiltered = bCut;
// TODO: restore old note captions instead of cloning new captions...
- pDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL & ~IDF_OBJECTS, NULL, pClipDoc.get(), true, false, bIncludeFiltered );
+ rDoc.CopyFromClip( aDestRange, aDestMark, IDF_ALL & ~IDF_OBJECTS, NULL, pClipDoc.get(), true, false, bIncludeFiltered );
if (bCut)
for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
- pDoc->RefreshAutoFilter( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(),
+ rDoc.RefreshAutoFilter( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(),
aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(), nTab );
// skipped rows and merged cells don't mix
@@ -1362,7 +1362,7 @@ void ScUndoDragDrop::Redo()
{
SCCOL nEndCol = aDestRange.aEnd.Col();
SCROW nEndRow = aDestRange.aEnd.Row();
- pDoc->ExtendMerge( aDestRange.aStart.Col(), aDestRange.aStart.Row(),
+ rDoc.ExtendMerge( aDestRange.aStart.Col(), aDestRange.aStart.Row(),
nEndCol, nEndRow, nTab, true );
PaintArea( ScRange( aDestRange.aStart.Col(), aDestRange.aStart.Row(), nTab,
nEndCol, nEndRow, nTab ), 0 );
@@ -1374,7 +1374,7 @@ void ScUndoDragDrop::Redo()
ShowTable( aDestRange.aStart.Tab() );
RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
- EnableDrawAdjust( pDoc, true ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
@@ -1412,10 +1412,10 @@ OUString ScUndoListNames::GetComment() const
void ScUndoListNames::DoChange( ScDocument* pSrcDoc ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aBlockRange, IDF_ALL );
- pSrcDoc->CopyToDocument( aBlockRange, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( aBlockRange, IDF_ALL );
+ pSrcDoc->CopyToDocument( aBlockRange, IDF_ALL, false, &rDoc );
pDocShell->PostPaint( aBlockRange, PAINT_GRID );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1478,10 +1478,10 @@ void ScUndoConditionalFormat::Redo()
void ScUndoConditionalFormat::DoChange(ScDocument* pSrcDoc)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( maRange, IDF_ALL );
- pSrcDoc->CopyToDocument( maRange, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( maRange, IDF_ALL );
+ pSrcDoc->CopyToDocument( maRange, IDF_ALL, false, &rDoc );
pDocShell->PostPaint( maRange, PAINT_GRID );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1538,9 +1538,9 @@ void ScUndoUseScenario::Undo()
pViewShell->InitOwnBlockMode();
}
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->DeleteSelection( IDF_ALL, aMarkData );
- pUndoDoc->CopyToDocument( aRange, IDF_ALL, true, pDoc, &aMarkData );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.DeleteSelection( IDF_ALL, aMarkData );
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL, true, &rDoc, &aMarkData );
// scenario table
bool bFrame = false;
@@ -1555,14 +1555,14 @@ void ScUndoUseScenario::Undo()
Color aColor;
sal_uInt16 nScenFlags;
pUndoDoc->GetScenarioData( i, aComment, aColor, nScenFlags );
- pDoc->SetScenarioData( i, aComment, aColor, nScenFlags );
+ rDoc.SetScenarioData( i, aComment, aColor, nScenFlags );
bool bActive = pUndoDoc->IsActiveScenario( i );
- pDoc->SetActiveScenario( i, bActive );
+ rDoc.SetActiveScenario( i, bActive );
// For copy-back scenario also consider content
if ( nScenFlags & SC_SCENARIO_TWOWAY )
{
- pDoc->DeleteAreaTab( 0,0, MAXCOL,MAXROW, i, IDF_ALL );
- pUndoDoc->CopyToDocument( 0,0,i, MAXCOL,MAXROW,i, IDF_ALL,false, pDoc );
+ rDoc.DeleteAreaTab( 0,0, MAXCOL,MAXROW, i, IDF_ALL );
+ pUndoDoc->CopyToDocument( 0,0,i, MAXCOL,MAXROW,i, IDF_ALL,false, &rDoc );
}
if ( nScenFlags & SC_SCENARIO_SHOWFRAME )
bFrame = true;
@@ -1613,8 +1613,8 @@ bool ScUndoUseScenario::CanRepeat(SfxRepeatTarget& rTarget) const
{
if (rTarget.ISA(ScTabViewTarget))
{
- ScViewData* pViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
- return !pViewData->GetDocument()->IsScenario( pViewData->GetTabNo() );
+ ScViewData& rViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
+ return !rViewData.GetDocument()->IsScenario( rViewData.GetTabNo() );
}
return false;
}
@@ -1645,28 +1645,28 @@ OUString ScUndoSelectionStyle::GetComment() const
void ScUndoSelectionStyle::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SetViewMarkData( aMarkData );
ScRange aWorkRange( aRange );
- if ( pDoc->HasAttrib( aWorkRange, HASATTR_MERGED ) ) // Merged cells?
- pDoc->ExtendMerge( aWorkRange, true );
+ if ( rDoc.HasAttrib( aWorkRange, HASATTR_MERGED ) ) // Merged cells?
+ rDoc.ExtendMerge( aWorkRange, true );
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
if (bUndo) // if Undo then push back all old data again
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aCopyRange = aWorkRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, &rDoc, &aMarkData );
}
else // if Redo, then reapply style
{
- ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool();
+ ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
ScStyleSheet* pStyleSheet =
(ScStyleSheet*) pStlPool->Find( aStyleName, SFX_STYLE_FAMILY_PARA );
if (!pStyleSheet)
@@ -1674,7 +1674,7 @@ void ScUndoSelectionStyle::DoChange( const bool bUndo )
OSL_FAIL("StyleSheet not found");
return;
}
- pDoc->ApplySelectionStyle( *pStyleSheet, aMarkData );
+ rDoc.ApplySelectionStyle( *pStyleSheet, aMarkData );
}
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
@@ -1704,8 +1704,8 @@ void ScUndoSelectionStyle::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
ScStyleSheet* pStyleSheet = (ScStyleSheet*) pStlPool->
Find( aStyleName, SFX_STYLE_FAMILY_PARA );
if (!pStyleSheet)
@@ -1750,8 +1750,8 @@ OUString ScUndoEnterMatrix::GetComment() const
void ScUndoEnterMatrix::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -1763,17 +1763,17 @@ void ScUndoEnterMatrix::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aBlockRange, IDF_ALL & ~IDF_NOTE );
- pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.DeleteAreaTab( aBlockRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
pDocShell->PostPaint( aBlockRange, PAINT_GRID );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->CellContentChanged();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -1784,13 +1784,13 @@ void ScUndoEnterMatrix::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aDestMark;
aDestMark.SelectOneTable( aBlockRange.aStart.Tab() );
aDestMark.SetMarkArea( aBlockRange );
- pDoc->InsertMatrixFormula( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
+ rDoc.InsertMatrixFormula( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(),
aDestMark, aFormula );
@@ -1804,8 +1804,8 @@ void ScUndoEnterMatrix::Repeat(SfxRepeatTarget& rTarget)
if (rTarget.ISA(ScTabViewTarget))
{
OUString aTemp = aFormula;
- ScDocument* pDoc = pDocShell->GetDocument();
- ((ScTabViewTarget&)rTarget).GetViewShell()->EnterMatrix(aTemp, pDoc->GetGrammar());
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ((ScTabViewTarget&)rTarget).GetViewShell()->EnterMatrix(aTemp, rDoc.GetGrammar());
}
}
@@ -1847,12 +1847,12 @@ void ScUndoIndent::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aCopyRange = aBlockRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, &rDoc, &aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndUndo();
@@ -1862,8 +1862,8 @@ void ScUndoIndent::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->ChangeSelectionIndent( bIsIncrement, aMarkData );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.ChangeSelectionIndent( bIsIncrement, aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndRedo();
@@ -1903,12 +1903,12 @@ void ScUndoTransliterate::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aCopyRange = aBlockRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_CONTENTS, true, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_CONTENTS, true, &rDoc, &aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndUndo();
@@ -1918,8 +1918,8 @@ void ScUndoTransliterate::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->TransliterateText( aMarkData, nTransliterationType );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.TransliterateText( aMarkData, nTransliterationType );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndRedo();
@@ -1968,8 +1968,8 @@ void ScUndoClearItems::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, true, pDoc, &aMarkData );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, true, &rDoc, &aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndUndo();
@@ -1979,8 +1979,8 @@ void ScUndoClearItems::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->ClearSelectionItems( pWhich, aMarkData );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.ClearSelectionItems( pWhich, aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndRedo();
@@ -1990,8 +1990,8 @@ void ScUndoClearItems::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
- ScViewData* pViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
- pViewData->GetDocFunc().ClearItems( pViewData->GetMarkData(), pWhich, false );
+ ScViewData& rViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
+ rViewData.GetDocFunc().ClearItems( rViewData.GetMarkData(), pWhich, false );
}
}
@@ -2023,10 +2023,10 @@ void ScUndoRemoveBreaks::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- pUndoDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, &rDoc );
if (pViewShell)
pViewShell->UpdatePageBreakData( true );
pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
@@ -2038,11 +2038,11 @@ void ScUndoRemoveBreaks::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- pDoc->RemoveManualBreaks(nTab);
- pDoc->UpdatePageBreaks(nTab);
+ rDoc.RemoveManualBreaks(nTab);
+ rDoc.UpdatePageBreaks(nTab);
if (pViewShell)
pViewShell->UpdatePageBreakData( true );
pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
@@ -2091,7 +2091,7 @@ void ScUndoRemoveMerge::Undo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (set<SCTAB>::const_iterator itr = maOption.maTabs.begin(), itrEnd = maOption.maTabs.end();
itr != itrEnd; ++itr)
{
@@ -2100,8 +2100,8 @@ void ScUndoRemoveMerge::Undo()
continue;
// There is no need to extend merge area because it's already been extended.
ScRange aRange = maOption.getSingleRange(*itr);
- pDoc->DeleteAreaTab(aRange, IDF_ATTRIB);
- pUndoDoc->CopyToDocument(aRange, IDF_ATTRIB, false, pDoc);
+ rDoc.DeleteAreaTab(aRange, IDF_ATTRIB);
+ pUndoDoc->CopyToDocument(aRange, IDF_ATTRIB, false, &rDoc);
bool bDidPaint = false;
if ( pViewShell )
@@ -2123,7 +2123,7 @@ void ScUndoRemoveMerge::Redo()
SetCurTab();
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
for (set<SCTAB>::const_iterator itr = maOption.maTabs.begin(), itrEnd = maOption.maTabs.end();
@@ -2133,18 +2133,18 @@ void ScUndoRemoveMerge::Redo()
// There is no need to extend merge area because it's already been extended.
ScRange aRange = maOption.getSingleRange(nTab);
- const SfxPoolItem& rDefAttr = pDoc->GetPool()->GetDefaultItem( ATTR_MERGE );
- ScPatternAttr aPattern( pDoc->GetPool() );
+ const SfxPoolItem& rDefAttr = rDoc.GetPool()->GetDefaultItem( ATTR_MERGE );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( rDefAttr );
- pDoc->ApplyPatternAreaTab( maOption.mnStartCol, maOption.mnStartRow,
+ rDoc.ApplyPatternAreaTab( maOption.mnStartCol, maOption.mnStartRow,
maOption.mnEndCol, maOption.mnEndRow, nTab,
aPattern );
- pDoc->RemoveFlagsTab( maOption.mnStartCol, maOption.mnStartRow,
+ rDoc.RemoveFlagsTab( maOption.mnStartCol, maOption.mnStartRow,
maOption.mnEndCol, maOption.mnEndRow, nTab,
SC_MF_HOR | SC_MF_VER );
- pDoc->ExtendMerge(aRange, true);
+ rDoc.ExtendMerge(aRange, true);
// Paint
@@ -2228,10 +2228,10 @@ void ScUndoBorder::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aMarkData;
aMarkData.MarkFromRangeList( *pRanges, false );
- pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, true, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, true, &rDoc, &aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndUndo();
@@ -2241,7 +2241,7 @@ void ScUndoBorder::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument(); // call function at docfunc
+ ScDocument& rDoc = pDocShell->GetDocument(); // call function at docfunc
size_t nCount = pRanges->size();
for (size_t i = 0; i < nCount; ++i )
{
@@ -2252,7 +2252,7 @@ void ScUndoBorder::Redo()
aMark.SetMarkArea( aRange );
aMark.SelectTable( nTab, true );
- pDoc->ApplySelectionFrame( aMark, pOuter, pInner );
+ rDoc.ApplySelectionFrame( aMark, pOuter, pInner );
}
for (size_t i = 0; i < nCount; ++i)
pDocShell->PostPaint( *(*pRanges)[i], PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index 674f9bb62f23..071198b43d7e 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -53,7 +53,7 @@ ScUndoWidthOrHeight::ScUndoWidthOrHeight( ScDocShell* pNewDocShell,
eMode( eNewMode ),
pDrawUndo( NULL )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoWidthOrHeight::~ScUndoWidthOrHeight()
@@ -81,7 +81,7 @@ void ScUndoWidthOrHeight::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOLROW nPaintStart = nStart > 0 ? nStart-1 : static_cast<SCCOLROW>(0);
@@ -93,9 +93,9 @@ void ScUndoWidthOrHeight::Undo()
//! outlines from all tables?
if (pUndoTab) // Outlines are included when saving ?
- pDoc->SetOutlineTable( nStartTab, pUndoTab );
+ rDoc.SetOutlineTable( nStartTab, pUndoTab );
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
@@ -103,27 +103,27 @@ void ScUndoWidthOrHeight::Undo()
{
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, *itr,
static_cast<SCCOL>(nEnd), MAXROW, *itr, IDF_NONE,
- false, pDoc );
- pDoc->UpdatePageBreaks( *itr );
+ false, &rDoc );
+ rDoc.UpdatePageBreaks( *itr );
pDocShell->PostPaint( static_cast<SCCOL>(nPaintStart), 0, *itr,
MAXCOL, MAXROW, *itr, PAINT_GRID | PAINT_TOP );
}
else // Height
{
- pUndoDoc->CopyToDocument( 0, nStart, *itr, MAXCOL, nEnd, *itr, IDF_NONE, false, pDoc );
- pDoc->UpdatePageBreaks( *itr );
+ pUndoDoc->CopyToDocument( 0, nStart, *itr, MAXCOL, nEnd, *itr, IDF_NONE, false, &rDoc );
+ rDoc.UpdatePageBreaks( *itr );
pDocShell->PostPaint( 0, nPaintStart, *itr, MAXCOL, MAXROW, *itr, PAINT_GRID | PAINT_LEFT );
}
}
- DoSdrUndoAction( pDrawUndo, pDoc );
+ DoSdrUndoAction( pDrawUndo, &rDoc );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
pViewShell->UpdateScrollBars();
- SCTAB nCurrentTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nCurrentTab = pViewShell->GetViewData().GetTabNo();
if ( nCurrentTab < nStartTab || nCurrentTab > nEndTab )
pViewShell->SetTabNo( nStartTab );
}
@@ -145,7 +145,7 @@ void ScUndoWidthOrHeight::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
if ( nTab < nStartTab || nTab > nEndTab )
pViewShell->SetTabNo( nStartTab );
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 736d140c5b0d..e80c5265969b 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -87,7 +87,7 @@ ScUndoDeleteContents::ScUndoDeleteContents(
bMulti ( bNewMulti ) // unnecessary
{
if (bObjects)
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
if ( !(aMarkData.IsMarked() || aMarkData.IsMultiMarked()) ) // if no cell is selected:
aMarkData.SetMarkArea( aRange ); // select cell under cursor
@@ -113,7 +113,7 @@ void ScUndoDeleteContents::SetDataSpans( const boost::shared_ptr<DataSpansType>&
void ScUndoDeleteContents::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
pChangeTrack->AppendContentRange( aRange, pUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -123,7 +123,7 @@ void ScUndoDeleteContents::SetChangeTrack()
void ScUndoDeleteContents::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SetViewMarkData( aMarkData );
@@ -142,15 +142,15 @@ void ScUndoDeleteContents::DoChange( const bool bUndo )
nUndoFlags |= IDF_NOCAPTIONS;
ScRange aCopyRange = aRange;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, bMulti, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, bMulti, &rDoc, &aMarkData );
- DoSdrUndoAction( pDrawUndo, pDoc );
+ DoSdrUndoAction( pDrawUndo, &rDoc );
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -164,7 +164,7 @@ void ScUndoDeleteContents::DoChange( const bool bUndo )
RedoSdrUndoAction( pDrawUndo );
// do not delete objects and note captions, they have been removed via drawing undo
sal_uInt16 nRedoFlags = (nFlags & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
- pDoc->DeleteSelection( nRedoFlags, aMarkData );
+ rDoc.DeleteSelection( nRedoFlags, aMarkData );
aMarkData.MarkToSimple();
SetChangeTrack();
@@ -256,10 +256,10 @@ OUString ScUndoFillTable::GetComment() const
void ScUndoFillTable::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
- SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
+ SCTAB nTabCount = pDocShell->GetDocument().GetTableCount();
ScRange aWorkRange(aRange);
nStartChangeAction = 0;
sal_uLong nTmpAction;
@@ -283,13 +283,13 @@ void ScUndoFillTable::SetChangeTrack()
void ScUndoFillTable::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SetViewMarkData( aMarkData );
if (bUndo) // only Undo
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aWorkRange(aRange);
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
@@ -298,20 +298,20 @@ void ScUndoFillTable::DoChange( const bool bUndo )
aWorkRange.aStart.SetTab(*itr);
aWorkRange.aEnd.SetTab(*itr);
if (bMulti)
- pDoc->DeleteSelectionTab( *itr, IDF_ALL, aMarkData );
+ rDoc.DeleteSelectionTab( *itr, IDF_ALL, aMarkData );
else
- pDoc->DeleteAreaTab( aWorkRange, IDF_ALL );
- pUndoDoc->CopyToDocument( aWorkRange, IDF_ALL, bMulti, pDoc, &aMarkData );
+ rDoc.DeleteAreaTab( aWorkRange, IDF_ALL );
+ pUndoDoc->CopyToDocument( aWorkRange, IDF_ALL, bMulti, &rDoc, &aMarkData );
}
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
}
else // only Redo
{
aMarkData.MarkToMulti();
- pDoc->FillTabMarked( nSrcTab, aMarkData, nFlags, nFunction, bSkipEmpty, bAsLink );
+ rDoc.FillTabMarked( nSrcTab, aMarkData, nFlags, nFunction, bSkipEmpty, bAsLink );
aMarkData.MarkToSimple();
SetChangeTrack();
}
@@ -324,7 +324,7 @@ void ScUndoFillTable::DoChange( const bool bUndo )
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
if ( !aMarkData.GetTableSelect(nTab) )
pViewShell->SetTabNo( nSrcTab );
@@ -371,7 +371,7 @@ ScUndoSelectionAttr::ScUndoSelectionAttr( ScDocShell* pNewDocShell,
pUndoDoc ( pNewUndoDoc ),
bMulti ( bNewMulti )
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pApplyPattern = (ScPatternAttr*) &pPool->Put( *pNewApply );
pLineOuter = pNewOuter ? (SvxBoxItem*) &pPool->Put( *pNewOuter ) : NULL;
pLineInner = pNewInner ? (SvxBoxInfoItem*) &pPool->Put( *pNewInner ) : NULL;
@@ -379,7 +379,7 @@ ScUndoSelectionAttr::ScUndoSelectionAttr( ScDocShell* pNewDocShell,
ScUndoSelectionAttr::~ScUndoSelectionAttr()
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pPool->Remove(*pApplyPattern);
if (pLineOuter)
pPool->Remove(*pLineOuter);
@@ -402,13 +402,13 @@ ScEditDataArray* ScUndoSelectionAttr::GetDataArray()
void ScUndoSelectionAttr::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SetViewMarkData( aMarkData );
ScRange aEffRange( aRange );
- if ( pDoc->HasAttrib( aEffRange, HASATTR_MERGED ) ) // merged cells?
- pDoc->ExtendMerge( aEffRange );
+ if ( rDoc.HasAttrib( aEffRange, HASATTR_MERGED ) ) // merged cells?
+ rDoc.ExtendMerge( aEffRange );
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aEffRange );
@@ -418,19 +418,19 @@ void ScUndoSelectionAttr::DoChange( const bool bUndo )
if (bUndo) // only for Undo
{
ScRange aCopyRange = aRange;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, &rDoc, &aMarkData );
}
else // only for Redo
{
aMarkData.MarkToMulti();
- pDoc->ApplySelectionPattern( *pApplyPattern, aMarkData );
+ rDoc.ApplySelectionPattern( *pApplyPattern, aMarkData );
aMarkData.MarkToSimple();
if (pLineOuter)
- pDoc->ApplySelectionFrame( aMarkData, pLineOuter, pLineInner );
+ rDoc.ApplySelectionFrame( aMarkData, pLineOuter, pLineInner );
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -442,26 +442,26 @@ void ScUndoSelectionAttr::DoChange( const bool bUndo )
void ScUndoSelectionAttr::ChangeEditData( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (const ScEditDataArray::Item* pItem = mpDataArray->First(); pItem; pItem = mpDataArray->Next())
{
ScAddress aPos(pItem->GetCol(), pItem->GetRow(), pItem->GetTab());
- if (pDoc->GetCellType(aPos) != CELLTYPE_EDIT)
+ if (rDoc.GetCellType(aPos) != CELLTYPE_EDIT)
continue;
if (bUndo)
{
if (pItem->GetOldData())
- pDoc->SetEditText(aPos, *pItem->GetOldData(), NULL);
+ rDoc.SetEditText(aPos, *pItem->GetOldData(), NULL);
else
- pDoc->SetEmptyCell(aPos);
+ rDoc.SetEmptyCell(aPos);
}
else
{
if (pItem->GetNewData())
- pDoc->SetEditText(aPos, *pItem->GetNewData(), NULL);
+ rDoc.SetEditText(aPos, *pItem->GetNewData(), NULL);
else
- pDoc->SetEmptyCell(aPos);
+ rDoc.SetEmptyCell(aPos);
}
}
}
@@ -528,7 +528,7 @@ OUString ScUndoAutoFill::GetComment() const
void ScUndoAutoFill::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -540,9 +540,9 @@ void ScUndoAutoFill::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
@@ -552,10 +552,10 @@ void ScUndoAutoFill::Undo()
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
- pDoc->DeleteAreaTab( aWorkRange, IDF_AUTOFILL );
- pUndoDoc->CopyToDocument( aWorkRange, IDF_AUTOFILL, false, pDoc );
+ rDoc.DeleteAreaTab( aWorkRange, IDF_AUTOFILL );
+ pUndoDoc->CopyToDocument( aWorkRange, IDF_AUTOFILL, false, &rDoc );
- pDoc->ExtendMerge( aWorkRange, true );
+ rDoc.ExtendMerge( aWorkRange, true );
pDocShell->PostPaint( aWorkRange, PAINT_GRID, nExtFlags );
}
pDocShell->PostDataChanged();
@@ -563,7 +563,7 @@ void ScUndoAutoFill::Undo()
if (pViewShell)
pViewShell->CellContentChanged();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -593,13 +593,13 @@ void ScUndoAutoFill::Redo()
break;
}
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if ( fStartValue != MAXDOUBLE )
{
SCCOL nValX = (eFillDir == FILL_TO_LEFT) ? aSource.aEnd.Col() : aSource.aStart.Col();
SCROW nValY = (eFillDir == FILL_TO_TOP ) ? aSource.aEnd.Row() : aSource.aStart.Row();
SCTAB nTab = aSource.aStart.Tab();
- pDoc->SetValue( nValX, nValY, nTab, fStartValue );
+ rDoc.SetValue( nValX, nValY, nTab, fStartValue );
}
sal_uLong nProgCount;
if (eFillDir == FILL_TO_BOTTOM || eFillDir == FILL_TO_TOP)
@@ -607,10 +607,10 @@ void ScUndoAutoFill::Redo()
else
nProgCount = aSource.aEnd.Row() - aSource.aStart.Row() + 1;
nProgCount *= nCount;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aSource.aStart.Col(), aSource.aStart.Row(),
+ rDoc.Fill( aSource.aStart.Col(), aSource.aStart.Row(),
aSource.aEnd.Col(), aSource.aEnd.Row(), &aProgress,
aMarkData, nCount,
eFillDir, eFillCmd, eFillDateCmd,
@@ -674,7 +674,7 @@ void ScUndoMerge::DoChange( bool bUndo ) const
// Nothing to do.
return;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
ScRange aCurRange = maOption.getSingleRange(ScDocShell::GetCurTab());
@@ -688,20 +688,20 @@ void ScUndoMerge::DoChange( bool bUndo ) const
if (bUndo)
// remove merge (contents are copied back below from undo document)
- pDoc->RemoveMerge( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab() );
+ rDoc.RemoveMerge( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab() );
else
{
// repeat merge, but do not remove note captions (will be done by drawing redo below)
- pDoc->DoMerge( aRange.aStart.Tab(),
+ rDoc.DoMerge( aRange.aStart.Tab(),
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(), false );
if (maOption.mbCenter)
{
- pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(),
SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
- pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(),
SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) );
}
@@ -710,20 +710,20 @@ void ScUndoMerge::DoChange( bool bUndo ) const
// undo -> copy back deleted contents
if (bUndo && mpUndoDoc)
{
- pDoc->DeleteAreaTab( aRange, IDF_CONTENTS|IDF_NOCAPTIONS );
- mpUndoDoc->CopyToDocument( aRange, IDF_ALL|IDF_NOCAPTIONS, false, pDoc );
+ rDoc.DeleteAreaTab( aRange, IDF_CONTENTS|IDF_NOCAPTIONS );
+ mpUndoDoc->CopyToDocument( aRange, IDF_ALL|IDF_NOCAPTIONS, false, &rDoc );
}
// redo -> merge contents again
else if (!bUndo && mbMergeContents)
{
- pDoc->DoMergeContents( aRange.aStart.Tab(),
+ rDoc.DoMergeContents( aRange.aStart.Tab(),
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row() );
}
if (bUndo)
- DoSdrUndoAction( mpDrawUndo, pDoc );
+ DoSdrUndoAction( mpDrawUndo, &rDoc );
else
RedoSdrUndoAction( mpDrawUndo );
@@ -795,16 +795,16 @@ void ScUndoAutoFormat::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
- pDoc->DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
+ SCTAB nTabCount = rDoc.GetTableCount();
+ rDoc.DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(),
aMarkData, IDF_ATTRIB );
ScRange aCopyRange = aBlockRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, false, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, false, &rDoc, &aMarkData );
// cell heights and widths (IDF_NONE)
if (bSize)
@@ -817,9 +817,9 @@ void ScUndoAutoFormat::Undo()
SCTAB nEndZ = aBlockRange.aEnd.Tab();
pUndoDoc->CopyToDocument( nStartX, 0, 0, nEndX, MAXROW, nTabCount-1,
- IDF_NONE, false, pDoc, &aMarkData );
+ IDF_NONE, false, &rDoc, &aMarkData );
pUndoDoc->CopyToDocument( 0, nStartY, 0, MAXCOL, nEndY, nTabCount-1,
- IDF_NONE, false, pDoc, &aMarkData );
+ IDF_NONE, false, &rDoc, &aMarkData );
pDocShell->PostPaint( 0, 0, nStartZ, MAXCOL, MAXROW, nEndZ,
PAINT_GRID | PAINT_LEFT | PAINT_TOP, SC_PF_LINES );
}
@@ -833,7 +833,7 @@ void ScUndoAutoFormat::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nStartX = aBlockRange.aStart.Col();
SCROW nStartY = aBlockRange.aStart.Row();
@@ -842,7 +842,7 @@ void ScUndoAutoFormat::Redo()
SCROW nEndY = aBlockRange.aEnd.Row();
SCTAB nEndZ = aBlockRange.aEnd.Tab();
- pDoc->AutoFormat( nStartX, nStartY, nEndX, nEndY, nFormatNo, aMarkData );
+ rDoc.AutoFormat( nStartX, nStartY, nEndX, nEndY, nFormatNo, aMarkData );
if (bSize)
{
@@ -853,11 +853,11 @@ void ScUndoAutoFormat::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- ScViewData* pData = pViewShell->GetViewData();
- nPPTX = pData->GetPPTX();
- nPPTY = pData->GetPPTY();
- aZoomX = pData->GetZoomX();
- aZoomY = pData->GetZoomY();
+ ScViewData& rData = pViewShell->GetViewData();
+ nPPTX = rData.GetPPTX();
+ nPPTY = rData.GetPPTY();
+ aZoomX = rData.GetZoomX();
+ aZoomY = rData.GetZoomY();
}
else
{
@@ -879,22 +879,22 @@ void ScUndoAutoFormat::Redo()
// as SC_SIZE_VISOPT
for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
{
- sal_uInt8 nOld = pDoc->GetRowFlags(nRow,nTab);
- bool bHidden = pDoc->RowHidden(nRow, nTab);
+ sal_uInt8 nOld = rDoc.GetRowFlags(nRow,nTab);
+ bool bHidden = rDoc.RowHidden(nRow, nTab);
if ( !bHidden && ( nOld & CR_MANUALSIZE ) )
- pDoc->SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
+ rDoc.SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
}
- pDoc->SetOptimalHeight(aCxt, nStartY, nEndY, nTab);
+ rDoc.SetOptimalHeight(aCxt, nStartY, nEndY, nTab);
for (SCCOL nCol=nStartX; nCol<=nEndX; nCol++)
- if (!pDoc->ColHidden(nCol, nTab))
+ if (!rDoc.ColHidden(nCol, nTab))
{
- sal_uInt16 nThisSize = STD_EXTRA_WIDTH + pDoc->GetOptimalColWidth( nCol, nTab,
+ sal_uInt16 nThisSize = STD_EXTRA_WIDTH + rDoc.GetOptimalColWidth( nCol, nTab,
&aVirtDev, nPPTX, nPPTY, aZoomX, aZoomY, bFormula,
&aDestMark );
- pDoc->SetColWidth( nCol, nTab, nThisSize );
- pDoc->ShowCol( nCol, nTab, true );
+ rDoc.SetColWidth( nCol, nTab, nThisSize );
+ rDoc.ShowCol( nCol, nTab, true );
}
}
@@ -941,8 +941,8 @@ ScUndoReplace::~ScUndoReplace()
void ScUndoReplace::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
{
if ( pUndoDoc )
@@ -957,9 +957,9 @@ void ScUndoReplace::SetChangeTrack()
ScChangeActionContent* pContent = new ScChangeActionContent(
ScRange( aCursorPos) );
ScCellValue aCell;
- aCell.assign(*pDoc, aCursorPos);
- pContent->SetOldValue( aUndoStr, pDoc );
- pContent->SetNewValue(aCell, pDoc);
+ aCell.assign(rDoc, aCursorPos);
+ pContent->SetOldValue( aUndoStr, &rDoc );
+ pContent->SetNewValue(aCell, &rDoc);
pChangeTrack->Append( pContent );
nEndChangeAction = pChangeTrack->GetActionMax();
}
@@ -977,7 +977,7 @@ void ScUndoReplace::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
ShowTable( aCursorPos.Tab() );
@@ -998,7 +998,7 @@ void ScUndoReplace::Undo()
sal_uInt16 nUndoFlags = (pSearchItem->GetPattern()) ? IDF_ATTRIB : IDF_CONTENTS;
pUndoDoc->CopyToDocument( 0, 0, 0,
MAXCOL, MAXROW, MAXTAB,
- nUndoFlags, false, pDoc, NULL, false ); // without row flags
+ nUndoFlags, false, &rDoc, NULL, false ); // without row flags
pDocShell->PostPaintGridAll();
}
else if (pSearchItem->GetPattern() &&
@@ -1007,7 +1007,7 @@ void ScUndoReplace::Undo()
OUString aTempStr = pSearchItem->GetSearchString(); // toggle
pSearchItem->SetSearchString(pSearchItem->GetReplaceString());
pSearchItem->SetReplaceString(aTempStr);
- pDoc->ReplaceStyle( *pSearchItem,
+ rDoc.ReplaceStyle( *pSearchItem,
aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(),
aMarkData, true);
pSearchItem->SetReplaceString(pSearchItem->GetSearchString());
@@ -1019,7 +1019,7 @@ void ScUndoReplace::Undo()
}
else if (pSearchItem->GetCellType() == SVX_SEARCHIN_NOTE)
{
- ScPostIt* pNote = pDoc->GetNote(aCursorPos);
+ ScPostIt* pNote = rDoc.GetNote(aCursorPos);
OSL_ENSURE( pNote, "ScUndoReplace::Undo - cell does not contain a note" );
if (pNote)
pNote->SetText( aCursorPos, aUndoStr );
@@ -1032,19 +1032,19 @@ void ScUndoReplace::Undo()
// aUndoStr may contain line breaks
if ( aUndoStr.indexOf('\n') != -1 )
{
- ScFieldEditEngine& rEngine = pDoc->GetEditEngine();
+ ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
rEngine.SetText(aUndoStr);
- pDoc->SetEditText(aCursorPos, rEngine.CreateTextObject());
+ rDoc.SetEditText(aCursorPos, rEngine.CreateTextObject());
}
else
- pDoc->SetString( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aUndoStr );
+ rDoc.SetString( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aUndoStr );
if (pViewShell)
pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
SC_FOLLOW_JUMP, false, false );
pDocShell->PostPaintGridAll();
}
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -1055,7 +1055,7 @@ void ScUndoReplace::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -1073,7 +1073,7 @@ void ScUndoReplace::Redo()
else if (pSearchItem->GetPattern() &&
pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE)
{
- pDoc->ReplaceStyle( *pSearchItem,
+ rDoc.ReplaceStyle( *pSearchItem,
aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(),
aMarkData, true);
pDocShell->PostPaintGridAll();
@@ -1137,9 +1137,9 @@ void ScUndoTabOp::Undo()
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aRange );
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aRange,IDF_ALL & ~IDF_NOTE );
- pUndoDoc->CopyToDocument( aRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.DeleteAreaTab( aRange,IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
pDocShell->PostPaint( aRange, PAINT_GRID, nExtFlags );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1197,8 +1197,8 @@ ScUndoConversion::~ScUndoConversion()
void ScUndoConversion::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
{
if ( pUndoDoc )
@@ -1231,18 +1231,18 @@ void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPo
{
if (pRefDoc)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ShowTable( rCursorPos.Tab() );
SetViewMarkData( aMarkData );
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
// Undo/Redo-doc has only selected tables
bool bMulti = aMarkData.IsMultiMarked();
pRefDoc->CopyToDocument( 0, 0, 0,
MAXCOL, MAXROW, nTabCount-1,
- IDF_CONTENTS, bMulti, pDoc, &aMarkData );
+ IDF_CONTENTS, bMulti, &rDoc, &aMarkData );
pDocShell->PostPaintGridAll();
}
else
@@ -1255,7 +1255,7 @@ void ScUndoConversion::Undo()
{
BeginUndo();
DoChange( pUndoDoc, aCursorPos );
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
EndUndo();
@@ -1307,7 +1307,7 @@ OUString ScUndoRefConversion::GetComment() const
void ScUndoRefConversion::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_FORMULA) )
pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -1317,17 +1317,17 @@ void ScUndoRefConversion::SetChangeTrack()
void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ShowTable(aRange);
SetViewMarkData( aMarkData );
ScRange aCopyRange = aRange;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, pDoc, &aMarkData );
+ pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, &rDoc, &aMarkData );
pDocShell->PostPaint( aRange, PAINT_GRID);
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1340,7 +1340,7 @@ void ScUndoRefConversion::Undo()
BeginUndo();
if (pUndoDoc)
DoChange(pUndoDoc);
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
EndUndo();
@@ -1394,8 +1394,8 @@ void ScUndoRefreshLink::Undo()
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
bool bFirst = true;
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
if (pUndoDoc->HasTable(nTab))
{
@@ -1403,28 +1403,28 @@ void ScUndoRefreshLink::Undo()
if (bMakeRedo)
{
if (bFirst)
- pRedoDoc->InitUndo( pDoc, nTab, nTab, true, true );
+ pRedoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
else
pRedoDoc->AddUndoTab( nTab, nTab, true, true );
bFirst = false;
- pDoc->CopyToDocument(aRange, IDF_ALL, false, pRedoDoc);
+ rDoc.CopyToDocument(aRange, IDF_ALL, false, pRedoDoc);
pRedoDoc->SetLink( nTab,
- pDoc->GetLinkMode(nTab),
- pDoc->GetLinkDoc(nTab),
- pDoc->GetLinkFlt(nTab),
- pDoc->GetLinkOpt(nTab),
- pDoc->GetLinkTab(nTab),
- pDoc->GetLinkRefreshDelay(nTab) );
- pRedoDoc->SetTabBgColor( nTab, pDoc->GetTabBgColor(nTab) );
+ rDoc.GetLinkMode(nTab),
+ rDoc.GetLinkDoc(nTab),
+ rDoc.GetLinkFlt(nTab),
+ rDoc.GetLinkOpt(nTab),
+ rDoc.GetLinkTab(nTab),
+ rDoc.GetLinkRefreshDelay(nTab) );
+ pRedoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
}
- pDoc->DeleteAreaTab( aRange,IDF_ALL );
- pUndoDoc->CopyToDocument( aRange, IDF_ALL, false, pDoc );
- pDoc->SetLink( nTab, pUndoDoc->GetLinkMode(nTab), pUndoDoc->GetLinkDoc(nTab),
+ rDoc.DeleteAreaTab( aRange,IDF_ALL );
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL, false, &rDoc );
+ rDoc.SetLink( nTab, pUndoDoc->GetLinkMode(nTab), pUndoDoc->GetLinkDoc(nTab),
pUndoDoc->GetLinkFlt(nTab), pUndoDoc->GetLinkOpt(nTab),
pUndoDoc->GetLinkTab(nTab),
pUndoDoc->GetLinkRefreshDelay(nTab) );
- pDoc->SetTabBgColor( nTab, pUndoDoc->GetTabBgColor(nTab) );
+ rDoc.SetTabBgColor( nTab, pUndoDoc->GetTabBgColor(nTab) );
}
pDocShell->PostPaintGridAll();
@@ -1439,23 +1439,23 @@ void ScUndoRefreshLink::Redo()
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
if (pRedoDoc->HasTable(nTab))
{
ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
- pDoc->DeleteAreaTab( aRange, IDF_ALL );
- pRedoDoc->CopyToDocument( aRange, IDF_ALL, false, pDoc );
- pDoc->SetLink( nTab,
+ rDoc.DeleteAreaTab( aRange, IDF_ALL );
+ pRedoDoc->CopyToDocument( aRange, IDF_ALL, false, &rDoc );
+ rDoc.SetLink( nTab,
pRedoDoc->GetLinkMode(nTab),
pRedoDoc->GetLinkDoc(nTab),
pRedoDoc->GetLinkFlt(nTab),
pRedoDoc->GetLinkOpt(nTab),
pRedoDoc->GetLinkTab(nTab),
pRedoDoc->GetLinkRefreshDelay(nTab) );
- pDoc->SetTabBgColor( nTab, pRedoDoc->GetTabBgColor(nTab) );
+ rDoc.SetTabBgColor( nTab, pRedoDoc->GetTabBgColor(nTab) );
}
pDocShell->PostPaintGridAll();
@@ -1518,8 +1518,8 @@ OUString ScUndoInsertAreaLink::GetComment() const
void ScUndoInsertAreaLink::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aDocName, aFltName, aOptions,
aAreaName, aRange );
@@ -1531,8 +1531,8 @@ void ScUndoInsertAreaLink::Undo()
void ScUndoInsertAreaLink::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = new ScAreaLink( pDocShell, aDocName, aFltName, aOptions,
aAreaName, aRange.aStart, nRefreshDelay );
@@ -1580,8 +1580,8 @@ OUString ScUndoRemoveAreaLink::GetComment() const
void ScUndoRemoveAreaLink::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = new ScAreaLink( pDocShell, aDocName, aFltName, aOptions,
aAreaName, aRange.aStart, nRefreshDelay );
@@ -1596,8 +1596,8 @@ void ScUndoRemoveAreaLink::Undo()
void ScUndoRemoveAreaLink::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aDocName, aFltName, aOptions,
aAreaName, aRange );
@@ -1656,7 +1656,7 @@ OUString ScUndoUpdateAreaLink::GetComment() const
void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nEndX = std::max( aOldRange.aEnd.Col(), aNewRange.aEnd.Col() );
SCROW nEndY = std::max( aOldRange.aEnd.Row(), aNewRange.aEnd.Row() );
@@ -1666,35 +1666,35 @@ void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
{
if ( bWithInsert )
{
- pDoc->FitBlock( aNewRange, aOldRange );
- pDoc->DeleteAreaTab( aOldRange, IDF_ALL & ~IDF_NOTE );
- pUndoDoc->UndoToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.FitBlock( aNewRange, aOldRange );
+ rDoc.DeleteAreaTab( aOldRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->UndoToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
else
{
ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
- pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
}
else
{
if ( bWithInsert )
{
- pDoc->FitBlock( aOldRange, aNewRange );
- pDoc->DeleteAreaTab( aNewRange, IDF_ALL & ~IDF_NOTE );
- pRedoDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.FitBlock( aOldRange, aNewRange );
+ rDoc.DeleteAreaTab( aNewRange, IDF_ALL & ~IDF_NOTE );
+ pRedoDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
else
{
ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
- pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
- pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
+ pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
}
ScRange aWorkRange( aNewRange.aStart, ScAddress( nEndX, nEndY, nEndZ ) );
- pDoc->ExtendMerge( aWorkRange, true );
+ rDoc.ExtendMerge( aWorkRange, true );
// Paint
@@ -1714,8 +1714,8 @@ void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
void ScUndoUpdateAreaLink::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aNewDoc, aNewFlt, aNewOpt,
aNewArea, aNewRange );
if (pLink)
@@ -1730,8 +1730,8 @@ void ScUndoUpdateAreaLink::Undo()
void ScUndoUpdateAreaLink::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aOldDoc, aOldFlt, aOldOpt,
aOldArea, aOldRange );
if (pLink)
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 1119a9ee5024..aa8497870598 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -49,7 +49,7 @@ using ::boost::shared_ptr;
namespace HelperNotifyChanges
{
- void NotifyIfChangesListeners(ScDocShell &rDocShell, const ScAddress &rPos,
+ void NotifyIfChangesListeners(ScDocShell& rDocShell, const ScAddress &rPos,
const ScUndoEnterData::ValuesType &rOldValues, const OUString &rType = OUString("cell-change"))
{
if (ScModelObj* pModelObj = getMustPropagateChangesModel(rDocShell))
@@ -90,7 +90,7 @@ ScUndoCursorAttr::ScUndoCursorAttr( ScDocShell* pNewDocShell,
pNewEditData( static_cast<EditTextObject*>(NULL) ),
bIsAutomatic( bAutomatic )
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pNewPattern = (ScPatternAttr*) &pPool->Put( *pNewPat );
pOldPattern = (ScPatternAttr*) &pPool->Put( *pOldPat );
pApplyPattern = (ScPatternAttr*) &pPool->Put( *pApplyPat );
@@ -98,7 +98,7 @@ ScUndoCursorAttr::ScUndoCursorAttr( ScDocShell* pNewDocShell,
ScUndoCursorAttr::~ScUndoCursorAttr()
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pPool->Remove(*pNewPattern);
pPool->Remove(*pOldPattern);
pPool->Remove(*pApplyPattern);
@@ -120,12 +120,12 @@ void ScUndoCursorAttr::SetEditData( EditTextObject* pOld, EditTextObject* pNew )
void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern, const shared_ptr<EditTextObject>& pEditData ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScAddress aPos(nCol, nRow, nTab);
- pDoc->SetPattern( nCol, nRow, nTab, *pWhichPattern, true );
+ rDoc.SetPattern( nCol, nRow, nTab, *pWhichPattern, true );
- if (pDoc->GetCellType(aPos) == CELLTYPE_EDIT && pEditData)
- pDoc->SetEditText(aPos, *pEditData, NULL);
+ if (rDoc.GetCellType(aPos) == CELLTYPE_EDIT && pEditData)
+ rDoc.SetEditText(aPos, *pEditData, NULL);
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -225,7 +225,7 @@ void ScUndoEnterData::DoChange() const
void ScUndoEnterData::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
mnEndChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -249,29 +249,29 @@ void ScUndoEnterData::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (size_t i = 0, n = maOldValues.size(); i < n; ++i)
{
Value& rVal = maOldValues[i];
ScCellValue aNewCell;
- aNewCell.assign(rVal.maCell, *pDoc, SC_CLONECELL_STARTLISTENING);
+ aNewCell.assign(rVal.maCell, rDoc, SC_CLONECELL_STARTLISTENING);
ScAddress aPos = maPos;
aPos.SetTab(rVal.mnTab);
- aNewCell.release(*pDoc, aPos);
+ aNewCell.release(rDoc, aPos);
if (rVal.mbHasFormat)
- pDoc->ApplyAttr(maPos.Col(), maPos.Row(), rVal.mnTab,
+ rDoc.ApplyAttr(maPos.Col(), maPos.Row(), rVal.mnTab,
SfxUInt32Item(ATTR_VALUE_FORMAT, rVal.mnFormat));
else
{
- ScPatternAttr aPattern(*pDoc->GetPattern(maPos.Col(), maPos.Row(), rVal.mnTab));
+ ScPatternAttr aPattern(*rDoc.GetPattern(maPos.Col(), maPos.Row(), rVal.mnTab));
aPattern.GetItemSet().ClearItem( ATTR_VALUE_FORMAT );
- pDoc->SetPattern(maPos.Col(), maPos.Row(), rVal.mnTab, aPattern, true);
+ rDoc.SetPattern(maPos.Col(), maPos.Row(), rVal.mnTab, aPattern, true);
}
pDocShell->PostPaintCell(maPos.Col(), maPos.Row(), rVal.mnTab);
}
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
size_t nCount = maOldValues.size();
if ( pChangeTrack && mnEndChangeAction >= sal::static_int_cast<sal_uLong>(nCount) )
pChangeTrack->Undo( mnEndChangeAction - nCount + 1, mnEndChangeAction );
@@ -286,7 +286,7 @@ void ScUndoEnterData::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (size_t i = 0, n = maOldValues.size(); i < n; ++i)
{
SCTAB nTab = maOldValues[i].mnTab;
@@ -295,10 +295,10 @@ void ScUndoEnterData::Redo()
ScAddress aPos = maPos;
aPos.SetTab(nTab);
// edit text wil be cloned.
- pDoc->SetEditText(aPos, *mpNewEditData, NULL);
+ rDoc.SetEditText(aPos, *mpNewEditData, NULL);
}
else
- pDoc->SetString(maPos.Col(), maPos.Row(), nTab, maNewString);
+ rDoc.SetString(maPos.Col(), maPos.Row(), nTab, maNewString);
pDocShell->PostPaintCell(maPos.Col(), maPos.Row(), nTab);
}
@@ -348,8 +348,8 @@ OUString ScUndoEnterValue::GetComment() const
void ScUndoEnterValue::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
{
nEndChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -365,14 +365,14 @@ void ScUndoEnterValue::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScCellValue aNewCell;
- aNewCell.assign(maOldCell, *pDoc, SC_CLONECELL_STARTLISTENING);
- aNewCell.release(*pDoc, aPos);
+ aNewCell.assign(maOldCell, rDoc, SC_CLONECELL_STARTLISTENING);
+ aNewCell.release(rDoc, aPos);
pDocShell->PostPaintCell( aPos );
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
@@ -383,8 +383,8 @@ void ScUndoEnterValue::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
pDocShell->PostPaintCell( aPos );
SetChangeTrack();
@@ -416,8 +416,8 @@ void ScUndoSetCell::Undo()
SetValue(maOldValue);
pDocShell->PostPaintCell(maPos);
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if (pChangeTrack)
pChangeTrack->Undo(mnEndChangeAction, mnEndChangeAction);
@@ -450,8 +450,8 @@ OUString ScUndoSetCell::GetComment() const
void ScUndoSetCell::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if (pChangeTrack)
{
mnEndChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -467,29 +467,29 @@ void ScUndoSetCell::SetChangeTrack()
void ScUndoSetCell::SetValue( const ScCellValue& rVal )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
switch (rVal.meType)
{
case CELLTYPE_NONE:
// empty cell
- pDoc->SetEmptyCell(maPos);
+ rDoc.SetEmptyCell(maPos);
break;
case CELLTYPE_VALUE:
- pDoc->SetValue(maPos, rVal.mfValue);
+ rDoc.SetValue(maPos, rVal.mfValue);
break;
case CELLTYPE_STRING:
{
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(maPos, rVal.mpString->getString());
+ rDoc.SetString(maPos, rVal.mpString->getString());
}
break;
case CELLTYPE_EDIT:
- pDoc->SetEditText(maPos, rVal.mpEditText->Clone());
+ rDoc.SetEditText(maPos, rVal.mpEditText->Clone());
break;
case CELLTYPE_FORMULA:
- pDoc->SetFormulaCell(maPos, rVal.mpFormula->Clone());
+ rDoc.SetFormulaCell(maPos, rVal.mpFormula->Clone());
break;
default:
;
@@ -540,7 +540,7 @@ void ScUndoPageBreak::DoChange( bool bInsertP ) const
else
pViewShell->DeletePageBreak(bColumn, false);
- pDocShell->GetDocument()->InvalidatePageBreaks(nTab);
+ pDocShell->GetDocument().InvalidatePageBreaks(nTab);
}
}
@@ -601,9 +601,9 @@ void ScUndoPrintZoom::DoChange( bool bUndo )
sal_uInt16 nScale = bUndo ? nOldScale : nNewScale;
sal_uInt16 nPages = bUndo ? nOldPages : nNewPages;
- ScDocument* pDoc = pDocShell->GetDocument();
- OUString aStyleName = pDoc->GetPageStyle( nTab );
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ OUString aStyleName = rDoc.GetPageStyle( nTab );
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SFX_STYLE_FAMILY_PAGE );
OSL_ENSURE( pStyleSheet, "PageStyle not found" );
if ( pStyleSheet )
@@ -636,8 +636,8 @@ void ScUndoPrintZoom::Repeat(SfxRepeatTarget& rTarget)
if (rTarget.ISA(ScTabViewTarget))
{
ScTabViewShell& rViewShell = *((ScTabViewTarget&)rTarget).GetViewShell();
- ScViewData* pViewData = rViewShell.GetViewData();
- pViewData->GetDocShell()->SetPrintZoom( pViewData->GetTabNo(), nNewScale, nNewPages );
+ ScViewData& rViewData = rViewShell.GetViewData();
+ rViewData.GetDocShell()->SetPrintZoom( rViewData.GetTabNo(), nNewScale, nNewPages );
}
}
@@ -668,7 +668,7 @@ OUString ScUndoThesaurus::GetComment() const
void ScUndoThesaurus::SetChangeTrack( const ScCellValue& rOldCell )
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
nEndChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -682,7 +682,7 @@ void ScUndoThesaurus::SetChangeTrack( const ScCellValue& rOldCell )
void ScUndoThesaurus::DoChange( bool bUndo, const ScCellValue& rText )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -692,7 +692,7 @@ void ScUndoThesaurus::DoChange( bool bUndo, const ScCellValue& rText )
}
ScAddress aPos(nCol, nRow, nTab);
- rText.commit(*pDoc, aPos);
+ rText.commit(rDoc, aPos);
if (!bUndo)
SetChangeTrack(maOldText);
@@ -703,7 +703,7 @@ void ScUndoThesaurus::Undo()
{
BeginUndo();
DoChange(true, maOldText);
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
EndUndo();
@@ -757,7 +757,7 @@ ScUndoReplaceNote::~ScUndoReplaceNote()
void ScUndoReplaceNote::Undo()
{
BeginUndo();
- DoSdrUndoAction( mpDrawUndo, pDocShell->GetDocument() );
+ DoSdrUndoAction( mpDrawUndo, &pDocShell->GetDocument() );
/* Undo insert -> remove new note.
Undo remove -> insert old note.
Undo replace -> remove new note, insert old note. */
@@ -799,7 +799,7 @@ void ScUndoReplaceNote::DoInsertNote( const ScNoteData& rNoteData )
{
if( rNoteData.mpCaption )
{
- ScDocument& rDoc = *pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OSL_ENSURE( !rDoc.GetNote(maPos), "ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
ScPostIt* pNote = new ScPostIt( rDoc, maPos, rNoteData, false );
rDoc.SetNote( maPos, pNote );
@@ -810,7 +810,7 @@ void ScUndoReplaceNote::DoRemoveNote( const ScNoteData& rNoteData )
{
if( rNoteData.mpCaption )
{
- ScDocument& rDoc = *pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OSL_ENSURE( rDoc.GetNote(maPos), "ScUndoReplaceNote::DoRemoveNote - missing cell note" );
if( ScPostIt* pNote = rDoc.ReleaseNote( maPos ) )
{
@@ -837,7 +837,7 @@ ScUndoShowHideNote::~ScUndoShowHideNote()
void ScUndoShowHideNote::Undo()
{
BeginUndo();
- if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote(maPos) )
+ if( ScPostIt* pNote = pDocShell->GetDocument().GetNote(maPos) )
pNote->ShowCaption( maPos, !mbShown );
EndUndo();
}
@@ -845,7 +845,7 @@ void ScUndoShowHideNote::Undo()
void ScUndoShowHideNote::Redo()
{
BeginRedo();
- if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote(maPos) )
+ if( ScPostIt* pNote = pDocShell->GetDocument().GetNote(maPos) )
pNote->ShowCaption( maPos, mbShown );
EndRedo();
}
@@ -906,19 +906,19 @@ void ScUndoDetective::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- DoSdrUndoAction(pDrawUndo, pDoc);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ DoSdrUndoAction(pDrawUndo, &rDoc);
if (bIsDelete)
{
if ( pOldList )
- pDoc->SetDetOpList( new ScDetOpList(*pOldList) );
+ rDoc.SetDetOpList( new ScDetOpList(*pOldList) );
}
else
{
// Remove entry from list
- ScDetOpList* pList = pDoc->GetDetOpList();
+ ScDetOpList* pList = rDoc.GetDetOpList();
if (pList && pList->Count())
{
ScDetOpDataVector& rVec = pList->GetDataVector();
@@ -945,12 +945,12 @@ void ScUndoDetective::Redo()
RedoSdrUndoAction(pDrawUndo);
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bIsDelete)
- pDoc->ClearDetectiveOperations();
+ rDoc.ClearDetectiveOperations();
else
- pDoc->AddDetectiveOperation( ScDetOpData( aPos, (ScDetOpType) nAction ) );
+ rDoc.AddDetectiveOperation( ScDetOpData( aPos, (ScDetOpType) nAction ) );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -991,25 +991,25 @@ OUString ScUndoRangeNames::GetComment() const
void ScUndoRangeNames::DoChange( bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->PreprocessRangeNameUpdate();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.PreprocessRangeNameUpdate();
if ( bUndo )
{
if (mnTab >= 0)
- pDoc->SetRangeName( mnTab, new ScRangeName( *pOldRanges ) );
+ rDoc.SetRangeName( mnTab, new ScRangeName( *pOldRanges ) );
else
- pDoc->SetRangeName( new ScRangeName( *pOldRanges ) );
+ rDoc.SetRangeName( new ScRangeName( *pOldRanges ) );
}
else
{
if (mnTab >= 0)
- pDoc->SetRangeName( mnTab, new ScRangeName( *pNewRanges ) );
+ rDoc.SetRangeName( mnTab, new ScRangeName( *pNewRanges ) );
else
- pDoc->SetRangeName( new ScRangeName( *pNewRanges ) );
+ rDoc.SetRangeName( new ScRangeName( *pNewRanges ) );
}
- pDoc->PostprocessRangeNameUpdate();
+ rDoc.PostprocessRangeNameUpdate();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
}
diff --git a/sc/source/ui/undo/undocell2.cxx b/sc/source/ui/undo/undocell2.cxx
index 0b45efc419e9..0aa39a56fa01 100644
--- a/sc/source/ui/undo/undocell2.cxx
+++ b/sc/source/ui/undo/undocell2.cxx
@@ -20,8 +20,8 @@ UndoSetCells::~UndoSetCells() {}
void UndoSetCells::DoChange( const CellValues& rValues )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->CopyCellValuesFrom(maTopPos, rValues);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.CopyCellValuesFrom(maTopPos, rValues);
ScRange aRange(maTopPos);
aRange.aEnd.IncRow(rValues.size());
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 59845fa4a057..94c0df4a5598 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -96,12 +96,12 @@ void ScUndoDoOutline::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
// sheet has to be switched over (#46952#)!
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -115,9 +115,9 @@ void ScUndoDoOutline::Undo()
// Original column/row status
if (bColumns)
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
- static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, pDoc);
+ static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, &rDoc);
else
- pUndoDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, &rDoc );
pViewShell->UpdateScrollBars();
@@ -134,7 +134,7 @@ void ScUndoDoOutline::Redo()
// sheet has to be switched over (#46952#)!
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -185,15 +185,15 @@ void ScUndoMakeOutline::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockStart, aBlockEnd );
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -268,26 +268,26 @@ void ScUndoOutlineLevel::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
if (bColumns)
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
- static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, pDoc);
+ static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, &rDoc);
else
- pUndoDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, &rDoc );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
pViewShell->UpdateScrollBars();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -304,7 +304,7 @@ void ScUndoOutlineLevel::Redo()
// sheet has to be switched on or off before this (#46952#) !!!
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -355,12 +355,12 @@ void ScUndoOutlineBlock::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
SCCOLROW nStartCol = aBlockStart.Col();
@@ -371,21 +371,21 @@ void ScUndoOutlineBlock::Undo()
if (!bShow)
{ // Size of the hidden blocks
size_t nLevel;
- pUndoTable->GetColArray()->FindTouchedLevel( nStartCol, nEndCol, nLevel );
- pUndoTable->GetColArray()->ExtendBlock( nLevel, nStartCol, nEndCol );
- pUndoTable->GetRowArray()->FindTouchedLevel( nStartRow, nEndRow, nLevel );
- pUndoTable->GetRowArray()->ExtendBlock( nLevel, nStartRow, nEndRow );
+ pUndoTable->GetColArray().FindTouchedLevel( nStartCol, nEndCol, nLevel );
+ pUndoTable->GetColArray().ExtendBlock( nLevel, nStartCol, nEndCol );
+ pUndoTable->GetRowArray().FindTouchedLevel( nStartRow, nEndRow, nLevel );
+ pUndoTable->GetRowArray().ExtendBlock( nLevel, nStartRow, nEndRow );
}
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStartCol), 0, nTab,
- static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false, pDoc );
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false, &rDoc );
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
pViewShell->UpdateScrollBars();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -454,12 +454,12 @@ void ScUndoRemoveAllOutlines::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
SCCOL nStartCol = aBlockStart.Col();
@@ -467,14 +467,14 @@ void ScUndoRemoveAllOutlines::Undo()
SCROW nStartRow = aBlockStart.Row();
SCROW nEndRow = aBlockEnd.Row();
- pUndoDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pDoc );
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, &rDoc );
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
pViewShell->UpdateScrollBars();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -492,7 +492,7 @@ void ScUndoRemoveAllOutlines::Redo()
// sheet has to be switched over (#46952#)!
SCTAB nTab = aBlockStart.Tab();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -539,12 +539,12 @@ void ScUndoAutoOutline::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
// Original outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
if (pUndoDoc && pUndoTable)
@@ -553,18 +553,18 @@ void ScUndoAutoOutline::Undo()
SCCOLROW nStartRow;
SCCOLROW nEndCol;
SCCOLROW nEndRow;
- pUndoTable->GetColArray()->GetRange( nStartCol, nEndCol );
- pUndoTable->GetRowArray()->GetRange( nStartRow, nEndRow );
+ pUndoTable->GetColArray().GetRange( nStartCol, nEndCol );
+ pUndoTable->GetRowArray().GetRange( nStartRow, nEndRow );
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStartCol), 0, nTab,
static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false,
- pDoc);
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ &rDoc);
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
pViewShell->UpdateScrollBars();
}
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -584,7 +584,7 @@ void ScUndoAutoOutline::Redo()
{
// sheet has to be switched on or off before this (#46952#) !!!
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
}
@@ -648,21 +648,21 @@ void ScUndoSubTotals::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (nNewEndRow > aParam.nRow2)
{
- pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, aParam.nRow2+1, static_cast<SCSIZE>(nNewEndRow-aParam.nRow2) );
+ rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aParam.nRow2+1, static_cast<SCSIZE>(nNewEndRow-aParam.nRow2) );
}
else if (nNewEndRow < aParam.nRow2)
{
- pDoc->InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(aParam.nRow2-nNewEndRow) );
+ rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(aParam.nRow2-nNewEndRow) );
}
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
if (pUndoTable)
@@ -671,13 +671,13 @@ void ScUndoSubTotals::Undo()
SCCOLROW nStartRow;
SCCOLROW nEndCol;
SCCOLROW nEndRow;
- pUndoTable->GetColArray()->GetRange( nStartCol, nEndCol );
- pUndoTable->GetRowArray()->GetRange( nStartRow, nEndRow );
+ pUndoTable->GetColArray().GetRange( nStartCol, nEndCol );
+ pUndoTable->GetRowArray().GetRange( nStartRow, nEndRow );
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStartCol), 0, nTab,
static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false,
- pDoc);
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ &rDoc);
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
pViewShell->UpdateScrollBars();
}
@@ -687,22 +687,22 @@ void ScUndoSubTotals::Undo()
ScUndoUtil::MarkSimpleBlock( pDocShell, 0, aParam.nRow1+1, nTab,
MAXCOL, aParam.nRow2, nTab );
- pDoc->DeleteAreaTab( 0,aParam.nRow1+1, MAXCOL,aParam.nRow2, nTab, IDF_ALL );
+ rDoc.DeleteAreaTab( 0,aParam.nRow1+1, MAXCOL,aParam.nRow2, nTab, IDF_ALL );
pUndoDoc->CopyToDocument( 0, aParam.nRow1+1, nTab, MAXCOL, aParam.nRow2, nTab,
- IDF_NONE, false, pDoc ); // Flags
+ IDF_NONE, false, &rDoc ); // Flags
pUndoDoc->UndoToDocument( 0, aParam.nRow1+1, nTab, MAXCOL, aParam.nRow2, nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
ScUndoUtil::MarkSimpleBlock( pDocShell, aParam.nCol1,aParam.nRow1,nTab,
aParam.nCol2,aParam.nRow2,nTab );
if (pUndoRange)
- pDoc->SetRangeName( new ScRangeName( *pUndoRange ) );
+ rDoc.SetRangeName( new ScRangeName( *pUndoRange ) );
if (pUndoDB)
- pDoc->SetDBCollection( new ScDBCollection( *pUndoDB ), true );
+ rDoc.SetDBCollection( new ScDBCollection( *pUndoDB ), true );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -718,7 +718,7 @@ void ScUndoSubTotals::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -772,7 +772,7 @@ void ScUndoSort::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCCOL nStartCol = aSortParam.nCol1;
@@ -793,26 +793,26 @@ void ScUndoSort::Undo()
nEndCol, nEndRow, nSortTab );
// do not delete/copy note captions, they are handled in drawing undo (ScDBFuncUndo::mpDrawUndo)
- pDoc->DeleteAreaTab( nStartCol,nStartRow, nEndCol,nEndRow, nSortTab, IDF_ALL|IDF_NOCAPTIONS );
+ rDoc.DeleteAreaTab( nStartCol,nStartRow, nEndCol,nEndRow, nSortTab, IDF_ALL|IDF_NOCAPTIONS );
pUndoDoc->CopyToDocument( nStartCol, nStartRow, nSortTab, nEndCol, nEndRow, nSortTab,
- IDF_ALL|IDF_NOCAPTIONS, false, pDoc );
+ IDF_ALL|IDF_NOCAPTIONS, false, &rDoc );
if (bDestArea)
{
// do not delete/copy note captions, they are handled in drawing undo (ScDBFuncUndo::mpDrawUndo)
- pDoc->DeleteAreaTab( aDestRange, IDF_ALL|IDF_NOCAPTIONS );
- pUndoDoc->CopyToDocument( aDestRange, IDF_ALL|IDF_NOCAPTIONS, false, pDoc );
+ rDoc.DeleteAreaTab( aDestRange, IDF_ALL|IDF_NOCAPTIONS );
+ pUndoDoc->CopyToDocument( aDestRange, IDF_ALL|IDF_NOCAPTIONS, false, &rDoc );
}
// Row heights always (due to automatic adjustment)
// TODO change to use ScBlockUndo
pUndoDoc->CopyToDocument( 0, nStartRow, nSortTab, MAXCOL, nEndRow, nSortTab,
- IDF_NONE, false, pDoc );
+ IDF_NONE, false, &rDoc );
if (pUndoDB)
- pDoc->SetDBCollection( new ScDBCollection( *pUndoDB ), true );
+ rDoc.SetDBCollection( new ScDBCollection( *pUndoDB ), true );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nSortTab )
pViewShell->SetTabNo( nSortTab );
@@ -828,7 +828,7 @@ void ScUndoSort::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -879,7 +879,7 @@ ScUndoQuery::ScUndoQuery( ScDocShell* pNewDocShell, SCTAB nNewTab, const ScQuery
aAdvSource = *pAdvSrc;
}
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoQuery::~ScUndoQuery()
@@ -898,7 +898,7 @@ void ScUndoQuery::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
bool bCopy = !aQueryParam.bInplace;
@@ -909,7 +909,7 @@ void ScUndoQuery::Undo()
nDestEndCol = aQueryParam.nDestCol + ( aQueryParam.nCol2-aQueryParam.nCol1 );
nDestEndRow = aQueryParam.nDestRow + ( aQueryParam.nRow2-aQueryParam.nRow1 );
- ScDBData* pData = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ ScDBData* pData = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
aQueryParam.nDestTab, true );
if (pData)
{
@@ -922,7 +922,7 @@ void ScUndoQuery::Undo()
if ( bDoSize && bDestArea )
{
// aDestRange is the old range
- pDoc->FitBlock( ScRange(
+ rDoc.FitBlock( ScRange(
aQueryParam.nDestCol, aQueryParam.nDestRow, aQueryParam.nDestTab,
nDestEndCol, nDestEndRow, aQueryParam.nDestTab ),
aOldDest );
@@ -931,43 +931,43 @@ void ScUndoQuery::Undo()
ScUndoUtil::MarkSimpleBlock( pDocShell,
aQueryParam.nDestCol, aQueryParam.nDestRow, aQueryParam.nDestTab,
nDestEndCol, nDestEndRow, aQueryParam.nDestTab );
- pDoc->DeleteAreaTab( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ rDoc.DeleteAreaTab( aQueryParam.nDestCol, aQueryParam.nDestRow,
nDestEndCol, nDestEndRow, aQueryParam.nDestTab, IDF_ALL );
pViewShell->DoneBlockMode();
pUndoDoc->CopyToDocument( aQueryParam.nDestCol, aQueryParam.nDestRow, aQueryParam.nDestTab,
nDestEndCol, nDestEndRow, aQueryParam.nDestTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
// Attributes are always copied (#49287#)
// rest of the old range
if ( bDestArea && !bDoSize )
{
- pDoc->DeleteAreaTab( aOldDest, IDF_ALL );
- pUndoDoc->CopyToDocument( aOldDest, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( aOldDest, IDF_ALL );
+ pUndoDoc->CopyToDocument( aOldDest, IDF_ALL, false, &rDoc );
}
}
else
pUndoDoc->CopyToDocument( 0, aQueryParam.nRow1, nTab, MAXCOL, aQueryParam.nRow2, nTab,
- IDF_NONE, false, pDoc );
+ IDF_NONE, false, &rDoc );
if (pUndoDB)
- pDoc->SetDBCollection( new ScDBCollection( *pUndoDB ), true );
+ rDoc.SetDBCollection( new ScDBCollection( *pUndoDB ), true );
if (!bCopy)
{
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
}
ScRange aDirtyRange( 0 , aQueryParam.nRow1, nTab,
MAXCOL, aQueryParam.nRow2, nTab );
- pDoc->SetDirty( aDirtyRange );
+ rDoc.SetDirty( aDirtyRange );
- DoSdrUndoAction( pDrawUndo, pDoc );
+ DoSdrUndoAction( pDrawUndo, &rDoc );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1003,7 +1003,7 @@ void ScUndoQuery::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1047,16 +1047,16 @@ void ScUndoAutoFilter::DoChange( bool bUndo )
{
bool bNewFilter = bUndo ? !bFilterSet : bFilterSet;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScDBData* pDBData=NULL;
if (aDBName.equalsAscii(STR_DB_LOCAL_NONAME))
{
SCTAB nTab = aOriginalRange.aStart.Tab();
- pDBData = pDoc->GetAnonymousDBData(nTab);
+ pDBData = rDoc.GetAnonymousDBData(nTab);
}
else
{
- ScDBCollection* pColl = pDoc->GetDBCollection();
+ ScDBCollection* pColl = rDoc.GetDBCollection();
pDBData = pColl->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(aDBName));
}
@@ -1072,9 +1072,9 @@ void ScUndoAutoFilter::DoChange( bool bUndo )
pDBData->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
if ( bNewFilter )
- pDoc->ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
+ rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
else
- pDoc->RemoveFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
+ rDoc.RemoveFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID );
}
@@ -1127,14 +1127,14 @@ void ScUndoDBData::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- bool bOldAutoCalc = pDoc->GetAutoCalc();
- pDoc->SetAutoCalc( false ); // Avoid unnecessary calculations
- pDoc->CompileDBFormula( true ); // CreateFormulaString
- pDoc->SetDBCollection( new ScDBCollection(*pUndoColl), true );
- pDoc->CompileDBFormula( false ); // CompileFormulaString
- pDoc->SetAutoCalc( bOldAutoCalc );
+ bool bOldAutoCalc = rDoc.GetAutoCalc();
+ rDoc.SetAutoCalc( false ); // Avoid unnecessary calculations
+ rDoc.CompileDBFormula( true ); // CreateFormulaString
+ rDoc.SetDBCollection( new ScDBCollection(*pUndoColl), true );
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
+ rDoc.SetAutoCalc( bOldAutoCalc );
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
@@ -1145,14 +1145,14 @@ void ScUndoDBData::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- bool bOldAutoCalc = pDoc->GetAutoCalc();
- pDoc->SetAutoCalc( false ); // Avoid unnecessary calculations
- pDoc->CompileDBFormula( true ); // CreateFormulaString
- pDoc->SetDBCollection( new ScDBCollection(*pRedoColl), true );
- pDoc->CompileDBFormula( false ); // CompileFormulaString
- pDoc->SetAutoCalc( bOldAutoCalc );
+ bool bOldAutoCalc = rDoc.GetAutoCalc();
+ rDoc.SetAutoCalc( false ); // Avoid unnecessary calculations
+ rDoc.CompileDBFormula( true ); // CreateFormulaString
+ rDoc.SetDBCollection( new ScDBCollection(*pRedoColl), true );
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
+ rDoc.SetAutoCalc( bOldAutoCalc );
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
@@ -1205,7 +1205,7 @@ void ScUndoImportData::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
ScUndoUtil::MarkSimpleBlock( pDocShell, aImportParam.nCol1,aImportParam.nRow1,nTab,
@@ -1218,7 +1218,7 @@ void ScUndoImportData::Undo()
if (pUndoDBData && pRedoDBData)
{
pRedoDBData->GetArea( nTable, nCol1, nRow1, nCol2, nRow2 );
- pCurrentData = ScUndoUtil::GetOldDBData( pRedoDBData, pDoc, nTab,
+ pCurrentData = ScUndoUtil::GetOldDBData( pRedoDBData, &rDoc, nTab,
nCol1, nRow1, nCol2, nRow2 );
if ( !bRedoFilled )
@@ -1227,15 +1227,15 @@ void ScUndoImportData::Undo()
// imported data is deleted later anyway,
// so now delete each column after copying to save memory (#41216#)
- bool bOldAutoCalc = pDoc->GetAutoCalc();
- pDoc->SetAutoCalc( false ); // outside of the loop
+ bool bOldAutoCalc = rDoc.GetAutoCalc();
+ rDoc.SetAutoCalc( false ); // outside of the loop
for (SCCOL nCopyCol = nCol1; nCopyCol <= nCol2; nCopyCol++)
{
- pDoc->CopyToDocument( nCopyCol,nRow1,nTab, nCopyCol,nRow2,nTab,
+ rDoc.CopyToDocument( nCopyCol,nRow1,nTab, nCopyCol,nRow2,nTab,
IDF_CONTENTS & ~IDF_NOTE, false, pRedoDoc );
- pDoc->DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS & ~IDF_NOTE );
+ rDoc.DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS & ~IDF_NOTE );
}
- pDoc->SetAutoCalc( bOldAutoCalc );
+ rDoc.SetAutoCalc( bOldAutoCalc );
bRedoFilled = true;
}
}
@@ -1249,20 +1249,20 @@ void ScUndoImportData::Undo()
pUndoDBData->GetArea( aOld );
pRedoDBData->GetArea( aNew );
- pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
+ rDoc.DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE );
aOld.aEnd.SetCol( aOld.aEnd.Col() + nFormulaCols ); // FitBlock also for formulas
aNew.aEnd.SetCol( aNew.aEnd.Col() + nFormulaCols );
- pDoc->FitBlock( aNew, aOld, false ); // backwards
+ rDoc.FitBlock( aNew, aOld, false ); // backwards
}
else
- pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
+ rDoc.DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE );
pUndoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab,
nEndCol+nFormulaCols,nEndRow,nTab,
- IDF_ALL & ~IDF_NOTE, false, pDoc );
+ IDF_ALL & ~IDF_NOTE, false, &rDoc );
if (pCurrentData)
{
@@ -1272,7 +1272,7 @@ void ScUndoImportData::Undo()
ScUndoUtil::MarkSimpleBlock( pDocShell, nCol1, nRow1, nTable, nCol2, nRow2, nTable );
}
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1290,7 +1290,7 @@ void ScUndoImportData::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
ScUndoUtil::MarkSimpleBlock( pDocShell, aImportParam.nCol1,aImportParam.nRow1,nTab,
@@ -1303,7 +1303,7 @@ void ScUndoImportData::Redo()
if (pUndoDBData && pRedoDBData)
{
pUndoDBData->GetArea( nTable, nCol1, nRow1, nCol2, nRow2 );
- pCurrentData = ScUndoUtil::GetOldDBData( pUndoDBData, pDoc, nTab,
+ pCurrentData = ScUndoUtil::GetOldDBData( pUndoDBData, &rDoc, nTab,
nCol1, nRow1, nCol2, nRow2 );
}
bool bMoveCells = pUndoDBData && pRedoDBData &&
@@ -1318,19 +1318,19 @@ void ScUndoImportData::Redo()
aOld.aEnd.SetCol( aOld.aEnd.Col() + nFormulaCols ); // FitBlock also for formulas
aNew.aEnd.SetCol( aNew.aEnd.Col() + nFormulaCols );
- pDoc->FitBlock( aOld, aNew );
+ rDoc.FitBlock( aOld, aNew );
- pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
+ rDoc.DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE );
- pRedoDoc->CopyToDocument( aNew, IDF_ALL & ~IDF_NOTE, false, pDoc ); // including formulas
+ pRedoDoc->CopyToDocument( aNew, IDF_ALL & ~IDF_NOTE, false, &rDoc ); // including formulas
}
else
{
- pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
+ rDoc.DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE );
pRedoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab,
- nEndCol,nEndRow,nTab, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ nEndCol,nEndRow,nTab, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
if (pCurrentData)
@@ -1341,7 +1341,7 @@ void ScUndoImportData::Redo()
ScUndoUtil::MarkSimpleBlock( pDocShell, nCol1, nRow1, nTable, nCol2, nRow2, nTable );
}
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1423,13 +1423,13 @@ void ScUndoRepeatDB::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
if (bQuerySize)
{
- pDoc->FitBlock( aNewQuery, aOldQuery, false );
+ rDoc.FitBlock( aNewQuery, aOldQuery, false );
if ( aNewQuery.aEnd.Col() == aOldQuery.aEnd.Col() )
{
@@ -1437,7 +1437,7 @@ void ScUndoRepeatDB::Undo()
SCCOL nCol = aOldQuery.aEnd.Col() + 1;
SCROW nRow = aOldQuery.aStart.Row() + 1; // test the header
while ( nCol <= MAXCOL &&
- pDoc->GetCellType(ScAddress( nCol, nRow, nTab )) == CELLTYPE_FORMULA )
+ rDoc.GetCellType(ScAddress( nCol, nRow, nTab )) == CELLTYPE_FORMULA )
++nCol, ++nFormulaCols;
if ( nFormulaCols > 0 )
@@ -1447,7 +1447,7 @@ void ScUndoRepeatDB::Undo()
aOldForm.aEnd.SetCol( aOldQuery.aEnd.Col() + nFormulaCols );
ScRange aNewForm = aOldForm;
aNewForm.aEnd.SetRow( aNewQuery.aEnd.Row() );
- pDoc->FitBlock( aNewForm, aOldForm, false );
+ rDoc.FitBlock( aNewForm, aOldForm, false );
}
}
}
@@ -1456,15 +1456,15 @@ void ScUndoRepeatDB::Undo()
if (nNewEndRow > aBlockEnd.Row())
{
- pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, aBlockEnd.Row()+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) );
+ rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aBlockEnd.Row()+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) );
}
else if (nNewEndRow < aBlockEnd.Row())
{
- pDoc->InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) );
+ rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) );
}
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
if (pUndoTable)
@@ -1473,13 +1473,13 @@ void ScUndoRepeatDB::Undo()
SCCOLROW nStartRow;
SCCOLROW nEndCol;
SCCOLROW nEndRow;
- pUndoTable->GetColArray()->GetRange( nStartCol, nEndCol );
- pUndoTable->GetRowArray()->GetRange( nStartRow, nEndRow );
+ pUndoTable->GetColArray().GetRange( nStartCol, nEndCol );
+ pUndoTable->GetRowArray().GetRange( nStartRow, nEndRow );
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStartCol), 0, nTab,
static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false,
- pDoc );
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ &rDoc );
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
pViewShell->UpdateScrollBars();
}
@@ -1487,23 +1487,23 @@ void ScUndoRepeatDB::Undo()
// Original data and references
ScUndoUtil::MarkSimpleBlock( pDocShell, 0, aBlockStart.Row(), nTab,
MAXCOL, aBlockEnd.Row(), nTab );
- pDoc->DeleteAreaTab( 0, aBlockStart.Row(),
+ rDoc.DeleteAreaTab( 0, aBlockStart.Row(),
MAXCOL, aBlockEnd.Row(), nTab, IDF_ALL );
pUndoDoc->CopyToDocument( 0, aBlockStart.Row(), nTab, MAXCOL, aBlockEnd.Row(), nTab,
- IDF_NONE, false, pDoc ); // Flags
+ IDF_NONE, false, &rDoc ); // Flags
pUndoDoc->UndoToDocument( 0, aBlockStart.Row(), nTab, MAXCOL, aBlockEnd.Row(), nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockStart.Col(),aBlockStart.Row(),nTab,
aBlockEnd.Col(),aBlockEnd.Row(),nTab );
if (pUndoRange)
- pDoc->SetRangeName( new ScRangeName( *pUndoRange ) );
+ rDoc.SetRangeName( new ScRangeName( *pUndoRange ) );
if (pUndoDB)
- pDoc->SetDBCollection( new ScDBCollection( *pUndoDB ), true );
+ rDoc.SetDBCollection( new ScDBCollection( *pUndoDB ), true );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1520,7 +1520,7 @@ void ScUndoRepeatDB::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1585,7 +1585,7 @@ void ScUndoDataPilot::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRange aOldRange;
ScRange aNewRange;
@@ -1593,14 +1593,14 @@ void ScUndoDataPilot::Undo()
if ( pNewDPObject && pNewUndoDoc )
{
aNewRange = pNewDPObject->GetOutRange();
- pDoc->DeleteAreaTab( aNewRange, IDF_ALL );
- pNewUndoDoc->CopyToDocument( aNewRange, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( aNewRange, IDF_ALL );
+ pNewUndoDoc->CopyToDocument( aNewRange, IDF_ALL, false, &rDoc );
}
if ( pOldDPObject && pOldUndoDoc )
{
aOldRange = pOldDPObject->GetOutRange();
- pDoc->DeleteAreaTab( aOldRange, IDF_ALL );
- pOldUndoDoc->CopyToDocument( aOldRange, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( aOldRange, IDF_ALL );
+ pOldUndoDoc->CopyToDocument( aOldRange, IDF_ALL, false, &rDoc );
}
// update objects in collection
@@ -1610,7 +1610,7 @@ void ScUndoDataPilot::Undo()
// find updated object
//! find by name!
- ScDPObject* pDocObj = pDoc->GetDPAtCursor(
+ ScDPObject* pDocObj = rDoc.GetDPAtCursor(
aNewRange.aStart.Col(), aNewRange.aStart.Row(), aNewRange.aStart.Tab() );
OSL_ENSURE(pDocObj, "DPObject not found");
if (pDocObj)
@@ -1628,7 +1628,7 @@ void ScUndoDataPilot::Undo()
else
{
// delete inserted object
- pDoc->GetDPCollection()->FreeTable(pDocObj);
+ rDoc.GetDPCollection()->FreeTable(pDocObj);
}
}
}
@@ -1637,7 +1637,7 @@ void ScUndoDataPilot::Undo()
// re-insert deleted object
ScDPObject* pDestObj = new ScDPObject( *pOldDPObject );
- if ( !pDoc->GetDPCollection()->InsertNewTable(pDestObj) )
+ if ( !rDoc.GetDPCollection()->InsertNewTable(pDestObj) )
{
OSL_FAIL("cannot insert DPObject");
DELETEZ( pDestObj );
@@ -1659,7 +1659,7 @@ void ScUndoDataPilot::Undo()
if (pNewDPObject)
{
// notify API objects
- pDoc->BroadcastUno( ScDataPilotModifiedHint( pNewDPObject->GetName() ) );
+ rDoc.BroadcastUno( ScDataPilotModifiedHint( pNewDPObject->GetName() ) );
}
EndUndo();
@@ -1672,7 +1672,7 @@ void ScUndoDataPilot::Redo()
//! copy output data instead of repeating the change,
//! in case external data have changed!
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScDPObject* pSourceObj = NULL;
if ( pOldDPObject )
@@ -1681,7 +1681,7 @@ void ScUndoDataPilot::Redo()
//! find by name!
ScRange aOldRange = pOldDPObject->GetOutRange();
- pSourceObj = pDoc->GetDPAtCursor(
+ pSourceObj = rDoc.GetDPAtCursor(
aOldRange.aStart.Col(), aOldRange.aStart.Row(), aOldRange.aStart.Tab() );
OSL_ENSURE(pSourceObj, "DPObject not found");
}
@@ -1734,7 +1734,7 @@ void ScUndoConsolidate::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB nTab = aDestArea.nTab;
ScRange aOldRange;
@@ -1743,23 +1743,23 @@ void ScUndoConsolidate::Undo()
if (bInsRef)
{
- pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, aDestArea.nRowStart, nInsertCount );
- pDoc->SetOutlineTable( nTab, pUndoTab );
+ rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aDestArea.nRowStart, nInsertCount );
+ rDoc.SetOutlineTable( nTab, pUndoTab );
// Row status
- pUndoDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, &rDoc );
// Data and references
- pDoc->DeleteAreaTab( 0,aDestArea.nRowStart, MAXCOL,aDestArea.nRowEnd, nTab, IDF_ALL );
+ rDoc.DeleteAreaTab( 0,aDestArea.nRowStart, MAXCOL,aDestArea.nRowEnd, nTab, IDF_ALL );
pUndoDoc->UndoToDocument( 0, aDestArea.nRowStart, nTab,
MAXCOL, aDestArea.nRowEnd, nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
// Original range
if (pUndoData)
{
- pDoc->DeleteAreaTab(aOldRange, IDF_ALL);
- pUndoDoc->CopyToDocument(aOldRange, IDF_ALL, false, pDoc);
+ rDoc.DeleteAreaTab(aOldRange, IDF_ALL);
+ pUndoDoc->CopyToDocument(aOldRange, IDF_ALL, false, &rDoc);
}
pDocShell->PostPaint( 0,aDestArea.nRowStart,nTab, MAXCOL,MAXROW,nTab,
@@ -1767,17 +1767,17 @@ void ScUndoConsolidate::Undo()
}
else
{
- pDoc->DeleteAreaTab( aDestArea.nColStart,aDestArea.nRowStart,
+ rDoc.DeleteAreaTab( aDestArea.nColStart,aDestArea.nRowStart,
aDestArea.nColEnd,aDestArea.nRowEnd, nTab, IDF_ALL );
pUndoDoc->CopyToDocument( aDestArea.nColStart, aDestArea.nRowStart, nTab,
aDestArea.nColEnd, aDestArea.nRowEnd, nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
// Original range
if (pUndoData)
{
- pDoc->DeleteAreaTab(aOldRange, IDF_ALL);
- pUndoDoc->CopyToDocument(aOldRange, IDF_ALL, false, pDoc);
+ rDoc.DeleteAreaTab(aOldRange, IDF_ALL);
+ pUndoDoc->CopyToDocument(aOldRange, IDF_ALL, false, &rDoc);
}
SCCOL nEndX = aDestArea.nColEnd;
@@ -1796,7 +1796,7 @@ void ScUndoConsolidate::Undo()
// Adjust Database range again
if (pUndoData)
{
- ScDBCollection* pColl = pDoc->GetDBCollection();
+ ScDBCollection* pColl = rDoc.GetDBCollection();
if (pColl)
{
ScDBData* pDocData = pColl->getNamedDBs().findByUpperName(pUndoData->GetUpperName());
@@ -1808,7 +1808,7 @@ void ScUndoConsolidate::Undo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nViewTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nViewTab = pViewShell->GetViewData().GetTabNo();
if ( nViewTab != nTab )
pViewShell->SetTabNo( nTab );
}
@@ -1825,7 +1825,7 @@ void ScUndoConsolidate::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nViewTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nViewTab = pViewShell->GetViewData().GetTabNo();
if ( nViewTab != aParam.nTab )
pViewShell->SetTabNo( aParam.nTab );
}
@@ -1845,9 +1845,9 @@ bool ScUndoConsolidate::CanRepeat(SfxRepeatTarget& /* rTarget */) const
// Change source data of Chart
void ScUndoChartData::Init()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
aOldRangeListRef = new ScRangeList;
- pDoc->GetOldChartParameters( aChartName, *aOldRangeListRef, bOldColHeaders, bOldRowHeaders );
+ rDoc.GetOldChartParameters( aChartName, *aOldRangeListRef, bOldColHeaders, bOldRowHeaders );
}
ScUndoChartData::ScUndoChartData( ScDocShell* pNewDocShell, const OUString& rName,
@@ -1891,7 +1891,7 @@ void ScUndoChartData::Undo()
{
BeginUndo();
- pDocShell->GetDocument()->UpdateChartArea( aChartName, aOldRangeListRef,
+ pDocShell->GetDocument().UpdateChartArea( aChartName, aOldRangeListRef,
bOldColHeaders, bOldRowHeaders, false );
EndUndo();
@@ -1901,7 +1901,7 @@ void ScUndoChartData::Redo()
{
BeginRedo();
- pDocShell->GetDocument()->UpdateChartArea( aChartName, aNewRangeListRef,
+ pDocShell->GetDocument().UpdateChartArea( aChartName, aNewRangeListRef,
bNewColHeaders, bNewRowHeaders, bAddRange );
EndRedo();
@@ -1942,7 +1942,7 @@ ScUndoDataForm::ScUndoDataForm( ScDocShell* pNewDocShell,
mpMarkData->SetMarkArea(aBlockRange); // mark paste block
if ( pRefUndoData )
- pRefUndoData->DeleteUnchanged( pDocShell->GetDocument() );
+ pRefUndoData->DeleteUnchanged( &pDocShell->GetDocument() );
SetChangeTrack();
}
@@ -1962,7 +1962,7 @@ OUString ScUndoDataForm::GetComment() const
void ScUndoDataForm::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction, SC_CACM_PASTE );
@@ -1982,10 +1982,10 @@ void ScUndoDataForm::Undo()
void ScUndoDataForm::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- EnableDrawAdjust( pDoc, false ); //! include in ScBlockUndo?
+ ScDocument& rDoc = pDocShell->GetDocument();
+ EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
DoChange( false );
- EnableDrawAdjust( pDoc, true ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
}
@@ -2001,13 +2001,13 @@ bool ScUndoDataForm::CanRepeat(SfxRepeatTarget& rTarget) const
void ScUndoDataForm::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// RefUndoData for redo is created before first undo
// (with DeleteUnchanged after the DoUndo call)
bool bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
if ( bCreateRedoData )
- pRefRedoData = new ScRefUndoData( pDoc );
+ pRefRedoData = new ScRefUndoData( &rDoc );
ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData : pRefRedoData;
@@ -2022,7 +2022,7 @@ void ScUndoDataForm::DoChange( const bool bUndo )
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
if ( bUndo && !bRedoFilled )
{
if (!pRedoDoc)
@@ -2031,14 +2031,14 @@ void ScUndoDataForm::DoChange( const bool bUndo )
bool bRowInfo = ( aBlockRange.aStart.Col()==0 && aBlockRange.aEnd.Col()==MAXCOL );
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndoSelected( pDoc, *mpMarkData, bColInfo, bRowInfo );
+ pRedoDoc->InitUndoSelected( &rDoc, *mpMarkData, bColInfo, bRowInfo );
}
// read "redo" data from the document in the first undo
// all sheets - CopyToDocument skips those that don't exist in pRedoDoc
ScRange aCopyRange = aBlockRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, 1, false, pRedoDoc );
+ rDoc.CopyToDocument( aCopyRange, 1, false, pRedoDoc );
bRedoFilled = true;
}
@@ -2049,22 +2049,22 @@ void ScUndoDataForm::DoChange( const bool bUndo )
{
OUString aOldString = pUndoDoc->GetString(
aBlockRange.aStart.Col()+i, aBlockRange.aStart.Row(), aBlockRange.aStart.Tab());
- pDoc->SetString( aBlockRange.aStart.Col()+i , aBlockRange.aStart.Row() , aBlockRange.aStart.Tab() , aOldString );
+ rDoc.SetString( aBlockRange.aStart.Col()+i , aBlockRange.aStart.Row() , aBlockRange.aStart.Tab() , aOldString );
}
if (pWorkRefData)
{
- pWorkRefData->DoUndo( pDoc, true ); // TRUE = bSetChartRangeLists for SetChartListenerCollection
- if ( pDoc->RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aBlockRange.aStart.Tab() ) )
+ pWorkRefData->DoUndo( &rDoc, true ); // TRUE = bSetChartRangeLists for SetChartListenerCollection
+ if ( rDoc.RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aBlockRange.aStart.Tab() ) )
bPaintAll = true;
}
if ( bCreateRedoData && pRefRedoData )
- pRefRedoData->DeleteUnchanged( pDoc );
+ pRefRedoData->DeleteUnchanged( &rDoc );
if ( bUndo )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
}
@@ -2072,7 +2072,7 @@ void ScUndoDataForm::DoChange( const bool bUndo )
SetChangeTrack();
ScRange aDrawRange( aBlockRange );
- pDoc->ExtendMerge( aDrawRange, true ); // only needed for single sheet (text/rtf etc.)
+ rDoc.ExtendMerge( aDrawRange, true ); // only needed for single sheet (text/rtf etc.)
sal_uInt16 nPaint = PAINT_GRID;
if (bPaintAll)
{
diff --git a/sc/source/ui/undo/undorangename.cxx b/sc/source/ui/undo/undorangename.cxx
index db9b0e43429e..13da03bd9200 100644
--- a/sc/source/ui/undo/undorangename.cxx
+++ b/sc/source/ui/undo/undorangename.cxx
@@ -75,7 +75,7 @@ OUString ScUndoAllRangeNames::GetComment() const
void ScUndoAllRangeNames::DoChange(const boost::ptr_map<OUString, ScRangeName>& rNames)
{
- ScDocument& rDoc = *pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
rDoc.PreprocessRangeNameUpdate();
rDoc.SetAllRangeNames(rNames);
@@ -99,15 +99,15 @@ ScUndoAddRangeData::~ScUndoAddRangeData()
void ScUndoAddRangeData::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeName* pRangeName = NULL;
if (mnTab == -1)
{
- pRangeName = pDoc->GetRangeName();
+ pRangeName = rDoc.GetRangeName();
}
else
{
- pRangeName = pDoc->GetRangeName( mnTab );
+ pRangeName = rDoc.GetRangeName( mnTab );
}
pRangeName->erase(*mpRangeData);
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
@@ -116,15 +116,15 @@ void ScUndoAddRangeData::Undo()
void ScUndoAddRangeData::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeName* pRangeName = NULL;
if (mnTab == -1)
{
- pRangeName = pDoc->GetRangeName();
+ pRangeName = rDoc.GetRangeName();
}
else
{
- pRangeName = pDoc->GetRangeName( mnTab );
+ pRangeName = rDoc.GetRangeName( mnTab );
}
pRangeName->insert(new ScRangeData(*mpRangeData));
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx
index b0e240fcd321..68d3510d7bd8 100644
--- a/sc/source/ui/undo/undostyl.cxx
+++ b/sc/source/ui/undo/undostyl.cxx
@@ -122,8 +122,8 @@ static void lcl_DocStyleChanged( ScDocument* pDoc, SfxStyleSheetBase* pStyle, bo
void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
SfxStyleFamily eStyleFamily, const ScStyleSaveData& rData )
{
- ScDocument* pDoc = pDocSh->GetDocument();
- ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
OUString aNewName = rData.GetName();
bool bDelete = aNewName.isEmpty(); // no new name -> delete style
bool bNew = ( rName.isEmpty() && !bDelete ); // creating new style
@@ -147,7 +147,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
pStyle = &pStlPool->Make( aNewName, eStyleFamily, SFXSTYLEBIT_USERDEF );
if ( eStyleFamily == SFX_STYLE_FAMILY_PARA )
- pDoc->GetPool()->CellStyleCreated( aNewName );
+ rDoc.GetPool()->CellStyleCreated( aNewName );
}
if ( pStyle )
@@ -155,9 +155,9 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
if ( bDelete )
{
if ( eStyleFamily == SFX_STYLE_FAMILY_PARA )
- lcl_DocStyleChanged( pDoc, pStyle, true ); // TRUE: remove usage of style
+ lcl_DocStyleChanged( &rDoc, pStyle, true ); // TRUE: remove usage of style
else
- pDoc->RemovePageStyleInUse( rName );
+ rDoc.RemovePageStyleInUse( rName );
// delete style
pStlPool->Remove( pStyle );
@@ -178,17 +178,17 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
if ( eStyleFamily == SFX_STYLE_FAMILY_PARA )
{
- lcl_DocStyleChanged( pDoc, pStyle, false ); // cell styles: row heights
+ lcl_DocStyleChanged( &rDoc, pStyle, false ); // cell styles: row heights
}
else
{
// page styles
if ( bNew && aNewName != rName )
- pDoc->RenamePageStyleInUse( rName, aNewName );
+ rDoc.RenamePageStyleInUse( rName, aNewName );
if (pNewSet)
- pDoc->ModifyStyleSheet( *pStyle, *pNewSet );
+ rDoc.ModifyStyleSheet( *pStyle, *pNewSet );
pDocSh->PageStyleModified( aNewName, true );
}
@@ -257,7 +257,7 @@ void ScUndoApplyPageStyle::Undo()
BeginUndo();
for( ApplyStyleVec::const_iterator aIt = maEntries.begin(), aEnd = maEntries.end(); aIt != aEnd; ++aIt )
{
- pDocShell->GetDocument()->SetPageStyle( aIt->mnTab, aIt->maOldStyle );
+ pDocShell->GetDocument().SetPageStyle( aIt->mnTab, aIt->maOldStyle );
ScPrintFunc( pDocShell, pDocShell->GetPrinter(), aIt->mnTab ).UpdatePages();
}
EndUndo();
@@ -268,7 +268,7 @@ void ScUndoApplyPageStyle::Redo()
BeginRedo();
for( ApplyStyleVec::const_iterator aIt = maEntries.begin(), aEnd = maEntries.end(); aIt != aEnd; ++aIt )
{
- pDocShell->GetDocument()->SetPageStyle( aIt->mnTab, maNewStyle );
+ pDocShell->GetDocument().SetPageStyle( aIt->mnTab, maNewStyle );
ScPrintFunc( pDocShell, pDocShell->GetPrinter(), aIt->mnTab ).UpdatePages();
}
EndRedo();
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 816e2b845414..1a3b9f6c276b 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -84,7 +84,7 @@ ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell,
nTab( nTabNum ),
bAppend( bApp )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
SetChangeTrack();
}
@@ -103,7 +103,7 @@ OUString ScUndoInsertTab::GetComment() const
void ScUndoInsertTab::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab );
@@ -125,9 +125,9 @@ void ScUndoInsertTab::Undo()
bDrawIsInUndo = false;
pDocShell->SetInUndo( false ); //! EndUndo
- DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
+ DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
@@ -159,7 +159,7 @@ void ScUndoInsertTab::Redo()
void ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -176,7 +176,7 @@ ScUndoInsertTables::ScUndoInsertTables( ScDocShell* pNewDocShell,
aNameList( newNameList ),
nTab( nTabNum )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
SetChangeTrack();
}
@@ -193,7 +193,7 @@ OUString ScUndoInsertTables::GetComment() const
void ScUndoInsertTables::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
nStartChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -224,9 +224,9 @@ void ScUndoInsertTables::Undo()
bDrawIsInUndo = false;
pDocShell->SetInUndo( false ); //! EndUndo
- DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
+ DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -254,7 +254,7 @@ void ScUndoInsertTables::Redo()
void ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -283,7 +283,7 @@ OUString ScUndoDeleteTab::GetComment() const
void ScUndoDeleteTab::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
sal_uLong nTmpChangeAction;
@@ -314,7 +314,7 @@ void ScUndoDeleteTab::Undo()
{
BeginUndo();
unsigned int i=0;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bLink = false;
OUString aName;
@@ -325,18 +325,18 @@ void ScUndoDeleteTab::Undo()
pRefUndoDoc->GetName( nTab, aName );
bDrawIsInUndo = true;
- bool bOk = pDoc->InsertTab(nTab, aName, false, true);
+ bool bOk = rDoc.InsertTab(nTab, aName, false, true);
bDrawIsInUndo = false;
if (bOk)
{
- pRefUndoDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, pDoc );
+ pRefUndoDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, &rDoc );
OUString aOldName;
pRefUndoDoc->GetName( nTab, aOldName );
- pDoc->RenameTab( nTab, aOldName, false );
+ rDoc.RenameTab( nTab, aOldName, false );
if (pRefUndoDoc->IsLinked(nTab))
{
- pDoc->SetLink( nTab, pRefUndoDoc->GetLinkMode(nTab), pRefUndoDoc->GetLinkDoc(nTab),
+ rDoc.SetLink( nTab, pRefUndoDoc->GetLinkMode(nTab), pRefUndoDoc->GetLinkDoc(nTab),
pRefUndoDoc->GetLinkFlt(nTab), pRefUndoDoc->GetLinkOpt(nTab),
pRefUndoDoc->GetLinkTab(nTab), pRefUndoDoc->GetLinkRefreshDelay(nTab) );
bLink = true;
@@ -344,22 +344,22 @@ void ScUndoDeleteTab::Undo()
if ( pRefUndoDoc->IsScenario(nTab) )
{
- pDoc->SetScenario( nTab, true );
+ rDoc.SetScenario( nTab, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
pRefUndoDoc->GetScenarioData( nTab, aComment, aColor, nScenFlags );
- pDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags );
+ rDoc.SetScenarioData( nTab, aComment, aColor, nScenFlags );
bool bActive = pRefUndoDoc->IsActiveScenario( nTab );
- pDoc->SetActiveScenario( nTab, bActive );
+ rDoc.SetActiveScenario( nTab, bActive );
}
- pDoc->SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
- pDoc->SetTabBgColor( nTab, pRefUndoDoc->GetTabBgColor(nTab) );
- pDoc->SetSheetEvents( nTab, pRefUndoDoc->GetSheetEvents( nTab ) );
- pDoc->SetLayoutRTL( nTab, pRefUndoDoc->IsLayoutRTL( nTab ) );
+ rDoc.SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
+ rDoc.SetTabBgColor( nTab, pRefUndoDoc->GetTabBgColor(nTab) );
+ rDoc.SetSheetEvents( nTab, pRefUndoDoc->GetSheetEvents( nTab ) );
+ rDoc.SetLayoutRTL( nTab, pRefUndoDoc->IsLayoutRTL( nTab ) );
if ( pRefUndoDoc->IsTabProtected( nTab ) )
- pDoc->SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
+ rDoc.SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
}
}
if (bLink)
@@ -369,7 +369,7 @@ void ScUndoDeleteTab::Undo()
EndUndo(); // Draw-Undo has to be called before Broadcast!
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -387,13 +387,13 @@ void ScUndoDeleteTab::Undo()
// not ShowTable due to SetTabNo(..., sal_True):
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
- pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDoc, theTabs[0] ), true );
+ pViewShell->SetTabNo( lcl_GetVisibleTabBefore( rDoc, theTabs[0] ), true );
}
void ScUndoDeleteTab::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDocShell->GetDocument(), theTabs.front() ) );
+ pViewShell->SetTabNo( lcl_GetVisibleTabBefore( pDocShell->GetDocument(), theTabs.front() ) );
RedoSdrUndoAction( pDrawUndo ); // Draw Redo first
@@ -414,7 +414,7 @@ void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
if (rTarget.ISA(ScTabViewTarget))
{
ScTabViewShell* pViewShell = ((ScTabViewTarget&)rTarget).GetViewShell();
- pViewShell->DeleteTable( pViewShell->GetViewData()->GetTabNo(), true );
+ pViewShell->DeleteTable( pViewShell->GetViewData().GetTabNo(), true );
}
}
@@ -445,8 +445,8 @@ OUString ScUndoRenameTab::GetComment() const
void ScUndoRenameTab::DoChange( SCTAB nTabP, const OUString& rName ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->RenameTab( nTabP, rName );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.RenameTab( nTabP, rName );
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); // Navigator
@@ -507,28 +507,28 @@ OUString ScUndoMoveTab::GetComment() const
void ScUndoMoveTab::DoChange( bool bUndo ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (bUndo) // UnDo
{
size_t i = mpNewTabs->size();
boost::scoped_ptr<ScProgress> pProgress(new ScProgress(pDocShell , ScGlobal::GetRscString(STR_UNDO_MOVE_TAB),
- i * pDoc->GetCodeCount()));
+ i * rDoc.GetCodeCount()));
for (; i > 0; --i)
{
SCTAB nDestTab = (*mpNewTabs)[i-1];
SCTAB nOldTab = (*mpOldTabs)[i-1];
if (nDestTab > MAXTAB) // appended ?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
- pDoc->MoveTab( nDestTab, nOldTab, pProgress.get() );
- pViewShell->GetViewData()->MoveTab( nDestTab, nOldTab );
+ rDoc.MoveTab( nDestTab, nOldTab, pProgress.get() );
+ pViewShell->GetViewData().MoveTab( nDestTab, nOldTab );
pViewShell->SetTabNo( nOldTab, true );
if (mpOldNames)
{
const OUString& rOldName = (*mpOldNames)[i-1];
- pDoc->RenameTab(nOldTab, rOldName);
+ rDoc.RenameTab(nOldTab, rOldName);
}
}
}
@@ -536,22 +536,22 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
{
size_t n = mpNewTabs->size();
boost::scoped_ptr<ScProgress> pProgress(new ScProgress(pDocShell , ScGlobal::GetRscString(STR_UNDO_MOVE_TAB),
- n * pDoc->GetCodeCount()));
+ n * rDoc.GetCodeCount()));
for (size_t i = 0; i < n; ++i)
{
SCTAB nDestTab = (*mpNewTabs)[i];
SCTAB nNewTab = nDestTab;
SCTAB nOldTab = (*mpOldTabs)[i];
if (nDestTab > MAXTAB) // appended ?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
- pDoc->MoveTab( nOldTab, nNewTab, pProgress.get() );
- pViewShell->GetViewData()->MoveTab( nOldTab, nNewTab );
+ rDoc.MoveTab( nOldTab, nNewTab, pProgress.get() );
+ pViewShell->GetViewData().MoveTab( nOldTab, nNewTab );
pViewShell->SetTabNo( nDestTab, true );
if (mpNewNames)
{
const OUString& rNewName = (*mpNewNames)[i];
- pDoc->RenameTab(nNewTab, rNewName);
+ rDoc.RenameTab(nNewTab, rNewName);
}
}
}
@@ -593,7 +593,7 @@ ScUndoCopyTab::ScUndoCopyTab(
mpNewNames(pNewNames),
pDrawUndo( NULL )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
if (mpNewNames && mpNewTabs->size() != mpNewNames->size())
// The sizes differ. Something is wrong.
@@ -626,19 +626,19 @@ void ScUndoCopyTab::DoChange() const
void ScUndoCopyTab::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- DoSdrUndoAction( pDrawUndo, pDoc ); // before the sheets are deleted
+ DoSdrUndoAction( pDrawUndo, &rDoc ); // before the sheets are deleted
vector<SCTAB>::const_reverse_iterator itr, itrEnd = mpNewTabs->rend();
for (itr = mpNewTabs->rbegin(); itr != itrEnd; ++itr)
{
SCTAB nDestTab = *itr;
if (nDestTab > MAXTAB) // append?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
bDrawIsInUndo = true;
- pDoc->DeleteTab(nDestTab);
+ rDoc.DeleteTab(nDestTab);
bDrawIsInUndo = false;
}
@@ -649,7 +649,7 @@ void ScUndoCopyTab::Undo()
{
SCTAB nDestTab = *itr;
if (nDestTab > MAXTAB) // append?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
pDocShell->Broadcast( ScTablesHint( SC_TAB_DELETED, nDestTab ) );
}
@@ -659,7 +659,7 @@ void ScUndoCopyTab::Undo()
void ScUndoCopyTab::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nDestTab = 0;
@@ -669,39 +669,39 @@ void ScUndoCopyTab::Redo()
SCTAB nNewTab = nDestTab;
SCTAB nOldTab = (*mpOldTabs)[i];
if (nDestTab > MAXTAB) // appended ?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
bDrawIsInUndo = true;
- pDoc->CopyTab( nOldTab, nNewTab );
+ rDoc.CopyTab( nOldTab, nNewTab );
bDrawIsInUndo = false;
- pViewShell->GetViewData()->MoveTab( nOldTab, nNewTab );
+ pViewShell->GetViewData().MoveTab( nOldTab, nNewTab );
SCTAB nAdjSource = nOldTab;
if ( nNewTab <= nOldTab )
++nAdjSource; // new position of source table after CopyTab
- if ( pDoc->IsScenario(nAdjSource) )
+ if ( rDoc.IsScenario(nAdjSource) )
{
- pDoc->SetScenario(nNewTab, true );
+ rDoc.SetScenario(nNewTab, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
- pDoc->GetScenarioData(nAdjSource, aComment, aColor, nScenFlags );
- pDoc->SetScenarioData(nNewTab, aComment, aColor, nScenFlags );
- bool bActive = pDoc->IsActiveScenario(nAdjSource);
- pDoc->SetActiveScenario(nNewTab, bActive );
- bool bVisible=pDoc->IsVisible(nAdjSource);
- pDoc->SetVisible(nNewTab,bVisible );
+ rDoc.GetScenarioData(nAdjSource, aComment, aColor, nScenFlags );
+ rDoc.SetScenarioData(nNewTab, aComment, aColor, nScenFlags );
+ bool bActive = rDoc.IsActiveScenario(nAdjSource);
+ rDoc.SetActiveScenario(nNewTab, bActive );
+ bool bVisible = rDoc.IsVisible(nAdjSource);
+ rDoc.SetVisible(nNewTab,bVisible );
}
- if ( pDoc->IsTabProtected( nAdjSource ) )
- pDoc->CopyTabProtection(nAdjSource, nNewTab);
+ if ( rDoc.IsTabProtected( nAdjSource ) )
+ rDoc.CopyTabProtection(nAdjSource, nNewTab);
if (mpNewNames)
{
const OUString& rName = (*mpNewNames)[i];
- pDoc->RenameTab(nNewTab, rName);
+ rDoc.RenameTab(nNewTab, rName);
}
}
@@ -755,15 +755,13 @@ OUString ScUndoTabColor::GetComment() const
void ScUndoTabColor::DoChange(bool bUndoType) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (!pDoc)
- return;
+ ScDocument& rDoc = pDocShell->GetDocument();
size_t nTabColorCount = aTabColorList.size();
for (size_t i = 0; i < nTabColorCount; ++i)
{
const ScUndoTabColorInfo& rTabColor = aTabColorList[i];
- pDoc->SetTabBgColor(rTabColor.mnTabId,
+ rDoc.SetTabBgColor(rTabColor.mnTabId,
bUndoType ? rTabColor.maOldTabBgColor : rTabColor.maNewTabBgColor);
}
@@ -807,7 +805,7 @@ ScUndoMakeScenario::ScUndoMakeScenario( ScDocShell* pNewDocShell,
nFlags( nF ),
pDrawUndo( NULL )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoMakeScenario::~ScUndoMakeScenario()
@@ -822,15 +820,15 @@ OUString ScUndoMakeScenario::GetComment() const
void ScUndoMakeScenario::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
pDocShell->SetInUndo( true );
bDrawIsInUndo = true;
- pDoc->DeleteTab( nDestTab );
+ rDoc.DeleteTab( nDestTab );
bDrawIsInUndo = false;
pDocShell->SetInUndo( false );
- DoSdrUndoAction( pDrawUndo, pDoc );
+ DoSdrUndoAction( pDrawUndo, &rDoc );
pDocShell->PostPaint(0,0,nDestTab,MAXCOL,MAXROW,MAXTAB, PAINT_ALL);
pDocShell->PostDataChanged();
@@ -887,7 +885,7 @@ ScUndoImportTab::ScUndoImportTab( ScDocShell* pShell,
pRedoDoc( NULL ),
pDrawUndo( NULL )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoImportTab::~ScUndoImportTab()
@@ -904,8 +902,8 @@ OUString ScUndoImportTab::GetComment() const
void ScUndoImportTab::DoChange() const
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
if (pViewShell)
{
if(nTab<nTabCount)
@@ -928,48 +926,48 @@ void ScUndoImportTab::Undo()
// Inserted range names, etc.
SCTAB i;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bMakeRedo = !pRedoDoc;
if (bMakeRedo)
{
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndo( pDoc, nTab,nTab+nCount-1, true,true );
+ pRedoDoc->InitUndo( &rDoc, nTab,nTab+nCount-1, true,true );
OUString aOldName;
for (i=0; i<nCount; i++)
{
SCTAB nTabPos=nTab+i;
- pDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,false, pRedoDoc );
- pDoc->GetName( nTabPos, aOldName );
+ rDoc.CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,false, pRedoDoc );
+ rDoc.GetName( nTabPos, aOldName );
pRedoDoc->RenameTab( nTabPos, aOldName, false );
- pRedoDoc->SetTabBgColor( nTabPos, pDoc->GetTabBgColor(nTabPos) );
+ pRedoDoc->SetTabBgColor( nTabPos, rDoc.GetTabBgColor(nTabPos) );
- if ( pDoc->IsScenario(nTabPos) )
+ if ( rDoc.IsScenario(nTabPos) )
{
pRedoDoc->SetScenario(nTabPos, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
- pDoc->GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
+ rDoc.GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
pRedoDoc->SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
- bool bActive = pDoc->IsActiveScenario(nTabPos);
+ bool bActive = rDoc.IsActiveScenario(nTabPos);
pRedoDoc->SetActiveScenario(nTabPos, bActive );
- bool bVisible=pDoc->IsVisible(nTabPos);
+ bool bVisible = rDoc.IsVisible(nTabPos);
pRedoDoc->SetVisible(nTabPos,bVisible );
}
- if ( pDoc->IsTabProtected( nTabPos ) )
- pRedoDoc->SetTabProtection(nTabPos, pDoc->GetTabProtection(nTabPos));
+ if ( rDoc.IsTabProtected( nTabPos ) )
+ pRedoDoc->SetTabProtection(nTabPos, rDoc.GetTabProtection(nTabPos));
}
}
- DoSdrUndoAction( pDrawUndo, pDoc ); // before the sheets are deleted
+ DoSdrUndoAction( pDrawUndo, &rDoc ); // before the sheets are deleted
bDrawIsInUndo = true;
for (i=0; i<nCount; i++)
- pDoc->DeleteTab( nTab );
+ rDoc.DeleteTab( nTab );
bDrawIsInUndo = false;
DoChange();
@@ -983,7 +981,7 @@ void ScUndoImportTab::Redo()
return;
}
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OUString aName;
SCTAB i;
for (i=0; i<nCount; i++) // first insert all sheets (#63304#)
@@ -991,31 +989,31 @@ void ScUndoImportTab::Redo()
SCTAB nTabPos=nTab+i;
pRedoDoc->GetName(nTabPos,aName);
bDrawIsInUndo = true;
- pDoc->InsertTab(nTabPos,aName);
+ rDoc.InsertTab(nTabPos,aName);
bDrawIsInUndo = false;
}
for (i=0; i<nCount; i++) // then copy into inserted sheets
{
SCTAB nTabPos=nTab+i;
- pRedoDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,false, pDoc );
- pDoc->SetTabBgColor( nTabPos, pRedoDoc->GetTabBgColor(nTabPos) );
+ pRedoDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,false, &rDoc );
+ rDoc.SetTabBgColor( nTabPos, pRedoDoc->GetTabBgColor(nTabPos) );
if ( pRedoDoc->IsScenario(nTabPos) )
{
- pDoc->SetScenario(nTabPos, true );
+ rDoc.SetScenario(nTabPos, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
pRedoDoc->GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
- pDoc->SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
+ rDoc.SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
bool bActive = pRedoDoc->IsActiveScenario(nTabPos);
- pDoc->SetActiveScenario(nTabPos, bActive );
+ rDoc.SetActiveScenario(nTabPos, bActive );
bool bVisible=pRedoDoc->IsVisible(nTabPos);
- pDoc->SetVisible(nTabPos,bVisible );
+ rDoc.SetVisible(nTabPos,bVisible );
}
if ( pRedoDoc->IsTabProtected( nTabPos ) )
- pDoc->SetTabProtection(nTabPos, pRedoDoc->GetTabProtection(nTabPos));
+ rDoc.SetTabProtection(nTabPos, pRedoDoc->GetTabProtection(nTabPos));
}
RedoSdrUndoAction( pDrawUndo ); // after the sheets are inserted
@@ -1026,7 +1024,7 @@ void ScUndoImportTab::Redo()
void ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -1035,39 +1033,39 @@ bool ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
return rTarget.ISA(ScTabViewTarget);
}
-ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const OUString& rDoc ) :
+ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const OUString& rDocName ) :
ScSimpleUndo( pShell ),
- aDocName( rDoc ),
+ aDocName( rDocName ),
nRefreshDelay( 0 ),
nCount( 0 )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
pTabs = new SCTAB[nTabCount];
pModes = new sal_uInt8[nTabCount];
pTabNames = new OUString[nTabCount];
for (SCTAB i=0; i<nTabCount; i++)
{
- sal_uInt8 nMode = pDoc->GetLinkMode(i);
+ sal_uInt8 nMode = rDoc.GetLinkMode(i);
if (nMode)
- if (pDoc->GetLinkDoc(i) == aDocName)
+ if (rDoc.GetLinkDoc(i) == aDocName)
{
if (!nCount)
{
- aFltName = pDoc->GetLinkFlt(i);
- aOptions = pDoc->GetLinkOpt(i);
- nRefreshDelay = pDoc->GetLinkRefreshDelay(i);
+ aFltName = rDoc.GetLinkFlt(i);
+ aOptions = rDoc.GetLinkOpt(i);
+ nRefreshDelay = rDoc.GetLinkRefreshDelay(i);
}
else
{
- OSL_ENSURE(OUString(aFltName) == pDoc->GetLinkFlt(i) &&
- OUString(aOptions) == pDoc->GetLinkOpt(i),
+ OSL_ENSURE(OUString(aFltName) == rDoc.GetLinkFlt(i) &&
+ OUString(aOptions) == rDoc.GetLinkOpt(i),
"different Filter for a Document?");
}
pTabs[nCount] = i;
pModes[nCount] = nMode;
- pTabNames[nCount] = pDoc->GetLinkTab(i);
+ pTabNames[nCount] = rDoc.GetLinkTab(i);
++nCount;
}
}
@@ -1087,13 +1085,13 @@ OUString ScUndoRemoveLink::GetComment() const
void ScUndoRemoveLink::DoChange( bool bLink ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OUString aEmpty;
for (sal_uInt16 i=0; i<nCount; i++)
if (bLink) // establish link
- pDoc->SetLink( pTabs[i], pModes[i], aDocName, aFltName, aOptions, pTabNames[i], nRefreshDelay );
+ rDoc.SetLink( pTabs[i], pModes[i], aDocName, aFltName, aOptions, pTabNames[i], nRefreshDelay );
else // remove link
- pDoc->SetLink( pTabs[i], SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
+ rDoc.SetLink( pTabs[i], SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
pDocShell->UpdateLinks();
}
@@ -1130,7 +1128,7 @@ ScUndoShowHideTab::~ScUndoShowHideTab()
void ScUndoShowHideTab::DoChange( bool bShowP ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab;
@@ -1138,7 +1136,7 @@ void ScUndoShowHideTab::DoChange( bool bShowP ) const
for(std::vector<SCTAB>::const_iterator itr = undoTabs.begin(), itrEnd = undoTabs.end(); itr != itrEnd; ++itr)
{
nTab = *itr;
- pDoc->SetVisible( nTab, bShowP );
+ rDoc.SetVisible( nTab, bShowP );
if (pViewShell)
pViewShell->SetTabNo(nTab,true);
}
@@ -1160,7 +1158,7 @@ void ScUndoShowHideTab::Redo()
void ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute( bShow ? FID_TABLE_SHOW : FID_TABLE_HIDE,
SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -1199,7 +1197,7 @@ ScUndoDocProtect::~ScUndoDocProtect()
void ScUndoDocProtect::DoProtect(bool bProtect)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bProtect)
{
@@ -1208,12 +1206,12 @@ void ScUndoDocProtect::DoProtect(bool bProtect)
auto_ptr<ScDocProtection> pCopy(new ScDocProtection(*mpProtectSettings));
SAL_WNODEPRECATED_DECLARATIONS_POP
pCopy->setProtected(true);
- pDoc->SetDocProtection(pCopy.get());
+ rDoc.SetDocProtection(pCopy.get());
}
else
{
// remove protection.
- pDoc->SetDocProtection(NULL);
+ rDoc.SetDocProtection(NULL);
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1271,7 +1269,7 @@ ScUndoTabProtect::~ScUndoTabProtect()
void ScUndoTabProtect::DoProtect(bool bProtect)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bProtect)
{
@@ -1280,12 +1278,12 @@ void ScUndoTabProtect::DoProtect(bool bProtect)
auto_ptr<ScTableProtection> pCopy(new ScTableProtection(*mpProtectSettings));
SAL_WNODEPRECATED_DECLARATIONS_POP
pCopy->setProtected(true);
- pDoc->SetTabProtection(mnTab, pCopy.get());
+ rDoc.SetTabProtection(mnTab, pCopy.get());
}
else
{
// remove protection.
- pDoc->SetTabProtection(mnTab, NULL);
+ rDoc.SetTabProtection(mnTab, NULL);
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1345,11 +1343,11 @@ ScUndoPrintRange::~ScUndoPrintRange()
void ScUndoPrintRange::DoChange(bool bUndo)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bUndo)
- pDoc->RestorePrintRanges( *pOldRanges );
+ rDoc.RestorePrintRanges( *pOldRanges );
else
- pDoc->RestorePrintRanges( *pNewRanges );
+ rDoc.RestorePrintRanges( *pNewRanges );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -1416,10 +1414,10 @@ OUString ScUndoScenarioFlags::GetComment() const
void ScUndoScenarioFlags::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->RenameTab( nTab, aOldName );
- pDoc->SetScenarioData( nTab, aOldComment, aOldColor, nOldFlags );
+ rDoc.RenameTab( nTab, aOldName );
+ rDoc.SetScenarioData( nTab, aOldComment, aOldColor, nOldFlags );
pDocShell->PostPaintGridAll();
// The sheet name might be used in a formula ...
@@ -1433,10 +1431,10 @@ void ScUndoScenarioFlags::Undo()
void ScUndoScenarioFlags::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->RenameTab( nTab, aNewName );
- pDoc->SetScenarioData( nTab, aNewComment, aNewColor, nNewFlags );
+ rDoc.RenameTab( nTab, aNewName );
+ rDoc.SetScenarioData( nTab, aNewComment, aNewColor, nNewFlags );
pDocShell->PostPaintGridAll();
// The sheet name might be used in a formula ...
@@ -1480,8 +1478,8 @@ OUString ScUndoRenameObject::GetComment() const
SdrObject* ScUndoRenameObject::GetObject()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if ( pDrawLayer )
{
sal_uInt16 nCount = pDrawLayer->GetPageCount();
@@ -1550,8 +1548,8 @@ void ScUndoLayoutRTL::DoChange( bool bNew )
{
pDocShell->SetInUndo( true );
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->SetLayoutRTL( nTab, bNew );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.SetLayoutRTL( nTab, bNew );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -1575,7 +1573,7 @@ void ScUndoLayoutRTL::Redo()
void ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute( FID_TAB_RTL, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
diff --git a/sc/source/ui/undo/undoutil.cxx b/sc/source/ui/undo/undoutil.cxx
index 51ba554e5439..0e0891cb29b8 100644
--- a/sc/source/ui/undo/undoutil.cxx
+++ b/sc/source/ui/undo/undoutil.cxx
@@ -38,14 +38,14 @@ void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nViewTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nViewTab = pViewShell->GetViewData().GetTabNo();
if ( nViewTab < nStartZ || nViewTab > nEndZ )
pViewShell->SetTabNo( nStartZ );
pViewShell->DoneBlockMode();
pViewShell->MoveCursorAbs( nStartX, nStartY, SC_FOLLOW_JUMP, false, false );
pViewShell->InitOwnBlockMode();
- pViewShell->GetViewData()->GetMarkData().
+ pViewShell->GetViewData().GetMarkData().
SetMarkArea( ScRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ) );
pViewShell->MarkDataChanged();
}
diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx
index 82f540905501..d7a273c240da 100644
--- a/sc/source/ui/unoobj/addruno.cxx
+++ b/sc/source/ui/unoobj/addruno.cxx
@@ -37,13 +37,13 @@ ScAddressConversionObj::ScAddressConversionObj(ScDocShell* pDocSh, bool _bIsRang
nRefSheet( 0 ),
bIsRange( _bIsRange )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScAddressConversionObj::~ScAddressConversionObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScAddressConversionObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -60,11 +60,11 @@ bool ScAddressConversionObj::ParseUIString( const OUString& rUIString, ::formula
if (!pDocShell)
return false;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bSuccess = false;
if ( bIsRange )
{
- sal_uInt16 nResult = aRange.ParseAny( rUIString, pDoc, eConv );
+ sal_uInt16 nResult = aRange.ParseAny( rUIString, &rDoc, eConv );
if ( nResult & SCA_VALID )
{
if ( ( nResult & SCA_TAB_3D ) == 0 )
@@ -78,7 +78,7 @@ bool ScAddressConversionObj::ParseUIString( const OUString& rUIString, ::formula
}
else
{
- sal_uInt16 nResult = aRange.aStart.Parse( rUIString, pDoc, eConv );
+ sal_uInt16 nResult = aRange.aStart.Parse( rUIString, &rDoc, eConv );
if ( nResult & SCA_VALID )
{
if ( ( nResult & SCA_TAB_3D ) == 0 )
@@ -222,7 +222,7 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro
if ( !pDocShell )
throw uno::RuntimeException();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
uno::Any aRet;
OUString aNameStr(aPropertyName);
@@ -253,9 +253,9 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro
if ( aRange.aStart.Tab() != nRefSheet )
nFlags |= SCA_TAB_3D;
if ( bIsRange )
- aFormatStr = aRange.Format(nFlags, pDoc);
+ aFormatStr = aRange.Format(nFlags, &rDoc);
else
- aFormatStr = aRange.aStart.Format(nFlags, pDoc);
+ aFormatStr = aRange.aStart.Format(nFlags, &rDoc);
aRet <<= aFormatStr;
}
else if ( aNameStr.equalsAscii( SC_UNONAME_PERSREPR ) || aNameStr.equalsAscii( SC_UNONAME_XLA1REPR ) )
@@ -264,7 +264,7 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro
::formula::FormulaGrammar::CONV_XL_A1 : ::formula::FormulaGrammar::CONV_OOO;
// generate file format string - always include sheet
- OUString aFormatStr(aRange.aStart.Format(SCA_VALID | SCA_TAB_3D, pDoc, eConv));
+ OUString aFormatStr(aRange.aStart.Format(SCA_VALID | SCA_TAB_3D, &rDoc, eConv));
if ( bIsRange )
{
// manually concatenate range so both parts always have the sheet name
@@ -272,7 +272,7 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro
sal_uInt16 nFlags = SCA_VALID;
if( eConv != ::formula::FormulaGrammar::CONV_XL_A1 )
nFlags |= SCA_TAB_3D;
- OUString aSecond(aRange.aEnd.Format(nFlags, pDoc, eConv));
+ OUString aSecond(aRange.aEnd.Format(nFlags, &rDoc, eConv));
aFormatStr += aSecond ;
}
aRet <<= OUString( aFormatStr );
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 276a2fec54d8..77321977bf36 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1045,8 +1045,8 @@ void ScHelperFunctions::AssignTableBorder2ToAny( uno::Any& rAny,
void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pDocShell->GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
ScDocument* pUndoDoc = NULL;
if (bUndo)
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
@@ -1059,17 +1059,17 @@ void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& r
if (bUndo)
{
if ( i==0 )
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
else
pUndoDoc->AddUndoTab( nTab, nTab );
- pDoc->CopyToDocument( aRange, IDF_ATTRIB, false, pUndoDoc );
+ rDoc.CopyToDocument( aRange, IDF_ATTRIB, false, pUndoDoc );
}
ScMarkData aMark;
aMark.SetMarkArea( aRange );
aMark.SelectTable( nTab, true );
- pDoc->ApplySelectionFrame( aMark, &rOuter, &rInner );
+ rDoc.ApplySelectionFrame( aMark, &rOuter, &rInner );
// RowHeight bei Umrandung alleine nicht noetig
}
@@ -1091,15 +1091,15 @@ void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& r
static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
const uno::Sequence< uno::Sequence<uno::Any> >& aData )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCTAB nTab = rRange.aStart.Tab();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCCOL nEndCol = rRange.aEnd.Col();
SCROW nEndRow = rRange.aEnd.Row();
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
- if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
+ if ( !rDoc.IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
{
//! error message
return false;
@@ -1121,11 +1121,11 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
if ( bUndo )
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ rDoc.CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, false, pUndoDoc );
}
- pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
+ rDoc.DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
bool bError = false;
SCROW nDocRow = nStartRow;
@@ -1146,7 +1146,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
case uno::TypeClass_VOID:
{
// void = "no value"
- pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
+ rDoc.SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
}
break;
@@ -1162,7 +1162,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
{
double fVal(0.0);
rElement >>= fVal;
- pDoc->SetValue(aPos, fVal);
+ rDoc.SetValue(aPos, fVal);
}
break;
@@ -1174,7 +1174,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
{
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(aPos, aUStr, &aParam);
+ rDoc.SetString(aPos, aUStr, &aParam);
}
}
break;
@@ -1186,8 +1186,8 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
if ( rElement >>= aTokens )
{
ScTokenArray aTokenArray;
- ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokens );
- pDoc->SetFormula(aPos, aTokenArray);
+ ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, aTokens );
+ rDoc.SetFormula(aPos, aTokenArray);
}
else
bError = true;
@@ -1230,15 +1230,15 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
const uno::Sequence< uno::Sequence<OUString> >& aData,
const formula::FormulaGrammar::Grammar eGrammar )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCTAB nTab = rRange.aStart.Tab();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCCOL nEndCol = rRange.aEnd.Col();
SCROW nEndRow = rRange.aEnd.Row();
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
- if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
+ if ( !rDoc.IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
{
//! error message
return false;
@@ -1260,11 +1260,11 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
if ( bUndo )
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( rRange, IDF_CONTENTS, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ rDoc.CopyToDocument( rRange, IDF_CONTENTS, false, pUndoDoc );
}
- pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
+ rDoc.DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
bool bError = false;
SCROW nDocRow = nStartRow;
@@ -1282,17 +1282,17 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
ScInputStringType aRes =
ScStringUtil::parseInputString(
- *pDoc->GetFormatTable(), aText, LANGUAGE_ENGLISH_US);
+ *rDoc.GetFormatTable(), aText, LANGUAGE_ENGLISH_US);
switch (aRes.meType)
{
case ScInputStringType::Formula:
- pDoc->SetFormula(aPos, aRes.maText, eGrammar);
+ rDoc.SetFormula(aPos, aRes.maText, eGrammar);
break;
case ScInputStringType::Number:
- pDoc->SetValue(aPos, aRes.mfValue);
+ rDoc.SetValue(aPos, aRes.mfValue);
break;
case ScInputStringType::Text:
- pDoc->SetTextCell(aPos, aRes.maText);
+ rDoc.SetTextCell(aPos, aRes.maText);
break;
default:
;
@@ -1328,13 +1328,10 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
}
// used in ScCellRangeObj::getFormulaArray and ScCellObj::GetInputString_Impl
-static OUString lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPos, bool bEnglish )
+static OUString lcl_GetInputString( ScDocument& rDoc, const ScAddress& rPos, bool bEnglish )
{
- if (!pDoc)
- return EMPTY_OUSTRING;
-
ScRefCellValue aCell;
- aCell.assign(*pDoc, rPos);
+ aCell.assign(rDoc, rPos);
if (aCell.isEmpty())
return EMPTY_OUSTRING;
@@ -1349,11 +1346,11 @@ static OUString lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPos, boo
}
SvNumberFormatter* pFormatter = bEnglish ? ScGlobal::GetEnglishFormatter() :
- pDoc->GetFormatTable();
+ rDoc.GetFormatTable();
// Since the English formatter was constructed with
// LANGUAGE_ENGLISH_US the "General" format has index key 0,
// we don't have to query.
- sal_uInt32 nNumFmt = bEnglish ? 0 : pDoc->GetNumberFormat(rPos);
+ sal_uInt32 nNumFmt = bEnglish ? 0 : rDoc.GetNumberFormat(rPos);
if (eType == CELLTYPE_EDIT)
{
@@ -1362,13 +1359,13 @@ static OUString lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPos, boo
const EditTextObject* pData = aCell.mpEditText;
if (pData)
{
- EditEngine& rEngine = pDoc->GetEditEngine();
+ EditEngine& rEngine = rDoc.GetEditEngine();
rEngine.SetText(*pData);
aVal = rEngine.GetText(LINEEND_LF);
}
}
else
- ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter, pDoc);
+ ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter, &rDoc);
// ggf. ein ' davorhaengen wie in ScTabViewShell::UpdateInputHandler
if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT )
@@ -1412,9 +1409,9 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
if (pDocShell) // Null if created with createInstance
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->AddUnoObject(*this);
- nObjectId = pDoc->GetNewUnoId();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.AddUnoObject(*this);
+ nObjectId = rDoc.GetNewUnoId();
}
}
@@ -1437,9 +1434,9 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR) :
{
if (pDocShell) // Null if created with createInstance
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->AddUnoObject(*this);
- nObjectId = pDoc->GetNewUnoId();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.AddUnoObject(*this);
+ nObjectId = rDoc.GetNewUnoId();
}
}
@@ -1449,7 +1446,7 @@ ScCellRangesBase::~ScCellRangesBase()
// during ForgetCurrentAttrs
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
ForgetCurrentAttrs();
ForgetMarkData();
@@ -1486,8 +1483,8 @@ const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsFlat()
if ( !pCurrentFlat && pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pCurrentFlat = pDoc->CreateSelectionPattern( *GetMarkData(), false );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ pCurrentFlat = rDoc.CreateSelectionPattern( *GetMarkData(), false );
}
return pCurrentFlat;
}
@@ -1498,8 +1495,8 @@ const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsDeep()
if ( !pCurrentDeep && pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pCurrentDeep = pDoc->CreateSelectionPattern( *GetMarkData(), true );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ pCurrentDeep = rDoc.CreateSelectionPattern( *GetMarkData(), true );
}
return pCurrentDeep;
}
@@ -1536,12 +1533,12 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
boost::scoped_ptr<ScRangeList> pUndoRanges;
- if ( pDoc->HasUnoRefUndo() )
+ if ( rDoc.HasUnoRefUndo() )
pUndoRanges.reset(new ScRangeList( aRanges ));
- if ( aRanges.UpdateReference( rRef.GetMode(), pDoc, rRef.GetRange(),
+ if ( aRanges.UpdateReference( rRef.GetMode(), &rDoc, rRef.GetRange(),
rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) )
{
// i#90076; the object "this" was destroyed after calling ScTableSheetObj::getImplementation
@@ -1569,7 +1566,7 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
bGotDataChangedHint = true;
if ( pUndoRanges )
- pDoc->AddUnoRefChange( nObjectId, *pUndoRanges );
+ rDoc.AddUnoRefChange( nObjectId, *pUndoRanges );
}
}
else if ( rHint.ISA( SfxSimpleHint ) )
@@ -1615,9 +1612,9 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
// the EventObject holds a Ref to this object until after the listener calls
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for ( sal_uInt16 n=0; n<aValueListeners.size(); n++ )
- pDoc->AddUnoListenerCall( aValueListeners[n], aEvent );
+ rDoc.AddUnoListenerCall( aValueListeners[n], aEvent );
bGotDataChangedHint = false;
}
@@ -1655,9 +1652,9 @@ void ScCellRangesBase::RefChanged()
{
pValueListener->EndListeningAll();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
- pDoc->StartListeningArea( *aRanges[ i ], pValueListener );
+ rDoc.StartListeningArea( *aRanges[ i ], pValueListener );
}
ForgetCurrentAttrs();
@@ -1667,7 +1664,7 @@ void ScCellRangesBase::RefChanged()
ScDocument* ScCellRangesBase::GetDocument() const
{
if (pDocShell)
- return pDocShell->GetDocument();
+ return &pDocShell->GetDocument();
else
return NULL;
}
@@ -1683,7 +1680,7 @@ void ScCellRangesBase::InitInsertRange(ScDocShell* pDocSh, const ScRange& rR)
aRanges.RemoveAll();
aRanges.Append( aCellRange );
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
RefChanged(); // Range im Range-Objekt anpassen
}
@@ -1805,8 +1802,8 @@ double SAL_CALL ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunct
ScAddress aDummy; // wenn nicht Marked, ignoriert wegen Negative
double fVal;
ScSubTotalFunc eFunc = ScDPUtil::toSubTotalFunc(nFunction);
- ScDocument* pDoc = pDocShell->GetDocument();
- if ( !pDoc->GetSelectionFunction( eFunc, aDummy, aMark, fVal ) )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if ( !rDoc.GetSelectionFunction( eFunc, aDummy, aMark, fVal ) )
{
throw uno::RuntimeException(); //! own exception?
}
@@ -1903,7 +1900,7 @@ beans::PropertyState ScCellRangesBase::GetOnePropertyState( sal_uInt16 nItemWhic
else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
{
// a style is always set, there's no default state
- const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
+ const ScStyleSheet* pStyle = pDocShell->GetDocument().GetSelectionStyle(*GetMarkData());
if (pStyle)
eRet = beans::PropertyState_DIRECT_VALUE;
else
@@ -2005,14 +2002,14 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
if ( pEntry )
{
if ( IsScItemWid( pEntry->nWID ) )
{
- const ScPatternAttr* pPattern = pDoc->GetDefPattern();
+ const ScPatternAttr* pPattern = rDoc.GetDefPattern();
if ( pPattern )
{
const SfxItemSet& rSet = pPattern->GetItemSet();
@@ -2046,7 +2043,7 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert
case SC_WID_UNO_TBLBORD:
case SC_WID_UNO_TBLBORD2:
{
- const ScPatternAttr* pPattern = pDoc->GetDefPattern();
+ const ScPatternAttr* pPattern = rDoc.GetDefPattern();
if ( pPattern )
{
if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
@@ -2067,11 +2064,11 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert
bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
- pDoc->GetStorageGrammar() :
+ rDoc.GetStorageGrammar() :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
aAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
- new ScTableConditionalFormat( pDoc, 0, aRanges[0]->aStart.Tab(), eGrammar ));
+ new ScTableConditionalFormat( &rDoc, 0, aRanges[0]->aStart.Tab(), eGrammar ));
}
break;
case SC_WID_UNO_VALIDAT:
@@ -2081,11 +2078,11 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert
bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
- pDoc->GetStorageGrammar() :
+ rDoc.GetStorageGrammar() :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
aAny <<= uno::Reference<beans::XPropertySet>(
- new ScTableValidationObj( pDoc, 0, eGrammar ));
+ new ScTableValidationObj( &rDoc, 0, eGrammar ));
}
break;
case SC_WID_UNO_NUMRULES:
@@ -2112,7 +2109,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangesBase::getPropertySe
}
static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rValue,
- ScPatternAttr& rPattern, ScDocument* pDoc,
+ ScPatternAttr& rPattern, ScDocument &rDoc,
sal_uInt16& rFirstItemId, sal_uInt16& rSecondItemId )
{
rFirstItemId = rEntry.nWID;
@@ -2124,7 +2121,7 @@ static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const
case ATTR_VALUE_FORMAT:
{
// language for number formats
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
sal_uLong nOldFormat = ((const SfxUInt32Item&)rSet.Get( ATTR_VALUE_FORMAT )).GetValue();
LanguageType eOldLang = ((const SvxLanguageItem&)rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
nOldFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
@@ -2249,7 +2246,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
{
if ( !aRanges.empty() ) // leer = nichts zu tun
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund)
// muss vorher das alte Item aus dem Dokument geholt werden
@@ -2263,7 +2260,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
rSet.ClearInvalidItems();
sal_uInt16 nFirstItem, nSecondItem;
- lcl_SetCellProperty( *pEntry, aValue, aPattern, pDoc, nFirstItem, nSecondItem );
+ lcl_SetCellProperty( *pEntry, aValue, aPattern, rDoc, nFirstItem, nSecondItem );
for (sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++)
if ( nWhich != nFirstItem && nWhich != nSecondItem )
@@ -2287,13 +2284,13 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
/* TODO: Iterate through the range */
ScAddress aAddr = aRange.aStart;
- ScDocument *pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRefCellValue aCell;
- aCell.assign(*pDoc, aAddr);
+ aCell.assign(rDoc, aAddr);
- OUString aStr = aCell.getString(pDoc);
- EditEngine aEngine( pDoc->GetEnginePool() );
- aEngine.SetEditTextObjectPool(pDoc->GetEditPool());
+ OUString aStr = aCell.getString(&rDoc);
+ EditEngine aEngine( rDoc.GetEnginePool() );
+ aEngine.SetEditTextObjectPool(rDoc.GetEditPool());
/* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
* there are no other attribs for the cell.
@@ -2310,7 +2307,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
aEngine.QuickSetAttribs(aAttr, ESelection(0, 0, 0, aStr.getLength()));
// The cell will own the text object instance.
- pDoc->SetEditText(aRanges[0]->aStart, aEngine.CreateTextObject());
+ rDoc.SetEditText(aRanges[0]->aStart, aEngine.CreateTextObject());
}
}
}
@@ -2368,15 +2365,15 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
ScTableConditionalFormat::getImplementation( xInterface );
if (pFormat)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
formula::FormulaGrammar::GRAM_UNSPECIFIED :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
- ScConditionalFormat* pNew = new ScConditionalFormat( 0, pDoc ); // Index wird beim Einfuegen gesetzt
- pFormat->FillFormat( *pNew, pDoc, eGrammar );
+ ScConditionalFormat* pNew = new ScConditionalFormat( 0, &rDoc ); // Index wird beim Einfuegen gesetzt
+ pFormat->FillFormat( *pNew, &rDoc, eGrammar );
pNew->AddRange( aRanges );
SCTAB nTab = aRanges.front()->aStart.Tab();
pDocShell->GetDocFunc().ReplaceConditionalFormat( 0, pNew, nTab, aRanges );
@@ -2395,7 +2392,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
ScTableValidationObj::getImplementation( xInterface );
if (pValidObj)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
@@ -2403,11 +2400,11 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
boost::scoped_ptr<ScValidationData> pNewData(
- pValidObj->CreateValidationData( pDoc, eGrammar ));
- sal_uLong nIndex = pDoc->AddValidationEntry( *pNewData );
+ pValidObj->CreateValidationData( &rDoc, eGrammar ));
+ sal_uLong nIndex = rDoc.AddValidationEntry( *pNewData );
pNewData.reset();
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, true, true );
}
@@ -2452,13 +2449,13 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
{
case ATTR_VALUE_FORMAT:
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
sal_uLong nOldFormat = ((const SfxUInt32Item&)
pDataSet->Get( ATTR_VALUE_FORMAT )).GetValue();
LanguageType eOldLang = ((const SvxLanguageItem&)
pDataSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
- nOldFormat = pDoc->GetFormatTable()->
+ nOldFormat = rDoc.GetFormatTable()->
GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
rAny <<= (sal_Int32)( nOldFormat );
}
@@ -2491,7 +2488,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
case SC_WID_UNO_CELLSTYL:
{
OUString aStyleName;
- const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
+ const ScStyleSheet* pStyle = pDocShell->GetDocument().GetSelectionStyle(*GetMarkData());
if (pStyle)
aStyleName = pStyle->GetName();
rAny <<= OUString( ScStyleNameConversion::DisplayToProgrammaticName(
@@ -2508,11 +2505,11 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
SvxBoxItem aOuter(ATTR_BORDER);
SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aMark;
aMark.SetMarkArea( *pFirst );
aMark.SelectTable( pFirst->aStart.Tab(), true );
- pDoc->GetSelectionFrame( aMark, aOuter, aInner );
+ rDoc.GetSelectionFrame( aMark, aOuter, aInner );
if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
ScHelperFunctions::AssignTableBorder2ToAny( rAny, aOuter, aInner);
@@ -2528,11 +2525,11 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
if ( pPattern )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
- pDoc->GetStorageGrammar() :
+ rDoc.GetStorageGrammar() :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
const std::vector<sal_uInt32>& rIndex = ((const ScCondFormatItem&)
pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData();
@@ -2540,7 +2537,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
if(!rIndex.empty())
nIndex = rIndex[0];
rAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
- new ScTableConditionalFormat( pDoc, nIndex, aRanges.front()->aStart.Tab(), eGrammar ));
+ new ScTableConditionalFormat( &rDoc, nIndex, aRanges.front()->aStart.Tab(), eGrammar ));
}
}
break;
@@ -2551,16 +2548,16 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
if ( pPattern )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
- pDoc->GetStorageGrammar() :
+ rDoc.GetStorageGrammar() :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
sal_uLong nIndex = ((const SfxUInt32Item&)
pPattern->GetItem(ATTR_VALIDDATA)).GetValue();
rAny <<= uno::Reference<beans::XPropertySet>(
- new ScTableValidationObj( pDoc, nIndex, eGrammar ));
+ new ScTableValidationObj( &rDoc, nIndex, eGrammar ));
}
}
break;
@@ -2573,7 +2570,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
case SC_WID_UNO_ABSNAME:
{
OUString sRet;
- aRanges.Format(sRet, SCR_ABS_3D, pDocShell->GetDocument());
+ aRanges.Format(sRet, SCR_ABS_3D, &pDocShell->GetDocument());
rAny <<= sRet;
}
}
@@ -2668,7 +2665,7 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< OUString
}
}
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
boost::scoped_ptr<ScPatternAttr> pOldPattern;
boost::scoped_ptr<ScPatternAttr> pNewPattern;
@@ -2685,13 +2682,13 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< OUString
{
pOldPattern.reset(new ScPatternAttr( *GetCurrentAttrsDeep() ));
pOldPattern->GetItemSet().ClearInvalidItems();
- pNewPattern.reset(new ScPatternAttr( pDoc->GetPool() ));
+ pNewPattern.reset(new ScPatternAttr( rDoc.GetPool() ));
}
// collect items in pNewPattern, apply with one call after the loop
sal_uInt16 nFirstItem, nSecondItem;
- lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
+ lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem );
// put only affected items into new set
if ( nFirstItem )
@@ -2811,7 +2808,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
}
}
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
boost::scoped_ptr<ScPatternAttr> pOldPattern;
boost::scoped_ptr<ScPatternAttr> pNewPattern;
@@ -2829,7 +2826,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
{
pOldPattern.reset(new ScPatternAttr( *GetCurrentAttrsDeep() ));
pOldPattern->GetItemSet().ClearInvalidItems();
- pNewPattern.reset(new ScPatternAttr( pDoc->GetPool() ));
+ pNewPattern.reset(new ScPatternAttr( rDoc.GetPool() ));
}
// collect items in pNewPattern, apply with one call after the loop
@@ -2837,7 +2834,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
sal_uInt16 nFirstItem, nSecondItem;
try
{
- lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
+ lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem );
// put only affected items into new set
if ( nFirstItem )
@@ -3000,7 +2997,7 @@ ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const
SCCOL nStartX;
SCROW nStartY; // Anfang holen
- if (!pDocShell->GetDocument()->GetDataStart( nTab, nStartX, nStartY ))
+ if (!pDocShell->GetDocument().GetDataStart( nTab, nStartX, nStartY ))
{
nStartX = 0;
nStartY = 0;
@@ -3008,7 +3005,7 @@ ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const
SCCOL nEndX;
SCROW nEndY; // Ende holen
- if (!pDocShell->GetDocument()->GetTableArea( nTab, nEndX, nEndY ))
+ if (!pDocShell->GetDocument().GetTableArea( nTab, nEndX, nEndY ))
{
nEndX = 0;
nEndY = 0;
@@ -3020,7 +3017,7 @@ ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const
}
if (!xChartRanges.Is()) // sonst Ranges direkt uebernehmen
xChartRanges = new ScRangeList(aRanges);
- ScChartArray aArr( pDocShell->GetDocument(), xChartRanges, OUString() );
+ ScChartArray aArr( &pDocShell->GetDocument(), xChartRanges, OUString() );
// RowAsHdr = ColHeaders und umgekehrt
aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr );
@@ -3101,8 +3098,8 @@ void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<doub
ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, nRowCount );
if ( pDocShell && xChartRanges.Is() )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChartArray aArr( pDoc, xChartRanges, OUString() );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChartArray aArr( &rDoc, xChartRanges, OUString() );
aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
if (pPosMap)
@@ -3124,9 +3121,9 @@ void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<doub
{
double fVal = pArray[nCol];
if ( fVal == DBL_MIN )
- pDoc->SetEmptyCell(*pPos);
+ rDoc.SetEmptyCell(*pPos);
else
- pDoc->SetValue(*pPos, pArray[nCol]);
+ rDoc.SetValue(*pPos, pArray[nCol]);
}
}
}
@@ -3174,8 +3171,8 @@ void SAL_CALL ScCellRangesBase::setRowDescriptions(
ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( 1, nRowCount );
if ( pDocShell && xChartRanges.Is() )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChartArray aArr( pDoc, xChartRanges, OUString() );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChartArray aArr( &rDoc, xChartRanges, OUString() );
aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
if (pPosMap)
@@ -3191,12 +3188,12 @@ void SAL_CALL ScCellRangesBase::setRowDescriptions(
{
const OUString& aStr = pArray[nRow];
if (aStr.isEmpty())
- pDoc->SetEmptyCell(*pPos);
+ rDoc.SetEmptyCell(*pPos);
else
{
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(*pPos, aStr, &aParam);
+ rDoc.SetString(*pPos, aStr, &aParam);
}
}
}
@@ -3245,8 +3242,8 @@ void SAL_CALL ScCellRangesBase::setColumnDescriptions(
ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, 1 );
if ( pDocShell && xChartRanges.Is() )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChartArray aArr( pDoc, xChartRanges, OUString() );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChartArray aArr( &rDoc, xChartRanges, OUString() );
aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
if (pPosMap)
@@ -3262,12 +3259,12 @@ void SAL_CALL ScCellRangesBase::setColumnDescriptions(
{
const OUString& aStr = pArray[nCol];
if (aStr.isEmpty())
- pDoc->SetEmptyCell(*pPos);
+ rDoc.SetEmptyCell(*pPos);
else
{
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(*pPos, aStr, &aParam);
+ rDoc.SetString(*pPos, aStr, &aParam);
}
}
}
@@ -3294,7 +3291,7 @@ void ScCellRangesBase::ForceChartListener_Impl()
if (!pDocShell)
return;
- ScChartListenerCollection* pColl = pDocShell->GetDocument()->GetChartListenerCollection();
+ ScChartListenerCollection* pColl = pDocShell->GetDocument().GetChartListenerCollection();
if (!pColl)
return;
@@ -3318,15 +3315,15 @@ void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Refe
{
//! auf doppelte testen?
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
- ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
+ ScChartListenerCollection* pColl = rDoc.GetChartListenerCollection();
OUString aName = pColl->getUniqueName(OUString("__Uno"));
if (aName.isEmpty())
// failed to create unique name.
return;
- ScChartListener* pListener = new ScChartListener( aName, pDoc, aRangesRef );
+ ScChartListener* pListener = new ScChartListener( aName, &rDoc, aRangesRef );
pListener->SetUno( aListener, this );
pColl->insert( pListener );
pListener->StartListeningTo();
@@ -3340,8 +3337,8 @@ void SAL_CALL ScCellRangesBase::removeChartDataChangeEventListener( const uno::R
SolarMutexGuard aGuard;
if ( pDocShell && !aRanges.empty() )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChartListenerCollection* pColl = rDoc.GetChartListenerCollection();
pColl->FreeUno( aListener, this );
}
}
@@ -3376,9 +3373,9 @@ void SAL_CALL ScCellRangesBase::addModifyListener(const uno::Reference<util::XMo
if (!pValueListener)
pValueListener = new ScLinkListener( LINK( this, ScCellRangesBase, ValueListenerHdl ) );
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for ( size_t i = 0, nCount = aRanges.size(); i < nCount; i++)
- pDoc->StartListeningArea( *aRanges[ i ], pValueListener );
+ rDoc.StartListeningArea( *aRanges[ i ], pValueListener );
acquire(); // don't lose this object (one ref for all listeners)
}
@@ -3430,11 +3427,11 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleC
ScMarkData aMarkData(*GetMarkData());
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nCol = 0, nLastCol;
while (nCol <= MAXCOL)
{
- if (pDoc->ColHidden(nCol, nTab, NULL, &nLastCol))
+ if (rDoc.ColHidden(nCol, nTab, NULL, &nLastCol))
// hidden columns. Unselect them.
aMarkData.SetMultiMarkArea(ScRange(nCol, 0, nTab, nLastCol, MAXROW, nTab), false);
@@ -3444,7 +3441,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleC
SCROW nRow = 0, nLastRow;
while (nRow <= MAXROW)
{
- if (pDoc->RowHidden(nRow, nTab, NULL, &nLastRow))
+ if (rDoc.RowHidden(nRow, nTab, NULL, &nLastRow))
// These rows are hidden. Unselect them.
aMarkData.SetMultiMarkArea(ScRange(0, nRow, nTab, MAXCOL, nLastRow, nTab), false);
@@ -3465,7 +3462,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCel
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aMarkData(*GetMarkData());
@@ -3474,7 +3471,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCel
{
ScRange aRange = *aRanges[ i ];
- ScCellIterator aIter( pDoc, aRange );
+ ScCellIterator aIter( &rDoc, aRange );
for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
{
// Notizen zaehlen als nicht-leer
@@ -3501,7 +3498,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aMarkData;
@@ -3510,7 +3507,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC
{
ScRange aRange = *aRanges[ i ];
- ScCellIterator aIter( pDoc, aRange );
+ ScCellIterator aIter( &rDoc, aRange );
for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
{
bool bAdd = false;
@@ -3536,9 +3533,9 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC
{
// Date/Time Erkennung
- sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)pDoc->GetAttr(
+ sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)rDoc.GetAttr(
aIter.GetPos(), ATTR_VALUE_FORMAT))->GetValue();
- short nTyp = pDoc->GetFormatTable()->GetType(nIndex);
+ short nTyp = rDoc.GetFormatTable()->GetType(nIndex);
if ((nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) ||
(nTyp == NUMBERFORMAT_DATETIME))
{
@@ -3581,7 +3578,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaC
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aMarkData;
@@ -3590,7 +3587,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaC
{
ScRange aRange = *aRanges[ i ];
- ScCellIterator aIter( pDoc, aRange );
+ ScCellIterator aIter( &rDoc, aRange );
for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
{
if (aIter.getType() == CELLTYPE_FORMULA)
@@ -3636,7 +3633,7 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl(
{
size_t nRangeCount = aRanges.size();
size_t i;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aMarkData;
SCCOLROW nCmpPos = bColumnDiff ? (SCCOLROW)aCompare.Row : (SCCOLROW)aCompare.Column;
@@ -3650,7 +3647,7 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl(
aCmpRange = ScRange( 0,nCmpPos,nTab, MAXCOL,nCmpPos,nTab );
else
aCmpRange = ScRange( static_cast<SCCOL>(nCmpPos),0,nTab, static_cast<SCCOL>(nCmpPos),MAXROW,nTab );
- ScCellIterator aCmpIter( pDoc, aCmpRange );
+ ScCellIterator aCmpIter( &rDoc, aCmpRange );
for (bool bHasCell = aCmpIter.first(); bHasCell; bHasCell = aCmpIter.next())
{
SCCOLROW nCellPos = bColumnDiff ? static_cast<SCCOLROW>(aCmpIter.GetPos().Col()) : static_cast<SCCOLROW>(aCmpIter.GetPos().Row());
@@ -3688,7 +3685,7 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl(
{
ScRange aRange( *aRanges[ i ] );
- ScCellIterator aIter( pDoc, aRange );
+ ScCellIterator aIter( &rDoc, aRange );
for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
{
if (bColumnDiff)
@@ -3758,7 +3755,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPreceden
SolarMutexGuard aGuard;
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeList aNewRanges(aRanges);
bool bFound;
@@ -3774,7 +3771,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPreceden
for (size_t nR = 0, nCount = aNewRanges.size(); nR<nCount; ++nR)
{
ScRange aRange( *aNewRanges[ nR] );
- ScCellIterator aIter( pDoc, aRange );
+ ScCellIterator aIter( &rDoc, aRange );
for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
{
if (aIter.getType() != CELLTYPE_FORMULA)
@@ -3807,7 +3804,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependen
SolarMutexGuard aGuard;
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeList aNewRanges(aRanges);
bool bFound;
@@ -3822,7 +3819,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependen
SCTAB nTab = lcl_FirstTab(aNewRanges); //! alle Tabellen
- ScCellIterator aCellIter( pDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) );
+ ScCellIterator aCellIter( &rDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) );
for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next())
{
if (aCellIter.getType() != CELLTYPE_FORMULA)
@@ -3885,7 +3882,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
if (pSearchItem)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL );
// immer nur innerhalb dieses Objekts
pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
@@ -3897,7 +3894,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
SCCOL nCol = 0;
SCROW nRow = 0;
SCTAB nTab = 0;
- bool bFound = pDoc->SearchAndReplace(
+ bool bFound = rDoc.SearchAndReplace(
*pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL);
if (bFound)
{
@@ -3923,7 +3920,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
if (pSearchItem)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
// immer nur innerhalb dieses Objekts
pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
@@ -3943,7 +3940,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
OUString aDummyUndo;
ScRangeList aMatchedRanges;
- bool bFound = pDoc->SearchAndReplace(
+ bool bFound = rDoc.SearchAndReplace(
*pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL);
if (bFound)
{
@@ -4009,19 +4006,19 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
if (pSearchItem)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pDocShell->GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL );
// immer nur innerhalb dieses Objekts
pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
ScMarkData aMark(*GetMarkData());
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
bool bProtected = !pDocShell->IsEditable();
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
- if ( pDoc->IsTabProtected(*itr) )
+ if ( rDoc.IsTabProtected(*itr) )
bProtected = true;
if (bProtected)
{
@@ -4038,7 +4035,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
if (bUndo)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
}
itr = aMark.begin();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
@@ -4052,7 +4049,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
if (bUndo)
{
ScRangeList aMatchedRanges;
- bFound = pDoc->SearchAndReplace(
+ bFound = rDoc.SearchAndReplace(
*pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aUndoStr, pUndoDoc );
}
if (bFound)
@@ -4253,7 +4250,7 @@ OUString SAL_CALL ScCellRangesObj::getRangeAddressesAsString()
ScDocShell* pDocSh = GetDocShell();
const ScRangeList& rRanges = GetRangeList();
if (pDocSh)
- rRanges.Format( aString, SCA_VALID | SCA_TAB_3D, pDocSh->GetDocument() );
+ rRanges.Format( aString, SCA_VALID | SCA_TAB_3D, &pDocSh->GetDocument() );
return aString;
}
@@ -4440,10 +4437,10 @@ static bool lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDocSh,
if (pDocSh)
{
OUString aRangeStr;
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
{
- aRangeStr = rRanges[ i ]->Format(SCA_VALID | SCA_TAB_3D, pDoc);
+ aRangeStr = rRanges[ i ]->Format(SCA_VALID | SCA_TAB_3D, &rDoc);
if ( aRangeStr == rName )
{
rIndex = i;
@@ -4470,7 +4467,7 @@ static bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries,
// range contained in selection? (sheet must be specified)
ScRange aCellRange;
- sal_uInt16 nParse = aCellRange.ParseAny( rName, pDocSh->GetDocument() );
+ sal_uInt16 nParse = aCellRange.ParseAny( rName, &pDocSh->GetDocument() );
if ( ( nParse & ( SCA_VALID | SCA_TAB_3D ) ) == ( SCA_VALID | SCA_TAB_3D ) )
{
ScMarkData aMarkData;
@@ -4531,7 +4528,7 @@ void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName )
{
// deselect any ranges (parsed or named entry)
ScRangeList aDiff;
- bool bValid = ( aDiff.Parse( aNameStr, pDocSh->GetDocument() ) & SCA_VALID ) != 0;
+ bool bValid = ( aDiff.Parse( aNameStr, &pDocSh->GetDocument() ) & SCA_VALID ) != 0;
if (!bValid && !m_pImpl->m_aNamedEntries.empty())
{
sal_uInt16 nCount = m_pImpl->m_aNamedEntries.size();
@@ -4633,7 +4630,7 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getElementNames()
if (pDocSh)
{
OUString aRangeStr;
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
size_t nCount = rRanges.size();
uno::Sequence<OUString> aSeq(nCount);
@@ -4645,7 +4642,7 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getElementNames()
if (m_pImpl->m_aNamedEntries.empty() ||
!lcl_FindEntryName(m_pImpl->m_aNamedEntries, aRange, aRangeStr))
{
- aRangeStr = aRange.Format(SCA_VALID | SCA_TAB_3D, pDoc);
+ aRangeStr = aRange.Format(SCA_VALID | SCA_TAB_3D, &rDoc);
}
pAry[i] = aRangeStr;
}
@@ -4926,13 +4923,13 @@ uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName(
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = aRange.aStart.Tab();
ScRange aCellRange;
bool bFound = false;
OUString aString(aName);
- sal_uInt16 nParse = aCellRange.ParseAny( aString, pDoc, rDetails );
+ sal_uInt16 nParse = aCellRange.ParseAny( aString, &rDoc, rDetails );
if ( nParse & SCA_VALID )
{
if ( !(nParse & SCA_TAB_3D) ) // keine Tabelle angegeben -> auf dieser Tabelle
@@ -4945,8 +4942,8 @@ uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName(
else
{
ScRangeUtil aRangeUtil;
- if ( aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_NAMES ) ||
- aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_DBASE ) )
+ if ( aRangeUtil.MakeRangeFromName( aString, &rDoc, nTab, aCellRange, RUTL_NAMES ) ||
+ aRangeUtil.MakeRangeFromName( aString, &rDoc, nTab, aCellRange, RUTL_DBASE ) )
bFound = true;
}
@@ -5034,11 +5031,11 @@ OUString SAL_CALL ScCellRangeObj::getArrayFormula() throw(uno::RuntimeException,
OUString aFormula;
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
ScRefCellValue aCell1;
ScRefCellValue aCell2;
- aCell1.assign(*pDoc, aRange.aStart);
- aCell2.assign(*pDoc, aRange.aEnd);
+ aCell1.assign(rDoc, aRange.aStart);
+ aCell2.assign(rDoc, aRange.aEnd);
if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA)
{
const ScFormulaCell* pFCell1 = aCell1.mpFormula;
@@ -5112,11 +5109,11 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens()
if (!pDocSh)
return aSequence;
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
ScRefCellValue aCell1;
ScRefCellValue aCell2;
- aCell1.assign(*pDoc, aRange.aStart);
- aCell2.assign(*pDoc, aRange.aEnd);
+ aCell1.assign(rDoc, aRange.aStart);
+ aCell2.assign(rDoc, aRange.aEnd);
if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA)
{
const ScFormulaCell* pFCell1 = aCell1.mpFormula;
@@ -5129,7 +5126,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens()
{
const ScTokenArray* pTokenArray = pFCell1->GetCode();
if (pTokenArray)
- (void)ScTokenConversion::ConvertToTokenSequence(*pDoc, aSequence, *pTokenArray);
+ (void)ScTokenConversion::ConvertToTokenSequence(rDoc, aSequence, *pTokenArray);
}
}
}
@@ -5150,9 +5147,9 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula
throw uno::RuntimeException();
}
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
ScTokenArray aTokenArray;
- (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
+ (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
// Actually GRAM_PODF_A1 is a don't-care here because of the token
// array being set, it fits with other API compatibility grammars
@@ -5188,7 +5185,7 @@ uno::Sequence< uno::Sequence<uno::Any> > SAL_CALL ScCellRangeObj::getDataArray()
{
uno::Any aAny;
// bAllowNV = TRUE: errors as void
- if ( ScRangeToSequence::FillMixedArray( aAny, pDocSh->GetDocument(), aRange, true ) )
+ if ( ScRangeToSequence::FillMixedArray( aAny, &pDocSh->GetDocument(), aRange, true ) )
{
uno::Sequence< uno::Sequence<uno::Any> > aSeq;
if ( aAny >>= aSeq )
@@ -5270,7 +5267,7 @@ void SAL_CALL ScCellRangeObj::setFormulaArray(
ScDocShell* pDocSh = GetDocShell();
if (pDocSh)
{
- ScExternalRefManager::ApiGuard aExtRefGuard(pDocSh->GetDocument());
+ ScExternalRefManager::ApiGuard aExtRefGuard(&pDocSh->GetDocument());
// GRAM_PODF_A1 for API compatibility.
bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, formula::FormulaGrammar::GRAM_PODF_A1 );
@@ -5352,7 +5349,7 @@ sal_Bool SAL_CALL ScCellRangeObj::getIsMerged() throw(uno::RuntimeException, std
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- return pDocSh && pDocSh->GetDocument()->HasAttrib( aRange, HASATTR_MERGED );
+ return pDocSh && pDocSh->GetDocument().HasAttrib( aRange, HASATTR_MERGED );
}
// XCellSeries
@@ -5651,7 +5648,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe
static_cast<SCCOLROW>(aRange.aStart.Col()) :
static_cast<SCCOLROW>(aRange.aStart.Row());
SCSIZE nCount = aParam.GetEntryCount();
- svl::SharedStringPool& rPool = pDocSh->GetDocument()->GetSharedStringPool();
+ svl::SharedStringPool& rPool = pDocSh->GetDocument().GetSharedStringPool();
for (SCSIZE i=0; i<nCount; i++)
{
ScQueryEntry& rEntry = aParam.GetEntry(i);
@@ -5665,7 +5662,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe
if (rItem.meType != ScQueryEntry::ByString)
{
OUString aStr;
- pDocSh->GetDocument()->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr);
+ pDocSh->GetDocument().GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr);
rItem.maString = rPool.intern(aStr);
}
}
@@ -5719,8 +5716,8 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil
aParam.nRow2 = (SCROW)aDataAddress.EndRow;
aParam.nTab = aDataAddress.Sheet;
- ScDocument* pDoc = pDocSh->GetDocument();
- bool bOk = pDoc->CreateQueryParam(
+ ScDocument& rDoc = pDocSh->GetDocument();
+ bool bOk = rDoc.CreateQueryParam(
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
aRange.aStart.Tab(), aParam );
@@ -5960,7 +5957,7 @@ void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEnt
if (pDocSh)
{
// GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
- Rectangle aMMRect(pDocSh->GetDocument()->GetMMRect(
+ Rectangle aMMRect(pDocSh->GetDocument().GetMMRect(
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ));
awt::Point aPos( aMMRect.Left(), aMMRect.Top() );
@@ -5973,7 +5970,7 @@ void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEnt
if (pDocSh)
{
// GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
- Rectangle aMMRect = pDocSh->GetDocument()->GetMMRect(
+ Rectangle aMMRect = pDocSh->GetDocument().GetMMRect(
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() );
Size aSize(aMMRect.GetSize());
@@ -6145,11 +6142,11 @@ OUString ScCellObj::GetOutputString_Impl() const
OUString aVal;
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
ScRefCellValue aCell;
- aCell.assign(*pDoc, aCellPos);
+ aCell.assign(rDoc, aCellPos);
- aVal = ScCellFormat::GetOutputString(*pDoc, aCellPos, aCell);
+ aVal = ScCellFormat::GetOutputString(rDoc, aCellPos, aCell);
}
return aVal;
}
@@ -6169,7 +6166,7 @@ double ScCellObj::GetValue_Impl() const
{
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
- return pDocSh->GetDocument()->GetValue( aCellPos );
+ return pDocSh->GetDocument().GetValue( aCellPos );
return 0.0;
}
@@ -6194,9 +6191,9 @@ void ScCellObj::InputEnglishString( const OUString& rText )
return;
OUString aString(rText);
- ScDocument* pDoc = pDocSh->GetDocument();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
- sal_uInt32 nOldFormat = pDoc->GetNumberFormat( aCellPos );
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
+ sal_uInt32 nOldFormat = rDoc.GetNumberFormat( aCellPos );
if (pFormatter->GetType(nOldFormat) == NUMBERFORMAT_TEXT)
{
SetString_Impl(aString, false, false); // text cell
@@ -6216,7 +6213,7 @@ void ScCellObj::InputEnglishString( const OUString& rText )
sal_uInt32 nNewFormat = ScGlobal::GetStandardFormat(*pFormatter, nOldFormat, aRes.mnFormatType);
if (nNewFormat != nOldFormat)
{
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
// ATTR_LANGUAGE_FORMAT remains unchanged
rFunc.ApplyAttributes( *GetMarkData(), aPattern, true, true );
@@ -6228,7 +6225,7 @@ void ScCellObj::InputEnglishString( const OUString& rText )
case ScInputStringType::Formula:
rFunc.SetFormulaCell(
aCellPos,
- new ScFormulaCell(pDoc, aCellPos, aRes.maText, formula::FormulaGrammar::GRAM_PODF_A1),
+ new ScFormulaCell(&rDoc, aCellPos, aRes.maText, formula::FormulaGrammar::GRAM_PODF_A1),
false);
break;
case ScInputStringType::Number:
@@ -6451,7 +6448,7 @@ void SAL_CALL ScCellObj::setFormulaString( const OUString& aFormula) throw(uno::
ScDocShell *pDocSh = GetDocShell();
if( pDocSh )
{
- ScFormulaCell* pCell = new ScFormulaCell( pDocSh->GetDocument(), aCellPos );
+ ScFormulaCell* pCell = new ScFormulaCell( &pDocSh->GetDocument(), aCellPos );
pCell->SetHybridFormula( aFormula, formula::FormulaGrammar::GRAM_NATIVE );
pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pCell, false);
}
@@ -6460,9 +6457,9 @@ void SAL_CALL ScCellObj::setFormulaResult( double nValue ) throw(uno::RuntimeExc
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh && pDocSh->GetDocument()->GetCellType( aCellPos ) == CELLTYPE_FORMULA )
+ if ( pDocSh && pDocSh->GetDocument().GetCellType( aCellPos ) == CELLTYPE_FORMULA )
{
- ScFormulaCell* pCell = pDocSh->GetDocument()->GetFormulaCell(aCellPos);
+ ScFormulaCell* pCell = pDocSh->GetDocument().GetFormulaCell(aCellPos);
if (!pCell)
return;
pCell->SetHybridDouble( nValue );
@@ -6478,7 +6475,7 @@ table::CellContentType SAL_CALL ScCellObj::getType() throw(uno::RuntimeException
ScDocShell* pDocSh = GetDocShell();
if (pDocSh)
{
- CellType eCalcType = pDocSh->GetDocument()->GetCellType( aCellPos );
+ CellType eCalcType = pDocSh->GetDocument().GetCellType( aCellPos );
switch (eCalcType)
{
case CELLTYPE_VALUE:
@@ -6509,7 +6506,7 @@ table::CellContentType ScCellObj::GetResultType_Impl()
if ( pDocSh )
{
ScRefCellValue aCell;
- aCell.assign(*pDocSh->GetDocument(), aCellPos);
+ aCell.assign(pDocSh->GetDocument(), aCellPos);
if (aCell.meType == CELLTYPE_FORMULA)
{
bool bValue = aCell.mpFormula->IsValue();
@@ -6531,7 +6528,7 @@ sal_Int32 SAL_CALL ScCellObj::getError() throw(uno::RuntimeException, std::excep
sal_uInt16 nError = 0;
ScRefCellValue aCell;
- aCell.assign(*pDocSh->GetDocument(), aCellPos);
+ aCell.assign(pDocSh->GetDocument(), aCellPos);
if (aCell.meType == CELLTYPE_FORMULA)
nError = aCell.mpFormula->GetErrCode();
@@ -6549,14 +6546,14 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellObj::getTokens()
if (!pDocSh)
return aSequence;
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
ScRefCellValue aCell;
- aCell.assign(*pDoc, aCellPos);
+ aCell.assign(rDoc, aCellPos);
if (aCell.meType == CELLTYPE_FORMULA)
{
ScTokenArray* pTokenArray = aCell.mpFormula->GetCode();
if (pTokenArray)
- ScTokenConversion::ConvertToTokenSequence(*pDoc, aSequence, *pTokenArray);
+ ScTokenConversion::ConvertToTokenSequence(rDoc, aSequence, *pTokenArray);
}
return aSequence;
}
@@ -6567,11 +6564,11 @@ void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rT
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
ScTokenArray aTokenArray;
- (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
+ (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
- ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, aCellPos, aTokenArray);
+ ScFormulaCell* pNewCell = new ScFormulaCell(&rDoc, aCellPos, aTokenArray);
(void)pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pNewCell, false);
}
}
@@ -7022,12 +7019,12 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- Size aSize(pDoc->GetPageSize( nTab ));
+ Size aSize(rDoc.GetPageSize( nTab ));
if (aSize.Width() && aSize.Height()) // effektive Groesse schon gesetzt?
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
else
{
// Umbrueche updaten wie in ScDocShell::PageStyleModified:
@@ -7038,7 +7035,7 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage
SCCOL nCount = 0;
SCCOL nCol;
for (nCol=0; nCol<=MAXCOL; nCol++)
- if (pDoc->HasColBreak(nCol, nTab))
+ if (rDoc.HasColBreak(nCol, nTab))
++nCount;
sheet::TablePageBreakData aData;
@@ -7047,7 +7044,7 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage
sal_uInt16 nPos = 0;
for (nCol=0; nCol<=MAXCOL; nCol++)
{
- ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
+ ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
if (nBreak)
{
aData.Position = nCol;
@@ -7068,19 +7065,19 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getRowPageBre
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- Size aSize(pDoc->GetPageSize( nTab ));
+ Size aSize(rDoc.GetPageSize( nTab ));
if (aSize.Width() && aSize.Height()) // effektive Groesse schon gesetzt?
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
else
{
// Umbrueche updaten wie in ScDocShell::PageStyleModified:
ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
aPrintFunc.UpdatePages();
}
- return pDoc->GetRowBreakData(nTab);
+ return rDoc.GetRowBreakData(nTab);
}
return uno::Sequence<sheet::TablePageBreakData>(0);
}
@@ -7093,21 +7090,21 @@ void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks() throw(uno::RuntimeExc
{
//! docfunc Funktion, auch fuer ScViewFunc::RemoveManualBreaks
- ScDocument* pDoc = pDocSh->GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pDocSh->GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
SCTAB nTab = GetTab_Impl();
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( sal_True );
pDocSh->SetDocumentModified();
@@ -7123,7 +7120,7 @@ OUString SAL_CALL ScTableSheetObj::getName() throw(uno::RuntimeException, std::e
OUString aName;
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
- pDocSh->GetDocument()->GetName( GetTab_Impl(), aName );
+ pDocSh->GetDocument().GetName( GetTab_Impl(), aName );
return aName;
}
@@ -7265,11 +7262,11 @@ void ScTableSheetObj::PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges )
{
// Umbrueche und Undo
ScDocShell* pDocSh = GetDocShell();
- ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : 0;
- if(pDocSh && pDoc)
+ if(pDocSh)
{
- const bool bUndo(pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pDocSh->GetDocument();
+ const bool bUndo(rDoc.IsUndoEnabled());
const SCTAB nTab(GetTab_Impl());
if(bUndo)
@@ -7279,7 +7276,7 @@ void ScTableSheetObj::PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges )
pDocSh,
nTab,
pOldRanges,
- pDoc->CreatePrintRangeSaver())); // create new ranges
+ rDoc.CreatePrintRangeSaver())); // create new ranges
// #i120105# ownership of old ranges has changed, mark as consumed
pOldRanges = 0;
@@ -7307,16 +7304,16 @@ uno::Sequence<table::CellRangeAddress> SAL_CALL ScTableSheetObj::getPrintAreas()
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- sal_uInt16 nCount = pDoc->GetPrintRangeCount( nTab );
+ sal_uInt16 nCount = rDoc.GetPrintRangeCount( nTab );
table::CellRangeAddress aRangeAddress;
uno::Sequence<table::CellRangeAddress> aSeq(nCount);
table::CellRangeAddress* pAry = aSeq.getArray();
for (sal_uInt16 i=0; i<nCount; i++)
{
- const ScRange* pRange = pDoc->GetPrintRange( nTab, i );
+ const ScRange* pRange = rDoc.GetPrintRange( nTab, i );
OSL_ENSURE(pRange,"wo ist der Druckbereich");
if (pRange)
{
@@ -7339,14 +7336,14 @@ void SAL_CALL ScTableSheetObj::setPrintAreas(
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- if ( pDoc->IsUndoEnabled() )
- pOldRanges = pDoc->CreatePrintRangeSaver();
+ if ( rDoc.IsUndoEnabled() )
+ pOldRanges = rDoc.CreatePrintRangeSaver();
sal_uInt16 nCount = (sal_uInt16) aPrintAreas.getLength();
- pDoc->ClearPrintRanges( nTab );
+ rDoc.ClearPrintRanges( nTab );
if (nCount)
{
ScRange aPrintRange;
@@ -7354,11 +7351,11 @@ void SAL_CALL ScTableSheetObj::setPrintAreas(
for (sal_uInt16 i=0; i<nCount; i++)
{
ScUnoConversion::FillScRange( aPrintRange, pAry[i] );
- pDoc->AddPrintRange( nTab, aPrintRange );
+ rDoc.AddPrintRange( nTab, aPrintRange );
}
}
- if ( pDoc->IsUndoEnabled() )
+ if ( rDoc.IsUndoEnabled() )
PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
}
}
@@ -7369,9 +7366,9 @@ sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleColumns() throw(uno::RuntimeExce
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- return ( pDoc->GetRepeatColRange(nTab) != NULL );
+ return ( rDoc.GetRepeatColRange(nTab) != NULL );
}
return false;
}
@@ -7383,21 +7380,21 @@ void SAL_CALL ScTableSheetObj::setPrintTitleColumns( sal_Bool bPrintTitleColumns
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
+ ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver();
if ( bPrintTitleColumns )
{
- if ( !pDoc->GetRepeatColRange( nTab ) ) // keinen bestehenden Bereich veraendern
+ if ( !rDoc.GetRepeatColRange( nTab ) ) // keinen bestehenden Bereich veraendern
{
ScRange aNew( 0, 0, nTab, 0, 0, nTab ); // Default
- pDoc->SetRepeatColRange( nTab, &aNew ); // einschalten
+ rDoc.SetRepeatColRange( nTab, &aNew ); // einschalten
}
}
else
- pDoc->SetRepeatColRange( nTab, NULL ); // abschalten
+ rDoc.SetRepeatColRange( nTab, NULL ); // abschalten
PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
@@ -7412,9 +7409,9 @@ table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleColumns() throw(uno::R
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- const ScRange* pRange = pDoc->GetRepeatColRange(nTab);
+ const ScRange* pRange = rDoc.GetRepeatColRange(nTab);
if (pRange)
{
ScUnoConversion::FillApiRange( aRet, *pRange );
@@ -7431,14 +7428,14 @@ void SAL_CALL ScTableSheetObj::setTitleColumns( const table::CellRangeAddress& a
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
+ ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver();
ScRange aNew;
ScUnoConversion::FillScRange( aNew, aTitleColumns );
- pDoc->SetRepeatColRange( nTab, &aNew ); // immer auch einschalten
+ rDoc.SetRepeatColRange( nTab, &aNew ); // immer auch einschalten
PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
}
@@ -7450,9 +7447,9 @@ sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleRows() throw(uno::RuntimeExcepti
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- return ( pDoc->GetRepeatRowRange(nTab) != NULL );
+ return ( rDoc.GetRepeatRowRange(nTab) != NULL );
}
return false;
}
@@ -7464,21 +7461,21 @@ void SAL_CALL ScTableSheetObj::setPrintTitleRows( sal_Bool bPrintTitleRows )
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
+ ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver();
if ( bPrintTitleRows )
{
- if ( !pDoc->GetRepeatRowRange( nTab ) ) // keinen bestehenden Bereich veraendern
+ if ( !rDoc.GetRepeatRowRange( nTab ) ) // keinen bestehenden Bereich veraendern
{
ScRange aNew( 0, 0, nTab, 0, 0, nTab ); // Default
- pDoc->SetRepeatRowRange( nTab, &aNew ); // einschalten
+ rDoc.SetRepeatRowRange( nTab, &aNew ); // einschalten
}
}
else
- pDoc->SetRepeatRowRange( nTab, NULL ); // abschalten
+ rDoc.SetRepeatRowRange( nTab, NULL ); // abschalten
PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
@@ -7493,9 +7490,9 @@ table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleRows() throw(uno::Runt
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- const ScRange* pRange = pDoc->GetRepeatRowRange(nTab);
+ const ScRange* pRange = rDoc.GetRepeatRowRange(nTab);
if (pRange)
{
ScUnoConversion::FillApiRange( aRet, *pRange );
@@ -7512,14 +7509,14 @@ void SAL_CALL ScTableSheetObj::setTitleRows( const table::CellRangeAddress& aTit
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
+ ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver();
ScRange aNew;
ScUnoConversion::FillScRange( aNew, aTitleRows );
- pDoc->SetRepeatRowRange( nTab, &aNew ); // immer auch einschalten
+ rDoc.SetRepeatRowRange( nTab, &aNew ); // immer auch einschalten
PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc.
}
@@ -7534,7 +7531,7 @@ sheet::SheetLinkMode SAL_CALL ScTableSheetObj::getLinkMode() throw(uno::RuntimeE
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- sal_uInt8 nMode = pDocSh->GetDocument()->GetLinkMode( GetTab_Impl() );
+ sal_uInt8 nMode = pDocSh->GetDocument().GetLinkMode( GetTab_Impl() );
if ( nMode == SC_LINK_NORMAL )
eRet = sheet::SheetLinkMode_NORMAL;
else if ( nMode == SC_LINK_VALUE )
@@ -7563,7 +7560,7 @@ OUString SAL_CALL ScTableSheetObj::getLinkUrl() throw(uno::RuntimeException, std
OUString aFile;
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
- aFile = pDocSh->GetDocument()->GetLinkDoc( GetTab_Impl() );
+ aFile = pDocSh->GetDocument().GetLinkDoc( GetTab_Impl() );
return aFile;
}
@@ -7587,7 +7584,7 @@ OUString SAL_CALL ScTableSheetObj::getLinkSheetName() throw(uno::RuntimeExceptio
OUString aSheet;
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
- aSheet = pDocSh->GetDocument()->GetLinkTab( GetTab_Impl() );
+ aSheet = pDocSh->GetDocument().GetLinkTab( GetTab_Impl() );
return aSheet;
}
@@ -7613,7 +7610,7 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
OUString aFileString = aUrl;
@@ -7636,7 +7633,7 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee
nLinkMode = SC_LINK_VALUE;
sal_uLong nRefresh = 0;
- pDoc->SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh );
+ rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh );
pDocSh->UpdateLinks(); // ggf. Link eintragen oder loeschen
SfxBindings* pBindings = pDocSh->GetViewBindings();
@@ -7645,12 +7642,12 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee
//! Undo fuer Link-Daten an der Table
- if ( nLinkMode != SC_LINK_NONE && pDoc->IsExecuteLinkEnabled() ) // Link updaten
+ if ( nLinkMode != SC_LINK_NONE && rDoc.IsExecuteLinkEnabled() ) // Link updaten
{
// Update immer, auch wenn der Link schon da war
//! Update nur fuer die betroffene Tabelle???
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
sal_uInt16 nCount = pLinkManager->GetLinks().size();
for ( sal_uInt16 i=0; i<nCount; i++ )
{
@@ -7877,7 +7874,7 @@ void SAL_CALL ScTableSheetObj::protect( const OUString& aPassword )
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
// #i108245# if already protected, don't change anything
- if ( pDocSh && !pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ) )
+ if ( pDocSh && !pDocSh->GetDocument().IsTabProtected( GetTab_Impl() ) )
{
OUString aString(aPassword);
pDocSh->GetDocFunc().Protect( GetTab_Impl(), aString, true );
@@ -7903,7 +7900,7 @@ sal_Bool SAL_CALL ScTableSheetObj::isProtected() throw(uno::RuntimeException, st
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
- return pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() );
+ return pDocSh->GetDocument().IsTabProtected( GetTab_Impl() );
OSL_FAIL("keine DocShell"); //! Exception oder so?
return false;
@@ -7916,7 +7913,7 @@ sal_Bool SAL_CALL ScTableSheetObj::getIsScenario() throw(uno::RuntimeException,
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
- return pDocSh->GetDocument()->IsScenario( GetTab_Impl() );
+ return pDocSh->GetDocument().IsScenario( GetTab_Impl() );
return false;
}
@@ -7930,7 +7927,7 @@ OUString SAL_CALL ScTableSheetObj::getScenarioComment() throw(uno::RuntimeExcept
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDocSh->GetDocument()->GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags );
+ pDocSh->GetDocument().GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags );
return aComment;
}
return OUString();
@@ -7943,15 +7940,15 @@ void SAL_CALL ScTableSheetObj::setScenarioComment( const OUString& aScenarioComm
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
OUString aName;
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetName( nTab, aName );
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
aComment = aScenarioComment;
@@ -7966,10 +7963,10 @@ void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAd
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
ScMarkData aMarkData;
aMarkData.SelectTable( nTab, true );
@@ -7989,7 +7986,7 @@ void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAd
}
// Szenario-Ranges sind durch Attribut gekennzeichnet
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) );
aPattern.GetItemSet().Put( ScProtectionAttr( true ) );
pDocSh->GetDocFunc().ApplyAttributes( aMarkData, aPattern, true, true );
@@ -8003,16 +8000,16 @@ void SAL_CALL ScTableSheetObj::apply() throw(uno::RuntimeException, std::excepti
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
OUString aName;
- pDoc->GetName( nTab, aName ); // Name dieses Szenarios
+ rDoc.GetName( nTab, aName ); // Name dieses Szenarios
SCTAB nDestTab = nTab;
- while ( nDestTab > 0 && pDoc->IsScenario(nDestTab) )
+ while ( nDestTab > 0 && rDoc.IsScenario(nDestTab) )
--nDestTab;
- if ( !pDoc->IsScenario(nDestTab) )
+ if ( !rDoc.IsScenario(nDestTab) )
pDocSh->UseScenario( nDestTab, aName );
//! sonst Fehler oder so
@@ -8028,9 +8025,9 @@ uno::Sequence< table::CellRangeAddress > SAL_CALL ScTableSheetObj::getRanges( )
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- const ScRangeList* pRangeList = pDoc->GetScenarioRanges(nTab);
+ const ScRangeList* pRangeList = rDoc.GetScenarioRanges(nTab);
if (pRangeList)
{
size_t nCount = pRangeList->size();
@@ -8061,16 +8058,13 @@ void ScTableSheetObj::setExternalName( const OUString& aUrl, const OUString& aSh
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
- if ( pDoc )
+ ScDocument& rDoc = pDocSh->GetDocument();
+ const SCTAB nTab = GetTab_Impl();
+ const OUString aAbsDocName( ScGlobal::GetAbsDocName( aUrl, pDocSh ) );
+ const OUString aDocTabName( ScGlobal::GetDocTabName( aAbsDocName, aSheetName ) );
+ if ( !rDoc.RenameTab( nTab, aDocTabName, false /*bUpdateRef*/, true /*bExternalDocument*/ ) )
{
- const SCTAB nTab = GetTab_Impl();
- const OUString aAbsDocName( ScGlobal::GetAbsDocName( aUrl, pDocSh ) );
- const OUString aDocTabName( ScGlobal::GetDocTabName( aAbsDocName, aSheetName ) );
- if ( !pDoc->RenameTab( nTab, aDocTabName, false /*bUpdateRef*/, true /*bExternalDocument*/ ) )
- {
- throw container::ElementExistException( OUString(), *this );
- }
+ throw container::ElementExistException( OUString(), *this );
}
}
}
@@ -8116,7 +8110,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
ScDocShell* pDocSh = GetDocShell();
if (!pDocSh)
return; //! Exception oder so?
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
ScDocFunc &rFunc = pDocSh->GetDocFunc();
@@ -8129,10 +8123,10 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
//! Undo? (auch bei SID_STYLE_APPLY an der View)
- if ( pDoc->GetPageStyle( nTab ) != aNewStr )
+ if ( rDoc.GetPageStyle( nTab ) != aNewStr )
{
- pDoc->SetPageStyle( nTab, aNewStr );
- if (!pDoc->IsImportingXML())
+ rDoc.SetPageStyle( nTab, aNewStr );
+ if (!rDoc.IsImportingXML())
{
ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages();
@@ -8156,12 +8150,12 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
}
else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
{
- if (pDoc->IsScenario(nTab))
- pDoc->SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ if (rDoc.IsScenario(nTab))
+ rDoc.SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
}
else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
sal_Int32 nNewColor = 0;
if (aValue >>= nNewColor)
@@ -8170,8 +8164,8 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetName( nTab, aName );
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
aColor = Color(static_cast<sal_uInt32>(nNewColor));
@@ -8181,14 +8175,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
}
else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aName;
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetName( nTab, aName );
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
bool bModify(false);
if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
@@ -8214,14 +8208,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
}
else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aName;
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetName( nTab, aName );
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
bool bModify(false);
if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
@@ -8247,14 +8241,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
}
else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aName;
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetName( nTab, aName );
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
bool bModify(false);
if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
@@ -8280,14 +8274,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
}
else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aName;
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetName( nTab, aName );
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
bool bModify(false);
if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
@@ -8313,14 +8307,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
}
else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aName;
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetName( nTab, aName );
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
bool bModify(false);
if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
@@ -8346,14 +8340,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
}
else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aName;
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetName( nTab, aName );
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
bool bModify(false);
if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
@@ -8392,11 +8386,11 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
{
bool bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue );
if (bAutoPrint)
- pDoc->SetPrintEntireSheet( nTab ); // clears all print ranges
+ rDoc.SetPrintEntireSheet( nTab ); // clears all print ranges
else
{
- if (pDoc->IsPrintEntireSheet( nTab ))
- pDoc->ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
+ if (rDoc.IsPrintEntireSheet( nTab ))
+ rDoc.ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
}
}
else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
@@ -8405,7 +8399,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
if ( aValue >>= nColor )
{
const Color aColor( static_cast< ColorData >( nColor ) );
- if ( pDoc->GetTabBgColor( nTab ) != aColor )
+ if ( rDoc.GetTabBgColor( nTab ) != aColor )
rFunc.SetTabBgColor( nTab, aColor, true, true );
}
}
@@ -8414,7 +8408,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
OUString aCodeName;
if ( pDocSh && ( aValue >>= aCodeName ) )
{
- pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), aCodeName );
+ pDocSh->GetDocument().SetCodeName( GetTab_Impl(), aCodeName );
}
}
else
@@ -8432,7 +8426,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
ScDocShell* pDocSh = GetDocShell();
if (!pDocSh)
throw uno::RuntimeException();
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
if ( pEntry->nWID == SC_WID_UNO_NAMES )
@@ -8442,11 +8436,11 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
else if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
{
rAny <<= OUString( ScStyleNameConversion::DisplayToProgrammaticName(
- pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ) );
+ rDoc.GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ) );
}
else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
- bool bVis = pDoc->IsVisible( nTab );
+ bool bVis = rDoc.IsVisible( nTab );
ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
}
else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT )
@@ -8461,114 +8455,114 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
}
else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
{
- if (pDoc->IsScenario(nTab))
- ScUnoHelpFunctions::SetBoolInAny( rAny, pDoc->IsActiveScenario( nTab ));
+ if (rDoc.IsScenario(nTab))
+ ScUnoHelpFunctions::SetBoolInAny( rAny, rDoc.IsActiveScenario( nTab ));
}
else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
rAny <<= static_cast<sal_Int32>(aColor.GetColor());
}
}
else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PROTECT) != 0 );
}
}
else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_SHOWFRAME) != 0 );
}
}
else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PRINTFRAME) != 0 );
}
}
else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_TWOWAY) != 0 );
}
}
else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_ATTRIB) != 0 );
}
}
else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
{
- if (pDoc->IsScenario(nTab))
+ if (rDoc.IsScenario(nTab))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
ScUnoHelpFunctions::SetBoolInAny( rAny, !(nFlags & SC_SCENARIO_VALUE));
}
}
else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
{
- if (pDoc->IsLayoutRTL(nTab))
+ if (rDoc.IsLayoutRTL(nTab))
rAny <<= sal_Int16(com::sun::star::text::WritingMode2::RL_TB);
else
rAny <<= sal_Int16(com::sun::star::text::WritingMode2::LR_TB);
}
else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
{
- bool bAutoPrint = pDoc->IsPrintEntireSheet( nTab );
+ bool bAutoPrint = rDoc.IsPrintEntireSheet( nTab );
ScUnoHelpFunctions::SetBoolInAny( rAny, bAutoPrint );
}
else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
{
- rAny <<= sal_Int32(pDoc->GetTabBgColor(nTab).GetColor());
+ rAny <<= sal_Int32(rDoc.GetTabBgColor(nTab).GetColor());
}
else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
{
OUString aCodeName;
if ( pDocSh )
- pDocSh->GetDocument()->GetCodeName( GetTab_Impl(), aCodeName );
+ pDocSh->GetDocument().GetCodeName( GetTab_Impl(), aCodeName );
rAny <<= OUString( aCodeName );
}
else
@@ -8799,7 +8793,7 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
if (!pDocSh)
throw uno::RuntimeException();
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
const ScRange& rRange = GetRange();
OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten");
SCCOL nCol = rRange.aStart.Col();
@@ -8808,30 +8802,30 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
if ( pEntry->nWID == SC_WID_UNO_CELLWID )
{
// for hidden column, return original height
- sal_uInt16 nWidth = pDoc->GetOriginalWidth( nCol, nTab );
+ sal_uInt16 nWidth = rDoc.GetOriginalWidth( nCol, nTab );
// property is 1/100mm, column width is twips
nWidth = (sal_uInt16) TwipsToHMM(nWidth);
rAny <<= (sal_Int32)( nWidth );
}
else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
- bool bHidden = pDoc->ColHidden(nCol, nTab);
+ bool bHidden = rDoc.ColHidden(nCol, nTab);
ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden );
}
else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
{
//! momentan immer gesetzt ??!?!
- bool bOpt = !(pDoc->GetColFlags( nCol, nTab ) & CR_MANUALSIZE);
+ bool bOpt = !(rDoc.GetColFlags( nCol, nTab ) & CR_MANUALSIZE);
ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
}
else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
{
- ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
+ ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
}
else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
{
- ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
+ ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
ScUnoHelpFunctions::SetBoolInAny(rAny, (nBreak & BREAK_MANUAL) != 0);
}
else
@@ -8882,7 +8876,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
ScDocShell* pDocSh = GetDocShell();
if (!pDocSh)
return; //! Exception oder so?
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
const ScRange& rRange = GetRange();
OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
SCROW nRow = rRange.aStart.Row();
@@ -8913,7 +8907,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
{
bool bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue );
// SC_SIZE_DIRECT mit Groesse 0 blendet aus
- pDoc->SetRowFiltered(nRow, nRow, nTab, bFil);
+ rDoc.SetRowFiltered(nRow, nRow, nTab, bFil);
}
else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
{
@@ -8923,7 +8917,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
else
{
// set current height again manually
- sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
+ sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab );
rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, true, true);
}
}
@@ -8948,7 +8942,7 @@ void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
ScDocShell* pDocSh = GetDocShell();
if (!pDocSh)
throw uno::RuntimeException();
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
const ScRange& rRange = GetRange();
OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
SCROW nRow = rRange.aStart.Row();
@@ -8957,34 +8951,34 @@ void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
{
// for hidden row, return original height
- sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
+ sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab );
// property is 1/100mm, row height is twips
nHeight = (sal_uInt16) TwipsToHMM(nHeight);
rAny <<= (sal_Int32)( nHeight );
}
else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
- bool bHidden = pDoc->RowHidden(nRow, nTab);
+ bool bHidden = rDoc.RowHidden(nRow, nTab);
ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden );
}
else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
{
- bool bVis = pDoc->RowFiltered(nRow, nTab);
+ bool bVis = rDoc.RowFiltered(nRow, nTab);
ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
}
else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
{
- bool bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & CR_MANUALSIZE);
+ bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CR_MANUALSIZE);
ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
}
else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
{
- ScBreakType nBreak = pDoc->HasRowBreak(nRow, nTab);
+ ScBreakType nBreak = rDoc.HasRowBreak(nRow, nTab);
ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
}
else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
{
- ScBreakType nBreak = (pDoc->HasRowBreak(nRow, nTab) & BREAK_MANUAL);
+ ScBreakType nBreak = (rDoc.HasRowBreak(nRow, nTab) & BREAK_MANUAL);
ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
}
else
@@ -9001,13 +8995,13 @@ ScCellsObj::ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR) :
pDocShell( pDocSh ),
aRanges( rR )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScCellsObj::~ScCellsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -9015,7 +9009,7 @@ void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( rHint.ISA( ScUpdateRefHint ) )
{
const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
- aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
+ aRanges.UpdateReference( rRef.GetMode(), &pDocShell->GetDocument(), rRef.GetRange(),
rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
}
else if ( rHint.ISA( SfxSimpleHint ) &&
@@ -9062,8 +9056,8 @@ ScCellsEnumeration::ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR
pMark( NULL ),
bAtEnd( false )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->AddUnoObject(*this);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.AddUnoObject(*this);
if ( aRanges.empty() )
bAtEnd = true;
@@ -9084,9 +9078,9 @@ void ScCellsEnumeration::CheckPos_Impl()
return;
bool bFound = false;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRefCellValue aCell;
- aCell.assign(*pDoc, aPos);
+ aCell.assign(rDoc, aPos);
if (!aCell.isEmpty())
{
if (!pMark)
@@ -9104,7 +9098,7 @@ void ScCellsEnumeration::CheckPos_Impl()
ScCellsEnumeration::~ScCellsEnumeration()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
delete pMark;
}
@@ -9121,7 +9115,7 @@ void ScCellsEnumeration::Advance_Impl()
SCCOL nCol = aPos.Col();
SCROW nRow = aPos.Row();
SCTAB nTab = aPos.Tab();
- bool bFound = pDocShell->GetDocument()->GetNextMarkedCell( nCol, nRow, nTab, *pMark );
+ bool bFound = pDocShell->GetDocument().GetNextMarkedCell( nCol, nRow, nTab, *pMark );
if (bFound)
aPos.Set( nCol, nRow, nTab );
else
@@ -9135,7 +9129,7 @@ void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
if (pDocShell)
{
const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
- aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
+ aRanges.UpdateReference( rRef.GetMode(), &pDocShell->GetDocument(), rRef.GetRange(),
rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
delete pMark; // aus verschobenen Bereichen neu erzeugen
@@ -9145,7 +9139,7 @@ void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
ScRangeList aNew;
aNew.Append(ScRange(aPos));
- aNew.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
+ aNew.UpdateReference( rRef.GetMode(), &pDocShell->GetDocument(), rRef.GetRange(),
rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
if (aNew.size()==1)
{
@@ -9190,8 +9184,8 @@ ScCellFormatsObj::ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) :
pDocShell( pDocSh ),
aTotalRange( rRange )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->AddUnoObject(*this);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.AddUnoObject(*this);
OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" );
}
@@ -9199,7 +9193,7 @@ ScCellFormatsObj::ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) :
ScCellFormatsObj::~ScCellFormatsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -9222,9 +9216,9 @@ ScCellRangeObj* ScCellFormatsObj::GetObjectByIndex_Impl(long nIndex) const
ScCellRangeObj* pRet = NULL;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
long nPos = 0;
- ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(),
+ ScAttrRectIterator aIter( &rDoc, aTotalRange.aStart.Tab(),
aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
SCCOL nCol1, nCol2;
@@ -9258,8 +9252,8 @@ sal_Int32 SAL_CALL ScCellFormatsObj::getCount() throw(uno::RuntimeException, std
long nCount = 0;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(),
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScAttrRectIterator aIter( &rDoc, aTotalRange.aStart.Tab(),
aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
SCCOL nCol1, nCol2;
@@ -9313,13 +9307,13 @@ ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScR
bAtEnd( false ),
bDirty( false )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->AddUnoObject(*this);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.AddUnoObject(*this);
OSL_ENSURE( rRange.aStart.Tab() == rRange.aEnd.Tab(),
"CellFormatsEnumeration: unterschiedliche Tabellen" );
- pIter = new ScAttrRectIterator( pDoc, nTab,
+ pIter = new ScAttrRectIterator( &rDoc, nTab,
rRange.aStart.Col(), rRange.aStart.Row(),
rRange.aEnd.Col(), rRange.aEnd.Row() );
Advance_Impl();
@@ -9328,7 +9322,7 @@ ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScR
ScCellFormatsEnumeration::~ScCellFormatsEnumeration()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
delete pIter;
}
@@ -9417,7 +9411,7 @@ ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange
aTotalRange( rRange ),
aRangeLists()
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" );
@@ -9427,7 +9421,7 @@ ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange
ScUniqueCellFormatsObj::~ScUniqueCellFormatsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -9590,9 +9584,9 @@ void ScUniqueCellFormatsObj::GetObjects_Impl()
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB nTab = aTotalRange.aStart.Tab();
- ScAttrRectIterator aIter( pDoc, nTab,
+ ScAttrRectIterator aIter( &rDoc, nTab,
aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
SCCOL nCol1, nCol2;
@@ -9604,7 +9598,7 @@ void ScUniqueCellFormatsObj::GetObjects_Impl()
while (aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
{
ScRange aRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
- const ScPatternAttr* pPattern = pDoc->GetPattern(nCol1, nRow1, nTab);
+ const ScPatternAttr* pPattern = rDoc.GetPattern(nCol1, nRow1, nTab);
aHashMap[pPattern].Join( aRange );
}
@@ -9679,13 +9673,13 @@ ScUniqueCellFormatsEnumeration::ScUniqueCellFormatsEnumeration(ScDocShell* pDocS
pDocShell( pDocSh ),
nCurrentPosition(0)
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScUniqueCellFormatsEnumeration::~ScUniqueCellFormatsEnumeration()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScUniqueCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index c94e4d9f5507..a0c70540f14d 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -56,8 +56,8 @@ static SdrOle2Obj* lcl_FindChartObj( ScDocShell* pDocShell, SCTAB nTab, const OU
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if (pDrawLayer)
{
SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
@@ -68,7 +68,7 @@ static SdrOle2Obj* lcl_FindChartObj( ScDocShell* pDocShell, SCTAB nTab, const OU
SdrObject* pObject = aIter.Next();
while (pObject)
{
- if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart(pObject) )
+ if ( pObject->GetObjIdentifier() == OBJ_OLE2 && rDoc.IsChart(pObject) )
{
uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObject)->GetObjRef();
if ( xObj.is() )
@@ -90,13 +90,13 @@ ScChartsObj::ScChartsObj(ScDocShell* pDocSh, SCTAB nT) :
pDocShell( pDocSh ),
nTab( nT )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScChartsObj::~ScChartsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScChartsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -115,8 +115,8 @@ ScChartObj* ScChartsObj::GetObjectByIndex_Impl(long nIndex) const
OUString aName;
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if (pDrawLayer)
{
SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
@@ -128,7 +128,7 @@ ScChartObj* ScChartsObj::GetObjectByIndex_Impl(long nIndex) const
SdrObject* pObject = aIter.Next();
while (pObject)
{
- if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart(pObject) )
+ if ( pObject->GetObjIdentifier() == OBJ_OLE2 && rDoc.IsChart(pObject) )
{
if ( nPos == nIndex )
{
@@ -170,11 +170,11 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
if (!pDocShell)
return;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScDrawLayer* pModel = pDocShell->MakeDrawLayer();
SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab));
OSL_ENSURE(pPage,"addChart: keine Page");
- if (!pPage || !pDoc)
+ if (!pPage)
return;
// chart can't be inserted if any ole object with that name exists on any table
@@ -210,7 +210,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
// Rechteck anpassen
//! Fehler/Exception, wenn leer/ungueltig ???
Point aRectPos( aRect.X, aRect.Y );
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
if ( ( aRectPos.X() < 0 && !bLayoutRTL ) || ( aRectPos.X() > 0 && bLayoutRTL ) )
aRectPos.X() = 0;
@@ -235,7 +235,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
// Calc -> DataProvider
uno::Reference< chart2::data::XDataProvider > xDataProvider = new
- ScChart2DataProvider( pDoc );
+ ScChart2DataProvider( &rDoc );
// Chart -> DataReceiver
uno::Reference< chart2::data::XDataReceiver > xReceiver;
uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
@@ -244,7 +244,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
if( xReceiver.is())
{
OUString sRangeStr;
- xNewRanges->Format(sRangeStr, SCR_ABS_3D, pDoc);
+ xNewRanges->Format(sRangeStr, SCR_ABS_3D, &rDoc);
// connect
if( !sRangeStr.isEmpty() )
@@ -273,8 +273,8 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
}
ScChartListener* pChartListener =
- new ScChartListener( aName, pDoc, xNewRanges );
- pDoc->GetChartListenerCollection()->insert( pChartListener );
+ new ScChartListener( aName, &rDoc, xNewRanges );
+ rDoc.GetChartListenerCollection()->insert( pChartListener );
pChartListener->StartListeningTo();
SdrOle2Obj* pObj = new SdrOle2Obj( ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), aName, aInsRect );
@@ -299,9 +299,9 @@ void SAL_CALL ScChartsObj::removeByName( const OUString& aName )
SdrOle2Obj* pObj = lcl_FindChartObj( pDocShell, nTab, aName );
if (pObj)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->GetChartListenerCollection()->removeByName(aName);
- ScDrawLayer* pModel = pDoc->GetDrawLayer(); // ist nicht 0
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.GetChartListenerCollection()->removeByName(aName);
+ ScDrawLayer* pModel = rDoc.GetDrawLayer(); // ist nicht 0
SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab)); // ist nicht 0
pModel->AddUndo( new SdrUndoDelObj( *pObj ) );
@@ -328,8 +328,8 @@ sal_Int32 SAL_CALL ScChartsObj::getCount() throw(uno::RuntimeException, std::exc
sal_Int32 nCount = 0;
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if (pDrawLayer)
{
SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
@@ -340,7 +340,7 @@ sal_Int32 SAL_CALL ScChartsObj::getCount() throw(uno::RuntimeException, std::exc
SdrObject* pObject = aIter.Next();
while (pObject)
{
- if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart(pObject) )
+ if ( pObject->GetObjIdentifier() == OBJ_OLE2 && rDoc.IsChart(pObject) )
++nCount;
pObject = aIter.Next();
}
@@ -391,14 +391,14 @@ uno::Sequence<OUString> SAL_CALL ScChartsObj::getElementNames() throw(uno::Runti
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
long nCount = getCount();
uno::Sequence<OUString> aSeq(nCount);
OUString* pAry = aSeq.getArray();
long nPos = 0;
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if (pDrawLayer)
{
SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
@@ -409,7 +409,7 @@ uno::Sequence<OUString> SAL_CALL ScChartsObj::getElementNames() throw(uno::Runti
SdrObject* pObject = aIter.Next();
while (pObject)
{
- if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart(pObject) )
+ if ( pObject->GetObjIdentifier() == OBJ_OLE2 && rDoc.IsChart(pObject) )
{
OUString aName;
uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObject)->GetObjRef();
@@ -444,7 +444,7 @@ ScChartObj::ScChartObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN)
,nTab( nT )
,aChartName( rN )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
uno::Sequence< table::CellRangeAddress > aInitialPropValue;
registerPropertyNoMember( OUString( "RelatedCellRanges" ),
@@ -455,7 +455,7 @@ ScChartObj::ScChartObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN)
ScChartObj::~ScChartObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScChartObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -472,11 +472,11 @@ void ScChartObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
void ScChartObj::GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const
{
bool bFound = false;
- ScDocument* pDoc = (pDocShell? pDocShell->GetDocument(): 0);
- if( pDoc )
+ if( pDocShell )
{
- uno::Reference< chart2::XChartDocument > xChartDoc( pDoc->GetChartByName( aChartName ) );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ uno::Reference< chart2::XChartDocument > xChartDoc( rDoc.GetChartByName( aChartName ) );
if( xChartDoc.is() )
{
uno::Reference< chart2::data::XDataReceiver > xReceiver( xChartDoc, uno::UNO_QUERY );
@@ -516,7 +516,7 @@ void ScChartObj::GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool&
rColHeaders=bHasCategories;
rRowHeaders=bFirstCellAsLabel;
}
- rRanges->Parse( aRanges, pDoc);
+ rRanges->Parse( aRanges, &rDoc);
}
bFound = true;
}
@@ -533,15 +533,15 @@ void ScChartObj::Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, b
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pDocShell->GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
if (bUndo)
{
pDocShell->GetUndoManager()->AddUndoAction(
new ScUndoChartData( pDocShell, aChartName, rRanges, bColHeaders, bRowHeaders, false ) );
}
- pDoc->UpdateChartArea( aChartName, rRanges, bColHeaders, bRowHeaders, false );
+ rDoc.UpdateChartArea( aChartName, rRanges, bColHeaders, bRowHeaders, false );
}
}
@@ -572,11 +572,13 @@ void ScChartObj::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno:
ScUnoConversion::FillScRange( aRange, aCellRange );
rRangeList->Append( aRange );
}
- ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL );
- ScChartListenerCollection* pCollection = ( pDoc ? pDoc->GetChartListenerCollection() : NULL );
- if ( pCollection )
+ if ( pDocShell )
{
- pCollection->ChangeListening( aChartName, rRangeList );
+ ScChartListenerCollection* pCollection = pDocShell->GetDocument().GetChartListenerCollection();
+ if ( pCollection )
+ {
+ pCollection->ChangeListening( aChartName, rRangeList );
+ }
}
}
}
@@ -592,11 +594,11 @@ void ScChartObj::getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) con
{
case PROP_HANDLE_RELATED_CELLRANGES:
{
- ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL );
- if (!pDoc)
+ if (!pDocShell)
break;
+ ScDocument& rDoc = pDocShell->GetDocument();
- ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection();
+ ScChartListenerCollection* pCollection = rDoc.GetChartListenerCollection();
if (!pCollection)
break;
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 1f2637257801..4f849aec5df3 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -85,13 +85,13 @@ ScDocumentConfiguration::ScDocumentConfiguration(ScDocShell* pDocSh)
: pDocShell(pDocSh) ,
aPropSet ( lcl_GetConfigPropertyMap() )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDocumentConfiguration::~ScDocumentConfiguration()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDocumentConfiguration::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -126,201 +126,196 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
if(pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (pDoc)
+ ScDocument& rDoc = pDocShell->GetDocument();
+ bool bUpdateHeights = false;
+
+ ScViewOptions aViewOpt(rDoc.GetViewOptions());
+
+ /*Stampit enable/disable print cancel */
+ if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) )
+ pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ /*Stampit enable/disable print cancel */
+
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) )
+ aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) )
+ aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) )
+ aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) )
{
- bool bUpdateHeights = false;
-
- ScViewOptions aViewOpt(pDoc->GetViewOptions());
-
- /*Stampit enable/disable print cancel */
- if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) )
- pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- /*Stampit enable/disable print cancel */
-
- else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) )
- aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) )
- aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) )
- aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) )
+ sal_Int64 nColor = 0;
+ if (aValue >>= nColor)
{
- sal_Int64 nColor = 0;
- if (aValue >>= nColor)
- {
- OUString aColorName;
- Color aColor(static_cast<sal_uInt32>(nColor));
- aViewOpt.SetGridColor(aColor, aColorName);
- }
+ OUString aColorName;
+ Color aColor(static_cast<sal_uInt32>(nColor));
+ aViewOpt.SetGridColor(aColor, aColorName);
}
- else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) )
- aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) )
- pDoc->SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) )
- aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) )
- aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) )
- aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) )
- pDoc->SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) )
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) )
+ aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) )
+ rDoc.SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) )
+ aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) )
+ aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) )
+ aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) )
+ rDoc.SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) )
+ {
+ OUString sPrinterName;
+ if ( aValue >>= sPrinterName )
{
- OUString sPrinterName;
- if ( aValue >>= sPrinterName )
+ // #i75610# if the name is empty, do nothing (don't create any printer)
+ if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
{
- // #i75610# if the name is empty, do nothing (don't create any printer)
- if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
+ SfxPrinter* pPrinter = pDocShell->GetPrinter();
+ if (pPrinter)
{
- SfxPrinter* pPrinter = pDocShell->GetPrinter();
- if (pPrinter)
+ if (pPrinter->GetName() != sPrinterName)
{
- if (pPrinter->GetName() != sPrinterName)
- {
- SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
- if (pNewPrinter->IsKnown())
- pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER );
- else
- delete pNewPrinter;
- }
+ SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
+ if (pNewPrinter->IsKnown())
+ pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER );
+ else
+ delete pNewPrinter;
}
- else
- throw uno::RuntimeException();
}
+ else
+ throw uno::RuntimeException();
}
- else
- throw lang::IllegalArgumentException();
}
- else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) )
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) )
+ {
+ uno::Sequence<sal_Int8> aSequence;
+ if ( aValue >>= aSequence )
{
- uno::Sequence<sal_Int8> aSequence;
- if ( aValue >>= aSequence )
+ sal_uInt32 nSize = aSequence.getLength();
+ // #i75610# if the sequence is empty, do nothing (don't create any printer)
+ if ( nSize != 0 )
{
- sal_uInt32 nSize = aSequence.getLength();
- // #i75610# if the sequence is empty, do nothing (don't create any printer)
- if ( nSize != 0 )
- {
- SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
- aStream.Seek ( STREAM_SEEK_TO_BEGIN );
- SfxItemSet* pSet = new SfxItemSet( *pDoc->GetPool(),
- SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
- SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
- SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET,
- SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
- NULL );
- pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) );
- }
+ SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ SfxItemSet* pSet = new SfxItemSet( *rDoc.GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET,
+ SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
+ NULL );
+ pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) );
}
}
- else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) )
- {
- bool bTmp=true;
- if ( aValue >>= bTmp )
- pDocShell->SetUseUserData( bTmp );
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) )
- {
- // read-only - should not be set
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) )
- {
- // Int16 contains CharacterCompressionType values
- sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
- pDoc->SetAsianCompression( (sal_uInt8) nUno );
- bUpdateHeights = true;
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) )
- {
- pDoc->SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- bUpdateHeights = true;
- }
- else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) )
- {
- bool bTmp=false;
- if ( aValue >>= bTmp )
- pDocShell->SetSaveVersionOnClose( bTmp );
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) )
- {
- bool bTmp=true;
- if ( aValue >>= bTmp )
- pDocShell->SetQueryLoadTemplate( bTmp );
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) )
- {
- bool bTmp=false;
- if ( aValue >>= bTmp )
- pDocShell->SetLoadReadonly( bTmp );
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) )
- {
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) )
+ {
+ bool bTmp=true;
+ if ( aValue >>= bTmp )
+ pDocShell->SetUseUserData( bTmp );
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) )
+ {
+ // read-only - should not be set
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) )
+ {
+ // Int16 contains CharacterCompressionType values
+ sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
+ rDoc.SetAsianCompression( (sal_uInt8) nUno );
+ bUpdateHeights = true;
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) )
+ {
+ rDoc.SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ bUpdateHeights = true;
+ }
+ else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) )
+ {
+ bool bTmp=false;
+ if ( aValue >>= bTmp )
+ pDocShell->SetSaveVersionOnClose( bTmp );
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) )
+ {
+ bool bTmp=true;
+ if ( aValue >>= bTmp )
+ pDocShell->SetQueryLoadTemplate( bTmp );
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) )
+ {
+ bool bTmp=false;
+ if ( aValue >>= bTmp )
+ pDocShell->SetLoadReadonly( bTmp );
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) )
+ {
#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
- bool bDocShared = false;
- if ( aValue >>= bDocShared )
- {
- pDocShell->SetSharedXMLFlag( bDocShared );
- }
-#endif
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) )
+ bool bDocShared = false;
+ if ( aValue >>= bDocShared )
{
- uno::Sequence< beans::PropertyValue > aInfo;
- if ( !( aValue >>= aInfo ) )
- throw lang::IllegalArgumentException(
- OUString( "Value of type Sequence<PropertyValue> expected!" ),
- uno::Reference< uno::XInterface >(),
- 2 );
-
- if ( !pDocShell->SetModifyPasswordInfo( aInfo ) )
- throw beans::PropertyVetoException(
- "The hash is not allowed to be changed now!" );
+ pDocShell->SetSharedXMLFlag( bDocShared );
}
- else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) )
+#endif
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) )
+ {
+ uno::Sequence< beans::PropertyValue > aInfo;
+ if ( !( aValue >>= aInfo ) )
+ throw lang::IllegalArgumentException(
+ OUString( "Value of type Sequence<PropertyValue> expected!" ),
+ uno::Reference< uno::XInterface >(),
+ 2 );
+
+ if ( !pDocShell->SetModifyPasswordInfo( aInfo ) )
+ throw beans::PropertyVetoException(
+ "The hash is not allowed to be changed now!" );
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) )
+ {
+ bool bVal = false;
+ if ( aValue >>=bVal )
{
- bool bVal = false;
- if ( aValue >>=bVal )
- {
- pDoc->SetIsUsingEmbededFonts(bVal);
- }
+ rDoc.SetIsUsingEmbededFonts(bVal);
}
+ }
+ else
+ {
+ ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
+ if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) )
+ aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) )
+ aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) )
+ aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) )
+ aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) )
+ aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) )
+ aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) )
+ aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else
- {
- ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
- if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) )
- aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) )
- aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) )
- aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) )
- aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) )
- aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) )
- aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) )
- aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else
- throw beans::UnknownPropertyException();
- aViewOpt.SetGridOptions(aGridOpt);
- }
- pDoc->SetViewOptions(aViewOpt);
+ throw beans::UnknownPropertyException();
+ aViewOpt.SetGridOptions(aGridOpt);
+ }
+ rDoc.SetViewOptions(aViewOpt);
- if ( bUpdateHeights && !pDoc->IsImportingXML() )
- {
- // update automatic row heights and repaint
- SCTAB nTabCount = pDoc->GetTableCount();
- for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
- pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
- pDocShell->SetDocumentModified();
- }
+ if ( bUpdateHeights && !rDoc.IsImportingXML() )
+ {
+ // update automatic row heights and repaint
+ SCTAB nTabCount = rDoc.GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
+ pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
+ pDocShell->SetDocumentModified();
}
- else
- throw uno::RuntimeException();
}
else
throw uno::RuntimeException();
@@ -335,121 +330,116 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr
if(pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (pDoc)
+ ScDocument& rDoc = pDocShell->GetDocument();
+ const ScViewOptions& aViewOpt = rDoc.GetViewOptions();
+
+ /*Stampit enable/disable print cancel */
+ if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() );
+ /*Stampit enable/disable print cancel */
+
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) )
{
- const ScViewOptions& aViewOpt = pDoc->GetViewOptions();
-
- /*Stampit enable/disable print cancel */
- if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() );
- /*Stampit enable/disable print cancel */
-
- else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) )
- {
- OUString aColorName;
- Color aColor = aViewOpt.GetGridColor(&aColorName);
- aRet <<= static_cast<sal_Int64>(aColor.GetColor());
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) );
- else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) )
- aRet <<= static_cast<sal_Int16> ( pDoc->GetLinkMode() );
- else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) );
- else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAutoCalc() );
- else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) )
- {
- // #i75610# don't create the printer, return empty string if no printer created yet
- // (as in SwXDocumentSettings)
- SfxPrinter* pPrinter = pDoc->GetPrinter( false );
- if (pPrinter)
- aRet <<= OUString ( pPrinter->GetName());
- else
- aRet <<= OUString();
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) )
- {
- // #i75610# don't create the printer, return empty sequence if no printer created yet
- // (as in SwXDocumentSettings)
- SfxPrinter* pPrinter = pDoc->GetPrinter( false );
- if (pPrinter)
- {
- SvMemoryStream aStream;
- pPrinter->Store( aStream );
- aStream.Seek ( STREAM_SEEK_TO_END );
- sal_uInt32 nSize = aStream.Tell();
- aStream.Seek ( STREAM_SEEK_TO_BEGIN );
- uno::Sequence < sal_Int8 > aSequence( nSize );
- aStream.Read ( aSequence.getArray(), nSize );
- aRet <<= aSequence;
- }
- else
- aRet <<= uno::Sequence<sal_Int8>();
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) )
- aRet <<= pDocShell->IsUseUserData();
- else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) )
+ OUString aColorName;
+ Color aColor = aViewOpt.GetGridColor(&aColorName);
+ aRet <<= static_cast<sal_Int64>(aColor.GetColor());
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) );
+ else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) )
+ aRet <<= static_cast<sal_Int16> ( rDoc.GetLinkMode() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) );
+ else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.GetAutoCalc() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) )
+ {
+ // #i75610# don't create the printer, return empty string if no printer created yet
+ // (as in SwXDocumentSettings)
+ SfxPrinter* pPrinter = rDoc.GetPrinter( false );
+ if (pPrinter)
+ aRet <<= OUString ( pPrinter->GetName());
+ else
+ aRet <<= OUString();
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) )
+ {
+ // #i75610# don't create the printer, return empty sequence if no printer created yet
+ // (as in SwXDocumentSettings)
+ SfxPrinter* pPrinter = rDoc.GetPrinter( false );
+ if (pPrinter)
{
- aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
+ SvMemoryStream aStream;
+ pPrinter->Store( aStream );
+ aStream.Seek ( STREAM_SEEK_TO_END );
+ sal_uInt32 nSize = aStream.Tell();
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ uno::Sequence < sal_Int8 > aSequence( nSize );
+ aStream.Read ( aSequence.getArray(), nSize );
+ aRet <<= aSequence;
}
- else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) )
- aRet <<= static_cast<sal_Int16> ( pDoc->GetAsianCompression() );
- else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAsianKerning() );
- else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) )
- aRet <<= pDocShell->IsSaveVersionOnClose();
- else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) )
- aRet <<= pDocShell->IsQueryLoadTemplate();
- else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) )
- aRet <<= pDocShell->IsLoadReadonly();
- else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) )
- {
+ else
+ aRet <<= uno::Sequence<sal_Int8>();
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) )
+ aRet <<= pDocShell->IsUseUserData();
+ else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) )
+ {
+ aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) )
+ aRet <<= static_cast<sal_Int16> ( rDoc.GetAsianCompression() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.GetAsianKerning() );
+ else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) )
+ aRet <<= pDocShell->IsSaveVersionOnClose();
+ else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) )
+ aRet <<= pDocShell->IsQueryLoadTemplate();
+ else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) )
+ aRet <<= pDocShell->IsLoadReadonly();
+ else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) )
+ {
#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
- ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() );
+ ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() );
#endif
- }
- else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) )
- aRet <<= pDocShell->GetModifyPasswordInfo();
- else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) )
- {
- aRet <<= pDoc->IsUsingEmbededFonts();
- }
+ }
+ else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) )
+ aRet <<= pDocShell->GetModifyPasswordInfo();
+ else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) )
+ {
+ aRet <<= rDoc.IsUsingEmbededFonts();
+ }
+ else
+ {
+ const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
+ if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) )
+ aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) )
+ aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) )
+ aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) )
+ aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() );
+ else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) )
+ ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() );
else
- {
- const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
- if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) )
- aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) )
- aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) )
- aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) )
- aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() );
- else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() );
- else
- throw beans::UnknownPropertyException();
- }
+ throw beans::UnknownPropertyException();
}
- else
- throw uno::RuntimeException();
}
else
throw uno::RuntimeException();
diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx
index a50792d8cb49..bd203db8ecf9 100644
--- a/sc/source/ui/unoobj/cursuno.cxx
+++ b/sc/source/ui/unoobj/cursuno.cxx
@@ -110,7 +110,7 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentRegion() throw(uno::RuntimeExcep
SCROW nEndRow = aOneRange.aEnd.Row();
SCTAB nTab = aOneRange.aStart.Tab();
- pDocSh->GetDocument()->GetDataArea(
+ pDocSh->GetDocument().GetDataArea(
nTab, nStartCol, nStartRow, nEndCol, nEndRow, true, false );
ScRange aNew( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab );
@@ -132,11 +132,11 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentArray()
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
ScRange aMatrix;
// finding the matrix range is now in GetMatrixFormulaRange in the document
- if ( pDoc->GetMatrixFormulaRange( aCursor, aMatrix ) )
+ if ( rDoc.GetMatrixFormulaRange( aCursor, aMatrix ) )
{
SetNewRange( aMatrix );
}
@@ -161,9 +161,9 @@ void SAL_CALL ScCellCursorObj::collapseToMergedArea() throw(uno::RuntimeExceptio
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aNewRange( *rRanges[ 0 ] );
- ScDocument* pDoc = pDocSh->GetDocument();
- pDoc->ExtendOverlapped( aNewRange );
- pDoc->ExtendMerge( aNewRange ); // after ExtendOverlapped!
+ ScDocument& rDoc = pDocSh->GetDocument();
+ rDoc.ExtendOverlapped( aNewRange );
+ rDoc.ExtendMerge( aNewRange ); // after ExtendOverlapped!
SetNewRange( aNewRange );
}
@@ -245,7 +245,7 @@ void SAL_CALL ScCellCursorObj::gotoStartOfUsedArea(sal_Bool bExpand)
SCCOL nUsedX = 0; // Anfang holen
SCROW nUsedY = 0;
- if (!pDocSh->GetDocument()->GetDataStart( nTab, nUsedX, nUsedY ))
+ if (!pDocSh->GetDocument().GetDataStart( nTab, nUsedX, nUsedY ))
{
nUsedX = 0;
nUsedY = 0;
@@ -273,7 +273,7 @@ void SAL_CALL ScCellCursorObj::gotoEndOfUsedArea( sal_Bool bExpand )
SCCOL nUsedX = 0; // Ende holen
SCROW nUsedY = 0;
- if (!pDocSh->GetDocument()->GetTableArea( nTab, nUsedX, nUsedY ))
+ if (!pDocSh->GetDocument().GetTableArea( nTab, nUsedX, nUsedY ))
{
nUsedX = 0;
nUsedY = 0;
@@ -309,7 +309,7 @@ void SAL_CALL ScCellCursorObj::gotoStart() throw(uno::RuntimeException, std::exc
SCROW nEndRow = aOneRange.aEnd.Row();
SCTAB nTab = aOneRange.aStart.Tab();
- pDocSh->GetDocument()->GetDataArea(
+ pDocSh->GetDocument().GetDataArea(
nTab, nStartCol, nStartRow, nEndCol, nEndRow, false, false );
ScRange aNew( nStartCol, nStartRow, nTab );
@@ -337,7 +337,7 @@ void SAL_CALL ScCellCursorObj::gotoEnd() throw(uno::RuntimeException, std::excep
SCROW nEndRow = aOneRange.aEnd.Row();
SCTAB nTab = aOneRange.aStart.Tab();
- pDocSh->GetDocument()->GetDataArea(
+ pDocSh->GetDocument().GetDataArea(
nTab, nStartCol, nStartRow, nEndCol, nEndRow, false, false );
ScRange aNew( nEndCol, nEndRow, nTab );
@@ -361,7 +361,7 @@ void SAL_CALL ScCellCursorObj::gotoNext() throw(uno::RuntimeException, std::exce
SCTAB nTab = aCursor.Tab();
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
- pDocSh->GetDocument()->GetNextPos( nNewX,nNewY, nTab, 1,0, false,true, aMark );
+ pDocSh->GetDocument().GetNextPos( nNewX,nNewY, nTab, 1,0, false,true, aMark );
//! sonst Exception oder so
SetNewRange( ScRange( nNewX, nNewY, nTab ) );
@@ -383,7 +383,7 @@ void SAL_CALL ScCellCursorObj::gotoPrevious() throw(uno::RuntimeException, std::
SCTAB nTab = aCursor.Tab();
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
- pDocSh->GetDocument()->GetNextPos( nNewX,nNewY, nTab, -1,0, false,true, aMark );
+ pDocSh->GetDocument().GetNextPos( nNewX,nNewY, nTab, -1,0, false,true, aMark );
//! sonst Exception oder so
SetNewRange( ScRange( nNewX, nNewY, nTab ) );
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 3ace2c48bd14..ff3d54b1f3e2 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -234,8 +234,8 @@ static ScDPObject* lcl_GetDPObject( ScDocShell* pDocShell, SCTAB nTab, const OUS
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDPCollection* pColl = pDoc->GetDPCollection();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDPCollection* pColl = rDoc.GetDPCollection();
if ( pColl )
{
size_t nCount = pColl->GetCount();
@@ -255,8 +255,8 @@ static OUString lcl_CreatePivotName( ScDocShell* pDocShell )
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDPCollection* pColl = pDoc->GetDPCollection();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDPCollection* pColl = rDoc.GetDPCollection();
if ( pColl )
return pColl->CreateNewName();
}
@@ -284,13 +284,13 @@ ScDataPilotTablesObj::ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT) :
pDocShell( pDocSh ),
nTab( nT )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDataPilotTablesObj::~ScDataPilotTablesObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDataPilotTablesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -310,8 +310,8 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDPCollection* pColl = pDoc->GetDPCollection();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDPCollection* pColl = rDoc.GetDPCollection();
if ( pColl )
{
// count tables on this sheet
@@ -459,8 +459,8 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException, std:
SolarMutexGuard aGuard;
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDPCollection* pColl = pDoc->GetDPCollection();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDPCollection* pColl = rDoc.GetDPCollection();
if ( pColl )
{
// count tables on this sheet
@@ -520,8 +520,8 @@ Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDPCollection* pColl = pDoc->GetDPCollection();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDPCollection* pColl = rDoc.GetDPCollection();
if ( pColl )
{
// count tables on this sheet
@@ -558,8 +558,8 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName )
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDPCollection* pColl = pDoc->GetDPCollection();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDPCollection* pColl = rDoc.GetDPCollection();
if ( pColl )
{
size_t nCount = pColl->GetCount();
@@ -579,13 +579,13 @@ ScDataPilotDescriptorBase::ScDataPilotDescriptorBase(ScDocShell* pDocSh) :
maPropSet( lcl_GetDataPilotDescriptorBaseMap() ),
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDataPilotDescriptorBase::~ScDataPilotDescriptorBase()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
Any SAL_CALL ScDataPilotDescriptorBase::queryInterface( const uno::Type& rType )
@@ -672,7 +672,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setSourceRange( const CellRangeAddress&
if (!pDPObject)
throw RuntimeException();
- ScSheetSourceDesc aSheetDesc(pDocShell->GetDocument());
+ ScSheetSourceDesc aSheetDesc(&pDocShell->GetDocument());
if (pDPObject->IsSheetData())
aSheetDesc = *pDPObject->GetSheetDesc();
@@ -792,7 +792,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp
uno::Sequence<beans::PropertyValue> aArgSeq;
if ( aValue >>= aArgSeq )
{
- ScImportSourceDesc aImportDesc(pDocShell->GetDocument());
+ ScImportSourceDesc aImportDesc(&pDocShell->GetDocument());
const ScImportSourceDesc* pOldDesc = pDPObject->GetImportSourceDesc();
if (pOldDesc)
@@ -1351,7 +1351,7 @@ void ScDataPilotTableObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
ScRangeList aRanges;
aRanges.Append( aRange );
const ScUpdateRefHint& rRef = static_cast< const ScUpdateRefHint& >( rHint );
- if ( aRanges.UpdateReference( rRef.GetMode(), GetDocShell()->GetDocument(), rRef.GetRange(),
+ if ( aRanges.UpdateReference( rRef.GetMode(), &GetDocShell()->GetDocument(), rRef.GetRange(),
rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) &&
aRanges.size() == 1 )
{
@@ -1373,14 +1373,14 @@ void ScDataPilotTableObj::Refreshed_Impl()
// the EventObject holds a Ref to this object until after the listener calls
- ScDocument* pDoc = GetDocShell()->GetDocument();
+ ScDocument& rDoc = GetDocShell()->GetDocument();
for ( sal_uInt16 n=0; n<aModifyListeners.size(); n++ )
- pDoc->AddUnoListenerCall( aModifyListeners[n], aEvent );
+ rDoc.AddUnoListenerCall( aModifyListeners[n], aEvent );
}
ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) :
ScDataPilotDescriptorBase( pDocSh ),
- mpDPObject(new ScDPObject(pDocSh ? pDocSh->GetDocument() : NULL) )
+ mpDPObject(new ScDPObject(pDocSh ? &pDocSh->GetDocument() : NULL) )
{
ScDPSaveData aSaveData;
// set defaults like in ScPivotParam constructor
@@ -1389,7 +1389,7 @@ ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) :
aSaveData.SetIgnoreEmptyRows( false );
aSaveData.SetRepeatIfEmpty( false );
mpDPObject->SetSaveData(aSaveData);
- ScSheetSourceDesc aSheetDesc(pDocSh ? pDocSh->GetDocument() : NULL);
+ ScSheetSourceDesc aSheetDesc(pDocSh ? &pDocSh->GetDocument() : NULL);
mpDPObject->SetSheetDesc(aSheetDesc);
mpDPObject->GetSource();
}
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 09762b1f1402..d1afe899dd3c 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -994,13 +994,13 @@ ScFilterDescriptorBase::ScFilterDescriptorBase(ScDocShell* pDocShell) :
pDocSh(pDocShell)
{
if (pDocSh)
- pDocSh->GetDocument()->AddUnoObject(*this);
+ pDocSh->GetDocument().AddUnoObject(*this);
}
ScFilterDescriptorBase::~ScFilterDescriptorBase()
{
if (pDocSh)
- pDocSh->GetDocument()->RemoveUnoObject(*this);
+ pDocSh->GetDocument().RemoveUnoObject(*this);
}
void ScFilterDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -1356,8 +1356,8 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields(
SCSIZE nCount = static_cast<SCSIZE>(aFilterFields.getLength());
aParam.Resize( nCount );
- ScDocument* pDoc = pDocSh->GetDocument();
- svl::SharedStringPool& rPool = pDoc->GetSharedStringPool();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ svl::SharedStringPool& rPool = rDoc.GetSharedStringPool();
const sheet::TableFilterField* pAry = aFilterFields.getConstArray();
SCSIZE i;
for (i=0; i<nCount; i++)
@@ -1376,7 +1376,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields(
if (rItem.meType != ScQueryEntry::ByString)
{
OUString aStr;
- pDoc->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr);
+ rDoc.GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr);
rItem.maString = rPool.intern(aStr);
}
@@ -1418,7 +1418,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields2(
SolarMutexGuard aGuard;
ScQueryParam aParam;
GetData(aParam);
- fillQueryParam(aParam, pDocSh->GetDocument(), aFilterFields);
+ fillQueryParam(aParam, &pDocSh->GetDocument(), aFilterFields);
PutData(aParam);
}
@@ -1429,7 +1429,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields3(
SolarMutexGuard aGuard;
ScQueryParam aParam;
GetData(aParam);
- fillQueryParam(aParam, pDocSh->GetDocument(), aFilterFields);
+ fillQueryParam(aParam, &pDocSh->GetDocument(), aFilterFields);
PutData(aParam);
}
@@ -1621,7 +1621,7 @@ void ScDataPilotFilterDescriptor::PutData( const ScQueryParam& rParam )
ScDPObject* pDPObj = pParent->GetDPObject();
if (pDPObj)
{
- ScSheetSourceDesc aSheetDesc(pParent->GetDocShell()->GetDocument());
+ ScSheetSourceDesc aSheetDesc(&pParent->GetDocShell()->GetDocument());
if (pDPObj->IsSheetData())
aSheetDesc = *pDPObj->GetSheetDesc();
aSheetDesc.SetQueryParam(rParam);
@@ -1638,7 +1638,7 @@ ScDatabaseRangeObj::ScDatabaseRangeObj(ScDocShell* pDocSh, const OUString& rNm)
bIsUnnamed(false),
aTab( 0 )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDatabaseRangeObj::ScDatabaseRangeObj(ScDocShell* pDocSh, const SCTAB nTab) :
@@ -1648,13 +1648,13 @@ ScDatabaseRangeObj::ScDatabaseRangeObj(ScDocShell* pDocSh, const SCTAB nTab) :
bIsUnnamed(true),
aTab( nTab )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDatabaseRangeObj::~ScDatabaseRangeObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDatabaseRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -1682,11 +1682,11 @@ ScDBData* ScDatabaseRangeObj::GetDBData_Impl() const
{
if (bIsUnnamed)
{
- pRet = pDocShell->GetDocument()->GetAnonymousDBData(aTab);
+ pRet = pDocShell->GetDocument().GetAnonymousDBData(aTab);
}
else
{
- ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
+ ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection();
if (pNames)
{
ScDBData* p = pNames->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(aName));
@@ -2037,13 +2037,13 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue(
aNewData.SetAutoFilter(bAutoFilter);
ScRange aRange;
aNewData.GetArea(aRange);
- ScDocument* pDoc = pDocShell->GetDocument();
- if (bAutoFilter && pDoc)
- pDoc->ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if (bAutoFilter)
+ rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(), SC_MF_AUTO );
- else if (!bAutoFilter && pDoc)
- pDoc->RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
+ else if (!bAutoFilter)
+ rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(), SC_MF_AUTO );
ScRange aPaintRange(aRange.aStart, aRange.aEnd);
@@ -2081,12 +2081,12 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue(
sal_Int32 nRefresh = 0;
if (aValue >>= nRefresh)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
aNewData.SetRefreshDelay(nRefresh);
- if (pDoc && pDoc->GetDBCollection())
+ if (rDoc.GetDBCollection())
{
- aNewData.SetRefreshHandler( pDoc->GetDBCollection()->GetRefreshHandler() );
- aNewData.SetRefreshControl( pDoc->GetRefreshTimerControlAddress() );
+ aNewData.SetRefreshHandler( rDoc.GetDBCollection()->GetRefreshHandler() );
+ aNewData.SetRefreshControl( &rDoc.GetRefreshTimerControlAddress() );
}
}
}
@@ -2203,13 +2203,13 @@ uno::Sequence<OUString> SAL_CALL ScDatabaseRangeObj::getSupportedServiceNames()
ScDatabaseRangesObj::ScDatabaseRangesObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDatabaseRangesObj::~ScDatabaseRangesObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -2230,7 +2230,7 @@ ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByIndex_Impl(size_t nIndex)
if (!pDocShell)
return NULL;
- ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
+ ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection();
if (!pNames)
return NULL;
@@ -2307,7 +2307,7 @@ sal_Int32 SAL_CALL ScDatabaseRangesObj::getCount() throw(uno::RuntimeException,
if (pDocShell)
{
- ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
+ ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection();
if (pNames)
return static_cast<sal_Int32>(pNames->getNamedDBs().size());
}
@@ -2365,7 +2365,7 @@ uno::Sequence<OUString> SAL_CALL ScDatabaseRangesObj::getElementNames()
if (pDocShell)
{
- ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
+ ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection();
if (pNames)
{
const ScDBCollection::NamedDBs& rDBs = pNames->getNamedDBs();
@@ -2389,7 +2389,7 @@ sal_Bool SAL_CALL ScDatabaseRangesObj::hasByName( const OUString& aName )
if (pDocShell)
{
- ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
+ ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection();
if (pNames)
return pNames->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(aName)) != NULL;
}
@@ -2399,13 +2399,13 @@ sal_Bool SAL_CALL ScDatabaseRangesObj::hasByName( const OUString& aName )
ScUnnamedDatabaseRangesObj::ScUnnamedDatabaseRangesObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScUnnamedDatabaseRangesObj::~ScUnnamedDatabaseRangesObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScUnnamedDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -2429,7 +2429,7 @@ void ScUnnamedDatabaseRangesObj::setByTable( const table::CellRangeAddress& aRan
bool bDone = false;
if (pDocShell)
{
- if ( pDocShell->GetDocument()->GetTableCount() <= aRange.Sheet )
+ if ( pDocShell->GetDocument().GetTableCount() <= aRange.Sheet )
throw lang::IndexOutOfBoundsException();
ScDBDocFunc aFunc(*pDocShell);
@@ -2450,7 +2450,7 @@ uno::Any ScUnnamedDatabaseRangesObj::getByTable( sal_Int32 nTab )
SolarMutexGuard aGuard;
if (pDocShell)
{
- if ( pDocShell->GetDocument()->GetTableCount() <= nTab )
+ if ( pDocShell->GetDocument().GetTableCount() <= nTab )
throw lang::IndexOutOfBoundsException();
uno::Reference<sheet::XDatabaseRange> xRange(
new ScDatabaseRangeObj(pDocShell, static_cast<SCTAB>(nTab)));
@@ -2470,9 +2470,9 @@ sal_Bool ScUnnamedDatabaseRangesObj::hasByTable( sal_Int32 nTab )
SolarMutexGuard aGuard;
if (pDocShell)
{
- if (pDocShell->GetDocument()->GetTableCount() <= nTab)
+ if (pDocShell->GetDocument().GetTableCount() <= nTab)
throw lang::IndexOutOfBoundsException();
- if (pDocShell->GetDocument()->GetAnonymousDBData((SCTAB) nTab))
+ if (pDocShell->GetDocument().GetAnonymousDBData((SCTAB) nTab))
return true;
return false;
}
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index eebb8c72bfc2..1a2527d6b5ea 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -77,13 +77,13 @@ ScDocDefaultsObj::ScDocDefaultsObj(ScDocShell* pDocSh) :
pDocShell( pDocSh ),
aPropertyMap(lcl_GetDocDefaultsMap())
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDocDefaultsObj::~ScDocDefaultsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDocDefaultsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -134,35 +134,25 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
{
if(aPropertyName.equalsAscii(SC_UNO_STANDARDDEC) )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (pDoc)
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDocOptions aDocOpt(rDoc.GetDocOptions());
+ sal_Int16 nValue = 0;
+ if (aValue >>= nValue)
{
- ScDocOptions aDocOpt(pDoc->GetDocOptions());
- sal_Int16 nValue = 0;
- if (aValue >>= nValue)
- {
- aDocOpt.SetStdPrecision(static_cast<sal_uInt16> (nValue));
- pDoc->SetDocOptions(aDocOpt);
- }
+ aDocOpt.SetStdPrecision(static_cast<sal_uInt16> (nValue));
+ rDoc.SetDocOptions(aDocOpt);
}
- else
- throw uno::RuntimeException();
}
else if (aPropertyName.equalsAscii(SC_UNO_TABSTOPDIS) )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (pDoc)
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDocOptions aDocOpt(rDoc.GetDocOptions());
+ sal_Int32 nValue = 0;
+ if (aValue >>= nValue)
{
- ScDocOptions aDocOpt(pDoc->GetDocOptions());
- sal_Int32 nValue = 0;
- if (aValue >>= nValue)
- {
- aDocOpt.SetTabDistance(static_cast<sal_uInt16>(HMMToTwips(nValue)));
- pDoc->SetDocOptions(aDocOpt);
- }
+ aDocOpt.SetTabDistance(static_cast<sal_uInt16>(HMMToTwips(nValue)));
+ rDoc.SetDocOptions(aDocOpt);
}
- else
- throw uno::RuntimeException();
}
}
else if ( pEntry->nWID == ATTR_FONT_LANGUAGE ||
@@ -181,9 +171,9 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
else
eNew = LANGUAGE_NONE;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
if ( pEntry->nWID == ATTR_CJK_FONT_LANGUAGE )
eCjk = eNew;
@@ -192,12 +182,12 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
else
eLatin = eNew;
- pDoc->SetLanguage( eLatin, eCjk, eCtl );
+ rDoc.SetLanguage( eLatin, eCjk, eCtl );
}
}
else
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
SfxPoolItem* pNewItem = pPool->GetDefaultItem(pEntry->nWID).Clone();
if( !pNewItem->PutValue( aValue, pEntry->nMemberId ) )
@@ -230,36 +220,26 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyValue( const OUString& aPropertyN
{
if(aPropertyName.equalsAscii(SC_UNO_STANDARDDEC) )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (pDoc)
- {
- const ScDocOptions& aDocOpt = pDoc->GetDocOptions();
- sal_uInt16 nPrec = aDocOpt.GetStdPrecision();
- // the max value of unsigned 16-bit integer is used as the flag
- // value for unlimited precision, c.f.
- // SvNumberFormatter::UNLIMITED_PRECISION.
- if (nPrec <= ::std::numeric_limits<sal_Int16>::max())
- aRet <<= static_cast<sal_Int16> (nPrec);
- }
- else
- throw uno::RuntimeException();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ const ScDocOptions& aDocOpt = rDoc.GetDocOptions();
+ sal_uInt16 nPrec = aDocOpt.GetStdPrecision();
+ // the max value of unsigned 16-bit integer is used as the flag
+ // value for unlimited precision, c.f.
+ // SvNumberFormatter::UNLIMITED_PRECISION.
+ if (nPrec <= ::std::numeric_limits<sal_Int16>::max())
+ aRet <<= static_cast<sal_Int16> (nPrec);
}
else if (aPropertyName.equalsAscii(SC_UNO_TABSTOPDIS) )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (pDoc)
- {
- const ScDocOptions& aDocOpt = pDoc->GetDocOptions();
- sal_Int32 nValue (TwipsToEvenHMM(aDocOpt.GetTabDistance()));
- aRet <<= nValue;
- }
- else
- throw uno::RuntimeException();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ const ScDocOptions& aDocOpt = rDoc.GetDocOptions();
+ sal_Int32 nValue (TwipsToEvenHMM(aDocOpt.GetTabDistance()));
+ aRet <<= nValue;
}
}
else
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
const SfxPoolItem& rItem = pPool->GetDefaultItem( pEntry->nWID );
rItem.QueryValue( aRet, pEntry->nMemberId );
}
@@ -296,7 +276,7 @@ beans::PropertyState SAL_CALL ScDocDefaultsObj::getPropertyState( const OUString
{
// check if pool default is set
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
if ( pPool->GetPoolDefaultItem( nWID ) != NULL )
eRet = beans::PropertyState_DIRECT_VALUE;
}
@@ -333,7 +313,7 @@ void SAL_CALL ScDocDefaultsObj::setPropertyToDefault( const OUString& aPropertyN
if (pEntry->nWID)
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pPool->ResetPoolDefaultItem( pEntry->nWID );
ItemsChanged();
@@ -358,7 +338,7 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyDefault( const OUString& aPropert
uno::Any aRet;
if (pEntry->nWID)
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
const SfxPoolItem* pItem = pPool->GetItem2( pEntry->nWID, SFX_ITEMS_DEFAULT );
if (pItem)
pItem->QueryValue( aRet, pEntry->nMemberId );
diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx
index 0b29ddda4c35..b87ad9be3358 100644
--- a/sc/source/ui/unoobj/dispuno.cxx
+++ b/sc/source/ui/unoobj/dispuno.cxx
@@ -227,10 +227,10 @@ void SAL_CALL ScDispatch::dispatch( const util::URL& aURL,
bool bDone = false;
if ( pViewShell && aURL.Complete.equalsAscii(cURLInsertColumns) )
{
- ScViewData* pViewData = pViewShell->GetViewData();
- ScAddress aPos( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() );
+ ScViewData& rViewData = pViewShell->GetViewData();
+ ScAddress aPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
- ScDBDocFunc aFunc( *pViewData->GetDocShell() );
+ ScDBDocFunc aFunc( *rViewData.GetDocShell() );
bDone = aFunc.DoImportUno( aPos, aArgs );
}
// cURLDocDataSource is never dispatched
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 75cabca93aee..131f9b7db07d 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -355,14 +355,14 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
// pDocShell may be NULL if this is the base of a ScDocOptionsObj
if ( pDocShell )
{
- pDocShell->GetDocument()->AddUnoObject(*this); // SfxModel is derived from SfxListener
+ pDocShell->GetDocument().AddUnoObject(*this); // SfxModel is derived from SfxListener
}
}
ScModelObj::~ScModelObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
if (xNumberAgg.is())
xNumberAgg->setDelegator(uno::Reference<uno::XInterface>());
@@ -381,7 +381,7 @@ uno::Reference< uno::XAggregation> ScModelObj::GetFormatter()
comphelper::increment( m_refCount );
// waehrend des queryInterface braucht man ein Ref auf das
// SvNumberFormatsSupplierObj, sonst wird es geloescht.
- uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(pDocShell->GetDocument()->GetFormatTable() ));
+ uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(pDocShell->GetDocument().GetFormatTable() ));
{
xNumberAgg.set(uno::Reference<uno::XAggregation>( xFormatter, uno::UNO_QUERY ));
// extra block to force deletion of the temporary before setDelegator
@@ -400,7 +400,7 @@ uno::Reference< uno::XAggregation> ScModelObj::GetFormatter()
ScDocument* ScModelObj::GetDocument() const
{
if (pDocShell)
- return pDocShell->GetDocument();
+ return &pDocShell->GetDocument();
return NULL;
}
@@ -584,16 +584,16 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
// handle "OnCalculate" sheet events (search also for VBA event handlers)
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if ( pDoc->GetVbaEventProcessor().is() )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if ( rDoc.GetVbaEventProcessor().is() )
{
// If the VBA event processor is set, HasAnyCalcNotification is much faster than HasAnySheetEventScript
- if ( pDoc->HasAnyCalcNotification() && pDoc->HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true ) )
+ if ( rDoc.HasAnyCalcNotification() && rDoc.HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true ) )
HandleCalculateEvents();
}
else
{
- if ( pDoc->HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE ) )
+ if ( rDoc.HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE ) )
HandleCalculateEvents();
}
}
@@ -612,7 +612,7 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
SvNumberFormatsSupplierObj::getImplementation(
uno::Reference<util::XNumberFormatsSupplier>(xNumberAgg, uno::UNO_QUERY) );
if ( pNumFmt && pDocShell )
- pNumFmt->SetNumberFormatter( pDocShell->GetDocument()->GetFormatTable() );
+ pNumFmt->SetNumberFormatter( pDocShell->GetDocument().GetFormatTable() );
}
}
}
@@ -861,12 +861,12 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection,
SdrObject *pSdrObj = pShape->GetSdrObject();
if( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if( pDoc && pSdrObj )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if( pSdrObj )
{
Rectangle aObjRect = pSdrObj->GetCurrentBoundRect();
SCTAB nCurrentTab = ScDocShell::GetCurTab();
- ScRange aRange = pDoc->GetRange( nCurrentTab, aObjRect );
+ ScRange aRange = rDoc.GetRange( nCurrentTab, aObjRect );
rMark.SetMarkArea( aRange );
if( rMark.IsMarked() && !rMark.IsMultiMarked() )
@@ -884,7 +884,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection,
// render the whole document
// -> no selection, all sheets
- SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
+ SCTAB nTabCount = pDocShell->GetDocument().GetTableCount();
for (SCTAB nTab = 0; nTab < nTabCount; nTab++)
rMark.SelectTable( nTab, true );
rStatus.SetMode( SC_PRINTSEL_DOCUMENT );
@@ -899,7 +899,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection,
{
uno::Sequence<sal_Int32> aSelected = xSelectedSheets->getSelectedSheets();
ScMarkData::MarkedTabsType aSelectedTabs;
- SCTAB nMaxTab = pDocShell->GetDocument()->GetTableCount() -1;
+ SCTAB nMaxTab = pDocShell->GetDocument().GetTableCount() -1;
for (sal_Int32 i = 0, n = aSelected.getLength(); i < n; ++i)
{
SCTAB nSelected = static_cast<SCTAB>(aSelected[i]);
@@ -1119,12 +1119,12 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
throw lang::IllegalArgumentException();
SCTAB nTab = pPrintFuncCache->GetTabForPage( nRenderer );
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
FmFormView* pDrawView = NULL;
// #114135#
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if( pModel )
{
@@ -1169,7 +1169,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
Rectangle aArea( pDev->PixelToLogic( Rectangle( 0,0,0,0 ) ) );
sal_Int32 nDestID = pPDFData->CreateDest( aArea );
OUString aTabName;
- pDoc->GetName( nTab, aTabName );
+ rDoc.GetName( nTab, aTabName );
sal_Int32 nParent = -1; // top-level
pPDFData->CreateOutlineItem( nParent, aTabName, nDestID );
}
@@ -1178,7 +1178,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
{
Rectangle aArea( pDev->PixelToLogic( Rectangle( 0,0,0,0 ) ) );
OUString aTabName;
- pDoc->GetName( nTab, aTabName );
+ rDoc.GetName( nTab, aTabName );
//need the PDF page number here
pPDFData->CreateNamedDest( aTabName, aArea );
}
@@ -1207,7 +1207,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
ScRange aTargetRange;
Rectangle aTargetRect; // 1/100th mm
bool bIsSheet = false;
- bool bValid = lcl_ParseTarget( aTarget, aTargetRange, aTargetRect, bIsSheet, pDoc, nTab );
+ bool bValid = lcl_ParseTarget( aTarget, aTargetRange, aTargetRect, bIsSheet, &rDoc, nTab );
if ( bValid )
{
@@ -1231,7 +1231,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
// get the rectangle of the page's cell range in 1/100th mm
ScRange aLocRange = aLocation.aCellRange;
- Rectangle aLocationMM = pDoc->GetMMRect(
+ Rectangle aLocationMM = rDoc.GetMMRect(
aLocRange.aStart.Col(), aLocRange.aStart.Row(),
aLocRange.aEnd.Col(), aLocRange.aEnd.Row(),
aLocRange.aStart.Tab() );
@@ -1385,7 +1385,7 @@ sal_Bool SAL_CALL ScModelObj::isAutomaticCalculationEnabled() throw(uno::Runtime
{
SolarMutexGuard aGuard;
if (pDocShell)
- return pDocShell->GetDocument()->GetAutoCalc();
+ return pDocShell->GetDocument().GetAutoCalc();
OSL_FAIL("keine DocShell"); //! Exception oder so?
return false;
@@ -1398,10 +1398,10 @@ void SAL_CALL ScModelObj::enableAutomaticCalculation( sal_Bool bEnabledIn )
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if ( pDoc->GetAutoCalc() != bEnabled )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if ( rDoc.GetAutoCalc() != bEnabled )
{
- pDoc->SetAutoCalc( bEnabled );
+ rDoc.SetAutoCalc( bEnabled );
pDocShell->SetDocumentModified();
}
}
@@ -1417,7 +1417,7 @@ void SAL_CALL ScModelObj::protect( const OUString& aPassword ) throw(uno::Runtim
{
SolarMutexGuard aGuard;
// #i108245# if already protected, don't change anything
- if ( pDocShell && !pDocShell->GetDocument()->IsDocProtected() )
+ if ( pDocShell && !pDocShell->GetDocument().IsDocProtected() )
{
OUString aString(aPassword);
pDocShell->GetDocFunc().Protect( TABLEID_DOC, aString, true );
@@ -1441,7 +1441,7 @@ sal_Bool SAL_CALL ScModelObj::isProtected() throw(uno::RuntimeException, std::ex
{
SolarMutexGuard aGuard;
if (pDocShell)
- return pDocShell->GetDocument()->IsDocProtected();
+ return pDocShell->GetDocument().IsDocProtected();
OSL_FAIL("keine DocShell"); //! Exception oder so?
return false;
@@ -1475,9 +1475,9 @@ sheet::GoalResult SAL_CALL ScModelObj::seekGoal(
{
WaitObject aWait( pDocShell->GetActiveDialogParent() );
OUString aGoalString(aGoalValue);
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
double fValue = 0.0;
- bool bFound = pDoc->Solver(
+ bool bFound = rDoc.Solver(
(SCCOL)aFormulaPosition.Column, (SCROW)aFormulaPosition.Row, aFormulaPosition.Sheet,
(SCCOL)aVariablePosition.Column, (SCROW)aVariablePosition.Row, aVariablePosition.Sheet,
aGoalString, fValue );
@@ -1497,8 +1497,8 @@ uno::Reference<sheet::XConsolidationDescriptor> SAL_CALL ScModelObj::createConso
ScConsolidationDescriptor* pNew = new ScConsolidationDescriptor;
if ( pDocShell && !bEmpty )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- const ScConsolidateParam* pParam = pDoc->GetConsolidateDlgData();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ const ScConsolidateParam* pParam = rDoc.GetConsolidateDlgData();
if (pParam)
pNew->SetParam( *pParam );
}
@@ -1527,7 +1527,7 @@ void SAL_CALL ScModelObj::consolidate(
{
const ScConsolidateParam& rParam = aImpl.GetParam();
pDocShell->DoConsolidate( rParam, true );
- pDocShell->GetDocument()->SetConsolidateDlgData( &rParam );
+ pDocShell->GetDocument().SetConsolidateDlgData( &rParam );
}
}
@@ -1557,7 +1557,7 @@ uno::Reference< container::XIndexAccess > SAL_CALL ScModelObj::getViewData( )
uno::Sequence< beans::PropertyValue > aSeq;
aSeq.realloc(1);
OUString sName;
- pDocShell->GetDocument()->GetName( pDocShell->GetDocument()->GetVisibleTab(), sName );
+ pDocShell->GetDocument().GetName( pDocShell->GetDocument().GetVisibleTab(), sName );
OUString sOUName(sName);
aSeq[0].Name = SC_ACTIVETABLE;
aSeq[0].Value <<= sOUName;
@@ -1591,12 +1591,12 @@ void SAL_CALL ScModelObj::setPropertyValue(
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- const ScDocOptions& rOldOpt = pDoc->GetDocOptions();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ const ScDocOptions& rOldOpt = rDoc.GetDocOptions();
ScDocOptions aNewOpt = rOldOpt;
// Don't recalculate while loading XML, when the formula text is stored
// Recalculation after loading is handled separately.
- bool bHardRecalc = !pDoc->IsImportingXML();
+ bool bHardRecalc = !rDoc.IsImportingXML();
bool bOpt = ScDocOptionsHelper::setPropertyValue( aNewOpt, aPropSet.getPropertyMap(), aPropertyName, aValue );
if (bOpt)
@@ -1613,16 +1613,16 @@ void SAL_CALL ScModelObj::setPropertyValue(
if ( aValue >>= aLocale )
{
LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
eLatin = ScUnoConversion::GetLanguage(aLocale);
- pDoc->SetLanguage( eLatin, eCjk, eCtl );
+ rDoc.SetLanguage( eLatin, eCjk, eCtl );
}
}
else if ( aString.equalsAscii( SC_UNO_CODENAME ) )
{
OUString sCodeName;
if ( aValue >>= sCodeName )
- pDoc->SetCodeName( sCodeName );
+ rDoc.SetCodeName( sCodeName );
}
else if ( aString.equalsAscii( SC_UNO_CJK_CLOCAL ) )
{
@@ -1630,9 +1630,9 @@ void SAL_CALL ScModelObj::setPropertyValue(
if ( aValue >>= aLocale )
{
LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
eCjk = ScUnoConversion::GetLanguage(aLocale);
- pDoc->SetLanguage( eLatin, eCjk, eCtl );
+ rDoc.SetLanguage( eLatin, eCjk, eCtl );
}
}
else if ( aString.equalsAscii( SC_UNO_CTL_CLOCAL ) )
@@ -1641,9 +1641,9 @@ void SAL_CALL ScModelObj::setPropertyValue(
if ( aValue >>= aLocale )
{
LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
eCtl = ScUnoConversion::GetLanguage(aLocale);
- pDoc->SetLanguage( eLatin, eCjk, eCtl );
+ rDoc.SetLanguage( eLatin, eCjk, eCtl );
}
}
else if ( aString.equalsAscii( SC_UNO_APPLYFMDES ) )
@@ -1673,25 +1673,25 @@ void SAL_CALL ScModelObj::setPropertyValue(
else if ( aString.equalsAscii( SC_UNO_ISUNDOENABLED ) )
{
bool bUndoEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- pDoc->EnableUndo( bUndoEnabled );
+ rDoc.EnableUndo( bUndoEnabled );
pDocShell->GetUndoManager()->SetMaxUndoActionCount(
bUndoEnabled
? officecfg::Office::Common::Undo::Steps::get() : 0);
}
else if ( aString.equalsAscii( SC_UNO_ISADJUSTHEIGHTENABLED ) )
{
- bool bOldAdjustHeightEnabled = pDoc->IsAdjustHeightEnabled();
+ bool bOldAdjustHeightEnabled = rDoc.IsAdjustHeightEnabled();
bool bAdjustHeightEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
if( bOldAdjustHeightEnabled != bAdjustHeightEnabled )
- pDoc->EnableAdjustHeight( bAdjustHeightEnabled );
+ rDoc.EnableAdjustHeight( bAdjustHeightEnabled );
}
else if ( aString.equalsAscii( SC_UNO_ISEXECUTELINKENABLED ) )
{
- pDoc->EnableExecuteLink( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ rDoc.EnableExecuteLink( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
}
else if ( aString.equalsAscii( SC_UNO_ISCHANGEREADONLYENABLED ) )
{
- pDoc->EnableChangeReadOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ rDoc.EnableChangeReadOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
}
else if ( aString.equalsAscii( "BuildId" ) )
{
@@ -1702,7 +1702,7 @@ void SAL_CALL ScModelObj::setPropertyValue(
OUString aObjName;
aValue >>= aObjName;
if ( !aObjName.isEmpty() )
- pDoc->RestoreChartListener( aObjName );
+ rDoc.RestoreChartListener( aObjName );
}
else if ( aString.equalsAscii( SC_UNO_INTEROPGRABBAG ) )
{
@@ -1711,7 +1711,7 @@ void SAL_CALL ScModelObj::setPropertyValue(
if ( aNewOpt != rOldOpt )
{
- pDoc->SetDocOptions( aNewOpt );
+ rDoc.SetDocOptions( aNewOpt );
//! Recalc only for options that need it?
if ( bHardRecalc )
pDocShell->DoHardRecalc( true );
@@ -1730,8 +1730,8 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- const ScDocOptions& rOpt = pDoc->GetDocOptions();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ const ScDocOptions& rOpt = rDoc.GetDocOptions();
aRet = ScDocOptionsHelper::getPropertyValue( rOpt, aPropSet.getPropertyMap(), aPropertyName );
if ( aRet.hasValue() )
{
@@ -1740,7 +1740,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
else if ( aString.equalsAscii( SC_UNONAME_CLOCAL ) )
{
LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
lang::Locale aLocale;
ScUnoConversion::FillLocale( aLocale, eLatin );
@@ -1748,14 +1748,14 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
}
else if ( aString.equalsAscii( SC_UNO_CODENAME ) )
{
- OUString sCodeName = pDoc->GetCodeName();
+ OUString sCodeName = rDoc.GetCodeName();
aRet <<= sCodeName;
}
else if ( aString.equalsAscii( SC_UNO_CJK_CLOCAL ) )
{
LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
lang::Locale aLocale;
ScUnoConversion::FillLocale( aLocale, eCjk );
@@ -1764,7 +1764,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
else if ( aString.equalsAscii( SC_UNO_CTL_CLOCAL ) )
{
LanguageType eLatin, eCjk, eCtl;
- pDoc->GetLanguage( eLatin, eCjk, eCtl );
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
lang::Locale aLocale;
ScUnoConversion::FillLocale( aLocale, eCtl );
@@ -1809,14 +1809,14 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
else if ( aString.equalsAscii( SC_UNO_APPLYFMDES ) )
{
// default for no model is TRUE
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
bool bOpenInDesign = pModel ? pModel->GetOpenInDesignMode() : sal_True;
ScUnoHelpFunctions::SetBoolInAny( aRet, bOpenInDesign );
}
else if ( aString.equalsAscii( SC_UNO_AUTOCONTFOC ) )
{
// default for no model is FALSE
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
bool bAutoControlFocus = pModel && pModel->GetAutoControlFocus();
ScUnoHelpFunctions::SetBoolInAny( aRet, bAutoControlFocus );
}
@@ -1826,7 +1826,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
}
else if ( aString.equalsAscii( SC_UNO_HASDRAWPAGES ) )
{
- ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetDocument()->GetDrawLayer() != 0) );
+ ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetDocument().GetDrawLayer() != 0) );
}
else if ( aString.equalsAscii( SC_UNO_BASICLIBRARIES ) )
{
@@ -1859,24 +1859,24 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
}
else if ( aString.equalsAscii( SC_UNO_ISUNDOENABLED ) )
{
- ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->IsUndoEnabled() );
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsUndoEnabled() );
}
else if ( aString.equalsAscii( SC_UNO_ISADJUSTHEIGHTENABLED ) )
{
- ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->IsAdjustHeightEnabled() );
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsAdjustHeightEnabled() );
}
else if ( aString.equalsAscii( SC_UNO_ISEXECUTELINKENABLED ) )
{
- ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->IsExecuteLinkEnabled() );
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsExecuteLinkEnabled() );
}
else if ( aString.equalsAscii( SC_UNO_ISCHANGEREADONLYENABLED ) )
{
- ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->IsChangeReadOnlyEnabled() );
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsChangeReadOnlyEnabled() );
}
else if ( aString.equalsAscii( SC_UNO_REFERENCEDEVICE ) )
{
VCLXDevice* pXDev = new VCLXDevice();
- pXDev->SetOutputDevice( pDoc->GetRefDevice() );
+ pXDev->SetOutputDevice( rDoc.GetRefDevice() );
aRet <<= uno::Reference< awt::XDevice >( pXDev );
}
else if ( aString.equalsAscii( "BuildId" ) )
@@ -2130,7 +2130,7 @@ bool ScModelObj::HasChangesListeners() const
return true;
// "change" event set in any sheet?
- return pDocShell && pDocShell->GetDocument()->HasAnySheetEventScript(SC_SHEETEVENT_CHANGE);
+ return pDocShell && pDocShell->GetDocument().HasAnySheetEventScript(SC_SHEETEVENT_CHANGE);
}
void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& rRanges,
@@ -2183,13 +2183,13 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r
{
ScMarkData aMarkData;
aMarkData.MarkFromRangeList( rRanges, false );
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nTab = *itr;
- const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab);
+ const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
if (pEvents)
{
const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_CHANGE);
@@ -2237,17 +2237,17 @@ void ScModelObj::HandleCalculateEvents()
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// don't call events before the document is visible
// (might also set a flag on SFX_EVENT_LOADFINISHED and only disable while loading)
- if ( pDoc->IsDocVisible() )
+ if ( rDoc.IsDocVisible() )
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab = 0; nTab < nTabCount; nTab++)
{
- if (pDoc->HasCalcNotification(nTab))
+ if (rDoc.HasCalcNotification(nTab))
{
- if (const ScSheetEvents* pEvents = pDoc->GetSheetEvents( nTab ))
+ if (const ScSheetEvents* pEvents = rDoc.GetSheetEvents( nTab ))
{
if (const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_CALCULATE))
{
@@ -2261,7 +2261,7 @@ void ScModelObj::HandleCalculateEvents()
try
{
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[ 0 ] <<= nTab;
xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_CALCULATE ), aArgs );
@@ -2272,7 +2272,7 @@ void ScModelObj::HandleCalculateEvents()
}
}
}
- pDoc->ResetCalcNotifications();
+ rDoc.ResetCalcNotifications();
}
}
@@ -2380,13 +2380,13 @@ uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
ScDrawPagesObj::ScDrawPagesObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDrawPagesObj::~ScDrawPagesObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDrawPagesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -2406,7 +2406,7 @@ uno::Reference<drawing::XDrawPage> ScDrawPagesObj::GetObjectByIndex_Impl(sal_Int
{
ScDrawLayer* pDrawLayer = pDocShell->MakeDrawLayer();
OSL_ENSURE(pDrawLayer,"kann Draw-Layer nicht anlegen");
- if ( pDrawLayer && nIndex >= 0 && nIndex < pDocShell->GetDocument()->GetTableCount() )
+ if ( pDrawLayer && nIndex >= 0 && nIndex < pDocShell->GetDocument().GetTableCount() )
{
SdrPage* pPage = pDrawLayer->GetPage((sal_uInt16)nIndex);
OSL_ENSURE(pPage,"Draw-Page nicht gefunden");
@@ -2429,7 +2429,7 @@ uno::Reference<drawing::XDrawPage> SAL_CALL ScDrawPagesObj::insertNewByIndex( sa
if (pDocShell)
{
OUString aNewName;
- pDocShell->GetDocument()->CreateValidTabName(aNewName);
+ pDocShell->GetDocument().CreateValidTabName(aNewName);
if ( pDocShell->GetDocFunc().InsertTable( static_cast<SCTAB>(nPos),
aNewName, true, true ) )
xRet.set(GetObjectByIndex_Impl( nPos ));
@@ -2459,7 +2459,7 @@ sal_Int32 SAL_CALL ScDrawPagesObj::getCount() throw(uno::RuntimeException, std::
{
SolarMutexGuard aGuard;
if (pDocShell)
- return pDocShell->GetDocument()->GetTableCount();
+ return pDocShell->GetDocument().GetTableCount();
return 0;
}
@@ -2490,13 +2490,13 @@ sal_Bool SAL_CALL ScDrawPagesObj::hasElements() throw(uno::RuntimeException, std
ScTableSheetsObj::ScTableSheetsObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScTableSheetsObj::~ScTableSheetsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScTableSheetsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -2514,7 +2514,7 @@ void ScTableSheetsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
ScTableSheetObj* ScTableSheetsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
{
- if ( pDocShell && nIndex >= 0 && nIndex < pDocShell->GetDocument()->GetTableCount() )
+ if ( pDocShell && nIndex >= 0 && nIndex < pDocShell->GetDocument().GetTableCount() )
return new ScTableSheetObj( pDocShell, static_cast<SCTAB>(nIndex) );
return NULL;
@@ -2525,7 +2525,7 @@ ScTableSheetObj* ScTableSheetsObj::GetObjectByName_Impl(const OUString& aName) c
if (pDocShell)
{
SCTAB nIndex;
- if ( pDocShell->GetDocument()->GetTable( aName, nIndex ) )
+ if ( pDocShell->GetDocument().GetTable( aName, nIndex ) )
return new ScTableSheetObj( pDocShell, nIndex );
}
return NULL;
@@ -2553,7 +2553,7 @@ void SAL_CALL ScTableSheetsObj::moveByName( const OUString& aName, sal_Int16 nDe
if (pDocShell)
{
SCTAB nSource;
- if ( pDocShell->GetDocument()->GetTable( aName, nSource ) )
+ if ( pDocShell->GetDocument().GetTable( aName, nSource ) )
bDone = pDocShell->MoveTable( nSource, nDestination, false, true );
}
if (!bDone)
@@ -2570,14 +2570,14 @@ void SAL_CALL ScTableSheetsObj::copyByName( const OUString& aName,
{
OUString aNewStr(aCopy);
SCTAB nSource;
- if ( pDocShell->GetDocument()->GetTable( aName, nSource ) )
+ if ( pDocShell->GetDocument().GetTable( aName, nSource ) )
{
bDone = pDocShell->MoveTable( nSource, nDestination, true, true );
if (bDone)
{
// #i92477# any index past the last sheet means "append" in MoveTable
SCTAB nResultTab = static_cast<SCTAB>(nDestination);
- SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); // count after copying
+ SCTAB nTabCount = pDocShell->GetDocument().GetTableCount(); // count after copying
if (nResultTab >= nTabCount)
nResultTab = nTabCount - 1;
@@ -2608,17 +2608,17 @@ void SAL_CALL ScTableSheetsObj::insertByName( const OUString& aName, const uno::
ScTableSheetObj* pSheetObj = ScTableSheetObj::getImplementation( xInterface );
if ( pSheetObj && !pSheetObj->GetDocShell() ) // noch nicht eingefuegt?
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OUString aNamStr(aName);
SCTAB nDummy;
- if ( pDoc->GetTable( aNamStr, nDummy ) )
+ if ( rDoc.GetTable( aNamStr, nDummy ) )
{
// name already exists
throw container::ElementExistException();
}
else
{
- SCTAB nPosition = pDoc->GetTableCount();
+ SCTAB nPosition = rDoc.GetTableCount();
bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aNamStr,
true, true );
if (bDone)
@@ -2661,7 +2661,7 @@ void SAL_CALL ScTableSheetsObj::replaceByName( const OUString& aName, const uno:
if ( pSheetObj && !pSheetObj->GetDocShell() ) // noch nicht eingefuegt?
{
SCTAB nPosition;
- if ( pDocShell->GetDocument()->GetTable( aName, nPosition ) )
+ if ( pDocShell->GetDocument().GetTable( aName, nPosition ) )
{
if ( pDocShell->GetDocFunc().DeleteTable( nPosition, true, true ) )
{
@@ -2703,7 +2703,7 @@ void SAL_CALL ScTableSheetsObj::removeByName( const OUString& aName )
if (pDocShell)
{
SCTAB nIndex;
- if ( pDocShell->GetDocument()->GetTable( aName, nIndex ) )
+ if ( pDocShell->GetDocument().GetTable( aName, nIndex ) )
bDone = pDocShell->GetDocFunc().DeleteTable( nIndex, true, true );
else // not found
throw container::NoSuchElementException();
@@ -2719,7 +2719,7 @@ sal_Int32 ScTableSheetsObj::importSheet(
throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
{
//pDocShell is the destination
- ScDocument* pDocDest = pDocShell->GetDocument();
+ ScDocument& rDocDest = pDocShell->GetDocument();
// Source document docShell
if ( !xDocSrc.is() )
@@ -2729,11 +2729,11 @@ sal_Int32 ScTableSheetsObj::importSheet(
// SourceSheet Position and does srcName exists ?
SCTAB nIndexSrc;
- if ( !pDocShellSrc->GetDocument()->GetTable( srcName, nIndexSrc ) )
+ if ( !pDocShellSrc->GetDocument().GetTable( srcName, nIndexSrc ) )
throw lang::IllegalArgumentException();
// Check the validity of destination index.
- SCTAB nCount = pDocDest->GetTableCount();
+ SCTAB nCount = rDocDest.GetTableCount();
SCTAB nIndexDest = static_cast<SCTAB>(nDestPosition);
if (nIndexDest > nCount || nIndexDest < 0)
throw lang::IndexOutOfBoundsException();
@@ -2778,8 +2778,8 @@ uno::Sequence < uno::Reference< table::XCellRange > > SAL_CALL ScTableSheetsObj:
uno::Sequence < uno::Reference < table::XCellRange > > xRet;
ScRangeList aRangeList;
- ScDocument* pDoc = pDocShell->GetDocument();
- if (ScRangeStringConverter::GetRangeListFromString( aRangeList, aRange, pDoc, ::formula::FormulaGrammar::CONV_OOO, ';' ))
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if (ScRangeStringConverter::GetRangeListFromString( aRangeList, aRange, &rDoc, ::formula::FormulaGrammar::CONV_OOO, ';' ))
{
size_t nCount = aRangeList.size();
if (nCount)
@@ -2815,7 +2815,7 @@ sal_Int32 SAL_CALL ScTableSheetsObj::getCount() throw(uno::RuntimeException, std
{
SolarMutexGuard aGuard;
if (pDocShell)
- return pDocShell->GetDocument()->GetTableCount();
+ return pDocShell->GetDocument().GetTableCount();
return 0;
}
@@ -2864,14 +2864,14 @@ uno::Sequence<OUString> SAL_CALL ScTableSheetsObj::getElementNames()
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
OUString aName;
uno::Sequence<OUString> aSeq(nCount);
OUString* pAry = aSeq.getArray();
for (SCTAB i=0; i<nCount; i++)
{
- pDoc->GetName( i, aName );
+ rDoc.GetName( i, aName );
pAry[i] = aName;
}
return aSeq;
@@ -2886,7 +2886,7 @@ sal_Bool SAL_CALL ScTableSheetsObj::hasByName( const OUString& aName )
if (pDocShell)
{
SCTAB nIndex;
- if ( pDocShell->GetDocument()->GetTable( aName, nIndex ) )
+ if ( pDocShell->GetDocument().GetTable( aName, nIndex ) )
return sal_True;
}
return false;
@@ -2898,13 +2898,13 @@ ScTableColumnsObj::ScTableColumnsObj(ScDocShell* pDocSh, SCTAB nT, SCCOL nSC, SC
nStartCol( nSC ),
nEndCol ( nEC )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScTableColumnsObj::~ScTableColumnsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScTableColumnsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -3120,7 +3120,7 @@ uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aProperty
if (!pDocShell)
throw uno::RuntimeException();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OUString aNameString(aPropertyName);
uno::Any aAny;
@@ -3129,27 +3129,27 @@ uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aProperty
if ( aNameString.equalsAscii( SC_UNONAME_CELLWID ) )
{
// for hidden column, return original height
- sal_uInt16 nWidth = pDoc->GetOriginalWidth( nStartCol, nTab );
+ sal_uInt16 nWidth = rDoc.GetOriginalWidth( nStartCol, nTab );
aAny <<= (sal_Int32)TwipsToHMM(nWidth);
}
else if ( aNameString.equalsAscii( SC_UNONAME_CELLVIS ) )
{
- bool bVis = !pDoc->ColHidden(nStartCol, nTab);
+ bool bVis = !rDoc.ColHidden(nStartCol, nTab);
ScUnoHelpFunctions::SetBoolInAny( aAny, bVis );
}
else if ( aNameString.equalsAscii( SC_UNONAME_OWIDTH ) )
{
- bool bOpt = !(pDoc->GetColFlags( nStartCol, nTab ) & CR_MANUALSIZE);
+ bool bOpt = !(rDoc.GetColFlags( nStartCol, nTab ) & CR_MANUALSIZE);
ScUnoHelpFunctions::SetBoolInAny( aAny, bOpt );
}
else if ( aNameString.equalsAscii( SC_UNONAME_NEWPAGE ) )
{
- ScBreakType nBreak = pDoc->HasColBreak(nStartCol, nTab);
+ ScBreakType nBreak = rDoc.HasColBreak(nStartCol, nTab);
ScUnoHelpFunctions::SetBoolInAny( aAny, nBreak );
}
else if ( aNameString.equalsAscii( SC_UNONAME_MANPAGE ) )
{
- ScBreakType nBreak = pDoc->HasColBreak(nStartCol, nTab);
+ ScBreakType nBreak = rDoc.HasColBreak(nStartCol, nTab);
ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) != 0 );
}
@@ -3164,13 +3164,13 @@ ScTableRowsObj::ScTableRowsObj(ScDocShell* pDocSh, SCTAB nT, SCROW nSR, SCROW nE
nStartRow( nSR ),
nEndRow ( nER )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScTableRowsObj::~ScTableRowsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScTableRowsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -3292,20 +3292,20 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
throw uno::RuntimeException();
ScDocFunc& rFunc = pDocShell->GetDocFunc();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
std::vector<sc::ColRowSpan> aRowArr(1, sc::ColRowSpan(nStartRow,nEndRow));
OUString aNameString(aPropertyName);
if ( aNameString.equalsAscii( SC_UNONAME_OHEIGHT ) )
{
sal_Int32 nNewHeight = 0;
- if ( pDoc->IsImportingXML() && ( aValue >>= nNewHeight ) )
+ if ( rDoc.IsImportingXML() && ( aValue >>= nNewHeight ) )
{
// used to set the stored row height for rows with optimal height when loading.
// TODO: It's probably cleaner to use a different property name
// for this.
- pDoc->SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) );
+ rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) );
}
else
{
@@ -3323,13 +3323,13 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
sal_Int32 nNewHeight = 0;
if ( aValue >>= nNewHeight )
{
- if (pDoc->IsImportingXML())
+ if (rDoc.IsImportingXML())
{
// TODO: This is a band-aid fix. Eventually we need to
// re-work ods' style import to get it to set styles to
// ScDocument directly.
- pDoc->SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) );
- pDoc->SetManualHeight( nStartRow, nEndRow, nTab, true );
+ rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) );
+ rDoc.SetManualHeight( nStartRow, nEndRow, nTab, true );
}
else
rFunc.SetWidthOrHeight(
@@ -3347,15 +3347,15 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
{
// #i116460# Shortcut to only set the flag, without drawing layer update etc.
// Should only be used from import filters.
- pDoc->SetRowHidden(nStartRow, nEndRow, nTab, !ScUnoHelpFunctions::GetBoolFromAny( aValue ));
+ rDoc.SetRowHidden(nStartRow, nEndRow, nTab, !ScUnoHelpFunctions::GetBoolFromAny( aValue ));
}
else if ( aNameString.equalsAscii( SC_UNONAME_CELLFILT ) )
{
//! undo etc.
if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
- pDoc->SetRowFiltered(nStartRow, nEndRow, nTab, true);
+ rDoc.SetRowFiltered(nStartRow, nEndRow, nTab, true);
else
- pDoc->SetRowFiltered(nStartRow, nEndRow, nTab, false);
+ rDoc.SetRowFiltered(nStartRow, nEndRow, nTab, false);
}
else if ( aNameString.equalsAscii( SC_UNONAME_NEWPAGE) || aNameString.equalsAscii( SC_UNONAME_MANPAGE) )
{
@@ -3389,7 +3389,7 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam
if (!pDocShell)
throw uno::RuntimeException();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OUString aNameString(aPropertyName);
uno::Any aAny;
@@ -3398,33 +3398,33 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam
if ( aNameString.equalsAscii( SC_UNONAME_CELLHGT ) )
{
// for hidden row, return original height
- sal_uInt16 nHeight = pDoc->GetOriginalHeight( nStartRow, nTab );
+ sal_uInt16 nHeight = rDoc.GetOriginalHeight( nStartRow, nTab );
aAny <<= (sal_Int32)TwipsToHMM(nHeight);
}
else if ( aNameString.equalsAscii( SC_UNONAME_CELLVIS ) )
{
SCROW nLastRow;
- bool bVis = !pDoc->RowHidden(nStartRow, nTab, NULL, &nLastRow);
+ bool bVis = !rDoc.RowHidden(nStartRow, nTab, NULL, &nLastRow);
ScUnoHelpFunctions::SetBoolInAny( aAny, bVis );
}
else if ( aNameString.equalsAscii( SC_UNONAME_CELLFILT ) )
{
- bool bVis = pDoc->RowFiltered(nStartRow, nTab);
+ bool bVis = rDoc.RowFiltered(nStartRow, nTab);
ScUnoHelpFunctions::SetBoolInAny( aAny, bVis );
}
else if ( aNameString.equalsAscii( SC_UNONAME_OHEIGHT ) )
{
- bool bOpt = !(pDoc->GetRowFlags( nStartRow, nTab ) & CR_MANUALSIZE);
+ bool bOpt = !(rDoc.GetRowFlags( nStartRow, nTab ) & CR_MANUALSIZE);
ScUnoHelpFunctions::SetBoolInAny( aAny, bOpt );
}
else if ( aNameString.equalsAscii( SC_UNONAME_NEWPAGE ) )
{
- ScBreakType nBreak = pDoc->HasRowBreak(nStartRow, nTab);
+ ScBreakType nBreak = rDoc.HasRowBreak(nStartRow, nTab);
ScUnoHelpFunctions::SetBoolInAny( aAny, nBreak );
}
else if ( aNameString.equalsAscii( SC_UNONAME_MANPAGE ) )
{
- ScBreakType nBreak = pDoc->HasRowBreak(nStartRow, nTab);
+ ScBreakType nBreak = rDoc.HasRowBreak(nStartRow, nTab);
ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) != 0 );
}
else if ( aNameString.equalsAscii( SC_UNONAME_CELLBACK ) || aNameString.equalsAscii( SC_UNONAME_CELLTRAN ) )
@@ -3445,7 +3445,7 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScTableRowsObj )
ScSpreadsheetSettingsObj::~ScSpreadsheetSettingsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScSpreadsheetSettingsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -3491,13 +3491,13 @@ ScAnnotationsObj::ScAnnotationsObj(ScDocShell* pDocSh, SCTAB nT) :
pDocShell( pDocSh ),
nTab( nT )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScAnnotationsObj::~ScAnnotationsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScAnnotationsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -3516,8 +3516,8 @@ bool ScAnnotationsObj::GetAddressByIndex_Impl( sal_Int32 nIndex, ScAddress& rPos
if (!pDocShell)
return false;
- ScDocument* pDoc = pDocShell->GetDocument();
- rPos = pDoc->GetNotePosition(nIndex);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rPos = rDoc.GetNotePosition(nIndex);
return rPos.IsValid();
}
@@ -3584,10 +3584,10 @@ sal_Int32 SAL_CALL ScAnnotationsObj::getCount()
sal_Int32 nCount = 0;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
const ScRangeList aRangeList( ScRange( 0, 0, nTab, MAXCOL, MAXROW, nTab) );
std::vector<sc::NoteEntry> rNotes;
- pDoc->GetNotesInRange(aRangeList, rNotes);
+ rDoc.GetNotesInRange(aRangeList, rNotes);
nCount = rNotes.size();
}
return nCount;
@@ -3621,13 +3621,13 @@ ScScenariosObj::ScScenariosObj(ScDocShell* pDocSh, SCTAB nT) :
pDocShell( pDocSh ),
nTab ( nT )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScScenariosObj::~ScScenariosObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScScenariosObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -3652,10 +3652,10 @@ bool ScScenariosObj::GetScenarioIndex_Impl( const OUString& rName, SCTAB& rIndex
if ( pDocShell )
{
OUString aTabName;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB nCount = (SCTAB)getCount();
for (SCTAB i=0; i<nCount; i++)
- if (pDoc->GetName( nTab+i+1, aTabName ))
+ if (rDoc.GetName( nTab+i+1, aTabName ))
if (aTabName.equals(rName))
{
rIndex = i;
@@ -3745,12 +3745,12 @@ sal_Int32 SAL_CALL ScScenariosObj::getCount() throw(uno::RuntimeException, std::
SCTAB nCount = 0;
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (!pDoc->IsScenario(nTab))
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if (!rDoc.IsScenario(nTab))
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nNext = nTab + 1;
- while (nNext < nTabCount && pDoc->IsScenario(nNext))
+ while (nNext < nTabCount && rDoc.IsScenario(nNext))
{
++nCount;
++nNext;
@@ -3806,10 +3806,10 @@ uno::Sequence<OUString> SAL_CALL ScScenariosObj::getElementNames()
if ( pDocShell ) // sonst ist auch Count = 0
{
OUString aTabName;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OUString* pAry = aSeq.getArray();
for (SCTAB i=0; i<nCount; i++)
- if (pDoc->GetName( nTab+i+1, aTabName ))
+ if (rDoc.GetName( nTab+i+1, aTabName ))
pAry[i] = aTabName;
}
diff --git a/sc/source/ui/unoobj/drdefuno.cxx b/sc/source/ui/unoobj/drdefuno.cxx
index 8aa8fda0ed5f..b382b17da612 100644
--- a/sc/source/ui/unoobj/drdefuno.cxx
+++ b/sc/source/ui/unoobj/drdefuno.cxx
@@ -30,13 +30,13 @@ ScDrawDefaultsObj::ScDrawDefaultsObj(ScDocShell* pDocSh) :
// SvxUnoDrawPool is initialized without model,
// draw layer is created on demand in getModelPool
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDrawDefaultsObj::~ScDrawDefaultsObj() throw ()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDrawDefaultsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -57,7 +57,7 @@ SfxItemPool* ScDrawDefaultsObj::getModelPool( bool bReadOnly ) throw()
if ( pDocShell )
{
ScDrawLayer* pModel = bReadOnly ?
- pDocShell->GetDocument()->GetDrawLayer() :
+ pDocShell->GetDocument().GetDrawLayer() :
pDocShell->MakeDrawLayer();
if ( pModel )
pRet = &pModel->GetItemPool();
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index ff1fa5e33c2b..85ab77eb3e02 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -112,7 +112,7 @@ ScAnnotationEditSource::ScAnnotationEditSource(ScDocShell* pDocSh, const ScAddre
bDataValid( false )
{
if (pDocShell)
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScAnnotationEditSource::~ScAnnotationEditSource()
@@ -120,7 +120,7 @@ ScAnnotationEditSource::~ScAnnotationEditSource()
SolarMutexGuard aGuard; // needed for EditEngine dtor
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
delete pForwarder;
delete pEditEngine;
@@ -133,7 +133,7 @@ SvxEditSource* ScAnnotationEditSource::Clone() const
SdrObject* ScAnnotationEditSource::GetCaptionObj()
{
- ScPostIt* pNote = pDocShell->GetDocument()->GetNote(aCellPos);
+ ScPostIt* pNote = pDocShell->GetDocument().GetNote(aCellPos);
return pNote ? pNote->GetOrCreateCaption( aCellPos ) : 0;
}
@@ -144,7 +144,7 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder()
// Notizen haben keine Felder
if ( pDocShell )
{
- pEditEngine = new ScNoteEditEngine( pDocShell->GetDocument()->GetNoteEngine() );
+ pEditEngine = new ScNoteEditEngine( pDocShell->GetDocument().GetNoteEngine() );
}
else
{
@@ -159,7 +159,7 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder()
return pForwarder;
if ( pDocShell )
- if ( ScPostIt* pNote = pDocShell->GetDocument()->GetNote(aCellPos) )
+ if ( ScPostIt* pNote = pDocShell->GetDocument().GetNote(aCellPos) )
if ( const EditTextObject* pEditObj = pNote->GetEditTextObject() )
pEditEngine->SetText( *pEditObj ); // incl. Umbrueche
diff --git a/sc/source/ui/unoobj/eventuno.cxx b/sc/source/ui/unoobj/eventuno.cxx
index e72d8062324b..14a7af9eaf8e 100644
--- a/sc/source/ui/unoobj/eventuno.cxx
+++ b/sc/source/ui/unoobj/eventuno.cxx
@@ -33,13 +33,13 @@ ScSheetEventsObj::ScSheetEventsObj(ScDocShell* pDocSh, SCTAB nT) :
mpDocShell( pDocSh ),
mnTab( nT )
{
- mpDocShell->GetDocument()->AddUnoObject(*this);
+ mpDocShell->GetDocument().AddUnoObject(*this);
}
ScSheetEventsObj::~ScSheetEventsObj()
{
if (mpDocShell)
- mpDocShell->GetDocument()->RemoveUnoObject(*this);
+ mpDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScSheetEventsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -76,7 +76,7 @@ void SAL_CALL ScSheetEventsObj::replaceByName( const OUString& aName, const uno:
throw container::NoSuchElementException();
ScSheetEvents aNewEvents;
- const ScSheetEvents* pOldEvents = mpDocShell->GetDocument()->GetSheetEvents(mnTab);
+ const ScSheetEvents* pOldEvents = mpDocShell->GetDocument().GetSheetEvents(mnTab);
if (pOldEvents)
aNewEvents = *pOldEvents;
@@ -110,7 +110,7 @@ void SAL_CALL ScSheetEventsObj::replaceByName( const OUString& aName, const uno:
else
aNewEvents.SetScript( nEvent, NULL ); // reset
- mpDocShell->GetDocument()->SetSheetEvents( mnTab, &aNewEvents );
+ mpDocShell->GetDocument().SetSheetEvents( mnTab, &aNewEvents );
mpDocShell->SetDocumentModified();
}
@@ -127,7 +127,7 @@ uno::Any SAL_CALL ScSheetEventsObj::getByName( const OUString& aName )
const OUString* pScript = NULL;
if (mpDocShell)
{
- const ScSheetEvents* pEvents = mpDocShell->GetDocument()->GetSheetEvents(mnTab);
+ const ScSheetEvents* pEvents = mpDocShell->GetDocument().GetSheetEvents(mnTab);
if (pEvents)
pScript = pEvents->GetScript(nEvent);
}
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 8021562df8a0..a43e5448e7e1 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -284,7 +284,7 @@ ScCellFieldsObj::ScCellFieldsObj(
aCellPos( rPos ),
mpRefreshListeners( NULL )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
mpEditSource = new ScCellEditSource( pDocShell, aCellPos );
}
@@ -292,7 +292,7 @@ ScCellFieldsObj::ScCellFieldsObj(
ScCellFieldsObj::~ScCellFieldsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
delete mpEditSource;
diff --git a/sc/source/ui/unoobj/forbiuno.cxx b/sc/source/ui/unoobj/forbiuno.cxx
index e6843c0f94e0..bfaa5a2196b9 100644
--- a/sc/source/ui/unoobj/forbiuno.cxx
+++ b/sc/source/ui/unoobj/forbiuno.cxx
@@ -29,15 +29,15 @@ static rtl::Reference<SvxForbiddenCharactersTable> lcl_GetForbidden( ScDocShell*
rtl::Reference<SvxForbiddenCharactersTable> xRet;
if ( pDocSh )
{
- ScDocument* pDoc = pDocSh->GetDocument();
- xRet = pDoc->GetForbiddenCharacters();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ xRet = rDoc.GetForbiddenCharacters();
if ( !xRet.is() )
{
// create an empty SvxForbiddenCharactersTable for SvxUnoForbiddenCharsTable,
// so changes can be stored.
xRet = new SvxForbiddenCharactersTable( comphelper::getProcessComponentContext() );
- pDoc->SetForbiddenCharacters( xRet );
+ rDoc.SetForbiddenCharacters( xRet );
}
}
return xRet;
@@ -48,13 +48,13 @@ ScForbiddenCharsObj::ScForbiddenCharsObj( ScDocShell* pDocSh ) :
pDocShell( pDocSh )
{
if (pDocShell)
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScForbiddenCharsObj::~ScForbiddenCharsObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScForbiddenCharsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -70,7 +70,7 @@ void ScForbiddenCharsObj::onChange()
{
if (pDocShell)
{
- pDocShell->GetDocument()->SetForbiddenCharacters( mxForbiddenChars );
+ pDocShell->GetDocument().SetForbiddenCharacters( mxForbiddenChars );
pDocShell->PostPaintGridAll();
pDocShell->SetDocumentModified();
}
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index 24769484d77d..18a4a2c4f1b1 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -77,13 +77,13 @@ ScSheetLinkObj::ScSheetLinkObj(ScDocShell* pDocSh, const OUString& rName) :
pDocShell( pDocSh ),
aFileName( rName )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScSheetLinkObj::~ScSheetLinkObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScSheetLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -108,7 +108,7 @@ ScTableLink* ScSheetLinkObj::GetLink_Impl() const
{
if (pDocShell)
{
- sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
size_t nCount = pLinkManager->GetLinks().size();
for (size_t i=0; i<nCount; i++)
{
@@ -289,14 +289,14 @@ void ScSheetLinkObj::setFileName(const OUString& rNewName)
// zuerst Tabellen umsetzen
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- if ( pDoc->IsLinked(nTab) && pDoc->GetLinkDoc(nTab) == aFileName ) // alte Datei
- pDoc->SetLink( nTab, pDoc->GetLinkMode(nTab), aNewStr,
- pDoc->GetLinkFlt(nTab), pDoc->GetLinkOpt(nTab),
- pDoc->GetLinkTab(nTab),
- pDoc->GetLinkRefreshDelay(nTab) ); // nur Datei aendern
+ if ( rDoc.IsLinked(nTab) && rDoc.GetLinkDoc(nTab) == aFileName ) // alte Datei
+ rDoc.SetLink( nTab, rDoc.GetLinkMode(nTab), aNewStr,
+ rDoc.GetLinkFlt(nTab), rDoc.GetLinkOpt(nTab),
+ rDoc.GetLinkTab(nTab),
+ rDoc.GetLinkRefreshDelay(nTab) ); // nur Datei aendern
// Links updaten
//! Undo !!!
@@ -374,13 +374,13 @@ void ScSheetLinkObj::setRefreshDelay(sal_Int32 nRefreshDelay)
ScSheetLinksObj::ScSheetLinksObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScSheetLinksObj::~ScSheetLinksObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScSheetLinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -403,15 +403,15 @@ ScSheetLinkObj* ScSheetLinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
typedef boost::unordered_set<OUString, OUStringHash> StrSetType;
StrSetType aNames;
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
sal_Int32 nCount = 0;
for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
{
- if (!pDoc->IsLinked(nTab))
+ if (!rDoc.IsLinked(nTab))
continue;
- OUString aLinkDoc = pDoc->GetLinkDoc(nTab);
+ OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
if (aNames.insert(aLinkDoc).second)
{
// unique document name.
@@ -432,13 +432,13 @@ ScSheetLinkObj* ScSheetLinksObj::GetObjectByName_Impl(const OUString& aName)
{
OUString aNameStr(aName);
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- if (pDoc->IsLinked(nTab))
+ if (rDoc.IsLinked(nTab))
{
- //! case-insensitiv ???
- OUString aLinkDoc = pDoc->GetLinkDoc( nTab );
+ //! case-insensitive ???
+ OUString aLinkDoc = rDoc.GetLinkDoc( nTab );
if ( aLinkDoc == aNameStr )
return new ScSheetLinkObj( pDocShell, aNameStr );
}
@@ -469,14 +469,14 @@ sal_Int32 SAL_CALL ScSheetLinksObj::getCount() throw(uno::RuntimeException, std:
sal_Int32 nCount = 0;
StrSetType aNames;
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
{
- if (!pDoc->IsLinked(nTab))
+ if (!rDoc.IsLinked(nTab))
continue;
- OUString aLinkDoc = pDoc->GetLinkDoc(nTab);
+ OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
if (aNames.insert(aLinkDoc).second)
++nCount;
}
@@ -530,13 +530,13 @@ sal_Bool SAL_CALL ScSheetLinksObj::hasByName( const OUString& aName )
{
OUString aNameStr(aName);
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- if (pDoc->IsLinked(nTab))
+ if (rDoc.IsLinked(nTab))
{
//! case-insensitiv ???
- OUString aLinkDoc(pDoc->GetLinkDoc( nTab ));
+ OUString aLinkDoc(rDoc.GetLinkDoc( nTab ));
if ( aLinkDoc == aNameStr )
return sal_True;
}
@@ -555,8 +555,8 @@ uno::Sequence<OUString> SAL_CALL ScSheetLinksObj::getElementNames() throw(uno::R
return uno::Sequence<OUString>();
StrSetType aNames;
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
sal_Int32 nLinkCount = getCount();
uno::Sequence<OUString> aSeq(nLinkCount);
@@ -564,10 +564,10 @@ uno::Sequence<OUString> SAL_CALL ScSheetLinksObj::getElementNames() throw(uno::R
size_t nPos = 0;
for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
{
- if (!pDoc->IsLinked(nTab))
+ if (!rDoc.IsLinked(nTab))
continue;
- OUString aLinkDoc = pDoc->GetLinkDoc(nTab);
+ OUString aLinkDoc = rDoc.GetLinkDoc(nTab);
if (aNames.insert(aLinkDoc).second)
pAry[nPos++] = aLinkDoc;
}
@@ -579,7 +579,7 @@ static ScAreaLink* lcl_GetAreaLink( ScDocShell* pDocShell, size_t nPos )
{
if (pDocShell)
{
- sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
size_t nTotalCount = pLinkManager->GetLinks().size();
size_t nAreaCount = 0;
for (size_t i=0; i<nTotalCount; i++)
@@ -601,13 +601,13 @@ ScAreaLinkObj::ScAreaLinkObj(ScDocShell* pDocSh, size_t nP) :
pDocShell( pDocSh ),
nPos( nP )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScAreaLinkObj::~ScAreaLinkObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScAreaLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -652,7 +652,7 @@ void ScAreaLinkObj::Modify_Impl( const OUString* pNewFile, const OUString* pNewF
//! Undo fuer Loeschen
//! Undo zusammenfassen
- sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
pLinkManager->Remove( pLink );
pLink = NULL; // bei Remove geloescht
@@ -916,13 +916,13 @@ void SAL_CALL ScAreaLinkObj::setDestArea( const table::CellRangeAddress& aDestAr
ScAreaLinksObj::ScAreaLinksObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScAreaLinksObj::~ScAreaLinksObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScAreaLinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -977,7 +977,7 @@ void SAL_CALL ScAreaLinksObj::removeByIndex( sal_Int32 nIndex ) throw(uno::Runti
{
//! SetAddUndo oder so
- sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
pLinkManager->Remove( pLink );
}
}
@@ -999,7 +999,7 @@ sal_Int32 SAL_CALL ScAreaLinksObj::getCount() throw(uno::RuntimeException, std::
sal_Int32 nAreaCount = 0;
if (pDocShell)
{
- sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
size_t nTotalCount = pLinkManager->GetLinks().size();
for (size_t i=0; i<nTotalCount; i++)
{
@@ -1042,13 +1042,13 @@ ScDDELinkObj::ScDDELinkObj(ScDocShell* pDocSh, const OUString& rA,
aTopic( rT ),
aItem( rI )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDDELinkObj::~ScDDELinkObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDDELinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -1126,7 +1126,7 @@ void SAL_CALL ScDDELinkObj::refresh() throw(uno::RuntimeException, std::exceptio
SolarMutexGuard aGuard;
if (pDocShell)
{
- sc::DocumentLinkManager& rMgr = pDocShell->GetDocument()->GetDocLinkManager();
+ sc::DocumentLinkManager& rMgr = pDocShell->GetDocument().GetDocLinkManager();
rMgr.updateDdeLink(aAppl, aTopic, aItem);
}
}
@@ -1175,23 +1175,20 @@ uno::Sequence< uno::Sequence< uno::Any > > ScDDELinkObj::getResults( )
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if ( pDoc )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ size_t nPos = 0;
+ if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
{
- size_t nPos = 0;
- if ( pDoc->FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
+ const ScMatrix* pMatrix = rDoc.GetDdeLinkResultMatrix( nPos );
+ if ( pMatrix )
{
- const ScMatrix* pMatrix = pDoc->GetDdeLinkResultMatrix( nPos );
- if ( pMatrix )
+ uno::Any aAny;
+ if ( ScRangeToSequence::FillMixedArray( aAny, pMatrix, true ) )
{
- uno::Any aAny;
- if ( ScRangeToSequence::FillMixedArray( aAny, pMatrix, true ) )
- {
- aAny >>= aReturn;
- }
+ aAny >>= aReturn;
}
- bSuccess = true;
}
+ bSuccess = true;
}
}
@@ -1212,17 +1209,14 @@ void ScDDELinkObj::setResults( const uno::Sequence< uno::Sequence< uno::Any > >&
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if ( pDoc )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ size_t nPos = 0;
+ if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
{
- size_t nPos = 0;
- if ( pDoc->FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) )
- {
- uno::Any aAny;
- aAny <<= aResults;
- ScMatrixRef xMatrix = ScSequenceToMatrix::CreateMixedMatrix( aAny );
- bSuccess = pDoc->SetDdeLinkResultMatrix( nPos, xMatrix );
- }
+ uno::Any aAny;
+ aAny <<= aResults;
+ ScMatrixRef xMatrix = ScSequenceToMatrix::CreateMixedMatrix( aAny );
+ bSuccess = rDoc.SetDdeLinkResultMatrix( nPos, xMatrix );
}
}
@@ -1244,13 +1238,13 @@ void ScDDELinkObj::Refreshed_Impl()
ScDDELinksObj::ScDDELinksObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScDDELinksObj::~ScDDELinksObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScDDELinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -1271,7 +1265,7 @@ ScDDELinkObj* ScDDELinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
if (pDocShell)
{
OUString aAppl, aTopic, aItem;
- if ( pDocShell->GetDocument()->GetDdeLinkData( (size_t)nIndex, aAppl, aTopic, aItem ) )
+ if ( pDocShell->GetDocument().GetDdeLinkData( (size_t)nIndex, aAppl, aTopic, aItem ) )
return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem );
}
return NULL;
@@ -1284,11 +1278,11 @@ ScDDELinkObj* ScDDELinksObj::GetObjectByName_Impl(const OUString& aName)
OUString aNamStr(aName);
OUString aAppl, aTopic, aItem;
- ScDocument* pDoc = pDocShell->GetDocument();
- size_t nCount = pDoc->GetDocLinkManager().getDdeLinkCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ size_t nCount = rDoc.GetDocLinkManager().getDdeLinkCount();
for (size_t i=0; i<nCount; i++)
{
- pDoc->GetDdeLinkData( i, aAppl, aTopic, aItem );
+ rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aNamStr )
return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem );
}
@@ -1312,7 +1306,7 @@ sal_Int32 SAL_CALL ScDDELinksObj::getCount() throw(uno::RuntimeException, std::e
SolarMutexGuard aGuard;
sal_Int32 nAreaCount = 0;
if (pDocShell)
- nAreaCount = pDocShell->GetDocument()->GetDocLinkManager().getDdeLinkCount();
+ nAreaCount = pDocShell->GetDocument().GetDocLinkManager().getDdeLinkCount();
return nAreaCount;
}
@@ -1359,14 +1353,14 @@ uno::Sequence<OUString> SAL_CALL ScDDELinksObj::getElementNames() throw(uno::Run
{
OUString aAppl, aTopic, aItem;
- ScDocument* pDoc = pDocShell->GetDocument();
- size_t nCount = pDocShell->GetDocument()->GetDocLinkManager().getDdeLinkCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ size_t nCount = pDocShell->GetDocument().GetDocLinkManager().getDdeLinkCount();
uno::Sequence<OUString> aSeq(nCount);
OUString* pAry = aSeq.getArray();
for (size_t i=0; i<nCount; i++)
{
- pDoc->GetDdeLinkData( i, aAppl, aTopic, aItem );
+ rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
pAry[i] = lcl_BuildDDEName(aAppl, aTopic, aItem);
}
return aSeq;
@@ -1383,11 +1377,11 @@ sal_Bool SAL_CALL ScDDELinksObj::hasByName( const OUString& aName )
OUString aNamStr(aName);
OUString aAppl, aTopic, aItem;
- ScDocument* pDoc = pDocShell->GetDocument();
- size_t nCount = pDocShell->GetDocument()->GetDocLinkManager().getDdeLinkCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ size_t nCount = pDocShell->GetDocument().GetDocLinkManager().getDdeLinkCount();
for (size_t i=0; i<nCount; i++)
{
- pDoc->GetDdeLinkData( i, aAppl, aTopic, aItem );
+ rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem );
if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aNamStr )
return sal_True;
}
@@ -1407,38 +1401,35 @@ uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink(
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if ( pDoc )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sal_uInt8 nMod = SC_DDE_DEFAULT;
+ switch ( nMode )
{
- sal_uInt8 nMod = SC_DDE_DEFAULT;
- switch ( nMode )
- {
- case sheet::DDELinkMode_DEFAULT:
- {
- nMod = SC_DDE_DEFAULT;
- }
- break;
- case sheet::DDELinkMode_ENGLISH:
- {
- nMod = SC_DDE_ENGLISH;
- }
- break;
- case sheet::DDELinkMode_TEXT:
- {
- nMod = SC_DDE_TEXT;
- }
- break;
- default:
- {
- }
- break;
- }
+ case sheet::DDELinkMode_DEFAULT:
+ {
+ nMod = SC_DDE_DEFAULT;
+ }
+ break;
+ case sheet::DDELinkMode_ENGLISH:
+ {
+ nMod = SC_DDE_ENGLISH;
+ }
+ break;
+ case sheet::DDELinkMode_TEXT:
+ {
+ nMod = SC_DDE_TEXT;
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
- if ( pDoc->CreateDdeLink( aApplication, aTopic, aItem, nMod, ScMatrixRef() ) )
- {
- const OUString aName( lcl_BuildDDEName( aApplication, aTopic, aItem ) );
- xLink.set( GetObjectByName_Impl( aName ) );
- }
+ if ( rDoc.CreateDdeLink( aApplication, aTopic, aItem, nMod, ScMatrixRef() ) )
+ {
+ const OUString aName( lcl_BuildDDEName( aApplication, aTopic, aItem ) );
+ xLink.set( GetObjectByName_Impl( aName ) );
}
}
@@ -1476,7 +1467,7 @@ void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nCol, sal_Int32 nR
pToken.reset(new FormulaDoubleToken(fVal));
else if (rValue >>= aVal)
{
- svl::SharedStringPool& rPool = mpDocShell->GetDocument()->GetSharedStringPool();
+ svl::SharedStringPool& rPool = mpDocShell->GetDocument().GetSharedStringPool();
svl::SharedString aSS = rPool.intern(aVal);
pToken.reset(new FormulaStringToken(aSS));
}
@@ -1692,7 +1683,7 @@ sal_Int32 SAL_CALL ScExternalDocLinkObj::getTokenIndex()
ScExternalDocLinksObj::ScExternalDocLinksObj(ScDocShell* pDocShell) :
mpDocShell(pDocShell),
- mpRefMgr(pDocShell->GetDocument()->GetExternalRefManager())
+ mpRefMgr(pDocShell->GetDocument().GetExternalRefManager())
{
}
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 6d4107401305..edceecf35013 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -88,13 +88,13 @@ ScNamedRangeObj::ScNamedRangeObj( rtl::Reference< ScNamedRangesObj > xParent, Sc
aName( rNm ),
mxSheet( xSheet )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScNamedRangeObj::~ScNamedRangeObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScNamedRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -115,9 +115,9 @@ ScRangeData* ScNamedRangeObj::GetRangeData_Impl()
ScRangeName* pNames;
SCTAB nTab = GetTab_Impl();
if (nTab >= 0)
- pNames = pDocShell->GetDocument()->GetRangeName(nTab);
+ pNames = pDocShell->GetDocument().GetRangeName(nTab);
else
- pNames = pDocShell->GetDocument()->GetRangeName();
+ pNames = pDocShell->GetDocument().GetRangeName();
if (pNames)
{
pRet = pNames->findByUpperName(ScGlobal::pCharClass->uppercase(aName));
@@ -134,10 +134,10 @@ SCTAB ScNamedRangeObj::GetTab_Impl()
{
if (!pDocShell)
return -2;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB nTab;
OUString sName = mxSheet->getName();
- pDoc->GetTable(sName, nTab);
+ rDoc.GetTable(sName, nTab);
return nTab;
}
else
@@ -153,13 +153,13 @@ void ScNamedRangeObj::Modify_Impl( const OUString* pNewName, const ScTokenArray*
if (!pDocShell)
return;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeName* pNames;
SCTAB nTab = GetTab_Impl();
if (nTab >= 0)
- pNames = pDoc->GetRangeName(nTab);
+ pNames = rDoc.GetRangeName(nTab);
else
- pNames = pDoc->GetRangeName();
+ pNames = rDoc.GetRangeName();
if (!pNames)
return;
@@ -188,9 +188,9 @@ void ScNamedRangeObj::Modify_Impl( const OUString* pNewName, const ScTokenArray*
ScRangeData* pNew = NULL;
if (pNewTokens)
- pNew = new ScRangeData( pDoc, aInsName, *pNewTokens, aPos, nType );
+ pNew = new ScRangeData( &rDoc, aInsName, *pNewTokens, aPos, nType );
else
- pNew = new ScRangeData( pDoc, aInsName, aContent, aPos, nType, eGrammar );
+ pNew = new ScRangeData( &rDoc, aInsName, aContent, aPos, nType, eGrammar );
pNew->SetIndex( pOld->GetIndex() );
@@ -263,7 +263,7 @@ table::CellAddress SAL_CALL ScNamedRangeObj::getReferencePosition()
aAddress.Sheet = aPos.Tab();
if (pDocShell)
{
- SCTAB nDocTabs = pDocShell->GetDocument()->GetTableCount();
+ SCTAB nDocTabs = pDocShell->GetDocument().GetTableCount();
if ( aAddress.Sheet >= nDocTabs && nDocTabs > 0 )
{
// Even after ValidateTabRefs, the position can be invalid if
@@ -328,7 +328,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScNamedRangeObj::getTokens()
{
ScTokenArray* pTokenArray = pData->GetCode();
if ( pTokenArray )
- (void)ScTokenConversion::ConvertToTokenSequence( *pDocShell->GetDocument(), aSequence, *pTokenArray );
+ (void)ScTokenConversion::ConvertToTokenSequence( pDocShell->GetDocument(), aSequence, *pTokenArray );
}
return aSequence;
}
@@ -340,7 +340,7 @@ void SAL_CALL ScNamedRangeObj::setTokens( const uno::Sequence<sheet::FormulaToke
if( pDocShell )
{
ScTokenArray aTokenArray;
- (void)ScTokenConversion::ConvertToTokenArray( *pDocShell->GetDocument(), aTokenArray, rTokens );
+ (void)ScTokenConversion::ConvertToTokenArray( pDocShell->GetDocument(), aTokenArray, rTokens );
// GRAM_PODF_A1 for API compatibility.
Modify_Impl( NULL, &aTokenArray, NULL, NULL, NULL, formula::FormulaGrammar::GRAM_PODF_A1 );
}
@@ -471,13 +471,13 @@ ScNamedRangesObj::ScNamedRangesObj(ScDocShell* pDocSh) :
mbModifyAndBroadcast(true),
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScNamedRangesObj::~ScNamedRangesObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScNamedRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -511,13 +511,13 @@ void SAL_CALL ScNamedRangesObj::addNewByName( const OUString& aName,
bool bDone = false;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeName* pNames = GetRangeName_Impl();
if (pNames && !pNames->findByUpperName(ScGlobal::pCharClass->uppercase(aName)))
{
ScRangeName* pNewRanges = new ScRangeName( *pNames );
// GRAM_PODF_A1 for API compatibility.
- ScRangeData* pNew = new ScRangeData( pDoc, aName, aContent,
+ ScRangeData* pNew = new ScRangeData( &rDoc, aName, aContent,
aPos, nNewType,formula::FormulaGrammar::GRAM_PODF_A1 );
if ( pNewRanges->insert(pNew) )
{
@@ -739,13 +739,13 @@ sal_Bool SAL_CALL ScNamedRangesObj::hasByName( const OUString& aName )
/** called from the XActionLockable interface methods on initial locking */
void ScNamedRangesObj::lock()
{
- pDocShell->GetDocument()->PreprocessRangeNameUpdate();
+ pDocShell->GetDocument().PreprocessRangeNameUpdate();
}
/** called from the XActionLockable interface methods on final unlock */
void ScNamedRangesObj::unlock()
{
- pDocShell->GetDocument()->PostprocessRangeNameUpdate();
+ pDocShell->GetDocument().PostprocessRangeNameUpdate();
}
// document::XActionLockable
@@ -753,27 +753,27 @@ void ScNamedRangesObj::unlock()
sal_Bool ScNamedRangesObj::isActionLocked() throw(uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- return pDocShell->GetDocument()->GetNamedRangesLockCount() != 0;
+ return pDocShell->GetDocument().GetNamedRangesLockCount() != 0;
}
void ScNamedRangesObj::addActionLock() throw(uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ScDocument* pDoc = pDocShell->GetDocument();
- sal_Int16 nLockCount = pDoc->GetNamedRangesLockCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
++nLockCount;
if ( nLockCount == 1 )
{
lock();
}
- pDoc->SetNamedRangesLockCount( nLockCount );
+ rDoc.SetNamedRangesLockCount( nLockCount );
}
void ScNamedRangesObj::removeActionLock() throw(uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ScDocument* pDoc = pDocShell->GetDocument();
- sal_Int16 nLockCount = pDoc->GetNamedRangesLockCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
if ( nLockCount > 0 )
{
--nLockCount;
@@ -781,7 +781,7 @@ void ScNamedRangesObj::removeActionLock() throw(uno::RuntimeException, std::exce
{
unlock();
}
- pDoc->SetNamedRangesLockCount( nLockCount );
+ rDoc.SetNamedRangesLockCount( nLockCount );
}
}
@@ -790,8 +790,8 @@ void ScNamedRangesObj::setActionLocks( sal_Int16 nLock ) throw(uno::RuntimeExcep
SolarMutexGuard aGuard;
if ( nLock >= 0 )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sal_Int16 nLockCount = pDoc->GetNamedRangesLockCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
if ( nLock == 0 && nLockCount > 0 )
{
unlock();
@@ -800,20 +800,20 @@ void ScNamedRangesObj::setActionLocks( sal_Int16 nLock ) throw(uno::RuntimeExcep
{
lock();
}
- pDoc->SetNamedRangesLockCount( nLock );
+ rDoc.SetNamedRangesLockCount( nLock );
}
}
sal_Int16 ScNamedRangesObj::resetActionLocks() throw(uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ScDocument* pDoc = pDocShell->GetDocument();
- sal_Int16 nLockCount = pDoc->GetNamedRangesLockCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
if ( nLockCount > 0 )
{
unlock();
}
- pDoc->SetNamedRangesLockCount( 0 );
+ rDoc.SetNamedRangesLockCount( 0 );
return nLockCount;
}
@@ -833,7 +833,7 @@ ScNamedRangeObj* ScGlobalNamedRangesObj::GetObjectByIndex_Impl(sal_uInt16 nIndex
if (!pDocShell)
return NULL;
- ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName();
+ ScRangeName* pNames = pDocShell->GetDocument().GetRangeName();
if (!pNames)
return NULL;
@@ -860,7 +860,7 @@ ScNamedRangeObj* ScGlobalNamedRangesObj::GetObjectByName_Impl(const OUString& aN
ScRangeName* ScGlobalNamedRangesObj::GetRangeName_Impl()
{
- return pDocShell->GetDocument()->GetRangeName();
+ return pDocShell->GetDocument().GetRangeName();
}
SCTAB ScGlobalNamedRangesObj::GetTab_Impl()
@@ -894,11 +894,11 @@ ScNamedRangeObj* ScLocalNamedRangesObj::GetObjectByIndex_Impl( sal_uInt16 nIndex
return NULL;
OUString aName = mxSheet->getName();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB nTab;
- pDoc->GetTable( aName, nTab );
+ rDoc.GetTable( aName, nTab );
- ScRangeName* pNames = pDoc->GetRangeName( nTab );
+ ScRangeName* pNames = rDoc.GetRangeName( nTab );
if (!pNames)
return NULL;
@@ -919,13 +919,13 @@ ScNamedRangeObj* ScLocalNamedRangesObj::GetObjectByIndex_Impl( sal_uInt16 nIndex
ScRangeName* ScLocalNamedRangesObj::GetRangeName_Impl()
{
SCTAB nTab = GetTab_Impl();
- return pDocShell->GetDocument()->GetRangeName( nTab );
+ return pDocShell->GetDocument().GetRangeName( nTab );
}
SCTAB ScLocalNamedRangesObj::GetTab_Impl()
{
SCTAB nTab;
- pDocShell->GetDocument()->GetTable(mxSheet->getName(), nTab);
+ pDocShell->GetDocument().GetTable(mxSheet->getName(), nTab);
return nTab;
}
@@ -934,13 +934,13 @@ ScLabelRangeObj::ScLabelRangeObj(ScDocShell* pDocSh, bool bCol, const ScRange& r
bColumn( bCol ),
aRange( rR )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScLabelRangeObj::~ScLabelRangeObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScLabelRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -958,8 +958,8 @@ ScRangePair* ScLabelRangeObj::GetData_Impl()
ScRangePair* pRet = NULL;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScRangePairList* pList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
if (pList)
pRet = pList->Find( aRange );
}
@@ -970,8 +970,8 @@ void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData )
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScRangePairList* pOldList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
if (pOldList)
{
ScRangePairListRef xNewList(pOldList->Clone());
@@ -989,11 +989,11 @@ void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData )
delete pEntry;
if (bColumn)
- pDoc->GetColNameRangesRef() = xNewList;
+ rDoc.GetColNameRangesRef() = xNewList;
else
- pDoc->GetRowNameRangesRef() = xNewList;
+ rDoc.GetRowNameRangesRef() = xNewList;
- pDoc->CompileColRowNameFormula();
+ rDoc.CompileColRowNameFormula();
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID );
pDocShell->SetDocumentModified();
@@ -1052,13 +1052,13 @@ ScLabelRangesObj::ScLabelRangesObj(ScDocShell* pDocSh, bool bCol) :
pDocShell( pDocSh ),
bColumn( bCol )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScLabelRangesObj::~ScLabelRangesObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScLabelRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -1078,8 +1078,8 @@ ScLabelRangeObj* ScLabelRangesObj::GetObjectByIndex_Impl(size_t nIndex)
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScRangePairList* pList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
if ( pList && nIndex < pList->size() )
{
ScRangePair* pData = (*pList)[nIndex];
@@ -1097,8 +1097,8 @@ void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelAre
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScRangePairList* pOldList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
if (pOldList)
{
ScRangePairListRef xNewList(pOldList->Clone());
@@ -1110,11 +1110,11 @@ void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelAre
xNewList->Join( ScRangePair( aLabelRange, aDataRange ) );
if (bColumn)
- pDoc->GetColNameRangesRef() = xNewList;
+ rDoc.GetColNameRangesRef() = xNewList;
else
- pDoc->GetRowNameRangesRef() = xNewList;
+ rDoc.GetRowNameRangesRef() = xNewList;
- pDoc->CompileColRowNameFormula();
+ rDoc.CompileColRowNameFormula();
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID );
pDocShell->SetDocumentModified();
@@ -1130,8 +1130,8 @@ void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex )
bool bDone = false;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScRangePairList* pOldList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
if ( pOldList && nIndex >= 0 && nIndex < (sal_Int32)pOldList->size() )
{
@@ -1144,11 +1144,11 @@ void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex )
delete pEntry;
if (bColumn)
- pDoc->GetColNameRangesRef() = xNewList;
+ rDoc.GetColNameRangesRef() = xNewList;
else
- pDoc->GetRowNameRangesRef() = xNewList;
+ rDoc.GetRowNameRangesRef() = xNewList;
- pDoc->CompileColRowNameFormula();
+ rDoc.CompileColRowNameFormula();
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID );
pDocShell->SetDocumentModified();
bDone = true;
@@ -1177,8 +1177,8 @@ sal_Int32 SAL_CALL ScLabelRangesObj::getCount() throw(uno::RuntimeException, std
SolarMutexGuard aGuard;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScRangePairList* pList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
if (pList)
return pList->size();
}
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index c0bcef6d3fcc..d8dcbcec9679 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -60,7 +60,7 @@ ScAnnotationObj::ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos) :
aCellPos( rPos ),
pUnoText( NULL )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
// pUnoText is allocated on demand (GetUnoText)
// can't be aggregated because getString/setString is handled here
@@ -69,7 +69,7 @@ ScAnnotationObj::ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos) :
ScAnnotationObj::~ScAnnotationObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
if (pUnoText)
pUnoText->release();
@@ -248,6 +248,6 @@ SvxUnoText& ScAnnotationObj::GetUnoText()
const ScPostIt* ScAnnotationObj::ImplGetNote() const
{
- return pDocShell ? pDocShell->GetDocument()->GetNote(aCellPos) : 0;
+ return pDocShell ? pDocShell->GetDocument().GetNote(aCellPos) : 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index 7227f056fc95..e9bf1d5d158b 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -83,10 +83,6 @@ class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container
public:
ScVbaObjectForCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell )
{
- ScDocument* pDoc = mpDocShell->GetDocument();
- if ( !pDoc )
- throw uno::RuntimeException();
-
uno::Sequence< uno::Any > aArgs(2);
// access the application object ( parent for workbook )
aArgs[0] = uno::Any( ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.Application", uno::Sequence< uno::Any >() ) );
@@ -99,26 +95,24 @@ public:
SolarMutexGuard aGuard;
maCachedObject = uno::Any(); // clear cached object
- ScDocument* pDoc = mpDocShell->GetDocument();
- if ( !pDoc )
- throw uno::RuntimeException();
+ ScDocument& rDoc = mpDocShell->GetDocument();
// aName is generated from the stream name which can be different ( case-wise )
// from the code name
- if( aName.equalsIgnoreAsciiCase( pDoc->GetCodeName() ) )
+ if( aName.equalsIgnoreAsciiCase( rDoc.GetCodeName() ) )
maCachedObject = maWorkbook;
else
{
OUString sCodeName;
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
for( SCTAB i = 0; i < nCount; i++ )
{
- pDoc->GetCodeName( i, sCodeName );
+ rDoc.GetCodeName( i, sCodeName );
// aName is generated from the stream name which can be different ( case-wise )
// from the code name
if( sCodeName.equalsIgnoreAsciiCase( aName ) )
{
OUString sSheetName;
- if( pDoc->GetName( i, sSheetName ) )
+ if( rDoc.GetName( i, sSheetName ) )
{
uno::Reference< frame::XModel > xModel( mpDocShell->GetModel() );
uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
@@ -151,19 +145,17 @@ public:
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{
SolarMutexGuard aGuard;
- ScDocument* pDoc = mpDocShell->GetDocument();
- if ( !pDoc )
- throw uno::RuntimeException();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = mpDocShell->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
uno::Sequence< OUString > aNames( nCount + 1 );
SCTAB index = 0;
OUString sCodeName;
for( ; index < nCount; ++index )
{
- pDoc->GetCodeName( index, sCodeName );
+ rDoc.GetCodeName( index, sCodeName );
aNames[ index ] = sCodeName;
}
- aNames[ index ] = pDoc->GetCodeName();
+ aNames[ index ] = rDoc.GetCodeName();
return aNames;
}
// XElemenAccess
@@ -204,7 +196,7 @@ public:
if ( bMatched )
{
OUString sName;
- mrDocShell.GetDocument()->GetCodeName( static_cast<SCTAB>( index ), sName );
+ mrDocShell.GetDocument().GetCodeName( static_cast<SCTAB>( index ), sName );
sCodeName = sName;
}
}
@@ -235,7 +227,7 @@ public:
if (xFormControls == xContainer)
{
OUString aName;
- if (mrDocShell.GetDocument()->GetCodeName(static_cast<SCTAB>(i), aName))
+ if (mrDocShell.GetDocument().GetCodeName(static_cast<SCTAB>(i), aName))
return aName;
}
}
@@ -583,8 +575,8 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
break;
case SC_SERVICE_CHDATAPROV:
- if (pDocShell && pDocShell->GetDocument())
- xRet = *new ScChart2DataProvider( pDocShell->GetDocument() );
+ if (pDocShell)
+ xRet = *new ScChart2DataProvider( &pDocShell->GetDocument() );
break;
case SC_SERVICE_FORMULAPARS:
@@ -595,10 +587,10 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
case SC_SERVICE_OPCODEMAPPER:
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScAddress aAddress;
- ScCompiler* pComp = new ScCompiler(pDoc,aAddress);
- pComp->SetGrammar( pDoc->GetGrammar() );
+ ScCompiler* pComp = new ScCompiler(&rDoc,aAddress);
+ pComp->SetGrammar( rDoc.GetGrammar() );
SAL_WNODEPRECATED_DECLARATIONS_PUSH
xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> (pComp))));
SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -606,7 +598,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
}
#ifndef DISABLE_SCRIPTING
case SC_SERVICE_VBAOBJECTPROVIDER:
- if (pDocShell && pDocShell->GetDocument()->IsInVBAMode())
+ if (pDocShell && pDocShell->GetDocument().IsInVBAMode())
{
OSL_TRACE("**** creating VBA Object mapper");
xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
@@ -636,7 +628,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
// create the VBA document event processor
uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents(
::ooo::vba::createVBAUnoAPIServiceWithArgs( pDocShell, "com.sun.star.script.vba.VBASpreadsheetEventProcessor", aArgs ), uno::UNO_QUERY );
- pDocShell->GetDocument()->SetVbaEventProcessor( xVbaEvents );
+ pDocShell->GetDocument().SetVbaEventProcessor( xVbaEvents );
}
}
break;
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 8d0050fd8146..357d06dbf51e 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -399,13 +399,13 @@ static bool lcl_AnyTabProtected( ScDocument& rDoc )
ScStyleFamiliesObj::ScStyleFamiliesObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScStyleFamiliesObj::~ScStyleFamiliesObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScStyleFamiliesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -588,13 +588,13 @@ ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam) :
pDocShell( pDocSh ),
eFamily( eFam )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScStyleFamilyObj::~ScStyleFamilyObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScStyleFamilyObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -614,8 +614,8 @@ ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex)
{
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
SfxStyleSheetIterator aIter( pStylePool, eFamily );
if ( nIndex < aIter.Count() )
@@ -636,8 +636,8 @@ ScStyleObj* ScStyleFamilyObj::GetObjectByName_Impl(const OUString& aName)
{
OUString aString(aName);
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
if ( pStylePool->Find( aString, eFamily ) )
return new ScStyleObj( pDocShell, eFamily, aString );
}
@@ -660,8 +660,8 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno::
{
OUString aNameStr(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) ));
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
//! DocFunc-Funktion??
//! Undo ?????????????
@@ -670,8 +670,8 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno::
{
(void)pStylePool->Make( aNameStr, eFamily, SFXSTYLEBIT_USERDEF );
- if ( eFamily == SFX_STYLE_FAMILY_PARA && !pDoc->IsImportingXML() )
- pDoc->GetPool()->CellStyleCreated( aNameStr );
+ if ( eFamily == SFX_STYLE_FAMILY_PARA && !rDoc.IsImportingXML() )
+ rDoc.GetPool()->CellStyleCreated( aNameStr );
pStyleObj->InitDoc( pDocShell, aNameStr ); // Objekt kann benutzt werden
@@ -712,8 +712,8 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName )
{
OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) ));
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
//! DocFunc-Funktion??
//! Undo ?????????????
@@ -730,7 +730,7 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName )
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
Fraction aZoom(1,1);
- pDoc->StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
+ rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
pDocShell->SetDocumentModified();
@@ -740,7 +740,7 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName )
}
else
{
- if ( pDoc->RemovePageStyleInUse( aString ) )
+ if ( rDoc.RemovePageStyleInUse( aString ) )
pDocShell->PageStyleModified( ScGlobal::GetRscString(STR_STYLENAME_STANDARD), true );
pStylePool->Remove( pStyle );
@@ -764,8 +764,8 @@ sal_Int32 SAL_CALL ScStyleFamilyObj::getCount() throw(uno::RuntimeException, std
SolarMutexGuard aGuard;
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
SfxStyleSheetIterator aIter( pStylePool, eFamily );
return aIter.Count();
@@ -820,8 +820,8 @@ uno::Sequence<OUString> SAL_CALL ScStyleFamilyObj::getElementNames()
SolarMutexGuard aGuard;
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
SfxStyleSheetIterator aIter( pStylePool, eFamily );
sal_uInt16 nCount = aIter.Count();
@@ -851,8 +851,8 @@ sal_Bool SAL_CALL ScStyleFamilyObj::hasByName( const OUString& aName )
{
OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) ));
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
if ( pStylePool->Find( aString, eFamily ) )
return sal_True;
}
@@ -934,7 +934,7 @@ ScStyleObj::ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const OUString&
// pDocShell ist Null, wenn per ServiceProvider erzeugt
if (pDocShell)
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
void ScStyleObj::InitDoc( ScDocShell* pNewDocSh, const OUString& rNewName )
@@ -943,14 +943,14 @@ void ScStyleObj::InitDoc( ScDocShell* pNewDocSh, const OUString& rNewName )
{
aStyleName = rNewName;
pDocShell = pNewDocSh;
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
}
ScStyleObj::~ScStyleObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
// XUnoTunnel
@@ -1002,8 +1002,8 @@ SfxStyleSheetBase* ScStyleObj::GetStyle_Impl()
{
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
return pStylePool->Find( aStyleName, eFamily );
}
return NULL;
@@ -1048,7 +1048,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle )
if (pStyle)
{
// cell styles cannot be modified if any sheet is protected
- if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
+ if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
return; //! exception?
//! DocFunc-Funktion??
@@ -1060,7 +1060,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle )
{
// wie bei setPropertyValue
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if ( eFamily == SFX_STYLE_FAMILY_PARA )
{
// Zeilenhoehen anpassen...
@@ -1070,7 +1070,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle )
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
Fraction aZoom(1,1);
- pDoc->StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
+ rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
pDocShell->SetDocumentModified();
@@ -1104,7 +1104,7 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName )
if (pStyle)
{
// cell styles cannot be renamed if any sheet is protected
- if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
+ if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
return; //! exception?
//! DocFunc-Funktion??
@@ -1116,9 +1116,9 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName )
{
aStyleName = aString; //! notify other objects for this style?
- ScDocument* pDoc = pDocShell->GetDocument();
- if ( eFamily == SFX_STYLE_FAMILY_PARA && !pDoc->IsImportingXML() )
- pDoc->GetPool()->CellStyleCreated( aString );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if ( eFamily == SFX_STYLE_FAMILY_PARA && !rDoc.IsImportingXML() )
+ rDoc.GetPool()->CellStyleCreated( aString );
// Zellvorlagen = 2, Seitenvorlagen = 4
sal_uInt16 nId = ( eFamily == SFX_STYLE_FAMILY_PARA ) ?
@@ -1416,7 +1416,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault()
if ( pStyle )
{
// cell styles cannot be modified if any sheet is protected
- if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
+ if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
throw uno::RuntimeException();
SfxItemSet& rSet = pStyle->GetItemSet();
@@ -1424,7 +1424,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault()
//! merge with SetOneProperty
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if ( eFamily == SFX_STYLE_FAMILY_PARA )
{
// row heights
@@ -1434,7 +1434,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault()
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
Fraction aZoom(1,1);
- pDoc->StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
+ rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
pDocShell->SetDocumentModified();
@@ -1527,7 +1527,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt
if ( pStyle && pEntry )
{
// cell styles cannot be modified if any sheet is protected
- if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
+ if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
throw uno::RuntimeException();
SfxItemSet& rSet = pStyle->GetItemSet(); // direkt im lebenden Style aendern...
@@ -1577,7 +1577,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt
{
// language for number formats
SvNumberFormatter* pFormatter =
- pDocShell->GetDocument()->GetFormatTable();
+ pDocShell->GetDocument().GetFormatTable();
sal_uInt32 nOldFormat = ((const SfxUInt32Item&)
rSet.Get( ATTR_VALUE_FORMAT )).GetValue();
LanguageType eOldLang = ((const SvxLanguageItem&)
@@ -1803,7 +1803,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt
//! DocFunc-Funktion??
//! Undo ?????????????
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if ( eFamily == SFX_STYLE_FAMILY_PARA )
{
// Zeilenhoehen anpassen...
@@ -1813,7 +1813,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
Fraction aZoom(1,1);
- pDoc->StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
+ rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
pDocShell->SetDocumentModified();
@@ -1861,7 +1861,7 @@ uno::Any SAL_CALL ScStyleObj::getPropertyValue( const OUString& aPropertyName )
pItemSet->Get( ATTR_VALUE_FORMAT )).GetValue();
LanguageType eOldLang = ((const SvxLanguageItem&)
pItemSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
- nOldFormat = pDocShell->GetDocument()->GetFormatTable()->
+ nOldFormat = pDocShell->GetDocument().GetFormatTable()->
GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
aAny <<= nOldFormat;
}
diff --git a/sc/source/ui/unoobj/targuno.cxx b/sc/source/ui/unoobj/targuno.cxx
index df1b80de2ee5..84beb009ede8 100644
--- a/sc/source/ui/unoobj/targuno.cxx
+++ b/sc/source/ui/unoobj/targuno.cxx
@@ -67,7 +67,7 @@ SC_SIMPLE_SERVICE_INFO( ScLinkTargetsObj, "ScLinkTargetsObj", "com.sun.s
ScLinkTargetTypesObj::ScLinkTargetTypesObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
for (sal_uInt16 i=0; i<SC_LINKTARGETTYPE_COUNT; i++)
aNames[i] = ScResId( nTypeResIds[i] );
@@ -76,7 +76,7 @@ ScLinkTargetTypesObj::ScLinkTargetTypesObj(ScDocShell* pDocSh) :
ScLinkTargetTypesObj::~ScLinkTargetTypesObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScLinkTargetTypesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -135,14 +135,14 @@ ScLinkTargetTypeObj::ScLinkTargetTypeObj(ScDocShell* pDocSh, sal_uInt16 nT) :
pDocShell( pDocSh ),
nType( nT )
{
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
aName = ScResId( nTypeResIds[nType] ); //! on demand?
}
ScLinkTargetTypeObj::~ScLinkTargetTypeObj()
{
if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScLinkTargetTypeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 5b5dd354961d..48238e41bd5d 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -901,7 +901,7 @@ ScCellTextData::ScCellTextData(ScDocShell* pDocSh, const ScAddress& rP) :
bDoUpdate( true )
{
if (pDocShell)
- pDocShell->GetDocument()->AddUnoObject(*this);
+ pDocShell->GetDocument().AddUnoObject(*this);
}
ScCellTextData::~ScCellTextData()
@@ -910,8 +910,8 @@ ScCellTextData::~ScCellTextData()
if (pDocShell)
{
- pDocShell->GetDocument()->RemoveUnoObject(*this);
- pDocShell->GetDocument()->DisposeFieldEditEngine(pEditEngine);
+ pDocShell->GetDocument().RemoveUnoObject(*this);
+ pDocShell->GetDocument().DisposeFieldEditEngine(pEditEngine);
}
else
delete pEditEngine;
@@ -932,8 +932,8 @@ void ScCellTextData::GetCellText(const ScAddress& rCellPos, OUString& rText)
{
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->GetInputString( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.GetInputString( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText );
}
}
@@ -943,8 +943,8 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
{
if ( pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pEditEngine = pDoc->CreateFieldEditEngine();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ pEditEngine = rDoc.CreateFieldEditEngine();
}
else
{
@@ -970,19 +970,19 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SfxItemSet aDefaults( pEditEngine->GetEmptyItemSet() );
if( const ScPatternAttr* pPattern =
- pDoc->GetPattern( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) )
+ rDoc.GetPattern( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) )
{
pPattern->FillEditItemSet( &aDefaults );
pPattern->FillEditParaItems( &aDefaults ); // including alignment etc. (for reading)
}
- if (pDoc->GetCellType(aCellPos) == CELLTYPE_EDIT)
+ if (rDoc.GetCellType(aCellPos) == CELLTYPE_EDIT)
{
- const EditTextObject* pObj = pDoc->GetEditText(aCellPos);
+ const EditTextObject* pObj = rDoc.GetEditText(aCellPos);
if (pObj)
pEditEngine->SetTextNewDefaults(*pObj, aDefaults);
}
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index 2b7b884e0e11..738d33d8a5be 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -68,13 +68,13 @@ ScFormulaParserObj::ScFormulaParserObj(ScDocShell* pDocSh) :
mbIgnoreSpaces( true ),
mbCompileFAP( false )
{
- mpDocShell->GetDocument()->AddUnoObject(*this);
+ mpDocShell->GetDocument().AddUnoObject(*this);
}
ScFormulaParserObj::~ScFormulaParserObj()
{
if (mpDocShell)
- mpDocShell->GetDocument()->RemoveUnoObject(*this);
+ mpDocShell->GetDocument().RemoveUnoObject(*this);
}
void ScFormulaParserObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
@@ -129,17 +129,17 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula(
if (mpDocShell)
{
- ScDocument* pDoc = mpDocShell->GetDocument();
- ScExternalRefManager::ApiGuard aExtRefGuard(pDoc);
+ ScDocument& rDoc = mpDocShell->GetDocument();
+ ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc);
ScAddress aRefPos( ScAddress::UNINITIALIZED );
ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
- ScCompiler aCompiler( pDoc, aRefPos);
- aCompiler.SetGrammar(pDoc->GetGrammar());
+ ScCompiler aCompiler( &rDoc, aRefPos);
+ aCompiler.SetGrammar(rDoc.GetGrammar());
SetCompilerFlags( aCompiler );
ScTokenArray* pCode = aCompiler.CompileString( aFormula );
- (void)ScTokenConversion::ConvertToTokenSequence( *pDoc, aRet, *pCode );
+ (void)ScTokenConversion::ConvertToTokenSequence( rDoc, aRet, *pCode );
delete pCode;
}
@@ -155,13 +155,13 @@ OUString SAL_CALL ScFormulaParserObj::printFormula(
if (mpDocShell)
{
- ScDocument* pDoc = mpDocShell->GetDocument();
+ ScDocument& rDoc = mpDocShell->GetDocument();
ScTokenArray aCode;
- (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aCode, aTokens );
+ (void)ScTokenConversion::ConvertToTokenArray( rDoc, aCode, aTokens );
ScAddress aRefPos( ScAddress::UNINITIALIZED );
ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
- ScCompiler aCompiler( pDoc, aRefPos, aCode);
- aCompiler.SetGrammar(pDoc->GetGrammar());
+ ScCompiler aCompiler( &rDoc, aRefPos, aCode);
+ aCompiler.SetGrammar(rDoc.GetGrammar());
SetCompilerFlags( aCompiler );
OUStringBuffer aBuffer;
@@ -204,9 +204,9 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
// CompileEnglish _before_ OpCodeMap!
if (mxOpCodeMap.get() && mbEnglish != bOldEnglish)
{
- ScDocument* pDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( pDoc, ScAddress());
- aCompiler.SetGrammar(pDoc->GetGrammar());
+ ScDocument& rDoc = mpDocShell->GetDocument();
+ ScCompiler aCompiler( &rDoc, ScAddress());
+ aCompiler.SetGrammar(rDoc.GetGrammar());
mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish);
}
}
@@ -225,9 +225,9 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
{
if (aValue >>= maOpCodeMapping)
{
- ScDocument* pDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( pDoc, ScAddress());
- aCompiler.SetGrammar(pDoc->GetGrammar());
+ ScDocument& rDoc = mpDocShell->GetDocument();
+ ScCompiler aCompiler( &rDoc, ScAddress());
+ aCompiler.SetGrammar(rDoc.GetGrammar());
mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish);
}
else
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 4c40d4a39284..65dcffabfedc 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -183,13 +183,13 @@ sal_Int32 SAL_CALL ScViewPaneBase::getFirstVisibleColumn() throw(uno::RuntimeExc
SolarMutexGuard aGuard;
if (pViewShell)
{
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
- pViewData->GetActivePart() :
+ rViewData.GetActivePart() :
(ScSplitPos) nPane;
ScHSplitPos eWhichH = WhichH( eWhich );
- return pViewData->GetPosX( eWhichH );
+ return rViewData.GetPosX( eWhichH );
}
OSL_FAIL("keine View ?!?"); //! Exception?
return 0;
@@ -201,13 +201,13 @@ void SAL_CALL ScViewPaneBase::setFirstVisibleColumn(sal_Int32 nFirstVisibleColum
SolarMutexGuard aGuard;
if (pViewShell)
{
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
- pViewData->GetActivePart() :
+ rViewData.GetActivePart() :
(ScSplitPos) nPane;
ScHSplitPos eWhichH = WhichH( eWhich );
- long nDeltaX = ((long)nFirstVisibleColumn) - pViewData->GetPosX( eWhichH );
+ long nDeltaX = ((long)nFirstVisibleColumn) - rViewData.GetPosX( eWhichH );
pViewShell->ScrollX( nDeltaX, eWhichH );
}
}
@@ -217,13 +217,13 @@ sal_Int32 SAL_CALL ScViewPaneBase::getFirstVisibleRow() throw(uno::RuntimeExcept
SolarMutexGuard aGuard;
if (pViewShell)
{
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
- pViewData->GetActivePart() :
+ rViewData.GetActivePart() :
(ScSplitPos) nPane;
ScVSplitPos eWhichV = WhichV( eWhich );
- return pViewData->GetPosY( eWhichV );
+ return rViewData.GetPosY( eWhichV );
}
OSL_FAIL("keine View ?!?"); //! Exception?
return 0;
@@ -235,13 +235,13 @@ void SAL_CALL ScViewPaneBase::setFirstVisibleRow( sal_Int32 nFirstVisibleRow )
SolarMutexGuard aGuard;
if (pViewShell)
{
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
- pViewData->GetActivePart() :
+ rViewData.GetActivePart() :
(ScSplitPos) nPane;
ScVSplitPos eWhichV = WhichV( eWhich );
- long nDeltaY = ((long)nFirstVisibleRow) - pViewData->GetPosY( eWhichV );
+ long nDeltaY = ((long)nFirstVisibleRow) - rViewData.GetPosY( eWhichV );
pViewShell->ScrollY( nDeltaY, eWhichV );
}
}
@@ -253,9 +253,9 @@ table::CellRangeAddress SAL_CALL ScViewPaneBase::getVisibleRange()
table::CellRangeAddress aAdr;
if (pViewShell)
{
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
- pViewData->GetActivePart() :
+ rViewData.GetActivePart() :
(ScSplitPos) nPane;
ScHSplitPos eWhichH = WhichH( eWhich );
ScVSplitPos eWhichV = WhichV( eWhich );
@@ -264,13 +264,13 @@ table::CellRangeAddress SAL_CALL ScViewPaneBase::getVisibleRange()
// VisibleRange in Excel auch teilweise sichtbare.
//! anpassen ???
- SCCOL nVisX = pViewData->VisibleCellsX( eWhichH );
- SCROW nVisY = pViewData->VisibleCellsY( eWhichV );
+ SCCOL nVisX = rViewData.VisibleCellsX( eWhichH );
+ SCROW nVisY = rViewData.VisibleCellsY( eWhichV );
if (!nVisX) nVisX = 1; // irgendwas muss ja im Range sein
if (!nVisY) nVisY = 1;
- aAdr.Sheet = pViewData->GetTabNo();
- aAdr.StartColumn = pViewData->GetPosX( eWhichH );
- aAdr.StartRow = pViewData->GetPosY( eWhichV );
+ aAdr.Sheet = rViewData.GetTabNo();
+ aAdr.StartColumn = rViewData.GetPosX( eWhichH );
+ aAdr.StartRow = rViewData.GetPosY( eWhichV );
aAdr.EndColumn = aAdr.StartColumn + nVisX - 1;
aAdr.EndRow = aAdr.StartRow + nVisY - 1;
}
@@ -285,7 +285,7 @@ uno::Reference<table::XCellRange> SAL_CALL ScViewPaneBase::getReferredCells()
SolarMutexGuard aGuard;
if (pViewShell)
{
- ScDocShell* pDocSh = pViewShell->GetViewData()->GetDocShell();
+ ScDocShell* pDocSh = pViewShell->GetViewData().GetDocShell();
table::CellRangeAddress aAdr(getVisibleRange()); //! Hilfsfunktion mit ScRange?
ScRange aRange( (SCCOL)aAdr.StartColumn, (SCROW)aAdr.StartRow, aAdr.Sheet,
@@ -306,9 +306,9 @@ namespace
if ( !_pViewShell )
return false;
- ScViewData* pViewData = _pViewShell->GetViewData();
+ ScViewData& rViewData = _pViewShell->GetViewData();
ScSplitPos eWhich = ( _nPane == SC_VIEWPANE_ACTIVE ) ?
- pViewData->GetActivePart() :
+ rViewData.GetActivePart() :
(ScSplitPos) _nPane;
_rpWindow = _pViewShell->GetWindowByPos( eWhich );
_rpSdrView = _pViewShell->GetSdrView();
@@ -385,19 +385,19 @@ awt::Rectangle ScViewPaneBase::GetVisArea() const
if (pViewShell)
{
ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
- pViewShell->GetViewData()->GetActivePart() :
+ pViewShell->GetViewData().GetActivePart() :
(ScSplitPos) nPane;
ScGridWindow* pWindow = (ScGridWindow*)pViewShell->GetWindowByPos(eWhich);
- ScDocument* pDoc = pViewShell->GetViewData()->GetDocument();
+ ScDocument* pDoc = pViewShell->GetViewData().GetDocument();
if (pWindow && pDoc)
{
ScHSplitPos eWhichH = ((eWhich == SC_SPLIT_TOPLEFT) || (eWhich == SC_SPLIT_BOTTOMLEFT)) ?
SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
ScVSplitPos eWhichV = ((eWhich == SC_SPLIT_TOPLEFT) || (eWhich == SC_SPLIT_TOPRIGHT)) ?
SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
- ScAddress aCell(pViewShell->GetViewData()->GetPosX(eWhichH),
- pViewShell->GetViewData()->GetPosY(eWhichV),
- pViewShell->GetViewData()->GetTabNo());
+ ScAddress aCell(pViewShell->GetViewData().GetPosX(eWhichH),
+ pViewShell->GetViewData().GetPosY(eWhichV),
+ pViewShell->GetViewData().GetTabNo());
Rectangle aCellRect( pDoc->GetMMRect( aCell.Col(), aCell.Row(), aCell.Col(), aCell.Row(), aCell.Tab() ) );
Size aVisSize( pWindow->PixelToLogic( pWindow->GetSizePixel(), pWindow->GetDrawMapMode( true ) ) );
Point aVisPos( aCellRect.TopLeft() );
@@ -458,7 +458,7 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
mbPendingSelectionChanged(false)
{
if (pViewSh)
- nPreviousTab = pViewSh->GetViewData()->GetTabNo();
+ nPreviousTab = pViewSh->GetViewData().GetTabNo();
}
ScTabViewObj::~ScTabViewObj()
@@ -512,13 +512,13 @@ void SAL_CALL ScTabViewObj::release() throw()
static void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, sal_Int32 nEvent )
{
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
// when deleting a sheet, nPreviousTab can be invalid
// (could be handled with reference updates)
- if (!pDoc->HasTable(nTab))
+ if (!rDoc.HasTable(nTab))
return;
- const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab);
+ const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
if (pEvents)
{
const OUString* pScript = pEvents->GetScript(nEvent);
@@ -535,7 +535,7 @@ static void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, sal_Int32 nEvent )
// execute VBA event handlers
try
{
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
// the parameter is the clicked object, as in the mousePressed call above
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[ 0 ] <<= nTab;
@@ -551,15 +551,15 @@ void ScTabViewObj::SheetChanged( bool bSameTabButMoved )
if ( !GetViewShell() )
return;
- ScViewData* pViewData = GetViewShell()->GetViewData();
- ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScViewData& rViewData = GetViewShell()->GetViewData();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
if (!aActivationListeners.empty())
{
sheet::ActivationEvent aEvent;
uno::Reference< sheet::XSpreadsheetView > xView(this);
uno::Reference< uno::XInterface > xSource(xView, uno::UNO_QUERY);
aEvent.Source = xSource;
- aEvent.ActiveSheet = new ScTableSheetObj(pDocSh, pViewData->GetTabNo());
+ aEvent.ActiveSheet = new ScTableSheetObj(pDocSh, rViewData.GetTabNo());
for (XActivationEventListenerVector::iterator it = aActivationListeners.begin(); it != aActivationListeners.end(); )
{
try
@@ -576,7 +576,7 @@ void ScTabViewObj::SheetChanged( bool bSameTabButMoved )
/* Handle sheet events, but do not trigger event handlers, if the old
active sheet gets re-activated after inserting/deleting/moving a sheet. */
- SCTAB nNewTab = pViewData->GetTabNo();
+ SCTAB nNewTab = rViewData.GetTabNo();
if ( !bSameTabButMoved && (nNewTab != nPreviousTab) )
{
lcl_CallActivate( pDocSh, nPreviousTab, SC_SHEETEVENT_UNFOCUS );
@@ -721,8 +721,8 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection )
if (pRangesImp) // Zell-Ranges
{
- ScViewData* pViewData = pViewSh->GetViewData();
- if ( pViewData->GetDocShell() == pRangesImp->GetDocShell() )
+ ScViewData& rViewData = pViewSh->GetViewData();
+ if ( rViewData.GetDocShell() == pRangesImp->GetDocShell() )
{
// Zuerst evtl. Drawing-Selektion aufheben
// (MarkListHasChanged hebt Tabellen-Selektion auf)
@@ -758,13 +758,13 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection )
// Mehrfachselektion
const ScRange* pFirst = rRanges[ 0 ];
- if ( pFirst && !lcl_TabInRanges( pViewData->GetTabNo(), rRanges ) )
+ if ( pFirst && !lcl_TabInRanges( rViewData.GetTabNo(), rRanges ) )
pViewSh->SetTabNo( pFirst->aStart.Tab() );
pViewSh->DoneBlockMode();
pViewSh->InitOwnBlockMode();
- pViewData->GetMarkData().MarkFromRangeList( rRanges, true );
+ rViewData.GetMarkData().MarkFromRangeList( rRanges, true );
pViewSh->MarkDataChanged();
- pViewData->GetDocShell()->PostPaintGridAll(); // Markierung (alt&neu)
+ rViewData.GetDocShell()->PostPaintGridAll(); // Markierung (alt&neu)
if ( pFirst )
{
pViewSh->AlignToCursor( pFirst->aStart.Col(), pFirst->aStart.Row(),
@@ -902,14 +902,14 @@ uno::Any SAL_CALL ScTabViewObj::getSelection()
// sonst Tabellen-(Zellen-)Selektion
- ScViewData* pViewData = pViewSh->GetViewData();
- ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScViewData& rViewData = pViewSh->GetViewData();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
- const ScMarkData& rMark = pViewData->GetMarkData();
+ const ScMarkData& rMark = rViewData.GetMarkData();
SCTAB nTabs = rMark.GetSelectCount();
ScRange aRange;
- ScMarkType eMarkType = pViewData->GetSimpleArea(aRange);
+ ScMarkType eMarkType = rViewData.GetSimpleArea(aRange);
if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE) )
{
if (aRange.aStart == aRange.aEnd)
@@ -920,7 +920,7 @@ uno::Any SAL_CALL ScTabViewObj::getSelection()
else if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE_FILTERED) )
{
ScMarkData aFilteredMark( rMark );
- ScViewUtil::UnmarkFiltered( aFilteredMark, pDocSh->GetDocument());
+ ScViewUtil::UnmarkFiltered( aFilteredMark, &pDocSh->GetDocument());
ScRangeList aRangeList;
aFilteredMark.FillRangeListWithMarks( &aRangeList, false);
// Theoretically a selection may start and end on a filtered row.
@@ -947,7 +947,7 @@ uno::Any SAL_CALL ScTabViewObj::getSelection()
else // Mehrfachselektion
{
ScRangeListRef xRanges;
- pViewData->GetMultiArea( xRanges );
+ rViewData.GetMultiArea( xRanges );
// bei mehreren Tabellen Ranges kopieren
//! sollte eigentlich schon in ScMarkData::FillRangeListWithMarks passieren?
@@ -988,10 +988,10 @@ sal_Int32 SAL_CALL ScTabViewObj::getCount() throw(uno::RuntimeException, std::ex
if (pViewSh)
{
nPanes = 1;
- ScViewData* pViewData = pViewSh->GetViewData();
- if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE )
+ ScViewData& rViewData = pViewSh->GetViewData();
+ if ( rViewData.GetHSplitMode() != SC_SPLIT_NONE )
nPanes *= 2;
- if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE )
+ if ( rViewData.GetVSplitMode() != SC_SPLIT_NONE )
nPanes *= 2;
}
return nPanes;
@@ -1034,9 +1034,9 @@ ScViewPaneObj* ScTabViewObj::GetObjectByIndex_Impl(sal_uInt16 nIndex) const
{
ScSplitPos eWhich = SC_SPLIT_BOTTOMLEFT; // default Position
bool bError = false;
- ScViewData* pViewData = pViewSh->GetViewData();
- bool bHor = ( pViewData->GetHSplitMode() != SC_SPLIT_NONE );
- bool bVer = ( pViewData->GetVSplitMode() != SC_SPLIT_NONE );
+ ScViewData& rViewData = pViewSh->GetViewData();
+ bool bHor = ( rViewData.GetHSplitMode() != SC_SPLIT_NONE );
+ bool bVer = ( rViewData.GetVSplitMode() != SC_SPLIT_NONE );
if ( bHor && bVer )
{
// links oben, links unten, rechts oben, rechts unten - wie in Excel
@@ -1078,9 +1078,9 @@ uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTabViewObj::getActiveSheet()
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScViewData* pData = pViewSh->GetViewData();
- SCTAB nTab = pData->GetTabNo();
- return new ScTableSheetObj( pData->GetDocShell(), nTab );
+ ScViewData& rViewData = pViewSh->GetViewData();
+ SCTAB nTab = rViewData.GetTabNo();
+ return new ScTableSheetObj( rViewData.GetDocShell(), nTab );
}
return NULL;
}
@@ -1097,13 +1097,13 @@ void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreads
// XSpreadsheet und ScCellRangesBase -> muss ein Sheet sein
ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xActiveSheet );
- if ( pRangesImp && pViewSh->GetViewData()->GetDocShell() == pRangesImp->GetDocShell() )
+ if ( pRangesImp && pViewSh->GetViewData().GetDocShell() == pRangesImp->GetDocShell() )
{
const ScRangeList& rRanges = pRangesImp->GetRangeList();
if ( rRanges.size() == 1 )
{
SCTAB nNewTab = rRanges[ 0 ]->aStart.Tab();
- if ( pViewSh->GetViewData()->GetDocument()->HasTable(nNewTab) )
+ if ( pViewSh->GetViewData().GetDocument()->HasTable(nNewTab) )
pViewSh->SetTabNo( nNewTab );
}
}
@@ -1117,17 +1117,17 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP
{
SCsCOL nX;
SCsROW nY;
- ScViewData* pData = GetViewShell()->GetViewData();
- ScSplitPos eSplitMode = pData->GetActivePart();
- SCTAB nTab(pData->GetTabNo());
- pData->GetPosFromPixel( rPoint.X(), rPoint.Y(), eSplitMode, nX, nY);
+ ScViewData& rData = GetViewShell()->GetViewData();
+ ScSplitPos eSplitMode = rData.GetActivePart();
+ SCTAB nTab(rData.GetTabNo());
+ rData.GetPosFromPixel( rPoint.X(), rPoint.Y(), eSplitMode, nX, nY);
ScAddress aCellPos (nX, nY, nTab);
- ScCellObj* pCellObj = new ScCellObj(pData->GetDocShell(), aCellPos);
+ ScCellObj* pCellObj = new ScCellObj(rData.GetDocShell(), aCellPos);
xTarget.set(uno::Reference<table::XCell>(pCellObj), uno::UNO_QUERY);
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument* pDoc = rData.GetDocument();
if (pDoc && pDoc->GetDrawLayer())
{
SdrPage* pDrawPage = NULL;
@@ -1139,7 +1139,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP
if (pDrawPage && pDrawView && pDrawView->GetSdrPageView())
{
- Window* pActiveWin = pData->GetActiveWin();
+ Window* pActiveWin = rData.GetActiveWin();
Point aPos = pActiveWin->PixelToLogic(rPoint);
sal_uInt16 nHitLog = (sal_uInt16) pActiveWin->PixelToLogic(
@@ -1170,9 +1170,9 @@ bool ScTabViewObj::IsMouseListening() const
return true;
// also include sheet events, because MousePressed must be called for them
- ScViewData* pViewData = GetViewShell()->GetViewData();
- ScDocument* pDoc = pViewData->GetDocument();
- SCTAB nTab = pViewData->GetTabNo();
+ ScViewData& rViewData = GetViewShell()->GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
+ SCTAB nTab = rViewData.GetTabNo();
return
pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_RIGHTCLICK, true ) ||
pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_DOUBLECLICK, true ) ||
@@ -1223,11 +1223,11 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
sal_Int32 nEvent = bDoubleClick ? SC_SHEETEVENT_DOUBLECLICK : SC_SHEETEVENT_RIGHTCLICK;
ScTabViewShell* pViewSh = GetViewShell();
- ScViewData* pViewData = pViewSh->GetViewData();
- ScDocShell* pDocSh = pViewData->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
- SCTAB nTab = pViewData->GetTabNo();
- const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab);
+ ScViewData& rViewData = pViewSh->GetViewData();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = rViewData.GetTabNo();
+ const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
if (pEvents)
{
const OUString* pScript = pEvents->GetScript(nEvent);
@@ -1256,7 +1256,7 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
// execute VBA event handler
if (!bReturn && xTarget.is()) try
{
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
// the parameter is the clicked object, as in the mousePressed call above
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[ 0 ] <<= xTarget;
@@ -1283,10 +1283,10 @@ bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e )
{
mbPendingSelectionChanged = false;
ScTabViewShell* pViewSh = GetViewShell();
- ScViewData* pViewData = pViewSh->GetViewData();
- ScDocShell* pDocSh = pViewData->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ ScViewData& rViewData = pViewSh->GetViewData();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[ 0 ] <<= getSelection();
xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_SELECT ), aArgs );
@@ -1450,7 +1450,7 @@ sal_Int16 ScTabViewObj::GetZoom(void) const
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- const Fraction& rZoomY = pViewSh->GetViewData()->GetZoomY(); // Y wird angezeigt
+ const Fraction& rZoomY = pViewSh->GetViewData().GetZoomY(); // Y wird angezeigt
return (sal_Int16)(( rZoomY.GetNumerator() * 100 ) / rZoomY.GetDenominator());
}
return 0;
@@ -1463,12 +1463,12 @@ void ScTabViewObj::SetZoom(sal_Int16 nZoom)
{
if ( nZoom != GetZoom() && nZoom != 0 )
{
- if (!pViewSh->GetViewData()->IsPagebreakMode())
+ if (!pViewSh->GetViewData().IsPagebreakMode())
{
ScModule* pScMod = SC_MOD();
ScAppOptions aNewOpt(pScMod->GetAppOptions());
aNewOpt.SetZoom( nZoom );
- aNewOpt.SetZoomType( pViewSh->GetViewData()->GetView()->GetZoomType() );
+ aNewOpt.SetZoomType( pViewSh->GetViewData().GetView()->GetZoomType() );
pScMod->SetAppOptions( aNewOpt );
}
}
@@ -1488,7 +1488,7 @@ sal_Int16 ScTabViewObj::GetZoomType(void) const
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- SvxZoomType eZoomType = pViewSh->GetViewData()->GetView()->GetZoomType();
+ SvxZoomType eZoomType = pViewSh->GetViewData().GetView()->GetZoomType();
switch (eZoomType)
{
case SVX_ZOOM_PERCENT:
@@ -1516,7 +1516,7 @@ void ScTabViewObj::SetZoomType(sal_Int16 aZoomType)
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScDBFunc* pView = pViewSh->GetViewData()->GetView();
+ ScDBFunc* pView = pViewSh->GetViewData().GetView();
if (pView)
{
SvxZoomType eZoomType;
@@ -1573,9 +1573,9 @@ sal_Bool SAL_CALL ScTabViewObj::getIsWindowSplit() throw(uno::RuntimeException,
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScViewData* pViewData = pViewSh->GetViewData();
- return ( pViewData->GetHSplitMode() == SC_SPLIT_NORMAL ||
- pViewData->GetVSplitMode() == SC_SPLIT_NORMAL );
+ ScViewData& rViewData = pViewSh->GetViewData();
+ return ( rViewData.GetHSplitMode() == SC_SPLIT_NORMAL ||
+ rViewData.GetVSplitMode() == SC_SPLIT_NORMAL );
}
return false;
@@ -1589,9 +1589,9 @@ sal_Bool SAL_CALL ScTabViewObj::hasFrozenPanes() throw(uno::RuntimeException, st
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScViewData* pViewData = pViewSh->GetViewData();
- return ( pViewData->GetHSplitMode() == SC_SPLIT_FIX ||
- pViewData->GetVSplitMode() == SC_SPLIT_FIX );
+ ScViewData& rViewData = pViewSh->GetViewData();
+ return ( rViewData.GetHSplitMode() == SC_SPLIT_FIX ||
+ rViewData.GetVSplitMode() == SC_SPLIT_FIX );
}
return false;
@@ -1603,9 +1603,9 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitHorizontal() throw(uno::RuntimeExceptio
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScViewData* pViewData = pViewSh->GetViewData();
- if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE )
- return pViewData->GetHSplitPos();
+ ScViewData& rViewData = pViewSh->GetViewData();
+ if ( rViewData.GetHSplitMode() != SC_SPLIT_NONE )
+ return rViewData.GetHSplitPos();
}
return 0;
}
@@ -1616,9 +1616,9 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitVertical() throw(uno::RuntimeException,
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScViewData* pViewData = pViewSh->GetViewData();
- if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE )
- return pViewData->GetVSplitPos();
+ ScViewData& rViewData = pViewSh->GetViewData();
+ if ( rViewData.GetVSplitMode() != SC_SPLIT_NONE )
+ return rViewData.GetVSplitPos();
}
return 0;
}
@@ -1630,18 +1630,18 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitColumn()
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScViewData* pViewData = pViewSh->GetViewData();
- if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE )
+ ScViewData& rViewData = pViewSh->GetViewData();
+ if ( rViewData.GetHSplitMode() != SC_SPLIT_NONE )
{
- long nSplit = pViewData->GetHSplitPos();
+ long nSplit = rViewData.GetHSplitPos();
ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
- if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE )
+ if ( rViewData.GetVSplitMode() != SC_SPLIT_NONE )
ePos = SC_SPLIT_TOPLEFT;
SCsCOL nCol;
SCsROW nRow;
- pViewData->GetPosFromPixel( nSplit, 0, ePos, nCol, nRow, false );
+ rViewData.GetPosFromPixel( nSplit, 0, ePos, nCol, nRow, false );
if ( nCol > 0 )
return nCol;
}
@@ -1655,15 +1655,15 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitRow() throw(uno::RuntimeException, std:
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScViewData* pViewData = pViewSh->GetViewData();
- if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE )
+ ScViewData& rViewData = pViewSh->GetViewData();
+ if ( rViewData.GetVSplitMode() != SC_SPLIT_NONE )
{
- long nSplit = pViewData->GetVSplitPos();
+ long nSplit = rViewData.GetVSplitPos();
ScSplitPos ePos = SC_SPLIT_TOPLEFT; // es ist vertikal geteilt
SCsCOL nCol;
SCsROW nRow;
- pViewData->GetPosFromPixel( 0, nSplit, ePos, nCol, nRow, false );
+ rViewData.GetPosFromPixel( 0, nSplit, ePos, nCol, nRow, false );
if ( nRow > 0 )
return nRow;
}
@@ -1700,8 +1700,8 @@ void SAL_CALL ScTabViewObj::freezeAtPosition( sal_Int32 nColumns, sal_Int32 nRow
if (pWin)
aWinStart = pWin->GetPosPixel();
- ScViewData* pViewData = pViewSh->GetViewData();
- Point aSplit(pViewData->GetScrPos( (SCCOL)nColumns, (SCROW)nRows, SC_SPLIT_BOTTOMLEFT, true ));
+ ScViewData& rViewData = pViewSh->GetViewData();
+ Point aSplit(rViewData.GetScrPos( (SCCOL)nColumns, (SCROW)nRows, SC_SPLIT_BOTTOMLEFT, true ));
aSplit += aWinStart;
pViewSh->SplitAtPixel( aSplit, true, true );
@@ -1742,7 +1742,7 @@ void ScTabViewObj::SelectionChanged()
// Note: executing this slot through the dispatcher
// will cause the style dialog to be raised so we go
// direct here
- ScFormatShell aShell( GetViewShell()->GetViewData() );
+ ScFormatShell aShell( &GetViewShell()->GetViewData() );
SfxAllItemSet reqList( SFX_APP()->GetPool() );
SfxRequest aReq( SID_STYLE_END_PREVIEW, 0, reqList );
aShell.ExecuteStyle( aReq );
@@ -1753,11 +1753,11 @@ void ScTabViewObj::SelectionChanged()
// handle sheet events
ScTabViewShell* pViewSh = GetViewShell();
- ScViewData* pViewData = pViewSh->GetViewData();
- ScDocShell* pDocSh = pViewData->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
- SCTAB nTab = pViewData->GetTabNo();
- const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab);
+ ScViewData& rViewData = pViewSh->GetViewData();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = rViewData.GetTabNo();
+ const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
if (pEvents)
{
const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_SELECT);
@@ -1777,7 +1777,7 @@ void ScTabViewObj::SelectionChanged()
mbPendingSelectionChanged = false;
try
{
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[ 0 ] <<= getSelection();
xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_SELECT ), aArgs );
@@ -1823,8 +1823,8 @@ void SAL_CALL ScTabViewObj::setPropertyValue(
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- ScViewData* pViewData = pViewSh->GetViewData();
- const ScViewOptions& rOldOpt = pViewSh->GetViewData()->GetOptions();
+ ScViewData& rViewData = pViewSh->GetViewData();
+ const ScViewOptions& rOldOpt = pViewSh->GetViewData().GetOptions();
ScViewOptions aNewOpt(rOldOpt);
if ( aString.equalsAscii( SC_UNO_COLROWHDR ) || aString.equalsAscii( OLD_UNO_COLROWHDR ) )
@@ -1912,9 +1912,9 @@ void SAL_CALL ScTabViewObj::setPropertyValue(
if ( aNewOpt != rOldOpt )
{
- pViewData->SetOptions( aNewOpt );
- pViewData->GetDocument()->SetViewOptions( aNewOpt );
- pViewData->GetDocShell()->SetDocumentModified(); //! wirklich?
+ rViewData.SetOptions( aNewOpt );
+ rViewData.GetDocument()->SetViewOptions( aNewOpt );
+ rViewData.GetDocShell()->SetDocumentModified(); //! wirklich?
pViewSh->UpdateFixPos();
pViewSh->PaintGrid();
@@ -1947,7 +1947,7 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- const ScViewOptions& rOpt = pViewSh->GetViewData()->GetOptions();
+ const ScViewOptions& rOpt = pViewSh->GetViewData().GetOptions();
if ( aString.equalsAscii( SC_UNO_COLROWHDR ) || aString.equalsAscii( OLD_UNO_COLROWHDR ) )
ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HEADER ) );
@@ -1977,8 +1977,8 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName
else if ( aString.equalsAscii( SC_UNO_ZOOMVALUE ) ) aRet <<= GetZoom();
else if ( aString.equalsAscii( SC_UNO_VISAREASCREEN ) )
{
- ScViewData* pViewData = pViewSh->GetViewData();
- Window* pActiveWin = ( pViewData ? pViewData->GetActiveWin() : NULL );
+ ScViewData& rViewData = pViewSh->GetViewData();
+ Window* pActiveWin = rViewData.GetActiveWin();
if ( pActiveWin )
{
Rectangle aRect = pActiveWin->GetWindowExtentsRelative( NULL );
@@ -2256,8 +2256,8 @@ ScTabViewObj* ScTabViewObj::getImplementation( const uno::Reference<uno::XInterf
ScDrawTextObjectBar* pTextShell = PTR_CAST( ScDrawTextObjectBar, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) );
if (pTextShell)
{
- ScViewData* pViewData = GetViewShell()->GetViewData();
- ScDrawView* pView = pViewData->GetScDrawView();
+ ScViewData& rViewData = GetViewShell()->GetViewData();
+ ScDrawView* pView = rViewData.GetScDrawView();
OutlinerView* pOutView = pView->GetTextEditOutlinerView();
if (pOutView)
return pOutView->GetEditView().GetTransferable();
@@ -2286,8 +2286,8 @@ void SAL_CALL ScTabViewObj::insertTransferable( const ::com::sun::star::uno::Ref
ScDrawTextObjectBar* pTextShell = PTR_CAST( ScDrawTextObjectBar, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) );
if (pTextShell)
{
- ScViewData* pViewData = GetViewShell()->GetViewData();
- ScDrawView* pView = pViewData->GetScDrawView();
+ ScViewData& rViewData = GetViewShell()->GetViewData();
+ ScDrawView* pView = rViewData.GetScDrawView();
OutlinerView* pOutView = pView->GetTextEditOutlinerView();
if ( pOutView )
{
@@ -2321,21 +2321,19 @@ uno::Sequence<sal_Int32> ScTabViewObj::getSelectedSheets()
if (!pViewSh)
return uno::Sequence<sal_Int32>();
- ScViewData* pViewData = pViewSh->GetViewData();
- if (!pViewData)
- return uno::Sequence<sal_Int32>();
+ ScViewData& rViewData = pViewSh->GetViewData();
// #i95280# when printing from the shell, the view is never activated,
// so Excel view settings must also be evaluated here.
- ScExtDocOptions* pExtOpt = pViewData->GetDocument()->GetExtDocOptions();
+ ScExtDocOptions* pExtOpt = rViewData.GetDocument()->GetExtDocOptions();
if (pExtOpt && pExtOpt->IsChanged())
{
- pViewSh->GetViewData()->ReadExtOptions(*pExtOpt); // Excel view settings
- pViewSh->SetTabNo(pViewSh->GetViewData()->GetTabNo(), true);
+ pViewSh->GetViewData().ReadExtOptions(*pExtOpt); // Excel view settings
+ pViewSh->SetTabNo(pViewSh->GetViewData().GetTabNo(), true);
pExtOpt->SetChanged(false);
}
- return toSequence(pViewData->GetMarkData().GetSelectedTabs());
+ return toSequence(rViewData.GetMarkData().GetSelectedTabs());
}
ScPreviewObj::ScPreviewObj(ScPreviewShell* pViewSh) :
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index ef7ebc1ad8d8..96c76a725612 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -98,7 +98,7 @@ void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom
{
ScTabViewShell* pViewSh = excel::getBestViewShell( xModel );
Fraction aFract( nZoom, 100 );
- pViewSh->GetViewData()->SetZoom( aFract, aFract, nTabs );
+ pViewSh->GetViewData().SetZoom( aFract, aFract, nTabs );
pViewSh->RefreshZoom();
}
@@ -195,8 +195,8 @@ void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, sal_uInt16
ScTabViewShell* pTabViewShell = getBestViewShell( xModel );
if ( pTabViewShell )
{
- ScViewData* pView = pTabViewShell->GetViewData();
- Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
+ ScViewData& rView = pTabViewShell->GetViewData();
+ Window* pWin = rView.GetActiveWin();
if (pWin)
{
ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
@@ -319,21 +319,21 @@ void setUpDocumentModules( const uno::Reference< sheet::XSpreadsheetDocument >&
uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess( xSF->createInstance("ooo.vba.VBAObjectModuleObjectProvider"), uno::UNO_QUERY_THROW );
// set up the module info for the workbook and sheets in the nealy created
// spreadsheet
- ScDocument* pDoc = pShell->GetDocument();
- OUString sCodeName = pDoc->GetCodeName();
+ ScDocument& rDoc = pShell->GetDocument();
+ OUString sCodeName = rDoc.GetCodeName();
if ( sCodeName.isEmpty() )
{
sCodeName = "ThisWorkbook";
- pDoc->SetCodeName( sCodeName );
+ rDoc.SetCodeName( sCodeName );
}
std::vector< OUString > sDocModuleNames;
sDocModuleNames.push_back( sCodeName );
- for ( SCTAB index = 0; index < pDoc->GetTableCount(); index++)
+ for ( SCTAB index = 0; index < rDoc.GetTableCount(); index++)
{
OUString aName;
- pDoc->GetCodeName( index, aName );
+ rDoc.GetCodeName( index, aName );
sDocModuleNames.push_back( aName );
}
@@ -359,7 +359,7 @@ void setUpDocumentModules( const uno::Reference< sheet::XSpreadsheetDocument >&
itself as listener for specific events. */
try
{
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pShell->GetDocument()->GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pShell->GetDocument().GetVbaEventProcessor(), uno::UNO_SET_THROW );
uno::Sequence< uno::Any > aArgs;
xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKBOOK_OPEN, aArgs );
}
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 95de99017ab2..c050f1153c53 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -302,12 +302,10 @@ ScVbaApplication::getActiveCell() throw (uno::RuntimeException, std::exception )
ScTabViewShell* pViewShell = excel::getCurrentBestViewShell(mxContext);
if ( !pViewShell )
throw uno::RuntimeException("No ViewShell available" );
- ScViewData* pTabView = pViewShell->GetViewData();
- if ( !pTabView )
- throw uno::RuntimeException("No ViewData available" );
+ ScViewData& rTabView = pViewShell->GetViewData();
- sal_Int32 nCursorX = pTabView->GetCurX();
- sal_Int32 nCursorY = pTabView->GetCurY();
+ sal_Int32 nCursorX = rTabView.GetCurX();
+ sal_Int32 nCursorY = rTabView.GetCurY();
// #i117392# excel::getUnoSheetModuleObj() may return null in documents without global VBA mode enabled
return new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) );
@@ -576,9 +574,9 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) thro
{
xVbaSheetRange->Select();
uno::Reference< excel::XWindow > xWindow = getActiveWindow();
- ScSplitPos eWhich = pShell->GetViewData()->GetActivePart();
- sal_Int32 nValueX = pShell->GetViewData()->GetPosX(WhichH(eWhich));
- sal_Int32 nValueY = pShell->GetViewData()->GetPosY(WhichV(eWhich));
+ ScSplitPos eWhich = pShell->GetViewData().GetActivePart();
+ sal_Int32 nValueX = pShell->GetViewData().GetPosX(WhichH(eWhich));
+ sal_Int32 nValueY = pShell->GetViewData().GetPosY(WhichV(eWhich));
xWindow->SmallScroll( uno::makeAny( (sal_Int16)(xVbaSheetRange->getRow() - 1) ),
uno::makeAny( (sal_Int16)nValueY ),
uno::makeAny( (sal_Int16)(xVbaSheetRange->getColumn() - 1) ),
@@ -616,9 +614,9 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) thro
{
xVbaRange->Select();
uno::Reference< excel::XWindow > xWindow = getActiveWindow();
- ScSplitPos eWhich = pShell->GetViewData()->GetActivePart();
- sal_Int32 nValueX = pShell->GetViewData()->GetPosX(WhichH(eWhich));
- sal_Int32 nValueY = pShell->GetViewData()->GetPosY(WhichV(eWhich));
+ ScSplitPos eWhich = pShell->GetViewData().GetActivePart();
+ sal_Int32 nValueX = pShell->GetViewData().GetPosX(WhichH(eWhich));
+ sal_Int32 nValueY = pShell->GetViewData().GetPosY(WhichV(eWhich));
xWindow->SmallScroll( uno::makeAny( (sal_Int16)(xVbaRange->getRow() - 1) ),
uno::makeAny( (sal_Int16)nValueY ),
uno::makeAny( (sal_Int16)(xVbaRange->getColumn() - 1) ),
@@ -772,7 +770,7 @@ ScVbaApplication::getDisplayScrollBars() throw (uno::RuntimeException, std::exc
ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext );
if ( pShell )
{
- return ( pShell->GetViewData()->IsHScrollMode() && pShell->GetViewData()->IsVScrollMode() );
+ return ( pShell->GetViewData().IsHScrollMode() && pShell->GetViewData().IsVScrollMode() );
}
return true;
}
@@ -1225,8 +1223,8 @@ ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeExc
{
OSL_TRACE("ScVbaApplication::Volatile() In method ->%s<-", OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
uno::Reference< frame::XModel > xModel( getCurrentDocument() );
- ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- pDoc->GetMacroManager()->SetUserFuncVolatile( pMeth->GetName(), bVolatile);
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ rDoc.GetMacroManager()->SetUserFuncVolatile( pMeth->GetName(), bVolatile);
}
// this is bound to break when loading the document
diff --git a/sc/source/ui/vba/vbachart.cxx b/sc/source/ui/vba/vbachart.cxx
index 811768a374fd..18214850e401 100644
--- a/sc/source/ui/vba/vbachart.cxx
+++ b/sc/source/ui/vba/vbachart.cxx
@@ -579,13 +579,9 @@ ScVbaChart::setSourceData( const css::uno::Reference< ::ooo::vba::excel::XRange
ScVbaRange* pRange = static_cast< ScVbaRange* >( _xCalcRange.get() );
if ( pRange )
{
- ScDocument* pDoc = pRange->getScDocument();
- if ( pDoc )
- {
- bsetRowHeaders = pDoc->HasRowHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ) );
- bsetColumnHeaders = pDoc->HasColHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ));
-;
- }
+ ScDocument& rDoc = pRange->getScDocument();
+ bsetRowHeaders = rDoc.HasRowHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ) );
+ bsetColumnHeaders = rDoc.HasColHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ));
}
mxTableChart->setHasRowHeaders(bsetRowHeaders);
mxTableChart->setHasColumnHeaders(bsetColumnHeaders);
diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx
index c506dded4893..c4c42a1c30f8 100644
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -510,7 +510,7 @@ ScVbaEventsHelper::ScVbaEventsHelper( const uno::Sequence< uno::Any >& rArgs, co
mbOpened( false )
{
mpDocShell = dynamic_cast< ScDocShell* >( mpShell ); // mpShell from base class
- mpDoc = mpDocShell ? mpDocShell->GetDocument() : 0;
+ mpDoc = mpDocShell ? &mpDocShell->GetDocument() : 0;
if( !mxModel.is() || !mpDocShell || !mpDoc )
return;
diff --git a/sc/source/ui/vba/vbaname.cxx b/sc/source/ui/vba/vbaname.cxx
index f80eaf534519..4949384b17fc 100644
--- a/sc/source/ui/vba/vbaname.cxx
+++ b/sc/source/ui/vba/vbaname.cxx
@@ -130,12 +130,12 @@ void ScVbaName::setContent( const OUString& rContent, const formula::FormulaGra
if ( pNamedRange && pNamedRange->pDocShell )
{
- ScDocument* pDoc = pNamedRange->pDocShell->GetDocument();
+ ScDocument& rDoc = pNamedRange->pDocShell->GetDocument();
ScRangeData* pOldData = pNamedRange->GetRangeData_Impl();
if (pOldData)
{
// Shorter way of doing this ?
- ScCompiler aComp( pDoc, pOldData->GetPos() );
+ ScCompiler aComp( &rDoc, pOldData->GetPos() );
aComp.SetGrammar( eGrammar );
boost::scoped_ptr<ScTokenArray> pArray(aComp.CompileString(sContent));
pOldData->SetCode(*pArray);
diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx
index c93fdbac564b..8cf18ec2183e 100644
--- a/sc/source/ui/vba/vbanames.cxx
+++ b/sc/source/ui/vba/vbanames.cxx
@@ -78,10 +78,8 @@ ScVbaNames::getScDocument()
ScTabViewShell * pTabViewShell = excel::getBestViewShell( xModel );
if ( !pTabViewShell )
throw uno::RuntimeException( "No ViewShell available" );
- ScViewData* pViewData = pTabViewShell->GetViewData();
- if ( !pViewData )
- throw uno::RuntimeException( "No ViewData available" );
- return pViewData->GetDocument();
+ ScViewData& rViewData = pTabViewShell->GetViewData();
+ return rViewData.GetDocument();
}
diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx
index f422778ccb0b..7f91a80da576 100644
--- a/sc/source/ui/vba/vbapagesetup.cxx
+++ b/sc/source/ui/vba/vbapagesetup.cxx
@@ -82,8 +82,8 @@ OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeExcepti
ScUnoConversion::FillScRange( aRange, aSeq[i] );
aRangeList.Append( aRange );
}
- ScDocument* pDoc = excel::getDocShell( mxModel )->GetDocument();
- aRangeList.Format( aPrintArea, nFlags, pDoc, formula::FormulaGrammar::CONV_XL_A1, ',' );
+ ScDocument& rDoc = excel::getDocShell( mxModel )->GetDocument();
+ aRangeList.Format( aPrintArea, nFlags, &rDoc, formula::FormulaGrammar::CONV_XL_A1, ',' );
}
return aPrintArea;
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 75d34169cf2c..57d3ec747257 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -274,18 +274,16 @@ void ScVbaRange::fireChangeEvent()
{
if( ScVbaApplication::getDocumentEventsEnabled() )
{
- if( ScDocument* pDoc = getScDocument() )
+ ScDocument& rDoc = getScDocument();
+ uno::Reference< script::vba::XVBAEventProcessor > xVBAEvents = rDoc.GetVbaEventProcessor();
+ if( xVBAEvents.is() ) try
+ {
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] <<= uno::Reference< excel::XRange >( this );
+ xVBAEvents->processVbaEvent( script::vba::VBAEventId::WORKSHEET_CHANGE, aArgs );
+ }
+ catch( uno::Exception& )
{
- uno::Reference< script::vba::XVBAEventProcessor > xVBAEvents = pDoc->GetVbaEventProcessor();
- if( xVBAEvents.is() ) try
- {
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= uno::Reference< excel::XRange >( this );
- xVBAEvents->processVbaEvent( script::vba::VBAEventId::WORKSHEET_CHANGE, aArgs );
- }
- catch( uno::Exception& )
- {
- }
}
}
}
@@ -426,17 +424,17 @@ uno::Reference< frame::XModel > getModelFromRange( const uno::Reference< table::
return getModelFromXIf( xIf );
}
-ScDocument*
+ScDocument&
getDocumentFromRange( const uno::Reference< table::XCellRange >& xRange )
{
ScDocShell* pDocShell = getDocShellFromRange( xRange );
if ( !pDocShell )
throw uno::RuntimeException("Failed to access underlying docshell from uno range object" );
- ScDocument* pDoc = pDocShell->GetDocument();
- return pDoc;
+ ScDocument& rDoc = pDocShell->GetDocument();
+ return rDoc;
}
-ScDocument*
+ScDocument&
ScVbaRange::getScDocument() throw (uno::RuntimeException)
{
if ( mxRanges.is() )
@@ -1157,12 +1155,11 @@ bool
ScVbaRange::getCellRangesForAddress( sal_uInt16& rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention& eConv, char cDelimiter )
{
- ScDocument* pDoc = NULL;
if ( pDocSh )
{
- pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
sal_uInt16 nMask = SCA_VALID;
- rResFlags = rCellRanges.Parse( sAddress, pDoc, nMask, eConv, 0, cDelimiter );
+ rResFlags = rCellRanges.Parse( sAddress, &rDoc, nMask, eConv, 0, cDelimiter );
if ( rResFlags & SCA_VALID )
{
return true;
@@ -1203,17 +1200,14 @@ bool getScRangeListForAddress( const OUString& sName, ScDocShell* pDocSh, ScRang
if ( !xNameAccess->hasByName( sAddress ) )
{
// try a local name
- ScDocument* pDoc = pDocSh->GetDocument();
- if ( pDoc )
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nCurTab = ScDocShell::GetCurTab();
+ ScRangeName* pRangeName = rDoc.GetRangeName(nCurTab);
+ if (pRangeName)
{
- SCTAB nCurTab = ScDocShell::GetCurTab();
- ScRangeName* pRangeName = pDoc->GetRangeName(nCurTab);
- if (pRangeName)
- {
- bLocalName = pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(sAddress)) != NULL;
- // TODO: Handle local names correctly.
- (void)bLocalName;
- }
+ bLocalName = pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(sAddress)) != NULL;
+ // TODO: Handle local names correctly.
+ (void)bLocalName;
}
}
char aChar = 0;
@@ -1223,7 +1217,7 @@ bool getScRangeListForAddress( const OUString& sName, ScDocShell* pDocSh, ScRang
sAddress = xNamed->getContent();
// As the address comes from OOO, the addressing
// style is may not be XL_A1
- eConv = pDocSh->GetDocument()->GetAddressConvention();
+ eConv = pDocSh->GetDocument().GetAddressConvention();
aChar = ';';
}
@@ -1367,7 +1361,7 @@ util::TriState lclGetMergedState( const uno::Reference< table::XCellRange >& rxC
of a merged range is part of this range are not covered. */
ScRange aScRange;
ScUnoConversion::FillScRange( aScRange, aRangeAddr );
- bool bHasMerged = getDocumentFromRange( rxCellRange )->HasAttrib( aScRange, HASATTR_MERGED | HASATTR_OVERLAPPED );
+ bool bHasMerged = getDocumentFromRange( rxCellRange ).HasAttrib( aScRange, HASATTR_MERGED | HASATTR_OVERLAPPED );
return bHasMerged ? util::TriState_INDETERMINATE : util::TriState_NO;
}
@@ -1424,10 +1418,8 @@ static uno::Reference< XCollection >
lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno::Reference<uno::XComponentContext>& xContext, const uno::Reference< table::XCellRange >& xRange ) throw( uno::RuntimeException )
{
uno::Reference< XHelperInterface > xParent( xParentRange, uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocumentFromRange(xRange);
- if ( !pDoc )
- throw uno::RuntimeException("Failed to access document from shell" );
- ScVbaPalette aPalette( pDoc->GetDocumentShell() );
+ ScDocument& rDoc = getDocumentFromRange(xRange);
+ ScVbaPalette aPalette( rDoc.GetDocumentShell() );
uno::Reference< XCollection > borders( new ScVbaBorders( xParent, xContext, xRange, aPalette ) );
return borders;
}
@@ -1667,7 +1659,7 @@ ScVbaRange::setFormulaValue( const uno::Any& rFormula, formula::FormulaGrammar::
aVisitor.visit( valueProcessor );
return;
}
- CellFormulaValueSetter formulaValueSetter( rFormula, getScDocument(), eGram );
+ CellFormulaValueSetter formulaValueSetter( rFormula, &getScDocument(), eGram );
setValue( rFormula, formulaValueSetter, bFireEvent );
}
@@ -1683,7 +1675,7 @@ ScVbaRange::getFormulaValue( formula::FormulaGrammar::Grammar eGram ) throw (uno
uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
return xRange->getFormula();
}
- CellFormulaValueGetter valueGetter( getScDocument(), eGram );
+ CellFormulaValueGetter valueGetter( &getScDocument(), eGram );
return getValue( valueGetter );
}
@@ -2023,7 +2015,7 @@ ScVbaRange::setFormulaArray(const uno::Any& rFormula) throw (uno::RuntimeExcepti
rFormula >>= sFormula;
uno::Sequence<sheet::FormulaToken> aTokens = xParser->parseFormula( sFormula, aAddress );
ScTokenArray aTokenArray;
- (void)ScTokenConversion::ConvertToTokenArray( *getScDocument(), aTokenArray, aTokens );
+ (void)ScTokenConversion::ConvertToTokenArray( getScDocument(), aTokenArray, aTokens );
getScDocShell()->GetDocFunc().EnterMatrix( *getScRangeList()[0], NULL, &aTokenArray, OUString(), true, true, EMPTY_OUSTRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
@@ -2089,7 +2081,7 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut
}
sal_uInt16 nFlags = SCA_VALID;
ScDocShell* pDocShell = getScDocShell();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
RangeHelper thisRange( mxRange );
table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
@@ -2126,22 +2118,20 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut
table::CellRangeAddress refAddress = getCellRangeAddressForVBARange( RelativeTo, pDocShell );
dDetails = ScAddress::Details( formula::FormulaGrammar::CONV_XL_R1C1, static_cast< SCROW >( refAddress.StartRow ), static_cast< SCCOL >( refAddress.StartColumn ) );
}
- return aRange.Format(nFlags, pDoc, dDetails);
+ return aRange.Format(nFlags, &rDoc, dDetails);
}
uno::Reference < excel::XFont >
ScVbaRange::Font() throw ( script::BasicErrorException, uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY );
- ScDocument* pDoc = getScDocument();
+ ScDocument& rDoc = getScDocument();
if ( mxRange.is() )
xProps.set(mxRange, ::uno::UNO_QUERY );
else if ( mxRanges.is() )
xProps.set(mxRanges, ::uno::UNO_QUERY );
- if ( !pDoc )
- throw uno::RuntimeException("Failed to access document from shell" );
- ScVbaPalette aPalette( pDoc->GetDocumentShell() );
+ ScVbaPalette aPalette( rDoc.GetDocumentShell() );
ScCellRangeObj* pRangeObj = NULL;
try
{
@@ -2210,7 +2200,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
{
ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRange tmpRange;
- sal_uInt16 flags = tmpRange.ParseCols( sCol, getDocumentFromRange( xRange ), dDetails );
+ sal_uInt16 flags = tmpRange.ParseCols( sCol, &getDocumentFromRange( xRange ), dDetails );
if ( ( flags & 0x200 ) != 0x200 )
throw uno::RuntimeException();
nColumn = tmpRange.aStart.Col() + 1;
@@ -2387,7 +2377,7 @@ ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException, std::exc
{
ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRange tmpRange;
- tmpRange.ParseRows( sAddress, getDocumentFromRange( mxRange ), dDetails );
+ tmpRange.ParseRows( sAddress, &getDocumentFromRange( mxRange ), dDetails );
SCROW nStartRow = tmpRange.aStart.Row();
SCROW nEndRow = tmpRange.aEnd.Row();
@@ -2431,7 +2421,7 @@ ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException, std::
{
ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRange tmpRange;
- tmpRange.ParseCols( sAddress, getDocumentFromRange( mxRange ), dDetails );
+ tmpRange.ParseCols( sAddress, &getDocumentFromRange( mxRange ), dDetails );
SCCOL nStartCol = tmpRange.aStart.Col();
SCCOL nEndCol = tmpRange.aEnd.Col();
@@ -2691,7 +2681,7 @@ ScVbaRange::getWrapText() throw (script::BasicErrorException, uno::RuntimeExcept
uno::Reference< excel::XInterior > ScVbaRange::Interior( ) throw ( script::BasicErrorException, uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xProps( mxRange, uno::UNO_QUERY_THROW );
- return new ScVbaInterior ( this, mxContext, xProps, getScDocument() );
+ return new ScVbaInterior ( this, mxContext, xProps, &getScDocument() );
}
uno::Reference< excel::XRange >
ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2 ) throw (uno::RuntimeException, std::exception)
@@ -3400,15 +3390,13 @@ ScVbaRange::Sort( const uno::Any& Key1, const uno::Any& Order1, const uno::Any&
sal_Int16 nDataOption2 = excel::XlSortDataOption::xlSortNormal;
sal_Int16 nDataOption3 = excel::XlSortDataOption::xlSortNormal;
- ScDocument* pDoc = getScDocument();
- if ( !pDoc )
- throw uno::RuntimeException("Failed to access document from shell" );
+ ScDocument& rDoc = getScDocument();
RangeHelper thisRange( mxRange );
table::CellRangeAddress thisRangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
ScSortParam aSortParam;
SCTAB nTab = thisRangeAddress.Sheet;
- pDoc->GetSortParam( aSortParam, nTab );
+ rDoc.GetSortParam( aSortParam, nTab );
if ( DataOption1.hasValue() )
DataOption1 >>= nDataOption1;
@@ -3464,8 +3452,8 @@ ScVbaRange::Sort( const uno::Any& Key1, const uno::Any& Order1, const uno::Any&
if ( nHeader == excel::XlYesNoGuess::xlGuess )
{
- bool bHasColHeader = pDoc->HasColHeader( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), static_cast< SCCOL >( thisRangeAddress.EndColumn ), static_cast< SCROW >( thisRangeAddress.EndRow ), static_cast< SCTAB >( thisRangeAddress.Sheet ));
- bool bHasRowHeader = pDoc->HasRowHeader( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), static_cast< SCCOL >( thisRangeAddress.EndColumn ), static_cast< SCROW >( thisRangeAddress.EndRow ), static_cast< SCTAB >( thisRangeAddress.Sheet ) );
+ bool bHasColHeader = rDoc.HasColHeader( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), static_cast< SCCOL >( thisRangeAddress.EndColumn ), static_cast< SCROW >( thisRangeAddress.EndRow ), static_cast< SCTAB >( thisRangeAddress.Sheet ));
+ bool bHasRowHeader = rDoc.HasRowHeader( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), static_cast< SCCOL >( thisRangeAddress.EndColumn ), static_cast< SCROW >( thisRangeAddress.EndRow ), static_cast< SCTAB >( thisRangeAddress.Sheet ) );
if ( bHasColHeader || bHasRowHeader )
nHeader = excel::XlYesNoGuess::xlYes;
else
@@ -3559,7 +3547,7 @@ ScVbaRange::Sort( const uno::Any& Key1, const uno::Any& Order1, const uno::Any&
nIndex = findSortPropertyIndex( sortDescriptor, CONTS_HEADER );
sortDescriptor[ nIndex ].Value <<= bContainsHeader;
- pDoc->SetSortParam( aSortParam, nTab );
+ rDoc.SetSortParam( aSortParam, nTab );
xSort->sort( sortDescriptor );
// #FIXME #TODO
@@ -3663,12 +3651,10 @@ ScVbaRange::characters( const uno::Any& Start, const uno::Any& Length ) throw (u
if ( !isSingleCellRange() )
throw uno::RuntimeException("Can't create Characters property for multicell range " );
uno::Reference< text::XSimpleText > xSimple(mxRange->getCellByPosition(0,0) , uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocumentFromRange(mxRange);
- if ( !pDoc )
- throw uno::RuntimeException("Failed to access document from shell" );
+ ScDocument& rDoc = getDocumentFromRange(mxRange);
- ScVbaPalette aPalette( pDoc->GetDocumentShell() );
- return new ScVbaCharacters( this, mxContext, aPalette, xSimple, Start, Length );
+ ScVbaPalette aPalette( rDoc.GetDocumentShell() );
+ return new ScVbaCharacters( this, mxContext, aPalette, xSimple, Start, Length );
}
void SAL_CALL
@@ -3761,8 +3747,8 @@ double
ScVbaRange::getCalcColWidth(const table::CellRangeAddress& rAddress)
throw (uno::RuntimeException, std::exception)
{
- ScDocument* pDoc = getScDocument();
- sal_uInt16 nWidth = pDoc->GetOriginalWidth( static_cast< SCCOL >( rAddress.StartColumn ), static_cast< SCTAB >( rAddress.Sheet ) );
+ ScDocument& rDoc = getScDocument();
+ sal_uInt16 nWidth = rDoc.GetOriginalWidth( static_cast< SCCOL >( rAddress.StartColumn ), static_cast< SCTAB >( rAddress.Sheet ) );
double nPoints = lcl_TwipsToPoints( nWidth );
nPoints = lcl_Round2DecPlaces( nPoints );
return nPoints;
@@ -3772,8 +3758,8 @@ double
ScVbaRange::getCalcRowHeight(const table::CellRangeAddress& rAddress)
throw (uno::RuntimeException, std::exception)
{
- ScDocument* pDoc = getDocumentFromRange( mxRange );
- sal_uInt16 nWidth = pDoc->GetOriginalHeight( rAddress.StartRow, rAddress.Sheet );
+ ScDocument& rDoc = getDocumentFromRange( mxRange );
+ sal_uInt16 nWidth = rDoc.GetOriginalHeight( rAddress.StartRow, rAddress.Sheet );
double nPoints = lcl_TwipsToPoints( nWidth );
nPoints = lcl_Round2DecPlaces( nPoints );
return nPoints;
@@ -3782,9 +3768,9 @@ ScVbaRange::getCalcRowHeight(const table::CellRangeAddress& rAddress)
// return Char Width in points
double getDefaultCharWidth( ScDocShell* pDocShell )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- OutputDevice* pRefDevice = pDoc->GetRefDevice();
- ScPatternAttr* pAttr = pDoc->GetDefPattern();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ OutputDevice* pRefDevice = rDoc.GetRefDevice();
+ ScPatternAttr* pAttr = rDoc.GetDefPattern();
::Font aDefFont;
pAttr->GetFont( aDefFont, SC_AUTOCOL_BLACK, pRefDevice );
pRefDevice->SetFont( aDefFont );
@@ -3815,7 +3801,7 @@ ScVbaRange::getColumnWidth() throw (uno::RuntimeException, std::exception)
for( sal_Int32 nCol = nStartCol ; nCol <= nEndCol; ++nCol )
{
thisAddress.StartColumn = nCol;
- sal_uInt16 nCurTwips = pShell->GetDocument()->GetOriginalWidth( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCTAB >( thisAddress.Sheet ) );
+ sal_uInt16 nCurTwips = pShell->GetDocument().GetOriginalWidth( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCTAB >( thisAddress.Sheet ) );
if ( nCol == nStartCol )
nColTwips = nCurTwips;
if ( nColTwips != nCurTwips )
@@ -3983,7 +3969,7 @@ ScVbaRange::getRowHeight()
for ( sal_Int32 nRow = nStartRow ; nRow <= nEndRow; ++nRow )
{
thisAddress.StartRow = nRow;
- sal_uInt16 nCurTwips = pShell->GetDocument()->GetOriginalHeight( thisAddress.StartRow, thisAddress.Sheet );
+ sal_uInt16 nCurTwips = pShell->GetDocument().GetOriginalHeight( thisAddress.StartRow, thisAddress.Sheet );
if ( nRow == nStartRow )
nRowTwips = nCurTwips;
if ( nRowTwips != nCurTwips )
@@ -4037,13 +4023,13 @@ ScVbaRange::getPageBreak() throw (uno::RuntimeException, std::exception)
uno::Reference< frame::XModel > xModel = pShell->GetModel();
if ( xModel.is() )
{
- ScDocument* pDoc = getDocumentFromRange( mxRange );
+ ScDocument& rDoc = getDocumentFromRange( mxRange );
ScBreakType nBreak = BREAK_NONE;
if ( !bColumn )
- nBreak = pDoc->HasRowBreak(thisAddress.StartRow, thisAddress.Sheet);
+ nBreak = rDoc.HasRowBreak(thisAddress.StartRow, thisAddress.Sheet);
else
- nBreak = pDoc->HasColBreak(thisAddress.StartColumn, thisAddress.Sheet);
+ nBreak = rDoc.HasColBreak(thisAddress.StartColumn, thisAddress.Sheet);
if (nBreak & BREAK_PAGE)
nPageBreak = excel::XlPageBreak::xlPageBreakAutomatic;
@@ -4276,7 +4262,7 @@ static ScDBData* lcl_GetDBData_Impl( ScDocShell* pDocShell, sal_Int16 nSheet )
ScDBData* pRet = NULL;
if (pDocShell)
{
- pRet = pDocShell->GetDocument()->GetAnonymousDBData(nSheet);
+ pRet = pDocShell->GetDocument().GetAnonymousDBData(nSheet);
}
return pRet;
}
@@ -4441,7 +4427,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
RangeHelper multiCellRange( mxRange );
autoFiltAddress = multiCellRange.getCellRangeAddressable()->getRangeAddress();
// #163530# Filter box shows only entry of first row
- ScDocument* pDocument = ( pShell ? pShell->GetDocument() : NULL );
+ ScDocument* pDocument = ( pShell ? &pShell->GetDocument() : NULL );
if ( pDocument )
{
SCCOL nStartCol = autoFiltAddress.StartColumn;
@@ -4473,7 +4459,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
// set header (autofilter always need column headers)
uno::Reference< beans::XPropertySet > xFiltProps( xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY_THROW );
bool bHasColHeader = false;
- ScDocument* pDoc = pShell ? pShell->GetDocument() : NULL;
+ ScDocument* pDoc = pShell ? &pShell->GetDocument() : NULL;
if (pDoc)
{
bHasColHeader = pDoc->HasColHeader( static_cast< SCCOL >( autoFiltAddress.StartColumn ), static_cast< SCROW >( autoFiltAddress.StartRow ), static_cast< SCCOL >( autoFiltAddress.EndColumn ), static_cast< SCROW >( autoFiltAddress.EndRow ), static_cast< SCTAB >( autoFiltAddress.Sheet ) );
@@ -4881,18 +4867,15 @@ uno::Any ScVbaRange::getShowDetail() throw ( css::uno::RuntimeException, std::ex
(thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn ))
{
bool bColumn =thisAddress.StartRow == thisAddress.EndRow ? false:sal_True;
- ScDocument* pDoc = getDocumentFromRange( mxRange );
- ScOutlineTable* pOutlineTable = pDoc->GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), true);
- const ScOutlineArray* pOutlineArray = bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray();
- if( pOutlineArray )
+ ScDocument& rDoc = getDocumentFromRange( mxRange );
+ ScOutlineTable* pOutlineTable = rDoc.GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), true);
+ const ScOutlineArray& rOutlineArray = bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray();
+ SCCOLROW nPos = bColumn ? (SCCOLROW)(thisAddress.EndColumn-1):(SCCOLROW)(thisAddress.EndRow-1);
+ const ScOutlineEntry* pEntry = rOutlineArray.GetEntryByPos( 0, nPos );
+ if( pEntry )
{
- SCCOLROW nPos = bColumn ? (SCCOLROW)(thisAddress.EndColumn-1):(SCCOLROW)(thisAddress.EndRow-1);
- const ScOutlineEntry* pEntry = pOutlineArray->GetEntryByPos( 0, nPos );
- if( pEntry )
- {
- bShowDetail = !pEntry->IsHidden();
- return uno::makeAny( bShowDetail );
- }
+ bShowDetail = !pEntry->IsHidden();
+ return uno::makeAny( bShowDetail );
}
}
else
@@ -5334,8 +5317,8 @@ ScVbaRange::PreviousNext( bool bIsPrevious )
SCROW nNewY = refRange.aStart.Row();
SCTAB nTab = refRange.aStart.Tab();
- ScDocument* pDoc = getScDocument();
- pDoc->GetNextPos( nNewX,nNewY, nTab, nMove,0, true,true, markedRange );
+ ScDocument& rDoc = getScDocument();
+ rDoc.GetNextPos( nNewX,nNewY, nTab, nMove,0, true,true, markedRange );
refRange.aStart.SetCol( nNewX );
refRange.aStart.SetRow( nNewY );
refRange.aStart.SetTab( nTab );
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index 985823553d83..5fe1c664b412 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -122,7 +122,7 @@ public:
ScVbaRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges, bool bIsRows = false, bool bIsColumns = false ) throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException );
ScVbaRange( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException );
- ScDocument* getScDocument() throw (css::uno::RuntimeException);
+ ScDocument& getScDocument() throw (css::uno::RuntimeException);
ScDocShell* getScDocShell() throw (css::uno::RuntimeException);
/** Returns the ScVbaRange implementation object for the passed VBA Range object. */
diff --git a/sc/source/ui/vba/vbatextboxshape.cxx b/sc/source/ui/vba/vbatextboxshape.cxx
index 3cbb47743ea1..747aad67543d 100644
--- a/sc/source/ui/vba/vbatextboxshape.cxx
+++ b/sc/source/ui/vba/vbatextboxshape.cxx
@@ -47,7 +47,7 @@ uno::Reference< excel::XCharacters > SAL_CALL
ScVbaTextBoxShape::characters( const uno::Any& Start, const uno::Any& Length ) throw (uno::RuntimeException, std::exception)
{
ScDocShell* pDocShell = excel::getDocShell( m_xModel );
- ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
+ ScDocument* pDoc = pDocShell ? &pDocShell->GetDocument() : NULL;
if ( !pDoc )
throw uno::RuntimeException("Failed to access document from shell" );
diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index ac89af3c0ab4..3f383c6da532 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -111,9 +111,9 @@ public:
if ( !pViewShell )
throw uno::RuntimeException("Cannot obtain view shell" );
- SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
+ SCTAB nTabCount = pDocShell->GetDocument().GetTableCount();
SCTAB nIndex = 0;
- const ScMarkData& rMarkData = pViewShell->GetViewData()->GetMarkData();
+ const ScMarkData& rMarkData = pViewShell->GetViewData().GetMarkData();
sheets.reserve( nTabCount );
uno::Reference <sheet::XSpreadsheetDocument> xSpreadSheet( m_xModel, uno::UNO_QUERY_THROW );
uno::Reference <container::XIndexAccess> xIndex( xSpreadSheet->getSheets(), uno::UNO_QUERY_THROW );
@@ -355,8 +355,8 @@ ScVbaWindow::getScrollRow() throw (uno::RuntimeException, std::exception)
ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
if ( pViewShell )
{
- ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
- nValue = pViewShell->GetViewData()->GetPosY(WhichV(eWhich));
+ ScSplitPos eWhich = pViewShell->GetViewData().GetActivePart();
+ nValue = pViewShell->GetViewData().GetPosY(WhichV(eWhich));
}
return uno::makeAny( nValue + 1);
@@ -371,8 +371,8 @@ ScVbaWindow::setScrollRow( const uno::Any& _scrollrow ) throw (uno::RuntimeExcep
{
sal_Int32 scrollRow = 0;
_scrollrow >>= scrollRow;
- ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
- sal_Int32 nOldValue = pViewShell->GetViewData()->GetPosY(WhichV(eWhich)) + 1;
+ ScSplitPos eWhich = pViewShell->GetViewData().GetActivePart();
+ sal_Int32 nOldValue = pViewShell->GetViewData().GetPosY(WhichV(eWhich)) + 1;
pViewShell->ScrollLines(0, scrollRow - nOldValue);
}
}
@@ -385,8 +385,8 @@ ScVbaWindow::getScrollColumn() throw (uno::RuntimeException, std::exception)
ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
if ( pViewShell )
{
- ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
- nValue = pViewShell->GetViewData()->GetPosX(WhichH(eWhich));
+ ScSplitPos eWhich = pViewShell->GetViewData().GetActivePart();
+ nValue = pViewShell->GetViewData().GetPosX(WhichH(eWhich));
}
return uno::makeAny( nValue + 1);
@@ -401,8 +401,8 @@ ScVbaWindow::setScrollColumn( const uno::Any& _scrollcolumn ) throw (uno::Runtim
{
sal_Int32 scrollColumn = 0;
_scrollcolumn >>= scrollColumn;
- ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
- sal_Int32 nOldValue = pViewShell->GetViewData()->GetPosX(WhichH(eWhich)) + 1;
+ ScSplitPos eWhich = pViewShell->GetViewData().GetActivePart();
+ sal_Int32 nOldValue = pViewShell->GetViewData().GetPosX(WhichH(eWhich)) + 1;
pViewShell->ScrollLines(scrollColumn - nOldValue, 0);
}
}
@@ -794,7 +794,7 @@ ScVbaWindow::getView() throw (uno::RuntimeException, std::exception)
ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
if (pViewShell)
- bPageBreak = pViewShell->GetViewData()->IsPagebreakMode();
+ bPageBreak = pViewShell->GetViewData().IsPagebreakMode();
if( bPageBreak )
nWindowView = excel::XlWindowView::xlPageBreakPreview;
@@ -871,9 +871,9 @@ ScVbaWindow::PrintPreview( const css::uno::Any& EnableChanges ) throw (css::scri
double SAL_CALL ScVbaWindow::getTabRatio() throw (css::uno::RuntimeException, std::exception)
{
ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
- if ( pViewShell && pViewShell->GetViewData() && pViewShell->GetViewData()->GetView() )
+ if ( pViewShell && pViewShell->GetViewData().GetView() )
{
- double fRatio = pViewShell->GetViewData()->GetView()->GetRelTabBarWidth();
+ double fRatio = pViewShell->GetViewData().GetView()->GetRelTabBarWidth();
if ( fRatio >= 0.0 && fRatio <= 1.0 )
return fRatio;
}
@@ -883,10 +883,10 @@ double SAL_CALL ScVbaWindow::getTabRatio() throw (css::uno::RuntimeException, st
void SAL_CALL ScVbaWindow::setTabRatio( double fRatio ) throw (css::uno::RuntimeException, std::exception)
{
ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
- if ( pViewShell && pViewShell->GetViewData() && pViewShell->GetViewData()->GetView() )
+ if ( pViewShell && pViewShell->GetViewData().GetView() )
{
if ( fRatio >= 0.0 && fRatio <= 1.0 )
- pViewShell->GetViewData()->GetView()->SetRelTabBarWidth( fRatio );
+ pViewShell->GetViewData().GetView()->SetRelTabBarWidth( fRatio );
}
}
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 7599126b685c..d78bdde29f80 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -280,17 +280,17 @@ ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException, std::exceptio
sal_Bool SAL_CALL ScVbaWorkbook::getPrecisionAsDisplayed() throw (uno::RuntimeException, std::exception)
{
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- return pDoc->GetDocOptions().IsCalcAsShown();
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ return rDoc.GetDocOptions().IsCalcAsShown();
}
void SAL_CALL ScVbaWorkbook::setPrecisionAsDisplayed( sal_Bool _precisionAsDisplayed ) throw (uno::RuntimeException, std::exception)
{
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- ScDocOptions aOpt = pDoc->GetDocOptions();
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ ScDocOptions aOpt = rDoc.GetDocOptions();
aOpt.SetCalcAsShown( _precisionAsDisplayed );
- pDoc->SetDocOptions( aOpt );
+ rDoc.SetDocOptions( aOpt );
}
void
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index b367e3611c9a..4b5d2d4a62a1 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -234,7 +234,7 @@ ScVbaWorksheet::createSheetCopyInNewDoc(const OUString& aCurrSheetName)
ScDocShell* pShell = excel::getDocShell( xModel );
OUString aCodeName;
- pShell->GetDocument()->GetCodeName( 0, aCodeName );
+ pShell->GetDocument().GetCodeName( 0, aCodeName );
return uno::Reference< excel::XWorksheet >( getUnoDocModule( aCodeName, pShell ), uno::UNO_QUERY_THROW );
}
@@ -344,8 +344,8 @@ ScVbaWorksheet::getEnableSelection() throw (uno::RuntimeException, std::exceptio
if ( ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
{
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
bool bLockedCells = false;
bool bUnlockedCells = false;
if( pProtect )
@@ -379,8 +379,8 @@ ScVbaWorksheet::setEnableSelection( sal_Int32 nSelection ) throw (uno::RuntimeEx
if ( ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
{
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
// default is xlNoSelection
bool bLockedCells = false;
bool bUnlockedCells = false;
@@ -407,8 +407,8 @@ ScVbaWorksheet::setEnableSelection( sal_Int32 nSelection ) throw (uno::RuntimeEx
sal_Bool SAL_CALL ScVbaWorksheet::getAutoFilterMode() throw (uno::RuntimeException, std::exception)
{
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- ScDBData* pDBData = pDoc->GetAnonymousDBData(getSheetID());
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ ScDBData* pDBData = rDoc.GetAnonymousDBData(getSheetID());
if (pDBData)
return pDBData->HasAutoFilter();
return false;
@@ -418,19 +418,19 @@ void SAL_CALL ScVbaWorksheet::setAutoFilterMode( sal_Bool bAutoFilterMode ) thro
{
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
ScDocShell* pDocShell = excel::getDocShell( xModel );
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDBData* pDBData = pDoc->GetAnonymousDBData(getSheetID());
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDBData* pDBData = rDoc.GetAnonymousDBData(getSheetID());
if (pDBData)
{
pDBData->SetAutoFilter(bAutoFilterMode);
ScRange aRange;
pDBData->GetArea(aRange);
- if (bAutoFilterMode && pDoc)
- pDoc->ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
+ if (bAutoFilterMode)
+ rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(), SC_MF_AUTO );
- else if (!bAutoFilterMode && pDoc)
- pDoc->RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
+ else if (!bAutoFilterMode)
+ rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(), SC_MF_AUTO );
ScRange aPaintRange(aRange.aStart, aRange.aEnd);
@@ -519,8 +519,8 @@ ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException, std::ex
if ( bSheetExists )
{
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
if ( pProtect )
return pProtect->isOptionEnabled( ScTableProtection::OBJECTS );
}
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx
index 7a88275337cb..038b3f052bd4 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -370,7 +370,7 @@ ScVbaWorksheets::Select( const uno::Any& Replace ) throw (uno::RuntimeException,
if ( !pViewShell )
throw uno::RuntimeException("Cannot obtain view shell" );
- ScMarkData& rMarkData = pViewShell->GetViewData()->GetMarkData();
+ ScMarkData& rMarkData = pViewShell->GetViewData().GetMarkData();
bool bReplace = true;
Replace >>= bReplace;
// Replace is defaulted to True, meanining this current collection
@@ -549,7 +549,7 @@ void ScVbaWorksheets::PrintPreview( const css::uno::Any& /*EnableChanges*/ ) thr
WaitUntilPreviewIsClosed( pViewFrame );
// restore old tab selection
pViewShell = excel::getBestViewShell( mxModel );
- pViewShell->GetViewData()->GetMarkData().SetSelectedTabs(aOldTabs);
+ pViewShell->GetViewData().GetMarkData().SetSelectedTabs(aOldTabs);
}
}
}
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));
}