diff options
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 31 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 2 |
5 files changed, 32 insertions, 13 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 05b93f38e4a8..2120405fe77f 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1289,7 +1289,7 @@ public: void InvalidateTableArea(); /// Return the number of columns / rows that should be visible for the tiled rendering. - SC_DLLPUBLIC bool GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const; + SC_DLLPUBLIC void GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const; SC_DLLPUBLIC bool GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const; diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index a56a0a3b65bf..77be2ded3879 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -84,6 +84,7 @@ #include "externalrefmgr.hxx" #include "appoptio.hxx" #include "scmod.hxx" +#include "../../ui/inc/viewdata.hxx" #include "../../ui/inc/viewutil.hxx" #include "tabprotection.hxx" #include "formulaparserpool.hxx" @@ -697,9 +698,35 @@ bool ScDocument::GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) return false; } -bool ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const +void ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const { - return GetPrintArea(nTab, rEndCol, rEndRow, false); + bool bHasPrintArea = GetPrintArea(nTab, rEndCol, rEndRow, false); + + // we need some reasonable minimal document size + ScViewData* pViewData = ScDocShell::GetViewData(); + if (!pViewData) + { + if (!bHasPrintArea) + { + rEndCol = 20; + rEndRow = 50; + } + else + { + rEndCol += 20; + rEndRow += 50; + } + } + else if (!bHasPrintArea) + { + rEndCol = pViewData->GetMaxTiledCol(); + rEndRow = pViewData->GetMaxTiledRow(); + } + else + { + rEndCol = std::max(rEndCol, pViewData->GetMaxTiledCol()); + rEndRow = std::max(rEndRow, pViewData->GetMaxTiledRow()); + } } bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress ) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 7aeb40cb9761..064c8b699533 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -543,11 +543,7 @@ Size ScModelObj::getDocumentSize() SCROW nEndRow = 0; const ScDocument& rDoc = pDocShell->GetDocument(); - if (!rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow)) - return aSize; - - nEndCol = std::max(nEndCol, pViewData->GetMaxTiledCol()); - nEndRow = std::max(nEndRow, pViewData->GetMaxTiledRow()); + rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow); // convert to twips aSize.setWidth(rDoc.GetColWidth(0, nEndCol, nTab)); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index da1c843ef789..3da00b52b669 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1625,9 +1625,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) { SCCOL nMaxTiledCol; SCROW nMaxTiledRow; - pDoc->GetTiledRenderingArea( nTab, nMaxTiledCol, nMaxTiledRow ); - nMaxTiledCol = std::max(nMaxTiledCol, pViewData->GetMaxTiledCol()); - nMaxTiledRow = std::max(nMaxTiledRow, pViewData->GetMaxTiledRow()); + pDoc->GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow); if (nX2 > nMaxTiledCol) nX2 = nMaxTiledCol; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 420e892f174d..e4671f6da2ed 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2312,8 +2312,6 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) SCCOL nEndCol = 0; SCROW nEndRow = 0; pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); - nEndCol = std::max(nEndCol, aViewData.GetMaxTiledCol()); - nEndRow = std::max(nEndRow, aViewData.GetMaxTiledRow()); boost::property_tree::ptree aRows; long nTotal = 0; |