summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-07-10 22:41:46 +0300
committerMiklos Vajna <vmiklos@collabora.com>2023-07-11 14:03:50 +0200
commitb13a7112d89b402b41640a19f55ad9edb6433592 (patch)
tree0e182800d03073ce2e7b6c0984d591a736c38673 /cui
parentfd64b426bc6175841143714ccc16bad181fd088f (diff)
tdf#150408: Implement UI for "Legal" numbering
Change-Id: I16849a2d823539040ecb91416b5214d25851950a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154287 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/numpages.hxx2
-rw-r--r--cui/source/tabpages/numpages.cxx27
-rw-r--r--cui/uiconfig/ui/numberingoptionspage.ui47
3 files changed, 62 insertions, 14 deletions
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index dd1dfbaf31c6..d693b9e0324f 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -235,6 +235,7 @@ class SvxNumOptionsTabPage : public SfxTabPage
std::unique_ptr<weld::MetricSpinButton> m_xBulRelSizeMF;
std::unique_ptr<weld::Label> m_xAllLevelFT;
std::unique_ptr<weld::SpinButton> m_xAllLevelNF;
+ std::unique_ptr<weld::CheckButton> m_xIsLegalCB;
std::unique_ptr<weld::Label> m_xStartFT;
std::unique_ptr<weld::SpinButton> m_xStartED;
std::unique_ptr<weld::Label> m_xBulletFT;
@@ -273,6 +274,7 @@ class SvxNumOptionsTabPage : public SfxTabPage
DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
DECL_LINK(SpinModifyHdl_Impl, weld::SpinButton&, void);
DECL_LINK(AllLevelHdl_Impl, weld::SpinButton&, void);
+ DECL_LINK(IsLegalHdl_Impl, weld::Toggleable&, void);
DECL_LINK(OrientHdl_Impl, weld::ComboBox&, void);
DECL_LINK(SameLevelHdl_Impl, weld::Toggleable&, void);
DECL_LINK(BulColorHdl_Impl, ColorListBox&, void);
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 2179ad2cf107..45ee580f1667 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1037,6 +1037,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
, m_xBulRelSizeMF(m_xBuilder->weld_metric_spin_button("relsize", FieldUnit::PERCENT))
, m_xAllLevelFT(m_xBuilder->weld_label("sublevelsft"))
, m_xAllLevelNF(m_xBuilder->weld_spin_button("sublevels"))
+ , m_xIsLegalCB(m_xBuilder->weld_check_button("islegal"))
, m_xStartFT(m_xBuilder->weld_label("startatft"))
, m_xStartED(m_xBuilder->weld_spin_button("startat"))
, m_xBulletFT(m_xBuilder->weld_label("bulletft"))
@@ -1074,6 +1075,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
m_xPrefixED->connect_changed(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
m_xSuffixED->connect_changed(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
m_xAllLevelNF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl));
+ m_xIsLegalCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, IsLegalHdl_Impl));
m_xOrientLB->connect_changed(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl));
m_xSameLevelCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl));
m_xBulRelSizeMF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl));
@@ -1271,6 +1273,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
bool bAllLevel = bContinuous && !bHTMLMode;
m_xAllLevelFT->set_visible(bAllLevel);
m_xAllLevelNF->set_visible(bAllLevel);
+ m_xIsLegalCB->set_visible(bAllLevel);
m_xAllLevelsFrame->set_visible(bContinuous);
@@ -1334,6 +1337,8 @@ void SvxNumOptionsTabPage::InitControls()
bool bSameBulColor = true;
bool bSameBulRelSize= true;
+ TriState isLegal = TRISTATE_INDET;
+
const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
OUString sFirstCharFmt;
sal_Int16 eFirstOrient = text::VertOrientation::NONE;
@@ -1358,6 +1363,7 @@ void SvxNumOptionsTabPage::InitControls()
eFirstOrient = aNumFmtArr[i]->GetVertOrient();
if(bShowBitmap)
aFirstSize = aNumFmtArr[i]->GetGraphicSize();
+ isLegal = aNumFmtArr[i]->GetIsLegal() ? TRISTATE_TRUE : TRISTATE_FALSE;
}
if( i > nLvl)
{
@@ -1367,6 +1373,8 @@ void SvxNumOptionsTabPage::InitControls()
bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix();
bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix();
bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels();
+ if (aNumFmtArr[i]->GetIsLegal() != aNumFmtArr[nLvl]->GetIsLegal())
+ isLegal = TRISTATE_INDET;
bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFormatName();
bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient();
if(bShowBitmap && bSameSize)
@@ -1439,6 +1447,9 @@ void SvxNumOptionsTabPage::InitControls()
m_xAllLevelNF->set_text("");
}
+ m_xIsLegalCB->set_state(isLegal);
+ m_xIsLegalCB->set_sensitive(!m_xSameLevelCB->get_active());
+
if(bBullRelSize)
{
if(bSameBulRelSize)
@@ -1518,6 +1529,7 @@ void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType )
bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
m_xAllLevelFT->set_visible(bAllLevel);
m_xAllLevelNF->set_visible(bAllLevel);
+ m_xIsLegalCB->set_visible(bAllLevel);
m_xStartFT->set_visible(!(bBullet||bBitmap));
m_xStartED->set_visible(!(bBullet||bBitmap));
@@ -1627,6 +1639,21 @@ IMPL_LINK(SvxNumOptionsTabPage, AllLevelHdl_Impl, weld::SpinButton&, rBox, void)
SetModified();
}
+IMPL_LINK(SvxNumOptionsTabPage, IsLegalHdl_Impl, weld::Toggleable&, rBox, void)
+{
+ bool bSet = rBox.get_active();
+ for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if (nActNumLvl & (sal_uInt16(1) << i))
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ aNumFmt.SetIsLegal(bSet);
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ }
+ SetModified();
+}
+
IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox, void)
{
OUString sSelectStyle;
diff --git a/cui/uiconfig/ui/numberingoptionspage.ui b/cui/uiconfig/ui/numberingoptionspage.ui
index adb0ea9cc662..82ea810beef2 100644
--- a/cui/uiconfig/ui/numberingoptionspage.ui
+++ b/cui/uiconfig/ui/numberingoptionspage.ui
@@ -209,6 +209,25 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="islegal">
+ <property name="label" translatable="yes" context="numberingoptionspage|islegal">All sublevels Arabic</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="islegal-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="numberingoptionspage|extended_tip|islegal">Use Arabic numerals for all sublevels ("Legal" numbering).</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkSpinButton" id="startat">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -266,7 +285,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">11</property>
+ <property name="top_attach">12</property>
</packing>
</child>
<child>
@@ -280,7 +299,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">12</property>
+ <property name="top_attach">13</property>
</packing>
</child>
<child>
@@ -299,7 +318,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">12</property>
+ <property name="top_attach">13</property>
</packing>
</child>
<child>
@@ -314,7 +333,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">13</property>
+ <property name="top_attach">14</property>
</packing>
</child>
<child>
@@ -333,7 +352,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">13</property>
+ <property name="top_attach">14</property>
</packing>
</child>
<child>
@@ -352,7 +371,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">14</property>
+ <property name="top_attach">15</property>
</packing>
</child>
<child>
@@ -366,7 +385,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">15</property>
+ <property name="top_attach">16</property>
</packing>
</child>
<child>
@@ -393,7 +412,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">15</property>
+ <property name="top_attach">16</property>
</packing>
</child>
<child>
@@ -416,7 +435,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">11</property>
+ <property name="top_attach">12</property>
</packing>
</child>
<child>
@@ -488,7 +507,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">9</property>
+ <property name="top_attach">10</property>
</packing>
</child>
<child>
@@ -501,7 +520,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">8</property>
+ <property name="top_attach">9</property>
</packing>
</child>
<child>
@@ -518,7 +537,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">10</property>
+ <property name="top_attach">11</property>
</packing>
</child>
<child>
@@ -535,7 +554,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">9</property>
+ <property name="top_attach">10</property>
</packing>
</child>
<child>
@@ -549,7 +568,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">10</property>
+ <property name="top_attach">11</property>
</packing>
</child>
<child>