summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/weld.hxx1
-rw-r--r--sw/source/ui/table/tabledlg.cxx43
-rw-r--r--sw/source/uibase/inc/prcntfld.hxx1
-rw-r--r--sw/source/uibase/table/tablepg.hxx1
-rw-r--r--sw/uiconfig/swriter/ui/tablecolumnpage.ui44
-rw-r--r--vcl/source/app/salvtables.cxx5
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx6
7 files changed, 69 insertions, 32 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e49e3689f56d..86ecdfe01032 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -75,6 +75,7 @@ public:
virtual void set_grid_left_attach(int nAttach) = 0;
virtual int get_grid_left_attach() const = 0;
+ virtual void set_grid_width(int nCols) = 0;
virtual void set_grid_top_attach(int nAttach) = 0;
virtual int get_grid_top_attach() const = 0;
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 8e61980b1dff..13423f5899ba 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -702,6 +702,7 @@ SwTableColumnPage::SwTableColumnPage(TabPageParent pParent, const SfxItemSet& rS
, pTableData(nullptr)
, nTableWidth(0)
, nMinWidth(MINLAY)
+ , nMetFields(MET_FIELDS)
, nNoOfCols(0)
, nNoOfVisibleCols(0)
, bModified(false)
@@ -728,6 +729,24 @@ SwTableColumnPage::SwTableColumnPage(TabPageParent pParent, const SfxItemSet& rS
{
SetExchangeSupport();
+ //tdf#120420 keeping showing column width fields unless
+ //the dialog begins to grow, then stop adding them
+ weld::Window* pTopLevel = pParent.GetFrameWeld();
+ Size aOrigSize = pTopLevel->get_preferred_size();
+ for (sal_uInt16 i = 0; i < MET_FIELDS; ++i)
+ {
+ m_aFieldArr[i].show();
+ m_aTextArr[i]->show();
+
+ if (pTopLevel->get_preferred_size().Width() > aOrigSize.Width())
+ {
+ nMetFields = i + 1;
+ m_aTextArr[i]->set_grid_width(1);
+ m_xUpBtn->set_grid_left_attach(nMetFields * 2 - 1);
+ break;
+ }
+ }
+
const SfxPoolItem* pItem;
Init(SfxItemState::SET == rSet.GetItemState( SID_HTML_MODE, false,&pItem )
&& static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON);
@@ -763,7 +782,7 @@ void SwTableColumnPage::Reset( const SfxItemSet* )
}
sal_Int64 nMinTwips = m_aFieldArr[0].NormalizePercent( nMinWidth );
sal_Int64 nMaxTwips = m_aFieldArr[0].NormalizePercent( nTableWidth );
- for( sal_uInt16 i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
+ for( sal_uInt16 i = 0; (i < nMetFields) && (i < nNoOfVisibleCols); i++ )
{
m_aFieldArr[i].SetPrcntValue( m_aFieldArr[i].NormalizePercent(
GetVisibleWidth(i) ), FUNIT_TWIP );
@@ -773,10 +792,12 @@ void SwTableColumnPage::Reset( const SfxItemSet* )
m_aTextArr[i]->set_sensitive(true);
}
- if( nNoOfVisibleCols > MET_FIELDS )
+ if (nNoOfVisibleCols > nMetFields)
+ {
m_xUpBtn->set_sensitive(true);
+ }
- for( sal_uInt16 i = nNoOfVisibleCols; i < MET_FIELDS; ++i )
+ for( sal_uInt16 i = nNoOfVisibleCols; i < nMetFields; ++i )
{
m_aFieldArr[i].set_text(OUString());
m_aTextArr[i]->set_sensitive(false);
@@ -790,7 +811,7 @@ void SwTableColumnPage::Init(bool bWeb)
{
FieldUnit aMetric = ::GetDfltMetric(bWeb);
Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwTableColumnPage, ValueChangedHdl);
- for (sal_uInt16 i = 0; i < MET_FIELDS; ++i)
+ for (sal_uInt16 i = 0; i < nMetFields; ++i)
{
aValueTable[i] = i;
m_aFieldArr[i].SetMetric(aMetric);
@@ -820,13 +841,13 @@ IMPL_LINK(SwTableColumnPage, AutoClickHdl, weld::Button&, rControl, void)
}
if (&rControl == m_xUpBtn.get())
{
- if( aValueTable[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 )
+ if( aValueTable[ nMetFields -1 ] < nNoOfVisibleCols -1 )
{
for(sal_uInt16 & rn : aValueTable)
rn += 1;
}
}
- for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < MET_FIELDS); i++ )
+ for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < nMetFields); i++ )
{
OUString sEntry('~');
OUString sIndex = OUString::number( aValueTable[i] + 1 );
@@ -835,7 +856,7 @@ IMPL_LINK(SwTableColumnPage, AutoClickHdl, weld::Button&, rControl, void)
}
m_xDownBtn->set_sensitive(aValueTable[0] > 0);
- m_xUpBtn->set_sensitive(aValueTable[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 );
+ m_xUpBtn->set_sensitive(aValueTable[ nMetFields -1 ] < nNoOfVisibleCols -1 );
UpdateCols(0);
}
@@ -879,7 +900,7 @@ void SwTableColumnPage::ModifyHdl(const weld::MetricSpinButton* pField)
SwPercentField *pEdit = nullptr;
sal_uInt16 i;
- for( i = 0; i < MET_FIELDS; i++)
+ for( i = 0; i < nMetFields; i++)
{
if (pField == m_aFieldArr[i].get())
{
@@ -888,7 +909,7 @@ void SwTableColumnPage::ModifyHdl(const weld::MetricSpinButton* pField)
}
}
- if (MET_FIELDS <= i || !pEdit)
+ if (nMetFields <= i || !pEdit)
{
OSL_ENSURE(false, "cannot happen.");
return;
@@ -1004,7 +1025,7 @@ void SwTableColumnPage::UpdateCols( sal_uInt16 nCurrentPos )
if(!bPercentMode)
m_xSpaceED->set_value(m_xSpaceED->normalize(pTableData->GetSpace() - nTableWidth), FUNIT_TWIP);
- for( sal_uInt16 i = 0; ( i < nNoOfVisibleCols ) && ( i < MET_FIELDS ); i++)
+ for( sal_uInt16 i = 0; ( i < nNoOfVisibleCols ) && ( i < nMetFields ); i++)
{
m_aFieldArr[i].SetPrcntValue(m_aFieldArr[i].NormalizePercent(
GetVisibleWidth(aValueTable[i]) ), FUNIT_TWIP);
@@ -1014,7 +1035,7 @@ void SwTableColumnPage::UpdateCols( sal_uInt16 nCurrentPos )
void SwTableColumnPage::ActivatePage( const SfxItemSet& )
{
bPercentMode = pTableData->GetWidthPercent() != 0;
- for( sal_uInt16 i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
+ for( sal_uInt16 i = 0; (i < nMetFields) && (i < nNoOfVisibleCols); i++ )
{
m_aFieldArr[i].SetRefValue(pTableData->GetWidth());
m_aFieldArr[i].ShowPercent( bPercentMode );
diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx
index 17c16e78f041..6b831a259b13 100644
--- a/sw/source/uibase/inc/prcntfld.hxx
+++ b/sw/source/uibase/inc/prcntfld.hxx
@@ -112,6 +112,7 @@ public:
void connect_value_changed(const Link<weld::MetricSpinButton&, void>& rLink) { m_pField->connect_value_changed(rLink); }
void SetMetric(FieldUnit eUnit) { ::SetFieldUnit(*m_pField, eUnit); }
void set_sensitive(bool bEnable) { m_pField->set_sensitive(bEnable); }
+ void show() { m_pField->show(); }
bool has_focus() const { return m_pField->has_focus(); }
void save_value() { m_pField->save_value(); }
bool get_value_changed_from_saved() const { return m_pField->get_value_changed_from_saved(); }
diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx
index 02f9d57ba758..ad939bc635dd 100644
--- a/sw/source/uibase/table/tablepg.hxx
+++ b/sw/source/uibase/table/tablepg.hxx
@@ -99,6 +99,7 @@ class SwTableColumnPage : public SfxTabPage
SwTableRep* pTableData;
SwTwips nTableWidth;
SwTwips nMinWidth;
+ sal_uInt16 nMetFields;
sal_uInt16 nNoOfCols;
sal_uInt16 nNoOfVisibleCols;
// Remember the width, when switching to autoalign
diff --git a/sw/uiconfig/swriter/ui/tablecolumnpage.ui b/sw/uiconfig/swriter/ui/tablecolumnpage.ui
index 5efafa5cce5e..00050c4e2a81 100644
--- a/sw/uiconfig/swriter/ui/tablecolumnpage.ui
+++ b/sw/uiconfig/swriter/ui/tablecolumnpage.ui
@@ -151,7 +151,6 @@
<property name="column_spacing">12</property>
<child>
<object class="GtkSpinButton" id="width2">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
@@ -168,11 +167,11 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="width3">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
@@ -187,13 +186,13 @@
</child>
</object>
<packing>
- <property name="left_attach">3</property>
+ <property name="left_attach">4</property>
<property name="top_attach">1</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="width4">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
@@ -208,13 +207,13 @@
</child>
</object>
<packing>
- <property name="left_attach">4</property>
+ <property name="left_attach">6</property>
<property name="top_attach">1</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="width5">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
@@ -229,13 +228,13 @@
</child>
</object>
<packing>
- <property name="left_attach">5</property>
+ <property name="left_attach">8</property>
<property name="top_attach">1</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="width6">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
@@ -250,30 +249,30 @@
</child>
</object>
<packing>
- <property name="left_attach">6</property>
+ <property name="left_attach">10</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="6">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="label">_6</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">width6</property>
</object>
<packing>
- <property name="left_attach">6</property>
+ <property name="left_attach">10</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="1">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="label">_1</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">width1</property>
@@ -285,9 +284,9 @@
</child>
<child>
<object class="GtkLabel" id="2">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="label">_2</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">width2</property>
@@ -295,53 +294,56 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="3">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="label">_3</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">width3</property>
</object>
<packing>
- <property name="left_attach">3</property>
+ <property name="left_attach">4</property>
<property name="top_attach">0</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="5">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="label">_5</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">width5</property>
</object>
<packing>
- <property name="left_attach">5</property>
+ <property name="left_attach">8</property>
<property name="top_attach">0</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="4">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="label">_4</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">width4</property>
</object>
<packing>
- <property name="left_attach">4</property>
+ <property name="left_attach">6</property>
<property name="top_attach">0</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="width1">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
@@ -387,7 +389,7 @@
<property name="always_show_image">True</property>
</object>
<packing>
- <property name="left_attach">7</property>
+ <property name="left_attach">11</property>
<property name="top_attach">0</property>
</packing>
</child>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3d03b0a70124..102aa450c70a 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -341,6 +341,11 @@ public:
return m_xWidget->get_grid_left_attach();
}
+ virtual void set_grid_width(int nCols) override
+ {
+ m_xWidget->set_grid_width(nCols);
+ }
+
virtual void set_grid_top_attach(int nAttach) override
{
m_xWidget->set_grid_top_attach(nAttach);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a03682d46bba..71131528dd46 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1346,6 +1346,12 @@ public:
return nAttach;
}
+ virtual void set_grid_width(int nCols) override
+ {
+ GtkContainer* pParent = GTK_CONTAINER(gtk_widget_get_parent(m_pWidget));
+ gtk_container_child_set(pParent, m_pWidget, "width", nCols, nullptr);
+ }
+
virtual void set_grid_top_attach(int nAttach) override
{
GtkContainer* pParent = GTK_CONTAINER(gtk_widget_get_parent(m_pWidget));