diff options
author | Michael Stahl <mst@openoffice.org> | 2011-02-18 19:47:04 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-02-18 19:47:04 +0100 |
commit | 3c5facfce42a0dbe362d6b9fa5ac374fd76f51a1 (patch) | |
tree | 3b01b451a10aced41d4ae954aaab6c6044135d64 /xmloff/source/style/PageMasterExportPropMapper.cxx | |
parent | c9200e42289d06c6335fa15befb0a003f4ad0689 (diff) |
sw34bf04: #i117001#: xmloff: support fo:margin
Diffstat (limited to 'xmloff/source/style/PageMasterExportPropMapper.cxx')
-rw-r--r-- | xmloff/source/style/PageMasterExportPropMapper.cxx | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx index fe14231e51c4..d803b79b50a1 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -31,9 +31,7 @@ #include <xmloff/xmltoken.hxx> #include <comphelper/types.hxx> #include <com/sun/star/table/BorderLine.hpp> -#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX #include <xmloff/PageMasterStyleMap.hxx> -#endif #include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> #include <comphelper/extract.hxx> @@ -84,6 +82,12 @@ void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int32 nInde struct XMLPropertyStateBuffer { + XMLPropertyState* pPMMarginAll; + XMLPropertyState* pPMMarginTop; + XMLPropertyState* pPMMarginBottom; + XMLPropertyState* pPMMarginLeft; + XMLPropertyState* pPMMarginRight; + XMLPropertyState* pPMBorderAll; XMLPropertyState* pPMBorderTop; XMLPropertyState* pPMBorderBottom; @@ -106,7 +110,13 @@ struct XMLPropertyStateBuffer void ContextFilter( ::std::vector< XMLPropertyState >& rPropState ); }; -XMLPropertyStateBuffer::XMLPropertyStateBuffer() : +XMLPropertyStateBuffer::XMLPropertyStateBuffer() + : pPMMarginAll( NULL ) + , pPMMarginTop( NULL ) + , pPMMarginBottom( NULL ) + , pPMMarginLeft( NULL ) + , pPMMarginRight( NULL ) + , pPMBorderAll( NULL ), pPMBorderTop( NULL ), pPMBorderBottom( NULL ), @@ -129,6 +139,31 @@ XMLPropertyStateBuffer::XMLPropertyStateBuffer() : void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& ) { + if (pPMMarginAll) + { + if (pPMMarginTop && pPMMarginBottom && pPMMarginLeft && pPMMarginRight) + { + sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0; + + pPMMarginTop->maValue >>= nTop; + pPMMarginBottom->maValue >>= nBottom; + pPMMarginLeft->maValue >>= nLeft; + pPMMarginRight->maValue >>= nRight; + + if ((nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight)) + { + lcl_RemoveState( pPMMarginTop ); + lcl_RemoveState( pPMMarginBottom ); + lcl_RemoveState( pPMMarginLeft ); + lcl_RemoveState( pPMMarginRight ); + } + else + lcl_RemoveState( pPMMarginAll ); + } + else + lcl_RemoveState( pPMMarginAll ); + } + if( pPMBorderAll ) { if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight ) @@ -348,6 +383,11 @@ void XMLPageMasterExportPropMapper::ContextFilter( switch( nSimpleId ) { + case CTF_PM_MARGINALL: pBuffer->pPMMarginAll = pProp; break; + case CTF_PM_MARGINTOP: pBuffer->pPMMarginTop = pProp; break; + case CTF_PM_MARGINBOTTOM: pBuffer->pPMMarginBottom = pProp; break; + case CTF_PM_MARGINLEFT: pBuffer->pPMMarginLeft = pProp; break; + case CTF_PM_MARGINRIGHT: pBuffer->pPMMarginRight = pProp; break; case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break; case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break; case CTF_PM_BORDERBOTTOM: pBuffer->pPMBorderBottom = pProp; break; |