Mirror shape on right-to-left sheet?

2020-12-20 Thread Regina Henschel

Hi all,

Start Calc and set the sheet to right-to-left (complex text layout 
enabled, menu Format).

Insert left-to-right arrow, one cell anchored, another page anchored.
Save to .ods and open archive.
Examine element draw:enhanced-geometry. There is no attribute 
'draw:mirror-horizontal' which means default value "false".


Now do the same in Excel. Excel writes 'draw:mirror-horizontal="true"'.

Open the file which was saved by LibreOffice. Notice that the page 
anchored arrow is flipped. That is bug 137081. To fix it, I need to 
know, what is the correct attribute in file format.


Kind regards
Regina

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - svx/qa svx/source

2020-12-17 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 c6bc280fa986bac1b62726a4a19fd0be1c735fc0
Author: Regina Henschel 
AuthorDate: Tue Dec 15 20:20:55 2020 +0100
Commit: Xisco Fauli 
CommitDate: Thu Dec 17 11:16:38 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 
(cherry picked from commit d4ca360f6632f03e9fb7e9af37aac40d23f1249a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107803
Reviewed-by: Xisco Fauli 

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, 

[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(*GetSdrObject

Re: LO calc formulas

2020-12-09 Thread Regina Henschel

Hi Dante,

the methods for the Calc functions are in files interpr*.cxx and 
interpre.hxx. Most methods are named kind ScFoo, ScSum for example. They 
do outer things like checking, that parameters are valid. From there you 
will easily find the calculating algorithm, often a local method.


I think, summation uses simple +

Kind regards
Regina


Dante Doménech schrieb am 09-Dec-20 um 20:25:

Does anyone know where are implemented the calc formulas?
I'd like to check out if it uses the kahan algorithm, pairwise sum or 
something else.



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - vcl/win

2020-12-09 Thread Regina Henschel (via logerrit)
 vcl/win/gdi/gdiimpl.cxx |   35 +++
 1 file changed, 31 insertions(+), 4 deletions(-)

New commits:
commit d41d6768a17c65460565265f41a590f8e6982ad9
Author: Regina Henschel 
AuthorDate: Thu Dec 3 23:53:43 2020 +0100
Commit: Xisco Fauli 
CommitDate: Wed Dec 9 17:33:09 2020 +0100

tdf#134128 Use Gdiplus::DashCapRound for round dash or dot.

If Skia and OpenGL are disabled, rendering in edit mode shows no round
dashes and dots on Windows. This becomes especially visible, when
importing OOXML documents. In that case it looks as if dots are lost.
The patch uses now Gdiplus::DashCapRound instead of the previously
used Gdiplus::DashCapFlat, and it adds a similar tweak as in OOXML
import and increases the dash length by the cap size for rendering.

Change-Id: I98a258809ef253a2cacb7c5c94f2b26b89ee2488
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107181
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 24d770799660d3ec94ee7add435645794426042b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107201
Reviewed-by: Xisco Fauli 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index de022280c4b2..b3b70320dd05 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2343,12 +2343,39 @@ bool WinSalGraphicsImpl::drawPolyLine(
 std::vector aDashArray(pStroke->size());
 const double fFactor(fLineWidth == 0 ? 1.0 : 1.0 / fLineWidth);
 
-for(size_t a(0); a < pStroke->size(); a++)
+// tdf#134128. ODF adds caps to the dashes and dots, but GDI makes 
caps from the
+// dash or dot themselve. We tweak aDashArray to look the same in GDI 
(e.g. Impress edit mode)
+// and other renderes (e.g. Impress slide show), while keeping the 
total length of the
+// pattern.
+// Patterns are always a sequence dash space dash space ...
+if (eLineCap != css::drawing::LineCap_BUTT)
 {
-aDashArray[a] = Gdiplus::REAL((*pStroke)[a] * fFactor);
+size_t nSize = pStroke->size();
+// We want to treat dash and space in pairs. There should be no 
odd size. If so, we ignore
+// last item.
+nSize /= 2;
+for(size_t a(0); a < nSize; a++)
+{
+double fDashLengthRel = (*pStroke)[2 * a] * fFactor;
+double fSpaceLengthRel = (*pStroke)[2 * a + 1] * fFactor;
+// GDI allows only positive lengths for space, Skia negative 
lengths too. Thus the
+// appearance is different, in case space is too small.
+double fCorrect = fSpaceLengthRel - 1.0 <= 0 ? fSpaceLengthRel 
- 0.01 : 1.0;
+aDashArray[2 * a] = Gdiplus::REAL(fDashLengthRel + fCorrect);
+aDashArray[2 * a + 1] = Gdiplus::REAL(fSpaceLengthRel - 
fCorrect);
+}
 }
-
-aPen.SetDashCap(Gdiplus::DashCapFlat);
+else
+{
+for(size_t a(0); a < pStroke->size(); a++)
+{
+aDashArray[a] = Gdiplus::REAL((*pStroke)[a] * fFactor);
+}
+}
+if (eLineCap == css::drawing::LineCap_ROUND)
+aPen.SetDashCap(Gdiplus::DashCapRound);
+else
+aPen.SetDashCap(Gdiplus::DashCapFlat); // "square" doesn't exist 
in Gdiplus
 aPen.SetDashOffset(Gdiplus::REAL(0.0));
 aPen.SetDashPattern(aDashArray.data(), aDashArray.size());
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: Math/Formula visual editing

2020-12-06 Thread Regina Henschel

Hi Peter,

LibreOffice has an in-line formula editor. But no one has improved it in 
the last seven years, so it is still an "experimental feature". You are 
welcome to bring it to the regular UI.


With this editor you write the formula directly into the main window and 
the markup is automatically generated in the command window.


You can enable it in Tools > Options > LibreOffice > Advanced.

Kind regards
Regina

Peter Gervai schrieb am 06-Dec-20 um 20:56:

Hello Devs!

[..]

I was looking around formula input tools, from LyX through various
tools to LO Math (or Formula, it is sometimes referenced either this
or that). Basically what's usable was LyX, but it's clunky and hard to
use for non-technical people and LO, which is rather easy to use. (And
you can edit TeX source, but that's absolutely not user friendly.)
None of them was really _good_or _simple_. I'm here to help LO
Formula/Math to be the best.


[..]

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: vcl/win

2020-12-03 Thread Regina Henschel (via logerrit)
 vcl/win/gdi/gdiimpl.cxx |   35 +++
 1 file changed, 31 insertions(+), 4 deletions(-)

New commits:
commit 24d770799660d3ec94ee7add435645794426042b
Author: Regina Henschel 
AuthorDate: Thu Dec 3 23:53:43 2020 +0100
Commit: Noel Grandin 
CommitDate: Fri Dec 4 07:23:10 2020 +0100

tdf#134128 Use Gdiplus::DashCapRound for round dash or dot.

If Skia and OpenGL are disabled, rendering in edit mode shows no round
dashes and dots on Windows. This becomes especially visible, when
importing OOXML documents. In that case it looks as if dots are lost.
The patch uses now Gdiplus::DashCapRound instead of the previously
used Gdiplus::DashCapFlat, and it adds a similar tweak as in OOXML
import and increases the dash length by the cap size for rendering.

Change-Id: I98a258809ef253a2cacb7c5c94f2b26b89ee2488
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107181
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index de022280c4b2..b3b70320dd05 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2343,12 +2343,39 @@ bool WinSalGraphicsImpl::drawPolyLine(
 std::vector aDashArray(pStroke->size());
 const double fFactor(fLineWidth == 0 ? 1.0 : 1.0 / fLineWidth);
 
-for(size_t a(0); a < pStroke->size(); a++)
+// tdf#134128. ODF adds caps to the dashes and dots, but GDI makes 
caps from the
+// dash or dot themselve. We tweak aDashArray to look the same in GDI 
(e.g. Impress edit mode)
+// and other renderes (e.g. Impress slide show), while keeping the 
total length of the
+// pattern.
+// Patterns are always a sequence dash space dash space ...
+if (eLineCap != css::drawing::LineCap_BUTT)
 {
-aDashArray[a] = Gdiplus::REAL((*pStroke)[a] * fFactor);
+size_t nSize = pStroke->size();
+// We want to treat dash and space in pairs. There should be no 
odd size. If so, we ignore
+// last item.
+nSize /= 2;
+for(size_t a(0); a < nSize; a++)
+{
+double fDashLengthRel = (*pStroke)[2 * a] * fFactor;
+double fSpaceLengthRel = (*pStroke)[2 * a + 1] * fFactor;
+// GDI allows only positive lengths for space, Skia negative 
lengths too. Thus the
+// appearance is different, in case space is too small.
+double fCorrect = fSpaceLengthRel - 1.0 <= 0 ? fSpaceLengthRel 
- 0.01 : 1.0;
+aDashArray[2 * a] = Gdiplus::REAL(fDashLengthRel + fCorrect);
+aDashArray[2 * a + 1] = Gdiplus::REAL(fSpaceLengthRel - 
fCorrect);
+}
 }
-
-aPen.SetDashCap(Gdiplus::DashCapFlat);
+else
+{
+for(size_t a(0); a < pStroke->size(); a++)
+{
+aDashArray[a] = Gdiplus::REAL((*pStroke)[a] * fFactor);
+}
+}
+if (eLineCap == css::drawing::LineCap_ROUND)
+aPen.SetDashCap(Gdiplus::DashCapRound);
+else
+aPen.SetDashCap(Gdiplus::DashCapFlat); // "square" doesn't exist 
in Gdiplus
 aPen.SetDashOffset(Gdiplus::REAL(0.0));
 aPen.SetDashPattern(aDashArray.data(), aDashArray.size());
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: how does arithmetic exactly work in Calc?

2020-12-03 Thread Regina Henschel

Hi Michel,

for example look for ScAdd in
https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr5.cxx
and for the rtl::math things in
https://opengrok.libreoffice.org/xref/core/include/rtl/math.hxx

Kind regards
Regina

Michel Onoff schrieb am 03-Dec-20 um 13:48:

Hi,

I would like to understand how simple arithmetic (+ - * /) works in Calc.
I kind of guess that the underlying internal number representation is
IEEE 754 double (64 bit).
I also guess that when a double is shown on the sheet it is approximated
by a decimal with at most 15 significand digits.

To reproduce the behavior below, use scientific notation with 20 digits
or more.

I have two slightly different number x and x'.
x is 2^-49 (a formula) while x' is 1.77635683940025E-15 (a literal).
Their decimal representation appear equal on the sheet, but they are,
indeed, slightly different internally. You can set them apart as follows:

y = x - 1.7763568394002E-15
y' = x' - 1.7763568394002E-15

that is, by subtracting the same number from x and x'.
y and y' appear differently on the sheet, meaning that x and x' are
different internally to start with.

However, x - x' is exactly 0. In IEEE 754 arithmetic, two numbers are
equal if and only if their difference is 0. That would mean that x and
x' are equal, which they are not from the above.

So, what is the exact model for Calc's arithmetic?
Which calculations are performed exactly on fundamental arithmetic
operations?

Thanks
Michel
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/qa sc/source

2020-12-03 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/ManualColWidthRowHeight.ods |binary
 sc/qa/unit/scshapetest.cxx  |  121 
 sc/source/core/data/drwlayer.cxx|   22 ++--
 3 files changed, 135 insertions(+), 8 deletions(-)

New commits:
commit 9706790b1e4d34d0fac5eb10a51770f9d62f802c
Author: Regina Henschel 
AuthorDate: Tue Dec 1 00:05:43 2020 +0100
Commit: Xisco Fauli 
CommitDate: Thu Dec 3 10:18:06 2020 +0100

tdf#137576 Improve cell anchored measure line in Calc

Measure lines do not always have a logic rectangle. It might be empty
or the 1cm x 1cm default square. But Calc needs it to calculate
NonRotatedAnchor. The latter is needed for cell anchored shapes when
saving in ODF. Always generating a logic rectangle in class
SdrMeasureObj is difficult (I got crashes in Draw) and not necessary.
Calc now forces the calculation of the logic rectangle where it is
needed by Calc.

Change-Id: I8689bc95985db1619eb5e72df99901bd52086cb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106990
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107131

diff --git a/sc/qa/unit/data/ods/ManualColWidthRowHeight.ods 
b/sc/qa/unit/data/ods/ManualColWidthRowHeight.ods
new file mode 100644
index ..1cc738e05244
Binary files /dev/null and b/sc/qa/unit/data/ods/ManualColWidthRowHeight.ods 
differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 9362d3d76a87..4458c71e1d2f 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -16,10 +16,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -38,6 +40,8 @@ public:
 ScShapeTest();
 void saveAndReload(css::uno::Reference& xComponent,
const OUString& rFilter);
+void testTdf137576_LogicRectInDefaultMeasureline();
+void testTdf137576_LogicRectInNewMeasureline();
 void testMeasurelineHideColSave();
 void testHideColsShow();
 void testTdf138138_MoveCellWithRotatedShape();
@@ -49,6 +53,8 @@ public:
 void testCustomShapeCellAnchoredRotatedShape();
 
 CPPUNIT_TEST_SUITE(ScShapeTest);
+CPPUNIT_TEST(testTdf137576_LogicRectInDefaultMeasureline);
+CPPUNIT_TEST(testTdf137576_LogicRectInNewMeasureline);
 CPPUNIT_TEST(testMeasurelineHideColSave);
 CPPUNIT_TEST(testHideColsShow);
 CPPUNIT_TEST(testTdf138138_MoveCellWithRotatedShape);
@@ -124,6 +130,121 @@ static void lcl_AssertPointEqualWithTolerance(const 
OString& sInfo, const Point
 CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), std::abs(rExpected.Y() - 
rActual.Y()) <= nTolerance);
 }
 
+void ScShapeTest::testTdf137576_LogicRectInDefaultMeasureline()
+{
+// Error was, that the empty logical rectangle of a default measure line 
(Ctrl+Click)
+// resulted in zeros in NonRotatedAnchor and a wrong position when 
reloading.
+
+// Load an empty document.
+OUString aFileURL;
+createFileURL("ManualColWidthRowHeight.ods", aFileURL);
+uno::Reference xComponent = 
loadFromDesktop(aFileURL);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get ScDocShell
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT_MESSAGE("No ScDocShell", pDocSh);
+
+// Create default measureline by SfxRequest that corresponds to Ctrl+Click
+ScTabViewShell* pTabViewShell = pDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT_MESSAGE("No ScTabViewShell", pTabViewShell);
+SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_MEASURELINE);
+aReq.SetModifier(KEY_MOD1); // Ctrl
+pTabViewShell->ExecDraw(aReq);
+
+// Get document and newly created measure line.
+ScDocument& rDoc = pDocSh->GetDocument();
+ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+CPPUNIT_ASSERT_MESSAGE("No ScDrawLayer", pDrawLayer);
+const SdrPage* pPage = pDrawLayer->GetPage(0);
+CPPUNIT_ASSERT_MESSAGE("No draw page", pPage);
+SdrObject* pObj = pPage->GetObj(0);
+CPPUNIT_ASSERT_MESSAGE("No object found", pObj);
+
+// Anchor "to Cell (resize with cell)"
+ScDrawLayer::SetCellAnchoredFromPosition(*pObj, rDoc, 0 /*SCTAB*/, true 
/*bResizeWithCell*/);
+// Deselect shape and switch to object selection type "Cell".
+pTabViewShell->SetDrawShell(false);
+
+// Hide column A.
+uno::Sequence aPropertyValues = {
+comphelper::makePropertyValue("ToPoint", OUString("$A$1")),
+};
+dispatchCommand(xComponent, ".uno:GoToCell", aPropertyValues);
+dispatchCommand(xComponent, ".uno:Hid

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

2020-12-02 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/ManualColWidthRowHeight.ods |binary
 sc/qa/unit/scshapetest.cxx  |  121 
 sc/source/core/data/drwlayer.cxx|   22 ++--
 3 files changed, 135 insertions(+), 8 deletions(-)

New commits:
commit d0921aa753c43600272865602df3c7c2a8f13196
Author: Regina Henschel 
AuthorDate: Tue Dec 1 00:05:43 2020 +0100
Commit: Regina Henschel 
CommitDate: Wed Dec 2 19:06:43 2020 +0100

tdf#137576 Improve cell anchored measure line in Calc

Measure lines do not always have a logic rectangle. It might be empty
or the 1cm x 1cm default square. But Calc needs it to calculate
NonRotatedAnchor. The latter is needed for cell anchored shapes when
saving in ODF. Always generating a logic rectangle in class
SdrMeasureObj is difficult (I got crashes in Draw) and not necessary.
Calc now forces the calculation of the logic rectangle where it is
needed by Calc.

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

diff --git a/sc/qa/unit/data/ods/ManualColWidthRowHeight.ods 
b/sc/qa/unit/data/ods/ManualColWidthRowHeight.ods
new file mode 100644
index ..1cc738e05244
Binary files /dev/null and b/sc/qa/unit/data/ods/ManualColWidthRowHeight.ods 
differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 236cbc0879b4..c13ec7189622 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -13,10 +13,12 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -35,6 +37,8 @@ public:
 ScShapeTest();
 void saveAndReload(css::uno::Reference& xComponent,
const OUString& rFilter);
+void testTdf137576_LogicRectInDefaultMeasureline();
+void testTdf137576_LogicRectInNewMeasureline();
 void testMeasurelineHideColSave();
 void testHideColsShow();
 void testTdf138138_MoveCellWithRotatedShape();
@@ -46,6 +50,8 @@ public:
 void testCustomShapeCellAnchoredRotatedShape();
 
 CPPUNIT_TEST_SUITE(ScShapeTest);
+CPPUNIT_TEST(testTdf137576_LogicRectInDefaultMeasureline);
+CPPUNIT_TEST(testTdf137576_LogicRectInNewMeasureline);
 CPPUNIT_TEST(testMeasurelineHideColSave);
 CPPUNIT_TEST(testHideColsShow);
 CPPUNIT_TEST(testTdf138138_MoveCellWithRotatedShape);
@@ -121,6 +127,121 @@ static void lcl_AssertPointEqualWithTolerance(const 
OString& sInfo, const Point
 CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), std::abs(rExpected.Y() - 
rActual.Y()) <= nTolerance);
 }
 
+void ScShapeTest::testTdf137576_LogicRectInDefaultMeasureline()
+{
+// Error was, that the empty logical rectangle of a default measure line 
(Ctrl+Click)
+// resulted in zeros in NonRotatedAnchor and a wrong position when 
reloading.
+
+// Load an empty document.
+OUString aFileURL;
+createFileURL("ManualColWidthRowHeight.ods", aFileURL);
+uno::Reference xComponent = 
loadFromDesktop(aFileURL);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get ScDocShell
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT_MESSAGE("No ScDocShell", pDocSh);
+
+// Create default measureline by SfxRequest that corresponds to Ctrl+Click
+ScTabViewShell* pTabViewShell = pDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT_MESSAGE("No ScTabViewShell", pTabViewShell);
+SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_MEASURELINE);
+aReq.SetModifier(KEY_MOD1); // Ctrl
+pTabViewShell->ExecDraw(aReq);
+
+// Get document and newly created measure line.
+ScDocument& rDoc = pDocSh->GetDocument();
+ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+CPPUNIT_ASSERT_MESSAGE("No ScDrawLayer", pDrawLayer);
+const SdrPage* pPage = pDrawLayer->GetPage(0);
+CPPUNIT_ASSERT_MESSAGE("No draw page", pPage);
+SdrObject* pObj = pPage->GetObj(0);
+CPPUNIT_ASSERT_MESSAGE("No object found", pObj);
+
+// Anchor "to Cell (resize with cell)"
+ScDrawLayer::SetCellAnchoredFromPosition(*pObj, rDoc, 0 /*SCTAB*/, true 
/*bResizeWithCell*/);
+// Deselect shape and switch to object selection type "Cell".
+pTabViewShell->SetDrawShell(false);
+
+// Hide column A.
+uno::Sequence aPropertyValues = {
+comphelper::makePropertyValue("ToPoint", OUString("$A$1")),
+};
+dispatchCommand(xComponent, ".uno:GoToCell", aPropertyValues);
+dispatchCommand(xComponent, ".uno:HideColumn", {});
+
+// Get current position. I will not use absolute values for compar

Re: Trouble with SdrMeasureObj (dimension line)

2020-12-01 Thread Regina Henschel

Hi Miklos, hi all,

Regina Henschel schrieb am 20-Nov-20 um 11:46:

Hi Miklos,

Miklos Vajna schrieb am 19-Nov-20 um 09:22:

Hi Regina,

On Wed, Nov 18, 2020 at 11:56:01PM +0100, Regina Henschel 
 wrote:
Do you know examples for unit tests with "drag create" and for unit 
tests

with "create default objects"?


I'm not sure we have such tests. But it does not seem too problematic to
create one. Here is how I would start:


Good tip! I see use of a dispatcher in the call stack. That looks 
promising.


The approach with dispatcher did not work. But after some days and 
several failed attempts I found a solution to create the default measure 
line:


   ScTabViewShell* pTabViewShell = pDocSh->GetBestViewShell(false);
   SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_MEASURELINE);
   aReq.SetModifier(8192); // Ctrl
   pTabViewShell->ExecDraw(aReq);

I had seen the magic number "8192" in uitest 
sw/qa/uitest/writer_tests7/tdf130629.py and in Visual Studio. There 
might be a "speaking" define, I don't know.


The shape is inserted and selected, so that you can manipulate it, 
changing the anchor for example. When you want to work on the sheet 
itself, hiding a column for example, you have to deactivate draw shell. 
That can be done with

   pTabViewShell->SetDrawShell(false);

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: FastSaxParser ans XFastParser

2020-11-26 Thread Regina Henschel

Dante Doménech schrieb am 26-Nov-20 um 23:37:

Hello.
I'm sorry for asking stuff like this, but I'm not a full fledged 
developer and stuff like this is quite hard for me.


Starmath mathml is supposed to use FastSaxParser (or I understand that). 
At least changes on FastSaxParserImpl will have repercussions on it. 
However, on mathmlimport.cxx we do use XFastParser. However 
FastSaxParser is a child class of XFastParser, so changes on it should 
not have repercussions on it's parent.


So, what are we actually doing? And how has this stuff to be treated?
Or at least some kind of documentation emplaining which kind of process 
are we using.


If you try to copy paste the code outside to do some customized parser, 
it will break. There is that #*include*  
 
which there is nowhere to be found (opengrok also fails in looking for 
it). There is no such file inside the only libxml directory to be found 
and the others files with that name don't seem to be related by the 
stuff that breaks when removed: xmlEntity, xmlEntityPtr, xmlChar, ... 
xml basic definitions.


So, does anyone know which file is it?
The library libxml2 belongs to the externals. The source was downloaded, 
when you first build LibreOffice to the place which you have specified 
in an autogen parameter. For me it is

--with-external-tar=/cygdrive/d/Build_forCommit/externalsrc

The downloaded file is then unpacked to
workdir/UnpackedTarball/libxml2. That has some documentation. Besides 
that you find infos on the project site http://www.xmlsoft.org/


"workdir" exists only in your build, not in Opengrok.

BTW, "workdir" contains some other interesting information, e.g. the 
relationship between numbers (as seen in Visual Studio) and tokens or 
properties for module oox in workdir/CustomTarget/oox/generated\oox/token/


core/external/libxml2/ contains only makefile and some patches.


I'm neither familiar with module starmath nor sax parser, but as far as 
I know, starmath currently does not use character entities at all. So 
you are entering new territory, so to speak.


The API has an interface XDTDHandler in com::sun::star::xml::sax with 
the methods "notationDecl" and "unparsedEntityDecl". An OpenGrok search 
leads to /core/sax/source/expatwrap/sax_expat.cxx. So it seems you need 
to implement a class which supports this interface. But I'm still a 
novice in many aspects and it would be better a professional developer 
gives you ideas for further steps.


Kind regards
Regina





___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Mathml XMLReader (starmath module)

2020-11-23 Thread Regina Henschel

Hi Dante,

Dante Doménech schrieb am 22-Nov-20 um 15:27:

Hello. I'm trying to add support for  in mathml.
The reason why actually isn't supported is because mathml is being 
loaded as XML. It is similar, but it isn't. That is why when XmlReader 
finds a mathml particular , it will throw an exception at 
XmlReader::handleReference. However mathml specifics can not be added, 
since they're not part of the XML standard.


Can you point me, to where XmlReader is used in MathML import? I thought 
MathML is imported with FastParser, module sax.


Kind regards
Regina






___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Trouble with SdrMeasureObj (dimension line)

2020-11-20 Thread Regina Henschel

Hi Miklos,

Miklos Vajna schrieb am 19-Nov-20 um 09:22:

Hi Regina,

On Wed, Nov 18, 2020 at 11:56:01PM +0100, Regina Henschel 
 wrote:

Do you know examples for unit tests with "drag create" and for unit tests
with "create default objects"?


I'm not sure we have such tests. But it does not seem too problematic to
create one. Here is how I would start:

I think the CreateDefaultObject() call in
sd::DrawViewShell::FuPermanent() it the place where such default objects
are created in the Draw/Impress case.

You could put a breakpoint there and see how it's called, what higher
level API is there that could you call from cppunit. E.g. SdrView has
SdrDragView::BegDragObj() and SdrDragView::EndDragObj(), possibly those
could be used for this purpose.


Good tip! I see use of a dispatcher in the call stack. That looks promising.

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2020-11-20 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/measurelineHideColSave.ods |binary
 sc/qa/unit/scshapetest.cxx |   74 +
 sc/source/filter/xml/xmlexprt.cxx  |   28 -
 3 files changed, 87 insertions(+), 15 deletions(-)

New commits:
commit bba0cd79984875124f8d43d05d4cdb7f63517e77
Author: Regina Henschel 
AuthorDate: Thu Nov 19 21:16:33 2020 +0100
Commit: Regina Henschel 
CommitDate: Fri Nov 20 10:17:17 2020 +0100

Replace matrix translate with object Move

TR*BaseGeometry is faulty for SdrMeasureObj, fixing these methods is a
larger effort and Move is simpler anyway. So I replace the translation
using matrices with the Move methods for objects. Backup and restore
of the geometry values in state HiddenAsZero is now done with
SdrObjGeoData. That is known to work from use in Undo methods.

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

diff --git a/sc/qa/unit/data/ods/measurelineHideColSave.ods 
b/sc/qa/unit/data/ods/measurelineHideColSave.ods
new file mode 100644
index ..0cca41897e7a
Binary files /dev/null and b/sc/qa/unit/data/ods/measurelineHideColSave.ods 
differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index c8753cb99aa9..5ecd4eef9068 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -37,6 +38,7 @@ public:
 ScShapeTest();
 void saveAndReload(css::uno::Reference& xComponent,
const OUString& rFilter);
+void testMeasurelineHideColSave();
 void testHideColsShow();
 void testTdf138138_MoveCellWithRotatedShape();
 void testLoadVerticalFlip();
@@ -47,6 +49,7 @@ public:
 void testCustomShapeCellAnchoredRotatedShape();
 
 CPPUNIT_TEST_SUITE(ScShapeTest);
+CPPUNIT_TEST(testMeasurelineHideColSave);
 CPPUNIT_TEST(testHideColsShow);
 CPPUNIT_TEST(testTdf138138_MoveCellWithRotatedShape);
 CPPUNIT_TEST(testLoadVerticalFlip);
@@ -108,6 +111,77 @@ static void lcl_AssertRectEqualWithTolerance(const 
OString& sInfo,
std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
 }
 
+static void lcl_AssertPointEqualWithTolerance(const OString& sInfo, const 
Point rExpected,
+  const Point rActual, const 
sal_Int32 nTolerance)
+{
+// X
+OString sMsg = sInfo + " X expected " + OString::number(rExpected.X()) + " 
actual "
+   + OString::number(rActual.X()) + " Tolerance " + 
OString::number(nTolerance);
+CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), std::abs(rExpected.X() - 
rActual.X()) <= nTolerance);
+// Y
+sMsg = sInfo + " Y expected " + OString::number(rExpected.Y()) + " actual "
+   + OString::number(rActual.Y()) + " Tolerance " + 
OString::number(nTolerance);
+CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), std::abs(rExpected.Y() - 
rActual.Y()) <= nTolerance);
+}
+
+void ScShapeTest::testMeasurelineHideColSave()
+{
+// The document contains a SdrMeasureObj anchored "To Cell (resive with 
cell)" with start in cell
+// D11 and end in cell I5. Error was, that after hiding col A and saving, 
start and end point
+// position were lost.
+OUString aFileURL;
+createFileURL("measurelineHideColSave.ods", aFileURL);
+uno::Reference xComponent = 
loadFromDesktop(aFileURL);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get the document model
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT(pDocSh);
+
+// Get document and shape
+ScDocument& rDoc = pDocSh->GetDocument();
+ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+CPPUNIT_ASSERT_MESSAGE("No ScDrawLayer", pDrawLayer);
+const SdrPage* pPage = pDrawLayer->GetPage(0);
+CPPUNIT_ASSERT_MESSAGE("No draw page", pPage);
+SdrObject* pObj = pPage->GetObj(0);
+CPPUNIT_ASSERT_MESSAGE("No object found", pObj);
+
+// Make sure loading is correct
+Point aStartPoint(7500, 15000); // according UI
+Point aEndPoint(17500, 8000);
+lcl_AssertPointEqualWithTolerance("Load start: ", aStartPoint, 
pObj->GetPoint(0), 1);
+lcl_AssertPointEqualWithTolerance("Load end: ", aEndPoint, 
pObj->GetPoint(1), 1);
+
+// Hide column A, save and reload
+rDoc.SetColHidden(0, 0, 0, true);
+saveAndReload(xComponent, "calc8");
+CPPUNIT_ASSERT(xComponent);
+
+// Get ScDocShell
+pFoundShell = SfxObjectS

