Files
libreoffice/xmloff/source/style/PageMasterExportPropMapper.cxx

576 lines
22 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by: Armin Le Grand. #118558# Correcting OLE attributes of LO3.4 at load time by loading as OOo3.3, details see task. http://svn.apache.org/viewvc?view=revision&revision=1195906 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles http://svn.apache.org/viewvc?view=revision&revision=1293316 #119337# Solves the wrong get/setPropertyValue calls in SvxShapeText (and thus in SvxOle2Shape) http://svn.apache.org/viewvc?view=revision&revision=1344156 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117717#: remove wrong assertion http://svn.apache.org/viewvc?view=revision&revision=1172349 Patch contributed by Herbert Duerr goodbye Registration and License dialogs, don't let the door hit you http://svn.apache.org/viewvc?view=revision&revision=1172613 help gcc 4.6.0 on 32bit ubuntu 11.10" http://svn.apache.org/viewvc?view=revision&revision=1245357 Do not add targets for junit tests when junit is disabled. Patch contributed by Andre Fischer http://svn.apache.org/viewvc?view=revision&revision=1241508 Revert "sb140: #i117082# avoid unncessary static class data members commit 21d97438e2944861e26e4984195f959a0cce1e41. remove obsolete FreeBSD visibility special case. retain consolidated BSD bridge code, remove OS/2 pieces.
2012-11-12 17:21:24 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-10-18 10:34:12 +00:00
#include "PageMasterExportPropMapper.hxx"
#include <xmloff/xmltoken.hxx>
#include <comphelper/types.hxx>
#include <com/sun/star/table/BorderLine2.hpp>
#include <xmloff/PageMasterStyleMap.hxx>
2000-10-20 15:30:27 +00:00
#include <tools/debug.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/extract.hxx>
2000-10-20 15:30:27 +00:00
Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes (cherry picked from commit cc25c58f7052827bfebdc9fbeec668c8fa29ed1b) Conflicts: cui/source/factory/dlgfact.cxx cui/source/factory/dlgfact.hxx cui/source/inc/bbdlg.hxx cui/source/inc/cuires.hrc cui/source/tabpages/bbdlg.cxx cui/source/tabpages/bbdlg.src cui/source/tabpages/page.cxx cui/source/tabpages/tparea.cxx include/svx/pagectrl.hxx include/svx/svxdlg.hxx include/svx/svxids.hrc include/xmloff/PageMasterStyleMap.hxx include/xmloff/prstylei.hxx include/xmloff/txtprmap.hxx svx/Package_inc.mk svx/inc/svx/hdft.hxx svx/source/dialog/hdft.cxx svx/source/dialog/pagectrl.cxx svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/unodraw/unobrushitemhelper.cxx sw/Library_sw.mk sw/inc/fillattributes.hxx sw/inc/format.hxx sw/inc/frmatr.hxx sw/inc/frmfmt.hxx sw/inc/hintids.hxx sw/inc/hints.hxx sw/inc/ndtxt.hxx sw/inc/node.hxx sw/inc/swunohelper.hxx sw/inc/unobrushitemhelper.hxx sw/inc/unoprnms.hxx sw/source/core/attr/format.cxx sw/source/core/attr/hints.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnew.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/poolfmt.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/node.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/inc/rolbck.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/fillattributes.cxx sw/source/core/layout/findfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/rolbck.cxx sw/source/core/unocore/swunohelper.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoparagraph.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/chrdlg/paradlg.src sw/source/ui/chrdlg/pardlg.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/frmdlg/colex.cxx sw/source/uibase/shells/basesh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uiview/viewstat.cxx sw/source/uibase/utlui/uitool.cxx xmloff/inc/PageMasterImportContext.hxx xmloff/inc/xmloff/XMLShapeStyleContext.hxx xmloff/source/draw/XMLShapeStyleContext.cxx xmloff/source/draw/sdpropls.hxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterImportContext.cxx xmloff/source/style/PageMasterPropHdlFactory.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx xmloff/source/text/txtstyli.cxx Conflicts: svx/source/dialog/hdft.cxx sw/source/core/doc/visiturl.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtatr2.cxx sw/source/core/unocore/unostyle.cxx Change-Id: I7e8779db6c0cbd1e242b63eab888f468f2de509a
2014-06-02 15:00:50 +00:00
//UUUU
#include <xmloff/txtprmap.hxx>
2000-10-18 10:34:12 +00:00
using namespace ::com::sun::star;
2000-10-20 15:30:27 +00:00
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::comphelper;
using namespace ::xmloff::token;
static inline bool lcl_HasSameLineWidth( const table::BorderLine2& rLine1, const table::BorderLine2& rLine2 )
{
return (rLine1.InnerLineWidth == rLine2.InnerLineWidth) &&
(rLine1.OuterLineWidth == rLine2.OuterLineWidth) &&
2011-01-12 23:30:44 +01:00
(rLine1.LineDistance == rLine2.LineDistance) &&
(rLine1.LineWidth == rLine2.LineWidth);
}
inline bool operator==( const table::BorderLine2& rLine1, const table::BorderLine2& rLine2 )
{
return (rLine1.Color == rLine2.Color) &&
lcl_HasSameLineWidth( rLine1, rLine2 ) &&
( rLine1.LineStyle == rLine2.LineStyle );
}
static inline void lcl_RemoveState( XMLPropertyState* pState )
{
pState->mnIndex = -1;
pState->maValue.clear();
}
static void lcl_RemoveStateIfZero16( XMLPropertyState* pState )
{
sal_Int16 nValue = sal_Int16();
if( (pState->maValue >>= nValue) && !nValue )
lcl_RemoveState( pState );
}
static void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int32 nIndex, const OUString& rProperty, uno::Reference< beans::XPropertySet >& xProps)
{
if(::cppu::any2bool(xProps->getPropertyValue(rProperty)))
rPropState.push_back(XMLPropertyState (nIndex, css::uno::Any(true)));
}
// helper struct to handle equal XMLPropertyState's for page, header and footer
struct XMLPropertyStateBuffer
{
XMLPropertyState* pPMMarginAll;
XMLPropertyState* pPMMarginTop;
XMLPropertyState* pPMMarginBottom;
XMLPropertyState* pPMMarginLeft;
XMLPropertyState* pPMMarginRight;
XMLPropertyState* pPMBorderAll;
XMLPropertyState* pPMBorderTop;
XMLPropertyState* pPMBorderBottom;
XMLPropertyState* pPMBorderLeft;
XMLPropertyState* pPMBorderRight;
XMLPropertyState* pPMBorderWidthAll;
XMLPropertyState* pPMBorderWidthTop;
XMLPropertyState* pPMBorderWidthBottom;
XMLPropertyState* pPMBorderWidthLeft;
XMLPropertyState* pPMBorderWidthRight;
XMLPropertyState* pPMPaddingAll;
XMLPropertyState* pPMPaddingTop;
XMLPropertyState* pPMPaddingBottom;
XMLPropertyState* pPMPaddingLeft;
XMLPropertyState* pPMPaddingRight;
XMLPropertyStateBuffer();
void ContextFilter( ::std::vector< XMLPropertyState >& rPropState );
};
XMLPropertyStateBuffer::XMLPropertyStateBuffer()
: pPMMarginAll( NULL )
, pPMMarginTop( NULL )
, pPMMarginBottom( NULL )
, pPMMarginLeft( NULL )
, pPMMarginRight( NULL )
,
pPMBorderAll( NULL ),
pPMBorderTop( NULL ),
pPMBorderBottom( NULL ),
pPMBorderLeft( NULL ),
pPMBorderRight( NULL ),
pPMBorderWidthAll( NULL ),
pPMBorderWidthTop( NULL ),
pPMBorderWidthBottom( NULL ),
pPMBorderWidthLeft( NULL ),
pPMBorderWidthRight( NULL ),
pPMPaddingAll( NULL ),
pPMPaddingTop( NULL ),
pPMPaddingBottom( NULL ),
pPMPaddingLeft( NULL ),
pPMPaddingRight( NULL )
{
}
void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& )
{
if (pPMMarginAll)
{
lcl_RemoveState(pPMMarginAll); // #i117696# do not write fo:margin
}
if( pPMBorderAll )
{
if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight )
{
table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
2000-10-18 10:34:12 +00:00
pPMBorderTop->maValue >>= aLineTop;
pPMBorderBottom->maValue >>= aLineBottom;
pPMBorderLeft->maValue >>= aLineLeft;
pPMBorderRight->maValue >>= aLineRight;
if( (aLineTop == aLineBottom) && (aLineBottom == aLineLeft) && (aLineLeft == aLineRight) )
{
lcl_RemoveState( pPMBorderTop );
lcl_RemoveState( pPMBorderBottom );
lcl_RemoveState( pPMBorderLeft );
lcl_RemoveState( pPMBorderRight );
}
else
lcl_RemoveState( pPMBorderAll );
}
else
lcl_RemoveState( pPMBorderAll );
}
if( pPMBorderWidthAll )
{
if( pPMBorderWidthTop && pPMBorderWidthBottom && pPMBorderWidthLeft && pPMBorderWidthRight )
{
table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
pPMBorderWidthTop->maValue >>= aLineTop;
pPMBorderWidthBottom->maValue >>= aLineBottom;
pPMBorderWidthLeft->maValue >>= aLineLeft;
pPMBorderWidthRight->maValue >>= aLineRight;
if( lcl_HasSameLineWidth( aLineTop, aLineBottom ) &&
lcl_HasSameLineWidth( aLineBottom, aLineLeft ) &&
lcl_HasSameLineWidth( aLineLeft, aLineRight ) )
{
lcl_RemoveState( pPMBorderWidthTop );
lcl_RemoveState( pPMBorderWidthBottom );
lcl_RemoveState( pPMBorderWidthLeft );
lcl_RemoveState( pPMBorderWidthRight );
}
else
lcl_RemoveState( pPMBorderWidthAll );
}
else
lcl_RemoveState( pPMBorderWidthAll );
}
if( pPMPaddingAll )
{
if( pPMPaddingTop && pPMPaddingBottom && pPMPaddingLeft && pPMPaddingRight )
{
sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0;
pPMPaddingTop->maValue >>= nTop;
pPMPaddingBottom->maValue >>= nBottom;
pPMPaddingLeft->maValue >>= nLeft;
pPMPaddingRight->maValue >>= nRight;
if( (nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight) )
{
lcl_RemoveState( pPMPaddingTop );
lcl_RemoveState( pPMPaddingBottom );
lcl_RemoveState( pPMPaddingLeft );
lcl_RemoveState( pPMPaddingRight );
}
else
lcl_RemoveState( pPMPaddingAll );
}
else
lcl_RemoveState( pPMPaddingAll );
}
}
2000-10-18 10:34:12 +00:00
XMLPageMasterExportPropMapper::XMLPageMasterExportPropMapper(
const rtl::Reference< XMLPropertySetMapper >& rMapper,
2000-10-20 15:30:27 +00:00
SvXMLExport& rExport ) :
SvXMLExportPropertyMapper( rMapper ),
2000-10-26 07:35:07 +00:00
aBackgroundImageExport( rExport ),
aTextColumnsExport( rExport ),
aFootnoteSeparatorExport( rExport )
2000-10-18 10:34:12 +00:00
{
}
XMLPageMasterExportPropMapper::~XMLPageMasterExportPropMapper()
{
}
2000-10-20 15:30:27 +00:00
void XMLPageMasterExportPropMapper::handleElementItem(
SvXMLExport&,
2000-10-20 15:30:27 +00:00
const XMLPropertyState& rProperty,
SvXmlExportFlags /*nFlags*/,
2000-10-20 15:30:27 +00:00
const ::std::vector< XMLPropertyState >* pProperties,
sal_uInt32 nIdx ) const
{
XMLPageMasterExportPropMapper* pThis = const_cast<XMLPageMasterExportPropMapper*>(this);
2000-10-20 15:30:27 +00:00
sal_uInt32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
switch( nContextId )
2000-10-20 15:30:27 +00:00
{
case CTF_PM_GRAPHICURL:
case CTF_PM_HEADERGRAPHICURL:
case CTF_PM_FOOTERGRAPHICURL:
2000-10-20 15:30:27 +00:00
{
DBG_ASSERT( pProperties && (nIdx >= 2), "property vector missing" );
sal_Int32 nPos;
sal_Int32 nFilter;
switch( nContextId )
{
case CTF_PM_GRAPHICURL:
nPos = CTF_PM_GRAPHICPOSITION;
nFilter = CTF_PM_GRAPHICFILTER;
break;
case CTF_PM_HEADERGRAPHICURL:
nPos = CTF_PM_HEADERGRAPHICPOSITION;
nFilter = CTF_PM_HEADERGRAPHICFILTER;
break;
case CTF_PM_FOOTERGRAPHICURL:
nPos = CTF_PM_FOOTERGRAPHICPOSITION;
nFilter = CTF_PM_FOOTERGRAPHICFILTER;
break;
default:
nPos = 0; // TODO What values should this be?
nFilter = 0;
}
const Any* pPos = NULL;
const Any* pFilter = NULL;
if( pProperties && (nIdx >= 2) )
{
const XMLPropertyState& rPos = (*pProperties)[nIdx - 2];
DBG_ASSERT( getPropertySetMapper()->GetEntryContextId( rPos.mnIndex ) == nPos,
"invalid property map: pos expected" );
if( getPropertySetMapper()->GetEntryContextId( rPos.mnIndex ) == nPos )
pPos = &rPos.maValue;
2000-10-20 15:30:27 +00:00
const XMLPropertyState& rFilter = (*pProperties)[nIdx - 1];
DBG_ASSERT( getPropertySetMapper()->GetEntryContextId( rFilter.mnIndex ) == nFilter,
"invalid property map: filter expected" );
if( getPropertySetMapper()->GetEntryContextId( rFilter.mnIndex ) == nFilter )
pFilter = &rFilter.maValue;
}
sal_uInt32 nPropIndex = rProperty.mnIndex;
pThis->aBackgroundImageExport.exportXML( rProperty.maValue, pPos, pFilter, NULL,
getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
2000-10-20 15:30:27 +00:00
}
break;
2000-10-26 07:35:07 +00:00
case CTF_PM_TEXTCOLUMNS:
pThis->aTextColumnsExport.exportXML( rProperty.maValue );
break;
case CTF_PM_FTN_LINE_WEIGHT:
pThis->aFootnoteSeparatorExport.exportXML( pProperties, nIdx,
getPropertySetMapper());
break;
2000-10-20 15:30:27 +00:00
}
}
2000-10-18 10:34:12 +00:00
void XMLPageMasterExportPropMapper::handleSpecialItem(
SvXMLAttributeList&,
const XMLPropertyState&,
const SvXMLUnitConverter&,
const SvXMLNamespaceMap&,
const ::std::vector< XMLPropertyState >*,
sal_uInt32 /*nIdx*/) const
2000-10-18 10:34:12 +00:00
{
}
void XMLPageMasterExportPropMapper::ContextFilter(
bool bEnableFoFontFamily,
::std::vector< XMLPropertyState >& rPropState,
Reference< XPropertySet > rPropSet ) const
{
XMLPropertyStateBuffer aPageBuffer;
XMLPropertyStateBuffer aHeaderBuffer;
XMLPropertyStateBuffer aFooterBuffer;
XMLPropertyState* pPMHeaderHeight = NULL;
XMLPropertyState* pPMHeaderMinHeight = NULL;
XMLPropertyState* pPMHeaderDynamic = NULL;
XMLPropertyState* pPMFooterHeight = NULL;
XMLPropertyState* pPMFooterMinHeight = NULL;
XMLPropertyState* pPMFooterDynamic = NULL;
XMLPropertyState* pPMScaleTo = NULL;
XMLPropertyState* pPMScaleToPages = NULL;
XMLPropertyState* pPMScaleToX = NULL;
XMLPropertyState* pPMScaleToY = NULL;
XMLPropertyState* pPMStandardMode = NULL;
XMLPropertyState* pPMGridBaseWidth = NULL;
// same as pPMGridSnapTo but for backward compatibility only
XMLPropertyState* pPMGridSnapToChars = NULL;
XMLPropertyState* pPMGridSnapTo = NULL;
XMLPropertyState* pPrint = NULL;
Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes (cherry picked from commit cc25c58f7052827bfebdc9fbeec668c8fa29ed1b) Conflicts: cui/source/factory/dlgfact.cxx cui/source/factory/dlgfact.hxx cui/source/inc/bbdlg.hxx cui/source/inc/cuires.hrc cui/source/tabpages/bbdlg.cxx cui/source/tabpages/bbdlg.src cui/source/tabpages/page.cxx cui/source/tabpages/tparea.cxx include/svx/pagectrl.hxx include/svx/svxdlg.hxx include/svx/svxids.hrc include/xmloff/PageMasterStyleMap.hxx include/xmloff/prstylei.hxx include/xmloff/txtprmap.hxx svx/Package_inc.mk svx/inc/svx/hdft.hxx svx/source/dialog/hdft.cxx svx/source/dialog/pagectrl.cxx svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/unodraw/unobrushitemhelper.cxx sw/Library_sw.mk sw/inc/fillattributes.hxx sw/inc/format.hxx sw/inc/frmatr.hxx sw/inc/frmfmt.hxx sw/inc/hintids.hxx sw/inc/hints.hxx sw/inc/ndtxt.hxx sw/inc/node.hxx sw/inc/swunohelper.hxx sw/inc/unobrushitemhelper.hxx sw/inc/unoprnms.hxx sw/source/core/attr/format.cxx sw/source/core/attr/hints.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnew.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/poolfmt.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/node.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/inc/rolbck.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/fillattributes.cxx sw/source/core/layout/findfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/rolbck.cxx sw/source/core/unocore/swunohelper.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoparagraph.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/chrdlg/paradlg.src sw/source/ui/chrdlg/pardlg.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/frmdlg/colex.cxx sw/source/uibase/shells/basesh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uiview/viewstat.cxx sw/source/uibase/utlui/uitool.cxx xmloff/inc/PageMasterImportContext.hxx xmloff/inc/xmloff/XMLShapeStyleContext.hxx xmloff/source/draw/XMLShapeStyleContext.cxx xmloff/source/draw/sdpropls.hxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterImportContext.cxx xmloff/source/style/PageMasterPropHdlFactory.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx xmloff/source/text/txtstyli.cxx Conflicts: svx/source/dialog/hdft.cxx sw/source/core/doc/visiturl.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtatr2.cxx sw/source/core/unocore/unostyle.cxx Change-Id: I7e8779db6c0cbd1e242b63eab888f468f2de509a
2014-06-02 15:00:50 +00:00
//UUUU
XMLPropertyState* pRepeatOffsetX = NULL;
XMLPropertyState* pRepeatOffsetY = NULL;
XMLPropertyState* pHeaderRepeatOffsetX = NULL;
XMLPropertyState* pHeaderRepeatOffsetY = NULL;
XMLPropertyState* pFooterRepeatOffsetX = NULL;
XMLPropertyState* pFooterRepeatOffsetY = NULL;
rtl::Reference < XMLPropertySetMapper > aPropMapper(getPropertySetMapper());
for( ::std::vector< XMLPropertyState >::iterator aIter = rPropState.begin(); aIter != rPropState.end(); ++aIter )
{
XMLPropertyState *pProp = &(*aIter);
sal_Int16 nContextId = aPropMapper->GetEntryContextId( pProp->mnIndex );
sal_Int16 nFlag = nContextId & CTF_PM_FLAGMASK;
sal_Int16 nSimpleId = nContextId & (~CTF_PM_FLAGMASK | XML_PM_CTF_START);
sal_Int16 nPrintId = nContextId & CTF_PM_PRINTMASK;
XMLPropertyStateBuffer* pBuffer;
switch( nFlag )
{
case CTF_PM_HEADERFLAG: pBuffer = &aHeaderBuffer; break;
case CTF_PM_FOOTERFLAG: pBuffer = &aFooterBuffer; break;
default: pBuffer = &aPageBuffer; break;
}
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;
case CTF_PM_BORDERLEFT: pBuffer->pPMBorderLeft = pProp; break;
case CTF_PM_BORDERRIGHT: pBuffer->pPMBorderRight = pProp; break;
case CTF_PM_BORDERWIDTHALL: pBuffer->pPMBorderWidthAll = pProp; break;
case CTF_PM_BORDERWIDTHTOP: pBuffer->pPMBorderWidthTop = pProp; break;
case CTF_PM_BORDERWIDTHBOTTOM: pBuffer->pPMBorderWidthBottom = pProp; break;
case CTF_PM_BORDERWIDTHLEFT: pBuffer->pPMBorderWidthLeft = pProp; break;
case CTF_PM_BORDERWIDTHRIGHT: pBuffer->pPMBorderWidthRight = pProp; break;
case CTF_PM_PADDINGALL: pBuffer->pPMPaddingAll = pProp; break;
case CTF_PM_PADDINGTOP: pBuffer->pPMPaddingTop = pProp; break;
case CTF_PM_PADDINGBOTTOM: pBuffer->pPMPaddingBottom = pProp; break;
case CTF_PM_PADDINGLEFT: pBuffer->pPMPaddingLeft = pProp; break;
case CTF_PM_PADDINGRIGHT: pBuffer->pPMPaddingRight = pProp; break;
}
switch( nContextId )
{
case CTF_PM_HEADERHEIGHT: pPMHeaderHeight = pProp; break;
case CTF_PM_HEADERMINHEIGHT: pPMHeaderMinHeight = pProp; break;
case CTF_PM_HEADERDYNAMIC: pPMHeaderDynamic = pProp; break;
case CTF_PM_FOOTERHEIGHT: pPMFooterHeight = pProp; break;
case CTF_PM_FOOTERMINHEIGHT: pPMFooterMinHeight = pProp; break;
case CTF_PM_FOOTERDYNAMIC: pPMFooterDynamic = pProp; break;
case CTF_PM_SCALETO: pPMScaleTo = pProp; break;
case CTF_PM_SCALETOPAGES: pPMScaleToPages = pProp; break;
case CTF_PM_SCALETOX: pPMScaleToX = pProp; break;
case CTF_PM_SCALETOY: pPMScaleToY = pProp; break;
case CTF_PM_STANDARD_MODE: pPMStandardMode = pProp; break;
case CTP_PM_GRID_BASE_WIDTH: pPMGridBaseWidth = pProp; break;
case CTP_PM_GRID_SNAP_TO_CHARS: pPMGridSnapToChars = pProp; break;
case CTP_PM_GRID_SNAP_TO: pPMGridSnapTo = pProp; break;
Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes (cherry picked from commit cc25c58f7052827bfebdc9fbeec668c8fa29ed1b) Conflicts: cui/source/factory/dlgfact.cxx cui/source/factory/dlgfact.hxx cui/source/inc/bbdlg.hxx cui/source/inc/cuires.hrc cui/source/tabpages/bbdlg.cxx cui/source/tabpages/bbdlg.src cui/source/tabpages/page.cxx cui/source/tabpages/tparea.cxx include/svx/pagectrl.hxx include/svx/svxdlg.hxx include/svx/svxids.hrc include/xmloff/PageMasterStyleMap.hxx include/xmloff/prstylei.hxx include/xmloff/txtprmap.hxx svx/Package_inc.mk svx/inc/svx/hdft.hxx svx/source/dialog/hdft.cxx svx/source/dialog/pagectrl.cxx svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/unodraw/unobrushitemhelper.cxx sw/Library_sw.mk sw/inc/fillattributes.hxx sw/inc/format.hxx sw/inc/frmatr.hxx sw/inc/frmfmt.hxx sw/inc/hintids.hxx sw/inc/hints.hxx sw/inc/ndtxt.hxx sw/inc/node.hxx sw/inc/swunohelper.hxx sw/inc/unobrushitemhelper.hxx sw/inc/unoprnms.hxx sw/source/core/attr/format.cxx sw/source/core/attr/hints.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnew.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/poolfmt.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/node.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/inc/rolbck.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/fillattributes.cxx sw/source/core/layout/findfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/rolbck.cxx sw/source/core/unocore/swunohelper.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoparagraph.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/chrdlg/paradlg.src sw/source/ui/chrdlg/pardlg.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/frmdlg/colex.cxx sw/source/uibase/shells/basesh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uiview/viewstat.cxx sw/source/uibase/utlui/uitool.cxx xmloff/inc/PageMasterImportContext.hxx xmloff/inc/xmloff/XMLShapeStyleContext.hxx xmloff/source/draw/XMLShapeStyleContext.cxx xmloff/source/draw/sdpropls.hxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterImportContext.cxx xmloff/source/style/PageMasterPropHdlFactory.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx xmloff/source/text/txtstyli.cxx Conflicts: svx/source/dialog/hdft.cxx sw/source/core/doc/visiturl.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtatr2.cxx sw/source/core/unocore/unostyle.cxx Change-Id: I7e8779db6c0cbd1e242b63eab888f468f2de509a
2014-06-02 15:00:50 +00:00
//UUUU
case CTF_PM_REPEAT_OFFSET_X:
pRepeatOffsetX = pProp;
break;
//UUUU
case CTF_PM_REPEAT_OFFSET_Y:
pRepeatOffsetY = pProp;
break;
//UUUU
case CTF_PM_HEADERREPEAT_OFFSET_X:
pHeaderRepeatOffsetX = pProp;
break;
//UUUU
case CTF_PM_HEADERREPEAT_OFFSET_Y:
pHeaderRepeatOffsetY = pProp;
break;
//UUUU
case CTF_PM_FOOTERREPEAT_OFFSET_X:
pFooterRepeatOffsetX = pProp;
break;
//UUUU
case CTF_PM_FOOTERREPEAT_OFFSET_Y:
pFooterRepeatOffsetY = pProp;
break;
//UUUU Sort out empty entries
case CTF_PM_FILLGRADIENTNAME:
case CTF_PM_FILLHATCHNAME:
case CTF_PM_FILLBITMAPNAME:
case CTF_PM_FILLTRANSNAME:
case CTF_PM_HEADERFILLGRADIENTNAME:
case CTF_PM_HEADERFILLHATCHNAME:
case CTF_PM_HEADERFILLBITMAPNAME:
case CTF_PM_HEADERFILLTRANSNAME:
case CTF_PM_FOOTERFILLGRADIENTNAME:
case CTF_PM_FOOTERFILLHATCHNAME:
case CTF_PM_FOOTERFILLBITMAPNAME:
case CTF_PM_FOOTERFILLTRANSNAME:
{
rtl::OUString aStr;
if( (pProp->maValue >>= aStr) && 0 == aStr.getLength() )
{
pProp->mnIndex = -1;
}
break;
}
}
Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes (cherry picked from commit cc25c58f7052827bfebdc9fbeec668c8fa29ed1b) Conflicts: cui/source/factory/dlgfact.cxx cui/source/factory/dlgfact.hxx cui/source/inc/bbdlg.hxx cui/source/inc/cuires.hrc cui/source/tabpages/bbdlg.cxx cui/source/tabpages/bbdlg.src cui/source/tabpages/page.cxx cui/source/tabpages/tparea.cxx include/svx/pagectrl.hxx include/svx/svxdlg.hxx include/svx/svxids.hrc include/xmloff/PageMasterStyleMap.hxx include/xmloff/prstylei.hxx include/xmloff/txtprmap.hxx svx/Package_inc.mk svx/inc/svx/hdft.hxx svx/source/dialog/hdft.cxx svx/source/dialog/pagectrl.cxx svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/unodraw/unobrushitemhelper.cxx sw/Library_sw.mk sw/inc/fillattributes.hxx sw/inc/format.hxx sw/inc/frmatr.hxx sw/inc/frmfmt.hxx sw/inc/hintids.hxx sw/inc/hints.hxx sw/inc/ndtxt.hxx sw/inc/node.hxx sw/inc/swunohelper.hxx sw/inc/unobrushitemhelper.hxx sw/inc/unoprnms.hxx sw/source/core/attr/format.cxx sw/source/core/attr/hints.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnew.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/poolfmt.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/node.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/inc/rolbck.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/fillattributes.cxx sw/source/core/layout/findfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/rolbck.cxx sw/source/core/unocore/swunohelper.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoparagraph.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/chrdlg/paradlg.src sw/source/ui/chrdlg/pardlg.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/frmdlg/colex.cxx sw/source/uibase/shells/basesh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uiview/viewstat.cxx sw/source/uibase/utlui/uitool.cxx xmloff/inc/PageMasterImportContext.hxx xmloff/inc/xmloff/XMLShapeStyleContext.hxx xmloff/source/draw/XMLShapeStyleContext.cxx xmloff/source/draw/sdpropls.hxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterImportContext.cxx xmloff/source/style/PageMasterPropHdlFactory.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx xmloff/source/text/txtstyli.cxx Conflicts: svx/source/dialog/hdft.cxx sw/source/core/doc/visiturl.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtatr2.cxx sw/source/core/unocore/unostyle.cxx Change-Id: I7e8779db6c0cbd1e242b63eab888f468f2de509a
2014-06-02 15:00:50 +00:00
if (nPrintId == CTF_PM_PRINTMASK)
{
pPrint = pProp;
lcl_RemoveState(pPrint);
}
}
Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes (cherry picked from commit cc25c58f7052827bfebdc9fbeec668c8fa29ed1b) Conflicts: cui/source/factory/dlgfact.cxx cui/source/factory/dlgfact.hxx cui/source/inc/bbdlg.hxx cui/source/inc/cuires.hrc cui/source/tabpages/bbdlg.cxx cui/source/tabpages/bbdlg.src cui/source/tabpages/page.cxx cui/source/tabpages/tparea.cxx include/svx/pagectrl.hxx include/svx/svxdlg.hxx include/svx/svxids.hrc include/xmloff/PageMasterStyleMap.hxx include/xmloff/prstylei.hxx include/xmloff/txtprmap.hxx svx/Package_inc.mk svx/inc/svx/hdft.hxx svx/source/dialog/hdft.cxx svx/source/dialog/pagectrl.cxx svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/unodraw/unobrushitemhelper.cxx sw/Library_sw.mk sw/inc/fillattributes.hxx sw/inc/format.hxx sw/inc/frmatr.hxx sw/inc/frmfmt.hxx sw/inc/hintids.hxx sw/inc/hints.hxx sw/inc/ndtxt.hxx sw/inc/node.hxx sw/inc/swunohelper.hxx sw/inc/unobrushitemhelper.hxx sw/inc/unoprnms.hxx sw/source/core/attr/format.cxx sw/source/core/attr/hints.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnew.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/poolfmt.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/node.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/inc/rolbck.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/fillattributes.cxx sw/source/core/layout/findfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/rolbck.cxx sw/source/core/unocore/swunohelper.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoparagraph.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/chrdlg/paradlg.src sw/source/ui/chrdlg/pardlg.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/frmdlg/colex.cxx sw/source/uibase/shells/basesh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uiview/viewstat.cxx sw/source/uibase/utlui/uitool.cxx xmloff/inc/PageMasterImportContext.hxx xmloff/inc/xmloff/XMLShapeStyleContext.hxx xmloff/source/draw/XMLShapeStyleContext.cxx xmloff/source/draw/sdpropls.hxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterImportContext.cxx xmloff/source/style/PageMasterPropHdlFactory.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx xmloff/source/text/txtstyli.cxx Conflicts: svx/source/dialog/hdft.cxx sw/source/core/doc/visiturl.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtatr2.cxx sw/source/core/unocore/unostyle.cxx Change-Id: I7e8779db6c0cbd1e242b63eab888f468f2de509a
2014-06-02 15:00:50 +00:00
//UUUU These entries need to be reduced to a single one for XML export.
// Both would be exported as 'draw:tile-repeat-offset' following a percent
// value and a 'vertical' or 'horizontal' tag as mark. If both would be active
// and both would be exported this would create an XML error (same property twice)
if(pRepeatOffsetX && pRepeatOffsetY)
{
sal_Int32 nOffset(0);
if((pRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
{
pRepeatOffsetX->mnIndex = -1;
}
else
{
pRepeatOffsetY->mnIndex = -1;
}
}
//UUUU Same as above for Header
if(pHeaderRepeatOffsetX && pHeaderRepeatOffsetY)
{
sal_Int32 nOffset(0);
if((pHeaderRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
{
pHeaderRepeatOffsetX->mnIndex = -1;
}
else
{
pHeaderRepeatOffsetY->mnIndex = -1;
}
}
//UUUU Same as above for Footer
if(pFooterRepeatOffsetX && pFooterRepeatOffsetY)
{
sal_Int32 nOffset(0);
if((pFooterRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
{
pFooterRepeatOffsetX->mnIndex = -1;
}
else
{
pFooterRepeatOffsetY->mnIndex = -1;
}
}
if( pPMStandardMode && !getBOOL(pPMStandardMode->maValue) )
{
lcl_RemoveState(pPMStandardMode);
if( pPMGridBaseWidth )
lcl_RemoveState(pPMGridBaseWidth);
if( pPMGridSnapToChars )
lcl_RemoveState(pPMGridSnapToChars);
if (pPMGridSnapTo)
{
lcl_RemoveState(pPMGridSnapTo);
}
}
if( pPMGridBaseWidth && pPMStandardMode )
lcl_RemoveState(pPMStandardMode);
aPageBuffer.ContextFilter( rPropState );
aHeaderBuffer.ContextFilter( rPropState );
aFooterBuffer.ContextFilter( rPropState );
if( pPMHeaderHeight && (!pPMHeaderDynamic || (pPMHeaderDynamic && getBOOL( pPMHeaderDynamic->maValue ))) )
lcl_RemoveState( pPMHeaderHeight );
if( pPMHeaderMinHeight && pPMHeaderDynamic && !getBOOL( pPMHeaderDynamic->maValue ) )
lcl_RemoveState( pPMHeaderMinHeight );
if( pPMHeaderDynamic )
lcl_RemoveState( pPMHeaderDynamic );
if( pPMFooterHeight && (!pPMFooterDynamic || (pPMFooterDynamic && getBOOL( pPMFooterDynamic->maValue ))) )
lcl_RemoveState( pPMFooterHeight );
if( pPMFooterMinHeight && pPMFooterDynamic && !getBOOL( pPMFooterDynamic->maValue ) )
lcl_RemoveState( pPMFooterMinHeight );
if( pPMFooterDynamic )
lcl_RemoveState( pPMFooterDynamic );
if( pPMScaleTo )
lcl_RemoveStateIfZero16( pPMScaleTo );
if( pPMScaleToPages )
lcl_RemoveStateIfZero16( pPMScaleToPages );
if( pPMScaleToX )
lcl_RemoveStateIfZero16( pPMScaleToX );
if( pPMScaleToY )
lcl_RemoveStateIfZero16( pPMScaleToY );
if (pPrint)
{
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ANNOTATIONS), "PrintAnnotations", rPropSet);
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_CHARTS), "PrintCharts", rPropSet);
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_DRAWING), "PrintDrawing", rPropSet);
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_FORMULAS), "PrintFormulas", rPropSet);
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_GRID), "PrintGrid", rPropSet);
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_HEADERS), "PrintHeaders", rPropSet);
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_OBJECTS), "PrintObjects", rPropSet);
lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ZEROVALUES), "PrintZeroValues", rPropSet);
}
SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rPropState, rPropSet);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */