summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/rtfsdrexport.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-05-11 18:24:44 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-05-11 18:46:41 +0200
commit1a4d24b3a430ed7f75e76e64fb0e22d05a1fad0d (patch)
tree8a7fe6949df55191161641c45c81fb55f96ef2d2 /sw/source/filter/ww8/rtfsdrexport.cxx
parentb05778b9c0e21e3b8fd9d8baa03864e6f0b9b407 (diff)
sw: fix indentation in rtfsdrexport
Change-Id: I5499007c88659b2d235c765ba352e2bc4a8a3eb8
Diffstat (limited to 'sw/source/filter/ww8/rtfsdrexport.cxx')
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx565
1 files changed, 288 insertions, 277 deletions
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index c64629c36bf3..34fa98e2ef04 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -33,18 +33,18 @@
using namespace sw::util;
using namespace css;
-RtfSdrExport::RtfSdrExport( RtfExport &rExport )
- : EscherEx( EscherExGlobalRef( new EscherExGlobal ), 0 ),
- m_rExport( rExport ),
- m_rAttrOutput( (RtfAttributeOutput&)m_rExport.AttrOutput() ),
- m_pSdrObject( NULL ),
- m_nShapeType( ESCHER_ShpInst_Nil ),
- m_nShapeFlags ( 0 ) ,
- m_pShapeStyle( new OStringBuffer( 200 ) ),
- m_pShapeTypeWritten( new bool[ ESCHER_ShpInst_COUNT ] )
+RtfSdrExport::RtfSdrExport(RtfExport& rExport)
+ : EscherEx(EscherExGlobalRef(new EscherExGlobal), 0),
+ m_rExport(rExport),
+ m_rAttrOutput((RtfAttributeOutput&)m_rExport.AttrOutput()),
+ m_pSdrObject(NULL),
+ m_nShapeType(ESCHER_ShpInst_Nil),
+ m_nShapeFlags(0) ,
+ m_pShapeStyle(new OStringBuffer(200)),
+ m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ])
{
mnGroupLevel = 1;
- memset( m_pShapeTypeWritten, 0, ESCHER_ShpInst_COUNT * sizeof( bool ) );
+ memset(m_pShapeTypeWritten, 0, ESCHER_ShpInst_COUNT * sizeof(bool));
}
RtfSdrExport::~RtfSdrExport()
@@ -54,18 +54,18 @@ RtfSdrExport::~RtfSdrExport()
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);
- EscherEx::OpenContainer( nEscherContainer, nRecInstance );
+ EscherEx::OpenContainer(nEscherContainer, nRecInstance);
- if ( nEscherContainer == ESCHER_SpContainer )
+ if (nEscherContainer == ESCHER_SpContainer)
{
m_nShapeType = ESCHER_ShpInst_Nil;
- if ( !m_pShapeStyle->isEmpty() )
+ if (!m_pShapeStyle->isEmpty())
m_pShapeStyle->makeStringAndClear();
- m_pShapeStyle->ensureCapacity( 200 );
+ m_pShapeStyle->ensureCapacity(200);
m_aShapeProps.clear();
}
}
@@ -74,11 +74,11 @@ void RtfSdrExport::CloseContainer()
{
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
sal_Int32 nShapeElement = StartShape();
- EndShape( nShapeElement );
+ EndShape(nShapeElement);
// cleanup
m_nShapeType = ESCHER_ShpInst_Nil;
@@ -87,7 +87,7 @@ void RtfSdrExport::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);
@@ -101,7 +101,7 @@ void RtfSdrExport::LeaveGroup()
/* 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);
@@ -109,30 +109,30 @@ void RtfSdrExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_
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++;
- nRet += ( *pVal++ ) << 8;
+ nRet += (*pVal++) << 8;
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;
- if ( ( nPointSize == 0xfff0 ) || ( nPointSize == 4 ) )
+ if ((nPointSize == 0xfff0) || (nPointSize == 4))
{
sal_uInt16 nUnsigned = *pVal++;
- nUnsigned += ( *pVal++ ) << 8;
+ nUnsigned += (*pVal++) << 8;
rVerticesPos += 2;
- nRet = sal_Int16( nUnsigned );
+ nRet = sal_Int16(nUnsigned);
}
- else if ( nPointSize == 8 )
+ else if (nPointSize == 8)
{
sal_uInt32 nUnsigned = *pVal++;
- nUnsigned += ( *pVal++ ) << 8;
- nUnsigned += ( *pVal++ ) << 16;
- nUnsigned += ( *pVal++ ) << 24;
+ nUnsigned += (*pVal++) << 8;
+ nUnsigned += (*pVal++) << 16;
+ nUnsigned += (*pVal++) << 24;
rVerticesPos += 4;
nRet = nUnsigned;
@@ -141,273 +141,283 @@ inline sal_Int32 impl_GetPointComponent( const sal_uInt8* &pVal, sal_Size& rVert
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);
- if ( m_nShapeType == ESCHER_ShpInst_Nil )
+ if (m_nShapeType == ESCHER_ShpInst_Nil)
return;
- if ( m_nShapeType == ESCHER_ShpInst_Line )
- AddLineDimensions( rRect );
+ if (m_nShapeType == ESCHER_ShpInst_Line)
+ AddLineDimensions(rRect);
else
- AddRectangleDimensions( *m_pShapeStyle, rRect );
+ AddRectangleDimensions(*m_pShapeStyle, rRect);
// properties
- const EscherProperties &rOpts = rProps.GetOpts();
- for ( EscherProperties::const_iterator it = rOpts.begin(); it != rOpts.end(); ++it )
+ const EscherProperties& rOpts = rProps.GetOpts();
+ 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:
- {
- int nWrapType = 0;
- switch ( it->nPropValue )
- {
- case ESCHER_WrapSquare: nWrapType = 2; break;
- case ESCHER_WrapByPoints: nWrapType = 4; break;
- case ESCHER_WrapNone: nWrapType = 3; break;
- case ESCHER_WrapTopBottom: nWrapType = 1; break;
- case ESCHER_WrapThrough: nWrapType = 5; break;
- }
- if ( nWrapType )
- m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType);
- }
- break;
- case ESCHER_Prop_fillColor:
- m_aShapeProps.insert(std::pair<OString,OString>("fillColor", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_fillBackColor:
- m_aShapeProps.insert(std::pair<OString,OString>("fillBackColor", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_AnchorText:
- m_aShapeProps.insert(std::pair<OString,OString>("anchorText", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_fNoFillHitTest:
- if (it->nPropValue)
- m_aShapeProps.insert(std::pair<OString,OString>("fNoFillHitTest", OString::number(1)));
- break;
- case ESCHER_Prop_fNoLineDrawDash:
- // for some reason the value is set to 0x90000 if lines are switched off
- if( it->nPropValue == 0x90000 )
- m_aShapeProps.insert(std::pair<OString,OString>("fLine", OString::number(0)));
+ case ESCHER_Prop_WrapText:
+ {
+ int nWrapType = 0;
+ switch (it->nPropValue)
+ {
+ case ESCHER_WrapSquare:
+ nWrapType = 2;
break;
- case ESCHER_Prop_lineColor:
- m_aShapeProps.insert(std::pair<OString,OString>("lineColor", OString::number(it->nPropValue)));
+ case ESCHER_WrapByPoints:
+ nWrapType = 4;
break;
- case ESCHER_Prop_lineBackColor:
- m_aShapeProps.insert(std::pair<OString,OString>("lineBackColor", OString::number(it->nPropValue)));
+ case ESCHER_WrapNone:
+ nWrapType = 3;
break;
- case ESCHER_Prop_lineJoinStyle:
- m_aShapeProps.insert(std::pair<OString,OString>("lineJoinStyle", OString::number(it->nPropValue)));
+ case ESCHER_WrapTopBottom:
+ nWrapType = 1;
break;
- case ESCHER_Prop_fshadowObscured:
- if (it->nPropValue)
- m_aShapeProps.insert(std::pair<OString,OString>("fshadowObscured", "1"));
+ case ESCHER_WrapThrough:
+ nWrapType = 5;
break;
- case ESCHER_Prop_geoLeft:
- case ESCHER_Prop_geoTop:
- {
- sal_uInt32 nLeft = 0, nTop = 0;
+ }
+ if (nWrapType)
+ m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType);
+ }
+ break;
+ case ESCHER_Prop_fillColor:
+ m_aShapeProps.insert(std::pair<OString,OString>("fillColor", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_fillBackColor:
+ m_aShapeProps.insert(std::pair<OString,OString>("fillBackColor", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_AnchorText:
+ m_aShapeProps.insert(std::pair<OString,OString>("anchorText", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_fNoFillHitTest:
+ if (it->nPropValue)
+ m_aShapeProps.insert(std::pair<OString,OString>("fNoFillHitTest", OString::number(1)));
+ break;
+ case ESCHER_Prop_fNoLineDrawDash:
+ // for some reason the value is set to 0x90000 if lines are switched off
+ if (it->nPropValue == 0x90000)
+ m_aShapeProps.insert(std::pair<OString,OString>("fLine", OString::number(0)));
+ break;
+ case ESCHER_Prop_lineColor:
+ m_aShapeProps.insert(std::pair<OString,OString>("lineColor", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_lineBackColor:
+ m_aShapeProps.insert(std::pair<OString,OString>("lineBackColor", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_lineJoinStyle:
+ m_aShapeProps.insert(std::pair<OString,OString>("lineJoinStyle", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_fshadowObscured:
+ if (it->nPropValue)
+ m_aShapeProps.insert(std::pair<OString,OString>("fshadowObscured", "1"));
+ break;
+ case ESCHER_Prop_geoLeft:
+ case ESCHER_Prop_geoTop:
+ {
+ sal_uInt32 nLeft = 0, nTop = 0;
- if ( nId == ESCHER_Prop_geoLeft )
- {
- nLeft = it->nPropValue;
- rProps.GetOpt( ESCHER_Prop_geoTop, nTop );
- }
- else
- {
- nTop = it->nPropValue;
- rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft );
- }
+ if (nId == ESCHER_Prop_geoLeft)
+ {
+ nLeft = it->nPropValue;
+ rProps.GetOpt(ESCHER_Prop_geoTop, nTop);
+ }
+ else
+ {
+ nTop = it->nPropValue;
+ rProps.GetOpt(ESCHER_Prop_geoLeft, nLeft);
+ }
- m_aShapeProps.insert(std::pair<OString,OString>("geoLeft",
- OString::number(sal_Int32( nLeft ))));
- m_aShapeProps.insert(std::pair<OString,OString>("geoTop",
- OString::number(sal_Int32( nTop ))));
- }
- break;
+ m_aShapeProps.insert(std::pair<OString,OString>("geoLeft",
+ OString::number(sal_Int32(nLeft))));
+ m_aShapeProps.insert(std::pair<OString,OString>("geoTop",
+ OString::number(sal_Int32(nTop))));
+ }
+ break;
- case ESCHER_Prop_geoRight:
- case ESCHER_Prop_geoBottom:
- {
- sal_uInt32 nLeft = 0, nRight = 0, nTop = 0, nBottom = 0;
- rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft );
- rProps.GetOpt( ESCHER_Prop_geoTop, nTop );
+ case ESCHER_Prop_geoRight:
+ case ESCHER_Prop_geoBottom:
+ {
+ sal_uInt32 nLeft = 0, nRight = 0, nTop = 0, nBottom = 0;
+ rProps.GetOpt(ESCHER_Prop_geoLeft, nLeft);
+ rProps.GetOpt(ESCHER_Prop_geoTop, nTop);
- if ( nId == ESCHER_Prop_geoRight )
- {
- nRight = it->nPropValue;
- rProps.GetOpt( ESCHER_Prop_geoBottom, nBottom );
- }
- else
- {
- nBottom = it->nPropValue;
- rProps.GetOpt( ESCHER_Prop_geoRight, nRight );
- }
+ if (nId == ESCHER_Prop_geoRight)
+ {
+ nRight = it->nPropValue;
+ rProps.GetOpt(ESCHER_Prop_geoBottom, nBottom);
+ }
+ else
+ {
+ nBottom = it->nPropValue;
+ rProps.GetOpt(ESCHER_Prop_geoRight, nRight);
+ }
- m_aShapeProps.insert(std::pair<OString,OString>("geoRight",
- OString::number(sal_Int32( nRight ) - sal_Int32( nLeft ))));
- m_aShapeProps.insert(std::pair<OString,OString>("geoBottom",
- OString::number(sal_Int32( nBottom ) - sal_Int32( nTop ))));
- }
- break;
- case ESCHER_Prop_pVertices:
- case ESCHER_Prop_pSegmentInfo:
- {
- EscherPropSortStruct aVertices;
- EscherPropSortStruct aSegments;
+ m_aShapeProps.insert(std::pair<OString,OString>("geoRight",
+ OString::number(sal_Int32(nRight) - sal_Int32(nLeft))));
+ m_aShapeProps.insert(std::pair<OString,OString>("geoBottom",
+ OString::number(sal_Int32(nBottom) - sal_Int32(nTop))));
+ }
+ break;
+ case ESCHER_Prop_pVertices:
+ case ESCHER_Prop_pSegmentInfo:
+ {
+ EscherPropSortStruct aVertices;
+ EscherPropSortStruct aSegments;
- if ( rProps.GetOpt( ESCHER_Prop_pVertices, aVertices ) &&
- rProps.GetOpt( ESCHER_Prop_pSegmentInfo, aSegments ) )
- {
- const sal_uInt8 *pVerticesIt = aVertices.pBuf + 6;
- sal_Size nVerticesPos = 6;
- const sal_uInt8 *pSegmentIt = aSegments.pBuf;
+ if (rProps.GetOpt(ESCHER_Prop_pVertices, aVertices) &&
+ rProps.GetOpt(ESCHER_Prop_pSegmentInfo, aSegments))
+ {
+ const sal_uInt8* pVerticesIt = aVertices.pBuf + 6;
+ sal_Size nVerticesPos = 6;
+ const sal_uInt8* pSegmentIt = aSegments.pBuf;
- OStringBuffer aSegmentInfo( 512 );
- OStringBuffer aVerticies( 512 );
+ OStringBuffer aSegmentInfo(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
- sal_uInt16 nSegments = impl_GetUInt16( pSegmentIt );
- sal_Int32 nVertices = 0;
- aSegmentInfo.append("2;").append((sal_Int32)nSegments);
- pSegmentIt += 4;
+ // number of segments
+ sal_uInt16 nSegments = impl_GetUInt16(pSegmentIt);
+ sal_Int32 nVertices = 0;
+ aSegmentInfo.append("2;").append((sal_Int32)nSegments);
+ pSegmentIt += 4;
- for ( ; nSegments; --nSegments )
+ for (; nSegments; --nSegments)
+ {
+ sal_uInt16 nSeg = impl_GetUInt16(pSegmentIt);
+ aSegmentInfo.append(';').append((sal_Int32)nSeg);
+ switch (nSeg)
+ {
+ case 0x0001: // lineto
+ case 0x4000: // moveto
+ {
+ sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
+ sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
+ aVerticies.append(";(").append(nX).append(",").append(nY).append(")");
+ nVertices ++;
+ }
+ break;
+ case 0x2001: // curveto
+ {
+ for (int i = 0; i < 3; i++)
{
- sal_uInt16 nSeg = impl_GetUInt16( pSegmentIt );
- aSegmentInfo.append(';').append((sal_Int32)nSeg);
- switch ( nSeg )
- {
- case 0x0001: // lineto
- case 0x4000: // moveto
- {
- sal_Int32 nX = impl_GetPointComponent( pVerticesIt, nVerticesPos, nPointSize );
- sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nVerticesPos, nPointSize );
- aVerticies.append( ";(" ).append( nX ).append( "," ).append( nY ).append( ")" );
- nVertices ++;
- }
- break;
- case 0x2001: // curveto
- {
- for (int i = 0; i < 3; i++)
- {
- sal_Int32 nX = impl_GetPointComponent( pVerticesIt, nVerticesPos, nPointSize );
- sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nVerticesPos, nPointSize );
- aVerticies.append( ";(" ).append( nX ).append( "," ).append( nY ).append( ")" );
- nVertices ++;
- }
- }
- break;
- case 0xb300:
- case 0xac00:
- case 0xaa00: // nofill
- case 0xab00: // nostroke
- case 0x6001: // close
- case 0x8000: // end
- break;
- default:
- // See EscherPropertyContainer::CreateCustomShapeProperties, by default nSeg is simply the number of points.
- for (int i = 0; i < nSeg; ++i)
- {
- if (nVerticesPos >= aVertices.nPropSize)
- break;
- sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
- sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
- aVerticies.append(";(").append(nX).append(",").append(nY).append(")");
- ++nVertices;
- }
- break;
- }
+ sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
+ sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
+ aVerticies.append(";(").append(nX).append(",").append(nY).append(")");
+ nVertices ++;
}
-
- if (!aVerticies.isEmpty() )
+ }
+ break;
+ case 0xb300:
+ case 0xac00:
+ case 0xaa00: // nofill
+ case 0xab00: // nostroke
+ case 0x6001: // close
+ case 0x8000: // end
+ break;
+ default:
+ // See EscherPropertyContainer::CreateCustomShapeProperties, by default nSeg is simply the number of points.
+ for (int i = 0; i < nSeg; ++i)
{
- // 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()));
+ if (nVerticesPos >= aVertices.nPropSize)
+ break;
+ sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
+ sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize);
+ aVerticies.append(";(").append(nX).append(",").append(nY).append(")");
+ ++nVertices;
}
- if ( !aSegmentInfo.isEmpty() )
- m_aShapeProps.insert(std::pair<OString,OString>("pSegmentInfo", aSegmentInfo.makeStringAndClear()));
+ break;
}
- else
- SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled shape path, missing either pVertices or pSegmentInfo");
}
- break;
- case ESCHER_Prop_shapePath:
- // noop, we use pSegmentInfo instead
- break;
- case ESCHER_Prop_fFillOK:
- if (!it->nPropValue)
- m_aShapeProps.insert(std::pair<OString,OString>("fFillOK", "0"));
- break;
- case ESCHER_Prop_dxTextLeft:
- m_aShapeProps.insert(std::pair<OString,OString>("dxTextLeft", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_dyTextTop:
- m_aShapeProps.insert(std::pair<OString,OString>("dyTextTop", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_dxTextRight:
- m_aShapeProps.insert(std::pair<OString,OString>("dxTextRight", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_dyTextBottom:
- m_aShapeProps.insert(std::pair<OString,OString>("dyTextBottom", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_FitTextToShape:
- // Size text to fit shape size: not supported by RTF
- break;
- case ESCHER_Prop_adjustValue:
- m_aShapeProps.insert(std::pair<OString,OString>("adjustValue", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_txflTextFlow:
- m_aShapeProps.insert(std::pair<OString,OString>("txflTextFlow", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_fillType:
- m_aShapeProps.insert(std::pair<OString,OString>("fillType", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_fillOpacity:
- m_aShapeProps.insert(std::pair<OString,OString>("fillOpacity", OString::number(it->nPropValue)));
- break;
- case ESCHER_Prop_fillBlip:
+
+ if (!aVerticies.isEmpty())
{
- OStringBuffer aBuf;
- aBuf.append('{').append(OOO_STRING_SVTOOLS_RTF_PICT).append(OOO_STRING_SVTOOLS_RTF_PNGBLIP).append(SAL_NEWLINE_STRING);
- int nHeaderSize = 25; // The first bytes are WW8-specific, we're only interested in the PNG
- aBuf.append(RtfAttributeOutput::WriteHex(it->pBuf + nHeaderSize, it->nPropSize - nHeaderSize));
- aBuf.append('}');
- m_aShapeProps.insert(std::pair<OString,OString>("fillBlip", aBuf.makeStringAndClear()));
+ // 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()));
}
- break;
- default:
- SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled property: " << nId << " (value: " << it->nPropValue << ")");
- break;
+ if (!aSegmentInfo.isEmpty())
+ m_aShapeProps.insert(std::pair<OString,OString>("pSegmentInfo", aSegmentInfo.makeStringAndClear()));
+ }
+ else
+ SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled shape path, missing either pVertices or pSegmentInfo");
+ }
+ break;
+ case ESCHER_Prop_shapePath:
+ // noop, we use pSegmentInfo instead
+ break;
+ case ESCHER_Prop_fFillOK:
+ if (!it->nPropValue)
+ m_aShapeProps.insert(std::pair<OString,OString>("fFillOK", "0"));
+ break;
+ case ESCHER_Prop_dxTextLeft:
+ m_aShapeProps.insert(std::pair<OString,OString>("dxTextLeft", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_dyTextTop:
+ m_aShapeProps.insert(std::pair<OString,OString>("dyTextTop", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_dxTextRight:
+ m_aShapeProps.insert(std::pair<OString,OString>("dxTextRight", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_dyTextBottom:
+ m_aShapeProps.insert(std::pair<OString,OString>("dyTextBottom", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_FitTextToShape:
+ // Size text to fit shape size: not supported by RTF
+ break;
+ case ESCHER_Prop_adjustValue:
+ m_aShapeProps.insert(std::pair<OString,OString>("adjustValue", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_txflTextFlow:
+ m_aShapeProps.insert(std::pair<OString,OString>("txflTextFlow", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_fillType:
+ m_aShapeProps.insert(std::pair<OString,OString>("fillType", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_fillOpacity:
+ m_aShapeProps.insert(std::pair<OString,OString>("fillOpacity", OString::number(it->nPropValue)));
+ break;
+ case ESCHER_Prop_fillBlip:
+ {
+ OStringBuffer aBuf;
+ aBuf.append('{').append(OOO_STRING_SVTOOLS_RTF_PICT).append(OOO_STRING_SVTOOLS_RTF_PNGBLIP).append(SAL_NEWLINE_STRING);
+ int nHeaderSize = 25; // The first bytes are WW8-specific, we're only interested in the PNG
+ aBuf.append(RtfAttributeOutput::WriteHex(it->pBuf + nHeaderSize, it->nPropSize - nHeaderSize));
+ aBuf.append('}');
+ m_aShapeProps.insert(std::pair<OString,OString>("fillBlip", aBuf.makeStringAndClear()));
+ }
+ break;
+ default:
+ SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled property: " << nId << " (value: " << it->nPropValue << ")");
+ break;
}
}
}
-void RtfSdrExport::AddLineDimensions( const Rectangle& rRectangle )
+void RtfSdrExport::AddLineDimensions(const Rectangle& rRectangle)
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC);
// We get the position relative to (the current?) character
m_aShapeProps.insert(std::pair<OString,OString>("posrelh", "3"));
- switch ( m_nShapeFlags & 0xC0 )
+ switch (m_nShapeFlags & 0xC0)
{
- case 0x40:
- m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1"));
- break;
- case 0x80:
- m_aShapeProps.insert(std::pair<OString,OString>("fFlipH", "1"));
- break;
- case 0xC0:
- m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1"));
- m_aShapeProps.insert(std::pair<OString,OString>("fFlipH", "1"));
- break;
+ case 0x40:
+ m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1"));
+ break;
+ case 0x80:
+ m_aShapeProps.insert(std::pair<OString,OString>("fFlipH", "1"));
+ break;
+ case 0xC0:
+ m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1"));
+ m_aShapeProps.insert(std::pair<OString,OString>("fFlipH", "1"));
+ break;
}
// the actual dimensions
@@ -417,7 +427,7 @@ void RtfSdrExport::AddLineDimensions( const Rectangle& rRectangle )
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);
@@ -432,12 +442,12 @@ void RtfSdrExport::AddRectangleDimensions( OStringBuffer& rBuffer, const Rectang
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)
- .append('{').append(OOO_STRING_SVTOOLS_RTF_SN " ").append(cName).append('}')
- .append('{').append(OOO_STRING_SVTOOLS_RTF_SV " ").append(rValue).append('}')
- .append('}');
+ .append('{').append(OOO_STRING_SVTOOLS_RTF_SN " ").append(cName).append('}')
+ .append('{').append(OOO_STRING_SVTOOLS_RTF_SV " ").append(rValue).append('}')
+ .append('}');
}
void RtfSdrExport::impl_writeGraphic()
@@ -483,7 +493,7 @@ sal_Int32 RtfSdrExport::StartShape()
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC);
- if ( m_nShapeType == ESCHER_ShpInst_Nil )
+ if (m_nShapeType == ESCHER_ShpInst_Nil)
return -1;
m_aShapeProps.insert(std::pair<OString,OString>("shapeType", OString::number(m_nShapeType)));
@@ -499,11 +509,11 @@ sal_Int32 RtfSdrExport::StartShape()
// Ignore \shpbypage, \shpbymargin, and \shpbycolumn, in favor of the posrelh property.
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)
- lcl_AppendSP(m_rAttrOutput.RunText(), (*i).first.getStr(), (*i).second );
+ 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(), "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(), "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));
// now check if we have some text
const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject);
@@ -527,11 +537,11 @@ sal_Int32 RtfSdrExport::StartShape()
pParaObj = pTxtObj->GetOutlinerParaObject();
}
- if( pParaObj )
+ if (pParaObj)
{
// this is reached only in case some text is attached to the shape
WriteOutliner(*pParaObj);
- if( bOwnParaObj )
+ if (bOwnParaObj)
delete pParaObj;
}
}
@@ -544,36 +554,37 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj)
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start");
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();
m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SHPTXT).append(' ');
for (sal_Int32 n = 0; n < nPara; ++n)
{
- if( n )
- aAttrIter.NextPara( n );
+ if (n)
+ aAttrIter.NextPara(n);
rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet();
- OUString aStr( rEditObj.GetText( n ));
+ OUString aStr(rEditObj.GetText(n));
sal_Int32 nAktPos = 0;
const sal_Int32 nEnd = aStr.getLength();
aAttrIter.OutParaAttr(false);
m_rAttrOutput.RunText().append(m_rAttrOutput.Styles().makeStringAndClear());
- do {
+ do
+ {
const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet();
- aAttrIter.OutAttr( nAktPos );
+ aAttrIter.OutAttr(nAktPos);
m_rAttrOutput.RunText().append('{').append(m_rAttrOutput.Styles().makeStringAndClear()).append(SAL_NEWLINE_STRING);
- bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
- if( !bTxtAtr )
+ bool bTxtAtr = aAttrIter.IsTxtAttr(nAktPos);
+ if (!bTxtAtr)
{
- OUString aOut( aStr.copy( nAktPos, nNextAttr - nAktPos ) );
- m_rAttrOutput.RunText().append( msfilter::rtfutil::OutString( aOut, eChrSet ) );
+ OUString aOut(aStr.copy(nAktPos, nNextAttr - nAktPos));
+ m_rAttrOutput.RunText().append(msfilter::rtfutil::OutString(aOut, eChrSet));
}
m_rAttrOutput.RunText().append('}');
@@ -582,25 +593,25 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj)
eChrSet = eNextChrSet;
aAttrIter.NextPos();
}
- while( nAktPos < nEnd );
+ while (nAktPos < nEnd);
}
m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_PAR).append('}');
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);
- if ( nShapeElement >= 0 )
+ if (nShapeElement >= 0)
{
// end of the shape
m_rAttrOutput.RunText().append('}').append('}');
}
}
-sal_uInt32 RtfSdrExport::AddSdrObject( const SdrObject& rObj )
+sal_uInt32 RtfSdrExport::AddSdrObject(const SdrObject& rObj)
{
m_pSdrObject = &rObj;
return EscherEx::AddSdrObject(rObj);