summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-21 15:11:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-21 20:37:14 +0200
commitdca1ed757674ad9b32ded6ab92b6fe85c7890005 (patch)
tree3ebf204dc482e7bda58c12176fa110cd453a5239
parenta7f05c009aad9fb8c8872312929c473b55cb1454 (diff)
flatten SwShareBoxFormats a little
Change-Id: I1ddbc0d2d9969597491f47ddbabd99badfee78a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119334 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/doc/tblrwcl.cxx18
-rw-r--r--sw/source/core/inc/tblrwcl.hxx2
2 files changed, 9 insertions, 11 deletions
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 15840f18bcd0..6d8d86ce8f12 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -3264,7 +3264,7 @@ SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat, tools
{
sal_uInt16 nPos;
return Seek_Entry( rFormat, &nPos )
- ? m_ShareArr[ nPos ]->GetFormat(nWidth)
+ ? m_ShareArr[ nPos ].GetFormat(nWidth)
: nullptr;
}
SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat,
@@ -3272,23 +3272,21 @@ SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat,
{
sal_uInt16 nPos;
return Seek_Entry( rFormat, &nPos )
- ? m_ShareArr[ nPos ]->GetFormat(rItem)
+ ? m_ShareArr[ nPos ].GetFormat(rItem)
: nullptr;
}
void SwShareBoxFormats::AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNew )
{
sal_uInt16 nPos;
- SwShareBoxFormat* pEntry;
if( !Seek_Entry( rOld, &nPos ))
{
- pEntry = new SwShareBoxFormat( rOld );
- m_ShareArr.insert(m_ShareArr.begin() + nPos, std::unique_ptr<SwShareBoxFormat>(pEntry));
+ SwShareBoxFormat aEntry(rOld);
+ aEntry.AddFormat( rNew );
+ m_ShareArr.insert(m_ShareArr.begin() + nPos, aEntry);
}
else
- pEntry = m_ShareArr[ nPos ].get();
-
- pEntry->AddFormat( rNew );
+ m_ShareArr[ nPos ].AddFormat(rNew);
}
void SwShareBoxFormats::ChangeFrameFormat( SwTableBox* pBox, SwTableLine* pLn,
@@ -3361,7 +3359,7 @@ void SwShareBoxFormats::RemoveFormat( const SwFrameFormat& rFormat )
{
for (auto i = m_ShareArr.size(); i; )
{
- if (m_ShareArr[ --i ]->RemoveFormat(rFormat))
+ if (m_ShareArr[ --i ].RemoveFormat(rFormat))
{
m_ShareArr.erase( m_ShareArr.begin() + i );
}
@@ -3379,7 +3377,7 @@ bool SwShareBoxFormats::Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pP
while( nU <= nO )
{
const auto nM = nU + ( nO - nU ) / 2;
- sal_uIntPtr nFormat = reinterpret_cast<sal_uIntPtr>(&m_ShareArr[ nM ]->GetOldFormat());
+ sal_uIntPtr nFormat = reinterpret_cast<sal_uIntPtr>(&m_ShareArr[ nM ].GetOldFormat());
if( nFormat == nIdx )
{
if( pPos )
diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx
index addc40804f74..9280a67edf6f 100644
--- a/sw/source/core/inc/tblrwcl.hxx
+++ b/sw/source/core/inc/tblrwcl.hxx
@@ -171,7 +171,7 @@ public:
class SwShareBoxFormats
{
- std::vector<std::unique_ptr<SwShareBoxFormat>> m_ShareArr;
+ std::vector<SwShareBoxFormat> m_ShareArr;
bool Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const;