summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-02-02 12:07:59 +0100
committerMichael Stahl <mstahl@redhat.com>2012-02-02 14:36:17 +0100
commit0b7bba10208d198471cbdb56c2007e5cdb00a6ac (patch)
tree77a456c2bf28d4dd30bd5dc8175cee8ca194f811 /xmloff
parent790365e79d28e2c2a41140707ac126dbf6966e38 (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.hxx3
-rw-r--r--xmloff/source/text/txtparae.cxx30
2 files changed, 26 insertions, 7 deletions
diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx
index 02eb4b66d51a..11e014085855 100644
--- a/xmloff/inc/xmloff/txtparae.hxx
+++ b/xmloff/inc/xmloff/txtparae.hxx
@@ -263,7 +263,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 d48675b5d48d..0335b744f68d 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2464,7 +2464,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;
@@ -2568,8 +2569,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() );
@@ -2638,8 +2644,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() );
@@ -2787,11 +2798,12 @@ void XMLTextParagraphExport::_exportTextFrame(
OUString sAutoStyle( sStyle );
OUString aMinHeightValue;
+ OUString sMinWidthValue;
sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle );
if( !sAutoStyle.isEmpty() )
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 );
@@ -2800,6 +2812,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 ) )
{