[Libreoffice-commits] .: sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Mar 22 10:43:11 PDT 2011


 sc/inc/document.hxx              |    6 +++---
 sc/source/core/data/column2.cxx  |    4 ----
 sc/source/core/data/documen9.cxx |    4 ++++
 sc/source/core/data/document.cxx |    4 ++--
 sc/source/ui/view/printfun.cxx   |   15 +++++++++++++++
 5 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit f4939e316d9192d21f667cfc0d396bc9c899a4ec
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 22 13:38:54 2011 -0400

    Let's check for borders only when calculating printable pages.
    
    The original change was introduced to allow printing of sheets that
    only has cell borders without any data cells.  But, the change was
    not put in the right scope, and ended up affecting all kinds of
    run-time behaviors. (fdo#33621, fdo#33671)
    
    Also fixed some uninitialized data numbers.

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 61a67a8..782e80e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -836,9 +836,9 @@ public:
     sal_Bool			IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
     sal_Bool			IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
 
-    SC_DLLPUBLIC bool           HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
-                                           SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask );
-    SC_DLLPUBLIC bool           HasAttrib( const ScRange& rRange, sal_uInt16 nMask );
+    SC_DLLPUBLIC bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
+                                 SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask ) const;
+    SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, sal_uInt16 nMask ) const;
 
     void			GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
                                     const SvxBorderLine** ppLeft,
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 849898a..7ec4b23 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1242,10 +1242,6 @@ bool ScColumn::IsEmpty() const
 
 bool ScColumn::IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes) const
 {
-    Rectangle aRect;
-    if (pAttrArray->HasLines(nStartRow, nEndRow, aRect, true, true))
-        return false;
-
     if ( nCount == 0 || !pItems )
         return true;
 
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 86dadb0..de0f1be 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -467,6 +467,10 @@ sal_Bool ScDocument::IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
     if (!IsBlockEmpty( nTab, nStartCol, nStartRow, nEndCol, nEndRow ))
         return false;
 
+    if (HasAttrib(ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab), HASATTR_LINES))
+        // 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;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 0202408..1841145 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4284,7 +4284,7 @@ void ScDocument::GetSelectionFrame( const ScMarkData& rMark,
 
 
 bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
-                            SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask )
+                            SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask ) const
 {
     if ( nMask & HASATTR_ROTATE )
     {
@@ -4365,7 +4365,7 @@ bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
     return bFound;
 }
 
-bool ScDocument::HasAttrib( const ScRange& rRange, sal_uInt16 nMask )
+bool ScDocument::HasAttrib( const ScRange& rRange, sal_uInt16 nMask ) const
 {
     return HasAttrib( rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(),
                       rRange.aEnd.Col(),   rRange.aEnd.Row(),   rRange.aEnd.Tab(),
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index cf39e2c..e678e33 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -247,6 +247,9 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter, SCTAB nTa
         bMultiArea			( false ),
         nTabPages			( 0 ),
         nTotalPages			( 0 ),
+        nPagesX(0),
+        nPagesY(0),
+        nTotalY(0),
         pPageData			( pData )
 {
     pDev = pPrinter;
@@ -270,6 +273,9 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, SCTAB nTab,
         bMultiArea			( false ),
         nTabPages			( 0 ),
         nTotalPages			( 0 ),
+        nPagesX(0),
+        nPagesY(0),
+        nTotalY(0),
         pPageData			( NULL )
 {
     pDev = pOutDev;
@@ -285,6 +291,9 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell,
         bSourceRangeValid	( false ),
         bPrintCurrentTable	( false ),
         bMultiArea			( false ),
+        nPagesX(0),
+        nPagesY(0),
+        nTotalY(0),
         pPageData			( NULL )
 {
     pDev = pOutDev;
@@ -320,6 +329,9 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, SCTAB nTab,
         bMultiArea          ( false ),
         nTabPages           ( 0 ),
         nTotalPages         ( 0 ),
+        nPagesX(0),
+        nPagesY(0),
+        nTotalY(0),
         pPageData           ( NULL )
 {
     pDev = pWindow;
@@ -333,6 +345,9 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow,
         pUserArea           ( NULL ),
         bPrintCurrentTable  ( false ),
         bMultiArea          ( false ),
+        nPagesX(0),
+        nPagesY(0),
+        nTotalY(0),
         pPageData           ( NULL )
 {
     pDev = pWindow;


More information about the Libreoffice-commits mailing list