Kaydet (Commit) 0b7bba10 authored tarafından Michael Stahl's avatar Michael Stahl

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.
üst 790365e7
......@@ -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<
......
......@@ -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 ) )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment