diff options
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/dbgoutsw.hxx | 3 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 6 | ||||
-rw-r--r-- | sw/inc/frameformats.hxx | 91 | ||||
-rw-r--r-- | sw/inc/frmfmt.hxx | 3 | ||||
-rw-r--r-- | sw/inc/textboxhelper.hxx | 1 |
5 files changed, 5 insertions, 99 deletions
diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx index 2d8af9972e21..97587d911333 100644 --- a/sw/inc/dbgoutsw.hxx +++ b/sw/inc/dbgoutsw.hxx @@ -41,7 +41,6 @@ class SwNodeNum; class SwUndo; class SwRect; class SwFrameFormat; -class SwFrameFormats; class SwNumRuleTable; class SwNumRule; class SwOutlineNodes; @@ -71,9 +70,9 @@ const char* dbg_out(const SwUndo& rUndo); const char* dbg_out(SwOutlineNodes const& rNodes); const char* dbg_out(const SwNumRule& rRule); const char* dbg_out(const SwTextFormatColl& rFormat); -const char* dbg_out(const SwFrameFormats& rFrameFormats); const char* dbg_out(const SwNumRuleTable& rTable); const char* dbg_out(const SwNodeRange& rRange); +const char* dbg_out(const sw::FrameFormats<sw::SpzFrameFormat*>& rFrameFormats); template <typename tKey, typename tMember, typename fHashFunction> OUString lcl_dbg_out(const std::unordered_map<tKey, tMember, fHashFunction>& rMap) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index ef630faf1a33..c3ac513c4b52 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -246,7 +246,7 @@ class SW_DLLPUBLIC SwDoc final std::unique_ptr<SwTextFormatColl> mpDfltTextFormatColl; //< Defaultformatcollections std::unique_ptr<SwGrfFormatColl> mpDfltGrfFormatColl; - std::unique_ptr<SwFrameFormats> mpFrameFormatTable; //< Format table + std::unique_ptr<sw::FrameFormats<SwFrameFormat*>> mpFrameFormatTable; //< Format table std::unique_ptr<SwCharFormats> mpCharFormatTable; std::unique_ptr<sw::FrameFormats<sw::SpzFrameFormat*>> mpSpzFrameFormatTable; std::unique_ptr<SwSectionFormats> mpSectionFormatTable; @@ -748,8 +748,8 @@ public: bool DontExpandFormat( const SwPosition& rPos, bool bFlag = true ); // Formats - const SwFrameFormats* GetFrameFormats() const { return mpFrameFormatTable.get(); } - SwFrameFormats* GetFrameFormats() { return mpFrameFormatTable.get(); } + const sw::FrameFormats<SwFrameFormat*>* GetFrameFormats() const { return mpFrameFormatTable.get(); } + sw::FrameFormats<SwFrameFormat*>* GetFrameFormats() { return mpFrameFormatTable.get(); } const SwCharFormats* GetCharFormats() const { return mpCharFormatTable.get();} SwCharFormats* GetCharFormats() { return mpCharFormatTable.get();} diff --git a/sw/inc/frameformats.hxx b/sw/inc/frameformats.hxx index be3e5fd9ae77..bdf0a69905b5 100644 --- a/sw/inc/frameformats.hxx +++ b/sw/inc/frameformats.hxx @@ -34,97 +34,6 @@ class SwTableFormat; // Like o3tl::find_partialorder_ptrequals // We don't allow duplicated object entries! -struct type_name_key - : boost::multi_index::composite_key< - SwFrameFormat*, - boost::multi_index::const_mem_fun<SwFormat, const OUString&, &SwFormat::GetName>, - boost::multi_index::const_mem_fun<SwFormat, sal_uInt16, &SwFormat::Which>, - boost::multi_index::identity<SwFrameFormat*> // the actual object pointer - > -{ -}; - -typedef boost::multi_index_container< - SwFrameFormat*, - boost::multi_index::indexed_by<boost::multi_index::random_access<>, - boost::multi_index::ordered_unique<type_name_key>>> - SwFrameFormatsBase; - -/// Specific frame formats (frames, DrawObjects). -class SW_DLLPUBLIC SwFrameFormats final : public SwFormatsBase -{ - // function updating ByName index via modify - friend void SwFrameFormat::SetFormatName(const OUString&, bool); - -public: - typedef SwFrameFormatsBase::nth_index<0>::type ByPos; - typedef SwFrameFormatsBase::nth_index<1>::type ByTypeAndName; - typedef ByPos::iterator iterator; - -private: - SwFrameFormatsBase m_Array; - ByPos& m_PosIndex; - ByTypeAndName& m_TypeAndNameIndex; - -public: - typedef ByPos::const_iterator const_iterator; - typedef SwFrameFormatsBase::size_type size_type; - typedef SwFrameFormatsBase::value_type value_type; - - SwFrameFormats(); - // frees all SwFrameFormat! - virtual ~SwFrameFormats() override; - - bool empty() const { return m_Array.empty(); } - size_t size() const { return m_Array.size(); } - - // Only fails, if you try to insert the same object twice - std::pair<const_iterator, bool> push_back(const value_type& x); - - // This will try to remove the exact object! - bool erase(const value_type& x); - void erase(size_type index); - void erase(const_iterator const& position); - - // Get the iterator of the exact object (includes pointer!), - // e.g for position with std::distance. - // There is also ContainsFormat, if you don't need the position. - const_iterator find(const value_type& x) const; - - ByTypeAndName::const_iterator findByTypeAndName(sal_uInt16 type, const OUString& name) const; - // search for formats by name - std::pair<ByTypeAndName::const_iterator, ByTypeAndName::const_iterator> - findRangeByName(const OUString& name) const; - // So we can actually check for end() - ByTypeAndName::const_iterator typeAndNameEnd() const { return m_TypeAndNameIndex.end(); } - - const value_type& operator[](size_t index_) const { return m_PosIndex.operator[](index_); } - const value_type& front() const { return m_PosIndex.front(); } - const value_type& back() const { return m_PosIndex.back(); } - const_iterator begin() const { return m_PosIndex.begin(); } - const_iterator end() const { return m_PosIndex.end(); } - - void dumpAsXml(xmlTextWriterPtr pWriter, const char* pName) const; - - virtual size_t GetFormatCount() const override { return m_Array.size(); } - virtual SwFormat* GetFormat(size_t idx) const override { return operator[](idx); } - virtual void Rename(const SwFrameFormat& rFormat, const OUString& sNewName) override; - - /// fast check if given format is contained here - /// @precond pFormat must not have been deleted - bool ContainsFormat(SwFrameFormat const& rFormat) const; - /// not so fast check that given format is still alive (i.e. contained here) - bool IsAlive(SwFrameFormat const*) const; - - void DeleteAndDestroyAll(bool keepDefault = false); - - bool newDefault(const value_type& x); - void newDefault(const_iterator const& position); - - // Override return type to reduce casting - virtual SwFrameFormat* FindFormatByName(const OUString& rName) const override; -}; - namespace sw { template <class value_type> class FrameFormats final : public SwFormatsBase diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 309aa78de552..c619da0e95a8 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -64,7 +64,6 @@ namespace sw class SpzFrameFormat; } class SwFormatsBase; -class SwFrameFormats; class SwTableFormat; /// Style of a layout element. @@ -74,9 +73,9 @@ class SW_DLLPUBLIC SwFrameFormat friend class SwDoc; friend class SwPageDesc; ///< Is allowed to call protected CTor. friend class ::sw::DocumentLayoutManager; ///< Is allowed to call protected CTor. - friend class SwFrameFormats; ///< Is allowed to update the list backref. friend class sw::FrameFormats<SwTableFormat*>; ///< Is allowed to update the list backref. friend class sw::FrameFormats<sw::SpzFrameFormat*>; ///< Is allowed to update the list backref. + friend class sw::FrameFormats<SwFrameFormat*>; ///< Is allowed to update the list backref. friend class SwTextBoxHelper; friend class SwUndoFlyBase; ///< calls SetOtherTextBoxFormat diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx index 2eef22d2b20e..c4f4c3d8fbbb 100644 --- a/sw/inc/textboxhelper.hxx +++ b/sw/inc/textboxhelper.hxx @@ -25,7 +25,6 @@ class SdrPage; class SdrObject; class SfxItemSet; class SwFrameFormat; -class SwFrameFormats; class SwFormatAnchor; class SwFormatContent; class SwDoc; |