Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello,

this patch removes some code that resulted in strange behavior with merged
areas and shadows. The code extended the merged area by one column/row which
resulted in strange behavior with undo/redo. It seems that the code was an
old hack for the ui part that is no longer needed.

Regards,
Markus
From 9957ff62a8caec17f033cdfbed3a96d3232a31e1 Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrhard@googlemail.com>
Date: Tue, 6 Sep 2011 21:31:00 +0200
Subject: [PATCH] don't extend the merged area by one for shadows

---
 sc/inc/attarray.hxx               |    2 +-
 sc/inc/column.hxx                 |    2 +-
 sc/inc/document.hxx               |    6 +++---
 sc/inc/table.hxx                  |    2 +-
 sc/source/core/data/attarray.cxx  |   15 +--------------
 sc/source/core/data/column.cxx    |    4 ++--
 sc/source/core/data/documen9.cxx  |    2 +-
 sc/source/core/data/document.cxx  |   12 ++++++------
 sc/source/core/data/table2.cxx    |    4 ++--
 sc/source/ui/docshell/docfunc.cxx |   10 +++++-----
 sc/source/ui/undo/undoblk.cxx     |    2 +-
 sc/source/ui/view/printfun.cxx    |    2 +-
 sc/source/ui/view/viewdata.cxx    |    2 +-
 sc/source/ui/view/viewfun3.cxx    |    2 +-
 14 files changed, 27 insertions(+), 40 deletions(-)

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index dcf58aa..678fb70 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -161,7 +161,7 @@ public:
     bool    HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const;
     sal_Bool   ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
                                 SCCOL& rPaintCol, SCROW& rPaintRow,
-                                sal_Bool bRefresh, sal_Bool bAttrs );
+                                sal_Bool bRefresh );
     sal_Bool   RemoveAreaMerge( SCROW nStartRow, SCROW nEndRow );
 
     void       FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& 
rUsedRows, bool bReset );
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index dcd7b64..d4a60af 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -156,7 +156,7 @@ public:
     bool    HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
     bool    ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
                                 SCCOL& rPaintCol, SCROW& rPaintRow,
-                                bool bRefresh, bool bAttrs );
+                                bool bRefresh );
 
     bool               IsEmptyVisData(bool bNotes) const;              // without Broadcaster
     bool               IsEmptyData() const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 4c7202b..1f17f4f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -811,11 +811,11 @@ public:
 
     sal_Bool            ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
                                 SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark,
-                                sal_Bool bRefresh = false, sal_Bool bAttrs = false );
+                                sal_Bool bRefresh = false );
     sal_Bool                   ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
                                 SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab,
-                                sal_Bool bRefresh = false, sal_Bool bAttrs = false );
-    sal_Bool                   ExtendMerge( ScRange& rRange, sal_Bool bRefresh = false, sal_Bool 
bAttrs = false );
+                                sal_Bool bRefresh = false );
+    sal_Bool                   ExtendMerge( ScRange& rRange, sal_Bool bRefresh = false );
     sal_Bool                   ExtendTotalMerge( ScRange& rRange );
     SC_DLLPUBLIC sal_Bool                      ExtendOverlapped( SCCOL& rStartCol, SCROW& 
rStartRow,
                                 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 36bd138..7b47cd0 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -516,7 +516,7 @@ public:
     bool        HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
     bool        ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
                                 SCCOL& rEndCol, SCROW& rEndRow,
-                                sal_Bool bRefresh, sal_Bool bAttrs );
+                                sal_Bool bRefresh );
     const SfxPoolItem*         GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
     const ScPatternAttr*       GetPattern( SCCOL nCol, SCROW nRow ) const;
     const ScPatternAttr*    GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 6741093..5366845 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1349,7 +1349,7 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) 
const
 // Area around any given summaries expand and adapt any MergeFlag (bRefresh)
 sal_Bool ScAttrArray::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
                                 SCCOL& rPaintCol, SCROW& rPaintRow,
