[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 4 commits - officecfg/registry sc/source xmloff/inc xmloff/source

Noel Power noelp at kemper.freedesktop.org
Tue Feb 7 09:25:19 PST 2012


 officecfg/registry/data/org/openoffice/Office/Common.xcu |    2 -
 sc/source/filter/xml/xmlstyle.cxx                        |    4 +-
 xmloff/inc/xmloff/txtparae.hxx                           |    3 +
 xmloff/source/draw/sdpropls.cxx                          |   23 +++++++++++
 xmloff/source/text/txtparae.cxx                          |   30 ++++++++++++---
 5 files changed, 51 insertions(+), 11 deletions(-)

New commits:
commit dae8fff9289edbfda3317bd19acd233400528a95
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 2 12:44:03 2012 +0100

    fdo#45534: ODF export: fix draw:fit-to-size
    
    In ODF 1.1 and 1.2 this attribute is of type boolean, so only write the
    new values if the extended format is selected.
    (regression introduced with e479f47f7d48dbd0d701bf347b6a2d5121ba3d34)

diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 88ffa2e..c5f77e5 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -619,6 +619,15 @@ SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] =
     { XML_TOKEN_INVALID, 0 }
 };
 
+SvXMLEnumMapEntry const pXML_FitToSize_Enum_Odf12[] =
+{
+    { XML_FALSE,        drawing::TextFitToSizeType_NONE },
+    { XML_TRUE,         drawing::TextFitToSizeType_PROPORTIONAL },
+    { XML_TRUE,         drawing::TextFitToSizeType_ALLLINES },
+    { XML_TRUE,         drawing::TextFitToSizeType_AUTOFIT },
+    { XML_TOKEN_INVALID, 0 }
+};
+
 SvXMLEnumMapEntry const pXML_FitToSize_Enum[] =
 {
     { XML_FALSE,        drawing::TextFitToSizeType_NONE },
@@ -1047,7 +1056,19 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
                 pHdl = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextVerticalAdjust*)0) );
                 break;
             case XML_SD_TYPE_FITTOSIZE:
-                pHdl = new XMLEnumPropertyHdl( pXML_FitToSize_Enum, ::getCppuType((const com::sun::star::drawing::TextFitToSizeType*)0) );
+                {
+                    if (mpExport && (mpExport->getDefaultVersion()
+                                        <= SvtSaveOptions::ODFVER_012))
+                    {
+                        pHdl = new XMLEnumPropertyHdl(pXML_FitToSize_Enum_Odf12,
+                            ::getCppuType(static_cast<const com::sun::star::drawing::TextFitToSizeType*>(0)));
+                    }
+                    else
+                    {
+                        pHdl = new XMLEnumPropertyHdl(pXML_FitToSize_Enum,
+                            ::getCppuType(static_cast<const com::sun::star::drawing::TextFitToSizeType*>(0)));
+                    }
+                }
                 break;
             case XML_SD_TYPE_MEASURE_UNIT:
                 pHdl = new XMLEnumPropertyHdl( pXML_MeasureUnit_Enum, ::getCppuType((const sal_Int32*)0) );
commit c6bf0fdf82c9ba0626ea6356923d293820e75565
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Feb 1 21:32:14 2012 +0100

    fdo#45450: sc: ODF export: cell styles:
    
    Only write "style:vertical-justify" and "css3t:text-justify" in ODF
    extended mode.
    (regression from 7da57d17b6179e71c8b6d7549ad89eaf3a4a28c6)

diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx
index 0e91a0d..7956c6f 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -90,7 +90,7 @@ const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
     MAP( "HoriJustify", XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
     MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ),
     MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
-    MAP( SC_UNONAME_CELLHJUS_METHOD, XML_NAMESPACE_CSS3TEXT, XML_TEXT_JUSTIFY, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY_METHOD, 0 ),
+    MAP_EXT( SC_UNONAME_CELLHJUS_METHOD, XML_NAMESPACE_CSS3TEXT, XML_TEXT_JUSTIFY, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY_METHOD, 0 ),
     MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
     MAP( "IsTextWrapped", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_ISTEXTWRAPPED, 0 ),
     MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_ALLBORDER ),
@@ -117,7 +117,7 @@ const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
     MAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
     MAP( "ValidationXML", XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BUILDIN_CMP_ONLY, CTF_SC_VALIDATION ),
     MAP( "VertJustify", XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY, 0),
-    MAP( SC_UNONAME_CELLVJUS_METHOD, XML_NAMESPACE_STYLE, XML_VERTICAL_JUSTIFY, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY_METHOD, 0 ),
+    MAP_EXT( SC_UNONAME_CELLVJUS_METHOD, XML_NAMESPACE_STYLE, XML_VERTICAL_JUSTIFY, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY_METHOD, 0 ),
 
     MAP_END()
 };
commit dbca6cea0897f1215f7a071583d7689c033526c5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 2 12:07:59 2012 +0100

    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.

diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx
index cb095eb..549315f 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 18f078a..2330b37 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 ) )
     {
commit fd19436de41d1be21bc2eca3d84647f2156dba75
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 2 12:53:59 2012 +0100

    fdo#45446: officecfg: turn off SaveBackwardCompatibleODF
    
    As detailed in the bug, this option is the reason why LO writes several
    elements and attributes that are not valid in ODF; the corresponding
    bugs in the import filters are all fixed in OOo 2.4 or earlier,
    so there is no reason to risk interoperability problems with other ODF
    impolementations for this any more.

diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu
index 215999a..744c7f2 100644
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
@@ -594,7 +594,7 @@
   <node oor:name="Save">
     <node oor:name="Document">
       <prop oor:name="SaveBackwardCompatibleODF" oor:type="xs:boolean">
-        <value>true</value>
+        <value>false</value>
       </prop>
       <prop oor:name="CreateBackup" install:module="gconflockdown">
         <value oor:external=


More information about the Libreoffice-commits mailing list