Trouble with SdrMeasureObj (dimension line)

2020-11-18 Thread Regina Henschel

Hi all,

I have wondered why a SdrMeasureObj, which is anchored "to cell (resize 
with cell), does not work in Calc (e.g. tdf#137576).

Problems detected so far:

(A) TRGetBaseGeometry does not include a rotation angle. So a chain of 
TRGetBaseGeometry followed by TRSetBaseGeometry does not work. I'm going 
to change ScXMLExport::WriteShapes so that is does not use matrices. I 
think, a fix for TR*BaseGeometry is a larger effort.


(B) Neither "drag create", nor ctor, nor "create default" set maRect. 
Because SdrMeasureObj has no own NbcGetLogicRect it uses the inherited 
one from SdrTextObj, which simple results maRect. Thus Calc uses in some 
cases an empty rectangle, when it calculates NonRotatedAnchor. The 
latter is used when saving the document.


(C) Setting start or end point does not update maRect. The method 
includes SetRectsDirty(). A call to GetSnapRect() will then trigger 
RecalSnapRect(), but that does not affect maRect.


(D) Both NbcSetLogicRect and NbcSetSnapRect use the inherited one from 
SdrTextObj and therefor do not set start and end point. Fixing that 
looks like a larger effort to me too.


TakeUnrotatedSnapRect can calculate a logic rectangle of the current 
state of a SdrMeasureObj. I can add this to 
FuConstRectangle::CreateDefaultObject, which is responsible for a 
default SdrMeasureObj (used for accessibility), and to 
SdrMeasureObj::EndCreate. That will work for creating measure lines in 
the UI of Calc.


Implementing a SdrMeasureObj::GetLogicRect(), which recalculates maRect, 
is not possible because of const-ness.


Questions:
Should I add TakeUnrotatedSnapRect to other places too? Candidates are
ctor SdrMeasureObj::SdrMeasureObj(SdrModel& rSdrModel, const Point& 
rPt1, const Point& rPt2)

SdrMeasureObj::RecalcSnapRect()
SdrMeasureObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)

Do you know other places which need to be changed, or which are sensible 
and need testing?


Do you have better ideas?

Do you have a suggestion for the order, things to do?

Do you know examples for unit tests with "drag create" and for unit 
tests with "create default objects"?


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2020-11-15 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/hideColsShow.ods |binary
 sc/qa/unit/scshapetest.cxx   |   59 +++
 sc/source/ui/view/drawvie3.cxx   |   18 +-
 3 files changed, 75 insertions(+), 2 deletions(-)

New commits:
commit 670d10f2b06656973a61e956956b149bae01721f
Author: Regina Henschel 
AuthorDate: Fri Nov 13 18:29:20 2020 +0100
Commit: Regina Henschel 
CommitDate: Sun Nov 15 09:04:14 2020 +0100

Avoid changing anchor on visibility change of cell

This is an addition to commit 1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca
The following scenario had produced a wrong object size: The object is
anchored to cell. Some columns containing this cell were hidden and
then shown again.
ScDrawLayer::SetCellAnchoredFromPosition was called in this case and
had produced the wrong size. When the column of the object anchor is
shown, object becomes visible. This gives an 'object change' event,
sent to ScDrawView::Notify, which calls adjustAnchoredPosition. That
had a test pAnchor->getShapeRect() == pObj->GetSnapRect() that should
prevent calling SetCellAnchoredFromPosition. But exact equality fails
due to +-1 differencies because of Twips<->Hmm conversions.

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

diff --git a/sc/qa/unit/data/ods/hideColsShow.ods 
b/sc/qa/unit/data/ods/hideColsShow.ods
new file mode 100644
index ..acfea8f1ef98
Binary files /dev/null and b/sc/qa/unit/data/ods/hideColsShow.ods differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index d31a3ce03a1e..6eac2bc2b859 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -33,6 +33,7 @@ public:
 ScShapeTest();
 void saveAndReload(css::uno::Reference& xComponent,
const OUString& rFilter);
+void testHideColsShow();
 void testTdf138138_MoveCellWithRotatedShape();
 void testLoadVerticalFlip();
 void testTdf117948_CollapseBeforeShape();
@@ -42,6 +43,7 @@ public:
 void testCustomShapeCellAnchoredRotatedShape();
 
 CPPUNIT_TEST_SUITE(ScShapeTest);
+CPPUNIT_TEST(testHideColsShow);
 CPPUNIT_TEST(testTdf138138_MoveCellWithRotatedShape);
 CPPUNIT_TEST(testLoadVerticalFlip);
 CPPUNIT_TEST(testTdf117948_CollapseBeforeShape);
@@ -101,6 +103,63 @@ static void lcl_AssertRectEqualWithTolerance(const 
OString& sInfo,
labs(rExpected.GetHeight() - rActual.GetHeight()) 
<= nTolerance);
 }
 
+void ScShapeTest::testHideColsShow()
+{
+// The document contains a shape anchored "To Cell (resive with cell)" 
with starts in cell C3 and
+//ends in cell D5. Error was, that hiding cols C and D and then show them 
again extends the shape
+// to column E
+
+OUString aFileURL;
+createFileURL("hideColsShow.ods", aFileURL);
+uno::Reference xComponent = 
loadFromDesktop(aFileURL);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get the document model
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT(pDocSh);
+
+// Get document and shape
+ScDocument& rDoc = pDocSh->GetDocument();
+ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+CPPUNIT_ASSERT_MESSAGE("No ScDrawLayer", pDrawLayer);
+const SdrPage* pPage = pDrawLayer->GetPage(0);
+CPPUNIT_ASSERT_MESSAGE("No draw page", pPage);
+SdrObject* pObj = pPage->GetObj(0);
+CPPUNIT_ASSERT_MESSAGE("No object found", pObj);
+CPPUNIT_ASSERT_MESSAGE("Load: Object should be visible", 
pObj->IsVisible());
+tools::Rectangle aSnapRectOrig(pObj->GetSnapRect());
+
+// Hide cols C and D.
+uno::Sequence aPropertyValues = {
+comphelper::makePropertyValue("ToPoint", OUString("$C$1:$D$1")),
+};
+dispatchCommand(xComponent, ".uno:GoToCell", aPropertyValues);
+
+ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT_MESSAGE("No ScTabViewShell", pViewShell);
+pViewShell->GetViewData().GetDispatcher().Execute(FID_COL_HIDE);
+
+// Check object is invisible
+CPPUNIT_ASSERT_MESSAGE("Hide: Object should be invisible", 
!pObj->IsVisible());
+
+// Show cols C and D
+aPropertyValues = {
+comphelper::makePropertyValue("ToPoint", OUString("$C$1:$D$1")),
+};
+dispatchCommand(xComponent, ".uno:GoToCell", aPropertyValues);
+pViewShell->GetViewData().GetDispatcher().Execute(FID_COL_SHOW);
+
+// Check object is visible and has old size
+CPPUNIT_ASSERT_MESSAGE(

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

2020-11-13 Thread Regina Henschel (via logerrit)
 sc/qa/unit/subsequent_filters-test.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6532bdc0a27eb31dcacf02e3bb1a587270a48b6f
Author: Regina Henschel 
AuthorDate: Fri Nov 13 01:15:04 2020 +0100
Commit: Mike Kaganski 
CommitDate: Fri Nov 13 11:15:51 2020 +0100

Force number constants to tools::Long in asserts

Change-Id: I404b0edb31fb4eb797baf814136b00fd605724eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105775
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 891cc326b907..229d0b3df8fa 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -1069,7 +1069,7 @@ void ScFiltersTest::testBorderODS()
 
 CPPUNIT_ASSERT(pRight);
 CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, 
pRight->GetBorderLineStyle());
-CPPUNIT_ASSERT_EQUAL(20L, pRight->GetWidth());
+CPPUNIT_ASSERT_EQUAL(tools::Long(20), pRight->GetWidth());
 
 rDoc.GetBorderLines( 2, 8, 0, , , ,  );
 
@@ -1078,7 +1078,7 @@ void ScFiltersTest::testBorderODS()
 CPPUNIT_ASSERT(pBottom);
 CPPUNIT_ASSERT(pRight);
 CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, 
pRight->GetBorderLineStyle());
-CPPUNIT_ASSERT_EQUAL(5L, pRight->GetWidth());
+CPPUNIT_ASSERT_EQUAL(tools::Long(5), pRight->GetWidth());
 CPPUNIT_ASSERT_EQUAL(COL_BLUE, pRight->GetColor());
 
 xDocSh->DoClose();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


make sc.check fails in subsequent_filters-test in ScFiltersTest::testPreviewMissingObjLink()

2020-11-12 Thread Regina Henschel

Hi all,

A "make sc.check" fails for me in current master in 
subsequent_filters-test in ScFiltersTest::testPreviewMissingObjLink()


Line:
CPPUNIT_ASSERT_MESSAGE("the ole object links to a missing file, but we 
should retain its preview", pGraphic);


Some days ago, it had not failed.

I use Window10 with Cygwin and VS 2019.

Kind regards
Regina



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Problem with /core/sc/qa/unit/helper/qahelper.cxx

2020-11-12 Thread Regina Henschel

Hi Stephan,

Stephan Bergmann schrieb am 12-Nov-20 um 21:34:
[..]

The line #192 is
 CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", 200l, 
aFont.GetFontSize().getHeight());


that "200l" needs to be "tools::Long(200)" now; not sure why that hasn't 
been fixed yet, please go ahead and send to Gerrit (if it actually 
works, which it should :)


Yes, "make sc.check" compiles after forcing tools::Long.

https://gerrit.libreoffice.org/c/core/+/105775

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Problem with /core/sc/qa/unit/helper/qahelper.cxx

2020-11-12 Thread Regina Henschel

Hi all,

with current master and make sc.check I get the error

D:/Build_forCommit/core/sc/qa/unit/helper/qahelper.cxx(192): error 
C2672: 'CppUnit::assertEquals': no matching overloade

d function found
D:/Build_forCommit/core/sc/qa/unit/helper/qahelper.cxx(192): error 
C2782: 'void CppUnit::assertEquals(const T &,const T
&,CppUnit::SourceLine,const std::string &)': template parameter 'T' is 
ambiguous
D:\build_forCommit\core\workdir\UnpackedTarball\cppunit\include\cppunit/TestAssert.h(161): 
note: see declaration of 'Cpp

Unit::assertEquals'
D:/Build_forCommit/core/sc/qa/unit/helper/qahelper.cxx(192): note: could 
be 'tools::Long'
D:/Build_forCommit/core/sc/qa/unit/helper/qahelper.cxx(192): note: or 
   'long'
D:/Build_forCommit/core/sc/qa/unit/helper/qahelper.cxx(192): error 
C2784: 'void CppUnit::assertEquals(const T &,const T
&,CppUnit::SourceLine,const std::string &)': could not deduce template 
argument for 'const T &' from 'tools::Long'
D:\build_forCommit\core\workdir\UnpackedTarball\cppunit\include\cppunit/TestAssert.h(161): 
note: see declaration of 'Cpp

Unit::assertEquals'

The line #192 is
CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", 200l, 
aFont.GetFontSize().getHeight());


Same problems in /sc/qa/unit/ucalc_pivottable.cxx. I have not tested 
further. Do I need to make a "clean" build or what else?


Kind regards
Regina

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2020-11-12 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/tdf138138_MoveCellWithRotatedShape.ods |binary
 sc/qa/unit/scshapetest.cxx |   71 +
 sc/source/core/data/drwlayer.cxx   |6 -
 3 files changed, 75 insertions(+), 2 deletions(-)

New commits:
commit 3238606c8470f3eaeada3fc601e186ec5cfac925
Author: Regina Henschel 
AuthorDate: Wed Nov 11 21:06:26 2020 +0100
Commit: Regina Henschel 
CommitDate: Thu Nov 12 13:41:38 2020 +0100

tdf138138 Apply shape shift also to NoRotatedAnchor

The 'normal' anchor (as on screen) is connected to the snap rectangle,
the NoRotatedAnchor is connected to the logic rectangle. They differ,
if the shape is transformed, e.g. rotated. Error was, that values of
the 'normal' anchor were applied to NoRotatedAnchor instead of
calculating the shift of NoRotatedAnchor independently. The error
becomes only visible on save, because there the NoRotatedAnchor is
used. Effected shape types are legacy shapes, text boxes and
transformable OLEs.
I have not tested, whether this fix would work for LO 7.0 too.

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

diff --git a/sc/qa/unit/data/ods/tdf138138_MoveCellWithRotatedShape.ods 
b/sc/qa/unit/data/ods/tdf138138_MoveCellWithRotatedShape.ods
new file mode 100644
index ..352d59180600
Binary files /dev/null and 
b/sc/qa/unit/data/ods/tdf138138_MoveCellWithRotatedShape.ods differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index b04db32a6599..d31a3ce03a1e 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -33,6 +33,7 @@ public:
 ScShapeTest();
 void saveAndReload(css::uno::Reference& xComponent,
const OUString& rFilter);
+void testTdf138138_MoveCellWithRotatedShape();
 void testLoadVerticalFlip();
 void testTdf117948_CollapseBeforeShape();
 void testTdf137355_UndoHideRows();
@@ -41,6 +42,7 @@ public:
 void testCustomShapeCellAnchoredRotatedShape();
 
 CPPUNIT_TEST_SUITE(ScShapeTest);
+CPPUNIT_TEST(testTdf138138_MoveCellWithRotatedShape);
 CPPUNIT_TEST(testLoadVerticalFlip);
 CPPUNIT_TEST(testTdf117948_CollapseBeforeShape);
 CPPUNIT_TEST(testTdf137355_UndoHideRows);
@@ -99,6 +101,75 @@ static void lcl_AssertRectEqualWithTolerance(const OString& 
sInfo,
labs(rExpected.GetHeight() - rActual.GetHeight()) 
<= nTolerance);
 }
 
