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

RtfSdrExport: no need to allocate m_pShapeStyle dynamically

Change-Id: I429c876c4e0bba04e39c806670a828178ca811ef
üst 7082fcb4
...@@ -38,7 +38,7 @@ RtfSdrExport::RtfSdrExport(RtfExport& rExport) ...@@ -38,7 +38,7 @@ RtfSdrExport::RtfSdrExport(RtfExport& rExport)
m_pSdrObject(NULL), m_pSdrObject(NULL),
m_nShapeType(ESCHER_ShpInst_Nil), m_nShapeType(ESCHER_ShpInst_Nil),
m_nShapeFlags(0) , m_nShapeFlags(0) ,
m_pShapeStyle(new OStringBuffer(200)), m_aShapeStyle(200),
m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ]), m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ]),
m_aTextBoxes(SwTextBoxHelper::findTextBoxes(m_rExport.pDoc)) m_aTextBoxes(SwTextBoxHelper::findTextBoxes(m_rExport.pDoc))
{ {
...@@ -49,7 +49,6 @@ RtfSdrExport::RtfSdrExport(RtfExport& rExport) ...@@ -49,7 +49,6 @@ RtfSdrExport::RtfSdrExport(RtfExport& rExport)
RtfSdrExport::~RtfSdrExport() RtfSdrExport::~RtfSdrExport()
{ {
delete mpOutStrm, mpOutStrm = NULL; delete mpOutStrm, mpOutStrm = NULL;
delete m_pShapeStyle, m_pShapeStyle = NULL;
delete[] m_pShapeTypeWritten, m_pShapeTypeWritten = NULL; delete[] m_pShapeTypeWritten, m_pShapeTypeWritten = NULL;
} }
...@@ -60,9 +59,9 @@ void RtfSdrExport::OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance) ...@@ -60,9 +59,9 @@ void RtfSdrExport::OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance)
if (nEscherContainer == ESCHER_SpContainer) if (nEscherContainer == ESCHER_SpContainer)
{ {
m_nShapeType = ESCHER_ShpInst_Nil; m_nShapeType = ESCHER_ShpInst_Nil;
if (!m_pShapeStyle->isEmpty()) if (!m_aShapeStyle.isEmpty())
m_pShapeStyle->makeStringAndClear(); m_aShapeStyle.makeStringAndClear();
m_pShapeStyle->ensureCapacity(200); m_aShapeStyle.ensureCapacity(200);
m_aShapeProps.clear(); m_aShapeProps.clear();
} }
} }
...@@ -138,7 +137,7 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec ...@@ -138,7 +137,7 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec
if (m_nShapeType == ESCHER_ShpInst_Line) if (m_nShapeType == ESCHER_ShpInst_Line)
AddLineDimensions(rRect); AddLineDimensions(rRect);
else else
AddRectangleDimensions(*m_pShapeStyle, rRect); AddRectangleDimensions(m_aShapeStyle, rRect);
// properties // properties
const EscherProperties& rOpts = rProps.GetOpts(); const EscherProperties& rOpts = rProps.GetOpts();
...@@ -170,7 +169,7 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec ...@@ -170,7 +169,7 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec
break; break;
} }
if (nWrapType) if (nWrapType)
m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType); m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType);
} }
break; break;
case ESCHER_Prop_fillColor: case ESCHER_Prop_fillColor:
...@@ -407,10 +406,10 @@ void RtfSdrExport::AddLineDimensions(const Rectangle& rRectangle) ...@@ -407,10 +406,10 @@ void RtfSdrExport::AddLineDimensions(const Rectangle& rRectangle)
} }
// the actual dimensions // the actual dimensions
m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPLEFT).append(rRectangle.Left()); m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPLEFT).append(rRectangle.Left());
m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPTOP).append(rRectangle.Top()); m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPTOP).append(rRectangle.Top());
m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPRIGHT).append(rRectangle.Right()); m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPRIGHT).append(rRectangle.Right());
m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPBOTTOM).append(rRectangle.Bottom()); m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPBOTTOM).append(rRectangle.Bottom());
} }
void RtfSdrExport::AddRectangleDimensions(OStringBuffer& rBuffer, const Rectangle& rRectangle) void RtfSdrExport::AddRectangleDimensions(OStringBuffer& rBuffer, const Rectangle& rRectangle)
...@@ -484,7 +483,7 @@ sal_Int32 RtfSdrExport::StartShape() ...@@ -484,7 +483,7 @@ sal_Int32 RtfSdrExport::StartShape()
m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SHP); m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SHP);
m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_IGNORE).append(OOO_STRING_SVTOOLS_RTF_SHPINST); m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_IGNORE).append(OOO_STRING_SVTOOLS_RTF_SHPINST);
m_rAttrOutput.RunText().append(m_pShapeStyle->makeStringAndClear()); m_rAttrOutput.RunText().append(m_aShapeStyle.makeStringAndClear());
// Ignore \shpbxpage, \shpbxmargin, and \shpbxcolumn, in favor of the posrelh property. // Ignore \shpbxpage, \shpbxmargin, and \shpbxcolumn, in favor of the posrelh property.
m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE); m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE);
// Ignore \shpbypage, \shpbymargin, and \shpbycolumn, in favor of the posrelh property. // Ignore \shpbypage, \shpbymargin, and \shpbycolumn, in favor of the posrelh property.
......
...@@ -47,7 +47,7 @@ class RtfSdrExport : public EscherEx ...@@ -47,7 +47,7 @@ class RtfSdrExport : public EscherEx
sal_uInt32 m_nShapeFlags; sal_uInt32 m_nShapeFlags;
/// Remember style, the most important shape attribute ;-) /// Remember style, the most important shape attribute ;-)
OStringBuffer* m_pShapeStyle; OStringBuffer m_aShapeStyle;
std::map<OString,OString> m_aShapeProps; std::map<OString,OString> m_aShapeProps;
......
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