diff options
author | Thorsten Behrens <tbehrens@novell.com> | 2011-04-28 00:12:58 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@novell.com> | 2011-04-28 00:12:58 +0200 |
commit | b969af6f23727b21115dc9be9caa6bd5959f715b (patch) | |
tree | dad01ac060f65a7d5a93526ffe7e64f0cf5c5bf0 /xmloff | |
parent | 06b6df6759929073e917ae0fa7e819407d3e2555 (diff) | |
parent | 10b8226d32eb2ef19ae6206823796b591a6b3261 (diff) |
Merge commit 'ooo/DEV300_m106' into integration/dev300_m106
Conflicts:
avmedia/source/gstreamer/gstframegrabber.cxx
avmedia/source/gstreamer/gstplayer.cxx
avmedia/source/gstreamer/gstplayer.hxx
basic/inc/basic/sbxdef.hxx
basic/source/classes/sbxmod.cxx
basic/source/comp/makefile.mk
basic/source/comp/sbcomp.cxx
basic/source/inc/namecont.hxx
basic/source/inc/scriptcont.hxx
basic/source/runtime/methods.cxx
basic/source/runtime/runtime.cxx
basic/source/runtime/stdobj.cxx
basic/source/runtime/step1.cxx
basic/source/uno/namecont.cxx
basic/util/makefile.mk
connectivity/source/commontools/predicateinput.cxx
connectivity/source/drivers/dbase/DNoException.cxx
connectivity/source/drivers/dbase/DTable.cxx
connectivity/source/drivers/file/fcomp.cxx
connectivity/source/drivers/jdbc/JConnection.cxx
connectivity/source/drivers/odbcbase/OResultSet.cxx
connectivity/source/drivers/odbcbase/OStatement.cxx
connectivity/source/parse/sqlnode.cxx
desktop/source/app/app.cxx
drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
drawinglayer/source/processor2d/vclprocessor2d.cxx
formula/inc/formula/token.hxx
formula/source/core/api/token.cxx
fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
fpicker/source/win32/filepicker/platform_vista.h
framework/source/helper/persistentwindowstate.cxx
framework/source/uielement/menubarmanager.cxx
oovbaapi/ooo/vba/XFoundFiles.idl
oovbaapi/ooo/vba/excel/XApplication.idl
oovbaapi/ooo/vba/msforms/XCheckBox.idl
oovbaapi/ooo/vba/msforms/XComboBox.idl
oovbaapi/ooo/vba/msforms/XControl.idl
oovbaapi/ooo/vba/msforms/XGroupBox.idl
oovbaapi/ooo/vba/msforms/XLabel.idl
oovbaapi/ooo/vba/msforms/XListBox.idl
oovbaapi/ooo/vba/msforms/XNewFont.idl
oovbaapi/ooo/vba/msforms/XRadioButton.idl
oovbaapi/ooo/vba/msforms/XTextBox.idl
oovbaapi/ooo/vba/msforms/XToggleButton.idl
scripting/source/dlgprov/dlgevtatt.cxx
sfx2/source/control/unoctitm.cxx
sfx2/source/doc/objstor.cxx
sfx2/source/doc/objxtor.cxx
svx/inc/svx/svdograf.hxx
svx/source/form/fmpage.cxx
svx/source/form/fmpgeimp.cxx
svx/source/svdraw/svdedtv.cxx
svx/source/svdraw/svdfmtf.cxx
svx/source/svdraw/svdograf.cxx
svx/source/svdraw/svdouno.cxx
svx/source/xml/xmlgrhlp.cxx
uui/source/iahndl-ssl.cxx
vbahelper/Library_msforms.mk
vbahelper/Library_vbahelper.mk
vbahelper/inc/vbahelper/vbahelper.hxx
vbahelper/prj/build.lst
vbahelper/source/msforms/vbacombobox.cxx
vbahelper/source/msforms/vbacontrol.cxx
vbahelper/source/msforms/vbacontrols.cxx
vbahelper/source/msforms/vbaframe.cxx
vbahelper/source/msforms/vbaframe.hxx
vbahelper/source/msforms/vbalabel.cxx
vbahelper/source/msforms/vbalabel.hxx
vbahelper/source/msforms/vbalistbox.cxx
vbahelper/source/msforms/vbalistbox.hxx
vbahelper/source/msforms/vbamultipage.cxx
vbahelper/source/msforms/vbatogglebutton.cxx
vbahelper/source/msforms/vbauserform.cxx
vbahelper/source/vbahelper/vbacommandbar.cxx
vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
vbahelper/source/vbahelper/vbahelper.cxx
vbahelper/source/vbahelper/vbawindowbase.cxx
xmloff/source/meta/xmlmetai.cxx
xmloff/source/style/PageMasterExportPropMapper.cxx
xmloff/source/style/PageMasterStyleMap.cxx
xmloff/source/text/txtexppr.cxx
xmloff/source/text/txtprmap.cxx
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 | 17 | ||||
-rw-r--r-- | xmloff/source/forms/elementimport.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/meta/xmlmetai.cxx | 113 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterExportPropMapper.cxx | 44 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterImportPropMapper.cxx | 75 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterStyleMap.cxx | 25 | ||||
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 121 | ||||
-rw-r--r-- | xmloff/source/text/txtimppr.cxx | 78 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 23 |
14 files changed, 386 insertions, 155 deletions
diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx index d81bd80daa..a555fce37f 100644 --- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx +++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx @@ -84,6 +84,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) @@ -119,6 +124,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) @@ -141,6 +152,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 6d0e3faca6..20f601ba34 100644 --- a/xmloff/inc/xmloff/txtprmap.hxx +++ b/xmloff/inc/xmloff/txtprmap.hxx @@ -180,6 +180,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 fff0fc3bad..900521ee0f 100644 --- a/xmloff/inc/xmloff/xmlmetai.hxx +++ b/xmloff/inc/xmloff/xmlmetai.hxx @@ -26,8 +26,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" @@ -70,12 +70,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 d361c38ac9..74fffcdee6 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3136,6 +3136,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 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/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; |