cui/uiconfig/ui/pastespecial.ui | 1 + include/vcl/edit.hxx | 3 +++ sfx2/uiconfig/ui/documentinfopage.ui | 2 ++ vcl/source/control/edit.cxx | 20 +++++++++++++++++++- 4 files changed, 25 insertions(+), 1 deletion(-)
New commits: commit 112ce9b1dc1cbf34bb6378ff2e61dba6144782c9 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Jun 24 12:42:39 2013 +0100 Resolves: fdo#66105 set max growth width for labels/edits which take paths Change-Id: I12220821f76550baacdc8ce604f2e612d260c1a1 (cherry picked from commit 9495e912797f67897a4a658d20137bb94f39e9ab) Reviewed-on: https://gerrit.libreoffice.org/4481 Reviewed-by: Fridrich Strba <fridr...@documentfoundation.org> Tested-by: Fridrich Strba <fridr...@documentfoundation.org> diff --git a/cui/uiconfig/ui/pastespecial.ui b/cui/uiconfig/ui/pastespecial.ui index fb08b9e..3eb4e7d 100644 --- a/cui/uiconfig/ui/pastespecial.ui +++ b/cui/uiconfig/ui/pastespecial.ui @@ -97,6 +97,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="wrap">True</property> + <property name="max_width_chars">72</property> </object> <packing> <property name="expand">False</property> diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx index 11c1ae8..6df1f7b 100644 --- a/include/vcl/edit.hxx +++ b/include/vcl/edit.hxx @@ -71,6 +71,7 @@ private: sal_uInt16 mnAlign; xub_StrLen mnMaxTextLen; sal_Int32 mnWidthInChars; + sal_Int32 mnMaxWidthChars; AutocompleteAction meAutocompleteAction; sal_Unicode mcEchoChar; sal_Bool mbModified:1, @@ -193,6 +194,8 @@ public: void SetWidthInChars(sal_Int32 nWidthInChars); sal_Int32 GetWidthInChars() const { return mnWidthInChars; } + void setMaxWidthChars(sal_Int32 nWidth); + virtual void SetSelection( const Selection& rSelection ); virtual const Selection& GetSelection() const; diff --git a/sfx2/uiconfig/ui/documentinfopage.ui b/sfx2/uiconfig/ui/documentinfopage.ui index eeccbd0..f25a95a 100644 --- a/sfx2/uiconfig/ui/documentinfopage.ui +++ b/sfx2/uiconfig/ui/documentinfopage.ui @@ -275,6 +275,7 @@ <property name="can_focus">False</property> <property name="xalign">0</property> <property name="selectable">True</property> + <property name="max_width_chars">56</property> </object> <packing> <property name="left_attach">1</property> @@ -336,6 +337,7 @@ <property name="can_focus">False</property> <property name="xalign">0</property> <property name="selectable">True</property> + <property name="max_width_chars">56</property> </object> <packing> <property name="left_attach">1</property> diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 20323b3..e8798a2 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -214,10 +214,21 @@ void Edit::SetWidthInChars(sal_Int32 nWidthInChars) } } +void Edit::setMaxWidthChars(sal_Int32 nWidth) +{ + if (nWidth != mnMaxWidthChars) + { + mnMaxWidthChars = nWidth; + queue_resize(); + } +} + bool Edit::set_property(const OString &rKey, const OString &rValue) { if (rKey == "width-chars") SetWidthInChars(rValue.toInt32()); + else if (rKey == "max-width-chars") + setMaxWidthChars(rValue.toInt32()); else if (rKey == "max-length") { sal_Int32 nTextLen = rValue.toInt32(); @@ -295,6 +306,7 @@ void Edit::ImplInitEditData() mnAlign = EDIT_ALIGN_LEFT; mnMaxTextLen = EDIT_NOLIMIT; mnWidthInChars = -1; + mnMaxWidthChars = -1; meAutocompleteAction = AUTOCOMPLETE_KEYINPUT; mbModified = sal_False; mbInternModified = sal_False; @@ -2886,8 +2898,14 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const } else { + OUString aString; + if (mnMaxWidthChars != -1 && mnMaxWidthChars < rString.getLength()) + aString = rString.copy(0, mnMaxWidthChars); + else + aString = rString; + aSize.Height() = GetTextHeight(); - aSize.Width() = GetTextWidth(rString); + aSize.Width() = GetTextWidth(aString); aSize.Width() += ImplGetExtraOffset() * 2; // do not create edit fields in which one cannot enter anything // a default minimum width should exist for at least 3 characters
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits