diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-02-02 12:07:59 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-02-07 17:25:57 +0000 |
commit | dbca6cea0897f1215f7a071583d7689c033526c5 (patch) | |
tree | e4cd90fb526ff9f85f4e742f130676d8ad1b1891 /xmloff | |
parent | fd19436de41d1be21bc2eca3d84647f2156dba75 (diff) |
fdo#45449: ODF export: frames: invalid "min-width"
XMLTextParagraphExport::addTextFrameAttributes: delay writing of the
fo:min-width and fo:min-height attributes so that they end up at the
draw:text-box element, and not at draw:frame where they are invalid.
Testing reveals that the ODF import can already handle reading the
attributes from the draw:text-box elements, so there doesn't seem to be
a backward compatibility problem.
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmloff/txtparae.hxx | 3 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 30 |
2 files changed, 26 insertions, 7 deletions
diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx index cb095ebcfc75..549315fdc7cb 100644 --- a/xmloff/inc/xmloff/txtparae.hxx +++ b/xmloff/inc/xmloff/txtparae.hxx @@ -269,7 +269,8 @@ protected: const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& rPropSet, sal_Bool bShape, - ::rtl::OUString *pMinHeightValue = 0 ); + ::rtl::OUString *pMinHeightValue = 0, + ::rtl::OUString *pMinWidthValue = 0 ); virtual void exportStyleAttributes( const ::com::sun::star::uno::Reference< diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 18f078a6072a..2330b378f18a 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2492,7 +2492,8 @@ sal_Bool lcl_txtpara_isBoundAsChar( sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( const Reference < XPropertySet >& rPropSet, sal_Bool bShape, - OUString *pMinHeightValue ) + OUString *pMinHeightValue, + OUString *pMinWidthValue) { sal_Int32 nShapeFeatures = SEF_DEFAULT; @@ -2596,8 +2597,13 @@ sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( } GetExport().GetMM100UnitConverter().convertMeasureToXML(sValue, nWidth); if( SizeType::FIX != nWidthType ) - GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_WIDTH, - sValue.makeStringAndClear() ); + { + assert(pMinWidthValue); + if (pMinWidthValue) + { + *pMinWidthValue = sValue.makeStringAndClear(); + } + } else GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, sValue.makeStringAndClear() ); @@ -2666,8 +2672,13 @@ sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( { ::sax::Converter::convertPercent( sValue, nRelHeight ); if( SizeType::MIN == nSizeType ) - GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_HEIGHT, - sValue.makeStringAndClear() ); + { + assert(pMinHeightValue); + if (pMinHeightValue) + { + *pMinHeightValue = sValue.makeStringAndClear(); + } + } else GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_HEIGHT, sValue.makeStringAndClear() ); @@ -2815,11 +2826,12 @@ void XMLTextParagraphExport::_exportTextFrame( OUString sAutoStyle( sStyle ); OUString aMinHeightValue; + OUString sMinWidthValue; sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle ); if( sAutoStyle.getLength() ) GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME, GetExport().EncodeStyleName( sAutoStyle ) ); - addTextFrameAttributes( rPropSet, sal_False, &aMinHeightValue ); + addTextFrameAttributes(rPropSet, false, &aMinHeightValue, &sMinWidthValue); SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, XML_FRAME, sal_False, sal_True ); @@ -2828,6 +2840,12 @@ void XMLTextParagraphExport::_exportTextFrame( GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_HEIGHT, aMinHeightValue ); + if (!sMinWidthValue.isEmpty()) + { + GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_WIDTH, + sMinWidthValue ); + } + // draw:chain-next-name if( rPropSetInfo->hasPropertyByName( sChainNextName ) ) { |