[Libreoffice-commits] .: Branch 'feature/cmclayouttrans' - 4 commits - canvas/source sw/source vcl/inc vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Aug 30 02:21:56 PDT 2012
canvas/source/directx/dx_9rm.cxx | 4 ++--
sw/source/ui/misc/linenum.cxx | 6 +++---
vcl/inc/vcl/edit.hxx | 1 +
vcl/inc/vcl/field.hxx | 12 +++++++-----
vcl/inc/vcl/spinfld.hxx | 1 +
vcl/source/control/edit.cxx | 11 +++++++----
vcl/source/control/field.cxx | 34 ++++++++++++++++++++++++++++++++++
vcl/source/control/spinfld.cxx | 12 ++++++++----
vcl/source/window/window2.cxx | 3 +--
9 files changed, 64 insertions(+), 20 deletions(-)
New commits:
commit 2420c409694375f5a36ca4b537baa1cace4d3f3a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 30 10:13:53 2012 +0100
call queue_layout from queue_resize
Change-Id: I7f28c844bfbf739337937970355dbd4a8d39fe81
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index bb7aa5a..73eff89 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1781,8 +1781,7 @@ void Window::queue_resize()
if (!pDialog || pDialog == this)
return;
- if (pDialog->isLayoutEnabled())
- pDialog->Resize();
+ pDialog->queue_layout();
}
//We deliberately do not overwrite our maHelpId here
commit 8e11c9ee92eeaff75b5fdd89119aef73d6349929
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 30 10:03:30 2012 +0100
Get optimal size of spinbuttons from min/max values, not current val
Change-Id: I2af72a1d88d2d411924110c6ead03bc8ed8b5dde
diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx
index 7e19cf0..42b9718 100644
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -229,6 +229,7 @@ public:
AutocompleteAction GetAutocompleteAction() const { return meAutocompleteAction; }
virtual Size CalcMinimumSize() const;
+ virtual Size CalcMinimumSizeForText(const rtl::OUString &rString) const;
virtual Size GetOptimalSize(WindowSizeType eType) const;
virtual Size CalcSize( sal_uInt16 nChars ) const;
virtual xub_StrLen GetMaxVisChars() const;
diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx
index e7a5eb4..1278a43 100644
--- a/vcl/inc/vcl/field.hxx
+++ b/vcl/inc/vcl/field.hxx
@@ -171,8 +171,6 @@ protected:
protected:
NumericFormatter();
- virtual XubString CreateFieldText( sal_Int64 nValue ) const;
-
void FieldUp();
void FieldDown();
void FieldFirst();
@@ -213,6 +211,7 @@ public:
void SetUserValue( sal_Int64 nNewValue );
virtual void SetValue( sal_Int64 nNewValue );
virtual sal_Int64 GetValue() const;
+ virtual XubString CreateFieldText( sal_Int64 nValue ) const;
sal_Bool IsValueModified() const;
sal_Int64 GetCorrectedValue() const { return mnCorrectedValue; }
@@ -241,8 +240,6 @@ protected:
protected:
MetricFormatter();
- virtual XubString CreateFieldText( sal_Int64 nValue ) const;
-
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
SAL_DLLPRIVATE sal_Bool ImplMetricReformat( const XubString& rStr, double& rValue, XubString& rOutStr );
@@ -275,6 +272,7 @@ public:
void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit );
virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const;
virtual sal_Int64 GetValue() const;
+ virtual XubString CreateFieldText( sal_Int64 nValue ) const;
using NumericFormatter::GetCorrectedValue;
sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const;
@@ -296,7 +294,6 @@ private:
protected:
CurrencyFormatter();
- virtual XubString CreateFieldText( sal_Int64 nValue ) const;
SAL_DLLPRIVATE sal_Bool ImplCurrencyReformat( const XubString& rStr, XubString& rOutStr );
public:
@@ -308,6 +305,7 @@ public:
virtual void SetValue( sal_Int64 nNewValue );
virtual sal_Int64 GetValue() const;
+ virtual XubString CreateFieldText( sal_Int64 nValue ) const;
};
@@ -525,6 +523,8 @@ public:
virtual long Notify( NotifyEvent& rNEvt );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual Size CalcMinimumSize() const;
+
virtual void Modify();
virtual void Up();
@@ -552,6 +552,8 @@ public:
virtual long Notify( NotifyEvent& rNEvt );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual Size CalcMinimumSize() const;
+
virtual void Modify();
virtual void Up();
diff --git a/vcl/inc/vcl/spinfld.hxx b/vcl/inc/vcl/spinfld.hxx
index fbe2fb4..f773baa 100644
--- a/vcl/inc/vcl/spinfld.hxx
+++ b/vcl/inc/vcl/spinfld.hxx
@@ -101,6 +101,7 @@ public:
const Link& GetLastHdl() const { return maLastHdlLink; }
virtual Size CalcMinimumSize() const;
+ virtual Size CalcMinimumSizeForText(const rtl::OUString &rString) const;
virtual Size GetOptimalSize(WindowSizeType eType) const;
virtual Size CalcSize( sal_uInt16 nChars ) const;
virtual void take_properties(Window &rOther);
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 2220437..6dd30d5 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2860,11 +2860,9 @@ void Edit::SetSubEdit( Edit* pEdit )
}
}
-// -----------------------------------------------------------------------
-
-Size Edit::CalcMinimumSize() const
+Size Edit::CalcMinimumSizeForText(const rtl::OUString &rString) const
{
- Size aSize ( GetTextWidth( GetText() ), GetTextHeight() );
+ Size aSize ( GetTextWidth( rString ), GetTextHeight() );
// do not create edit fields in which one cannot enter anything
// a default minimum width should exist for at least 3 characters
Size aMinSize ( CalcSize( 3 ) );
@@ -2889,6 +2887,11 @@ Size Edit::CalcMinimumSize() const
return aSize;
}
+Size Edit::CalcMinimumSize() const
+{
+ return CalcMinimumSizeForText(GetText());
+}
+
Size Edit::GetMinimumEditSize()
{
Window* pDefWin = ImplGetDefaultWindow();
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index e968b5c..be73612 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -937,6 +937,35 @@ void NumericField::Last()
SpinField::Last();
}
+namespace
+{
+ Size calcMinimumSize(const SpinField &rSpinField, const NumericFormatter &rFormatter)
+ {
+ rtl::OUStringBuffer aBuf;
+ sal_Int32 nTextLen;
+
+ nTextLen = rtl::OUString::valueOf(rFormatter.GetMin()).getLength();
+ comphelper::string::padToLength(aBuf, nTextLen, '9');
+ Size aMinTextSize = rSpinField.CalcMinimumSizeForText(
+ rFormatter.CreateFieldText(aBuf.makeStringAndClear().toInt64()));
+
+ nTextLen = rtl::OUString::valueOf(rFormatter.GetMax()).getLength();
+ comphelper::string::padToLength(aBuf, nTextLen, '9');
+ Size aMaxTextSize = rSpinField.CalcMinimumSizeForText(
+ rFormatter.CreateFieldText(aBuf.makeStringAndClear().toInt64()));
+
+ Size aRet(std::max(aMinTextSize.Width(), aMaxTextSize.Width()),
+ std::max(aMinTextSize.Height(), aMaxTextSize.Height()));
+
+ return aRet;
+ }
+}
+
+Size NumericField::CalcMinimumSize() const
+{
+ return calcMinimumSize(*this, *this);
+}
+
// -----------------------------------------------------------------------
NumericBox::NumericBox( Window* pParent, WinBits nWinStyle ) :
@@ -1693,6 +1722,11 @@ MetricField::MetricField( Window* pParent, const ResId& rResId ) :
Show();
}
+Size MetricField::CalcMinimumSize() const
+{
+ return calcMinimumSize(*this, *this);
+}
+
void MetricFormatter::take_properties(MetricFormatter &rOtherField)
{
maCustomUnitText = rOtherField.maCustomUnitText;
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index ae6b004..dcd5233 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -990,11 +990,9 @@ sal_Bool SpinField::ShowDropDown( sal_Bool )
return sal_False;
}
-// -----------------------------------------------------------------------
-
-Size SpinField::CalcMinimumSize() const
+Size SpinField::CalcMinimumSizeForText(const rtl::OUString &rString) const
{
- Size aSz = Edit::CalcMinimumSize();
+ Size aSz = Edit::CalcMinimumSizeForText(rString);
if ( GetStyle() & WB_DROPDOWN )
aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
@@ -1004,6 +1002,12 @@ Size SpinField::CalcMinimumSize() const
return aSz;
}
+Size SpinField::CalcMinimumSize() const
+{
+ fprintf(stderr, "SpinField::CalcMinimumSize\n");
+ return CalcMinimumSizeForText(GetText());
+}
+
// -----------------------------------------------------------------------
Size SpinField::GetOptimalSize(WindowSizeType eType) const
commit 9bfb70ec9d64e5a868bcc5b18be418515491833b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 30 09:26:36 2012 +0100
some windows SetPosSizePixel->setPosSizePixel
Change-Id: I676284380e2aab7327f4ceb5e043aafb29aa555d
diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index 7c22f81..0d5976d 100644
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -717,7 +717,7 @@ namespace dxcanvas
maSize.setY(static_cast<sal_Int32>(rSizePixel.Height()));
// let the child window cover the same size as the parent window.
- mpWindow->SetPosSizePixel(0,0,maSize.getX(),maSize.getY());
+ mpWindow->setPosSizePixel(0,0,maSize.getX(),maSize.getY());
// TODO(F2): since we would like to share precious hardware
// resources, the direct3d9 object should be global. each new
@@ -1024,7 +1024,7 @@ namespace dxcanvas
maSize.setX(static_cast<sal_Int32>(rect.getWidth()));
maSize.setY(static_cast<sal_Int32>(rect.getHeight()));
- mpWindow->SetPosSizePixel(0,0,maSize.getX(),maSize.getY());
+ mpWindow->setPosSizePixel(0,0,maSize.getX(),maSize.getY());
// resize back buffer, if necessary
// -------------------------------------------------------------
commit c7f323ca0c718dd87add90b49f9ed4cec0294bb1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 30 08:16:07 2012 +0100
additional syntax tidying
Change-Id: I0b99c39fb74ecabd2cc8ec16d38e362a03e83381
diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx
index cbbfb62..7d37e28 100644
--- a/sw/source/ui/misc/linenum.cxx
+++ b/sw/source/ui/misc/linenum.cxx
@@ -75,8 +75,8 @@ SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw)
sIntervalName += String::CreateFromAscii(")");
m_pDivIntervalNF->SetAccessibleName(sIntervalName);
- Window *pNumIntervalFT = m_pUIBuilder->get<Window>("interval");
- Window *pNumRowsFT = m_pUIBuilder->get<Window>("intervallines");
+ Window *pNumIntervalFT = get<Window>("interval");
+ Window *pNumRowsFT = get<Window>("intervallines");
sIntervalName = pNumIntervalFT->GetAccessibleName();
sIntervalName += String::CreateFromAscii("(");
sIntervalName += pNumRowsFT->GetAccessibleName();
@@ -139,7 +139,7 @@ SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw)
ModifyHdl();
LineOnOffHdl();
- PushButton *pOkPB = m_pUIBuilder->get<PushButton>("ok");
+ PushButton *pOkPB = get<PushButton>("ok");
pOkPB->SetClickHdl(LINK(this, SwLineNumberingDlg, OKHdl));
}
More information about the Libreoffice-commits
mailing list