summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-23 09:56:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-23 14:36:45 +0200
commit639e52064260bc47698078a4319e59fe4b54db62 (patch)
tree5705df21a6dfef2d7ae6f41917cf8a5efad2aa48 /sw
parent9815bf197c27afdfeccf967898c3a000bcf7b256 (diff)
simplify SwFormatsModifyBase::ContainsFormat
can just call IsAlive Change-Id: I7cd3b33520261b68d549783cabd5cf3f6f4847a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117696 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/docary.hxx5
-rw-r--r--sw/source/core/undo/unattr.cxx2
2 files changed, 3 insertions, 4 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 9ce149d7de89..49d1a7c368a7 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -164,9 +164,8 @@ public:
/// check if given format is contained here
/// @precond pFormat must not have been deleted
- bool ContainsFormat(SwFormat const*const pFormat) const {
- Value p = dynamic_cast<Value>(const_cast<SwFormat*>(pFormat));
- return p != nullptr && SwVectorModifyBase<Value>::IsAlive(p);
+ bool ContainsFormat(Value pFormat) const {
+ return SwVectorModifyBase<Value>::IsAlive(pFormat);
}
// Override return type to reduce casting
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index a4c1aaec54d9..208f54cc7eb2 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -139,7 +139,7 @@ void SwUndoFormatAttr::Init( const SwFormat & rFormat )
m_nNodeIndex = pTable->GetTabSortBoxes()[ 0 ]->GetSttNd()
->FindTableNode()->GetIndex();
}
- } else if (pDoc->GetSections().ContainsFormat(&rFormat)) {
+ } else if (dynamic_cast<const SwSectionFormat*>(&rFormat)) {
m_nNodeIndex = rFormat.GetContent().GetContentIdx()->GetIndex();
} else if ( dynamic_cast< const SwTableBoxFormat* >( &rFormat ) != nullptr ) {
SwTableBox * pTableBox = SwIterator<SwTableBox,SwFormat>( rFormat ).First();