[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 5 commits - embeddedobj/source include/svtools sd/source sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Wed May 10 19:38:18 UTC 2017


 embeddedobj/source/msole/oleembed.cxx           |   31 +++++++++++++++++-------
 include/svtools/rtfkeywd.hxx                    |    1 
 sd/source/ui/animations/CustomAnimationPane.cxx |    7 +++--
 sd/source/ui/animations/CustomAnimationPane.hxx |    1 
 sw/qa/extras/rtfexport/data/tdf107620.docx      |binary
 sw/qa/extras/rtfexport/rtfexport.cxx            |   11 ++++++++
 sw/source/filter/ww8/rtfexport.cxx              |    5 +++
 sw/source/filter/ww8/ww8par.cxx                 |   12 ++++++---
 writerfilter/source/dmapper/PropertyMap.cxx     |   12 +++++----
 9 files changed, 61 insertions(+), 19 deletions(-)

New commits:
commit c1976f31163e547ea92a10b1695474993c3530c1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 9 09:10:24 2017 +0200

    tdf#107620 RTF export: handle DocumentSettingId::PARA_SPACE_MAX compat setting
    
    As it turns out it has a dedicated RTF control word.  With this, the
    bugdoc is again kept as a one-page document during DOCX -> RTF
    conversion.
    
    If we are at it, also write the automatic before/after paragraph spacing
    markup.
    
    (cherry picked from commit 3a9854a92923df8013ca832c48aa9f284bcb1adc, but
    the nice-to-have automatic spacing markup is not picked)
    
    Conflicts:
            sw/qa/extras/rtfexport/rtfexport.cxx
            sw/source/filter/ww8/rtfattributeoutput.cxx
            sw/source/filter/ww8/rtfexport.cxx
    
    Change-Id: I78de644f0631e59ef507dfaa07c5a812d4ef10cd
    Reviewed-on: https://gerrit.libreoffice.org/37428
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit 9f827e21f68adace66caf8b7d8f0bec037e5f9b9)

diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx
index 55d97f51bd16..65ae39ac305d 100644
--- a/include/svtools/rtfkeywd.hxx
+++ b/include/svtools/rtfkeywd.hxx
@@ -1208,6 +1208,7 @@
 #define LO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh"
 #define LO_STRING_SVTOOLS_RTF_GENERATOR "\\generator"
 #define LO_STRING_SVTOOLS_RTF_VIEWBKSP "\\viewbksp"
+#define LO_STRING_SVTOOLS_RTF_HTMAUTSP "\\htmautsp"
 
 #endif // INCLUDED_SVTOOLS_RTFKEYWD_HXX
 
diff --git a/sw/qa/extras/rtfexport/data/tdf107620.docx b/sw/qa/extras/rtfexport/data/tdf107620.docx
new file mode 100644
index 000000000000..285bd92ae670
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf107620.docx differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 19b3235a4cdc..003b5ef03bc5 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1136,6 +1136,17 @@ DECLARE_RTFEXPORT_TEST(testTdf104228, "tdf104228.rtf")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf107620, "tdf107620.docx")
+{
+    // This failed, RTF export didn't write the \htmautsp compat flag, the
+    // original bugdoc resulting in 2 pages instead of 1.
+    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
+    bool bAddParaTableSpacing = true;
+    xSettings->getPropertyValue("AddParaTableSpacing") >>= bAddParaTableSpacing;
+    CPPUNIT_ASSERT(!bAddParaTableSpacing);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index edf7281984ef..c1143b3c5b6c 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -47,6 +47,7 @@
 #include <svx/xflclit.hxx>
 #include <editeng/hyphenzoneitem.hxx>
 #include <fmtmeta.hxx>
+#include <IDocumentSettingAccess.hxx>
 
 using namespace ::com::sun::star;
 
@@ -824,6 +825,10 @@ void RtfExport::ExportDocument_Impl()
         Strm().WriteCharPtr(pOut);
     }
 
+    if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX))
+        // RTF default is true, so write compat flag if this should be false.
+        Strm().WriteCharPtr(LO_STRING_SVTOOLS_RTF_HTMAUTSP);
+
     Strm().WriteCharPtr(SAL_NEWLINE_STRING);
 
     WriteFootnoteSettings();