-                                sal_Bool bRefresh, sal_Bool bAttrs )
+                                sal_Bool bRefresh )
 {
     const ScPatternAttr* pPattern;
     const ScMergeAttr* pItem;
@@ -1376,19 +1376,6 @@ sal_Bool ScAttrArray::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW 
nEndRo
                 rPaintRow = nMergeEndRow;
             bFound = sal_True;
 
-            if (bAttrs)
-            {
-                const SvxShadowItem* pShadow =
-                        (const SvxShadowItem*) &pPattern->GetItem( ATTR_SHADOW );
-                SvxShadowLocation eLoc = pShadow->GetLocation();
-                if ( eLoc == SVX_SHADOW_TOPRIGHT || eLoc == SVX_SHADOW_BOTTOMRIGHT )
-                    if ( nMergeEndCol+1 > rPaintCol && nMergeEndCol < MAXCOL )
-                        rPaintCol = nMergeEndCol+1;
-                if ( eLoc == SVX_SHADOW_BOTTOMLEFT || eLoc == SVX_SHADOW_BOTTOMRIGHT )
-                    if ( nMergeEndRow+1 > rPaintRow && nMergeEndRow < MAXROW )
-                        rPaintRow = nMergeEndRow+1;
-            }
-
             if (bRefresh)
             {
                 if ( nMergeEndCol > nThisCol )
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 471c0dc..5fecb2d 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -280,9 +280,9 @@ bool ScColumn::HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) c
 
 bool ScColumn::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
                             SCCOL& rPaintCol, SCROW& rPaintRow,
-                            bool bRefresh, bool bAttrs )
+                            bool bRefresh )
 {
-    return pAttrArray->ExtendMerge( nThisCol, nStartRow, nEndRow, rPaintCol, rPaintRow, bRefresh, 
bAttrs );
+    return pAttrArray->ExtendMerge( nThisCol, nStartRow, nEndRow, rPaintCol, rPaintRow, bRefresh );
 }
 
 
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 3d58b87..2dc90d6 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -512,7 +512,7 @@ sal_Bool ScDocument::IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
         SCROW nTmpRow = nEndRow;
 
         pThis->ExtendMerge( 0,nStartRow, nExtendCol,nTmpRow, nTab,
-                            false, sal_True );         // kein Refresh, incl. Attrs
+                            false );           // kein Refresh, incl. Attrs
 
         OutputDevice* pDev = pThis->GetPrinter();
         pDev->SetMapMode( MAP_PIXEL );                         // wichtig fuer GetNeededSize
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 6668b74..fa80311 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4677,7 +4677,7 @@ sal_Bool ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
 
 sal_Bool ScDocument::ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
                               SCCOL& rEndCol, SCROW& rEndRow,
