summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx17
-rw-r--r--xmloff/source/forms/elementimport.cxx6
-rw-r--r--xmloff/source/meta/xmlmetai.cxx113
-rw-r--r--xmloff/source/style/PageMasterExportPropMapper.cxx44
-rw-r--r--xmloff/source/style/PageMasterImportPropMapper.cxx75
-rw-r--r--xmloff/source/style/PageMasterStyleMap.cxx25
-rw-r--r--xmloff/source/text/txtexppr.cxx121
-rw-r--r--xmloff/source/text/txtfldi.cxx2
-rw-r--r--xmloff/source/text/txtimppr.cxx78
-rw-r--r--xmloff/source/text/txtprmap.cxx23
11 files changed, 358 insertions, 148 deletions
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 0a11903eb0..ada1cc766f 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3134,6 +3134,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 47fcac2a7f..cf68d47eba 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -444,6 +444,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;
+ }
+ }
}
}
@@ -753,7 +764,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(RTL_CONSTASCII_USTRINGPARAM(
@@ -761,9 +772,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/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 6247264730..051b7c289f 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -889,12 +889,12 @@ namespace xmloff
if (!bRetrievedValues)
{
getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty);
- ENSURE_OR_BREAK( pCurrentValueProperty && pValueProperty, "OControlImport::StartElement: illegal value property names!" );
+ ENSURE_OR_BREAK( pValueProperty, "OControlImport::StartElement: illegal value property names!" );
bRetrievedValues = sal_True;
}
- OSL_ENSURE((PROPID_VALUE != aValueProps->Handle) || pValueProperty,
+ ENSURE_OR_BREAK((PROPID_VALUE != aValueProps->Handle) || pValueProperty,
"OControlImport::StartElement: the control does not have a value property!");
- OSL_ENSURE((PROPID_CURRENT_VALUE != aValueProps->Handle) || pCurrentValueProperty,
+ ENSURE_OR_BREAK((PROPID_CURRENT_VALUE != aValueProps->Handle) || pCurrentValueProperty,
"OControlImport::StartElement: the control does not have a current-value property!");
// transfer the name
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 0278307eda..aa1155f2da 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -31,6 +31,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>
@@ -125,6 +126,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(RTL_CONSTASCII_USTRINGPARAM(
+ "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(RTL_CONSTASCII_USTRINGPARAM(
+ "SvXMLMetaDocumentContext::initGenerator: exception")),
+ rImport, makeAny(e));
+ }
+}
+
SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport,
sal_uInt16 nPrfx, const rtl::OUString& rLName,
const uno::Reference<document::XDocumentProperties>& xDocProps,
@@ -133,8 +199,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
}
@@ -167,6 +234,7 @@ void SvXMLMetaDocumentContext::StartElement(
mxDocBuilder->startElement(
GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(),
GetXMLToken(XML_DOCUMENT_META)), xAttrList);
+
}
void SvXMLMetaDocumentContext::EndElement()
@@ -176,43 +244,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(RTL_CONSTASCII_USTRINGPARAM(
- "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 c59d61ced2..fa4442a8f6 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -85,6 +85,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;
@@ -107,7 +113,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 ),
@@ -130,6 +142,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 )
@@ -349,6 +386,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 048c5dc5e1..3785ea7fd6 100644
--- a/xmloff/source/style/PageMasterImportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterImportPropMapper.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-
#include "PageMasterImportPropMapper.hxx"
#include "PageMasterPropMapper.hxx"
#include <xmloff/PageMasterStyleMap.hxx>
@@ -126,7 +125,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)
@@ -186,12 +193,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 +349,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 61449e776f..17f7e92001 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -30,7 +30,7 @@
#include "precompiled_xmloff.hxx"
#include <xmloff/PageMasterStyleMap.hxx>
-#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
using namespace ::xmloff::token;
@@ -53,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 +131,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 +162,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 0e8584b686..7d04488225 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -31,6 +31,9 @@
#include <tools/debug.hxx>
#include <xmloff/txtprmap.hxx>
#include <com/sun/star/table/BorderLine2.hpp>
+
+#include "txtexppr.hxx"
+
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
@@ -38,7 +41,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"
@@ -303,6 +309,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,
@@ -443,6 +469,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();
@@ -557,6 +586,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;
}
}
@@ -602,87 +633,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/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 9812273ab5..536984bed0 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -210,7 +210,7 @@ const sal_Char sAPI_is_fixed_language[] = "IsFixedLanguage";
const sal_Char sAPI_is_visible[] = "IsVisible";
const sal_Char sAPI_TextRange[] = "TextRange";
-const sal_Char sAPI_true[] = "sal_True";
+const sal_Char sAPI_true[] = "TRUE";
TYPEINIT1( XMLTextFieldImportContext, SvXMLImportContext);
diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx
index 7b5d99bec7..180ac0f3fe 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
@@ -450,6 +502,16 @@ void XMLTextImportPropertyMapper::finished(
pBorders[i]->maValue <<= aBorderLine;
}
}
+
+ if (pAllParaMargin)
+ {
+ pAllParaMargin->mnIndex = -1;
+ }
+ if (pAllMargin)
+ {
+ pAllMargin->mnIndex = -1;
+ }
+
if( pAllBorderDistance )
pAllBorderDistance->mnIndex = -1;
@@ -593,8 +655,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 8cf954a868..66c80b95b1 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -28,11 +28,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>
#include "txtprhdl.hxx"
-#include <xmloff/txtprmap.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -88,6 +91,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 ),
@@ -575,11 +581,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
@@ -844,7 +851,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;
@@ -854,7 +861,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;