summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/node.hxx4
-rw-r--r--sw/source/core/doc/doclay.cxx6
-rw-r--r--sw/source/core/docnode/node.cxx19
-rw-r--r--sw/source/core/edit/autofmt.cxx5
-rw-r--r--sw/source/core/layout/atrfrm.cxx15
-rw-r--r--sw/source/core/layout/frmtool.cxx14
-rw-r--r--sw/source/core/layout/wsfrm.cxx16
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx6
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx2
9 files changed, 31 insertions, 56 deletions
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index c5693ce98c87..53e2a79d0068 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -107,7 +107,7 @@ private:
/// all SwFrameFormat that are anchored at the node
/// invariant: SwFrameFormat is in the list iff
/// SwFrameFormat::GetAnchor().GetContentAnchor() points to this node
- std::optional<std::vector<SwFrameFormat*>> m_xAnchoredFlys;
+ std::vector<SwFrameFormat*> m_aAnchoredFlys;
protected:
SwStartNode* m_pStartOfSection;
@@ -294,7 +294,7 @@ public:
sal_uInt8 HasPrevNextLayNode() const;
- std::vector<SwFrameFormat *> const* GetAnchoredFlys() const { return m_xAnchoredFlys ? &*m_xAnchoredFlys : nullptr; }
+ std::vector<SwFrameFormat *> const & GetAnchoredFlys() const { return m_aAnchoredFlys; }
void AddAnchoredFly(SwFrameFormat *);
void RemoveAnchoredFly(SwFrameFormat *);
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 43b4408ec080..556ff77fdb78 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1571,11 +1571,11 @@ bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const
checkFormats.push_back( pFormat );
}
#endif
- std::vector<SwFrameFormat*> const*const pFlys(pFlyNd->GetAnchoredFlys());
+ std::vector<SwFrameFormat*> const & rFlys(pFlyNd->GetAnchoredFlys());
bool bFound(false);
- for (size_t i = 0; pFlys && i < pFlys->size(); ++i)
+ for (size_t i = 0; i < rFlys.size(); ++i)
{
- const SwFrameFormat *const pFormat = (*pFlys)[i];
+ const SwFrameFormat *const pFormat = rFlys[i];
const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
if( pIdx && pFlyNd == &pIdx->GetNode() )
{
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 3b0245969246..4f7b18ba3a68 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -347,7 +347,7 @@ SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNdType )
SwNode::~SwNode()
{
- assert(!m_xAnchoredFlys || GetDoc().IsInDtor()); // must all be deleted
+ assert(m_aAnchoredFlys.empty() || GetDoc().IsInDtor()); // must all be deleted
InvalidateInSwCache(RES_OBJECTDYING);
assert(!IsInCache());
}
@@ -2119,11 +2119,7 @@ void SwNode::AddAnchoredFly(SwFrameFormat *const pFlyFormat)
assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
// check node type, cf. SwFormatAnchor::SetAnchor()
assert(IsTextNode() || IsStartNode() || IsTableNode());
- if (!m_xAnchoredFlys)
- {
- m_xAnchoredFlys.emplace();
- }
- m_xAnchoredFlys->push_back(pFlyFormat);
+ m_aAnchoredFlys.push_back(pFlyFormat);
}
void SwNode::RemoveAnchoredFly(SwFrameFormat *const pFlyFormat)
@@ -2132,14 +2128,9 @@ void SwNode::RemoveAnchoredFly(SwFrameFormat *const pFlyFormat)
// cannot assert this in Remove because it is called when new anchor is already set
// assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
assert(IsTextNode() || IsStartNode() || IsTableNode());
- assert(m_xAnchoredFlys);
- auto it(std::find(m_xAnchoredFlys->begin(), m_xAnchoredFlys->end(), pFlyFormat));
- assert(it != m_xAnchoredFlys->end());
- m_xAnchoredFlys->erase(it);
- if (m_xAnchoredFlys->empty())
- {
- m_xAnchoredFlys.reset();
- }
+ auto it(std::find(m_aAnchoredFlys.begin(), m_aAnchoredFlys.end(), pFlyFormat));
+ assert(it != m_aAnchoredFlys.end());
+ m_aAnchoredFlys.erase(it);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index b9b4d8480a7a..12df8e7383e9 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -345,11 +345,8 @@ bool SwAutoFormat::HasObjects(const SwTextFrame & rFrame)
SwNodeIndex node(*rFrame.GetTextNodeFirst());
do
{
- if (node.GetNode().GetAnchoredFlys() != nullptr)
- {
- assert(!node.GetNode().GetAnchoredFlys()->empty());
+ if (!node.GetNode().GetAnchoredFlys().empty())
return true;
- }
++node;
}
while (sw::FrameContainsNode(rFrame, node.GetIndex()));
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index dd434fb6d90c..fc4865619466 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -3582,14 +3582,11 @@ void CheckAnchoredFlyConsistency(SwDoc const& rDoc)
for (sal_uLong i = 0; i != count; ++i)
{
SwNode const*const pNode(rNodes[i]);
- std::vector<SwFrameFormat*> const*const pFlys(pNode->GetAnchoredFlys());
- if (pFlys)
+ std::vector<SwFrameFormat*> const & rFlys(pNode->GetAnchoredFlys());
+ for (const auto& rpFly : rFlys)
{
- for (const auto& rpFly : *pFlys)
- {
- SwFormatAnchor const& rAnchor((*rpFly).GetAnchor(false));
- assert(&rAnchor.GetContentAnchor()->nNode.GetNode() == pNode);
- }
+ SwFormatAnchor const& rAnchor((*rpFly).GetAnchor(false));
+ assert(&rAnchor.GetContentAnchor()->nNode.GetNode() == pNode);
}
}
SwFrameFormats const*const pSpzFrameFormats(rDoc.GetSpzFrameFormats());
@@ -3609,8 +3606,8 @@ void CheckAnchoredFlyConsistency(SwDoc const& rDoc)
else
{
SwNode & rNode(rAnchor.GetContentAnchor()->nNode.GetNode());
- std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
- assert(std::find(pFlys->begin(), pFlys->end(), *it) != pFlys->end());
+ std::vector<SwFrameFormat*> const& rFlys(rNode.GetAnchoredFlys());
+ 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 51e76b63daaa..13350fef27c3 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1160,12 +1160,8 @@ void RemoveHiddenObjsOfNode(SwTextNode const& rNode,
std::vector<sw::Extent>::const_iterator const*const pEnd,
SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
{
- std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
- if (!pFlys)
- {
- return;
- }
- for (SwFrameFormat * pFrameFormat : *pFlys)
+ std::vector<SwFrameFormat*> const & rFlys(rNode.GetAnchoredFlys());
+ for (SwFrameFormat * pFrameFormat : rFlys)
{
SwFormatAnchor const& rAnchor = pFrameFormat->GetAnchor();
if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR
@@ -1204,10 +1200,10 @@ void AppendObjsOfNode(SwFrameFormats const*const pTable, sal_uLong const nIndex,
#endif
SwNode const& rNode(*pDoc->GetNodes()[nIndex]);
- std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
- for (size_t it = 0; pFlys && it != pFlys->size(); )
+ std::vector<SwFrameFormat*> const & rFlys(rNode.GetAnchoredFlys());
+ for (size_t it = 0; it != rFlys.size(); )
{
- SwFrameFormat *const pFormat = (*pFlys)[it];
+ SwFrameFormat *const pFormat = rFlys[it];
const SwFormatAnchor &rAnch = pFormat->GetAnchor();
if ( rAnch.GetContentAnchor() &&
IsShown(nIndex, rAnch, pIter, pEnd, pFirstNode, pLastNode))
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 27c9c6f5049d..4e8fb2e1fa1f 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4240,14 +4240,11 @@ static void AddRemoveFlysForNode(
if (pSkipped)
{
// if a fly has been added by AppendObjsOfNode, it must be skipped; if not, then it doesn't matter if it's skipped or not because it has no frames and because of that it would be skipped anyway
- if (auto const pFlys = pNode->GetAnchoredFlys())
+ for (auto const pFly : pNode->GetAnchoredFlys())
{
- for (auto const pFly : *pFlys)
+ if (pFly->Which() != RES_DRAWFRMFMT)
{
- if (pFly->Which() != RES_DRAWFRMFMT)
- {
- pSkipped->insert(pFly->GetContent().GetContentIdx()->GetIndex());
- }
+ pSkipped->insert(pFly->GetContent().GetContentIdx()->GetIndex());
}
}
}
@@ -4418,12 +4415,9 @@ static void UnHideRedlines(SwRootFrame & rLayout,
{
sw::RemoveFootnotesForNode(rLayout, *pNode->GetTextNode(), nullptr);
// similarly, remove the anchored flys
- if (auto const pFlys = pNode->GetAnchoredFlys())
+ for (SwFrameFormat * pFormat : pNode->GetAnchoredFlys())
{
- for (SwFrameFormat * pFormat : *pFlys)
- {
- pFormat->DelFrames(/*&rLayout*/);
- }
+ pFormat->DelFrames(/*&rLayout*/);
}
}
}
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index d513fe97c267..1a21120cb05c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1447,10 +1447,10 @@ void SwTextNode::Update(
}
}
#endif
- std::vector<SwFrameFormat*> const*const pFlys(GetAnchoredFlys());
- for (size_t i = 0; pFlys && i != pFlys->size(); ++i)
+ std::vector<SwFrameFormat*> const& rFlys(GetAnchoredFlys());
+ for (size_t i = 0; i != rFlys.size(); ++i)
{
- SwFrameFormat const*const pFormat = (*pFlys)[i];
+ SwFrameFormat const*const pFormat = rFlys[i];
const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
const SwPosition* pContentAnchor = rAnchor.GetContentAnchor();
if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR && pContentAnchor)
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index aae8843adc59..2a4d939b2d0b 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -628,7 +628,7 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
&& (pTempNode = pDoc->GetNodes()[pRedlineInfo->pContentIndex->GetIndex() + 1]->GetTextNode()) != nullptr
&& pTempNode->GetText().isEmpty()
&& !pTempNode->GetpSwpHints()
- && !pTempNode->GetAnchoredFlys()))
+ && pTempNode->GetAnchoredFlys().empty()))
{
// ignore redline (e.g. file loaded in insert mode):
// delete 'deleted' redlines and forget about the whole thing