commit bd221493a98260bcd7d1e49e1748c09eae4ebf54
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 9 09:24:11 2017 +0100

    Related: tdf#62702 handle EmbeddedOdf like CONTENTS on ole activate attempt
    
    (cherry picked from commit 8db9cfd2973b3e6f0c682fe8961540d528e6d493)
    
    Related: tdf#62702 also try various other known streams for object content
    
    (cherry picked from commit 013e34d875aeb75d9660af7c18967c2d468cbd74)
    
    Change-Id: I11f1d6ad049cada1cadfe97a440b7ae562ba4ced
    5b5fa61e9930ba0eaa5ac86e4231050c9ebebf8a
    Reviewed-on: https://gerrit.libreoffice.org/37434
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    
    (cherry picked from commit 8f45915b6c76ace7aeffaa042d487e8e2d7f4d89)

diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 2faed0ba62be..e26875732ef3 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -711,18 +711,33 @@ namespace
                 "com.sun.star.embed.OLESimpleStorage",
                 aArgs ), uno::UNO_QUERY_THROW );
 
-        uno::Reference< io::XStream > xCONTENTS;
-        try
+        //various stream names that can contain the real document contents for
+        //this object in a straightforward direct way
+        static const OUStringLiteral aStreamNames[] =
         {
-            xNameContainer->getByName("CONTENTS") >>= xCONTENTS;
-        }
-        catch (container::NoSuchElementException const&)
+            OUStringLiteral("CONTENTS"),
+            OUStringLiteral("Package"),
+            OUStringLiteral("EmbeddedOdf"),
+            OUStringLiteral("WordDocument"),
+            OUStringLiteral("Workbook"),
+            OUStringLiteral("PowerPoint Document")
+        };
+
+        bool bCopied = false;
+        for (size_t i = 0; i < SAL_N_ELEMENTS(aStreamNames) && !bCopied; ++i)
         {
-            // ignore
+            uno::Reference<io::XStream> xEmbeddedFile;
+            try
+            {
+                xNameContainer->getByName(aStreamNames[i]) >>= xEmbeddedFile;
+            }
+            catch (const container::NoSuchElementException&)
+            {
+                // ignore
+            }
+            bCopied = xEmbeddedFile.is() && lcl_CopyStream(xEmbeddedFile->getInputStream(), xStream->getOutputStream());
         }
 
-        bool bCopied = xCONTENTS.is() && lcl_CopyStream(xCONTENTS->getInputStream(), xStream->getOutputStream());
-
         if (!bCopied)
         {
             uno::Reference< io::XStream > xOle10Native;
commit bb51303007ff1588dc467b270651619e3eff282e
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed May 3 16:55:00 2017 +0200

    tdf#105703: Make sure we actually have a motion path here
    
    fix regression from my previous commit
    
    Change-Id: Iddba458ffaf7b647c1942b35d80aa37e6ff6ed13
    Reviewed-on: https://gerrit.libreoffice.org/37216
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>
    (cherry picked from commit 9eae606ebc1ebd20dbc0aeb44e1f760e62afcdbe)
    Reviewed-on: https://gerrit.libreoffice.org/37226
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 8501821f3b5ad541c40b5465aab000a6960b97ba)

diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 26bd04829f50..7e2fc961e67e 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -130,6 +130,7 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
     mrBase( rBase ),
     mpCustomAnimationPresets(nullptr),
     mnPropertyType( nPropertyTypeNone ),
+    mnMotionPathPos( 3 ),
     mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND ),
@@ -146,6 +147,7 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
     mrBase( rBase ),
     mpCustomAnimationPresets(nullptr),
     mnPropertyType( nPropertyTypeNone ),
+    mnMotionPathPos( 3 ),
     mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ),
     mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND ),
