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


Hi there,

I'd like to have 

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8bf60230255e0e8da66cafff578f148858cee4ca

cherry-picked to the 3.4 branch.  A patch for this commit is attached as
well for convenience.

This fixes a slight layout problem in the main pivot table dialog, where
the text "Drag the fields from the right into the desired position"
appeared overlapping the row and data field areas on Windows XP.  This
commit fixes it.  On platforms other than Windows XP there is no such
issue.

Apparently our dialogs get vertically compressed on Windows XP (for
whatever reason).  And because the size and position of the
page/row/column/data field areas are absolute, this caused the layout
breakage on XP.

Review & sign-off appreciated.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kohei.yoshida@suse.com>
From 83c6787d538e556d4410bf96d41e36a7a7d58e7d Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@suse.com>
Date: Tue, 30 Aug 2011 13:11:47 -0400
Subject: [PATCH] Adjust the dialog size to make sure the bottom text is visible.

This ensures that the bottom text "Drag the fields from ..." is
visible on all platforms.  Previously this text overlapped with
the data and row field windows on Windows XP.
---
 sc/source/ui/dbgui/dpuiglobal.hxx |    1 +
 sc/source/ui/dbgui/pvlaydlg.cxx   |   67 +++++++++++++++++++++++++++++++++++++
 sc/source/ui/inc/pvlaydlg.hxx     |    1 +
 3 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/sc/source/ui/dbgui/dpuiglobal.hxx b/sc/source/ui/dbgui/dpuiglobal.hxx
index d27d827..d112580 100644
--- a/sc/source/ui/dbgui/dpuiglobal.hxx
+++ b/sc/source/ui/dbgui/dpuiglobal.hxx
@@ -36,6 +36,7 @@
 #define FIELD_BTN_HEIGHT    23
 #define SELECT_FIELD_BTN_SPACE   2
 #define FIELD_AREA_GAP       3   // gap between row/column/data/page areas
+#define TEXT_INFO_GAP        5 // gap between the row/data areas and the text notice below.
 
 #endif
 
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 6616595..475c0ce 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -1345,6 +1345,73 @@ void ScDPLayoutDlg::CalcWndSizes()
     aWndCol.CalcSize();
     aWndData.CalcSize();
     aWndSelect.CalcSize();
+
+    AdjustDlgSize();
+}
+
+namespace {
+
+class MoveWndDown : public std::unary_function<Window*, void>
+{
+    long mnDelta;
+public:
+    MoveWndDown(long nDelta) : mnDelta(nDelta) {}
+    void operator() (Window* p) const
+    {
+        Point aPos = p->GetPosPixel();
+        aPos.Y() += mnDelta;
+        p->SetPosPixel(aPos);
+    }
+};
+
+}
+
+void ScDPLayoutDlg::AdjustDlgSize()
+{
+    // On some platforms such as Windows XP, the dialog is not large enough to
+    // show the 'Drag the fields from the right...' text at the bottom. Check
+    // if it overlaps, and if it does, make the dialog size larger.
+    Size aWndSize = GetSizePixel();
+
+    Point aPosText = aFtInfo.GetPosPixel();
+    Size aSizeText = aFtInfo.GetSizePixel();
+    long nYRef = aWndData.GetPosPixel().Y() + aWndData.GetSizePixel().Height();
+    if (aPosText.Y() > nYRef)
+        // This text is visible. No need to adjust.
+        return;
+
+    // Calculate the extra height necessary.
+    long nBottomMargin = aWndSize.Height() - (aPosText.Y() + aSizeText.Height());
+    long nHeightNeeded = nYRef + TEXT_INFO_GAP + aSizeText.Height() + nBottomMargin;
+    long nDelta = nHeightNeeded - aWndSize.Height();
+    if (nDelta <= 0)
+        // This should never happen but just in case....
+        return;
+
+    // Make the main dialog taller.
+    aWndSize.Height() += nDelta;
+    SetSizePixel(aWndSize);
+
+    // Move the relevant controls downward.
+    std::vector<Window*> aWndToMove;
+    aWndToMove.reserve(16);
+    aWndToMove.push_back(&aFtInfo);
+    aWndToMove.push_back(&aBtnMore);
+    aWndToMove.push_back(&aFlAreas);
+    aWndToMove.push_back(&aFtInArea);
+    aWndToMove.push_back(&aEdInPos);
+    aWndToMove.push_back(&aRbInPos);
+    aWndToMove.push_back(&aFtOutArea);
+    aWndToMove.push_back(&aLbOutPos);
+    aWndToMove.push_back(&aEdOutPos);
+    aWndToMove.push_back(&aRbOutPos);
+    aWndToMove.push_back(&aBtnIgnEmptyRows);
+    aWndToMove.push_back(&aBtnDetectCat);
+    aWndToMove.push_back(&aBtnTotalCol);
+    aWndToMove.push_back(&aBtnTotalRow);
+    aWndToMove.push_back(&aBtnFilter);
+    aWndToMove.push_back(&aBtnDrillDown);
+    std::for_each(aWndToMove.begin(), aWndToMove.end(), MoveWndDown(nDelta));
 }
 
 namespace {
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
index 875f25d..3ffcd64 100644
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ b/sc/source/ui/inc/pvlaydlg.hxx
@@ -196,6 +196,7 @@ private:
     void                    InitFocus       ();
     void                    InitFields      ();
     void                    CalcWndSizes    ();
+    void                    AdjustDlgSize();
     Point                   DlgPos2WndPos   ( const Point& rPt, Window& rWnd );
     ScDPLabelData*          GetLabelData    ( SCsCOL nCol, size_t* pPos = NULL );
     String                  GetLabelString  ( SCsCOL nCol );
-- 
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.