+void ScShapeTest::testTdf138138_MoveCellWithRotatedShape()
+{
+// The document contains a 90deg rotated, cell-anchored rectangle in 
column D. Insert 2 columns
+// after column B, save and reload. The shape was not correctly moved to 
column F.
+OUString aFileURL;
+createFileURL("tdf138138_MoveCellWithRotatedShape.ods", aFileURL);
+uno::Reference xComponent = 
loadFromDesktop(aFileURL);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get ScDocShell
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT(pDocSh);
+
+// Get document and object
+ScDocument& rDoc = pDocSh->GetDocument();
+ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+CPPUNIT_ASSERT_MESSAGE("Load: No ScDrawLayer", pDrawLayer);
+const SdrPage* pPage = pDrawLayer->GetPage(0);
+CPPUNIT_ASSERT_MESSAGE("Load: No draw page", pPage);
+SdrObject* pObj = pPage->GetObj(0);
+CPPUNIT_ASSERT_MESSAGE("Load: custom shape not found", pObj);
+
+// Check anchor and position of shape. The expected values are taken from 
UI.
+tools::Rectangle aSnapRect = pObj->GetSnapRect();
+tools::Rectangle aExpectedRect(Point(1, 3000), Size(1000, 7500));
+lcl_AssertRectEqualWithTolerance("Load original: ", aExpectedRect, 
aSnapRect, 1);
+
+// Insert two columns after column B
+uno::Sequence aPropertyValues = {
+comphelper::makePropertyValue("ToPoint", OUString("$A$1:$B$1")),
+};
+dispatchCommand(xComponent, ".uno:GoToCell", aPropertyValues);
+ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT_MESSAGE("No ScTabViewShell", pViewShell);
+pViewShell->GetViewData().GetDispatcher().Execute(FID_INS_COLUMNS_AFTER);
+aExpectedRect = tools::Rectangle(Point(16000, 3000), Size(1000, 7500)); // 
col width 3000
+aSnapRect = pObj->GetSnapRect();
+lcl_AssertRectEqualWithTolerance("Shift: Wrong after insert of columns ", 
aExpectedRect,
+ aSnapRect, 1);
+
+// Save and reload
+saveAndReload(xComponent, "calc8");
+  

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

2020-11-10 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/loadVerticalFlip.ods |binary
 sc/qa/unit/scshapetest.cxx   |   30 ++
 sc/source/core/data/drwlayer.cxx |5 +++--
 3 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit 122d1e391625ca21345c67c90720e971819aa4a6
Author: Regina Henschel 
AuthorDate: Tue Nov 10 23:37:20 2020 +0100
Commit: Regina Henschel 
CommitDate: Wed Nov 11 00:20:07 2020 +0100

Correction to improve 'resize with cell'

Error: A vertical flipped shape lost flip on loading. The error slipped
in, when I have implemented the suggestions from Jan-Marek. The object
is vertical flipped, to have no flip for calculating the full sized
logical rectangle. Therefore the second call to method
lcl_NeedsMirrorYCorrection gives wrong result 'false'. I need to
remember the result of the first call.

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

diff --git a/sc/qa/unit/data/ods/loadVerticalFlip.ods 
b/sc/qa/unit/data/ods/loadVerticalFlip.ods
new file mode 100644
index ..e18809cef2ac
Binary files /dev/null and b/sc/qa/unit/data/ods/loadVerticalFlip.ods differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index d2c8cc946296..279c9be43eda 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -33,6 +33,7 @@ public:
 ScShapeTest();
 void saveAndReload(css::uno::Reference& xComponent,
const OUString& rFilter);
+void testLoadVerticalFlip();
 void testTdf117948_CollapseBeforeShape();
 void testTdf137355_UndoHideRows();
 void testTdf115655_HideDetail();
@@ -40,6 +41,7 @@ public:
 void testCustomShapeCellAnchoredRotatedShape();
 
 CPPUNIT_TEST_SUITE(ScShapeTest);
+CPPUNIT_TEST(testLoadVerticalFlip);
 CPPUNIT_TEST(testTdf117948_CollapseBeforeShape);
 CPPUNIT_TEST(testTdf137355_UndoHideRows);
 CPPUNIT_TEST(testTdf115655_HideDetail);
@@ -97,6 +99,34 @@ static void lcl_AssertRectEqualWithTolerance(const OString& 
sInfo,
labs(rExpected.GetHeight() - rActual.GetHeight()) 
<= nTolerance);
 }
 
+void ScShapeTest::testLoadVerticalFlip()
+{
+// The document has a cell anchored custom shape with vertical flip. Error 
was, that the
+// flip was lost on loading.
+OUString aFileURL;
+createFileURL("loadVerticalFlip.ods", aFileURL);
+uno::Reference xComponent = 
loadFromDesktop(aFileURL);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get the document model
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT(pDocSh);
+
+// Get the shape and check that it is flipped
+ScDocument& rDoc = pDocSh->GetDocument();
+ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+CPPUNIT_ASSERT(pDrawLayer);
+const SdrPage* pPage = pDrawLayer->GetPage(0);
+CPPUNIT_ASSERT(pPage);
+SdrObjCustomShape* pObj = 
dynamic_cast(pPage->GetObj(0));
+CPPUNIT_ASSERT(pObj);
+CPPUNIT_ASSERT_MESSAGE("Load: Object should be vertically flipped", 
pObj->IsMirroredY());
+
+pDocSh->DoClose();
+}
+
 void ScShapeTest::testTdf117948_CollapseBeforeShape()
 {
 // The document contains a column group left from the image. The group is 
exanded. Collapse the
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index a9e177f01567..88335082c41f 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -673,7 +673,8 @@ void lcl_SetLogicRectFromAnchor(SdrObject* pObj, 
ScDrawObjData& rAnchor, ScDocum
 // set the logic rectangle, and apply flip again. You cannot simple use a 
180deg-rotated
 // rectangle, because custom shape mirroring is internally applied after 
the other
 // transformations.
-if (lcl_NeedsMirrorYCorrection(pObj))
+const bool bNeedsMirrorYCorrection = lcl_NeedsMirrorYCorrection(pObj); // 
remember state
+if (bNeedsMirrorYCorrection)
 {
 const tools::Rectangle aRect(pObj->GetSnapRect());
 const Point aLeft(aRect.Left(), (aRect.Top() + aRect.Bottom()) >> 1);
@@ -703,7 +704,7 @@ void lcl_SetLogicRectFromAnchor(SdrObject* pObj, 
ScDrawObjData& rAnchor, ScDocum
 pObj->NbcSetLogicRect(lcl_makeSafeRectangle(aNewRectangle));
 
 // The shape has the correct logical rectangle now. Reapply the above 
removed mirroring.
-if (lcl_NeedsMirrorYCorrection(pObj))
+if (bNeedsMirrorYCorrection)
 {
 const tools::Rectangle aRect(pObj->GetSnapRect());
 const Point aLeft(aRect.Left(), (aRect.Top() + aRect.Bottom()) >> 1);
_

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

2020-11-10 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/tdf117948_CollapseBeforeShape.ods |binary
 sc/qa/unit/scshapetest.cxx|   80 +-
 sc/source/filter/xml/xmlexprt.cxx |   49 +--
 3 files changed, 120 insertions(+), 9 deletions(-)

New commits:
commit 1cb6bb9576871ff5d56c9810ff1791abc3dd64fd
Author: Regina Henschel 
AuthorDate: Sat Nov 7 01:08:53 2020 +0100
Commit: Regina Henschel 
CommitDate: Tue Nov 10 12:12:43 2020 +0100

tdf#117948 Do not treat hidden rows as zero in ODF export

The object geometry in ODF file format has values so as if no hidden
columns or rows exists. But for rendering the object geometry has to
treat hidden rows and columns as zero. This patch changes the object
geometry temporarily to the 'no hidden columns and rows' mode for
export and restores the original geometry afterwards.
The patch considers hidden columns left from the shape and hidden rows
above the shape. So the object is shifted. Considering hidden columns
or rows in the area, which is covered by the shape, is still missing.
That would possibly require scaling.

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

diff --git a/sc/qa/unit/data/ods/tdf117948_CollapseBeforeShape.ods 
b/sc/qa/unit/data/ods/tdf117948_CollapseBeforeShape.ods
new file mode 100644
index ..bbc1af87cf07
Binary files /dev/null and 
b/sc/qa/unit/data/ods/tdf117948_CollapseBeforeShape.ods differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 49bad113610e..d2c8cc946296 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -33,13 +33,14 @@ public:
 ScShapeTest();
 void saveAndReload(css::uno::Reference& xComponent,
const OUString& rFilter);
-
+void testTdf117948_CollapseBeforeShape();
 void testTdf137355_UndoHideRows();
 void testTdf115655_HideDetail();
 void testFitToCellSize();
 void testCustomShapeCellAnchoredRotatedShape();
 
 CPPUNIT_TEST_SUITE(ScShapeTest);
+CPPUNIT_TEST(testTdf117948_CollapseBeforeShape);
 CPPUNIT_TEST(testTdf137355_UndoHideRows);
 CPPUNIT_TEST(testTdf115655_HideDetail);
 CPPUNIT_TEST(testFitToCellSize);
@@ -96,6 +97,83 @@ static void lcl_AssertRectEqualWithTolerance(const OString& 
sInfo,
labs(rExpected.GetHeight() - rActual.GetHeight()) 
<= nTolerance);
 }
 
+void ScShapeTest::testTdf117948_CollapseBeforeShape()
+{
+// The document contains a column group left from the image. The group is 
exanded. Collapse the
+// group, save and reload. The original error was, that the line was on 
wrong position after reload.
+// After the fix for 'resive with cell', the custom shape had wrong 
position and size too.
+OUString aFileURL;
+createFileURL("tdf117948_CollapseBeforeShape.ods", aFileURL);
+uno::Reference xComponent = 
loadFromDesktop(aFileURL);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get ScDocShell
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT(pDocSh);
+
+// Get document and objects
+ScDocument& rDoc = pDocSh->GetDocument();
+ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+CPPUNIT_ASSERT_MESSAGE("Load: No ScDrawLayer", pDrawLayer);
+const SdrPage* pPage = pDrawLayer->GetPage(0);
+CPPUNIT_ASSERT_MESSAGE("Load: No draw page", pPage);
+SdrObject* pObj0 = pPage->GetObj(0);
+CPPUNIT_ASSERT_MESSAGE("Load: custom shape not found", pObj0);
+SdrObject* pObj1 = pPage->GetObj(1);
+CPPUNIT_ASSERT_MESSAGE("Load: Vertical line not found", pObj1);
+
+// Collapse the group
+ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT_MESSAGE("Load: No ScTabViewShell", pViewShell);
+pViewShell->GetViewData().SetCurX(1);
+pViewShell->GetViewData().SetCurY(0);
+pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_HIDE);
+
+// Check anchor and position of shape. The expected values are taken from 
UI before saving.
+tools::Rectangle aSnapRect0Collapse = pObj0->GetSnapRect();
+tools::Rectangle aExpectedRect0(Point(4672, 1334), Size(1787, 1723));
+lcl_AssertRectEqualWithTolerance("Collapse: Custom shape", aExpectedRect0, 
aSnapRect0Collapse,
+ 1);
+tools::Rectangle aSnapRect1Collapse = pObj1->GetSnapRect();
+tools::Rectangle aExpectedRect1(Point(5647, 4172), Size(21, 3441));
+lcl_AssertRectEqualWithTolerance("Collape: Line", aExpectedRect1, 
aSnapRect1Collapse, 1);
+

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

2020-11-04 Thread Regina Henschel (via logerrit)
 sc/qa/unit/bugfix-test.cxx|  216 +-
 sc/qa/unit/data/ods/tdf115655_HideDetail.ods  |binary
 sc/qa/unit/data/ods/tdf137020_FlipVertical.ods|binary
 sc/qa/unit/data/ods/tdf137044_CoverHiddenRows.ods |binary
 sc/qa/unit/data/ods/tdf137216_HideCol.ods |binary
 sc/qa/unit/data/ods/tdf137355_UndoHideRows.ods|binary
 sc/qa/unit/data/ods/tdf137576_Measureline.ods |binary
 sc/qa/unit/scshapetest.cxx|  200 ++--
 8 files changed, 392 insertions(+), 24 deletions(-)

New commits:
commit 804c1b77f26bd36895c77586ba4fb43a8b84bec8
Author: Regina Henschel 
AuthorDate: Tue Nov 3 19:51:51 2020 +0100
Commit: Regina Henschel 
CommitDate: Wed Nov 4 22:16:54 2020 +0100

Unit tests for: Improve 'resize with cell' handling

These tests belong to commit 1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca
They cover tdf#137576, tdf#137216, tdf#137044, tdf#137020, tdf#137355
and tdf#115655.
I have replaced the rectangle comparison in scshapetest.cxx with the
same one as used in bugfix-test.cxx

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

diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 30164e920ba5..2d815bb10c93 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -19,6 +19,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -26,11 +30,14 @@ using namespace ::com::sun::star::uno;
 class ScFiltersTest : public ScBootstrapFixture
 {
 public:
-
 ScFiltersTest();
 
 virtual void setUp() override;
 
+void testTdf137576_Measureline();
+void testTdf137216_HideCol();
+void testTdf137044_CoverHiddenRows();
+void testTdf137020_FlipVertical();
 void testTdf64229();
 void testTdf36933();
 void testTdf43700();
@@ -49,6 +56,10 @@ public:
 void testTdf130725();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
+CPPUNIT_TEST(testTdf137576_Measureline);
+CPPUNIT_TEST(testTdf137216_HideCol);
+CPPUNIT_TEST(testTdf137044_CoverHiddenRows);
+CPPUNIT_TEST(testTdf137020_FlipVertical);
 CPPUNIT_TEST(testTdf64229);
 CPPUNIT_TEST(testTdf36933);
 CPPUNIT_TEST(testTdf43700);
@@ -66,10 +77,213 @@ public:
 CPPUNIT_TEST(testTdf129789);
 CPPUNIT_TEST(testTdf130725);
 CPPUNIT_TEST_SUITE_END();
+
 private:
 uno::Reference m_xCalcComponent;
 };
 
+static 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(), labs(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(), labs(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(),
+   labs(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(),
+   labs(rExpected.GetHeight() - rActual.GetHeight()) 
<= nTolerance);
+}
+
+static void lcl_AssertPointEqualWithTolerance(const OString& sInfo, const 
Point rExpected,
+  const Point rActual, const 
sal_Int32 nTolerance)
+{
+// X
+OString sMsg = sInfo + " X expected " + OString::number(rExpected.X()) + " 
actual "
+   + OString::number(rActual.X()) + " Tolerance " + 
OString::number(nTolerance);
+CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), labs(rExpected.X() - rActual.X()) <= 
nTolerance);
+// Y
+sMsg = sInfo + " Y expected " + OString::number(rExpected.Y()) + &q

Re: pointer check in unit tests

2020-11-03 Thread Regina Henschel

Hi Miklos, Stephan, Mike,

I have kept all those asserts for now.

Changing ScBootstrapFixture::loadDoc would be a separate task anyway.

Kind regards
Regina

Mike Kaganski schrieb am 03-Nov-20 um 10:22:

On 03.11.2020 11:37, Miklos Vajna wrote:

Hi Regina,

On Mon, Nov 02, 2020 at 07:52:54PM +0100, Regina Henschel 
 wrote:

ScDocShellRef xDocSh = loadDoc("tdf137020_FlipVertical.", FORMAT_ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load tdf137020_FlipVertical.ods",
xDocSh.is());
ScDocument& rDoc = xDocSh->GetDocument();
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
CPPUNIT_ASSERT_MESSAGE("No SdDrawLayer", pDrawLayer);
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT_MESSAGE("No draw page", pPage);
CPPUNIT_ASSERT_EQUAL( static_cast(1), pPage->GetObjCount() );
SdrObject* pObj =  pPage->GetObj(0);
CPPUNIT_ASSERT_MESSAGE("No object", pObj);

Can I drop the CPPUNIT_ASSERT in these cases? They have nothing to do 
with
the test itself, but check only the pointers, which appear on the way 
to the

object, which I want to test.


The benefit of such explicit asserts is that they document your
assumptions and if they are not held, then a test failure log will show
this failure explicitly.

If you don't do that, we'll only see that the test crashed.

I believe that in most cases this benefit is larger than the cost of the
noise in the code.

(If you see a case where a pointer is returned and it can't be ever
nullptr, then we should fix the return type to a be reference. Caolan
did lots of fixes like that recently.)


Note also that all calls to ScBootstrapFixture::loadDoc currently either 
assert on its result, or dereference it unconditionally; so this 
function may be improved to include the assert inside, and guarantee the 
validity of returned result. One assert less in unit test code :-)




___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


pointer check in unit tests

2020-11-02 Thread Regina Henschel

Hi all,

In a unit test I have often sequences like this:

ScDocShellRef xDocSh = loadDoc("tdf137020_FlipVertical.", FORMAT_ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load tdf137020_FlipVertical.ods", 
xDocSh.is());

ScDocument& rDoc = xDocSh->GetDocument();
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
CPPUNIT_ASSERT_MESSAGE("No SdDrawLayer", pDrawLayer);
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT_MESSAGE("No draw page", pPage);
CPPUNIT_ASSERT_EQUAL( static_cast(1), pPage->GetObjCount() );
SdrObject* pObj =  pPage->GetObj(0);
CPPUNIT_ASSERT_MESSAGE("No object", pObj);

Can I drop the CPPUNIT_ASSERT in these cases? They have nothing to do 
with the test itself, but check only the pointers, which appear on the 
way to the object, which I want to test.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source test/source

2020-10-31 Thread Regina Henschel (via logerrit)
 sc/inc/drwlayer.hxx |2 
 sc/inc/table.hxx|2 
 sc/qa/unit/filters-test.cxx |   16 
 sc/qa/unit/scshapetest.cxx  |2 
 sc/qa/unit/ucalc.cxx|   10 
 sc/source/core/data/drwlayer.cxx|  358 +++-
 sc/source/core/data/table5.cxx  |   41 ++
 sc/source/filter/xml/xmlexprt.cxx   |4 
 sc/source/filter/xml/xmlimprt.cxx   |   32 +
 sc/source/filter/xml/xmlimprt.hxx   |2 
 test/source/sheet/xsheetannotationshapesupplier.cxx |2 
 11 files changed, 362 insertions(+), 109 deletions(-)

New commits:
commit 1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca
Author: Regina Henschel 
AuthorDate: Sat Oct 10 17:55:31 2020 +0200
Commit: Regina Henschel 
CommitDate: Sat Oct 31 15:36:00 2020 +0100

Improve 'resize with cell' handling

The patch contains a larger rework of RecalcPos and connected areas
and covers several bugs. Essentials in short:
Move initialization from RecalcPos to own method and use it in
ScXMLImport::endDocument
Do not change hidden objects, which includes not setting width or
height to zero, and be consistent in using object visibility.
Special handling of vertical flipped customshapes.
Repair anchor on import of line and measure line.
ODF conformance: Create logical rectangle from anchor instead using
size.

Details:
tdf#137044
ScDrawLayer::SetPageSize is called several times while loading a
document. It includes a call to ScDrawLayer::RecalcPos for all cell
anchored objects. An object gets initialized with the first call.
Problem was, that the row heights were not finished at that time and
anchor cells and offsets were partly calculated based on default cell
height. That results in wrong height and offset of objects.
The solution separates initialization from RecalcPos and puts it into
an own method ScDrawLayer::InitializeCellAnchoredObj. This is then
called from ScXMLImport::endDocument when row height settings are
finished.
The call to RecalcPos is not totally removed from SetPageSize but only
excluded while loading, because it is needed for size changes after
the document is loaded.

tdf#137576 partly
For measure lines and ordinary lines, which were anchored 'To cell
(resize with cell)', LibreOffice has written wrong end-cell info to
file. So reopening results in wrong lines. The geometry of lines is
based on two points. Fortunatelly the combination of position of the
cell, which contains the shape, and start and end points gives correct
absolute position of these points.
Solution is, to regenerate the initial ScDrawObjData infos from these
points and do not use the stored end-cell info. For a total fix
implementation of NbcSetSnapRect for SdrMeasureObj is needed, which is
not included here.

tdf#137020
Cell anchored shapes are contained in a cell in file. To determine
size and position of the shape a rectangle is used, so defined, that
after applying transformation you get the desired shape. In case of
custom shapes, a vertical flip is not contained in the transformation
but it is an attribute inside the shape and flip is done at the shape
center and will not change the rectangle.
This rectangle determines start and end addresses and offsets in
ScDrawObjData in rNoRotatedAnchor. The info is used directly in XML
export. It is correctly build while loading the file.
But in case of vertical flipped custom shapes the logical rectangle
of the shape has an additional 180deg rotation. Changing that behavior
is currently out of scope. Therefore special handling of vertical
flipped custom shapes was added.

tdf#99549
ODF specifies that in case of existence of end-cell attribute, size
attributes have to be ignored. But LO has based the logical rectangle
on size. In addition it has written zero width and height in case of
hidden row and cols. Result was, that objects are 'lost' on opening
although they still exists in the file.
With the patch the object size is recalculated from anchor on opening.

tdf#137355, tdf#137044, tdf#115655
The old solution has recalculated the snap rectangle based on current
state of hidden row or column. That has produced shapes of zero width
or height and loss of offset in case start or end cell of the shape
was hidden. In running LO it was partly offset by using cached infos
in ScDrawObjData. That failed in case of save and reload.
Solution is, to only change visible shapes. It is enough to adapt the
shape when it becomes visible. That is introduced in RecalcPos and
SetCellAnchoredFromPosition.

tdf#137216
Shapes

Improve 'resize with cell'

2020-10-28 Thread Regina Henschel

Hi all,

I want to change the way 'resize with cell' is handled, because the 
current way causes a lot of bugs. My intended patch is in 
https://gerrit.libreoffice.org/c/core/+/104643


A review would be nice. Especially
- Do you agree with the changes in principle?
- Do you see any problem, which I need to solve before merging the patch?

The patch has no unit tests. I will write unit tests as separate commit 
afterwards.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: error detected by loplugin:staticaccess

2020-10-26 Thread Regina Henschel

Hallo Mike, hallo Caolán,

thank you for helping me.

Kind regards
Regina

Mike Kaganski schrieb am 25-Oct-20 um 17:03:

Hi Regina,

On 25.10.2020 17:12, Regina Henschel wrote:

Hi all,

I got an error in https://gerrit.libreoffice.org/c/core/+/104643
But I do not know, how to write it correctly. Can you please help me?
The other compilers are fine, with the way I have written it.


Since GetObjData is a static method, it does not belong to an object, 
but to the class. So writing pDrawLayer->GetObjData(aObj) (which looks 
as if GetObjData was operating on pDrawLayer) is conceptually wrong, and 
[loplugin:staticaccess] suggests you to we-write it as


     ScDrawObjData* pData = ScDrawLayer::GetObjData(aObj);

instead.



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


error detected by loplugin:staticaccess

2020-10-25 Thread Regina Henschel

Hi all,

I got an error in https://gerrit.libreoffice.org/c/core/+/104643
But I do not know, how to write it correctly. Can you please help me?
The other compilers are fine, with the way I have written it.

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Where are Calc functions implemented in libreoffce?

2020-10-22 Thread Regina Henschel

Hi Emmertt,

you mean functions like LINEST or GCD? They belong to class ScInterpreter.

You might have a look at
https://wiki.openoffice.org/wiki/Hacking_Calc_-_The_First_Step

and the very good guide written by Eike
https://wiki.openoffice.org/wiki/Calc/Implementation/Spreadsheet_Functions

If that is not what you are looking for, you should describe in more 
details what you want to do.


Kind regards
Regina

Emmett Miller schrieb am 21-Oct-20 um 22:42:
Where are Calc functions implemented in libreoffce source? They don't 
appear to be implemented as 
https://wiki.openoffice.org/wiki/Calc/Add-In/Simple_Calc_Add-In
Calc/Add-In/Simple Calc Add-In - Apache OpenOffice Wiki 

This is a step by step guide on how to write a simple component (a Calc 
add-in) for OpenOffice.org (OOo) in C++. Even though the instructions 
are for Linux, this guide should give an idea on how to write components 
on other operating systems as well.This document has been updated for 
OOo version 3, an earlier revision of this page pertaining to OOo 
version 2 can be found here.

wiki.openoffice.org




___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - svx/source

2020-10-14 Thread Regina Henschel (via logerrit)
 svx/source/svdraw/svdedtv1.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f4e4c380c8aa89cedca5ab2aa2006e12461158a7
Author: Regina Henschel 
AuthorDate: Tue Oct 13 14:44:17 2020 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 14 14:29:31 2020 +0200

tdf#137446 catch divByZero in ResizeMultMarkedObj

When a horizontal or vertical line is resized, the height or width
is zero and yFact or xFact are invalid Fraction. They are passed on
to SdrTextObj::NbcResize. There an invalid Fractions returns -1 for
GetDenominator and results a faulty mirroring.

Change-Id: Iafe91827cfc7a8b6ccff852115f01ccbb90e54b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104234
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
(cherry picked from commit 94e6e140491de31c0788c91af855a75a3bb12709)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104290
Reviewed-by: Xisco Fauli 

diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 3423ba65027b..389801f8d1ee 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -269,11 +269,11 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
 }
 
 Fraction aFrac(1,1);
-if (bWdh && bHgt)
+if (bWdh && xFact.IsValid() && bHgt && yFact.IsValid())
 pO->Resize(rRef, xFact, yFact);
-else if (bWdh)
+else if (bWdh && xFact.IsValid())
 pO->Resize(rRef, xFact, aFrac);
-else if (bHgt)
+else if (bHgt && yFact.IsValid())
 pO->Resize(rRef, aFrac, yFact);
 }
 if( bUndo )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: How to make a unit test which involves a dialog

2020-10-13 Thread Regina Henschel

Hi Xisco,

Xisco Fauli schrieb am 13-Oct-20 um 21:11:

Hi Regina,

oh, I didn't know you were on Windows. Unfortunately the logging is not
supported there, see
https://wiki.documentfoundation.org/Development/UITests#Unsupported_ui_items

OTOH, I can create the UItest for you once you submit the patch if you
want to avoid the hassle of switching to Linux and building LibreOffice
there.


This is a great offer, which I gladly accept. Many thanks for such support.

Kind regards
Regina



Regards

On 13/10/20 18:36, Regina Henschel wrote:

Hi Xisco,

Xisco Fauli schrieb am 13-Oct-20 um 16:43:

Hi Regina,

You can use a UItest for that.

Launch LibreOffice with LO_COLLECT_UIINFO="test.log"
instdir/program/scalc, follow the steps to reproduce the issue and you
will have the action log in instdir/uitest/test.log.

You have information on how to run uitests here:
https://wiki.documentfoundation.org/Development/UITests#Running_the_test



I can launch LibreOffice, I see the folder uitest, but I do not get a
file "test.log".
Might it be, that it works only on Linux? I work on Windows 10 with
Cygwin.

Kind regards
Regina


Regards

On 13/10/20 15:02, Regina Henschel wrote:

Hi all,

the patch for which I want to make a unit test is in
https://gerrit.libreoffice.org/c/core/+/104234

The error is produced, when you set a new width or height for a
horizontal or vertical line in the Position dialog in Calc. So
how can I use the Position dialog in a unit test? Is it possible
with C++?

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice




___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice




___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2020-10-13 Thread Regina Henschel (via logerrit)
 svx/source/svdraw/svdedtv1.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 94e6e140491de31c0788c91af855a75a3bb12709
Author: Regina Henschel 
AuthorDate: Tue Oct 13 14:44:17 2020 +0200
Commit: Regina Henschel 
CommitDate: Tue Oct 13 23:01:18 2020 +0200

tdf#137446 catch divByZero in ResizeMultMarkedObj

When a horizontal or vertical line is resized, the height or width
is zero and yFact or xFact are invalid Fraction. They are passed on
to SdrTextObj::NbcResize. There an invalid Fractions returns -1 for
GetDenominator and results a faulty mirroring.

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

diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 39ebd7c7acb4..86a3cdd35725 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -269,11 +269,11 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
 }
 
 Fraction aFrac(1,1);
