core.git: svx/qa sw/qa

2024-05-16 Thread Caolán McNamara (via logerrit)
 svx/qa/unit/customshapes.cxx   |8 +++-
 svx/qa/unit/svdraw.cxx |1 +
 svx/qa/unit/table.cxx  |1 +
 sw/qa/extras/htmlexport/htmlexport.cxx |1 +
 sw/qa/extras/uiwriter/uiwriter6.cxx|1 +
 sw/qa/unit/swmodeltestbase.cxx |1 +
 6 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 601ae6910288c7f3abdbb11de644c17b3b2d0cb5
Author: Caolán McNamara 
AuthorDate: Wed May 15 21:08:50 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu May 16 09:34:49 2024 +0200

WaE: C6011 Dereferencing NULL pointer warnings

Change-Id: If4ca47bc4d8203ed7d20e1bbf1c3ebe2587c403f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167709
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 304ae64f23b2..47ab375e6037 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -122,6 +122,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf150302)
 
 // Mark Object
 SfxViewShell* pViewShell = SfxViewShell::Current();
+CPPUNIT_ASSERT(pViewShell);
 SdrView* pSdrView = pViewShell->GetDrawView();
 pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
 
@@ -157,6 +158,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf147409_GeomItemHash)
 
 // Mark Object
 SfxViewShell* pViewShell = SfxViewShell::Current();
+CPPUNIT_ASSERT(pViewShell);
 SdrView* pSdrView = pViewShell->GetDrawView();
 pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
 
@@ -174,6 +176,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf146866_GeomItemHash)
 
 // Mark Object
 SfxViewShell* pViewShell = SfxViewShell::Current();
+CPPUNIT_ASSERT(pViewShell);
 SdrView* pSdrView = pViewShell->GetDrawView();
 pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
 
@@ -502,6 +505,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf141021ExtrusionNorth)
 
 // Mark Object
 SfxViewShell* pViewShell = SfxViewShell::Current();
+CPPUNIT_ASSERT(pViewShell);
 SdrView* pSdrView = pViewShell->GetDrawView();
 pSdrView->MarkObj(, pSdrView->GetSdrPageView());
 
@@ -509,7 +513,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf141021ExtrusionNorth)
 SfxRequest aReq(pViewShell->GetViewFrame(), SID_EXTRUSION_DIRECTION);
 SfxInt32Item aItem(SID_EXTRUSION_DIRECTION, 90);
 aReq.AppendItem(aItem);
-svx::ExtrusionBar::execute(pSdrView, aReq, 
SfxViewFrame::Current()->GetBindings());
+SfxViewFrame* pFrame = SfxViewFrame::Current();
+CPPUNIT_ASSERT(pFrame);
+svx::ExtrusionBar::execute(pSdrView, aReq, pFrame->GetBindings());
 
 // Verify height. Without the fix in place the height would 4001.
 tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 0c01bf4dfce2..83293c52ee3f 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -237,6 +237,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testTextEditEmptyGrabBag)
 
 // When editing the shape text of the 2nd rectangle (insert a char at the 
start).
 SfxViewShell* pViewShell = SfxViewShell::Current();
+CPPUNIT_ASSERT(pViewShell);
 SdrView* pSdrView = pViewShell->GetDrawView();
 SdrObject* pObject = SdrObject::getSdrObjectFromXShape(xRect2);
 pSdrView->SdrBeginTextEdit(pObject);
diff --git a/svx/qa/unit/table.cxx b/svx/qa/unit/table.cxx
index 6331a23cbe98..ce48f216026a 100644
--- a/svx/qa/unit/table.cxx
+++ b/svx/qa/unit/table.cxx
@@ -120,6 +120,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testSvxTableControllerSetAttrToSelectedShape)
 auto pSdrObject
 = 
dynamic_cast(pSdrPage->GetObj(pSdrPage->GetObjCount() 
- 1));
 SfxViewShell* pViewShell = SfxViewShell::Current();
+CPPUNIT_ASSERT(pViewShell);
 SdrView* pSdrView = pViewShell->GetDrawView();
 pSdrView->SdrBeginTextEdit(pSdrObject);
 CPPUNIT_ASSERT(pSdrView->IsTextEdit());
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 282ce035b3a6..b3297ad815fe 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2866,6 +2866,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testHTML_NoPreserveSpaces)
   xmlXPathObjectPtr pXmlObj = getXPathNode(pDoc, rXPath);
   xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
   CPPUNIT_ASSERT_EQUAL_MESSAGE(rXPath.getStr(), 1, 
xmlXPathNodeSetGetLength(pXmlNodes));
+  CPPUNIT_ASSERT(pXmlNodes);
   xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
   if (xmlChar* prop = xmlGetProp(pXmlNode, BAD_CAST("style")))
   {
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index ce525954ace9..43c74906e10d 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ 

core.git: svx/qa svx/source

2024-05-13 Thread Regina Henschel (via logerrit)
 svx/qa/unit/data/tdf128433_rectanglecontourtext_CJK.fodg |  418 +++
 svx/qa/unit/data/tdf84507_polygoncontourtext.fodg|  396 ++
 svx/qa/unit/svdraw.cxx   |   33 +
 svx/source/svdraw/svdotextdecomposition.cxx  |   66 ++
 4 files changed, 905 insertions(+), 8 deletions(-)

New commits:
commit 47664e282da4999b8e471a6a916d7ec80414ac18
Author: Regina Henschel 
AuthorDate: Tue May 7 23:51:24 2024 +0200
Commit: Regina Henschel 
CommitDate: Tue May 14 00:25:13 2024 +0200

tdf#84507 move contour text to correct place in rotated...

...path objects.

I first tried to change the UnitPolyPolygon in
ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence().
But it is needed in that way to draw the geometry of the object.
Now the change is made in SdrTextObj::impDecomposeContourTextPrimitive().

The basic idea is to recover the original PolyPolygon and transform it so,
that the transformed text is placed into the transformed PolyPolygon. The
ObjectMatrix gets a translation then, which moves the transformed text to
the correct position in the PolyPolygon.

For East Asian writingmode tb-rl, the text start needs to be top-right.
Added that, which resolves bug 128433.

If the shape has a fat stroke the text reaches into the stroke currently.
I have changed the code so that now a reduced area for the text is used.
The polypolygon behaves now same as the legacy rectangle.

Sometimes not all text is drawn although the rotated PolyPolygon would
have enought place for it. Or in other cases the text spills out of the
PolyPolygon. But I don't know a solution yet. As the other changes are
an improvement, this problem can be solved later.

Change-Id: I951024bf0d6d992587ec9cf2ed37665f322b66fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167299
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/data/tdf128433_rectanglecontourtext_CJK.fodg 
b/svx/qa/unit/data/tdf128433_rectanglecontourtext_CJK.fodg
new file mode 100644
index ..f3ee6416183d
--- /dev/null
+++ b/svx/qa/unit/data/tdf128433_rectanglecontourtext_CJK.fodg
@@ -0,0 +1,418 @@
+
+
+http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/200
 4/writer" xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns
 :css3t="http://www.w3.org/TR/css3-text/; 
xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" 
xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" 
xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.graphics">
+ 
+2024-05-09T12:19:03.20800
+32x24
+PT13M
+8
+LOmyBuild/24.8.0.0.alpha0$Windows_X86_64 
LibreOffice_project/d4fdafa103bfea94a279d7069ddc50ba92f67d01
+Regina Henschel
+2024-05-10T14:25:48.22600
+Regina Henschel
+
+
+
+ 
+  
+   -353
+   -11742
+   55688
+   24795
+   
+  

core.git: svx/qa

2024-03-31 Thread Andrea Gelmini (via logerrit)
 svx/qa/unit/customshapes.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b7d6f7e2ef4e89607d7886e821be977c50f11843
Author: Andrea Gelmini 
AuthorDate: Sun Mar 31 11:24:55 2024 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Mar 31 21:06:01 2024 +0200

Fix typo

Change-Id: I606c3eb804cba508638ac401b35a8bea4e961807
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165588
Tested-by: Adolfo Jayme Barrientos 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 92770e9f2320..f8df68fb3138 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -59,7 +59,7 @@ protected:
 uno::Reference getShape(sal_uInt8 nShapeIndex);
 sal_uInt8 countShapes();
 // fX and fY are positions relative to the size of the bitmap of the shape
-// Thus the position is indepedent from DPI
+// Thus the position is independent from DPI
 Color getColor(uno::Reference xShape, const double& fX, 
const double& fY);
 };
 


core.git: svx/qa svx/source

2024-03-30 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   42 ++
 svx/qa/unit/data/tdf160421_3D_FlipLight.odp   |binary
 svx/source/customshapes/EnhancedCustomShape3d.cxx |8 
 3 files changed, 50 insertions(+)

New commits:
commit 9761d4239de6398d4f6ecf08356f2ce18e502a04
Author: Regina Henschel 
AuthorDate: Fri Mar 29 22:44:45 2024 +0100
Commit: Regina Henschel 
CommitDate: Sat Mar 30 21:19:25 2024 +0100

tdf#160421 flip lights too for flipped extruded shapes

If an extruded custom shape is mirrored, the lights in the scene are
also mirrored. This should not happen. MS Office keeps the light
direction in relation to the camera direction for binary files and pptx
files with legacy camera. We should do the same, especially since the UI
does not allow the user to set the light directions at arbitrary angles.
Otherwise the shape receives only ambient light.

Change-Id: I091d78c581b3d247f8b0680cd57654e3df330cdd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165562
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 617c97300c43..92770e9f2320 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -58,6 +58,9 @@ protected:
 // get shape nShapeIndex from page 0
 uno::Reference getShape(sal_uInt8 nShapeIndex);
 sal_uInt8 countShapes();
+// fX and fY are positions relative to the size of the bitmap of the shape
+// Thus the position is indepedent from DPI
+Color getColor(uno::Reference xShape, const double& fX, 
const double& fY);
 };
 
 uno::Reference CustomshapesTest::getShape(sal_uInt8 
nShapeIndex)
@@ -84,6 +87,18 @@ sal_uInt8 CustomshapesTest::countShapes()
 return xDrawPage->getCount();
 }
 
+Color CustomshapesTest::getColor(uno::Reference xShape, const 
double& fX,
+ const double& fY)
+{
+GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", 
maTempFile.GetURL());
+SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
+vcl::PngImageReader aPNGReader(aFileStream);
+Bitmap aBMP = aPNGReader.read().GetBitmap();
+Size aSize = aBMP.GetSizePixel();
+BitmapScopedReadAccess pRead(aBMP);
+return pRead->GetColor(aSize.Height() * fY, aSize.Width() * fX);
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf150302)
 {
 loadFromFile(u"FontworkSameLetterHeights.fodg");
@@ -1376,6 +1391,33 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf153000_MS0_SPT_25_31)
 CPPUNIT_ASSERT_EQUAL(aExpected[i], aCoordinates.getLength());
 }
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf160421_3D_FlipLight)
+{
+// The document contains (0)an extruded 'rectangle' custom shape which is 
illuminated with front
+// light, (1) this shape vertically flipped and (2) this shape 
horizontally flipped.
+// When the shape is flipped vertically or horizontally, the light 
direction should not
+// change. MS Office behaves in this way for ppt and pptx and it is 
meaningful as flipping is
+// applied to the shape, not to the scene.
+
+// Load document.
+loadFromFile(u"tdf160421_3D_FlipLight.odp");
+
+// Get color from untransformed shape (0).
+uno::Reference xShape = getShape(0);
+Color aNormalColor = getColor(xShape, 0.6, 0.6);
+
+// Test that color from vertically flipped shape (1) is same as normal 
color. Without the fix
+// it was only build from ambient light and thus much darker.
+xShape = getShape(1);
+sal_uInt16 nColorDistance = aNormalColor.GetColorError(getColor(xShape, 
0.6, 0.6));
+CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
+
+// Same for horizontally flipped shape (2)
+xShape = getShape(2);
+nColorDistance = aNormalColor.GetColorError(getColor(xShape, 0.6, 0.6));
+CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf160421_3D_FlipLight.odp 
b/svx/qa/unit/data/tdf160421_3D_FlipLight.odp
new file mode 100644
index ..2decc51e3e6d
Binary files /dev/null and b/svx/qa/unit/data/tdf160421_3D_FlipLight.odp differ
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx 
b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 2763c9e47e00..d2f9de215f65 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -838,6 +838,14 @@ rtl::Reference 
EnhancedCustomShape3d::Create3DObject(
 basegfx::B3DVector aLight2Vector(aSecondLightDirection.DirectionX, 
-aSecondLightDirection.DirectionY, aSecondLightDirection.DirectionZ);
 aLight2Vector.normalize();
 
+// tdf#160421 a single flip inverts the light directions currently 
(March 2024). So invert
+// their directions here for rendering.
+if (bIsMirroredX != 

[Libreoffice-commits] core.git: svx/qa

2023-11-22 Thread Andrea Gelmini (via logerrit)
 svx/qa/unit/svdraw.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3709a8e5f03a6498a6f3ac7c6671d4b08fc46ea3
Author: Andrea Gelmini 
AuthorDate: Wed Nov 22 16:20:01 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 22 21:05:44 2023 +0100

Fix typo in code

Change-Id: I2e9ba39aeb838b019464363612505edb5a7c6353
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159832
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 2a7b7950c998..b670a59ba6fc 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -427,7 +427,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, 
testTdf148000_EOLinCurvedText)
 }
 }
 
-CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_CurvedTextEidth)
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_CurvedTextWidth)
 {
 std::vector aFilenames
 = { u"tdf148000_CurvedTextWidth.pptx"_ustr, 
u"tdf148000_CurvedTextWidth_New.odp"_ustr,


[Libreoffice-commits] core.git: svx/qa svx/source

2023-10-20 Thread Stephan Bergmann (via logerrit)
 svx/qa/unit/gallery/test_gallery.cxx|   14 +--
 svx/source/accessibility/AccessibleControlShape.cxx |8 -
 svx/source/accessibility/AccessibleShape.cxx|4 
 svx/source/customshapes/EnhancedCustomShape2d.cxx   |2 
 svx/source/dialog/ClassificationDialog.cxx  |2 
 svx/source/dialog/imapdlg.cxx   |   14 +--
 svx/source/dialog/rubydialog.cxx|   10 +-
 svx/source/dialog/swframeexample.cxx|4 
 svx/source/fmcomp/fmgridcl.cxx  |2 
 svx/source/fmcomp/gridcell.cxx  |   10 +-
 svx/source/fmcomp/gridcols.cxx  |4 
 svx/source/form/datanavi.cxx|   46 +-
 svx/source/form/fmobj.cxx   |2 
 svx/source/form/fmundo.cxx  |2 
 svx/source/form/formcontrolfactory.cxx  |2 
 svx/source/form/formcontroller.cxx  |2 
 svx/source/gallery2/gallery1.cxx|4 
 svx/source/items/statusitem.cxx |4 
 svx/source/items/viewlayoutitem.cxx |4 
 svx/source/items/zoomslideritem.cxx |8 -
 svx/source/mnuctrls/smarttagmenu.cxx|2 
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx   |2 
 svx/source/sidebar/line/LinePropertyPanelBase.cxx   |2 
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |2 
 svx/source/svdraw/svdoashp.cxx  |   32 +++
 svx/source/svdraw/svdoole2.cxx  |2 
 svx/source/svdraw/svdtrans.cxx  |2 
 svx/source/svdraw/svdview.cxx   |2 
 svx/source/table/cellcursor.cxx |4 
 svx/source/table/svdotable.cxx  |2 
 svx/source/table/tablecontroller.cxx|2 
 svx/source/table/tablelayouter.cxx  |2 
 svx/source/table/tablemodel.cxx |4 
 svx/source/table/tablertfexporter.cxx   |2 
 svx/source/tbxctrls/extrusioncontrols.cxx   |   28 +++---
 svx/source/tbxctrls/fillctrl.cxx|4 
 svx/source/tbxctrls/fontworkgallery.cxx |   14 +--
 svx/source/tbxctrls/grafctrl.cxx|4 
 svx/source/tbxctrls/tbcontrl.cxx|2 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx  |   18 ++--
 svx/source/toolbars/extrusionbar.cxx|   20 ++--
 svx/source/toolbars/fontworkbar.cxx |   16 +--
 svx/source/unodraw/unomod.cxx   |2 
 svx/source/unodraw/unoshape.cxx |   86 ++--
 svx/source/xml/xmleohlp.cxx |2 
 svx/source/xoutdev/_xoutbmp.cxx |8 -
 46 files changed, 207 insertions(+), 207 deletions(-)

New commits:
commit b60b3b5bbcc8db61bb24d3866b48cb4c63eb4f30
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:32 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 20 18:43:34 2023 +0200

Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: svx

Change-Id: Ib5028b826a3f62303b9e0502af70ad62c578fbb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158240
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/svx/qa/unit/gallery/test_gallery.cxx 
b/svx/qa/unit/gallery/test_gallery.cxx
index 0919a09503eb..6fb033e5f880 100644
--- a/svx/qa/unit/gallery/test_gallery.cxx
+++ b/svx/qa/unit/gallery/test_gallery.cxx
@@ -68,7 +68,7 @@ void GalleryObjTest::TestCreateTheme()
 
 std::unique_ptr pGallery(new Gallery(aGalleryURL));
 CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != 
nullptr));
-static constexpr OUStringLiteral myThemeName = u"addytesttheme";
+static constexpr OUString myThemeName = u"addytesttheme"_ustr;
 CPPUNIT_ASSERT_MESSAGE("Could not create theme", 
pGallery->CreateTheme(myThemeName));
 CPPUNIT_ASSERT_MESSAGE("Could not find theme", 
pGallery->HasTheme(myThemeName));
 
@@ -93,7 +93,7 @@ void GalleryObjTest::TestDeleteTheme()
 
 std::unique_ptr pGallery(new Gallery(aGalleryURL));
 CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != 
nullptr));
-static constexpr OUStringLiteral myThemeName = u"addytesttheme";
+static constexpr OUString myThemeName = u"addytesttheme"_ustr;
 CPPUNIT_ASSERT_MESSAGE("Could not create theme", 
pGallery->CreateTheme(myThemeName));
 CPPUNIT_ASSERT_MESSAGE("Could not find theme", 
pGallery->HasTheme(myThemeName));
 
@@ -129,12 +129,12 @@ void GalleryObjTest::TestSetThemeName()
 
 std::unique_ptr pGallery(new Gallery(aGalleryURL));
 CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != 
nullptr));
-static constexpr OUStringLiteral myThemeName = u"addytesttheme";
+static constexpr OUString myThemeName = 

[Libreoffice-commits] core.git: svx/qa

2023-10-05 Thread Thorsten Behrens (via logerrit)
 svx/qa/unit/core.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ae533151bcc16de22fb90b42be1cf7432b0fddc3
Author: Thorsten Behrens 
AuthorDate: Thu Oct 5 04:07:12 2023 +0200
Commit: Thorsten Behrens 
CommitDate: Thu Oct 5 09:59:28 2023 +0200

related tdf#123983: don't open test file read/write from src tree

Change-Id: I7f09a78076fa67447ead82ac7dc8556d840d5697
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157576
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/svx/qa/unit/core.cxx b/svx/qa/unit/core.cxx
index 4735c6664b4f..0625d7ad70fb 100644
--- a/svx/qa/unit/core.cxx
+++ b/svx/qa/unit/core.cxx
@@ -62,7 +62,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGraphicObjectResolver)
 OUString aURL = createFileURL(u"GraphicObjectResolverTest.zip");
 uno::Reference xStorage
 = 
comphelper::OStorageHelper::GetStorageOfFormatFromURL(ZIP_STORAGE_FORMAT_STRING,
 aURL,
-
embed::ElementModes::READWRITE);
+
embed::ElementModes::READ);
 CPPUNIT_ASSERT(xStorage.is());
 
 rtl::Reference xGraphicHelper


[Libreoffice-commits] core.git: svx/qa

2023-09-06 Thread Xisco Fauli (via logerrit)
 svx/qa/unit/table.cxx |   18 ++
 1 file changed, 18 insertions(+)

New commits:
commit a06c580643ebcca37f0baac009534fd826602966
Author: Xisco Fauli 
AuthorDate: Wed Sep 6 10:55:04 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Sep 6 12:41:51 2023 +0200

related: tdf#150557: improve test a bit

Change-Id: Idf596d26a6b9cce29ae690a4975bff70f5f05ea2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156611
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/table.cxx b/svx/qa/unit/table.cxx
index 72359dbc7820..cc0c46efa21c 100644
--- a/svx/qa/unit/table.cxx
+++ b/svx/qa/unit/table.cxx
@@ -82,6 +82,24 @@ CPPUNIT_TEST_FIXTURE(Test, testTableShadowBlur)
 //- In <>, XPath contents of child does not match
 // i.e. the shadow's transparency was miscalculated.
 assertXPathContent(pDocument, "count(//objectinfo/unifiedtransparence)", 
"0");
+
+assertXPath(pDocument, "//objectinfo/shadow[1]", "color", "#ff");
+assertXPath(pDocument, "//objectinfo/shadow[1]", "blur", "141");
+assertXPath(pDocument, "//objectinfo/shadow[2]", "color", "#ff");
+assertXPath(pDocument, "//objectinfo/shadow[2]", "blur", "141");
+assertXPath(pDocument, "//objectinfo/shadow[3]", "color", "#ff");
+assertXPath(pDocument, "//objectinfo/shadow[3]", "blur", "141");
+assertXPath(pDocument, "//objectinfo/shadow[4]", "color", "#ff");
+assertXPath(pDocument, "//objectinfo/shadow[4]", "blur", "141");
+assertXPath(pDocument, "//objectinfo/shadow[5]", "color", "#ff");
+assertXPath(pDocument, "//objectinfo/shadow[5]", "blur", "141");
+
+assertXPath(pDocument, 
"//objectinfo/group/sdrCell[1]/unifiedtransparence", 0);
+assertXPath(pDocument, 
"//objectinfo/group/sdrCell[2]/unifiedtransparence", 0);
+assertXPath(pDocument, 
"//objectinfo/group/sdrCell[3]/unifiedtransparence", "transparence",
+"80");
+assertXPath(pDocument, 
"//objectinfo/group/sdrCell[4]/unifiedtransparence", "transparence",
+"80");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testSvxTableControllerSetAttrToSelectedShape)


[Libreoffice-commits] core.git: svx/qa svx/source

2023-09-05 Thread Sarper Akdemir (via logerrit)
 svx/qa/unit/table.cxx|   14 ++
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |   13 ++---
 2 files changed, 8 insertions(+), 19 deletions(-)

New commits:
commit 98319164284c4a25d6a2313e6b8a35d244d94e91
Author: Sarper Akdemir 
AuthorDate: Mon Sep 4 18:10:22 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Tue Sep 5 13:21:13 2023 +0200

tdf#150557: svx: don't factor in transparence twice for cell shadows

multiplying child transparence with shadow alpha to get the
correct shadow alpha has been incorrect maybe since commits:
7eb4f92ed90e13ce5cbf7286fae623770e71324c,
e735ad1c57cddaf17d6ffc0cf15b5e14fa63c4ad

In ShadowPrimitive2D::create2DDecomposition the
shadow-casting primitive's alpha(mask) itself is already
being taken into account.

Therefore getting cell shadow alpha by multiplying child
transparence with shadow alpha, has the effect of child
transparence being applied twice for the table cell.

Change-Id: I78f9bbfcb0694a86eabc061330677784e887b5dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156528
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/svx/qa/unit/table.cxx b/svx/qa/unit/table.cxx
index dc3ad1e2bf67..72359dbc7820 100644
--- a/svx/qa/unit/table.cxx
+++ b/svx/qa/unit/table.cxx
@@ -73,17 +73,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTableShadowBlur)
 drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
 = renderPageToPrimitives(xDrawPage);
 
-// Then make sure that the cell fill part of the shadow is excluded from 
blurring:
+// Then make sure that the cell fill part of the shadow has the expected 
transparency:
 drawinglayer::Primitive2dXmlDump aDumper;
 xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
 // Without the accompanying fix in place, this test would have failed with:
-// - number of nodes is incorrect
-// - Expected: 1
-// - Actual  : 0
-// i.e. the shadow itself was not transparent and that resulted in a 
non-transparent rendering
-// as well, while the rendering transparency should be based on the 
transparency of the shadow
-// itself and the transparency of the cell fill.
-assertXPath(pDocument, "//objectinfo/unifiedtransparence[1]", 
"transparence", "80");
+//- Expected: 0
+//- Actual  : 2
+//- In <>, XPath contents of child does not match
+// i.e. the shadow's transparency was miscalculated.
+assertXPathContent(pDocument, "count(//objectinfo/unifiedtransparence)", 
"0");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testSvxTableControllerSetAttrToSelectedShape)
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx 
b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index b5df830d73fe..33e42efc6d23 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -850,25 +850,16 @@ sal_uInt32 
SlideBackgroundFillPrimitive2D::getPrimitive2DID() const
 Primitive2DContainer aRetval;
 for (const auto& xChild : rContentForShadow)
 {
-double fChildTransparence = 0.0;
-auto pChild = 
dynamic_cast(xChild.get());
-if (pChild)
-{
-fChildTransparence = 
pChild->getTransparenceForShadow();
-fChildTransparence /= 100;
-}
 aRetval.push_back(Primitive2DReference(
 new ShadowPrimitive2D(aShadowOffset, rShadow.getColor(), 
rShadow.getBlur(),
 Primitive2DContainer({ xChild 
};
-if (rShadow.getTransparence() != 0.0 || fChildTransparence != 
0.0)
+if (rShadow.getTransparence() != 0.0)
 {
 Primitive2DContainer aTempContent{ aRetval.back() };
 
-double fChildAlpha = 1.0 - fChildTransparence;
 double fShadowAlpha = 1.0 - rShadow.getTransparence();
-double fTransparence = 1.0 - fChildAlpha * fShadowAlpha;
 aRetval.back() = Primitive2DReference(new 
UnifiedTransparencePrimitive2D(
-std::move(aTempContent), fTransparence));
+std::move(aTempContent), fShadowAlpha));
 }
 }
 


[Libreoffice-commits] core.git: svx/qa svx/source

2023-07-20 Thread Matt K (via logerrit)
 svx/qa/unit/customshapes.cxx|   48 ++
 svx/qa/unit/data/FontworkSameLetterHeights.fodg |  402 
 svx/source/toolbars/fontworkbar.cxx |   15 
 3 files changed, 457 insertions(+), 8 deletions(-)

New commits:
commit 58a4459627a92958ef133868f72af10d8d56ccad
Author: Matt K 
AuthorDate: Thu Jul 13 15:31:14 2023 -0500
Commit: Hossein 
CommitDate: Thu Jul 20 16:12:36 2023 +0200

tdf#150302 Fix FontworkSameLetterHeights button in Draw

This change fixes the Font Work Bar SameLetterHeights button
at the bottom of Draw when opening a file without a
FontWorkSameLetterHeights property initialied in the XML
of the file.  The change now applies a default property value
which allows the button to properly work and switch the boolean
value of property which can then be saved in the XML of the file.
Also added a unit test which checks for the correct property
value after toggling the button 2 times.

The command to run the new unit test is:
make CppunitTest_svx_unit CPPUNIT_TEST_NAME=testTdf150302

Change-Id: Id55eaedb625139f0071cdca5f628a0766afab0fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154402
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 464a6b542e84..f285baa27e63 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -89,6 +89,54 @@ sal_uInt8 CustomshapesTest::countShapes()
 return xDrawPage->getCount();
 }
 
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf150302)
+{
+loadFromURL(u"FontworkSameLetterHeights.fodg");
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of shapes", 
static_cast(2),
+ countShapes());
+
+bool bSameHeights = false;
+uno::Reference xShape(getShape(0));
+SdrObjCustomShape* pSdrCustomShape(
+
static_cast(SdrObject::getSdrObjectFromXShape(xShape)));
+const SdrCustomShapeGeometryItem& rGeometryItem(
+pSdrCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY));
+const css::uno::Any* pAny
+= rGeometryItem.GetPropertyValueByName("TextPath", 
"SameLetterHeights");
+if (pAny)
+*pAny >>= bSameHeights;
+
+CPPUNIT_ASSERT_MESSAGE("Wrong initial value", !bSameHeights);
+
+// Mark Object
+SfxViewShell* pViewShell = SfxViewShell::Current();
+SdrView* pSdrView = pViewShell->GetDrawView();
+pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
+
+dispatchCommand(mxComponent, ".uno:FontworkSameLetterHeights", {});
+
+const SdrCustomShapeGeometryItem& rGeometryItem1
+= pSdrCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY);
+pAny = rGeometryItem1.GetPropertyValueByName("TextPath", 
"SameLetterHeights");
+if (pAny)
+*pAny >>= bSameHeights;
+
+CPPUNIT_ASSERT_MESSAGE("Wrong value after toggle", bSameHeights);
+
+pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
+
+dispatchCommand(mxComponent, ".uno:FontworkSameLetterHeights", {});
+
+const SdrCustomShapeGeometryItem& rGeometryItem2
+= pSdrCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY);
+pAny = rGeometryItem2.GetPropertyValueByName("TextPath", 
"SameLetterHeights");
+if (pAny)
+*pAny >>= bSameHeights;
+
+CPPUNIT_ASSERT_MESSAGE("Wrong value after toggle 2", !bSameHeights);
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf147409_GeomItemHash)
 {
 loadFromURL(u"tdf147409_GeomItemHash.odg");
diff --git a/svx/qa/unit/data/FontworkSameLetterHeights.fodg 
b/svx/qa/unit/data/FontworkSameLetterHeights.fodg
new file mode 100755
index ..424b850c5ddb
--- /dev/null
+++ b/svx/qa/unit/data/FontworkSameLetterHeights.fodg
@@ -0,0 +1,402 @@
+
+
+http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/200
 4/writer" xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:tableooo="http://openoffice.org/2009/table; 

[Libreoffice-commits] core.git: svx/qa svx/source

2023-04-19 Thread Sarper Akdemir (via logerrit)
 svx/qa/unit/data/tdf150020-shadow-alignment.pptx |binary
 svx/qa/unit/sdr.cxx  |   81 ++-
 svx/source/table/viewcontactoftableobj.cxx   |   54 ---
 3 files changed, 81 insertions(+), 54 deletions(-)

New commits:
commit fcf776a09a2c5cd692480c8ec4a678e3d04739c9
Author: Sarper Akdemir 
AuthorDate: Wed Apr 19 15:17:27 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Wed Apr 19 19:06:54 2023 +0200

tdf#150020: pass transform and scale matrix for the table shadow primitive

Shadow scaling related bits in createEmbeddedShadowPrimitive, requires
the ObjectMatrix with scale and translate.

Pass these in for table shadow creation too.

Change-Id: I28c30fe49d3c90e3ca03fb5294ca97eb5ba22773
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150639
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/svx/qa/unit/data/tdf150020-shadow-alignment.pptx 
b/svx/qa/unit/data/tdf150020-shadow-alignment.pptx
index caba1a122da5..0002667bd4d9 100644
Binary files a/svx/qa/unit/data/tdf150020-shadow-alignment.pptx and 
b/svx/qa/unit/data/tdf150020-shadow-alignment.pptx differ
diff --git a/svx/qa/unit/sdr.cxx b/svx/qa/unit/sdr.cxx
index b98df8b58041..4d6c4226d11b 100644
--- a/svx/qa/unit/sdr.cxx
+++ b/svx/qa/unit/sdr.cxx
@@ -85,46 +85,67 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment)
 loadFromURL(u"tdf150020-shadow-alignment.pptx");
 
 uno::Reference 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
-uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
- uno::UNO_QUERY);
-drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
-= renderPageToPrimitives(xDrawPage);
+{
+// Page 1 contains 9 shapes with each shadow alignment
+uno::Reference xDrawPage(
+xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
+= renderPageToPrimitives(xDrawPage);
 
-// Examine the created primitives.
-drawinglayer::Primitive2dXmlDump aDumper;
-xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
+// Examine the created primitives.
+drawinglayer::Primitive2dXmlDump aDumper;
+xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
 
-// Without the accompanying fix in place, this test would have failed with:
-// - Expected: -567
-// - Actual  : 162
-// - In <>, attribute 'xy13' of '(//shadow/transform)[1]' incorrect value.
-// i.e. shadow alignment was ignored while scaling the shadow.
-assertXPath(pDocument, "(//shadow/transform)[1]", "xy13", "-567");
-assertXPath(pDocument, "(//shadow/transform)[1]", "xy23", "162");
+// Without the accompanying fix in place, this test would have failed 
with:
+// - Expected: -567
+// - Actual  : 162
+// - In <>, attribute 'xy13' of '(//shadow/transform)[1]' incorrect 
value.
+// i.e. shadow alignment was ignored while scaling the shadow.
+assertXPath(pDocument, "(//shadow/transform)[1]", "xy13", "-567");
+assertXPath(pDocument, "(//shadow/transform)[1]", "xy23", "162");
 
-assertXPath(pDocument, "(//shadow/transform)[2]", "xy13", "-1794");
-assertXPath(pDocument, "(//shadow/transform)[2]", "xy23", "162");
+assertXPath(pDocument, "(//shadow/transform)[2]", "xy13", "-1794");
+assertXPath(pDocument, "(//shadow/transform)[2]", "xy23", "162");
 
-assertXPath(pDocument, "(//shadow/transform)[3]", "xy13", "-3021");
-assertXPath(pDocument, "(//shadow/transform)[3]", "xy23", "161");
+assertXPath(pDocument, "(//shadow/transform)[3]", "xy13", "-3021");
+assertXPath(pDocument, "(//shadow/transform)[3]", "xy23", "161");
 
-assertXPath(pDocument, "(//shadow/transform)[4]", "xy13", "-567");
-assertXPath(pDocument, "(//shadow/transform)[4]", "xy23", "-749");
+assertXPath(pDocument, "(//shadow/transform)[4]", "xy13", "-567");
+assertXPath(pDocument, "(//shadow/transform)[4]", "xy23", "-749");
 
-assertXPath(pDocument, "(//shadow/transform)[5]", "xy13", "-3021");
-assertXPath(pDocument, "(//shadow/transform)[5]", "xy23", "-750");
+assertXPath(pDocument, "(//shadow/transform)[5]", "xy13", "-3021");
+assertXPath(pDocument, "(//shadow/transform)[5]", "xy23", "-750");
 
-assertXPath(pDocument, "(//shadow/transform)[6]", "xy13", "-566");
-assertXPath(pDocument, "(//shadow/transform)[6]", "xy23", "-1691");
+assertXPath(pDocument, "(//shadow/transform)[6]", "xy13", "-566");
+assertXPath(pDocument, "(//shadow/transform)[6]", "xy23", "-1691");
 
-assertXPath(pDocument, "(//shadow/transform)[7]", "xy13", "-1794");
-assertXPath(pDocument, "(//shadow/transform)[7]", "xy23", "-1693");
+

[Libreoffice-commits] core.git: svx/qa

2023-04-12 Thread Stephan Bergmann (via logerrit)
 svx/qa/unit/customshapes.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit d8249389f791177464b0b74fc873384433d08947
Author: Stephan Bergmann 
AuthorDate: Wed Apr 12 23:06:54 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Apr 13 07:48:15 2023 +0200

-Werror,-Wunused-variable

Unused ever since it got introduced in 
6de8d3109dffa7d4d0cc06f319cca70134f0a8f3
"tdf#103474 handle edge cases in ARCANGLETO".

(Found with an experimental Clang build supporting 
__attribute__((warn_unused))
on individual ctors rather than just whole class types, and the 
corresponding
css::uno::Reference ctor marked accordingly.)

Change-Id: I40342955feedad25435c03f16a31b9585281c1f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150306
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 52667c326f3c..464a6b542e84 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -1081,7 +1081,6 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf122323_largeSwingAngle)
 // the end angle and used it modulo 360, no full ellipse was drawn.
 loadFromURL(u"tdf122323_swingAngle_larger360deg.pptx");
 uno::Reference xShape(getShape(0));
-uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
 SdrObjCustomShape& rSdrObjCustomShape(
 
static_cast(*SdrObject::getSdrObjectFromXShape(xShape)));
 EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);


