[Libreoffice-commits] core.git: Branch 'feature/BorderlineFix' - sc/source svx/source

Armin Le Grand Armin.Le.Grand at cib.de
Tue Jan 23 09:38:43 UTC 2018


 sc/source/ui/inc/output.hxx          |    7 +++++--
 sc/source/ui/view/gridwin4.cxx       |    4 ----
 sc/source/ui/view/output.cxx         |    3 +++
 svx/source/dialog/framelinkarray.cxx |   27 +++++++++++++++++++++------
 4 files changed, 29 insertions(+), 12 deletions(-)

New commits:
commit 5184115ea2c8f0096b2948908c012c73ca4cf681
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Tue Jan 23 10:29:44 2018 +0100

    BorderlineFix: Corrected handling for 'rotated' CellBorders
    
    CellBorders can be rotated (including their Text) and need special
    visualization that is based on an own sheared/rotated coordinate
    system. Currently only possible for single cells (not merged ones)
    and needs to handle all borders (also bottom-right directly in the
    rotated cell, not in the neighboured ones to have the geometry,
    plus avoiding these in the non-rotated neighbour cells.
    Also corrected adding CellRotation data to svx::frame::Array
    in calc using SetCellRotations() which now gets called in the
    ScOutputData constructor to ensure it gets called in all places
    where it is used.
    
    Change-Id: I47bdfc29ba5ca76bbc07d98cb64733f867b1ee20

diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index f23dabae3de0..c41433609b9e 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -255,6 +255,11 @@ private:
     long SetEngineTextAndGetWidth( DrawEditParam& rParam, const OUString& rSetString,
                                    long& rNeededPixel, long nAddWidthPixels );
 
+    // Check for and set cell rotations at OutputData to have it available
+    // in the svx tooling to render the borders. Moved to private section
+    // and the single call to end of constructor to be sure this always happens
+    void    SetCellRotations();
+
 public:
     /**
      * @param nNewScrX: X-Offset in the output device for the table
@@ -311,8 +316,6 @@ public:
 
                     // with logic MapMode set!
     void    DrawEdit(bool bPixelToLogic);
-
-    void    SetCellRotations();
     void    DrawRotated(bool bPixelToLogic);        // logical
 
     void    DrawClear();
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 22e07763decb..64cd440e9902 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -696,10 +696,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
         pContentDev->SetMapMode(aCurrentMapMode);
     }
 
-    // check for and set cell rotations at OutputData to have it available
-    // in the svx tooling to render the borders
-    aOutputData.SetCellRotations();
-
     if ( rDoc.HasBackgroundDraw( nTab, aDrawingRectLogic ) )
     {
         pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index bd3687cd1cd3..064bb14ce1a1 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -214,6 +214,9 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType,
 
     bTabProtected = mpDoc->IsTabProtected( nTab );
     bLayoutRTL = mpDoc->IsLayoutRTL( nTab );
+
+    // always needed, so call at the end of the constructor
+    SetCellRotations();
 }
 
 ScOutputData::~ScOutputData()
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index 096216210585..ab6db75799e3 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -1092,9 +1092,21 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 const bool bFirstRow(nRow == nFirstRow);
                 const bool bLastRow(nRow == nLastRow);
 
+                // handle rotation: If cell is rotated, handle lower/right edge inside
+                // this local geometry due to the created CoordinateSystem already representing
+                // the needed transformations.
+                const bool bRotated(rCell.IsRotated());
+
+                // Additionally avoid double-handling by supressing handling when self not roated,
+                // but above/left is rotated and thus already handled. Two directly connected
+                // rotated will paint/create both edges, they might be rotated differently.
+                const bool bSuppressAbove(!bRotated && nRow > nFirstRow && CELL(nCol, nRow - 1).IsRotated());
+                const bool bSupressLeft(!bRotated && nCol > nFirstCol && CELL(nCol - 1, nRow).IsRotated());
+
                 // create upper line for this Cell
-                if (!bOverlapY      // true for first line in merged cells or cells
-                    || bFirstRow)   // true for non_Calc usages of this tooling
+                if ((!bOverlapY         // true for first line in merged cells or cells
+                    || bFirstRow)       // true for non_Calc usages of this tooling
+                    && !bSuppressAbove) // true when above is not rotated, so edge is already handled (see bRotated)
                 {
                     // get CellStyle - method will take care to get the correct one, e.g.
                     // for merged cells (it uses ORIGCELL that works with topLeft's of these)
@@ -1107,7 +1119,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 }
 
                 // create lower line for this Cell
-                if (bLastRow)       // true for non_Calc usages of this tooling
+                if (bLastRow       // true for non_Calc usages of this tooling
+                    || bRotated)   // true if cell is rotated, handle lower edge in local geometry
                 {
                     const Style& rBottom(GetCellStyleBottom(nCol, nRow));
 
@@ -1118,8 +1131,9 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 }
 
                 // create left line for this Cell
-                if (!bOverlapX      // true for first column in merged cells or cells
-                    || bFirstCol)   // true for non_Calc usages of this tooling
+                if ((!bOverlapX         // true for first column in merged cells or cells
+                    || bFirstCol)       // true for non_Calc usages of this tooling
+                    && !bSupressLeft)   // true when left is not rotated, so edge is already handled (see bRotated)
                 {
                     const Style& rLeft(GetCellStyleLeft(nCol, nRow));
 
@@ -1130,7 +1144,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 }
 
                 // create right line for this Cell
-                if (bLastCol)       // true for non_Calc usages of this tooling
+                if (bLastCol        // true for non_Calc usages of this tooling
+                    || bRotated)    // true if cell is rotated, handle right edge in local geometry
                 {
                     const Style& rRight(GetCellStyleRight(nCol, nRow));
 


More information about the Libreoffice-commits mailing list