basic/qa/basic_coverage/test_mod_operator.vb |   25 +++++++++++++++++++++++++
 basic/source/comp/exprnode.cxx               |   13 +++++++++----
 dev/null                                     |binary
 svx/qa/unit/customshapes.cxx                 |   18 ------------------
 xmloff/source/draw/ximpcustomshape.cxx       |    9 ---------
 5 files changed, 34 insertions(+), 31 deletions(-)

New commits:
commit 6fa9053b1bdc69e78d4403975d7623eb22b05898
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Sun Apr 4 19:34:47 2021 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Tue Apr 6 11:42:36 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.heini...@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 7947f3ed80ce2056de4777a21fc6767466645327
Author:     Regina Henschel <rb.hensc...@t-online.de>
AuthorDate: Sat Apr 3 13:56:22 2021 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Apr 6 11:42:25 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.hensc...@t-online.de>
    (cherry picked from commit f1b55d3f8e963069fc798bcf559ae9af2bf18b64)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113636
    Reviewed-by: Xisco Fauli <xiscofa...@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 ) );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to