[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 8 commits - basic/qa basic/source filter/source include/filter sc/inc sc/qa sc/source sfx2/source svx/qa vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/source vcl/unx xmloff/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 6 11:59:35 UTC 2021


 basic/qa/basic_coverage/test_mod_operator.vb |   25 ++++++++++
 basic/source/comp/exprnode.cxx               |   13 +++--
 dev/null                                     |binary
 filter/source/msfilter/eschesdo.cxx          |   20 ++++----
 filter/source/msfilter/eschesdo.hxx          |    4 -
 include/filter/msfilter/escherex.hxx         |    4 -
 sc/inc/document.hxx                          |    2 
 sc/qa/unit/uicalc/data/tdf99913.xlsx         |binary
 sc/qa/unit/uicalc/uicalc.cxx                 |    9 +++
 sc/source/core/tool/compiler.cxx             |    9 +++
 sc/source/filter/excel/xeescher.cxx          |    4 -
 sc/source/filter/oox/worksheethelper.cxx     |   65 +++++++++++++++++++++++----
 sfx2/source/sidebar/DeckLayouter.cxx         |   11 ++++
 svx/qa/unit/customshapes.cxx                 |   18 -------
 vcl/Library_vclplug_gtk3.mk                  |    1 
 vcl/Library_vclplug_gtk3_kde5.mk             |    1 
 vcl/source/filter/ipdf/pdfread.cxx           |    2 
 vcl/unx/gtk3/a11y/atkwrapper.hxx             |    1 
 vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx         |   28 +++++++++++
 xmloff/source/draw/ximpcustomshape.cxx       |    9 ---
 20 files changed, 167 insertions(+), 59 deletions(-)

New commits:
commit 143098db8c67c90bd8bd1c90c2feb191a285023b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Mar 24 11:33:42 2021 +0000
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 6 13:58:52 2021 +0200

    tdf#141197 if we have a sysobj child then include that in the atk hierarchy
    
    this also should make the case of an embedded video visible in the atk
    hierarchy as well as the target of the native gtk widgets in a vcl
    window container in the startcenter
    
    Change-Id: Ia91439cbccbffbb0badbfb466f7ab6d1ccbfe3ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113526
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index 9e67d5efc265..317152b59fe9 100644
--- a/vcl/Library_vclplug_gtk3.mk
+++ b/vcl/Library_vclplug_gtk3.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Library_set_include,vclplug_gtk3,\
 
 $(eval $(call gb_Library_add_defs,vclplug_gtk3,\
     -DVCLPLUG_GTK_IMPLEMENTATION \
+    -DVCL_INTERNALS \
 ))
 
 $(eval $(call gb_Library_use_custom_headers,vclplug_gtk3,\
diff --git a/vcl/Library_vclplug_gtk3_kde5.mk b/vcl/Library_vclplug_gtk3_kde5.mk
index 51dafda097be..602be3d13b45 100644
--- a/vcl/Library_vclplug_gtk3_kde5.mk
+++ b/vcl/Library_vclplug_gtk3_kde5.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_add_cxxflags,vclplug_gtk3_kde5,\
 
 $(eval $(call gb_Library_add_defs,vclplug_gtk3_kde5,\
     -DVCLPLUG_GTK_IMPLEMENTATION -DVCLPLUG_GTK3_KDE5_IMPLEMENTATION \
+    -DVCL_INTERNALS \
 ))
 
 $(eval $(call gb_Library_use_custom_headers,vclplug_gtk3_kde5,\
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx
index d9c651a2eae8..0fcbce6369fd 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx
@@ -46,6 +46,7 @@ struct AtkObjectWrapper
 {
     AtkObject aParent;
     AtkObject* mpOrig;  //if we're a GtkDrawingArea acting as a custom LibreOffice widget, this is the toolkit default impl
+    AtkObject* mpSysObjChild; //if we're a container for a sysobj, then this is the sysobj native gtk AtkObject
 
     css::uno::Reference<css::accessibility::XAccessible> mpAccessible;
     css::uno::Reference<css::accessibility::XAccessibleContext> mpContext;
diff --git a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx
index cbce84b09fd1..1d53043f3d2b 100644
--- a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx
@@ -40,10 +40,14 @@
 #include <com/sun/star/accessibility/XAccessibleImage.hpp>
 #include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
 
 #include <rtl/strbuf.hxx>
 #include <osl/diagnose.h>
 #include <tools/diagnose_ex.h>
+#include <vcl/syschild.hxx>
+#include <vcl/sysdata.hxx>
+#include <vcl/toolkit/unowrap.hxx>
 
 #include "atkwrapper.hxx"
 #include "atkregistry.hxx"
@@ -407,6 +411,10 @@ static gint
 wrapper_get_n_children( AtkObject *atk_obj )
 {
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
+
+    if (obj->mpSysObjChild)
+        return 1;
+
     gint n = 0;
 
     if( obj->mpContext.is() )
@@ -429,6 +437,13 @@ wrapper_ref_child( AtkObject *atk_obj,
                    gint       i )
 {
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
+
+    if (obj->mpSysObjChild)
+    {
+        g_object_ref(obj->mpSysObjChild);
+        return obj->mpSysObjChild;
+    }
+
     AtkObject* child = nullptr;
 
     // see comments above atk_object_wrapper_remove_child
@@ -875,6 +890,19 @@ atk_object_wrapper_new( const css::uno::Reference< css::accessibility::XAccessib
             }
         }
 
+        // tdf#141197 if we have a sysobj child then include that in the hierarchy
+        if (UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper())
+        {
+            css::uno::Reference<css::awt::XWindow> xAWTWindow(rxAccessible, css::uno::UNO_QUERY);
+            VclPtr<vcl::Window> xWindow = pWrapper->GetWindow(xAWTWindow);
+            if (xWindow && xWindow->GetType() == WindowType::SYSTEMCHILDWINDOW)
+            {
+                const SystemEnvData* pEnvData = static_cast<SystemChildWindow*>(xWindow.get())->GetSystemData();
+                if (GtkWidget *pSysObj = pEnvData ? static_cast<GtkWidget*>(pEnvData->pWidget) : nullptr)
+                    pWrap->mpSysObjChild = gtk_widget_get_accessible(pSysObj);
+            }
+        }
+
         return ATK_OBJECT( pWrap );
     }
     catch (const uno::Exception &)
commit f4034873bab7021785387ad5aa6ba9bcc10bd52d
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Wed Mar 24 14:07:15 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 6 13:57:24 2021 +0200

    tdf#99913 XLSX import: set filtered flag for rows
    
    hidden by AutoFilter to support copying the
    result of filtering. Unlike ODS and XLS,
    XLSX doesn't differentiates filtered and
    manually hidden rows, and without this fix,
    copy of the unupdated data of the loaded
    filtering contained the hidden rows, too.
    
    Change-Id: I390d1a84b9bf275f3d3782756553b2f236487758
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113040
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113382
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 46f3e51d1a99..832a02410eed 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1947,7 +1947,7 @@ public:
     SC_DLLPUBLIC SCROW          LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
     SCROW                       CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
 
-    bool                        RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
+    SC_DLLPUBLIC bool           RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
     bool                        HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
     bool                        ColFiltered(SCCOL nCol, SCTAB nTab) const;
     SC_DLLPUBLIC void           SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered);
diff --git a/sc/qa/unit/uicalc/data/tdf99913.xlsx b/sc/qa/unit/uicalc/data/tdf99913.xlsx
new file mode 100644
index 000000000000..3fd18a12984a
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf99913.xlsx differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index c744528b8e0e..59edd0527c4e 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -364,6 +364,15 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf123202)
     CPPUNIT_ASSERT(pDoc->RowHidden(2, 0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf99913)
+{
+    ScModelObj* pModelObj = createDoc("tdf99913.xlsx");
+    ScDocument* pDoc = pModelObj->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+
+    CPPUNIT_ASSERT(pDoc->RowFiltered(2, 0));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 110ce64ba79c..93b6fe88f429 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -68,6 +68,8 @@
 #include <stlsheet.hxx>
 #include <stlpool.hxx>
 #include <cellvalue.hxx>
+#include <columnspanset.hxx>
+#include <dbdata.hxx>
 
 #include <svl/stritem.hxx>
 #include <editeng/eeitem.hxx>
@@ -340,9 +342,12 @@ private:
     void                convertColumns( OutlineLevelVec& orColLevels, const ValueRange& rColRange, const ColumnModel& rModel );
 
     /** Converts row properties for all rows in the sheet. */
-    void                convertRows();
+    void                convertRows(const std::vector<sc::ColRowSpan>& rSpans);
     /** Converts row properties. */
-    void                convertRows( OutlineLevelVec& orRowLevels, const ValueRange& rRowRange, const RowModel& rModel, double fDefHeight = -1.0 );
+    void                convertRows(OutlineLevelVec& orRowLevels, const ValueRange& rRowRange,
+                                    const RowModel& rModel,
+                                    const std::vector<sc::ColRowSpan>& rSpans,
+                                    double fDefHeight = -1.0);
 
     /** Converts outline grouping for the passed column or row. */
     void                convertOutlines( OutlineLevelVec& orLevels, sal_Int32 nColRow, sal_Int32 nLevel, bool bCollapsed, bool bRows );
@@ -946,7 +951,37 @@ void WorksheetGlobals::finalizeWorksheetImport()
 
     lclUpdateProgressBar( mxFinalProgress, 0.5 );
     convertColumns();
-    convertRows();
+
+    // tdf#99913 rows hidden by filter need extra flag
+    ScDocument& rDoc = getScDocument();
+    std::vector<sc::ColRowSpan> aSpans;
+    SCTAB nTab = getSheetIndex();
+    ScDBData* pDBData = rDoc.GetAnonymousDBData(nTab);
+    if (pDBData && pDBData->HasAutoFilter())
+    {
+        ScRange aRange;
+        pDBData->GetArea(aRange);
+        SCCOLROW nStartRow = static_cast<SCCOLROW>(aRange.aStart.Row());
+        SCCOLROW nEndRow = static_cast<SCCOLROW>(aRange.aEnd.Row());
+        aSpans.push_back(sc::ColRowSpan(nStartRow, nEndRow));
+    }
+    ScDBCollection* pDocColl = rDoc.GetDBCollection();
+    if (!pDocColl->empty())
+    {
+        ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
+        for (const auto& rxDB : rDBs)
+        {
+            if (rxDB->GetTab() == nTab && rxDB->HasAutoFilter())
+            {
+                ScRange aRange;
+                rxDB->GetArea(aRange);
+                SCCOLROW nStartRow = static_cast<SCCOLROW>(aRange.aStart.Row());
+                SCCOLROW nEndRow = static_cast<SCCOLROW>(aRange.aEnd.Row());
+                aSpans.push_back(sc::ColRowSpan(nStartRow, nEndRow));
+            }
+        }
+    }
+    convertRows(aSpans);
     lclUpdateProgressBar( mxFinalProgress, 1.0 );
 }
 
@@ -1200,7 +1235,7 @@ void WorksheetGlobals::convertColumns( OutlineLevelVec& orColLevels,
     convertOutlines( orColLevels, rColRange.mnFirst, rModel.mnLevel, rModel.mbCollapsed, false );
 }
 
-void WorksheetGlobals::convertRows()
+void WorksheetGlobals::convertRows(const std::vector<sc::ColRowSpan>& rSpans)
 {
     sal_Int32 nNextRow = 0;
     sal_Int32 nMaxRow = mrMaxApiPos.Row();
@@ -1213,21 +1248,23 @@ void WorksheetGlobals::convertRows()
         ValueRange aRowRange( ::std::max( rowModel.first, nNextRow ), ::std::min( rowModel.second.second, nMaxRow ) );
         // process gap between two row models, use default row model
         if( nNextRow < aRowRange.mnFirst )
-            convertRows( aRowLevels, ValueRange( nNextRow, aRowRange.mnFirst - 1 ), maDefRowModel );
+            convertRows(aRowLevels, ValueRange(nNextRow, aRowRange.mnFirst - 1), maDefRowModel,
+                        rSpans);
         // process the row model
-        convertRows( aRowLevels, aRowRange, rowModel.second.first, maDefRowModel.mfHeight );
+        convertRows(aRowLevels, aRowRange, rowModel.second.first, rSpans, maDefRowModel.mfHeight);
         // cache next row to be processed
         nNextRow = aRowRange.mnLast + 1;
     }
 
     // remaining default rows to end of sheet
-    convertRows( aRowLevels, ValueRange( nNextRow, nMaxRow ), maDefRowModel );
+    convertRows(aRowLevels, ValueRange(nNextRow, nMaxRow), maDefRowModel, rSpans);
     // close remaining row outlines spanning to end of sheet
     convertOutlines( aRowLevels, nMaxRow + 1, 0, false, true );
 }
 
-void WorksheetGlobals::convertRows( OutlineLevelVec& orRowLevels,
-        const ValueRange& rRowRange, const RowModel& rModel, double fDefHeight )
+void WorksheetGlobals::convertRows(OutlineLevelVec& orRowLevels, const ValueRange& rRowRange,
+                                   const RowModel& rModel,
+                                   const std::vector<sc::ColRowSpan>& rSpans, double fDefHeight)
 {
     // row height: convert points to row height in 1/100 mm
     double fHeight = (rModel.mfHeight >= 0.0) ? rModel.mfHeight : fDefHeight;
@@ -1249,6 +1286,16 @@ void WorksheetGlobals::convertRows( OutlineLevelVec& orRowLevels,
     {
         ScDocument& rDoc = getScDocument();
         rDoc.SetRowHidden( nStartRow, nEndRow, nTab, true );
+        for (const auto& rSpan : rSpans)
+        {
+            // tdf#99913 rows hidden by filter need extra flag
+            if (rSpan.mnStart <= nStartRow && nStartRow <= rSpan.mnEnd)
+            {
+                SCROW nLast = ::std::min(nEndRow, rSpan.mnEnd);
+                rDoc.SetRowFiltered(nStartRow, nLast, nTab, true);
+                break;
+            }
+        }
     }
 
     // outline settings for this row range
commit 5eb0320780f6a4b8085f5dedb880ba4f04cf0424
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 1 21:25:10 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 6 13:57:07 2021 +0200

    ofz#32796: no pdfium during wmf fuzzing
    
    Change-Id: I418615dd68618bb8623a052cf52a85b917d4382d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113492
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113527
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index a36eacbfd41a..80f207a68196 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -74,6 +74,8 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream)
     {
         // Downconvert to PDF-1.6.
         auto pPdfium = vcl::pdf::PDFiumLibrary::get();
+        if (!pPdfium)
+            return false;
 
         // Read input into a buffer.
         SvMemoryStream aInBuffer;
commit b261ee04d9176f07ae79e74226a2a23e47b3c4d0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Mar 2 14:12:20 2021 +0000
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 6 13:57:01 2021 +0200

    make Analog Clock sidebar extension demo work
    
    from...
    
    https://wiki.openoffice.org/wiki/Sidebar_for_Developers#Example:_Analog_Clock_Extension
    http://people.apache.org/~af/clock/AnalogClock.oxt
    
    presumably compatibility was broken at:
    commit e66be44b69ee2a1b99bda32af93ea453c669b319
    Date:   Sun Jun 2 04:46:58 2013 +0200
    
        sidebar: Restrict the minimal width of the sidebar.
    
    Change-Id: Id1531d4531a3e9bceb3d37a9e74a7a06497098e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111868
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113525
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index f90ec176b2d0..bebc75e726ad 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -433,7 +433,16 @@ void GetRequestedSizes (
                          << " Maximum: " << rItem.maLayoutSize.Maximum);
             }
 
-            sal_Int32 nWidth = xPanel->getMinimalWidth();
+            sal_Int32 nWidth = rMinimalWidth;
+            try
+            {
+                // The demo sidebar extension "Analog Clock" fails with
+                // java.lang.AbstractMethodError here
+                nWidth = xPanel->getMinimalWidth();
+            }
+            catch (...)
+            {
+            }
 
             uno::Reference<frame::XDesktop2> xDesktop
                 = frame::Desktop::create(comphelper::getProcessComponentContext());
commit 9f90edc5a9a8ca192508f4fe97e43583dc3e2309
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 2 14:28:37 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 6 13:56:56 2021 +0200

    ofz: Segv on unknown address
    
    Change-Id: I6c69375a89781fc0b87230203335c861efb562f9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113481
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index eb8706596910..85ceb6a0d8f3 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2643,7 +2643,14 @@ Label_MaskStateMachine:
                                 if (eState != ssSkipReference)
                                 {
                                     *pSym++ = c;
-                                    *pSym++ = *pSrc++;
+
+                                    if( pSym == &cSymbol[ MAXSTRLEN ] )
+                                    {
+                                        SetError( FormulaError::StringOverflow);
+                                        eState = ssStop;
+                                    }
+                                    else
+                                        *pSym++ = *pSrc++;
                                 }
                                 bAddToSymbol = false;
                             }
commit 72aa34f8f8f51040c6f94efc90a70a44d8d18ff3
Author:     Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Sun Apr 4 19:34:47 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 6 13:56:51 2021 +0200

    tdf#141201 - Round MOD literals to Integer values
    
    (regression from commit I8dbfdf4bb2eceac0b5afbddd3f35e1dcde2db68b
    "tdf#84435: Mod operator does not deal with decimals as described in help").
    
    Change-Id: I74b231d3814148579a3be0a92b7602fa4387281f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113571
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heinisch at yahoo.de>
    (cherry picked from commit a9fcd2cf2bfb42693787e8c4197e5988e155e235)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113635

diff --git a/basic/qa/basic_coverage/test_mod_operator.vb b/basic/qa/basic_coverage/test_mod_operator.vb
new file mode 100644
index 000000000000..006d97558052
--- /dev/null
+++ b/basic/qa/basic_coverage/test_mod_operator.vb
@@ -0,0 +1,25 @@
+'
+' This file is part of the LibreOffice project.
+'
+' This Source Code Form is subject to the terms of the Mozilla Public
+' License, v. 2.0. If a copy of the MPL was not distributed with this
+' file, You can obtain one at http://mozilla.org/MPL/2.0/.
+'
+
+Function doUnitTest as Integer
+
+    doUnitTest = 0
+
+    Dim a As Double, b as Double
+    a = 16.4
+    b = 5.9
+
+    ' tdf#141201 - MOD operands are rounded to Integer values before the operation is performed
+    if (a MOD b <> 4) Then Exit Function
+    if (16.4 MOD 5.9 <> 4) Then Exit Function
+    if (15.9 MOD 6.4 <> 4) Then Exit Function
+    if (2147483647.4 MOD 4 <> 3) Then Exit Function
+
+    doUnitTest = 1
+
+End Function
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 02f8801f1aea..1771da0017f3 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -27,6 +27,8 @@
 
 #include <basic/sberrors.hxx>
 
+#include <rtl/math.hxx>
+
 SbiExprNode::SbiExprNode( std::unique_ptr<SbiExprNode> l, SbiToken t, std::unique_ptr<SbiExprNode> r ) :
     pLeft(std::move(l)),
     pRight(std::move(r)),
@@ -294,8 +296,13 @@ void SbiExprNode::FoldConstantsBinaryNode(SbiParser* pParser)
     {
         double nl = pLeft->nVal;
         double nr = pRight->nVal;
+        // tdf#141201 - round MOD literals to Integer values
+        if (eTok == MOD)
+        {
+            nl = rtl::math::round(nl);
+            nr = rtl::math::round(nr);
+        }
         tools::Long ll = 0, lr = 0;
-        tools::Long llMod = 0, lrMod = 0;
         if( ( eTok >= AND && eTok <= IMP )
            || eTok == IDIV || eTok == MOD )
         {
@@ -322,8 +329,6 @@ void SbiExprNode::FoldConstantsBinaryNode(SbiParser* pParser)
                 nr = SbxMINLNG;
             }
             ll = static_cast<tools::Long>(nl); lr = static_cast<tools::Long>(nr);
-            llMod = static_cast<tools::Long>(nl);
-            lrMod = static_cast<tools::Long>(nr);
             if( bErr )
             {
                 pParser->Error( ERRCODE_BASIC_MATH_OVERFLOW );
@@ -388,7 +393,7 @@ void SbiExprNode::FoldConstantsBinaryNode(SbiParser* pParser)
                 {
                     pParser->Error( ERRCODE_BASIC_ZERODIV ); nVal = HUGE_VAL;
                     bError = true;
-                } else nVal = llMod - lrMod * (llMod/lrMod);
+                } else nVal = ll - lr * (ll/lr);
                 eType = SbxLONG; break;
             case AND:
                 nVal = static_cast<double>( ll & lr ); eType = SbxLONG; break;
commit b8f72a53c417eb81b51b11088634e1f8fd07c637
Author:     Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Sat Apr 3 13:56:22 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 6 13:56:44 2021 +0200

    Revert "tdf#141127 Use ODF default values for draw:extrusion-skew"
    
    This reverts commit 2bf8c1e0e211601a70b6b28fdb92f636c7969513.
    
    Reason for revert: tdf#141268 LibreOffice uses -135deg skew angle as internal default. If a user does not touch the direction, the value is not written to file, although that would be necessary because it is not ODF default. With the patch applied the missing value will be interpreted as 45deg on opening. So the first step is, to write -135deg to file. And then after some time, when wrong files are unlikely, the patch can be applied.
    A suggestion for writing -135deg is from Julien Nabet in  https://gerrit.libreoffice.org/c/core/+/113257. From code it looks good to me, but I have not tested it yet. I would only add some comments to explain the situation.
    
    Change-Id: I71673ad2e5376c2a78fa74900e95117b8543e268
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113538
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
    (cherry picked from commit f1b55d3f8e963069fc798bcf559ae9af2bf18b64)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113636
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 036aff90543f..db7808a16f2f 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -933,24 +933,6 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176)
         }
     }
 }
-
-CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf141127WrongSkewDefault)
-{
-    // Load a document that has a shape in extrusion mode, but no draw:extrusion-skew attribute.
-    // Error was, that the shape uses the MS Office binary defaults and so the extruded side faces
-    // were not left/bottom, but top/right.
-    OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + "tdf141127_defaultSkewAngle.odp";
-    mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.presentation.PresentationDocument");
-    CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
-    uno::Reference<drawing::XShape> xShape(getShape(0));
-    SdrObjCustomShape& rSdrCustomShape(
-        static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape)));
-
-    // Check left/bottom of bound rect. Without fix it would be left=15994, bottom=6999.
-    tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
-    CPPUNIT_ASSERT_EQUAL(tools::Long(15371), aBoundRect.Left());
-    CPPUNIT_ASSERT_EQUAL(tools::Long(7622), aBoundRect.Bottom());
-}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf141127_defaultSkewAngle.odp b/svx/qa/unit/data/tdf141127_defaultSkewAngle.odp
deleted file mode 100644
index 5cd0da96ec20..000000000000
Binary files a/svx/qa/unit/data/tdf141127_defaultSkewAngle.odp and /dev/null differ
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
index ef58c7664baa..3bd71eae268d 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -1291,15 +1291,6 @@ void XMLEnhancedCustomShapeContext::endFastElement(sal_Int32 )
         }
     }
 