[Libreoffice-commits] core.git: svx/qa

2023-03-04 Thread Tomaž Vajngerl (via logerrit)
 svx/qa/unit/svdraw.cxx |   33 +
 1 file changed, 33 insertions(+)

New commits:
commit 89d19cf6e721652eaa19eee2e4700eb4e4fdb540
Author: Tomaž Vajngerl 
AuthorDate: Sat Mar 4 18:46:25 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Mar 5 01:40:58 2023 +

svx: add test for RotatePoint

Change-Id: I62182fa02843d428d1b745c55ab695450ec4940a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148235
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index fc1a884c4b74..0001a7f4d66a 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -636,6 +636,39 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObjectRotate)
 pPage->RemoveObject(0);
 }
 }
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testRotatePoint)
+{
+{
+auto angle = 18000_deg100;
+double angleRadians = toRadians(angle);
+Point aPoint(2000, 1000);
+Point aReference(1000, 1000);
+RotatePoint(aPoint, aReference, std::sin(angleRadians), 
std::cos(angleRadians));
+
+CPPUNIT_ASSERT_EQUAL(Point(0, 1000), aPoint);
+}
+
+{
+auto angle = 9000_deg100;
+double angleRadians = toRadians(angle);
+Point aPoint(2000, 1000);
+Point aReference(1000, 1000);
+RotatePoint(aPoint, aReference, std::sin(angleRadians), 
std::cos(angleRadians));
+
+CPPUNIT_ASSERT_EQUAL(Point(1000, 0), aPoint);
+}
+
+{
+auto angle = 18000_deg100;
+double angleRadians = toRadians(angle);
+Point aPoint(100, 100);
+Point aReference(200, 200);
+RotatePoint(aPoint, aReference, std::sin(angleRadians), 
std::cos(angleRadians));
+
+CPPUNIT_ASSERT_EQUAL(Point(300, 300), aPoint);
+}
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: svx/qa

2023-03-04 Thread Tomaž Vajngerl (via logerrit)
 svx/qa/unit/svdraw.cxx |   87 +
 1 file changed, 87 insertions(+)

New commits:
commit e74c6e8550ae2644e30752e1fa91005c2a412ec7
Author: Tomaž Vajngerl 
AuthorDate: Sat Mar 4 17:14:01 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Mar 5 01:40:15 2023 +

svx: SdrRectObj move, rotate tests

Change-Id: I448f82d87be34c58d0abf4f6a0c1e6192567b807
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148234
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 7bf1ceb9d4a1..fc1a884c4b74 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -549,6 +550,92 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip)
 // i.e. the 2nd page had a line shape from the first page's footer.
 CPPUNIT_ASSERT_EQUAL(2, pPage2->getObjectCount());
 }
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObjectMove)
+{
+std::unique_ptr pModel(new SdrModel(nullptr, nullptr, true));
+pModel->GetItemPool().FreezeIdRanges();
+
+rtl::Reference pPage(new SdrPage(*pModel, false));
+pPage->SetSize(Size(5, 5));
+pModel->InsertPage(pPage.get(), 0);
+
+tools::Rectangle aRect(Point(), Size(100, 100));
+rtl::Reference pRectangleObject = new SdrRectObj(*pModel, 
aRect);
+pPage->NbcInsertObject(pRectangleObject.get());
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(), Size(100, 100)),
+ pRectangleObject->GetLogicRect());
+pRectangleObject->NbcMove({ 100, 100 });
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(100, 100), Size(100, 100)),
+ pRectangleObject->GetLogicRect());
+
+pPage->RemoveObject(0);
+}
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObjectRotate)
+{
+std::unique_ptr pModel(new SdrModel(nullptr, nullptr, true));
+pModel->GetItemPool().FreezeIdRanges();
+
+rtl::Reference pPage(new SdrPage(*pModel, false));
+pPage->SetSize(Size(5, 5));
+pModel->InsertPage(pPage.get(), 0);
+
+{
+tools::Rectangle aObjectSize(Point(), Size(100, 100));
+rtl::Reference pRectangleObject = new SdrRectObj(*pModel, 
aObjectSize);
+pPage->NbcInsertObject(pRectangleObject.get());
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(0, 0), Size(100, 100)),
+ pRectangleObject->GetLogicRect());
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(0, 0), Size(100, 100)),
+ pRectangleObject->GetSnapRect());
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(-1, -1), Size(102, 102)),
+ pRectangleObject->GetCurrentBoundRect());
+
+auto angle = 9000_deg100;
+double angleRadians = toRadians(angle);
+pRectangleObject->NbcRotate(aObjectSize.Center(), angle, 
std::sin(angleRadians),
+std::cos(angleRadians));
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(0, 98), Size(100, 100)),
+ pRectangleObject->GetLogicRect());
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(0, -1), Size(100, 100)),
+ pRectangleObject->GetSnapRect());
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(-1, -2), Size(102, 102)),
+ pRectangleObject->GetCurrentBoundRect());
+
+pPage->RemoveObject(0);
+}
+
+{
+tools::Rectangle aObjectSize(Point(), Size(100, 100));
+rtl::Reference pRectangleObject = new SdrRectObj(*pModel, 
aObjectSize);
+pPage->NbcInsertObject(pRectangleObject.get());
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(0, 0), Size(100, 100)),
+ pRectangleObject->GetLogicRect());
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(0, 0), Size(100, 100)),
+ pRectangleObject->GetSnapRect());
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(-1, -1), Size(102, 102)),
+ pRectangleObject->GetCurrentBoundRect());
+
+auto angle = -4500_deg100;
+double angleRadians = toRadians(angle);
+pRectangleObject->NbcRotate(aObjectSize.Center(), angle, 
std::sin(angleRadians),
+std::cos(angleRadians));
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(49, -20), Size(100, 100)),
+ pRectangleObject->GetLogicRect());
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(-21, -20), Size(141, 141)),
+ pRectangleObject->GetSnapRect());
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(-22, -21), Size(143, 143)),
+ pRectangleObject->GetCurrentBoundRect());
+
+pPage->RemoveObject(0);
+}
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: svx/qa

2023-01-24 Thread ektagoel12 (via logerrit)
 svx/qa/unit/styles.cxx |   28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 21fbb4b952c7ba5d580c71150ffe9423aaf57f9e
Author: ektagoel12 
AuthorDate: Sun Jan 22 14:24:09 2023 +0530
Commit: Xisco Fauli 
CommitDate: Tue Jan 24 17:57:20 2023 +

tdf#141908 Replace usage of sal_Int32 with Color

Change-Id: Id2849140ba1302d59918eb30458984aef2b5c6ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145964
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index 3a4aff375fc7..d44bf9ac4dc8 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -30,22 +30,22 @@ public:
 };
 
 /// Get the character color of the first text portion in xShape.
-sal_Int32 GetShapeTextColor(const uno::Reference& xShape)
+Color GetShapeTextColor(const uno::Reference& xShape)
 {
 uno::Reference xText(xShape->getText(), 
uno::UNO_QUERY);
 uno::Reference 
xPara(xText->createEnumeration()->nextElement(),
 uno::UNO_QUERY);
 uno::Reference 
xPortion(xPara->createEnumeration()->nextElement(),
  uno::UNO_QUERY);
-sal_Int32 nColor{};
+Color nColor{};
 xPortion->getPropertyValue("CharColor") >>= nColor;
 return nColor;
 }
 
 /// Get the solid fill color of xShape.
-sal_Int32 GetShapeFillColor(const uno::Reference& xShape)
+Color GetShapeFillColor(const uno::Reference& xShape)
 {
-sal_Int32 nColor{};
+Color nColor{};
 xShape->getPropertyValue("FillColor") >>= nColor;
 return nColor;
 }
@@ -61,17 +61,17 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 uno::Reference xDrawPageShapes(xDrawPage, 
uno::UNO_QUERY);
 uno::Reference xShape(xDrawPageShapes->getByIndex(0), 
uno::UNO_QUERY);
 // Blue.
-CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), 
GetShapeTextColor(xShape));
+CPPUNIT_ASSERT_EQUAL(Color(0x4472c4), GetShapeTextColor(xShape));
 uno::Reference xShape2(xDrawPageShapes->getByIndex(1), 
uno::UNO_QUERY);
 // Blue, lighter.
-CPPUNIT_ASSERT_EQUAL(static_cast(0xb4c7e7), 
GetShapeTextColor(xShape2));
+CPPUNIT_ASSERT_EQUAL(Color(0xb4c7e7), GetShapeTextColor(xShape2));
 uno::Reference xShape3(xDrawPageShapes->getByIndex(2), 
uno::UNO_QUERY);
 // Blue, darker.
-CPPUNIT_ASSERT_EQUAL(static_cast(0x2f5597), 
GetShapeTextColor(xShape3));
+CPPUNIT_ASSERT_EQUAL(Color(0x2f5597), GetShapeTextColor(xShape3));
 // Shape fill:
 uno::Reference 
xShape4(xDrawPageShapes->getByIndex(4), uno::UNO_QUERY);
 // Blue.
-CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), 
GetShapeFillColor(xShape4));
+CPPUNIT_ASSERT_EQUAL(Color(0x4472c4), GetShapeFillColor(xShape4));
 
 // The theme color of this filled shape is set by the PPTX import:
 {
@@ -84,7 +84,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 }
 uno::Reference 
xShape5(xDrawPageShapes->getByIndex(5), uno::UNO_QUERY);
 // Blue, lighter.
-CPPUNIT_ASSERT_EQUAL(static_cast(0xb4c7e7), 
GetShapeFillColor(xShape5));
+CPPUNIT_ASSERT_EQUAL(Color(0xb4c7e7), GetShapeFillColor(xShape5));
 // The theme index, and effects (lum mod, lum off) are set by the PPTX 
import:
 {
 uno::Reference xThemeColor;
@@ -113,26 +113,26 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 // - Expected: 9486886 (#90c226, green)
 // - Actual  : 4485828 (#4472c4, blue)
 // i.e. shape text was not updated on theme change.
-CPPUNIT_ASSERT_EQUAL(static_cast(0x90c226), 
GetShapeTextColor(xShape));
+CPPUNIT_ASSERT_EQUAL(Color(0x90c226), GetShapeTextColor(xShape));
 // Green, lighter:
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 14020002 (#d5eda2, light green)
 // - Actual  : 9486886 (#90c226, stock green)
 // i.e. the "light" effect on green was not applied.
-CPPUNIT_ASSERT_EQUAL(static_cast(0xd5eda2), 
GetShapeTextColor(xShape2));
+CPPUNIT_ASSERT_EQUAL(Color(0xd5eda2), GetShapeTextColor(xShape2));
 // Green, darker.
-CPPUNIT_ASSERT_EQUAL(static_cast(0x6c911d), 
GetShapeTextColor(xShape3));
+CPPUNIT_ASSERT_EQUAL(Color(0x6c911d), GetShapeTextColor(xShape3));
 // Shape fill:
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 9486886 (#90c226, green)
 // - Actual  : 4485828 (#4472c4, blue)
-CPPUNIT_ASSERT_EQUAL(static_cast(0x90c226), 
GetShapeFillColor(xShape4));
+CPPUNIT_ASSERT_EQUAL(Color(0x90c226), GetShapeFillColor(xShape4));
 // Green, lighter:
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 14020002 (#d5eda2, light green)
 // - Actual  : 9486886 (#90c226, green)
 // i.e. the "light" effect on green was not applied.
-CPPUNIT_ASSERT_EQUAL(static_cast(0xd5eda2), 
GetShapeFillColor(xShape5));
+

[Libreoffice-commits] core.git: svx/qa

2023-01-14 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   54 +-
 svx/qa/unit/data/tdf153000_WordArt_type_25_to_31.docx |binary
 2 files changed, 53 insertions(+), 1 deletion(-)

New commits:
commit e21053ef1113eb32d6d364b6c69470570a6846fe
Author: Regina Henschel 
AuthorDate: Sat Jan 14 12:19:56 2023 +0100
Commit: Regina Henschel 
CommitDate: Sat Jan 14 14:08:23 2023 +

tdf#153000 Unittest file types MSO_SPT=25 to 31

Unit test for commit 11319f419988443af85cf3c60dbed12d67fc183f

Change-Id: Idac7205a98599b765fdfc25a6fd29460f0ee430d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145508
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 38f8159143a0..fbaa5f7e7421 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -1217,7 +1217,7 @@ bool 
lcl_getShapeSegments(uno::Sequence& rS
 break;
 }
 }
-if (rSegments.getLength() > 2)
+if (rSegments.getLength() > 1)
 return true;
 else
 return false;
@@ -1282,6 +1282,58 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf148707_two_commands_B_V)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", sal_uInt32(2), 
aPolyPolygon.count());
 }
 }
+
+bool 
lcl_getShapeCoordinates(uno::Sequence&
 rCoordinates,
+ const uno::Reference& xShape)
+{
+uno::Reference xShapeProps(xShape, 
uno::UNO_QUERY_THROW);
+uno::Any anotherAny = xShapeProps->getPropertyValue("CustomShapeGeometry");
+uno::Sequence aCustomShapeGeometry;
+if (!(anotherAny >>= aCustomShapeGeometry))
+return false;
+uno::Sequence aPathProps;
+for (beans::PropertyValue const& rProp : 
std::as_const(aCustomShapeGeometry))
+{
+if (rProp.Name == "Path")
+{
+rProp.Value >>= aPathProps;
+break;
+}
+}
+
+for (beans::PropertyValue const& rProp : std::as_const(aPathProps))
+{
+if (rProp.Name == "Coordinates")
+{
+rProp.Value >>= rCoordinates;
+break;
+}
+}
+if (rCoordinates.getLength() > 0)
+return true;
+else
+return false;
+}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf153000_MS0_SPT_25_31)
+{
+// The shapes MSO_SPT=25 to MSO_SPT=31 are currently rendered as 
rectangle. They should be
+// rendered same way as in Word. More info in bug 153000.
+loadFromURL(u"tdf153000_WordArt_type_25_to_31.docx");
+// The wrong rendering becomes visible in properties "Coordinates" and 
"Segments". To simplify
+// the test we do not compare the values themselve but only the amount of 
values.
+// Without fix there were always 5 pairs in "Coordinates" and "Segments" 
did not exist.
+sal_Int32 aExpected[] = { 8, 5, 14, 8, 8, 14, 4 };
+for (sal_uInt8 i = 0; i < 7; i++)
+{
+uno::Reference xShape(getShape(i));
+uno::Sequence aSegments;
+CPPUNIT_ASSERT(lcl_getShapeSegments(aSegments, xShape));
+uno::Sequence aCoordinates;
+CPPUNIT_ASSERT(lcl_getShapeCoordinates(aCoordinates, xShape));
+CPPUNIT_ASSERT_EQUAL(aExpected[i], aCoordinates.getLength());
+}
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf153000_WordArt_type_25_to_31.docx 
b/svx/qa/unit/data/tdf153000_WordArt_type_25_to_31.docx
new file mode 100644
index ..f05a7a4b4f06
Binary files /dev/null and 
b/svx/qa/unit/data/tdf153000_WordArt_type_25_to_31.docx differ


[Libreoffice-commits] core.git: svx/qa

2022-11-23 Thread Tarcísio Ladeia de Oliveira (via logerrit)
 svx/qa/unit/core.cxx   |4 
 svx/qa/unit/svdraw.cxx |4 
 2 files changed, 8 insertions(+)

New commits:
commit a468c06f384b8ad2fb1260d375844accb18db2dc
Author: Tarcísio Ladeia de Oliveira 
AuthorDate: Mon Nov 21 23:14:20 2022 -0300
Commit: Xisco Fauli 
CommitDate: Wed Nov 23 12:47:59 2022 +0100

svx/qa: add checks for PDFiumDocument pointer

When compiled without PDFium, two tests in svx were causing segmentation
faults, as they were trying to access null pointers. Add a check for the
pointer returned and end test if it is a nullptr (based on how it is done
in other tests).

Change-Id: Iab3c341a20f002adc92fac22ef76ed022aa49422
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143081
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/core.cxx b/svx/qa/unit/core.cxx
index f834222ea009..a2976fd90eed 100644
--- a/svx/qa/unit/core.cxx
+++ b/svx/qa/unit/core.cxx
@@ -50,6 +50,10 @@ CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf)
 // Without the accompanying fix in place, this test would have failed, 
because the output was
 // empty (0 bytes).
 std::unique_ptr pPdfDocument = parsePDFExport();
+if (!pPdfDocument)
+{
+return;
+}
 int nPageCount = pPdfDocument->getPageCount();
 CPPUNIT_ASSERT_GREATER(0, nPageCount);
 }
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index c1c8bc435a9a..b20a08fe5092 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -498,6 +498,10 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip)
 
 // Then make sure that line shape gets clipped:
 std::unique_ptr pDoc = parsePDFExport();
+if (!pDoc)
+{
+return;
+}
 std::unique_ptr pPage1 = pDoc->openPage(0);
 CPPUNIT_ASSERT_EQUAL(3, pPage1->getObjectCount());
 std::unique_ptr pPage2 = pDoc->openPage(1);


[Libreoffice-commits] core.git: svx/qa svx/source

2022-10-11 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/page-view-draw-layer-clip.docx |binary
 svx/qa/unit/svdraw.cxx  |   37 
 svx/source/svdraw/svdpagv.cxx   |2 -
 3 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit bab44a97d21d0ac8a8a06678e71024c1a830943f
Author: Miklos Vajna 
AuthorDate: Mon Oct 10 20:38:40 2022 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 11 08:29:34 2022 +0200

tdf#151060 sw PDF export: don't paint off-page part of drawing object

Reported to be a regression from
c12358166a9bd88fe10feabca45a6ad3f65dff8e (DOCX import: fix lost objects
anchored to an empty linked header, 2020-01-10), the 3rd page of the PDF
export result contains an unexpected line shape.

This was "working" before as all objects anchored to the empty header
were lost.

Fix the problem by clipping the rendering to the page frame when
handling shapes, similar to what
689cead9e0837dc932e3a4cd765f7d319b529018 (tdf#91260 svx, sw: don't paint
off-page part of drawing object, 2016-12-06) did to fix the normal
rendering of the document.

The testcase document just has 2 pages, so there the unexpected shape
was on the 2nd page.

Change-Id: Ica24cd15717a1ee97dff448d385a10536671103e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141167
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/data/page-view-draw-layer-clip.docx 
b/svx/qa/unit/data/page-view-draw-layer-clip.docx
new file mode 100644
index ..7136a800f01f
Binary files /dev/null and b/svx/qa/unit/data/page-view-draw-layer-clip.docx 
differ
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index f6ca7fd4b09e..90030296e1c8 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -509,6 +512,40 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testVideoSnapshot)
 // i.e. ~25% crop from left and right should result in half width, but it 
was not reduced.
 CPPUNIT_ASSERT_EQUAL(static_cast(321), 
rBitmap.GetSizePixel().getWidth());
 }
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip)
+{
+// Given a document with 2 pages, first page footer has an off-page line 
shape:
+OUString aURL = 
m_directories.getURLFromSrc(u"svx/qa/unit/data/page-view-draw-layer-clip.docx");
+mxComponent = loadFromDesktop(aURL);
+
+// When saving that document to PDF:
+utl::TempFileNamed aTempFile;
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+xStorable->storeToURL(aTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
+
+// Then make sure that line shape gets clipped:
+SvFileStream aFile(aTempFile.GetURL(), StreamMode::READ);
+SvMemoryStream aMemory;
+aMemory.WriteStream(aFile);
+std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get();
+if (!pPDFium)
+{
+return;
+}
+std::unique_ptr pDoc
+= pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), 
OString());
+std::unique_ptr pPage1 = pDoc->openPage(0);
+CPPUNIT_ASSERT_EQUAL(3, pPage1->getObjectCount());
+std::unique_ptr pPage2 = pDoc->openPage(1);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 3
+// i.e. the 2nd page had a line shape from the first page's footer.
+CPPUNIT_ASSERT_EQUAL(2, pPage2->getObjectCount());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 0e35d09b080e..60cd8cfe8ca0 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -262,7 +262,7 @@ void SdrPageView::DrawLayer(SdrLayerID nID, OutputDevice* 
pGivenTarget,
 if(pKnownTarget)
 {
 // paint known target
-pKnownTarget->RedrawLayer(, pRedirector, nullptr);
+pKnownTarget->RedrawLayer(, pRedirector, pPageFrame);
 }
 else
 {


[Libreoffice-commits] core.git: svx/qa svx/source

2022-08-24 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/video-snapshot.pptx |binary
 svx/qa/unit/svdraw.cxx   |   23 +++
 svx/source/svdraw/svdomedia.cxx  |9 +
 3 files changed, 32 insertions(+)

New commits:
commit 8fa1d453c94cdbb03dac646fb8db2ebd1a0e84bd
Author: Miklos Vajna 
AuthorDate: Wed Aug 24 13:53:38 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Aug 24 15:45:12 2022 +0200

Related: tdf#149971 svx: support explicitly provided snapshots for media 
shapes

Snapshots / previews for media objects are used when the shape's video
is not playing. This is generated by seeking to the 3rd second in the
video, probably to avoid initial black frames.

The trouble is that PowerPoint takes the initial frame (at least in case
of the bugdoc), so our snapshot doesn't match the reference.

We already import a bitmap snapshot from PPTX files since commit
e2d46da076f43a7c0d56fc486b9f15339243f7c9 (avmedia: add doc model for
bitmap fill of slide narrations, 2021-01-21), fix the problem by
changing the snapshot generation to prefer this bitmap over generating
one from the video.

The crop properties of this bitmap / the video are still not yet handled
from PPTX.

Change-Id: Id985ed5e4222d9a98203d054e08a0f97a0f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138763
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/data/video-snapshot.pptx 
b/svx/qa/unit/data/video-snapshot.pptx
new file mode 100644
index ..9a0ec9ebd867
Binary files /dev/null and b/svx/qa/unit/data/video-snapshot.pptx differ
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 9ad02060d68e..1bb9a6dab4db 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -483,6 +484,28 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testMaterialSpecular)
 // The first light is harsh, the second light soft. So the 3D scene should 
have 6 lights (1+1+4).
 assertXPath(pXmlDoc, "//light", 6);
 }
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testVideoSnapshot)
+{
+// Given a slide with a media shape, containing a 4 sec video, 
red-green-blue-black being the 4
+// seconds:
+OUString aURL = 
m_directories.getURLFromSrc(u"svx/qa/unit/data/video-snapshot.pptx");
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.presentation.PresentationDocument");
+SdrPage* pSdrPage = getFirstDrawPageWithAssert();
+auto pSdrMediaObj = dynamic_cast(pSdrPage->GetObj(0));
+
+// When getting the red snapshot of the video:
+Graphic aSnapshot(pSdrMediaObj->getSnapshot());
+
+// Then make sure the color is correct:
+const BitmapEx& rBitmap = aSnapshot.GetBitmapExRef();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: rgba[ffff]
+// - Actual  : rgba[00ff]
+// i.e. the preview was black, not red; since we seeked 3 secs into the 
video, while PowerPoint
+// doesn't do that.
+CPPUNIT_ASSERT_EQUAL(Color(0xff, 0x0, 0x0), rBitmap.GetPixelColor(0, 0));
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index f36e8aaa92e8..15a0e1179098 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -151,6 +151,15 @@ uno::Reference< graphic::XGraphic > const & 
SdrMediaObj::getSnapshot() const
 #if HAVE_FEATURE_AVMEDIA
 if( !m_xImpl->m_xCachedSnapshot.is() )
 {
+Graphic aGraphic = m_xImpl->m_MediaProperties.getGraphic();
+if (!aGraphic.IsNone())
+{
+// We have an explicit graphic for this media object, then go with 
that instead of
+// generating our own one.
+m_xImpl->m_xCachedSnapshot = aGraphic.GetXGraphic();
+return m_xImpl->m_xCachedSnapshot;
+}
+
 OUString aRealURL = m_xImpl->m_MediaProperties.getTempURL();
 if( aRealURL.isEmpty() )
 aRealURL = m_xImpl->m_MediaProperties.getURL();


[Libreoffice-commits] core.git: svx/qa svx/source

2022-06-24 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/table.cxx|   38 +++
 svx/source/table/tablecontroller.cxx |7 ++
 2 files changed, 45 insertions(+)

New commits:
commit 3edfbc19950610bb2061d29cb58b3811b1a0b1a5
Author: Miklos Vajna 
AuthorDate: Fri Jun 24 10:46:40 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jun 24 18:44:29 2022 +0200

tdf#148522 svx: fix undo of cell border changes text alignment in other 
cells

The Impress table properties dialog has multiple purposes: normally it
only affects the properties of the currently active cell, but shadow is
applied on the whole shape.

Regression from commit fdeb04f7c59cf8032fe17072ed779e70505cc6ab
(tdf#129961 svx: finish UI for table shadow as direct format,
2020-12-15), we started to apply properties to the current cell, and
then to the whole shape as well, unconditionally. This affects
undo/redo, as there is a separate undo manager while the text edit of a
table cell is active and when the text edit is ended.

Fix the problem by only applying properties on the shape when there we
actually have some properties: this way the text edit is typically not
ended, bringing back the old undo/redo behavior.

Note that we still need to end the text edit if the user explicitly sets
some shadow properties, that part is unchanged with this commit.

Change-Id: I78e28bd326a2c12c3775b33957adca4cd95ac582
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136357
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/table.cxx b/svx/qa/unit/table.cxx
index c82f331f2d17..c68abe18beea 100644
--- a/svx/qa/unit/table.cxx
+++ b/svx/qa/unit/table.cxx
@@ -24,6 +24,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -99,6 +104,39 @@ CPPUNIT_TEST_FIXTURE(Test, testTableShadowBlur)
 // itself and the transparency of the cell fill.
 assertXPath(pDocument, "//objectinfo/unifiedtransparence[1]", 
"transparence", "80");
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSvxTableControllerSetAttrToSelectedShape)
+{
+// Given a document with a table shape, editing cell text:
+getComponent() = loadFromDesktop("private:factory/simpress",
+ 
"com.sun.star.presentation.PresentationDocument");
+uno::Sequence aArgs
+= { comphelper::makePropertyValue("Rows", sal_Int32(2)),
+comphelper::makePropertyValue("Columns", sal_Int32(2)) };
+dispatchCommand(mxComponent, ".uno:InsertTable", aArgs);
+uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+auto pDrawPage = dynamic_cast(xDrawPage.get());
+CPPUNIT_ASSERT(pDrawPage);
+SdrPage* pSdrPage = pDrawPage->GetSdrPage();
+auto pSdrObject
+= 
dynamic_cast(pSdrPage->GetObj(pSdrPage->GetObjCount() 
- 1));
+SfxViewShell* pViewShell = SfxViewShell::Current();
+SdrView* pSdrView = pViewShell->GetDrawView();
+pSdrView->SdrBeginTextEdit(pSdrObject);
+CPPUNIT_ASSERT(pSdrView->IsTextEdit());
+const EditTextObject& rEdit = 
pSdrObject->getText(0)->GetOutlinerParaObject()->GetTextObject();
+SfxItemSet aSet(rEdit.GetParaAttribs(0));
+auto pTableController
+= 
dynamic_cast(pSdrView->getSelectionController().get());
+
+// When applying attributes which only affect the cell text, not the table 
shape:
+pTableController->SetAttrToSelectedShape(aSet);
+
+// Then make sure the text edit is not ended:
+CPPUNIT_ASSERT(pSdrView->IsTextEdit());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/table/tablecontroller.cxx 
b/svx/source/table/tablecontroller.cxx
index ef7401489c1d..1ceaa5141245 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -2754,6 +2754,13 @@ void SvxTableController::SetAttrToSelectedShape(const 
SfxItemSet& rAttr)
 SfxItemSetFixed 
aSet(*rAttr.GetPool());
 aSet.Put(rAttr);
 
+if (!aSet.Count())
+{
+// If there are no items to be applied on the shape, then don't set 
anything, it would
+// terminate text edit without a good reason, which affects undo/redo.
+return;
+}
+
 // Set shadow items on the marked shape.
 mrView.SetAttrToMarked(aSet, /*bReplaceAll=*/false);
 }


[Libreoffice-commits] core.git: svx/qa

2022-06-18 Thread Stephan Bergmann (via logerrit)
 svx/qa/unit/classicshapes.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 1d609713d090723aa78b71c35575102ad06717ff
Author: Stephan Bergmann 
AuthorDate: Fri Jun 17 22:57:41 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Jun 18 09:04:26 2022 +0200

-Werror=maybe-uninitialized

Change-Id: Ife1958a39a7cf673b745a7724ee963e868b21432
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136064
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx
index bb5bea7458c7..39c3dc20ce77 100644
--- a/svx/qa/unit/classicshapes.cxx
+++ b/svx/qa/unit/classicshapes.cxx
@@ -89,15 +89,15 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, 
testTdf98584ShearVertical)
 .toUtf8()
 .getStr(),
 5001.0, aFrameRect.Width, 2.0);
-double nShearA;
-xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_SHEARANGLE) >>= 
nShearA;
+double nShearA = {};
+
CPPUNIT_ASSERT(xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_SHEARANGLE) >>= 
nShearA);
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
 OUString("Incorrect Share angle on skewY page " + 
OUString::number(nPageIndex))
 .toUtf8()
 .getStr(),
 -5313.0, nShearA, 2.0);
-double nRotA;
-xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_ROTATEANGLE) >>= nRotA;
+double nRotA = {};
+
CPPUNIT_ASSERT(xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_ROTATEANGLE) >>= 
nRotA);
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
 OUString("Incorrect Rotate angle on skewY page " + 
OUString::number(nPageIndex))
 .toUtf8()
@@ -118,15 +118,15 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, 
testTdf98584ShearVertical)
 .toUtf8()
 .getStr(),
 5001.0, aFrameRect.Width, 2.0);
-double nShearA;
-xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_SHEARANGLE) >>= 
nShearA;
+double nShearA = {};
+
CPPUNIT_ASSERT(xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_SHEARANGLE) >>= 
nShearA);
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
 OUString("Incorrect Share angle on matrix page " + 
OUString::number(nPageIndex))
 .toUtf8()
 .getStr(),
 -6343.0, nShearA, 2.0);
-double nRotA;
-xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_ROTATEANGLE) >>= nRotA;
+double nRotA = {};
+
CPPUNIT_ASSERT(xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_ROTATEANGLE) >>= 
nRotA);
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
 OUString("Incorrect Rotate angle on matrix page " + 
OUString::number(nPageIndex))
 .toUtf8()


[Libreoffice-commits] core.git: svx/qa svx/source

2022-05-05 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   23 +
 svx/qa/unit/data/tdf148707_two_commands_B_V.odp   |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx |   24 +++---
 3 files changed, 35 insertions(+), 12 deletions(-)

New commits:
commit 124382eba6aaeb475b4077920c082bf5c51ac029
Author: Regina Henschel 
AuthorDate: Thu May 5 17:31:39 2022 +0200
Commit: Regina Henschel 
CommitDate: Thu May 5 21:27:15 2022 +0200

tdf#148707 implicit moveTo on all not only on first

The current solution checks implicit moveTo only on the first arc in
a sequence of arcs. The patch moves it into the loop, so that the
implicit moveTo is done for each command in a sequence.

