include/sfx2/module.hxx           |    2 +-
 sc/inc/scmod.hxx                  |    2 +-
 sc/source/ui/app/scmod.cxx        |    2 +-
 sd/inc/sdmod.hxx                  |    2 +-
 sd/source/ui/app/sdmod2.cxx       |    2 +-
 sfx2/source/dialog/StyleList.cxx  |   24 +++++++++++-------------
 sfx2/source/dialog/mgetempl.cxx   |    7 +++----
 sfx2/source/dialog/mgetempl.hxx   |    3 +--
 sfx2/source/dialog/templdlg.cxx   |    1 +
 sfx2/source/inc/StyleList.hxx     |    2 +-
 sw/inc/swmodule.hxx               |    2 +-
 sw/source/ui/chrdlg/swuiccoll.cxx |    6 +++---
 sw/source/uibase/app/swmodule.cxx |    2 +-
 13 files changed, 27 insertions(+), 30 deletions(-)

New commits:
commit 6f441eba260db39df386c46c5ee7492e79e25c8c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Feb 3 08:41:49 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Feb 4 00:33:14 2025 +0100

    tdf#165002 sidebar a11y: Set a11y names for styles tool buttons
    
    For the toolbar buttons to switch between the different
    styles categories ("Paragraph Styles", "Character Styles",...)
    in the "Styles" sidebar deck, set the tooltip text also as
    the accessible name.
    
    This makes the Orca screen reader with announce them
    (e.g. "Paragraph styles, toggle button, pressed") when using
    the gtk3 VCL plugin instead of just saying "toggle button", which
    doesn't give the screen reader any clue what those buttons are for.
    
    Change-Id: I8c30b6b67366d1839acb725bc4af012c276a5ee2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181037
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index b26123129f88..20515f2d1f0d 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -857,6 +857,7 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 
nId, const SfxStyleFami
     m_xActionTbL->set_item_visible(sId, true);
     m_xActionTbL->set_item_icon_name(sId, rItem.GetImage());
     m_xActionTbL->set_item_tooltip_text(sId, rItem.GetText());
+    m_xActionTbL->set_item_accessible_name(sId, rItem.GetText());
     m_xActionTbL->set_item_help_id(sId, sHelpId);
     ++m_nActionTbLVisible;
 }
commit 700194c65544f130c92819425933d43528ba1598
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sun Feb 2 23:46:11 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Feb 4 00:33:07 2025 +0100

    No longer use std::optional for SfxModule::CreateStyleFamilies
    
    Just return an empty std::vector instead of a std::optional that
    contains no value in the default implementation, and adjust the
    type of the local variables and class members that contain
    the result and their use accordingly.
    
    Change-Id: I4e25b3cbd96c6eb9f06b0ae44b36675bb11ab38a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181024
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 38f136ec6def..1d8cc18c405d 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -78,7 +78,7 @@ public:
                                                const SfxItemSet& rSet );
     virtual void                Invalidate(sal_uInt16 nId = 0) override;
 
-    virtual std::optional<SfxStyleFamilies> CreateStyleFamilies() { return {}; 
}
+    virtual SfxStyleFamilies CreateStyleFamilies() { return {}; }
 
     static SfxModule*           GetActiveModule( SfxViewFrame* pFrame=nullptr 
);
     static FieldUnit            GetCurrentFieldUnit();
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index fd19d67df5d9..0cf597af2103 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -229,7 +229,7 @@ public:
     virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override;
     virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet 
) override;
     virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, 
weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& 
rSet ) override;
-    virtual std::optional<SfxStyleFamilies> CreateStyleFamilies() override;
+    virtual SfxStyleFamilies CreateStyleFamilies() override;
 
     void                SetInSharedDocLoading( bool bNew )  { 
m_bIsInSharedDocLoading = bNew; }
     bool                IsInSharedDocLoading() const        { return 
m_bIsInSharedDocLoading; }
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 84238486fa6b..26e40a2d3d9a 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2344,7 +2344,7 @@ bool ScModule::HasThesaurusLanguage( LanguageType nLang )
     return bHasLang;
 }
 