-    //tdf#141127 Add ODF default values. Otherwise defaults from MS Office binary format are used.
-    if (!maExtrusion.empty())
-    {
-        auto it = std::find_if(maExtrusion.begin(), maExtrusion.end(), 
-            [](css::beans::PropertyValue& rProp){return EASGet(rProp.Name) == EAS_Skew;} );
-        if (it == maExtrusion.end())
-            GetEnhancedParameterPair(maExtrusion, "50 45", EAS_Skew);
-    }
-
     SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maExtrusion, EASGet( EAS_Extrusion ) );
     SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maPath,      EASGet( EAS_Path ) );
     SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maTextPath,  EASGet( EAS_TextPath ) );
commit 62f927465a51c9366789f870dc59faef4cd6b977
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Wed Mar 31 09:21:45 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 6 13:56:28 2021 +0200

    tdf#139786 partial revert tdf#106181 XLSX export: output form controls
    
    Not every export is going to be to OOXML format,
    so don't just set ooxmlexport to true
    and remove the "if" clause (especially when
    leaving the comment that this is for DOCX only).
    
    This is a partial revert to 7.1 (and backported to 6.4.5)
    commit 577dd32b1c4eb0a4cff574fbabca987cb52b831b.
    
    Change-Id: If7ea32a236715ec779cac302773c4c9da19865a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113399
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit a3c5c0f7ce73001adab7475fde1f8ffec4eef48b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113484
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 24f47d62909f..4972bcaef6c6 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -421,8 +421,8 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
         {
             const Reference< XPropertySet > xPropSet = rObj.mXPropSet;
             const Reference<XPropertySetInfo> xPropInfo = xPropSet.is() ? xPropSet->getPropertySetInfo() : Reference<XPropertySetInfo>();
-            // This code is expected to be called only for DOCX format.
-            if (xPropInfo.is())
+            // This code is expected to be called only for DOCX/XLSX formats.
+            if (xPropInfo.is() && bOOxmlExport)
             {
                 bool bInline = false;
                 if (xPropInfo->hasPropertyByName("AnchorType"))
@@ -834,7 +834,7 @@ void ImplEESdrWriter::ImplInitPageValues()
 }
 
 void ImplEESdrWriter::ImplWritePage(
-            EscherSolverContainer& rSolverContainer )
+            EscherSolverContainer& rSolverContainer, bool ooxmlExport )
 {
     ImplInitPageValues();
 
@@ -845,7 +845,7 @@ void ImplEESdrWriter::ImplWritePage(
                                     mXShapes->getByIndex( n )) );
         if( aObj.IsValid() )
         {
-            ImplWriteShape( aObj, rSolverContainer, true );
+            ImplWriteShape( aObj, rSolverContainer, ooxmlExport );
         }
     }
 }
