diff options
Diffstat (limited to 'sw')
65 files changed, 318 insertions, 279 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, diff --git a/sw/qa/core/attr/attr.cxx b/sw/qa/core/attr/attr.cxx index d123ed858b57..25d2a8025020 100644 --- a/sw/qa/core/attr/attr.cxx +++ b/sw/qa/core/attr/attr.cxx @@ -62,8 +62,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFormatFlySplit) RndStdIds eAnchor = RndStdIds::FLY_AT_PARA; aMgr.InsertFlyFrame(eAnchor, aMgr.GetPos(), aMgr.GetSize()); SwDoc* pDoc = getSwDoc(); - sw::SpzFrameFormats& rFlys = *pDoc->GetSpzFrameFormats(); - sw::SpzFrameFormat* pFly = rFlys[0]; + SwFrameFormats& rFlys = *pDoc->GetSpzFrameFormats(); + SwFrameFormat* pFly = rFlys[0]; CPPUNIT_ASSERT(!pFly->GetAttrSet().GetFlySplit().GetValue()); SfxItemSet aSet(pFly->GetAttrSet()); diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index fc1ffc69e8d9..1597302a5f64 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -55,7 +55,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType) pShell->InsertObject(svt::EmbeddedObjectRef(), &aGlobalName); // Then the anchor type should be as-char. - sw::SpzFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rFormats.size()); const SwFrameFormat& rFormat = *rFormats[0]; const SwFormatAnchor& rAnchor = rFormat.GetAnchor(); @@ -72,7 +72,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextboxTextRotateAngle) // Check the writing direction of the only TextFrame in the document. createSwDoc("textbox-textrotateangle.odt"); SwDoc* pDoc = getSwDoc(); - sw::SpzFrameFormats& rFrameFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFrameFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFrameFormats.size()); CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(RES_DRAWFRMFMT), rFrameFormats[0]->Which()); CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(RES_FLYFRMFMT), rFrameFormats[1]->Which()); @@ -132,9 +132,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxZOrder) { createSwDoc("textbox-zorder.docx"); SwDoc* pDoc = getSwDoc(); - sw::SpzFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), rFormats.size()); - const sw::SpzFrameFormat* pEllipse = rFormats[2]; + const SwFrameFormat* pEllipse = rFormats[2]; const SdrObject* pEllipseShape = pEllipse->FindRealSdrObject(); // Make sure we test the right shape. CPPUNIT_ASSERT_EQUAL(OUString("Shape3"), pEllipseShape->GetName()); @@ -291,9 +291,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyBookmarks) // Also, when checking the # of non-copy images in the resulting doc model: nActual = 0; - for (auto pSpz : *pDoc->GetSpzFrameFormats()) + SwFrameFormats& rFrameFormats = *pDoc->GetSpzFrameFormats(); + for (size_t i = 0; i < rFrameFormats.size(); ++i) { - if (pSpz->GetName().indexOf("Copy") == -1) + if (rFrameFormats[i]->GetName().indexOf("Copy") == -1) { ++nActual; } diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx index b77a4ea65d94..17bedbdbab9c 100644 --- a/sw/qa/core/draw/draw.cxx +++ b/sw/qa/core/draw/draw.cxx @@ -64,7 +64,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxUndoOrdNum) createSwDoc("textbox-undo-ordnum.docx"); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - const auto& rFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); // Test the state before del + undo. for (const auto& pFormat : rFormats) { diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx index 1ad1443dd392..f7e6992bf014 100644 --- a/sw/qa/core/layout/flycnt.cxx +++ b/sw/qa/core/layout/flycnt.cxx @@ -77,8 +77,8 @@ void Test::Create1x2SplitFly() pWrtShell->EndAllAction(); // Allow the text frame to split: pWrtShell->StartAllAction(); - auto& rFlys = *pDoc->GetSpzFrameFormats(); - auto pFly = rFlys[0]; + SwFrameFormats& rFlys = *pDoc->GetSpzFrameFormats(); + SwFrameFormat* pFly = rFlys[0]; SwAttrSet aSet(pFly->GetAttrSet()); aSet.Put(SwFormatFlySplit(true)); pDoc->SetAttr(aSet, *pFly); diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index f99cc3dd54dd..e0526bdbb361 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -74,7 +74,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) pWrtShell->SttEndDoc(/*bStart=*/false); pWrtShell->Paste(aClipboard); - const auto& rFormats = *pShell->GetDoc()->GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *pShell->GetDoc()->GetSpzFrameFormats(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 4 // - Actual : 6 @@ -176,7 +176,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testFlyAnchorUndo) SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); SwDoc* pDoc = pShell->GetDoc(); - const auto& rSpz = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rSpz = *pDoc->GetSpzFrameFormats(); sal_Int32 nExpected = rSpz[0]->GetAnchor().GetAnchorContentOffset(); // When deleting that last character and undoing it: diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx index 221f2ba4ece7..21543416dae8 100644 --- a/sw/qa/core/undo/undo.cxx +++ b/sw/qa/core/undo/undo.cxx @@ -66,7 +66,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo) selectShape(1); rtl::Reference<SwTransferable> pTransfer = new SwTransferable(*pWrtShell); pTransfer->Cut(); - auto& rSpzFrameFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rSpzFrameFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), rSpzFrameFormats.size()); pWrtShell->Undo(); diff --git a/sw/qa/core/view/view.cxx b/sw/qa/core/view/view.cxx index 576095c7f4cc..a3fd1863031e 100644 --- a/sw/qa/core/view/view.cxx +++ b/sw/qa/core/view/view.cxx @@ -49,11 +49,13 @@ CPPUNIT_TEST_FIXTURE(Test, testUpdateOleObjectPreviews) pWrtShell->UpdateOleObjectPreviews(); // Then make sure that the working preview of those objects are not lost: - const auto pFormats = pDoc->GetSpzFrameFormats(); + const SwFrameFormats* pFormats = pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT(pFormats); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pFormats->size()); - for (auto pFormat : *pFormats) + for (size_t i = 0; i < pFormats->size(); ++i) { + SwFrameFormat* pFormat = (*pFormats)[i]; + const SwNodeIndex* pNodeIndex = pFormat->GetContent().GetContentIdx(); CPPUNIT_ASSERT(pNodeIndex); SwNode* pNode = pDoc->GetNodes()[pNodeIndex->GetIndex() + 1]; diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index 34900529ada9..93c6598225b1 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -402,7 +402,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf122789) SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - const auto& rFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rFormats.size()); // This failed, the image had an absolute size, not a relative one. CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(70), rFormats[0]->GetAttrSet().GetFrameSize().GetWidthPercent()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index a0dd296e5e32..d69b53fa924c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -1103,8 +1103,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115094v3) createSwDoc("tdf115094v3.docx"); { SwDoc* pDoc = getSwDoc(); - auto& rSpzFormats = *pDoc->GetSpzFrameFormats(); - auto pFormat = rSpzFormats[0]; + SwFrameFormats& rSpzFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormat* pFormat = rSpzFormats[0]; // Without the fix, this has failed with: // - Expected: 1991 // - Actual : 1883 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 491626ff7812..a1610c35dbbb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -324,7 +324,7 @@ DECLARE_OOXMLEXPORT_TEST(testBtlrShape, "btlr-textbox.docx") SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - const auto& rFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFormats.size()); CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(RES_DRAWFRMFMT), rFormats[0]->Which()); CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(RES_FLYFRMFMT), rFormats[1]->Which()); diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 0213d0b893b7..3ae9fa470000 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -243,7 +243,7 @@ DECLARE_RTFEXPORT_TEST(testAnchoredAtSamePosition, "anchor.fodt") CPPUNIT_ASSERT_EQUAL(OUString("foobar"), getParagraph(1)->getString()); - auto& rFlys = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFlys(*pDoc->GetSpzFrameFormats()); if (isExported()) { // 2, not 3: the form control becomes a field on export... CPPUNIT_ASSERT_EQUAL(size_t(2), rFlys.size()); diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 1833b1220dbd..492de89912bc 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -753,7 +753,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137245) CPPUNIT_ASSERT(pFly != nullptr); } - const auto& rFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rFormats.size()); // move cursor back to body @@ -2692,12 +2692,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122942) pWrtShell->EndCreate(SdrCreateCmd::ForceEnd); // Make sure that the shape is inserted. - const auto& rFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFormats.size()); reload("writer8", "tdf122942.odt"); pDoc = getSwDoc(); - const auto& rFormats2 = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFormats2 = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFormats2.size()); // Make sure the top of the inserted shape does not move outside the existing shape, even after diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index b7a9a08d4316..a0356dfec4e5 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -1459,10 +1459,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testShapePageMove) { &aXItem, &aYItem }); // Check if the shape anchor was moved to the 2nd page as well. - auto pShapeFormats = pDoc->GetSpzFrameFormats(); + SwFrameFormats* pShapeFormats = pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT(!pShapeFormats->empty()); auto it = pShapeFormats->begin(); - auto pShapeFormat = *it; + SwFrameFormat* pShapeFormat = *it; const SwPosition* pAnchor = pShapeFormat->GetAnchor().GetContentAnchor(); CPPUNIT_ASSERT(pAnchor); @@ -2798,7 +2798,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf128603) rUndoManager.Undo(); // Make sure the content indexes still match. - const auto& rSpzFrameFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rSpzFrameFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(6), rSpzFrameFormats.size()); const SwNodeIndex* pIndex4 = rSpzFrameFormats[4]->GetContent().GetContentIdx(); CPPUNIT_ASSERT(pIndex4); diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 81a6d9e25fc2..65a1352dc79b 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -1072,7 +1072,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf130805) createSwDoc("tdf130805.odt"); SwDoc* pDoc = getSwDoc(); - const auto& rFrmFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFrmFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT(rFrmFormats.size() >= size_t(o3tl::make_unsigned(1))); auto pShape = rFrmFormats.front(); CPPUNIT_ASSERT(pShape); @@ -1097,9 +1097,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107893) SwDoc* pDoc = getSwDoc(); //Get the format of the shape - const auto& rFrmFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFrmFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT(rFrmFormats.size() >= size_t(o3tl::make_unsigned(1))); - auto pShape = rFrmFormats.front(); + SwFrameFormat* pShape = rFrmFormats.front(); CPPUNIT_ASSERT(pShape); //Add a textbox @@ -1150,9 +1150,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, TestTextBoxCrashAfterLineDel) SwDoc* pDoc = getSwDoc(); // Get the format of the shape - const auto& rFrmFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFrmFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT(rFrmFormats.size() >= size_t(o3tl::make_unsigned(1))); - auto pShape = rFrmFormats.front(); + SwFrameFormat* pShape = rFrmFormats.front(); CPPUNIT_ASSERT(pShape); // Add a textbox @@ -1974,7 +1974,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, AtPageTextBoxCrash) SwDoc* pDoc = getSwDoc(); // Get the format of the shape - const auto& rFrmFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFrmFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT(rFrmFormats.size() >= size_t(o3tl::make_unsigned(1))); auto pShape = rFrmFormats.front(); CPPUNIT_ASSERT(pShape); diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index d248c6ce6b26..f4274a629d39 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -689,10 +689,10 @@ DECLARE_WW8EXPORT_TEST(testTdf112535, "tdf112535.doc") SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); CPPUNIT_ASSERT(pDoc->GetSpzFrameFormats()); - auto& rFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT(!rFormats.empty()); - const auto pFormat = rFormats[0]; + const SwFrameFormat* pFormat = rFormats[0]; CPPUNIT_ASSERT(pFormat); // Without the accompanying fix in place, this test would have failed: auto-contour was enabled diff --git a/sw/qa/filter/html/html.cxx b/sw/qa/filter/html/html.cxx index 523bc49a4358..6cd714bbdd48 100644 --- a/sw/qa/filter/html/html.cxx +++ b/sw/qa/filter/html/html.cxx @@ -65,8 +65,8 @@ CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspect) // Then make sure that the aspect ratio of the image is kept: auto pTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDocument->GetDocShell()->GetDoc(); - const auto& rFormats = *pDoc->GetSpzFrameFormats(); - const auto pFormat = rFormats[0]; + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormat* pFormat = rFormats[0]; const SwFormatFrameSize& rSize = pFormat->GetFrameSize(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 255 @@ -86,8 +86,8 @@ CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspectImage) // Then make sure that the aspect ratio of the image is kept: auto pTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDocument->GetDocShell()->GetDoc(); - const auto& rFormats = *pDoc->GetSpzFrameFormats(); - const auto pFormat = rFormats[0]; + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormat* pFormat = rFormats[0]; const SwFormatFrameSize& rSize = pFormat->GetFrameSize(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 255 diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx index b732a37eff40..a83bd12431df 100644 --- a/sw/qa/filter/ww8/ww8.cxx +++ b/sw/qa/filter/ww8/ww8.cxx @@ -214,8 +214,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxFloatingTableExport) pWrtShell->StartAllAction(); aMgr.InsertFlyFrame(RndStdIds::FLY_AT_PARA, aMgr.GetPos(), aMgr.GetSize()); // Mark it as a floating table: - auto& rFlys = *pDoc->GetSpzFrameFormats(); - auto pFly = rFlys[0]; + SwFrameFormats& rFlys = *pDoc->GetSpzFrameFormats(); + SwFrameFormat* pFly = rFlys[0]; SwAttrSet aSet(pFly->GetAttrSet()); aSet.Put(SwFormatFlySplit(true)); pDoc->SetAttr(aSet, *pFly); diff --git a/sw/qa/uibase/docvw/docvw.cxx b/sw/qa/uibase/docvw/docvw.cxx index 280a0459109e..677a5abd2a54 100644 --- a/sw/qa/uibase/docvw/docvw.cxx +++ b/sw/qa/uibase/docvw/docvw.cxx @@ -48,7 +48,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShiftClickOnImage) pWrtShell->SttEndDoc(/*bStt=*/false); // When shift-clicking on that fly frame: - auto& rSpzFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rSpzFormats = *pDoc->GetSpzFrameFormats(); auto pFrameFormat = dynamic_cast<SwFlyFrameFormat*>(rSpzFormats[0]); CPPUNIT_ASSERT(pFrameFormat); SwFlyFrame* pFlyFrame = pFrameFormat->GetFrame(); @@ -163,7 +163,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShiftDoubleClickOnImage) xRegistration->registerDispatchProviderInterceptor(pInterceptor); // When shift-double-clicking on that fly frame: - auto& rSpzFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rSpzFormats = *pDoc->GetSpzFrameFormats(); auto pFrameFormat = dynamic_cast<SwFlyFrameFormat*>(rSpzFormats[0]); CPPUNIT_ASSERT(pFrameFormat); SwFlyFrame* pFlyFrame = pFrameFormat->GetFrame(); diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx index 6ad35e07466a..b9f03d42d5ee 100644 --- a/sw/qa/uibase/uno/uno.cxx +++ b/sw/qa/uibase/uno/uno.cxx @@ -149,8 +149,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPositionGraphic) = xController->createTextRangeByPixelPosition(aPoint); // Then make sure that the anchor of the image is returned: - const auto& rFormats = *pDoc->GetSpzFrameFormats(); - const auto pFormat = rFormats[0]; + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); + const SwFrameFormat* pFormat = rFormats[0]; SwPosition aAnchorPos(*pFormat->GetAnchor().GetContentAnchor()); auto pTextRange = dynamic_cast<SwXTextRange*>(xTextRange.get()); SwPaM aPaM(pDoc->GetNodes()); diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 7a1b94af15ef..c5c0c741f5dd 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -2746,9 +2746,10 @@ bool SwCursorShell::SelectNxtPrvHyperlink( bool bNext ) // then check all the Flys with a URL or image map { - for(sw::SpzFrameFormat* pSpz: *GetDoc()->GetSpzFrameFormats()) + const SwFrameFormats* pFormats = GetDoc()->GetSpzFrameFormats(); + for( SwFrameFormats::size_type n = 0, nEnd = pFormats->size(); n < nEnd; ++n ) { - auto pFormat = static_cast<SwFlyFrameFormat*>(pSpz); + SwFlyFrameFormat* pFormat = static_cast<SwFlyFrameFormat*>((*pFormats)[ n ]); const SwFormatURL& rURLItem = pFormat->GetURL(); if( rURLItem.GetMap() || !rURLItem.GetURL().isEmpty() ) { diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index d87e0c2f2374..dd71aba69cc9 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -370,12 +370,12 @@ void ContentIdxStoreImpl::SaveFlys(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nC void ContentIdxStoreImpl::RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, bool bAuto, bool bAtStart) { - sw::SpzFrameFormats* pSpz = rDoc.GetSpzFrameFormats(); + SwFrameFormats* pSpz = rDoc.GetSpzFrameFormats(); for (const MarkEntry& aEntry : m_aFlyEntries) { if(!aEntry.m_bOther) { - sw::SpzFrameFormat* pFrameFormat = (*pSpz)[ aEntry.m_nIdx ]; + SwFrameFormat *pFrameFormat = (*pSpz)[ aEntry.m_nIdx ]; const SwFormatAnchor& rFlyAnchor = pFrameFormat->GetAnchor(); if( rFlyAnchor.GetContentAnchor() ) { diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 3a158e26a9a1..3d86d7ffec8f 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -101,9 +101,11 @@ namespace bool lcl_ChkFlyFly( SwDoc& rDoc, SwNodeOffset nSttNd, SwNodeOffset nEndNd, SwNodeOffset nInsNd ) { + const SwFrameFormats& rFrameFormatTable = *rDoc.GetSpzFrameFormats(); - for(sw::SpzFrameFormat* pFormat: *rDoc.GetSpzFrameFormats()) + for( size_t n = 0; n < rFrameFormatTable.size(); ++n ) { + SwFrameFormat const*const pFormat = rFrameFormatTable[n]; SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); if (pAnchorNode && @@ -2308,7 +2310,7 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) // If there are FlyFrames left, delete these too for( size_t n = 0; n < m_rDoc.GetSpzFrameFormats()->size(); ++n ) { - sw::SpzFrameFormat* pFly = (*m_rDoc.GetSpzFrameFormats())[n]; + SwFrameFormat* pFly = (*m_rDoc.GetSpzFrameFormats())[n]; const SwFormatAnchor* pAnchor = &pFly->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); if (pAnchorNode && diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index 6959b7c7ba3a..e0366bdd3a0b 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -248,19 +248,20 @@ void DocumentLayoutManager::DelLayoutFormat( SwFrameFormat *pFormat ) pContentIdx = pFormat->GetContent().GetContentIdx(); if (pContentIdx) { - sw::SpzFrameFormats* pSpzs = pFormat->GetDoc()->GetSpzFrameFormats(); - if ( pSpzs ) + const SwFrameFormats* pTable = pFormat->GetDoc()->GetSpzFrameFormats(); + if ( pTable ) { std::vector<SwFrameFormat*> aToDeleteFrameFormats; const SwNodeOffset nNodeIdxOfFlyFormat( pContentIdx->GetIndex() ); - for(sw::SpzFrameFormat* pSpz: *pSpzs) + for ( size_t i = 0; i < pTable->size(); ++i ) { - const SwFormatAnchor &rAnch = pSpz->GetAnchor(); + SwFrameFormat* pTmpFormat = (*pTable)[i]; + const SwFormatAnchor &rAnch = pTmpFormat->GetAnchor(); if ( rAnch.GetAnchorId() == RndStdIds::FLY_AT_FLY && rAnch.GetAnchorNode()->GetIndex() == nNodeIdxOfFlyFormat ) { - aToDeleteFrameFormats.push_back(pSpz); + aToDeleteFrameFormats.push_back( pTmpFormat ); } } diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 1c8e5327d4aa..8b1f18348796 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -407,14 +407,15 @@ static OUString lcl_AnchoredFrames(const SwNode & rNode) OUStringBuffer aResult("["); const SwDoc& rDoc = rNode.GetDoc(); - const sw::SpzFrameFormats* pSpzs = rDoc.GetSpzFrameFormats(); + const SwFrameFormats * pFrameFormats = rDoc.GetSpzFrameFormats(); - if (pSpzs) + if (pFrameFormats) { bool bFirst = true; - for(const sw::SpzFrameFormat* pSpz: *pSpzs) + for (SwFrameFormats::const_iterator i(pFrameFormats->begin()); + i != pFrameFormats->end(); ++i) { - const SwFormatAnchor& rAnchor = pSpz->GetAnchor(); + const SwFormatAnchor & rAnchor = (*i)->GetAnchor(); const SwNode * pPos = rAnchor.GetAnchorNode(); if (pPos && *pPos == rNode) @@ -422,8 +423,8 @@ static OUString lcl_AnchoredFrames(const SwNode & rNode) if (! bFirst) aResult.append(", "); - if (pSpz) - aResult.append(lcl_dbg_out(*pSpz)); + if (*i) + aResult.append(lcl_dbg_out(**i)); bFirst = false; } } diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx index c28a15f12bf5..6bf54c6b6e5a 100644 --- a/sw/source/core/doc/docbasic.cxx +++ b/sw/source/core/doc/docbasic.cxx @@ -157,10 +157,10 @@ sal_uInt16 SwDoc::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCall case EVENT_OBJECT_URLITEM: case EVENT_OBJECT_IMAGE: { - const auto pSpz = static_cast<const sw::SpzFrameFormat*>(rCallEvent.PTR.pFormat); + const SwFrameFormat* pFormat = rCallEvent.PTR.pFormat; if( bCheckPtr ) { - if (GetSpzFrameFormats()->IsAlive(pSpz)) + if (GetSpzFrameFormats()->IsAlive(pFormat)) bCheckPtr = false; // misuse as a flag else // this shouldn't be possible now that SwCallMouseEvent @@ -168,7 +168,7 @@ sal_uInt16 SwDoc::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCall assert(false); } if( !bCheckPtr ) - pTable = &pSpz->GetMacro().GetMacroTable(); + pTable = &pFormat->GetMacro().GetMacroTable(); } break; @@ -177,10 +177,10 @@ sal_uInt16 SwDoc::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCall const IMapObject* pIMapObj = rCallEvent.PTR.IMAP.pIMapObj; if( bCheckPtr ) { - const auto pSpz = static_cast<const sw::SpzFrameFormat*>(rCallEvent.PTR.IMAP.pFormat); - if (GetSpzFrameFormats()->IsAlive(pSpz)) + const SwFrameFormat* pFormat = rCallEvent.PTR.IMAP.pFormat; + if (GetSpzFrameFormats()->IsAlive(pFormat)) { - const ImageMap* pIMap = pSpz->GetURL().GetMap(); + const ImageMap* pIMap = pFormat->GetURL().GetMap(); if (pIMap) { for( size_t nPos = pIMap->GetIMapObjectCount(); nPos; ) diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 2941112bc5d8..1779ec998300 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1795,14 +1795,14 @@ namespace std::make_shared<CompareMainText>(rDestDoc, true)); //if we have the same number of frames then try to compare within them - const sw::SpzFrameFormats* pSrcFrameFormats = rSrcDoc.GetSpzFrameFormats(); - const sw::SpzFrameFormats* pDestFrameFormats = rDestDoc.GetSpzFrameFormats(); + const SwFrameFormats *pSrcFrameFormats = rSrcDoc.GetSpzFrameFormats(); + const SwFrameFormats *pDestFrameFormats = rDestDoc.GetSpzFrameFormats(); if (pSrcFrameFormats->size() == pDestFrameFormats->size()) { - for(sw::FrameFormats<sw::SpzFrameFormat*>::size_type i = 0; i < pSrcFrameFormats->size(); ++i) + for (size_t i = 0; i < pSrcFrameFormats->size(); ++i) { - const sw::SpzFrameFormat& rSrcFormat = *(*pSrcFrameFormats)[i]; - const sw::SpzFrameFormat& rDestFormat = *(*pDestFrameFormats)[i]; + const SwFrameFormat& rSrcFormat = *(*pSrcFrameFormats)[i]; + const SwFrameFormat& rDestFormat = *(*pDestFrameFormats)[i]; const SwNodeIndex* pSrcIdx = rSrcFormat.GetContent().GetContentIdx(); const SwNodeIndex* pDestIdx = rDestFormat.GetContent().GetContentIdx(); if (!pSrcIdx && !pDestIdx) diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 3994f2af8aac..a93000b679fc 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -93,7 +93,7 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos, } aAnchor.SetAnchor( &aPos ); - pFormat->GetDoc()->GetSpzFrameFormats()->push_back(static_cast<sw::SpzFrameFormat*>(pFormat)); + pFormat->GetDoc()->GetSpzFrameFormats()->push_back( pFormat ); // SetFormatAttr should call Modify() and add it to the node pFormat->SetFormatAttr( aAnchor ); SwContentNode* pCNd = aPos.GetNode().GetContentNode(); @@ -105,11 +105,11 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos, void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr ) { - sw::SpzFrameFormats& rSpzs = *rRg.aStart.GetNode().GetDoc().GetSpzFrameFormats(); - for(sw::FrameFormats<sw::SpzFrameFormat*>::size_type n = 0; n < rSpzs.size(); ++n ) + SwFrameFormats& rFormats = *rRg.aStart.GetNode().GetDoc().GetSpzFrameFormats(); + for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n ) { - auto pSpz = rSpzs[n]; - SwFormatAnchor const*const pAnchor = &pSpz->GetAnchor(); + SwFrameFormat *const pFormat = rFormats[n]; + SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); if (pAnchorNode && ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) || @@ -120,14 +120,14 @@ void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr ) (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId()) ? pAnchor->GetAnchorContentOffset() : 0, - pSpz, false ); + pFormat, false ); rArr.push_back( aSave ); - pSpz->DelFrames(); + pFormat->DelFrames(); // set a dummy anchor position to maintain anchoring invariants - SwFormatAnchor aAnchor( pSpz->GetAnchor() ); + SwFormatAnchor aAnchor( pFormat->GetAnchor() ); aAnchor.SetAnchor(nullptr); - pSpz->SetFormatAttr(aAnchor); - rSpzs.erase( rSpzs.begin() + n-- ); + pFormat->SetFormatAttr(aAnchor); + rFormats.erase( rFormats.begin() + n-- ); } } sw::CheckAnchoredFlyConsistency(rRg.aStart.GetNode().GetDoc()); @@ -136,8 +136,8 @@ void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr ) void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos, SaveFlyArr& rArr, bool bMoveAllFlys, SwHistory *const pHistory) { - sw::SpzFrameFormats& rFormats = *rPam.GetPoint()->GetNode().GetDoc().GetSpzFrameFormats(); - sw::SpzFrameFormat* pFormat; + SwFrameFormats& rFormats = *rPam.GetPoint()->GetNode().GetDoc().GetSpzFrameFormats(); + SwFrameFormat* pFormat; const SwFormatAnchor* pAnchor; const SwPosition* pPos = rPam.Start(); @@ -220,10 +220,10 @@ void DelFlyInRange( SwNode& rMkNd, SwPosition const& rEnd = mark <= point ? point : mark; SwDoc& rDoc = rMkNd.GetDoc(); - sw::SpzFrameFormats& rTable = *rDoc.GetSpzFrameFormats(); + SwFrameFormats& rTable = *rDoc.GetSpzFrameFormats(); for ( auto i = rTable.size(); i; ) { - sw::SpzFrameFormat* pFormat = rTable[--i]; + SwFrameFormat *pFormat = rTable[--i]; const SwFormatAnchor &rAnch = pFormat->GetAnchor(); SwPosition const*const pAPos = rAnch.GetContentAnchor(); if (pAPos && @@ -248,7 +248,7 @@ void DelFlyInRange( SwNode& rMkNd, if (i > rTable.size()) i = rTable.size(); else if (i == rTable.size() || pFormat != rTable[i]) - i = std::distance(rTable.begin(), rTable.find(pFormat)); + i = std::distance(rTable.begin(), rTable.find( pFormat )); } rDoc.getIDocumentLayoutAccess().DelLayoutFormat( pFormat ); diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 1d425e62f73d..998f123ee6c0 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -67,11 +67,15 @@ using namespace ::com::sun::star; size_t SwDoc::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const { + const SwFrameFormats& rFormats = *GetSpzFrameFormats(); + const size_t nSize = rFormats.size(); size_t nCount = 0; const SwNodeIndex* pIdx; - for(sw::SpzFrameFormat* pFlyFormat: *GetSpzFrameFormats()) + for ( size_t i = 0; i < nSize; ++i) { + const SwFrameFormat* pFlyFormat = rFormats[ i ]; + if (bIgnoreTextBoxes && SwTextBoxHelper::isTextBox(pFlyFormat, RES_FLYFRMFMT)) continue; @@ -110,12 +114,16 @@ size_t SwDoc::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const /// @attention If you change this, also update SwXFrameEnumeration in unocoll. SwFrameFormat* SwDoc::GetFlyNum( size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes ) { + SwFrameFormats& rFormats = *GetSpzFrameFormats(); SwFrameFormat* pRetFormat = nullptr; + const size_t nSize = rFormats.size(); const SwNodeIndex* pIdx; size_t nCount = 0; - for(sw::SpzFrameFormat* pFlyFormat: *GetSpzFrameFormats()) + for( size_t i = 0; !pRetFormat && i < nSize; ++i ) { + SwFrameFormat* pFlyFormat = rFormats[ i ]; + if (bIgnoreTextBoxes && SwTextBoxHelper::isTextBox(pFlyFormat, RES_FLYFRMFMT)) continue; @@ -151,11 +159,16 @@ SwFrameFormat* SwDoc::GetFlyNum( size_t nIdx, FlyCntType eType, bool bIgnoreText std::vector<SwFrameFormat const*> SwDoc::GetFlyFrameFormats( FlyCntType const eType, bool const bIgnoreTextBoxes) { + SwFrameFormats& rFormats = *GetSpzFrameFormats(); + const size_t nSize = rFormats.size(); + std::vector<SwFrameFormat const*> ret; - ret.reserve(GetSpzFrameFormats()->size()); + ret.reserve(nSize); - for(sw::SpzFrameFormat* pFlyFormat: *GetSpzFrameFormats()) + for (size_t i = 0; i < nSize; ++i) { + SwFrameFormat const*const pFlyFormat = rFormats[ i ]; + if (bIgnoreTextBoxes && SwTextBoxHelper::isTextBox(pFlyFormat, RES_FLYFRMFMT)) { continue; @@ -1012,7 +1025,7 @@ SwChainRet SwDoc::Chainable( const SwFrameFormat &rSource, const SwFrameFormat & return SwChainRet::NOT_EMPTY; } - for(sw::SpzFrameFormat* pSpzFrameFm: *GetSpzFrameFormats()) + for( auto pSpzFrameFm : *GetSpzFrameFormats() ) { const SwFormatAnchor& rAnchor = pSpzFrameFm->GetAnchor(); // #i20622# - to-frame anchored objects are allowed. diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index a0111f537469..aa737661d6dc 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -723,14 +723,13 @@ void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast ) } else { - auto pSpz = static_cast<sw::SpzFrameFormat*>(pFormat); - if(GetSpzFrameFormats()->ContainsFormat(pSpz)) + bool contains = GetSpzFrameFormats()->ContainsFormat(*pFormat); + OSL_ENSURE( contains, "FrameFormat not found." ); + if( contains ) { - GetSpzFrameFormats()->erase(pSpz); - delete pSpz; + GetSpzFrameFormats()->erase( pFormat ); + delete pFormat; } - else - SAL_WARN("sw", "FrameFormat not found."); } } } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index c56eae683a9c..94229dbc968f 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -501,7 +501,7 @@ SwPosFlyFrames SwDoc::GetAllFlyFormats( const SwPaM* pCmpRange, bool bDrawAlso, SwPosFlyFrames aRetval; // collect all anchored somehow to paragraphs - for(sw::SpzFrameFormat* pFly: *GetSpzFrameFormats()) + for( auto pFly : *GetSpzFrameFormats() ) { bool bDrawFormat = bDrawAlso && RES_DRAWFRMFMT == pFly->Which(); bool bFlyFormat = RES_FLYFRMFMT == pFly->Which(); @@ -1350,11 +1350,14 @@ static OUString lcl_GetUniqueFlyName(const SwDoc& rDoc, TranslateId pDefStrId, s OUString aName(SwResId(pDefStrId)); sal_Int32 nNmLen = aName.getLength(); + const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats(); + std::vector<unsigned int> aUsedNums; - aUsedNums.reserve(rDoc.GetSpzFrameFormats()->size()); + aUsedNums.reserve(rFormats.size()); - for(sw::SpzFrameFormat* pFlyFormat: *rDoc.GetSpzFrameFormats()) + for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n ) { + const SwFrameFormat* pFlyFormat = rFormats[ n ]; if (eType != pFlyFormat->Which()) continue; if (eType == RES_DRAWFRMFMT) @@ -1574,7 +1577,7 @@ bool SwDoc::IsInHeaderFooter( const SwNode& rIdx ) const // get up by using the Anchor #if OSL_DEBUG_LEVEL > 0 std::vector<const SwFrameFormat*> checkFormats; - for(sw::SpzFrameFormat* pFormat: *GetSpzFrameFormats()) + for( auto pFormat : *GetSpzFrameFormats() ) { const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx(); if( pIdx && pFlyNd == &pIdx->GetNode() ) diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index bfc8c71dfe48..5884616e9ee9 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -234,7 +234,7 @@ SwDoc::SwDoc() mpDfltGrfFormatColl( new SwGrfFormatColl( GetAttrPool(), "Graphikformatvorlage" ) ), mpFrameFormatTable( new SwFrameFormats() ), mpCharFormatTable( new SwCharFormats ), - mpSpzFrameFormatTable( new sw::FrameFormats<sw::SpzFrameFormat*>() ), + mpSpzFrameFormatTable( new SwFrameFormats() ), mpSectionFormatTable( new SwSectionFormats ), mpTableFrameFormatTable( new sw::TableFrameFormats() ), mpTextFormatCollTable( new SwTextFormatColls() ), @@ -1291,7 +1291,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu } // finally copy page bound frames - for(sw::SpzFrameFormat* pCpyFormat: *rSource.GetSpzFrameFormats()) + for ( auto pCpyFormat : *rSource.GetSpzFrameFormats() ) { const SwFrameFormat& rCpyFormat = *pCpyFormat; SwFormatAnchor aAnchor( rCpyFormat.GetAnchor() ); diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index d22ab372e323..3601c119bbb3 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -286,7 +286,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) auto [pStart, pEnd] = rPaM.StartEnd(); // SwPosition* // Set index to the Selection's start - for(sw::SpzFrameFormat* pFormat: *GetSpzFrameFormats()) + for ( const auto *pFormat : *GetSpzFrameFormats() ) { SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 0b11ea6c80d2..c39d9c387a3c 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -540,7 +540,7 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, } // If we still have FlyFrames hanging around, delete them too - for(sw::SpzFrameFormat* pFly: *pDoc->GetSpzFrameFormats()) + for( const auto pFly : *pDoc->GetSpzFrameFormats() ) { SwFormatAnchor const*const pAnchor = &pFly->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index e87a28ba4cfd..98fc0512acfd 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -349,7 +349,8 @@ sal_Int32 SwTextBoxHelper::getCount(SdrPage const* pPage) sal_Int32 SwTextBoxHelper::getCount(const SwDoc& rDoc) { sal_Int32 nRet = 0; - for (const sw::SpzFrameFormat* pFormat : *rDoc.GetSpzFrameFormats()) + const SwFrameFormats& rSpzFrameFormats = *rDoc.GetSpzFrameFormats(); + for (const auto pFormat : rSpzFrameFormats) { if (isTextBox(pFormat, RES_FLYFRMFMT)) ++nRet; @@ -959,7 +960,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u xPropertySet->setPropertyValue(aPropertyName, aValue); } -void SwTextBoxHelper::saveLinks(const sw::FrameFormats<sw::SpzFrameFormat*>& rFormats, +void SwTextBoxHelper::saveLinks(const SwFrameFormats& rFormats, std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks) { for (const auto pFormat : rFormats) diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 8e055c5242bc..b9ae26a0e421 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1662,7 +1662,8 @@ bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, // #i28006# Fly frames have to be restored even if the table was // #alone in the section - for(sw::SpzFrameFormat* pFly: *GetDoc().GetSpzFrameFormats()) + const SwFrameFormats& rFlyArr = *GetDoc().GetSpzFrameFormats(); + for( auto pFly : rFlyArr ) { SwFrameFormat *const pFormat = pFly; const SwFormatAnchor& rAnchor = pFormat->GetAnchor(); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index b69dec062a1f..91ac1697ea30 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -547,15 +547,16 @@ const SwPageDesc* SwNode::FindPageDesc( SwNodeOffset* pPgDescNdIdx ) const { // Find the right Anchor first const SwFrameFormat* pFormat = nullptr; - const sw::SpzFrameFormats& rFormats = *rDoc.GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats(); - for(sw::SpzFrameFormat* pSpz: rFormats) + for( size_t n = 0; n < rFormats.size(); ++n ) { - const SwFormatContent& rContent = pSpz->GetContent(); + const SwFrameFormat* pFrameFormat = rFormats[ n ]; + const SwFormatContent& rContent = pFrameFormat->GetContent(); if( rContent.GetContentIdx() && &rContent.GetContentIdx()->GetNode() == static_cast<SwNode const *>(pSttNd) ) { - pFormat = pSpz; + pFormat = pFrameFormat; break; } } @@ -750,17 +751,18 @@ SwFrameFormat* SwNode::GetFlyFormat() const if( !pRet ) { // The hard way through the Doc is our last way out - const sw::SpzFrameFormats& rSpzs = *GetDoc().GetSpzFrameFormats(); - for(sw::SpzFrameFormat* pSpz: rSpzs) + const SwFrameFormats& rFrameFormatTable = *GetDoc().GetSpzFrameFormats(); + for( size_t n = 0; n < rFrameFormatTable.size(); ++n ) { + SwFrameFormat* pFormat = rFrameFormatTable[n]; // Only Writer fly frames can contain Writer nodes. - if (pSpz->Which() != RES_FLYFRMFMT) + if (pFormat->Which() != RES_FLYFRMFMT) continue; - const SwFormatContent& rContent = pSpz->GetContent(); + const SwFormatContent& rContent = pFormat->GetContent(); if( rContent.GetContentIdx() && &rContent.GetContentIdx()->GetNode() == pSttNd ) { - pRet = pSpz; + pRet = pFormat; break; } } diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 5432119d8591..8675f62e72c9 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -751,10 +751,10 @@ SwDrawContact::~SwDrawContact() void SwDrawContact::GetTextObjectsFromFormat(std::list<SdrTextObj*>& o_rTextObjects, SwDoc& rDoc) { - for(sw::SpzFrameFormat* pFly: *rDoc.GetSpzFrameFormats()) + for(auto& rpFly : *rDoc.GetSpzFrameFormats()) { - if(dynamic_cast<const SwDrawFrameFormat*>(pFly)) - pFly->CallSwClientNotify(sw::CollectTextObjectsHint(o_rTextObjects)); + if(dynamic_cast<const SwDrawFrameFormat*>(rpFly)) + rpFly->CallSwClientNotify(sw::CollectTextObjectsHint(o_rTextObjects)); } } @@ -1877,7 +1877,8 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) else { const SwNode& rIdx = *pAnch->GetAnchorNode(); - for(sw::SpzFrameFormat* pFlyFormat :*(pDrawFrameFormat->GetDoc()->GetSpzFrameFormats())) + SwFrameFormats& rFormats = *(pDrawFrameFormat->GetDoc()->GetSpzFrameFormats()); + for( auto pFlyFormat : rFormats ) { if( pFlyFormat->GetContent().GetContentIdx() && rIdx == pFlyFormat->GetContent().GetContentIdx()->GetNode() ) diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index d5c03a14f1e0..11a3d945d447 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -93,7 +93,7 @@ void SwFEShell::Copy( SwDoc& rClpDoc, const OUString* pNewClpText ) } // also delete surrounding FlyFrames if any - for(sw::SpzFrameFormat* pFly : *rClpDoc.GetSpzFrameFormats() ) + for( const auto pFly : *rClpDoc.GetSpzFrameFormats() ) { SwFormatAnchor const*const pAnchor = &pFly->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); @@ -144,13 +144,13 @@ void SwFEShell::Copy( SwDoc& rClpDoc, const OUString* pNewClpText ) // assure the "RootFormat" is the first element in Spz-Array // (if necessary Flys were copied in Flys) - sw::SpzFrameFormats& rSpzFrameFormats = *rClpDoc.GetSpzFrameFormats(); + SwFrameFormats& rSpzFrameFormats = *rClpDoc.GetSpzFrameFormats(); if( rSpzFrameFormats[ 0 ] != pFlyFormat ) { #ifndef NDEBUG bool inserted = #endif - rSpzFrameFormats.newDefault(static_cast<sw::SpzFrameFormat*>(pFlyFormat)); + rSpzFrameFormats.newDefault( pFlyFormat ); assert( !inserted && "Fly not contained in Spz-Array" ); } @@ -688,7 +688,7 @@ namespace { return false; } - for(const sw::SpzFrameFormat* pSpzFormat: *pFormat->GetDoc()->GetSpzFrameFormats()) + for ( const auto& pSpzFormat : *pFormat->GetDoc()->GetSpzFrameFormats() ) { if (pSpzFormat->Which() != RES_FLYFRMFMT) { @@ -1043,7 +1043,7 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) if(!Imp()->GetDrawView()) MakeDrawView(); ::std::vector<SwFrameFormat*> inserted; - for (sw::SpzFrameFormat* pFlyFormat: *rClpDoc.GetSpzFrameFormats()) + for (auto const pFlyFormat : *rClpDoc.GetSpzFrameFormats()) { // if anchored inside other fly, will be copied when copying // top-level fly, so skip here! (other non-body anchor @@ -1203,7 +1203,7 @@ void SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1 if( !rToFill.Imp()->GetDrawView() ) rToFill.MakeDrawView(); - for(sw::SpzFrameFormat* pCpyFormat: *GetDoc()->GetSpzFrameFormats()) + for ( auto pCpyFormat : *GetDoc()->GetSpzFrameFormats() ) { SwFormatAnchor aAnchor( pCpyFormat->GetAnchor() ); if ((RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId()) && diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 92f41ef0597e..3e1bb21df9f8 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1004,7 +1004,7 @@ void SwFEShell::GetPageObjs( std::vector<SwFrameFormat*>& rFillArr ) { rFillArr.clear(); - for(sw::SpzFrameFormat* pFormat : *mxDoc->GetSpzFrameFormats() ) + for( auto pFormat : *mxDoc->GetSpzFrameFormats() ) { if (RndStdIds::FLY_AT_PAGE == pFormat->GetAnchor().GetAnchorId()) { @@ -1026,7 +1026,7 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr ) bool bTmpAssert = false; for( auto pFormat : rFillArr ) { - if (mxDoc->GetSpzFrameFormats()->IsAlive(static_cast<sw::SpzFrameFormat*>(pFormat))) + if (mxDoc->GetSpzFrameFormats()->IsAlive(pFormat)) { // FlyFormat is still valid, therefore process @@ -1443,7 +1443,7 @@ SwFrameFormat* SwFEShell::WizardGetFly() { // do not search the Fly via the layout. Now we can delete a frame // without a valid layout. ( e.g. for the wizards ) - sw::SpzFrameFormats& rSpzArr = *mxDoc->GetSpzFrameFormats(); + SwFrameFormats& rSpzArr = *mxDoc->GetSpzFrameFormats(); if( !rSpzArr.empty() ) { SwNode& rCursorNd = GetCursor()->GetPoint()->GetNode(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 48a92366509c..01022e60a7d9 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -901,7 +901,7 @@ bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam ) if( bRet ) { // now check for paragraph bound flies - const sw::SpzFrameFormats& rFormats = *rPam.GetDoc().GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *rPam.GetDoc().GetSpzFrameFormats(); SwNodeOffset nSttIdx = rPam.GetPoint()->GetNodeIndex(), nEndIdx = rBox.GetSttNd()->EndOfSectionIndex(), nIdx; diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 3c8966f3147b..ca3c787e3954 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -21,7 +21,6 @@ #define INCLUDED_SW_SOURCE_CORE_INC_FRMTOOL_HXX #include <swtypes.hxx> -#include <frameformats.hxx> #include <BorderCacheOwner.hxx> #include "frame.hxx" #include "txtfrm.hxx" @@ -57,9 +56,10 @@ constexpr tools::Long BROWSE_HEIGHT = 56700 * 10; // 10 Meters #define GRFNUM_YES 1 #define GRFNUM_REPLACE 2 -void AppendObjs(const sw::FrameFormats<sw::SpzFrameFormat*>* pSpz, SwNodeOffset nIndex, SwFrame* pFrame, SwPageFrame* pPage, SwDoc* doc); +void AppendObjs( const SwFrameFormats *pTable, SwNodeOffset nIndex, + SwFrame *pFrame, SwPageFrame *pPage, SwDoc* doc ); -void AppendObjsOfNode(sw::FrameFormats<sw::SpzFrameFormat*> const* pTable, SwNodeOffset nIndex, +void AppendObjsOfNode(SwFrameFormats const* pTable, SwNodeOffset nIndex, SwFrame * pFrame, SwPageFrame * pPage, SwDoc * pDoc, std::vector<sw::Extent>::const_iterator const* pIter, std::vector<sw::Extent>::const_iterator const* pEnd, @@ -72,7 +72,7 @@ void RemoveHiddenObjsOfNode(SwTextNode const& rNode, bool IsAnchoredObjShown(SwTextFrame const& rFrame, SwFormatAnchor const& rAnchor); -void AppendAllObjs(const sw::FrameFormats<sw::SpzFrameFormat*>* pSpzs, const SwFrame* pSib); +void AppendAllObjs(const SwFrameFormats* pTable, const SwFrame* pSib); // draw background with brush or graphics // The 6th parameter indicates that the method should consider background diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index b81a2fab65a9..b0f07c59f62b 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2835,12 +2835,15 @@ bool SwFrameFormat::IsLowerOf( const SwFrameFormat& rFormat ) const const SwFormatAnchor* pAnchor = &rFormat.GetAnchor(); if ((RndStdIds::FLY_AT_PAGE != pAnchor->GetAnchorId()) && pAnchor->GetAnchorNode()) { + const SwFrameFormats& rFormats = *GetDoc()->GetSpzFrameFormats(); const SwNode* pFlyNd = pAnchor->GetAnchorNode()->FindFlyStartNode(); while( pFlyNd ) { // then we walk up using the anchor - for(const sw::SpzFrameFormat* pFormat: *GetDoc()->GetSpzFrameFormats()) + size_t n; + for( n = 0; n < rFormats.size(); ++n ) { + const SwFrameFormat* pFormat = rFormats[ n ]; const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx(); if( pIdx && pFlyNd == &pIdx->GetNode() ) { @@ -2858,6 +2861,11 @@ bool SwFrameFormat::IsLowerOf( const SwFrameFormat& rFormat ) const break; } } + if( n >= rFormats.size() ) + { + OSL_ENSURE( false, "Fly section but no format found" ); + return false; + } } } return false; @@ -2931,8 +2939,8 @@ void SwFrameFormats::dumpAsXml(xmlTextWriterPtr pWriter, const char* pName) cons } -SwFlyFrameFormat::SwFlyFrameFormat(SwAttrPool& rPool, const OUString &rFormatName, SwFrameFormat* pDerivedFrame) - : sw::SpzFrameFormat(rPool, rFormatName, pDerivedFrame, RES_FLYFRMFMT) +SwFlyFrameFormat::SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, SwFrameFormat *pDrvdFrame ) + : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FLYFRMFMT ) {} SwFlyFrameFormat::~SwFlyFrameFormat() @@ -3006,8 +3014,10 @@ void SwFlyFrameFormat::MakeFrames() if ( pModify == nullptr ) { const SwNode & rNd = *aAnchorAttr.GetAnchorNode(); - for(sw::SpzFrameFormat* pFlyFormat: *GetDoc()->GetSpzFrameFormats()) + SwFrameFormats& rFormats = *GetDoc()->GetSpzFrameFormats(); + for( size_t i = 0; i < rFormats.size(); ++i ) { + SwFrameFormat* pFlyFormat = rFormats[i]; if( pFlyFormat->GetContent().GetContentIdx() && rNd == pFlyFormat->GetContent().GetContentIdx()->GetNode() ) { @@ -3670,24 +3680,25 @@ void CheckAnchoredFlyConsistency(SwDoc const& rDoc) assert(rAnchor.GetAnchorNode() == pNode); } } - if(!rDoc.GetSpzFrameFormats()) + SwFrameFormats const*const pSpzFrameFormats(rDoc.GetSpzFrameFormats()); + if (!pSpzFrameFormats) return; - for(sw::SpzFrameFormat* pSpz: *rDoc.GetSpzFrameFormats()) + for (auto it = pSpzFrameFormats->begin(); it != pSpzFrameFormats->end(); ++it) { - SwFormatAnchor const& rAnchor(pSpz->GetAnchor(false)); + SwFormatAnchor const& rAnchor((**it).GetAnchor(false)); if (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId()) { assert(!rAnchor.GetAnchorNode() // for invalid documents that lack text:anchor-page-number // it may have an anchor before MakeFrames() is called - || (!SwIterator<SwFrame, SwFrameFormat>(*pSpz).First())); + || (!SwIterator<SwFrame, SwFrameFormat>(**it).First())); } else { SwNode & rNode(*rAnchor.GetAnchorNode()); std::vector<SwFrameFormat*> const& rFlys(rNode.GetAnchoredFlys()); - assert(std::find(rFlys.begin(), rFlys.end(), pSpz) != rFlys.end()); + assert(std::find(rFlys.begin(), rFlys.end(), *it) != rFlys.end()); switch (rAnchor.GetAnchorId()) { case RndStdIds::FLY_AT_FLY: diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 193478da450e..057ce8adad9e 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -953,8 +953,11 @@ void SwContentNotify::ImplDestroy() // the page is known. Thus, this data can be corrected now. const SwPageFrame *pPage = nullptr; - for(sw::SpzFrameFormat* pFormat: *rDoc.GetSpzFrameFormats()) + SwFrameFormats *pTable = rDoc.GetSpzFrameFormats(); + + for ( size_t i = 0; i < pTable->size(); ++i ) { + SwFrameFormat *pFormat = (*pTable)[i]; const SwFormatAnchor &rAnch = pFormat->GetAnchor(); if ( RndStdIds::FLY_AT_PAGE != rAnch.GetAnchorId() || rAnch.GetAnchorNode() == nullptr ) @@ -1225,7 +1228,7 @@ void RemoveHiddenObjsOfNode(SwTextNode const& rNode, } } -void AppendObjsOfNode(sw::FrameFormats<sw::SpzFrameFormat*> const*const pTable, SwNodeOffset const nIndex, +void AppendObjsOfNode(SwFrameFormats const*const pTable, SwNodeOffset const nIndex, SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc, std::vector<sw::Extent>::const_iterator const*const pIter, std::vector<sw::Extent>::const_iterator const*const pEnd, @@ -1233,8 +1236,9 @@ void AppendObjsOfNode(sw::FrameFormats<sw::SpzFrameFormat*> const*const pTable, { #if OSL_DEBUG_LEVEL > 0 std::vector<SwFrameFormat*> checkFormats; - for(auto pFormat: *pTable) + for ( size_t i = 0; i < pTable->size(); ++i ) { + SwFrameFormat *pFormat = (*pTable)[i]; const SwFormatAnchor &rAnch = pFormat->GetAnchor(); if ( rAnch.GetAnchorNode() && IsShown(nIndex, rAnch, pIter, pEnd, pFirstNode, pLastNode)) @@ -1271,7 +1275,7 @@ void AppendObjsOfNode(sw::FrameFormats<sw::SpzFrameFormat*> const*const pTable, } -void AppendObjs(const sw::FrameFormats<sw::SpzFrameFormat*> *const pTable, SwNodeOffset const nIndex, +void AppendObjs(const SwFrameFormats *const pTable, SwNodeOffset const nIndex, SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc) { if (pFrame->IsTextFrame()) @@ -1374,7 +1378,7 @@ bool IsAnchoredObjShown(SwTextFrame const& rFrame, SwFormatAnchor const& rAnchor return ret; } -void AppendAllObjs(const sw::FrameFormats<sw::SpzFrameFormat*>* pTable, const SwFrame* pSib) +void AppendAllObjs(const SwFrameFormats* pTable, const SwFrame* pSib) { //Connecting of all Objects, which are described in the SpzTable with the //layout. @@ -1510,7 +1514,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, const bool bStartPercent = bPages && !nEndIndex; SwPageFrame *pPage = pLay->FindPageFrame(); - sw::SpzFrameFormats* pTable = pDoc->GetSpzFrameFormats(); + const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats(); SwFrame *pFrame = nullptr; std::unique_ptr<SwActualSection> pActualSection; std::unique_ptr<SwLayHelper> pPageMaker; @@ -2167,7 +2171,7 @@ void MakeFrames( SwDoc *pDoc, SwNode &rSttIdx, SwNode &rEndIdx ) // depend on value of <bAllowMove> if( !isFlyCreationSuppressed ) { - const sw::SpzFrameFormats* pTable = pDoc->GetSpzFrameFormats(); + const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats(); if( !pTable->empty() ) AppendAllObjs( pTable, pUpper ); } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index da29a0654eb9..152368d9d913 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -395,13 +395,14 @@ static void lcl_FormatLay( SwLayoutFrame *pLay ) } /// Create Flys or register draw objects -static void lcl_MakeObjs(const sw::FrameFormats<sw::SpzFrameFormat*>& rSpzs, SwPageFrame* pPage) +static void lcl_MakeObjs( const SwFrameFormats &rTable, SwPageFrame *pPage ) { // formats are in the special table of the document - for(size_t i = 0; i < rSpzs.size(); ++i ) + + for ( size_t i = 0; i < rTable.size(); ++i ) { - auto pSpz = rSpzs[i]; - const SwFormatAnchor &rAnch = pSpz->GetAnchor(); + SwFrameFormat *pFormat = rTable[i]; + const SwFormatAnchor &rAnch = pFormat->GetAnchor(); if ( rAnch.GetPageNum() == pPage->GetPhyPageNum() ) { if( rAnch.GetAnchorNode() ) @@ -410,19 +411,19 @@ static void lcl_MakeObjs(const sw::FrameFormats<sw::SpzFrameFormat*>& rSpzs, SwP { SwFormatAnchor aAnch( rAnch ); aAnch.SetAnchor( nullptr ); - pSpz->SetFormatAttr( aAnch ); + pFormat->SetFormatAttr( aAnch ); } else continue; } // is it a border or a SdrObject? - bool bSdrObj = RES_DRAWFRMFMT == pSpz->Which(); + bool bSdrObj = RES_DRAWFRMFMT == pFormat->Which(); SdrObject *pSdrObj = nullptr; - if ( bSdrObj && nullptr == (pSdrObj = pSpz->FindSdrObject()) ) + if ( bSdrObj && nullptr == (pSdrObj = pFormat->FindSdrObject()) ) { OSL_FAIL( "DrawObject not found." ); - pSpz->GetDoc()->DelFrameFormat( pSpz ); + pFormat->GetDoc()->DelFrameFormat( pFormat ); --i; continue; } @@ -455,7 +456,7 @@ static void lcl_MakeObjs(const sw::FrameFormats<sw::SpzFrameFormat*>& rSpzs, SwP } else { - SwIterator<SwFlyFrame,SwFormat> aIter( *pSpz ); + SwIterator<SwFlyFrame,SwFormat> aIter( *pFormat ); SwFlyFrame *pFly = aIter.First(); if ( pFly) { @@ -463,7 +464,7 @@ static void lcl_MakeObjs(const sw::FrameFormats<sw::SpzFrameFormat*>& rSpzs, SwP pFly->AnchorFrame()->RemoveFly( pFly ); } else - pFly = new SwFlyLayFrame( static_cast<SwFlyFrameFormat*>(pSpz), pPg, pPg ); + pFly = new SwFlyLayFrame( static_cast<SwFlyFrameFormat*>(pFormat), pPg, pPg ); pPg->AppendFly( pFly ); ::RegistFlys( pPg, pFly ); } @@ -1557,17 +1558,17 @@ void SwRootFrame::AssertFlyPages() mbAssertFlyPages = false; SwDoc *pDoc = GetFormat()->GetDoc(); - const sw::SpzFrameFormats* pSpzs = pDoc->GetSpzFrameFormats(); + const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats(); // what page targets the "last" Fly? // note the needed pages in a set sal_uInt16 nMaxPg(0); o3tl::sorted_vector< sal_uInt16 > neededPages; - neededPages.reserve(pSpzs->size()); + neededPages.reserve(pTable->size()); - for(auto pSpz: *pSpzs ) + for ( size_t i = 0; i < pTable->size(); ++i ) { - const SwFormatAnchor &rAnch = pSpz->GetAnchor(); + const SwFormatAnchor &rAnch = (*pTable)[i]->GetAnchor(); if(!rAnch.GetAnchorNode()) { const sal_uInt16 nPageNum(rAnch.GetPageNum()); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 6c8fa0ea9f55..96b048b81fca 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1261,8 +1261,8 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK pHeadline->InsertBefore( pFoll, nullptr ); SwPageFrame *pPage = pHeadline->FindPageFrame(); - const sw::SpzFrameFormats* pSpzs = GetFormat()->GetDoc()->GetSpzFrameFormats(); - if( !pSpzs->empty() ) + const SwFrameFormats *pTable = GetFormat()->GetDoc()->GetSpzFrameFormats(); + if( !pTable->empty() ) { SwNodeOffset nIndex; SwContentFrame* pFrame = pHeadline->ContainsContent(); @@ -1273,7 +1273,7 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK nIndex = pFrame->IsTextFrame() ? static_cast<SwTextFrame*>(pFrame)->GetTextNodeFirst()->GetIndex() : static_cast<SwNoTextFrame*>(pFrame)->GetNode()->GetIndex(); - AppendObjs(pSpzs, nIndex, pFrame, pPage, GetFormat()->GetDoc()); + AppendObjs( pTable, nIndex, pFrame, pPage, GetFormat()->GetDoc()); pFrame = pFrame->GetNextContentFrame(); if( !pHeadline->IsAnLower( pFrame ) ) break; diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 233e973ed178..971918632752 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -4270,7 +4270,7 @@ void SwRootFrame::InvalidateAllObjPos() static void AddRemoveFlysForNode( SwTextFrame & rFrame, SwTextNode & rTextNode, std::set<SwNodeOffset> *const pSkipped, - const sw::FrameFormats<sw::SpzFrameFormat*>& rTable, + const SwFrameFormats & rTable, SwPageFrame *const pPage, SwTextNode const*const pNode, std::vector<sw::Extent>::const_iterator const& rIterFirst, @@ -4321,7 +4321,7 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode( && rTextNode.GetIndex() <= pMerged->pLastNode->GetIndex()); // add visible flys in non-first node to merged frame // (hidden flys remain and are deleted via DelFrames()) - sw::SpzFrameFormats& rTable(*rTextNode.GetDoc().GetSpzFrameFormats()); + SwFrameFormats& rTable(*rTextNode.GetDoc().GetSpzFrameFormats()); SwPageFrame *const pPage(rFrame.FindPageFrame()); std::vector<sw::Extent>::const_iterator iterFirst(pMerged->extents.begin()); std::vector<sw::Extent>::const_iterator iter(iterFirst); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 7e39716cd252..a0a1ad028f77 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1927,8 +1927,11 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // HYPERLINKS (Graphics, Frames, OLEs ) - for(sw::SpzFrameFormat* pFrameFormat: *pDoc->GetSpzFrameFormats()) + SwFrameFormats* pTable = pDoc->GetSpzFrameFormats(); + const size_t nSpzFrameFormatsCount = pTable->size(); + for( size_t n = 0; n < nSpzFrameFormatsCount; ++n ) { + SwFrameFormat* pFrameFormat = (*pTable)[n]; const SwFormatURL* pItem; if ( RES_DRAWFRMFMT != pFrameFormat->Which() && GetFrameOfModify(mrSh.GetLayout(), *pFrameFormat, SwFrameType::Fly) && diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 61fb23368fbe..f055f735a94f 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -1043,11 +1043,11 @@ void SwTextNode::GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong aNodeArgs.m_nRightDiff = 0; if( nIndex ) { - sw::SpzFrameFormats* pSpzs = const_cast<sw::SpzFrameFormats*>(GetDoc().GetSpzFrameFormats()); - if(pSpzs) + SwFrameFormats* pTmp = const_cast<SwFrameFormats*>(GetDoc().GetSpzFrameFormats()); + if( pTmp ) { aNodeArgs.m_nIndex = nIndex; - for(auto pFormat: *pSpzs) + for( SwFrameFormat *pFormat : *pTmp ) lcl_MinMaxNode(pFormat, aNodeArgs); } } diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index e32d9fdff00b..642e2ed77d62 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -935,7 +935,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool ) { ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); - if (!pDoc->GetSpzFrameFormats()->IsAlive(static_cast<SwFlyFrameFormat*>(&m_rFormat))) // Format does still exist + if (!pDoc->GetSpzFrameFormats()->IsAlive(&m_rFormat)) // Format does still exist return; SwFormatAnchor aTmp( m_rFormat.GetAnchor() ); diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index cd1b3b1d9182..d09e1ec6d210 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -54,16 +54,17 @@ ( == AUTO ), if the anchor frame has be moved via MoveNodes(..) and DelFrames(..) */ -static void lcl_MakeAutoFrames(const sw::FrameFormats<sw::SpzFrameFormat*>& rSpzs, SwNodeOffset nMovedIndex ) +static void lcl_MakeAutoFrames( const SwFrameFormats& rSpzArr, SwNodeOffset nMovedIndex ) { - for(auto pSpz: rSpzs) + for( size_t n = 0; n < rSpzArr.size(); ++n ) { - const SwFormatAnchor* pAnchor = &pSpz->GetAnchor(); + SwFrameFormat * pFormat = rSpzArr[n]; + const SwFormatAnchor* pAnchor = &pFormat->GetAnchor(); if (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR) { const SwNode* pAnchorNode = pAnchor->GetAnchorNode(); if( pAnchorNode && nMovedIndex == pAnchorNode->GetIndex() ) - pSpz->MakeFrames(); + pFormat->MakeFrames(); } } } @@ -816,20 +817,25 @@ SwRewriter SwUndoDelete::GetRewriter() const } // Every object, anchored "AtContent" will be reanchored at rPos -static void lcl_ReAnchorAtContentFlyFrames(const sw::FrameFormats<sw::SpzFrameFormat*>& rSpzs, const SwPosition &rPos, SwNodeOffset nOldIdx ) +static void lcl_ReAnchorAtContentFlyFrames( const SwFrameFormats& rSpzArr, const SwPosition &rPos, SwNodeOffset nOldIdx ) { + if( rSpzArr.empty() ) + return; + + SwFrameFormat* pFormat; const SwFormatAnchor* pAnchor; - for(auto pSpz: rSpzs) + for( size_t n = 0; n < rSpzArr.size(); ++n ) { - pAnchor = &pSpz->GetAnchor(); + pFormat = rSpzArr[n]; + pAnchor = &pFormat->GetAnchor(); if (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_PARA) { - SwNode* pAnchorNode = pAnchor->GetAnchorNode(); + SwNode* pAnchorNode = pAnchor->GetAnchorNode(); if( pAnchorNode && nOldIdx == pAnchorNode->GetIndex() ) { SwFormatAnchor aAnch( *pAnchor ); aAnch.SetAnchor( &rPos ); - pSpz->SetFormatAttr( aAnch ); + pFormat->SetFormatAttr( aAnch ); } } } diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 523d065989f4..e1fa8570f054 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -976,10 +976,10 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark, if( DelContentType::Fly & nDelContentType ) { sal_uInt16 nChainInsPos = m_pHistory ? m_pHistory->Count() : 0; - const sw::SpzFrameFormats& rSpzArr = *rDoc.GetSpzFrameFormats(); + const SwFrameFormats& rSpzArr = *rDoc.GetSpzFrameFormats(); if( !rSpzArr.empty() ) { - sw::SpzFrameFormat* pFormat; + SwFrameFormat* pFormat; const SwFormatAnchor* pAnchor; size_t n = rSpzArr.size(); const SwPosition* pAPos; diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 6db3d9315114..232af5876c5d 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -100,8 +100,8 @@ void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & rContext, bool bShowSelFrame) SwDoc *const pDoc = & rContext.GetDoc(); // add again into array - sw::SpzFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); - rFlyFormats.push_back( static_cast<sw::SpzFrameFormat*>(m_pFrameFormat)); + SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); + rFlyFormats.push_back( m_pFrameFormat ); // OD 26.06.2003 #108784# - insert 'master' drawing object into drawing page if ( RES_DRAWFRMFMT == m_pFrameFormat->Which() ) @@ -272,8 +272,8 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc ) m_pFrameFormat->ResetFormatAttr( RES_ANCHOR ); // delete anchor // delete from array - sw::SpzFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); - rFlyFormats.erase(static_cast<sw::SpzFrameFormat*>(m_pFrameFormat)); + SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); + rFlyFormats.erase( m_pFrameFormat ); } SwUndoInsLayFormat::SwUndoInsLayFormat( SwFrameFormat* pFormat, SwNodeOffset nNodeIdx, sal_Int32 nCntIdx ) diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 3fd7fa8ce244..cfdae61e84ab 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -219,7 +219,7 @@ void SwUndoDrawGroup::UndoImpl(::sw::UndoRedoContext &) // remove from array SwDoc* pDoc = pFormat->GetDoc(); - sw::SpzFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat )); for( sal_uInt16 n = 1; n < m_nSize; ++n ) @@ -227,7 +227,7 @@ void SwUndoDrawGroup::UndoImpl(::sw::UndoRedoContext &) SwUndoGroupObjImpl& rSave = m_pObjArray[n]; ::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx ); - rFlyFormats.push_back(static_cast<sw::SpzFrameFormat*>(rSave.pFormat)); + rFlyFormats.push_back( rSave.pFormat ); pObj = rSave.pObj; @@ -264,7 +264,7 @@ void SwUndoDrawGroup::RedoImpl(::sw::UndoRedoContext &) // remove from array SwDoc* pDoc = m_pObjArray[0].pFormat->GetDoc(); - sw::SpzFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); // This will store the textboxes from the ex-group-shapes std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes; @@ -297,7 +297,7 @@ void SwUndoDrawGroup::RedoImpl(::sw::UndoRedoContext &) // re-insert group object ::lcl_RestoreAnchor( m_pObjArray[0].pFormat, m_pObjArray[0].nNodeIdx ); - rFlyFormats.push_back(static_cast<sw::SpzFrameFormat*>(m_pObjArray[0].pFormat )); + rFlyFormats.push_back( m_pObjArray[0].pFormat ); SwDrawContact *pContact = new SwDrawContact( m_pObjArray[0].pFormat, m_pObjArray[0].pObj ); // #i26791# - correction: connect object to layout @@ -336,7 +336,7 @@ void SwUndoDrawGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat, SdrOb pFormat->RemoveAllUnos(); // remove from array - sw::SpzFrameFormats& rFlyFormats = *pFormat->GetDoc()->GetSpzFrameFormats(); + SwFrameFormats& rFlyFormats = *pFormat->GetDoc()->GetSpzFrameFormats(); rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat )); } @@ -367,7 +367,7 @@ SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup* pObj, const SwDoc& rDoc ) pFormat->RemoveAllUnos(); // remove from array - sw::SpzFrameFormats& rFlyFormats = *pFormat->GetDoc()->GetSpzFrameFormats(); + SwFrameFormats& rFlyFormats = *pFormat->GetDoc()->GetSpzFrameFormats(); rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat )); } @@ -388,7 +388,7 @@ void SwUndoDrawUnGroup::UndoImpl(::sw::UndoRedoContext & rContext) m_bDeleteFormat = true; SwDoc *const pDoc = & rContext.GetDoc(); - sw::SpzFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); // This will store the textboxes what were owned by this group std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes; @@ -424,7 +424,7 @@ void SwUndoDrawUnGroup::UndoImpl(::sw::UndoRedoContext & rContext) // re-insert group object ::lcl_RestoreAnchor( m_pObjArray[0].pFormat, m_pObjArray[0].nNodeIdx ); - rFlyFormats.push_back(static_cast<sw::SpzFrameFormat*>(m_pObjArray[0].pFormat )); + rFlyFormats.push_back( m_pObjArray[0].pFormat ); SwDrawContact *pContact = new SwDrawContact( m_pObjArray[0].pFormat, m_pObjArray[0].pObj ); pContact->ConnectToLayout(); @@ -481,7 +481,7 @@ void SwUndoDrawUnGroup::RedoImpl(::sw::UndoRedoContext &) // remove from array SwDoc* pDoc = pFormat->GetDoc(); - sw::SpzFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat )); for( sal_uInt16 n = 1; n < m_nSize; ++n ) @@ -489,7 +489,7 @@ void SwUndoDrawUnGroup::RedoImpl(::sw::UndoRedoContext &) SwUndoGroupObjImpl& rSave = m_pObjArray[n]; ::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx ); - rFlyFormats.push_back(static_cast<sw::SpzFrameFormat*>(rSave.pFormat)); + rFlyFormats.push_back( rSave.pFormat ); SwDrawFrameFormat* pDrawFrameFormat = rSave.pFormat; @@ -588,12 +588,12 @@ SwUndoDrawDelete::~SwUndoDrawDelete() void SwUndoDrawDelete::UndoImpl(::sw::UndoRedoContext & rContext) { m_bDeleteFormat = false; - sw::SpzFrameFormats& rFlyFormats = *rContext.GetDoc().GetSpzFrameFormats(); + SwFrameFormats & rFlyFormats = *rContext.GetDoc().GetSpzFrameFormats(); for( size_t n = 0; n < m_pMarkList->GetMarkCount(); ++n ) { SwUndoGroupObjImpl& rSave = m_pObjArray[n]; ::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx ); - rFlyFormats.push_back(static_cast<sw::SpzFrameFormat*>(rSave.pFormat)); + rFlyFormats.push_back( rSave.pFormat ); SdrObject *pObj = rSave.pObj; SwDrawContact *pContact = new SwDrawContact( rSave.pFormat, pObj ); pContact->Changed_( *pObj, SdrUserCallType::Inserted, nullptr ); @@ -619,7 +619,7 @@ void SwUndoDrawDelete::UndoImpl(::sw::UndoRedoContext & rContext) void SwUndoDrawDelete::RedoImpl(::sw::UndoRedoContext & rContext) { m_bDeleteFormat = true; - sw::SpzFrameFormats& rFlyFormats = *rContext.GetDoc().GetSpzFrameFormats(); + SwFrameFormats & rFlyFormats = *rContext.GetDoc().GetSpzFrameFormats(); for( size_t n = 0; n < m_pMarkList->GetMarkCount(); ++n ) { SwUndoGroupObjImpl& rSave = m_pObjArray[n]; @@ -650,7 +650,7 @@ void SwUndoDrawDelete::AddObj( SwDrawFrameFormat* pFormat, // remove from array SwDoc* pDoc = pFormat->GetDoc(); - sw::SpzFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); + SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats(); rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat )); m_pMarkList->InsertEntry( rMark ); diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 8c351559db69..fffd8e8b4e51 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -434,8 +434,10 @@ SwUndoTableToText::SwUndoTableToText( const SwTable& rTable, sal_Unicode cCh ) const SwTableNode* pTableNd = rTable.GetTableNode(); SwNodeOffset nTableStt = pTableNd->GetIndex(), nTableEnd = pTableNd->EndOfSectionIndex(); - for(sw::SpzFrameFormat* pFormat: *pTableNd->GetDoc().GetSpzFrameFormats()) + const SwFrameFormats& rFrameFormatTable = *pTableNd->GetDoc().GetSpzFrameFormats(); + for( size_t n = 0; n < rFrameFormatTable.size(); ++n ) { + SwFrameFormat* pFormat = rFrameFormatTable[ n ]; SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); if (pAnchorNode && diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 65e70846470f..627ab4bf870c 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -1079,9 +1079,17 @@ template<FlyCntType T> SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc& rDoc) { SolarMutexGuard aGuard; - for(sw::SpzFrameFormat* pFormat: *rDoc.GetSpzFrameFormats()) + const SwFrameFormats* const pFormats = rDoc.GetSpzFrameFormats(); + if (pFormats->empty()) + return; + // #i104937# + const size_t nSize = pFormats->size(); + // #i104937# + SwFrameFormat* pFormat( nullptr ); + for( size_t i = 0; i < nSize; ++i ) { // #i104937# + pFormat = (*pFormats)[i]; if(pFormat->Which() != RES_FLYFRMFMT || SwTextBoxHelper::isTextBox(pFormat, RES_FLYFRMFMT)) continue; const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx(); diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index c07c78237e92..c73c2c34a458 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -155,9 +155,12 @@ void CollectFrameAtNode( const SwNode& rNd, } else { - for(sw::SpzFrameFormat* pSpz: *rDoc.GetSpzFrameFormats()) + const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats(); + const size_t nSize = rFormats.size(); + for ( size_t i = 0; i < nSize; i++) { - const SwFormatAnchor& rAnchor = pSpz->GetAnchor(); + const SwFrameFormat* pFormat = rFormats[ i ]; + const SwFormatAnchor& rAnchor = pFormat->GetAnchor(); const SwNode* pAnchorNode; if( rAnchor.GetAnchorId() == nChkType && nullptr != (pAnchorNode = rAnchor.GetAnchorNode()) && @@ -169,7 +172,7 @@ void CollectFrameAtNode( const SwNode& rNd, const sal_Int32 nIndex = rAnchor.GetAnchorContentOffset(); sal_uInt32 nOrder = rAnchor.GetOrder(); - rFrames.emplace_back(nIndex, nOrder, std::make_unique<sw::FrameClient>(pSpz)); + rFrames.emplace_back(nIndex, nOrder, std::make_unique<sw::FrameClient>(const_cast<SwFrameFormat*>(pFormat))); } } std::sort(rFrames.begin(), rFrames.end(), FrameClientSortListLess()); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index a6197e994c51..18d0769cd3b4 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -728,8 +728,15 @@ void SwViewShell::UpdateFields(bool bCloseDB) void SwViewShell::UpdateOleObjectPreviews() { SwDoc* pDoc = GetDoc(); - for(sw::SpzFrameFormat* pFormat: *pDoc->GetSpzFrameFormats()) + const SwFrameFormats* const pFormats = pDoc->GetSpzFrameFormats(); + if (pFormats->empty()) { + return; + } + + for (size_t i = 0; i < pFormats->size(); ++i) + { + SwFrameFormat* pFormat = (*pFormats)[i]; if (pFormat->Which() != RES_FLYFRMFMT) { continue; diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 741ceff97c33..67c213c4d331 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -1318,18 +1318,20 @@ void SwHTMLWriter::GetControls() } // and now the ones in a character-bound frame - for(sw::SpzFrameFormat* pSpz: *m_pDoc->GetSpzFrameFormats()) + const SwFrameFormats* pSpzFrameFormats = m_pDoc->GetSpzFrameFormats(); + for( size_t i=0; i<pSpzFrameFormats->size(); i++ ) { - if( RES_DRAWFRMFMT != pSpz->Which() ) + const SwFrameFormat *pFrameFormat = (*pSpzFrameFormats)[i]; + if( RES_DRAWFRMFMT != pFrameFormat->Which() ) continue; - const SwFormatAnchor& rAnchor = pSpz->GetAnchor(); + const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor(); const SwNode *pAnchorNode = rAnchor.GetAnchorNode(); if ((RndStdIds::FLY_AS_CHAR != rAnchor.GetAnchorId()) || !pAnchorNode) continue; const SdrObject *pSdrObj = - SwHTMLWriter::GetHTMLControl(*static_cast<SwDrawFrameFormat*>(pSpz) ); + SwHTMLWriter::GetHTMLControl( *static_cast<const SwDrawFrameFormat*>(pFrameFormat) ); if( !pSdrObj ) continue; diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index f8f6c8ba31a8..daf90faff773 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -1456,10 +1456,11 @@ void SwHTMLParser::StripTrailingPara() if( pCNd && pCNd->StartOfSectionIndex() + 2 < pCNd->EndOfSectionIndex() && CanRemoveNode(nNodeIdx)) { + const SwFrameFormats& rFrameFormatTable = *m_xDoc->GetSpzFrameFormats(); - for(sw::SpzFrameFormat* pSpz: *m_xDoc->GetSpzFrameFormats()) + for( auto pFormat : rFrameFormatTable ) { - SwFormatAnchor const*const pAnchor = &pSpz->GetAnchor(); + SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); if (pAnchorNode && ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) || diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 49e3e9a8abce..67502f1a278b 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -4551,10 +4551,12 @@ bool SwHTMLParser::HasCurrentParaFlys( bool bNoSurroundOnly, { SwNode& rNode = m_pPam->GetPoint()->GetNode(); + const SwFrameFormats& rFrameFormatTable = *m_xDoc->GetSpzFrameFormats(); bool bFound = false; - for(sw::SpzFrameFormat* pFormat: *m_xDoc->GetSpzFrameFormats()) + for ( size_t i=0; i<rFrameFormatTable.size(); i++ ) { + const SwFrameFormat *const pFormat = rFrameFormatTable[i]; SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor(); // A frame was found, when // - it is paragraph-bound, and diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index ba9425ec3c2b..66b4aa8fe450 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -953,7 +953,7 @@ sal_uInt32 WW8Export::GetSdrOrdNum( const SwFrameFormat& rFormat ) const // no Layout for this format, then recalc the ordnum SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(&rFormat); nOrdNum = std::distance(m_rDoc.GetSpzFrameFormats()->begin(), - m_rDoc.GetSpzFrameFormats()->find(static_cast<sw::SpzFrameFormat*>(pFormat))); + m_rDoc.GetSpzFrameFormats()->find( pFormat ) ); const SwDrawModel* pModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel(); if( pModel ) |