-                              const ScMarkData& rMark, sal_Bool bRefresh, sal_Bool bAttrs )
+                              const ScMarkData& rMark, sal_Bool bRefresh )
 {
     // use all selected sheets from rMark
 
@@ -4690,7 +4690,7 @@ sal_Bool ScDocument::ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
         {
             SCCOL nThisEndCol = nOldEndCol;
             SCROW nThisEndRow = nOldEndRow;
-            if ( ExtendMerge( nStartCol, nStartRow, nThisEndCol, nThisEndRow, nTab, bRefresh, 
bAttrs ) )
+            if ( ExtendMerge( nStartCol, nStartRow, nThisEndCol, nThisEndRow, nTab, bRefresh ) )
                 bFound = sal_True;
             if ( nThisEndCol > rEndCol )
                 rEndCol = nThisEndCol;
@@ -4704,13 +4704,13 @@ sal_Bool ScDocument::ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
 
 sal_Bool ScDocument::ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
                               SCCOL& rEndCol,  SCROW& rEndRow,
-                              SCTAB nTab, sal_Bool bRefresh, sal_Bool bAttrs )
+                              SCTAB nTab, sal_Bool bRefresh )
 {
     sal_Bool bFound = false;
     if ( ValidColRow(nStartCol,nStartRow) && ValidColRow(rEndCol,rEndRow) && ValidTab(nTab) )
     {
         if (pTab[nTab])
-            bFound = pTab[nTab]->ExtendMerge( nStartCol, nStartRow, rEndCol, rEndRow, bRefresh, 
bAttrs );
+            bFound = pTab[nTab]->ExtendMerge( nStartCol, nStartRow, rEndCol, rEndRow, bRefresh );
 
         if (bRefresh)
             RefreshAutoFilter( nStartCol, nStartRow, rEndCol, rEndRow, nTab );
@@ -4724,7 +4724,7 @@ sal_Bool ScDocument::ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
 }
 
 
-sal_Bool ScDocument::ExtendMerge( ScRange& rRange, sal_Bool bRefresh, sal_Bool bAttrs )
+sal_Bool ScDocument::ExtendMerge( ScRange& rRange, sal_Bool bRefresh )
 {
     sal_Bool bFound = false;
     SCTAB nStartTab = rRange.aStart.Tab();
@@ -4739,7 +4739,7 @@ sal_Bool ScDocument::ExtendMerge( ScRange& rRange, sal_Bool bRefresh, 
sal_Bool b
         SCROW nExtendRow = rRange.aEnd.Row();
         if (ExtendMerge( rRange.aStart.Col(), rRange.aStart.Row(),
                          nExtendCol,          nExtendRow,
-                         nTab, bRefresh, bAttrs ) )
+                         nTab, bRefresh ) )
         {
             bFound = sal_True;
             if (nExtendCol > nEndCol) nEndCol = nExtendCol;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 37b9e75..7d7d554 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1389,7 +1389,7 @@ bool ScTable::HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) 
co
 
 bool ScTable::ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
                            SCCOL& rEndCol, SCROW& rEndRow,
-                           sal_Bool bRefresh, sal_Bool bAttrs )
+                           sal_Bool bRefresh )
 {
     if (!(ValidCol(nStartCol) && ValidCol(rEndCol)))
     {
@@ -1400,7 +1400,7 @@ bool ScTable::ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
     SCCOL nOldEndX = rEndCol;
     SCROW nOldEndY = rEndRow;
     for (SCCOL i=nStartCol; i<=nOldEndX; i++)
-        bFound |= aCol[i].ExtendMerge( i, nStartRow, nOldEndY, rEndCol, rEndRow, bRefresh, bAttrs 
);
+        bFound |= aCol[i].ExtendMerge( i, nStartRow, nOldEndY, rEndCol, rEndRow, bRefresh );
     return bFound;
 }
 
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 89d99b9..24e4517 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1536,7 +1536,7 @@ sal_Bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* 
pTabMa
                     {
                         ScRange aRange( nTestCol, nTestRow1, i );
                         pDoc->ExtendOverlapped(aRange);
-                        pDoc->ExtendMerge(aRange, sal_True, sal_True);
+                        pDoc->ExtendMerge(aRange, sal_True);
 
                         if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
                         {
@@ -1544,7 +1544,7 @@ sal_Bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* 
pTabMa
                             {
                                 ScRange aTestRange( nTestCol, nTestRow, i );
                                 pDoc->ExtendOverlapped( aTestRange );
-                                pDoc->ExtendMerge( aTestRange, sal_True, sal_True);
+                                pDoc->ExtendMerge( aTestRange, sal_True);
                                 ScRange aMergeRange( 
aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
                                 if( !aExtendRange.In( aMergeRange ) )
                                 {
@@ -1946,7 +1946,7 @@ sal_Bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* 
pTabMa
                     {
                         ScRange aRange( nTestCol, nTestRow1, i );
                         pDoc->ExtendOverlapped( aRange );
-                        pDoc->ExtendMerge( aRange, sal_True, sal_True );
+                        pDoc->ExtendMerge( aRange, sal_True );
 
                         if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
                         {
@@ -1954,7 +1954,7 @@ sal_Bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* 
pTabMa
                             {
                                 ScRange aTestRange( nTestCol, nTestRow, i );
                                 pDoc->ExtendOverlapped( aTestRange );
-                                pDoc->ExtendMerge( aTestRange, sal_True, sal_True);
+                                pDoc->ExtendMerge( aTestRange, sal_True );
                                 ScRange aMergeRange( 
aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
                                 if( !aExtendRange.In( aMergeRange ) )
                                 {
@@ -4458,7 +4458,7 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, sal_Bool 
bRecord
                               aExtended.aEnd.Col(), aExtended.aEnd.Row(), nTab,
                               SC_MF_HOR | SC_MF_VER );
 
-        pDoc->ExtendMerge( aRefresh, sal_True, false );
+        pDoc->ExtendMerge( aRefresh, sal_True );
 
         if ( !AdjustRowHeight( aExtended ) )
             rDocShell.PostPaint( aExtended, PAINT_GRID );
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 71dded2..17588d5 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -2131,7 +2131,7 @@ void ScUndoRemoveMerge::Redo()
                               maOption.mnEndCol, maOption.mnEndRow, nTab,
                               SC_MF_HOR | SC_MF_VER );
 
-        pDoc->ExtendMerge(aRange, true, false);
+        pDoc->ExtendMerge(aRange, true);
 
         //     Paint
 
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 7fd44dc..0943ff1 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -779,7 +779,7 @@ sal_Bool ScPrintFunc::AdjustPrintArea( sal_Bool bNew )
     }
 
     pDoc->ExtendMerge( nStartCol,nStartRow, nEndCol,nEndRow, nPrintTab,
-                        false, sal_True );             // kein Refresh, incl. Attrs
+                        false );               // kein Refresh, incl. Attrs
 
     if ( bChangeCol )
     {
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index c3e4d0c..96ccccb 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1820,7 +1820,7 @@ sal_Bool ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos 
eWh
                 pDoc->RemoveFlagsTab( 0,0, MAXCOL,MAXROW, nTabNo, SC_MF_HOR | SC_MF_VER );
                 SCCOL nEndCol = MAXCOL;
                 SCROW nEndRow = MAXROW;
-                pDoc->ExtendMerge( 0,0, nEndCol,nEndRow, nTabNo, sal_True, false );
+                pDoc->ExtendMerge( 0,0, nEndCol,nEndRow, nTabNo, sal_True );
                 if (pDocShell)
                     pDocShell->PostPaint( ScRange(0,0,nTabNo,MAXCOL,MAXROW,nTabNo), PAINT_GRID );
             }
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 222571a..f0aa3b5 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1424,7 +1424,7 @@ sal_Bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc,
                 {
                     ScRange aRange(nCol, nRow1, nStartTab);
                     pDoc->ExtendOverlapped(aRange);
-                    pDoc->ExtendMerge(aRange, sal_True, sal_True);
+                    pDoc->ExtendMerge(aRange, sal_True);
                     rDocFunc.UnmergeCells(aRange, bRecord, sal_True);
                 }
             }
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.