summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-11-05 15:01:58 +0100
committerEike Rathke <erack@redhat.com>2011-11-05 15:01:58 +0100
commit864f6483c01c175510828f2495d410a009a7a66b (patch)
tree07e7813263677767ec95684ed1e47a65b2ac2d76
parent002cc3a611c9755abaa9a69270c20b90be3d759c (diff)
make some methods const
-rw-r--r--sc/inc/document.hxx12
-rw-r--r--sc/source/core/data/documen3.cxx2
-rw-r--r--sc/source/core/data/documen9.cxx16
-rw-r--r--sc/source/core/data/document.cxx9
4 files changed, 21 insertions, 18 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5c811517d694..0d28935dd6d8 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -722,8 +722,8 @@ public:
void StartAnimations( SCTAB nTab, Window* pWin );
- sal_Bool HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect );
- sal_Bool HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect );
+ sal_Bool HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect ) const;
+ sal_Bool HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect ) const;
const ScSheetEvents* GetSheetEvents( SCTAB nTab ) const;
void SetSheetEvents( SCTAB nTab, const ScSheetEvents* pNew );
@@ -828,10 +828,10 @@ public:
SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab,
sal_Bool bRefresh = false );
sal_Bool ExtendMerge( ScRange& rRange, sal_Bool bRefresh = false );
- sal_Bool ExtendTotalMerge( ScRange& rRange );
+ sal_Bool ExtendTotalMerge( ScRange& rRange ) const;
SC_DLLPUBLIC sal_Bool ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
- SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
- SC_DLLPUBLIC sal_Bool ExtendOverlapped( ScRange& rRange );
+ SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const;
+ SC_DLLPUBLIC sal_Bool ExtendOverlapped( ScRange& rRange ) const;
sal_Bool RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
@@ -951,7 +951,7 @@ public:
*/
void ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow,
- SCCOL& rEndCol, SCROW nEndRow );
+ SCCOL& rEndCol, SCROW nEndRow ) const;
SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
ScDirection eDir );
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 84056a7bbdd2..e40bf2dd6043 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -2068,7 +2068,7 @@ void ScDocument::RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab )
}
void ScDocument::ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
- SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow )
+ SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow ) const
{
if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
maTabs[nTab]->ExtendPrintArea( pDev, nStartCol, nStartRow, rEndCol, nEndRow );
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index b3c25e3888f4..96c9a379d5e8 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -352,7 +352,7 @@ void ScDocument::StartAnimations( SCTAB nTab, Window* pWin )
}
-sal_Bool ScDocument::HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect )
+sal_Bool ScDocument::HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect ) const
{
// Gibt es Objekte auf dem Hintergrund-Layer, die (teilweise) von rMMRect
// betroffen sind?
@@ -380,7 +380,7 @@ sal_Bool ScDocument::HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect )
return bFound;
}
-sal_Bool ScDocument::HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect )
+sal_Bool ScDocument::HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect ) const
{
// Gibt es ueberhaupt Objekte, die (teilweise) von rMMRect
// betroffen sind?
@@ -463,8 +463,6 @@ sal_Bool ScDocument::IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
// We want to print sheets with borders even if there is no cell content.
return false;
- ScDocument* pThis = (ScDocument*)this; //! GetMMRect / HasAnyDraw etc. const !!!
-
Rectangle aMMRect;
if ( pLastRange && pLastMM && nTab == pLastRange->aStart.Tab() &&
nStartRow == pLastRange->aStart.Row() && nEndRow == pLastRange->aEnd.Row() )
@@ -484,7 +482,7 @@ sal_Bool ScDocument::IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
aMMRect.Right() = (long)(nRight * HMM_PER_TWIPS);
}
else
- aMMRect = pThis->GetMMRect( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
+ aMMRect = GetMMRect( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
if ( pLastRange && pLastMM )
{
@@ -492,7 +490,7 @@ sal_Bool ScDocument::IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
*pLastMM = aMMRect;
}
- if ( pThis->HasAnyDraw( nTab, aMMRect ))
+ if ( HasAnyDraw( nTab, aMMRect ))
return false;
if ( nStartCol > 0 && !bLeftIsEmpty )
@@ -503,12 +501,16 @@ sal_Bool ScDocument::IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
SCCOL nExtendCol = nStartCol - 1;
SCROW nTmpRow = nEndRow;
+ // ExtendMerge() is non-const, but called without refresh. GetPrinter()
+ // might create and assign a printer.
+ ScDocument* pThis = const_cast<ScDocument*>(this);
+
pThis->ExtendMerge( 0,nStartRow, nExtendCol,nTmpRow, nTab,
false ); // kein Refresh, incl. Attrs
OutputDevice* pDev = pThis->GetPrinter();
pDev->SetMapMode( MAP_PIXEL ); // wichtig fuer GetNeededSize
- pThis->ExtendPrintArea( pDev, nTab, 0, nStartRow, nExtendCol, nEndRow );
+ ExtendPrintArea( pDev, nTab, 0, nStartRow, nExtendCol, nEndRow );
if ( nExtendCol >= nStartCol )
return false;
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 7dfbd091c61a..da3819bd3a8c 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4946,7 +4946,7 @@ sal_Bool ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange&
sal_Bool ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
- SCCOL nEndCol, SCROW nEndRow, SCTAB nTab )
+ SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const
{
bool bFound = false;
if ( ValidColRow(rStartCol,rStartRow) && ValidColRow(nEndCol,nEndRow) && ValidTab(nTab) )
@@ -5080,14 +5080,15 @@ sal_Bool ScDocument::ExtendMerge( ScRange& rRange, sal_Bool bRefresh )
return bFound;
}
-sal_Bool ScDocument::ExtendTotalMerge( ScRange& rRange )
+sal_Bool ScDocument::ExtendTotalMerge( ScRange& rRange ) const
{
// Bereich genau dann auf zusammengefasste Zellen erweitern, wenn
// dadurch keine neuen nicht-ueberdeckten Zellen getroffen werden
bool bRet = false;
ScRange aExt = rRange;
- if (ExtendMerge(aExt))
+ // ExtendMerge() is non-const, but called withouth refresh.
+ if (const_cast<ScDocument*>(this)->ExtendMerge( aExt, false))
{
if ( aExt.aEnd.Row() > rRange.aEnd.Row() )
{
@@ -5110,7 +5111,7 @@ sal_Bool ScDocument::ExtendTotalMerge( ScRange& rRange )
return bRet;
}
-sal_Bool ScDocument::ExtendOverlapped( ScRange& rRange )
+sal_Bool ScDocument::ExtendOverlapped( ScRange& rRange ) const
{
bool bFound = false;
SCTAB nStartTab = rRange.aStart.Tab();