-if (bWdh && bHgt)
+if (bWdh && xFact.IsValid() && bHgt && yFact.IsValid())
 pO->Resize(rRef, xFact, yFact);
-else if (bWdh)
+else if (bWdh && xFact.IsValid())
 pO->Resize(rRef, xFact, aFrac);
-else if (bHgt)
+else if (bHgt && yFact.IsValid())
 pO->Resize(rRef, aFrac, yFact);
 }
 if( bUndo )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: How to make a unit test which involves a dialog

2020-10-13 Thread Regina Henschel

Hi Xisco,

Xisco Fauli schrieb am 13-Oct-20 um 16:43:

Hi Regina,

You can use a UItest for that.

Launch LibreOffice with LO_COLLECT_UIINFO="test.log"
instdir/program/scalc, follow the steps to reproduce the issue and you
will have the action log in instdir/uitest/test.log.

You have information on how to run uitests here:
https://wiki.documentfoundation.org/Development/UITests#Running_the_test



I can launch LibreOffice, I see the folder uitest, but I do not get a 
file "test.log".

Might it be, that it works only on Linux? I work on Windows 10 with Cygwin.

Kind regards
Regina


Regards

On 13/10/20 15:02, Regina Henschel wrote:

Hi all,

the patch for which I want to make a unit test is in
https://gerrit.libreoffice.org/c/core/+/104234

The error is produced, when you set a new width or height for a
horizontal or vertical line in the Position dialog in Calc. So
how can I use the Position dialog in a unit test? Is it possible
with C++?

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice




___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


How to make a unit test which involves a dialog

2020-10-13 Thread Regina Henschel

Hi all,

the patch for which I want to make a unit test is in 
https://gerrit.libreoffice.org/c/core/+/104234


The error is produced, when you set a new width or height for a 
horizontal or vertical line in the Position dialog in Calc. So how 
can I use the Position dialog in a unit test? Is it possible with C++?


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - svx/qa svx/source

2020-09-29 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 5e722a79387959195202903469af2138722eddc8
Author: Regina Henschel 
AuthorDate: Wed Sep 23 19:02:30 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 29 15:56:37 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 
(cherry picked from commit 3b4198d4654e4cf569f9b82d87a2498dbbecb9ac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103580
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 309c5155d8da..ea5df12b27c3 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;
 
@@ -757,6 +762,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 3d4e6bfc409b..344e2d6036fb 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1665,22 +1665,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())
 {
-

Questions about ScDrawLayer::RecalcPos

2020-09-26 Thread Regina Henschel

Hi all,

I want to fix tdf#137020 "FILEOPEN Vertical flipped, cell anchored 
shapes have wrong position on opening". The error happens in 
ScDrawLayer::RecalcPos in sc\source\core\data\drwlayer.cxx. Vertical 
flipped custom shapes have an additional 180deg rotation, which is not 
considered when calculating the rectangles.


But before I can start, I need to be sure, that I understand the context 
correctly. Therefore some questions.


(A) There is (#947) a condition "if (rData.getShapeRect().IsEmpty())". 
That condition is met, if the file is opened.

Is it always met on opening?
Are there other situations in which the condition is met?

(B) After ScDrawLayer::RecalcPos is finished, the UserDataList in 
PlusData of the shape will have two items of ScDrawObjData of kind 
SC_UD_OBJDATA. The first one corresponds to rData, the second one to 
rNoRotatedAnchor in method RecalcPos. Correct?


The member maShapeRect in the first item will be the same as maSnapRect 
of the shape, and maShapeRect in the second item will be the same as 
maRect of the shape. In both cases hidden row/col are treated as zero 
for maShapeRect. Correct?


But maStart, maEnd and their offsets in the first item will be taken 
from the snap rectangle of the shape, whereby hidden row/col are not 
treated as zero, whereas the second item has them taken from the logic 
rectangle of the shape and hidden row/col are treated as zero. Correct?


(C) In case XML has an attribute table:end-cell-address, the 
ScAnchorType is SCA_CELL_RESIZE. In that case XML-import has not 
produced valid values for maRect (logic rectangle) of the shape, because 
row/col size and hidden state are not known at that place. And more, ODF 
has the rule to ignore svg:width and svg:height in that case, and these 
size attributes need not exist at all. So I would expect as first action 
in RecalcPos in that case, that maRect gets current, valid values 
considering maStart, maEnd and their offsets in rData. That does not 
happen. Why?


(D) In case SCA_CELL, the XML-import has produced valid values for 
maRect and maSnapRect of the shape. They are overwritten with values 
generated from the anchor. Reason? I would expect, that at least 
rNoRotatedAnchor uses the values from the XML-import directly in this case.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[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;
 }

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

2020-09-19 Thread Regina Henschel (via logerrit)
 chart2/qa/extras/chart2geometry.cxx   |   56 +++
 chart2/qa/extras/data/odt/tdf135366_data_label_export.odt |binary
 chart2/qa/extras/data/pptx/tdf135366_CustomLabelText.pptx |binary
 xmloff/source/chart/SchXMLExport.cxx  |  210 +++---
 4 files changed, 235 insertions(+), 31 deletions(-)

New commits:
commit 6d7a72ab1c044f7e1f30f7c4133dafdb214dfcbf
Author: Regina Henschel 
AuthorDate: Thu Sep 10 14:42:55 2020 +0200
Commit: Regina Henschel 
CommitDate: Sat Sep 19 14:27:24 2020 +0200

tdf#135366 Save line and fill of data labels to ODF

LibreOffice has line and fill properties of data labels in charts
as loext attributes in the style of the  or
 element. For ODF there has to be a
 element with line and fill properties in its
style.

This patch adds the needed  elements and their
associated  elements.

The element  exists in ODF since version 1.2.
The solution requires no extended namespace. The check is adapted
in lcl_getCustomLabelField.

Import was already done in commit
87d1ebeb11a00301745ee3c3c03fffb7033ab59d

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

diff --git a/chart2/qa/extras/chart2geometry.cxx 
b/chart2/qa/extras/chart2geometry.cxx
index b3f537c372e0..be6d842d7780 100644
--- a/chart2/qa/extras/chart2geometry.cxx
+++ b/chart2/qa/extras/chart2geometry.cxx
@@ -21,6 +21,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -52,6 +53,8 @@ public:
 void testTdf128345Legend_CS_TG_axial_import();
 void testTdf135366LabelOnSeries();
 void testTdf135366LabelOnPoint();
+void testTdf135366LabelExport();
+void testTdf135366_CustomLabelText();
 
 CPPUNIT_TEST_SUITE(Chart2GeometryTest);
 CPPUNIT_TEST(testTdf135184RoundLineCap);
@@ -66,6 +69,8 @@ public:
 CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_import);
 CPPUNIT_TEST(testTdf135366LabelOnSeries);
 CPPUNIT_TEST(testTdf135366LabelOnPoint);
+CPPUNIT_TEST(testTdf135366LabelExport);
+CPPUNIT_TEST(testTdf135366_CustomLabelText);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -502,6 +507,57 @@ void Chart2GeometryTest::testTdf135366LabelOnPoint()
  nFillColor);
 }
 
+void Chart2GeometryTest::testTdf135366LabelExport()
+{
+// Error was, that line and fill properties were not exported as
+// graphic-properties of a  element, but only
+// as loext chart-properties of the  element.
+load("/chart2/qa/extras/data/odt/", "tdf135366_data_label_export.odt");
+xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "writer8");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// Find label style
+const OString sLabelPath(
+
"//office:document-content/office:body/office:chart/chart:chart/chart:plot-area"
+
"/chart:series/chart:data-point[1]/chart:data-label/@chart:style-name");
+const OUString sOULabelStyleName = getXPathContent(pXmlDoc, sLabelPath);
+
+// Verify content of graphic properties of label style
+const OString sStylePath(
+
"//office:document-content/office:automatic-styles/style:style[@style:name='"
++ OU2O(sOULabelStyleName) + "']/style:graphic-properties");
+assertXPath(pXmlDoc, sStylePath, 1);
+assertXPath(pXmlDoc, sStylePath + "[@draw:fill='solid']");
+assertXPath(pXmlDoc, sStylePath + "[@draw:fill-color='#5050a0']");
+assertXPath(pXmlDoc, sStylePath + "[@draw:stroke='solid']");
+assertXPath(pXmlDoc, sStylePath + "[@svg:stroke-width='0.254cm']");
+assertXPath(pXmlDoc, sStylePath + "[@svg:stroke-color='#00']");
+}
+
+void Chart2GeometryTest::testTdf135366_CustomLabelText()
+{
+// Error was, that custom text in a data label was only exported in ODF 
extended,
+// although the used  element exists since ODF 1.2.
+SvtSaveOptions aSaveOpt;
+const SvtSaveOptions::ODFDefaultVersion 
nCurrentODFVersion(aSaveOpt.GetODFDefaultVersion());
+aSaveOpt.SetODFDefaultVersion(SvtSaveOptions::ODFVER_012);
+load("/chart2/qa/extras/data/pptx/", "tdf135366_CustomLabelText.pptx");
+xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// Find custom text. As of version 7.0 it is in a  element.
+const OString sCustomTextPath(
+
"//office:document-content/office:body/office:chart/chart:chart/chart:plot-area"
+"/chart:series/chart:data-point[2]/chart:data-label/text:p/text:span");
+assertXPath(pXmlDoc, sCustomTextPath, 1);
+
+// Verify text content
+const OUString sOUTextContent = getXPathContent(pXmlDoc, sCustomTextPath);
+CPPUNIT_ASSERT_EQUAL(OUString("

chart data label size

2020-09-18 Thread Regina Henschel

Hi all,

seeing all OOXML import trouble with data label position and wrong word 
wrap caused by wrong label size, wouldn't it be better to introduce a 
height and width of data labels as properties? All current ersatz by 
taken some percent from whatever will have examples, where it doesn't work.


I know, that  has no size attributes yet, so export to 
ODF would only be possible as extended.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - chart2/CppunitTest_chart2_geometry.mk chart2/Module_chart2.mk chart2/qa chart2/source oox/source

2020-09-15 Thread Regina Henschel (via logerrit)
 chart2/CppunitTest_chart2_geometry.mk|  
139 +
 chart2/Module_chart2.mk  |
1 
 chart2/qa/extras/chart2geometry.cxx  |  
242 ++
 chart2/qa/extras/data/xlsx/tdf135184RoundLineCap.xlsx
|binary
 chart2/qa/extras/data/xlsx/tdf135184RoundLineCap2.xlsx   
|binary
 chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx  |
1 
 chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx |
6 
 chart2/source/inc/LinePropertiesHelper.hxx   |
3 
 chart2/source/model/main/DataPointProperties.cxx |
8 
 chart2/source/tools/LinePropertiesHelper.cxx |
8 
 chart2/source/view/inc/VLineProperties.hxx   |
1 
 chart2/source/view/main/PropertyMapper.cxx   |
9 
 chart2/source/view/main/ShapeFactory.cxx |
5 
 chart2/source/view/main/VLineProperties.cxx  |
3 
 oox/source/drawingml/chart/objectformatter.cxx   |
6 
 oox/source/export/drawingml.cxx  |   
23 
 16 files changed, 435 insertions(+), 20 deletions(-)

New commits:
commit 2b218729b8332fa2bc8a20480c8ba701e1bca361
Author: Regina Henschel 
AuthorDate: Mon Jul 27 21:55:05 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 15 11:14:13 2020 +0200

tdf#135184 add linecaps in charts

Chart is currently not able to interpret property linecap. But in
case of linecap 'round' or 'square', line dashes lengths are adapted
so that they look same as in MS Office (tdf#134053). This does not
work, if the corresponding linecap property is not interpreted.
Dashed border of data labels is not fixed because of bug
tdf#135366.
In addition I have fixed errors in prstDash detection, which I
have noticed while creating unit tests.
The unit tests cover file text, not visual appearence.

Change-Id: I8cf2d2b2fc0923c2882f8148b4550bc363270480
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99562
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
(cherry picked from commit 74be8bb787a44464957e5d3105c8de6d36e81b4a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101871
Reviewed-by: Xisco Fauli 

diff --git a/chart2/CppunitTest_chart2_geometry.mk 
b/chart2/CppunitTest_chart2_geometry.mk
new file mode 100644
index ..fb07f9108a5f
--- /dev/null
+++ b/chart2/CppunitTest_chart2_geometry.mk
@@ -0,0 +1,139 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,chart2_geometry))
+
+$(eval $(call gb_CppunitTest_use_externals,chart2_geometry, \
+   boost_headers \
+   libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,chart2_geometry, \
+chart2/qa/extras/chart2geometry \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,chart2_geometry, \
+$(call gb_Helper_optional,AVMEDIA,avmedia) \
+basegfx \
+comphelper \
+cppu \
+cppuhelper \
+drawinglayer \
+editeng \
+for \
+forui \
+i18nlangtag \
+msfilter \
+oox \
+sal \
+salhelper \
+sax \
+sb \
+sc \
+sw \
+sd \
+sfx \
+sot \
+svl \
+svt \
+svx \
+svxcore \
+test \
+tl \
+tk \
+ucbhelper \
+unotest \
+utl \
+vbahelper \
+vcl \
+xo \
+))
+
+$(eval $(call gb_CppunitTest_set_include,chart2_geometry,\
+-I$(SRCDIR)/chart2/inc \
+$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,chart2_geometry))
+
+$(eval $(call gb_CppunitTest_use_ure,chart2_geometry))
+$(eval $(call gb_CppunitTest_use_vcl,chart2_geometry))
+
+$(eval $(call gb_CppunitTest_use_components,chart2_geometry,\
+basic/util/sb \
+animations/source/animcore/animcore \
+chart2/source/controller/chartcontroller \
+chart2/source/chartcore \
+comphelper/util/comphelp \
+configmgr/source/configmgr \
+dtrans/util/mcnttype \
+dbaccess/util/dba \
+embeddedobj/util/embobj \
+emfio/emfio \
+eventattacher/source/evtatt \
+filter/source/config/cache/filterconfig1 \
+filter/source/odfflatxml/odfflatxml \
+filter/source/storagefilterdetect/storagefd \
+filter/source/xmlfilteradaptor/xmlfa \
+filter/source/xmlfilterdetect/xmlfd

Bringing line and fill style of data labels to ODF

2020-09-11 Thread Regina Henschel

Hi NISZ LibreOffice Team, hi all,

I have started to bring the line and fill properties of data labels to 
ODF. Currently they are implemented in loext-Attributes in the styles of 
 and . But ODF needs  
elements and have them as ordinary line and fill attribute in the data 
label styles.


My current state of work is in 
https://gerrit.libreoffice.org/c/core/+/102381.


Because you are heavily working on chart import/export, it might be 
useful, if you have a look, whether what I plan to do is in conflict 
with that, what you plan to do.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2020-09-05 Thread Regina Henschel (via logerrit)
 chart2/qa/extras/chart2geometry.cxx   |  100 +-
 chart2/qa/extras/data/ods/tdf135366_data_label_series.ods |binary
 chart2/qa/extras/data/odt/tdf135366_data_label_point.odt  |binary
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |   62 +++
 xmloff/source/chart/SchXMLPlotAreaContext.hxx |   16 
 xmloff/source/chart/SchXMLSeries2Context.cxx  |  231 ++
 xmloff/source/chart/SchXMLSeries2Context.hxx  |3 
 xmloff/source/chart/transporttypes.hxx|   18 +
 8 files changed, 350 insertions(+), 80 deletions(-)

New commits:
commit 87d1ebeb11a00301745ee3c3c03fffb7033ab59d
Author: Regina Henschel 
AuthorDate: Sat Aug 22 23:03:02 2020 +0200
Commit: Regina Henschel 
CommitDate: Sat Sep 5 17:49:15 2020 +0200

tdf#135366 ODF import of line and fill of data labels

LibreOffice has line and fill properties of data labels in a chart in
properties of kind "LabelBorderWidth" or "LabelFillColor" at a data
point or, as defaults for the points, at a series.

But ODF has such information in a  element, which is
refered by a  element. That one can be child of a
 and child of a  element.

Microsoft Office correctly uses the  element and its
style for the line and fill properties of data labels. Up to now LO
cannot import such information and does not write the ODF elements.
Instead LibreOffice reads and writes attributes in 'loext' namespace.

Using the "LabelFoo" properties was implemented by Kohei Yoshida,
July 2014. Although there is no published service, these properties
can be used in macros. Because they are now available since six
years, the decision was to keep this internal model and convert on
import and export.

This patch implements the import of the ODF fill and line properties
from the  element and converts them to the internal
used properties.

LibreOffice has currently only implemented a few of the possible line
and fill properties. When more are implemented, their 
pairs need to be added to the array aApiToLabelFooPairs, further
adaptions are not needed.

The  contains in addition the absolute position of
a data label. LibreOffice has internally only a position offset
relative to the regular position of the label. The conversion of the
position is not included in the patch.

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

diff --git a/chart2/qa/extras/chart2geometry.cxx 
b/chart2/qa/extras/chart2geometry.cxx
index 091dafe67265..b3f537c372e0 100644
--- a/chart2/qa/extras/chart2geometry.cxx
+++ b/chart2/qa/extras/chart2geometry.cxx
@@ -11,10 +11,14 @@
 
 #include 
 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -46,6 +50,8 @@ public:
 void testTdf128345ChartWall_CS_TG_import();
 void testTdf128345Legend_CS_TG_axial_export();
 void testTdf128345Legend_CS_TG_axial_import();
+void testTdf135366LabelOnSeries();
+void testTdf135366LabelOnPoint();
 
 CPPUNIT_TEST_SUITE(Chart2GeometryTest);
 CPPUNIT_TEST(testTdf135184RoundLineCap);
@@ -58,6 +64,8 @@ public:
 CPPUNIT_TEST(testTdf128345ChartWall_CS_TG_import);
 CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_export);
 CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_import);
+CPPUNIT_TEST(testTdf135366LabelOnSeries);
+CPPUNIT_TEST(testTdf135366LabelOnPoint);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -71,12 +79,12 @@ protected:
 xmlDocUniquePtr parseExport(const OUString& rDir, const OUString& 
rFilterFormat);
 };
 
-// This is copied from Chart2ExportTest. It allows to access the chart form a 
MS Office document
+namespace
+{
+// This is copied from Chart2ExportTest. It allows to access the chart from a 
MS Office document
 // without knowing whether the file is a chart1.xml or chart2.xml... As of 
August 2020, Calc
 // and Impress use a static variable for the number and therefore the number 
depends on whether
 // there had already been savings before.
-namespace
-{
 struct CheckForChartName
 {
 private:
@@ -410,6 +418,90 @@ void 
Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_import()
 assertXPath(pXmlDoc2, sStart + " and @draw:end='100%']");
 }
 
+void Chart2GeometryTest::testTdf135366LabelOnSeries()
+{
+// Error was, that the fill and line properties of a  
were not
+// imported at all. Here they should be at the series.
+load("/chart2/qa/extras/data/ods/", "tdf135366_data_label_series.ods");
+uno::Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDa

Re: Problems with data labels in charts

2020-08-29 Thread Regina Henschel

Hi Miklos,

Miklos Vajna schrieb am 18-Aug-20 um 09:19:


Given it's there since 2014, I think there is benefit in not breaking
that. I would rather add the remaining missing LabelFoo properties
and keep the existing API working than the other way around.


Besides missing unit tests, import is finished now. Please have a look 
at https://gerrit.libreoffice.org/c/core/+/101194 and tell me, whether 
that's the way to go.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Make constant array accessible from different places

2020-08-28 Thread Regina Henschel

Hi Stephan,

thanks. I'll do it as you have suggested.

Kind regards
Regina

Stephan Bergmann schrieb am 28-Aug-20 um 19:16:

On 28/08/2020 18:53, Regina Henschel wrote:

I have a constant array
const std::pair aApiToLabelFooPairs[] =
{
 {"LineStyle", "LabelBorderStyle"},
    etc.
}

for to map draw object fill and line property names to data-label 
related properties of series and points in a chart on ODF import.


I need it in SchXMLSeries2Context::setStylesToSeries and in 
SchXMLSeries2Context::setStylesToDataPoints.


I have not worked on export yet, so I don't know whether it will be 
needed on export too.


Where to put this array and how?

I can put it separately from the SchXMLSeries2Context methods into the 
file SchXMLSeries2Context.cxx. Would that be "static" or not?


If aApiToLabelFooPairs is only used in 
xmloff/source/chart/SchXMLSeries2Context.cxx, you best put it in that 
file, at file scope.  And as the object is const, "static" would be 
redundant (and loplugin:redundantstatic would even warn about it).


(There's a slight drawback with global static objects involving e.g. 
OUString construction, as that incurs some cost when the library 
containing the object is loaded.  std::pair construction is by now 
constexpr if the construction of its members is, and two 
constexpr-constructible replacements for OUString that are suitable in 
many use cases is/was OUStringLiteral---but for which I'm planing on 
changing its role somewhat, so that it would unfortunately no longer be 
usable in your example---and std::u16string_view.  But you can ignore 
that for now and we can revisit things once (a) you know the final place 
for aApiToLabelFooPairs when all uses across import and export have been 
determined, and (b) the OUStringLiteral -> std::u16string_view situation 
has settled.)


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Make constant array accessible from different places

2020-08-28 Thread Regina Henschel

Hi all,

I need some technical help.

I have a constant array
const std::pair aApiToLabelFooPairs[] =
{
{"LineStyle", "LabelBorderStyle"},
   etc.
}

for to map draw object fill and line property names to data-label 
related properties of series and points in a chart on ODF import.


I need it in SchXMLSeries2Context::setStylesToSeries and in 
SchXMLSeries2Context::setStylesToDataPoints.


I have not worked on export yet, so I don't know whether it will be 
needed on export too.


Where to put this array and how?

I can put it separately from the SchXMLSeries2Context methods into the 
file SchXMLSeries2Context.cxx. Would that be "static" or not?


Better place?

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: XML-Questions

2020-08-28 Thread Regina Henschel

Hi Manfred,

Manfred Rebentisch schrieb am 28-Aug-20 um 06:45:


Why is the "h" separated? T6 is:

 
   
 



If I will work on the XML-files directly, I avoid to write 
officeooo:rsid. That attribute makes the file unnecessary complex. The 
setting is in Tools > Options > Writer > Comparison. Uncheck the option 
"Store it when changing the document".


In your example the element was only introduced to track, that you have 
something done with the "h".


Kind regards
Regina


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Problems with data labels in charts

2020-08-22 Thread Regina Henschel

Hi Miklos, hi all,

Miklos Vajna schrieb am 18-Aug-20 um 09:19:

Hi Regina,

On Mon, Aug 17, 2020 at 08:19:37PM +0200, Regina Henschel 
 wrote:

So you suggest to keep the internal structure?

That would mean, we will get about 18 additional "LabelFoo" properties over
the time for the still missing fill and line properties.


That is indeed some cost to be considered.


Then these needs to be done:
A) Implement import of such ODF files, which use the styles of
 elements for the fill and line properties of labels, so
that this information goes into the internal "labelFoo" properties.
B) Implement export to ODF, so that it writes the "labelFoo" properties into
the styles of  elements, initially in addition to the
loext:labelFoo attributes.
C) Implement a service for the "labelFoo" properties. (Currently they are
not officially available in the API, although they are visible in the Basic
IDE.)

The problem was not introduced by Gülşah, but this structure was determined
by Kohei Yoshida July 2014 with commit 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=f1531cdaaebe706d909dc6ddde439ccb5f4ad36d


Ah, thanks for researching that, so it's older.

Given it's there since 2014, I think there is benefit in not breaking
that. I would rather add the remaining missing LabelFoo properties
and keep the existing API working than the other way around.


I have now started with A). It is in 
https://gerrit.libreoffice.org/c/core/+/101194. That makes it easier to 
speak about the problems.


The current state is, that the styles, which are referenced by a 
 element are read and that the attributes svg:x and 
svg:y for the absolute position are read.


My ides is, to change the property names of the fill and line properties 
from their usual shape names to the "LabelFoo" names and then interpret 
the style as series or data point style respectively. Such changing is 
missing yet. Before I continue, I want to ask, what do you think about 
the idea?


Or do you have a better idea?


Not addressed is the position problem. Neither series nor data points 
have a property to hold an absolute position. And converting to the 
relative positions of Custom Position is only possible, if the data 
label position according the LabelPlacement values is known. But that is 
unknown, when styles are applied in 
SchXMLSeries2Context::setStylesToSeries or 
SchXMLSeries2Context::setStylesToDataPoints


Custom Position was introduced by Balazs Varga with commits
4223ff2be69f03e571464b0b09ad0d278918631b and
2a00d51150d410110602c953b3c3895debfcaa98.

If you have an idea for that, please tell me.

Kind regards
Regina






___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Problems with data labels in charts

2020-08-17 Thread Regina Henschel

Hi Miklos,

Miklos Vajna schrieb am 17-Aug-20 um 10:08:

Hi Regina,

On Sun, Aug 16, 2020 at 05:27:07PM +0200, Regina Henschel 
 wrote:

So there are discrepancies between what LibreOffice writes and reads and
what exists in ODF. What to do?


Regarding data label fill style, I think Gulsah added that recently in
commit 603df08a1e0211099ce2cf258cfe64a74ed6ded9 (2020-05-04). So in case
the used ODF markup is wrong, it is OK to just fix that without worrying
about backwards compat. The use-case in that commit was OOXML import +
correct rendering, so again, ODF markup can be tweaked.


So you suggest to keep the internal structure?

That would mean, we will get about 18 additional "LabelFoo" properties 
over the time for the still missing fill and line properties.


Then these needs to be done:
A) Implement import of such ODF files, which use the styles of 
 elements for the fill and line properties of labels, 
