tdf#101965 : Add No List default in Styles deck in sidebar
Change-Id: I167b379f31809bc252d3c091d0f545f8c2a3f13e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112143
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 608b179..efc99c1 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -863,6 +863,15 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr, bool bIsCal
bEntry = mxTreeBox->iter_next(*xEntry);
}
}
else if (eFam == SfxStyleFamily::Pseudo)
{
std::unique_ptr<weld::TreeIter> xEntry = mxTreeBox->make_iterator();
if (mxTreeBox->get_iter_first(*xEntry))
{
mxTreeBox->scroll_to_row(*xEntry);
mxTreeBox->select(*xEntry);
}
}
else
mxTreeBox->unselect_all();
}
@@ -938,6 +947,8 @@ static OUString lcl_GetStyleFamilyName( SfxStyleFamily nFamily )
return "PageStyles";
if(nFamily == SfxStyleFamily::Table)
return "TableStyles";
if (nFamily == SfxStyleFamily::Pseudo)
return "NumberingStyles";
return OUString();
}
@@ -947,6 +958,8 @@ OUString SfxCommonTemplateDialog_Impl::getDefaultStyleName( const SfxStyleFamily
OUString aFamilyName = lcl_GetStyleFamilyName(eFam);
if( aFamilyName == "TableStyles" )
sDefaultStyle = "Default Style";
else if(aFamilyName == "NumberingStyles")
sDefaultStyle = "No List";
else
sDefaultStyle = "Standard";
uno::Reference< style::XStyleFamiliesSupplier > xModel(GetObjectShell()->GetModel(), uno::UNO_QUERY);
@@ -2039,6 +2052,16 @@ void SfxCommonTemplateDialog_Impl::CreateContextMenu()
mxMenu->set_sensitive("edit", false);
mxMenu->set_sensitive("new", false);
}
if (pItem && pItem->GetFamily() == SfxStyleFamily::Pseudo)
{
const OUString aTemplName(GetSelectedEntry());
if (aTemplName == "No List")
{
mxMenu->set_sensitive("edit", false);
mxMenu->set_sensitive("new", false);
mxMenu->set_sensitive("hide", false);
}
}
}
SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow)
diff --git a/sw/inc/poolfmt.hxx b/sw/inc/poolfmt.hxx
index 56f787d..358747e 100644
--- a/sw/inc/poolfmt.hxx
+++ b/sw/inc/poolfmt.hxx
@@ -185,7 +185,8 @@ RES_POOLPAGE_END
enum RES_POOL_NUMRULE_TYPE
{
RES_POOLNUMRULE_BEGIN = POOLGRP_NUMRULE,
RES_POOLNUMRULE_NUM1 = RES_POOLNUMRULE_BEGIN, ///< NumRule Numbering 123.
RES_POOLNUMRULE_NOLIST = RES_POOLNUMRULE_BEGIN,
RES_POOLNUMRULE_NUM1, ///< NumRule Numbering 123.
RES_POOLNUMRULE_NUM2, ///< NumRule Numbering ABC.
RES_POOLNUMRULE_NUM3, ///< NumRule Numbering abc.
RES_POOLNUMRULE_NUM4, ///< NumRule Numbering IVX.
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index e234e31..f9914ef 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -211,6 +211,7 @@
#define STR_POOLPAGE_ENDNOTE NC_("STR_POOLPAGE_ENDNOTE", "Endnote")
#define STR_POOLPAGE_LANDSCAPE NC_("STR_POOLPAGE_LANDSCAPE", "Landscape")
// Numbering rules
#define STR_POOLNUMRULE_NOLIST NC_("STR_POOLNUMRULE_NOLIST", "No List")
#define STR_POOLNUMRULE_NUM1 NC_("STR_POOLNUMRULE_NUM1", "Numbering 123")
#define STR_POOLNUMRULE_NUM2 NC_("STR_POOLNUMRULE_NUM2", "Numbering ABC")
#define STR_POOLNUMRULE_NUM3 NC_("STR_POOLNUMRULE_NUM3", "Numbering abc")
diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py
index c2ae21c..48a46a7 100644
--- a/sw/qa/python/check_styles.py
+++ b/sw/qa/python/check_styles.py
@@ -159,7 +159,7 @@ class CheckStyle(unittest.TestCase):
def test_NumberingFamily(self):
xDoc = CheckStyle._uno.openEmptyWriterDoc()
xNumberingStyles = xDoc.StyleFamilies["NumberingStyles"]
vEmptyDocStyles = ['List 1', 'List 2', 'List 3', 'List 4', 'List 5', 'Numbering 123', 'Numbering ABC', 'Numbering abc', 'Numbering IVX', 'Numbering ivx']
vEmptyDocStyles = ['No List','List 1', 'List 2', 'List 3', 'List 4', 'List 5', 'Numbering 123', 'Numbering ABC', 'Numbering abc', 'Numbering IVX', 'Numbering ivx']
self.__test_StyleFamily(xNumberingStyles, vEmptyDocStyles, "SwXStyle")
self.__test_StyleFamilyIndex(xNumberingStyles, vEmptyDocStyles, "SwXStyle")
self.__test_StyleFamilyInsert(xDoc, xNumberingStyles, vEmptyDocStyles, "com.sun.star.style.NumberingStyle", "com.sun.star.style.CharacterStyle")
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index b2f2b09..7fa92a0 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -516,6 +516,7 @@ static const char* STR_POOLPAGE_ARY[] =
static const char* STR_POOLNUMRULE_NUM_ARY[] =
{
// Numbering styles
STR_POOLNUMRULE_NOLIST,
STR_POOLNUMRULE_NUM1,
STR_POOLNUMRULE_NUM2,
STR_POOLNUMRULE_NUM3,
diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx
index b7753c3..7635a97 100644
--- a/sw/source/core/doc/SwStyleNameMapper.cxx
+++ b/sw/source/core/doc/SwStyleNameMapper.cxx
@@ -709,6 +709,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetPageDescProgNameArray()
const std::vector<OUString>& SwStyleNameMapper::GetNumRuleProgNameArray()
{
static const std::vector<OUString> s_aNumRuleProgNameArray = {
"No List",
"Numbering 123", // STR_POOLNUMRULE_PRGM_NUM1
"Numbering ABC",
"Numbering abc",
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx
index e649323..3366692 100644
--- a/sw/source/ui/chrdlg/pardlg.cxx
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -215,7 +215,8 @@ void SwParaDlg::PageCreated(const OString& rId, SfxTabPage& rPage)
aNames.insert(pBase->GetName());
pBase = pPool->Next();
}
for(const auto& rName : aNames)
aNames.erase("No List");
for (const auto& rName : aNames)
rBox.append_text(rName);
}
// inits for Area and Transparency TabPages
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index ff6dd3e..7c6ac64 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -460,6 +460,7 @@ void SwTemplateDlgController::PageCreated(const OString& rId, SfxTabPage &rPage
aNames.insert(pBase->GetName());
pBase = pPool->Next();
}
aNames.erase("No List");
for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
rBox.append_text(*it);
}
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 99939d0..ac044a5 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1159,6 +1159,11 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString &rName, SfxStyleFamily nFa
// reset indent attribute on applying list style
// continue list of list style
const SwNumRule* pNumRule = pStyle->GetNumRule();
if (pNumRule->GetName() == "No List")
{
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_NUM_BULLET_OFF);
break;
}
const OUString sListIdForStyle =pNumRule->GetDefaultListId();
pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
break;
diff --git a/sw/uiconfig/swriter/ui/numparapage.ui b/sw/uiconfig/swriter/ui/numparapage.ui
index ff1c1a8..cb8f931 100644
--- a/sw/uiconfig/swriter/ui/numparapage.ui
+++ b/sw/uiconfig/swriter/ui/numparapage.ui
@@ -144,7 +144,7 @@
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes" context="numparapage|comboLB_NUMBER_STYLE">Assigned List Style</property>
<items>
<item translatable="yes" context="numparapage|comboLB_NUMBER_STYLE">None</item>
<item translatable="yes" context="numparapage|comboLB_NUMBER_STYLE">No List</item>
</items>
<child internal-child="accessible">
<object class="AtkObject" id="comboLB_NUMBER_STYLE-atkobject">