From c14b9d036ac8549feb588764b3596c0eb42cf97c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 25 Oct 2016 16:35:48 +0100 Subject: assemble SfxStyleFamilies from more generic resource components Change-Id: I25aa0d8bca1f16f5fc27d3b299709479a1635ea3 --- sw/inc/swmodule.hxx | 1 + sw/source/ui/app/app.src | 195 +++++++++++++++++++++----------------- sw/source/ui/chrdlg/swuiccoll.cxx | 30 +++--- sw/source/uibase/app/swmodule.cxx | 39 ++++++++ sw/source/uibase/inc/app.hrc | 16 +++- 5 files changed, 175 insertions(+), 106 deletions(-) (limited to 'sw') diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 6abfe6106b39..427732c8d08b 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -220,6 +220,7 @@ public: virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) override; virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; virtual VclPtr CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) override; + virtual SfxStyleFamilies* CreateStyleFamilies() override; // Pool is created here and set at SfxShell. void InitAttrPool(); diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src index f3ec0f65b4d4..2796e9c32e16 100644 --- a/sw/source/ui/app/app.src +++ b/sw/source/ui/app/app.src @@ -67,101 +67,118 @@ ImageList RID_DEFAULTIMAGELIST_LC IMAGELIST_AND_COUNT }; -SfxStyleFamilies DLG_STYLE_DESIGNER +String STR_PARAGRAPHSTYLEFAMILY { - StyleFamilyList = + Text [ en-US ] = "Paragraph Styles" ; +}; + +String STR_CHARACTERSTYLEFAMILY +{ + Text [ en-US ] = "Character Styles" ; +}; + +String STR_FRAMESTYLEFAMILY +{ + Text [ en-US ] = "Frame Styles" ; +}; + +String STR_PAGESTYLEFAMILY +{ + Text [ en-US ] = "Page Styles" ; +}; + +String STR_LISTSTYLEFAMILY +{ + Text [ en-US ] = "List Styles" ; +}; + +String STR_TABLESTYLEFAMILY +{ + Text [ en-US ] = "Table Styles" ; +}; + +StringArray RID_PARAGRAPHSTYLEFAMILY +{ + ItemList [ en-US ] = { - SfxStyleFamilyItem - { - Text [ en-US ] = "Paragraph Styles" ; - StyleFamily = SfxStyleFamily::Para ; - FilterList [ en-US ] = - { - < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; - < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; - < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; - < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; - < "Automatic" ; SFXSTYLEBIT_AUTO ; > ; - < "Text Styles" ; SWSTYLEBIT_TEXT ; > ; - < "Chapter Styles" ; SWSTYLEBIT_CHAPTER ; > ; - < "List Styles" ; SWSTYLEBIT_LIST ; > ; - < "Index Styles" ; SWSTYLEBIT_IDX ; > ; - < "Special Styles" ; SWSTYLEBIT_EXTRA ; > ; - < "HTML Styles" ; SWSTYLEBIT_HTML ; > ; - < "Conditional Styles" ; SWSTYLEBIT_CONDCOLL ; > ; - }; - }; - SfxStyleFamilyItem - { - Text [ en-US ] = "Character Styles" ; - StyleFamily = SfxStyleFamily::Char ; - FilterList [ en-US ] = - { - < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; - < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; - < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; - < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; - }; - }; - SfxStyleFamilyItem - { - Text [ en-US ] = "Frame Styles" ; - StyleFamily = SfxStyleFamily::Frame ; - FilterList [ en-US ] = - { - < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; - < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; - < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; - < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; - }; - }; - SfxStyleFamilyItem - { - Text [ en-US ] = "Page Styles" ; - StyleFamily = SfxStyleFamily::Page ; - FilterList [ en-US ] = - { - < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; - < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; - < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; - < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; - }; - }; - SfxStyleFamilyItem - { - StyleFamily = SfxStyleFamily::Pseudo ; - FilterList [ en-US ] = - { - < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; - < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; - < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; - < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; - }; - Text [ en-US ] = "List Styles" ; - }; - SfxStyleFamilyItem - { - Text [ en-US ] = "Table Styles" ; - StyleFamily = SfxStyleFamily::Table ; - FilterList [ en-US ] = - { - < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; - < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; - < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; - < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; - }; - }; + < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; + < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; + < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; + < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; + < "Automatic" ; SFXSTYLEBIT_AUTO ; > ; + < "Text Styles" ; SWSTYLEBIT_TEXT ; > ; + < "Chapter Styles" ; SWSTYLEBIT_CHAPTER ; > ; + < "List Styles" ; SWSTYLEBIT_LIST ; > ; + < "Index Styles" ; SWSTYLEBIT_IDX ; > ; + < "Special Styles" ; SWSTYLEBIT_EXTRA ; > ; + < "HTML Styles" ; SWSTYLEBIT_HTML ; > ; + < "Conditional Styles" ; SWSTYLEBIT_CONDCOLL ; > ; }; +}; - ImageList 1 // == BMP_COLOR_NORMAL + 1 +StringArray RID_CHARACTERSTYLEFAMILY +{ + ItemList [ en-US ] = + { + < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; + < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; + < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; + < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; + }; +}; + +StringArray RID_FRAMESTYLEFAMILY +{ + ItemList [ en-US ] = + { + < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; + < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; + < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; + < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; + }; +}; + +StringArray RID_PAGESTYLEFAMILY +{ + ItemList [ en-US ] = + { + < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; + < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; + < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; + < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; + }; +}; + +StringArray RID_LISTSTYLEFAMILY +{ + ItemList [ en-US ] = + { + < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; + < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; + < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; + < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; + }; +}; + +StringArray RID_TABLESTYLEFAMILY +{ + ItemList [ en-US ] = + { + < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ; + < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ; + < "Applied Styles" ; SFXSTYLEBIT_USED ; > ; + < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ; + }; +}; + +ImageList RID_STYLEFAMILY_IMAGELIST +{ + Prefix = "sf"; + IdList = { - Prefix = "sf"; - IdList = - { - 1; 2; 3; 4; 5; 6; - }; - IdCount = 6; + 1; 2; 3; 4; 5; 6; }; + IdCount = 6; }; // Bitmap for the NumberingTemplates in the Organizer diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index e102554aa435..df1b7d04a0b2 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -96,26 +96,24 @@ SwCondCollPage::SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet) m_pTbLinks->Resize(); // OS: Hack for the right selection m_pTbLinks->SetSpaceBetweenEntries( 0 ); - SfxStyleFamilies aFamilies(SW_RES(DLG_STYLE_DESIGNER)); - const SfxStyleFamilyItem* pFamilyItem = nullptr; - - size_t nCount = aFamilies.size(); - for( size_t i = 0; i < nCount; ++i ) + std::unique_ptr xFamilies(SW_MOD()->CreateStyleFamilies()); + size_t nCount = xFamilies->size(); + for (size_t j = 0; j < nCount; ++j) { - if(SfxStyleFamily::Para == (pFamilyItem = aFamilies.at( i ))->GetFamily()) - break; - } - - if (pFamilyItem) - { - const SfxStyleFilter& rFilterList = pFamilyItem->GetFilterList(); - for( size_t i = 0; i < rFilterList.size(); ++i ) + const SfxStyleFamilyItem &rFamilyItem = xFamilies->at(j); + if (SfxStyleFamily::Para == rFamilyItem.GetFamily()) { - m_pFilterLB->InsertEntry( rFilterList[ i ]->aName); - sal_uInt16* pFilter = new sal_uInt16(rFilterList[i]->nFlags); - m_pFilterLB->SetEntryData(i, pFilter); + const SfxStyleFilter& rFilterList = rFamilyItem.GetFilterList(); + for (size_t i = 0; i < rFilterList.size(); ++i) + { + m_pFilterLB->InsertEntry(rFilterList[i].aName); + sal_uInt16* pFilter = new sal_uInt16(rFilterList[i].nFlags); + m_pFilterLB->SetEntryData(i, pFilter); + } + break; } } + m_pFilterLB->SelectEntryPos(1); m_pTbLinks->Show(); diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 9d2818bce00d..19bc121b731e 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -398,4 +398,43 @@ void SwModule::RemoveAttrPool() SfxItemPool::Free(m_pAttrPool); } +SfxStyleFamilies* SwModule::CreateStyleFamilies() +{ + SfxStyleFamilies *pStyleFamilies = new SfxStyleFamilies; + + ImageList aEntryImages(SW_RES(RID_STYLEFAMILY_IMAGELIST)); + + pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para, + SW_RESSTR(STR_PARAGRAPHSTYLEFAMILY), + aEntryImages.GetImage(1), + SW_RES(RID_PARAGRAPHSTYLEFAMILY))); + + pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Char, + SW_RESSTR(STR_CHARACTERSTYLEFAMILY), + aEntryImages.GetImage(2), + SW_RES(RID_CHARACTERSTYLEFAMILY))); + + pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Frame, + SW_RESSTR(STR_FRAMESTYLEFAMILY), + aEntryImages.GetImage(3), + SW_RES(RID_FRAMESTYLEFAMILY))); + + pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Page, + SW_RESSTR(STR_PAGESTYLEFAMILY), + aEntryImages.GetImage(4), + SW_RES(RID_PAGESTYLEFAMILY))); + + pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Pseudo, + SW_RESSTR(STR_LISTSTYLEFAMILY), + aEntryImages.GetImage(5), + SW_RES(RID_LISTSTYLEFAMILY))); + + pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Table, + SW_RESSTR(STR_TABLESTYLEFAMILY), + aEntryImages.GetImage(6), + SW_RES(RID_TABLESTYLEFAMILY))); + + return pStyleFamilies; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/app.hrc b/sw/source/uibase/inc/app.hrc index 1dca48890527..d39e4d53df71 100644 --- a/sw/source/uibase/inc/app.hrc +++ b/sw/source/uibase/inc/app.hrc @@ -92,7 +92,21 @@ #define STR_WRONG_TABLENAME (RC_APP_BEGIN + 138) #define STR_SRTERR (RC_APP_BEGIN + 139) -#define APP_ACT_END STR_SRTERR +#define STR_PARAGRAPHSTYLEFAMILY (RC_APP_BEGIN + 140) +#define STR_CHARACTERSTYLEFAMILY (RC_APP_BEGIN + 141) +#define STR_FRAMESTYLEFAMILY (RC_APP_BEGIN + 142) +#define STR_PAGESTYLEFAMILY (RC_APP_BEGIN + 143) +#define STR_LISTSTYLEFAMILY (RC_APP_BEGIN + 144) +#define STR_TABLESTYLEFAMILY (RC_APP_BEGIN + 145) +#define RID_PARAGRAPHSTYLEFAMILY (RC_APP_BEGIN + 146) +#define RID_CHARACTERSTYLEFAMILY (RC_APP_BEGIN + 147) +#define RID_FRAMESTYLEFAMILY (RC_APP_BEGIN + 148) +#define RID_PAGESTYLEFAMILY (RC_APP_BEGIN + 149) +#define RID_LISTSTYLEFAMILY (RC_APP_BEGIN + 150) +#define RID_TABLESTYLEFAMILY (RC_APP_BEGIN + 151) +#define RID_STYLEFAMILY_IMAGELIST (RC_APP_BEGIN + 152) + +#define APP_ACT_END RID_STYLEFAMILY_IMAGELIST #if APP_ACT_END > RC_APP_END #error Resource-Id Ueberlauf in #file, #line -- cgit