[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Aug 30 13:20:38 PDT 2011


 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(+)

New commits:
commit 8bf60230255e0e8da66cafff578f148858cee4ca
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Aug 30 13:11:47 2011 -0400

    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.

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 c54fae1..866b068 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 );


More information about the Libreoffice-commits mailing list