Change-Id: I400fa8fc96d7377ede55296c71e7a82ce891cc24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133896
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 62e7728f7556..0b1970378e2a 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -1377,6 +1377,29 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf148714_CurvedArrows)
 }
 }
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148707_two_commands_B_V)
+{
+// tdf148707 custom shape with multiple command B or multiple command V 
were drawn with a line
+// between the arcs as if the second command was a A or W respectively.
+// The test document has a shape with path "V 0 0 50 100 0 50 25 0 50 0 
100 100 75 0 100 50 N"
+// and a shape with path "B 0 0 50 100 0 50 25 100 50 0 100 100 75 100 100 
50 N".
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf148707_two_commands_B_V.odp";
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+for (sal_uInt8 i = 0; i < 2; i++)
+{
+uno::Reference xShape(getShape(i));
+// In case no line is drawn, two polygons are generated; with line 
only one polygon
+SdrObjCustomShape& rSdrObjCustomShape(
+
static_cast(*SdrObject::getSdrObjectFromXShape(xShape)));
+EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+SdrPathObjUniquePtr pPathObj(
+
static_cast(aCustomShape2d.CreateLineGeometry().release()));
+CPPUNIT_ASSERT_MESSAGE("Could not convert to SdrPathObj", pPathObj);
+const basegfx::B2DPolyPolygon aPolyPolygon(pPathObj->GetPathPoly());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", sal_uInt32(2), 
aPolyPolygon.count());
+}
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf148707_two_commands_B_V.odp 
b/svx/qa/unit/data/tdf148707_two_commands_B_V.odp
new file mode 100644
index ..c26d371ef6a9
Binary files /dev/null and b/svx/qa/unit/data/tdf148707_two_commands_B_V.odp 
differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 1215433044ab..a521b6eb3120 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2337,25 +2337,25 @@ void EnhancedCustomShape2d::CreateSubPath(
 
 case ARC :
 case CLOCKWISEARC :
-{
-if(aNewB2DPolygon.count() > 1)
-{
-// #i76201# Add conversion to closed polygon when 
first and last points are equal
-basegfx::utils::checkClosed(aNewB2DPolygon);
-aNewB2DPolyPolygon.append(aNewB2DPolygon);
-}
-
-aNewB2DPolygon.clear();
-
-[[fallthrough]];
-}
 case ARCTO :
 case CLOCKWISEARCTO :
 {
 bool bClockwise = ( nCommand == CLOCKWISEARC ) || ( 
nCommand == CLOCKWISEARCTO );
+bool bImplicitMoveTo = (nCommand == ARC) || (nCommand == 
CLOCKWISEARC);
 sal_uInt32 nXor = bClockwise ? 3 : 2;
 for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( ( rSrcPt + 
3 ) < nCoordSize ); i++ )
 {
+if (bImplicitMoveTo)
+{
+if (aNewB2DPolygon.count() > 1)
+{
+// #i76201# Add conversion to closed polygon 
when first and last
+// points are equal
+basegfx::utils::checkClosed(aNewB2DPolygon);
+aNewB2DPolyPolygon.append(aNewB2DPolygon);
+}
+aNewB2DPolygon.clear();
+}
 tools::Rectangle aRect = tools::Rectangle::Justify( 
GetPoint( seqCoordinates[ rSrcPt ], true, true ), GetPoint( seqCoordinates[ 
rSrcPt 

[Libreoffice-commits] core.git: svx/qa svx/source

2022-05-03 Thread Stephan Bergmann (via logerrit)
 svx/qa/unit/XTableImportExportTest.cxx  |2 
 svx/qa/unit/svdraw.cxx  |   16 ++---
 svx/qa/unit/unodraw.cxx |4 -
 svx/qa/unit/xoutdev.cxx |6 +-
 svx/source/accessibility/AccessibleShape.cxx|4 -
 svx/source/accessibility/AccessibleTextHelper.cxx   |   18 +++---
 svx/source/accessibility/ChildrenManagerImpl.cxx|6 +-
 svx/source/accessibility/GraphCtlAccessibleContext.cxx  |6 +-
 svx/source/dialog/ClassificationCommon.cxx  |4 -
 svx/source/dialog/charmap.cxx   |4 -
 svx/source/dialog/signaturelinehelper.cxx   |3 -
 svx/source/fmcomp/dbaexchange.cxx   |6 +-
 svx/source/fmcomp/dbaobjectex.cxx   |2 
 svx/source/fmcomp/fmgridcl.cxx  |   46 +++
 svx/source/fmcomp/fmgridif.cxx  |2 
 svx/source/fmcomp/gridcell.cxx  |   12 ++--
 svx/source/form/datanavi.cxx|   48 
 svx/source/form/fmPropBrw.cxx   |   12 ++--
 svx/source/form/fmcontrolbordermanager.cxx  |   14 ++--
 svx/source/form/fmcontrollayout.cxx |9 +--
 svx/source/form/fmexch.cxx  |4 -
 svx/source/form/fmobj.cxx   |8 +-
 svx/source/form/fmobjfac.cxx|6 +-
 svx/source/form/fmpgeimp.cxx|   30 +-
 svx/source/form/fmservs.cxx |4 -
 svx/source/form/fmshell.cxx |2 
 svx/source/form/fmshimp.cxx |   22 +++
 svx/source/form/fmtools.cxx |4 -
 svx/source/form/fmundo.cxx  |6 +-
 svx/source/form/fmvwimp.cxx |   19 +++---
 svx/source/form/formcontrolfactory.cxx  |   27 -
 svx/source/form/formcontroller.cxx  |   12 ++--
 svx/source/form/navigatortree.cxx   |8 +-
 svx/source/form/navigatortreemodel.cxx  |6 +-
 svx/source/form/tabwin.cxx  |2 
 svx/source/gallery2/galmisc.cxx |4 -
 svx/source/items/SmartTagItem.cxx   |   16 ++---
 svx/source/items/customshapeitem.cxx|6 +-
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |2 
 svx/source/sidebar/text/TextCharacterSpacingControl.cxx |2 
 svx/source/smarttags/SmartTagMgr.cxx|6 +-
 svx/source/styles/ColorSets.cxx |4 -
 svx/source/svdraw/charthelper.cxx   |4 -
 svx/source/svdraw/svdmodel.cxx  |2 
 svx/source/svdraw/svdobj.cxx|2 
 svx/source/svdraw/svdouno.cxx   |2 
 svx/source/tbxctrls/bulletsnumbering.cxx|8 +-
 svx/source/tbxctrls/colrctrl.cxx|2 
 svx/source/tbxctrls/grafctrl.cxx|2 
 svx/source/tbxctrls/tbcontrl.cxx|2 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx  |   18 +++---
 svx/source/tbxctrls/verttexttbxctrl.cxx |2 
 svx/source/unodraw/UnoNamespaceMap.cxx  |2 
 svx/source/unodraw/gluepts.cxx  |4 -
 svx/source/unodraw/unopage.cxx  |2 
 svx/source/unodraw/unoshap2.cxx |2 
 svx/source/unodraw/unoshap4.cxx |2 
 svx/source/unodraw/unoshcol.cxx |2 
 svx/source/xml/xmleohlp.cxx |2 
 svx/source/xml/xmlgrhlp.cxx |2 
 svx/source/xml/xmlxtexp.cxx |4 -
 61 files changed, 243 insertions(+), 247 deletions(-)

New commits:
commit 1d2b6b709e81eec8600118b3402d82707aa113bc
Author: Stephan Bergmann 
AuthorDate: Tue May 3 17:01:57 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 3 21:48:15 2022 +0200

Just use Any ctor instead of makeAny in svx

Change-Id: I59b1b3f817a9028f132456ea5094f38f88674d00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133768
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/svx/qa/unit/XTableImportExportTest.cxx 
b/svx/qa/unit/XTableImportExportTest.cxx
index 1693d83d1a39..b97a7c50bc6b 100644
--- a/svx/qa/unit/XTableImportExportTest.cxx
+++ b/svx/qa/unit/XTableImportExportTest.cxx
@@ -51,7 +51,7 @@ CPPUNIT_TEST_FIXTURE(XTableImportExportTest, testImportExport)
 Graphic aGraphic(aBitmapEx);
 uno::Reference 

[Libreoffice-commits] core.git: svx/qa svx/source

2022-04-28 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx|   73 
 svx/qa/unit/data/tdf148714_CurvedArrows.ppt |binary
 svx/source/customshapes/EnhancedCustomShapeGeometry.cxx |   12 +-
 3 files changed, 81 insertions(+), 4 deletions(-)

New commits:
commit 4cfe46997eab3498cc519ef94c85ad2d644d3886
Author: Regina Henschel 
AuthorDate: Thu Apr 28 23:35:44 2022 +0200
Commit: Regina Henschel 
CommitDate: Fri Apr 29 07:27:48 2022 +0200

tdf#148714 connect first and second arc with arcTo

The curved*Arrows start with two arcs, which should be connected by a
line. The used commands are double V and double B respectively. Both
have an implicit moveTo, so that there should be no line between.
Other applications show the shapes correctly without line. But because
of bug 148714 LO shows a connecting line so that the error was not
earlier detected.
The patch changes the segment definition so that for the second
command the variant with implicit lineTo is used. This does not change
rendering in LO but makes other applications rendering the shapes
like LO.

Change-Id: I4f799f89497e52b1a7e00d8e5345a66ce21c00a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133586
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index fc671384e0c8..62e7728f7556 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -39,6 +39,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1304,6 +1306,77 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf148501_OctagonBevel)
 nColorDistance = aExpectedColor.GetColorError(aActualColor);
 CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
 }
+
+bool lcl_getShapeSegments(uno::Sequence& 
rSegments,
+  const uno::Reference& xShape)
+{
+uno::Reference xShapeProps(xShape, 
uno::UNO_QUERY_THROW);
+uno::Any anotherAny = xShapeProps->getPropertyValue("CustomShapeGeometry");
+uno::Sequence aCustomShapeGeometry;
+if (!(anotherAny >>= aCustomShapeGeometry))
+return false;
+uno::Sequence aPathProps;
+for (beans::PropertyValue const& rProp : 
std::as_const(aCustomShapeGeometry))
+{
+if (rProp.Name == "Path")
+{
+rProp.Value >>= aPathProps;
+break;
+}
+}
+
+for (beans::PropertyValue const& rProp : std::as_const(aPathProps))
+{
+if (rProp.Name == "Segments")
+{
+rProp.Value >>= rSegments;
+break;
+}
+}
+if (rSegments.getLength() > 2)
+return true;
+else
+return false;
+}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148714_CurvedArrows)
+{
+// Error was, that the line between 1. and 2. arc was missing.
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf148714_CurvedArrows.ppt";
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.presentation.PresentationDocument");
+
+for (sal_Int32 nShapeIndex = 0; nShapeIndex < 4; nShapeIndex++)
+{
+uno::Reference xShape(getShape(nShapeIndex));
+uno::Sequence aSegments;
+CPPUNIT_ASSERT(lcl_getShapeSegments(aSegments, xShape));
+
+if (nShapeIndex == 0 || nShapeIndex == 3)
+{
+// curvedDownArrow or curvedLeftArrow. Segments should start with 
VW. Without fix it was
+// V with count 2, which means VV.
+CPPUNIT_ASSERT_EQUAL(
+
sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC),
+aSegments[0].Command);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[0].Count);
+CPPUNIT_ASSERT_EQUAL(
+
sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO),
+aSegments[1].Command);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[1].Count);
+}
+else
+{
+// curvedUpArrow or curvedRightArrow. Segments should start with 
BA. Without fix is was
+// B with count 2, which means BB.
+
CPPUNIT_ASSERT_EQUAL(sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::ARC),
+ aSegments[0].Command);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[0].Count);
+
CPPUNIT_ASSERT_EQUAL(sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::ARCTO),
+ aSegments[1].Command);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[1].Count);
+}
+}
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf148714_CurvedArrows.ppt 
b/svx/qa/unit/data/tdf148714_CurvedArrows.ppt
new file mode 100644
index ..23e4ed0ad3eb
Binary files /dev/null and b/svx/qa/unit/data/tdf148714_CurvedArrows.ppt differ
diff --git 

[Libreoffice-commits] core.git: svx/qa svx/source

2022-04-22 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/theme.pptx |binary
 svx/qa/unit/styles.cxx  |   13 +
 svx/source/styles/ColorSets.cxx |9 +
 3 files changed, 22 insertions(+)

New commits:
commit 1f2a07e06b440ff1b15d66c2a2e72338301cdf0a
Author: Miklos Vajna 
AuthorDate: Thu Apr 21 20:08:06 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Apr 22 08:19:10 2022 +0200

sd theme: add rendering for shape fill color effects

Only the no-effects variant was working previously.

Change-Id: I50811a4c49d19dc801f0d1c841cbbdb2fae1ad60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133297
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/data/theme.pptx b/svx/qa/unit/data/theme.pptx
index ebed899cd42c..08e4a3b6f130 100644
Binary files a/svx/qa/unit/data/theme.pptx and b/svx/qa/unit/data/theme.pptx 
differ
diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index 3bfa6d8cf09b..ce9a039ce453 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -98,6 +98,13 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 xShape4->getPropertyValue("FillColorTheme") >>= nColorTheme;
 // 4 means accent1, this was -1 without the PPTX import bit in place.
 CPPUNIT_ASSERT_EQUAL(static_cast(4), nColorTheme);
+uno::Reference 
xShape5(xDrawPageShapes->getByIndex(5), uno::UNO_QUERY);
+// Blue, lighter.
+CPPUNIT_ASSERT_EQUAL(static_cast(0xb4c7e7), 
GetShapeFillColor(xShape5));
+// Set theme index to accent 1 & effects till PPTX import is missing.
+xShape5->setPropertyValue("FillColorTheme", 
uno::makeAny(static_cast(4)));
+xShape5->setPropertyValue("FillColorLumMod", 
uno::makeAny(static_cast(4000)));
+xShape5->setPropertyValue("FillColorLumOff", 
uno::makeAny(static_cast(6000)));
 
 // When changing the master slide of slide 1 to use the theme of the 
second master slide:
 uno::Reference xDrawPage2(
@@ -126,6 +133,12 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 // - Expected: 9486886 (#90c226, green)
 // - Actual  : 4485828 (#4472c4, blue)
 CPPUNIT_ASSERT_EQUAL(static_cast(0x90c226), 
GetShapeFillColor(xShape4));
+// Green, lighter:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 14020002 (#d5eda2, light green)
+// - Actual  : 9486886 (#90c226, green)
+// i.e. the "light" effect on green was not applied.
+CPPUNIT_ASSERT_EQUAL(static_cast(0xd5eda2), 
GetShapeFillColor(xShape5));
 }
 }
 
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index b1cb6fb34ca7..9edfdc2f3d2a 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -78,6 +78,15 @@ void UpdateFillColorSet(const 
uno::Reference& xShape, const
 }
 
 Color aColor = rColorSet.getColor(nFillColorTheme);
+sal_Int32 nFillColorLumMod{};
+xShape->getPropertyValue(UNO_NAME_FILLCOLOR_LUM_MOD) >>= nFillColorLumMod;
+sal_Int32 nFillColorLumOff{};
+xShape->getPropertyValue(UNO_NAME_FILLCOLOR_LUM_OFF) >>= nFillColorLumOff;
+if (nFillColorLumMod != 1 || nFillColorLumOff != 0)
+{
+aColor.ApplyLumModOff(nFillColorLumMod, nFillColorLumOff);
+}
+
 xShape->setPropertyValue(UNO_NAME_FILLCOLOR, 
uno::makeAny(static_cast(aColor)));
 }
 


[Libreoffice-commits] core.git: svx/qa svx/source

2022-04-20 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   41 ++
 svx/qa/unit/data/tdf148501_OctagonBevel.odp   |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx |   18 -
 3 files changed, 57 insertions(+), 2 deletions(-)

New commits:
commit d5fb8d502e77c1dfc77b2c7bdda4bb1540f3ddaf
Author: Regina Henschel 
AuthorDate: Mon Apr 18 19:31:26 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Apr 20 11:05:16 2022 +0200

tdf#148501 color shades only for filled PolyPolygons

For shading parts of a shape not of Type 'ooxml-*', ColorData is used,
introduced about 2005. For 'mso_spt*' shapes they are set directly,
for others they are encoded as 'col-' into the Type value.
During OOo time two changes were made, resulting in the bugs, that
colors are assigned to wrong segments and that shadings are too dark.
More details are in the bug report.

With this patch the colors are assigned to the correct segments again.
The too dark colors are visible in our preset shapes 'Octagon Bevel'.
The shape 'Diamond Bevel' with corrected color assignment is also
affected. Both need new ColorData. Since it is important for
Libreoffice to have good compatibility with OOXML, I have decided to
use only the four shading values available in OOXML. In the long run,
these shapes should be replaced by ones that contain the shading
information inside the  element.

Change-Id: I4b8323c45bf702fc371d6e6c82dd9102d0fd9929
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133132
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index d4ddca038f1f..fc671384e0c8 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -1263,6 +1263,47 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176)
 }
 }
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148501_OctagonBevel)
+{
+// The document contains a shape "Octagon Bevel". It should use shadings 
40%, 20%, -20%, -40%
+// from left-top to bottom-right. The test examines actual color, not the 
geometry.
+// Load document
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf148501_OctagonBevel.odp";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.presentation.PresentationDocument");
+
+// Generate bitmap from shape
+uno::Reference xShape = getShape(0);
+utl::TempFile aTempFile;
+aTempFile.EnableKillingFile();
+GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", 
aTempFile.GetURL());
+
+// Read bitmap and test color
+// expected in order top-left, top, top-right, right, bottom-right:
+// RGB(165|195|266), RGB(139|176|217), RGB(91|127|166), RGB(68|95|124), 
RGB(68|95|124)
+// Without applied patch the colors were:
+// RGB(193|214,236), RGB(193|214,236), RGB(80|111|145), RGB(23|32|41), 
RGB(193|214|236)
+// So we test segments top, right and bottom-right.
+SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
+vcl::PngImageReader aPNGReader(aFileStream);
+BitmapEx aBMPEx = aPNGReader.read();
+Bitmap aBMP = aBMPEx.GetBitmap();
+Bitmap::ScopedReadAccess pRead(aBMP);
+Size aSize = aBMP.GetSizePixel();
+
+// GetColor(Y,X). The chosen threshold for the ColorDistance can be 
adapted if necessary.
+Color aActualColor = pRead->GetColor(aSize.Height() * 0.17, aSize.Width() 
* 0.5); // top
+Color aExpectedColor(139, 176, 217);
+sal_uInt16 nColorDistance = aExpectedColor.GetColorError(aActualColor);
+CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
+aActualColor = pRead->GetColor(aSize.Height() * 0.5, aSize.Width() * 
0.83); // right
+aExpectedColor = Color(68, 95, 124); // same for right and bottom-right
+nColorDistance = aExpectedColor.GetColorError(aActualColor);
+CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
+aActualColor = pRead->GetColor(aSize.Height() * 0.75, aSize.Width() * 
0.75); // bottom-right
+nColorDistance = aExpectedColor.GetColorError(aActualColor);
+CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf148501_OctagonBevel.odp 
b/svx/qa/unit/data/tdf148501_OctagonBevel.odp
new file mode 100644
index ..9dafaf7c2624
Binary files /dev/null and b/svx/qa/unit/data/tdf148501_OctagonBevel.odp differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 32c7a73cc4dd..1aa482769711 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -777,8 +777,19 @@ 
EnhancedCustomShape2d::EnhancedCustomShape2d(SdrObjCustomShape& rSdrObjCustomSha
 case mso_sptSmileyFace :nColorData = 0x20e0; break;
 case mso_sptNil :
  

[Libreoffice-commits] core.git: svx/qa svx/source

2022-03-02 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/theme.pptx |binary
 svx/qa/unit/styles.cxx  |   19 +++
 svx/source/styles/ColorSets.cxx |   48 
 3 files changed, 53 insertions(+), 14 deletions(-)

New commits:
commit 6f50fe6f524d922c27ec1313ebef49352a2f9128
Author: Miklos Vajna 
AuthorDate: Wed Mar 2 20:27:09 2022 +0100
Commit: Miklos Vajna 
CommitDate: Thu Mar 3 08:16:57 2022 +0100

sd theme: add rendering for shape fill color

I.e. update the shape fill color when the theme of the master page
changes if the color is a theme color.

Change-Id: Ia1ed566230a8547334aa4a7d69627882aa690546
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130894
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/data/theme.pptx b/svx/qa/unit/data/theme.pptx
index 74397b3ea67a..ebed899cd42c 100644
Binary files a/svx/qa/unit/data/theme.pptx and b/svx/qa/unit/data/theme.pptx 
differ
diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index 565d981e6e2e..3881fe1d1006 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -62,6 +62,14 @@ sal_Int32 GetShapeTextColor(const 
uno::Reference& xShape)
 return nColor;
 }
 
+/// Get the solid fill color of xShape.
+sal_Int32 GetShapeFillColor(const uno::Reference& xShape)
+{
+sal_Int32 nColor{};
+xShape->getPropertyValue("FillColor") >>= nColor;
+return nColor;
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 {
 // Given a document, with a first slide and blue shape text from theme:
@@ -81,6 +89,12 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 uno::Reference xShape3(xDrawPageShapes->getByIndex(2), 
uno::UNO_QUERY);
 // Blue, darker.
 CPPUNIT_ASSERT_EQUAL(static_cast(0x2f5597), 
GetShapeTextColor(xShape3));
+// Shape fill:
+uno::Reference 
xShape4(xDrawPageShapes->getByIndex(4), uno::UNO_QUERY);
+// Blue.
+CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), 
GetShapeFillColor(xShape4));
+// Set theme index to accent 1 till PPTX import is missing.
+xShape4->setPropertyValue("FillColorTheme", 
uno::makeAny(static_cast(4)));
 
 // When changing the master slide of slide 1 to use the theme of the 
second master slide:
 uno::Reference xDrawPage2(
@@ -104,6 +118,11 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 CPPUNIT_ASSERT_EQUAL(static_cast(0xd5eda2), 
GetShapeTextColor(xShape2));
 // Green, darker.
 CPPUNIT_ASSERT_EQUAL(static_cast(0x6c911d), 
GetShapeTextColor(xShape3));
+// Shape fill:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 9486886 (#90c226, green)
+// - Actual  : 4485828 (#4472c4, blue)
+CPPUNIT_ASSERT_EQUAL(static_cast(0x90c226), 
GetShapeFillColor(xShape4));
 }
 }
 
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 97c79b58bcc6..5dcd089fd4ba 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -65,33 +65,53 @@ void UpdateTextPortionColorSet(const 
uno::Reference& xPorti
uno::makeAny(static_cast(aColor)));
 }
 
-void UpdateSdrObject(svx::Theme* pTheme, SdrObject* pObject)
+void UpdateFillColorSet(const uno::Reference& xShape, 
svx::ColorSet& rColorSet)
 {
-svx::ColorSet* pColorSet = pTheme->GetColorSet();
-if (!pColorSet)
+if 
(!xShape->getPropertySetInfo()->hasPropertyByName(UNO_NAME_FILLCOLOR_THEME))
 {
 return;
 }
 
-uno::Reference xShape(pObject->getUnoShape(), 
uno::UNO_QUERY);
-if (!xShape.is())
+sal_Int16 nFillColorTheme = -1;
+xShape->getPropertyValue(UNO_NAME_FILLCOLOR_THEME) >>= nFillColorTheme;
+if (nFillColorTheme < 0 || nFillColorTheme > 11)
+{
+return;
+}
+
+Color aColor = rColorSet.getColor(nFillColorTheme);
+xShape->setPropertyValue(UNO_NAME_FILLCOLOR, 
uno::makeAny(static_cast(aColor)));
+}
+
+void UpdateSdrObject(svx::Theme* pTheme, SdrObject* pObject)
+{
+svx::ColorSet* pColorSet = pTheme->GetColorSet();
+if (!pColorSet)
 {
-// E.g. group shapes have no text.
 return;
 }
 
-uno::Reference xText(xShape->getText(), 
uno::UNO_QUERY);
-uno::Reference xParagraphs = 
xText->createEnumeration();
-while (xParagraphs->hasMoreElements())
+uno::Reference xShape = pObject->getUnoShape();
+uno::Reference xShapeText(xShape, uno::UNO_QUERY);
+if (xShapeText.is())
 {
-uno::Reference 
xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY);
-uno::Reference xPortions = 
xParagraph->createEnumeration();
-while (xPortions->hasMoreElements())
+// E.g. group shapes have no text.
+uno::Reference 
xText(xShapeText->getText(), uno::UNO_QUERY);
+uno::Reference xParagraphs = 
xText->createEnumeration();
+while (xParagraphs->hasMoreElements())
 {
-uno::Reference 
xPortion(xPortions->nextElement(), uno::UNO_QUERY);
-

[Libreoffice-commits] core.git: svx/qa svx/source

2022-03-01 Thread Andrea Gelmini (via logerrit)
 svx/qa/unit/customshapes.cxx  |2 +-
 svx/qa/unit/svdraw.cxx|6 +++---
 svx/source/customshapes/EnhancedCustomShape3d.cxx |6 +++---
 svx/source/toolbars/extrusionbar.cxx  |2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 16665c48fef0ac178f224cccb1ddced69311835c
Author: Andrea Gelmini 
AuthorDate: Tue Mar 1 17:43:30 2022 +0100
Commit: Julien Nabet 
CommitDate: Tue Mar 1 17:48:39 2022 +0100

Fix typos

Change-Id: I13e7f1dc5d93f352e79139acb64b46dee298c9fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130186
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index bcce0ad7b458..bfec1f0141cf 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -223,7 +223,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf145700_3D_FrontLightDim)
 
 // Read bitmap and test color
 // The expected values are taken from an image generated by Word
-// Without the changed methods the nColorDistance was 476 and 173 
respecitively.
+// Without the changed methods the nColorDistance was 476 and 173 
respectively.
 SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
 vcl::PngImageReader aPNGReader(aFileStream);
 BitmapEx aBMPEx = aPNGReader.read();
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 275f75507d64..a063ef7d479f 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -398,7 +398,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks)
 assertXPath(pXmlDoc, "//scene", "projectionMode", "Perspective");
 assertXPath(pXmlDoc, "//scene/extrude3D[1]/fill", "color", "#ff");
 assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", 
"color", "#ff");
-// ODF default 50% is repesented by Specular Intensity = 2^5. The 
relationship is not linear.
+// ODF default 50% is represented by Specular Intensity = 2^5. The 
relationship is not linear.
 assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", 
"specularIntensity",
 "32");
 }
@@ -471,11 +471,11 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testMaterialSpecular)
 CPPUNIT_ASSERT(pXmlDoc);
 
 // 3D specular color is derived from properties 'extrusion-specularity' 
and 'extrusion-first-light
-// -level'. 3D specularIntensity is dervied from property 
'draw:extrusion-shininess'. Both are
+// -level'. 3D specularIntensity is derived from property 
'draw:extrusion-shininess'. Both are
 // object properties, not scene properties. Those were wrong in various 
forms before the patch.
 // Specularity = 77% * first-light-level 67% = 0.5159, which corresponds 
to gray color #848484.
 assertXPath(pXmlDoc, "(//material)[1]", "specular", "#848484");
-// extrusion-shinines 50% corresponds to 3D specularIntensity 32, use 
2^(50/10).
+// extrusion-shininess 50% corresponds to 3D specularIntensity 32, use 
2^(50/10).
 assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "32");
 // extrusion-first-light-level 67% corresponds to gray color #ababab, use 
255 * 0.67.
 assertXPath(pXmlDoc, "(//light)[1]", "color", "#ababab");
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx 
b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 0d8078fe6bd3..92ce3437228f 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -783,8 +783,8 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
 
 // Light Intensity
 
-// For "FirstLight" the 3D-Scene light "1" is regulary used. In 
case of surface "Matte"
-// the light 4 is used instead. For "SecondLight" the 3D-Scene 
light "2" is regulary used.
+// For "FirstLight" the 3D-Scene light "1" is regularly used. In 
case of surface "Matte"
+// the light 4 is used instead. For "SecondLight" the 3D-Scene 
light "2" is regularly used.
 // In case first or second light is not harsh, the lights 5 to 8 
are used in addition
 // to get a soft light appearance.
 // The 3D-Scene light "3" is currently not used.
@@ -892,7 +892,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
 
 // ToDo: How to handle fAmbientIntensity larger 1.0 ? Perhaps 
lighten object color?
 
-// Now set the regulary 3D-scene light attributes.
+// Now set the regularly 3D-scene light attributes.
 Color aAmbientColor(basegfx::BColor(fAmbientIntensity).clamp());
 
pScene->GetProperties().SetObjectItem(makeSvx3DAmbientcolorItem(aAmbientColor));
 
diff --git a/svx/source/toolbars/extrusionbar.cxx 
b/svx/source/toolbars/extrusionbar.cxx
index a3247cc02666..3e0273c2862c 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ 

[Libreoffice-commits] core.git: svx/qa svx/source

2022-02-17 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx|   36 
 svx/qa/unit/data/tdf147409_GeomItemHash.odg |binary
 svx/source/toolbars/extrusionbar.cxx|   13 ++
 svx/source/toolbars/fontworkbar.cxx |5 +++
 4 files changed, 48 insertions(+), 6 deletions(-)

New commits:
commit 4c0b033ece143b6f398157e812ff1c6b22e2855d
Author: Regina Henschel 
AuthorDate: Thu Feb 17 22:13:54 2022 +0100
Commit: Regina Henschel 
CommitDate: Thu Feb 17 23:56:37 2022 +0100

tdf#147409 tdf#146866 use SetPropertyValue for toggle

The toggles (Textpath,SameLetterHeights) and (Extrusion,Extrusion)
change a value by directly writing the value into the property. That
is lines (*pAny) <<= bOn;, for example. But that does not trigger
InvalidateHash() of the SdrCustomShapeGeometryItem. So the item has
still aHashState 'Valid'. On the other hand because of the change the
hash itself has changed. Therefore the == comparison between the
original item and its clone returns 'false' in customshapeitem.cxx#238.
And as a result, the assert in itempool.cxx#679 fails.

My solution replaces the direct writing with setting the value via
SetPropertyValue(), which includes the needed InvalidateHash(). The
method InvalidateHash() is private and so cannot be directly used in
fontwork.cxx and extrusionbar.cxx.

Change-Id: Ib6021defb61478de9cbefa8f26466a2fe21352a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130117
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 081a6b7789e0..bcce0ad7b458 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -132,6 +132,42 @@ void lcl_AssertRectEqualWithTolerance(std::string_view 
sInfo, const tools::Recta
std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
 }
 
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf147409_GeomItemHash)
+{
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf147409_GeomItemHash.odg";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+uno::Reference xShape(getShape(0));
+SdrObjCustomShape* pSdrCustomShape(
+
static_cast(SdrObject::getSdrObjectFromXShape(xShape)));
+
+// Mark Object
+SfxViewShell* pViewShell = SfxViewShell::Current();
+SdrView* pSdrView = pViewShell->GetDrawView();
+pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
+
+// Apply FontworkSameLetterHeights toggle
+// Without patch a debug build fails assert in SfxItemPool::PutImpl and so 
crashes.
+dispatchCommand(mxComponent, ".uno:FontworkSameLetterHeights", {});
+}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf146866_GeomItemHash)
+{
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf147409_GeomItemHash.odg";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+uno::Reference xShape(getShape(0));
+SdrObjCustomShape* pSdrCustomShape(
+
static_cast(SdrObject::getSdrObjectFromXShape(xShape)));
+
+// Mark Object
+SfxViewShell* pViewShell = SfxViewShell::Current();
+SdrView* pSdrView = pViewShell->GetDrawView();
+pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
+
+// Apply extrusion toggle
+// Without patch a debug build fails assert in SfxItemPool::PutImpl and so 
crashes.
+dispatchCommand(mxComponent, ".uno:ExtrusionToggle", {});
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_NonUI)
 {
 // The document contains first light soft, no ambient color, no second 
light and shininess 6.
diff --git a/svx/qa/unit/data/tdf147409_GeomItemHash.odg 
b/svx/qa/unit/data/tdf147409_GeomItemHash.odg
new file mode 100644
index ..770b7a6c0b42
Binary files /dev/null and b/svx/qa/unit/data/tdf147409_GeomItemHash.odg differ
diff --git a/svx/source/toolbars/extrusionbar.cxx 
b/svx/source/toolbars/extrusionbar.cxx
index 26ac4805cde0..10b56ad4b369 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -125,23 +125,26 @@ static void impl_execute( SfxRequest const & rReq, 
SdrCustomShapeGeometryItem& r
 {
 case SID_EXTRUSION_TOGGLE:
 {
-css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( 
sExtrusion, sExtrusion );
-
 bool bOn(false);
-if( pAny )
+css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( 
sExtrusion, sExtrusion );
+if ( pAny )
 {
 (*pAny) >>= bOn;
 bOn = !bOn;
-(*pAny) <<= bOn;
+css::beans::PropertyValue aPropValue;
+aPropValue.Name = sExtrusion;
+aPropValue.Value <<= bOn;
+rGeometryItem.SetPropertyValue(sExtrusion, aPropValue);
 }
 else
 {
 css::beans::PropertyValue 

[Libreoffice-commits] core.git: svx/qa svx/source

2022-02-10 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/unodraw.cxx   |   36 ++
 svx/source/unodraw/UnoGraphicExporter.cxx |   36 +-
 2 files changed, 71 insertions(+), 1 deletion(-)

New commits:
commit 00b0ff0687081bd6e88d3c3b0a1352c291fa6bb8
Author: Miklos Vajna 
AuthorDate: Thu Feb 10 20:08:11 2022 +0100
Commit: Miklos Vajna 
CommitDate: Fri Feb 11 08:25:11 2022 +0100

PNG export: allow setting filter data keys from the cmdline

For example, to set a custom pixel size:

soffice --convert-to 
'png:draw_png_Export:{"PixelHeight":{"type":"long","value":"192"},"PixelWidth":{"type":"long","value":"192"}}'
 test.odg

Change-Id: I628717ba36b6ad1ac03911eec06855c1745ef258
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129801
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx
index 7e69ba8d4f05..5d2814e2c21a 100644
--- a/svx/qa/unit/unodraw.cxx
+++ b/svx/qa/unit/unodraw.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -32,6 +33,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -208,6 +212,38 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testTitleShapeBullets)
 // were merged together (e.g. 1 bullet instead of 2 bullets for bulleted 
paragraphs).
 CPPUNIT_ASSERT(xTextE->hasMoreElements());
 }
+
+CPPUNIT_TEST_FIXTURE(UnodrawTest, testPngExport)
+{
+// Given an empty Impress document:
+mxComponent = loadFromDesktop("private:factory/simpress",
+  
"com.sun.star.presentation.PresentationDocument");
+
+// When exporting that document to PNG with a JSON size:
+uno::Reference xStorable(mxComponent, 
uno::UNO_QUERY_THROW);
+SvMemoryStream aStream;
+uno::Reference xOut = new 
utl::OOutputStreamWrapper(aStream);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("impress_png_Export");
+aMediaDescriptor["FilterOptions"]
+<<= OUString("{\"PixelHeight\":{\"type\":\"long\",\"value\":\"192\"},"
+ "\"PixelWidth\":{\"type\":\"long\",\"value\":\"192\"}}");
+aMediaDescriptor["OutputStream"] <<= xOut;
+xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
+
+// Then make sure that the size request is handled:
+aStream.Seek(STREAM_SEEK_TO_BEGIN);
+vcl::PngImageReader aPngReader(aStream);
+BitmapEx aBitmapEx;
+aPngReader.read(aBitmapEx);
+Size aSize = aBitmapEx.GetSizePixel();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 192
+// - Actual  : 595
+// i.e. it was not possible to influence the size from the cmdline.
+CPPUNIT_ASSERT_EQUAL(static_cast(192), aSize.getHeight());
+CPPUNIT_ASSERT_EQUAL(static_cast(192), aSize.getWidth());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx 
b/svx/source/unodraw/UnoGraphicExporter.cxx
index 7626579502e7..832699357257 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -64,6 +64,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include "UnoGraphicExporter.hxx"
 #include 
 
@@ -402,8 +405,39 @@ VclPtr GraphicExporter::CreatePageVDev( 
SdrPage* pPage, tools::Lo
 return pVDev;
 }
 
-void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& 
aDescriptor, ExportSettings& rSettings )
+void GraphicExporter::ParseSettings(const Sequence& rDescriptor,
+ExportSettings& rSettings)
 {
+Sequence aDescriptor = rDescriptor;
+if (aDescriptor.hasElements())
+{
+comphelper::SequenceAsHashMap aMap(aDescriptor);
+Sequence aFilterData;
+OUString aFilterOptions;
+auto it = aMap.find("FilterData");
+if (it != aMap.end())
+{
+it->second >>= aFilterData;
+}
+it = aMap.find("FilterOptions");
+if (it != aMap.end())
+{
+it->second >>= aFilterOptions;
+}
+if (!aFilterData.hasElements() && !aFilterOptions.isEmpty())
+{
+// Allow setting filter data keys from the cmdline.
+std::vector aData
+= comphelper::JsonToPropertyValues(aFilterOptions.toUtf8());
+aFilterData = comphelper::containerToSequence(aData);
+if (aFilterData.hasElements())
+{
+aMap["FilterData"] <<= aFilterData;
+aDescriptor = aMap.getAsConstPropertyValueList();
+}
+}
+}
+
 for( const PropertyValue& rValue : aDescriptor )
 {
 if ( rValue.Name == "FilterName" )


[Libreoffice-commits] core.git: svx/qa

2022-02-05 Thread Caolán McNamara (via logerrit)
 svx/qa/unit/classicshapes.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6481fffb1e3aa0f4f75778bd354389a1d39a8f00
Author: Caolán McNamara 
AuthorDate: Sat Feb 5 19:18:50 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Feb 5 21:41:39 2022 +0100

WaE: angle[1|2] may be used uninitialized [-Wmaybe-uninitialized]

Change-Id: If8771e4c73656d6f6d236d2d530d0ec92c1f5a7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129533
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx
index 0ef0722875a3..bb5bea7458c7 100644
--- a/svx/qa/unit/classicshapes.cxx
+++ b/svx/qa/unit/classicshapes.cxx
@@ -188,7 +188,7 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf130076Flip)
 
 for (sal_uInt8 nPageIndex = 0; nPageIndex < 2; ++nPageIndex)
 {
-double nAngle1, nAngle2;
+double nAngle1(0.0), nAngle2(0.0);
 uno::Reference xShape(getShape(1, nPageIndex));
 uno::Reference xShapeProps(xShape, 
uno::UNO_QUERY);
 uno::Reference xShape2(getShape(2, nPageIndex));


[Libreoffice-commits] core.git: svx/qa

2022-01-12 Thread Xisco Fauli (via logerrit)
 svx/qa/unit/customshapes.cxx |  113 +++
 1 file changed, 40 insertions(+), 73 deletions(-)

New commits:
commit aaec6db548ef2fe4d1d1869491eea15571457f57
Author: Xisco Fauli 
AuthorDate: Tue Jan 11 23:28:58 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Jan 12 09:58:34 2022 +0100

CppunitTest_svx_unit: simplify code (part 2)

Change-Id: Ic98a25f495630517827c1e9f9827e1c45e1401ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128304
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index ca6ece320afa..b420ecebe2e4 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -686,7 +686,6 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf115813_OOXML_XY_handle)
 + "tdf115813_HandleMovementOOXMLPresetShapes.pptx";
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
 
-OUString sErrors;
 // values in vector InteractionsHandles are in 1/100 mm and refer to page
 for (sal_uInt8 i = 0; i < countShapes(); i++)
 {
@@ -722,16 +721,14 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf115813_OOXML_XY_handle)
   || (abs(nDesiredX - nObservedX) == 100 && abs(nDesiredY - 
nObservedY) <= 1)
   || (abs(nDesiredX - nObservedX) <= 1 && abs(nDesiredY - 
nObservedY) <= 1)))
 {
-sErrors += "\n" +
-   //sErrors += OUString(sal_Unicode(10));
-   OUString::number(i) + " " + sShapeType + ": " + 
OUString::number(j)
-   + " X " + OUString::number(nDesiredX) + "|"
-   + OUString::number(nObservedX) + " Y " + 
OUString::number(nDesiredY)
-   + "|" + OUString::number(nObservedY);
+OUString sError
+= OUString::number(i) + " " + sShapeType + ": " + 
OUString::number(j) + " X "
+  + OUString::number(nDesiredX) + "|" + 
OUString::number(nObservedX) + " Y "
+  + OUString::number(nDesiredY) + "|" + 
OUString::number(nObservedY);
+CPPUNIT_FAIL(sError.toUtf8().getStr());
 }
 }
 }
-CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
 }
 
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testQuadraticCurveTo)
@@ -764,7 +761,6 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf126512_OOXML_handle_in_ODP)
 = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf126512_OOXMLHandleMovementInODF.odp";
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
 
-OUString sErrors; // sErrors collects shape type and handle index for 
failing cases
 for (sal_uInt8 i = 0; i < countShapes(); i++)
 {
 uno::Reference xShape(getShape(i));
@@ -791,12 +787,12 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf126512_OOXML_handle_in_ODP)
 if (aInitialPosition.X == aObservedPosition.X
 && aInitialPosition.Y == aObservedPosition.Y)
 {
-sErrors
-+= "\n" + OUString::number(i) + " " + sShapeType + "  " + 
OUString::number(j);
+OUString sError
+= OUString::number(i) + " " + sShapeType + "  " + 
OUString::number(j);
+CPPUNIT_FAIL(sError.toUtf8().getStr());
 }
 }
 }
-CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
 }
 
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
@@ -809,37 +805,34 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_Mirror)
 // text frame but the frame rectangle for their text.
 OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf127785_Mirror.odp";
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
-OUString sErrors; // sErrors collects the errors and should be empty in 
case all is OK.
 
 uno::Reference xShapeV(getShape(0));
 uno::Reference xShapeVProps(xShapeV, uno::UNO_QUERY);
 CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeVProps.is());
 awt::Rectangle aBoundRectV;
 xShapeVProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= 
aBoundRectV;
-const sal_Int32 nHeightV = aBoundRectV.Height;
-const sal_Int32 nWidthV = aBoundRectV.Width;
-const sal_Int32 nLeftV = aBoundRectV.X;
-const sal_Int32 nTopV = aBoundRectV.Y;
-if (abs(nHeightV - 8000) > 10 || abs(nWidthV - 8000) > 10)
-sErrors += "Flip vertical wrong size.";
-if (abs(nLeftV - 1000) > 10 || abs(nTopV - 2000) > 10)
-sErrors += " Flip vertical wrong position.";
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Flip vertical wrong size.", 8000.0, 
aBoundRectV.Height,
+ 10.0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Flip vertical wrong size.", 8000.0, 
aBoundRectV.Width,
+  

[Libreoffice-commits] core.git: svx/qa

2022-01-11 Thread Xisco Fauli (via logerrit)
 svx/qa/unit/classicshapes.cxx |  143 ++
 1 file changed, 64 insertions(+), 79 deletions(-)

New commits:
commit 91c6279dd60b07788c8015fb04ecd2d310de1623
Author: Xisco Fauli 
AuthorDate: Mon Jan 10 20:09:57 2022 +0100
Commit: Xisco Fauli 
CommitDate: Tue Jan 11 12:40:09 2022 +0100

CppunitTest_svx_unit: simplify code

Just use CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE
or CPPUNIT_ASSERT_EQUAL_MESSAGE

Change-Id: Ibf399cc802e31c5265ba1301f38df79958bf9e1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128262
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx
index 3bba20f8ec73..0ef0722875a3 100644
--- a/svx/qa/unit/classicshapes.cxx
+++ b/svx/qa/unit/classicshapes.cxx
@@ -76,15 +76,7 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, 
testTdf98584ShearVertical)
 const OUString sURL(m_directories.getURLFromSrc(sDataDirectory) + 
"tdf98584_ShearVertical.odg");
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
 
-OUString sErrors; // sErrors collects the errors and should be empty in 
case all is OK.
-// All tests have a small tolerance for to avoid failing because of 
rounding errors.
-
 // Tests skewY
-sal_Int32 nShearE = -5313; // expected angle for horizontal shear
-sal_Int32 nRotE = 30687; // = -5313 expected angle for generated rotation
-// expected width of shape, should not change on vertical shearing
-sal_Int32 nWidthE = 5001;
-
 for (sal_uInt8 nPageIndex = 0; nPageIndex < 3; ++nPageIndex)
 {
 awt::Rectangle aFrameRect;
@@ -92,27 +84,28 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, 
testTdf98584ShearVertical)
 uno::Reference xShapeProps(xShape, 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeProps.is());
 xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= 
aFrameRect;
-const sal_Int32 nWidthA(aFrameRect.Width);
-if (abs(nWidthE - nWidthA) > 2)
-sErrors += "skewY page " + OUString::number(nPageIndex) + " width 
expected "
-   + OUString::number(nWidthE) + ", actual " + 
OUString::number(nWidthA) + "\n";
-sal_Int32 nShearA(0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
+OUString("Incorrect Width on skewY page " + 
OUString::number(nPageIndex))
+.toUtf8()
+.getStr(),
+5001.0, aFrameRect.Width, 2.0);
+double nShearA;
 xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_SHEARANGLE) >>= 
nShearA;
-if (abs(nShearE - nShearA) > 2)
-sErrors += "skewY page" + OUString::number(nPageIndex) + " shear 
angle expected "
-   + OUString::number(nShearE) + ", actual " + 
OUString::number(nShearA) + "\n";
-sal_Int32 nRotA(0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
+OUString("Incorrect Share angle on skewY page " + 
OUString::number(nPageIndex))
+.toUtf8()
+.getStr(),
+-5313.0, nShearA, 2.0);
+double nRotA;
 xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_ROTATEANGLE) >>= nRotA;
-if (abs(nRotE - nRotA) > 2)
-sErrors += "skewY page" + OUString::number(nPageIndex) + " rotate 
angle expected "
-   + OUString::number(nRotE) + ", actual " + 
OUString::number(nRotA) + "\n";
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
+OUString("Incorrect Rotate angle on skewY page " + 
OUString::number(nPageIndex))
+.toUtf8()
+.getStr(),
+30687.0, nRotA, 2.0);
 }
 
 // Tests matrix
-nShearE = -6343;
-nRotE = 29657;
-nWidthE = 5001;
-
 for (sal_uInt8 nPageIndex = 3; nPageIndex < 6; ++nPageIndex)
 {
 awt::Rectangle aFrameRect;
@@ -120,23 +113,26 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, 
testTdf98584ShearVertical)
 uno::Reference xShapeProps(xShape, 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeProps.is());
 xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= 
aFrameRect;
-const sal_Int32 nWidthA(aFrameRect.Width);
-if (abs(nWidthE - nWidthA) > 2)
-sErrors += "matrix page " + OUString::number(nPageIndex) + " width 
expected "
-   + OUString::number(nWidthE) + ", actual " + 
OUString::number(nWidthA) + "\n";
-sal_Int32 nShearA(0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
+OUString("Incorrect Width on matrix page " + 
OUString::number(nPageIndex))
+.toUtf8()
+.getStr(),
+5001.0, aFrameRect.Width, 2.0);
+double nShearA;
 xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_SHEARANGLE) >>= 
nShearA;
-if (abs(nShearE - nShearA) > 2)
-sErrors += 

[Libreoffice-commits] core.git: svx/qa svx/source

2022-01-10 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/theme.pptx |binary
 svx/qa/unit/styles.cxx  |1 +
 svx/source/styles/ColorSets.cxx |6 ++
 3 files changed, 7 insertions(+)

New commits:
commit 952b3b227e02ae4eedce3138fcb39613bf12486d
Author: Miklos Vajna 
AuthorDate: Mon Jan 10 14:36:02 2022 +0100
Commit: Miklos Vajna 
CommitDate: Mon Jan 10 17:38:56 2022 +0100

sd theme: fix applying new colors after theme change for group shapes

UpdateSdrObject() is called for both group and non-group shapes, so
don't assume that they always have text, otherwise we would crash.

Change-Id: I3672673176f0cb462a8b8d61a68466f541e9ce06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128248
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/data/theme.pptx b/svx/qa/unit/data/theme.pptx
index 652a9fc29e06..74397b3ea67a 100644
Binary files a/svx/qa/unit/data/theme.pptx and b/svx/qa/unit/data/theme.pptx 
differ
diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index 1e7151edf359..565d981e6e2e 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -68,6 +68,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "theme.pptx";
 getComponent() = loadFromDesktop(aURL);
 uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+// The draw page also contains a group shape to make sure we don't crash 
on group shapes.
 uno::Reference xDrawPage(
 xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
 uno::Reference xDrawPageShapes(xDrawPage, 
uno::UNO_QUERY);
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index c77e6ccf2d76..97c79b58bcc6 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -74,6 +74,12 @@ void UpdateSdrObject(svx::Theme* pTheme, SdrObject* pObject)
 }
 
 uno::Reference xShape(pObject->getUnoShape(), 
uno::UNO_QUERY);
+if (!xShape.is())
+{
+// E.g. group shapes have no text.
+return;
+}
+
 uno::Reference xText(xShape->getText(), 
uno::UNO_QUERY);
 uno::Reference xParagraphs = 
xText->createEnumeration();
 while (xParagraphs->hasMoreElements())


[Libreoffice-commits] core.git: svx/qa

2022-01-06 Thread Stephan Bergmann (via logerrit)
 svx/qa/unit/classicshapes.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit caaff91025316a464aa979b743a4748ab2d207ac
Author: Stephan Bergmann 
AuthorDate: Thu Jan 6 19:00:26 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Jan 6 23:02:39 2022 +0100

-Werror=maybe-uninitialized

Change-Id: Icebc6b95596e62628d00cc3c851f56a6a78ee727
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128058
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx
index d9e0fc18c7c1..3bba20f8ec73 100644
--- a/svx/qa/unit/classicshapes.cxx
+++ b/svx/qa/unit/classicshapes.cxx
@@ -198,15 +198,15 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf130076Flip)
 
 for (sal_uInt8 nPageIndex = 0; nPageIndex < 2; ++nPageIndex)
 {
-sal_Int32 angle1, angle2;
+sal_Int32 angle1 = {}, angle2 = {};
 const sal_Int32 goodAngle1 = 26000;
 const sal_Int32 goodAngle2 = 26000;
 uno::Reference xShape(getShape(1, nPageIndex));
 uno::Reference xShapeProps(xShape, 
uno::UNO_QUERY);
 uno::Reference xShape2(getShape(2, nPageIndex));
 uno::Reference xShapeProps2(xShape2, 
uno::UNO_QUERY);
-xShapeProps->getPropertyValue("CircleStartAngle") >>= angle1;
-xShapeProps2->getPropertyValue("CircleStartAngle") >>= angle2;
+CPPUNIT_ASSERT(xShapeProps->getPropertyValue("CircleStartAngle") >>= 
angle1);
+CPPUNIT_ASSERT(xShapeProps2->getPropertyValue("CircleStartAngle") >>= 
angle2);
 if (angle1 != goodAngle1)
 {
 sErrors += "page " + OUString::number(nPageIndex)


[Libreoffice-commits] core.git: svx/qa xmloff/source

2022-01-05 Thread Dhiraj Holden (via logerrit)
 svx/qa/unit/classicshapes.cxx  |   42 -
 svx/qa/unit/data/tdf130076_FlipOnSectorSection.odg |binary
 xmloff/source/draw/ximpshap.cxx|   25 
 3 files changed, 65 insertions(+), 2 deletions(-)

New commits:
commit 207d202ed2f1f44e5b62157b5a92ee5e8cc2c3e5
Author: Dhiraj Holden 
AuthorDate: Sat Jan 1 20:14:33 2022 -0500
Commit: Regina Henschel 
CommitDate: Wed Jan 5 15:31:58 2022 +0100

tdf#130076 Fixed flip not working properly from file

Added code to check whether the angles need to be changed when the
section is flipped.

Change-Id: I9cc3e16db74c6e9616385bc39849e4c73686b56c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127853
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx
index 8d8ed8bd74e4..d9e0fc18c7c1 100644
--- a/svx/qa/unit/classicshapes.cxx
+++ b/svx/qa/unit/classicshapes.cxx
@@ -181,6 +181,46 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, 
testTdf98583ShearHorizontal)
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
 }
-}
 
+CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf130076Flip)
+{
+// The document contains sections of a circle, one of which is scaled
+// (1, -1), one of which is scaled (-1,1), one of which is transformed
+// by a matrix equivalent to a vertical flip, and another which is
+// transformed by a matrix equivalent to a horizontal flip. Error was
+// that the transformation was made before the CircleKind was set,
+// resulting in the flip being performed incorrectly.
+const OUString sURL(m_directories.getURLFromSrc(sDataDirectory)
++ "tdf130076_FlipOnSectorSection.odg");
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+
+OUString sErrors; // sErrors collects the errors and should be empty in 
case all is OK.
+
+for (sal_uInt8 nPageIndex = 0; nPageIndex < 2; ++nPageIndex)
+{
+sal_Int32 angle1, angle2;
+const sal_Int32 goodAngle1 = 26000;
+const sal_Int32 goodAngle2 = 26000;
+uno::Reference xShape(getShape(1, nPageIndex));
+uno::Reference xShapeProps(xShape, 
uno::UNO_QUERY);
+uno::Reference xShape2(getShape(2, nPageIndex));
+uno::Reference xShapeProps2(xShape2, 
uno::UNO_QUERY);
+xShapeProps->getPropertyValue("CircleStartAngle") >>= angle1;
+xShapeProps2->getPropertyValue("CircleStartAngle") >>= angle2;
+if (angle1 != goodAngle1)
+{
+sErrors += "page " + OUString::number(nPageIndex)
+   + " expected vertical flip starting angle " + 
OUString::number(goodAngle1)
+   + " actual " + OUString::number(angle1) + "\n";
+}
+if (angle2 != goodAngle2)
+{
+sErrors += "page " + OUString::number(nPageIndex)
+   + " expected horizontal flip starting angle " + 
OUString::number(goodAngle2)
+   + " actual " + OUString::number(angle2) + "\n";
+}
+}
+CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
+}
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf130076_FlipOnSectorSection.odg 
b/svx/qa/unit/data/tdf130076_FlipOnSectorSection.odg
new file mode 100644
index ..058e7e0443f9
Binary files /dev/null and b/svx/qa/unit/data/tdf130076_FlipOnSectorSection.odg 
differ
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 4d2dec38a3c8..a19a6c19d936 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -1172,7 +1172,6 @@ void SdXMLEllipseShapeContext::startFastElement 
(sal_Int32 nElement,
 maPosition.X = mnCX - mnRX;
 maPosition.Y = mnCY - mnRY;
 }
-
 // set pos, size, shear and rotate
 SetTransformation();
 
@@ -1181,6 +1180,30 @@ void SdXMLEllipseShapeContext::startFastElement 
(sal_Int32 nElement,
 uno::Reference< beans::XPropertySet > xPropSet( mxShape, 
uno::UNO_QUERY );
 if( xPropSet.is() )
 {
+// calculate the correct start and end angle
+sal_Int32 mnOldStartAngle = mnStartAngle;
+sal_Int32 mnOldEndAngle = mnEndAngle;
+basegfx::B2DTuple aScale;
+basegfx::B2DTuple aTranslate;
+double fRotate;
+double fShearX;
+maUsedTransformation.decompose(aScale, aTranslate, fRotate, 
fShearX);
+if (aScale.getX() < 0 || aScale.getY() < 0)
+{
+// The angle for a horizontal flip is the same as the angle 
for a
+// vertical flip because a vertical flip is treated as a 
horizontal
+// flip plus a rotation.
+
+// To perform the flip, the start and end angle are switched 
and we
+// use the fact performing a horizontal flip on a shape will 

[Libreoffice-commits] core.git: svx/qa

2021-12-16 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx |   48 +++
 svx/qa/unit/data/tdf145904_center_Zminus2000.odt |binary
 svx/qa/unit/data/tdf145956_Origin.odp|binary
 3 files changed, 48 insertions(+)

New commits:
commit b9c159361abd79862b30412c433fb355d63299e2
Author: Regina Henschel 
AuthorDate: Thu Dec 16 19:47:05 2021 +0100
Commit: Regina Henschel 
CommitDate: Fri Dec 17 01:32:38 2021 +0100

tdf#145904,tdf#145956 unit test extrusion of shapes

These tests belongs to commit 453c5b6,
improve extrusion of custom shapes.

Change-Id: I3b89a887d72b6814540a659dfa088f1550a1d47b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126962
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 84a18fc77b4d..ca6ece320afa 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -127,6 +127,54 @@ void lcl_AssertRectEqualWithTolerance(std::string_view 
sInfo, const tools::Recta
std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
 }
 
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145956_Origin_Relative_BoundRect)
+{
+// The ViewPoint is relative to point Origin. The coordinates of point 
Origin are fractions of
+// the actual (2D) bounding rectangle of the shape, including rotation 
around z-axis and flip.
+// Error (among others) was, that the unrotated snap rectangle was used.
+
+// Load document
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf145956_Origin.odp";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.presentation.PresentationDocument");
+
+// The shape is extruded with 10cm. viewpoint="(0cm 0cm 25cm)", origin="0 
0".
+uno::Reference xShape(getShape(0));
+uno::Reference xPropSet(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the properties", xPropSet.is());
+awt::Rectangle aBoundRect;
+xPropSet->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRect;
+sal_Int32 nActualTop = aBoundRect.Y;
+
+// Without the fix it would have failed with top = 9462.
+// The tolerance 10 is estimated and can be adjusted if required for HiDPI.
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("top", 10448, nActualTop, 10);
+}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145904_Extrusion_CenterZ_odt)
+{
+// The Z-component of the extrusion rotation center specifies the position 
in Hmm.
+// Error (among others) was, that the value was interpreted as Twips.
+
+// Load document
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf145904_center_Zminus2000.odt";
+mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument");
+
+// The shape is extruded and tilt left 60deg. The rotation center is at 
-2000Hmm on the z-axis.
+// That is a position behind the back face of the extruded shape.
+uno::Reference xShape(getShape(0));
+uno::Reference xPropSet(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the properties", xPropSet.is());
+awt::Rectangle aBoundRect;
+xPropSet->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRect;
+awt::Point aAnchorPosition;
+xPropSet->getPropertyValue("AnchorPosition") >>= aAnchorPosition;
+sal_Int32 nActualLeft = aBoundRect.X - aAnchorPosition.X;
+
+// Without the fix it would have failed with left = 7731.
+// The tolerance 10 is estimated and can be adjusted if required for HiDPI.
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("left", 3501, nActualLeft, 10);
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145904_Extrusion_CenterY_odt)
 {
 // The X- and Y-component of the extrusion rotation center specify the 
position as fraction of
diff --git a/svx/qa/unit/data/tdf145904_center_Zminus2000.odt 
b/svx/qa/unit/data/tdf145904_center_Zminus2000.odt
new file mode 100644
index ..9a19f4cbdd6a
Binary files /dev/null and b/svx/qa/unit/data/tdf145904_center_Zminus2000.odt 
differ
diff --git a/svx/qa/unit/data/tdf145956_Origin.odp 
b/svx/qa/unit/data/tdf145956_Origin.odp
new file mode 100644
index ..7bba1dadd8e7
Binary files /dev/null and b/svx/qa/unit/data/tdf145956_Origin.odp differ


[Libreoffice-commits] core.git: svx/qa

2021-12-16 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit 88a2856c319b1ef5635d2a6ad2755be3fbef638a
Author: Andrea Gelmini 
AuthorDate: Thu Dec 16 11:05:27 2021 +0100
Commit: Julien Nabet 
CommitDate: Thu Dec 16 17:58:59 2021 +0100

Removed executable bits on .odt

Change-Id: Ibcfb38261e9d5bdd44259849c060de0d8c3a69a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126913
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/data/tdf145904_center_Y0dot25.odt 
b/svx/qa/unit/data/tdf145904_center_Y0dot25.odt
old mode 100755
new mode 100644


[Libreoffice-commits] core.git: svx/qa

2021-12-16 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit efe7d60333ba707223e526a8dd164d3a9348f4ff
Author: Andrea Gelmini 
AuthorDate: Thu Dec 16 11:42:08 2021 +0100
Commit: Julien Nabet 
CommitDate: Thu Dec 16 17:58:30 2021 +0100

Removed executable bits on .doc file

Change-Id: If41904da363187128c900910c39ee1d375271946
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126914
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/data/tdf145904_center_Y0dot25.doc 
b/svx/qa/unit/data/tdf145904_center_Y0dot25.doc
old mode 100755
new mode 100644


[Libreoffice-commits] core.git: svx/qa svx/source

2021-12-03 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/theme.pptx |binary
 svx/qa/unit/styles.cxx  |   49 
 svx/source/styles/ColorSets.cxx |   42 ++
 3 files changed, 63 insertions(+), 28 deletions(-)

New commits:
commit 9ebf7034c9cd3a0601542397254ebc97647a862e
Author: Miklos Vajna 
AuthorDate: Fri Dec 3 08:38:18 2021 +0100
Commit: Miklos Vajna 
CommitDate: Fri Dec 3 13:34:58 2021 +0100

svx: consider color effects when updating objects for theme changes

This builds on top of commit 48f0c5f73f99c919ec24deadc96c3cf5483c9314
(svx: update objects of pages of a master page when the theme changes,
2021-11-30), but now not only plain colors with colors with effects are
also considered. The luminance modulation / offset is what PowerPoint
uses the generate lighter / darker variants, tinting / shading is what
Word uses.

Change-Id: Ibfafb9be9986645117015bf3b05491daec8914be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126270
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/data/theme.pptx b/svx/qa/unit/data/theme.pptx
index 397b6706ffa4..652a9fc29e06 100644
Binary files a/svx/qa/unit/data/theme.pptx and b/svx/qa/unit/data/theme.pptx 
differ
diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index 9cbae8f997ba..1e7151edf359 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -49,6 +49,19 @@ void Test::tearDown()
 
 constexpr OUStringLiteral DATA_DIRECTORY = u"/svx/qa/unit/data/";
 
+/// Get the character color of the first text portion in xShape.
+sal_Int32 GetShapeTextColor(const uno::Reference& xShape)
+{
+uno::Reference xText(xShape->getText(), 
uno::UNO_QUERY);
+uno::Reference 
xPara(xText->createEnumeration()->nextElement(),
+uno::UNO_QUERY);
+uno::Reference 
xPortion(xPara->createEnumeration()->nextElement(),
+ uno::UNO_QUERY);
+sal_Int32 nColor{};
+xPortion->getPropertyValue("CharColor") >>= nColor;
+return nColor;
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 {
 // Given a document, with a first slide and blue shape text from theme:
@@ -59,17 +72,14 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
 uno::Reference xDrawPageShapes(xDrawPage, 
uno::UNO_QUERY);
 uno::Reference xShape(xDrawPageShapes->getByIndex(0), 
uno::UNO_QUERY);
-{
-uno::Reference xText(xShape->getText(), 
uno::UNO_QUERY);
-uno::Reference xPara(
-xText->createEnumeration()->nextElement(), uno::UNO_QUERY);
-uno::Reference 
xPortion(xPara->createEnumeration()->nextElement(),
- uno::UNO_QUERY);
-sal_Int32 nColor{};
-xPortion->getPropertyValue("CharColor") >>= nColor;
-// Blue.
-CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), nColor);
-}
+// Blue.
+CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), 
GetShapeTextColor(xShape));
+uno::Reference xShape2(xDrawPageShapes->getByIndex(1), 
uno::UNO_QUERY);
+// Blue, lighter.
+CPPUNIT_ASSERT_EQUAL(static_cast(0xb4c7e7), 
GetShapeTextColor(xShape2));
+uno::Reference xShape3(xDrawPageShapes->getByIndex(2), 
uno::UNO_QUERY);
+// Blue, darker.
+CPPUNIT_ASSERT_EQUAL(static_cast(0x2f5597), 
GetShapeTextColor(xShape3));
 
 // When changing the master slide of slide 1 to use the theme of the 
second master slide:
 uno::Reference xDrawPage2(
@@ -80,18 +90,19 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 xMasterPage->setPropertyValue("Theme", aTheme);
 
 // Then make sure the shape text color is now green:
-uno::Reference xText(xShape->getText(), 
uno::UNO_QUERY);
-uno::Reference 
xPara(xText->createEnumeration()->nextElement(),
-uno::UNO_QUERY);
-uno::Reference 
xPortion(xPara->createEnumeration()->nextElement(),
- uno::UNO_QUERY);
-sal_Int32 nColor{};
-xPortion->getPropertyValue("CharColor") >>= nColor;
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 9486886 (#90c226, green)
 // - Actual  : 4485828 (#4472c4, blue)
 // i.e. shape text was not updated on theme change.
-CPPUNIT_ASSERT_EQUAL(static_cast(0x90c226), nColor);
+CPPUNIT_ASSERT_EQUAL(static_cast(0x90c226), 
GetShapeTextColor(xShape));
+// Green, lighter:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 14020002 (#d5eda2, light green)
+// - Actual  : 9486886 (#90c226, stock green)
+// i.e. the "light" effect on green was not applied.
+CPPUNIT_ASSERT_EQUAL(static_cast(0xd5eda2), 
GetShapeTextColor(xShape2));
+// Green, darker.
+

[Libreoffice-commits] core.git: svx/qa

2021-11-13 Thread Regina Henschel (via logerrit)
 svx/qa/unit/svdraw.cxx |   26 ++
 1 file changed, 2 insertions(+), 24 deletions(-)

New commits:
commit 44f20abf66ce3f9806ad95522d7d9ae698350499
Author: Regina Henschel 
AuthorDate: Sat Nov 13 15:10:52 2021 +0100
Commit: Regina Henschel 
CommitDate: Sat Nov 13 18:42:09 2021 +0100

use new method too in existing unit tests in svdraw.cxx

Commit 87e5cac has introduced a local method for a common part of the
new unit tests. Identical parts are used in two existing unit tests.
The patch replaces them with calls to the new method.

Change-Id: I2945add642ac38048dd1fab4ffc3f2649a261650
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125168
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index f213af12f7de..cab6b56b0ae7 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -127,19 +127,9 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSemiTransparentText)
 auto pDrawPage = dynamic_cast(xDrawPage.get());
 CPPUNIT_ASSERT(pDrawPage);
 SdrPage* pSdrPage = pDrawPage->GetSdrPage();
-ScopedVclPtrInstance aVirtualDevice;
-sdr::contact::ObjectContactOfObjListPainter aObjectContact(*aVirtualDevice,
-   { 
pSdrPage->GetObj(0) }, nullptr);
-const sdr::contact::ViewObjectContact& rDrawPageVOContact
-= pSdrPage->GetViewContact().GetViewObjectContact(aObjectContact);
-sdr::contact::DisplayInfo aDisplayInfo;
-drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence;
-rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo, 
xPrimitiveSequence);
+xmlDocUniquePtr pDocument = 
lcl_dumpAndParseFirstObjectWithAssert(pSdrPage);
 
 // Make sure the text is semi-transparent.
-drawinglayer::Primitive2dXmlDump aDumper;
-xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
-
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 1
 // - Actual  : 0
@@ -401,19 +391,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks)
 auto pDrawPage = dynamic_cast(xDrawPage.get());
 CPPUNIT_ASSERT(pDrawPage);
 SdrPage* pSdrPage = pDrawPage->GetSdrPage();
-
-ScopedVclPtrInstance aVirtualDevice;
-sdr::contact::ObjectContactOfObjListPainter aObjectContact(*aVirtualDevice,
-   { 
pSdrPage->GetObj(0) }, nullptr);
-const auto& rDrawPageVOContact
-= pSdrPage->GetViewContact().GetViewObjectContact(aObjectContact);
-sdr::contact::DisplayInfo aDisplayInfo;
-drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence;
-rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo, 
xPrimitiveSequence);
-
-drawinglayer::Primitive2dXmlDump aDumper;
-xmlDocUniquePtr pXmlDoc = aDumper.dumpAndParse(xPrimitiveSequence);
-CPPUNIT_ASSERT(pXmlDoc);
+xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage);
 
 assertXPath(pXmlDoc, "/primitive2D", 1);
 


[Libreoffice-commits] core.git: svx/qa

2021-11-12 Thread Regina Henschel (via logerrit)
 svx/qa/unit/data/tdf140321_Matte_import.ppt  |binary
 svx/qa/unit/data/tdf140321_material_specular.odp |binary
 svx/qa/unit/data/tdf140321_metal.odp |binary
 svx/qa/unit/data/tdf140321_phong.odp |binary
 svx/qa/unit/svdraw.cxx   |  101 +++
 5 files changed, 101 insertions(+)

New commits:
commit 87e5caca7d3133a32d92503bfa8e5a1409545187
Author: Regina Henschel 
AuthorDate: Wed Nov 10 22:34:07 2021 +0100
Commit: Regina Henschel 
CommitDate: Fri Nov 12 15:55:52 2021 +0100

tdf#143021 unit test enable 'matte' extrusion surface

This adds the missing unit test for commmit
70a4cb766ed356bc17433ac1673e977bb0bf3d2f.

Thanks to Tomaž for extending the test framework to 3D.

Change-Id: Iffaa163c3d453318bc0ed7f8703af15bd20c8966
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125013
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/data/tdf140321_Matte_import.ppt 
b/svx/qa/unit/data/tdf140321_Matte_import.ppt
new file mode 100644
index ..83e790fd414f
Binary files /dev/null and b/svx/qa/unit/data/tdf140321_Matte_import.ppt differ
diff --git a/svx/qa/unit/data/tdf140321_material_specular.odp 
b/svx/qa/unit/data/tdf140321_material_specular.odp
new file mode 100644
index ..03869914f54d
Binary files /dev/null and b/svx/qa/unit/data/tdf140321_material_specular.odp 
differ
diff --git a/svx/qa/unit/data/tdf140321_metal.odp 
b/svx/qa/unit/data/tdf140321_metal.odp
new file mode 100644
index ..a81ee0dfbcd1
Binary files /dev/null and b/svx/qa/unit/data/tdf140321_metal.odp differ
diff --git a/svx/qa/unit/data/tdf140321_phong.odp 
b/svx/qa/unit/data/tdf140321_phong.odp
new file mode 100644
index ..989a0848532c
Binary files /dev/null and b/svx/qa/unit/data/tdf140321_phong.odp differ
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 5050136991bf..f213af12f7de 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -48,6 +48,7 @@ class SvdrawTest : public test::BootstrapFixture, public 
unotest::MacrosTest, pu
 {
 protected:
 uno::Reference mxComponent;
+SdrPage* getFirstDrawPageWithAssert();
 
 public:
 virtual void setUp() override
@@ -67,6 +68,37 @@ public:
 uno::Reference& getComponent() { return mxComponent; }
 };
 
