diff options
author | Frank Schönheit <fs@openoffice.org> | 2002-11-06 09:35:40 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2002-11-06 09:35:40 +0000 |
commit | b6693e51c732bff2540d7a5e34440c208da5258e (patch) | |
tree | 29e4151f7705746aa0e99fee78d193c11b98e449 /xmloff/source | |
parent | 7547d6eb09564884b2a9474bc23c63b6cf62a82d (diff) |
#102407# when exporting control shapes, care for the ParaAdjust aka Align property if it is defaulted
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 0733b796136c..b1ac5b810381 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeexport.cxx,v $ * - * $Revision: 1.54 $ + * $Revision: 1.55 $ * - * last change: $Author: cl $ $Date: 2002-11-04 12:38:50 $ + * last change: $Author: fs $ $Date: 2002-11-06 10:35:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -147,6 +147,10 @@ #include <tools/globname.hxx> #endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_ +#include <com/sun/star/beans/XPropertyState.hpp> +#endif + #include "xmlnmspe.hxx" using namespace ::rtl; @@ -393,6 +397,39 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap { xPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter( xPropSet ); + // ---------------------------------------------------------------------- + // yet more additionally, we need to care for the ParaAdjust property + if ( XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType ) + { + // this is because: + // * if controls shapes have a ParaAdjust property, then this is the Align property of the control model + // * control models are allowed to have an Align of "void" + // * the Default for control model's Align is TextAlign_LEFT + // * defaults for style properties are not written, but we need to write the "left", + // because we need to distiguish this "left" from the case where not align attribute + // is present which means "void" + // 102407 - 2002-11-01 - fs@openoffice.org + static const ::rtl::OUString s_sParaAdjustPropertyName( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) ); + uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); + if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( s_sParaAdjustPropertyName ) ) + { + uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY ); + if ( xPropState.is() && beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState( s_sParaAdjustPropertyName ) ) + { + sal_Int32 nIndex = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST ); + // TODO : this retrieval of the index should be moved into the ctor, holding the index + // as member, thus saving time. + DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!"); + + uno::Any aParaAdjustValue = xPropSet->getPropertyValue( s_sParaAdjustPropertyName ); + XMLPropertyState aAlignDefaultState( nIndex, aParaAdjustValue ); + + xPropStates.push_back( aAlignDefaultState ); + } + } + } + // ---------------------------------------------------------------------- + nCount = 0; std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin(); std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end(); |