diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-11-08 20:40:19 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-11-08 22:58:21 +0100 |
commit | e377a65a1e6acf6241ce0bd2fc35a6a786cd8de9 (patch) | |
tree | 251e00afd6de372b1f07c5009c873afe33b5f2eb /sw | |
parent | f7c14f57300255bb279ccd95d6b87347b1e0aec2 (diff) |
sw: remove pointless inheritance of SwChapterNumRules from SwBaseNumRules
Change-Id: I5426977d4ed5539d79335df0aa4bcccd71dd8966
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/misc/outline.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/config/StoredChapterNumbering.cxx | 24 | ||||
-rw-r--r-- | sw/source/uibase/config/uinums.cxx | 36 | ||||
-rw-r--r-- | sw/source/uibase/inc/uinums.hxx | 25 |
4 files changed, 32 insertions, 57 deletions
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index c3eae29e8ff7..d669783bb769 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -91,13 +91,13 @@ IMPL_LINK_INLINE_END( SwNumNamesDlg, SelectHdl, ListBox *, pBox ) void SwNumNamesDlg::SetUserNames(const OUString *pList[]) { sal_uInt16 nSelect = 0; - for(sal_uInt16 i = 0; i < SwBaseNumRules::nMaxRules; ++i) + for (sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i) { if(pList[i]) { m_pFormBox->RemoveEntry(i); m_pFormBox->InsertEntry(*pList[i], i); - if(i == nSelect && nSelect < SwBaseNumRules::nMaxRules) + if (i == nSelect && nSelect < SwChapterNumRules::nMaxRules) nSelect++; } } diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx index 245e88453517..eb8ae2fa3ca1 100644 --- a/sw/source/uibase/config/StoredChapterNumbering.cxx +++ b/sw/source/uibase/config/StoredChapterNumbering.cxx @@ -46,7 +46,7 @@ class StoredChapterNumberingRules { private: // TODO in case this ever becomes accessible via api need a invalidate - SwBaseNumRules & m_rNumRules; + SwChapterNumRules & m_rNumRules; sal_uInt16 const m_nIndex; SwNumRulesWithName * GetOrCreateRules() @@ -63,11 +63,11 @@ private: public: StoredChapterNumberingRules( - SwBaseNumRules & rNumRules, sal_uInt16 const nIndex) + SwChapterNumRules & rNumRules, sal_uInt16 const nIndex) : m_rNumRules(rNumRules) , m_nIndex(nIndex) { - assert(m_nIndex < SwBaseNumRules::nMaxRules); + assert(m_nIndex < SwChapterNumRules::nMaxRules); } // XNamed @@ -324,13 +324,13 @@ class StoredChapterNumberingRootContext : public SvXMLImportContext { private: - SwBaseNumRules & m_rNumRules; + SwChapterNumRules & m_rNumRules; size_t m_nCounter; ::std::vector<tools::SvRef<SvxXMLListStyleContext>> m_Contexts; public: StoredChapterNumberingRootContext( - SwBaseNumRules & rNumRules, SvXMLImport & rImport, + SwChapterNumRules & rNumRules, SvXMLImport & rImport, sal_uInt16 const nPrefix, OUString const& rLocalName) : SvXMLImportContext(rImport, nPrefix, rLocalName) , m_rNumRules(rNumRules) @@ -340,7 +340,7 @@ public: virtual void EndElement() SAL_OVERRIDE { - assert(m_Contexts.size() < SwBaseNumRules::nMaxRules); + assert(m_Contexts.size() < SwChapterNumRules::nMaxRules); for (auto iter = m_Contexts.begin(); iter != m_Contexts.end(); ++iter) { uno::Reference<container::XIndexReplace> const xRule( @@ -360,7 +360,7 @@ public: if (XML_NAMESPACE_TEXT == nPrefix && IsXMLToken(rLocalName, XML_OUTLINE_STYLE)) { ++m_nCounter; - if (m_nCounter <= SwBaseNumRules::nMaxRules) + if (m_nCounter <= SwChapterNumRules::nMaxRules) { SvxXMLListStyleContext *const pContext( new SvxXMLListStyleContext(GetImport(), @@ -384,12 +384,12 @@ class StoredChapterNumberingImport : public SvXMLImport { private: - SwBaseNumRules & m_rNumRules; + SwChapterNumRules & m_rNumRules; public: StoredChapterNumberingImport( uno::Reference<uno::XComponentContext> const& xContext, - SwBaseNumRules & rNumRules) + SwChapterNumRules & rNumRules) : SvXMLImport(xContext, "sw::StoredChapterNumberingImport", IMPORT_ALL) , m_rNumRules(rNumRules) { @@ -408,7 +408,7 @@ public: } }; -void ExportStoredChapterNumberingRules(SwBaseNumRules & rRules, +void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules, SvStream & rStream, OUString const& rFileName) { uno::Reference<uno::XComponentContext> const xContext( @@ -432,7 +432,7 @@ void ExportStoredChapterNumberingRules(SwBaseNumRules & rRules, // ... and the import needs to map from name to display-name then! std::set<OUString> charStyles; std::vector<uno::Reference<container::XIndexReplace>> numRules; - for (size_t i = 0; i < SwBaseNumRules::nMaxRules; ++i) + for (size_t i = 0; i < SwChapterNumRules::nMaxRules; ++i) { if (SwNumRulesWithName const* pRule = rRules.GetRules(i)) { @@ -461,7 +461,7 @@ void ExportStoredChapterNumberingRules(SwBaseNumRules & rRules, } } -void ImportStoredChapterNumberingRules(SwBaseNumRules & rRules, +void ImportStoredChapterNumberingRules(SwChapterNumRules & rRules, SvStream & rStream, OUString const& rFileName) { uno::Reference<uno::XComponentContext> const xContext( diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx index 2d03704408ee..7ccb53243cc5 100644 --- a/sw/source/uibase/config/uinums.cxx +++ b/sw/source/uibase/config/uinums.cxx @@ -54,16 +54,16 @@ using namespace ::com::sun::star; An old rule at that position will be overwritten. */ -SwBaseNumRules::SwBaseNumRules( const OUString& rFileName ) - : - sFileName( rFileName ), +SwChapterNumRules::SwChapterNumRules() + : sFileName(OUString(CHAPTER_FILENAME)) + , nVersion(0), bModified( false ) { Init(); } -void SwBaseNumRules::Save() +void SwChapterNumRules::Save() { if( bModified ) { @@ -87,13 +87,13 @@ void SwBaseNumRules::Save() } } -SwBaseNumRules::~SwBaseNumRules() +SwChapterNumRules::~SwChapterNumRules() { for( sal_uInt16 i = 0; i < nMaxRules; ++i ) delete pNumRules[i]; } -void SwBaseNumRules::Init() +void SwChapterNumRules::Init() { for(sal_uInt16 i = 0; i < nMaxRules; ++i ) pNumRules[i] = 0; @@ -107,15 +107,16 @@ void SwBaseNumRules::Init() } } -void SwBaseNumRules::CreateEmptyNumRule(sal_uInt16 const nIndex) +void SwChapterNumRules::CreateEmptyNumRule(sal_uInt16 const nIndex) { assert(nIndex < nMaxRules); assert(!pNumRules[nIndex]); pNumRules[nIndex] = new SwNumRulesWithName; } -void SwBaseNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, sal_uInt16 nIdx) +void SwChapterNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, sal_uInt16 nIdx) { + bModified = true; OSL_ENSURE(nIdx < nMaxRules, "Array der NumRules ueberindiziert."); if( !pNumRules[nIdx] ) pNumRules[nIdx] = new SwNumRulesWithName( rCopy ); @@ -124,7 +125,7 @@ void SwBaseNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, sal_uInt16 n Save(); // store it immediately } -bool SwBaseNumRules::Store(SvStream &rStream) +bool SwChapterNumRules::Store(SvStream &rStream) { rStream.WriteUInt16( ACT_NUM_VERSION ); // Write, what positions are occupied by a rule @@ -142,7 +143,7 @@ bool SwBaseNumRules::Store(SvStream &rStream) return true; } -int SwBaseNumRules::Load(SvStream &rStream) +int SwChapterNumRules::Load(SvStream &rStream) { int rc = 0; @@ -173,21 +174,6 @@ int SwBaseNumRules::Load(SvStream &rStream) return rc; } -SwChapterNumRules::SwChapterNumRules() : - SwBaseNumRules(OUString(CHAPTER_FILENAME)) -{ -} - - SwChapterNumRules::~SwChapterNumRules() -{ -} - -void SwChapterNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, sal_uInt16 nIdx) -{ - bModified = true; - SwBaseNumRules::ApplyNumRules(rCopy, nIdx); -} - SwNumRulesWithName::SwNumRulesWithName( const SwNumRule &rCopy, const OUString &rName ) : maName(rName) diff --git a/sw/source/uibase/inc/uinums.hxx b/sw/source/uibase/inc/uinums.hxx index bb1627e621f8..e95bc9cca3cb 100644 --- a/sw/source/uibase/inc/uinums.hxx +++ b/sw/source/uibase/inc/uinums.hxx @@ -62,7 +62,7 @@ class SW_DLLPUBLIC SwNumRulesWithName protected: friend class sw::StoredChapterNumberingRules; - friend class SwBaseNumRules; + friend class SwChapterNumRules; void SetName(const OUString& rSet) {maName = rSet;} void SetNumFmt(size_t, SwNumFmt const&, OUString const&); SwNumRulesWithName(); @@ -83,7 +83,7 @@ public: void GetNumFmt(size_t, SwNumFmt const*&, OUString const*&) const; }; -class SwBaseNumRules +class SwChapterNumRules { public: enum { nMaxRules = MAX_NUM_RULES }; // currently 9 defined forms @@ -100,8 +100,8 @@ protected: void Save(); public: - SwBaseNumRules(const OUString& rFileName); - virtual ~SwBaseNumRules(); + SwChapterNumRules(); + virtual ~SwChapterNumRules(); inline const SwNumRulesWithName* GetRules(sal_uInt16 nIdx) const; void CreateEmptyNumRule(sal_uInt16 nIdx); // for import @@ -111,18 +111,7 @@ public: }; -class SwChapterNumRules : public SwBaseNumRules -{ - -public: - SwChapterNumRules(); - virtual ~SwChapterNumRules(); - - virtual void ApplyNumRules( const SwNumRulesWithName &rCopy, - sal_uInt16 nIdx) SAL_OVERRIDE; -}; - -inline const SwNumRulesWithName *SwBaseNumRules::GetRules(sal_uInt16 nIdx) const +inline const SwNumRulesWithName *SwChapterNumRules::GetRules(sal_uInt16 nIdx) const { OSL_ENSURE(nIdx < nMaxRules, "Array der NumRules ueberindiziert."); return pNumRules[nIdx]; @@ -133,9 +122,9 @@ namespace sw { void ExportStoredChapterNumberingRules( - SwBaseNumRules & rRules, SvStream & rStream, OUString const&); + SwChapterNumRules & rRules, SvStream & rStream, OUString const&); void ImportStoredChapterNumberingRules( - SwBaseNumRules & rRules, SvStream & rStream, OUString const&); + SwChapterNumRules & rRules, SvStream & rStream, OUString const&); } // namespace sw |