+SdrPage* SvdrawTest::getFirstDrawPageWithAssert()
+{
+uno::Reference xDrawPagesSupplier(mxComponent,
+   
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT(xDrawPagesSupplier.is());
+uno::Reference 
xDrawPages(xDrawPagesSupplier->getDrawPages());
+uno::Reference xDrawPage(xDrawPages->getByIndex(0), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT(xDrawPage.is());
+
+auto pDrawPage = dynamic_cast(xDrawPage.get());
+CPPUNIT_ASSERT(pDrawPage);
+return pDrawPage->GetSdrPage();
+}
+
+xmlDocUniquePtr lcl_dumpAndParseFirstObjectWithAssert(SdrPage* pSdrPage)
+{
+ScopedVclPtrInstance aVirtualDevice;
+sdr::contact::ObjectContactOfObjListPainter aObjectContact(*aVirtualDevice,
+   { 
pSdrPage->GetObj(0) }, nullptr);
+const auto& rDrawPageVOContact
+= pSdrPage->GetViewContact().GetViewObjectContact(aObjectContact);
+sdr::contact::DisplayInfo aDisplayInfo;
+drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence;
+rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo, 
xPrimitiveSequence);
+
+drawinglayer::Primitive2dXmlDump aDumper;
+xmlDocUniquePtr pXmlDoc = aDumper.dumpAndParse(xPrimitiveSequence);
+CPPUNIT_ASSERT(pXmlDoc);
+return pXmlDoc;
+}
+
 CPPUNIT_TEST_FIXTURE(SvdrawTest, testSemiTransparentText)
 {
 // Create a new Draw document with a rectangle.
@@ -391,6 +423,75 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks)
 assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", 
"specularIntensity",
 "20");
 }
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMetal)
+{
+OUString aURL = 
m_directories.getURLFromSrc(u"svx/qa/unit/data/tdf140321_metal.odp");
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.presentation.PresentationDocument");
+
+SdrPage* pSdrPage = getFirstDrawPageWithAssert();
+
+xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage);
+
+// ODF specifies specular color as rgb(200,200,200) and adding 15 to 
specularity for metal=true
+// without patch the specular color was #ff
+assertXPath(pXmlDoc, "(//material)[1]", "specular", "#c8c8c8");
+// specularIntensity = 100 - (80 + 15), with nominal value 80 in the file
+// without patch specularIntensity was 15
+assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "5");
+}
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testExtrusionPhong)
+{
+OUString aURL = 

[Libreoffice-commits] core.git: svx/qa

2021-10-23 Thread Andrea Gelmini (via logerrit)
 svx/qa/unit/svdraw.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cc1598b806a8f63079de64512e0b322fc9b28714
Author: Andrea Gelmini 
AuthorDate: Fri Oct 22 23:26:06 2021 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 23 09:13:39 2021 +0200

Remove duplicated word

Change-Id: Ib3815aee68fdeb8f5eef465d01c51c66378fcd1a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124086
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 34f3c13cfbaa..8cf0f889eea7 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -335,7 +335,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, 
testAutoHeightMultiColShape)
 // When loading that document:
 getComponent().set(loadFromDesktop(aURL, 
"com.sun.star.presentation.PresentationDocument"));
 
-// Make sure the in-file shape height is kept, even if nominally the the 
shape height is
+// Make sure the in-file shape height is kept, even if nominally the shape 
height is
 // automatic:
 uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
 uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),


[Libreoffice-commits] core.git: svx/qa svx/source

2021-10-21 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   43 ++
 svx/qa/unit/data/tdf145245_ExtrusionPosition.odp  |binary
 svx/source/customshapes/EnhancedCustomShape3d.cxx |4 +-
 3 files changed, 45 insertions(+), 2 deletions(-)

New commits:
commit 5ab21caf603ba0a1c95bbc94a29eebe3483d1599
Author: Regina Henschel 
AuthorDate: Thu Oct 21 16:09:44 2021 +0200
Commit: Regina Henschel 
CommitDate: Thu Oct 21 23:36:16 2021 +0200

tdf#145245 correct relative position of extrusion

ODF specifies for draw:extrusion-depth, 'The draw:extrusion-depth
attribute specifies the depth of an extrusion. It takes two white space
separated values. The first value specifies the depth of the extrusion
in units, the second value specifies the fraction of the extrusion that
lies before a shape. The second value shall be in the range [0,1].'

The default for the second value is 0. Because LibreOffice has no UI to
change the value, the error becomes only visible, if you create own
custom shapes.

On import the ODF values are put in CustomShapeGeometry>Extrusion>
Depth. Method GetExtrusionDepth() calculates from that the length
values rBackwardDepth and rForwardDepth so that its sum is the depth.

CreateCustomShapeProperties() in escherex.cxx#2699 and
ApplyCustomShapeGeometryAttributes() in msdffimp.cxx#1684 use them in
the same sence.

But methods Create3DObject() and CalculateNewSnapRect() in
EnhancedCustomShape3d.cxx have used these values as if they were
coordinates.

I have keept the calculation in GetExtrusionDepth(), because it
reflects the meaning in ODF. I have corrected the signs in
Create3DObject() and CalculateNewSnapRect().

Change-Id: If275bb263b6f3d790f5893a69f38f8433acfbe7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123997
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index d4e7ff045fe1..92fbfc9fa62e 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -127,6 +127,49 @@ void lcl_AssertRectEqualWithTolerance(std::string_view 
sInfo, const tools::Recta
std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
 }
 
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145245_ExtrusionPosition)
+{
+// The second parameter of the extrusion-depth property specifies how much 
of the extrusion
+// lies before the shape. The file contains three shapes which have the 
values 0, 0.5 and 1.
+// They are rotated around the x-axis so that the extrusion becomes 
visible. The extrusion
+// depth itself is 5cm. Y-coordinate of shape is 6cm.
+
+// Load document
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf145245_ExtrusionPosition.odp";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+
+// The tolerance 40 is estimated and can be adjusted if required for HiDPI.
+{
+// First shape has extrusion behind the shape.
+uno::Reference xShape0(getShape(0));
+SdrObjCustomShape& rSdrCustomShape(
+
static_cast(*SdrObject::getSdrObjectFromXShape(xShape0)));
+tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+tools::Rectangle aExpected(Point(1000, 1000), Size(6002, 5001));
+lcl_AssertRectEqualWithTolerance("Pos 0.0 extrusion", aExpected, 
aBoundRect, 40);
+}
+{
+// Second shape has half of extrusion behind the shape.
+uno::Reference xShape(getShape(1));
+SdrObjCustomShape& rSdrCustomShape(
+
static_cast(*SdrObject::getSdrObjectFromXShape(xShape)));
+// Without the fix the height was 1 instead of 5001.
+tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+tools::Rectangle aExpected(Point(9000, 3500), Size(6002, 5001));
+lcl_AssertRectEqualWithTolerance("Pos 0.5 extrusion", aExpected, 
aBoundRect, 40);
+}
+{
+// Third shape has extrusion before the shape.
+uno::Reference xShape(getShape(2));
+SdrObjCustomShape& rSdrCustomShape(
+
static_cast(*SdrObject::getSdrObjectFromXShape(xShape)));
+// Without the fix the y-coordinate was 1000 instead of 6000.
+tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+tools::Rectangle aExpected(Point(18000, 6000), Size(6002, 5001));
+lcl_AssertRectEqualWithTolerance("Pos 1.0 extrusion", aExpected, 
aBoundRect, 40);
+}
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf145111_Fontwork_rendering_font_size)
 {
 // The tested position and height depend on dpi.
diff --git a/svx/qa/unit/data/tdf145245_ExtrusionPosition.odp 
b/svx/qa/unit/data/tdf145245_ExtrusionPosition.odp
new file mode 100644
index ..a356cf9ed396
Binary files /dev/null and 

[Libreoffice-commits] core.git: svx/qa svx/source

2021-10-21 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/auto-height-multi-col-shape.pptx |binary
 svx/qa/unit/svdraw.cxx|   28 ++
 svx/source/svdraw/svdoashp.cxx|   11 
 3 files changed, 39 insertions(+)

New commits:
commit ea5d4bab6c54432bf590f8650d9f5ea930a0daaa
Author: Miklos Vajna 
AuthorDate: Thu Oct 21 16:49:53 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 21 18:32:44 2021 +0200

sd: fix inteaction between multi-col shape text and automatic height

Multi-column shape text works by assuming a fixed height, then flowing
content to a next column once the current one is full.

Automatic height works by first laying out the text and then resizing
the shape to have a matching height.

When both are enabled, then we used to first calculate the automatic
height and then lay out the multi-col text using that height. PowerPoint
takes the height from the file format and lays out the multi-col text
using that fixed height, and only editing modifies the automatic height.

Fix the problem by not updating the automatic height when we have
multiple columns, this is meant to improve the stability of the layout
anyway.

Manual testing shows that editing the text on the UI still updates the
automatic height, as probably expected.

Based on Mike Kaganski's research - thanks! :-)

Change-Id: Iaf46c6008018b4bf26310322f25788a49c1d27f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123999
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/data/auto-height-multi-col-shape.pptx 
b/svx/qa/unit/data/auto-height-multi-col-shape.pptx
new file mode 100644
index ..12f232b0f236
Binary files /dev/null and b/svx/qa/unit/data/auto-height-multi-col-shape.pptx 
differ
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 7ad70b9ce92d..34f3c13cfbaa 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -323,6 +323,34 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObject)
 SdrObject* pObject(pRectangle);
 SdrObject::Free(pObject);
 }
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testAutoHeightMultiColShape)
+{
+// Given a document containing a shape that has:
+// 1) automatic height (resize shape to fix text)
+// 2) multiple columns (2)
+OUString aURL
+= 
m_directories.getURLFromSrc(u"svx/qa/unit/data/auto-height-multi-col-shape.pptx");
+
+// When loading that document:
+getComponent().set(loadFromDesktop(aURL, 
"com.sun.star.presentation.PresentationDocument"));
+
+// Make sure the in-file shape height is kept, even if nominally the the 
shape height is
+// automatic:
+uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+uno::Reference xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 6882
+// - Actual  : 3452
+// i.e. the shape height was smaller than expected, leading to a 2 columns 
layout instead of
+// laying out all the text in the first column.
+// 2477601 is from slide1.xml, .
+CPPUNIT_ASSERT_DOUBLES_EQUAL(
+static_cast(o3tl::convert(2477601, o3tl::Length::emu, 
o3tl::Length::mm100)),
+xShape->getSize().Height, 1);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 169f1782dd98..1b35ecd272c7 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2329,7 +2329,18 @@ bool 
SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool
 nHgt=aSiz2.Height()+1; // a little more tolerance
 }
 else
+{
 nHgt = rOutliner.GetTextHeight()+1; // a little more 
tolerance
+
+sal_Int16 nColumns = 
GetMergedItem(SDRATTR_TEXTCOLUMNS_NUMBER).GetValue();
+if (bHgtGrow && nColumns > 1)
+{
+// Both 'resize shape to fix text' and multiple 
columns are enabled. The
+// first means a dynamic height, the second 
expects a fixed height.
+// Resolve this conflict by going with the 
original height.
+nHgt = rR.getHeight();
+}
+}
 rOutliner.Clear();
 }
 }


[Libreoffice-commits] core.git: svx/qa svx/source

2021-10-17 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx|   24 
 svx/qa/unit/data/tdf144988_Fontwork_FontSize.odp|binary
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |8 -
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 3b922eb756d990c16944bbce42ae13142565a835
Author: Regina Henschel 
AuthorDate: Sun Oct 17 00:15:04 2021 +0200
Commit: Regina Henschel 
CommitDate: Sun Oct 17 14:04:29 2021 +0200

tdf#144988 correct font size in multiline Fontwork text

The error happened if ScaleX in TextPath is true. In that case the
original font size is used for rendering if possible. Only if a
paragraph is longer as its sub-path length, the rendered font size for
the whole text is reduced until the text fits. The error was, that in
case the first paragraph was too long and the second paragraph fits,
the fact that the first paragraph was too long was overwritten from
the factor for the second paragraph. That resulted in wrong position
and size of the text and overlapping characters.

The meaning of fScalingFactor is related to the usual case, where
ScaleX is false. Keeping original font size is not achieved by using
value 1 for fScalingFactor (which would be obvious), but the adaption
to case ScaleX==true is done in FitTextOutlinesToShapeOutlines() by
tweaking the width from the text bounding rectangle.

Change-Id: Icf5829018a83be0f1197304d17da10a88130f702
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123714
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 5c4ea6914288..d4e7ff045fe1 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -127,6 +127,30 @@ void lcl_AssertRectEqualWithTolerance(std::string_view 
sInfo, const tools::Recta
std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
 }
 
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf145111_Fontwork_rendering_font_size)
+{
+// The tested position and height depend on dpi.
+if (!IsDefaultDPI())
+return;
+
+// tdf#144988 In case ScaleX is true in property TextPath, the rendering 
font size should be
+// reduced in case any of the paragraphs would be longer as its sub-path. 
That was wrong, if
+// the first paragraph was too long and the second would fit. It resulted 
in wrong position
+// and height and overlapping characters.
+
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf144988_Fontwork_FontSize.odp";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+uno::Reference xShape(getShape(0));
+SdrObjCustomShape& rSdrCustomShape(
+
static_cast(*SdrObject::getSdrObjectFromXShape(xShape)));
+
+// Without the fix in place left|top, width x height was 1279|1279, 2815 x 
2448.
+// The expected values 1501|1777, 3941 x 1446 are only valid for 96dpi.
+tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+tools::Rectangle aExpected(Point(1501, 1777), Size(3941, 1446));
+lcl_AssertRectEqualWithTolerance("Wrong text rendering", aExpected, 
aBoundRect, 5);
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145111_anchor_in_Fontwork)
 {
 // The tested positions depend on dpi.
diff --git a/svx/qa/unit/data/tdf144988_Fontwork_FontSize.odp 
b/svx/qa/unit/data/tdf144988_Fontwork_FontSize.odp
new file mode 100644
index ..943bc143ba0e
Binary files /dev/null and b/svx/qa/unit/data/tdf144988_Fontwork_FontSize.odp 
differ
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx 
b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 56f67fcb0c89..32fd10661433 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -163,7 +163,6 @@ static void CalculateHorizontalScalingFactor(
 const tools::PolyPolygon& rOutline2d)
 {
 double fScalingFactor = 1.0;
-bool bScalingFactorDefined = false;
 rFWData.fVerticalTextScaling = 1.0;
 
 sal_uInt16 i = 0;
@@ -199,9 +198,14 @@ static void CalculateHorizontalScalingFactor(
 if ( nOutlinesCount2d & 1 )
 bSingleLineMode = true;
 
+// In case of rFWData.bScaleX == true it loops with reduced font size 
until the current run
+// results in a fScalingFactor >=1.0. The fact, that case rFWData.bScaleX 
== true keeps font
+// size if possible, is not done here with scaling factor 1 but is done in 
method
+// FitTextOutlinesToShapeOutlines()
 do
 {
 i = 0;
+bool bScalingFactorDefined = false; // New calculation for each font 
size
 for( const auto& rTextArea : rFWData.vTextAreas )
 {
 // calculating the width of the corresponding 2d text area
@@ -223,7 +227,7 @@ static void 

[Libreoffice-commits] core.git: svx/qa svx/source

2021-10-16 Thread Julien Nabet (via logerrit)
 svx/qa/unit/svdraw/test_SdrTextObject.cxx |7 
---
 svx/source/dialog/ctredlin.cxx|   23 
++
 svx/source/dialog/docrecovery.cxx |   11 
+++-
 svx/source/form/datanavi.cxx  |7 
++-
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx  |5 --
 svx/source/sidebar/inspector/InspectorTextPanel.cxx   |4 -
 svx/source/tbxctrls/PaletteManager.cxx|7 
+--
 svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx |9 
++-
 8 files changed, 41 insertions(+), 32 deletions(-)

New commits:
commit 9d98fadd5e943f4c3f87d0c269815c7a0feee217
Author: Julien Nabet 
AuthorDate: Sat Oct 16 13:43:59 2021 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 16 18:13:21 2021 +0200

Simplify vector initialization in svx

Change-Id: I139776f74fb93f90dae787eeae18e4a2a2ed7351
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123700
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/svdraw/test_SdrTextObject.cxx 
b/svx/qa/unit/svdraw/test_SdrTextObject.cxx
index 93b06272fd3d..218db2a52f0e 100644
--- a/svx/qa/unit/svdraw/test_SdrTextObject.cxx
+++ b/svx/qa/unit/svdraw/test_SdrTextObject.cxx
@@ -27,11 +27,8 @@ public:
 
 void SdrTextObjTest::AllFamiliesCanBeRestoredFromSavedString()
 {
-std::vector allFamilies;
-allFamilies.push_back(SfxStyleFamily::Char);
-allFamilies.push_back(SfxStyleFamily::Para);
-allFamilies.push_back(SfxStyleFamily::Page);
-allFamilies.push_back(SfxStyleFamily::Pseudo);
+std::vector allFamilies{ SfxStyleFamily::Char, 
SfxStyleFamily::Para,
+ SfxStyleFamily::Page, 
SfxStyleFamily::Pseudo };
 
 for (SfxStyleFamily family : allFamilies)
 {
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 3797df20d398..78b9974ec05d 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -358,10 +359,12 @@ void SvxRedlinTable::SetWriterView()
 pTreeView = xWriterTreeView.get();
 
 auto nDigitWidth = pTreeView->get_approximate_digit_width();
-std::vector aWidths;
-aWidths.push_back(nDigitWidth * 10);
-aWidths.push_back(nDigitWidth * 20);
-aWidths.push_back(nDigitWidth * 20);
+std::vector aWidths
+{
+o3tl::narrowing(nDigitWidth * 10),
+o3tl::narrowing(nDigitWidth * 20),
+o3tl::narrowing(nDigitWidth * 20)
+};
 pTreeView->set_column_fixed_widths(aWidths);
 }
 
@@ -374,11 +377,13 @@ void SvxRedlinTable::SetCalcView()
 pTreeView = xCalcTreeView.get();
 
 auto nDigitWidth = pTreeView->get_approximate_digit_width();
-std::vector aWidths;
-aWidths.push_back(nDigitWidth * 20);
-aWidths.push_back(nDigitWidth * 20);
-aWidths.push_back(nDigitWidth * 20);
-aWidths.push_back(nDigitWidth * 20);
+std::vector aWidths
+{
+o3tl::narrowing(nDigitWidth * 20),
+o3tl::narrowing(nDigitWidth * 20),
+o3tl::narrowing(nDigitWidth * 20),
+o3tl::narrowing(nDigitWidth * 20)
+};
 pTreeView->set_column_fixed_widths(aWidths);
 }
 
diff --git a/svx/source/dialog/docrecovery.cxx 
b/svx/source/dialog/docrecovery.cxx
index 1c86f078042f..94130ae491e7 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -657,10 +658,12 @@ RecoveryDialog::RecoveryDialog(weld::Window* pParent, 
RecoveryCore* pCore)
 
m_xProgressBar->set_size_request(m_xProgressBar->get_approximate_digit_width() 
* 50, -1);
 m_xProgress = new PluginProgress(m_xProgressBar.get());
 
-std::vector aWidths;
-aWidths.push_back(m_xFileListLB->get_checkbox_column_width());
-aWidths.push_back(60 * nWidth / 100);
-aWidths.push_back(m_xFileListLB->get_checkbox_column_width());
+std::vector aWidths
+{
+o3tl::narrowing(m_xFileListLB->get_checkbox_column_width()),
+o3tl::narrowing(60 * nWidth / 100),
+o3tl::narrowing(m_xFileListLB->get_checkbox_column_width())
+};
 m_xFileListLB->set_column_fixed_widths(aWidths);
 
 m_xNextBtn->set_sensitive(true);
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 45d7f8ab284e..4d5ac51af1d3 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -27,6 +27,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2636,8 +2637,10 @@ namespace svxform
 
m_xNamespacesList->set_size_request(m_xNamespacesList->get_approximate_digit_width()
 * 80,
 
m_xNamespacesList->get_height_rows(8));
 
-std::vector aWidths;
-  

[Libreoffice-commits] core.git: svx/qa svx/source

2021-10-15 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx|   38 
 svx/qa/unit/data/tdf145111_TL_BL_Fontwork.odp   |binary
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |2 
 3 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit 64bacd4f2bd9c8e10e8c9a0b7d18516c77260df3
Author: Regina Henschel 
AuthorDate: Fri Oct 15 02:00:30 2021 +0200
Commit: Regina Henschel 
CommitDate: Sat Oct 16 01:15:21 2021 +0200

tdf#145111 evaluate nVertDiff for HORZADJUST_LEFT too

In case of ScaleX=true in property TextPath, SDRTEXTVERTADJUST is
evaluated and should shift the Fontwork text. That did not work for
'LeftTop' and 'LeftBottom'.
Error was that in case of SDRTEXTHORZADJUST_LEFT the vertical shift
was not considered.

Change-Id: I4edb47515c4bf40e17b4054c3a10220df8468028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123613
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index c2d30cef2c0b..5c4ea6914288 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -127,6 +127,44 @@ void lcl_AssertRectEqualWithTolerance(std::string_view 
sInfo, const tools::Recta
std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
 }
 
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145111_anchor_in_Fontwork)
+{
+// The tested positions depend on dpi.
+if (!IsDefaultDPI())
+return;
+
+// tdf#145004 In case ScaleX is true in property TextPath, 
SDRTEXTVERTADJUST is
+// evaluated and should shift the Fontwork text. That did not work for
+// 'Top-Left' and 'Bottom-Left'.
+
+// Load document
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf145111_TL_BL_Fontwork.odp";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+
+{
+// First shape has anchor set to Top-Left, which shifts Fontwork text 
down.
+uno::Reference xShape(getShape(0));
+SdrObjCustomShape& rSdrCustomShape(
+
static_cast(*SdrObject::getSdrObjectFromXShape(xShape)));
+
+// Without the fix in place top was 2295, but should be 2916 for 96dpi.
+// Was 2184, should be 2886 for 120dpi.
+tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(2916), aBoundRect.Top(), 5);
+}
+{
+// Second shape has anchor set to Bottom-Left, which shifts Fontwork 
text up.
+uno::Reference xShape(getShape(1));
+SdrObjCustomShape& rSdrCustomShape(
+
static_cast(*SdrObject::getSdrObjectFromXShape(xShape)));
+
+// Without the fix in place top was 10294, but should be 9519 for 
96dpi.
+// Was 10184, should be 9481 for 120dpi.
+tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(9519), aBoundRect.Top(), 5);
+}
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145004_gap_by_ScaleX)
 {
 if (!IsDefaultDPI())
diff --git a/svx/qa/unit/data/tdf145111_TL_BL_Fontwork.odp 
b/svx/qa/unit/data/tdf145111_TL_BL_Fontwork.odp
new file mode 100644
index ..257023cfad0a
Binary files /dev/null and b/svx/qa/unit/data/tdf145111_TL_BL_Fontwork.odp 
differ
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx 
b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 669a855388cf..56f67fcb0c89 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -493,7 +493,7 @@ static bool GetFontWorkOutline(
 else if ( eHorzAdjust == SDRTEXTHORZADJUST_RIGHT )
 nHorzDiff = ( rFWData.fHorizontalTextScaling * 
rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() );
 
-if (nHorzDiff)
+if (nHorzDiff || nVertDiff)
 {
 for ( auto& rCharacter : rParagraph.vCharacters )
 {


[Libreoffice-commits] core.git: svx/qa svx/source

2021-10-13 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx|   22 
 svx/qa/unit/data/tdf145004_gap_by_ScaleX.pptx   |binary
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |3 --
 3 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 4e1f5b5eaddac6ff4b3028074edc8f6886d64c3f
Author: Regina Henschel 
AuthorDate: Fri Oct 8 22:10:35 2021 +0200
Commit: Regina Henschel 
CommitDate: Wed Oct 13 13:27:58 2021 +0200

tdf#145004 remove fontwork text padding for case ScaleX=true

The setting ScaleX=true in property TextPath in CustomShapeGeometry
is used in import of WortArt of kind 'Follow Path' from MS Office. The
value 'true' means, that the text is not stretched to the path but its
original font size is used as long as enough place is available.

The method CalculateHorizontalScalingFactor() has increased the
scaling factor by 10 percent to make a 'padding'. That results in a
too short text and a gap at start and/or end. The problem is not only
visible in imported shapes but in user designed Fontwork shapes too.
PowerPoint has no 'padding'. Currently our own preset Fontwork shapes
always use ScaleX=false and therefore are not affected.

I have not found any reason for such padding. So this patch removes it.

Change-Id: I7f2c4eb9101be1f13b006d4178ffbe75eb4ed55a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123295
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 57ef2ade4b8e..c2d30cef2c0b 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -127,6 +127,28 @@ void lcl_AssertRectEqualWithTolerance(std::string_view 
sInfo, const tools::Recta
std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
 }
 
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145004_gap_by_ScaleX)
+{
+if (!IsDefaultDPI())
+return;
+// tdf#145004 In case property ScaleX=true was set in property 'TextPath' 
an additional
+// padding was added to the scaling factor. That results in a gap at start 
or/and end of
+// the text. Such gap should not be there.
+
+// Load document and get shape. It is a custom shape from pptx import of a 
WordArt of
+// kind 'Follow Path'.
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf145004_gap_by_ScaleX.pptx";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+uno::Reference xShape(getShape(0));
+SdrObjCustomShape& rSdrCustomShape(
+
static_cast(*SdrObject::getSdrObjectFromXShape(xShape)));
+
+// Verify width. Without the fix in place the width was 8231, but should 
be 8496 for 96dpi.
+// Was 8328, should be 8527 for 120dpi.
+tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(8496), aBoundRect.GetWidth(), 5);
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf141021ExtrusionNorth)
 {
 // tdf#141021 Setting extrusion direction in projection method 
'perspective' to
diff --git a/svx/qa/unit/data/tdf145004_gap_by_ScaleX.pptx 
b/svx/qa/unit/data/tdf145004_gap_by_ScaleX.pptx
new file mode 100644
index ..900a89675e2a
Binary files /dev/null and b/svx/qa/unit/data/tdf145004_gap_by_ScaleX.pptx 
differ
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx 
b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 839c09f6143b..669a855388cf 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -242,9 +242,6 @@ static void CalculateHorizontalScalingFactor(
 
 if (nFontSize > 1)
 rFWData.fVerticalTextScaling = static_cast(nFontSize) / 
rFontHeight.GetHeight();
-// Add some padding
-if (rFWData.bScaleX)
-fScalingFactor *= 1.1;
 
 rFWData.fHorizontalTextScaling = fScalingFactor;
 }


[Libreoffice-commits] core.git: svx/qa svx/source

2021-06-28 Thread Regényi Balázs (via logerrit)
 svx/qa/unit/customshapes.cxx  |   24 +++---
 svx/source/customshapes/EnhancedCustomShape2d.cxx |3 +-
 2 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 2ffdd37067926ddb841c6055205f267b96706945
Author: Regényi Balázs 
AuthorDate: Sat Jan 16 13:48:44 2021 +0100
Commit: László Németh 
CommitDate: Mon Jun 28 09:35:18 2021 +0200

tdf#139549 DOCX import: document got modified at import time

Regression of bda05ba1736b74727872579b65b3fa14e3d8
"tdf#41466 DOCX import: fix VML v:shape/v:textbox".

Co-authored-by: Tünde Tóth

Change-Id: I8762aa8a710c3a37290e1db854b8cc86db6757b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109436
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 830c0074c757..b7b0788c4bba 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -610,9 +610,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 const sal_Int32 nWidthV = aBoundRectV.Width;
 const sal_Int32 nLeftV = aBoundRectV.X;
 const sal_Int32 nTopV = aBoundRectV.Y;
-if (abs(nHeightV - 4149) > 5 || abs(nWidthV - 3819) > 5)
+if (abs(nHeightV - 8000) > 10 || abs(nWidthV - 8000) > 10)
 sErrors += "Flip vertical wrong size.";
-if (abs(nLeftV - 3155) > 5 || abs(nTopV - 3736) > 5)
+if (abs(nLeftV - 1000) > 10 || abs(nTopV - 2000) > 10)
 sErrors += " Flip vertical wrong position.";
 
 uno::Reference xShapeH(getShape(1));
@@ -624,9 +624,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 const sal_Int32 nWidthH = aBoundRectH.Width;
 const sal_Int32 nLeftH = aBoundRectH.X;
 const sal_Int32 nTopH = aBoundRectH.Y;
-if (abs(nHeightH - 4149) > 5 || abs(nWidthH - 3819) > 5)
+if (abs(nHeightH - 8000) > 10 || abs(nWidthH - 8000) > 10)
 sErrors += " Flip horizontal wrong size.";
-if (abs(nLeftH - 15026) > 5 || abs(nTopH - 4115) > 5)
+if (abs(nLeftH - 13000) > 10 || abs(nTopH - 2000) > 10)
 sErrors += " Flip horizontal wrong position.";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
@@ -689,13 +689,13 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_Asymmetric)
 const sal_Int32 nTop = aBoundRect.Y;
 const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
 const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
-if (abs(nLeft - 10034) > 5)
+if (abs(nLeft - 9000) > 10)
 sErrors += "wrong left";
-if (abs(nRight - 12973) > 5)
+if (abs(nRight - 19000) > 10)
 sErrors += " wrong right";
-if (abs(nTop - 7892) > 5)
+if (abs(nTop - 3000) > 10)
 sErrors += " wrong top";
-if (abs(nBottom - 14884) > 5)
+if (abs(nBottom - 18000) > 10)
 sErrors += " wrong bottom";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
@@ -722,13 +722,13 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_TextRotateAngle)
 const sal_Int32 nTop = aBoundRect.Y;
 const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
 const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
-if (abs(nLeft - 5054) > 5)
+if (abs(nLeft - 2000) > 10)
 sErrors += "wrong left";
-if (abs(nRight - 6374) > 5)
+if (abs(nRight - 14000) > 10)
 sErrors += " wrong right";
-if (abs(nTop - 4516) > 5)
+if (abs(nTop - 3000) > 10)
 sErrors += " wrong top";
-if (abs(nBottom - 8930) > 5)
+if (abs(nBottom - 9000) > 10)
 sErrors += " wrong bottom";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 046f5a783c31..154f2df08c9e 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2864,9 +2864,10 @@ SdrObjectUniquePtr EnhancedCustomShape2d::CreatePathObj( 
bool bLineGeometryNeede
 SdrPathObj* pObj(rCandidate.first.get());
 const drawing::LineStyle 
eLineStyle(pObj->GetMergedItem(XATTR_LINESTYLE).GetValue());
 const drawing::FillStyle 
eFillStyle(pObj->GetMergedItem(XATTR_FILLSTYLE).GetValue());
+const auto pText = pObj->getActiveText();
 
 // #i40600# if bLineGeometryNeededOnly is set, linestyle does not 
matter
-if(bLineGeometryNeededOnly || (drawing::LineStyle_NONE != 
eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
+if(pText || bLineGeometryNeededOnly || (drawing::LineStyle_NONE != 
eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
 vNewList.push_back(std::move(rCandidate));
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa svx/source

2021-05-04 Thread Miklos Vajna (via logerrit)
 svx/qa/uitest/table/tablecontroller.py |   38 +
 svx/source/table/tablecontroller.cxx   |2 -
 2 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit ece86ef173cbc070c76f180d02ac80c65e07fff9
Author: Miklos Vajna 
AuthorDate: Mon May 3 20:49:08 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 4 09:02:08 2021 +0200

tdf#139500 svx: fix crash on changing table properties during active text 
edit

Regression from commit fdeb04f7c59cf8032fe17072ed779e70505cc6ab
(tdf#129961 svx: finish UI for table shadow as direct format,
2020-12-15), the problem was that the BegUndo() / EndUndo() pair can be
only used if we know that the text edit of a cell of a table shape is
not started or ended in-between.

The bugreport scenario was an active text edit, where setting attributes
on the shape ends the text edit:

#9 0x7f6dbb417121 in SdrEditView::EndTextEditAllViews() const 
/svx/source/svdraw/svdedtv.cxx:1079:20
#10 0x7f6dbb466798 in SdrEditView::SetAttrToMarked(SfxItemSet const&, 
bool) /svx/source/svdraw/svdedtv1.cxx:1095:9
#11 0x7f6dbc34b0af in 
sdr::table::SvxTableController::SetAttrToSelectedShape(SfxItemSet const&) 
/svx/source/table/tablecontroller.cxx:2738:12

Which also means that the underlying edit engine is deleted. But then
undo/redo would still reference that edit engine:

==31830==ERROR: AddressSanitizer: heap-use-after-free on address 
0x60c0001fc300 at pc 0x7f6dd73a9cb9 bp 0x7fff788db4b0 sp 0x7fff788db4a8
READ of size 8 at 0x60c0001fc300 thread T0
#0 0x7f6dd73a9cb8 in EditUndo::GetComment() const 
/editeng/source/editeng/editundo.cxx:147:34

Fix the problem by not grouping in case there is an active text edit,
that's not something I considered when I added the original grouping.

Change-Id: I4f3583e21a27f8380c35b3f4563ce496819bcb81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115049
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/uitest/table/tablecontroller.py 
b/svx/qa/uitest/table/tablecontroller.py
index afc5de807fde..607df44a3a4f 100644
--- a/svx/qa/uitest/table/tablecontroller.py
+++ b/svx/qa/uitest/table/tablecontroller.py
@@ -6,6 +6,7 @@
 
 from uitest.framework import UITestCase
 from uitest.uihelper.common import select_pos
+from libreoffice.uno.propertyvalue import mkPropertyValues
 
 
 # Test for SvxTableController.
@@ -42,4 +43,41 @@ class SvxTableControllerTest(UITestCase):
 # Close the document.
 self.ui_test.close_doc()
 
+def testUndoCrash(self):
+# Given an Impress document with a single table in it:
+self.ui_test.create_doc_in_start_center("impress")
+template = self.xUITest.getTopFocusWindow()
+self.ui_test.close_dialog_through_button(template.getChild("close"))
+self.xUITest.executeCommand(".uno:SelectAll")
+self.xUITest.executeCommand(".uno:Delete")
+
self.xUITest.executeCommand(".uno:InsertTable?Columns:short=3:short=3")
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# When enabling shadow on the shape while text edit is active:
+doc = self.xUITest.getTopFocusWindow()
+impress = doc.getChild("impress_win")
+impress.executeAction("TYPE", mkPropertyValues({"TEXT": "A1"}))
+for i in range(6):
+impress.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"CTRL+TAB"}))
+impress.executeAction("TYPE", mkPropertyValues({"TEXT": "A3"}))
+self.xUITest.executeCommand(".uno:SelectAll")
+self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+tableDialog = self.xUITest.getTopFocusWindow()
+tabs = tableDialog.getChild("tabcontrol")
+# Select "shadow".
+select_pos(tabs, "4")
+shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW")
+shadowCheckbox.executeAction("CLICK", tuple())
+self.ui_test.close_dialog_through_button(tableDialog.getChild("ok"))
+
+# Then make sure we don't crash:
+# Without the accompanying fix in place, this test would have failed 
crashed due to a
+# use-after-free: text edit ended but an undo action of the text edit 
remained on the undo
+# stack.
+for i in range(2):
+self.xUITest.executeCommand(".uno:Undo")
+
+# Close the document.
+self.ui_test.close_doc()
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/svx/source/table/tablecontroller.cxx 
b/svx/source/table/tablecontroller.cxx
index a81756c0ffdc..cab8570871dc 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -984,7 +984,7 @@ void SvxTableController::onFormatTable(const SfxRequest& 
rReq)
 // Create a single undo action when applying the result of the 
dialog.
 SdrTableObj& rTableObject(*mxTableObj);
 

[Libreoffice-commits] core.git: svx/qa

2021-04-06 Thread Xisco Fauli (via logerrit)
 svx/qa/unit/customshapes.cxx   |   15 +++
 svx/qa/unit/data/tdf141268.odp |binary
 2 files changed, 15 insertions(+)

New commits:
commit cb8b6503fb0c42e25faa75e110b05f69f4f62f59
Author: Xisco Fauli 
AuthorDate: Tue Apr 6 13:04:22 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Apr 6 16:23:50 2021 +0200

tdf#141268: svx_unit: Add unittest

Change-Id: Ie2f5bff44d8a113c3605fbe4311af5cbcfe009fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113658
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 4e3f76db74ec..830c0074c757 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -888,6 +888,21 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf122323_largeSwingAngle)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Start <> End", aStart, aEnd);
 }
 
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf141268)
+{
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf141268.odp";
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+uno::Reference xShape(getShape(0));
+SdrObjCustomShape& rSdrCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+
+// Check left/bottom of bound rect. Without fix it would be left=6722, 
bottom=9483.
+tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+CPPUNIT_ASSERT_EQUAL(tools::Long(7620), aBoundRect.Left());
+CPPUNIT_ASSERT_EQUAL(tools::Long(8585), aBoundRect.Bottom());
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176)
 {
 // Error was, that fObjectRotation was not correctly updated after 
shearing.
diff --git a/svx/qa/unit/data/tdf141268.odp b/svx/qa/unit/data/tdf141268.odp
new file mode 100644
index ..41d0dc4469f1
Binary files /dev/null and b/svx/qa/unit/data/tdf141268.odp differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa xmloff/source

2021-04-03 Thread Regina Henschel (via logerrit)
 dev/null   |binary
 svx/qa/unit/customshapes.cxx   |   18 --
 xmloff/source/draw/ximpcustomshape.cxx |9 -
 3 files changed, 27 deletions(-)

New commits:
commit f1b55d3f8e963069fc798bcf559ae9af2bf18b64
Author: Regina Henschel 
AuthorDate: Sat Apr 3 13:56:22 2021 +0200
Commit: Regina Henschel 
CommitDate: Sat Apr 3 18:15:12 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 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 811b4489569c..4e3f76db74ec 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -940,24 +940,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 xShape(getShape(0));
-SdrObjCustomShape& rSdrCustomShape(
-static_cast(*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..
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 15d296187348..ebaf15651950 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -1286,15 +1286,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


[Libreoffice-commits] core.git: svx/qa

2021-03-29 Thread Aditya Pratap Singh (via logerrit)
 svx/qa/unit/data/tdf60684.jpg |binary
 svx/qa/unit/xoutdev.cxx   |   28 
 2 files changed, 28 insertions(+)

New commits:
commit 869f3fa36e2c6306252cee43b244240d4024a242
Author: Aditya Pratap Singh 
AuthorDate: Wed Mar 24 14:32:18 2021 +0530
Commit: Xisco Fauli 
CommitDate: Mon Mar 29 21:56:49 2021 +0200

tdf#60684 Add unit test

Change-Id: I9fc633a9a7c977d869297237cdd8547ca0cd9d47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113037
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/data/tdf60684.jpg b/svx/qa/unit/data/tdf60684.jpg
new file mode 100644
index ..2218cdd72df0
Binary files /dev/null and b/svx/qa/unit/data/tdf60684.jpg differ
diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index 4e0cc5ff0b48..35eac21cda72 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -68,4 +68,32 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport)
 CPPUNIT_ASSERT_EQUAL(static_cast('-'), sFirstBytes[4]);
 }
 
+CPPUNIT_TEST_FIXTURE(XOutdevTest, testTdf60684)
+{
+Graphic aGraphic;
+test::Directories aDirectories;
+OUString aURL = 
aDirectories.getURLFromSrc(u"svx/qa/unit/data/tdf60684.jpg");
+SvFileStream aStream(aURL, StreamMode::READ);
+CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE,
+ 
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream));
+
+// Export it.
+utl::TempFile aTempFile;
+aTempFile.EnableKillingFile();
+XOutFlags const eFlags = XOutFlags::DontExpandFilename | 
XOutFlags::DontAddExtension
+ | XOutFlags::UseNativeIfPossible;
+OUString aTempURL = aTempFile.GetURL();
+XOutBitmap::WriteGraphic(aGraphic, aTempURL, "png", eFlags);
+
+SvStream* pStream = aTempFile.GetStream(StreamMode::READ);
+CPPUNIT_ASSERT(pStream->TellEnd() > 4);
+sal_uInt8 sFirstBytes[4];
+pStream->ReadBytes(sFirstBytes, 4);
+
+//Checks if the file's header matches a PNG's expected header
+CPPUNIT_ASSERT_EQUAL(static_cast('P'), sFirstBytes[1]);
+CPPUNIT_ASSERT_EQUAL(static_cast('N'), sFirstBytes[2]);
+CPPUNIT_ASSERT_EQUAL(static_cast('G'), sFirstBytes[3]);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa xmloff/source

2021-03-22 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx|   18 ++
 svx/qa/unit/data/tdf141127_defaultSkewAngle.odp |binary
 xmloff/source/draw/ximpcustomshape.cxx  |9 +
 3 files changed, 27 insertions(+)

New commits:
commit 2bf8c1e0e211601a70b6b28fdb92f636c7969513
Author: Regina Henschel 
AuthorDate: Sat Mar 20 20:05:19 2021 +0100
Commit: Regina Henschel 
CommitDate: Mon Mar 22 19:08:27 2021 +0100

tdf#141127 Use ODF default values for draw:extrusion-skew

The default value for extrusion skew angle is 45 in ODF and -135 in
binary MS Office. LO had used -135 in case the draw:extrusion-skew
attribute was missing on import. This could be fixed in GetSkew() in
EnhancedCustomShape3d.cxx#92. But that would break import of ppt files.
So I have decided not to search, were the binary import would need to
be tweaked, but I set the default values directly in file open in case
the attribute is missing.

Change-Id: Ieeffa64099fdbdbe0ba9d4dab7ed2f19d397a6e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112819
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 4e3f76db74ec..811b4489569c 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -940,6 +940,24 @@ 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 xShape(getShape(0));
+SdrObjCustomShape& rSdrCustomShape(
+static_cast(*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
new file mode 100644
index ..5cd0da96ec20
Binary files /dev/null and b/svx/qa/unit/data/tdf141127_defaultSkewAngle.odp 
differ
diff --git a/xmloff/source/draw/ximpcustomshape.cxx 
b/xmloff/source/draw/ximpcustomshape.cxx
index ebaf15651950..15d296187348 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -1286,6 +1286,15 @@ 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


[Libreoffice-commits] core.git: svx/qa svx/source

2021-03-11 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/xoutdev.cxx|   11 +++
 svx/source/inc/svdpdf.hxx  |7 +--
 svx/source/svdraw/svdedtv2.cxx |   14 --
 svx/source/svdraw/svdpdf.cxx   |8 
 4 files changed, 16 insertions(+), 24 deletions(-)

New commits:
commit c792cbf4f2d0d44279f273c4c6cba650601f1468
Author: Miklos Vajna 
AuthorDate: Wed Mar 10 21:18:45 2021 +0100
Commit: Miklos Vajna 
CommitDate: Thu Mar 11 11:29:08 2021 +0100

svx: rework to avoid pdfium ifdefs

Return early in case pdfium is not available, to avoid the ifdef forest.

Change-Id: If0e12f9dd937b308b6c3b121801269b2ce68ae60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112284
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index f422b5141705..4e0cc5ff0b48 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -7,8 +7,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include 
-
 #include 
 #include 
 #include 
@@ -22,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class XOutdevTest : public CppUnit::TestFixture
 {
@@ -35,7 +34,12 @@ public:
 
 CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport)
 {
-#if HAVE_FEATURE_PDFIUM
+auto pPdfium = vcl::pdf::PDFiumLibrary::get();
+if (!pPdfium)
+{
+return;
+}
+
 // Import the graphic.
 Graphic aGraphic;
 test::Directories aDirectories;
@@ -62,7 +66,6 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport)
 CPPUNIT_ASSERT_EQUAL(static_cast('D'), sFirstBytes[2]);
 CPPUNIT_ASSERT_EQUAL(static_cast('F'), sFirstBytes[3]);
 CPPUNIT_ASSERT_EQUAL(static_cast('-'), sFirstBytes[4]);
-#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/inc/svdpdf.hxx b/svx/source/inc/svdpdf.hxx
index 271eb1fd6dee..f8736a7bc891 100644
--- a/svx/source/inc/svdpdf.hxx
+++ b/svx/source/inc/svdpdf.hxx
@@ -20,9 +20,6 @@
 #ifndef INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX
 #define INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX
 
-#include 
-
-#if HAVE_FEATURE_PDFIUM
 #include 
 
 #include 
@@ -140,8 +137,6 @@ public:
 SvdProgressInfo* pProgrInfo = nullptr);
 };
 
-#endif // HAVE_FEATURE_PDFIUM
-
-#endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
+#endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 17ced3685bff..ef1a1c43e89b 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -2108,14 +2108,16 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo 
*pProgrInfo)
 
 if (pVectorGraphicData && pVectorGraphicData->getType() == 
VectorGraphicDataType::Pdf)
 {
-#if HAVE_FEATURE_PDFIUM
-aLogicRect = pGraf->GetLogicRect();
-ImpSdrPdfImport aFilter(*mpModel, pObj->GetLayer(), 
aLogicRect, aGraphic);
-if (aGraphic.getPageNumber() < aFilter.GetPageCount())
+auto pPdfium = vcl::pdf::PDFiumLibrary::get();
+if (pPdfium)
 {
-nInsCnt = aFilter.DoImport(*pOL, nInsPos, 
aGraphic.getPageNumber(), pProgrInfo);
+aLogicRect = pGraf->GetLogicRect();
+ImpSdrPdfImport aFilter(*mpModel, pObj->GetLayer(), 
aLogicRect, aGraphic);
+if (aGraphic.getPageNumber() < aFilter.GetPageCount())
+{
+nInsCnt = aFilter.DoImport(*pOL, nInsPos, 
aGraphic.getPageNumber(), pProgrInfo);
+}
 }
-#endif // HAVE_FEATURE_PDFIUM
 }
 else if (pGraf->HasGDIMetaFile() || 
pGraf->isEmbeddedVectorGraphicData() )
 {
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 75f079540935..714e90da7c52 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -19,12 +19,6 @@
 
 #include 
 
-#include 
-
-#if HAVE_FEATURE_PDFIUM
-#include 
-#include 
-
 #include 
 #include 
 #include 
@@ -1060,6 +1054,4 @@ tools::Rectangle ImpSdrPdfImport::PointsToLogic(double 
left, double right, doubl
 return tools::Rectangle(aPos, aSize);
 }
 
-#endif // HAVE_FEATURE_PDFIUM
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa sw/qa

2021-02-27 Thread Andrea Gelmini (via logerrit)
 svx/qa/unit/svdraw.cxx|2 +-
 sw/qa/extras/ww8export/ww8export3.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6da37b2cfd918f52da7f85e20211c9983d78711c
Author: Andrea Gelmini 
AuthorDate: Fri Feb 26 16:01:43 2021 +0100
Commit: Julien Nabet 
CommitDate: Sat Feb 27 20:54:50 2021 +0100

Fix typos

Change-Id: I4188e0bcc4089db3060179b7b1c085218fce92f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111649
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index bf452e62156a..95aaea7f659d 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -233,7 +233,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testTextEditEmptyGrabBag)
 rEditView.InsertText("y");
 pSdrView->SdrEndTextEdit();
 
