diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-04 11:31:33 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-05-09 10:17:13 +0200 |
commit | bcb41235deaf4b7ca90522bda3ba21a686819e6e (patch) | |
tree | 29f397deeb5c776b290b782847a4f9ec8487adb2 /svl | |
parent | b55b7a057f19521ad88fc6a274fcf071b798eb3e (diff) |
convert SfxStyleFamily to scoped enum
and update the RSC compiler to accept such
In the process fix some confusion in SD where it was confusing
SfxStyleFamily and the index of the relevant family
(which other parts of the code in SVL use)
Change-Id: I1efc9f85fbed8ab76eafe8f6e1ada411753ae5f9
Diffstat (limited to 'svl')
-rw-r--r-- | svl/qa/unit/items/test_IndexedStyleSheets.cxx | 18 | ||||
-rw-r--r-- | svl/source/items/IndexedStyleSheets.cxx | 15 | ||||
-rw-r--r-- | svl/source/items/srchitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/style.cxx | 8 |
4 files changed, 22 insertions, 21 deletions
diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx index c6c728818979..bb06e05cbfc5 100644 --- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx +++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx @@ -23,7 +23,7 @@ using namespace svl; class MockedStyleSheet : public SfxStyleSheetBase { public: - MockedStyleSheet(const rtl::OUString& name, SfxStyleFamily fam = SFX_STYLE_FAMILY_CHAR) + MockedStyleSheet(const rtl::OUString& name, SfxStyleFamily fam = SfxStyleFamily::Char) : SfxStyleSheetBase(name, nullptr, fam, 0) {;} @@ -172,28 +172,28 @@ void IndexedStyleSheetsTest::PositionCanBeQueriedByFamily() rtl::OUString name1("name1"); rtl::OUString name2("name2"); rtl::OUString name3("name3"); - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1, SFX_STYLE_FAMILY_CHAR)); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name2, SFX_STYLE_FAMILY_PARA)); - rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(name3, SFX_STYLE_FAMILY_CHAR)); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1, SfxStyleFamily::Char)); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name2, SfxStyleFamily::Para)); + rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(name3, SfxStyleFamily::Char)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); iss.AddStyleSheet(sheet2); iss.AddStyleSheet(sheet3); - const std::vector<unsigned>& v = iss.GetStyleSheetPositionsByFamily(SFX_STYLE_FAMILY_CHAR); + const std::vector<unsigned>& v = iss.GetStyleSheetPositionsByFamily(SfxStyleFamily::Char); CPPUNIT_ASSERT_EQUAL_MESSAGE("Separation by family works.", static_cast<size_t>(2), v.size()); - const std::vector<unsigned>& w = iss.GetStyleSheetPositionsByFamily(SFX_STYLE_FAMILY_ALL); + const std::vector<unsigned>& w = iss.GetStyleSheetPositionsByFamily(SfxStyleFamily::All); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wildcard works for family queries.", static_cast<size_t>(3), w.size()); } void IndexedStyleSheetsTest::OnlyOneStyleSheetIsReturnedWhenReturnFirstIsUsed() { rtl::OUString name("name1"); - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name, SFX_STYLE_FAMILY_CHAR)); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name, SFX_STYLE_FAMILY_PARA)); - rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(name, SFX_STYLE_FAMILY_CHAR)); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name, SfxStyleFamily::Char)); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name, SfxStyleFamily::Para)); + rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(name, SfxStyleFamily::Char)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); diff --git a/svl/source/items/IndexedStyleSheets.cxx b/svl/source/items/IndexedStyleSheets.cxx index 750a7fd18771..1b1b54eb4bd9 100644 --- a/svl/source/items/IndexedStyleSheets.cxx +++ b/svl/source/items/IndexedStyleSheets.cxx @@ -23,18 +23,19 @@ const size_t NUMBER_OF_FAMILIES = 6; size_t family_to_index(SfxStyleFamily family) { switch (family) { - case SFX_STYLE_FAMILY_CHAR: + case SfxStyleFamily::Char: return 0; - case SFX_STYLE_FAMILY_PARA: + case SfxStyleFamily::Para: return 1; - case SFX_STYLE_FAMILY_FRAME: + case SfxStyleFamily::Frame: return 2; - case SFX_STYLE_FAMILY_PAGE: + case SfxStyleFamily::Page: return 3; - case SFX_STYLE_FAMILY_PSEUDO: + case SfxStyleFamily::Pseudo: return 4; - case SFX_STYLE_FAMILY_ALL: + case SfxStyleFamily::All: return 5; + default: break; } assert(false); // only for compiler warning. all cases are handled in the switch return 0; @@ -57,7 +58,7 @@ IndexedStyleSheets::Register(const SfxStyleSheetBase& style, unsigned pos) mPositionsByName.insert(std::make_pair(style.GetName(), pos)); size_t position = family_to_index(style.GetFamily()); mStyleSheetPositionsByFamily.at(position).push_back(pos); - size_t positionForFamilyAll = family_to_index(SFX_STYLE_FAMILY_ALL); + size_t positionForFamilyAll = family_to_index(SfxStyleFamily::All); mStyleSheetPositionsByFamily.at(positionForFamilyAll).push_back(pos); } diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index 881c464ee1f4..f26597fc61d7 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -113,7 +113,7 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : 2, 2, 2, TransliterationModules_IGNORE_CASE, SearchAlgorithms2::ABSOLUTE, '\\' ), - m_eFamily ( SFX_STYLE_FAMILY_PARA ), + m_eFamily ( SfxStyleFamily::Para ), m_nCommand ( SvxSearchCmd::FIND ), m_nCellType ( SvxSearchCellType::FORMULA ), m_nAppFlag ( SvxSearchApp::WRITER ), diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 4221020c5077..f14dd8a1137e 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -372,7 +372,7 @@ SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const inline bool SfxStyleSheetIterator::IsTrivialSearch() { return (( nMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE) && - (GetSearchFamily() == SFX_STYLE_FAMILY_ALL); + (GetSearchFamily() == SfxStyleFamily::All); } namespace { @@ -385,7 +385,7 @@ struct DoesStyleMatchStyleSheetPredicate final : public svl::StyleSheetPredicate bool Check(const SfxStyleSheetBase& styleSheet) override { - bool bMatchFamily = ((mIterator->GetSearchFamily() == SFX_STYLE_FAMILY_ALL) || + bool bMatchFamily = ((mIterator->GetSearchFamily() == SfxStyleFamily::All) || ( styleSheet.GetFamily() == mIterator->GetSearchFamily() )); bool bUsed = mIterator->SearchUsed() && styleSheet.IsUsed( ); @@ -577,7 +577,7 @@ SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r ) : pImp(new SfxStyleSheetBasePool_Impl), aAppName(r.GetName()), rPool(r), - nSearchFamily(SFX_STYLE_FAMILY_PARA), + nSearchFamily(SfxStyleFamily::Para), nMask(SFXSTYLEBIT_ALL) { #ifdef DBG_UTIL @@ -656,7 +656,7 @@ SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r ) SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, sal_uInt16 mask) { - OSL_ENSURE( eFam != SFX_STYLE_FAMILY_ALL, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" ); + OSL_ENSURE( eFam != SfxStyleFamily::All, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" ); SfxStyleSheetIterator aIter(this, eFam, mask); rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) ); |