so that this information goes into the internal "labelFoo" properties.
B) Implement export to ODF, so that it writes the "labelFoo" properties 
into the styles of  elements, initially in addition to 
the loext:labelFoo attributes.
C) Implement a service for the "labelFoo" properties. (Currently they 
are not officially available in the API, although they are visible in 
the Basic IDE.)


The problem was not introduced by Gülşah, but this structure was 
determined by Kohei Yoshida July 2014 with commit 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=f1531cdaaebe706d909dc6ddde439ccb5f4ad36d


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Problems with data labels in charts

2020-08-16 Thread Regina Henschel

Hi all,

as far as I understand, we have currently this situation:

Graphic properties
--
A data label is created as css.drawing.TextShape and as such it can have 
FillProperties, LineProperties and ShadowProperties.
In ODF, a data label is a  element and its style can 
have graphic properties.

The data labels in MS Office have graphic properties too.

Our model has no explicit data labels, but all about data labels is 
contained as properties in a data point or as default in a data series. 
But data points and series have graphical properties themselves. So when 
graphic properties for data labels were introduced (such doesn't exist 
in OOo), new properties of kind "LabelFillColor" were created, see 
https://opengrok.libreoffice.org/xref/core/chart2/inc/unonames.hxx


This graphic properties are written to ODF in loext namespace into the 
style of the data point or series instead of writing into the style of 
the  element. That is wrong.
If a data label gets graphic properties in MS Office and the file is 
written to ODF by MS Office, then the properties are correctly in the 
style of the  element. But LibreOffice cannot 
interpret it.


Position
--
The user can drag a data label to a different position. This corresponds 
to "CustomLabelPosition". Latter is relative to the position calculated 
from the "LabelPlacement". (Do I understand this correctly?)
ODF has for a user defined position the attributes svg:x and svg:y of 
the  element. These describe the position relative to 
top/left of the entire chart.

MS Office uses these attributes in its export to ODF.
(OOXML has the element manualLayout, but I do not understand its unit.)
LibreOffice allows the user to drag the data label, but does not write 
the new position into the ODF-file at all and therefore has it lost on 
reopening.



So there are discrepancies between what LibreOffice writes and reads and 
what exists in ODF. What to do?


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Problems with new Writer feature "Page-content-bottom vertical relation "

2020-08-16 Thread Regina Henschel

Hi all,

Miklos has brought a proposal to the ODF TC, which is now 'resolved'
https://issues.oasis-open.org/browse/OFFICE-4073
(Proposal and resolution are in the issue.)

This specifies the bottom edge of the page content area as basis for the 
alignments "from top", "top", "middle", "bottom" and "below".


But now I have noticed problems, when looking at bug 
https://bugs.documentfoundation.org/show_bug.cgi?id=135720
FILEOPEN DOCX Vertically aligned shapes appear on top of each other if 
anchored to header/footer


The related implementations do not use the 'bottom edge of the page 
content area' as reference line, but they use the bottom page margin as 
reference area.


If a docx test document with picture vertical positioned "center" to 
"bottom margin" in Word is opened and saved as odt, it has the attribute 
' loext:veritical-rel="page-content-bottom" '.


Have I wrongly interpreted Miklos proposal? Or are you going to make an 
additional specification proposal?


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: chart2/qa sd/qa

2020-08-11 Thread Regina Henschel (via logerrit)
 chart2/qa/extras/chart2geometry.cxx  |  211 ++-
 chart2/qa/extras/data/pptx/tdf128345_ChartArea_CG_TS.pptx|binary
 chart2/qa/extras/data/pptx/tdf128345_ChartWall_CS_TG.pptx|binary
 chart2/qa/extras/data/pptx/tdf128345_Legend_CS_TG_axial.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx   |  120 --
 5 files changed, 193 insertions(+), 138 deletions(-)

New commits:
commit a6704e6dc53d64bc1442d337f7bfb8deb03f4145
Author: Regina Henschel 
AuthorDate: Mon Aug 10 23:26:54 2020 +0200
Commit: Regina Henschel 
CommitDate: Tue Aug 11 14:13:23 2020 +0200

tdf#128345 Move unit tests from sd to chart2 and improve them

a) The unit tests are about charts and therefore it is more natural to
have them in module chart2.
b) The file name of the chart in the pptx package is generated with a
static counter. Therefore the name depends on whether there have
been previous savings. Module chart2 has a method, that ignores the
number and takes the first matching file. Using that makes the tests
more stable and allows to fix the static counter without need to
adjust the tests.
c) I have put them into a new test suite, which I have started
recently. The other test suites are already hudge.
So this patch depends on commit
74be8bb787a44464957e5d3105c8de6d36e81b4a
d) I have made the paths in the tests independent of the naming
conventions which LibreOffice uses for styles and definitions.
e) I have split the tests in export and import.

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

diff --git a/chart2/qa/extras/chart2geometry.cxx 
b/chart2/qa/extras/chart2geometry.cxx
index dedfda6e1c24..cc4fc628612d 100644
--- a/chart2/qa/extras/chart2geometry.cxx
+++ b/chart2/qa/extras/chart2geometry.cxx
@@ -35,16 +35,29 @@ public:
 : ChartTest()
 {
 }
+// Mostly tests for line and fill properties
 void testTdf135184RoundLineCap();
 void testTdf135184RoundLineCap2();
 void testTdf135184RoundLineCap3();
 void testTdf135184RoundLineCap4();
+void testTdf128345ChartArea_CG_TS_export();
+void testTdf128345ChartArea_CG_TS_import();
+void testTdf128345ChartWall_CS_TG_export();
+void testTdf128345ChartWall_CS_TG_import();
+void testTdf128345Legend_CS_TG_axial_export();
+void testTdf128345Legend_CS_TG_axial_import();
 
 CPPUNIT_TEST_SUITE(Chart2GeometryTest);
 CPPUNIT_TEST(testTdf135184RoundLineCap);
 CPPUNIT_TEST(testTdf135184RoundLineCap2);
 CPPUNIT_TEST(testTdf135184RoundLineCap3);
 CPPUNIT_TEST(testTdf135184RoundLineCap4);
+CPPUNIT_TEST(testTdf128345ChartArea_CG_TS_export);
+CPPUNIT_TEST(testTdf128345ChartArea_CG_TS_import);
+CPPUNIT_TEST(testTdf128345ChartWall_CS_TG_export);
+CPPUNIT_TEST(testTdf128345ChartWall_CS_TG_import);
+CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_export);
+CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_import);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -58,6 +71,10 @@ protected:
 xmlDocUniquePtr parseExport(const OUString& rDir, const OUString& 
rFilterFormat);
 };
 
