ce85ecb
From 8208f795bb6882cf77adef940839f0c46b9befb2 Mon Sep 17 00:00:00 2001
285fc32
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
285fc32
Date: Mon, 5 Dec 2011 15:28:19 +0100
285fc32
Subject: [PATCH] vertical content overflowing out of cell (#i88341#)
285fc32
285fc32
---
ce85ecb
 sc/source/ui/inc/output.hxx   |  2 ++
ce85ecb
 sc/source/ui/view/output2.cxx | 66 ++++++++++++++++++++++++++++---------------
285fc32
 2 files changed, 45 insertions(+), 23 deletions(-)
285fc32
285fc32
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
ce85ecb
index 1b8d8f5..6dcbe2e 100644
285fc32
--- a/sc/source/ui/inc/output.hxx
285fc32
+++ b/sc/source/ui/inc/output.hxx
ce85ecb
@@ -296,6 +296,8 @@ public:
285fc32
     void    DrawExtraShadow(sal_Bool bLeft, sal_Bool bTop, sal_Bool bRight, sal_Bool bBottom);
285fc32
     void    DrawFrame();
8076325
 
5050f39
+    bool    UseNormalClip(SCROW nCellY, const SfxItemSet* pCondSet);
5050f39
+
5050f39
                     // with logic MapMode set!
285fc32
     void    DrawEdit(sal_Bool bPixelToLogic);
8076325
 
285fc32
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
ce85ecb
index ac6365c..141ef00 100644
285fc32
--- a/sc/source/ui/view/output2.cxx
285fc32
+++ b/sc/source/ui/view/output2.cxx
ce85ecb
@@ -2905,13 +2905,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
5050f39
                 (ScMergeAttr*)&rParam.mpPattern->GetItem(ATTR_MERGE);
5050f39
         bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1;
9af7fae
 
285fc32
-        //  Don't clip for text height when printing rows with optimal height,
285fc32
-        //  except when font size is from conditional formatting.
285fc32
-        //! Allow clipping when vertically merged?
5050f39
-        if ( eType != OUTTYPE_PRINTER ||
a2f244f
-            ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CR_MANUALSIZE ) ||
5050f39
-            ( rParam.mpCondSet && SFX_ITEM_SET ==
5050f39
-                rParam.mpCondSet->GetItemState(ATTR_FONT_HEIGHT, true) ) )
5050f39
+        if (UseNormalClip(rParam.mnCellY, rParam.mpCondSet))
5050f39
             bClip = true;
5050f39
         else
5050f39
             bSimClip = true;
ce85ecb
@@ -2946,6 +2940,19 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
5050f39
     }
5050f39
 
5050f39
     Rectangle aLogicClip;
0d33515
+    if (
0d33515
+         ((nAttrRotate == 9000) || (nAttrRotate == 27000)) &&
0d33515
+         (!(rParam.meOrient==SVX_ORIENTATION_STANDARD &&
0d33515
+            !rParam.mbAsianVertical)) &&
0d33515
+         (!(bClip || bSimClip))
0d33515
+       )
0d33515
+    {
0d33515
+        if (UseNormalClip(rParam.mnCellY, rParam.mpCondSet))
0d33515
+            bClip = true;
0d33515
+        else
0d33515
+            bSimClip = true;
0d33515
+    }
5050f39
+
5050f39
     if (bClip || bSimClip)
5050f39
     {
5050f39
         // Clip marks are already handled in GetOutputArea
ce85ecb
@@ -3278,13 +3285,8 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam)
5050f39
                 (ScMergeAttr*)&rParam.mpPattern->GetItem(ATTR_MERGE);
5050f39
         bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1;
8076325
 
285fc32
-        //  Don't clip for text height when printing rows with optimal height,
285fc32
-        //  except when font size is from conditional formatting.
285fc32
-        //! Allow clipping when vertically merged?
5050f39
-        if ( eType != OUTTYPE_PRINTER ||
a2f244f
-            ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CR_MANUALSIZE ) ||
5050f39
-            ( rParam.mpCondSet && SFX_ITEM_SET ==
5050f39
-                rParam.mpCondSet->GetItemState(ATTR_FONT_HEIGHT, true) ) )
9af7fae
+
5050f39
+        if (UseNormalClip(rParam.mnCellY, rParam.mpCondSet))
5050f39
             bClip = true;
