[Libreoffice-commits] core.git: 2 commits - cui/uiconfig include/editeng include/sfx2 include/svx include/vcl sfx2/uiconfig vcl/source
Caolán McNamara
caolanm at redhat.com
Mon Jun 24 06:41:01 PDT 2013
cui/uiconfig/ui/pastespecial.ui | 1 +
include/editeng/editids.hrc | 15 ++++++++++-----
include/sfx2/sfxsids.hrc | 4 ++++
include/svx/svxids.hrc | 3 +++
include/vcl/edit.hxx | 3 +++
sfx2/uiconfig/ui/documentinfopage.ui | 2 ++
vcl/source/control/edit.cxx | 21 ++++++++++++++++++++-
7 files changed, 43 insertions(+), 6 deletions(-)
New commits:
commit 669ad519902e21e0cb3537fb7e203987f75a4077
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 24 14:40:07 2013 +0100
colliding SID_SVX_START based ids
Change-Id: I6eba0b0c2291a71ebe683b23a0af400010d5b5d8
diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc
index 7dbaae8..e6c67c6 100644
--- a/include/editeng/editids.hrc
+++ b/include/editeng/editids.hrc
@@ -21,6 +21,12 @@
#include <svl/solar.hrc>
+/*
+ These SID_SVX_START entries came from include/svx/svxids.hrc, avoid
+ accidentally colliding entries with include/svx/svxids.hrc and
+ include/sfx2/sfxsids.hrc. Only add new SID_SVX_START entries to
+ include/svx/svxids.hrc
+*/
#define SID_ATTR_BRUSH ( SID_SVX_START + 1 )
#define SID_ATTR_TABSTOP ( SID_SVX_START + 2 )
#define SID_ATTR_TABSTOP_DEFAULTS ( SID_SVX_START + 3 )
@@ -112,17 +118,16 @@
#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_SVX_START + 996 )
#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_SVX_START + 997 )
#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_SVX_START + 998 )
-#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_SVX_START + 1121 )
-#define SID_ATTR_CHAR_PREVIEW_FONT ( SID_SVX_START + 1122 )
-#define SID_ATTR_CHAR_ENDPREVIEW_FONT ( SID_SVX_START + 1123 )
-
-// this ID didn't exist prior to the svx split
+// these ID didn't exist prior to the svx split, add new ids here
#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
#define SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD ( SID_EDIT_START + 69 )
#define SID_ATTR_ALIGN_VER_JUSTIFY_METHOD ( SID_EDIT_START + 70 )
#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_EDIT_START + 71 )
#define SID_ATTR_ALIGN_VER_JUSTIFY ( SID_EDIT_START + 72 )
+#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_EDIT_START + 73 )
+#define SID_ATTR_CHAR_PREVIEW_FONT ( SID_EDIT_START + 74 )
+#define SID_ATTR_CHAR_ENDPREVIEW_FONT ( SID_EDIT_START + 75 )
/*
// planned, but not doable: changing value of SIDs will break code that uses them for WhichRanges
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index fcfe4dd..d1227e3 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -583,6 +583,10 @@
#define SID_HELP_STYLESHEET (SID_OPTIONS_START + 99)
// slot IDs from SVX (svxids.hrc) ---------------------------------------------
+// These SID_SVX_START entries came from include/svx/svxids.hrc, avoid
+// accidentally colliding entries with include/svx/svxids.hrc and
+// include/editeng/editids.hrc. Only add new SID_SVX_START entries
+// to include/svx/svxids.hrc
#define SID_ZOOM_TOOLBOX (SID_SVX_START + 96)
#define SID_ZOOM_OUT (SID_SVX_START + 97)
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 7a62e63..8aa8807 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -269,6 +269,9 @@
// --------------------------------------------------------------------------
// Svx-Id's
+// When adding new entries here, note that other SID_SVX_START entries exist in
+// include/editeng/editids.hrc and include/sfx2/sfxsids.hrc so don't use the
+// same id for two different attributes
// --------------------------------------------------------------------------
#define SID_ATTR_BORDER_INNER ( SID_SVX_START + 23 )
commit 9495e912797f67897a4a658d20137bb94f39e9ab
Author: Caolán McNamara <caolanm at 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
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 2809979..7770b76 100644
--- a/sfx2/uiconfig/ui/documentinfopage.ui
+++ b/sfx2/uiconfig/ui/documentinfopage.ui
@@ -277,6 +277,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>
@@ -338,6 +339,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 cfd4d33..70f19f9 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -214,10 +214,22 @@ void Edit::SetWidthInChars(sal_Int32 nWidthInChars)
}
}
+void Edit::setMaxWidthChars(sal_Int32 nWidth)
+{
+ if (nWidth != mnMaxWidthChars)
+ {
+ mnMaxWidthChars = nWidth;
+ fprintf(stderr, "setMaxWidthChars of %d\n", 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 +307,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 +2899,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
More information about the Libreoffice-commits
mailing list