+// This is copied from Chart2ExportTest. It allows to access the chart form a 
MS Office document
+// without knowing whether the file is a chart1.xml or chart2.xml... As of 
August 2020, Calc
+// and Impress use a static variable for the number and therefore the number 
depends on whether
+// there had already been savings before.
 namespace
 {
 struct CheckForChartName
@@ -115,24 +132,27 @@ void 
Chart2GeometryTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
 {
 char const* pPrefix;
 char const* pURI;
-} const aNamespaces[]
-= { { "w", 
"http://schemas.openxmlformats.org/wordprocessingml/2006/main; },
-{ "v", "urn:schemas-microsoft-com:vml" },
-{ "c", "http://schemas.openxmlformats.org/drawingml/2006/chart; },
-{ "a", "http://schemas.openxmlformats.org/drawingml/2006/main; },
-{ "mc", 
"http://schemas.openxmlformats.org/markup-compatibility/2006; },
-{ "wps", 
"http://schemas.microsoft.com/office/word/2010/wordprocessingShape; },
-{ "wpg", 
"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup; },
-{ "wp", 
"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing; },
-{ "c15", "http://schemas.microsoft.com/office/drawing/2012/chart; 
},
-{ "office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" },
-{ "chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" },
-{ "style", "ur

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2020-08-09 Thread Regina Henschel (via logerrit)
 include/oox/export/chartexport.hxx   |1 
 oox/source/drawingml/chart/objectformatter.cxx   |2 
 oox/source/export/chartexport.cxx|  103 +++-
 sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp|binary
 sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp|binary
 sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx   |  120 +++
 7 files changed, 220 insertions(+), 6 deletions(-)

New commits:
commit acfd9e9ca2dfd76536c072e21c65cb3efc6aac80
Author: Regina Henschel 
AuthorDate: Mon Jul 27 00:31:04 2020 +0200
Commit: Regina Henschel 
CommitDate: Sun Aug 9 12:15:54 2020 +0200

tdf#128345 PPTX: add transparence gradient for fill in chart

Export cases:
Add transparence gradient on solid color fill by treating the
color fill as gradient with identical start and end color.
Add solid transparence on color gradient, by treating transparence
as gradient.
Import: Add missing property PROP_FillTransparenceGradientName to
spnCommonPropIds so that it is available in spObjTypeFormatEntries.
Otherwise transparence gradients will be skipped on import.

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

diff --git a/include/oox/export/chartexport.hxx 
b/include/oox/export/chartexport.hxx
index 194e15628aef..5faaf42cb1d1 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -141,6 +141,7 @@ private:
 void exportPlotArea( const css::uno::Reference<
  css::chart::XChartDocument >& rChartDoc );
 void exportFill( const css::uno::Reference< css::beans::XPropertySet >& 
xPropSet );
+void exportSolidFill(const css::uno::Reference& 
xPropSet);
 void exportGradientFill( const css::uno::Reference< 
css::beans::XPropertySet >& xPropSet );
 void exportBitmapFill( const css::uno::Reference< css::beans::XPropertySet 
>& xPropSet );
 void exportHatch(const css::uno::Reference& 
xPropSet);
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index 326f632e84b3..fd580742c97a 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -447,7 +447,7 @@ const ShapePropertyIds spnCommonPropIds =
 {
 PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, 
PROP_LineDashName,
 PROP_LineCap, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, 
PROP_INVALID, PROP_INVALID, PROP_INVALID,
-PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, 
PROP_FillGradientName,
+PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, 
PROP_FillTransparenceGradientName, PROP_FillGradientName,
 PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, 
PROP_FillBitmapSizeY,
 PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, 
PROP_FillBitmapRectanglePoint,
 PROP_FillHatchName, PROP_FillBackground
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 5f8ea80f8c9b..db4af798c867 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -429,6 +429,14 @@ static sal_Int32 lcl_generateRandomValue()
 return comphelper::rng::uniform_int_distribution(0, 1-1);
 }
 
+static sal_Int32 lcl_getAlphaFromTransparenceGradient(const awt::Gradient& 
rGradient, bool bStart)
+{
+// Our alpha is a gray color value.
+sal_uInt8 nRed = ::Color(bStart ? rGradient.StartColor : 
rGradient.EndColor).GetRed();
+// drawingML alpha is a percentage on a 0..10 scale.
+return (255 - nRed) * oox::drawingml::MAX_PERCENT / 255;
+}
+
 ChartExport::ChartExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, Reference< 
frame::XModel > const & xModel, XmlFilterBase* pFB, DocumentType eDocumentType )
 : DrawingML( std::move(pFS), pFB, eDocumentType )
 , mnXmlNamespace( nXmlNamespace )
@@ -1560,12 +1568,38 @@ void ChartExport::exportManualLayout(const 
css::chart2::RelativePosition& rPos,
 
 void ChartExport::exportFill( const Reference< XPropertySet >& xPropSet )
 {
-if ( !GetProperty( xPropSet, "FillStyle" ) )
+// Similar to DrawingML::WriteFill, but gradient access via name
+if (!GetProperty( xPropSet, "FillStyle" ))
 return;
-FillStyle aFillStyle( FillStyle_NONE );
-xPropSet->getPropertyValue( "FillStyle" ) >>= aFillStyle;
+FillStyle aFillStyle(FillStyle_NONE);
+xPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
+
+// map full transparent background to no fill
+if (aFillStyle == FillStyle_SOLID && GetProperty( xPropSet, 
&q

tdf#128345 PPTX: add transparence gradient for fill in chart

2020-08-07 Thread Regina Henschel

Hi all,

the patch
  https://gerrit.libreoffice.org/c/core/+/99464
  tdf#128345 PPTX: add transparence gradient for fill in chart
brings transparency gradients to charts. It is a follow up to
  https://gerrit.libreoffice.org/c/core/+/98792
  tdf#128345 pptx export: add transparence gradient in solid fill

If you want to review it, please add yourself in 99464. Otherwise I will 
submit it tomorrow.


Kind regards
Regain
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - oox/source sd/qa

2020-08-07 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/fillproperties.cxx   |6 
 oox/source/export/drawingml.cxx   |  106 +-
 sd/qa/unit/data/odp/tdf128345_FullTransparentGradient.odp |binary
 sd/qa/unit/data/odp/tdf128345_GradientAxial.odp   |binary
 sd/qa/unit/data/odp/tdf128345_GradientLinear.odp  |binary
 sd/qa/unit/data/odp/tdf128345_GradientRadial.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx|   80 ++
 7 files changed, 155 insertions(+), 37 deletions(-)

New commits:
commit 855420811e13d620dd1d0f016ac4f7da9535954c
Author: Regina Henschel 
AuthorDate: Tue Jul 14 22:52:56 2020 +0200
Commit: Miklos Vajna 
CommitDate: Fri Aug 7 13:44:19 2020 +0200

tdf#128345 pptx export: add transparence gradient in solid fill

In case of solid color fill a transparence gradient was not saved.
OOXML has no separate element for gradient transparency but has
transparency in color gradient stop elements. The patch detects
a transparence gradient, combines it with the fill color and exports
it as gradFill element.
The import was already correct, besides a wrong start or end value
in case of a symmetric gradient, which becomes AXIAL in LibreOffice.

(cherry picked from commit d187f22b7ff73954e1da39fb954c64bc315298cb)

Conflicts:
sd/qa/unit/export-tests-ooxml1.cxx

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

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 963c4009becf..f203e9e2823e 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -537,10 +537,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 aGradient.StartColor = sal_Int32(aStartColor.getColor( 
rGraphicHelper, nPhClr ));
 aGradient.EndColor = sal_Int32(aEndColor.getColor( 
rGraphicHelper, nPhClr ));
 
-if( aStartColor.hasTransparency() )
-nStartTrans = aStartColor.getTransparency()*255/100;
-if( aEndColor.hasTransparency() )
-nEndTrans = aEndColor.getTransparency()*255/100;
+nStartTrans = aStartColor.hasTransparency() ? 
aStartColor.getTransparency()*255/100 : 0;
+nEndTrans = aEndColor.hasTransparency() ? 
aEndColor.getTransparency()*255/100 : 0;
 
 aGradient.Border = rtl::math::round(100*nBorder);
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8a49546c94bd..14910f759598 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -397,8 +397,38 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 nAlpha = (MAX_PERCENT - ( PER_PERCENT * nTransparency ) );
 }
 
+// OOXML has no separate transparence gradient but uses transparency in 
the gradient stops.
+// So we merge transparency and color and use gradient fill in such case.
+awt::Gradient aTransparenceGradient;
+bool bNeedGradientFill(false);
+if (GetProperty(rXPropSet, "FillTransparenceGradient"))
+{
+mAny >>= aTransparenceGradient;
+if (aTransparenceGradient.StartColor != aTransparenceGradient.EndColor)
+bNeedGradientFill = true;
+else if (aTransparenceGradient.StartColor != 0)
+nAlpha = GetAlphaFromTransparenceGradient(aTransparenceGradient, 
true);
+}
+
 // write XML
-if ( nFillColor != nOriginalColor )
+if (bNeedGradientFill)
+{
+awt::Gradient aPseudoColorGradient;
+aPseudoColorGradient.XOffset = aTransparenceGradient.XOffset;
+aPseudoColorGradient.YOffset = aTransparenceGradient.YOffset;
+aPseudoColorGradient.StartIntensity = 100;
+aPseudoColorGradient.EndIntensity = 100;
+aPseudoColorGradient.Angle = aTransparenceGradient.Angle;
+aPseudoColorGradient.Border = aTransparenceGradient.Border;
+aPseudoColorGradient.Style = aTransparenceGradient.Style;
+aPseudoColorGradient.StartColor = nFillColor;
+aPseudoColorGradient.EndColor = nFillColor;
+aPseudoColorGradient.StepCount = aTransparenceGradient.StepCount;
+mpFS->startElementNS(XML_a, XML_gradFill, XML_rotWithShape, "0");
+WriteGradientFill(aPseudoColorGradient, aTransparenceGradient);
+mpFS->endElementNS( XML_a, XML_gradFill );
+}
+else if ( nFillColor != nOriginalColor )
 {
 // the user has set a different color for the shape
 WriteSolidFill( ::Color(nFillColor & 0xff), nAlpha );
@@ -578,25 +608,25 @@ void DrawingML::WriteGrabBagGradientFill( const Sequence< 
Property

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - oox/source sd/qa

2020-08-07 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/fillproperties.cxx   |6 
 oox/source/export/drawingml.cxx   |  106 +-
 sd/qa/unit/data/odp/tdf128345_FullTransparentGradient.odp |binary
 sd/qa/unit/data/odp/tdf128345_GradientAxial.odp   |binary
 sd/qa/unit/data/odp/tdf128345_GradientLinear.odp  |binary
 sd/qa/unit/data/odp/tdf128345_GradientRadial.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx|   80 ++
 7 files changed, 155 insertions(+), 37 deletions(-)

New commits:
commit 0ff6f5ad44a5fb9903c9a905d2ec55248ee75315
Author: Regina Henschel 
AuthorDate: Tue Jul 14 22:52:56 2020 +0200
Commit: Miklos Vajna 
CommitDate: Fri Aug 7 10:29:11 2020 +0200

tdf#128345 pptx export: add transparence gradient in solid fill

In case of solid color fill a transparence gradient was not saved.
OOXML has no separate element for gradient transparency but has
transparency in color gradient stop elements. The patch detects
a transparence gradient, combines it with the fill color and exports
it as gradFill element.
The import was already correct, besides a wrong start or end value
in case of a symmetric gradient, which becomes AXIAL in LibreOffice.

(cherry picked from commit d187f22b7ff73954e1da39fb954c64bc315298cb)

Conflicts:
oox/source/drawingml/fillproperties.cxx
sd/qa/unit/export-tests-ooxml1.cxx

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

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index caa54b82ca34..f963f103d2c8 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -529,10 +529,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 aGradient.StartColor = sal_Int32(aStartColor.getColor( 
rGraphicHelper, nPhClr ));
 aGradient.EndColor = sal_Int32(aEndColor.getColor( 
rGraphicHelper, nPhClr ));
 
-if( aStartColor.hasTransparency() )
-nStartTrans = 
aStartColor.getTransparency()*255/100;
-if( aEndColor.hasTransparency() )
-nEndTrans = aEndColor.getTransparency()*255/100;
+nStartTrans = aStartColor.hasTransparency() ? 
aStartColor.getTransparency()*255/100 : 0;
+nEndTrans = aEndColor.hasTransparency() ? 
aEndColor.getTransparency()*255/100 : 0;
 
 aGradient.Border = rtl::math::round(100*nBorder);
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 327d5a27931a..b9c6403caff2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -405,8 +405,38 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 nAlpha = (MAX_PERCENT - ( PER_PERCENT * nTransparency ) );
 }
 
+// OOXML has no separate transparence gradient but uses transparency in 
the gradient stops.
+// So we merge transparency and color and use gradient fill in such case.
+awt::Gradient aTransparenceGradient;
+bool bNeedGradientFill(false);
+if (GetProperty(rXPropSet, "FillTransparenceGradient"))
+{
+mAny >>= aTransparenceGradient;
+if (aTransparenceGradient.StartColor != aTransparenceGradient.EndColor)
+bNeedGradientFill = true;
+else if (aTransparenceGradient.StartColor != 0)
+nAlpha = GetAlphaFromTransparenceGradient(aTransparenceGradient, 
true);
+}
+
 // write XML
-if ( nFillColor != nOriginalColor )
+if (bNeedGradientFill)
+{
+awt::Gradient aPseudoColorGradient;
+aPseudoColorGradient.XOffset = aTransparenceGradient.XOffset;
+aPseudoColorGradient.YOffset = aTransparenceGradient.YOffset;
+aPseudoColorGradient.StartIntensity = 100;
+aPseudoColorGradient.EndIntensity = 100;
+aPseudoColorGradient.Angle = aTransparenceGradient.Angle;
+aPseudoColorGradient.Border = aTransparenceGradient.Border;
+aPseudoColorGradient.Style = aTransparenceGradient.Style;
+aPseudoColorGradient.StartColor = nFillColor;
+aPseudoColorGradient.EndColor = nFillColor;
+aPseudoColorGradient.StepCount = aTransparenceGradient.StepCount;
+mpFS->startElementNS(XML_a, XML_gradFill, XML_rotWithShape, "0");
+WriteGradientFill(aPseudoColorGradient, aTransparenceGradient);
+mpFS->endElementNS( XML_a, XML_gradFill );
+}
+else if ( nFillColor != nOriginalColor )
 {
 // the user has set a different color for the shape
 WriteSolidFill( ::Color(nFillColor &am

[Libreoffice-commits] core.git: chart2/CppunitTest_chart2_geometry.mk chart2/Module_chart2.mk chart2/qa chart2/source oox/source

2020-08-06 Thread Regina Henschel (via logerrit)
 chart2/CppunitTest_chart2_geometry.mk|  
139 +
 chart2/Module_chart2.mk  |
1 
 chart2/qa/extras/chart2geometry.cxx  |  
242 ++
 chart2/qa/extras/data/xlsx/tdf135184RoundLineCap.xlsx
|binary
 chart2/qa/extras/data/xlsx/tdf135184RoundLineCap2.xlsx   
|binary
 chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx  |
1 
 chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx |
6 
 chart2/source/inc/LinePropertiesHelper.hxx   |
3 
 chart2/source/model/main/DataPointProperties.cxx |
8 
 chart2/source/tools/LinePropertiesHelper.cxx |
8 
 chart2/source/view/inc/VLineProperties.hxx   |
1 
 chart2/source/view/main/PropertyMapper.cxx   |
9 
 chart2/source/view/main/ShapeFactory.cxx |
5 
 chart2/source/view/main/VLineProperties.cxx  |
3 
 oox/source/drawingml/chart/objectformatter.cxx   |
6 
 oox/source/export/drawingml.cxx  |   
23 
 16 files changed, 435 insertions(+), 20 deletions(-)

New commits:
commit 74be8bb787a44464957e5d3105c8de6d36e81b4a
Author: Regina Henschel 
AuthorDate: Mon Jul 27 21:55:05 2020 +0200
Commit: Regina Henschel 
CommitDate: Thu Aug 6 13:10:14 2020 +0200

tdf#135184 add linecaps in charts

Chart is currently not able to interpret property linecap. But in
case of linecap 'round' or 'square', line dashes lengths are adapted
so that they look same as in MS Office (tdf#134053). This does not
work, if the corresponding linecap property is not interpreted.
Dashed border of data labels is not fixed because of bug
tdf#135366.
In addition I have fixed errors in prstDash detection, which I
have noticed while creating unit tests.
The unit tests cover file text, not visual appearence.

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

diff --git a/chart2/CppunitTest_chart2_geometry.mk 
b/chart2/CppunitTest_chart2_geometry.mk
new file mode 100644
index ..fb07f9108a5f
--- /dev/null
+++ b/chart2/CppunitTest_chart2_geometry.mk
@@ -0,0 +1,139 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,chart2_geometry))
+
+$(eval $(call gb_CppunitTest_use_externals,chart2_geometry, \
+   boost_headers \
+   libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,chart2_geometry, \
+chart2/qa/extras/chart2geometry \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,chart2_geometry, \
+$(call gb_Helper_optional,AVMEDIA,avmedia) \
+basegfx \
+comphelper \
+cppu \
+cppuhelper \
+drawinglayer \
+editeng \
+for \
+forui \
+i18nlangtag \
+msfilter \
+oox \
+sal \
+salhelper \
+sax \
+sb \
+sc \
+sw \
+sd \
+sfx \
+sot \
+svl \
+svt \
+svx \
+svxcore \
+test \
+tl \
+tk \
+ucbhelper \
+unotest \
+utl \
+vbahelper \
+vcl \
+xo \
+))
+
+$(eval $(call gb_CppunitTest_set_include,chart2_geometry,\
+-I$(SRCDIR)/chart2/inc \
+$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,chart2_geometry))
+
+$(eval $(call gb_CppunitTest_use_ure,chart2_geometry))
+$(eval $(call gb_CppunitTest_use_vcl,chart2_geometry))
+
+$(eval $(call gb_CppunitTest_use_components,chart2_geometry,\
+basic/util/sb \
+animations/source/animcore/animcore \
+chart2/source/controller/chartcontroller \
+chart2/source/chartcore \
+comphelper/util/comphelp \
+configmgr/source/configmgr \
+dtrans/util/mcnttype \
+dbaccess/util/dba \
+embeddedobj/util/embobj \
+emfio/emfio \
+eventattacher/source/evtatt \
+filter/source/config/cache/filterconfig1 \
+filter/source/odfflatxml/odfflatxml \
+filter/source/storagefilterdetect/storagefd \
+filter/source/xmlfilteradaptor/xmlfa \
+filter/source/xmlfilterdetect/xmlfd \
+forms/util/frm \
+framework/util/fwk \
+i18npool/util/i18npool \
+linguistic/source/lng \
+oox/util/oox \
+package/source/xstor/xstor

Re: Need help for unit tests

2020-08-04 Thread Regina Henschel

Regina Henschel schrieb am 27-Jul-20 um 01:17:

I have seen in 
https://opengrok.libreoffice.org/xref/core/chart2/qa/extras/chart2import.cxx 

2541  Reference 
xDataPointLabel1(getShapeByName(xShapes,
2542 
"CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0"), 
UNO_SET_THROW);

How is the string build, what does it mean?


I have found it. CID=ClassifiedIdentifier
That belongs to
https://opengrok.libreoffice.org/xref/core/chart2/source/tools/ObjectIdentifier.cxx
https://opengrok.libreoffice.org/xref/core/chart2/source/inc/ObjectIdentifier.hxx

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Need help for unit tests

2020-07-28 Thread Regina Henschel

Hi Miklos,

Miklos Vajna schrieb am 27-Jul-20 um 09:20:

Hi Regina,

I guess the problem is that static counter in

oox/source/export/shapes.cxx:1970

This could be improved to do the same way as the DOCX export does in

sw/source/filter/ww8/docxattributeoutput.cxx:5165

i.e. do not have a static counter, rather make the counter a member of
the exporter class.

That way you would always get chart1.xml for the first chart of the
document on save.


Thank you for the hint. That means, I need to solve that, before going 
further.
And I have learned from you in another thread, that it would be better 
to have smaller test suites. So I tend to move the chart related tests 
to an own file.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Need help for unit tests

2020-07-26 Thread Regina Henschel

Hi all,

I need again help in unit tests.
I'm working on https://gerrit.libreoffice.org/c/core/+/99464.
That is continuation for
https://bugs.documentfoundation.org/show_bug.cgi?id=128345
FILESAVE: PPTX: transparency gradient on solid fill is not considered in 
export


This part is about transparency in charts. I have (until now) three 
files to be examined, each with one problem. I have used assertXPath on 
the saved pptx file. I have expected to get /ppt/charts/chart1.xml in 
all three cases, but I get chart1.xml for the first file, chart2.xml for 
the second and chart3.xml for the third file. You see it in 
SdOOXMLExportTest1::testTdf128345Chart_CS_TG() in 
sd/qa/unit/export-tests-ooxml1.cxx#1290.


Why is it not chart1.xml in all cases? Do I miss something?
Are these numbers stable?
How can I force to get chart1.xml in the export to pptx?


I have used assertXPath, because I do not know, how to access a chart 
and its parts from the active document in a unit test. Any hint, how to 
directly get the start and end color of a transparency gradient of a 
data point, for example?



I have seen in 
https://opengrok.libreoffice.org/xref/core/chart2/qa/extras/chart2import.cxx
2541  Reference 
xDataPointLabel1(getShapeByName(xShapes,
2542 
"CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0"), 
UNO_SET_THROW);

How is the string build, what does it mean?


And a general review of the patch would be nice too.

Kind regards
Regina




___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2020-07-22 Thread Regina Henschel (via logerrit)
 oox/source/export/drawingml.cxx   |   23 --
 sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx|   18 +++
 3 files changed, 38 insertions(+), 3 deletions(-)

New commits:
commit 51e5afb0042bc6a10f0cd02af5733079b42fa0f7
Author: Regina Henschel 
AuthorDate: Tue Jul 21 15:46:51 2020 +0200
Commit: Regina Henschel 
CommitDate: Wed Jul 22 11:54:04 2020 +0200

tdf#134969 Add solid transparence in color gradient

Converts a 'FillTransparence' percent value to a Gray color and
stores it in a TransparenceGradient, so that it can be used by
WriteGradientFill(). Use of third parameter rXPropSet is not possible,
because it would overwrite a true transparency gradient.
Causion, the property 'FillTransparenceGradient' might exist in an
XPropSet of a shape with some default values. To detect, whether a
gradient is actually used, you have to examine the property
'FillTransparenceGradientName'.

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

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 517d9801bba6..155c33796f70 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -540,10 +540,27 @@ void DrawingML::WriteGradientFill( const Reference< 
XPropertySet >& rXPropSet )
 else
 {
 mpFS->startElementNS(XML_a, XML_gradFill, XML_rotWithShape, "0");
-if( GetProperty(rXPropSet, "FillTransparenceGradient") )
-aTransparenceGradient = *o3tl::doAccess(mAny);
+OUString sFillTransparenceGradientName;
+if (GetProperty(rXPropSet, "FillTransparenceGradientName")
+&& (mAny >>= sFillTransparenceGradientName)
+&& !sFillTransparenceGradientName.isEmpty())
+{
+if (GetProperty(rXPropSet, "FillTransparenceGradient"))
+aTransparenceGradient = *o3tl::doAccess(mAny);
+}
+else if (GetProperty(rXPropSet, "FillTransparence"))
+{
+// currently only StartColor and EndColor are evaluated in 
WriteGradientFill()
+sal_Int32 nTransparency = 0;
+mAny >>= nTransparency;
+// convert percent to gray color
+nTransparency = nTransparency * 255/100;
+const sal_Int32 aGrayColor = static_cast( nTransparency 
| nTransparency << 8 | nTransparency << 16 );
+aTransparenceGradient.StartColor = aGrayColor;
+aTransparenceGradient.EndColor = aGrayColor;
+}
 WriteGradientFill(aGradient, aTransparenceGradient);
-mpFS->endElementNS( XML_a, XML_gradFill );
+mpFS->endElementNS(XML_a, XML_gradFill);
 }
 }
 
diff --git a/sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp 
b/sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp
new file mode 100644
index ..bb0d7bbc5709
Binary files /dev/null and 
b/sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 5cde7f0c8b91..f8f471f08b9a 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -97,6 +97,7 @@ public:
 void testTdf128345GradientLinear();
 void testTdf128345GradientRadial();
 void testTdf128345GradientAxial();
+void testTdf134969TransparencyOnColorGradient();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
@@ -143,6 +144,7 @@ public:
 CPPUNIT_TEST(testTdf128345GradientLinear);
 CPPUNIT_TEST(testTdf128345GradientRadial);
 CPPUNIT_TEST(testTdf128345GradientAxial);
+CPPUNIT_TEST(testTdf134969TransparencyOnColorGradient);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1212,6 +1214,22 @@ void SdOOXMLExportTest1::testTdf128345GradientAxial()
 xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest1::testTdf134969TransparencyOnColorGradient()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp"),
 ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+// Make sure the shape has a transparency in gradient stops.
+xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
+const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
+assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs",2);
+assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", 
"val", "6"

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

2020-07-18 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/fillproperties.cxx   |6 
 oox/source/export/drawingml.cxx   |  106 +-
 sd/qa/unit/data/odp/tdf128345_FullTransparentGradient.odp |binary
 sd/qa/unit/data/odp/tdf128345_GradientAxial.odp   |binary
 sd/qa/unit/data/odp/tdf128345_GradientLinear.odp  |binary
 sd/qa/unit/data/odp/tdf128345_GradientRadial.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx|   80 ++
 7 files changed, 155 insertions(+), 37 deletions(-)

New commits:
commit d187f22b7ff73954e1da39fb954c64bc315298cb
Author: Regina Henschel 
AuthorDate: Tue Jul 14 22:52:56 2020 +0200
Commit: Regina Henschel 
CommitDate: Sat Jul 18 16:29:37 2020 +0200

tdf#128345 pptx export: add transparence gradient in solid fill

In case of solid color fill a transparence gradient was not saved.
OOXML has no separate element for gradient transparency but has
transparency in color gradient stop elements. The patch detects
a transparence gradient, combines it with the fill color and exports
it as gradFill element.
The import was already correct, besides a wrong start or end value
in case of a symmetric gradient, which becomes AXIAL in LibreOffice.

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

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 963c4009becf..f203e9e2823e 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -537,10 +537,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 aGradient.StartColor = sal_Int32(aStartColor.getColor( 
rGraphicHelper, nPhClr ));
 aGradient.EndColor = sal_Int32(aEndColor.getColor( 
rGraphicHelper, nPhClr ));
 
-if( aStartColor.hasTransparency() )
-nStartTrans = aStartColor.getTransparency()*255/100;
-if( aEndColor.hasTransparency() )
-nEndTrans = aEndColor.getTransparency()*255/100;
+nStartTrans = aStartColor.hasTransparency() ? 
aStartColor.getTransparency()*255/100 : 0;
+nEndTrans = aEndColor.hasTransparency() ? 
aEndColor.getTransparency()*255/100 : 0;
 
 aGradient.Border = rtl::math::round(100*nBorder);
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 847bee54ab97..517d9801bba6 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -398,8 +398,38 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 nAlpha = (MAX_PERCENT - ( PER_PERCENT * nTransparency ) );
 }
 
+// OOXML has no separate transparence gradient but uses transparency in 
the gradient stops.
+// So we merge transparency and color and use gradient fill in such case.
+awt::Gradient aTransparenceGradient;
+bool bNeedGradientFill(false);
+if (GetProperty(rXPropSet, "FillTransparenceGradient"))
+{
+mAny >>= aTransparenceGradient;
+if (aTransparenceGradient.StartColor != aTransparenceGradient.EndColor)
+bNeedGradientFill = true;
+else if (aTransparenceGradient.StartColor != 0)
+nAlpha = GetAlphaFromTransparenceGradient(aTransparenceGradient, 
true);
+}
+
 // write XML
-if ( nFillColor != nOriginalColor )
+if (bNeedGradientFill)
+{
+awt::Gradient aPseudoColorGradient;
+aPseudoColorGradient.XOffset = aTransparenceGradient.XOffset;
+aPseudoColorGradient.YOffset = aTransparenceGradient.YOffset;
+aPseudoColorGradient.StartIntensity = 100;
+aPseudoColorGradient.EndIntensity = 100;
+aPseudoColorGradient.Angle = aTransparenceGradient.Angle;
+aPseudoColorGradient.Border = aTransparenceGradient.Border;
+aPseudoColorGradient.Style = aTransparenceGradient.Style;
+aPseudoColorGradient.StartColor = nFillColor;
+aPseudoColorGradient.EndColor = nFillColor;
+aPseudoColorGradient.StepCount = aTransparenceGradient.StepCount;
+mpFS->startElementNS(XML_a, XML_gradFill, XML_rotWithShape, "0");
+WriteGradientFill(aPseudoColorGradient, aTransparenceGradient);
+mpFS->endElementNS( XML_a, XML_gradFill );
+}
+else if ( nFillColor != nOriginalColor )
 {
 // the user has set a different color for the shape
 WriteSolidFill( ::Color(nFillColor & 0xff), nAlpha );
@@ -579,25 +609,25 @@ void DrawingML::WriteGrabBagGradientFill( const Sequence< 
PropertyValue >& aGrad
 void DrawingML::WriteGradientFill(awt::Gradient rGradient, awt::Gradient 
rTransparenceGradient,
   

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2020-07-09 Thread Regina Henschel (via logerrit)
 include/oox/export/drawingml.hxx   |   13 -
 include/oox/export/shapes.hxx  |1 
 oox/source/drawingml/customshapeproperties.cxx |3 
 oox/source/export/drawingml.cxx|  188 -
 oox/source/export/shapes.cxx   |   53 +---
 sd/qa/unit/data/odp/tdf100348_FontworkBitmapFill.odp   |binary
 sd/qa/unit/data/odp/tdf100348_FontworkGradientGlow.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   37 +++
 8 files changed, 198 insertions(+), 97 deletions(-)

New commits:
commit 005f5db47b8e1bbd7ebddee92009be072e835fd5
Author: Regina Henschel 
AuthorDate: Sat Jul 4 15:11:03 2020 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Jul 10 00:57:22 2020 +0200

tdf#100348 add fill to fontwork in export to pptx

This patch adds fill to the characters in a Fontwork shape in export
to pptx. It does not contain export to docx and not import.

Change-Id: Ie7c8a35380a845f513516636c4f60ee307eacd50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98187
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 439d817d0449..2760d2fe64a0 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -143,6 +143,7 @@ private:
 /// Parent exporter, used for text callback.
 DMLTextExport* mpTextExport;
 
+
 protected:
 css::uno::Any mAny;
 ::sax_fastparser::FSHelperPtr mpFS;
@@ -166,6 +167,7 @@ protected:
 const char* GetRelationCompPrefix() const;
 
 static bool EqualGradients( css::awt::Gradient aGradient1, 
css::awt::Gradient aGradient2 );
+bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet 
>& rXShapePropSet);
 
 void WriteGlowEffect(const css::uno::Reference& 
rXPropSet);
 void WriteSoftEdgeEffect(const 
css::uno::Reference& rXPropSet);
@@ -244,17 +246,20 @@ public:
 void WriteTransformation(const tools::Rectangle& rRectangle,
   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, sal_Int32 nRotation = 0, bool bIsGroupShape = false);
 
-void WriteText( const css::uno::Reference< css::uno::XInterface >& 
rXIface, const OUString& presetWarp, bool bBodyPr, bool bText = true, sal_Int32 
nXmlNamespace = 0);
+void WriteText( const css::uno::Reference< css::uno::XInterface >& 
rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0);
 void WriteParagraph( const css::uno::Reference< css::text::XTextContent >& 
rParagraph,
- bool& rbOverridingCharHeight, sal_Int32& rnCharHeight 
);
+ bool& rbOverridingCharHeight, sal_Int32& 
rnCharHeight, const css::uno::Reference< css::beans::XPropertySet >& 
rXShapePropSet);
 void WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, float fFirstCharHeight);
 void WriteParagraphNumbering(const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight,
   sal_Int16 nLevel );
 void WriteParagraphTabStops(const 
css::uno::Reference& rXPropSet);
 void WriteRun( const css::uno::Reference< css::text::XTextRange >& rRun,
-   bool& rbOverridingCharHeight, sal_Int32& rnCharHeight );
+   bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
+   const css::uno::Reference< css::beans::XPropertySet >& 
rXShapePropSet);
 void WriteRunProperties( const css::uno::Reference< 
css::beans::XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool 
bCheckDirect,
- bool& rbOverridingCharHeight, sal_Int32& 
rnCharHeight, sal_Int16 nScriptType = css::i18n::ScriptType::LATIN);
+ bool& rbOverridingCharHeight, sal_Int32& 
rnCharHeight,
+ sal_Int16 nScriptType = 
css::i18n::ScriptType::LATIN,
+ const css::uno::Reference< 
css::beans::XPropertySet >& rXShapePropSet = {});
 
 void WritePresetShape( const char* pShape , std::vector< 
std::pair> & rAvList );
 void WritePresetShape( const char* pShape );
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 53d505f168a2..e95af1eff83e 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -102,7 +102,6 @@ private:
 
 ShapeHashMap maShapeMap;
 ShapeHashMap* mpShapeMap;
-OUString m_presetWarp;
 
 public:
 
diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 00ecf33368ae..1b4d6b4a59f6 100644
--- a/oox/

Re: Review for gerrit 98187 : tdf#100348 add fill to fontwork in export to pptx

2020-07-08 Thread Regina Henschel

Hi all, hi Thorsten,

Regina Henschel schrieb am 07-Jul-20 um 14:48:


I know, that unit tests are missing.


I have added unit tests. So from my point of view it is finished now.

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Review for gerrit 98187 : tdf#100348 add fill to fontwork in export to pptx

2020-07-07 Thread Regina Henschel

Hi all,

I have continued to work on Fontwork. It brings fill, outline and 
effects from LO to pptx. The patch is in

https://gerrit.libreoffice.org/c/core/+/98187

It has the following limitations:
Not for docx
No import
Has no solution for character properties like "bold", which are ignored 
in LibreOffice but evaluated in PowerPoint.


I know, that unit tests are missing.

Please have a look, whether you see any problems. Otherwise I would 
commit it to master.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Question about class DrawingML

2020-07-01 Thread Regina Henschel

Hi Stephan,

thank you.

Kind regards
Regina

Stephan Bergmann schrieb am 01-Jul-20 um 13:43:

On 01/07/2020 13:38, Regina Henschel wrote:

Is it possible to set a default value for a parameter
const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet


   const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet 
= {}



so that a caller can omit it, if it is not needed in his case?


will pass an empty Reference when none is specified

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Question about class DrawingML

2020-07-01 Thread Regina Henschel

Hi,

Noel Grandin schrieb am 29-Jun-20 um 18:01:



On Mon, 29 Jun 2020 at 13:14, Regina Henschel <mailto:rb.hensc...@t-online.de>> wrote:


(1) add a member to class DrawingML
(2) extend the parameter lists in the calling chain


extending the parameter list is generally a better idea because it 
limits the scope of the extra information


Is it possible to set a default value for a parameter
const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet

so that a caller can omit it, if it is not needed in his case?

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Question about class DrawingML

2020-06-29 Thread Regina Henschel

Hi all,

I have restart looking how to export fill of a Fontwork-shape to pptx. I 
know in principle, what has to be done. The problem is, that I need 
shape properties in DrawingML::WriteRunProperties(). There exists this 
calling chain in DrawingML: WriteText() -> WriteParagraph() -> 
WriteRun() -> WriteRunProperties(). Currently only WriteText() has the 
shape properties in its variable 'rPropSet'. How can I transport the 
information to WriteRunProperties()?


Currently I can imagine
(1) add a member to class DrawingML
(2) extend the parameter lists in the calling chain

Class DrawingML has the derived classes ChartExport and ShapeExport.

Any idea how to solve the problem?

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - oox/source sd/qa

2020-06-23 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/lineproperties.cxx |   24 -
 oox/source/export/drawingml.cxx |   49 
 sd/qa/unit/data/pptx/tdf134053_dashdot.pptx |binary
 sd/qa/unit/uiimpress.cxx|   34 +++
 4 files changed, 91 insertions(+), 16 deletions(-)

New commits:
commit 1cbdc101c72309a97e9ee09c77f4fd36fbd71314
Author: Regina Henschel 
AuthorDate: Sat Jun 20 15:08:12 2020 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Jun 23 16:58:18 2020 +0200

tdf#134053 tweak dash and space length for ooxml

OOXML does not specify how line caps are applied to dashes. MS Office
keeps dash and space length for preset dash styles and for round
custom dash styles and add them for square line caps on custom dash
styles. ODF specifies, that the linecaps are added to the dashes and
the spaces are reduced, so that the dash-space pair keeps its length.

This patch changes the dash and space length on import and export so,
that they look nearly the same in LibreOffice as in MS Office.

For custom dash styles with square line cap the first dash is longer
as in MS Office. I have no solution for that. But I consider it as
minor problem, because MS Office has not even an UI for that case. It
should not hinder the improvement for the usual cases.

Change-Id: I3e3e4b7c9d71e440ed301d2be423100440cb688b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96769
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
(cherry picked from commit 3f3b50015e4fd9efc3459612a70409fca49cf390)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96796
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/oox/source/drawingml/lineproperties.cxx 
b/oox/source/drawingml/lineproperties.cxx
index 3183d5ce4c24..451da4c6aa26 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -443,6 +443,11 @@ void LineProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 sal_Int32 nLineWidth = getLineWidth(); // includes conversion from EMUs to 
1/100mm
 rPropMap.setProperty( ShapeProperty::LineWidth, nLineWidth );
 
+// line cap type
+LineCap eLineCap = moLineCap.has() ? lclGetLineCap( moLineCap.get() ) : 
LineCap_BUTT;
+if( moLineCap.has() )
+rPropMap.setProperty( ShapeProperty::LineCap, eLineCap );
+
 // create line dash from preset dash token or dash stop vector (not for 
invisible line)
 if( (eLineStyle != drawing::LineStyle_NONE) && (moPresetDash.differsFrom( 
XML_solid ) || !maCustomDash.empty()) )
 {
@@ -456,12 +461,25 @@ void LineProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 lclConvertCustomDash(aLineDash, maCustomDash);
 lclRecoverStandardDashStyles(aLineDash, nLineWidth);
 }
+
+// In MS Office (2020) for preset dash style line caps round and 
square are included in dash length.
+// For custom dash style round line cap is included, square line cap 
is added. In ODF line caps are
+// always added to dash length. Tweak the length accordingly.
+if (eLineCap == LineCap_ROUND || (eLineCap == LineCap_SQUARE && 
maCustomDash.empty()))
+{
+// Cannot use -100 because that results in 0 length in some cases 
and
+// LibreOffice interprets 0 length as 100%.
+if (aLineDash.DotLen >= 100 || aLineDash.DashLen >= 100)
+aLineDash.Distance += 99;
+if (aLineDash.DotLen >= 100)
+aLineDash.DotLen -= 99;
+if (aLineDash.DashLen >= 100)
+aLineDash.DashLen -= 99;
+}
+
 if( rPropMap.setProperty( ShapeProperty::LineDash, aLineDash ) )
 eLineStyle = drawing::LineStyle_DASH;
 }
-// line cap type
-if( moLineCap.has() )
-rPropMap.setProperty( ShapeProperty::LineCap, lclGetLineCap( 
moLineCap.get() ) );
 
 // set final line style property
 rPropMap.setProperty( ShapeProperty::LineStyle, eLineStyle );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index f14129d0a2e8..607db7a33ae7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -733,10 +733,11 @@ void DrawingML::WriteLineArrow( const Reference< 
XPropertySet >& rXPropSet, bool
 void DrawingML::WriteOutline( const Reference& rXPropSet, 
Reference< frame::XModel > const & xModel )
 {
 drawing::LineStyle aLineStyle( drawing::LineStyle_NONE );
-
 if (GetProperty(rXPropSet, "LineStyle"))
 mAny >>= aLineStyle;
 
+const LineCap aLineCap = GetProperty(rXPropSet, "LineCap") ? 
mAny.get() : LineCap_BUTT;
+
 sal_uInt32 nLineWidth = 0;
 sal_uInt32 nEmuLineWidth = 0;
 ::Color nColor;
@@ -747,6 +748,7 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Refe

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

2020-06-22 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/lineproperties.cxx |   24 -
 oox/source/export/drawingml.cxx |   49 
 sd/qa/unit/data/pptx/tdf134053_dashdot.pptx |binary
 sd/qa/unit/uiimpress.cxx|   34 +++
 4 files changed, 91 insertions(+), 16 deletions(-)

New commits:
commit 3f3b50015e4fd9efc3459612a70409fca49cf390
Author: Regina Henschel 
AuthorDate: Sat Jun 20 15:08:12 2020 +0200
Commit: Regina Henschel 
CommitDate: Mon Jun 22 10:43:08 2020 +0200

tdf#134053 tweak dash and space length for ooxml

OOXML does not specify how line caps are applied to dashes. MS Office
keeps dash and space length for preset dash styles and for round
custom dash styles and add them for square line caps on custom dash
styles. ODF specifies, that the linecaps are added to the dashes and
the spaces are reduced, so that the dash-space pair keeps its length.

This patch changes the dash and space length on import and export so,
that they look nearly the same in LibreOffice as in MS Office.

For custom dash styles with square line cap the first dash is longer
as in MS Office. I have no solution for that. But I consider it as
minor problem, because MS Office has not even an UI for that case. It
should not hinder the improvement for the usual cases.

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

diff --git a/oox/source/drawingml/lineproperties.cxx 
b/oox/source/drawingml/lineproperties.cxx
index 3183d5ce4c24..451da4c6aa26 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -443,6 +443,11 @@ void LineProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 sal_Int32 nLineWidth = getLineWidth(); // includes conversion from EMUs to 
1/100mm
 rPropMap.setProperty( ShapeProperty::LineWidth, nLineWidth );
 
+// line cap type
+LineCap eLineCap = moLineCap.has() ? lclGetLineCap( moLineCap.get() ) : 
LineCap_BUTT;
+if( moLineCap.has() )
+rPropMap.setProperty( ShapeProperty::LineCap, eLineCap );
+
 // create line dash from preset dash token or dash stop vector (not for 
invisible line)
 if( (eLineStyle != drawing::LineStyle_NONE) && (moPresetDash.differsFrom( 
XML_solid ) || !maCustomDash.empty()) )
 {
@@ -456,12 +461,25 @@ void LineProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 lclConvertCustomDash(aLineDash, maCustomDash);
 lclRecoverStandardDashStyles(aLineDash, nLineWidth);
 }
+
+// In MS Office (2020) for preset dash style line caps round and 
square are included in dash length.
+// For custom dash style round line cap is included, square line cap 
is added. In ODF line caps are
+// always added to dash length. Tweak the length accordingly.
+if (eLineCap == LineCap_ROUND || (eLineCap == LineCap_SQUARE && 
maCustomDash.empty()))
+{
+// Cannot use -100 because that results in 0 length in some cases 
and
+// LibreOffice interprets 0 length as 100%.
+if (aLineDash.DotLen >= 100 || aLineDash.DashLen >= 100)
+aLineDash.Distance += 99;
+if (aLineDash.DotLen >= 100)
+aLineDash.DotLen -= 99;
+if (aLineDash.DashLen >= 100)
+aLineDash.DashLen -= 99;
+}
+
 if( rPropMap.setProperty( ShapeProperty::LineDash, aLineDash ) )
 eLineStyle = drawing::LineStyle_DASH;
 }
-// line cap type
-if( moLineCap.has() )
-rPropMap.setProperty( ShapeProperty::LineCap, lclGetLineCap( 
moLineCap.get() ) );
 
 // set final line style property
 rPropMap.setProperty( ShapeProperty::LineStyle, eLineStyle );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index f14129d0a2e8..607db7a33ae7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -733,10 +733,11 @@ void DrawingML::WriteLineArrow( const Reference< 
XPropertySet >& rXPropSet, bool
 void DrawingML::WriteOutline( const Reference& rXPropSet, 
Reference< frame::XModel > const & xModel )
 {
 drawing::LineStyle aLineStyle( drawing::LineStyle_NONE );
-
 if (GetProperty(rXPropSet, "LineStyle"))
 mAny >>= aLineStyle;
 
+const LineCap aLineCap = GetProperty(rXPropSet, "LineCap") ? 
mAny.get() : LineCap_BUTT;
+
 sal_uInt32 nLineWidth = 0;
 sal_uInt32 nEmuLineWidth = 0;
 ::Color nColor;
@@ -747,6 +748,7 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 bool bDashSet = false;
 bool bNoFill = false;
 
+
 // get InteropGrabBag and search the relevant attributes
 OUString sColorFillScheme;
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - svx/qa svx/source

2020-06-16 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 6eaa80f5c40619d8d27c1e5dc180bd2289bd3559
Author: Regina Henschel 
AuthorDate: Wed Jun 10 20:58:54 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 16 13:15:16 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 
(cherry picked from commit 6de8d3109dffa7d4d0cc06f319cca70134f0a8f3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96335
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index d8f7fb8a5bf9..309c5155d8da 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -704,6 +704,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));
+

[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(*GetSdrObjectFromXSha

[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - svx/qa svx/source

2020-06-10 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 a7eef5557060504e6e185e8cd8d9acaf6431cd16
Author: Regina Henschel 
AuthorDate: Sun Jun 7 23:54:20 2020 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jun 10 21:52:56 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 
(cherry picked from commit 91f06123298bb8870cd6fa4e19d3aea9909f8e5b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95819
Reviewed-by: Xisco Fauli 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index a21652113ef8..b99bc0c1d576 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -671,6 +671,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] 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


ODF: gradient fill on paragraphs, i.a.

2020-06-05 Thread Regina Henschel

Hi all,

currently we have (invalid) draw:fill for header/footer and 
 containing draw:fill for paragraphs. And 
there are several requests to get gradient fill for tables. I would like 
to make a proposal for the ODF TC. But the solution is not straight 
forward, therefore I want your opinion first.


I don't like to go the way " => 
 because the latter contains much more things 
than needed for fill and especially draw:stroke will produce conflicts 
with fo:border. Therefore I would like to use the set 
style-graphic-fill-properties-attlist instead.


So I see these possibilities
A) Make a new empty element ( for example) with 
ref to style-graphic-fill-properties-attlist. Add the element to 
style-foo-properties-elements where already the  
element exists.


B) Make a new empty element ( for example) with 
ref to style-graphic-fill-properties-attlist. Add it as child to 
, bundled with suitable family items. That would result in 
something similar to the  for paragraphs.


C) Add a ref to style-graphic-properties-attlist to suitable (without 
'text') style-foo-properties-attlist, where already 
common-background-color-attlist exists. That would result in something 
similar to the current draw:fill in .


What do you think, which way it best?

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Update of https://odfvalidator.org/

2020-06-04 Thread Regina Henschel

Hi Michael,

Michael Stahl schrieb am 04-Jun-20 um 19:38:

hi Regina,

[..]
you can run the validator from the command prompt; the easiest way is to 
make sure you have --with-export-validation in autogen.input, then on a 
master recent enough to have ODF 1.3 changes "make fetch" will download 
the jar and you can run it via:


  sh bin/odfvalidator.sh


Thank you, I have put it to my tip collection. Fortunately the web 
validator works now.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Update of https://odfvalidator.org/

2020-06-04 Thread Regina Henschel

Hi Guilhem,

Guilhem Moulin schrieb am 04-Jun-20 um 20:19:

Hi there,

On Thu, 04 Jun 2020 at 19:38:29 +0200, Michael Stahl wrote:

On 04.06.20 16:58, Regina Henschel wrote:

Michael has listed in his summary of ODF 1.3 implementation some changes
for the validator, especially I read "Support 1.3 in web validator".

But https://odfvalidator.org/ has no item for ODF 1.3 and automatic
detection fails for ODF 1.3 too.


probably a question for tdf-infra? CC'ing Guilhem


Please use hostmas...@documentfoundation.org (or webs...@global.libreoffice.org)
for infra matters.

Updated the instance at https://odfvalidator.org/ , thanks for the poke.


Thank you. It works now.

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Update of https://odfvalidator.org/

2020-06-04 Thread Regina Henschel

Hi all,

Michael has listed in his summary of ODF 1.3 implementation some changes 
for the validator, especially I read "Support 1.3 in web validator".


But https://odfvalidator.org/ has no item for ODF 1.3 and automatic 
detection fails for ODF 1.3 too.


When is support for ODF 1.3 supposed to work? Is there an instance where 
support for ODF 1.3 can be tested in advance?


Kind regards
Regina

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Status of ODF 1.3 implementation in LibreOffice 7.0

2020-06-03 Thread Regina Henschel

Hi Michael,

thank you for the summary.

Michael Stahl schrieb am 03-Jun-20 um 13:16:


* Unimplemented ODF 1.3 features:

We found just 2 new features that are not or only partially implemented 
in LO, and have filed enhancement bugs for these:


* OFFICE-2117 chart data-label-series
   https://bugs.documentfoundation.org/show_bug.cgi?id=133176
* OFFICE-3765 number:fill-character in number:text-style
   https://bugs.documentfoundation.org/show_bug.cgi?id=133200
* OFFICE-3941 user-index-entry-template links
   https://bugs.documentfoundation.org/show_bug.cgi?id=121842


and another one:
* OFFICE-1148 Public Comment: Demand for modification of ODF file format 
about regression curvein spreadsheet

  Office-3959 Add moving-average to chart regression types
  https://bugs.documentfoundation.org/show_bug.cgi?id=133423
  Only the default type "prior" is implemented.

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How to register .otm files for LibreOffice 7.0 on Windows 10

2020-05-22 Thread Regina Henschel

Hi Miklos,

Miklos Vajna schrieb am 22-May-20 um 09:20:

Hi Regina,

On Thu, May 21, 2020 at 10:24:52PM +0200, Regina Henschel 
 wrote:

But the "Type" in Windows Explorer has still "OTM File" (would expect
something like 'OpenDocument Master Template')


Searching for ODT in scp2/ leads to
scp2/source/writer/registryitem_writer.scp, the same file does not
mention OTM (but it does not mention OTT and ODM). Perhaps you need to
extend that one?


so you think, that there is missing something in the code.
I have written https://bugs.documentfoundation.org/show_bug.cgi?id=133285

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


How to register .otm files for LibreOffice 7.0 on Windows 10

2020-05-21 Thread Regina Henschel

Hi all,

I have installed LibreOffice Version: 7.0.0.0.alpha1+ (x64)
Build ID: 0f855cc3f01fc77937e82738192fae4ee8325227
CPU threads: 8; OS: Windows 10.0 Build 18362; UI render: Skia/Vulkan; 
VCL: win;

Locale: de-DE (en_US); UI: en-US
Calc: CL

I have tried
right-click > Open with > More apps
In the file explorer go to
"C:\Program Files\LibreOfficeDev 7\program\soffice.exe"
Open.
It opens in OpenOffice.org 1.1.5. ???

I have tried
right-click > Open with > More apps
In the file explorer go to
"C:\Program Files\LibreOfficeDev 7\program\swriter.exe"
Open.
It opens now Writer and I get a new Global document. Using the checkbox 
"Always use this app to open .otm files" even double-click opens it now 
in Writer.


But the "Type" in Windows Explorer has still "OTM File" (would expect 
something like 'OpenDocument Master Template'), and the icon there is 
the Writer icon, where it should be a template-like icon.


Is something missing in LibreOffice 7.0, or do I make wrong steps or 
miss something?


Kind regards
Regina


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Guidance to where in the codebase the Menu structure is built

2020-05-20 Thread Regina Henschel

KKing schrieb am 20-May-20 um 08:55:

Thankyou both.

Will investigate both approaches and may also consider writing a 
satellite program that reads the registrymodifications.xcu file for the 
recent file entries and spawn LO with a selected file.


For using macros you find ideas in
https://listarchives.libreoffice.org/global/users/msg39905.html

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Guidance to where in the codebase the Menu structure is built

2020-05-18 Thread Regina Henschel

KKing schrieb am 18-May-20 um 16:13:
I have pulled code for Libreoffice 7.0.0.0 and have built it on Debian 
10 and seems to run fine.


I would like to look at modifying the default Menu structure potentially 
dependant on the user or a startup parameter.


Could someone point me to where in the codebase the default Menus get 
built?


There are a couple of things want to look at, but one of the main 
requests we get is if the old school list of 9 most recent documents (or 
we have had variation request of 9 favourite) can be assigned to the 
file menu so it is easier and quicker to just use keyboard to get access 
to the files e.g.  Alt+F-2   would load the 2nd most recent document.


The list of recent files is in file registrymodifications.xcu in the 
user directory. It should be possible to read it from there via macro, 
then make macros which opens the 1st, 2nd ... and then add items to the 
menu, which call these macros.


Or if using mouse it acceptable, the field "Load URL" in a toolbar might 
work for you too. That field shows the full path and not only the 
document name.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How to use running slideshow in unit test?

2020-05-15 Thread Regina Henschel

Hi Thorsten,

Thorsten Behrens schrieb am 14-May-20 um 23:28:

Hi Regina,

better late than never -

Regina Henschel wrote:

xPresentation2->start();
CPPUNIT_ASSERT(xPresentation2->isRunning());

But the assertion fails.


Many slideshow activities happen timer-based, that also includes the
initial start.

I'd stick a Scheduler::ProcessEventsToIdle() after the start() call,
and see how far that gets you.


Unfortunately that does not work. The assertion still fails.



It _might_ turn out that in the end, a subsequent or uitest might be
more suitable to what you'd need here...


I've never done anything like this before. Are there any examples or 
instructions, maybe regarding slideshow?


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2020-04-25 Thread Regina Henschel (via logerrit)
 sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp |binary
 sd/qa/unit/misc-tests.cxx |   25 
 sd/source/ui/slideshow/slideshow.cxx  |   26 +
 sd/source/ui/view/drviews5.cxx|   17 +++
 slideshow/source/engine/slideshowimpl.cxx |   27 +++---
 xmloff/source/draw/layerimp.cxx   |9 ++
 6 files changed, 94 insertions(+), 10 deletions(-)

New commits:
commit eb2d669af61b8808d5819b16157c59d3c6c3e03b
Author: Regina Henschel 
AuthorDate: Sun Apr 19 18:22:11 2020 +0200
Commit: Regina Henschel 
CommitDate: Sat Apr 25 14:49:30 2020 +0200

tdf#129898 Use layer DrawnInSlideshow in edit mode

If 'Mouse pointer as pen' is set in slideshow settings, painting in
slideshow becomes persistent. A layer DrawnInSlideshow is created
for that purpose during slideshow. But that layer was not known to
the view from where the slideshow was started.
Generating a layer had been done regardless whether such layer
already exists or not. That had produced several layers with
identical name. That may not happen, because layers are identified
by name.

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

diff --git a/sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp 
b/sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp
new file mode 100644
index ..796b57b2cb84
Binary files /dev/null and 
b/sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp differ
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 3e23752aa477..53707a5676a2 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -82,6 +82,7 @@ public:
 void testTdf98839_ShearVFlipH();
 void testTdf130988();
 void testTdf131033();
+void testTdf129898LayerDrawnInSlideshow();
 
 CPPUNIT_TEST_SUITE(SdMiscTest);
 CPPUNIT_TEST(testTdf96206);
@@ -102,6 +103,7 @@ public:
 CPPUNIT_TEST(testTdf98839_ShearVFlipH);
 CPPUNIT_TEST(testTdf130988);
 CPPUNIT_TEST(testTdf131033);
+CPPUNIT_TEST(testTdf129898LayerDrawnInSlideshow);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -854,6 +856,29 @@ void SdMiscTest::testTdf131033()
 xDocShRef->DoClose();
 }
 
+void SdMiscTest::testTdf129898LayerDrawnInSlideshow()
+{
+// Versions LO 6.2 to 6.4 have produced files, where the layer 
DrawnInSlideshow has
+// got visible=false and printable=false attributes. Those files should be 
repaired now.
+const OUString sURL = 
"sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp";
+sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc(sURL), 
ODP);
+CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocShRef.is());
+
+// Verify model
+const OUString sName = "DrawnInSlideshow";
+SdrLayerAdmin& rLayerAdmin = xDocShRef->GetDoc()->GetLayerAdmin();
+SdrLayer* pLayer = rLayerAdmin.GetLayer(sName);
+CPPUNIT_ASSERT_MESSAGE("No layer DrawnInSlideshow", pLayer);
+CPPUNIT_ASSERT(pLayer->IsVisibleODF() && pLayer->IsPrintableODF());
+
+// Verify view
+sd::DrawViewShell* pViewShell = 
static_cast(xDocShRef->GetViewShell());
+SdrPageView* pPageView = pViewShell->GetView()->GetSdrPageView();
+CPPUNIT_ASSERT(pPageView->IsLayerVisible(sName) && 
pPageView->IsLayerPrintable(sName));
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/ui/slideshow/slideshow.cxx 
b/sd/source/ui/slideshow/slideshow.cxx
index e43d08b960a9..1b63f0d06f14 100644
--- a/sd/source/ui/slideshow/slideshow.cxx
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -35,6 +36,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -766,6 +768,30 @@ void SAL_CALL SlideShow::end()
 }
 }
 
+// In case mbMouseAsPen was set, a new layer DrawnInSlideshow 
might have been generated
+// during slideshow, which is not known to FrameView yet.
+if (any2bool(getPropertyValue("UsePen"))
+&& 
pViewShell->GetDoc()->GetLayerAdmin().GetLayer("DrawnInSlideshow"))
+{
+SdrLayerIDSet aDocLayerIDSet;
+
pViewShell->GetDoc()->GetLayerAdmin().getVisibleLayersODF(aDocLayerIDSet);
+if (pViewShell->GetFrameView()->GetVisibleLayers() != 
aDocLayerIDSet)
+{
+
pViewShell->GetFrameView()->SetVisibleLayers(aDocLayerIDSet);
+ 

How to use running slideshow in unit test?

2020-04-19 Thread Regina Henschel

Hi all,

to make a unit test for tdf#129898 
(https://gerrit.libreoffice.org/c/core/+/92502), I would need a running 
slideshow in full screen mode, and then use mouse to paint something.


How do I get a running slideshow? I have not found any test, which uses 
a running slideshow.


I have tried this in sd\qa\unit\misc-tests.cxx:

const OUString sURL("/sd/qa/unit/data/tdf129898_MousePointerAsPen.odp");
sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc(sURL), 
ODP);
sd::DrawViewShell* pDrawViewShell = 
static_cast(xDocShRef -> GetViewShell());
uno::Reference xPresentation2 = 
xDocShRef->GetDoc()->getPresentation();

xPresentation2->start();
CPPUNIT_ASSERT(xPresentation2->isRunning());

But the assertion fails.

In debugger I see, mbIsInStartup=true and mxController empty.

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: ESC meeting minutes: 2020-04-16

2020-04-16 Thread Regina Henschel

Miklos Vajna schrieb am 16-Apr-20 um 16:33:


* Tenders for budget 2020 (Miklos, Thorsten)
   + voting deadline was ideally today
   + still chasing a few people to vote (Thorsten)
   + propose to wait till the end of the call
   + tonight: hand over to the board, board meeting tomorrow


Where would I have been able to vote? Where was it announced?

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Need help with views in Impress

2020-04-12 Thread Regina Henschel

Hi all,

if you check "Mouse pointer as pen" in "Slide Show Settings", then the 
graphics, which you paint during running slideshow, are kept when the 
slideshow is stopped and available in edit mode.

The problem is, that they are not visible in the edit window (bug 129898).

Such graphics are assigned to layer "DrawnInSlideshow". It is generated 
during the slideshow. That happens in 
SlideShowImpl::registerUserPaintPolygons. The layer gets the correct 
visibility setting there.


If you create a second view via menu Window > New Window, then the 
paintings are visible. The document has the correct information.


The edit window from where the slideshow starts is remembered with
mpOldActiveWindow = mpViewShell->GetActiveWindow();
in the ctor of SlideshowImpl and restored with
mpViewShell->SetActiveWindow(mpOldActiveWindow);
in method disposing().

How can I get this remembered edit window, which is used after finishing 
the slideshow, to be updated to the changed layer set of the document?


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: remove attribute table:cell-range-address at element in ODF 1.4

2020-04-03 Thread Regina Henschel

Hi Eike,

thank you for looking at it.

Eike Rathke schrieb am 02-Apr-20 um 14:50:

Hi Regina,

On Tuesday, 2020-03-31 16:56:59 +0200, Regina Henschel wrote:


Does anyone know, whether there exists a scenario (besides sx* import
filter) where it makes a difference for LibreOffice, whether the attribute
exists or not?


Of the places that  git grep -w XML_CELL_RANGE_ADDRESS   lists there may
be one of interest

xmloff/source/chart/SchXMLImport.cxx
SchXMLImportHelper::GetPlotAreaAttrTokenMap() has

 { XML_NAMESPACE_TABLE,  XML_CELL_RANGE_ADDRESS, 
XML_TOK_PA_CHART_ADDRESS },

XML_TOK_PA_CHART_ADDRESS is used in
xmloff/source/chart/SchXMLPlotAreaContext.cxx
SchXMLPlotAreaContext::StartElement() to set mrChartAddress and
m_rbHasRangeAtPlotArea = true (that both are references, so wherever
used outside..) and m_rbHasRangeAtPlotArea being true _may_ lead to an
internal data provider not being created as a last fallback further
down. >
I don't know of the consequences or how things are later used from there.


I have made some tests. I seems the "normal" charts are currently always 
written with the needed chart:value-cell-range-address attribute of 
 element.


One problem are charts in reports. The report builder has severe 
problems with charts that make testing impossible.


Another problem are pivot charts. But their use of 
table:cell-range-address is faulty anyway. So a rework can use a 
solution without it.


I have put all these into
https://bugs.documentfoundation.org/show_bug.cgi?id=131862

Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: remove attribute table:cell-range-address at element in ODF 1.4

2020-04-01 Thread Regina Henschel

Hi Alex,

Alexander Thurgood schrieb am 01-Apr-20 um 12:21:

Le 31/03/2020 à 16:56, Regina Henschel a écrit :

Hi Regina,



Does anyone know, whether there exists a scenario (besides sx* import
filter) where it makes a difference for LibreOffice, whether the
attribute exists or not?




I don't know whether this is the case, but would Charts in Base Reports
be concerned ?


Thank you for the hint. Those charts might be concerned. Unfortunately I 
could not make an example. I hit bug #117162 and bug 117159. Does anyone 
has a suitable odb test file?


The questions are: Does the chart use the attribute:table:cell-range at 
all? If yes, does it still works, if the attribute is manually removed 
in the file?


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


remove attribute table:cell-range-address at element in ODF 1.4

2020-03-31 Thread Regina Henschel

Hi all,

the ODF TC is going to remove table:cell-range-address as attribute from 
the  element. This attribute is already marked as 
"deprecated" in ODF 1.2. [1]


I have made some tests in Calc, Impress and Writer, where I have removed 
the attribute manually from the files. I have found no difference, when 
open that file then.


In times of OOo1, with own old XML format, this attribute was used to 
distinguish whether a chart references external data or uses its 
internal table.


Excel does not write this attribute at all.

Does anyone know, whether there exists a scenario (besides sx* import 
filter) where it makes a difference for LibreOffice, whether the 
attribute exists or not?


Kind regards
Regina

[1] https://issues.oasis-open.org/browse/OFFICE-3741
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: GSoC Propsal: Styles Inspector

2020-03-30 Thread Regina Henschel

Hi Harshit Jain,

Please excuse, that you do not have got a response on this list. Your 
topic touches the user interface. Therefore I suggest, that you sent a 
mail to the design mailing list too.

https://wiki.documentfoundation.org/Design/Mailing_List

Besides that, I cannot help you further, because Writer is not my area.

Kind regards
Regina


Harshit Jain schrieb am 27-Mar-20 um 11:04:

Greetings,
Again requesting you all to please review my proposal so that I can make 
any final changes if needed.


On Wed, Mar 25, 2020 at 3:07 PM Harshit Jain 
mailto:harshitjain1371...@gmail.com>> wrote:


Greetings!
I am Harshit Jain, a senior undergraduate student pursuing
Electrical Engineering at the Indian Institute of Technology Delhi.
Being passionate about software development, I now want to start
contributing to open-source and GSoC is indeed a great opportunity
to embark upon this journey.
Upon going through the list of projects, I found the project
regarding implementing a Styles Inspector really interesting and
would like to work on this as a part of the GSoC project. I have
already drafted a proposal on the same and shared through the
official GSoC portal. I request you all to review my proposal and
give any suggestions which may be required in my proposal.
Link: https://1drv.ms/w/s!At4gk155x7NehSaCXzcJ67J13orQ?e=Kb24OW

As far as my contributions are concerned, I have just started
contributing easy patches to the libreoffice code and would like to
become more active and contribute more in the days to come. The
details of the patch submitted are as follows:
Status: Merged
Gerrit link: https://gerrit.libreoffice.org/c/core/+/90901
Bug link: https://bugs.documentfoundation.org/show_bug.cgi?id=124176

Again requesting you all to please review my proposal and suggest
any changes if needed.

Thanks,
Harshit Jain


Regards,
Harshit Jain


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: GSoC Project Proposal: Multi-color gradient

2020-03-26 Thread Regina Henschel

Hi Pranesh,

Pranesh Ulleri schrieb am 26-Mar-20 um 17:21:
[..]
For this Google Summer of Code, I would like to contribute to the 
"Multi-color gradient". This is the link to the proposal that I have 
drafted. [ Link To The Draft ] 
. 
I request you to review this draft and give your valuable feedback.


It's wonderful that you want to take care of multi-color gradients. It's 
a complex issue. The members here on the mailing list have very 
different knowledge and skills. So don't hesitate to ask here on the 
list and maybe learn about completely different aspects.


For example, I work with the ODF file format. From this point of view 
you should know that the ODF file format has two completely different 
gradients [1].
One is the gradient defined by the element . It is 
implemented in LibreOffice, and the user interface belongs to this 
gradient. It allows only two colors, but has very different shapes of 
the gradient.
The other one is the gradient defined by the elements 
 and . It allows multiple 
colors, but is not implemented yet.


For all solutions, not only internal handling and user interface have to 
be considered, but also how the style information can be stored in the file.


I wish you every success in your work.

Kind regards
Regina

[1] 
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#element-draw_gradient

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: RFC: Sane rectangle class

2020-03-20 Thread Regina Henschel

Hi,

Tomaž Vajngerl schrieb am 20-Mar-20 um 18:13:


Hi,

Do you know a specific case where that actually matters? My personal
position
on integers is "use int, unless you explicitly need something else".


We are dealing with 100th-mm or twip units, which can get quite big (in 
writer we are always referencing relative from page 1 AFAIK) and could 
go to use EMU in the future (because it resolves lovely both imperial 
and metric, so my hope is that we could get rid of MapMode nonsense), so 
I would go with sal_Int64. Anyway, a compiler / architecture dependent 
type is the last one I would use.


The problem for huge values is not Writer but Calc. For example, make a 
sheet with row height 10cm on all rows. Insert a shape in A2000 and look 
at the position information in the status bar. (Shapes are anchored to 
page as default). Then insert a shape in A3000 and look again, then in 
A1. And the sheet goes up to A1048576!


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: RFC: Sane rectangle class

2020-03-20 Thread Regina Henschel

Hi Luboš,

Luboš Luňák schrieb am 19-Mar-20 um 16:13:


  Hello,

  yes, this is about the tools::Rectangle nightmare of an API (in case you
don't know, it's this [1] ). I'm hunting an off-by-one error somewhere in
VCL, and it's hard to find it when I can't even tell which parts of the code
are right or wrong :(.


These off-by-one problems occur earlier than in VCL. For example changes 
to maSnapRect when a shape is transformed by shear and rotation.




  This has been already discussed a couple of times, e.g. in the [2] thread,
and apparently there's no reasonable way to fix tools::Rectangle. Which means
we basically have two choices, 1) live with it, suck it up, and have code
full of workarounds where you can't be sure what's right, or 2) use something
else. Since I'm fed up with 1), I suggest we try 2). Note that it doesn't
mean doing one big change, I rather propose that we get a replacement for
tools::Rectangle and slowly transition to it.


I see the problem not in tools::Rectangle itself, but in the fact, that 
it uses integer and not double. Using double makes width = right - left 
in all cases and would solve accuracy problems in manipulating shapes. 
It would be up to renderer to do a suitable conversion to integer.


We have already basegfx::B2DRange (or its alias B2DRectangle) and the 
struct RealRectangle2D in the API for using double. But I see no way but 
a big change to get the SdrObject-hierarchy to not use tools::Rectangle 
but basegfx::B2DRange.


[..]


  So, yeah, I'm proposing a new standard Rectangle class (and I know xkcd, and
I'm still serious). My idea is roughly that there will be some
tools::NewRectangle (or whatever usable name), it will be more or less like
tools::Rectangle, but it'll make things clear, for example:
- internal representation will be whatever sane thing will work, e.g.
x,y,width,height , and it won't matter for the API
- empty rectangle is simply width == 0 || height == 0
- no (int, int, int, int) ctor
- we can try without bottom and right functions, or we can define what they
mean and be consistent about it (no idea, no preference)
- there will be things like FromOpenRectangle() to allow converting from/to
tools::Rectangle, making it hopefully easier to gradually move over


You can already use getWidth() instead of GetWidth(). A new kind of 
rectangle does not solve the problem, that you have to examine each use, 
whether including or excluding the edge is better. I think, only 
switching to double and using it a long as possible would really help to 
reduce off-by-one problems and increase accuracy.


Kind regards
Regina
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: ODF 1.2, xml:id attribute

2020-03-04 Thread Regina Henschel

Hi Olivier,

what do you want to do with 'xml:id'? Its value is unique in a document, 
but it need not be stable in the lifetime of a document.


Kind regards
Regina

Olivier Hallot schrieb am 03-Mar-20 um 22:42:

Hi

Is there a widget in the user interface or API to assign the xml:id [1]
attribute to an object?

for example, I'd like to add xml:id to every  element in a file.


[1] 19.914 xml:id
The xml:id attribute is standardized by the W3C [XML-ID] and gives an
element a unique identification in its XML file.

Kind regards



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2020-03-04 Thread Regina Henschel (via logerrit)
 sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg |binary
 sd/qa/unit/misc-tests.cxx  |   26 +
 svx/source/engine3d/view3d.cxx |   16 +++
 3 files changed, 34 insertions(+), 8 deletions(-)

New commits:
commit a33484276ed16af7599a59653677f21f051c97e8
Author: Regina Henschel 
AuthorDate: Tue Mar 3 18:12:36 2020 +0100
Commit: Regina Henschel 
CommitDate: Wed Mar 4 14:22:49 2020 +0100

tdf#131033 consider 20° tilt of 3D in 2D projection

Error was, that the default 20° tilt of a newly created 3D scene was
not applied to the rectangle for the 2D projection and therefore the
projection was not high enough. The used method is the same as used
when dragging a scene to tilt it. I don't know whether there exists
a simpler way.

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

diff --git a/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg 
b/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg
new file mode 100644
index ..f6cfc96e6b12
Binary files /dev/null and b/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg 
differ
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 6871b2d432e3..3e23752aa477 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -81,6 +81,7 @@ public:
 void testTdf120527();
 void testTdf98839_ShearVFlipH();
 void testTdf130988();
+void testTdf131033();
 
 CPPUNIT_TEST_SUITE(SdMiscTest);
 CPPUNIT_TEST(testTdf96206);
@@ -100,6 +101,7 @@ public:
 CPPUNIT_TEST(testTdf120527);
 CPPUNIT_TEST(testTdf98839_ShearVFlipH);
 CPPUNIT_TEST(testTdf130988);
+CPPUNIT_TEST(testTdf131033);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -828,6 +830,30 @@ void SdMiscTest::testTdf130988()
 xDocShRef->DoClose();
 }
 
+void SdMiscTest::testTdf131033()
+{
+const OUString sURL("sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg");
+sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc(sURL), 
ODG);
+
+// The document contains a polygon, so that emulate command 
.uno:ConvertInto3DLathe
+// by direct call of ConvertMarkedObjTo3D works.
+// It produces a rotation around a vertical axis, which is far away from 
the
+// generating shape.
+sd::ViewShell* pViewShell = xDocShRef->GetViewShell();
+E3dView* pView = dynamic_cast(pViewShell->GetView());
+pView->MarkNextObj();
+pView->ConvertMarkedObjTo3D(false, basegfx::B2DPoint(11000.0, -5000.0), 
basegfx::B2DPoint(11000.0, -9000.0));
+E3dScene* pObj = dynamic_cast(pView->GetMarkedObjectByIndex(0));
+CPPUNIT_ASSERT(pObj);
+
+// Error was, that the 2D representation of the scene did not contain the 
default 20°
+// rotation of the new scene around x-axis and therefore was not high 
enough.
+const double fSnapRectHeight = pObj->GetSnapRect().getHeight();
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("2D height", 7096.0, fSnapRectHeight, 
1.0);
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index c756c90439c8..77d94ab1c581 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -969,23 +970,22 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const 
basegfx::B2DPoint& rPnt1
 MarkObj(pScene, pPV);
 
 // Rotate Rotation body around the axis of rotation
-basegfx::B3DHomMatrix aRotate;
-
 if(!bExtrude && fRot3D != 0.0)
 {
+basegfx::B3DHomMatrix aRotate;
 aRotate.rotate(0.0, 0.0, fRot3D);
+pScene->SetTransform(aRotate * pScene->GetTransform());
 }
 
 // Set default rotation
-aRotate.rotate(DEG2RAD(20.0), 0.0, 0.0);
-
-if(!aRotate.isIdentity())
 {
+basegfx::B3DHomMatrix aRotate;
+aRotate.rotate(DEG2RAD(20.0), 0.0, 0.0);
+// E3DModifySceneSnapRectUpdater updates the 2D representation of 
the scene.
+// It prepares things in ctor and acts in dtor.
+E3DModifySceneSnapRectUpdater 
aUpdater(pScene->getSdrObjectFromSdrObjList());
 pScene->SetTransform(aRotate * pScene->GetTransform());
 }
-
-// Invalid SnapRects of objects
-pScene->SetSnapRect(aRect);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-29 Thread Regina Henschel (via logerrit)
 sd/qa/unit/data/tdf130988_3D_create_lathe.odg |binary
 sd/qa/unit/misc-tests.cxx |   26 ++
 svx/source/engine3d/view3d.cxx|5 +
 3 files changed, 31 insertions(+)

New commits:
commit 946eb391028284ca1b0b9927891a8e21c1c478f9
Author: Regina Henschel 
AuthorDate: Fri Feb 28 18:09:34 2020 +0100
Commit: Regina Henschel 
CommitDate: Sat Feb 29 13:10:24 2020 +0100

tdf#130988 add y-axis up<->down in create 3D obj

Creating the matrix aLatheMat uses a coordinate system with y-axis
pointing up, but aPolyPoly2D and ctor of E3dLatheObj uses y-axis
pointing down. Converting was missing. The error was inherited
from OOo2.

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

diff --git a/sd/qa/unit/data/tdf130988_3D_create_lathe.odg 
b/sd/qa/unit/data/tdf130988_3D_create_lathe.odg
new file mode 100644
index ..e2b37ef60235
Binary files /dev/null and b/sd/qa/unit/data/tdf130988_3D_create_lathe.odg 
differ
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 852cdc03ece6..6871b2d432e3 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -55,6 +55,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -78,6 +80,7 @@ public:
 void testTdf119956();
 void testTdf120527();
 void testTdf98839_ShearVFlipH();
+void testTdf130988();
 
 CPPUNIT_TEST_SUITE(SdMiscTest);
 CPPUNIT_TEST(testTdf96206);
@@ -96,6 +99,7 @@ public:
 CPPUNIT_TEST(testTdf119956);
 CPPUNIT_TEST(testTdf120527);
 CPPUNIT_TEST(testTdf98839_ShearVFlipH);
+CPPUNIT_TEST(testTdf130988);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -802,6 +806,28 @@ void SdMiscTest::testTdf98839_ShearVFlipH()
 xDocShRef->DoClose();
 }
 
+void SdMiscTest::testTdf130988()
+{
+const OUString sURL("sd/qa/unit/data/tdf130988_3D_create_lathe.odg");
+sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc(sURL), 
ODG);
+
+//emulate command .uno:ConvertInto3DLathe
+sd::ViewShell* pViewShell = xDocShRef->GetViewShell();
+E3dView* pView = dynamic_cast(pViewShell->GetView());
+pView->MarkNextObj();
+pView->ConvertMarkedObjTo3D(false, basegfx::B2DPoint(8000.0, -3000.0), 
basegfx::B2DPoint(3000.0, -8000.0));
+E3dScene* pObj = dynamic_cast(pView->GetMarkedObjectByIndex(0));
+CPPUNIT_ASSERT(pObj);
+
+// Error was, that the created 3D object had a wrong path. Instead 
examining
+// the path directly, I use the scene distance, because that is easier. The
+// scene distance is calculated from the object while creating.
+const double fDistance = pObj->GetDistance();
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("D3DSceneDistance", 7071.0, 
fDistance, 0.5);
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 4d7e13897166..c756c90439c8 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -737,8 +737,13 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* 
pScene, SdrObject* pObj, boo
 }
 else
 {
+// rLatheMat expects coordinates with y-axis up, pPath uses y-axis 
down
+basegfx::B2DHomMatrix aFlipVerticalMat(1.0, 0.0, 0.0, 0.0, -1.0, 
0.0);
 basegfx::B2DPolyPolygon aPolyPoly2D(pPath->GetPathPoly());
+aPolyPoly2D.transform(aFlipVerticalMat);
 aPolyPoly2D.transform(rLatheMat);
+// ctor E3dLatheObj expects coordinates with y-axis down
+aPolyPoly2D.transform(aFlipVerticalMat);
 p3DObj = new E3dLatheObj(pObj->getSdrModelFromSdrObject(), 
aDefault, aPolyPoly2D);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


<    1   2   3   4   5   6   7   8   9   10   >