Kaydet (Commit) 0af2e9fa authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: manual memory management -> boost::optional in PropertyMap

Change-Id: Ie8f7ce11ab03d47835cfe224c775324dd79a5e7a
üst 780dd8c1
......@@ -432,7 +432,6 @@ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
{
static sal_Int32 nNumber = 0;
nSectionNumber = nNumber++;
memset(&m_pBorderLines, 0x00, sizeof(m_pBorderLines));
for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder )
{
m_nBorderDistances[ nBorder ] = -1;
......@@ -471,8 +470,6 @@ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
SectionPropertyMap::~SectionPropertyMap()
{
for( sal_Int16 ePos = BORDER_LEFT; ePos <= BORDER_BOTTOM; ++ePos)
delete m_pBorderLines[ePos];
}
......@@ -564,8 +561,7 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
void SectionPropertyMap::SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const table::BorderLine2& rBorderLine, bool bShadow )
{
delete m_pBorderLines[ePos];
m_pBorderLines[ePos] = new table::BorderLine2( rBorderLine );
m_oBorderLines[ePos] = rBorderLine;
m_nBorderDistances[ePos] = nLineDistance;
m_bBorderShadows[ePos] = bShadow;
}
......@@ -639,19 +635,19 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
{
if( m_pBorderLines[nBorder] )
if( m_oBorderLines[nBorder] )
{
const OUString sBorderName = getPropertyName( aBorderIds[nBorder] );
if (xFirst.is())
xFirst->setPropertyValue( sBorderName, uno::makeAny( *m_pBorderLines[nBorder] ));
xFirst->setPropertyValue( sBorderName, uno::makeAny( *m_oBorderLines[nBorder] ));
if(xSecond.is())
xSecond->setPropertyValue( sBorderName, uno::makeAny( *m_pBorderLines[nBorder] ));
xSecond->setPropertyValue( sBorderName, uno::makeAny( *m_oBorderLines[nBorder] ));
}
if( m_nBorderDistances[nBorder] >= 0 )
{
sal_uInt32 nLineWidth = 0;
if (m_pBorderLines[nBorder])
nLineWidth = m_pBorderLines[nBorder]->LineWidth;
if (m_oBorderLines[nBorder])
nLineWidth = m_oBorderLines[nBorder]->LineWidth;
if(xFirst.is())
SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
......@@ -663,7 +659,7 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
if (m_bBorderShadows[BORDER_RIGHT])
{
table::ShadowFormat aFormat = getShadowFromBorder(*m_pBorderLines[BORDER_RIGHT]);
table::ShadowFormat aFormat = getShadowFromBorder(*m_oBorderLines[BORDER_RIGHT]);
if (xFirst.is())
xFirst->setPropertyValue(getPropertyName(PROP_SHADOW_FORMAT), uno::makeAny(aFormat));
if (xSecond.is())
......
......@@ -23,6 +23,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/uno/Any.h>
#include "PropertyIds.hxx"
#include <memory>
......@@ -190,7 +191,7 @@ class SectionPropertyMap : public PropertyMap
css::uno::Reference<css::beans::XPropertySet> m_aFirstPageStyle;
css::uno::Reference<css::beans::XPropertySet> m_aFollowPageStyle;
css::table::BorderLine2* m_pBorderLines[4];
boost::optional<css::table::BorderLine2> m_oBorderLines[4];
sal_Int32 m_nBorderDistances[4];
sal_Int32 m_nBorderParams;
bool m_bBorderShadows[4];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment