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

sw: fix indentation in rtfsdrexport

Change-Id: I5499007c88659b2d235c765ba352e2bc4a8a3eb8
üst b05778b9
...@@ -33,18 +33,18 @@ ...@@ -33,18 +33,18 @@
using namespace sw::util; using namespace sw::util;
using namespace css; using namespace css;
RtfSdrExport::RtfSdrExport( RtfExport &rExport ) RtfSdrExport::RtfSdrExport(RtfExport& rExport)
: EscherEx( EscherExGlobalRef( new EscherExGlobal ), 0 ), : EscherEx(EscherExGlobalRef(new EscherExGlobal), 0),
m_rExport( rExport ), m_rExport(rExport),
m_rAttrOutput( (RtfAttributeOutput&)m_rExport.AttrOutput() ), m_rAttrOutput((RtfAttributeOutput&)m_rExport.AttrOutput()),
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_pShapeStyle(new OStringBuffer(200)),
m_pShapeTypeWritten( new bool[ ESCHER_ShpInst_COUNT ] ) m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ])
{ {
mnGroupLevel = 1; mnGroupLevel = 1;
memset( m_pShapeTypeWritten, 0, ESCHER_ShpInst_COUNT * sizeof( bool ) ); memset(m_pShapeTypeWritten, 0, ESCHER_ShpInst_COUNT * sizeof(bool));
} }
RtfSdrExport::~RtfSdrExport() RtfSdrExport::~RtfSdrExport()
...@@ -54,18 +54,18 @@ RtfSdrExport::~RtfSdrExport() ...@@ -54,18 +54,18 @@ RtfSdrExport::~RtfSdrExport()
delete[] m_pShapeTypeWritten, m_pShapeTypeWritten = NULL; delete[] m_pShapeTypeWritten, m_pShapeTypeWritten = NULL;
} }
void RtfSdrExport::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance ) void RtfSdrExport::OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance)
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
EscherEx::OpenContainer( nEscherContainer, nRecInstance ); EscherEx::OpenContainer(nEscherContainer, 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_pShapeStyle->isEmpty())
m_pShapeStyle->makeStringAndClear(); m_pShapeStyle->makeStringAndClear();
m_pShapeStyle->ensureCapacity( 200 ); m_pShapeStyle->ensureCapacity(200);
m_aShapeProps.clear(); m_aShapeProps.clear();
} }
} }
...@@ -74,11 +74,11 @@ void RtfSdrExport::CloseContainer() ...@@ -74,11 +74,11 @@ void RtfSdrExport::CloseContainer()
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
if ( mRecTypes.back() == ESCHER_SpContainer ) if (mRecTypes.back() == ESCHER_SpContainer)
{ {
// write the shape now when we have all the info // write the shape now when we have all the info
sal_Int32 nShapeElement = StartShape(); sal_Int32 nShapeElement = StartShape();
EndShape( nShapeElement ); EndShape(nShapeElement);
// cleanup // cleanup
m_nShapeType = ESCHER_ShpInst_Nil; m_nShapeType = ESCHER_ShpInst_Nil;
...@@ -87,7 +87,7 @@ void RtfSdrExport::CloseContainer() ...@@ -87,7 +87,7 @@ void RtfSdrExport::CloseContainer()
EscherEx::CloseContainer(); EscherEx::CloseContainer();
} }
sal_uInt32 RtfSdrExport::EnterGroup( const OUString& /*rShapeName*/, const Rectangle* /*pRect*/ ) sal_uInt32 RtfSdrExport::EnterGroup(const OUString& /*rShapeName*/, const Rectangle* /*pRect*/)
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
...@@ -101,7 +101,7 @@ void RtfSdrExport::LeaveGroup() ...@@ -101,7 +101,7 @@ void RtfSdrExport::LeaveGroup()
/* noop */ /* noop */
} }
void RtfSdrExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 /*nShapeId*/ ) void RtfSdrExport::AddShape(sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 /*nShapeId*/)
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
...@@ -109,30 +109,30 @@ void RtfSdrExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_ ...@@ -109,30 +109,30 @@ void RtfSdrExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_
m_nShapeFlags = nShapeFlags; m_nShapeFlags = nShapeFlags;
} }
inline sal_uInt16 impl_GetUInt16( const sal_uInt8* &pVal ) inline sal_uInt16 impl_GetUInt16(const sal_uInt8*& pVal)
{ {
sal_uInt16 nRet = *pVal++; sal_uInt16 nRet = *pVal++;
nRet += ( *pVal++ ) << 8; nRet += (*pVal++) << 8;
return nRet; return nRet;
} }
inline sal_Int32 impl_GetPointComponent( const sal_uInt8* &pVal, sal_Size& rVerticesPos, sal_uInt16 nPointSize ) inline sal_Int32 impl_GetPointComponent(const sal_uInt8*& pVal, sal_Size& rVerticesPos, sal_uInt16 nPointSize)
{ {
sal_Int32 nRet = 0; sal_Int32 nRet = 0;
if ( ( nPointSize == 0xfff0 ) || ( nPointSize == 4 ) ) if ((nPointSize == 0xfff0) || (nPointSize == 4))
{ {
sal_uInt16 nUnsigned = *pVal++; sal_uInt16 nUnsigned = *pVal++;
nUnsigned += ( *pVal++ ) << 8; nUnsigned += (*pVal++) << 8;
rVerticesPos += 2; rVerticesPos += 2;
nRet = sal_Int16( nUnsigned ); nRet = sal_Int16(nUnsigned);
} }
else if ( nPointSize == 8 ) else if (nPointSize == 8)
{ {
sal_uInt32 nUnsigned = *pVal++; sal_uInt32 nUnsigned = *pVal++;
nUnsigned += ( *pVal++ ) << 8; nUnsigned += (*pVal++) << 8;
nUnsigned += ( *pVal++ ) << 16; nUnsigned += (*pVal++) << 16;
nUnsigned += ( *pVal++ ) << 24; nUnsigned += (*pVal++) << 24;
rVerticesPos += 4; rVerticesPos += 4;
nRet = nUnsigned; nRet = nUnsigned;
...@@ -141,38 +141,48 @@ inline sal_Int32 impl_GetPointComponent( const sal_uInt8* &pVal, sal_Size& rVert ...@@ -141,38 +141,48 @@ inline sal_Int32 impl_GetPointComponent( const sal_uInt8* &pVal, sal_Size& rVert
return nRet; return nRet;
} }
void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ) void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRect)
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
if ( m_nShapeType == ESCHER_ShpInst_Nil ) if (m_nShapeType == ESCHER_ShpInst_Nil)
return; return;
if ( m_nShapeType == ESCHER_ShpInst_Line ) if (m_nShapeType == ESCHER_ShpInst_Line)
AddLineDimensions( rRect ); AddLineDimensions(rRect);
else else
AddRectangleDimensions( *m_pShapeStyle, rRect ); AddRectangleDimensions(*m_pShapeStyle, rRect);
// properties // properties
const EscherProperties &rOpts = rProps.GetOpts(); const EscherProperties& rOpts = rProps.GetOpts();
for ( EscherProperties::const_iterator it = rOpts.begin(); it != rOpts.end(); ++it ) for (EscherProperties::const_iterator it = rOpts.begin(); it != rOpts.end(); ++it)
{ {
sal_uInt16 nId = ( it->nPropId & 0x0FFF ); sal_uInt16 nId = (it->nPropId & 0x0FFF);
switch ( nId ) switch (nId)
{ {
case ESCHER_Prop_WrapText: case ESCHER_Prop_WrapText:
{ {
int nWrapType = 0; int nWrapType = 0;
switch ( it->nPropValue ) switch (it->nPropValue)
{ {
case ESCHER_WrapSquare: nWrapType = 2; break; case ESCHER_WrapSquare:
case ESCHER_WrapByPoints: nWrapType = 4; break; nWrapType = 2;
case ESCHER_WrapNone: nWrapType = 3; break; break;
case ESCHER_WrapTopBottom: nWrapType = 1; break; case ESCHER_WrapByPoints:
case ESCHER_WrapThrough: nWrapType = 5; break; nWrapType = 4;
break;
case ESCHER_WrapNone:
nWrapType = 3;
break;
case ESCHER_WrapTopBottom:
nWrapType = 1;
break;
case ESCHER_WrapThrough:
nWrapType = 5;
break;
} }
if ( nWrapType ) if (nWrapType)
m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType); m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType);
} }
break; break;
...@@ -191,7 +201,7 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe ...@@ -191,7 +201,7 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe
break; break;
case ESCHER_Prop_fNoLineDrawDash: case ESCHER_Prop_fNoLineDrawDash:
// for some reason the value is set to 0x90000 if lines are switched off // for some reason the value is set to 0x90000 if lines are switched off
if( it->nPropValue == 0x90000 ) if (it->nPropValue == 0x90000)
m_aShapeProps.insert(std::pair<OString,OString>("fLine", OString::number(0))); m_aShapeProps.insert(std::pair<OString,OString>("fLine", OString::number(0)));
break; break;
case ESCHER_Prop_lineColor: case ESCHER_Prop_lineColor:
...@@ -212,21 +222,21 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe ...@@ -212,21 +222,21 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe
{ {
sal_uInt32 nLeft = 0, nTop = 0; sal_uInt32 nLeft = 0, nTop = 0;
if ( nId == ESCHER_Prop_geoLeft ) if (nId == ESCHER_Prop_geoLeft)
{ {
nLeft = it->nPropValue; nLeft = it->nPropValue;
rProps.GetOpt( ESCHER_Prop_geoTop, nTop ); rProps.GetOpt(ESCHER_Prop_geoTop, nTop);
} }
else else
{ {
nTop = it->nPropValue; nTop = it->nPropValue;
rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft ); rProps.GetOpt(ESCHER_Prop_geoLeft, nLeft);
} }
m_aShapeProps.insert(std::pair<OString,OString>("geoLeft", m_aShapeProps.insert(std::pair<OString,OString>("geoLeft",
OString::number(sal_Int32( nLeft )))); OString::number(sal_Int32(nLeft))));
m_aShapeProps.insert(std::pair<OString,OString>("geoTop", m_aShapeProps.insert(std::pair<OString,OString>("geoTop",
OString::number(sal_Int32( nTop )))); OString::number(sal_Int32(nTop))));
} }
break; break;
...@@ -234,24 +244,24 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe ...@@ -234,24 +244,24 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe
case ESCHER_Prop_geoBottom: case ESCHER_Prop_geoBottom:
{ {
sal_uInt32 nLeft = 0, nRight = 0, nTop = 0, nBottom = 0; sal_uInt32 nLeft = 0, nRight = 0, nTop = 0, nBottom = 0;
rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft ); rProps.GetOpt(ESCHER_Prop_geoLeft, nLeft);
rProps.GetOpt( ESCHER_Prop_geoTop, nTop ); rProps.GetOpt(ESCHER_Prop_geoTop, nTop);
if ( nId == ESCHER_Prop_geoRight ) if (nId == ESCHER_Prop_geoRight)
{ {
nRight = it->nPropValue; nRight = it->nPropValue;
rProps.GetOpt( ESCHER_Prop_geoBottom, nBottom ); rProps.GetOpt(ESCHER_Prop_geoBottom, nBottom);
} }
else else
{ {
nBottom = it->nPropValue; nBottom = it->nPropValue;
rProps.GetOpt( ESCHER_Prop_geoRight, nRight ); rProps.GetOpt(ESCHER_Prop_geoRight, nRight);
} }
m_aShapeProps.insert(std::pair<OString,OString>("geoRight", m_aShapeProps.insert(std::pair<OString,OString>("geoRight",
OString::number(sal_Int32( nRight ) - sal_Int32( nLeft )))); OString::number(sal_Int32(nRight) - sal_Int32(nLeft))));
m_aShapeProps.insert(std::pair<OString,OString>("geoBottom", m_aShapeProps.insert(std::pair<OString,OString>("geoBottom",
OString::number(sal_Int32( nBottom ) - sal_Int32( nTop )))); OString::number(sal_Int32(nBottom) - sal_Int32(nTop))));
} }
break; break;
case ESCHER_Prop_pVertices: case ESCHER_Prop_pVertices:
...@@ -260,36 +270,36 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe ...@@ -260,36 +270,36 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe
EscherPropSortStruct aVertices; EscherPropSortStruct aVertices;
EscherPropSortStruct aSegments; EscherPropSortStruct aSegments;
if ( rProps.GetOpt( ESCHER_Prop_pVertices, aVertices ) && if (rProps.GetOpt(ESCHER_Prop_pVertices, aVertices) &&
rProps.GetOpt( ESCHER_Prop_pSegmentInfo, aSegments ) ) rProps.GetOpt(ESCHER_Prop_pSegmentInfo, aSegments))
{ {
const sal_uInt8 *pVerticesIt = aVertices.pBuf + 6; const sal_uInt8* pVerticesIt = aVertices.pBuf + 6;
sal_Size nVerticesPos = 6; sal_Size nVerticesPos = 6;
const sal_uInt8 *pSegmentIt = aSegments.pBuf; const sal_uInt8* pSegmentIt = aSegments.pBuf;
OStringBuffer aSegmentInfo( 512 ); OStringBuffer aSegmentInfo(512);
OStringBuffer aVerticies( 512 ); OStringBuffer aVerticies(512);
sal_uInt16 nPointSize = aVertices.pBuf[4] + ( aVertices.pBuf[5] << 8 ); sal_uInt16 nPointSize = aVertices.pBuf[4] + (aVertices.pBuf[5] << 8);
// number of segments // number of segments
sal_uInt16 nSegments = impl_GetUInt16( pSegmentIt ); sal_uInt16 nSegments = impl_GetUInt16(pSegmentIt);
sal_Int32 nVertices = 0; sal_Int32 nVertices = 0;
aSegmentInfo.append("2;").append((sal_Int32)nSegments); aSegmentInfo.append("2;").append((sal_Int32)nSegments);
pSegmentIt += 4; pSegmentIt += 4;
for ( ; nSegments; --nSegments ) for (; nSegments; --nSegments)
{ {
sal_uInt16 nSeg = impl_GetUInt16( pSegmentIt ); sal_uInt16 nSeg = impl_GetUInt16(pSegmentIt);
aSegmentInfo.append(';').append((sal_Int32)nSeg); aSegmentInfo.append(';').append((sal_Int32)nSeg);
switch ( nSeg ) switch (nSeg)
{ {
case 0x0001: // lineto case 0x0001: // lineto
case 0x4000: // moveto case 0x4000: // moveto
{ {
sal_Int32 nX = impl_GetPointComponent( pVerticesIt, nVerticesPos, nPointSize ); sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nVerticesPos, nPointSize ); sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
aVerticies.append( ";(" ).append( nX ).append( "," ).append( nY ).append( ")" ); aVerticies.append(";(").append(nX).append(",").append(nY).append(")");
nVertices ++; nVertices ++;
} }
break; break;
...@@ -297,9 +307,9 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe ...@@ -297,9 +307,9 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
sal_Int32 nX = impl_GetPointComponent( pVerticesIt, nVerticesPos, nPointSize ); sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nVerticesPos, nPointSize ); sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
aVerticies.append( ";(" ).append( nX ).append( "," ).append( nY ).append( ")" ); aVerticies.append(";(").append(nX).append(",").append(nY).append(")");
nVertices ++; nVertices ++;
} }
} }
...@@ -326,12 +336,12 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe ...@@ -326,12 +336,12 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe
} }
} }
if (!aVerticies.isEmpty() ) if (!aVerticies.isEmpty())
{ {
// We know the number of vertices at the end only, so we have to prepend them here. // We know the number of vertices at the end only, so we have to prepend them here.
m_aShapeProps.insert(std::pair<OString,OString>("pVerticies", "8;" + OString::number(nVertices) + aVerticies.makeStringAndClear())); m_aShapeProps.insert(std::pair<OString,OString>("pVerticies", "8;" + OString::number(nVertices) + aVerticies.makeStringAndClear()));
} }
if ( !aSegmentInfo.isEmpty() ) if (!aSegmentInfo.isEmpty())
m_aShapeProps.insert(std::pair<OString,OString>("pSegmentInfo", aSegmentInfo.makeStringAndClear())); m_aShapeProps.insert(std::pair<OString,OString>("pSegmentInfo", aSegmentInfo.makeStringAndClear()));
} }
else else
...@@ -389,14 +399,14 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe ...@@ -389,14 +399,14 @@ void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRe
} }
} }
void RtfSdrExport::AddLineDimensions( const Rectangle& rRectangle ) void RtfSdrExport::AddLineDimensions(const Rectangle& rRectangle)
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
// We get the position relative to (the current?) character // We get the position relative to (the current?) character
m_aShapeProps.insert(std::pair<OString,OString>("posrelh", "3")); m_aShapeProps.insert(std::pair<OString,OString>("posrelh", "3"));
switch ( m_nShapeFlags & 0xC0 ) switch (m_nShapeFlags & 0xC0)
{ {
case 0x40: case 0x40:
m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1")); m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1"));
...@@ -417,7 +427,7 @@ void RtfSdrExport::AddLineDimensions( const Rectangle& rRectangle ) ...@@ -417,7 +427,7 @@ void RtfSdrExport::AddLineDimensions( const Rectangle& rRectangle )
m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPBOTTOM).append(rRectangle.Bottom()); m_pShapeStyle->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)
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
...@@ -432,7 +442,7 @@ void RtfSdrExport::AddRectangleDimensions( OStringBuffer& rBuffer, const Rectang ...@@ -432,7 +442,7 @@ void RtfSdrExport::AddRectangleDimensions( OStringBuffer& rBuffer, const Rectang
extern const char* pShapeTypes[]; extern const char* pShapeTypes[];
static void lcl_AppendSP( OStringBuffer& rRunText, const char cName[], const OString& rValue) static void lcl_AppendSP(OStringBuffer& rRunText, const char cName[], const OString& rValue)
{ {
rRunText.append('{').append(OOO_STRING_SVTOOLS_RTF_SP) rRunText.append('{').append(OOO_STRING_SVTOOLS_RTF_SP)
.append('{').append(OOO_STRING_SVTOOLS_RTF_SN " ").append(cName).append('}') .append('{').append(OOO_STRING_SVTOOLS_RTF_SN " ").append(cName).append('}')
...@@ -483,7 +493,7 @@ sal_Int32 RtfSdrExport::StartShape() ...@@ -483,7 +493,7 @@ sal_Int32 RtfSdrExport::StartShape()
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
if ( m_nShapeType == ESCHER_ShpInst_Nil ) if (m_nShapeType == ESCHER_ShpInst_Nil)
return -1; return -1;
m_aShapeProps.insert(std::pair<OString,OString>("shapeType", OString::number(m_nShapeType))); m_aShapeProps.insert(std::pair<OString,OString>("shapeType", OString::number(m_nShapeType)));
...@@ -499,11 +509,11 @@ sal_Int32 RtfSdrExport::StartShape() ...@@ -499,11 +509,11 @@ sal_Int32 RtfSdrExport::StartShape()
// Ignore \shpbypage, \shpbymargin, and \shpbycolumn, in favor of the posrelh property. // Ignore \shpbypage, \shpbymargin, and \shpbycolumn, in favor of the posrelh property.
m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE); m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE);
for(std::map<OString,OString>::reverse_iterator i = m_aShapeProps.rbegin(); i != m_aShapeProps.rend(); ++i) for (std::map<OString,OString>::reverse_iterator i = m_aShapeProps.rbegin(); i != m_aShapeProps.rend(); ++i)
lcl_AppendSP(m_rAttrOutput.RunText(), (*i).first.getStr(), (*i).second ); lcl_AppendSP(m_rAttrOutput.RunText(), (*i).first.getStr(), (*i).second);
lcl_AppendSP(m_rAttrOutput.RunText(), "wzDescription", msfilter::rtfutil::OutString( m_pSdrObject->GetDescription(), m_rExport.eCurrentEncoding)); lcl_AppendSP(m_rAttrOutput.RunText(), "wzDescription", msfilter::rtfutil::OutString(m_pSdrObject->GetDescription(), m_rExport.eCurrentEncoding));
lcl_AppendSP(m_rAttrOutput.RunText(), "wzName", msfilter::rtfutil::OutString( m_pSdrObject->GetTitle(), m_rExport.eCurrentEncoding)); lcl_AppendSP(m_rAttrOutput.RunText(), "wzName", msfilter::rtfutil::OutString(m_pSdrObject->GetTitle(), m_rExport.eCurrentEncoding));
// now check if we have some text // now check if we have some text
const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject); const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject);
...@@ -527,11 +537,11 @@ sal_Int32 RtfSdrExport::StartShape() ...@@ -527,11 +537,11 @@ sal_Int32 RtfSdrExport::StartShape()
pParaObj = pTxtObj->GetOutlinerParaObject(); pParaObj = pTxtObj->GetOutlinerParaObject();
} }
if( pParaObj ) if (pParaObj)
{ {
// this is reached only in case some text is attached to the shape // this is reached only in case some text is attached to the shape
WriteOutliner(*pParaObj); WriteOutliner(*pParaObj);
if( bOwnParaObj ) if (bOwnParaObj)
delete pParaObj; delete pParaObj;
} }
} }
...@@ -544,36 +554,37 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj) ...@@ -544,36 +554,37 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj)
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start"); SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start");
const EditTextObject& rEditObj = rParaObj.GetTextObject(); const EditTextObject& rEditObj = rParaObj.GetTextObject();
MSWord_SdrAttrIter aAttrIter( m_rExport, rEditObj, TXT_HFTXTBOX ); MSWord_SdrAttrIter aAttrIter(m_rExport, rEditObj, TXT_HFTXTBOX);
sal_Int32 nPara = rEditObj.GetParagraphCount(); sal_Int32 nPara = rEditObj.GetParagraphCount();
m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SHPTXT).append(' '); m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SHPTXT).append(' ');
for (sal_Int32 n = 0; n < nPara; ++n) for (sal_Int32 n = 0; n < nPara; ++n)
{ {
if( n ) if (n)
aAttrIter.NextPara( n ); aAttrIter.NextPara(n);
rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet(); rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet();
OUString aStr( rEditObj.GetText( n )); OUString aStr(rEditObj.GetText(n));
sal_Int32 nAktPos = 0; sal_Int32 nAktPos = 0;
const sal_Int32 nEnd = aStr.getLength(); const sal_Int32 nEnd = aStr.getLength();
aAttrIter.OutParaAttr(false); aAttrIter.OutParaAttr(false);
m_rAttrOutput.RunText().append(m_rAttrOutput.Styles().makeStringAndClear()); m_rAttrOutput.RunText().append(m_rAttrOutput.Styles().makeStringAndClear());
do { do
{
const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd); const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet(); rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet();
aAttrIter.OutAttr( nAktPos ); aAttrIter.OutAttr(nAktPos);
m_rAttrOutput.RunText().append('{').append(m_rAttrOutput.Styles().makeStringAndClear()).append(SAL_NEWLINE_STRING); m_rAttrOutput.RunText().append('{').append(m_rAttrOutput.Styles().makeStringAndClear()).append(SAL_NEWLINE_STRING);
bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos ); bool bTxtAtr = aAttrIter.IsTxtAttr(nAktPos);
if( !bTxtAtr ) if (!bTxtAtr)
{ {
OUString aOut( aStr.copy( nAktPos, nNextAttr - nAktPos ) ); OUString aOut(aStr.copy(nAktPos, nNextAttr - nAktPos));
m_rAttrOutput.RunText().append( msfilter::rtfutil::OutString( aOut, eChrSet ) ); m_rAttrOutput.RunText().append(msfilter::rtfutil::OutString(aOut, eChrSet));
} }
m_rAttrOutput.RunText().append('}'); m_rAttrOutput.RunText().append('}');
...@@ -582,25 +593,25 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj) ...@@ -582,25 +593,25 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj)
eChrSet = eNextChrSet; eChrSet = eNextChrSet;
aAttrIter.NextPos(); aAttrIter.NextPos();
} }
while( nAktPos < nEnd ); while (nAktPos < nEnd);
} }
m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_PAR).append('}'); m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_PAR).append('}');
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " end"); SAL_INFO("sw.rtf", OSL_THIS_FUNC << " end");
} }
void RtfSdrExport::EndShape( sal_Int32 nShapeElement ) void RtfSdrExport::EndShape(sal_Int32 nShapeElement)
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC); SAL_INFO("sw.rtf", OSL_THIS_FUNC);
if ( nShapeElement >= 0 ) if (nShapeElement >= 0)
{ {
// end of the shape // end of the shape
m_rAttrOutput.RunText().append('}').append('}'); m_rAttrOutput.RunText().append('}').append('}');
} }
} }
sal_uInt32 RtfSdrExport::AddSdrObject( const SdrObject& rObj ) sal_uInt32 RtfSdrExport::AddSdrObject(const SdrObject& rObj)
{ {
m_pSdrObject = &rObj; m_pSdrObject = &rObj;
return EscherEx::AddSdrObject(rObj); return EscherEx::AddSdrObject(rObj);
......
...@@ -32,9 +32,9 @@ class RtfAttributeOutput; ...@@ -32,9 +32,9 @@ class RtfAttributeOutput;
/// Handles export of drawings using RTF markup /// Handles export of drawings using RTF markup
class RtfSdrExport : public EscherEx class RtfSdrExport : public EscherEx
{ {
RtfExport &m_rExport; RtfExport& m_rExport;
RtfAttributeOutput &m_rAttrOutput; RtfAttributeOutput& m_rAttrOutput;
const SdrObject* m_pSdrObject; const SdrObject* m_pSdrObject;
...@@ -45,21 +45,21 @@ class RtfSdrExport : public EscherEx ...@@ -45,21 +45,21 @@ 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_pShapeStyle;
std::map<OString,OString> m_aShapeProps; std::map<OString,OString> m_aShapeProps;
/// Remember which shape types we had already written. /// Remember which shape types we had already written.
bool *m_pShapeTypeWritten; bool* m_pShapeTypeWritten;
public: public:
RtfSdrExport( RtfExport &rExport ); RtfSdrExport(RtfExport& rExport);
virtual ~RtfSdrExport(); virtual ~RtfSdrExport();
/// Export the sdr object as Sdr. /// Export the sdr object as Sdr.
/// ///
/// Call this when you need to export the object as Sdr in RTF. /// Call this when you need to export the object as Sdr in RTF.
sal_uInt32 AddSdrObject( const SdrObject& rObj ); sal_uInt32 AddSdrObject(const SdrObject& rObj);
protected: protected:
/// Start the shape for which we just collected the information. /// Start the shape for which we just collected the information.
...@@ -72,26 +72,26 @@ protected: ...@@ -72,26 +72,26 @@ protected:
/// ///
/// The parameter is just what we got from StartShape(). /// The parameter is just what we got from StartShape().
using EscherEx::EndShape; using EscherEx::EndShape;
void EndShape( sal_Int32 nShapeElement ); void EndShape(sal_Int32 nShapeElement);
virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Commit(EscherPropertyContainer& rProps, const Rectangle& rRect) SAL_OVERRIDE;
private: private:
virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 ) SAL_OVERRIDE; virtual void OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance = 0) SAL_OVERRIDE;
virtual void CloseContainer() SAL_OVERRIDE; virtual void CloseContainer() SAL_OVERRIDE;
virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 ) SAL_OVERRIDE; virtual sal_uInt32 EnterGroup(const OUString& rShapeName, const Rectangle* pBoundRect = 0) SAL_OVERRIDE;
virtual void LeaveGroup() SAL_OVERRIDE; virtual void LeaveGroup() SAL_OVERRIDE;
virtual void AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 nShapeId = 0 ) SAL_OVERRIDE; virtual void AddShape(sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 nShapeId = 0) SAL_OVERRIDE;
private: private:
/// Add starting and ending point of a line to the m_pShapeAttrList. /// Add starting and ending point of a line to the m_pShapeAttrList.
void AddLineDimensions( const Rectangle& rRectangle ); void AddLineDimensions(const Rectangle& rRectangle);
/// Add position and size to the OStringBuffer. /// Add position and size to the OStringBuffer.
void AddRectangleDimensions( OStringBuffer& rBuffer, const Rectangle& rRectangle ); void AddRectangleDimensions(OStringBuffer& rBuffer, const Rectangle& rRectangle);
void WriteOutliner(const OutlinerParaObject& rParaObj); void WriteOutliner(const OutlinerParaObject& rParaObj);
......
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