-std::optional<SfxStyleFamilies> ScModule::CreateStyleFamilies()
+SfxStyleFamilies ScModule::CreateStyleFamilies()
 {
     SfxStyleFamilies aStyleFamilies;
     std::locale resLocale = ScModule::get()->GetResLocale();
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index 156a2ec09cec..074cabcfc0b6 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -119,7 +119,7 @@ public:
     virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override;
     virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet 
) override;
     virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, 
weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& 
rSet ) override;
-    virtual std::optional<SfxStyleFamilies> CreateStyleFamilies() override;
+    virtual SfxStyleFamilies CreateStyleFamilies() override;
 
     SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
     SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 338b134f2277..52ebc7b33c5e 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -862,7 +862,7 @@ std::unique_ptr<SfxTabPage> SdModule::CreateTabPage( 
sal_uInt16 nId, weld::Conta
     return xRet;
 }
 
-std::optional<SfxStyleFamilies> SdModule::CreateStyleFamilies()
+SfxStyleFamilies SdModule::CreateStyleFamilies()
 {
     SfxStyleFamilies aStyleFamilies;
     std::locale resLocale = SdModule::get()->GetResLocale();
diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx
index 1fd863181d02..846dee4089de 100644
--- a/sfx2/source/dialog/StyleList.cxx
+++ b/sfx2/source/dialog/StyleList.cxx
@@ -235,9 +235,7 @@ IMPL_LINK_NOARG(StyleList, ReadResource, void*, size_t)
     m_pCurObjShell = pViewFrame->GetObjectShell();
     m_Module = m_pCurObjShell ? m_pCurObjShell->GetModule() : nullptr;
     if (m_Module)
-        m_xStyleFamilies = m_Module->CreateStyleFamilies();
-    if (!m_xStyleFamilies)
-        m_xStyleFamilies.emplace();
+        m_aStyleFamilies = m_Module->CreateStyleFamilies();
 
     m_nActFilter = 0xffff;
 
@@ -251,14 +249,14 @@ IMPL_LINK_NOARG(StyleList, ReadResource, void*, size_t)
         if (m_bModuleHasStylesHighlighterFeature)
             sDefaultCharStyleUIName = 
getDefaultStyleName(SfxStyleFamily::Char);
     }