@@ -924,10 +924,10 @@ void ImplEESdrWriter::ImplFlushSolverContainer()
     }
 }
 
-void ImplEESdrWriter::ImplWriteCurrentPage()
+void ImplEESdrWriter::ImplWriteCurrentPage(bool ooxmlExport)
 {
     assert(mpSolverContainer && "ImplEESdrWriter::ImplWriteCurrentPage: no SolverContainer");
-    ImplWritePage( *mpSolverContainer );
+    ImplWritePage( *mpSolverContainer, ooxmlExport );
     ImplExitPage();
 }
 
@@ -937,16 +937,16 @@ sal_uInt32 ImplEESdrWriter::ImplWriteTheShape( ImplEESdrObject& rObj , bool ooxm
     return ImplWriteShape( rObj, *mpSolverContainer, ooxmlExport );
 }
 
-void EscherEx::AddSdrPage( const SdrPage& rPage )
+void EscherEx::AddSdrPage( const SdrPage& rPage, bool ooxmlExport )
 {
     if ( mpImplEESdrWriter->ImplInitPage( rPage ) )
-        mpImplEESdrWriter->ImplWriteCurrentPage();
+        mpImplEESdrWriter->ImplWriteCurrentPage(ooxmlExport);
 }
 
-void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes )
+void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes, bool ooxmlExport )
 {
     if ( mpImplEESdrWriter->ImplInitUnoShapes( rxShapes ) )
-        mpImplEESdrWriter->ImplWriteCurrentPage();
+        mpImplEESdrWriter->ImplWriteCurrentPage(ooxmlExport);
 }
 
 sal_uInt32 EscherEx::AddSdrObject( const SdrObject& rObj, bool ooxmlExport )
diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx
index fc1522c79dca..d2ea3d52b235 100644
--- a/filter/source/msfilter/eschesdo.hxx
+++ b/filter/source/msfilter/eschesdo.hxx
@@ -113,7 +113,7 @@ class ImplEESdrWriter
     std::unique_ptr<EscherSolverContainer> mpSolverContainer;
 
     void                ImplInitPageValues();
-    void                ImplWritePage( EscherSolverContainer& rSolver );
+    void                ImplWritePage( EscherSolverContainer& rSolver, bool ooxmlExport );
     sal_uInt32          ImplWriteShape( ImplEESdrObject& rObj,
                             EscherSolverContainer& rSolver,
                             const bool bOOxmlExport = false );  // returns ShapeID
@@ -133,7 +133,7 @@ public:
     EscherExHostAppData* ImplGetHostData() { return mpHostAppData; }
     bool                ImplInitPage( const SdrPage& rPage );
     bool                ImplInitUnoShapes( const css::uno::Reference< css::drawing::XShapes >& rxShapes );
-    void                ImplWriteCurrentPage();
+    void                ImplWriteCurrentPage( bool ooxmlExport );
     sal_uInt32          ImplWriteTheShape( ImplEESdrObject& rObj, bool ooxmlExport );
     void                ImplExitPage();
 };
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index f55074ecf856..9ab3d891da2a 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -1158,8 +1158,8 @@ public:
 
                 // ...Sdr... implemented in eschesdo.cxx
 
