[Libreoffice-commits] core.git: 2 commits - emfio/inc emfio/source filter/source include/filter
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 3 06:59:11 UTC 2021
emfio/inc/mtftools.hxx | 4 +-
emfio/source/reader/emfreader.cxx | 8 ++--
emfio/source/reader/mtftools.cxx | 10 ++---
emfio/source/reader/wmfreader.cxx | 4 +-
filter/source/msfilter/svdfppt.cxx | 61 +++++++++++++++++-------------------
include/filter/msfilter/svdfppt.hxx | 4 +-
6 files changed, 45 insertions(+), 46 deletions(-)
New commits:
commit cbd005536189a6d0e7598bf06480042017fbaf32
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Sep 2 19:43:52 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 3 08:58:47 2021 +0200
no need to allocat PptFontEntityAtom separately here
Change-Id: Id0b8c919bc35bb427a88c229d024a118437785f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121530
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index a2ce30270283..66afb79fc5cc 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -556,12 +556,11 @@ bool SdrEscherImport::SeekToShape( SvStream& /*rSt*/, SvxMSDffClientData* /*pCli
return false;
}
-PptFontEntityAtom* SdrEscherImport::GetFontEnityAtom( sal_uInt32 nNum ) const
+const PptFontEntityAtom* SdrEscherImport::GetFontEnityAtom( sal_uInt32 nNum ) const
{
- PptFontEntityAtom* pRetValue = nullptr;
- if (m_pFonts && (nNum < m_pFonts->size()))
- pRetValue = (*m_pFonts)[ nNum ].get();
- return pRetValue;
+ if (m_xFonts && nNum < m_xFonts->size())
+ return &(*m_xFonts)[ nNum ];
+ return nullptr;
}
SdrObject* SdrEscherImport::ReadObjText( PPTTextObj* /*pTextObj*/, SdrObject* pObj, SdPageCapsule /*pPage*/) const
@@ -1461,7 +1460,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
if ( m_bOk )
{
- if (!m_pFonts)
+ if (!m_xFonts)
ReadFontCollection();
// reading TxPF, TxSI
@@ -2181,33 +2180,33 @@ bool SdrPowerPointImport::ReadFontCollection()
while ( SeekToRec( rStCtrl, PPT_PST_FontEntityAtom, aListHd.GetRecEndFilePos() ) )
{
bRet = true;
- if (!m_pFonts)
- m_pFonts.reset( new std::vector<std::unique_ptr<PptFontEntityAtom>> );
- std::unique_ptr<PptFontEntityAtom> pFont(new PptFontEntityAtom);
- ReadPptFontEntityAtom( rStCtrl, *pFont );
+ if (!m_xFonts)
+ m_xFonts.emplace();
+ PptFontEntityAtom aFontAtom;
+ ReadPptFontEntityAtom( rStCtrl, aFontAtom );
vcl::Font aFont;
- aFont.SetCharSet( pFont->eCharSet );
- aFont.SetFamilyName( pFont->aName );
- aFont.SetFamily( pFont->eFamily );
- aFont.SetPitch( pFont->ePitch );
+ aFont.SetCharSet( aFontAtom.eCharSet );
+ aFont.SetFamilyName( aFontAtom.aName );
+ aFont.SetFamily( aFontAtom.eFamily );
+ aFont.SetPitch( aFontAtom.ePitch );
aFont.SetFontHeight( 100 );
// following block is necessary, because our old PowerPoint export did not set the
// correct charset
- if ( pFont->aName.equalsIgnoreAsciiCase( "Wingdings" ) ||
- pFont->aName.equalsIgnoreAsciiCase( "Wingdings 2" ) ||
- pFont->aName.equalsIgnoreAsciiCase( "Wingdings 3" ) ||
- pFont->aName.equalsIgnoreAsciiCase( "Monotype Sorts" ) ||
- pFont->aName.equalsIgnoreAsciiCase( "Monotype Sorts 2" ) ||
- pFont->aName.equalsIgnoreAsciiCase( "Webdings" ) ||
- pFont->aName.equalsIgnoreAsciiCase( "StarBats" ) ||
- pFont->aName.equalsIgnoreAsciiCase( "StarMath" ) ||
- pFont->aName.equalsIgnoreAsciiCase( "ZapfDingbats" ) )
+ if ( aFontAtom.aName.equalsIgnoreAsciiCase( "Wingdings" ) ||
+ aFontAtom.aName.equalsIgnoreAsciiCase( "Wingdings 2" ) ||
+ aFontAtom.aName.equalsIgnoreAsciiCase( "Wingdings 3" ) ||
+ aFontAtom.aName.equalsIgnoreAsciiCase( "Monotype Sorts" ) ||
+ aFontAtom.aName.equalsIgnoreAsciiCase( "Monotype Sorts 2" ) ||
+ aFontAtom.aName.equalsIgnoreAsciiCase( "Webdings" ) ||
+ aFontAtom.aName.equalsIgnoreAsciiCase( "StarBats" ) ||
+ aFontAtom.aName.equalsIgnoreAsciiCase( "StarMath" ) ||
+ aFontAtom.aName.equalsIgnoreAsciiCase( "ZapfDingbats" ) )
{
- pFont->eCharSet = RTL_TEXTENCODING_SYMBOL;
+ aFontAtom.eCharSet = RTL_TEXTENCODING_SYMBOL;
};
- m_pFonts->insert(m_pFonts->begin() + nCount2++, std::move(pFont));
+ m_xFonts->insert(m_xFonts->begin() + nCount2++, std::move(aFontAtom));
}
}
rStCtrl.Seek( nOldFPos ); // restore FilePos
@@ -2290,7 +2289,7 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj*
sal_uInt32 nFont;
pPortion->GetAttrib( PPT_CharAttr_Font, nFont, pTextObj->GetInstance() );
- PptFontEntityAtom* pFontEnityAtom = GetFontEnityAtom( nFont );
+ const PptFontEntityAtom* pFontEnityAtom = GetFontEnityAtom( nFont );
if ( pFontEnityAtom && ( pFontEnityAtom->eCharSet == RTL_TEXTENCODING_SYMBOL ) )
{
sal_Unicode nUnicode;
@@ -3701,7 +3700,7 @@ void PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport const & rManag
case SVX_NUM_CHARS_LOWER_LETTER_N :
{
sal_uInt32 nFont = rCharLevel.mnFont;
- PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nFont );
+ const PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nFont );
if ( pFontEnityAtom )
{
vcl::Font aFont;
@@ -3759,7 +3758,7 @@ bool PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport const & rManag
{
sal_uInt32 nFont;
pPtr->GetAttrib( PPT_CharAttr_Font, nFont, nDestinationInstance );
- PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nFont );
+ const PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nFont );
if ( pFontEnityAtom )
{
vcl::Font aFont;
@@ -3781,7 +3780,7 @@ bool PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport const & rManag
void PPTNumberFormatCreator::ImplGetNumberFormat( SdrPowerPointImport const & rManager, SvxNumberFormat& rNumberFormat )
{
vcl::Font aFont;
- PptFontEntityAtom* pAtom = rManager.GetFontEnityAtom( nBulletFont );
+ const PptFontEntityAtom* pAtom = rManager.GetFontEnityAtom( nBulletFont );
if ( pAtom )
{
rtl_TextEncoding eCharSet( pAtom->eCharSet );
@@ -5608,7 +5607,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
{
if ( nAsianFontId != 0xffff )
{
- PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nAsianFontId );
+ const PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nAsianFontId );
if ( pFontEnityAtom )
{
rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName,
@@ -5620,7 +5619,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
}
if ( GetAttrib( PPT_CharAttr_Font, nVal, nDestinationInstance ) )
{
- PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nVal );
+ const PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nVal );
if ( pFontEnityAtom )
{
rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName, OUString(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO ) );
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 628288088ecc..e0aa98e56c29 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -459,7 +459,7 @@ protected:
::std::vector< PPTOleEntry > aOleObjectList;
- std::unique_ptr<std::vector<std::unique_ptr<PptFontEntityAtom>>> m_pFonts;
+ std::optional<std::vector<PptFontEntityAtom>> m_xFonts;
sal_uInt32 nStreamLen;
@@ -476,7 +476,7 @@ public:
virtual ~SdrEscherImport() override;
virtual bool GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const override;
virtual bool SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const override;
- PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const;
+ const PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const;
void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph );
virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const;
virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pObj ) override;
commit d2ba1d72c047a31321cf4c510c8c4a729c3706e9
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Sep 2 19:57:57 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 3 08:58:38 2021 +0200
no need to allocate BSaveStruct separately
Change-Id: Id14f525e84c22caa8f974f2f1d9f398f8d8e2df8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121532
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index 1ee6efd68f26..b0945f7806ef 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -562,7 +562,7 @@ namespace emfio
SvStream* mpInputStream; // the WMF/EMF file to be read
sal_uInt32 mnStartPos;
sal_uInt32 mnEndPos;
- std::vector<std::unique_ptr<BSaveStruct>> maBmpSaveList;
+ std::vector<BSaveStruct> maBmpSaveList;
// tdf#127471 always try to detect - only used with ScaledText
ScaledFontDetectCorrectHelper maScaledFontHelper;
@@ -680,7 +680,7 @@ namespace emfio
bool bRecordPath = false,
sal_Int32 nGraphicsMode = GM_COMPATIBLE);
- void ResolveBitmapActions(std::vector<std::unique_ptr<BSaveStruct>>& rSaveList);
+ void ResolveBitmapActions(std::vector<BSaveStruct>& rSaveList);
void IntersectClipRect(const tools::Rectangle& rRect);
void ExcludeClipRect(const tools::Rectangle& rRect);
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index af09ed2799cd..15ea08f8d51c 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -519,7 +519,7 @@ namespace emfio
aGraphic.getVectorGraphicData()->setSizeHint(maSizeHint);
maBmpSaveList.emplace_back(
- new BSaveStruct(aGraphic.GetBitmapEx(), aOutputRect, SRCCOPY, /*bForceAlpha=*/true));
+ aGraphic.GetBitmapEx(), aOutputRect, SRCCOPY, /*bForceAlpha=*/true);
const std::shared_ptr<VectorGraphicData> pVectorGraphicData
= aGraphic.getVectorGraphicData();
if (!pVectorGraphicData)
@@ -1640,7 +1640,7 @@ namespace emfio
aPNGWriter.Write(aNew);
}
#endif
- maBmpSaveList.emplace_back(new BSaveStruct(aBitmapEx, aRect, SRCAND|SRCINVERT));
+ maBmpSaveList.emplace_back(aBitmapEx, aRect, SRCAND|SRCINVERT);
}
}
}
@@ -1720,7 +1720,7 @@ namespace emfio
aBitmap.Crop( aCropRect );
}
- maBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aRect, dwRop));
+ maBmpSaveList.emplace_back(aBitmap, aRect, dwRop);
}
}
}
@@ -1805,7 +1805,7 @@ namespace emfio
tools::Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) );
aBitmap.Crop( aCropRect );
}
- maBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aRect, dwRop));
+ maBmpSaveList.emplace_back(aBitmap, aRect, dwRop);
}
}
}
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 590fddd9e508..aaefec7eb6e4 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1912,7 +1912,7 @@ namespace emfio
mpGDIMetaFile->AddAction( new MetaBmpScaleAction( rPos, rSize, aBmpEx.GetBitmap() ) );
}
- void MtfTools::ResolveBitmapActions( std::vector<std::unique_ptr<BSaveStruct>>& rSaveList )
+ void MtfTools::ResolveBitmapActions( std::vector<BSaveStruct>& rSaveList )
{
UpdateClipRegion();
@@ -1925,7 +1925,7 @@ namespace emfio
size_t nObjectsOfSameSize = 0;
size_t nObjectStartIndex = nObjects - nObjectsLeft;
- BSaveStruct* pSave = rSaveList[nObjectStartIndex].get();
+ BSaveStruct* pSave = &rSaveList[nObjectStartIndex];
tools::Rectangle aRect( pSave->aOutRect );
for ( i = nObjectStartIndex; i < nObjects; )
@@ -1933,7 +1933,7 @@ namespace emfio
nObjectsOfSameSize++;
if ( ++i < nObjects )
{
- pSave = rSaveList[i].get();
+ pSave = &rSaveList[i];
if ( pSave->aOutRect != aRect )
break;
}
@@ -1943,7 +1943,7 @@ namespace emfio
for ( i = nObjectStartIndex; i < ( nObjectStartIndex + nObjectsOfSameSize ); i++ )
{
- pSave = rSaveList[i].get();
+ pSave = &rSaveList[i];
sal_uInt32 nWinRop = pSave->nWinRop;
sal_uInt8 nRasterOperation = static_cast<sal_uInt8>( nWinRop >> 16 );
@@ -1971,7 +1971,7 @@ namespace emfio
{
if ( nObjectsOfSameSize == 2 )
{
- BSaveStruct* pSave2 = rSaveList[i + 1].get();
+ BSaveStruct* pSave2 = &rSaveList[i + 1];
if ( ( pSave->aBmpEx.GetPrefSize() == pSave2->aBmpEx.GetPrefSize() ) &&
( pSave->aBmpEx.GetPrefMapMode() == pSave2->aBmpEx.GetPrefMapMode() ) )
{
diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx
index 552896e892dd..82c6210acbbf 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -857,7 +857,7 @@ namespace emfio
aBitmap.Crop( aCropRect );
}
tools::Rectangle aDestRect( aPoint, Size( nSxe, nSye ) );
- maBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aDestRect, nRasterOperation));
+ maBmpSaveList.emplace_back(aBitmap, aDestRect, nRasterOperation);
}
}
break;
@@ -922,7 +922,7 @@ namespace emfio
aBmp.Crop( aCropRect );
}
- maBmpSaveList.emplace_back(new BSaveStruct(aBmp, aDestRect, nRasterOperation));
+ maBmpSaveList.emplace_back(aBmp, aDestRect, nRasterOperation);
}
}
break;
More information about the Libreoffice-commits
mailing list