-// Then make sure that grab-bag is empty to avoid loosing the new text.
+// Then make sure that grab-bag is empty to avoid losing the new text.
 xGroupProps->getPropertyValue("InteropGrabBag") >>= aGrabBag;
 // Without the accompanying fix in place, this test would have failed with:
 // assertion failed
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index b5b033468b02..b2afbce478de 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -82,7 +82,7 @@ DECLARE_WW8EXPORT_TEST(testTdf138345_paraCharHighlight, 
"tdf138345_paraCharHighl
 CPPUNIT_ASSERT_EQUAL(static_cast(COL_AUTO), 
getProperty(xRun, "CharHighlight"));
 CPPUNIT_ASSERT_EQUAL(static_cast(COL_AUTO), 
getProperty(xRun, "CharBackColor"));
 
-//tdf#118711 - don't explicity specify the default page style at the 
beginning of the document
+//tdf#118711 - don't explicitly specify the default page style at the 
beginning of the document
 uno::Reference xPara(getParagraph(1), 
uno::UNO_QUERY_THROW);
 CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName"));
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa svx/source

2021-02-12 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/unodraw.cxx |   33 +
 svx/source/unodraw/unoshtxt.cxx |   12 
 2 files changed, 33 insertions(+), 12 deletions(-)

New commits:
commit 043690eff82d5798774452a8364e1566b866a320
Author: Miklos Vajna 
AuthorDate: Fri Feb 12 17:22:57 2021 +0100
Commit: Miklos Vajna 
CommitDate: Fri Feb 12 20:17:35 2021 +0100

svx: fix import of multiple paragraphs into title shapes

Title shapes try hard to have a single paragraph only, the Impress UI
inserts linebreaks instead of paragraphs breaks in
sd::FuText::KeyInput(), ever since commit
f47a9d9db3d06927380bb79b04bb6d4721a92d2b (initial import, 2000-09-18).
This matches the PowerPoint behavior. This is most visible when the
paragraph has a bullet associated with it.

Interestingly you can still put multiple paragraphs into title shapes
using paste special -> plain text.

In that case, it was inconsistent that we exported these multiple
paragraphs to ODP, but merged them to a single paragraph on import since
commit 0a783c1a041e2b74b7bf238d11ee2c303f6708f4 (#100190# don't allow
more then one paragraph on title text objects, 2002-06-25).

This results in loosing your bullets on save + open, both in the ODP and
PPTX cases, since removeActionLock() on the XShape triggers this tweak.
Also, PowerPoint does not do this merging on import. So fix the problem
by removing the import-time tweak but leave the UI unchanged.

Change-Id: I6796f83c40e83f65cfb0f6c7e66069c3e08c1e2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110826
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx
index c0941034280e..21bb3200ba2c 100644
--- a/svx/qa/unit/unodraw.cxx
+++ b/svx/qa/unit/unodraw.cxx
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -175,6 +176,38 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testTableShadowDirect)
 // which has no shadow for cell text (only for cell borders and cell 
background).
 assertXPath(pDocument, "//shadow//sdrblocktext", /*nNumberOfNodes=*/0);
 }
+
+CPPUNIT_TEST_FIXTURE(UnodrawTest, testTitleShapeBullets)
+{
+// Create a title shape with 2 paragraphs in it.
+mxComponent = loadFromDesktop("private:factory/simpress",
+  
"com.sun.star.presentation.PresentationDocument");
+uno::Reference xSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPages = xSupplier->getDrawPages();
+uno::Reference xDrawPage(xDrawPages->getByIndex(0), 
uno::UNO_QUERY);
+// A default document contains a title shape and a text shape on the first 
slide.
+uno::Reference xTitleShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xTitleShapeInfo(xTitleShape, 
uno::UNO_QUERY);
+
CPPUNIT_ASSERT(xTitleShapeInfo->supportsService("com.sun.star.presentation.TitleTextShape"));
+uno::Reference xTitleShapeText(xTitleShape, 
uno::UNO_QUERY);
+uno::Reference xText = xTitleShapeText->getText();
+uno::Reference xCursor = xText->createTextCursor();
+xText->insertString(xCursor, "foo", /*bAbsorb=*/false);
+xText->insertControlCharacter(xCursor, 
text::ControlCharacter::APPEND_PARAGRAPH,
+  /*bAbsorb=*/false);
+xText->insertString(xCursor, "bar", /*bAbsorb=*/false);
+
+// Check that the title shape has 2 paragraphs.
+uno::Reference xTextEA(xText, 
uno::UNO_QUERY);
+uno::Reference xTextE = 
xTextEA->createEnumeration();
+// Has a first paragraph.
+CPPUNIT_ASSERT(xTextE->hasMoreElements());
+xTextE->nextElement();
+// Has a second paragraph.
+// Without the accompanying fix in place, this test would have failed, 
because the 2 paragraphs
+// were merged together (e.g. 1 bullet instead of 2 bullets for bulleted 
paragraphs).
+CPPUNIT_ASSERT(xTextE->hasMoreElements());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 7f2a8af49606..39cad52c073b 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -780,18 +780,6 @@ void SvxTextEditSourceImpl::UpdateData()
 {
 if( mpOutliner->GetParagraphCount() != 1 || 
mpOutliner->GetEditEngine().GetTextLen( 0 ) )
 {
-if( mpOutliner->GetParagraphCount() > 1 )
-{
-if (pTextObj->IsTextFrame() && pTextObj->GetTextKind() 
== OBJ_TITLETEXT)
-{
-while( mpOutliner->GetParagraphCount() > 1 )
-{
-ESelection aSel( 
0,mpOutliner->GetEditEngine().GetTextLen( 0 ), 1,0 );
-mpOutliner->QuickInsertLineBreak( aSel );
-}
-

[Libreoffice-commits] core.git: svx/qa svx/source

2021-01-06 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/0-width-text-wrap.pptx  |binary
 svx/qa/unit/sdr.cxx  |   51 ++-
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |   28 +-
 3 files changed, 66 insertions(+), 13 deletions(-)

New commits:
commit 65e2ef43f186164729e1cc071b805bc1a7125cfe
Author: Miklos Vajna 
AuthorDate: Wed Jan 6 10:23:44 2021 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 6 12:23:59 2021 +0100

tdf#134288 svx: fix rendering of text on a zero-width shape

We have conflicting requirements here: on one hand, the shape is zero
width, so the text area is also zero.  On the other hand, we put some
text on the shape, which should be visible.

The result was that the left/right text margin (2x250 mm100) was counted
as part of the text area, so we put a few (but not 1) characters / line
for zero width. Fix this to be PowerPoint-compatible: as the width
decreases, we break the text up to more and more lines, but if the width
is 0, then we don't break it up at all.

An alternative would be to do this later in
SdrTextObj::impDecomposeBlockTextPrimitive(), but there we no longer
know the width is really 0, because the text margins and some small
increase (+1 to be an inclusive range, +1 to have a non-zero scale) is
already added to the original width.

Change-Id: Ieaa3e726bc5d37983b6221452e14f01db315f790
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108835
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/data/0-width-text-wrap.pptx 
b/svx/qa/unit/data/0-width-text-wrap.pptx
new file mode 100644
index ..17349924d89b
Binary files /dev/null and b/svx/qa/unit/data/0-width-text-wrap.pptx differ
diff --git a/svx/qa/unit/sdr.cxx b/svx/qa/unit/sdr.cxx
index 49f4baa7182c..f6eb74488797 100644
--- a/svx/qa/unit/sdr.cxx
+++ b/svx/qa/unit/sdr.cxx
@@ -51,19 +51,14 @@ public:
 test::BootstrapFixture::tearDown();
 }
 uno::Reference& getComponent() { return mxComponent; }
+
+drawinglayer::primitive2d::Primitive2DContainer
+renderPageToPrimitives(const uno::Reference& 
xDrawPage);
 };
 
-CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin)
+drawinglayer::primitive2d::Primitive2DContainer
+SdrTest::renderPageToPrimitives(const uno::Reference& 
xDrawPage)
 {
-// Load a document containing a custom shape.
-test::Directories aDirectories;
-OUString aURL = 
aDirectories.getURLFromSrc(u"svx/qa/unit/data/shadow-scale-origin.pptx");
-getComponent() = loadFromDesktop(aURL);
-uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
-uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
- uno::UNO_QUERY);
-
-// Render it.
 auto pDrawPage = dynamic_cast(xDrawPage.get());
 CPPUNIT_ASSERT(pDrawPage);
 SdrPage* pSdrPage = pDrawPage->GetSdrPage();
@@ -73,8 +68,20 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin)
 const sdr::contact::ViewObjectContact& rDrawPageVOContact
 = pSdrPage->GetViewContact().GetViewObjectContact(aObjectContact);
 sdr::contact::DisplayInfo aDisplayInfo;
+return rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo);
+}
+
+CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin)
+{
+// Load a document containing a custom shape.
+test::Directories aDirectories;
+OUString aURL = 
aDirectories.getURLFromSrc(u"svx/qa/unit/data/shadow-scale-origin.pptx");
+getComponent() = loadFromDesktop(aURL);
+uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
 drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
-= rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo);
+= renderPageToPrimitives(xDrawPage);
 
 // Examine the created primitives.
 drawinglayer::Primitive2dXmlDump aDumper;
@@ -89,6 +96,28 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin)
 CPPUNIT_ASSERT_EQUAL(-705., std::round(fShadowX));
 CPPUNIT_ASSERT_EQUAL(-685., std::round(fShadowY));
 }
+
+CPPUNIT_TEST_FIXTURE(SdrTest, testZeroWidthTextWrap)
+{
+// Load a document containing a 0-width shape with text.
+test::Directories aDirectories;
+OUString aURL = 
aDirectories.getURLFromSrc(u"svx/qa/unit/data/0-width-text-wrap.pptx");
+getComponent() = loadFromDesktop(aURL);
+uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
+= renderPageToPrimitives(xDrawPage);
+
+// Examine the created primitives.
+

[Libreoffice-commits] core.git: svx/qa svx/source

2020-12-16 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   82 ++
 svx/qa/unit/data/tdf138945_resizeRotatedShape.odg |binary
 svx/source/svdraw/svdoashp.cxx|   24 ++
 3 files changed, 106 insertions(+)

New commits:
commit d4ca360f6632f03e9fb7e9af37aac40d23f1249a
Author: Regina Henschel 
AuthorDate: Tue Dec 15 20:20:55 2020 +0100
Commit: Regina Henschel 
CommitDate: Wed Dec 16 13:59:14 2020 +0100

tdf#138945 update fObjectRotation for NbcResize

SdrObjCustomShape::NbcResize uses the inherited SdrTextObj::NbcResize.
But a SdrTextObj does not know fObjectRotation. Explicit update to new
rotation angle after resize is needed.
The error became visible, if you changed width or height of a rotated
or sheared custom shape in the Position dialog. Then the shape
handles were not on the shape outline.

Change-Id: Idbe47a3b1ef2b34e9645d62830cb330f2e49bd3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107792
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 737ab5bdf6d0..e3a5e0ac92a3 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -90,6 +90,88 @@ sal_uInt8 CustomshapesTest::countShapes()
 return xDrawPage->getCount();
 }
 
+void lcl_AssertRectEqualWithTolerance(const OString& sInfo, const 
tools::Rectangle& rExpected,
+  const tools::Rectangle& rActual, const 
sal_Int32 nTolerance)
+{
+// Left
+OString sMsg = sInfo + " Left expected " + 
OString::number(rExpected.Left()) + " actual "
+   + OString::number(rActual.Left()) + " Tolerance " + 
OString::number(nTolerance);
+CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(),
+   std::abs(rExpected.Left() - rActual.Left()) <= 
nTolerance);
+
+// Top
+sMsg = sInfo + " Top expected " + OString::number(rExpected.Top()) + " 
actual "
+   + OString::number(rActual.Top()) + " Tolerance " + 
OString::number(nTolerance);
+CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), std::abs(rExpected.Top() - 
rActual.Top()) <= nTolerance);
+
+// Width
+sMsg = sInfo + " Width expected " + OString::number(rExpected.GetWidth()) 
+ " actual "
+   + OString::number(rActual.GetWidth()) + " Tolerance " + 
OString::number(nTolerance);
+CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(),
+   std::abs(rExpected.GetWidth() - rActual.GetWidth()) 
<= nTolerance);
+
+// Height
+sMsg = sInfo + " Height expected " + 
OString::number(rExpected.GetHeight()) + " actual "
+   + OString::number(rActual.GetHeight()) + " Tolerance " + 
OString::number(nTolerance);
+CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(),
+   std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
+}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testResizeRotatedShape)
+{
+// tdf#138945 Setting width or height for a rotated or sheared shape in 
the Position dialog
+// had resulted in a mismatch of handle position and shape outline. That 
becomes visible in object
+// properties as mismatch of frame rectangle and bound rectangle.
+// Problem was, that fObjectRotation was not updated.
+
+// Load document and get shape. It is a rectangle custom shape with 45° 
shear and 330° rotation.
+OUString aURL
+= m_directories.getURLFromSrc(sDataDirectory) + 
"tdf138945_resizeRotatedShape.odg";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+uno::Reference xShape(getShape(0));
+
+// Change height and mirror vertical
+{
+SdrObjCustomShape& rSdrShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+rSdrShape.NbcResize(rSdrShape.GetRelativePos(), Fraction(1.0), 
Fraction(-0.5));
+tools::Rectangle aSnapRect(rSdrShape.GetSnapRect());
+tools::Rectangle aBoundRect(rSdrShape.GetCurrentBoundRect());
+lcl_AssertRectEqualWithTolerance("height changed, mirror vert", 
aSnapRect, aBoundRect, 3);
+}
+
+// Change height
+{
+SdrObjCustomShape& rSdrShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+rSdrShape.NbcResize(rSdrShape.GetRelativePos(), Fraction(1.0), 
Fraction(2.0));
+tools::Rectangle aSnapRect(rSdrShape.GetSnapRect());
+tools::Rectangle aBoundRect(rSdrShape.GetCurrentBoundRect());
+lcl_AssertRectEqualWithTolerance("height changed", aSnapRect, 
aBoundRect, 3);
+}
+
+// Change width
+{
+SdrObjCustomShape& rSdrShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+rSdrShape.NbcResize(rSdrShape.GetRelativePos(), Fraction(2.0), 
Fraction(1.0));
+tools::Rectangle aSnapRect(rSdrShape.GetSnapRect());
+tools::Rectangle 

[Libreoffice-commits] core.git: svx/qa svx/source

2020-12-01 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/unodraw.cxx|   26 ++
 svx/source/unodraw/unoprov.cxx |1 +
 2 files changed, 27 insertions(+)

New commits:
commit 55d4c6cfe5bd9b737698c6cd1f28ee8234abb5d0
Author: Miklos Vajna 
AuthorDate: Tue Dec 1 15:16:13 2020 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 1 20:25:00 2020 +0100

tdf#129961 svx: add UNO API for table shadow as direct format

Adding it via a style was working already.

Change-Id: I122c359716a404159d3521d63d44ef8bfe35c214
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106987
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx
index a835dee951bd..51b1c8b43847 100644
--- a/svx/qa/unit/unodraw.cxx
+++ b/svx/qa/unit/unodraw.cxx
@@ -107,6 +107,32 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testTdf93998)
 xModelProps->getPropertyValue("Graphic") >>= xGraphic;
 CPPUNIT_ASSERT(xGraphic.is());
 }
+
+CPPUNIT_TEST_FIXTURE(UnodrawTest, testTableShadowDirect)
+{
+// Create an Impress document an insert a table shape.
+mxComponent = loadFromDesktop("private:factory/simpress",
+  
"com.sun.star.presentation.PresentationDocument");
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xShape(
+xFactory->createInstance("com.sun.star.drawing.TableShape"), 
uno::UNO_QUERY);
+xShape->setPosition(awt::Point(1000, 1000));
+xShape->setSize(awt::Size(1, 1));
+uno::Reference xSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPages = xSupplier->getDrawPages();
+uno::Reference xDrawPage(xDrawPages->getByIndex(0), 
uno::UNO_QUERY);
+xDrawPage->add(xShape);
+
+// Create a red shadow on it without touching its style.
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+// Without the accompanying fix in place, this test would have failed with 
throwing a
+// beans.UnknownPropertyException, as shadow-as-direct-formatting on 
tables were not possible.
+xShapeProps->setPropertyValue("Shadow", uno::makeAny(true));
+sal_Int32 nRed = 0xff;
+xShapeProps->setPropertyValue("ShadowColor", uno::makeAny(nRed));
+CPPUNIT_ASSERT(xShapeProps->getPropertyValue("ShadowColor") >>= nRed);
+CPPUNIT_ASSERT_EQUAL(static_cast(0xff), nRed);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 9b4cb8e43a53..f51cfa2cee73 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -739,6 +739,7 @@ static SfxItemPropertyMapEntry const * 
ImplGetSvxTableShapePropertyMap()
 {
 static SfxItemPropertyMapEntry const  aTableShapePropertyMap_Impl[] =
 {
+SHADOW_PROPERTIES
 { u"" UNO_NAME_MISC_OBJ_ZORDER,   OWN_ATTR_ZORDER, 
cppu::UnoType::get(), 0, 0},
 { u"" UNO_NAME_MISC_OBJ_LAYERID,  SDRATTR_LAYERID, 
cppu::UnoType::get(), 0,0},
 { u"" UNO_NAME_MISC_OBJ_LAYERNAME,SDRATTR_LAYERNAME, 
cppu::UnoType::get(), 0, 0},
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa

2020-10-20 Thread Xisco Fauli (via logerrit)
 svx/qa/unit/customshapes.cxx |   35 +++
 1 file changed, 19 insertions(+), 16 deletions(-)

New commits:
commit 82b1bcf7d23d3795347fb45c09ea3c836c246bd3
Author: Xisco Fauli 
AuthorDate: Tue Oct 20 12:21:24 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 20 17:53:18 2020 +0200

CppunitTest_svx_unit: directly use asserts here

if it failed, it wouldn't be clear why

Change-Id: Ib96674a2d243bea946abff429a267c3ce4fc64f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104559
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index e42c7ad2fde9..763135208c92 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -514,25 +514,30 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf126060_3D_Z_Rotation)
 OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf126060_3D_Z_Rotation.pptx";
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
 CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
-OUString sErrors; // sErrors collects the errors and should be empty in 
case all is OK.
 
 uno::Reference xShape(getShape(0));
 SdrObjCustomShape& rSdrObjCustomShape(
 static_cast(*GetSdrObjectFromXShape(xShape)));
 
-if (rSdrObjCustomShape.GetCameraZRotation() != 90)
-sErrors += "Wrong text camera Z rotation";
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong text camera Z rotation", 90.0,
+ rSdrObjCustomShape.GetCameraZRotation());
 
 basegfx::B2DHomMatrix aObjectTransform;
 basegfx::B2DPolyPolygon aObjectPolyPolygon;
 rSdrObjCustomShape.TRGetBaseGeometry(aObjectTransform, aObjectPolyPolygon);
 
-if (aObjectTransform.get(0, 0) != 1492 || aObjectTransform.get(0, 1) != 0
-|| aObjectTransform.get(0, 2) != 1129 || aObjectTransform.get(1, 0) != 0
-|| aObjectTransform.get(1, 1) != 2500 || aObjectTransform.get(1, 2) != 
5846)
-sErrors += " Wrong transformation matrix";
-
-CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 0,0 position", 
1492.0,
+ aObjectTransform.get(0, 0));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 0,1 position", 0.0,
+ aObjectTransform.get(0, 1));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 0,2 position", 
1129.0,
+ aObjectTransform.get(0, 2));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 1,0 position", 0.0,
+ aObjectTransform.get(1, 0));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 1,1 position", 
2500.0,
+ aObjectTransform.get(1, 1));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 1,2 position", 
5846.0,
+ aObjectTransform.get(1, 2));
 }
 
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Asymmetric)
@@ -621,13 +626,11 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf128413_tbrlOnOff)
 
 awt::Rectangle aObservedRect;
 xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= 
aObservedRect;
-OUString sError;
-if (aOrigRect.Width != aObservedRect.Width || aOrigRect.Height != 
aObservedRect.Height
-|| aOrigRect.X != aObservedRect.X || aOrigRect.Y != aObservedRect.Y)
-{
-sError = "Shape has wrong size or wrong position.";
-}
-CPPUNIT_ASSERT_EQUAL(OUString(), sError);
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape has wrong width", aOrigRect.Width, 
aObservedRect.Width);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape has wrong height", aOrigRect.Height, 
aObservedRect.Height);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape has wrong X position", aOrigRect.X, 
aObservedRect.X);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape has wrong Y position", aOrigRect.Y, 
aObservedRect.Y);
 }
 
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf129532_MatrixFlipV)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa svx/source

2020-09-23 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   57 ++
 svx/qa/unit/data/tdf136176_rot30_flip.odg |binary
 svx/source/svdraw/svdoashp.cxx|   25 -
 3 files changed, 73 insertions(+), 9 deletions(-)

New commits:
commit 3b4198d4654e4cf569f9b82d87a2498dbbecb9ac
Author: Regina Henschel 
AuthorDate: Wed Sep 23 19:02:30 2020 +0200
Commit: Regina Henschel 
CommitDate: Wed Sep 23 20:21:03 2020 +0200