-    size_t nCount = m_xStyleFamilies->size();
+    size_t nCount = m_aStyleFamilies.size();
     m_pBindings->ENTERREGISTRATIONS();
 
     size_t i;
     for (i = 0; i < nCount; ++i)
     {
         sal_uInt16 nSlot = 0;
-        switch (m_xStyleFamilies->at(i).GetFamily())
+        switch (m_aStyleFamilies.at(i).GetFamily())
         {
             case SfxStyleFamily::Char:
                 nSlot = SID_STYLE_FAMILY1;
@@ -860,17 +858,17 @@ static SfxStyleFamily NIdToSfxFamilyId(sal_uInt16 nId)
 
 sal_uInt16 StyleList::StyleNrToInfoOffset(sal_uInt16 nId)
 {
-    const SfxStyleFamilyItem& rItem = m_xStyleFamilies->at(nId);
+    const SfxStyleFamilyItem& rItem = m_aStyleFamilies.at(nId);
     return SfxTemplate::SfxFamilyIdToNId(rItem.GetFamily()) - 1;
 }
 
 // Helper function: Access to the current family item
 const SfxStyleFamilyItem* StyleList::GetFamilyItem() const
 {
-    const size_t nCount = m_xStyleFamilies->size();
+    const size_t nCount = m_aStyleFamilies.size();
     for (size_t i = 0; i < nCount; ++i)
     {
-        const SfxStyleFamilyItem& rItem = m_xStyleFamilies->at(i);
+        const SfxStyleFamilyItem& rItem = m_aStyleFamilies.at(i);
         sal_uInt16 nId = SfxTemplate::SfxFamilyIdToNId(rItem.GetFamily());
         if (nId == m_nActFamily)
             return &rItem;
@@ -912,7 +910,7 @@ IMPL_LINK_NOARG(StyleList, IsSafeForWaterCan, void*, bool)
 
 IMPL_LINK(StyleList, SetWaterCanState, const SfxBoolItem*, pItem, void)
 {
-    size_t nCount = m_xStyleFamilies->size();
+    size_t nCount = m_aStyleFamilies.size();
     m_pBindings->EnterRegistrations();
     for (size_t n = 0; n < nCount; n++)
     {
@@ -1239,7 +1237,7 @@ void StyleList::UpdateStyles(StyleFlags nFlags)
     if (!pItem)
     {
         // Is the case for the template catalog
-        const size_t nFamilyCount = m_xStyleFamilies->size();
+        const size_t nFamilyCount = m_aStyleFamilies.size();
         size_t n;
         for (n = 0; n < nFamilyCount; n++)
             if (m_pFamilyState[StyleNrToInfoOffset(n)])
@@ -1568,7 +1566,7 @@ IMPL_LINK_NOARG(StyleList, Clear, void*, void)
             pViewShell->GetStylesHighlighterCharColorMap().clear();
         }
     }
-    m_xStyleFamilies.reset();
+    m_aStyleFamilies.clear();
     for (auto& i : m_pFamilyState)
         i.reset();
     m_pCurObjShell = nullptr;
@@ -1916,7 +1914,7 @@ void StyleList::Update()
     if (m_nActFamily == 0xffff || nullptr == (pItem = 
m_pFamilyState[m_nActFamily - 1].get()))
     {
         m_pParentDialog->CheckItem(OUString::number(m_nActFamily), false);
-        const size_t nFamilyCount = m_xStyleFamilies->size();
+        const size_t nFamilyCount = m_aStyleFamilies.size();
         size_t n;
         for (n = 0; n < nFamilyCount; n++)
             if (m_pFamilyState[StyleNrToInfoOffset(n)])
@@ -1974,7 +1972,7 @@ void StyleList::Update()
 
 const SfxStyleFamilyItem& StyleList::GetFamilyItemByIndex(size_t i) const
 {
-    return m_xStyleFamilies->at(i);
+    return m_aStyleFamilies.at(i);
 }
 
 IMPL_STATIC_LINK(StyleList, CustomGetSizeHdl, weld::TreeView::get_size_args, 
aPayload, Size)
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 9425b5e5b437..4bbed98ecb5a 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -91,7 +91,7 @@ 
SfxManageStyleSheetPage::SfxManageStyleSheetPage(weld::Container* pPage, weld::D
     else
         m_xEditLinkStyleBtn->set_sensitive(true);
 
-    mxFamilies = SfxApplication::GetModule_Impl()->CreateStyleFamilies();
+    maFamilies = SfxApplication::GetModule_Impl()->CreateStyleFamilies();
 
     SfxStyleSheetBasePool* pPool = nullptr;
     SfxObjectShell* pDocShell = SfxObjectShell::Current();
@@ -184,11 +184,11 @@ 
SfxManageStyleSheetPage::SfxManageStyleSheetPage(weld::Container* pPage, weld::D
         m_xBaseLb->set_sensitive(false);
     }
 
-    size_t nCount = mxFamilies->size();
+    size_t nCount = maFamilies.size();
     size_t i;
     for ( i = 0; i < nCount; ++i )
     {
-        pItem = &(mxFamilies->at(i));
+        pItem = &(maFamilies.at(i));
 
         if ( pItem->GetFamily() == pStyle->GetFamily() )
             break;
@@ -255,7 +255,6 @@ 
SfxManageStyleSheetPage::SfxManageStyleSheetPage(weld::Container* pPage, weld::D
 
 SfxManageStyleSheetPage::~SfxManageStyleSheetPage()
 {
-    mxFamilies.reset();
     pItem = nullptr;
     pStyle = nullptr;
 }
diff --git a/sfx2/source/dialog/mgetempl.hxx b/sfx2/source/dialog/mgetempl.hxx
index 7bc67cec3c7e..0e59c6862ef8 100644
--- a/sfx2/source/dialog/mgetempl.hxx
+++ b/sfx2/source/dialog/mgetempl.hxx
@@ -22,7 +22,6 @@
 #include <sfx2/styfitem.hxx>
 #include <sfx2/tabdlg.hxx>
 #include <memory>
-#include <optional>
 
 namespace weld { class Button; }
 namespace weld { class CheckButton; }
@@ -39,7 +38,7 @@ namespace weld { class Widget; }
 class SfxManageStyleSheetPage final : public SfxTabPage
 {
     SfxStyleSheetBase *pStyle;
-    std::optional<SfxStyleFamilies> mxFamilies;
+    SfxStyleFamilies maFamilies;
     const SfxStyleFamilyItem *pItem;
     OUString aBuf;
     bool bModified;
diff --git a/sfx2/source/inc/StyleList.hxx b/sfx2/source/inc/StyleList.hxx
index bc8a90ada248..3d466409a67e 100644
--- a/sfx2/source/inc/StyleList.hxx
+++ b/sfx2/source/inc/StyleList.hxx
@@ -223,7 +223,7 @@ private:
     std::unique_ptr<weld::Builder> mxMenuBuilder;
     std::unique_ptr<weld::Menu> mxMenu;
 
-    std::optional<SfxStyleFamilies> m_xStyleFamilies;
+    SfxStyleFamilies m_aStyleFamilies;
     std::array<std::unique_ptr<SfxTemplateItem>, MAX_FAMILIES> m_pFamilyState;
     SfxObjectShell* m_pCurObjShell;
     sal_uInt16 m_nActFamily;
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index c77fa3d0d7b7..6d39a3dc76c5 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -232,7 +232,7 @@ public:
     virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override;
     virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet 
) override;
     virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, 
weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& 
rSet ) override;
-    SW_DLLPUBLIC virtual std::optional<SfxStyleFamilies> CreateStyleFamilies() 
override;
+    SW_DLLPUBLIC virtual SfxStyleFamilies CreateStyleFamilies() override;
 
     // Pool is created here and set at SfxShell.
     void    InitAttrPool();
diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx 
b/sw/source/ui/chrdlg/swuiccoll.cxx
index d111e2dde19c..d578087bf8f6 100644
--- a/sw/source/ui/chrdlg/swuiccoll.cxx
+++ b/sw/source/ui/chrdlg/swuiccoll.cxx
@@ -71,11 +71,11 @@ SwCondCollPage::SwCondCollPage(weld::Container* pPage, 
weld::DialogController* p
     m_xStyleLB->connect_selection_changed(LINK(this, SwCondCollPage, 
SelectTreeListBoxHdl));
     m_xFilterLB->connect_changed(LINK(this, SwCondCollPage, SelectListBoxHdl));
 
-    std::optional<SfxStyleFamilies> 
xFamilies(SwModule::get()->CreateStyleFamilies());
-    size_t nCount = xFamilies->size();
+    SfxStyleFamilies aFamilies(SwModule::get()->CreateStyleFamilies());
+    size_t nCount = aFamilies.size();
     for (size_t j = 0; j < nCount; ++j)
     {
-        const SfxStyleFamilyItem &rFamilyItem = xFamilies->at(j);
+        const SfxStyleFamilyItem &rFamilyItem = aFamilies.at(j);
         if (SfxStyleFamily::Para == rFamilyItem.GetFamily())
         {
             const SfxStyleFilter& rFilterList = rFamilyItem.GetFilterList();
diff --git a/sw/source/uibase/app/swmodule.cxx 
b/sw/source/uibase/app/swmodule.cxx
index ef814781bdd8..0cd7814fb0f7 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -350,7 +350,7 @@ void    SwModule::RemoveAttrPool()
     m_pAttrPool.clear();
 }
 
-std::optional<SfxStyleFamilies> SwModule::CreateStyleFamilies()
+SfxStyleFamilies SwModule::CreateStyleFamilies()
 {
     SfxStyleFamilies aStyleFamilies;
 

Reply via email to