diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2011-03-22 17:38:22 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2011-03-22 17:38:22 +0100 |
commit | 2e057ce63ae6e0709d51d7defdf5cabc85baae24 (patch) | |
tree | 2bdd4b2c804e5cd30d008ec851399e66549e866b /xmloff | |
parent | 4deb4ccac394b4fb0bc192779d341fda660f635d (diff) | |
parent | d7ead261f5d0ea3ecbddc9316b6b0b7af9f17471 (diff) |
CWS-TOOLING: integrate CWS sw34bf04
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmloff/PageMasterStyleMap.hxx | 17 | ||||
-rw-r--r-- | xmloff/inc/xmloff/txtprmap.hxx | 8 | ||||
-rw-r--r-- | xmloff/inc/xmloff/xmlmetai.hxx | 10 | ||||
-rw-r--r-- | xmloff/inc/xmloff/xmltoken.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlimp.cxx | 21 | ||||
-rw-r--r-- | xmloff/source/meta/xmlmetai.cxx | 113 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterExportPropMapper.cxx | 46 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterImportPropMapper.cxx | 79 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterStyleMap.cxx | 28 | ||||
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 123 | ||||
-rw-r--r-- | xmloff/source/text/txtimppr.cxx | 78 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 27 |
13 files changed, 384 insertions, 170 deletions
diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx index 6ca1ba29f2cb..592949ca2b82 100644 --- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx +++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx @@ -83,6 +83,11 @@ #define CTF_PM_PRINT_HEADERS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0017)) #define CTF_PM_PRINT_OBJECTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0018)) #define CTF_PM_PRINT_ZEROVALUES (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0019)) +#define CTF_PM_MARGINALL (XML_PM_CTF_START + 0x001A) +#define CTF_PM_MARGINTOP (XML_PM_CTF_START + 0x001B) +#define CTF_PM_MARGINBOTTOM (XML_PM_CTF_START + 0x001C) +#define CTF_PM_MARGINLEFT (XML_PM_CTF_START + 0x001D) +#define CTF_PM_MARGINRIGHT (XML_PM_CTF_START + 0x001E) #define CTF_PM_PAGEUSAGE (XML_PM_CTF_START + 0x0031) #define CTF_PM_GRAPHICPOSITION (XML_PM_CTF_START + 0x0032) @@ -118,6 +123,12 @@ #define CTF_PM_HEADERGRAPHICPOSITION (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0034)) #define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0035)) #define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_HEADERMARGINALL (CTF_PM_HEADERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_HEADERMARGINTOP (CTF_PM_HEADERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_HEADERMARGINBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_HEADERMARGINLEFT (CTF_PM_HEADERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_HEADERMARGINRIGHT (CTF_PM_HEADERFLAG|CTF_PM_MARGINRIGHT) + // footer #define CTF_PM_FOOTERBORDERALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL) #define CTF_PM_FOOTERBORDERTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP) @@ -140,6 +151,12 @@ #define CTF_PM_FOOTERGRAPHICPOSITION (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0034)) #define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0035)) #define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_FOOTERMARGINALL (CTF_PM_FOOTERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_FOOTERMARGINTOP (CTF_PM_FOOTERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_FOOTERMARGINBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_FOOTERMARGINLEFT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_FOOTERMARGINRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINRIGHT) + #define CTF_PM_FTN_HEIGTH (XML_PM_CTF_START + 0x0060) #define CTF_PM_FTN_LINE_WEIGTH (XML_PM_CTF_START + 0x0061) #define CTF_PM_FTN_LINE_COLOR (XML_PM_CTF_START + 0x0062) diff --git a/xmloff/inc/xmloff/txtprmap.hxx b/xmloff/inc/xmloff/txtprmap.hxx index d64cc1266ef9..a02151cd0993 100644 --- a/xmloff/inc/xmloff/txtprmap.hxx +++ b/xmloff/inc/xmloff/txtprmap.hxx @@ -178,6 +178,14 @@ #define CTF_TEXT_DISPLAY (XML_TEXT_CTF_START + 143) #define CTF_TEXT_CLIP (XML_TEXT_CTF_START + 144) #define CTF_TEXT_CLIP11 (XML_TEXT_CTF_START + 145) +#define CTF_PARAMARGINALL (XML_TEXT_CTF_START + 146) +#define CTF_PARAMARGINALL_REL (XML_TEXT_CTF_START + 147) +#define CTF_MARGINALL (XML_TEXT_CTF_START + 148) +#define CTF_MARGINLEFT (XML_TEXT_CTF_START + 149) +#define CTF_MARGINRIGHT (XML_TEXT_CTF_START + 150) +#define CTF_MARGINTOP (XML_TEXT_CTF_START + 151) +#define CTF_MARGINBOTTOM (XML_TEXT_CTF_START + 152) + #define TEXT_PROP_MAP_TEXT 0 #define TEXT_PROP_MAP_PARA 1 #define TEXT_PROP_MAP_FRAME 2 diff --git a/xmloff/inc/xmloff/xmlmetai.hxx b/xmloff/inc/xmloff/xmlmetai.hxx index efdd1d3f024f..2ddd51920054 100644 --- a/xmloff/inc/xmloff/xmlmetai.hxx +++ b/xmloff/inc/xmloff/xmlmetai.hxx @@ -25,8 +25,8 @@ * ************************************************************************/ -#ifndef _XMLOFF_XMLMETAI_HXX -#define _XMLOFF_XMLMETAI_HXX +#ifndef XMLOFF_XMLMETAI_HXX +#define XMLOFF_XMLMETAI_HXX #include "sal/config.h" #include "xmloff/dllapi.h" @@ -69,12 +69,6 @@ public: virtual void EndElement(); -protected: - /// initialize DocumentProperties object with DOM and base URL - void initDocumentProperties(); - // set the BuildId property at the importer - void setBuildId(const ::rtl::OUString & i_rBuildId); - public: static void setBuildId(const ::rtl::OUString & rGenerator, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xImportInfo ); diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index ca321245fdb2..39186a044311 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3130,6 +3130,8 @@ namespace xmloff { namespace token { XML_MIN_VALUE, XML_MAX_VALUE, + XML_MARGIN, // #i117001# + XML_TOKEN_END }; diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index bc1e40114c5f..ec0039f16771 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3130,6 +3130,8 @@ namespace xmloff { namespace token { TOKEN( "min-value", XML_MIN_VALUE ), TOKEN( "max-value", XML_MAX_VALUE ), + TOKEN( "margin", XML_MARGIN), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 578b3eefc719..7b69609fafe9 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -30,15 +30,11 @@ #include <tools/string.hxx> -#ifndef _XMLOFF_XMLMETAI_HXX #include <xmloff/xmlscripti.hxx> -#endif #include "sdxmlimp_impl.hxx" #include "ximpbody.hxx" -#ifndef _SFX_XMLMETAI_HXX #include <xmloff/xmlmetai.hxx> -#endif #include "ximpstyl.hxx" #include "xmloff/xmlnmspe.hxx" #include <xmloff/xmltoken.hxx> @@ -447,6 +443,17 @@ void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen if( xInfoSetInfo->hasPropertyByName( msPreview ) ) xInfoSet->getPropertyValue( msPreview ) >>= mbPreview; + + ::rtl::OUString const sOrganizerMode( + RTL_CONSTASCII_USTRINGPARAM("OrganizerMode")); + if (xInfoSetInfo->hasPropertyByName(sOrganizerMode)) + { + sal_Bool bStyleOnly(sal_False); + if (xInfoSet->getPropertyValue(sOrganizerMode) >>= bStyleOnly) + { + mbLoadDoc = !bStyleOnly; + } + } } } @@ -765,7 +772,7 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName, { SvXMLImportContext* pContext = 0L; - if (!IsStylesOnlyMode() && (getImportFlags() & IMPORT_META)) + if (getImportFlags() & IMPORT_META) { uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( @@ -773,9 +780,11 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName, uno::UNO_QUERY_THROW); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( GetModel(), uno::UNO_QUERY_THROW); + uno::Reference<document::XDocumentProperties> const xDocProps( + (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties()); pContext = new SvXMLMetaDocumentContext(*this, XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); + xDocProps, xDocBuilder); } if(!pContext) diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index e2ba207e5cd6..9f5aebece935 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/xml/dom/XSAXDocumentBuilder.hpp> +#include <com/sun/star/xml/xpath/XXPathAPI.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> @@ -124,6 +125,71 @@ void XMLDocumentBuilderContext::EndElement() //=========================================================================== +static void +lcl_initDocumentProperties(SvXMLImport & rImport, + uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder, + uno::Reference<document::XDocumentProperties> const& xDocProps) +{ + uno::Sequence< uno::Any > aSeq(1); + uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder, + uno::UNO_QUERY_THROW); + aSeq[0] <<= xDB->getDocument(); + uno::Reference< lang::XInitialization > const xInit(xDocProps, + uno::UNO_QUERY_THROW); + try { + xInit->initialize(aSeq); + rImport.SetStatistics(xDocProps->getDocumentStatistics()); + // convert all URLs from relative to absolute + xDocProps->setTemplateURL(rImport.GetAbsoluteReference( + xDocProps->getTemplateURL())); + xDocProps->setAutoloadURL(rImport.GetAbsoluteReference( + xDocProps->getAutoloadURL())); + SvXMLMetaDocumentContext::setBuildId( + xDocProps->getGenerator(), rImport.getImportInfo()); + } catch (uno::RuntimeException) { + throw; + } catch (uno::Exception & e) { + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString::createFromAscii( + "SvXMLMetaDocumentContext::initDocumentProperties: " + "properties init exception"), + rImport, makeAny(e)); + } +} + +static void +lcl_initGenerator(SvXMLImport & rImport, + uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder) +{ + uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder, + uno::UNO_QUERY_THROW); + uno::Reference< xml::dom::XDocument > const xDoc(xDB->getDocument(), + uno::UNO_SET_THROW); + try { + uno::Reference< xml::xpath::XXPathAPI > const xPath( + rImport.getServiceFactory()->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.xml.xpath.XPathAPI"))), + uno::UNO_QUERY_THROW ); + xPath->registerNS(GetXMLToken(XML_NP_OFFICE),GetXMLToken(XML_N_OFFICE)); + xPath->registerNS(GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META)); + + ::rtl::OUString const expr(RTL_CONSTASCII_USTRINGPARAM( + "string(/office:document-meta/office:meta/meta:generator)")); + uno::Reference< xml::xpath::XXPathObject > const xObj( + xPath->eval(xDoc.get(), expr), uno::UNO_SET_THROW); + OUString const value(xObj->getString()); + SvXMLMetaDocumentContext::setBuildId(value, rImport.getImportInfo()); + } catch (uno::RuntimeException) { + throw; + } catch (uno::Exception & e) { + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString::createFromAscii( + "SvXMLMetaDocumentContext::initGenerator: exception"), + rImport, makeAny(e)); + } +} + SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName, const uno::Reference<document::XDocumentProperties>& xDocProps, @@ -132,8 +198,9 @@ SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport, mxDocProps(xDocProps), mxDocBuilder(xDocBuilder) { - DBG_ASSERT(xDocProps.is(), "SvXMLMetaDocumentContext: no document props"); - DBG_ASSERT(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr"); +// #i103539#: must always read meta.xml for generator, xDocProps unwanted then +// OSL_ENSURE(xDocProps.is(), "SvXMLMetaDocumentContext: no document props"); + OSL_ENSURE(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr"); // here are no attributes } @@ -166,6 +233,7 @@ void SvXMLMetaDocumentContext::StartElement( mxDocBuilder->startElement( GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(), GetXMLToken(XML_DOCUMENT_META)), xAttrList); + } void SvXMLMetaDocumentContext::EndElement() @@ -175,43 +243,16 @@ void SvXMLMetaDocumentContext::EndElement() GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(), GetXMLToken(XML_DOCUMENT_META))); mxDocBuilder->endDocument(); - initDocumentProperties(); -} - -void SvXMLMetaDocumentContext::initDocumentProperties() -{ - uno::Sequence< uno::Any > aSeq(1); - uno::Reference< xml::dom::XSAXDocumentBuilder > xDB (mxDocBuilder, - uno::UNO_QUERY_THROW); - aSeq[0] <<= xDB->getDocument(); - uno::Reference< lang::XInitialization > xInit(mxDocProps, - uno::UNO_QUERY_THROW); - try { - xInit->initialize(aSeq); - GetImport().SetStatistics(mxDocProps->getDocumentStatistics()); - // convert all URLs from relative to absolute - mxDocProps->setTemplateURL(GetImport().GetAbsoluteReference( - mxDocProps->getTemplateURL())); - mxDocProps->setAutoloadURL(GetImport().GetAbsoluteReference( - mxDocProps->getAutoloadURL())); - setBuildId(mxDocProps->getGenerator()); - } catch (uno::RuntimeException) { - throw; - } catch (uno::Exception & e) { - throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "SvXMLMetaDocumentContext::initDocumentProperties: " - "properties init exception"), - GetImport(), makeAny(e)); + if (mxDocProps.is()) + { + lcl_initDocumentProperties(GetImport(), mxDocBuilder, mxDocProps); + } + else + { + lcl_initGenerator(GetImport(), mxDocBuilder); } } -void SvXMLMetaDocumentContext::setBuildId(const ::rtl::OUString & i_rBuildId) -{ - SvXMLMetaDocumentContext::setBuildId( i_rBuildId, GetImport().getImportInfo() ); -} - -//static void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId, const uno::Reference<beans::XPropertySet>& xImportInfo ) { OUString sBuildId; 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; diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx index 59cff11d65cc..4af6e1ce16e1 100644 --- a/xmloff/source/style/PageMasterImportPropMapper.cxx +++ b/xmloff/source/style/PageMasterImportPropMapper.cxx @@ -28,14 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" - #include "PageMasterImportPropMapper.hxx" -#ifndef _XMLOFF_PAGEMASTERPROPMAPPER_HXX #include "PageMasterPropMapper.hxx" -#endif -#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX #include <xmloff/PageMasterStyleMap.hxx> -#endif #include <xmloff/maptype.hxx> #include <com/sun/star/table/BorderLine.hpp> #include <com/sun/star/container/XNameContainer.hpp> @@ -129,7 +124,15 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& XMLPropertyState* pFooterHeight = NULL; XMLPropertyState* pFooterMinHeight = NULL; XMLPropertyState* pFooterDynamic = NULL; - sal_uInt16 i; // for the "for" loop + XMLPropertyState* pAllMarginProperty = NULL; + XMLPropertyState* pMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr<XMLPropertyState> pNewMargins[4]; + XMLPropertyState* pAllHeaderMarginProperty = NULL; + XMLPropertyState* pHeaderMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr<XMLPropertyState> pNewHeaderMargins[4]; + XMLPropertyState* pAllFooterMarginProperty = NULL; + XMLPropertyState* pFooterMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr<XMLPropertyState> pNewFooterMargins[4]; ::std::vector< XMLPropertyState >::iterator aEnd = rProperties.end(); for (::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != aEnd; ++aIter) @@ -189,12 +192,60 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& case CTF_PM_HEADERMINHEIGHT : pHeaderMinHeight = property; break; case CTF_PM_FOOTERHEIGHT : pFooterHeight = property; break; case CTF_PM_FOOTERMINHEIGHT : pFooterMinHeight = property; break; + case CTF_PM_MARGINALL : + pAllMarginProperty = property; break; + case CTF_PM_MARGINTOP : + pMargins[XML_LINE_TOP] = property; break; + case CTF_PM_MARGINBOTTOM: + pMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_MARGINLEFT : + pMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_MARGINRIGHT : + pMargins[XML_LINE_RIGHT] = property; break; + case CTF_PM_HEADERMARGINALL : + pAllHeaderMarginProperty = property; break; + case CTF_PM_HEADERMARGINTOP : + pHeaderMargins[XML_LINE_TOP] = property; break; + case CTF_PM_HEADERMARGINBOTTOM: + pHeaderMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_HEADERMARGINLEFT : + pHeaderMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_HEADERMARGINRIGHT : + pHeaderMargins[XML_LINE_RIGHT] = property; break; + case CTF_PM_FOOTERMARGINALL : + pAllFooterMarginProperty = property; break; + case CTF_PM_FOOTERMARGINTOP : + pFooterMargins[XML_LINE_TOP] = property; break; + case CTF_PM_FOOTERMARGINBOTTOM: + pFooterMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_FOOTERMARGINLEFT : + pFooterMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_FOOTERMARGINRIGHT : + pFooterMargins[XML_LINE_RIGHT] = property; break; } } } - for ( i = 0; i < 4; i++) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pAllMarginProperty && !pMargins[i]) + { + pNewMargins[i].reset(new XMLPropertyState( + pAllMarginProperty->mnIndex + 1 + i, + pAllMarginProperty->maValue)); + } + if (pAllHeaderMarginProperty && !pHeaderMargins[i]) + { + pNewHeaderMargins[i].reset(new XMLPropertyState( + pAllHeaderMarginProperty->mnIndex + 1 + i, + pAllHeaderMarginProperty->maValue)); + } + if (pAllFooterMarginProperty && !pFooterMargins[i]) + { + pNewFooterMargins[i].reset(new XMLPropertyState( + pAllFooterMarginProperty->mnIndex + 1 + i, + pAllFooterMarginProperty->maValue)); + } if (pAllPaddingProperty && !pPadding[i]) pNewPadding[i] = new XMLPropertyState(pAllPaddingProperty->mnIndex + 1 + i, pAllPaddingProperty->maValue); if (pAllBorderProperty && !pBorders[i]) @@ -294,8 +345,20 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& aAny.setValue( &bValue, ::getBooleanCppuType() ); pFooterDynamic = new XMLPropertyState(pFooterMinHeight->mnIndex + 1, aAny); } - for (i = 0; i < 4; i++) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pNewMargins[i].get()) + { + rProperties.push_back(*pNewMargins[i]); + } + if (pNewHeaderMargins[i].get()) + { + rProperties.push_back(*pNewHeaderMargins[i]); + } + if (pNewFooterMargins[i].get()) + { + rProperties.push_back(*pNewFooterMargins[i]); + } if (pNewPadding[i]) { rProperties.push_back(*pNewPadding[i]); diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx index 6dbda70f5125..41d2172ab4fa 100644 --- a/xmloff/source/style/PageMasterStyleMap.cxx +++ b/xmloff/source/style/PageMasterStyleMap.cxx @@ -28,10 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX #include <xmloff/PageMasterStyleMap.hxx> -#endif -#include "xmloff/xmlnmspe.hxx" + +#include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> using namespace ::xmloff::token; @@ -54,10 +53,11 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_PM_TYPE_NUMLETTERSYNC, 0 ), PLMAP( "PrinterPaperTray", XML_NAMESPACE_STYLE, XML_PAPER_TRAY_NAME, XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT, 0 ), PLMAP( "IsLandscape", XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PM_TYPE_PRINTORIENTATION, 0 ), - PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, 0 ), - PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ), - PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, 0 ), - PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ), + PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_MARGINALL ), + PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_MARGINTOP ), + PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_MARGINBOTTOM ), + PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_MARGINLEFT ), + PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_MARGINRIGHT ), PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_BORDERALL ), PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_BORDERTOP ), PLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_BORDERBOTTOM ), @@ -130,9 +130,10 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = HFMAP( "HeaderHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERHEIGHT ), HFMAP( "HeaderHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMINHEIGHT ), HFMAP( "HeaderIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_HEADERDYNAMIC ), - HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINALL ), + HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINLEFT ), + HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINRIGHT ), + HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINBOTTOM ), HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_HEADERBORDERALL ), HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_HEADERBORDERTOP ), HFMAP( "HeaderBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_HEADERBORDERBOTTOM ), @@ -160,9 +161,10 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = HFMAP( "FooterHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERHEIGHT ), HFMAP( "FooterHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMINHEIGHT ), HFMAP( "FooterIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_FOOTERDYNAMIC ), - HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINALL ), + HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINLEFT ), + HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINRIGHT ), + HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINTOP ), HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERALL ), HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERTOP ), HFMAP( "FooterBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERBOTTOM ), diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 7b3c7e828683..6bca8e8f4e20 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -27,8 +27,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#include <tools/debug.hxx> -#include <xmloff/txtprmap.hxx> + +#include "txtexppr.hxx" + #include <com/sun/star/table/BorderLine.hpp> #include <com/sun/star/text/SizeType.hpp> #include <com/sun/star/text/WrapTextMode.hpp> @@ -37,7 +38,10 @@ #include <com/sun/star/awt/FontPitch.hpp> #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/text/XChapterNumberingSupplier.hpp> -#include "txtexppr.hxx" + +#include <tools/debug.hxx> + +#include <xmloff/txtprmap.hxx> #include <xmloff/xmlexp.hxx> #include "XMLSectionFootnoteConfigExport.hxx" @@ -302,6 +306,26 @@ void XMLTextExportPropertySetMapper::ContextFontHeightFilter( // helper method; implementation below bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&); +static void +lcl_checkMultiProperty(XMLPropertyState *const pState, + XMLPropertyState *const pRelState) +{ + if (pState && pRelState) + { + sal_Int32 nTemp = 0; + pRelState->maValue >>= nTemp; + if (100 == nTemp) + { + pRelState->mnIndex = -1; + pRelState->maValue.clear(); + } + else + { + pState->mnIndex = -1; + pState->maValue.clear(); + } + } +} void XMLTextExportPropertySetMapper::ContextFilter( ::std::vector< XMLPropertyState >& rProperties, @@ -444,6 +468,9 @@ void XMLTextExportPropertySetMapper::ContextFilter( XMLPropertyState* pClip11State = NULL; XMLPropertyState* pClipState = NULL; + XMLPropertyState* pAllParaMargin = NULL; + XMLPropertyState* pAllMargin = NULL; + sal_Bool bNeedsAnchor = sal_False; for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); @@ -560,6 +587,8 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break; case CTF_TEXT_CLIP11: pClip11State = propertie; break; case CTF_TEXT_CLIP: pClipState = propertie; break; + case CTF_PARAMARGINALL: pAllParaMargin = propertie; break; + case CTF_MARGINALL: pAllMargin = propertie; break; } } @@ -605,87 +634,21 @@ void XMLTextExportPropertySetMapper::ContextFilter( } } - if( pParaLeftMarginState && pParaLeftMarginRelState ) - { - sal_Int32 nTemp = 0; - pParaLeftMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaLeftMarginRelState->mnIndex = -1; - pParaLeftMarginRelState->maValue.clear(); - } - else - { - pParaLeftMarginState->mnIndex = -1; - pParaLeftMarginState->maValue.clear(); - } - - } - - if( pParaRightMarginState && pParaRightMarginRelState ) - { - sal_Int32 nTemp = 0; - pParaRightMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaRightMarginRelState->mnIndex = -1; - pParaRightMarginRelState->maValue.clear(); - } - else - { - pParaRightMarginState->mnIndex = -1; - pParaRightMarginState->maValue.clear(); - } - } - - if( pParaFirstLineState && pParaFirstLineRelState ) - { - sal_Int32 nTemp = 0; - pParaFirstLineRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaFirstLineRelState->mnIndex = -1; - pParaFirstLineRelState->maValue.clear(); - } - else - { - pParaFirstLineState->mnIndex = -1; - pParaFirstLineState->maValue.clear(); - } - } + lcl_checkMultiProperty(pParaLeftMarginState, pParaLeftMarginRelState); + lcl_checkMultiProperty(pParaRightMarginState, pParaRightMarginRelState); + lcl_checkMultiProperty(pParaTopMarginState, pParaTopMarginRelState); + lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState); + lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState); - if( pParaTopMarginState && pParaTopMarginRelState ) + if (pAllParaMargin) { - sal_Int32 nTemp = 0; - pParaTopMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaTopMarginRelState->mnIndex = -1; - pParaTopMarginRelState->maValue.clear(); - } - else - { - pParaTopMarginState->mnIndex = -1; - pParaTopMarginState->maValue.clear(); - } - + pAllParaMargin->mnIndex = -1; // just export individual attributes... + pAllParaMargin->maValue.clear(); } - - if( pParaBottomMarginState && pParaBottomMarginRelState ) + if (pAllMargin) { - sal_Int32 nTemp = 0; - pParaBottomMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaBottomMarginRelState->mnIndex = -1; - pParaBottomMarginRelState->maValue.clear(); - } - else - { - pParaBottomMarginState->mnIndex = -1; - pParaBottomMarginState->maValue.clear(); - } - + pAllMargin->mnIndex = -1; // just export individual attributes... + pAllMargin->maValue.clear(); } if( pAllBorderWidthState ) diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index dceac7a26890..93e8750b8fb2 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -316,7 +316,12 @@ void XMLTextImportPropertyMapper::finished( XMLPropertyState* pVertOrientRelAsChar = 0; XMLPropertyState* pBackTransparency = NULL; // transparency in % XMLPropertyState* pBackTransparent = NULL; // transparency as boolean - sal_uInt16 i; // for the "for" loop + XMLPropertyState* pAllParaMargin = 0; + XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 }; + ::std::auto_ptr<XMLPropertyState> pNewParaMargins[4]; + XMLPropertyState* pAllMargin = 0; + XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 }; + ::std::auto_ptr<XMLPropertyState> pNewMargins[4]; for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != rProperties.end(); @@ -384,7 +389,31 @@ void XMLTextImportPropertyMapper::finished( bHasAnyWidth = sal_True; break; case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break; case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break; - + case CTF_PARAMARGINALL: + case CTF_PARAMARGINALL_REL: + pAllParaMargin = property; break; + case CTF_PARALEFTMARGIN: + case CTF_PARALEFTMARGIN_REL: + pParaMargins[XML_LINE_LEFT] = property; break; + case CTF_PARARIGHTMARGIN: + case CTF_PARARIGHTMARGIN_REL: + pParaMargins[XML_LINE_RIGHT] = property; break; + case CTF_PARATOPMARGIN: + case CTF_PARATOPMARGIN_REL: + pParaMargins[XML_LINE_TOP] = property; break; + case CTF_PARABOTTOMMARGIN: + case CTF_PARABOTTOMMARGIN_REL: + pParaMargins[XML_LINE_BOTTOM] = property; break; + case CTF_MARGINALL: + pAllMargin = property; break; + case CTF_MARGINLEFT: + pMargins[XML_LINE_LEFT] = property; break; + case CTF_MARGINRIGHT: + pMargins[XML_LINE_RIGHT] = property; break; + case CTF_MARGINTOP: + pMargins[XML_LINE_TOP] = property; break; + case CTF_MARGINBOTTOM: + pMargins[XML_LINE_BOTTOM] = property; break; } } @@ -401,8 +430,31 @@ void XMLTextImportPropertyMapper::finished( FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL ); - for( i = 0; i < 4; i++ ) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pAllParaMargin && !pParaMargins[i]) + { +#ifdef DBG_UTIL + sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( + pAllParaMargin->mnIndex + (2*i) + 2 ); + OSL_ENSURE( nTmp >= CTF_PARALEFTMARGIN && + nTmp <= CTF_PARABOTTOMMARGIN_REL, + "wrong property context id" ); +#endif + pNewParaMargins[i].reset(new XMLPropertyState( + pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue)); + } + if (pAllMargin && !pMargins[i]) + { +#ifdef DBG_UTIL + sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( + pAllMargin->mnIndex + i + 1 ); + OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM, + "wrong property context id" ); +#endif + pNewMargins[i].reset(new XMLPropertyState( + pAllMargin->mnIndex + i + 1, pAllMargin->maValue)); + } if( pAllBorderDistance && !pBorderDistances[i] ) { #ifdef DBG_UTIL @@ -506,6 +558,16 @@ void XMLTextImportPropertyMapper::finished( } #endif } + + if (pAllParaMargin) + { + pAllParaMargin->mnIndex = -1; + } + if (pAllMargin) + { + pAllMargin->mnIndex = -1; + } + if( pAllBorderDistance ) pAllBorderDistance->mnIndex = -1; @@ -649,8 +711,16 @@ void XMLTextImportPropertyMapper::finished( delete pNewFontCharSetCTL; } - for( i=0; i<4; i++ ) + for (sal_uInt16 i=0; i<4; i++) { + if (pNewParaMargins[i].get()) + { + rProperties.push_back(*pNewParaMargins[i]); + } + if (pNewMargins[i].get()) + { + rProperties.push_back(*pNewMargins[i]); + } if( pNewBorderDistances[i] ) { rProperties.push_back( *pNewBorderDistances[i] ); diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index fbc53ef3e16e..ff49ecd234f9 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -27,15 +27,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" + +#include <xmloff/txtprmap.hxx> + #include <tools/debug.hxx> -#include "xmloff/xmlnmspe.hxx" + +#include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> -#ifndef _XMLOFF_TXTPRHDL_HXX #include "txtprhdl.hxx" -#endif -#ifndef _XMLOFF_TXTPRMAP_HXX -#include <xmloff/txtprmap.hxx> -#endif using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -91,6 +90,9 @@ XMLPropertyMapEntry aXMLParaPropMap[] = // RES_UNKNOWNATR_CONTAINER MP_E( "ParaUserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ), // RES_LR_SPACE + // !!! DO NOT REORDER THE MARGINS !!! + MP_E( "ParaLeftMargin", FO, MARGIN, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAMARGINALL ), + MP_E( "ParaLeftMarginRelative", FO, MARGIN, XML_TYPE_PERCENT16, CTF_PARAMARGINALL_REL ), MP_E( "ParaLeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ), MP_E( "ParaLeftMarginRelative", FO, MARGIN_LEFT, XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ), MP_E( "ParaRightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ), @@ -578,11 +580,12 @@ XMLPropertyMapEntry aXMLFramePropMap[] = MG_ED( "VertOrientPosition", SVG, Y, XML_TYPE_MEASURE, 0 ), // ***** The map for automatic styles starts here ***** // RES_LR_SPACE - MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, 0), - MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ), + MG_E( "LeftMargin", FO, MARGIN, XML_TYPE_MEASURE, CTF_MARGINALL ), + MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, CTF_MARGINLEFT ), + MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_MARGINRIGHT ), // RES_UL_SPACE - MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, 0 ), - MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ), + MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, CTF_MARGINTOP ), + MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_MARGINBOTTOM ), // RES_PAGEDESC // not required // RES_BREAK @@ -852,7 +855,7 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType ) break; case TEXT_PROP_MAP_SHAPE_PARA: pMap = &(aXMLParaPropMap[1]); - DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "shape para map changed" ); + OSL_ENSURE( pMap->meXMLName == XML_MARGIN, "shape para map changed" ); break; case TEXT_PROP_MAP_PARA: pMap = aXMLParaPropMap; @@ -862,7 +865,7 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType ) break; case TEXT_PROP_MAP_AUTO_FRAME: pMap = &(aXMLFramePropMap[13]); - DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "frame map changed" ); + OSL_ENSURE( pMap->meXMLName == XML_MARGIN, "frame map changed" ); break; case TEXT_PROP_MAP_SHAPE: pMap = aXMLShapePropMap; |