@@ -1980,7 +1982,8 @@ PathKind CustomAnimationPane::getCreatePathKind() const
 {
     PathKind eKind = PathKind::NONE;
 
-    if( mpLBAnimation->GetSelectEntryCount() == 1 )
+    if( ( mpLBAnimation->GetSelectEntryCount() == 1 ) &&
+        ( mpLBCategory->GetSelectEntryPos() == mnMotionPathPos ) )
     {
         const sal_Int32 nPos = mpLBAnimation->GetSelectEntryPos();
         if( nPos == mnCurvePathPos )
@@ -2167,7 +2170,7 @@ sal_uInt32 CustomAnimationPane::fillAnimationLB( bool bHasText )
     const PresetCategoryList::const_iterator aCategoryEnd( rCategoryList.end() );
     mpLBAnimation->Clear();
 
-    if(nPosition == 3)
+    if(nPosition == mnMotionPathPos)
     {
         OUString sMotionPathLabel( SD_RESSTR( STR_CUSTOMANIMATION_USERPATH ) );
         mpLBAnimation->InsertCategory( sMotionPathLabel );
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index e849d70876dd..f6cef94dbafd 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -161,6 +161,7 @@ private:
     OUString    maStrProperty;
 
     sal_Int32   mnPropertyType;
+    sal_Int32   mnMotionPathPos;
     sal_Int32   mnCurvePathPos;
     sal_Int32   mnPolygonPathPos;
     sal_Int32   mnFreeformPathPos;
commit 3e0044057846819fe9a4836063e6ca70206329d5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri May 5 22:05:46 2017 +0200

    tdf#104407 writerfilter: fix crash with null xRangeProperties
    
    The m_xStartingRange is null at this point for whatever reason,
    and the block immediately above this one already checks
    xRangeProperties, so let's just do the same here. (Also IsNewDoc(),
    where the logic between PageDescName and PageNumberOffset presumably
    shouldn't differ?).
    
    (started to crash with abaf6bde4ee91c628bd55a7ec2e876a5d0ecff6e
     as previously that code was unreachable in RTF import)
    
    Change-Id: I20539c3a753ecea357e556ea556c3c26983ce1d1
    (cherry picked from commit e4da2e5dfa9e462e0d9c23a1a60caf4b3ef2dc56)
    Reviewed-on: https://gerrit.libreoffice.org/37305
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 8521f4c8fb08aa37912f73a73ba1a34c2ccc97ed)

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 0e7f0678aed3..ec79cb1ba653 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1416,16 +1416,18 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
                 }
 
                 if (xRangeProperties.is() && rDM_Impl.IsNewDoc())
+                {
                     xRangeProperties->setPropertyValue(
                         getPropertyName( PROP_PAGE_DESC_NAME ),
                         uno::makeAny( m_bTitlePage ?  m_sFirstPageStyleName
                                       : m_sFollowPageStyleName ));
 
-                if(m_bPageNoRestart || m_nPageNumber >= 0)
-                {
-                    sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
-                    xRangeProperties->setPropertyValue(getPropertyName( PROP_PAGE_NUMBER_OFFSET ),
-                        uno::makeAny( nPageNumber ));
+                    if (m_bPageNoRestart || 0 <= m_nPageNumber)
+                    {
+                        sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
+                        xRangeProperties->setPropertyValue(getPropertyName(PROP_PAGE_NUMBER_OFFSET),
+                            uno::makeAny(nPageNumber));
+                    }
                 }
             }
         }
commit 82b7a53cc646960e6be7da2b6a93d14887906b42
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 7 14:56:51 2017 +0100

    ofz check against expected struct size
    
    don't copy vector and const up as well
    
    Change-Id: Ia9c9dd9e0dee2300f8f60eec15b67e4a349c8a93
    (cherry picked from commit f5c0d7508b972898153bbf4069c9ea48f53d64d5)
    Reviewed-on: https://gerrit.libreoffice.org/37345
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit a36a425f28a1cff5e364d1e9f667c92e7698c7f7)

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 68520286567a..70ff38a94ad0 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5023,10 +5023,14 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
 
     for (size_t i=0; i < aLinkStrings.size() && i < aStringIds.size(); ++i)
     {
-        ww::bytes stringId = aStringIds[i];
-        WW8_STRINGID *stringIdStruct = reinterpret_cast<WW8_STRINGID*>(&stringId[0]);
-        m_aLinkStringMap[SVBT16ToShort(stringIdStruct->nStringId)] =
-            aLinkStrings[i];
+        const ww::bytes& stringId = aStringIds[i];
+        if (stringId.size() < sizeof(WW8_STRINGID))
+        {
+            SAL_WARN("sw.ww8", "SwWW8ImplReader::CoreLoad: WW8_STRINGID is too short");
+            continue;
+        }
+        const WW8_STRINGID *stringIdStruct = reinterpret_cast<const WW8_STRINGID*>(stringId.data());
+        m_aLinkStringMap[SVBT16ToShort(stringIdStruct->nStringId)] = aLinkStrings[i];
     }
 
     ReadDocVars(); // import document variables as meta information.


More information about the Libreoffice-commits mailing list