diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-04-27 07:58:23 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-04-27 09:14:08 +0200 |
commit | 52acefd6024ec79f8333ba40eef83816eda3046f (patch) | |
tree | d919e4088c500d2fcdad04e7cf358b008f08754c /sw/inc | |
parent | 2f8d10b0b9baa03b8a713e9fd1342fe6c8094fb4 (diff) |
Revert "introduce sw::SpzFrameFormat ..."
This reverts commit 09cdcb5f37bb4e42da7b28db6e757b9f2affed14. It broke at
least CppunitTest_sw_uiwriter3
(<https://ci.libreoffice.org//job/lo_ubsan/2756/>),
> /sw/source/core/undo/rolbck.cxx:938:46: runtime error: downcast of address 0x61300041fd00 which does not point to an object of type 'SwFlyFrameFormat'
> 0x61300041fd00: note: object is of type 'SwDrawFrameFormat'
> 00 00 00 00 70 83 cf 09 25 7f 00 00 00 83 47 00 30 61 00 00 40 e5 43 00 30 61 00 00 80 66 5d 00
> ^~~~~~~~~~~~~~~~~~~~~~~
> vptr for 'SwDrawFrameFormat'
> #0 0x7f24fca9c5b9 in SwHistoryChangeFlyAnchor::SetInDoc(SwDoc*, bool) /sw/source/core/undo/rolbck.cxx:938:46
> #1 0x7f24fca880f3 in SwHistory::Rollback(SwDoc*, unsigned short) /sw/source/core/undo/rolbck.cxx:1208:15
> #2 0x7f24fcb47832 in SwUndoDelete::UndoImpl(sw::UndoRedoContext&) /sw/source/core/undo/undel.cxx:1031:33
> #3 0x7f24fcb703c2 in SwUndo::UndoWithContext(SfxUndoContext&) /sw/source/core/undo/undobj.cxx:225:5
> #4 0x7f2543b8b57c in SfxUndoManager::ImplUndo(SfxUndoContext*) /svl/source/undo/undo.cxx:712:22
> #5 0x7f2543b8c4f8 in SfxUndoManager::UndoWithContext(SfxUndoContext&) /svl/source/undo/undo.cxx:664:12
> #6 0x7f24fca6a074 in sw::UndoManager::impl_DoUndoRedo(sw::UndoManager::UndoOrRedoType, unsigned long) /sw/source/core/undo/docundo.cxx:696:32
> #7 0x7f24fca6b38f in sw::UndoManager::UndoWithOffset(unsigned long) /sw/source/core/undo/docundo.cxx:731:16
> #8 0x7f24fa830b18 in SwEditShell::Undo(unsigned short, unsigned short) /sw/source/core/edit/edundo.cxx:141:57
> #9 0x7f250088f448 in SwWrtShell::Do(SwWrtShell::DoType, unsigned short, unsigned short) /sw/source/uibase/wrtsh/wrtundo.cxx:45:26
> #10 0x7f24ff7f16e2 in SwBaseShell::ExecUndo(SfxRequest&) /sw/source/uibase/shells/basesh.cxx:651:27
> #11 0x7f24ff7eea14 in SfxStubSwBaseShellExecUndo(SfxShell*, SfxRequest&) /workdir/SdiTarget/sw/sdi/swslots.hxx:2203:1
> #12 0x7f2523fbc059 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:254:9
> #13 0x7f2523fd1ced in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:753:9
> #14 0x7f2523f61333 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) /sfx2/source/control/bindings.cxx:1060:22
> #15 0x7f252437496b in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:688:53
> #16 0x7f2524377211 in SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:266:16
> #17 0x7f24cad28dd6 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatch> const&, com::sun::star::util::URL const&, bool, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:163:30
> #18 0x7f24cad27cb2 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:120:16
> #19 0x7f24cad29684 in non-virtual thunk to framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx
> #20 0x7f24e91d386d in unotest::MacrosTest::dispatchCommand(com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:94:33
> #21 0x7f25319b2012 in testTdf132321::TestBody() /sw/qa/extras/uiwriter/uiwriter3.cxx:982:5
Change-Id: Ibeb181bc38cd6f88df76403cca8a15b45090633f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151027
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/doc.hxx | 6 | ||||
-rw-r--r-- | sw/inc/frameformats.hxx | 14 | ||||
-rw-r--r-- | sw/inc/frmfmt.hxx | 52 | ||||
-rw-r--r-- | sw/inc/textboxhelper.hxx | 7 |
4 files changed, 20 insertions, 59 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 7a1b2e0ee969..d9ff583fcdec 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -248,7 +248,7 @@ class SW_DLLPUBLIC SwDoc final std::unique_ptr<SwFrameFormats> mpFrameFormatTable; //< Format table std::unique_ptr<SwCharFormats> mpCharFormatTable; - std::unique_ptr<sw::FrameFormats<sw::SpzFrameFormat*>> mpSpzFrameFormatTable; + std::unique_ptr<SwFrameFormats> mpSpzFrameFormatTable; std::unique_ptr<SwSectionFormats> mpSectionFormatTable; std::unique_ptr<sw::TableFrameFormats> mpTableFrameFormatTable; //< For tables std::unique_ptr<SwTextFormatColls> mpTextFormatCollTable; //< FormatCollections @@ -754,8 +754,8 @@ public: SwCharFormats* GetCharFormats() { return mpCharFormatTable.get();} // LayoutFormats (frames, DrawObjects), sometimes const sometimes not - const sw::FrameFormats<sw::SpzFrameFormat*>* GetSpzFrameFormats() const { return mpSpzFrameFormatTable.get(); } - sw::FrameFormats<sw::SpzFrameFormat*>* GetSpzFrameFormats() { return mpSpzFrameFormatTable.get(); } + const SwFrameFormats* GetSpzFrameFormats() const { return mpSpzFrameFormatTable.get(); } + SwFrameFormats* GetSpzFrameFormats() { return mpSpzFrameFormatTable.get(); } const SwFrameFormat *GetDfltFrameFormat() const { return mpDfltFrameFormat.get(); } SwFrameFormat *GetDfltFrameFormat() { return mpDfltFrameFormat.get(); } diff --git a/sw/inc/frameformats.hxx b/sw/inc/frameformats.hxx index be3e5fd9ae77..97c86408e867 100644 --- a/sw/inc/frameformats.hxx +++ b/sw/inc/frameformats.hxx @@ -19,7 +19,6 @@ #pragma once #include "docary.hxx" -#include "frmfmt.hxx" #include "swtblfmt.hxx" #include <boost/multi_index_container.hpp> #include <boost/multi_index/composite_key.hpp> @@ -154,10 +153,6 @@ template <class value_type> class FrameFormats final : public SwFormatsBase friend class ::SwFrameFormat; public: - // getting from T* to T const* ... - typedef typename std::add_pointer< - typename std::add_const<typename std::remove_pointer<value_type>::type>::type>::type - const_value_type; typedef typename FrameFormatsContainer::size_type size_type; typedef typename FrameFormatsContainer::template index<ByPos>::type index_type; typedef typename index_type::iterator iterator; @@ -279,12 +274,7 @@ public: bool ContainsFormat(const value_type& rpFormat) const { return rpFormat->m_ffList == this; }; /// not so fast check that given format is still alive (i.e. contained here) - bool IsAlive(const_value_type pFrameFormat) const - { - auto pThisNonConst - = const_cast<typename std::remove_const<sw::FrameFormats<value_type>>::type*>(this); - return pThisNonConst->find(const_cast<value_type>(pFrameFormat)) != pThisNonConst->end(); - }; + bool IsAlive(value_type const* p) const { return find(*p) != end(); }; void DeleteAndDestroyAll(bool keepDefault = false) { @@ -324,10 +314,8 @@ public: }; }; typedef FrameFormats<::SwTableFormat*> TableFrameFormats; -typedef FrameFormats<sw::SpzFrameFormat*> SpzFrameFormats; } template class SW_DLLPUBLIC sw::FrameFormats<SwTableFormat*>; -template class SW_DLLPUBLIC sw::FrameFormats<sw::SpzFrameFormat*>; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 309aa78de552..f5e44e03136c 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -23,27 +23,20 @@ #include <com/sun/star/text/PositionLayoutDir.hpp> #include <cppuhelper/weakref.hxx> #include <tools/gen.hxx> -namespace sw -{ - template<class T> class FrameFormats; - class SpzFrameFormat; -} #include "format.hxx" #include "hintids.hxx" #include "swdllapi.h" #include <list> #include "textboxhelper.hxx" +class SwFlyFrame; +class SwFlyDrawContact; +class SwAnchoredObject; class Graphic; -class IMapObject; class ImageMap; -class SdrObject; -class SwAnchoredObject; -class SwDrawFrameFormat; -class SwFlyDrawContact; -class SwFlyFrame; -class SwFlyFrameFormat; +class IMapObject; class SwRect; +class SdrObject; class SwRootFrame; class SwTableBox; @@ -61,7 +54,6 @@ namespace sw virtual ~FindSdrObjectHint() override; }; template<class T> class FrameFormats; - class SpzFrameFormat; } class SwFormatsBase; class SwFrameFormats; @@ -76,7 +68,6 @@ class SW_DLLPUBLIC SwFrameFormat 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 SwTextBoxHelper; friend class SwUndoFlyBase; ///< calls SetOtherTextBoxFormat @@ -199,25 +190,9 @@ public: virtual bool IsVisible() const; }; -namespace sw -{ - class SW_DLLPUBLIC SpzFrameFormat: public SwFrameFormat { - friend ::SwDrawFrameFormat; - friend ::SwFlyFrameFormat; - SpzFrameFormat( - SwAttrPool& rPool, - const OUString& rFormatName, - SwFrameFormat* pDerivedFrame, - sal_uInt16 nFormatWhich) - : SwFrameFormat(rPool, rFormatName, pDerivedFrame, nFormatWhich) - { - assert(nFormatWhich == RES_DRAWFRMFMT || nFormatWhich == RES_FLYFRMFMT); - }; - }; -} // The FlyFrame-Format -class SW_DLLPUBLIC SwFlyFrameFormat final : public sw::SpzFrameFormat +class SW_DLLPUBLIC SwFlyFrameFormat final : public SwFrameFormat { friend class SwDoc; OUString msTitle; @@ -405,7 +380,7 @@ namespace sw }; } -class SW_DLLPUBLIC SwDrawFrameFormat final : public sw::SpzFrameFormat +class SW_DLLPUBLIC SwDrawFrameFormat final : public SwFrameFormat { friend class SwDoc; @@ -421,12 +396,15 @@ class SW_DLLPUBLIC SwDrawFrameFormat final : public sw::SpzFrameFormat bool mbPosAttrSet; - SwDrawFrameFormat(SwAttrPool& rPool, const OUString& rFormatName, SwFrameFormat* pDerivedFrame) - : sw::SpzFrameFormat(rPool, rFormatName, pDerivedFrame, RES_DRAWFRMFMT), + SwDrawFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, + SwFrameFormat *pDrvdFrame ) + : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_DRAWFRMFMT ), m_pSdrObjectCached(nullptr), - meLayoutDir(SwFrameFormat::HORI_L2R), - mnPositionLayoutDir(css::text::PositionLayoutDir::PositionInLayoutDirOfAnchor), - mbPosAttrSet(false) + meLayoutDir( SwFrameFormat::HORI_L2R ), + + mnPositionLayoutDir( css::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), + + mbPosAttrSet( false ) {} public: diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx index 2eef22d2b20e..ebf329342d8e 100644 --- a/sw/inc/textboxhelper.hxx +++ b/sw/inc/textboxhelper.hxx @@ -42,11 +42,6 @@ namespace com::sun::star::text { class XTextFrame; } -namespace sw -{ -template <class T> class FrameFormats; -class SpzFrameFormat; -} /** * A TextBox is a TextFrame, that is tied to a drawinglayer shape. @@ -170,7 +165,7 @@ public: static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough); /// Saves the current shape -> textbox links in a map, so they can be restored later. - static void saveLinks(const sw::FrameFormats<sw::SpzFrameFormat*>& rFormats, + static void saveLinks(const SwFrameFormats& rFormats, std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks); /// Undo the effect of saveLinks() + individual resetLink() calls. static void restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew, |