285fc32
From 5316edea6948f3e2a77e4fc68799f67de21fada7 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
---
285fc32
 sc/source/ui/inc/output.hxx   |    2 +
285fc32
 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
285fc32
index 72934cf..3a91c14 100644
285fc32
--- a/sc/source/ui/inc/output.hxx
285fc32
+++ b/sc/source/ui/inc/output.hxx
285fc32
@@ -306,6 +306,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
285fc32
index de1506a..5522e69 100644
285fc32
--- a/sc/source/ui/view/output2.cxx
285fc32
+++ b/sc/source/ui/view/output2.cxx
285fc32
@@ -2818,13 +2818,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 ||
5050f39
-            ( pDoc->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;
285fc32
@@ -2859,6 +2853,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
285fc32
@@ -3191,13 +3198,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 ||
5050f39
-            ( pDoc->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;
285fc32
@@ -3563,13 +3565,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 ||
5050f39
-            ( pDoc->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;
285fc32
@@ -4460,6 +4456,20 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
285fc32
     rParam.adjustForHyperlinkInPDF(aURLStart, pDev);
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 ||
9af7fae
+               ( pDoc->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;
285fc32
@@ -5168,11 +5178,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
-- 
285fc32
1.7.7.3
285fc32