[Libreoffice-commits] .: 7 commits - officecfg/registry sc/source sw/source xmloff/inc xmloff/source

Michael Stahl mst at kemper.freedesktop.org
Thu Feb 2 05:39:10 PST 2012


 officecfg/registry/data/org/openoffice/Office/Common.xcu |    2 
 sc/source/filter/xml/xmlstyle.cxx                        |    4 -
 sw/source/ui/uiview/view.cxx                             |    2 
 xmloff/inc/xmloff/txtparae.hxx                           |    3 -
 xmloff/source/draw/sdpropls.cxx                          |   23 ++++++++++
 xmloff/source/style/XMLPageExport.cxx                    |    3 +
 xmloff/source/text/txtparae.cxx                          |   32 ++++++++++++---
 7 files changed, 57 insertions(+), 12 deletions(-)

New commits:
commit e2bc0c04ba0c33e02f1842013041f26ccb2de77d
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=
commit e0de9f832f8f27de473242440ca4b544ab7b9216
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 2 12:51:46 2012 +0100

    fdo#45447: add an assertion when anchored to page 0
    
    XMLTextParagraphExport::addTextFrameAttributes: detect invalid anchor
    page number; this really should be fixed in Writer/writerfilter though.

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 0335b74..3cd935a 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2501,6 +2501,8 @@ sal_Int32 XMLTextParagraphExport::addTextFrameAttributes(
     {
         sal_Int16 nPage = 0;
         rPropSet->getPropertyValue( sAnchorPageNo ) >>= nPage;
+        SAL_WARN_IF(nPage <= 0, "xmloff",
+                "ERROR: writing invalid anchor-page-number 0");
         ::sax::Converter::convertNumber( sValue, (sal_Int32)nPage );
         GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_PAGE_NUMBER,
                                   sValue.makeStringAndClear() );
commit 6c15b856242127ddca766da700002489ba287e21
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 448d921..7c68585 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 0b7bba10208d198471cbdb56c2007e5cdb00a6ac
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 02eb4b6..11e0140 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 d48675b..0335b74 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 ) )
     {
commit 790365e79d28e2c2a41140707ac126dbf6966e38
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 f76c2fc..e294311 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 9d32497c01475f2b5e5bec756e4dd0ca9f9d4928
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Feb 1 15:49:16 2012 +0100

    fdo#37024: SwView::SwView: fix BROWSE_MODE setting:
    
    Apparently there is a check in SwDoc::SetAllUniqueFlyNames so that when
    frames with certain anchor types are in a document, then SetLoaded()
    is never called.  Checking this flag via IsLoaded() here seems
    unnecessary.
    This problem was introduced with ebc5777548dea42ed966a16c66d879b1485bbfb4,
    from CWS swlayoutrefactoring.

diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index c2ee944..fbe254b 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -836,7 +836,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
 
         if( !bOldShellWasSrcView && pWebDShell && !bOldShellWasPagePreView )
             aUsrPref.setBrowseMode( sal_True );
-        else if( rDoc.IsLoaded() )
+        else
             aUsrPref.setBrowseMode( rDoc.get(IDocumentSettingAccess::BROWSE_MODE) );
 
         //Fuer den BrowseMode wollen wir keinen Factor uebernehmen.
commit 4b85affdc4667995bdee9347cb4cc902c883495b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jan 31 17:32:42 2012 +0100

    fdo#38752: xmloff: add assertion for default-page-layout

diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx
index d98d8d7..d08fa7a 100644
--- a/xmloff/source/style/XMLPageExport.cxx
+++ b/xmloff/source/style/XMLPageExport.cxx
@@ -255,6 +255,9 @@ void XMLPageExport::exportDefaultStyle()
 
             if( bExport )
             {
+                assert(GetExport().getDefaultVersion()
+                        >= SvtSaveOptions::ODFVER_012);
+
                 //<style:default-page-layout>
                 SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
                                           XML_DEFAULT_PAGE_LAYOUT,


More information about the Libreoffice-commits mailing list