tdf#136176 Correct update fObjectRotation in NbcShear

Change-Id: I4a73a720845436d25fc1a02eb615dad47f17f96d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103269
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index e500c9bd2649..10abdad0f7e3 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -12,10 +12,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -24,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -749,6 +754,58 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf122323_largeSwingAngle)
 const basegfx::B2DPoint aEnd(aPolygon.getB2DPoint(aPolygon.count() - 2));
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Start <> End", aStart, aEnd);
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176)
+{
+// Error was, that fObjectRotation was not correctly updated after 
shearing.
+// The problem becomes visible after save and reload.
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf136176_rot30_flip.odg";
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+
+for (sal_uInt16 i = 0; i < 3; i++)
+{
+// get shape
+uno::Reference xShape(getShape(i));
+SdrObjCustomShape& rSdrObjCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+// apply shearing 20deg
+const Point aCenter = rSdrObjCustomShape.GetSnapRect().Center();
+rSdrObjCustomShape.Shear(aCenter, 2000, tan(basegfx::deg2rad(20.0)), 
false);
+}
+
+// Save and reload
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+utl::TempFile aTempFile;
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("draw8");
+xStorable->storeToURL(aTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
+mxComponent->dispose();
+mxComponent = loadFromDesktop(aTempFile.GetURL());
+
+// Expected values of point 4 of the shape polygon
+const OString sTestCase[] = { "FlipH", "FlipV", "FlipHV" };
+const double fX[] = { 14981.0, 3849.0, 15214.0 };
+const double fY[] = { 9366.0, 16464.0, 23463.0 };
+
+// Verify correct positions
+for (sal_uInt16 i = 0; i < 3; i++)
+{
+// Get shape
+const uno::Reference xShape(getShape(i));
+const SdrObjCustomShape& rSdrObjCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+// Create polygon from shape and examine point 4 of the polygon
+const basegfx::B2DPolyPolygon aLineGeometry = 
rSdrObjCustomShape.GetLineGeometry(false);
+const basegfx::B2DPoint 
aPoint(aLineGeometry.getB2DPolygon(0).getB2DPoint(4));
+// Allow some tolerance for rounding errors
+if (fabs(aPoint.getX() - fX[i]) > 2.0 || fabs(aPoint.getY() - fY[i]) > 
2.0)
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sTestCase[i].getStr(), aPoint,
+ basegfx::B2DPoint(fX[i], fY[i]));
+}
+}
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf136176_rot30_flip.odg 
b/svx/qa/unit/data/tdf136176_rot30_flip.odg
new file mode 100644
index ..75707a0f5ecb
Binary files /dev/null and b/svx/qa/unit/data/tdf136176_rot30_flip.odg differ
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 662ab4a06797..3e7391d8123c 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1649,22 +1649,29 @@ void SdrObjCustomShape::NbcShear( const Point& rRef, 
long nAngle, double tn, boo
 // updating fObjectRotation
 long nTextObjRotation = aGeo.nRotationAngle;
 double fAngle = nTextObjRotation;
-
 fAngle /= 100.0;
-
-bool bSingleFlip = (IsMirroredX()!= IsMirroredY());
-
-fObjectRotation = fmod( bSingleFlip ? -fAngle : fAngle, 360.0 );
-
-if ( fObjectRotation < 0 )
+if (IsMirroredX())
 {
-fObjectRotation = 360.0 + fObjectRotation;
+if (IsMirroredY())
+fObjectRotation = fAngle - 180.0;
+else
+fObjectRotation = -fAngle;
 }
+else
+{
+if (IsMirroredY())
+fObjectRotation = 180.0 - fAngle;
+else
+fObjectRotation = 

[Libreoffice-commits] core.git: svx/qa

2020-08-03 Thread Rene Engelhard (via logerrit)
 svx/qa/unit/XTableImportExportTest.cxx |1 +
 svx/qa/unit/xoutdev.cxx|1 +
 2 files changed, 2 insertions(+)

New commits:
commit 456d61ec526e250fd1af894e109d5914ac9c9e6e
Author: Rene Engelhard 
AuthorDate: Sun Aug 2 20:10:41 2020 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 3 09:37:30 2020 +0200

fix build with (system-)cppunit 1.14.0

by #include  so that CPPUNIT_TEST_FIXTURE
is defined

Change-Id: Iacbfb2f513df6e7eb7ca04f7900cd4e6b3fd69c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99963
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/XTableImportExportTest.cxx 
b/svx/qa/unit/XTableImportExportTest.cxx
index 9356f2691323..31962a52be52 100644
--- a/svx/qa/unit/XTableImportExportTest.cxx
+++ b/svx/qa/unit/XTableImportExportTest.cxx
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index 4b767ca1481e..0b5148b393d5 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa svx/source

2020-06-14 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx|   53 +++
 svx/qa/unit/data/tdf103474_commandG_CaseZeroHeight.odp  |binary
 svx/qa/unit/data/tdf122323_swingAngle_larger360deg.pptx |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx   |  112 +---
 4 files changed, 120 insertions(+), 45 deletions(-)

New commits:
commit 6de8d3109dffa7d4d0cc06f319cca70134f0a8f3
Author: Regina Henschel 
AuthorDate: Wed Jun 10 20:58:54 2020 +0200
Commit: Regina Henschel 
CommitDate: Sun Jun 14 16:06:54 2020 +0200

tdf#103474 handle edge cases in ARCANGLETO

The arc-polygon generation in tools does not consider edge cases with
zero height or width. That leads to wrong rendering in some ooxml
shapes, when the handle is dragged to its extrem position, e.g. in
left/right braces/bracket and can.

I have switched from tools to basegfx in case ARCANGLETO and added
handling for edge cases. Switching to basegfx has the additional
advantage, that Bezier curves are used and not polylines. You see
the difference, if you convert the shape to curve.
ARCANGLETO is not used from our shapes or from import from binary
MS Office, but only from OOXML or user-defined custom shapes.

tdf#122323 MS Office restricts the swing angle to [-360°,360] in
rendering. Such restriction is not in OOXML and not in ODF.
Nevertheless, I have added a clamp for ooxml-foo shapes for better
interoperability.

Change-Id: Ib3233ce14dab950cc521cb8cbac6809a1d3e34a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96068
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 53826369612b..79cd6de65410 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -696,6 +696,59 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf103474_commandT_CaseZeroHeight)
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aStart y-coordinate", .0, 
aStart.getY(), 1.0);
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aEnd y-coordinate", 1999.0, 
aEnd.getY(), 1.0);
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf103474_commandG_CaseZeroHeight)
+{
+// Some as above, but with shape with command G.
+OUString sURL
+= m_directories.getURLFromSrc(sDataDirectory) + 
"tdf103474_commandG_CaseZeroHeight.odp";
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+uno::Reference xShape(getShape(0));
+// The end points of the straight line segment should have the same 
x-coordinate of left
+// of shape, and different y-coordinates, one top and the other bottom of 
the shape.
+SdrObjCustomShape& rSdrObjCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+SdrPathObj* pPathObj = 
static_cast(aCustomShape2d.CreateLineGeometry());
+CPPUNIT_ASSERT_MESSAGE("Could not convert to SdrPathObj", pPathObj);
+const basegfx::B2DPolyPolygon aPolyPolygon(pPathObj->GetPathPoly());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast(1),
+ aPolyPolygon.count());
+const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
+// Get the middle points of the polygon. They are the endpoints of the
+// straight line segment regardless of the quarter ellipse parts, because
+// the shape is symmetric.
+const basegfx::B2DPoint aStart(aPolygon.getB2DPoint(aPolygon.count() / 2 - 
1));
+const basegfx::B2DPoint aEnd(aPolygon.getB2DPoint(aPolygon.count() / 2));
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aStart x-coordinate", 1999.0, 
aStart.getX(), 1.0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aEnd x-coordinate", 1999.0, 
aEnd.getX(), 1.0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aStart y-coordinate", .0, 
aStart.getY(), 1.0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aEnd y-coordinate", 1999.0, 
aEnd.getY(), 1.0);
+}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf122323_largeSwingAngle)
+{
+// SwingAngles are clamped to [-360;360] in MS Office. Error was, that LO 
calculated
+// the end angle and used it modulo 360, no full ellipse was drawn.
+OUString sURL
+= m_directories.getURLFromSrc(sDataDirectory) + 
"tdf122323_swingAngle_larger360deg.pptx";
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+uno::Reference xShape(getShape(0));
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+SdrObjCustomShape& rSdrObjCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+SdrPathObj* pPathObj = 
static_cast(aCustomShape2d.CreateLineGeometry());
+

[Libreoffice-commits] core.git: svx/qa

2020-06-08 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/customshapes.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit eda8be919201972680d2d82a90cccaca8c3f6248
Author: Miklos Vajna 
AuthorDate: Mon Jun 8 15:11:45 2020 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jun 8 17:20:37 2020 +0200

svx: fix loplugin:elidestringvar warning

Change-Id: I5424388dfc37988b2f4e5f8f34dcb1a577d9bfb6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95806
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 3a422fce3687..91ae38cfeff0 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -670,8 +670,8 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf103474_commandT_CaseZeroHeight)
 // corner case where the ellipse has zero height.
 // Error was, that the calculation of the circle angle from the ellipse
 // angle results in a wrong angle for the case 180° and height zero.
-const OUString sFileName("tdf103474_commandT_CaseZeroHeight.odp");
-OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+OUString sURL
+= m_directories.getURLFromSrc(sDataDirectory) + 
"tdf103474_commandT_CaseZeroHeight.odp";
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.presentation.PresentationDocument");
 CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
 uno::Reference xShape(getShape(0));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa svx/source

2020-06-08 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx   |   33 +
 svx/qa/unit/data/tdf103474_commandT_CaseZeroHeight.odp |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx  |2 +
 3 files changed, 35 insertions(+)

New commits:
commit 91f06123298bb8870cd6fa4e19d3aea9909f8e5b
Author: Regina Henschel 
AuthorDate: Sun Jun 7 23:54:20 2020 +0200
Commit: Regina Henschel 
CommitDate: Mon Jun 8 13:36:06 2020 +0200

tdf#103474 handle quarter angles before using atan2

sin(basegfx::deg2rad(fEAngleDeg)) does not result in 0 for
fEAngleDeg=180 because of rounding errors and therefore
atan2 later in the code gives wrong angle.
Because the corresponding circle angle is the same as the ellipse
angle for 0°, 90°, 180° and 270°, these angles are now handled
before using atan2.

Change-Id: Iae2a4d188b837ff787f2af4d79f874ba21c9aa2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95772
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index ce2f06c42bfe..3a422fce3687 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -663,6 +663,39 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf129532_MatrixFlipV)
 }
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf103474_commandT_CaseZeroHeight)
+{
+// tdf103474 custom shape with command T to create quater ellipses in a 
bracket,
+// corner case where the ellipse has zero height.
+// Error was, that the calculation of the circle angle from the ellipse
+// angle results in a wrong angle for the case 180° and height zero.
+const OUString sFileName("tdf103474_commandT_CaseZeroHeight.odp");
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.presentation.PresentationDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+uno::Reference xShape(getShape(0));
+// The end points of the straight line segment should have the same 
x-coordinate of left
+// of shape, and different y-coordinates, one top and the other bottom of 
the shape.
+SdrObjCustomShape& rSdrObjCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+SdrPathObj* pPathObj = 
static_cast(aCustomShape2d.CreateLineGeometry());
+CPPUNIT_ASSERT_MESSAGE("Could not convert to SdrPathObj", pPathObj);
+const basegfx::B2DPolyPolygon aPolyPolygon(pPathObj->GetPathPoly());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast(1),
+ aPolyPolygon.count());
+const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
+// Get the middle points of the polygon. They are the endpoints of the
+// straight line segment regardless of the quarter ellipse parts, because
+// the shape is symmetric.
+const basegfx::B2DPoint aStart(aPolygon.getB2DPoint(aPolygon.count() / 2 - 
1));
+const basegfx::B2DPoint aEnd(aPolygon.getB2DPoint(aPolygon.count() / 2));
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aStart x-coordinate", 13999.0, 
aStart.getX(), 1.0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aEnd x-coordinate", 13999.0, 
aEnd.getX(), 1.0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aStart y-coordinate", .0, 
aStart.getY(), 1.0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("aEnd y-coordinate", 1999.0, 
aEnd.getY(), 1.0);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf103474_commandT_CaseZeroHeight.odp 
b/svx/qa/unit/data/tdf103474_commandT_CaseZeroHeight.odp
new file mode 100644
index ..54a4377cab8f
Binary files /dev/null and 
b/svx/qa/unit/data/tdf103474_commandT_CaseZeroHeight.odp differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 7bf8383ab8f6..8b570edd809e 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1997,6 +1997,8 @@ static double lcl_getNormalizedCircleAngleRad(const 
double fWR, const double fHR
 double fEAngleDeg(fmod(fEllipseAngleDeg, 360.0));
 if (fEAngleDeg < 0.0)
 fEAngleDeg += 360.0;
+if (fEAngleDeg == 0.0 || fEAngleDeg == 90.0 || fEAngleDeg == 180.0 || 
fEAngleDeg == 270.0)
+return basegfx::deg2rad(fEAngleDeg);
 const double fX(fHR * cos(basegfx::deg2rad(fEAngleDeg)));
 const double fY(fWR * sin(basegfx::deg2rad(fEAngleDeg)));
 if (fX != 0.0 || fY != 0.0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa svx/source

2020-06-05 Thread Stephan Bergmann (via logerrit)
 svx/qa/unit/classicshapes.cxx |7 +-
 svx/qa/unit/customshapes.cxx  |   56 +-
 svx/source/core/graphichelper.cxx |3 -
 svx/source/dialog/SafeModeDialog.cxx  |3 -
 svx/source/form/fmshimp.cxx   |3 -
 svx/source/form/fmsrcimp.cxx  |6 --
 svx/source/form/navigatortree.cxx |6 --
 svx/source/form/tbxform.cxx   |3 -
 svx/source/gallery2/galobj.cxx|5 -
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx |3 -
 svx/source/svdraw/svdedtv1.cxx|3 -
 svx/source/svdraw/svdedxv.cxx |8 +--
 svx/source/svdraw/svdoashp.cxx|   55 +++--
 svx/source/svdraw/svdpntv.cxx |3 -
 svx/source/table/svdotable.cxx|3 -
 svx/source/table/tablecontroller.cxx  |3 -
 svx/source/tbxctrls/extrusioncontrols.cxx |4 -
 svx/source/tbxctrls/fillctrl.cxx  |3 -
 svx/source/unodraw/unoshap2.cxx   |3 -
 svx/source/xml/xmlxtexp.cxx   |3 -
 20 files changed, 67 insertions(+), 116 deletions(-)

New commits:
commit 017862727a19f419313eead325f1dbc2936088ed
Author: Stephan Bergmann 
AuthorDate: Fri Jun 5 10:18:21 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 5 11:59:17 2020 +0200

Upcoming loplugin:elidestringvar: svx

Change-Id: Ia7b4f69361b6cc29f6e5c0093b13cf0b48e25ba3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95576
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx
index b03210d12c20..3e519418ed84 100644
--- a/svx/qa/unit/classicshapes.cxx
+++ b/svx/qa/unit/classicshapes.cxx
@@ -73,8 +73,7 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, 
testTdf98584ShearVertical)
 // They are converted to rotate * shear horizontal * scale.
 // Besides using a wrong sign in shear angle, error was, that 
TRSetGeometry of SdrPathObj did
 // not consider the additional scaling (tdf#98565).
-const OUString sFileName("tdf98584_ShearVertical.odg");
-const OUString sURL(m_directories.getURLFromSrc(sDataDirectory) + 
sFileName);
+const OUString sURL(m_directories.getURLFromSrc(sDataDirectory) + 
"tdf98584_ShearVertical.odg");
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
 CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
 
@@ -149,8 +148,8 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, 
testTdf98583ShearHorizontal)
 // LT 8000,5000 and RB 14000, 9000, which means width 6001, height 4001.
 // Error was, that not the mathematical matrix was used, but the API 
matrix, which has
 // wrong sign in shear angle.
-const OUString sFileName("tdf98583_ShearHorizontal.odp");
-const OUString sURL(m_directories.getURLFromSrc(sDataDirectory) + 
sFileName);
+const OUString sURL(m_directories.getURLFromSrc(sDataDirectory)
++ "tdf98583_ShearHorizontal.odp");
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.presentation.PresentationDocument");
 CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
 
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index a21652113ef8..ce2f06c42bfe 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -183,8 +183,8 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testWidthOrientationCommandU)
 // tdf121845 custom shape with command U (angleellipse) is  wrongly drawn
 // Load a document with path "M 750 0 L 750 500 250 500 250 0 U 500 0 500 
500 0 180 N"
 // in viewBox="0 0 1000 500" and width="10cm", height="5cm".
-const OUString sFileName("tdf121845_WidthOrientation_command_U.odg");
-const OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
sFileName;
+const OUString sURL
+= m_directories.getURLFromSrc(sDataDirectory) + 
"tdf121845_WidthOrientation_command_U.odg";
 mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
 CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
 // Error was, that the width and height of the ellipse was halved and that 
the ellipse
@@ -207,8 +207,8 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testHalfEllipseVML)
 // tdf121845 custom shape with command U (angleellipse) is  wrongly drawn
 // Load a document which was converted from VML to doc by Word. It had a 
VML
 // path="m750,al500,,500,500,,-11796480e" resulting in a lower half circle.
-const OUString sFileName("tdf121845_HalfEllipseVML.doc");
-const OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
sFileName;
+const OUString sURL
+= m_directories.getURLFromSrc(sDataDirectory) + 

[Libreoffice-commits] core.git: svx/qa

2020-06-02 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit 76e6c5f4a98b6da9b0d7945dd87f7476d90aebbc
Author: Andrea Gelmini 
AuthorDate: Tue Jun 2 14:54:33 2020 +0200
Commit: Julien Nabet 
CommitDate: Tue Jun 2 17:51:28 2020 +0200

Removed executable permission on graphic files

Change-Id: I47099bd08e73ef726be60b740c4b72220cb7fc6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95362
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/gallery/data/galtest1.png 
b/svx/qa/unit/gallery/data/galtest1.png
old mode 100755
new mode 100644
diff --git a/svx/qa/unit/gallery/data/galtest2.png 
b/svx/qa/unit/gallery/data/galtest2.png
old mode 100755
new mode 100644
diff --git a/svx/qa/unit/gallery/data/galtest3.jpg 
b/svx/qa/unit/gallery/data/galtest3.jpg
old mode 100755
new mode 100644
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa

2020-01-17 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit 30c9468ec9e289d0c259c6ac11aec372fc419e04
Author: Andrea Gelmini 
AuthorDate: Fri Jan 17 19:45:09 2020 +0100
Commit: Julien Nabet 
CommitDate: Sat Jan 18 08:25:40 2020 +0100

Removed executable permission on file

Change-Id: Ia16ee2f0c5e3b3293fdc6c1cf2ba4145e752fb11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86999
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx
old mode 100755
new mode 100644
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa

2019-12-04 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/svdraw.cxx |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit ac5970258eec9d541721b8a2018c882b3f66550d
Author: Miklos Vajna 
AuthorDate: Tue Dec 3 21:21:30 2019 +0100
Commit: Miklos Vajna 
CommitDate: Wed Dec 4 09:01:40 2019 +0100

CppunitTest_svx_unit: simplify testSemiTransparentText

Reading SvxXShadowPreview::Paint() shows how to use
sdr::contact::ObjectContactOfObjListPainter, which makes it possible to
avoid the whole chain of dummy SdrView, SdrPageView and SdrPageWindow,
just to turn an SdrObject into primitives.

Change-Id: I10c85476af20a2addbd070198b9c75341275ff8d
Reviewed-on: https://gerrit.libreoffice.org/84375
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index d702effe2dbe..a0b32dc5c08e 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -22,12 +22,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -86,12 +84,10 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSemiTransparentText)
 CPPUNIT_ASSERT(pDrawPage);
 SdrPage* pSdrPage = pDrawPage->GetSdrPage();
 ScopedVclPtrInstance aVirtualDevice;
-SdrView aSdrView(pSdrPage->getSdrModelFromSdrPage(), aVirtualDevice);
-SdrPageView aSdrPageView(pSdrPage, aSdrView);
-SdrPageWindow* pSdrPageWindow = aSdrPageView.GetPageWindow(0);
-sdr::contact::ObjectContact& rObjectContactOfPageView = 
pSdrPageWindow->GetObjectContact();
+sdr::contact::ObjectContactOfObjListPainter aObjectContact(*aVirtualDevice,
+   { 
pSdrPage->GetObj(0) }, nullptr);
 const sdr::contact::ViewObjectContact& rDrawPageVOContact
-= 
pSdrPage->GetViewContact().GetViewObjectContact(rObjectContactOfPageView);
+= pSdrPage->GetViewContact().GetViewObjectContact(aObjectContact);
 sdr::contact::DisplayInfo aDisplayInfo;
 drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
 = rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: svx/qa svx/source

2019-11-08 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   29 +
 svx/qa/unit/data/tdf128413_tbrl_OnOff.odp |binary
 svx/source/svdraw/svdoashp.cxx|5 +++--
 3 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit 9b2a94321e3a05364064cb60dafc1d1b69eece56
Author: Regina Henschel 
AuthorDate: Thu Nov 7 15:25:21 2019 +0100
Commit: Regina Henschel 
CommitDate: Fri Nov 8 15:25:35 2019 +0100

tdf#128413 SetSnapRect of custom shapes expects logic rect

SdrObjCustomShape has its own version of SetSnapRect. This expects
a logic rectangle in its input parameter. That was not considered in
method SetVerticalWriting(). The result was, that for rotated or
sheared shapes, which has text, setting tb-rl writing mode changed
size and position.

Change-Id: Idefd75cf25fd9ff4b9088ee494c65d5e6c5d12c8
Reviewed-on: https://gerrit.libreoffice.org/82233
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 25ddbc97df17..796fa4824809 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -602,6 +602,35 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_TextRotateAngle)
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf128413_tbrlOnOff)
+{
+// The document contains a rotated shape with text. The error was, that 
switching
+// tb-rl writing-mode on, changed the shape size and position.
+
+const OUString sFileName("tdf128413_tbrl_OnOff.odp");
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+uno::Reference xShape(getShape(0));
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeProps.is());
+awt::Rectangle aOrigRect;
+xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= aOrigRect;
+
+SdrObjCustomShape& rSdrObjCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+rSdrObjCustomShape.SetVerticalWriting(true);
+
+awt::Rectangle aObservedRect;
+xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= 
aObservedRect;
+OUString sError;
+if (aOrigRect.Width != aObservedRect.Width || aOrigRect.Height != 
aObservedRect.Height
+|| aOrigRect.X != aObservedRect.X || aOrigRect.Y != aObservedRect.Y)
+{
+sError = "Shape has wrong size or wrong position.";
+}
+CPPUNIT_ASSERT_EQUAL(OUString(), sError);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf128413_tbrl_OnOff.odp 
b/svx/qa/unit/data/tdf128413_tbrl_OnOff.odp
new file mode 100644
index ..f10f98bbeccf
Binary files /dev/null and b/svx/qa/unit/data/tdf128413_tbrl_OnOff.odp differ
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 2fa14030b11a..7afb195499cd 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2208,8 +2208,9 @@ void SdrObjCustomShape::SetVerticalWriting( bool 
bVertical )
 SdrTextHorzAdjust eHorz = 
rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
 SdrTextVertAdjust eVert = 
rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
 
-// rescue object size
-tools::Rectangle aObjectRect = GetSnapRect();
+// rescue object size, SetSnapRect below expects logic rect,
+// not snap rect.
+tools::Rectangle aObjectRect = GetLogicRect();
 
 // prepare ItemSet to set exchanged width and height items
 SfxItemSet aNewSet(*rSet.GetPool(),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: svx/qa svx/source

2019-10-02 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   34 ++
 svx/qa/unit/data/tdf127785_asymmetricTextBoxFlipV.odg |binary
 svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx |   13 +
 3 files changed, 47 insertions(+)

New commits:
commit caaa8fe7c4bb88185b5b11591ee8a619cff0eced
Author: Regina Henschel 
AuthorDate: Tue Oct 1 18:20:53 2019 +0200
Commit: Regina Henschel 
CommitDate: Wed Oct 2 13:36:17 2019 +0200

tdf#127785 compensate 180deg rotation for position of text box

If a shape is vertically flipped, then the text is rotated by 180deg
around the shape center. The rotation is done by SdrTextObj. There
text rectangle and shape rectangle are the same, so the rotated text
rectangle has the correct position in regard to flipping. But the
text rectangle for SdrObjCustomShape is set by the shape author in
the TextFrames attribute and might have an asymmetric position. The
patch translates the text rectangle so, that is will be at the
correct position after the 180deg rotation.

Change-Id: I42e552394cc4b0103530eab48750dd621c52cc5e
Reviewed-on: https://gerrit.libreoffice.org/79984
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 5ad16cc5ea53..c1090f87109d 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -505,6 +505,40 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_Mirror)
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Asymmetric)
+{
+// The document contains a shapes with vertical flip and text frame 
asymmetrical
+// to shape. The shape has not stroke and no fill, so that the bounding 
box surrounds
+// the text and therefore equals approximately the text frame.
+// Error was, that the 180deg text rotation was not compensated for the 
position of
+// the flipped text box.
+const OUString sFileName("tdf127785_asymmetricTextBoxFlipV.odg");
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+OUString sErrors; // sErrors collects the errors and should be empty in 
case all is OK.
+
+uno::Reference xShape(getShape(0));
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeProps.is());
+awt::Rectangle aBoundRect;
+xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRect;
+const sal_Int32 nLeft = aBoundRect.X;
+const sal_Int32 nTop = aBoundRect.Y;
+const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
+const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
+if (abs(nLeft - 10034) > 5)
+sErrors += "wrong left";
+if (abs(nRight - 12973) > 5)
+sErrors += " wrong right";
+if (abs(nTop - 7892) > 5)
+sErrors += " wrong top";
+if (abs(nBottom - 14884) > 5)
+sErrors += " wrong bottom";
+
+CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf127785_asymmetricTextBoxFlipV.odg 
b/svx/qa/unit/data/tdf127785_asymmetricTextBoxFlipV.odg
new file mode 100644
index ..ea700eaf7e49
Binary files /dev/null and 
b/svx/qa/unit/data/tdf127785_asymmetricTextBoxFlipV.odg differ
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx 
b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index c88644acb6e1..08771194e109 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -168,6 +168,19 @@ namespace sdr
 // give text object a size
 aTextBoxMatrix.scale(aTextRange.getWidth(), 
aTextRange.getHeight());
 
+// NbcMirror() of SdrTextObj (from which SdrObjCustomShape 
is derived), adds a
+// 180deg rotation around the shape center to the text 
box. If aTextRange differs
+// from aObjectRange, that is not the position needed for 
mirroring. We
+// translate the text box here so, that it is at the 
correct position after rotation.
+if(GetCustomShapeObj().IsMirroredY())
+{
+aTextBoxMatrix.translate(
+aObjectRange.getWidth() - aTextRange.getWidth()
+- 2 * (aTextRange.getMinX() - 
aObjectRange.getMinimum().getX()),
+aObjectRange.getHeight() - 
aTextRange.getHeight()
+- 2 * (aTextRange.getMinY() - 
aObjectRange.getMinimum().getY()));
+}
+

[Libreoffice-commits] core.git: svx/qa

2019-09-29 Thread Andrea Gelmini (via logerrit)
 svx/qa/unit/customshapes.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 66889d5219cec22bd0e654e5a812e90cdd04e59d
Author: Andrea Gelmini 
AuthorDate: Sun Sep 29 10:19:32 2019 +0200
Commit: Julien Nabet 
CommitDate: Sun Sep 29 10:39:36 2019 +0200

Fix typo

Change-Id: I3a322ce0d16daa179dd674b975327180f8b10561
Reviewed-on: https://gerrit.libreoffice.org/79809
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 5f5983776e15..ed26337380bf 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -465,7 +465,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 {
 // The document contains two shapes, one with horizontal flip, the other 
with vertical
 // flip. They are diamonds, so their text frame is symmetric to the center 
of the shape.
-// The shapes have not stroke and no fill, so that the bounding box 
sourrounds the text
+// The shapes have not stroke and no fill, so that the bounding box 
surrounds the text
 // and therefore equals approximately the text frame.
 // Error was, that because of wrong calculation, the flipped shapes do not 
use the
 // text frame but the frame rectangle for their text.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: svx/qa svx/source

2019-09-28 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   45 ++
 svx/qa/unit/data/tdf127785_Mirror.odp |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx |   10 ++--
 3 files changed, 50 insertions(+), 5 deletions(-)

New commits:
commit 7830a9d42926a9c5265230d42fce4a4858b303c1
Author: Regina Henschel 
AuthorDate: Sat Sep 28 00:34:35 2019 +0200
Commit: Regina Henschel 
CommitDate: Sat Sep 28 20:00:51 2019 +0200

tdf#127785 correct calculation of text rectangle in flipped shape

The calculation had used a wrong corner. That resulted in negative
width or height. Thus the entire shape frame was used as fallback
instead of the smaller text rectangle.

Change-Id: Ia18d9630dc83c0556115609575f26dcfa71bdb13
Reviewed-on: https://gerrit.libreoffice.org/79774
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 5d1d4c3f44fe..5f5983776e15 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -460,6 +460,51 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf126512_OOXML_handle_in_ODP)
 }
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
+{
+// The document contains two shapes, one with horizontal flip, the other 
with vertical
+// flip. They are diamonds, so their text frame is symmetric to the center 
of the shape.
+// The shapes have not stroke and no fill, so that the bounding box 
sourrounds the text
+// and therefore equals approximately the text frame.
+// Error was, that because of wrong calculation, the flipped shapes do not 
use the
+// text frame but the frame rectangle for their text.
+const OUString sFileName("tdf127785_Mirror.odp");
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+OUString sErrors; // sErrors collects the errors and should be empty in 
case all is OK.
+
+uno::Reference xShapeV(getShape(0));
+uno::Reference xShapeVProps(xShapeV, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeVProps.is());
+awt::Rectangle aBoundRectV;
+xShapeVProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= 
aBoundRectV;
+const sal_Int32 nHeightV = aBoundRectV.Height;
+const sal_Int32 nWidthV = aBoundRectV.Width;
+const sal_Int32 nLeftV = aBoundRectV.X;
+const sal_Int32 nTopV = aBoundRectV.Y;
+if (abs(nHeightV - 4149) > 5 || abs(nWidthV - 3819) > 5)
+sErrors += "Flip vertical wrong size.";
+if (abs(nLeftV - 3155) > 5 || abs(nTopV - 3736) > 5)
+sErrors += " Flip vertical wrong position.";
+
+uno::Reference xShapeH(getShape(1));
+uno::Reference xShapeHProps(xShapeH, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeHProps.is());
+awt::Rectangle aBoundRectH;
+xShapeHProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= 
aBoundRectH;
+const sal_Int32 nHeightH = aBoundRectH.Height;
+const sal_Int32 nWidthH = aBoundRectH.Width;
+const sal_Int32 nLeftH = aBoundRectH.X;
+const sal_Int32 nTopH = aBoundRectH.Y;
+if (abs(nHeightH - 4149) > 5 || abs(nWidthH - 3819) > 5)
+sErrors += " Flip horizontal wrong size.";
+if (abs(nLeftH - 15026) > 5 || abs(nTopH - 4115) > 5)
+sErrors += " Flip horizontal wrong position.";
+
+CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf127785_Mirror.odp 
b/svx/qa/unit/data/tdf127785_Mirror.odp
new file mode 100644
index ..ff867839f4ac
Binary files /dev/null and b/svx/qa/unit/data/tdf127785_Mirror.odp differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index ee0331987c65..6151ea928e47 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1101,17 +1101,17 @@ tools::Rectangle EnhancedCustomShape2d::GetTextRect() 
const
 sal_Int32 nIndex = 0;
 Point aTopLeft( GetPoint( seqTextFrames[ nIndex ].TopLeft, !bOOXMLShape, 
true ) );
 Point aBottomRight( GetPoint( seqTextFrames[ nIndex ].BottomRight, 
!bOOXMLShape, true ) );
+tools::Rectangle aRect( aTopLeft, aBottomRight );
 if ( bFlipH )
 {
-aTopLeft.setX( aLogicRect.GetWidth() - aTopLeft.X() );
-aBottomRight.setX( aLogicRect.GetWidth() - aBottomRight.X() );
+aRect.SetLeft(aLogicRect.GetWidth() - 1 - aBottomRight.X());
+aRect.SetRight( aLogicRect.GetWidth() - 1 - aTopLeft.X());
 }
 if ( bFlipV )
 {
-aTopLeft.setY( aLogicRect.GetHeight() - aTopLeft.Y() );
-

[Libreoffice-commits] core.git: svx/qa svx/source toolkit/source

2019-08-26 Thread Miklos Vajna (via logerrit)
 svx/qa/unit/data/tdf93998.odp |binary
 svx/qa/unit/unodraw.cxx   |   33 ++
 svx/source/unodraw/unoshap2.cxx   |   10 -
 toolkit/source/controls/dialogcontrol.cxx |   25 --
 toolkit/source/helper/property.cxx|2 -
 5 files changed, 61 insertions(+), 9 deletions(-)

New commits:
commit 3341986547b69bcb4c38e4ccb2f0853a3a569bb5
Author: Miklos Vajna 
AuthorDate: Mon Aug 26 17:54:50 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 26 19:21:06 2019 +0200

tdf#93998 toolkit: restore support for setting dialog background from shape

Regression from commit fb29e6eeeaad5255bb924ff59162a83ed80bfb0a (svx:
removing GraphicURL and OWN_ATTR_GRAFURL, fix writerfilter, 2018-03-08),
the problem was that an in-document macro tried to assign a bitmap shape
to a dialog background, which broke during the image handling rework.

Note that in this case the actual type of the "URL" is not interesting,
we can just return an XGraphic and then take it on the other side as
well, without re-introducing the intentionally removed graphic URLs
which point to memory addresses.

This also made it necessary to extend
UnoDialogControl::ImplModelPropertiesChanged(), so that in case a
graphic is assigned to the dialog model, then the dialog model -> dialog
sync code doesn't just copy over the empty image URL string. With this,
finally clicking on the button of the bugdoc makes the dialog show up
with the correct background.

Change-Id: Id78269643289efb435b96a6a0b9f8a93fa49ec04
Reviewed-on: https://gerrit.libreoffice.org/78153
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svx/qa/unit/data/tdf93998.odp b/svx/qa/unit/data/tdf93998.odp
new file mode 100644
index ..889aeeb0216f
Binary files /dev/null and b/svx/qa/unit/data/tdf93998.odp differ
diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx
index ee4b336b1a3d..b4e1b9c26b93 100644
--- a/svx/qa/unit/unodraw.cxx
+++ b/svx/qa/unit/unodraw.cxx
@@ -12,6 +12,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -76,6 +80,35 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testWriterGraphicExport)
{ "MediaType", 
uno::Any(OUString("image/jpeg")) } }));
 CPPUNIT_ASSERT(xExportFilter->filter(aProperties));
 }
