Blame SOURCES/openoffice.org-3.0.0.ooo88341.sc.verticalboxes.patch

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