summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-08-30 13:11:47 -0400
committerTor Lillqvist <tlillqvist@suse.com>2011-09-08 08:06:46 +0300
commit8ceb17039c1bbfcb8d64eef9265b99238addcf6a (patch)
treecc4ab59b17791d4259faade96a439e7ba1c05e3b
parent577bf305f26f70cb3ef9dee9f0063f8bbbb3e51b (diff)
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. Signed-off-by: Tor Lillqvist <tlillqvist@suse.com>
-rw-r--r--sc/source/ui/dbgui/dpuiglobal.hxx1
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx67
-rw-r--r--sc/source/ui/inc/pvlaydlg.hxx1
3 files changed, 69 insertions, 0 deletions
diff --git a/sc/source/ui/dbgui/dpuiglobal.hxx b/sc/source/ui/dbgui/dpuiglobal.hxx
index d27d8278d..d1125807a 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 6616595d1..475c0ce93 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 875f25dbc..3ffcd6444 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 );