-    void    AddSdrPage( const SdrPage& rPage );
-    void    AddUnoShapes( const css::uno::Reference< css::drawing::XShapes >& rxShapes );
+    void    AddSdrPage( const SdrPage& rPage, bool ooxmlExport = false );
+    void    AddUnoShapes( const css::uno::Reference< css::drawing::XShapes >& rxShapes, bool ooxmlExport = false );
 
                 /// returns the ShapeID
     sal_uInt32  AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false );
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 22c2462df750..7a7514aa7061 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1804,7 +1804,7 @@ void XclExpObjectManager::StartSheet()
 rtl::Reference< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const SdrPage* pSdrPage )
 {
     if( pSdrPage )
-        mxEscherEx->AddSdrPage( *pSdrPage );
+        mxEscherEx->AddSdrPage( *pSdrPage, GetOutput() != EXC_OUTPUT_BINARY );
     // the first dummy object may still be open
     OSL_ENSURE( mxEscherEx->GetGroupLevel() <= 1, "XclExpObjectManager::ProcessDrawing - still groups open?" );
     while( mxEscherEx->GetGroupLevel() )
@@ -1816,7 +1816,7 @@ rtl::Reference< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const Sd
 rtl::Reference< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const Reference< XShapes >& rxShapes )
 {
     if( rxShapes.is() )
-        mxEscherEx->AddUnoShapes( rxShapes );
+        mxEscherEx->AddUnoShapes( rxShapes, GetOutput() != EXC_OUTPUT_BINARY );
     // the first dummy object may still be open
     OSL_ENSURE( mxEscherEx->GetGroupLevel() <= 1, "XclExpObjectManager::ProcessDrawing - still groups open?" );
     while( mxEscherEx->GetGroupLevel() )


More information about the Libreoffice-commits mailing list