diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-18 12:14:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-19 08:35:42 +0200 |
commit | 0035573ee7798cdf54ef44a54306a0515eeb90a7 (patch) | |
tree | 29f89470e725120dbb6378a64ab0bf01970ecf89 /sw | |
parent | 694f3ed0825d75bf855a74b2294ba0ff370afbb6 (diff) |
convert SFXSTYLEBIT to scoped enum
drop SFXSTYLEBIT_HIERARCHY because it has no overlap with these values,
it's used an extra bit in
SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter
Change-Id: I8ee5ecb9b5f8d2087d8eedd1f5526260ec1e4018
Reviewed-on: https://gerrit.libreoffice.org/53089
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/app.hrc | 89 | ||||
-rw-r--r-- | sw/inc/docsh.hxx | 4 | ||||
-rw-r--r-- | sw/inc/docstyle.hxx | 11 | ||||
-rw-r--r-- | sw/inc/swstyle.h | 34 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 38 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/swuiccoll.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/misc/docfnote.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/app/docst.cxx | 54 | ||||
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 195 |
9 files changed, 200 insertions, 236 deletions
diff --git a/sw/inc/app.hrc b/sw/inc/app.hrc index 352bab8ecfbc..f92bdbfe1688 100644 --- a/sw/inc/app.hrc +++ b/sw/inc/app.hrc @@ -23,68 +23,67 @@ #define NC_(Context, String) (Context "\004" u8##String) #include <svl/style.hxx> -#include "swstyle.h" -const std::pair<const char*, int> RID_PARAGRAPHSTYLEFAMILY[] = +const std::pair<const char*, SfxStyleSearchBits> RID_PARAGRAPHSTYLEFAMILY[] = { - { NC_("RID_PARAGRAPHSTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Applied Styles") , SFXSTYLEBIT_USED }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Automatic") , SFXSTYLEBIT_AUTO }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Text Styles") , SWSTYLEBIT_TEXT }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Chapter Styles") , SWSTYLEBIT_CHAPTER }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "List Styles") , SWSTYLEBIT_LIST }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Index Styles") , SWSTYLEBIT_IDX }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Special Styles") , SWSTYLEBIT_EXTRA }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "HTML Styles") , SWSTYLEBIT_HTML }, - { NC_("RID_PARAGRAPHSTYLEFAMILY", "Conditional Styles") , SWSTYLEBIT_CONDCOLL }, - { nullptr, 0 } + { NC_("RID_PARAGRAPHSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Automatic") , SfxStyleSearchBits::Auto }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Text Styles") , SfxStyleSearchBits::SwText }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Chapter Styles") , SfxStyleSearchBits::SwChapter }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "List Styles") , SfxStyleSearchBits::SwList }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Index Styles") , SfxStyleSearchBits::SwIndex }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Special Styles") , SfxStyleSearchBits::SwExtra }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "HTML Styles") , SfxStyleSearchBits::SwHtml }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Conditional Styles") , SfxStyleSearchBits::SwCondColl }, + { nullptr, SfxStyleSearchBits::Auto } }; -const std::pair<const char*, int> RID_CHARACTERSTYLEFAMILY[] = +const std::pair<const char*, SfxStyleSearchBits> RID_CHARACTERSTYLEFAMILY[] = { - { NC_("RID_CHARACTERSTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE }, - { NC_("RID_CHARACTERSTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN }, - { NC_("RID_CHARACTERSTYLEFAMILY", "Applied Styles") , SFXSTYLEBIT_USED }, - { NC_("RID_CHARACTERSTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF }, - { nullptr, 0 } + { NC_("RID_CHARACTERSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_CHARACTERSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_CHARACTERSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_CHARACTERSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } }; -const std::pair<const char*, int> RID_FRAMESTYLEFAMILY[] = +const std::pair<const char*, SfxStyleSearchBits> RID_FRAMESTYLEFAMILY[] = { - { NC_("RID_FRAMESTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE }, - { NC_("RID_FRAMESTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN }, - { NC_("RID_FRAMESTYLEFAMILY", "Applied Styles") , SFXSTYLEBIT_USED }, - { NC_("RID_FRAMESTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF }, - { nullptr, 0 } + { NC_("RID_FRAMESTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_FRAMESTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_FRAMESTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_FRAMESTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } }; -const std::pair<const char*, int> RID_PAGESTYLEFAMILY[] = +const std::pair<const char*, SfxStyleSearchBits> RID_PAGESTYLEFAMILY[] = { - { NC_("RID_PAGESTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE }, - { NC_("RID_PAGESTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN }, - { NC_("RID_PAGESTYLEFAMILY", "Applied Styles") , SFXSTYLEBIT_USED }, - { NC_("RID_PAGESTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF }, - { nullptr, 0 } + { NC_("RID_PAGESTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_PAGESTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_PAGESTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_PAGESTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } }; -const std::pair<const char*, int> RID_LISTSTYLEFAMILY[] = +const std::pair<const char*, SfxStyleSearchBits> RID_LISTSTYLEFAMILY[] = { - { NC_("RID_LISTSTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE }, - { NC_("RID_LISTSTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN }, - { NC_("RID_LISTSTYLEFAMILY", "Applied Styles") , SFXSTYLEBIT_USED }, - { NC_("RID_LISTSTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF }, - { nullptr, 0 } + { NC_("RID_LISTSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_LISTSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_LISTSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_LISTSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } }; -const std::pair<const char*, int> RID_TABLESTYLEFAMILY[] = +const std::pair<const char*, SfxStyleSearchBits> RID_TABLESTYLEFAMILY[] = { - { NC_("RID_TABLESTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE }, - { NC_("RID_TABLESTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN }, - { NC_("RID_TABLESTYLEFAMILY", "Applied Styles") , SFXSTYLEBIT_USED }, - { NC_("RID_TABLESTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF }, - { nullptr, 0 } + { NC_("RID_TABLESTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_TABLESTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_TABLESTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_TABLESTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } }; #endif diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 0dd2b669d0c9..ebd823291046 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -122,7 +122,7 @@ class SW_DLLPUBLIC SwDocShell const OUString &rName, const OUString& rParent, const SfxStyleFamily nFamily, - sal_uInt16 nMask, + SfxStyleSearchBits nMask, const bool bNew, const OString& sPageId, SwWrtShell* pActShell, @@ -138,7 +138,7 @@ class SW_DLLPUBLIC SwDocShell SAL_DLLPRIVATE SfxStyleFamily DoWaterCan( const OUString &rName, SfxStyleFamily nFamily); SAL_DLLPRIVATE void UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell); SAL_DLLPRIVATE void MakeByExample(const OUString &rName, - SfxStyleFamily nFamily, sal_uInt16 nMask, SwWrtShell* pShell); + SfxStyleFamily nFamily, SfxStyleSearchBits nMask, SwWrtShell* pShell); SAL_DLLPRIVATE void SubInitNew(); ///< for InitNew and HtmlSourceMode. diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 59dcfe9afa8a..85c7fa4ea558 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -84,7 +84,6 @@ public: void Reset(); - void SetMask(sal_uInt16 nMsk) { nMask = nMsk; } void SetFamily(SfxStyleFamily eFam) { nFamily = eFam; } bool IsPhysical() const { return bPhysical; } @@ -176,7 +175,7 @@ class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener public: SwStyleSheetIterator( SwDocStyleSheetPool* pBase, - SfxStyleFamily eFam, sal_uInt16 n ); + SfxStyleFamily eFam, SfxStyleSearchBits n ); virtual ~SwStyleSheetIterator() override; virtual sal_uInt16 Count() override; @@ -196,7 +195,7 @@ class SwDocStyleSheetPool : public SfxStyleSheetBasePool SwDoc& rDoc; bool bOrganizer : 1; ///< Organizer - virtual SfxStyleSheetBase* Create( const OUString&, SfxStyleFamily, sal_uInt16 nMask) override; + virtual SfxStyleSheetBase* Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits nMask) override; virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& ) override; using SfxStyleSheetBasePool::Find; @@ -205,10 +204,10 @@ public: SwDocStyleSheetPool( SwDoc&, bool bOrganizer ); virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily, - sal_uInt16 nMask = SFXSTYLEBIT_ALL) override; + SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, - sal_uInt16 n=SFXSTYLEBIT_ALL ) override; + SfxStyleSearchBits n=SfxStyleSearchBits::All ) override; virtual bool SetParent( SfxStyleFamily eFam, const OUString &rStyle, const OUString &rParent ) override; @@ -217,7 +216,7 @@ public: bool IsOrganizerMode() const { return bOrganizer; } - virtual std::shared_ptr<SfxStyleSheetIterator> CreateIterator( SfxStyleFamily, sal_uInt16 nMask ) override; + virtual std::shared_ptr<SfxStyleSheetIterator> CreateIterator( SfxStyleFamily, SfxStyleSearchBits nMask ) override; SwDoc& GetDoc() const { return rDoc; } diff --git a/sw/inc/swstyle.h b/sw/inc/swstyle.h deleted file mode 100644 index 59e37e95a3f9..000000000000 --- a/sw/inc/swstyle.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SW_INC_SWSTYLE_H -#define INCLUDED_SW_INC_SWSTYLE_H - - -#define SWSTYLEBIT_TEXT 0x0001 -#define SWSTYLEBIT_CHAPTER 0x0002 -#define SWSTYLEBIT_LIST 0x0004 -#define SWSTYLEBIT_IDX 0x0008 -#define SWSTYLEBIT_EXTRA 0x0010 -#define SWSTYLEBIT_HTML 0x0020 -#define SWSTYLEBIT_CONDCOLL 0x0040 - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index b7f60b5dcc7f..c1821f2b9a82 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -46,7 +46,6 @@ #include <unostyle.hxx> #include <unosett.hxx> #include <docsh.hxx> -#include <swstyle.h> #include <paratr.hxx> #include <unoprnms.hxx> #include <shellio.hxx> @@ -145,14 +144,13 @@ namespace #define nPoolCollDocStackedStart ( nPoolCollRegisterStackedStart + nPoolCollRegisterRange) #define nPoolCollHtmlStackedStart ( nPoolCollDocStackedStart + nPoolCollDocRange) using paragraphstyle_t = std::remove_const<decltype(style::ParagraphStyleCategory::TEXT)>::type; - using swstylebits_t = sal_uInt16; using collectionbits_t = sal_uInt16; struct ParagraphStyleCategoryEntry { paragraphstyle_t m_eCategory; - swstylebits_t m_nSwStyleBits; + SfxStyleSearchBits m_nSwStyleBits; collectionbits_t m_nCollectionBits; - ParagraphStyleCategoryEntry(paragraphstyle_t eCategory, swstylebits_t nSwStyleBits, collectionbits_t nCollectionBits) + ParagraphStyleCategoryEntry(paragraphstyle_t eCategory, SfxStyleSearchBits nSwStyleBits, collectionbits_t nCollectionBits) : m_eCategory(eCategory) , m_nSwStyleBits(nSwStyleBits) , m_nCollectionBits(nCollectionBits) @@ -861,7 +859,7 @@ uno::Sequence<OUString> XStyleFamily::getElementNames() if(!m_pBasePool) throw uno::RuntimeException(); std::vector<OUString> vRet; - std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL); + std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SfxStyleSearchBits::All); for (SfxStyleSheetBase* pStyle = pIt->First(); pStyle; pStyle = pIt->Next()) { OUString sName; @@ -935,9 +933,9 @@ void XStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement) if (!pNewStyle || !pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != m_rEntry.m_eFamily) throw lang::IllegalArgumentException(); - sal_uInt16 nMask = SFXSTYLEBIT_ALL; + SfxStyleSearchBits nMask = SfxStyleSearchBits::All; if(m_rEntry.m_eFamily == SfxStyleFamily::Para && !pNewStyle->IsConditional()) - nMask &= ~SWSTYLEBIT_CONDCOLL; + nMask &= ~SfxStyleSearchBits::SwCondColl; m_pBasePool->Make(sStyleName, m_rEntry.m_eFamily, nMask); pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool); pNewStyle->SetStyleName(sStyleName); @@ -1088,12 +1086,12 @@ static const std::vector<ParagraphStyleCategoryEntry>* lcl_GetParagraphStyleCate if(!our_pParagraphStyleCategoryEntries) { our_pParagraphStyleCategoryEntries = new std::vector<ParagraphStyleCategoryEntry>{ - { style::ParagraphStyleCategory::TEXT, SWSTYLEBIT_TEXT, COLL_TEXT_BITS }, - { style::ParagraphStyleCategory::CHAPTER, SWSTYLEBIT_CHAPTER, COLL_DOC_BITS }, - { style::ParagraphStyleCategory::LIST, SWSTYLEBIT_LIST, COLL_LISTS_BITS }, - { style::ParagraphStyleCategory::INDEX, SWSTYLEBIT_IDX, COLL_REGISTER_BITS }, - { style::ParagraphStyleCategory::EXTRA, SWSTYLEBIT_EXTRA, COLL_EXTRA_BITS }, - { style::ParagraphStyleCategory::HTML, SWSTYLEBIT_HTML, COLL_HTML_BITS } + { style::ParagraphStyleCategory::TEXT, SfxStyleSearchBits::SwText, COLL_TEXT_BITS }, + { style::ParagraphStyleCategory::CHAPTER, SfxStyleSearchBits::SwChapter, COLL_DOC_BITS }, + { style::ParagraphStyleCategory::LIST, SfxStyleSearchBits::SwList, COLL_LISTS_BITS }, + { style::ParagraphStyleCategory::INDEX, SfxStyleSearchBits::SwIndex, COLL_REGISTER_BITS }, + { style::ParagraphStyleCategory::EXTRA, SfxStyleSearchBits::SwExtra, COLL_EXTRA_BITS }, + { style::ParagraphStyleCategory::HTML, SfxStyleSearchBits::SwHtml, COLL_HTML_BITS } }; } return our_pParagraphStyleCategoryEntries; @@ -1376,7 +1374,7 @@ sal_Bool SwXStyle::isInUse() SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); - m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, SFXSTYLEBIT_USED); + m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, SfxStyleSearchBits::Used); SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); return pBase && pBase->IsUsed(); } @@ -1873,18 +1871,18 @@ void SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>(const SfxItemPropertySimpleEntr { if(!o_rStyleBase.getNewBase()->IsUserDefined() || !rValue.has<paragraphstyle_t>()) throw lang::IllegalArgumentException(); - static std::unique_ptr<std::map<paragraphstyle_t, swstylebits_t>> pUnoToCore; + static std::unique_ptr<std::map<paragraphstyle_t, SfxStyleSearchBits>> pUnoToCore; if(!pUnoToCore) { - pUnoToCore.reset(new std::map<paragraphstyle_t, swstylebits_t>); + pUnoToCore.reset(new std::map<paragraphstyle_t, SfxStyleSearchBits>); auto pEntries = lcl_GetParagraphStyleCategoryEntries(); std::transform(pEntries->begin(), pEntries->end(), std::inserter(*pUnoToCore, pUnoToCore->end()), - [] (const ParagraphStyleCategoryEntry& rEntry) { return std::pair<paragraphstyle_t, swstylebits_t>(rEntry.m_eCategory, rEntry.m_nSwStyleBits); }); + [] (const ParagraphStyleCategoryEntry& rEntry) { return std::pair<paragraphstyle_t, SfxStyleSearchBits>(rEntry.m_eCategory, rEntry.m_nSwStyleBits); }); } const auto pUnoToCoreIt(pUnoToCore->find(rValue.get<paragraphstyle_t>())); if(pUnoToCoreIt == pUnoToCore->end()) throw lang::IllegalArgumentException(); - o_rStyleBase.getNewBase()->SetMask( pUnoToCoreIt->second|SFXSTYLEBIT_USERDEF ); + o_rStyleBase.getNewBase()->SetMask( pUnoToCoreIt->second|SfxStyleSearchBits::UserDefined ); } template<> void SwXStyle::SetPropertyValue<SID_SWREGISTER_COLLECTION>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) @@ -2031,7 +2029,7 @@ void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNa SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName, &GetDoc()->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent if(m_pBasePool) { - const sal_uInt16 nSaveMask = m_pBasePool->GetSearchMask(); + const SfxStyleSearchBits nSaveMask = m_pBasePool->GetSearchMask(); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, nSaveMask); @@ -2084,7 +2082,7 @@ SfxStyleSheetBase* SwXStyle::GetStyleSheetBase() { if(!m_pBasePool) return nullptr; - const sal_uInt16 nSaveMask = m_pBasePool->GetSearchMask(); + const SfxStyleSearchBits nSaveMask = m_pBasePool->GetSearchMask(); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, nSaveMask ); diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index 2e58a68dfccc..c3d9eb1535c1 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -107,8 +107,7 @@ SwCondCollPage::SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet) 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); + m_pFilterLB->SetEntryData(i, reinterpret_cast<void*>(sal_uInt16(rFilterList[i].nFlags))); } break; } @@ -127,9 +126,6 @@ SwCondCollPage::~SwCondCollPage() void SwCondCollPage::dispose() { - for(sal_Int32 i = 0; i < m_pFilterLB->GetEntryCount(); ++i) - delete static_cast<sal_uInt16*>(m_pFilterLB->GetEntryData(i)); - m_pConditionCB.clear(); m_pContextFT.clear(); m_pUsedFT.clear(); @@ -282,7 +278,7 @@ void SwCondCollPage::SelectHdl(void const * pBox) { m_pStyleLB->Clear(); const sal_Int32 nSelPos = static_cast<ListBox const *>(pBox)->GetSelectedEntryPos(); - const sal_uInt16 nSearchFlags = *static_cast<sal_uInt16*>(m_pFilterLB->GetEntryData(nSelPos)); + const SfxStyleSearchBits nSearchFlags = static_cast<SfxStyleSearchBits>(reinterpret_cast<sal_IntPtr>(m_pFilterLB->GetEntryData(nSelPos))); SfxStyleSheetBasePool* pPool = m_rSh.GetView().GetDocShell()->GetStyleSheetPool(); pPool->SetSearchMask(SfxStyleFamily::Para, nSearchFlags); const SfxStyleSheetBase* pBase = pPool->First(); diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index 62068137c7e2..302de1f7a6be 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -31,7 +31,6 @@ #include <wdocsh.hxx> #include <uitool.hxx> #include <poolfmt.hxx> -#include <swstyle.h> #include <SwStyleNameMapper.hxx> #include <memory> @@ -195,7 +194,7 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet* ) // styles special regions // paragraph SfxStyleSheetBasePool* pStyleSheetPool = pSh->GetView().GetDocShell()->GetStyleSheetPool(); - pStyleSheetPool->SetSearchMask(SfxStyleFamily::Para, SWSTYLEBIT_EXTRA); + pStyleSheetPool->SetSearchMask(SfxStyleFamily::Para, SfxStyleSearchBits::SwExtra); SfxStyleSheetBase *pStyle = pStyleSheetPool->First(); while(pStyle) { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 9b785bf31c9a..5ef0e4b295c0 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -68,7 +68,6 @@ #include <IDocumentFieldsAccess.hxx> #include <IDocumentListsAccess.hxx> #include <IDocumentState.hxx> -#include <swstyle.h> #include <frmfmt.hxx> #include <charfmt.hxx> #include <poolfmt.hxx> @@ -164,23 +163,23 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) SfxTemplateItem aItem(nWhich, aName); - sal_uInt16 nMask = 0; + SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto; if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)) - nMask = SWSTYLEBIT_HTML; + nMask = SfxStyleSearchBits::SwHtml; else { const FrameTypeFlags nSelection = pShell->GetFrameType(nullptr,true); if(pShell->GetCurTOX()) - nMask = SWSTYLEBIT_IDX ; + nMask = SfxStyleSearchBits::SwIndex ; else if(nSelection & FrameTypeFlags::HEADER || nSelection & FrameTypeFlags::FOOTER || nSelection & FrameTypeFlags::TABLE || nSelection & FrameTypeFlags::FLY_ANY || nSelection & FrameTypeFlags::FOOTNOTE || nSelection & FrameTypeFlags::FTNPAGE) - nMask = SWSTYLEBIT_EXTRA; + nMask = SfxStyleSearchBits::SwExtra; else - nMask = SWSTYLEBIT_TEXT; + nMask = SfxStyleSearchBits::SwText; } aItem.SetValue(nMask); @@ -307,13 +306,13 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) const SfxStyleFamily nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); OUString sName; - sal_uInt16 nMask = 0; + SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto; if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_NEW, false, &pItem )) sName = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_MASK, false, &pItem )) - nMask = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + nMask = static_cast<SfxStyleSearchBits>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); OUString sParent; if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_REFERENCE, false, &pItem )) @@ -371,7 +370,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) { OUString aParam; SfxStyleFamily nFamily = SfxStyleFamily::Para; - sal_uInt16 nMask = 0; + SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto; SwWrtShell* pActShell = nullptr; if( !pArgs ) @@ -440,7 +439,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_MASK, false, &pItem )) - nMask = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + nMask = static_cast<SfxStyleSearchBits>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_WRTSHELL, false, &pItem )) pActShell = pShell = static_cast<SwWrtShell*>(static_cast<const SwPtrItem*>(pItem)->GetValue()); @@ -489,7 +488,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) } if (!aParam.isEmpty() || nSlot == SID_STYLE_WATERCAN ) { - sal_uInt16 nRet = SFXSTYLEBIT_ALL; + sal_uInt16 nRet = 0xffff; bool bReturns = false; switch(nSlot) @@ -645,7 +644,7 @@ void SwDocShell::Edit( const OUString &rName, const OUString &rParent, const SfxStyleFamily nFamily, - sal_uInt16 nMask, + SfxStyleSearchBits nMask, const bool bNew, const OString& sPage, SwWrtShell* pActShell, @@ -669,10 +668,10 @@ void SwDocShell::Edit( m_pWrtShell->StartUndo(); } - if( SFXSTYLEBIT_ALL != nMask && SFXSTYLEBIT_ALL_VISIBLE != nMask && SFXSTYLEBIT_USED != nMask ) - nMask |= SFXSTYLEBIT_USERDEF; + if( SfxStyleSearchBits::All != nMask && SfxStyleSearchBits::AllVisible != nMask && SfxStyleSearchBits::Used != nMask ) + nMask |= SfxStyleSearchBits::UserDefined; else - nMask = SFXSTYLEBIT_USERDEF; + nMask = SfxStyleSearchBits::UserDefined; pStyle = &m_xBasePool->Make( rName, nFamily, nMask ); @@ -1147,7 +1146,7 @@ void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWr // NewByExample void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily, - sal_uInt16 nMask, SwWrtShell* pShell ) + SfxStyleSearchBits nMask, SwWrtShell* pShell ) { SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell(); SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find( @@ -1156,10 +1155,10 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily, { // preserve the current mask of PI, then the new one is // immediately merged with the viewable area - if( SFXSTYLEBIT_ALL == nMask || SFXSTYLEBIT_USED == nMask ) - nMask = SFXSTYLEBIT_USERDEF; + if( SfxStyleSearchBits::All == nMask || SfxStyleSearchBits::Used == nMask ) + nMask = SfxStyleSearchBits::UserDefined; else - nMask |= SFXSTYLEBIT_USERDEF; + nMask |= SfxStyleSearchBits::UserDefined; pStyle = static_cast<SwDocStyleSheet*>( &m_xBasePool->Make(rName, nFamily, nMask ) ); @@ -1179,26 +1178,27 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily, // set the mask at the Collection: sal_uInt16 nId = pColl->GetPoolFormatId() & 0x87ff; - switch( nMask & 0x0fff ) + switch( nMask & static_cast<SfxStyleSearchBits>(0x0fff) ) { - case SWSTYLEBIT_TEXT: + case SfxStyleSearchBits::SwText: nId |= COLL_TEXT_BITS; break; - case SWSTYLEBIT_CHAPTER: + case SfxStyleSearchBits::SwChapter: nId |= COLL_DOC_BITS; break; - case SWSTYLEBIT_LIST: + case SfxStyleSearchBits::SwList: nId |= COLL_LISTS_BITS; break; - case SWSTYLEBIT_IDX: + case SfxStyleSearchBits::SwIndex: nId |= COLL_REGISTER_BITS; break; - case SWSTYLEBIT_EXTRA: + case SfxStyleSearchBits::SwExtra: nId |= COLL_EXTRA_BITS; break; - case SWSTYLEBIT_HTML: + case SfxStyleSearchBits::SwHtml: nId |= COLL_HTML_BITS; break; + default: break; } pColl->SetPoolFormatId(nId); @@ -1375,7 +1375,7 @@ void SwDocShell::FormatPage( SwWrtShell& rActShell, SfxRequest* pRequest) { - Edit(rPage, aEmptyOUStr, SfxStyleFamily::Page, 0, false, rPageId, &rActShell, pRequest); + Edit(rPage, aEmptyOUStr, SfxStyleFamily::Page, SfxStyleSearchBits::Auto, false, rPageId, &rActShell, pRequest); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index f3e46b3f2ca0..2dd0be561f25 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -50,7 +50,6 @@ #include <IDocumentDrawModelAccess.hxx> #include <IDocumentState.hxx> #include <cmdid.h> -#include <swstyle.h> #include <app.hrc> #include <strings.hrc> #include <paratr.hxx> @@ -454,7 +453,7 @@ void SwStyleSheetIterator::SwPoolFormatList::Append( char cChar, const OUString& SwDocStyleSheet::SwDocStyleSheet( SwDoc& rDocument, SwDocStyleSheetPool* _rPool) : - SfxStyleSheetBase( OUString(), _rPool, SfxStyleFamily::Char, 0 ), + SfxStyleSheetBase( OUString(), _rPool, SfxStyleFamily::Char, SfxStyleSearchBits::Auto ), pCharFormat(nullptr), pColl(nullptr), pFrameFormat(nullptr), @@ -1565,26 +1564,27 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, sal_uInt16 nId = pColl->GetPoolFormatId() & ~ ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID ); - switch( GetMask() & ( 0x0fff & ~SWSTYLEBIT_CONDCOLL ) ) + switch( GetMask() & ( static_cast<SfxStyleSearchBits>(0x0fff) & ~SfxStyleSearchBits::SwCondColl ) ) { - case SWSTYLEBIT_TEXT: + case SfxStyleSearchBits::SwText: nId |= COLL_TEXT_BITS; break; - case SWSTYLEBIT_CHAPTER: + case SfxStyleSearchBits::SwChapter: nId |= COLL_DOC_BITS; break; - case SWSTYLEBIT_LIST: + case SfxStyleSearchBits::SwList: nId |= COLL_LISTS_BITS; break; - case SWSTYLEBIT_IDX: + case SfxStyleSearchBits::SwIndex: nId |= COLL_REGISTER_BITS; break; - case SWSTYLEBIT_EXTRA: + case SfxStyleSearchBits::SwExtra: nId |= COLL_EXTRA_BITS; break; - case SWSTYLEBIT_HTML: + case SfxStyleSearchBits::SwHtml: nId |= COLL_HTML_BITS; break; + default: break; } pColl->SetPoolFormatId( nId ); break; @@ -1962,7 +1962,7 @@ bool SwDocStyleSheet::FillStyleSheet( } else if( !bCreate ) nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, SwGetPoolIdFromName::PageDesc ); - SetMask( (USER_FMT & nPoolId) ? SFXSTYLEBIT_USERDEF : 0 ); + SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto ); bRet = nullptr != pDesc || USHRT_MAX != nPoolId; if( bDeleteInfo ) @@ -1991,7 +1991,7 @@ bool SwDocStyleSheet::FillStyleSheet( } else if( !bCreate ) nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, SwGetPoolIdFromName::NumRule ); - SetMask( (USER_FMT & nPoolId) ? SFXSTYLEBIT_USERDEF : 0 ); + SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto ); bRet = nullptr != pNumRule || USHRT_MAX != nPoolId; @@ -2001,7 +2001,7 @@ bool SwDocStyleSheet::FillStyleSheet( case SfxStyleFamily::Table: pTableFormat = lcl_FindTableStyle(rDoc, aName, this, bCreate); - SetMask((pTableFormat && pTableFormat->IsUserDefined()) ? SFXSTYLEBIT_USERDEF : 0); + SetMask((pTableFormat && pTableFormat->IsUserDefined()) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto); bRet = bPhysical = (nullptr != pTableFormat); break; @@ -2019,20 +2019,20 @@ bool SwDocStyleSheet::FillStyleSheet( if( pFormat ) nPoolId = pFormat->GetPoolFormatId(); - sal_uInt16 _nMask = 0; + SfxStyleSearchBits _nMask = SfxStyleSearchBits::Auto; if( pFormat == rDoc.GetDfltCharFormat() ) - _nMask |= SFXSTYLEBIT_READONLY; + _nMask |= SfxStyleSearchBits::ReadOnly; else if( USER_FMT & nPoolId ) - _nMask |= SFXSTYLEBIT_USERDEF; + _nMask |= SfxStyleSearchBits::UserDefined; switch ( COLL_GET_RANGE_BITS & nPoolId ) { - case COLL_TEXT_BITS: _nMask |= SWSTYLEBIT_TEXT; break; - case COLL_DOC_BITS : _nMask |= SWSTYLEBIT_CHAPTER; break; - case COLL_LISTS_BITS: _nMask |= SWSTYLEBIT_LIST; break; - case COLL_REGISTER_BITS: _nMask |= SWSTYLEBIT_IDX; break; - case COLL_EXTRA_BITS: _nMask |= SWSTYLEBIT_EXTRA; break; - case COLL_HTML_BITS: _nMask |= SWSTYLEBIT_HTML; break; + case COLL_TEXT_BITS: _nMask |= SfxStyleSearchBits::SwText; break; + case COLL_DOC_BITS : _nMask |= SfxStyleSearchBits::SwChapter; break; + case COLL_LISTS_BITS: _nMask |= SfxStyleSearchBits::SwList; break; + case COLL_REGISTER_BITS: _nMask |= SfxStyleSearchBits::SwIndex; break; + case COLL_EXTRA_BITS: _nMask |= SfxStyleSearchBits::SwExtra; break; + case COLL_HTML_BITS: _nMask |= SfxStyleSearchBits::SwHtml; break; } if( pFormat ) @@ -2046,7 +2046,7 @@ bool SwDocStyleSheet::FillStyleSheet( aHelpFile.clear(); if( RES_CONDTXTFMTCOLL == pFormat->Which() ) - _nMask |= SWSTYLEBIT_CONDCOLL; + _nMask |= SfxStyleSearchBits::SwCondColl; if (FillPreview == eFType) { @@ -2087,7 +2087,7 @@ void SwDocStyleSheet::Create() if( !pColl ) { SwTextFormatColl *pPar = (*rDoc.GetTextFormatColls())[0]; - if( nMask & SWSTYLEBIT_CONDCOLL ) + if( nMask & SfxStyleSearchBits::SwCondColl ) pColl = rDoc.MakeCondTextFormatColl( aName, pPar ); else pColl = rDoc.MakeTextFormatColl( aName, pPar ); @@ -2404,7 +2404,7 @@ SwDocStyleSheetPool::SwDocStyleSheetPool( SwDoc& rDocument, bool bOrg ) SfxStyleSheetBase& SwDocStyleSheetPool::Make( const OUString& rName, SfxStyleFamily eFam, - sal_uInt16 _nMask) + SfxStyleSearchBits _nMask) { mxStyleSheet->PresetName(rName); mxStyleSheet->PresetParent(OUString()); @@ -2424,13 +2424,13 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Create( const SfxStyleSheetBase& /*rOr } SfxStyleSheetBase* SwDocStyleSheetPool::Create( const OUString &, - SfxStyleFamily, sal_uInt16 ) + SfxStyleFamily, SfxStyleSearchBits ) { OSL_ENSURE( false, "Create in SW-Stylesheet-Pool not possible" ); return nullptr; } -std::shared_ptr<SfxStyleSheetIterator> SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, sal_uInt16 _nMask ) +std::shared_ptr<SfxStyleSheetIterator> SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, SfxStyleSearchBits _nMask ) { return std::shared_ptr<SfxStyleSheetIterator>(new SwStyleSheetIterator( this, eFam, _nMask )); } @@ -2558,22 +2558,22 @@ bool SwDocStyleSheetPool::SetParent( SfxStyleFamily eFam, } SfxStyleSheetBase* SwDocStyleSheetPool::Find( const OUString& rName, - SfxStyleFamily eFam, sal_uInt16 n ) + SfxStyleFamily eFam, SfxStyleSearchBits n ) { - sal_uInt16 nSMask = n; + SfxStyleSearchBits nSMask = n; if( SfxStyleFamily::Para == eFam && rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) ) { // then only HTML-Templates are of interest - if( USHRT_MAX == nSMask ) - nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED; + if( SfxStyleSearchBits::All == nSMask ) + nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined | SfxStyleSearchBits::Used; else - nSMask &= SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF | - SWSTYLEBIT_CONDCOLL | SWSTYLEBIT_HTML; - if( !nSMask ) - nSMask = SWSTYLEBIT_HTML; + nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined | + SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml; + if( nSMask == SfxStyleSearchBits::Auto ) + nSMask = SfxStyleSearchBits::SwHtml; } - const bool bSearchUsed = ( n != SFXSTYLEBIT_ALL && n & SFXSTYLEBIT_USED ); + const bool bSearchUsed = ( n != SfxStyleSearchBits::All && n & SfxStyleSearchBits::Used ); const SwModify* pMod = nullptr; mxStyleSheet->SetPhysical( false ); @@ -2606,7 +2606,7 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const OUString& rName, const SwNumRule* pRule = mxStyleSheet->GetNumRule(); if( pRule && !bSearchUsed && - (( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF + (( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined ? !(pRule->GetPoolFormatId() & USER_FMT) // searched for used and found none : bSearchUsed )) @@ -2629,7 +2629,7 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const OUString& rName, ? static_cast<const SwPageDesc*>(pMod)->GetPoolFormatId() : static_cast<const SwFormat*>(pMod)->GetPoolFormatId(); - if( ( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF + if( ( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined ? !(nId & USER_FMT) // searched for used and found none : bSearchUsed ) @@ -2639,7 +2639,7 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const OUString& rName, } SwStyleSheetIterator::SwStyleSheetIterator( SwDocStyleSheetPool* pBase, - SfxStyleFamily eFam, sal_uInt16 n ) + SfxStyleFamily eFam, SfxStyleSearchBits n ) : SfxStyleSheetIterator( pBase, eFam, n ), mxIterSheet( new SwDocStyleSheet( pBase->GetDoc(), pBase ) ), mxStyleSheet( new SwDocStyleSheet( pBase->GetDoc(), pBase ) ) @@ -2685,14 +2685,14 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() mxIterSheet->Reset(); SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc(); - const sal_uInt16 nSrchMask = nMask; + const SfxStyleSearchBits nSrchMask = nMask; const bool bIsSearchUsed = SearchUsed(); - bool bSearchHidden = ( nMask & SFXSTYLEBIT_HIDDEN ); - bool bOnlyHidden = nMask == SFXSTYLEBIT_HIDDEN; + bool bSearchHidden( nMask & SfxStyleSearchBits::Hidden ); + bool bOnlyHidden = nMask == SfxStyleSearchBits::Hidden; const bool bOrganizer = static_cast<SwDocStyleSheetPool*>(pBasePool)->IsOrganizerMode(); - bool bAll = ( nSrchMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE; + bool bAll = ( nSrchMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible; if( nSearchFamily == SfxStyleFamily::Char || nSearchFamily == SfxStyleFamily::All ) @@ -2706,7 +2706,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if( ( !bSearchHidden && pFormat->IsHidden() && !bUsed ) || ( pFormat->IsDefault() && pFormat != rDoc.GetDfltCharFormat() ) ) continue; - if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !pFormat->IsHidden( ) ) + if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) ) continue; if( !bUsed ) @@ -2715,7 +2715,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() const sal_uInt16 nId = rDoc.GetDfltCharFormat() == pFormat ? sal_uInt16( RES_POOLCHR_INET_NORMAL ): pFormat->GetPoolFormatId(); - if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF + if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined ? !(nId & USER_FMT) // searched for used and found none : bIsSearchUsed ) @@ -2766,18 +2766,18 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if( nSearchFamily == SfxStyleFamily::Para || nSearchFamily == SfxStyleFamily::All ) { - sal_uInt16 nSMask = nSrchMask; + SfxStyleSearchBits nSMask = nSrchMask; if( rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) ) { // then only HTML-Template are of interest - if( SFXSTYLEBIT_ALL_VISIBLE == ( nSMask & SFXSTYLEBIT_ALL_VISIBLE ) ) - nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF | - SFXSTYLEBIT_USED; + if( SfxStyleSearchBits::AllVisible == ( nSMask & SfxStyleSearchBits::AllVisible ) ) + nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined | + SfxStyleSearchBits::Used; else - nSMask &= SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF | - SWSTYLEBIT_CONDCOLL | SWSTYLEBIT_HTML; - if( !nSMask ) - nSMask = SWSTYLEBIT_HTML; + nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined | + SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml; + if( nSMask == SfxStyleSearchBits::Auto ) + nSMask = SfxStyleSearchBits::SwHtml; } const size_t nArrLen = rDoc.GetTextFormatColls()->size(); @@ -2789,38 +2789,43 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() ) continue; - if ( nSMask == SFXSTYLEBIT_HIDDEN && !pColl->IsHidden( ) ) + if ( nSMask == SfxStyleSearchBits::Hidden && !pColl->IsHidden( ) ) continue; if( !(bIsSearchUsed && bUsed )) { const sal_uInt16 nId = pColl->GetPoolFormatId(); - switch ( nSMask & ~SFXSTYLEBIT_USED ) + auto tmpMask = nSMask & ~SfxStyleSearchBits::Used; + if (tmpMask == SfxStyleSearchBits::UserDefined) { - case SFXSTYLEBIT_USERDEF: if(!IsPoolUserFormat(nId)) continue; - break; - case SWSTYLEBIT_TEXT: + } + else if (tmpMask == SfxStyleSearchBits::SwText) + { if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue; - break; - case SWSTYLEBIT_CHAPTER: + } + else if (tmpMask == SfxStyleSearchBits::SwChapter) + { if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue; - break; - case SWSTYLEBIT_LIST: + } + else if (tmpMask == SfxStyleSearchBits::SwList) + { if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue; - break; - case SWSTYLEBIT_IDX: + } + else if (tmpMask == SfxStyleSearchBits::SwIndex) + { if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue; - break; - case SWSTYLEBIT_EXTRA: + } + else if (tmpMask == SfxStyleSearchBits::SwExtra) + { if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue; - break; - case SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF: - if(IsPoolUserFormat(nId)) - break; - SAL_FALLTHROUGH; - case SWSTYLEBIT_HTML: - if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS) + } + else if (tmpMask == (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined) + || tmpMask == SfxStyleSearchBits::SwHtml) + { + if((tmpMask & SfxStyleSearchBits::UserDefined) && IsPoolUserFormat(nId)) + ; // do nothing + else if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS) { // but some we also want to see in this section bool bContinue = true; @@ -2846,11 +2851,13 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if( bContinue ) continue; } - break; - case SWSTYLEBIT_CONDCOLL: + } + else if (tmpMask == SfxStyleSearchBits::SwCondColl) + { if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue; - break; - default: + } + else + { // searched for used and found none if( bIsSearchUsed ) continue; @@ -2859,23 +2866,23 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() aLst.Append( cPARA, pColl->GetName() ); } - bAll = ( nSMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE; - if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT ) + bAll = ( nSMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible; + if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwText ) AppendStyleList(SwStyleNameMapper::GetTextUINameArray(), bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ); - if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CHAPTER ) + if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwChapter ) AppendStyleList(SwStyleNameMapper::GetDocUINameArray(), bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ; - if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_LIST ) + if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwList ) AppendStyleList(SwStyleNameMapper::GetListsUINameArray(), bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ; - if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_IDX ) + if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwIndex ) AppendStyleList(SwStyleNameMapper::GetRegisterUINameArray(), bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ; - if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_EXTRA ) + if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwExtra ) AppendStyleList(SwStyleNameMapper::GetExtraUINameArray(), bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ; - if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CONDCOLL ) + if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwCondColl ) { if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( RES_POOLCOLL_TEXT )) @@ -2883,9 +2890,9 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() RES_POOLCOLL_TEXT - RES_POOLCOLL_TEXT_BEGIN ] ); } if ( bAll || - (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_HTML || - (nSMask & ~SFXSTYLEBIT_USED) == - (SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF) ) + (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwHtml || + (nSMask & ~SfxStyleSearchBits::Used) == + (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined) ) { AppendStyleList(SwStyleNameMapper::GetHTMLUINameArray(), bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ; @@ -2935,13 +2942,13 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if( ( !bSearchHidden && pFormat->IsHidden( ) && !bUsed ) || pFormat->IsDefault() || pFormat->IsAuto() ) continue; - if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !pFormat->IsHidden( ) ) + if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) ) continue; const sal_uInt16 nId = pFormat->GetPoolFormatId(); if( !bUsed ) { - if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF + if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined ? !(nId & USER_FMT) // searched for used and found none : bIsSearchUsed ) @@ -2971,14 +2978,14 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if( !bUsed ) { if ( ( !bSearchHidden && rDesc.IsHidden() ) || - ( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF + ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined ? !(nId & USER_FMT) // searched for used and found none : bIsSearchUsed ) ) continue; } - if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !rDesc.IsHidden( ) ) + if ( nSrchMask == SfxStyleSearchBits::Hidden && !rDesc.IsHidden( ) ) continue; aLst.Append( cPAGE, rDesc.GetName() ); @@ -2997,14 +3004,14 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() const SwNumRule& rRule = *rNumTable[ i ]; if( !rRule.IsAutoRule() ) { - if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !rRule.IsHidden( ) ) + if ( nSrchMask == SfxStyleSearchBits::Hidden && !rRule.IsHidden( ) ) continue; bool bUsed = bIsSearchUsed && ( bOrganizer || SwDoc::IsUsed(rRule) ); if( !bUsed ) { if( ( !bSearchHidden && rRule.IsHidden() ) || - ( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF + ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined ? !(rRule.GetPoolFormatId() & USER_FMT) // searched for used and found none : bIsSearchUsed ) ) @@ -3030,11 +3037,11 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rTableStyle)); if(!bUsed) { - if(nSrchMask == SFXSTYLEBIT_HIDDEN && !rTableStyle.IsHidden()) + if(nSrchMask == SfxStyleSearchBits::Hidden && !rTableStyle.IsHidden()) continue; if( (!bSearchHidden && rTableStyle.IsHidden() ) || - ( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF + ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined ? !rTableStyle.IsUserDefined() // searched for used and found none : bIsSearchUsed ) ) |