[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Apr 25 10:43:24 PDT 2011
sc/source/ui/dbgui/dpuiglobal.hxx | 1 -
sc/source/ui/dbgui/fieldwnd.cxx | 9 +++++++--
sc/source/ui/dbgui/pvlaydlg.cxx | 22 +++++++++++++++++++---
sc/source/ui/inc/fieldwnd.hxx | 1 +
sc/source/ui/inc/pvlaydlg.hxx | 2 ++
5 files changed, 29 insertions(+), 6 deletions(-)
New commits:
commit 79ab92c3f4195e4895aae2b7b1a02c3cf0ced8bc
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Apr 25 12:34:16 2011 -0400
Fixed layout problem on Windows. It was not entirely platform independent.
diff --git a/sc/source/ui/dbgui/dpuiglobal.hxx b/sc/source/ui/dbgui/dpuiglobal.hxx
index b648750..d27d827 100644
--- a/sc/source/ui/dbgui/dpuiglobal.hxx
+++ b/sc/source/ui/dbgui/dpuiglobal.hxx
@@ -33,7 +33,6 @@
#define OUTER_MARGIN_VER 4
#define DATA_FIELD_BTN_GAP 2 // must be an even number
#define ROW_FIELD_BTN_GAP 2 // must be an even number
-#define FIELD_BTN_WIDTH 81
#define FIELD_BTN_HEIGHT 23
#define SELECT_FIELD_BTN_SPACE 2
#define FIELD_AREA_GAP 3 // gap between row/column/data/page areas
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index 474c487..eadd0f4 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -611,6 +611,11 @@ void ScDPFieldControlBase::DrawInvertSelection()
InvertTracking(aSel, SHOWTRACK_SMALL | SHOWTRACK_WINDOW);
}
+Size ScDPFieldControlBase::GetStdFieldBtnSize() const
+{
+ return mpDlg->GetStdFieldBtnSize();
+}
+
bool ScDPFieldControlBase::IsShortenedText( size_t nIndex ) const
{
const FieldNames& rFields = GetFieldNames();
@@ -726,7 +731,7 @@ Point ScDPHorFieldControl::GetFieldPosition( size_t nIndex )
Size ScDPHorFieldControl::GetFieldSize() const
{
- return Size(FIELD_BTN_WIDTH, FIELD_BTN_HEIGHT);
+ return GetStdFieldBtnSize();
}
bool ScDPHorFieldControl::GetFieldIndex( const Point& rPos, size_t& rnIndex )
@@ -1032,7 +1037,7 @@ Point ScDPRowFieldControl::GetFieldPosition(size_t nIndex)
Size ScDPRowFieldControl::GetFieldSize() const
{
- return Size(FIELD_BTN_WIDTH, FIELD_BTN_HEIGHT);
+ return GetStdFieldBtnSize();
}
bool ScDPRowFieldControl::GetFieldIndex( const Point& rPos, size_t& rnIndex )
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index a5fc7cd..0ff9928 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -1132,6 +1132,14 @@ void ScDPLayoutDlg::NotifyRemoveField( ScDPFieldType eType, size_t nFieldIndex )
RemoveField( eType, nFieldIndex );
}
+Size ScDPLayoutDlg::GetStdFieldBtnSize() const
+{
+ // This size is static but is platform dependent. The field button size
+ // is calculated relative to the size of the OK button.
+ double w = static_cast<double>(aBtnOk.GetSizePixel().Width()) * 0.70;
+ return Size(static_cast<long>(w), FIELD_BTN_HEIGHT);
+}
+
void ScDPLayoutDlg::Deactivate()
{
/* If the dialog has been deactivated (click into document), the LoseFocus
@@ -1290,10 +1298,18 @@ Point ScDPLayoutDlg::DlgPos2WndPos( const Point& rPt, Window& rWnd )
void ScDPLayoutDlg::CalcWndSizes()
{
+ // The pivot.src file only specifies the positions of the controls. Here,
+ // we calculate appropriate size of each control based on how they are
+ // positioned relative to each other.
+
// row/column/data area sizes
- long nFldW = FIELD_BTN_WIDTH;
- long nFldH = FIELD_BTN_HEIGHT;
- aWndData.SetSizePixel(Size(338, 185));
+ long nFldW = GetStdFieldBtnSize().Width();
+ long nFldH = GetStdFieldBtnSize().Height();
+
+ aWndData.SetSizePixel(
+ Size(aWndSelect.GetPosPixel().X() - aWndData.GetPosPixel().X() - FIELD_AREA_GAP*4,
+ 185));
+
aWndPage.SetSizePixel(
Size(aWndData.GetSizePixel().Width() + 85,
aWndCol.GetPosPixel().Y() - aWndPage.GetPosPixel().Y() - FIELD_AREA_GAP));
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx
index 7835855..edd8aec 100644
--- a/sc/source/ui/inc/fieldwnd.hxx
+++ b/sc/source/ui/inc/fieldwnd.hxx
@@ -195,6 +195,7 @@ protected:
void AppendPaintable(Window* p);
void DrawPaintables();
void DrawInvertSelection();
+ Size GetStdFieldBtnSize() const;
/** @return The new selection index after moving to the given direction. */
virtual size_t CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const = 0;
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
index 19176e7..875f25d 100644
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ b/sc/source/ui/inc/pvlaydlg.hxx
@@ -104,6 +104,8 @@ public:
void NotifyMoveFieldToEnd ( ScDPFieldType eToType );
void NotifyRemoveField ( ScDPFieldType eType, size_t nFieldIndex );
+ Size GetStdFieldBtnSize() const;
+
protected:
virtual void Deactivate();
More information about the Libreoffice-commits
mailing list