[Libreoffice-commits] core.git: 2 commits - extras/source sc/uiconfig vcl/inc vcl/source
Caolán McNamara
caolanm at redhat.com
Fri Feb 22 08:56:21 PST 2013
extras/source/glade/libreoffice-catalog.xml | 15 +++++++++++++++
sc/uiconfig/scalc/ui/sortoptionspage.ui | 3 ++-
vcl/inc/vcl/combobox.hxx | 4 ++++
vcl/inc/vcl/lstbox.hxx | 4 ++++
vcl/source/control/combobox.cxx | 17 +++++++++++++++++
vcl/source/control/lstbox.cxx | 21 +++++++++++++++++++++
vcl/source/window/builder.cxx | 2 +-
7 files changed, 64 insertions(+), 2 deletions(-)
New commits:
commit 6c68f2c8edb47d8165521ce97799092ab449a9b7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Feb 22 16:54:59 2013 +0000
wrap max-width-chars in a custom widget to avoid it getting dropped silently
Change-Id: I7ccbd4b2e1aebc84a59bb9000e7322c8aa62ffd7
diff --git a/extras/source/glade/libreoffice-catalog.xml b/extras/source/glade/libreoffice-catalog.xml
index 0612baa..93f4dc6 100644
--- a/extras/source/glade/libreoffice-catalog.xml
+++ b/extras/source/glade/libreoffice-catalog.xml
@@ -57,5 +57,20 @@
<glade-widget-class title="Table Container" name="svxcorelo-SvxSimpleTableContainer"
generic-name="Simple Table Container" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
+
+ <glade-widget-class title="VclComboBoxText" name="VclComboBoxText"
+ generic-name="ComboBoxText" parent="GtkComboBoxText"
+ icon-name="widget-gtk-comboboxtext">
+ <properties>
+ <property save="True" query="False" id="max-width-chars" default="-1" name="Maximum Width in Characters">
+ <parameter-spec>
+ <type>GParamInt</type>
+ <min>-1</min>
+ </parameter-spec>
+ <tooltip>The desired maximum width of the ComboBox, in characters</tooltip>
+ </property>
+ </properties>
+ </glade-widget-class>
+
</glade-widget-classes>
</glade-catalog>
diff --git a/sc/uiconfig/scalc/ui/sortoptionspage.ui b/sc/uiconfig/scalc/ui/sortoptionspage.ui
index 2b0a9cc..0fc7eeb 100644
--- a/sc/uiconfig/scalc/ui/sortoptionspage.ui
+++ b/sc/uiconfig/scalc/ui/sortoptionspage.ui
@@ -164,7 +164,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="sortuserlb">
+ <object class="VclComboBoxText" id="sortuserlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">20</property>
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 264bf92..facb2e5 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1060,7 +1060,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
}
else if (name == "GtkLinkButton")
pWindow = new FixedHyperlink(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK|WB_NOLABEL);
- else if ((name == "GtkComboBox") || (name == "GtkComboBoxText"))
+ else if ((name == "GtkComboBox") || (name == "GtkComboBoxText") || (name == "VclComboBoxText"))
{
extractModel(id, rMap);
if (extractEntry(rMap))
commit 7c760f34a00462d5904d0e2eed4132761c2e51c5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Feb 22 15:41:00 2013 +0000
Resolves: fdo#60764 sort options can grow too wide to fit on screen
Change-Id: Id3aed9ef251f61710b43ceda1a28c6895e91872f
diff --git a/sc/uiconfig/scalc/ui/sortoptionspage.ui b/sc/uiconfig/scalc/ui/sortoptionspage.ui
index 805e0cc..2b0a9cc 100644
--- a/sc/uiconfig/scalc/ui/sortoptionspage.ui
+++ b/sc/uiconfig/scalc/ui/sortoptionspage.ui
@@ -168,6 +168,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">20</property>
+ <property name="max_width_chars">72</property>
<accessibility>
<relation type="labelled-by" target="sortuser"/>
</accessibility>
diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx
index 33a4382..1a73983 100644
--- a/vcl/inc/vcl/combobox.hxx
+++ b/vcl/inc/vcl/combobox.hxx
@@ -47,6 +47,7 @@ private:
sal_Bool mbDDAutoSize : 1;
sal_Bool mbSyntheticModify : 1;
sal_Bool mbMatchCase : 1;
+ sal_Int32 m_nMaxWidthChars;
Link maSelectHdl;
Link maDoubleClickHdl;
@@ -214,6 +215,9 @@ public:
*/
using Control::GetIndexForPoint;
long GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const;
+
+ sal_Int32 getMaxWidthChars() const { return m_nMaxWidthChars; }
+ void setMaxWidthChars(sal_Int32 nWidth);
};
#endif // _COMBOBOX_HXX
diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx
index 694f45c..74dc854 100644
--- a/vcl/inc/vcl/lstbox.hxx
+++ b/vcl/inc/vcl/lstbox.hxx
@@ -44,6 +44,7 @@ private:
sal_uInt16 mnDDHeight;
sal_uInt16 mnSaveValue;
sal_Bool mbDDAutoSize;
+ sal_Int32 m_nMaxWidthChars;
Link maSelectHdl;
Link maDoubleClickHdl;
sal_uInt16 mnLineCount;
@@ -219,6 +220,9 @@ public:
using Control::GetIndexForPoint;
long GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const;
+ sal_Int32 getMaxWidthChars() const { return m_nMaxWidthChars; }
+ void setMaxWidthChars(sal_Int32 nWidth);
+
virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
};
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 673001d..e74d024 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -110,6 +110,7 @@ void ComboBox::ImplInitComboBoxData()
mbSyntheticModify = sal_False;
mbMatchCase = sal_False;
mcMultiSep = ';';
+ m_nMaxWidthChars = -1;
}
// -----------------------------------------------------------------------
@@ -1063,6 +1064,13 @@ Size ComboBox::CalcMinimumSize() const
aSz.Height() = Edit::CalcMinimumSizeForText(GetText()).Height();
aSz.Width() = mpImplLB->GetMaxEntryWidth();
+ if (m_nMaxWidthChars != -1)
+ {
+ //MAP_APPFONT == 1/8th avg char
+ long nMaxWidth = LogicToPixel(Size(m_nMaxWidthChars * 8, 0),
+ MapMode(MAP_APPFONT)).Width();
+ aSz.Width() = std::min(aSz.Width(), nMaxWidth);
+ }
aSz.Width() += getMaxWidthScrollBarAndDownButton();
ComboBoxBounds aBounds(calcComboBoxDropDownComponentBounds(
Size(0xFFFF, 0xFFFF), Size(0xFFFF, 0xFFFF)));
@@ -1541,4 +1549,13 @@ ComboBox::ComboBoxBounds ComboBox::calcComboBoxDropDownComponentBounds(const Siz
return aBounds;
}
+void ComboBox::setMaxWidthChars(sal_Int32 nWidth)
+{
+ if (nWidth != m_nMaxWidthChars)
+ {
+ m_nMaxWidthChars = nWidth;
+ queue_resize();
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index beb216d..d87c1b3 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -98,6 +98,7 @@ void ListBox::ImplInitListBoxData()
mbDDAutoSize = sal_True;
mnSaveValue = LISTBOX_ENTRY_NOTFOUND;
mnLineCount = 0;
+ m_nMaxWidthChars = -1;
}
// -----------------------------------------------------------------------
@@ -1344,6 +1345,15 @@ Size ListBox::CalcSubEditSize() const
aSz.Height() = mpImplLB->CalcSize( 1 ).Height();
// size to maxmimum entry width
aSz.Width() = mpImplLB->GetMaxEntryWidth();
+
+ if (m_nMaxWidthChars != -1)
+ {
+ //MAP_APPFONT == 1/8th avg char
+ long nMaxWidth = LogicToPixel(Size(m_nMaxWidthChars * 8, 0),
+ MapMode(MAP_APPFONT)).Width();
+ aSz.Width() = std::min(aSz.Width(), nMaxWidth);
+ }
+
// do not create ultrathin ListBoxes, it doesn't look good
if( aSz.Width() < GetSettings().GetStyleSettings().GetScrollBarSize() )
aSz.Width() = GetSettings().GetStyleSettings().GetScrollBarSize();
@@ -1552,10 +1562,21 @@ const Wallpaper& ListBox::GetDisplayBackground() const
return mpImplLB->GetDisplayBackground();
}
+void ListBox::setMaxWidthChars(sal_Int32 nWidth)
+{
+ if (nWidth != m_nMaxWidthChars)
+ {
+ m_nMaxWidthChars = nWidth;
+ queue_resize();
+ }
+}
+
bool ListBox::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
{
if (rKey == "active")
SelectEntryPos(rValue.toInt32());
+ else if (rKey == "max-width-chars")
+ setMaxWidthChars(rValue.toInt32());
else
return Control::set_property(rKey, rValue);
return true;
More information about the Libreoffice-commits
mailing list