[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 21 18:37:50 UTC 2021
sw/source/core/doc/tblrwcl.cxx | 18 ++++++++----------
sw/source/core/inc/tblrwcl.hxx | 2 +-
2 files changed, 9 insertions(+), 11 deletions(-)
New commits:
commit dca1ed757674ad9b32ded6ab92b6fe85c7890005
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 21 15:11:27 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 21 20:37:14 2021 +0200
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 at collabora.co.uk>
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;
More information about the Libreoffice-commits
mailing list