5050f39
         else
5050f39
             bSimClip = true;
ce85ecb
@@ -3650,13 +3652,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam)
5050f39
                 (ScMergeAttr*)&rParam.mpPattern->GetItem(ATTR_MERGE);
5050f39
         bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1;
5050f39
 
285fc32
-        //  Don't clip for text height when printing rows with optimal height,
285fc32
-        //  except when font size is from conditional formatting.
285fc32
-        //! Allow clipping when vertically merged?
5050f39
-        if ( eType != OUTTYPE_PRINTER ||
a2f244f
-            ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CR_MANUALSIZE ) ||
5050f39
-            ( rParam.mpCondSet && SFX_ITEM_SET ==
5050f39
-                rParam.mpCondSet->GetItemState(ATTR_FONT_HEIGHT, true) ) )
5050f39
+        if (UseNormalClip(rParam.mnCellY, rParam.mpCondSet))
5050f39
             bClip = true;
5050f39
         else
5050f39
             bSimClip = true;
ce85ecb
@@ -4547,6 +4543,20 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
a2f244f
     rParam.adjustForHyperlinkInPDF(aURLStart, mpDev);
5050f39
 }
5050f39
 
8076325
+bool ScOutputData::UseNormalClip(SCROW nCellY, const SfxItemSet* pCondSet)
8076325
+{
8076325
+    bool bNormalClip = false;
9af7fae
+       //      Don't clip for text height when printing rows with optimal height,
9af7fae
+       //      except when font size is from conditional formatting.
9af7fae
+       //!     Allow clipping when vertically merged?
9af7fae
+       if ( eType != OUTTYPE_PRINTER ||
ce85ecb
+               ( mpDoc->GetRowFlags( nCellY, nTab ) & CR_MANUALSIZE ) ||
9af7fae
+               ( pCondSet && SFX_ITEM_SET ==
0d33515
+                       pCondSet->GetItemState(ATTR_FONT_HEIGHT, sal_True) ) )
0d33515
+               bNormalClip = true;
8076325
+    return bNormalClip;
8076325
+}
8076325
+
5050f39
 void ScOutputData::DrawEdit(sal_Bool bPixelToLogic)
8076325
 {
5050f39
     ScFieldEditEngine* pEngine = NULL;
ce85ecb
@@ -5258,11 +5268,21 @@ void ScOutputData::DrawRotated(sal_Bool bPixelToLogic)
9af7fae
                                     else
9af7fae
                                     {
285fc32
                                         //  bei gedrehtem Text ist Standard zentriert
9af7fae
+                                        long nDiff = 0;
9af7fae
                                         if (eHorJust==SVX_HOR_JUSTIFY_RIGHT)
9af7fae
-                                            aLogicStart.X() += nAvailWidth - nEngineWidth;
9af7fae
+                                            nDiff = nAvailWidth - nEngineWidth;
9af7fae
                                         else if (eHorJust==SVX_HOR_JUSTIFY_CENTER ||
9af7fae
                                                  eHorJust==SVX_HOR_JUSTIFY_STANDARD)
9af7fae
-                                            aLogicStart.X() += (nAvailWidth - nEngineWidth) / 2;
9af7fae
+                                            nDiff = (nAvailWidth - nEngineWidth) / 2;
8076325
+
9af7fae
+                                        if (nEngineWidth > nAvailWidth)
9af7fae
+                                        {
8076325
+                                            if (nAttrRotate == 9000)
9af7fae
+                                               nDiff = 0;
9af7fae
+                                            else if (nAttrRotate == 27000)
9af7fae
+                                               nDiff = nAvailWidth - nEngineWidth;
9af7fae
+                                        }
9af7fae
+                                        aLogicStart.X() += nDiff;
9af7fae
                                     }
9af7fae
                                 }
8076325
 
285fc32
-- 
ce85ecb
1.8.0
285fc32