+
+CPPUNIT_TEST_FIXTURE(UnodrawTest, testTdf93998)
+{
+mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY) 
+ "tdf93998.odp");
+uno::Reference 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDrawPagesSupplier.is());
+
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDrawPage.is());
+
+uno::Reference xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xShape.is());
+
+uno::Reference xFactory = 
comphelper::getProcessServiceFactory();
+uno::Reference xModel(
+xFactory->createInstance("com.sun.star.awt.UnoControlDialogModel"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xModel.is());
+
+uno::Reference xModelProps(xModel, uno::UNO_QUERY);
+CPPUNIT_ASSERT(xModelProps.is());
+
+// This resulted in a uno::RuntimeException, assigning a shape to a dialog 
model's image was
+// broken.
+xModelProps->setPropertyValue("ImageURL", 
xShape->getPropertyValue("GraphicURL"));
+uno::Reference xGraphic;
+xModelProps->getPropertyValue("Graphic") >>= xGraphic;
+CPPUNIT_ASSERT(xGraphic.is());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 97935d68af4f..688fd1b29ee6 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1487,13 +1487,13 @@ bool SvxGraphicObject::getPropertyValueImpl( const 
OUString& rName, const SfxIte
 }
 
 case OWN_ATTR_GRAPHIC_URL:
-{
-throw uno::RuntimeException("Getting from this property is not 
supported");
-break;
-}
-
 case OWN_ATTR_VALUE_GRAPHIC:
 {
+if (pProperty->nWID == OWN_ATTR_GRAPHIC_URL)
+{
+SAL_WARN("svx", "Getting Graphic by URL is not supported, getting 
it by value");
+}
+
 Reference xGraphic;
 auto pSdrGraphicObject = static_cast(GetSdrObject());
 if (pSdrGraphicObject->GetGraphicObject().GetType() != 
GraphicType::NONE)
diff --git a/toolkit/source/controls/dialogcontrol.cxx 
b/toolkit/source/controls/dialogcontrol.cxx
index e67f33bef885..fa5a4a17efaa 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -278,8 +278,18 @@ void SAL_CALL 
UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32
 if ( nHandle == 

[Libreoffice-commits] core.git: svx/qa svx/source

2019-06-10 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx  |   20 +++
 svx/qa/unit/data/tdf125782_QuadraticCurveTo.odg   |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx |   28 --
 3 files changed, 31 insertions(+), 17 deletions(-)

New commits:
commit 39599fc689364b70cf83e834a5742cc2181b13b0
Author: Regina Henschel 
AuthorDate: Sat Jun 8 21:49:50 2019 +0200
Commit: Regina Henschel 
CommitDate: Mon Jun 10 20:00:58 2019 +0200

tdf#125782 use correct 'current point' for quadraticcurveto

Use the same way to get the 'current point' as in
command arcangleto. The error was visible in shape teardrop.

Change-Id: Ie7af2b950bae7e3ea492eeb439a0cc2bfe7c
Reviewed-on: https://gerrit.libreoffice.org/73723
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 6426d72ab970..b70a8e536218 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -393,6 +393,26 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf115813_OOXML_XY_handle)
 }
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testQuadraticCurveTo)
+{
+// tdf125782 command Q (quadraticcurveto) uses wrong 'current point'.
+// When converting to cubic Bezier curve, this had resulted in a wrong 
first control point.
+// The quadraticcurveto segment starts in shape center in the test file. 
The first control
+// point should produce a horizontal tangent in the start point.
+const OUString sFileName("tdf125782_QuadraticCurveTo.odg");
+const OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
sFileName;
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+uno::Reference xShape(getShape(0));
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeProps.is());
+awt::Rectangle aBoundRect;
+xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRect;
+const double fHeight = static_cast(aBoundRect.Height);
+//Add some tolerance
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("bad height of quadraticcurveto", 
3004, fHeight, 10.0);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf125782_QuadraticCurveTo.odg 
b/svx/qa/unit/data/tdf125782_QuadraticCurveTo.odg
new file mode 100644
index ..ba7b495367ce
Binary files /dev/null and b/svx/qa/unit/data/tdf125782_QuadraticCurveTo.odg 
differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 256b96cd5362..482650fdf9d0 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2292,27 +2292,21 @@ void EnhancedCustomShape2d::CreateSubPath(
 {
 for ( sal_Int32 i(0); ( i < nPntCount ) && ( rSrcPt + 1 < 
nCoordSize ); i++ )
 {
-if ( rSrcPt )
+DBG_ASSERT(aNewB2DPolygon.count(), 
"EnhancedCustomShape2d::CreateSubPath: Error no previous point for Q (!)");
+if (aNewB2DPolygon.count() > 0)
 {
-const Point aPreviousEndPoint(GetPoint( 
seqCoordinates[ rSrcPt - 1 ], true, true));
-const Point aControlQ(GetPoint( seqCoordinates[ 
rSrcPt++ ], true, true ));
-const Point aEnd(GetPoint( seqCoordinates[ 
rSrcPt++ ], true, true ));
-const Point aControlA((aPreviousEndPoint + 
(aControlQ * 2)) / 3);
-const Point aControlB(((aControlQ * 2) + aEnd) / 
3);
-
-DBG_ASSERT(aNewB2DPolygon.count(), 
"EnhancedCustomShape2d::CreateSubPath: Error in adding Q control point (!)");
-aNewB2DPolygon.appendBezierSegment(
-basegfx::B2DPoint(aControlA.X(), 
aControlA.Y()),
-basegfx::B2DPoint(aControlB.X(), 
aControlB.Y()),
-basegfx::B2DPoint(aEnd.X(), aEnd.Y()));
+const basegfx::B2DPoint 
aPreviousEndPoint(aNewB2DPolygon.getB2DPoint(aNewB2DPolygon.count()-1));
+const basegfx::B2DPoint 
aControlQ(GetPointAsB2DPoint( seqCoordinates[ rSrcPt++ ], true, true ));
+const basegfx::B2DPoint aEnd(GetPointAsB2DPoint( 
seqCoordinates[ rSrcPt++ ], true, true ));
+const basegfx::B2DPoint 
aControlA((aPreviousEndPoint + (aControlQ * 2)) / 3);
+const basegfx::B2DPoint aControlB(((aControlQ * 2) 
+ aEnd) / 3);
+

[Libreoffice-commits] core.git: svx/qa

2019-05-25 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bfd26fd04ba06d0eac3fb516c6548a1e6eacc6df
Author: Regina Henschel 
AuthorDate: Sat May 25 16:48:09 2019 +0200
Commit: Regina Henschel 
CommitDate: Sat May 25 18:21:12 2019 +0200

tdf#125181 Update comment in unit test for added shapes

I have recently added shapes star24 and star32 to the unit test, but
forgotten to update the comment in the test accordingly.

Change-Id: I712c652100cadedc06a0b16c8dd27dc078cdbbeb
Reviewed-on: https://gerrit.libreoffice.org/72954
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 470d838cda3b..6426d72ab970 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -335,7 +335,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf115813_OOXML_XY_handle)
 {
 // The test covers all preset shapes with handles. Only these ones are
 // excluded: arc, blockArc, chord, circularArrow, gear6, gear9, 
mathNotEqual, pie,
-// leftCircularArrow, leftRightCircularArrow, star24, star32, swooshArrow.
+// leftCircularArrow, leftRightCircularArrow, swooshArrow.
 // Connectors are included as ordinary shapes to prevent converting.
 // Error was, that the handle movement and the changes to the shape did 
not follow
 // the mouse movement.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: svx/qa

2019-05-20 Thread Regina Henschel (via logerrit)
 svx/qa/unit/data/tdf115813_HandleMovementOOXMLPresetShapes.pptx |binary
 1 file changed

New commits:
commit 9345ef1cbd14411b7b5b328423fca1d443e623eb
Author: Regina Henschel 
AuthorDate: Mon May 20 18:45:19 2019 +0200
Commit: Regina Henschel 
CommitDate: Mon May 20 20:35:01 2019 +0200

tdf#125181 Add shapes star24 and star32 to unit test

The commit 500a70ba19d9c1207fd9121531950e55a70fd940 has fixed the error
in the definition of shapes star24 and star32. They can now be
included in the test file for unit test of preset shape handles.

Change-Id: I94f63d37a7faaec4006104127fcc0443304ae0b8
Reviewed-on: https://gerrit.libreoffice.org/72612
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/data/tdf115813_HandleMovementOOXMLPresetShapes.pptx 
b/svx/qa/unit/data/tdf115813_HandleMovementOOXMLPresetShapes.pptx
index a16826e23419..3435fef6175b 100644
Binary files a/svx/qa/unit/data/tdf115813_HandleMovementOOXMLPresetShapes.pptx 
and b/svx/qa/unit/data/tdf115813_HandleMovementOOXMLPresetShapes.pptx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: svx/qa svx/source

2019-04-16 Thread Regina Henschel (via logerrit)
 svx/qa/unit/customshapes.cxx   |   23 +
 svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx  |5 ++-
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit f0d07c5b84300e508d49dfceb968cb6a0dae436c
Author: Regina Henschel 
AuthorDate: Mon Apr 15 16:15:25 2019 +0200
Commit: Regina Henschel 
CommitDate: Tue Apr 16 12:05:43 2019 +0200

tdf#124740 Handle position is already scaled for ooxml-foo shapes

If a 'ooxml-foo' shape has a path internal coordinate system by
using w and h attribute, the position of the handle was out of
place. Because in 'ooxml-foo' shapes the handle position is not
directly connected to the adjustment value but via formulas, the
handle position is already scaled when calculating the position.

Change-Id: I84ef8c5ea3bbe94a1bfd9d8ba17b97248086234f
Reviewed-on: https://gerrit.libreoffice.org/70783
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index e58d46ab505d..526721d1a6c3 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -295,6 +295,29 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf124029_arc_position)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("shape width", static_cast(1610),
  static_cast(aFrameRect.Width));
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf124740_handle_path_coordsystem)
+{
+// tdf124740 OOXML shape with handle and w and h attribute on path has 
wrong
+// handle position
+// The handle position was scaled erroneously twice.
+const OUString sFileName("tdf124740_HandleInOOXMLUserShape.pptx");
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+uno::Reference xShape(getShape(0));
+// The shape has one, horizontal adjust handle. It is about 1/5 of 10cm 
from left
+// shape edge, shape is 6cm from left . That results in a position
+// of 8cm from left page edge, which is 8000 in 1/100 mm unit.
+SdrObjCustomShape& rSdrObjCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+Point aPosition;
+aCustomShape2d.GetHandlePosition(0, aPosition);
+double fX(aPosition.X());
+// tolerance for rounding to integer
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("handle X coordinate", 8000.0, fX, 
2.0);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx 
b/svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx
new file mode 100644
index ..dd6df7b03b43
Binary files /dev/null and 
b/svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index b8b859f7b82e..339973707bdd 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1163,7 +1163,10 @@ bool EnhancedCustomShape2d::GetHandlePosition( const 
sal_uInt32 nIndex, Point& r
 aHandle.aPosition.Second = aFirst;
 }
 }
-rReturnPosition = GetPoint( aHandle.aPosition );
+if (bOOXMLShape)
+rReturnPosition = GetPoint(aHandle.aPosition, false 
/*bScale*/);
+else
+rReturnPosition = GetPoint(aHandle.aPosition, true 
/*bScale*/);
 }
 const GeoStat aGeoStat(mrSdrObjCustomShape.GetGeoStat());
 if ( aGeoStat.nShearAngle )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: svx/qa

2019-04-01 Thread Andrea Gelmini (via logerrit)
 svx/qa/unit/customshapes.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit eb013085beece74dc1c4faac62c08f1eeb6992fa
Author: Andrea Gelmini 
AuthorDate: Mon Apr 1 20:13:30 2019 +
Commit: Jens Carl 
CommitDate: Tue Apr 2 07:00:28 2019 +0200

Fix typo

Change-Id: Iccc8c8b82efb00df491d5283512b60d6d1746735
Reviewed-on: https://gerrit.libreoffice.org/70101
Tested-by: Jenkins
Reviewed-by: Jens Carl 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 228ab7b3687b..e58d46ab505d 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -281,7 +281,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf124029_arc_position)
 {
 // tdf121029 MS binary custom shape mso_sptArc has wrong position
 // MS uses the sector for position reference. Error was, that
-// LibreOffice has used the underlaying ellipse.
+// LibreOffice has used the underlying ellipse.
 const OUString sFileName("tdf124029_Arc_position.doc");
 OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
 mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.text.TextDocument");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: svx/qa svx/source

2019-03-21 Thread Libreoffice Gerrit user
 svx/qa/unit/customshapes.cxx  |   26 ++
 svx/qa/unit/data/tdf124212_handle_position.odg|binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx |3 ++
 3 files changed, 29 insertions(+)

New commits:
commit 1ee8547003e50e212c00df1f8d2ec3f6fc50f819
Author: Regina Henschel 
AuthorDate: Tue Mar 19 20:10:12 2019 +0100
Commit: Regina Henschel 
CommitDate: Thu Mar 21 15:42:34 2019 +0100

tdf#124212 make adjustment handle work always

In method SetHandleControllerPosition() all transformations are
reversed to get the coordinates in shape inner coordinate system
from the outer position. The error was, that the first
transformation, the move in method GetPoint was forgotten. In case
of default viewBox '0 0 21600 21600' it is not visible. But the
error is noticeable, if left or top do not equal zero.

Change-Id: Icc3f4f2c603826151c95b8b9eea5030fb5805d67
Reviewed-on: https://gerrit.libreoffice.org/69439
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 33384f56c83b..e2444b50f967 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -250,6 +250,32 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf121845_two_commands_U)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast(2),
  aPolyPolygon.count());
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf124212_handle_position)
+{
+// tdf124212 Adjustment handle reacts wrongly, if custom shape has a non
+// default viewBox. Load a document with svg:viewBox="10800 0 10800 21600"
+// Error was, that moving the controller results in a handle position that
+// does not reflect the movement.
+const OUString sFileName("tdf124212_handle_position.odg");
+OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+mxComponent = loadFromDesktop(sURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+uno::Reference xShape(getShape(0));
+// The shape has one, horizontal adjust handle.
+SdrObjCustomShape& rSdrObjCustomShape(
+static_cast(*GetSdrObjectFromXShape(xShape)));
+EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+Point aInitialPosition;
+aCustomShape2d.GetHandlePosition(0, aInitialPosition);
+css::awt::Point aDesiredPosition(aInitialPosition.X() + 1000, 
aInitialPosition.Y());
+aCustomShape2d.SetHandleControllerPosition(0, aDesiredPosition);
+Point aObservedPosition;
+aCustomShape2d.GetHandlePosition(0, aObservedPosition);
+sal_Int32 nDesiredX(aDesiredPosition.X); // awt::Point
+sal_Int32 nObservedX(aObservedPosition.X()); // tools::Point
+CPPUNIT_ASSERT_EQUAL_MESSAGE("handle X coordinate", nDesiredX, nObservedX);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf124212_handle_position.odg 
b/svx/qa/unit/data/tdf124212_handle_position.odg
new file mode 100644
index ..7a4eb05175ad
Binary files /dev/null and b/svx/qa/unit/data/tdf124212_handle_position.odg 
differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
old mode 100644
new mode 100755
index bc143c47c971..b8b859f7b82e
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1223,6 +1223,9 @@ bool EnhancedCustomShape2d::SetHandleControllerPosition( 
const sal_uInt32 nIndex
 double fPos2 = aP.Y();  //( bFlipV ) ? aLogicRect.GetHeight() 
-aP.Y() : aP.Y();
 fPos1 = !basegfx::fTools::equalZero(fXScale) ? (fPos1 / fXScale) : 
SAL_MAX_INT32;
 fPos2 = !basegfx::fTools::equalZero(fYScale) ? (fPos2 / fYScale) : 
SAL_MAX_INT32;
+// revert -nCoordLeft and -nCoordTop aus GetPoint()
+fPos1 += nCoordLeft;
+fPos2 += nCoordTop;
 
 // Used for scaling the adjustment values based on handle positions
 double fWidth;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: svx/qa

2019-03-21 Thread Libreoffice Gerrit user
 svx/qa/unit/XTableImportExportTest.cxx |   11 +---
 svx/qa/unit/customshapes.cxx   |   41 +++--
 svx/qa/unit/unodraw.cxx|   11 +---
 svx/qa/unit/xoutdev.cxx|   11 +---
 4 files changed, 15 insertions(+), 59 deletions(-)

New commits:
commit ba83043d679b11740323708e0c9da8b1e4cae488
Author: Miklos Vajna 
AuthorDate: Wed Mar 20 21:42:07 2019 +0100
Commit: Miklos Vajna 
CommitDate: Thu Mar 21 09:07:02 2019 +0100

CppunitTest_svx_unit: use CPPUNIT_TEST_FIXTURE()

Change-Id: Ib2eac7368ebb06702f05101641e8830ea1fff6d5
Reviewed-on: https://gerrit.libreoffice.org/69483
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svx/qa/unit/XTableImportExportTest.cxx 
b/svx/qa/unit/XTableImportExportTest.cxx
index 564920f801d3..cc86393577e3 100644
--- a/svx/qa/unit/XTableImportExportTest.cxx
+++ b/svx/qa/unit/XTableImportExportTest.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -30,20 +31,14 @@ using namespace css;
 class XTableImportExportTest : public CppUnit::TestFixture
 {
 public:
-void testImportExport();
-
 virtual void setUp() override
 {
 CppUnit::TestFixture::setUp();
 SfxApplication::GetOrCreate();
 }
-
-CPPUNIT_TEST_SUITE(XTableImportExportTest);
-CPPUNIT_TEST(testImportExport);
-CPPUNIT_TEST_SUITE_END();
 };
 
-void XTableImportExportTest::testImportExport()
+CPPUNIT_TEST_FIXTURE(XTableImportExportTest, testImportExport)
 {
 utl::TempFile aTempFile(nullptr, true);
 aTempFile.EnableKillingFile();
@@ -87,6 +82,4 @@ void XTableImportExportTest::testImportExport()
 }
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(XTableImportExportTest);
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 23d3fb676770..33384f56c83b 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -34,9 +34,8 @@ const OUString sDataDirectory("svx/qa/unit/data/");
 /// Tests for svx/source/customshapes/ code.
 class CustomshapesTest : public test::BootstrapFixture, public 
unotest::MacrosTest
 {
+protected:
 uno::Reference mxComponent;
-
-private:
 // get shape nShapeIndex from page 0
 uno::Reference getShape(sal_uInt8 nShapeIndex);
 
@@ -55,26 +54,6 @@ public:
 }
 test::BootstrapFixture::tearDown();
 }
-
-void testViewBoxLeftTop();
-void testAccuracyCommandX();
-void testToggleCommandXY();
-void testMultipleMoveTo();
-void testWidthOrientationCommandU();
-void testHalfEllipseVML();
-void testLargeSwingAngleVML();
-void testTdf121845_two_commands_U();
-
-CPPUNIT_TEST_SUITE(CustomshapesTest);
-CPPUNIT_TEST(testViewBoxLeftTop);
-CPPUNIT_TEST(testAccuracyCommandX);
-CPPUNIT_TEST(testToggleCommandXY);
-CPPUNIT_TEST(testMultipleMoveTo);
-CPPUNIT_TEST(testWidthOrientationCommandU);
-CPPUNIT_TEST(testHalfEllipseVML);
-CPPUNIT_TEST(testLargeSwingAngleVML);
-CPPUNIT_TEST(testTdf121845_two_commands_U);
-CPPUNIT_TEST_SUITE_END();
 };
 
 uno::Reference CustomshapesTest::getShape(sal_uInt8 
nShapeIndex)
@@ -90,7 +69,7 @@ uno::Reference 
CustomshapesTest::getShape(sal_uInt8 nShapeIndex
 return xShape;
 }
 
-void CustomshapesTest::testViewBoxLeftTop()
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testViewBoxLeftTop)
 {
 // tdf#121890 formula values "left" and "top" are wrongly calculated
 // Load a document with two custom shapes of type "non-primitive"
@@ -123,7 +102,7 @@ void CustomshapesTest::testViewBoxLeftTop()
 CPPUNIT_ASSERT_LESS(static_cast(3), labs(aFrameRectTB.Y - 
aBoundRectTB.Y));
 }
 
-void CustomshapesTest::testAccuracyCommandX()
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testAccuracyCommandX)
 {
 // 121761 Increase accuracy of quarter circles drawn by command X or Y
 // The loaded document has a quarter circle with radius 1 (unit 1/100 
mm)
@@ -145,7 +124,7 @@ void CustomshapesTest::testAccuracyCommandX()
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("segment height out of tolerance", 
2942.0, fHeight, 8.0);
 }
 
-void CustomshapesTest::testToggleCommandXY()
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testToggleCommandXY)
 {
 // 121952 Toggle x- and y-direction if command X has several parameters
 // The loaded document has a shape with command X and two parameter placed 
on a diagonal.
@@ -168,7 +147,7 @@ void CustomshapesTest::testToggleCommandXY()
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("segment height out of tolerance", 
5871.0, fHeight, 16.0);
 }
 
-void CustomshapesTest::testMultipleMoveTo()
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testMultipleMoveTo)
 {
 // tdf122964 Multiple moveTo has to be treated as lineTo in 
draw:enhanced-path
 // Load a document with path "M 0 0 5 10 10 0 N"
@@ -187,7 +166,7 @@ void CustomshapesTest::testMultipleMoveTo()
 CPPUNIT_ASSERT_MESSAGE("Path is empty", 

[Libreoffice-commits] core.git: svx/qa

2019-01-29 Thread Libreoffice Gerrit user
 0 files changed

New commits:
commit 37f4c73aef2acd02b2f03d1f28ebcadf5e5dbf5e
Author: Andrea Gelmini 
AuthorDate: Tue Jan 29 21:52:54 2019 +0100
Commit: Julien Nabet 
CommitDate: Tue Jan 29 23:08:12 2019 +0100

Removed executable permission on source file

Change-Id: I085a21afdf842a70dcdaaf9694fc6b09502985fe
Reviewed-on: https://gerrit.libreoffice.org/67096
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
old mode 100755
new mode 100644
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa xmloff/source

2019-01-28 Thread Libreoffice Gerrit user
 svx/qa/unit/customshapes.cxx  |   29 ++
 svx/qa/unit/data/tdf122964_MultipleMoveTo.odg |binary
 xmloff/source/draw/ximpcustomshape.cxx|   29 --
 3 files changed, 52 insertions(+), 6 deletions(-)

New commits:
commit 76c7a6c39d769cb9bdb9b951d9f95507c0139372
Author: Regina Henschel 
AuthorDate: Fri Jan 25 00:30:57 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Tue Jan 29 01:16:51 2019 +0100

Improve ODF enhanced-path command moveTo to follow spec

ODF 1.2 section 19.145 says 'If a moveto is followed by multiple
pairs of coordinates, they are treated as lineto.' The patch does
this on import.

Change-Id: Ib493ca49288cdb2d34b7ee801bd052281617d2e8
Reviewed-on: https://gerrit.libreoffice.org/66888
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
old mode 100644
new mode 100755
index d3f63dffe2a9..a0c256b5d6e0
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -50,11 +50,13 @@ public:
 void testViewBoxLeftTop();
 void testAccuracyCommandX();
 void testToggleCommandXY();
+void testMultipleMoveTo();
 
 CPPUNIT_TEST_SUITE(CustomshapesTest);
 CPPUNIT_TEST(testViewBoxLeftTop);
 CPPUNIT_TEST(testAccuracyCommandX);
 CPPUNIT_TEST(testToggleCommandXY);
+CPPUNIT_TEST(testMultipleMoveTo);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -161,6 +163,33 @@ void CustomshapesTest::testToggleCommandXY()
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("segment height out of tolerance", 
5871.0, fHeight, 16.0);
 }
 
+void CustomshapesTest::testMultipleMoveTo()
+{
+// tdf122964 Multiple moveTo has to be treated as lineTo in 
draw:enhanced-path
+// Load a document with path "M 0 0 5 10 10 0 N"
+OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf122964_MultipleMoveTo.odg";
+mxComponent = loadFromDesktop(aURL, 
"com.sun.star.comp.drawing.DrawingDocument");
+CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+
+uno::Reference xDrawPagesSupplier(mxComponent,
+   
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", 
xDrawPagesSupplier.is());
+uno::Reference 
xDrawPages(xDrawPagesSupplier->getDrawPages());
+uno::Reference xDrawPage(xDrawPages->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+// Error was, that the second and further parameter pairs were treated as 
moveTo,
+// and so the generated path was empty, resulting in zero width and height 
of the
+// bounding box. It has to be treated same as "M 0 0 L 5 10 10 0 N".
+uno::Reference xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the shape", xShape.is());
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeProps.is());
+awt::Rectangle aBoundRect;
+xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRect;
+bool bIsZero(aBoundRect.Height == 0 && aBoundRect.Width == 0);
+CPPUNIT_ASSERT_MESSAGE("Path is empty", !bIsZero);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(CustomshapesTest);
 }
 
diff --git a/svx/qa/unit/data/tdf122964_MultipleMoveTo.odg 
b/svx/qa/unit/data/tdf122964_MultipleMoveTo.odg
new file mode 100644
index ..63d80fd06736
Binary files /dev/null and b/svx/qa/unit/data/tdf122964_MultipleMoveTo.odg 
differ
diff --git a/xmloff/source/draw/ximpcustomshape.cxx 
b/xmloff/source/draw/ximpcustomshape.cxx
index da15e3458cbb..35de24ba2562 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -792,16 +792,33 @@ static void GetEnhancedPath( std::vector< 
css::beans::PropertyValue >& rDest,
 }
 else if ( nParameterCount >= nParametersNeeded )
 {
-// check if the last command is identical,
-// if so, we just need to increment the count
-if ( !vSegments.empty() && ( vSegments[ vSegments.size() - 1 
].Command == nLatestSegmentCommand ) )
-vSegments[ vSegments.size() -1 ].Count++;
-else
+// Special rule for moveto in ODF 1.2 section 19.145
+// "If a moveto is followed by multiple pairs of coordinates, they 
are treated as lineto."
+if ( nLatestSegmentCommand == 
css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO )
 {
 css::drawing::EnhancedCustomShapeSegment aSegment;
-aSegment.Command = nLatestSegmentCommand;
+aSegment.Command = 
css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
 aSegment.Count = 1;
 vSegments.push_back( aSegment );
+nIndex--;
+nLatestSegmentCommand = 

[Libreoffice-commits] core.git: svx/qa

2018-12-14 Thread Libreoffice Gerrit user
 0 files changed

New commits:
commit 1d17cab6becbf24187633761b953c43b0800bb49
Author: Andrea Gelmini 
AuthorDate: Thu Dec 13 17:17:01 2018 +0100
Commit: Julien Nabet 
CommitDate: Fri Dec 14 09:14:36 2018 +0100

Removed executable permission on .cxx file

Change-Id: I09775c92f7c5b5e0f554a2822d243a230a06f626
Reviewed-on: https://gerrit.libreoffice.org/65136
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
old mode 100755
new mode 100644
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa

2018-03-19 Thread Caolán McNamara
 svx/qa/unit/XTableImportExportTest.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e83dc1b5edee95184a84d2d2ca2675b72d561098
Author: Caolán McNamara 
Date:   Mon Mar 19 10:39:36 2018 +

coverity#1430091 Unchecked return value

Change-Id: Id72d3c6714a8c74502247eed9c23c7cf8b5412f4
Reviewed-on: https://gerrit.libreoffice.org/51543
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/svx/qa/unit/XTableImportExportTest.cxx 
b/svx/qa/unit/XTableImportExportTest.cxx
index df08fa6190f5..6e136558efd8 100644
--- a/svx/qa/unit/XTableImportExportTest.cxx
+++ b/svx/qa/unit/XTableImportExportTest.cxx
@@ -68,7 +68,8 @@ void XTableImportExportTest::testImportExport()
 
 {
 XBitmapList xBitmapList(aTempURL, "REF");
-xBitmapList.Load();
+bool bResult = xBitmapList.Load();
+CPPUNIT_ASSERT(bResult);
 uno::Reference 
xNameContainer(xBitmapList.createInstance());
 CPPUNIT_ASSERT(xNameContainer.is());
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa svx/source

2017-06-27 Thread Noel Grandin
 svx/qa/unit/xoutdev.cxx|   
 2 -
 svx/source/accessibility/AccessibleShape.cxx   |   
 3 -
 svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx  |   
 3 -
 svx/source/dialog/pagectrl.cxx |   
 4 +-
 svx/source/dialog/pagenumberlistbox.cxx|   
 3 -
 svx/source/dialog/passwd.cxx   |   
 3 -
 svx/source/dialog/srchdlg.cxx  |   
 3 -
 svx/source/dialog/svxruler.cxx |   
 3 -
 svx/source/engine3d/view3d.cxx |   
 5 --
 svx/source/engine3d/view3d1.cxx|   
 3 -
 svx/source/fmcomp/fmgridcl.cxx |   
 2 -
 svx/source/fmcomp/fmgridif.cxx |   
 3 -
 svx/source/form/ParseContext.cxx   |   
 2 -
 svx/source/form/datanavi.cxx   |   
15 ++--
 svx/source/form/fmPropBrw.cxx  |   
 3 -
 svx/source/form/fmshimp.cxx|   
 7 +---
 svx/source/form/tbxform.cxx|   
 2 -
 svx/source/gallery2/gallery1.cxx   |   
 3 -
 svx/source/items/numfmtsh.cxx  |   
 6 ---
 svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx  |   
 3 -
 svx/source/sidebar/nbdtmg.cxx  |   
17 +++---
 svx/source/sidebar/text/TextCharacterSpacingControl.cxx|   
 3 -
 svx/source/stbctrls/pszctrl.cxx|   
 3 -
 svx/source/svdraw/svdedtv1.cxx |   
10 -
 svx/source/svdraw/svdibrow.cxx |   
 3 -
 svx/source/svdraw/svdoashp.cxx |   
13 ++-
 svx/source/svdraw/svdopath.cxx |   
 3 -
 svx/source/table/accessiblecell.cxx|   
 6 +--
 svx/source/tbxctrls/linectrl.cxx   |   
 4 +-
 svx/source/tbxctrls/tbcontrl.cxx   |   
 3 -
 svx/source/toolbars/extrusionbar.cxx   |   
 3 -
 svx/source/uitest/sdrobject.cxx|   
 6 +--
 svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx |   
 3 -
 svx/source/unodraw/UnoGraphicExporter.cxx  |   
 3 -
 svx/source/unodraw/unoshap4.cxx|   
 4 +-
 svx/source/xml/xmlgrhlp.cxx|   
 9 ++---
 36 files changed, 59 insertions(+), 112 deletions(-)

New commits:
commit 6561fc32afaa0ca992ae988b6d08c62e3e516d43
Author: Noel Grandin 
Date:   Mon Jun 26 14:47:52 2017 +0200

loplugin:oncevar in svx

Change-Id: I22a3a13e059ac7d3479f12860564fe3eb1b55e44
Reviewed-on: https://gerrit.libreoffice.org/39282
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index 2cc088609104..0f0451f3cf2a 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -52,7 +52,7 @@ void XOutdevTest::testPdfGraphicExport()
 // Export it.
 utl::TempFile aTempFile;
 aTempFile.EnableKillingFile();
-XOutFlags eFlags = XOutFlags::DontExpandFilename | 
XOutFlags::DontAddExtension | XOutFlags::UseNativeIfPossible;
+XOutFlags const eFlags = XOutFlags::DontExpandFilename | 
XOutFlags::DontAddExtension | XOutFlags::UseNativeIfPossible;
 OUString aTempURL = aTempFile.GetURL();
 XOutBitmap::WriteGraphic(aGraphic, aTempURL, "pdf", eFlags);
 
diff --git a/svx/source/accessibility/AccessibleShape.cxx 
b/svx/source/accessibility/AccessibleShape.cxx
index de059e9bb7fd..ac3347c15ff2 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -1441,8 +1441,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
 }
 sal_Int32 SAL_CALL AccessibleShape::getHyperLinkIndex( sal_Int32 )
 {
-sal_Int32 nRet = 0;
-return nRet;
+return 0;
 }
 // XAccessibleText
 sal_Int32 SAL_CALL AccessibleShape::getCaretPosition(  ){return 0;}
diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx 
b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
index ee94039c02b4..a97d6e0b9f03 100644
--- 

[Libreoffice-commits] core.git: svx/qa

2017-02-01 Thread Tor Lillqvist
 svx/qa/unit/xoutdev.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit d502c33b20f8570517b951e256756c71218bad52
Author: Tor Lillqvist 
Date:   Wed Feb 1 17:32:53 2017 +0200

Need  here, too

Change-Id: I9dc03760831f3f1ff433c67abde95060d533ea14

diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index ff2e8bc..5bd3179 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svx/qa

2016-06-29 Thread Stephan Bergmann
 svx/qa/unit/xoutdev.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 04c2f370fa894315780d3f838e22e2e4c9479168
Author: Stephan Bergmann 
Date:   Wed Jun 29 09:46:45 2016 +0200

loplugin:defaultparams

Change-Id: I17fd4679e0a6a58856021b40575ac9603da01b37

diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index 468d7ae..c053b26 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -41,7 +41,7 @@ void XOutdevTest::testPdfGraphicExport()
 
 // Export it.
 utl::TempFile aTempFile;
-aTempFile.EnableKillingFile(true);
+aTempFile.EnableKillingFile();
 XOutFlags eFlags = XOutFlags::DontExpandFilename | 
XOutFlags::DontAddExtension | XOutFlags::UseNativeIfPossible;
 OUString aTempURL = aTempFile.GetURL();
 XOutBitmap::WriteGraphic(aGraphic, aTempURL, "pdf", eFlags);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits