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

2022-08-09 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx  |   16 
 chart2/qa/extras/data/pptx/tdf150176.pptx  |binary
 oox/source/drawingml/chart/objectformatter.cxx |4 ++--
 3 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 071a36e042c76286fedb38f479dac79f29b661f9
Author: Balazs Varga 
AuthorDate: Mon Aug 8 18:56:04 2022 +0200
Commit: Balazs Varga 
CommitDate: Tue Aug 9 11:35:42 2022 +0200

tdf#150176 pptx chart import: fix automatic border style

Do not set the default border style for chart area in case of
pptx charts, if it is came from the MSO as an automtic line style.

regression from commit: 0dac43445b35da7e554dd4d7574c59611a0d0be1
(tdf#81437 XLSX import: fix missing chart border)

Change-Id: Iaaaecc1dffe80c3f1528851e707236f2f7228bee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137993
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 316520fb5197..4e5b3a83130e 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -85,6 +85,7 @@ public:
 void testTdf126033();
 void testAutoBackgroundXLSX();
 void testAutoChartAreaBorderPropXLSX();
+void testAutoChartAreaBorderPropPPTX();
 void testChartAreaStyleBackgroundXLSX();
 void testChartHatchFillXLSX();
 void testAxisTextRotationXLSX();
@@ -178,6 +179,7 @@ public:
 CPPUNIT_TEST(testTdf126033);
 CPPUNIT_TEST(testAutoBackgroundXLSX);
 CPPUNIT_TEST(testAutoChartAreaBorderPropXLSX);
+CPPUNIT_TEST(testAutoChartAreaBorderPropPPTX);
 CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX);
 CPPUNIT_TEST(testChartHatchFillXLSX);
 CPPUNIT_TEST(testAxisTextRotationXLSX);
@@ -1106,6 +1108,20 @@ void Chart2ImportTest::testAutoChartAreaBorderPropXLSX()
 sal_Int32(26), nWidth);
 }
 
+void Chart2ImportTest::testAutoChartAreaBorderPropPPTX()
+{
+load(u"/chart2/qa/extras/data/pptx/", u"tdf150176.pptx");
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+// Test "Automatic" chartarea border style/color/width.
+Reference xPropSet = xChartDoc->getPageBackground();
+CPPUNIT_ASSERT(xPropSet.is());
+drawing::LineStyle eStyle = 
xPropSet->getPropertyValue("LineStyle").get();
+CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chartarea border should be 
loaded as none style for pptx.",
+drawing::LineStyle_NONE, eStyle);
+}
+
 void Chart2ImportTest::testChartAreaStyleBackgroundXLSX()
 {
 load(u"/chart2/qa/extras/data/xlsx/", u"chart-area-style-background.xlsx");
diff --git a/chart2/qa/extras/data/pptx/tdf150176.pptx 
b/chart2/qa/extras/data/pptx/tdf150176.pptx
new file mode 100644
index ..fa217f92c822
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf150176.pptx differ
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index 14c96d166a03..5644b9eedf09 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -829,8 +829,8 @@ LineFormatter::LineFormatter( ObjectFormatterData& rData, 
const AutoFormatEntry*
 if( const Theme* pTheme = mrData.mrFilter.getCurrentTheme() )
 if( const LineProperties* pLineProps = pTheme->getLineStyle( 
pAutoFormatEntry->mnThemedIdx ) )
 *mxAutoLine = *pLineProps;
-// set automatic border property for chartarea, because of tdf#81437 and 
tdf#82217
-if ( eObjType == OBJECTTYPE_CHARTSPACE )
+// set automatic border property for chartarea, because of tdf#81437 and 
tdf#82217, except for pptx (tdf#150176)
+if ( eObjType == OBJECTTYPE_CHARTSPACE && 
!rData.mrFilter.getFileUrl().endsWithIgnoreAsciiCase(".pptx") )
 {
 mxAutoLine->maLineFill.moFillType = 
oox::GraphicHelper::getDefaultChartAreaLineStyle();
 mxAutoLine->moLineWidth = 
oox::GraphicHelper::getDefaultChartAreaLineWidth();


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

2021-08-23 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx|   17 ++---
 chart2/qa/extras/data/xlsx/tdf142351.xlsx|binary
 oox/source/drawingml/chart/axisconverter.cxx |4 ++--
 3 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit e701732725dd641741f39020d7dc965bc4db765d
Author: Balazs Varga 
AuthorDate: Tue Aug 17 14:28:48 2021 +0200
Commit: László Németh 
CommitDate: Mon Aug 23 11:50:29 2021 +0200

tdf#142351 chart ooxml import: fix category axis cross position

Set PROP_CrossoverPosition value regardless of the mrModel.mbAuto
value, which is a different thing. This element specifies that
this axis is a date or text axis based on the data that is used for
the axis labels, not a specific choice.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 89dcdeb529fd..608905e59328 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -531,10 +531,21 @@ void Chart2ExportTest::testBarChart()
 
 void Chart2ExportTest::testCrosses()
 {
-load(u"/chart2/qa/extras/data/docx/", "Bar_horizontal_cone.docx");
-xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open 
XML Text");
+// test crosses val="autoZero" with DOCX
+{
+load(u"/chart2/qa/extras/data/docx/", "Bar_horizontal_cone.docx");
+xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office 
Open XML Text");
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", "val", "autoZero");
+}
+// tdf#142351: test crossesAt val="-50" with XLSX
+{
+load(u"/chart2/qa/extras/data/xlsx/", "tdf142351.xlsx");
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office 
Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
 
-assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", 
"val", "autoZero");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crossesAt", "val", "-50");
+}
 }
 
 void Chart2ExportTest::testScatterChartTextXValues()
diff --git a/chart2/qa/extras/data/xlsx/tdf142351.xlsx 
b/chart2/qa/extras/data/xlsx/tdf142351.xlsx
new file mode 100644
index ..0414bb3f1625
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf142351.xlsx differ
diff --git a/oox/source/drawingml/chart/axisconverter.cxx 
b/oox/source/drawingml/chart/axisconverter.cxx
index 7aa141c0f798..4620f5b5a15c 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -372,8 +372,8 @@ void AxisConverter::convertFromModel(const 
Reference& rxCoord
 case XML_max:   eAxisPos = cssc::ChartAxisPosition_END; 
break;
 case XML_autoZero:  eAxisPos = cssc::ChartAxisPosition_ZERO;   
break;
 }
-if( !mrModel.mbAuto )
-aAxisProp.setProperty( PROP_CrossoverPosition, eAxisPos );
+
+aAxisProp.setProperty( PROP_CrossoverPosition, eAxisPos );
 
 // calculate automatic origin depending on scaling mode of crossing 
axis
 bool bCrossingLogScale = pCrossingAxis && lclIsLogarithmicScale( 
*pCrossingAxis );


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

2021-06-16 Thread Sarper Akdemir (via logerrit)
 chart2/qa/extras/chart2import.cxx|4 -
 chart2/qa/extras/xshape/chart2xshape.cxx |2 
 oox/source/drawingml/textbody.cxx|1 
 oox/source/ppt/pptshape.cxx  |  104 +++
 sd/qa/unit/data/pptx/numfmt.pptx |binary
 sd/qa/unit/data/pptx/slidenum_field.pptx |binary
 sd/qa/unit/import-tests.cxx  |2 
 7 files changed, 109 insertions(+), 4 deletions(-)

New commits:
commit 166671f4aa19deec47c10a220ae1d29fa57faa93
Author: Sarper Akdemir 
AuthorDate: Sun Apr 25 15:59:39 2021 +0300
Commit: Miklos Vajna 
CommitDate: Wed Jun 16 14:32:41 2021 +0200

tdf#59323: pptx import: import footer fields as properties

Makes footer, slidenum and datetime placeholders that are inserted to
the slides themselves on pptx files imported as slide properties if it
is possible to do so without losing information (style, position etc.)

If that is not the case and the footers have some special style applied
to them that isn't inherited from master slides, fallbacks to the current
implementation importing them as shapes.

Also since the default way of displaying slide footers in LO use the
respective text fields on master slides, information in master/layout
slide datetime and footer placeholders respectively get replaced with
 text fields and  text fields.

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 41d55297a336..383e4524468a 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -764,7 +764,7 @@ void Chart2ImportTest::testBnc864396()
 void Chart2ImportTest::testBnc889755()
 {
 load(u"/chart2/qa/extras/data/pptx/", "bnc889755.pptx");
-uno::Reference 
xChartDoc(getChartDocFromDrawImpress(0, 6), uno::UNO_QUERY_THROW);
+uno::Reference 
xChartDoc(getChartDocFromDrawImpress(0, 5), uno::UNO_QUERY_THROW);
 CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider());
 
 uno::Reference< chart2::XInternalDataProvider > xDataProvider( 
xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW );
@@ -792,7 +792,7 @@ void Chart2ImportTest::testBnc889755()
 uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
 uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
 // Shape "Title 3"
-uno::Reference xShapeProps(xPage->getByIndex(5), 
uno::UNO_QUERY_THROW);
+uno::Reference xShapeProps(xPage->getByIndex(4), 
uno::UNO_QUERY_THROW);
 awt::Gradient aTransparence;
 xShapeProps->getPropertyValue("FillTransparenceGradient") >>= 
aTransparence;
 CPPUNIT_ASSERT(aTransparence.StartColor != aTransparence.EndColor);
diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx 
b/chart2/qa/extras/xshape/chart2xshape.cxx
index 895f84bb62a4..4964bfc455ee 100644
--- a/chart2/qa/extras/xshape/chart2xshape.cxx
+++ b/chart2/qa/extras/xshape/chart2xshape.cxx
@@ -177,7 +177,7 @@ void Chart2XShapeTest::testTdf76649TrendLineBug()
 void Chart2XShapeTest::testTdf88154LabelRotatedLayout()
 {
 load(u"chart2/qa/extras/xshape/data/pptx/", 
"tdf88154_LabelRotatedLayout.pptx");
-uno::Reference xChartDoc = 
getChartDocFromDrawImpress(0, 6);
+uno::Reference xChartDoc = 
getChartDocFromDrawImpress(0, 5);
 uno::Reference xDumper(xChartDoc, UNO_QUERY_THROW);
 OUString rDump = xDumper->dump();
 OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8);
diff --git a/oox/source/drawingml/textbody.cxx 
b/oox/source/drawingml/textbody.cxx
index b665e7b355a0..f4da6886a69c 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -35,6 +35,7 @@ TextBody::TextBody()
 }
 
 TextBody::TextBody( const TextBodyPtr& pBody )
+: mbHasNoninheritedBodyProperties( false )
 {
 if( pBody ) {
 maTextProperties = pBody->maTextProperties;
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 4e07ae104db3..f1c4a892ac14 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -20,8 +20,12 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
 
+#include 
 #include 
 #include 
 #include 
@@ -86,6 +90,19 @@ static const char* lclDebugSubType( sal_Int32 nType )
 return "unknown - please extend lclDebugSubType";
 }
 
+namespace
+{
+bool ShapeHasNoVisualPropertiesOnImport(oox::ppt::PPTShape& rPPTShape)
+{
+return  !rPPTShape.hasNonInheritedShapeProperties()
+&& !rPPTShape.hasShapeStyleRefs()
+&& !rPPTShape.getTextBody()->hasVisualRunProperties()
+&& !rPPTShape.getTextBody()->hasNoninheritedBodyProperties()
+&& !rPPTShape.getTextBody()->hasListStyleOnImport()
+&& !rPPTShape.getTextBody()->hasParagraphProperties();
+}
+}
+
 

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

2021-04-12 Thread Szymon Kłos (via logerrit)
 chart2/qa/extras/chart2import.cxx|   35 +++
 chart2/qa/extras/data/xlsx/tdf140489.xlsx|binary
 oox/source/drawingml/chart/plotareaconverter.cxx |8 +++--
 3 files changed, 41 insertions(+), 2 deletions(-)

New commits:
commit be82f6313f298c13a2f040b218c6f2a33705ff8c
Author: Szymon Kłos 
AuthorDate: Thu Apr 8 15:08:38 2021 +0200
Commit: Szymon Kłos 
CommitDate: Mon Apr 12 13:39:57 2021 +0200

tdf#140489 fix chart display in xlsx

Commit 1147383:
tdf#114181 XLSX combined chart: fix swapped primary and secondary axes etc.

introduced regression by applying axis swaping not only
for combined charts.

Change-Id: I764399579ff922ddd495540fdd2a39675f2a8da5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113836
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 93596eebc2a0..3a8b77f48cdd 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -119,6 +119,7 @@ public:
 void testAxisTitleRotationXLSX();
 void testAxisTitlePositionDOCX();
 void testCombinedChartAttachedAxisXLSX();
+void testTdf140489MultiSeriesChartAxisXLSX();
 
 void testTdf90510(); // Pie chart label placement settings(XLS)
 void testTdf109858(); // Pie chart label placement settings(XLSX)
@@ -243,6 +244,7 @@ public:
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
 CPPUNIT_TEST(testAxisTitlePositionDOCX);
 CPPUNIT_TEST(testCombinedChartAttachedAxisXLSX);
+CPPUNIT_TEST(testTdf140489MultiSeriesChartAxisXLSX);
 CPPUNIT_TEST(testTdf90510);
 CPPUNIT_TEST(testTdf109858);
 CPPUNIT_TEST(testTdf130105);
@@ -1759,6 +1761,39 @@ void 
Chart2ImportTest::testCombinedChartAttachedAxisXLSX()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nAxisIndex);
 }
 
+void Chart2ImportTest::testTdf140489MultiSeriesChartAxisXLSX()
+{
+load(u"/chart2/qa/extras/data/xlsx/", "tdf140489.xlsx");
+Reference< chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+// First series
+Reference xSeries = getDataSeriesFromDoc(xChartDoc, 
0);
+CPPUNIT_ASSERT(xSeries.is());
+
+Reference xPropSet(xSeries, uno::UNO_QUERY_THROW);
+sal_Int32 nAxisIndex = -1;
+uno::Any aAny = xPropSet->getPropertyValue("AttachedAxisIndex");
+CPPUNIT_ASSERT(aAny >>= nAxisIndex);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nAxisIndex);
+
+// Second series
+xSeries = getDataSeriesFromDoc(xChartDoc, 0, 1);
+CPPUNIT_ASSERT(xSeries.is());
+
+xPropSet.set(xSeries, uno::UNO_QUERY_THROW);
+aAny = xPropSet->getPropertyValue("AttachedAxisIndex");
+CPPUNIT_ASSERT(aAny >>= nAxisIndex);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nAxisIndex);
+
+// Third series
+xSeries = getDataSeriesFromDoc(xChartDoc, 0, 2);
+CPPUNIT_ASSERT(xSeries.is());
+
+xPropSet.set(xSeries, uno::UNO_QUERY_THROW);
+aAny = xPropSet->getPropertyValue("AttachedAxisIndex");
+CPPUNIT_ASSERT(aAny >>= nAxisIndex);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nAxisIndex);
+}
+
 void Chart2ImportTest::testInternalDataProvider() {
 uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromImpress(u"/chart2/qa/extras/data/odp/", "chart.odp"), 
uno::UNO_QUERY_THROW);
 const uno::Reference< chart2::data::XDataProvider >& rxDataProvider = 
xChartDoc->getDataProvider();
diff --git a/chart2/qa/extras/data/xlsx/tdf140489.xlsx 
b/chart2/qa/extras/data/xlsx/tdf140489.xlsx
new file mode 100644
index ..bd24f40be7b5
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf140489.xlsx differ
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx 
b/oox/source/drawingml/chart/plotareaconverter.cxx
index 80ea37c57d30..9a0f9d337c8a 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -420,9 +420,13 @@ void PlotAreaConverter::convertFromModel( View3DModel& 
rView3DModel )
 // varying point colors only for single series in single chart type
 bool bSupportsVaryColorsByPoint = mrModel.maTypeGroups.size() == 1;
 
+bool bIsCombinedChart = mrModel.maTypeGroups.size() == 2 &&
+mrModel.maTypeGroups[0]->mnTypeId != mrModel.maTypeGroups[1]->mnTypeId;
+
 // convert all axes sets, and check which axis is attached to the first 
maTypeGroups
-sal_Int32 nStartAxesSetIdx = (rValAxisIds.size() > 1 && aAxesSets.size() > 
0 && aAxesSets[0]->maAxes.count( API_Y_AXIS )
-&& aAxesSets[0]->maAxes[ API_Y_AXIS ]->mnAxisId != rValAxisIds[0] 
) ? 1 : 0;
+sal_Int32 nStartAxesSetIdx = bIsCombinedChart ? ((rValAxisIds.size() > 1 
&& aAxesSets.size() > 0 && aAxesSets[0]->maAxes.count( API_Y_AXIS )
+&& aAxesSets[0]->maAxes[ API_Y_AXIS ]->mnAxisId != rValAxisIds[0] 
) ? 1 : 0)
+: 0;
 sal_Int32 nAxesSetIdx = nStartAxesSetIdx;
 
 bool bUseFixedInnerSize = false;

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

2021-03-04 Thread Justin Luth (via logerrit)
 chart2/qa/extras/chart2import.cxx   |   10 ++
 oox/source/drawingml/fillproperties.cxx |4 +++-
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 247963e53cce24c199a751c8ffb17f58b3a7d473
Author: Justin Luth 
AuthorDate: Wed Jan 27 10:46:05 2021 +0300
Commit: Justin Luth 
CommitDate: Thu Mar 4 17:45:23 2021 +0100

tdf#139940 oox: mark end before growing largest segment backwards

This fixes a regression in 7.1 (backported to 7.0.1) caused by
commit 73993fdb5d4b507694cd0edf80887d19f7e2bf9a for tdf#134183.

The largest segment has already been found, so we know where the
next segment starts. Now if we grow it backwards, that shouldn't
affect where it ends. So flag the end before growing the start,
otherwise we would have to recalculate the end again.

Change-Id: Iaae401d0438e533c7498be56f48fa153f7d3ff0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110004
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 4b425a386b70..59bd6ab2fda2 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -841,6 +841,16 @@ void Chart2ImportTest::testBnc889755()
 CPPUNIT_ASSERT_EQUAL(OUString("Nov-13"), aRowLabels[13]);
 CPPUNIT_ASSERT_EQUAL(OUString("Dec-13"), aRowLabels[14]);
 CPPUNIT_ASSERT_EQUAL(OUString("Jan-14"), aRowLabels[15]);
+
+//tdf#139940 - the title's gradient was lost and was filled with solid 
blue, instead of a "blue underline".
+uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+// Shape "Title 3"
+uno::Reference xShapeProps(xPage->getByIndex(5), 
uno::UNO_QUERY_THROW);
+awt::Gradient aTransparence;
+xShapeProps->getPropertyValue("FillTransparenceGradient") >>= 
aTransparence;
+CPPUNIT_ASSERT(aTransparence.StartColor != aTransparence.EndColor);
+CPPUNIT_ASSERT_EQUAL(static_cast(0xff), 
aTransparence.StartColor);
 }
 
 void Chart2ImportTest::testBnc882383()
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 754aa54ee2b8..3aa54ef36ea2 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -630,6 +630,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 aGradient.Angle = static_cast< sal_Int16 >( (8100 - 
(nDmlAngle / (PER_DEGREE / 10))) % 3600 );
 Color aStartColor, aEndColor;
 
+// Make a note where the widest segment stops, because we 
will try to grow it next.
+auto aWidestSegmentEnd = std::next(aWidestSegmentStart);
+
 // Try to grow the widest segment backwards: if a previous 
segment has the same
 // color, just different transparency, include it.
 while (aWidestSegmentStart != aGradientStops.begin())
@@ -644,7 +647,6 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 aWidestSegmentStart = it;
 }
 
-auto aWidestSegmentEnd = std::next(aWidestSegmentStart);
 // Try to grow the widest segment forward: if a next 
segment has the same
 // color, just different transparency, include it.
 while (aWidestSegmentEnd != 
std::prev(aGradientStops.end()))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-12-16 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx   |   34 ++--
 chart2/qa/extras/data/docx/testcustomshapepos.docx  |binary
 oox/source/drawingml/chart/chartdrawingfragment.cxx |9 +
 3 files changed, 34 insertions(+), 9 deletions(-)

New commits:
commit fbe77e5d61ca63a688c12be721e760935d78e780
Author: Balazs Varga 
AuthorDate: Sun Dec 13 14:08:38 2020 +0100
Commit: László Németh 
CommitDate: Wed Dec 16 15:35:10 2020 +0100

tdf#138889 OOXML chart: fix import of rotated shapes

in charts, resulted e.g. distorted arrows.

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index b94b27f4506a..e4742405d967 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -2615,6 +2615,11 @@ void Chart2ImportTest::testTdf134225()
 
 void Chart2ImportTest::testTdf136105()
 {
+// FIXME: the DPI check should be removed when either (1) the test is 
fixed to work with
+// non-default DPI; or (2) unit tests on Windows are made to use svp VCL 
plugin.
+if (!IsDefaultDPI())
+return;
+
 load("/chart2/qa/extras/data/xlsx/", "tdf136105.xlsx");
 // 1st chart with fix inner position and size
 {
@@ -2775,15 +2780,26 @@ void Chart2ImportTest::testTdfCustomShapePos()
 Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), 
UNO_QUERY_THROW);
 Reference xDrawPageSupplier(xChartDoc, 
UNO_QUERY_THROW);
 Reference xDrawPage(xDrawPageSupplier->getDrawPage(), 
UNO_SET_THROW);
-Reference xCustomShape(xDrawPage->getByIndex(0), 
UNO_QUERY_THROW);
-
-// test position and size of a custom shape within a chart
-awt::Point aPosition = xCustomShape->getPosition();
-CPPUNIT_ASSERT_DOUBLES_EQUAL(8845, aPosition.X, 300);
-CPPUNIT_ASSERT_DOUBLES_EQUAL(855, aPosition.Y, 300);
-awt::Size aSize = xCustomShape->getSize();
-CPPUNIT_ASSERT_DOUBLES_EQUAL(4831, aSize.Width, 300);
-CPPUNIT_ASSERT_DOUBLES_EQUAL(1550, aSize.Height, 300);
+// test position and size of a custom shape within a chart, rotated by 0 
degree.
+{
+Reference xCustomShape(xDrawPage->getByIndex(0), 
UNO_QUERY_THROW);
+awt::Point aPosition = xCustomShape->getPosition();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(8845, aPosition.X, 300);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(855, aPosition.Y, 300);
+awt::Size aSize = xCustomShape->getSize();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(4831, aSize.Width, 300);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1550, aSize.Height, 300);
+}
+// test position and size of a custom shape within a chart, rotated by 90 
degree.
+{
+Reference xCustomShape(xDrawPage->getByIndex(1), 
UNO_QUERY_THROW);
+awt::Point aPosition = xCustomShape->getPosition();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1658, aPosition.X, 300);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(6119, aPosition.Y, 300);
+awt::Size aSize = xCustomShape->getSize();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(4165, aSize.Width, 300);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1334, aSize.Height, 300);
+}
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
diff --git a/chart2/qa/extras/data/docx/testcustomshapepos.docx 
b/chart2/qa/extras/data/docx/testcustomshapepos.docx
index 31c5284e11b9..640c48ea4627 100644
Binary files a/chart2/qa/extras/data/docx/testcustomshapepos.docx and 
b/chart2/qa/extras/data/docx/testcustomshapepos.docx differ
diff --git a/oox/source/drawingml/chart/chartdrawingfragment.cxx 
b/oox/source/drawingml/chart/chartdrawingfragment.cxx
index 85eeb2986bcc..c41e2db49821 100644
--- a/oox/source/drawingml/chart/chartdrawingfragment.cxx
+++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx
@@ -209,6 +209,15 @@ void ChartDrawingFragment::onEndElement()
 EmuRectangle aShapeRectEmu = mxAnchor->calcAnchorRectEmu( 
maChartRectEmu );
 if( (aShapeRectEmu.X >= 0) && (aShapeRectEmu.Y >= 0) && 
(aShapeRectEmu.Width >= 0) && (aShapeRectEmu.Height >= 0) )
 {
+const sal_Int32 aRotation = mxShape->getRotation();
+if( (aRotation >= 45 * PER_DEGREE && aRotation < 135 * PER_DEGREE) 
|| (aRotation >= 225 * PER_DEGREE && aRotation < 315 * PER_DEGREE) )
+{
+sal_Int64 nHalfWidth = aShapeRectEmu.Width / 2;
+sal_Int64 nHalfHeight = aShapeRectEmu.Height / 2;
+aShapeRectEmu.X = aShapeRectEmu.X + nHalfWidth - nHalfHeight;
+aShapeRectEmu.Y = aShapeRectEmu.Y + nHalfHeight - nHalfWidth;
+std::swap(aShapeRectEmu.Width, aShapeRectEmu.Height);
+}
 // TODO: DrawingML implementation expects 32-bit coordinates for 
EMU rectangles (change that to EmuRectangle)
 awt::Rectangle aShapeRectEmu32(
 

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

2020-11-30 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx  |   19 +++
 chart2/qa/extras/data/docx/testcustomshapepos.docx |binary
 oox/source/drawingml/chart/chartspaceconverter.cxx |6 +-
 3 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit f1a5bb0b79c212a0459b1a17dd15f1159e663dbd
Author: Balazs Varga 
AuthorDate: Thu Nov 26 17:44:24 2020 +0100
Commit: Balazs Varga 
CommitDate: Mon Nov 30 10:23:29 2020 +0100

tdf#138561 OOXML Chart import: fix custom shape position

and size within charts. Use default page size for custom
shapes, too, like in the case of other shapes (legend, titles,
etc.), until we get the actual size of the embedded chart.

Follow up commit: a01ccdfa5fd5a0260b7aedf955e1e5aa0df072c3
(tdf#138307 Chart import: fix disappeared text from custom shape)

Change-Id: Id6da7322326fbe8dfa570264107db59cc45dff31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106704
Reviewed-by: Balazs Varga 
Tested-by: Balazs Varga 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index cb8c08c0697e..b94b27f4506a 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -170,6 +170,7 @@ public:
 void testTdf137505();
 void testTdf137734();
 void testTdf137874();
+void testTdfCustomShapePos();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -289,6 +290,7 @@ public:
 CPPUNIT_TEST(testTdf137505);
 CPPUNIT_TEST(testTdf137734);
 CPPUNIT_TEST(testTdf137874);
+CPPUNIT_TEST(testTdfCustomShapePos);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2767,6 +2769,23 @@ void Chart2ImportTest::testTdf137874()
 CPPUNIT_ASSERT(xLegendEntry.is());
 }
 
+void Chart2ImportTest::testTdfCustomShapePos()
+{
+load("/chart2/qa/extras/data/docx/", "testcustomshapepos.docx");
+Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), 
UNO_QUERY_THROW);
+Reference xDrawPageSupplier(xChartDoc, 
UNO_QUERY_THROW);
+Reference xDrawPage(xDrawPageSupplier->getDrawPage(), 
UNO_SET_THROW);
+Reference xCustomShape(xDrawPage->getByIndex(0), 
UNO_QUERY_THROW);
+
+// test position and size of a custom shape within a chart
+awt::Point aPosition = xCustomShape->getPosition();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(8845, aPosition.X, 300);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(855, aPosition.Y, 300);
+awt::Size aSize = xCustomShape->getSize();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(4831, aSize.Width, 300);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1550, aSize.Height, 300);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/testcustomshapepos.docx 
b/chart2/qa/extras/data/docx/testcustomshapepos.docx
new file mode 100644
index ..31c5284e11b9
Binary files /dev/null and b/chart2/qa/extras/data/docx/testcustomshapepos.docx 
differ
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx 
b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 1f90c2e092eb..d33e0086cc08 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -275,9 +275,13 @@ void ChartSpaceConverter::convertFromModel( const 
Reference< XShapes >& rxExtern
 drawing page instead, it is not possible to embed OLE objects. */
 bool bOleSupport = rxExternalPage.is();
 
+awt::Size aChartSize = getChartSize();
+if( aChartSize.Width <= 0 || aChartSize.Height <= 0 )
+aChartSize = getDefaultPageSize();
+
 // now, xShapes is not null anymore
 getFilter().importFragment( new ChartDrawingFragment(
-getFilter(), mrModel.maDrawingPath, xShapes, getChartSize(), 
aShapesOffset, bOleSupport ) );
+getFilter(), mrModel.maDrawingPath, xShapes, aChartSize, 
aShapesOffset, bOleSupport ) );
 }
 catch( Exception& )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-11-06 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |   15 ++
 chart2/qa/extras/data/xlsx/tdf137917.xlsx |binary
 oox/source/export/chartexport.cxx |   75 ++
 3 files changed, 90 insertions(+)

New commits:
commit e8a9d0050675034aa5d4670330ea47ef32306973
Author: Balazs Varga 
AuthorDate: Wed Nov 4 11:18:56 2020 +0100
Commit: László Németh 
CommitDate: Fri Nov 6 11:30:57 2020 +0100

tdf#137917 Chart OOXML: fix export of TimeIncrement of Date axis

Export of Major, Minor interval and baseTimeUnit of date axis as
required by the OOXML standard.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index d86fa14ef84c..73f9166d176c 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -181,6 +181,7 @@ public:
 void testTdf123647();
 void testTdf136267();
 void testDataLabelPlacementPieChart();
+void testTdf137917();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -324,6 +325,7 @@ public:
 CPPUNIT_TEST(testTdf123647);
 CPPUNIT_TEST(testTdf136267);
 CPPUNIT_TEST(testDataLabelPlacementPieChart);
+CPPUNIT_TEST(testTdf137917);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2969,6 +2971,19 @@ void Chart2ExportTest::testDataLabelPlacementPieChart()
 
 }
 
+void Chart2ExportTest::testTdf137917()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf137917.xlsx");
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:baseTimeUnit", "val", "days");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:majorUnit", "val", "1");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:majorTimeUnit", "val", "months");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:minorUnit", "val", "7");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:minorTimeUnit", "val", "days");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf137917.xlsx 
b/chart2/qa/extras/data/xlsx/tdf137917.xlsx
new file mode 100644
index ..4d08a23acd8a
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf137917.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 19c5b7abf5f4..f13cbca60d8c 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -48,6 +48,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -286,6 +289,51 @@ static sal_Int32 lcl_getCategoryAxisType( const Reference< 
chart2::XDiagram >& x
 return nAxisType;
 }
 
+static OUString lclGetTimeUnitToken( sal_Int32 nTimeUnit )
+{
+switch( nTimeUnit )
+{
+case cssc::TimeUnit::DAY:  return "days";
+case cssc::TimeUnit::MONTH:return "months";
+case cssc::TimeUnit::YEAR: return "years";
+default:   OSL_ENSURE(false, "lclGetTimeUnitToken 
- unexpected time unit");
+}
+return "days";
+}
+
+static cssc::TimeIncrement lcl_getDateTimeIncrement( const Reference< 
chart2::XDiagram >& xDiagram, sal_Int32 nAxisIndex )
+{
+cssc::TimeIncrement aTimeIncrement;
+try
+{
+Reference< chart2::XCoordinateSystemContainer > xCooSysCnt(
+xDiagram, uno::UNO_QUERY_THROW);
+const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
+xCooSysCnt->getCoordinateSystems());
+for( const auto& xCooSys : aCooSysSeq )
+{
+OSL_ASSERT(xCooSys.is());
+if( 0 < xCooSys->getDimension() && nAxisIndex <= 
xCooSys->getMaximumAxisIndexByDimension(0) )
+{
+Reference< chart2::XAxis > xAxis = 
xCooSys->getAxisByDimension(0, nAxisIndex);
+OSL_ASSERT(xAxis.is());
+if( xAxis.is() )
+{
+chart2::ScaleData aScaleData = xAxis->getScaleData();
+aTimeIncrement = aScaleData.TimeIncrement;
+break;
+}
+}
+}
+}
+catch (const uno::Exception&)
+{
+DBG_UNHANDLED_EXCEPTION("oox");
+}
+
+return aTimeIncrement;
+}
+
 static bool lcl_isSeriesAttachedToFirstAxis(
 const Reference< chart2::XDataSeries > & xDataSeries )
 {
@@ -3184,6 +3232,33 @@ void ChartExport::_exportAxis(
 // FIXME: seems not support? lblOffset
 pFS->singleElement(FSNS(XML_c, XML_lblOffset), XML_val, 
OString::number(100));
 
+// export baseTimeUnit, majorTimeUnit, 

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

2020-10-30 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2import.cxx|   12 
 oox/source/drawingml/chart/axisconverter.cxx |4 
 2 files changed, 16 insertions(+)

New commits:
commit e64f9356df76c41e3c5c432984e0ce1d25ca
Author: Tünde Tóth 
AuthorDate: Thu Oct 29 14:47:09 2020 +0100
Commit: László Németh 
CommitDate: Fri Oct 30 19:08:29 2020 +0100

tdf#126133 Chart OOXML import: set default text rotation to 0°

for the horizontal axis title, even if the position of the axis
is left or right.

With this, OOXML charts generated by third-party tools
imported without bad rotated title text (as previously in
commit fdb6d6ccf45e679ff3e369a876482b6801e08e25
[tdf#137734 Chart OOXML import: fix variable color charts],
without bad variable colors).

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 0cff3a8027be..62f9b85c1d76 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -2739,6 +2739,18 @@ void Chart2ImportTest::testTdf137734()
 bool bVaryColor = true;
 CPPUNIT_ASSERT(aAny >>= bVaryColor);
 CPPUNIT_ASSERT(!bVaryColor);
+
+// tdf#126133 Test primary X axis Rotation value
+Reference xXAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
+CPPUNIT_ASSERT(xXAxis.is());
+Reference xTitled(xXAxis, uno::UNO_QUERY_THROW);
+Reference xTitle = xTitled->getTitleObject();
+CPPUNIT_ASSERT(xTitle.is());
+Reference xTitlePropSet(xTitle, uno::UNO_QUERY_THROW);
+uno::Any aAny2 = xTitlePropSet->getPropertyValue("TextRotation");
+double nRotation = -1;
+CPPUNIT_ASSERT(aAny2 >>= nRotation);
+CPPUNIT_ASSERT_EQUAL(0.0, nRotation);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
diff --git a/oox/source/drawingml/chart/axisconverter.cxx 
b/oox/source/drawingml/chart/axisconverter.cxx
index 8599c68e6732..fa506e5a04dc 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -371,6 +371,10 @@ void AxisConverter::convertFromModel(
 if( mrModel.mxTitle.is() && 
(rTypeGroups.front()->getTypeInfo().meTypeCategory != TYPECATEGORY_RADAR) )
 {
 Reference< XTitled > xTitled( xAxis, UNO_QUERY_THROW );
+if (((nAxisIdx == API_X_AXIS && rTypeInfo.meTypeId != 
TYPEID_HORBAR)
+|| (nAxisIdx == API_Y_AXIS && rTypeInfo.meTypeId == 
TYPEID_HORBAR))
+&& (mrModel.mnAxisPos == XML_l || mrModel.mnAxisPos == XML_r))
+mrModel.mxTitle->mnDefaultRotation = 0;
 TitleConverter aTitleConv( *this, *mrModel.mxTitle );
 aTitleConv.convertFromModel( xTitled, 
OoxResId(STR_DIAGRAM_AXISTITLE), OBJECTTYPE_AXISTITLE, nAxesSetIdx, nAxisIdx );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-30 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   19 ++-
 chart2/qa/extras/data/xlsx/tdf137734.xlsx |binary
 oox/source/drawingml/chart/axismodel.cxx  |2 +-
 oox/source/drawingml/chart/typegroupmodel.cxx |2 +-
 4 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit fdb6d6ccf45e679ff3e369a876482b6801e08e25
Author: Tünde Tóth 
AuthorDate: Tue Oct 27 15:41:02 2020 +0100
Commit: László Németh 
CommitDate: Fri Oct 30 15:40:12 2020 +0100

tdf#137734 Chart OOXML import: fix variable color charts

generated by third-party tools by setting VaryColorsByPoint,
if the c:varyColors element is missing.

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 705c4a69a25f..0cff3a8027be 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -170,6 +170,7 @@ public:
 void testTdf134111();
 void testTdf136752();
 void testTdf137505();
+void testTdf137734();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -286,6 +287,7 @@ public:
 CPPUNIT_TEST(testTdf134111);
 CPPUNIT_TEST(testTdf136752);
 CPPUNIT_TEST(testTdf137505);
+CPPUNIT_TEST(testTdf137734);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1540,7 +1542,7 @@ void 
Chart2ImportTest::testVaryColorDefaultValues2013XLSX()
 uno::Any aAny = xPropSet->getPropertyValue("VaryColorsByPoint");
 bool bVaryColor = false;
 CPPUNIT_ASSERT(aAny >>= bVaryColor);
-CPPUNIT_ASSERT(bVaryColor);
+CPPUNIT_ASSERT(!bVaryColor);
 }
 
 void Chart2ImportTest::testPlotVisOnlyDefaultValue2013XLSX()
@@ -2724,6 +2726,21 @@ void Chart2ImportTest::testTdf137505()
 CPPUNIT_ASSERT_EQUAL(float(12), nFontSize);
 }
 
+void Chart2ImportTest::testTdf137734()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf137734.xlsx");
+Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xPropSet(xDataSeries, uno::UNO_QUERY_THROW);
+uno::Any aAny = xPropSet->getPropertyValue("VaryColorsByPoint");
+bool bVaryColor = true;
+CPPUNIT_ASSERT(aAny >>= bVaryColor);
+CPPUNIT_ASSERT(!bVaryColor);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf137734.xlsx 
b/chart2/qa/extras/data/xlsx/tdf137734.xlsx
new file mode 100644
index ..8c177becc30e
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf137734.xlsx differ
diff --git a/oox/source/drawingml/chart/axismodel.cxx 
b/oox/source/drawingml/chart/axismodel.cxx
index d84c707eba01..0159810dfc1f 100644
--- a/oox/source/drawingml/chart/axismodel.cxx
+++ b/oox/source/drawingml/chart/axismodel.cxx
@@ -49,7 +49,7 @@ AxisModel::AxisModel( sal_Int32 nTypeId, bool bMSO2007Doc ) :
 mnTickMarkSkip( 0 ),
 mnTypeId( nTypeId ),
 mbAuto( false ),
-mbDeleted( !bMSO2007Doc ),
+mbDeleted( false ),
 mbNoMultiLevel( false )
 {
 }
diff --git a/oox/source/drawingml/chart/typegroupmodel.cxx 
b/oox/source/drawingml/chart/typegroupmodel.cxx
index cc106a5de118..9479f93c4939 100644
--- a/oox/source/drawingml/chart/typegroupmodel.cxx
+++ b/oox/source/drawingml/chart/typegroupmodel.cxx
@@ -53,7 +53,7 @@ TypeGroupModel::TypeGroupModel( sal_Int32 nTypeId, bool 
bMSO2007Doc ) :
 mbShowMarker( !bMSO2007Doc ),
 mbShowNegBubbles( !bMSO2007Doc ),
 mbSmooth( !bMSO2007Doc ),
-mbVaryColors( !bMSO2007Doc ),
+mbVaryColors( false ),
 mbWireframe( !bMSO2007Doc )
 {
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-22 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx  |   55 +
 chart2/qa/extras/data/docx/tdf136650.docx  |binary
 oox/source/drawingml/chart/seriesconverter.cxx |   22 ++
 3 files changed, 53 insertions(+), 24 deletions(-)

New commits:
commit e4d3ad9fe640e71cf3bb4c969b75ebc17ce8e335
Author: Balazs Varga 
AuthorDate: Tue Sep 15 16:50:45 2020 +0200
Commit: László Németh 
CommitDate: Tue Sep 22 11:24:42 2020 +0200

tdf#136650 DOCX pie chart import: fix percentage

Follow-up of commit e0da00d655ecca5986eea3812a8a670c6adbc40f
(tdf#132174 Chart DOCX import: fix label number format).

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 651d2b829e06..fe0a2c48231e 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -1303,23 +1303,46 @@ void Chart2ImportTest::testNumberFormatsXLSX()
 void Chart2ImportTest::testNumberFormatsDOCX()
 {
 load("/chart2/qa/extras/data/docx/", "tdf132174.docx");
-uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
-CPPUNIT_ASSERT(xChartDoc.is());
-
-css::uno::Reference 
xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW);
-Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
-uno::Reference xPropertySet(xDataSeries, 
uno::UNO_QUERY_THROW);
-CPPUNIT_ASSERT(xPropertySet.is());
+{
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+css::uno::Reference 
xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW);
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+uno::Reference xPropertySet(xDataSeries, 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT(xPropertySet.is());
+
+sal_Int32 nNumberFormat;
+bool bLinkNumberFormatToSource = true;
+const sal_Int32 nChartDataNumberFormat = getNumberFormat(xChartDoc, 
"0%");
+xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
+CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
+xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= 
bLinkNumberFormatToSource;
+// LinkNumberFormatToSource should be set to false even if the 
original OOXML contain a true value,
+// because the inner data table of charts have no own number format!
+CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to 
false.", !bLinkNumberFormatToSource);
+}
 
-sal_Int32 nNumberFormat;
-bool bLinkNumberFormatToSource = true;
-const sal_Int32 nChartDataNumberFormat = getNumberFormat(xChartDoc, "0%");
-xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
-CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
-xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= 
bLinkNumberFormatToSource;
-// LinkNumberFormatToSource should be set to false even if the OOXML 
contain a true value,
-// because the inner data table of charts have no own number format!
-CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to 
false.", !bLinkNumberFormatToSource);
+load("/chart2/qa/extras/data/docx/", "tdf136650.docx");
+{
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+css::uno::Reference 
xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW);
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference 
xPropertySet(xDataSeries->getDataPointByIndex(1), uno::UNO_SET_THROW);
+
+sal_Int32 nNumberFormat;
+bool bLinkNumberFormatToSource = true;
+const sal_Int32 nChartDataNumberFormat = getNumberFormat(xChartDoc, 
"0%");
+xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
+CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
+xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= 
bLinkNumberFormatToSource;
+// LinkNumberFormatToSource should be set to false even if the 
original OOXML file contain a true value,
+// because the inner data table of charts have no own number format!
+CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to 
false.", !bLinkNumberFormatToSource);
+}
 }
 
 void Chart2ImportTest::testPercentageNumberFormatsDOCX()
diff --git a/chart2/qa/extras/data/docx/tdf136650.docx 
b/chart2/qa/extras/data/docx/tdf136650.docx
new file mode 100644
index ..cd095ec63110
Binary files /dev/null and 

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

2020-09-18 Thread Gülşah Köse (via logerrit)
 chart2/qa/extras/chart2export.cxx  |   17 +
 chart2/qa/extras/data/xlsx/data_labels_fill_color.xlsx |binary
 oox/source/export/chartexport.cxx  |   31 +
 3 files changed, 42 insertions(+), 6 deletions(-)

New commits:
commit a11bb74d4f464e9639ddb5b8d87dc4770663fea8
Author: Gülşah Köse 
AuthorDate: Fri Sep 18 13:20:30 2020 +0300
Commit: Gülşah Köse 
CommitDate: Fri Sep 18 18:55:17 2020 +0200

tdf#136247 OOXML export data label background color.

Change-Id: Ie3e00e8195239e6570bfe76c2451bae11c209145
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102999
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 8916208f8bde..49edb53991fe 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -107,6 +107,7 @@ public:
 void testAxisNumberFormatXLSX();
 void testDataPointLabelNumberFormatXLSX();
 void testDataLabelDefaultValuesXLSX();
+void testDataLabelFillColor();
 void testTitleOverlayXLSX();
 void testInvertIfNegativeXLSX();
 void testBubble3DXLSX();
@@ -248,6 +249,7 @@ public:
 CPPUNIT_TEST(testAxisNumberFormatXLSX);
 CPPUNIT_TEST(testDataPointLabelNumberFormatXLSX);
 CPPUNIT_TEST(testDataLabelDefaultValuesXLSX);
+CPPUNIT_TEST(testDataLabelFillColor);
 CPPUNIT_TEST(testTitleOverlayXLSX);
 CPPUNIT_TEST(testInvertIfNegativeXLSX);
 CPPUNIT_TEST(testBubble3DXLSX);
@@ -1739,6 +1741,21 @@ void Chart2ExportTest::testDataLabelDefaultValuesXLSX()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLblPos", "val", 
"outEnd");
 }
 
+void Chart2ExportTest::testDataLabelFillColor()
+{
+load("/chart2/qa/extras/data/xlsx/", "data_labels_fill_color.xlsx");
+Reference< chart2::XChartDocument> xDoc = getChartDocFromSheet(0, 
mxComponent);
+Reference xSeries = getDataSeriesFromDoc(xDoc, 0);
+Reference xPropSet(xSeries, uno::UNO_QUERY_THROW);
+uno::Any aAny = xPropSet->getPropertyValue("LabelFillColor");
+sal_Int32 nLabelFillColor;
+CPPUNIT_ASSERT(aAny >>= nLabelFillColor);
+
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:spPr/a:solidFill/a:srgbClr",
 "val", "F79646");
+}
+
 void Chart2ExportTest::testTitleOverlayXLSX()
 {
 load("/chart2/qa/extras/data/xlsx/", "chart_title.xlsx");
diff --git a/chart2/qa/extras/data/xlsx/data_labels_fill_color.xlsx 
b/chart2/qa/extras/data/xlsx/data_labels_fill_color.xlsx
new file mode 100644
index ..1a55f5b86836
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/data_labels_fill_color.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 12b3aba485ab..4d830f37c6ba 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3407,27 +3407,46 @@ void writeLabelProperties( const FSHelperPtr& pFS, 
ChartExport* pChartExport,
 Sequence> aCustomLabelFields;
 sal_Int32 nLabelBorderWidth = 0;
 sal_Int32 nLabelBorderColor = 0x00FF;
+sal_Int32 nLabelFillColor = -1;
 
 xPropSet->getPropertyValue("Label") >>= aLabel;
 xPropSet->getPropertyValue("CustomLabelFields") >>= aCustomLabelFields;
 xPropSet->getPropertyValue("LabelBorderWidth") >>= nLabelBorderWidth;
 xPropSet->getPropertyValue("LabelBorderColor") >>= nLabelBorderColor;
+xPropSet->getPropertyValue("LabelFillColor") >>= nLabelFillColor;
 
-if (nLabelBorderWidth > 0)
+if (nLabelBorderWidth > 0 || nLabelFillColor != -1)
 {
 pFS->startElement(FSNS(XML_c, XML_spPr));
-pFS->startElement(FSNS(XML_a, XML_ln), XML_w,
-  OString::number(convertHmmToEmu(nLabelBorderWidth)));
-if (nLabelBorderColor != -1)
+
+if (nLabelFillColor != -1)
 {
 pFS->startElement(FSNS(XML_a, XML_solidFill));
 
-OString aStr = OString::number(nLabelBorderColor, 
16).toAsciiUpperCase();
+OString aStr = OString::number(nLabelFillColor, 
16).toAsciiUpperCase();
 pFS->singleElement(FSNS(XML_a, XML_srgbClr), XML_val, aStr);
 
 pFS->endElement(FSNS(XML_a, XML_solidFill));
 }
-pFS->endElement(FSNS(XML_a, XML_ln));
+
+if (nLabelBorderWidth > 0)
+{
+pFS->startElement(FSNS(XML_a, XML_ln), XML_w,
+  
OString::number(convertHmmToEmu(nLabelBorderWidth)));
+
+if (nLabelBorderColor != -1)
+{
+pFS->startElement(FSNS(XML_a, XML_solidFill));
+
+OString aStr = OString::number(nLabelBorderColor, 
16).toAsciiUpperCase();
+pFS->singleElement(FSNS(XML_a, XML_srgbClr), XML_val, aStr);
+
+

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

2020-08-31 Thread Daniel Arato (NISZ) (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   14 ++
 chart2/qa/extras/data/odp/tdf121189.odp |binary
 oox/source/export/shapes.cxx|1 +
 3 files changed, 15 insertions(+)

New commits:
commit 0c5ac9d1cb39eac838a612092a8934a6ca12326f
Author: Daniel Arato (NISZ) 
AuthorDate: Mon Aug 24 17:29:08 2020 +0200
Commit: László Németh 
CommitDate: Mon Aug 31 10:12:41 2020 +0200

tdf#121189 PPTX export: fix missing chart

Based on Regina Henschel's technical analysis and code pointer.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index fddfdc0c2e67..7e17c2f1307c 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -156,6 +156,7 @@ public:
 void testTdf119029();
 void testTdf108022();
 void testTdf121744();
+void testTdf121189();
 void testTdf122031();
 void testTdf115012();
 void testTdf134118();
@@ -295,6 +296,7 @@ public:
 CPPUNIT_TEST(testTdf119029);
 CPPUNIT_TEST(testTdf108022);
 CPPUNIT_TEST(testTdf121744);
+CPPUNIT_TEST(testTdf121189);
 CPPUNIT_TEST(testTdf122031);
 CPPUNIT_TEST(testTdf115012);
 CPPUNIT_TEST(testTdf134118);
@@ -2577,6 +2579,18 @@ void Chart2ExportTest::testTdf121744()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[2]", "val", YValueId );
 }
 
+void Chart2ExportTest::testTdf121189()
+{
+load("/chart2/qa/extras/data/odp/", "tdf121189.odp");
+reload("Impress Office Open XML");
+
+uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xPage->getCount());
+uno::Reference xShape(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.OLE2Shape"), 
xShape->getShapeType());
+}
+
 void Chart2ExportTest::testTdf122031()
 {
 //Checks pie chart data label format.
diff --git a/chart2/qa/extras/data/odp/tdf121189.odp 
b/chart2/qa/extras/data/odp/tdf121189.odp
new file mode 100644
index ..6f99e0054936
Binary files /dev/null and b/chart2/qa/extras/data/odp/tdf121189.odp differ
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 3121aa745a16..e7997226f689 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1490,6 +1490,7 @@ static const NameToConvertMapType& lcl_GetConverters()
 
 { "com.sun.star.presentation.GraphicObjectShape"   , 
::WriteGraphicObjectShape },
 { "com.sun.star.presentation.MediaShape"   , 
::WriteGraphicObjectShape },
+{ "com.sun.star.presentation.ChartShape"   , 
::WriteOLE2Shape },
 { "com.sun.star.presentation.OLE2Shape", 
::WriteOLE2Shape },
 { "com.sun.star.presentation.TableShape"   , 
::WriteTableShape },
 { "com.sun.star.presentation.TextShape", 
::WriteTextShape },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-23 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx  |   11 +++
 chart2/qa/extras/data/xlsx/tdf134118.xlsx  |binary
 oox/source/drawingml/chart/chartspaceconverter.cxx |   11 ++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 886c2e35fadc7813498da041fc4ea8a8ba2fb358
Author: Balazs Varga 
AuthorDate: Wed Aug 12 08:34:42 2020 +0200
Commit: László Németh 
CommitDate: Sun Aug 23 13:05:46 2020 +0200

tdf#134118 Chart OOXML import: fix gaps in month based data

Leave gaps instead of zeroes, like MSO does, if data ranges
contain empty cells at month based time resolution.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 948aaec6700a..4be864c69ce4 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -157,6 +157,7 @@ public:
 void testTdf121744();
 void testTdf122031();
 void testTdf115012();
+void testTdf134118();
 void testTdf123206_customLabelText();
 void testCustomLabelText();
 void testDeletedLegendEntries();
@@ -295,6 +296,7 @@ public:
 CPPUNIT_TEST(testTdf121744);
 CPPUNIT_TEST(testTdf122031);
 CPPUNIT_TEST(testTdf115012);
+CPPUNIT_TEST(testTdf134118);
 CPPUNIT_TEST(testTdf123206_customLabelText);
 CPPUNIT_TEST(testCustomLabelText);
 CPPUNIT_TEST(testDeletedLegendEntries);
@@ -2571,6 +2573,15 @@ void Chart2ExportTest::testTdf115012()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", 
"zero");
 }
 
+void Chart2ExportTest::testTdf134118()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf134118.xlsx");
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+// workaround: use leave-gap instead of zero to show the original line 
chart
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", "gap");
+}
+
 void Chart2ExportTest::testTdf123206_customLabelText()
 {
 load("/chart2/qa/extras/data/docx/", "tdf123206.docx");
diff --git a/chart2/qa/extras/data/xlsx/tdf134118.xlsx 
b/chart2/qa/extras/data/xlsx/tdf134118.xlsx
new file mode 100644
index ..ca86fb8cf118
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf134118.xlsx differ
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx 
b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 342b6190a67d..1f90c2e092eb 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -206,7 +206,16 @@ void ChartSpaceConverter::convertFromModel( const 
Reference< XShapes >& rxExtern
 {
 using namespace ::com::sun::star::chart::MissingValueTreatment;
 sal_Int32 nMissingValues = LEAVE_GAP;
-switch( mrModel.mnDispBlanksAs )
+
+// tdf#134118 leave gap if the time unit is month
+bool bIsMonthBasedTimeUnit = false;
+if( mrModel.mxPlotArea.is() && mrModel.mxPlotArea->maAxes.size() > 0 &&
+mrModel.mxPlotArea->maAxes[0]->monBaseTimeUnit.has() )
+{
+bIsMonthBasedTimeUnit = 
mrModel.mxPlotArea->maAxes[0]->monBaseTimeUnit.get() == XML_months;
+}
+
+if (!bIsMonthBasedTimeUnit) switch( mrModel.mnDispBlanksAs )
 {
 case XML_gap:   nMissingValues = LEAVE_GAP; break;
 case XML_zero:  nMissingValues = USE_ZERO;  break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-19 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   10 ++
 chart2/qa/extras/data/xlsx/empty_chart.xlsx |binary
 oox/source/export/chartexport.cxx   |5 +
 sc/source/filter/xcl97/xcl97rec.cxx |   10 ++
 4 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit a8950d08a33e7aded31d4591c98a03d1edf8c5a4
Author: Tünde Tóth 
AuthorDate: Fri Aug 14 13:45:38 2020 +0200
Commit: László Németh 
CommitDate: Wed Aug 19 10:31:51 2020 +0200

tdf#123647 Chart XLSX export: fix missing empty chart

Save empty chart as empty bar chart, because a chart without chart type
is invalid.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 754768880054..948aaec6700a 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -174,6 +174,7 @@ public:
 void testTdf132594();
 void testTdf134255();
 void testTdf134977();
+void testTdf123647();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -311,6 +312,7 @@ public:
 CPPUNIT_TEST(testTdf132594);
 CPPUNIT_TEST(testTdf134255);
 CPPUNIT_TEST(testTdf134977);
+CPPUNIT_TEST(testTdf123647);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2861,6 +2863,14 @@ void Chart2ExportTest::testTdf134977()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:r/a:rPr",
 "sz", "900");
 }
 
+void Chart2ExportTest::testTdf123647()
+{
+load("/chart2/qa/extras/data/xlsx/", "empty_chart.xlsx");
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart", 1);
+}
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/empty_chart.xlsx 
b/chart2/qa/extras/data/xlsx/empty_chart.xlsx
new file mode 100644
index ..449902146af6
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/empty_chart.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index ab8458d44b04..5ea054d83ca0 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1380,6 +1380,11 @@ void ChartExport::exportPlotArea( const Reference< 
css::chart::XChartDocument >&
 // chart type
 const Sequence< Reference< chart2::XCoordinateSystem > >
 aCooSysSeq( xBCooSysCnt->getCoordinateSystems());
+
+// tdf#123647 Save empty chart as empty bar chart.
+if (!aCooSysSeq.hasElements())
+exportBarChart(nullptr);
+
 for( const auto& rCS : aCooSysSeq )
 {
 Reference< chart2::XChartTypeContainer > xCTCnt( rCS, uno::UNO_QUERY );
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index 213dfe77d4ae..0f9ba1288d33 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -202,9 +202,11 @@ bool IsValidObject( const XclObj& rObj )
 if (!xCooSysContainer.is())
 return false;
 
-const uno::Sequence > 
xCooSysSeq = xCooSysContainer->getCoordinateSystems();
-if (!xCooSysSeq.hasElements())
-return false;
+const uno::Sequence> 
xCooSysSeq = xCooSysContainer->getCoordinateSystems();
+
+// tdf#123647 Save empty charts too.
+// if (!xCooSysSeq.hasElements())
+// return false;
 
 for (const auto& rCooSys : xCooSysSeq)
 {
@@ -212,7 +214,7 @@ bool IsValidObject( const XclObj& rObj )
 if (!xChartTypeCont.is())
 return false;
 
-uno::Sequence > xChartTypeSeq = 
xChartTypeCont->getChartTypes();
+uno::Sequence> xChartTypeSeq = 
xChartTypeCont->getChartTypes();
 if (!xChartTypeSeq.hasElements())
 // No chart type.  Not good.
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-07 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2export.cxx |   26 +-
 chart2/qa/extras/chart2import.cxx |2 -
 chart2/qa/extras/data/xlsx/custom_data_label.xlsx |binary
 oox/source/drawingml/chart/seriesconverter.cxx|1 
 4 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit bcda268cde1f8408c2066ce985acedfce3e3bc2e
Author: Tünde Tóth 
AuthorDate: Mon Aug 3 09:12:14 2020 +0200
Commit: László Németh 
CommitDate: Fri Aug 7 11:54:24 2020 +0200

tdf#134977 Chart OOXML: fix import of custom data label

Use the data series properties for the default properties
of the custom data labels.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 628bdb98b213..f9b2651a922c 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -173,6 +173,7 @@ public:
 void testTdf133191();
 void testTdf132594();
 void testTdf134255();
+void testTdf134977();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -309,6 +310,7 @@ public:
 CPPUNIT_TEST(testTdf133191);
 CPPUNIT_TEST(testTdf132594);
 CPPUNIT_TEST(testTdf134255);
+CPPUNIT_TEST(testTdf134977);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2238,7 +2240,7 @@ void Chart2ExportTest::testCustomDataLabel()
 CPPUNIT_ASSERT_EQUAL(OUString("line"), aFields[5]->getString());
 aFields[5]->getPropertyValue("CharHeight") >>= nFontSize;
 aFields[5]->getPropertyValue("CharColor") >>= nFontColor;
-CPPUNIT_ASSERT_EQUAL(static_cast(13), nFontSize);
+CPPUNIT_ASSERT_EQUAL(static_cast(11.97), nFontSize);
 CPPUNIT_ASSERT_EQUAL(static_cast(0xbf9000), nFontColor);
 
 
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE,
 aFields[6]->getFieldType());
@@ -2837,6 +2839,28 @@ void Chart2ExportTest::testTdf134255()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:txPr/a:bodyPr", 
"wrap", "square");
 }
 
+void Chart2ExportTest::testTdf134977()
+{
+load("/chart2/qa/extras/data/xlsx/", "custom_data_label.xlsx");
+
+//import test
+uno::Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference< chart2::XDataSeries > xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+uno::Reference 
xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
+uno::Sequence> aFields;
+float nFontSize;
+xPropertySet->getPropertyValue("CustomLabelFields") >>= aFields;
+aFields[0]->getPropertyValue("CharHeight") >>= nFontSize;
+CPPUNIT_ASSERT_EQUAL(static_cast(9), nFontSize);
+
+//export test
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:r/a:rPr",
 "sz", "900");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 6c982238a5b3..d502d163fc64 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -1862,7 +1862,7 @@ void Chart2ImportTest::testTdf115107()
 CPPUNIT_ASSERT_EQUAL(OUString("line"), aFields[5]->getString());
 aFields[5]->getPropertyValue("CharHeight") >>= nFontSize;
 aFields[5]->getPropertyValue("CharColor") >>= nFontColor;
-CPPUNIT_ASSERT_EQUAL(static_cast(13), nFontSize);
+CPPUNIT_ASSERT_EQUAL(static_cast(11.97), nFontSize);
 CPPUNIT_ASSERT_EQUAL(static_cast(0xbf9000), nFontColor);
 
 
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE,
 aFields[6]->getFieldType());
diff --git a/chart2/qa/extras/data/xlsx/custom_data_label.xlsx 
b/chart2/qa/extras/data/xlsx/custom_data_label.xlsx
new file mode 100644
index ..cc69aaf0dc66
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/custom_data_label.xlsx 
differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index b34bc355ca4d..6e75fc89beab 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -315,6 +315,7 @@ void DataLabelConverter::convertFromModel( const Reference< 
XDataSeries >& rxDat
 
 // Store properties
 oox::PropertySet aPropertySet( xCustomLabel );
+convertTextProperty( aPropertySet, getFormatter(), 
mrModel.mxText->mxTextBody );
 pRun->getTextCharacterProperties().pushToPropSet( 

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

2020-07-15 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx  |   19 +++
 chart2/qa/extras/data/docx/tdf134111.docx  |binary
 oox/source/drawingml/chart/objectformatter.cxx |2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 6d1e9482cf1519e5b4d73331a5bcdfbbc9a15776
Author: Balazs Varga 
AuthorDate: Fri Jun 19 11:07:04 2020 +0200
Commit: László Németh 
CommitDate: Wed Jul 15 16:36:23 2020 +0200

tdf#134111 Chart OOXML Import: set text break to true

of category axis labels, even if the XML do not contain
Text Properties of category axis labels.

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 47aacb1af402..6c982238a5b3 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -163,6 +163,7 @@ public:
 void testTdf133376();
 void testTdf134225();
 void testTdf91250();
+void testTdf134111();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -274,6 +275,7 @@ public:
 CPPUNIT_TEST(testTdf133376);
 CPPUNIT_TEST(testTdf134225);
 CPPUNIT_TEST(testTdf91250);
+CPPUNIT_TEST(testTdf134111);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2575,6 +2577,23 @@ void Chart2ImportTest::testTdf91250()
 CPPUNIT_ASSERT_EQUAL(OUString("8.657"), aCategories[3]);
 }
 
+void Chart2ImportTest::testTdf134111()
+{
+// tdf134111 : To check TextBreak value is true
+load("/chart2/qa/extras/data/docx/", "tdf134111.docx");
+uno::Reference< chart::XChartDocument > xChartDoc = 
getChartDocFromWriter(0);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+uno::Reference< chart::XDiagram > mxDiagram(xChartDoc->getDiagram());
+CPPUNIT_ASSERT(mxDiagram.is());
+uno::Reference< chart::XAxisXSupplier > xAxisXSupp(mxDiagram, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xAxisXSupp.is());
+uno::Reference< beans::XPropertySet > xAxisProp(xAxisXSupp->getXAxis());
+bool bTextBreak = false;
+xAxisProp->getPropertyValue("TextBreak") >>= bTextBreak;
+// Expected value of 'TextBreak' is true
+CPPUNIT_ASSERT(bTextBreak);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf134111.docx 
b/chart2/qa/extras/data/docx/tdf134111.docx
new file mode 100644
index ..26e3a03e0b6d
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf134111.docx differ
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index 7e4073686065..c0669678eee0 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1155,7 +1155,7 @@ bool ObjectFormatter::getTextRotation( const ModelRef< 
TextBody >& rxTextProp, s
 }
 else
 {
-return false;
+return true;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-13 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx  |   22 ++
 chart2/qa/extras/data/docx/tdf134255.docx  |binary
 oox/source/drawingml/chart/objectformatter.cxx |4 
 3 files changed, 26 insertions(+)

New commits:
commit c777cb492d12fb7038254f116102716b9cb84fa3
Author: Balazs Varga 
AuthorDate: Tue Jul 7 13:11:19 2020 +0200
Commit: László Németh 
CommitDate: Mon Jul 13 10:39:19 2020 +0200

tdf#134255 Chart OOXML Import: set the auto text wrap

property to true, if we do not have text property attribute.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 4e4c7168c3b3..f70898a11ce6 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -171,6 +171,7 @@ public:
 void testTdf133190();
 void testTdf133191();
 void testTdf132594();
+void testTdf134255();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -305,6 +306,7 @@ public:
 CPPUNIT_TEST(testTdf133190);
 CPPUNIT_TEST(testTdf133191);
 CPPUNIT_TEST(testTdf132594);
+CPPUNIT_TEST(testTdf134255);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2802,6 +2804,26 @@ void Chart2ExportTest::testTdf132594()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:cat", 1);
 }
 
+void Chart2ExportTest::testTdf134255()
+{
+load("/chart2/qa/extras/data/docx/", "tdf134255.docx");
+Reference xChartDoc(getChartDocFromWriter(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+// import test
+Reference< chart2::XDataSeries > xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference< beans::XPropertySet > xPropSet(xDataSeries, UNO_QUERY_THROW);
+bool bWrap = false;
+CPPUNIT_ASSERT((xPropSet->getPropertyValue("TextWordWrap") >>= bWrap) && 
bWrap);
+
+// export test
+xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open 
XML Text");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:txPr/a:bodyPr", 
"wrap", "square");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf134255.docx 
b/chart2/qa/extras/data/docx/tdf134255.docx
new file mode 100644
index ..ff3cd8b67b53
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf134255.docx differ
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index c4f48b73e450..7e4073686065 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1077,7 +1077,11 @@ void ObjectFormatter::convertTextRotation( PropertySet& 
rPropSet, const ModelRef
 void ObjectFormatter::convertTextWrap( PropertySet& rPropSet, const ModelRef< 
TextBody >& rxTextProp )
 {
 if( !rxTextProp.is() )
+{
+// set default value (in OOXML the default value is true)
+rPropSet.setProperty( PROP_TextWordWrap, true );
 return;
+}
 
 PropertyMap& aPropMap = rxTextProp->getTextProperties().maPropertyMap;
 if( aPropMap.hasProperty(PROP_TextWordWrap) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-10 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx|   22 ++
 chart2/qa/extras/data/docx/tdf91250.docx |binary
 oox/source/drawingml/chart/datasourcecontext.cxx |3 +++
 3 files changed, 25 insertions(+)

New commits:
commit f66fbd4fb5fd557d6065aeea987b3dafdc30a430
Author: Balazs Varga 
AuthorDate: Mon Jun 8 14:26:33 2020 +0200
Commit: László Németh 
CommitDate: Wed Jun 10 11:38:32 2020 +0200

tdf#91250 Chart DOCX Import: Fix decimal place formatting issue

Use UNLIMITED_PRECISION in case of GENERAL number format of CATEGORY
axis labels in embedded charts, just like Calc does.

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 4a74b468774f..804f154333e8 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -161,6 +161,7 @@ public:
 void testTdf119138MissingAutoTitleDeleted();
 void testStockChartShiftedCategoryPosition();
 void testTdf133376();
+void testTdf91250();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -270,6 +271,7 @@ public:
 CPPUNIT_TEST(testTdf119138MissingAutoTitleDeleted);
 CPPUNIT_TEST(testStockChartShiftedCategoryPosition);
 CPPUNIT_TEST(testTdf133376);
+CPPUNIT_TEST(testTdf91250);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2523,6 +2525,26 @@ void Chart2ImportTest::testTdf133376()
 CPPUNIT_ASSERT_DOUBLES_EQUAL(5269, aLabelPosition.Y, 30);
 }
 
+void Chart2ImportTest::testTdf91250()
+{
+load("/chart2/qa/extras/data/docx/", "tdf91250.docx");
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference 
xInternalProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xInternalProvider.is());
+
+Reference xDescAccess(xInternalProvider, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDescAccess.is());
+
+// Get the category labels.
+Sequence aCategories = xDescAccess->getRowDescriptions();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCategories.getLength());
+CPPUNIT_ASSERT_EQUAL(OUString("12.3254"), aCategories[0]);
+CPPUNIT_ASSERT_EQUAL(OUString("11.62315"), aCategories[1]);
+CPPUNIT_ASSERT_EQUAL(OUString("9.26"), aCategories[2]);
+CPPUNIT_ASSERT_EQUAL(OUString("8.657"), aCategories[3]);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf91250.docx 
b/chart2/qa/extras/data/docx/tdf91250.docx
new file mode 100644
index ..4cb199b45795
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf91250.docx differ
diff --git a/oox/source/drawingml/chart/datasourcecontext.cxx 
b/oox/source/drawingml/chart/datasourcecontext.cxx
index 7ad910af65d4..16cd509e4a63 100644
--- a/oox/source/drawingml/chart/datasourcecontext.cxx
+++ b/oox/source/drawingml/chart/datasourcecontext.cxx
@@ -127,6 +127,9 @@ void DoubleSequenceContext::onCharacters( const OUString& 
rChars )
 double fValue = rChars.toDouble();
 ::Color* pColor = nullptr;
 OUString aFormattedValue;
+// tdf#91250: use UNLIMITED_PRECISION in case of 
GENERAL Number Format of category axis labels
+if( pNumFrmt->GetStandardPrec() != 
SvNumberFormatter::UNLIMITED_PRECISION )
+
pNumFrmt->ChangeStandardPrec(SvNumberFormatter::UNLIMITED_PRECISION);
 pNumFrmt->GetOutputString( fValue, nKey, 
aFormattedValue,  );
 mrModel.maData[ mnPtIndex ] <<= aFormattedValue;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-10 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx  |   22 ++
 chart2/qa/extras/data/docx/tdf133632.docx  |binary
 oox/source/drawingml/chart/seriesconverter.cxx |2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 0c0f4b1531e2e985bd53e8c551328f46bde0c8c9
Author: Balazs Varga 
AuthorDate: Thu Jun 4 11:33:06 2020 +0200
Commit: László Németh 
CommitDate: Wed Jun 10 11:26:56 2020 +0200

tdf#133632 Chart DOCX Import: fix percentage number format

Set the LinkNumberFormatToSource to false only if we have
an inner data table and the labels are shown as values.

Regression from commit: e0da00d655ecca5986eea3812a8a670c6adbc40f
(tdf#132174 Chart DOCX import: fix label number format)

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index ca91d5084c50..4a74b468774f 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -91,6 +91,7 @@ public:
 void testTextBreakXLSX();
 void testNumberFormatsXLSX();
 void testNumberFormatsDOCX();
+void testPercentageNumberFormatsDOCX();
 
 void testTransparentBackground(OUString const & filename);
 
@@ -208,6 +209,7 @@ public:
 CPPUNIT_TEST(testTextBreakXLSX);
 CPPUNIT_TEST(testNumberFormatsXLSX);
 CPPUNIT_TEST(testNumberFormatsDOCX);
+CPPUNIT_TEST(testPercentageNumberFormatsDOCX);
 CPPUNIT_TEST(testAutoTitleDelDefaultValue2007XLSX);
 CPPUNIT_TEST(testAutoTitleDelDefaultValue2013XLSX);
 CPPUNIT_TEST(testDispBlanksAsDefaultValue2007XLSX);
@@ -1312,6 +1314,26 @@ void Chart2ImportTest::testNumberFormatsDOCX()
 CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to 
false.", !bLinkNumberFormatToSource);
 }
 
+void Chart2ImportTest::testPercentageNumberFormatsDOCX()
+{
+load("/chart2/qa/extras/data/docx/", "tdf133632.docx");
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+css::uno::Reference 
xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW);
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+uno::Reference xPropertySet(xDataSeries, 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT(xPropertySet.is());
+
+bool bLinkNumberFormatToSource = false;
+chart2::DataPointLabel aLabel;
+xPropertySet->getPropertyValue("Label") >>= aLabel;
+CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumber);
+CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
+bool bSuccess = 
xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= 
bLinkNumberFormatToSource;
+CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to 
true.", bSuccess && bLinkNumberFormatToSource);
+}
+
 void Chart2ImportTest::testAutoTitleDelDefaultValue2007XLSX()
 {
 load("/chart2/qa/extras/data/xlsx/", "autotitledel_2007.xlsx");
diff --git a/chart2/qa/extras/data/docx/tdf133632.docx 
b/chart2/qa/extras/data/docx/tdf133632.docx
new file mode 100644
index ..b970e73f4c2f
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf133632.docx differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 5d08b28d8094..c55c3891a975 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -343,7 +343,7 @@ void DataLabelsConverter::convertFromModel( const 
Reference< XDataSeries >& rxDa
 {
 bool bMSO2007Doc = getFilter().isMSO2007Document();
 // tdf#132174: the inner data table has no own cell number format.
-if( getChartDocument()->hasInternalDataProvider() )
+if( getChartDocument()->hasInternalDataProvider() && 
mrModel.mobShowVal.get(!bMSO2007Doc) )
 mrModel.maNumberFormat.mbSourceLinked = false;
 lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, 
rTypeGroup, true, bMSO2007Doc );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-27 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2export.cxx |   11 +++
 chart2/qa/extras/data/xlsx/chart_pie2007.xlsx |binary
 oox/source/drawingml/chart/typegroupmodel.cxx |2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 47e45d75f7789f0178ea3e1b22ef7b8adc77018e
Author: Tünde Tóth 
AuthorDate: Tue May 26 13:34:32 2020 +0200
Commit: László Németh 
CommitDate: Wed May 27 10:53:54 2020 +0200

tdf#132594 Chart XLSX import: fix legend entries in pie charts

Legend entry text of pie chart wasn't imported correctly
in XLSX documents created with Excel 2007.

Regression from commit: e0b0502516a10181bbd1737b93b38b2bba4c98e8
(tdf#128016 Chart OOXML Import: fix duplicated category labels)

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 429ea41c5a5a..81b79439a9ff 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -170,6 +170,7 @@ public:
 void testTdf125812();
 void testTdf133190();
 void testTdf133191();
+void testTdf132594();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -303,6 +304,7 @@ public:
 CPPUNIT_TEST(testTdf125812);
 CPPUNIT_TEST(testTdf133190);
 CPPUNIT_TEST(testTdf133191);
+CPPUNIT_TEST(testTdf132594);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2791,6 +2793,15 @@ void Chart2ExportTest::testTdf133191()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[3]/c:txPr/a:bodyPr",
 "rot", "-450");
 }
 
+void Chart2ExportTest::testTdf132594()
+{
+load("/chart2/qa/extras/data/xlsx/", "chart_pie2007.xlsx");
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:cat", 1);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/chart_pie2007.xlsx 
b/chart2/qa/extras/data/xlsx/chart_pie2007.xlsx
new file mode 100644
index ..b122680257c0
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/chart_pie2007.xlsx 
differ
diff --git a/oox/source/drawingml/chart/typegroupmodel.cxx 
b/oox/source/drawingml/chart/typegroupmodel.cxx
index e109d89b913d..0edd189e27a6 100644
--- a/oox/source/drawingml/chart/typegroupmodel.cxx
+++ b/oox/source/drawingml/chart/typegroupmodel.cxx
@@ -55,7 +55,7 @@ TypeGroupModel::TypeGroupModel( sal_Int32 nTypeId, bool 
bMSO2007Doc ) :
 mbSmooth( !bMSO2007Doc ),
 mbVaryColors( !bMSO2007Doc ),
 mbWireframe( !bMSO2007Doc ),
-mbCatAxisVisible( !bMSO2007Doc )
+mbCatAxisVisible( true )
 {
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-25 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   25 +
 chart2/qa/extras/data/xlsx/tdf133190_tdf133191.xlsx |binary
 oox/source/export/chartexport.cxx   |   28 +---
 3 files changed, 44 insertions(+), 9 deletions(-)

New commits:
commit 74d020fb1344dd904681b612739727351f183b78
Author: Balazs Varga 
AuthorDate: Wed May 20 21:10:41 2020 +0200
Commit: László Németh 
CommitDate: Mon May 25 14:40:14 2020 +0200

tdf#133190 tdf#133191 Chart OOXML export: fix text wrap and rotation

of data point labels.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 08086d8ae2ab..429ea41c5a5a 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -168,6 +168,8 @@ public:
 void testTdf131979();
 void testTdf132076();
 void testTdf125812();
+void testTdf133190();
+void testTdf133191();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -299,6 +301,8 @@ public:
 CPPUNIT_TEST(testTdf131979);
 CPPUNIT_TEST(testTdf132076);
 CPPUNIT_TEST(testTdf125812);
+CPPUNIT_TEST(testTdf133190);
+CPPUNIT_TEST(testTdf133191);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2766,6 +2770,27 @@ void Chart2ExportTest::testTdf125812()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect", "b", 
"51000");
 }
 
+void Chart2ExportTest::testTdf133190()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf133190_tdf133191.xlsx");
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// Test word wrap of data point label
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:bodyPr",
 "wrap", "none");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:txPr/a:bodyPr",
 "wrap", "square");
+}
+
+void Chart2ExportTest::testTdf133191()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf133190_tdf133191.xlsx");
+xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// Test rotation of data point label
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[3]/c:txPr/a:bodyPr",
 "rot", "-450");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf133190_tdf133191.xlsx 
b/chart2/qa/extras/data/xlsx/tdf133190_tdf133191.xlsx
new file mode 100644
index ..f8cad0e8cfec
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/tdf133190_tdf133191.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 211b5b456438..6511cfaac48c 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2573,9 +2573,11 @@ void ChartExport::exportTextProps(const 
Reference& xPropSet)
 pFS->startElement(FSNS(XML_c, XML_txPr));
 
 sal_Int32 nRotation = 0;
+const char* textWordWrap = nullptr;
+
 if (auto xServiceInfo = uno::Reference(xPropSet, 
uno::UNO_QUERY))
 {
-double fMultiplier = 0;
+double fMultiplier = 0.0;
 // We have at least two possible units of returned value: degrees 
(e.g., for data labels),
 // and 100ths of degree (e.g., for axes labels). The latter is 
returned as an Any wrapping
 // a sal_Int32 value (see 
WrappedTextRotationProperty::convertInnerToOuterValue), while
@@ -2583,8 +2585,15 @@ void ChartExport::exportTextProps(const 
Reference& xPropSet)
 // use. But testing the service info should be more robust.
 if (xServiceInfo->supportsService("com.sun.star.chart.ChartAxis"))
 fMultiplier = -600.0;
-else if 
(xServiceInfo->supportsService("com.sun.star.chart2.DataSeries"))
+else if 
(xServiceInfo->supportsService("com.sun.star.chart2.DataSeries") || 
xServiceInfo->supportsService("com.sun.star.chart2.DataPointProperties"))
+{
 fMultiplier = -6.0;
+bool bTextWordWrap = false;
+if ((xPropSet->getPropertyValue("TextWordWrap") >>= bTextWordWrap) 
&& bTextWordWrap)
+textWordWrap = "square";
+else
+textWordWrap = "none";
+}
 
 if (fMultiplier)
 {
@@ -2592,25 +2601,26 @@ void ChartExport::exportTextProps(const 
Reference& xPropSet)
 uno::Any aAny = xPropSet->getPropertyValue("TextRotation");
 if (aAny.hasValue() && (aAny >>= fTextRotation))
 {
+fTextRotation *= fMultiplier;
 // The MS Office UI allows values only in range of 

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

2020-05-25 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2export.cxx|   14 
 chart2/qa/extras/data/odp/ellipticalGradientFill.odp |binary
 oox/source/export/drawingml.cxx  |   32 ++-
 3 files changed, 25 insertions(+), 21 deletions(-)

New commits:
commit 9cbde4be33d82fc822b11394e713b8d2492bcac8
Author: Tünde Tóth 
AuthorDate: Tue May 19 10:46:01 2020 +0200
Commit: László Németh 
CommitDate: Mon May 25 11:18:59 2020 +0200

tdf#125812 Chart: fix OOXML export of gradient center

See also: commit 898e4ae1364e76af8be22183ac64d73b6a6d8d90
(tdf#128794 Chart: Fix OOXML import/export of Radial gradient)

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 84a38b258733..08086d8ae2ab 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -167,6 +167,7 @@ public:
 void testTdf127792();
 void testTdf131979();
 void testTdf132076();
+void testTdf125812();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -297,6 +298,7 @@ public:
 CPPUNIT_TEST(testTdf127792);
 CPPUNIT_TEST(testTdf131979);
 CPPUNIT_TEST(testTdf132076);
+CPPUNIT_TEST(testTdf125812);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2752,6 +2754,18 @@ void Chart2ExportTest::testTdf132076()
 }
 }
 
+void Chart2ExportTest::testTdf125812()
+{
+load("/chart2/qa/extras/data/odp/", "ellipticalGradientFill.odp");
+xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS 
PowerPoint 2007 XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path", "path", "circle");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect", "l", 
"5");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect", "t", 
"49000");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect", "r", 
"5");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect", "b", 
"51000");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/odp/ellipticalGradientFill.odp 
b/chart2/qa/extras/data/odp/ellipticalGradientFill.odp
new file mode 100644
index ..754f439e5864
Binary files /dev/null and 
b/chart2/qa/extras/data/odp/ellipticalGradientFill.odp differ
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0be37c8748f0..21825902f1a0 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -176,9 +176,9 @@ static css::uno::Any getLineDash( const 
css::uno::Reference&
 
 namespace
 {
-void WriteRadialGradientPath(const awt::Gradient& rGradient, const 
FSHelperPtr& pFS)
+void WriteGradientPath(const awt::Gradient& rGradient, const FSHelperPtr& pFS, 
const bool bCircle)
 {
-pFS->startElementNS(XML_a, XML_path, XML_path, "circle");
+pFS->startElementNS(XML_a, XML_path, XML_path, bCircle ? "circle" : 
"rect");
 
 // Write the focus rectangle. Work with the focus point, and assume
 // that it extends 50% in all directions.  The below
@@ -186,13 +186,13 @@ void WriteRadialGradientPath(const awt::Gradient& 
rGradient, const FSHelperPtr&
 // edge of the tile rectangle and 100% means the center of it.
 rtl::Reference pAttributeList(
 sax_fastparser::FastSerializerHelper::createAttrList());
-sal_Int32 nLeftPercent = rGradient.XOffset * 2 - 50;
+sal_Int32 nLeftPercent = rGradient.XOffset;
 pAttributeList->add(XML_l, OString::number(nLeftPercent * PER_PERCENT));
-sal_Int32 nTopPercent = rGradient.YOffset * 2 - 50;
+sal_Int32 nTopPercent = rGradient.YOffset;
 pAttributeList->add(XML_t, OString::number(nTopPercent * PER_PERCENT));
-sal_Int32 nRightPercent = (100 - rGradient.XOffset) * 2 - 50;
+sal_Int32 nRightPercent = 100 - rGradient.XOffset;
 pAttributeList->add(XML_r, OString::number(nRightPercent * PER_PERCENT));
-sal_Int32 nBottomPercent = (100 - rGradient.YOffset) * 2 - 50;
+sal_Int32 nBottomPercent = 100 - rGradient.YOffset;
 pAttributeList->add(XML_b, OString::number(nBottomPercent * PER_PERCENT));
 sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList.get());
 pFS->singleElementNS(XML_a, XML_fillToRect, xAttributeList);
@@ -570,7 +570,7 @@ void DrawingML::WriteGrabBagGradientFill( const Sequence< 
PropertyValue >& aGrad
 OString::number3600 - rGradient.Angle + 900) * 6000) % 
2160)));
 break;
 case awt::GradientStyle_RADIAL:
-

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

2020-05-12 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |   13 ++
 chart2/qa/extras/data/docx/tdf128794.docx |binary
 oox/source/drawingml/fillproperties.cxx   |   36 --
 3 files changed, 37 insertions(+), 12 deletions(-)

New commits:
commit 898e4ae1364e76af8be22183ac64d73b6a6d8d90
Author: Balazs Varga 
AuthorDate: Tue May 5 16:58:23 2020 +0200
Commit: László Németh 
CommitDate: Tue May 12 16:50:45 2020 +0200

tdf#128794 Chart: Fix OOXML import/export of Radial gradient

Style should be radial at least when the horizontal/vertical
center is not in the corner of a shape. Otherwise import
as a linear gradient, because it is the most similar to the
MSO radial style.

Change-Id: I9bab7b787897bde51a06a950487de9843eb717a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93497
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: Tünde Tóth 
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 571a0da80132..5909bfd2c5db 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -96,6 +96,7 @@ public:
 void testColorGradientWithTransparancyDOCX();
 void testColorGradientWithTransparancyODS();
 void testColorGradientStopXLSX();
+void testRadialColorGradientDOCX();
 void testBarChartDataPointPropDOCX();
 void testFdo83058dlblPos();
 void testAutoTitleDelXLSX();
@@ -225,6 +226,7 @@ public:
 CPPUNIT_TEST(testColorGradientWithTransparancyDOCX);
 CPPUNIT_TEST(testColorGradientWithTransparancyODS);
 CPPUNIT_TEST(testColorGradientStopXLSX);
+CPPUNIT_TEST(testRadialColorGradientDOCX);
 CPPUNIT_TEST(testBarChartDataPointPropDOCX);
 CPPUNIT_TEST(testFdo83058dlblPos);
 CPPUNIT_TEST(testAutoTitleDelXLSX);
@@ -1347,6 +1349,17 @@ void Chart2ExportTest::testColorGradientStopXLSX()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:spPr/a:gradFill/a:gsLst/a:gs[2]",
 "pos", "10");
 }
 
+void Chart2ExportTest::testRadialColorGradientDOCX()
+{
+load("/chart2/qa/extras/data/docx/", "tdf128794.docx");
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+// Test the gradeint style (if there is no 'a:path' attribute, it is a 
linear gradient)
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path", 0);
+// Test the linear gradeint angle
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:lin", "ang", "1350");
+}
+
 void Chart2ExportTest::testBarChartDataPointPropDOCX()
 {
 load("/chart2/qa/extras/data/docx/", "testBarChartDataPointPropDOCX.docx");
diff --git a/chart2/qa/extras/data/docx/tdf128794.docx 
b/chart2/qa/extras/data/docx/tdf128794.docx
new file mode 100644
index ..098c0a00e3cc
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf128794.docx differ
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index acc13271ebc1..023af3bc613f 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -374,23 +374,35 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 
 if( maGradientProps.moGradientPath.has() )
 {
-// position of gradient center (limited to [30%;100%], 
otherwise gradient is too hidden)
 IntegerRectangle2D aFillToRect = 
maGradientProps.moFillToRect.get( IntegerRectangle2D( 0, 0, MAX_PERCENT, 
MAX_PERCENT ) );
 sal_Int32 nCenterX = (MAX_PERCENT + aFillToRect.X1 - 
aFillToRect.X2) / 2;
 aGradient.XOffset = getLimitedValue(
-nCenterX / PER_PERCENT, 30, 100);
-
-// Style should be radial at least when the horizontal 
center is at 50%.
-awt::GradientStyle eCircle = aGradient.XOffset == 50
- ? 
awt::GradientStyle_RADIAL
- : 
awt::GradientStyle_ELLIPTICAL;
-aGradient.Style = (maGradientProps.moGradientPath.get() == 
XML_circle)
-  ? eCircle
-  : awt::GradientStyle_RECT;
-
+nCenterX / PER_PERCENT, 0, 100);
 sal_Int32 nCenterY = (MAX_PERCENT + aFillToRect.Y1 - 
aFillToRect.Y2) / 2;
 aGradient.YOffset = getLimitedValue(
-nCenterY / PER_PERCENT, 30, 100);
+nCenterY / PER_PERCENT, 0, 100);
+
+if( maGradientProps.moGradientPath.get() == XML_circle )
+{
+// Style should be radial at least when the horizontal 
center is at 50%.
+// 

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

2020-04-24 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx  |   24 
 chart2/qa/extras/data/docx/tdf132174.docx  |binary
 oox/source/drawingml/chart/seriesconverter.cxx |4 
 3 files changed, 28 insertions(+)

New commits:
commit e0da00d655ecca5986eea3812a8a670c6adbc40f
Author: Balazs Varga 
AuthorDate: Wed Apr 22 14:41:49 2020 +0200
Commit: László Németh 
CommitDate: Fri Apr 24 15:59:41 2020 +0200

tdf#132174 Chart DOCX import: fix label number format

The inner data table of charts has no own cell number format,
unlike the MSO embedded XLSX, so we always have to set the link
number format to false, if we have an inner data table.

Regression from commit: 9c1063ba13028244346528e307d5563d6faf949d
(tdf#129173 tdf#129175 Fix number format of data labels)

Change-Id: I5e7865cb8c19fc6fae5b68305c7dc302516c0ad4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92695
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: Tünde Tóth 
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 4a7ccb373685..844d7208bac0 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -90,6 +90,7 @@ public:
 // void testTextCanOverlapXLSX(); // TODO : temporarily disabled.
 void testTextBreakXLSX();
 void testNumberFormatsXLSX();
+void testNumberFormatsDOCX();
 
 void testTransparentBackground(OUString const & filename);
 
@@ -204,6 +205,7 @@ public:
 // CPPUNIT_TEST(testTextCanOverlapXLSX); // TODO : temporarily disabled.
 CPPUNIT_TEST(testTextBreakXLSX);
 CPPUNIT_TEST(testNumberFormatsXLSX);
+CPPUNIT_TEST(testNumberFormatsDOCX);
 CPPUNIT_TEST(testAutoTitleDelDefaultValue2007XLSX);
 CPPUNIT_TEST(testAutoTitleDelDefaultValue2013XLSX);
 CPPUNIT_TEST(testDispBlanksAsDefaultValue2007XLSX);
@@ -1284,6 +1286,28 @@ void Chart2ImportTest::testNumberFormatsXLSX()
 CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to 
true.", bSuccess && bLinkNumberFormatToSource);
 }
 
+void Chart2ImportTest::testNumberFormatsDOCX()
+{
+load("/chart2/qa/extras/data/docx/", "tdf132174.docx");
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+css::uno::Reference 
xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW);
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+uno::Reference xPropertySet(xDataSeries, 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT(xPropertySet.is());
+
+sal_Int32 nNumberFormat;
+bool bLinkNumberFormatToSource = true;
+const sal_Int32 nChartDataNumberFormat = getNumberFormat(xChartDoc, "0%");
+xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
+CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
+xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= 
bLinkNumberFormatToSource;
+// LinkNumberFormatToSource should be set to false even if the OOXML 
contain a true value,
+// because the inner data table of charts have no own number format!
+CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to 
false.", !bLinkNumberFormatToSource);
+}
+
 void Chart2ImportTest::testAutoTitleDelDefaultValue2007XLSX()
 {
 load("/chart2/qa/extras/data/xlsx/", "autotitledel_2007.xlsx");
diff --git a/chart2/qa/extras/data/docx/tdf132174.docx 
b/chart2/qa/extras/data/docx/tdf132174.docx
new file mode 100644
index ..4f43695784fb
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf132174.docx differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 01e004f45c59..b12f4416100b 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -323,6 +324,9 @@ void DataLabelsConverter::convertFromModel( const 
Reference< XDataSeries >& rxDa
 if( !mrModel.mbDeleted )
 {
 bool bMSO2007Doc = getFilter().isMSO2007Document();
+// tdf#132174: the inner data table has no own cell number format.
+if( getChartDocument()->hasInternalDataProvider() )
+mrModel.maNumberFormat.mbSourceLinked = false;
 lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, 
rTypeGroup, true, bMSO2007Doc );
 
 if (mrModel.mxShapeProp)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-24 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx|   20 
 chart2/qa/extras/data/ods/tdf132076.ods  |binary
 chart2/qa/extras/data/xlsx/tdf132076.xlsx|binary
 oox/source/drawingml/chart/axisconverter.cxx |   10 ++--
 oox/source/export/chartexport.cxx|   62 ---
 5 files changed, 82 insertions(+), 10 deletions(-)

New commits:
commit 75156c6fd73dc202df541306e1636727d51d6fc3
Author: Balazs Varga 
AuthorDate: Thu Apr 16 22:08:15 2020 +0200
Commit: László Németh 
CommitDate: Fri Apr 24 15:28:17 2020 +0200

tdf#132076 Chart OOXML: fix lost date format of X axis

labels. Set the number format of category or date axes
too and use date axis type for date axes at import.
Export the real axis type of the X axis.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 378e2361d034..b44d712dbd50 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -165,6 +165,7 @@ public:
 void testTdf75330();
 void testTdf127792();
 void testTdf131979();
+void testTdf132076();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -293,6 +294,7 @@ public:
 CPPUNIT_TEST(testTdf75330);
 CPPUNIT_TEST(testTdf127792);
 CPPUNIT_TEST(testTdf131979);
+CPPUNIT_TEST(testTdf132076);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2711,6 +2713,24 @@ void Chart2ExportTest::testTdf131979()
 }
 }
 
+void Chart2ExportTest::testTdf132076()
+{
+{
+load("/chart2/qa/extras/data/ods/", "tdf132076.ods");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:catAx/c:numFmt", "formatCode", "dd");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:catAx/c:numFmt", "sourceLinked", "0");
+}
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf132076.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:numFmt", "formatCode", "dd");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:numFmt", "sourceLinked", "0");
+}
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/ods/tdf132076.ods 
b/chart2/qa/extras/data/ods/tdf132076.ods
new file mode 100644
index ..348dd0d71f25
Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf132076.ods differ
diff --git a/chart2/qa/extras/data/xlsx/tdf132076.xlsx 
b/chart2/qa/extras/data/xlsx/tdf132076.xlsx
new file mode 100644
index ..799ef9c8555a
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf132076.xlsx differ
diff --git a/oox/source/drawingml/chart/axisconverter.cxx 
b/oox/source/drawingml/chart/axisconverter.cxx
index 9e62b61d73bc..d73632476550 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -205,10 +205,8 @@ void AxisConverter::convertFromModel(
 OSL_ENSURE( (mrModel.mnTypeId == C_TOKEN( catAx )) || 
(mrModel.mnTypeId == C_TOKEN( dateAx )),
 "AxisConverter::convertFromModel - unexpected axis 
model type (must: c:catAx or c:dateAx)" );
 bool bDateAxis = mrModel.mnTypeId == C_TOKEN( dateAx );
-/*  Chart2 requires axis type CATEGORY for automatic
-category/date axis (even if it is a date axis
-currently). */
-aScaleData.AxisType = (bDateAxis && !mrModel.mbAuto) ? 
cssc2::AxisType::DATE : cssc2::AxisType::CATEGORY;
+// tdf#132076: set axis type to date, if it is a date axis!
+aScaleData.AxisType = bDateAxis ? cssc2::AxisType::DATE : 
cssc2::AxisType::CATEGORY;
 aScaleData.AutoDateAxis = mrModel.mbAuto;
 aScaleData.Categories = 
rTypeGroups.front()->createCategorySequence();
 /* set default ShiftedCategoryPosition values for some 
charttype,
@@ -341,8 +339,10 @@ void AxisConverter::convertFromModel(
 xAxis->setScaleData( aScaleData );
 
 // number format --
-if( !mrModel.mbDeleted && ((aScaleData.AxisType == 
cssc2::AxisType::REALNUMBER) || (aScaleData.AxisType == 
cssc2::AxisType::PERCENT)) )
+if( !mrModel.mbDeleted && aScaleData.AxisType != 
cssc2::AxisType::SERIES )
+{
 getFormatter().convertNumberFormat(aAxisProp, 
mrModel.maNumberFormat, true);
+}
 
 // position 

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

2020-03-20 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx   |   14 ++
 chart2/qa/extras/data/xlsx/tdfPieNumFormat.xlsx |binary
 oox/source/drawingml/chart/seriesconverter.cxx  |7 ---
 3 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 9f3623ce21a89e026128f85b4a09a40757754090
Author: Balazs Varga 
AuthorDate: Mon Mar 16 15:44:06 2020 +0100
Commit: László Németh 
CommitDate: Fri Mar 20 11:44:46 2020 +0100

tdf#131398 OOXML chart import: fix number format of pie chart labels

Remove percentage format detection heuristics, which converted the
plain number format with percentage style to percentage format based
on the formatted string, resulting bad pie chart labels.

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 68a142090805..4a7ccb373685 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -61,6 +61,7 @@ public:
  */
 void testPPTXHiddenDataSeries();
 void testPPTXPercentageNumberFormats();
+void testPieChartLabelsNumFormat();
 void testPPTXStackedNonStackedYAxis();
 void testPPTChartSeries();
 void testODPChartSeries();
@@ -175,6 +176,7 @@ public:
 CPPUNIT_TEST(testPPTXSparseChartSeries);
 CPPUNIT_TEST(testPPTXHiddenDataSeries);
 CPPUNIT_TEST(testPPTXPercentageNumberFormats);
+CPPUNIT_TEST(testPieChartLabelsNumFormat);
 CPPUNIT_TEST(testPPTXStackedNonStackedYAxis);
 CPPUNIT_TEST(testODPChartSeries);
 CPPUNIT_TEST(testBnc864396);
@@ -710,6 +712,18 @@ void Chart2ImportTest::testPPTXPercentageNumberFormats()
 CPPUNIT_ASSERT_MESSAGE("Y axis should be a percent format.", (nType & 
util::NumberFormat::PERCENT));
 }
 
+void Chart2ImportTest::testPieChartLabelsNumFormat()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdfPieNumFormat.xlsx");
+uno::Reference< chart::XChartDocument > xChartDoc(getChartCompFromSheet(0, 
mxComponent), UNO_QUERY_THROW);
+CPPUNIT_ASSERT(xChartDoc.is());
+// test data point labels format
+Reference 
xDataPointPropSet(xChartDoc->getDiagram()->getDataPointProperties(0, 0), 
uno::UNO_SET_THROW);
+chart2::DataPointLabel aLabel;
+xDataPointPropSet->getPropertyValue("Label") >>= aLabel;
+CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
+}
+
 void Chart2ImportTest::testPPTXStackedNonStackedYAxis()
 {
 load("/chart2/qa/extras/data/pptx/", 
"stacked-non-stacked-mix-y-axis.pptx");
diff --git a/chart2/qa/extras/data/xlsx/tdfPieNumFormat.xlsx 
b/chart2/qa/extras/data/xlsx/tdfPieNumFormat.xlsx
new file mode 100644
index ..0835cb33325b
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdfPieNumFormat.xlsx 
differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 6ade0b4cfd07..f063019b8327 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -124,13 +124,6 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, 
ObjectFormatter& rFormatt
 
 bool bShowValue   = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.get( 
!bMSO2007Doc );
 bool bShowPercent = !rDataLabel.mbDeleted && 
rDataLabel.mobShowPercent.get( !bMSO2007Doc ) && (rTypeInfo.meTypeCategory == 
TYPECATEGORY_PIE);
-if( bShowValue &&
-!bShowPercent && rTypeInfo.meTypeCategory == TYPECATEGORY_PIE &&
-rDataLabel.maNumberFormat.maFormatCode.indexOf('%') >= 0 )
-{
-bShowValue = false;
-bShowPercent = true;
-}
 bool bShowCateg   = !rDataLabel.mbDeleted && 
rDataLabel.mobShowCatName.get( !bMSO2007Doc );
 bool bShowSymbol  = !rDataLabel.mbDeleted && 
rDataLabel.mobShowLegendKey.get( !bMSO2007Doc );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-03-02 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |   23 +--
 chart2/qa/extras/data/xlsx/tdf130986.xlsx |binary
 oox/source/export/chartexport.cxx |3 +++
 3 files changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 94973fa0fa5c1253d8c8bf6b104d9e7123eee923
Author: Balazs Varga 
AuthorDate: Thu Feb 27 15:43:48 2020 +0100
Commit: László Németh 
CommitDate: Mon Mar 2 18:36:17 2020 +0100

tdf#130986 Chart OOXML export: fix number format of custom label

Export correct sourceLinked attribute in c:dLbls/c:dLbl/c:numFmt, as
in c:dLbls/c:numFmt.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 46c3e186d912..217e766e42fc 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -1619,13 +1619,24 @@ void Chart2ExportTest::testAxisNumberFormatXLSX()
 void Chart2ExportTest::testDataPointLabelNumberFormatXLSX()
 {
 load("/chart2/qa/extras/data/ods/", "tdf123774.ods");
-xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
-CPPUNIT_ASSERT(pXmlDoc);
-assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", 
"formatCode", "[$-40E]0.00%");
-assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", 
"sourceLinked", "0");
+{
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", 
"formatCode", "[$-40E]0.00%");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", 
"sourceLinked", "0");
 
-assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt", 
"formatCode", "[$-40E]0.00%");
-assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt", 
"sourceLinked", "0");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt", 
"formatCode", "[$-40E]0.00%");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt", 
"sourceLinked", "0");
+}
+
+load("/chart2/qa/extras/data/xlsx/", "tdf130986.xlsx");
+{
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open 
XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:idx", 
"val", "1");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:numFmt", 
"formatCode", "0.00E+00");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:numFmt", 
"sourceLinked", "0");
+}
 }
 
 void Chart2ExportTest::testDataLabelDefaultValuesXLSX()
diff --git a/chart2/qa/extras/data/xlsx/tdf130986.xlsx 
b/chart2/qa/extras/data/xlsx/tdf130986.xlsx
new file mode 100644
index ..9674fd1ab1d0
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf130986.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index c4a3827ea4fc..cf586257ccf7 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3435,6 +3435,9 @@ void ChartExport::exportDataLabels(
 }
 }
 
+if( GetProperty(xLabelPropSet, "LinkNumberFormatToSource") )
+mAny >>= bLinkedNumFmt;
+
 if( xLabelPropSet->getPropertyValue("Label") >>= aLabel )
 bLabelIsNumberFormat = aLabel.ShowNumber;
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-21 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx|   17 +
 chart2/qa/extras/data/xlsx/tdf130657.xlsx|binary
 oox/source/drawingml/chart/axisconverter.cxx |4 +++-
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 8163f4ad81487ae187d00d3ce86214e520cb8b69
Author: Balazs Varga 
AuthorDate: Fri Feb 14 14:06:04 2020 +0100
Commit: László Németh 
CommitDate: Fri Feb 21 09:21:39 2020 +0100

tdf#130657 OOXML chart import: fix charts without CrossBetween

by using default values for ShiftedCategoryPosition.

Regression from commit 111c260ab2883b7906f1a66e222dbf4dc3c58c4f
(tdf#12 OOXML chart export: fix "CrossBetween" for not imported charts)

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 93be02e70160..4850f33ee76c 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -141,6 +141,7 @@ public:
 void testTdf128432();
 void testTdf128627();
 void testTdf128634();
+void testTdf130657();
 void testDeletedDataLabel();
 void testDataPointInheritedColorDOCX();
 void testExternalStrRefsXLSX();
@@ -244,6 +245,7 @@ public:
 CPPUNIT_TEST(testTdf128432);
 CPPUNIT_TEST(testTdf128627);
 CPPUNIT_TEST(testTdf128634);
+CPPUNIT_TEST(testTdf130657);
 CPPUNIT_TEST(testDeletedDataLabel);
 CPPUNIT_TEST(testDataPointInheritedColorDOCX);
 CPPUNIT_TEST(testExternalStrRefsXLSX);
@@ -2127,6 +2129,21 @@ void Chart2ImportTest::testTdf128634()
 CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition);
 }
 
+void Chart2ImportTest::testTdf130657()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf130657.xlsx");
+// Test ShiftedCategoryPosition for charts which is not contain a 
"crossbetween" OOXML tag.
+uno::Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
+CPPUNIT_ASSERT(xAxis.is());
+
+chart2::ScaleData aScaleData = xAxis->getScaleData();
+CPPUNIT_ASSERT(aScaleData.Categories.is());
+CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition);
+}
+
 namespace {
 
 void checkDataLabelProperties(const Reference& 
xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible)
diff --git a/chart2/qa/extras/data/xlsx/tdf130657.xlsx 
b/chart2/qa/extras/data/xlsx/tdf130657.xlsx
new file mode 100644
index ..036da200ab9b
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf130657.xlsx differ
diff --git a/oox/source/drawingml/chart/axisconverter.cxx 
b/oox/source/drawingml/chart/axisconverter.cxx
index b79620081a70..5d1c94b875ba 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -217,8 +217,10 @@ void AxisConverter::convertFromModel(
 aScaleData.ShiftedCategoryPosition = true;
 else if( rTypeInfo.meTypeId == TYPEID_RADARLINE || 
rTypeInfo.meTypeId == TYPEID_RADARAREA )
 aScaleData.ShiftedCategoryPosition = false;
-else
+else if( pCrossingAxis->mnCrossBetween != -1 ) /*because 
of backwards compatibility*/
 aScaleData.ShiftedCategoryPosition = 
pCrossingAxis->mnCrossBetween == XML_between;
+else if( rTypeInfo.meTypeCategory == TYPECATEGORY_BAR || 
rTypeInfo.meTypeId == TYPEID_LINE || rTypeInfo.meTypeId == TYPEID_STOCK )
+aScaleData.ShiftedCategoryPosition = true;
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-20 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   14 ++
 chart2/qa/extras/data/xlsx/auto_marker_excel10.xlsx |binary
 oox/source/export/chartexport.cxx   |2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit bae73c0726e7fdf7f427a8254c9d6d4b4c510daf
Author: Tünde Tóth 
AuthorDate: Tue Feb 11 15:16:34 2020 +0100
Commit: László Németh 
CommitDate: Thu Feb 20 15:02:54 2020 +0100

tdf#126076 XLSX export: fix automatic line chart markers

The default automatic line chart markers in XLSX spreadsheets
created with Microsoft Excel 2010 became squares after export.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 88c7d154d170..469e25618b5f 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -156,6 +156,7 @@ public:
 void testTdf123206_customLabelText();
 void testDeletedLegendEntries();
 void testTdf130225();
+void testTdf126076();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -275,6 +276,7 @@ public:
 CPPUNIT_TEST(testTdf123206_customLabelText);
 CPPUNIT_TEST(testDeletedLegendEntries);
 CPPUNIT_TEST(testTdf130225);
+CPPUNIT_TEST(testTdf126076);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2516,6 +2518,18 @@ void Chart2ExportTest::testTdf130225()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), deletedLegendEntriesSeq[0]);
 }
 
+void Chart2ExportTest::testTdf126076()
+{
+load("/chart2/qa/extras/data/xlsx/", "auto_marker_excel10.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// This was 12: all series exported with square markers
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:marker/c:symbol[@val='square']",
 0);
+// instead of skipping markers
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:marker", 0);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/auto_marker_excel10.xlsx 
b/chart2/qa/extras/data/xlsx/auto_marker_excel10.xlsx
new file mode 100644
index ..c15756257251
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/auto_marker_excel10.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index fbeb2a892672..c4a3827ea4fc 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3810,7 +3810,7 @@ void ChartExport::exportMarker(const Reference< 
XPropertySet >& xPropSet)
 if( GetProperty( xPropSet, "Symbol" ) )
 mAny >>= aSymbol;
 
-if(aSymbol.Style != chart2::SymbolStyle_STANDARD && aSymbol.Style != 
chart2::SymbolStyle_AUTO && aSymbol.Style != chart2::SymbolStyle_NONE)
+if(aSymbol.Style != chart2::SymbolStyle_STANDARD && aSymbol.Style != 
chart2::SymbolStyle_NONE)
 return;
 
 FSHelperPtr pFS = GetFS();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-17 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   19 
 chart2/qa/extras/data/xlsx/testCustomPosDataLabels.xlsx |binary
 oox/source/export/chartexport.cxx   |   19 
 3 files changed, 38 insertions(+)

New commits:
commit 5339d0800ccdcd325294e61f8ae9e67648beb035
Author: Balazs Varga 
AuthorDate: Mon Feb 10 14:22:11 2020 +0100
Commit: László Németh 
CommitDate: Mon Feb 17 17:58:40 2020 +0100

tdf#130590 Chart OOXML export: fix custom label position

in case of all chart types except pie chart.

Follow-up of commit 4223ff2be69f03e571464b0b09ad0d278918631b
(tdf#48436 Chart: add CustomLabelPosition UNO API property)

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 1ff1064046e1..b9d5873052ba 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -134,6 +134,7 @@ public:
 void testAxisCrossBetweenXSLX();
 void testPieChartDataPointExplosionXLSX();
 void testCustomDataLabel();
+void testCustomPositionofDataLabel();
 void testCustomDataLabelMultipleSeries();
 void testNumberFormatExportPPTX();
 void testLabelSeparatorExportDOCX();
@@ -251,6 +252,7 @@ public:
 CPPUNIT_TEST(testAxisCrossBetweenXSLX);
 CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
 CPPUNIT_TEST(testCustomDataLabel);
+CPPUNIT_TEST(testCustomPositionofDataLabel);
 CPPUNIT_TEST(testCustomDataLabelMultipleSeries);
 CPPUNIT_TEST(testNumberFormatExportPPTX);
 CPPUNIT_TEST(testLabelSeparatorExportDOCX);
@@ -2170,6 +2172,23 @@ void Chart2ExportTest::testCustomDataLabel()
 CPPUNIT_ASSERT_EQUAL(OUString(" getString());
 }
 
+void Chart2ExportTest::testCustomPositionofDataLabel()
+{
+load("/chart2/qa/extras/data/xlsx/", "testCustomPosDataLabels.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// test custom position of data label
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", 
"val", "2");
+OUString aXVal = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:layout/c:manualLayout/c:x",
 "val");
+double nX = aXVal.toDouble();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.11027682973075476, nX, 1e-7);
+
+OUString aYVal = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:layout/c:manualLayout/c:y",
 "val");
+double nY = aYVal.toDouble();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.0742140311063737, nY, 1e-7);
+}
+
 void Chart2ExportTest::testCustomDataLabelMultipleSeries()
 {
 load("/chart2/qa/extras/data/pptx/", "tdf115107-2.pptx");
diff --git a/chart2/qa/extras/data/xlsx/testCustomPosDataLabels.xlsx 
b/chart2/qa/extras/data/xlsx/testCustomPosDataLabels.xlsx
new file mode 100644
index ..caa08956cd27
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/testCustomPosDataLabels.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 8debc8d047c3..ae33fdcdd222 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3416,6 +3416,25 @@ void ChartExport::exportDataLabels(
 pFS->startElement(FSNS(XML_c, XML_dLbl));
 pFS->singleElement(FSNS(XML_c, XML_idx), XML_val, 
OString::number(nIdx));
 
+// export custom position of data label
+if( eChartType != chart::TYPEID_PIE )
+{
+chart2::RelativePosition aCustomLabelPosition;
+if( xLabelPropSet->getPropertyValue("CustomLabelPosition") >>= 
aCustomLabelPosition )
+{
+pFS->startElement(FSNS(XML_c, XML_layout));
+pFS->startElement(FSNS(XML_c, XML_manualLayout));
+
+pFS->singleElement(FSNS(XML_c, XML_x), XML_val, 
OString::number(aCustomLabelPosition.Primary));
+pFS->singleElement(FSNS(XML_c, XML_y), XML_val, 
OString::number(aCustomLabelPosition.Secondary));
+
+SAL_WARN_IF(aCustomLabelPosition.Anchor != 
css::drawing::Alignment_TOP_LEFT, "oox", "unsupported anchor position");
+
+pFS->endElement(FSNS(XML_c, XML_manualLayout));
+pFS->endElement(FSNS(XML_c, XML_layout));
+}
+}
+
 if( xLabelPropSet->getPropertyValue("Label") >>= aLabel )
 bLabelIsNumberFormat = aLabel.ShowNumber;
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-13 Thread Gabor Kelemen (via logerrit)
 chart2/qa/extras/chart2import.cxx  |   13 
++
 chart2/qa/extras/data/xlsx/tdf119138-missing-autotitledeleted.xlsx |binary
 oox/source/drawingml/chart/chartspaceconverter.cxx |5 +++
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 176e06c116db09cae5781522461390da87632953
Author: Gabor Kelemen 
AuthorDate: Thu Feb 6 23:54:26 2020 +0100
Commit: László Németh 
CommitDate: Thu Feb 13 09:54:40 2020 +0100

tdf#119138 Show custom chart title if autoTitleDeleted is missing

autoTitleDeleted might be omitted by generators other than Excel
while providing custom title. mbAutoTitleDel is set only based on the 
attribute value
and the default also varies on whether MSO 2007 or newer is the generator, 
see tdf#78080

ECMA-376 Part 1 at 21.2.2.7 says:
A value of 1 or true specifies that the property is applied.
This is the default value for this attribute, and is implied
when the parent element is present, but this attribute is omitted.

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 054b04209db2..93be02e70160 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -154,6 +154,7 @@ public:
 void testTdf125444PercentageCustomLabel();
 void testDataPointLabelCustomPos();
 void testTdf130032();
+void testTdf119138MissingAutoTitleDeleted();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -256,6 +257,7 @@ public:
 CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
 CPPUNIT_TEST(testDataPointLabelCustomPos);
 CPPUNIT_TEST(testTdf130032);
+CPPUNIT_TEST(testTdf119138MissingAutoTitleDeleted);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2397,6 +2399,17 @@ void Chart2ImportTest::testTdf130032()
 CPPUNIT_ASSERT_EQUAL(chart::DataLabelPlacement::RIGHT, aPlacement);
 }
 
+void Chart2ImportTest::testTdf119138MissingAutoTitleDeleted()
+{
+load("/chart2/qa/extras/data/xlsx/", 
"tdf119138-missing-autotitledeleted.xlsx");
+Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+Reference xTitled(xChartDoc, uno::UNO_QUERY_THROW);
+uno::Reference xTitle = xTitled->getTitleObject();
+CPPUNIT_ASSERT_MESSAGE("Missing autoTitleDeleted is implied to be True if 
title text is present", xTitle.is());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf119138-missing-autotitledeleted.xlsx 
b/chart2/qa/extras/data/xlsx/tdf119138-missing-autotitledeleted.xlsx
new file mode 100644
index ..a20aa0bb1bf7
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/tdf119138-missing-autotitledeleted.xlsx differ
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx 
b/oox/source/drawingml/chart/chartspaceconverter.cxx
index ade046ef08e8..9ea5d8a6c97f 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -176,7 +176,10 @@ void ChartSpaceConverter::convertFromModel( const 
Reference< XShapes >& rxExtern
 }
 
 // chart title
-if( !mrModel.mbAutoTitleDel ) try
+/* tdf#119138 autoTitleDeleted might be omitted by generators other than 
Excel
+   while providing custom title. mbAutoTitleDel is set only based on the 
attribute value
+   and the default also varies on whether MSO 2007 or newer is the 
generator, see tdf#78080 */
+if( !mrModel.mbAutoTitleDel || mrModel.mxTitle.is() ) try
 {
 /*  If the title model is missing, but the chart shows exactly one
 series, the series title is shown as chart title. */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-29 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx|   14 ++
 chart2/qa/extras/data/xlsx/test3DAreaChartZAxis.xlsx |binary
 oox/source/export/chartexport.cxx|2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 6df2d48b53946e518a9689c3ea020250652d56be
Author: Balazs Varga 
AuthorDate: Mon Jan 27 11:19:16 2020 +0100
Commit: László Németh 
CommitDate: Wed Jan 29 12:01:40 2020 +0100

tdf#130237 OOXML chart export: fix incomplete 3D area chart

by exporting its z-axis properties into  element.

Data series of 3D area charts were “transparent” or incomplete
opening with MSO, because we exported z-axis as a category axis.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index ea19e9d2ad0a..5ee135f5920b 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -145,6 +145,7 @@ public:
 void testMultipleCategoryAxisLablesDOCX();
 void testTdf116163();
 void testTdf111824();
+void test3DAreaChartZAxis();
 void testTdf119029();
 void testTdf108022();
 void testTdf121744();
@@ -260,6 +261,7 @@ public:
 CPPUNIT_TEST(testMultipleCategoryAxisLablesDOCX);
 CPPUNIT_TEST(testTdf116163);
 CPPUNIT_TEST(testTdf111824);
+CPPUNIT_TEST(test3DAreaChartZAxis);
 CPPUNIT_TEST(testTdf119029);
 CPPUNIT_TEST(testTdf108022);
 CPPUNIT_TEST(testTdf121744);
@@ -2344,6 +2346,18 @@ void Chart2ExportTest::testTdf111824()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:serAx/c:axId", 
"val", zAxisIdOf3DBarchart);
 }
 
+void Chart2ExportTest::test3DAreaChartZAxis()
+{
+load("/chart2/qa/extras/data/xlsx/", "test3DAreaChartZAxis.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// Collect 3D area chart Z axID
+OUString zAxisIdOf3DAreachart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:area3DChart/c:axId[3]", "val");
+// 3D area chart z-axis properties should be in a serAx OOXML element 
instead of catAx
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:serAx/c:axId", 
"val", zAxisIdOf3DAreachart);
+}
+
 void Chart2ExportTest::testTdf119029()
 {
 load("/chart2/qa/extras/data/odp/", "tdf119029.odp");
diff --git a/chart2/qa/extras/data/xlsx/test3DAreaChartZAxis.xlsx 
b/chart2/qa/extras/data/xlsx/test3DAreaChartZAxis.xlsx
new file mode 100644
index ..01c6fe56f1c7
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/test3DAreaChartZAxis.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 46dc2285f839..8debc8d047c3 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2756,7 +2756,7 @@ void ChartExport::exportAxis(const AxisIdPair& 
rAxisIdPair)
 nAxisType = XML_valAx;
 else if( eChartType == chart::TYPEID_STOCK )
 nAxisType = XML_dateAx;
-else if( eChartType == chart::TYPEID_BAR )
+else if( eChartType == chart::TYPEID_BAR || eChartType == 
chart::TYPEID_AREA )
 nAxisType = XML_serAx;
 // FIXME: axPos, need to check axis direction
 sAxPos = "b";
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-28 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx  |   12 
 chart2/qa/extras/data/xlsx/tdf108107.xlsx  |binary
 oox/source/drawingml/chart/seriesconverter.cxx |3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 296f3f8e4a5337b82fc72845662b5d5749acdf99
Author: Balazs Varga 
AuthorDate: Sun Jan 26 20:59:21 2020 +0100
Commit: László Németh 
CommitDate: Tue Jan 28 10:00:40 2020 +0100

tdf#108107 OOXML chart: fix format of custom data point labels

Do not overwrite the property of moved data point labels
with default values, but use the data series properties for
these labels.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 96278053d59f..ea19e9d2ad0a 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -86,6 +86,7 @@ public:
 void testDataLabelAreaChartDOCX();
 void testDataLabelDefaultLineChartDOCX();
 void testIndividualDataLabelProps();
+void testTdf108107();
 void testChartTitlePropertiesColorFillDOCX();
 void testChartTitlePropertiesGradientFillDOCX();
 void testChartTitlePropertiesBitmapFillDOCX();
@@ -200,6 +201,7 @@ public:
 CPPUNIT_TEST(testDataLabelAreaChartDOCX);
 CPPUNIT_TEST(testDataLabelDefaultLineChartDOCX);
 CPPUNIT_TEST(testIndividualDataLabelProps);
+CPPUNIT_TEST(testTdf108107);
 CPPUNIT_TEST(testChartTitlePropertiesColorFillDOCX);
 CPPUNIT_TEST(testChartTitlePropertiesGradientFillDOCX);
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillDOCX);
@@ -1208,6 +1210,16 @@ void Chart2ExportTest::testIndividualDataLabelProps()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr/a:latin",
 "typeface", "Times New Roman");
 }
 
+void Chart2ExportTest::testTdf108107()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf108107.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", 
"val", "1");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:p/a:pPr/a:defRPr",
 "b", "1");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:p/a:pPr/a:defRPr",
 "sz", "2000");
+}
+
 void Chart2ExportTest::testChartTitlePropertiesColorFillDOCX()
 {
 load("/chart2/qa/extras/data/docx/", 
"testChartTitlePropertiesColorFill.docx");
diff --git a/chart2/qa/extras/data/xlsx/tdf108107.xlsx 
b/chart2/qa/extras/data/xlsx/tdf108107.xlsx
new file mode 100644
index ..3f86326fa28e
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf108107.xlsx differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index dccd19713833..62f78a28e383 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -177,7 +177,8 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, 
ObjectFormatter& rFormatt
 rFormatter.convertNumberFormat( rPropSet, rDataLabel.maNumberFormat, 
false, bShowPercent );
 
 // data label text formatting (frame formatting not supported by 
Chart2)
-convertTextProperty(rPropSet, rFormatter, rDataLabel.mxTextProp);
+if( bDataSeriesLabel || (rDataLabel.mxTextProp.is() && 
!rDataLabel.mxTextProp->getParagraphs().empty()) )
+convertTextProperty(rPropSet, rFormatter, rDataLabel.mxTextProp);
 
 // data label separator (do not overwrite series separator, if no 
explicit point separator is present)
 // Set the data label separator to "new line" if the value is shown as 
percentage with a category name,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-10 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2export.cxx |   40 ++
 chart2/qa/extras/chart2import.cxx |   39 --
 oox/source/export/chartexport.cxx |   82 +-
 3 files changed, 120 insertions(+), 41 deletions(-)

New commits:
commit 86be3422cd55fa9e44104f1628648061bb6a3495
Author: Tünde Tóth 
AuthorDate: Wed Dec 18 16:46:36 2019 +0100
Commit: László Németh 
CommitDate: Fri Jan 10 14:22:57 2020 +0100

tdf#129857 Chart OOXML export: fix deleted legend entries

The legend showed deleted legend entries too after export.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 62aa0764a69a..96278053d59f 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -150,6 +150,7 @@ public:
 void testTdf122031();
 void testTdf115012();
 void testTdf123206_customLabelText();
+void testDeletedLegendEntries();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -263,6 +264,7 @@ public:
 CPPUNIT_TEST(testTdf122031);
 CPPUNIT_TEST(testTdf115012);
 CPPUNIT_TEST(testTdf123206_customLabelText);
+CPPUNIT_TEST(testDeletedLegendEntries);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2403,6 +2405,44 @@ void Chart2ExportTest::testTdf123206_customLabelText()
 assertXPathContent(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r/a:t",
 "kiscica");
 }
 
+void Chart2ExportTest::testDeletedLegendEntries()
+{
+load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry.xlsx");
+{
+reload("Calc Office Open XML");
+Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference 
xDataSeries(getDataSeriesFromDoc(xChartDoc, 1));
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xPropertySet(xDataSeries, 
uno::UNO_QUERY_THROW);
+bool bShowLegendEntry = true;
+CPPUNIT_ASSERT(xPropertySet->getPropertyValue("ShowLegendEntry") >>= 
bShowLegendEntry);
+CPPUNIT_ASSERT(!bShowLegendEntry);
+}
+
+load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry2.xlsx");
+{
+reload("Calc Office Open XML");
+Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference 
xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xPropertySet(xDataSeries, 
uno::UNO_QUERY_THROW);
+bool bShowLegendEntry = true;
+CPPUNIT_ASSERT(xPropertySet->getPropertyValue("ShowLegendEntry") >>= 
bShowLegendEntry);
+CPPUNIT_ASSERT(!bShowLegendEntry);
+
+Reference xChartDoc2 = getChartDocFromSheet(1, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference 
xDataSeries2(getDataSeriesFromDoc(xChartDoc2, 0));
+CPPUNIT_ASSERT(xDataSeries2.is());
+Reference xPropertySet2(xDataSeries2, 
uno::UNO_QUERY_THROW);
+Sequence deletedLegendEntriesSeq;
+CPPUNIT_ASSERT(xPropertySet2->getPropertyValue("DeletedLegendEntries") 
>>= deletedLegendEntriesSeq);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), deletedLegendEntriesSeq[0]);
+}
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 5fcf205df813..9317785520c6 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -148,10 +148,8 @@ public:
 void testXaxisValues();
 void testTdf123504();
 void testTdf122765();
-void testTdf121991();
 void testTdf123206CustomLabelField();
 void testTdf125444PercentageCustomLabel();
-void testDeletedLegendEntries();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -249,10 +247,8 @@ public:
 CPPUNIT_TEST(testXaxisValues);
 CPPUNIT_TEST(testTdf123504);
 CPPUNIT_TEST(testTdf122765);
-CPPUNIT_TEST(testTdf121991);
 CPPUNIT_TEST(testTdf123206CustomLabelField);
 CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
-CPPUNIT_TEST(testDeletedLegendEntries);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2289,19 +2285,6 @@ void Chart2ImportTest::testTdf122765()
 CPPUNIT_ASSERT_GREATER(sal_Int32(7000), aSlicePosition.X);
 }
 
-void Chart2ImportTest::testTdf121991()
-{
-load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry.xlsx");
-Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, 
mxComponent);
-CPPUNIT_ASSERT(xChartDoc.is());
-Reference xDataSeries(getDataSeriesFromDoc(xChartDoc, 
1));
-CPPUNIT_ASSERT(xDataSeries.is());
-Reference xPropertySet(xDataSeries, 
uno::UNO_QUERY_THROW);
-bool 

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

2019-11-12 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx |   27 +++
 chart2/qa/extras/data/xlsx/tdf128732.xlsx |binary
 oox/source/drawingml/color.cxx|2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 124db1f2e3008493254e5d710221dbdd40a526db
Author: Balazs Varga 
AuthorDate: Tue Nov 12 12:21:20 2019 +0100
Commit: László Németh 
CommitDate: Wed Nov 13 08:34:23 2019 +0100

tdf#128732 Chart OOXML import: fix rounding error of color transparency

Change-Id: I52efb541d62a9536c2eb5f99453dc2cb594e6fe4
Reviewed-on: https://gerrit.libreoffice.org/82500
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index f04b42d2db6f..665b9f96e62d 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -33,6 +33,8 @@
 #include 
 
 #include 
+#include 
+#include 
 
 class Chart2ImportTest : public ChartTest
 {
@@ -63,6 +65,7 @@ public:
 void testODPChartSeries();
 void testBnc864396();
 void testBnc882383();
+void testTransparancyGradientValue();
 void testBnc889755();
 void testSimpleStrictXLSX();
 void testDelayedCellImport(); // chart range referencing content on later 
sheets
@@ -167,6 +170,7 @@ public:
 CPPUNIT_TEST(testODPChartSeries);
 CPPUNIT_TEST(testBnc864396);
 CPPUNIT_TEST(testBnc882383);
+CPPUNIT_TEST(testTransparancyGradientValue);
 CPPUNIT_TEST(testBnc889755);
 CPPUNIT_TEST(testSimpleStrictXLSX);
 CPPUNIT_TEST(testDelayedCellImport);
@@ -814,6 +818,29 @@ void Chart2ImportTest::testBnc882383()
 CPPUNIT_ASSERT(!sGradientName.isEmpty());
 }
 
+void Chart2ImportTest::testTransparancyGradientValue()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf128732.xlsx");
+uno::Reference< chart2::XChartDocument > xChartDoc = 
getChartDocFromSheet(0, mxComponent);
+CPPUNIT_ASSERT(xChartDoc.is());
+uno::Reference 
xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+CPPUNIT_ASSERT(xDataSeries.is());
+
+uno::Reference 
xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
+OUString sTranspGradientName;
+xPropertySet->getPropertyValue("FillTransparenceGradientName") >>= 
sTranspGradientName;
+CPPUNIT_ASSERT(!sTranspGradientName.isEmpty());
+
+awt::Gradient aTransparenceGradient;
+uno::Reference< lang::XMultiServiceFactory > xFact(xChartDoc, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xFact.is());
+uno::Reference< container::XNameAccess > 
xTransparenceGradient(xFact->createInstance("com.sun.star.drawing.TransparencyGradientTable"),
 uno::UNO_QUERY);
+uno::Any rTransparenceValue = 
xTransparenceGradient->getByName(sTranspGradientName);
+CPPUNIT_ASSERT(rTransparenceValue >>= aTransparenceGradient);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3355443), aTransparenceGradient.EndColor);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(5000268), aTransparenceGradient.StartColor);
+}
+
 void Chart2ImportTest::testSimpleStrictXLSX()
 {
 load("/chart2/qa/extras/data/xlsx/", "strict_chart.xlsx");
diff --git a/chart2/qa/extras/data/xlsx/tdf128732.xlsx 
b/chart2/qa/extras/data/xlsx/tdf128732.xlsx
new file mode 100644
index ..b92afb1ed6c5
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf128732.xlsx differ
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 325b68227fe9..09b033352877 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -623,7 +623,7 @@ bool Color::hasTransparency() const
 
 sal_Int16 Color::getTransparency() const
 {
-return static_cast< sal_Int16 >( (MAX_PERCENT - mnAlpha) / PER_PERCENT );
+return sal_Int16(std::round( (1.0 * (MAX_PERCENT - mnAlpha)) / 
PER_PERCENT) );
 }
 
 // private 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-12 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |   14 ++
 chart2/qa/extras/data/xlsx/tdf128619.xlsx |binary
 oox/source/export/drawingml.cxx   |2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit d7149889a9e1cae7f255691c2a35090ac3245bfa
Author: Balazs Varga 
AuthorDate: Mon Nov 11 15:03:05 2019 +0100
Commit: László Németh 
CommitDate: Wed Nov 13 08:28:11 2019 +0100

tdf#128619 Chart OOXML export: fix gradient position

Export the gradient border value as gradient stop
position of the first color at LINEAR GradientStyle.

Change-Id: I1a2b986a004fecbf68050c6bf95be549684fea70
Reviewed-on: https://gerrit.libreoffice.org/82446
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 4d14a1e96638..694e814250bd 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -91,6 +91,7 @@ public:
 void testChartTitlePropertiesBitmapFillDOCX();
 void testColorGradientWithTransparancyDOCX();
 void testColorGradientWithTransparancyODS();
+void testColorGradientStopXLSX();
 void testBarChartDataPointPropDOCX();
 void testFdo83058dlblPos();
 void testAutoTitleDelXLSX();
@@ -201,6 +202,7 @@ public:
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillDOCX);
 CPPUNIT_TEST(testColorGradientWithTransparancyDOCX);
 CPPUNIT_TEST(testColorGradientWithTransparancyODS);
+CPPUNIT_TEST(testColorGradientStopXLSX);
 CPPUNIT_TEST(testBarChartDataPointPropDOCX);
 CPPUNIT_TEST(testFdo83058dlblPos);
 CPPUNIT_TEST(testAutoTitleDelXLSX);
@@ -1251,6 +1253,18 @@ void 
Chart2ExportTest::testColorGradientWithTransparancyODS()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr/a:alpha",
 "val", "6");
 }
 
+void Chart2ExportTest::testColorGradientStopXLSX()
+{
+// Test color gradient (two color) stop of the first color
+load("/chart2/qa/extras/data/xlsx/", "tdf128619.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+// Test the position of the first color
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:spPr/a:gradFill/a:gsLst/a:gs[1]",
 "pos", "45000");
+// Test the position of the second color
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:spPr/a:gradFill/a:gsLst/a:gs[2]",
 "pos", "10");
+}
+
 void Chart2ExportTest::testBarChartDataPointPropDOCX()
 {
 load("/chart2/qa/extras/data/docx/", "testBarChartDataPointPropDOCX.docx");
diff --git a/chart2/qa/extras/data/xlsx/tdf128619.xlsx 
b/chart2/qa/extras/data/xlsx/tdf128619.xlsx
new file mode 100644
index ..e6eb142593fe
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf128619.xlsx differ
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a5c152dcf6d1..2cc160d05b57 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -605,7 +605,7 @@ void DrawingML::WriteGradientFill(awt::Gradient rGradient, 
awt::Gradient rTransp
 nStartAlpha = 
GetAlphaFromTransparenceGradient(rTransparenceGradient, true);
 nEndAlpha = 
GetAlphaFromTransparenceGradient(rTransparenceGradient, false);
 }
-WriteGradientStop(0, ColorWithIntensity(rGradient.StartColor, 
rGradient.StartIntensity),
+WriteGradientStop(rGradient.Border, 
ColorWithIntensity(rGradient.StartColor, rGradient.StartIntensity),
   nStartAlpha);
 WriteGradientStop(100, ColorWithIntensity(rGradient.EndColor, 
rGradient.EndIntensity),
   nEndAlpha);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-12 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx|   34 +++
 chart2/qa/extras/data/xlsx/tdf128627.xlsx|binary
 chart2/qa/extras/data/xlsx/tdf128634.xlsx|binary
 oox/source/drawingml/chart/axisconverter.cxx |9 ++-
 4 files changed, 42 insertions(+), 1 deletion(-)

New commits:
commit b5c14ba1987ba102ac98530e2e718100655e1042
Author: Balazs Varga 
AuthorDate: Thu Nov 7 13:49:09 2019 +0100
Commit: László Németh 
CommitDate: Tue Nov 12 21:46:29 2019 +0100

tdf#128627 tdf#128634 Fix OOXML import of CrossBetween

Set default 'midCat' value during the import, for Radar charts,
because MSO created them with default 'midCat', but exported a
'between' value.

Set default 'between' value during the import, for 3D Bar and
Stock charts, because sometimes the OOXML file can contain a
wrong CrossBetween value, but MSO import them with default
values.

tdf#128627 regression from commit: 830e539547c463b932ce643517f880789185032d
(tdf#127393 OOXML chart import: fix X axis position setting "CrossBetween")
tdf#128634 regression from commit: 111c260ab2883b7906f1a66e222dbf4dc3c58c4f
(tdf#12 OOXML chart export: fix "CrossBetween" for not imported charts)

Change-Id: Ie9763197b79c3a661e66043da7b89b4f0f00ba33
Reviewed-on: https://gerrit.libreoffice.org/82211
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 134dec112caa..f04b42d2db6f 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -133,6 +133,8 @@ public:
 void testTdf124243();
 void testTdf127393();
 void testTdf128432();
+void testTdf128627();
+void testTdf128634();
 void testDeletedDataLabel();
 void testDataPointInheritedColorDOCX();
 void testExternalStrRefsXLSX();
@@ -226,6 +228,8 @@ public:
 CPPUNIT_TEST(testTdf124243);
 CPPUNIT_TEST(testTdf127393);
 CPPUNIT_TEST(testTdf128432);
+CPPUNIT_TEST(testTdf128627);
+CPPUNIT_TEST(testTdf128634);
 CPPUNIT_TEST(testDeletedDataLabel);
 CPPUNIT_TEST(testDataPointInheritedColorDOCX);
 CPPUNIT_TEST(testExternalStrRefsXLSX);
@@ -2012,6 +2016,36 @@ void Chart2ImportTest::testTdf128432()
 CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition);
 }
 
+void Chart2ImportTest::testTdf128627()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf128627.xlsx");
+// Test ShiftedCategoryPosition for Radar Chart
+uno::Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
+CPPUNIT_ASSERT(xAxis.is());
+
+chart2::ScaleData aScaleData = xAxis->getScaleData();
+CPPUNIT_ASSERT(aScaleData.Categories.is());
+CPPUNIT_ASSERT(!aScaleData.ShiftedCategoryPosition);
+}
+
+void Chart2ImportTest::testTdf128634()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf128634.xlsx");
+// Test ShiftedCategoryPosition for 3D Charts
+uno::Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
+CPPUNIT_ASSERT(xAxis.is());
+
+chart2::ScaleData aScaleData = xAxis->getScaleData();
+CPPUNIT_ASSERT(aScaleData.Categories.is());
+CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition);
+}
+
 namespace {
 
 void checkDataLabelProperties(const Reference& 
xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible)
diff --git a/chart2/qa/extras/data/xlsx/tdf128627.xlsx 
b/chart2/qa/extras/data/xlsx/tdf128627.xlsx
new file mode 100644
index ..419c1ad2f9be
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf128627.xlsx differ
diff --git a/chart2/qa/extras/data/xlsx/tdf128634.xlsx 
b/chart2/qa/extras/data/xlsx/tdf128634.xlsx
new file mode 100644
index ..91baa780cea2
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf128634.xlsx differ
diff --git a/oox/source/drawingml/chart/axisconverter.cxx 
b/oox/source/drawingml/chart/axisconverter.cxx
index 9f2cc0f715dc..5f64586ffbb0 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -213,7 +213,14 @@ void AxisConverter::convertFromModel(
 aScaleData.AxisType = (bDateAxis && !mrModel.mbAuto) ? 
cssc2::AxisType::DATE : cssc2::AxisType::CATEGORY;
 aScaleData.AutoDateAxis = mrModel.mbAuto;
 aScaleData.Categories = 
rTypeGroups.front()->createCategorySequence();
-aScaleData.ShiftedCategoryPosition = 
pCrossingAxis->mnCrossBetween == XML_between;
+/* set default ShiftedCategoryPosition values for some 
charttype,
+   because the XML can contain wrong CrossBetween value, 
if came from MSO */
+ 

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

2019-11-08 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx|   10 
 chart2/qa/extras/data/xlsx/testAutoTitleDeleted.xlsx |binary
 oox/source/export/chartexport.cxx|   47 ++-
 3 files changed, 35 insertions(+), 22 deletions(-)

New commits:
commit f6437b3a98256cd2782164fedefbc109bf5ab114
Author: Balazs Varga 
AuthorDate: Wed Nov 6 15:50:32 2019 +0100
Commit: László Németh 
CommitDate: Fri Nov 8 13:19:47 2019 +0100

tdf#128618 OOXML chart export: deleted automatic title returns on save

If there is no main title and/or subtitle, write out autoTitleDeleted
with a true value.

Regression from the commit 96a29c12a9d8734c9d2a812f38fc6654b5df9c48
(tdf#101322 Chart OOXML Export: fix missing subtitle)

Change-Id: I0094014fc4da4cb66d31e4249f916452d00758c7
Reviewed-on: https://gerrit.libreoffice.org/82142
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index dd07808b1d05..4d14a1e96638 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -108,6 +108,7 @@ public:
 void testLegendManualLayoutXLSX();
 void testChartSubTitle();
 void testChartMainWithSubTitle();
+void testAutoTitleDeleted();
 void testChartTitlePropertiesColorFillXLSX();
 void testChartTitlePropertiesGradientFillXLSX();
 void testChartTitlePropertiesBitmapFillXLSX();
@@ -217,6 +218,7 @@ public:
 CPPUNIT_TEST(testLegendManualLayoutXLSX);
 CPPUNIT_TEST(testChartSubTitle);
 CPPUNIT_TEST(testChartMainWithSubTitle);
+CPPUNIT_TEST(testAutoTitleDeleted);
 CPPUNIT_TEST(testChartTitlePropertiesColorFillXLSX);
 CPPUNIT_TEST(testChartTitlePropertiesGradientFillXLSX);
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillXLSX);
@@ -1732,6 +1734,14 @@ void Chart2ExportTest::testChartMainWithSubTitle()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "81d41a");
 }
 
+void Chart2ExportTest::testAutoTitleDeleted()
+{
+load("/chart2/qa/extras/data/xlsx/", "testAutoTitleDeleted.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:autoTitleDeleted", "val", 
"1");
+}
+
 void Chart2ExportTest::testChartTitlePropertiesColorFillXLSX()
 {
 load("/chart2/qa/extras/data/xlsx/", 
"testChartTitlePropertiesColorFill.xlsx");
diff --git a/chart2/qa/extras/data/xlsx/testAutoTitleDeleted.xlsx 
b/chart2/qa/extras/data/xlsx/testAutoTitleDeleted.xlsx
new file mode 100644
index ..409389e23beb
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/testAutoTitleDeleted.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 040014912b32..aeb2c8012674 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -917,7 +917,7 @@ void ChartExport::exportChart( const Reference< 
css::chart::XChartDocument >& xC
 
 // get Properties of ChartDocument
 bool bHasMainTitle = false;
-bool bHasSubTitle = false;
+OUString aSubTitle;
 bool bHasLegend = false;
 Reference< beans::XPropertySet > xDocPropSet( xChartDoc, uno::UNO_QUERY );
 if( xDocPropSet.is())
@@ -926,8 +926,6 @@ void ChartExport::exportChart( const Reference< 
css::chart::XChartDocument >& xC
 {
 Any aAny( xDocPropSet->getPropertyValue("HasMainTitle"));
 aAny >>= bHasMainTitle;
-aAny = xDocPropSet->getPropertyValue("HasSubTitle");
-aAny >>= bHasSubTitle;
 aAny = xDocPropSet->getPropertyValue("HasLegend");
 aAny >>= bHasLegend;
 }
@@ -937,33 +935,38 @@ void ChartExport::exportChart( const Reference< 
css::chart::XChartDocument >& xC
 }
 } // if( xDocPropSet.is())
 
-// chart element
+Reference< beans::XPropertySet > xPropSubTitle( xChartDoc->getSubTitle(), 
UNO_QUERY );
+if( xPropSubTitle.is())
+{
+try
+{
+xPropSubTitle->getPropertyValue("String") >>= aSubTitle;
+}
+catch( beans::UnknownPropertyException & )
+{
+}
+}
 
+// chart element
 FSHelperPtr pFS = GetFS();
 pFS->startElement(FSNS(XML_c, XML_chart));
 
 // titles
-if( bHasMainTitle || bHasSubTitle )
+if( bHasMainTitle )
 {
-OUString aSubText;
-Reference< drawing::XShape > xShape;
-if( bHasSubTitle )
-{
-xShape = xChartDoc->getSubTitle();
-if( bHasMainTitle )
-{
-// if we have a title and a subtitle too, we need only the 
subtitle text
-Reference< beans::XPropertySet > xPropSet(xShape, 
uno::UNO_QUERY);
-if( xPropSet.is() )
-xPropSet->getPropertyValue("String") >>= aSubText;
-}
-}
- 

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

2019-11-08 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |   11 +++
 chart2/qa/extras/data/xlsx/tdf128633.xlsx |binary
 oox/source/export/chartexport.cxx |2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 271bdc3469b694c113e4449750866dee032e2d34
Author: Balazs Varga 
AuthorDate: Thu Nov 7 10:31:49 2019 +0100
Commit: László Németh 
CommitDate: Fri Nov 8 12:33:31 2019 +0100

tdf#128633 Chart OOXML Export: Fix position of bar in charts

Fix export of c:crossBetween tag if the category axis is deleted.

Regression from commit: e0b0502516a10181bbd1737b93b38b2bba4c98e8
(tdf#128016 Chart OOXML Import: fix duplicated category labels)

Change-Id: I46ab45f3ba4f3d0fdde3ddf017a7f512b6e2e403
Reviewed-on: https://gerrit.libreoffice.org/82194
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 5f2b9ee6825b..dd07808b1d05 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -123,6 +123,7 @@ public:
 void testCombinedChartSecondaryAxisXLSX();
 void testCombinedChartSecondaryAxisODS();
 void testCrossBetweenXLSX();
+void testCrossBetweenWithDeletedAxis();
 void testCrossBetweenODS();
 void testAxisTitleRotationXLSX();
 void testAxisTitlePositionDOCX();
@@ -231,6 +232,7 @@ public:
 CPPUNIT_TEST(testCombinedChartSecondaryAxisXLSX);
 CPPUNIT_TEST(testCombinedChartSecondaryAxisODS);
 CPPUNIT_TEST(testCrossBetweenXLSX);
+CPPUNIT_TEST(testCrossBetweenWithDeletedAxis);
 CPPUNIT_TEST(testCrossBetweenODS);
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
 CPPUNIT_TEST(testAxisTitlePositionDOCX);
@@ -1944,6 +1946,15 @@ void Chart2ExportTest::testCrossBetweenXLSX()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between");
 }
 
+void Chart2ExportTest::testCrossBetweenWithDeletedAxis()
+{
+// Original file was created with MS Office (the category axis is deleted 
in the file)
+load("/chart2/qa/extras/data/xlsx/", "tdf128633.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between");
+}
+
 void Chart2ExportTest::testCrossBetweenODS()
 {
 // Original file was created with LibreOffice
diff --git a/chart2/qa/extras/data/xlsx/tdf128633.xlsx 
b/chart2/qa/extras/data/xlsx/tdf128633.xlsx
new file mode 100644
index ..fa186895d65e
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf128633.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index c4bf38eff9ef..040014912b32 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -251,7 +251,7 @@ static bool lcl_isCategoryAxisShifted(const Reference< 
chart2::XChartDocument >&
 if( xAxis.is())
 {
 chart2::ScaleData aScaleData = xAxis->getScaleData();
-if( aScaleData.Categories.is() )
+if( aScaleData.AxisType == AXIS_PRIMARY_Y )
 {
 isCategoryPositionShifted = 
aScaleData.ShiftedCategoryPosition;
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-22 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx|   25 +
 chart2/qa/extras/chart2import.cxx|3 --
 oox/source/drawingml/chart/converterbase.cxx |   32 ---
 oox/source/export/chartexport.cxx|   11 -
 4 files changed, 60 insertions(+), 11 deletions(-)

New commits:
commit 9ff954d5f780cae5df6942e97b713cfc19449145
Author: Balazs Varga 
AuthorDate: Thu Oct 17 12:37:04 2019 +0200
Commit: László Németh 
CommitDate: Tue Oct 22 14:33:46 2019 +0200

tdf#127908 tdf#128193 Chart OOXML: Fix Custom Y axis title position

Import part: set the anchor position to the TOP_LEFT corner of the rectangle
during the import, if the textbox is rotated with 90 or 270 degree. Because
the OOXML files always contains the TOP_LEFT coordinates of a textbox, even 
if
they are rotated.

Note: Unfortunatelly we do not know the shape size, so this fix
cannot handle rotations different than 0, 90 or 270 degrees.

Export part: export the top left corner coordinates of axis title shape
as the OOXML Standerd requires.

Change-Id: Id0875d65884f6bfef8726135a7c03418d2ce3f23
Reviewed-on: https://gerrit.libreoffice.org/80939
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 8a0705f7d140..694ba5501043 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -123,6 +123,7 @@ public:
 void testCrossBetweenXLSX();
 void testCrossBetweenODS();
 void testAxisTitleRotationXLSX();
+void testAxisTitlePositionDOCX();
 void testAxisCrossBetweenXSLX();
 void testPieChartDataPointExplosionXLSX();
 void testCustomDataLabel();
@@ -228,6 +229,7 @@ public:
 CPPUNIT_TEST(testCrossBetweenXLSX);
 CPPUNIT_TEST(testCrossBetweenODS);
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
+CPPUNIT_TEST(testAxisTitlePositionDOCX);
 CPPUNIT_TEST(testAxisCrossBetweenXSLX);
 CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
 CPPUNIT_TEST(testCustomDataLabel);
@@ -1932,6 +1934,29 @@ void Chart2ExportTest::testAxisTitleRotationXLSX()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:valAx/c:title/c:tx/c:rich/a:bodyPr", "rot", 
"0");
 }
 
+void Chart2ExportTest::testAxisTitlePositionDOCX()
+{
+load("/chart2/qa/extras/data/docx/", "testAxisTitlePosition.docx");
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// test X Axis title position
+OUString aXVal = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:catAx/c:title/c:layout/c:manualLayout/c:x", 
"val");
+double nX = aXVal.toDouble();
+CPPUNIT_ASSERT(nX > 0.698208 && nX < 0.698209);
+OUString aYVal = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:catAx/c:title/c:layout/c:manualLayout/c:y", 
"val");
+double nY = aYVal.toDouble();
+CPPUNIT_ASSERT(nY > 0.805152 && nY < 0.805153);
+
+// test Y Axis title position
+aXVal = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:valAx/c:title/c:layout/c:manualLayout/c:x", 
"val");
+nX = aXVal.toDouble();
+CPPUNIT_ASSERT(nX > 0.025395 && nX < 0.025396);
+aYVal = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:valAx/c:title/c:layout/c:manualLayout/c:y", 
"val");
+nY = aYVal.toDouble();
+CPPUNIT_ASSERT(nY > 0.384407 && nY < 0.384408);
+}
+
 void Chart2ExportTest::testAxisCrossBetweenXSLX()
 {
 load("/chart2/qa/extras/data/odt/", "axis-position.odt");
diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index d0fcb34faafd..ab1233b13110 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -1539,8 +1539,7 @@ void Chart2ImportTest::testAxisTitlePositionDOCX()
 
 aPos = xAxisTitle->getPosition();
 CPPUNIT_ASSERT_EQUAL(sal_Int32(387), static_cast(aPos.X));
-// y coordinate is still wrong because of another older bug!
-/*CPPUNIT_ASSERT_EQUAL(sal_Int32(1535), static_cast(aPos.Y));*/
+CPPUNIT_ASSERT_EQUAL(sal_Int32(6378), static_cast(aPos.Y));
 }
 
 void Chart2ImportTest::testCombinedChartAttachedAxisXLSX()
diff --git a/oox/source/drawingml/chart/converterbase.cxx 
b/oox/source/drawingml/chart/converterbase.cxx
index 8acf77c619df..0b6b876a11a0 100644
--- a/oox/source/drawingml/chart/converterbase.cxx
+++ b/oox/source/drawingml/chart/converterbase.cxx
@@ -405,18 +405,34 @@ void LayoutConverter::convertFromModel( const Reference< 
XShape >& rxShape, doub
 lclCalcPosition( aChartSize.Height, mrModel.mfY, mrModel.mnYMode ) 
);
 if( (aShapePos.X >= 0) && (aShapePos.Y >= 0) )
 {
+bool bPropSet = false;
 // the call to XShape.getSize() may recalc the chart view
 awt::Size aShapeSize = rxShape->getSize();
 // rotated shapes need special 

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

2019-08-30 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |4 +++-
 oox/source/export/chartexport.cxx |6 --
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 5b97e75589523b3769ec87e27854e2c841d0d79f
Author: Balazs Varga 
AuthorDate: Thu Aug 29 11:08:04 2019 +0200
Commit: László Németh 
CommitDate: Fri Aug 30 16:32:47 2019 +0200

tdf#103988 OOXML export: fix bubble chart MSO interoperability

Write  into each  OOXML element
to allow file opening in MSO without removing the (previously
"corrupted") bubble chart.

Change-Id: Idf31a0d3d8f98a3be4c9a3b29e65d4d4c582be53
Reviewed-on: https://gerrit.libreoffice.org/78259
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 40ce4cc9e808..e1c7a4403afe 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -1570,7 +1570,9 @@ void Chart2ExportTest::testBubble3DXLSX()
 load("/chart2/qa/extras/data/xlsx/", "bubble_chart_simple.xlsx");
 xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
 CPPUNIT_ASSERT(pXmlDoc);
-assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:bubbleChart/c:bubble3D", "val", "0");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:bubbleChart/c:ser[1]/c:bubble3D", "val", 
"0");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:bubbleChart/c:ser[2]/c:bubble3D", "val", 
"0");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:bubbleChart/c:ser[3]/c:bubble3D", "val", 
"0");
 }
 
 void Chart2ExportTest::testNoMarkerXLSX()
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index bbf647926b33..a813acfd83b8 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1659,8 +1659,6 @@ void ChartExport::exportBubbleChart( const Reference< 
chart2::XChartType >& xCha
 bool bPrimaryAxes = true;
 exportAllSeries(xChartType, bPrimaryAxes);
 
-pFS->singleElement(FSNS(XML_c, XML_bubble3D), XML_val, "0");
-
 exportAxesId(bPrimaryAxes);
 
 pFS->endElement( FSNS( XML_c, XML_bubbleChart ) );
@@ -2191,6 +2189,10 @@ void ChartExport::exportSeries( const 
Reference& xChartType,
 || eChartType == chart::TYPEID_LINE )
 exportSmooth();
 
+// tdf103988: "corrupted" files with Bubble chart opening 
in MSO
+if( eChartType == chart::TYPEID_BUBBLE )
+pFS->singleElement(FSNS(XML_c, XML_bubble3D), XML_val, 
"0");
+
 pFS->endElement( FSNS( XML_c, XML_ser ) );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-30 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   16 
 chart2/qa/extras/data/odt/tdf114657.odt |binary
 oox/source/export/chartexport.cxx   |   24 ++--
 3 files changed, 22 insertions(+), 18 deletions(-)

New commits:
commit 2bd8e41a0fc10974f81695c1b2e32dc07c569d97
Author: Balazs Varga 
AuthorDate: Wed Aug 28 11:27:52 2019 +0200
Commit: László Németh 
CommitDate: Fri Aug 30 15:23:39 2019 +0200

tdf#114657 OOXML chart export: fix broken chart with NaN X value

Export c:pt elements only for numbers instead of replace the correct
X values with the sequence 1, 2, 3..., when the X values contain a NaN
value.

This reverts commit a211c754003f98bc8f7761224a0b265bd224f61f
"fdo77216-Charts-Scattered chart: Chart gets distorted on RT"

Change-Id: I6d0bec870b5317575d93eff407b3ec2ada56431e
Reviewed-on: https://gerrit.libreoffice.org/78221
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 78a763ee7bb6..40ce4cc9e808 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -48,6 +48,7 @@ public:
 void testBarChart();
 void testCrosses();
 void testScatterChartTextXValues();
+void testScatterXAxisValues();
 void testChartDataTable();
 void testChartExternalData();
 void testEmbeddingsGrabBag();
@@ -150,6 +151,7 @@ public:
 CPPUNIT_TEST(testBarChart);
 CPPUNIT_TEST(testCrosses);
 CPPUNIT_TEST(testScatterChartTextXValues);
+CPPUNIT_TEST(testScatterXAxisValues);
 CPPUNIT_TEST(testChartDataTable);
 CPPUNIT_TEST(testChartExternalData);
 CPPUNIT_TEST(testEmbeddingsGrabBag);
@@ -654,6 +656,20 @@ void Chart2ExportTest::testScatterChartTextXValues()
 assertXPathContent(pXmlDoc, 
"//c:scatterChart/c:ser[1]/c:xVal[1]/c:numRef[1]/c:numCache[1]/c:pt[1]/c:v[1]", 
"1");
 }
 
+void Chart2ExportTest::testScatterXAxisValues()
+{
+load("/chart2/qa/extras/data/odt/", "tdf114657.odt");
+
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, 
"//c:scatterChart/c:ser/c:xVal/c:numRef/c:numCache/c:ptCount", "val", "5");
+assertXPathContent(pXmlDoc, 
"//c:scatterChart/c:ser/c:xVal/c:numRef/c:numCache/c:pt[1]/c:v", "15");
+assertXPathContent(pXmlDoc, 
"//c:scatterChart/c:ser/c:xVal/c:numRef/c:numCache/c:pt[2]/c:v", "11");
+assertXPathContent(pXmlDoc, 
"//c:scatterChart/c:ser/c:xVal/c:numRef/c:numCache/c:pt[3]/c:v", "20");
+assertXPathContent(pXmlDoc, 
"//c:scatterChart/c:ser/c:xVal/c:numRef/c:numCache/c:pt[4]/c:v", "16");
+}
+
 void Chart2ExportTest::testChartDataTable()
 {
 load("/chart2/qa/extras/data/docx/", "testChartDataTable.docx");
diff --git a/chart2/qa/extras/data/odt/tdf114657.odt 
b/chart2/qa/extras/data/odt/tdf114657.odt
new file mode 100644
index ..4c99963b0d4f
Binary files /dev/null and b/chart2/qa/extras/data/odt/tdf114657.odt differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b7fdec22de69..bbf647926b33 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2376,28 +2376,16 @@ void ChartExport::exportSeriesValues( const Reference< 
chart2::data::XDataSequen
 pFS->endElement( FSNS( XML_c, XML_formatCode ) );
 pFS->singleElement(FSNS(XML_c, XML_ptCount), XML_val, 
OString::number(ptCount));
 
-bool bIsNumberValue = true;
-bool bXSeriesValue = false;
-double Value = 1.0;
-
-if(nValueType == XML_xVal)
-bXSeriesValue = true;
-
 for( sal_Int32 i = 0; i < ptCount; i++ )
 {
-pFS->startElement(FSNS(XML_c, XML_pt), XML_idx, OString::number(i));
-pFS->startElement(FSNS(XML_c, XML_v));
-if (bIsNumberValue && !rtl::math::isNan(aValues[i]))
-pFS->write( aValues[i] );
-else if(bXSeriesValue)
+if (!rtl::math::isNan(aValues[i]))
 {
-//In Case aValues is not a number for X Values...We write X values 
as 1,2,3MS Word does the same thing.
-pFS->write( Value );
-Value = Value + 1;
-bIsNumberValue = false;
+pFS->startElement(FSNS(XML_c, XML_pt), XML_idx, 
OString::number(i));
+pFS->startElement(FSNS(XML_c, XML_v));
+pFS->write(aValues[i]);
+pFS->endElement(FSNS(XML_c, XML_v));
+pFS->endElement(FSNS(XML_c, XML_pt));
 }
-pFS->endElement( FSNS( XML_c, XML_v ) );
-pFS->endElement( FSNS( XML_c, XML_pt ) );
 }
 
 pFS->endElement( FSNS( XML_c, XML_numCache ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-07 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx |   28 ++
 chart2/qa/extras/data/docx/tdf125337.docx |binary
 oox/source/drawingml/chart/chartconverter.cxx |2 -
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 80386c73e172975572f265018333c6231a6b3b22
Author: Balazs Varga 
AuthorDate: Tue Aug 6 15:22:30 2019 +0200
Commit: László Németh 
CommitDate: Wed Aug 7 14:23:50 2019 +0200

tdf#125337 Chart DOCX Import: fix missing empty data series columns

Create an empty column for a data series with NAN values, ie. where
only "ptCount" was defined without explicit data. Also data series
appear in the right order.

Change-Id: I4eac94c2b9f34c84c4c19e4717cafbd440b20087
Reviewed-on: https://gerrit.libreoffice.org/77026
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 710d15ebd60e..90a1bd8485cf 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -46,6 +46,7 @@ public:
 void testODTChartSeries();
 void testDOCChartSeries();
 void testDOCXChartSeries();
+void testDOCXChartEmptySeries();
 void testDOCXChartValuesSize();
 void testPPTXChartSeries();
 void testPPTXSparseChartSeries();
@@ -146,6 +147,7 @@ public:
 CPPUNIT_TEST(testODTChartSeries);
 CPPUNIT_TEST(testDOCChartSeries);
 CPPUNIT_TEST(testDOCXChartSeries);
+CPPUNIT_TEST(testDOCXChartEmptySeries);
 CPPUNIT_TEST(testDOCXChartValuesSize);
 CPPUNIT_TEST(testPPTChartSeries);
 CPPUNIT_TEST(testPPTXChartSeries);
@@ -469,6 +471,32 @@ void Chart2ImportTest::testDOCXChartSeries()
 CPPUNIT_ASSERT_EQUAL(OUString("Series 3"), aLabels[2][0].get());
 }
 
+void Chart2ImportTest::testDOCXChartEmptySeries()
+{
+load("/chart2/qa/extras/data/docx/", "tdf125337.docx");
+Reference xChartDoc(getChartDocFromWriter(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+Reference xCT = getChartTypeFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xCT.is());
+
+std::vector > aLabels = 
getDataSeriesLabelsFromChartType(xCT);
+CPPUNIT_ASSERT_EQUAL(size_t(3), aLabels.size());
+CPPUNIT_ASSERT_EQUAL(OUString("1. dataseries"), 
aLabels[0][0].get());
+CPPUNIT_ASSERT_EQUAL(OUString("2. dataseries"), 
aLabels[1][0].get());
+CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), aLabels[2][0].get());
+
+//test chart series sparse data for docx
+std::vector > aValues = 
getDataSeriesYValuesFromChartType(xCT);
+CPPUNIT_ASSERT_EQUAL(size_t(3), aValues.size());
+//test the second series values
+CPPUNIT_ASSERT_EQUAL(2.4, aValues[1][0]);
+CPPUNIT_ASSERT_EQUAL(4.4, aValues[1][1]);
+//test the third series (empty) values
+CPPUNIT_ASSERT(rtl::math::isNan(aValues[2][0]));
+CPPUNIT_ASSERT(rtl::math::isNan(aValues[2][1]));
+}
+
 void Chart2ImportTest::testDOCXChartValuesSize()
 {
 load( "/chart2/qa/extras/data/docx/", "bubblechart.docx" );
diff --git a/chart2/qa/extras/data/docx/tdf125337.docx 
b/chart2/qa/extras/data/docx/tdf125337.docx
new file mode 100644
index ..811f12d89841
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf125337.docx differ
diff --git a/oox/source/drawingml/chart/chartconverter.cxx 
b/oox/source/drawingml/chart/chartconverter.cxx
index 538f9956abc7..739092d72b02 100644
--- a/oox/source/drawingml/chart/chartconverter.cxx
+++ b/oox/source/drawingml/chart/chartconverter.cxx
@@ -124,7 +124,7 @@ Reference< XDataSequence > 
ChartConverter::createDataSequence(
 if( rxDataProvider.is() )
 {
 OUString aRangeRep;
-if( !rDataSeq.maData.empty() ) try
+if( !rDataSeq.maData.empty() || (rRole == "values-y" && 
rDataSeq.mnPointCount > 0) ) try
 {
 // create a single-row array from constant source data
 // (multiple levels in the case of complex categories)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-21 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx |   32 ++
 chart2/qa/extras/data/xlsx/tdf124817.xlsx |binary
 oox/source/drawingml/chart/typegroupconverter.cxx |   10 ++
 3 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit e98f19e598951a54561a7f414a209260b5e79a39
Author: Balazs Varga 
AuthorDate: Tue Jun 18 15:53:11 2019 +0200
Commit: László Németh 
CommitDate: Fri Jun 21 15:06:40 2019 +0200

tdf#124817 OOXML chart import: fix missing symbols

OOXML chart symbols with undefined fill color attribute were imported
as invisible white symbols. Fixed by using line color of these symbols.

Change-Id: Ie4314ed56b63daa82fe30b111aeae9e358ff2b4b
Reviewed-on: https://gerrit.libreoffice.org/74286
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index a55107b36318..803e99e773da 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -23,6 +23,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -71,6 +73,7 @@ public:
 void testTdf106217();
 void testTdf108021();
 void testTdf100084();
+void testTdf124817();
 void testAutoBackgroundXLSX();
 void testAutoChartAreaBorderPropXLSX();
 void testChartAreaStyleBackgroundXLSX();
@@ -163,6 +166,7 @@ public:
 CPPUNIT_TEST(testTdf106217);
 CPPUNIT_TEST(testTdf108021);
 CPPUNIT_TEST(testTdf100084);
+CPPUNIT_TEST(testTdf124817);
 CPPUNIT_TEST(testAutoBackgroundXLSX);
 CPPUNIT_TEST(testAutoChartAreaBorderPropXLSX);
 CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX);
@@ -901,6 +905,34 @@ void Chart2ImportTest::testTdf100084()
 CPPUNIT_ASSERT_MESSAGE("There should be a Diagram.", xDiagram.is());
 }
 
+void Chart2ImportTest::testTdf124817()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf124817.xlsx");
+Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+uno::Reference xDataSeries;
+chart2::Symbol aSymblProp;
+
+// Check the symbol of data series 1 (marker style none)
+xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+uno::Reference xPropSet_0(xDataSeries, 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT((xPropSet_0->getPropertyValue("Symbol") >>= aSymblProp) && 
(aSymblProp.Style == chart2::SymbolStyle_NONE));
+
+// Check the symbol of data series 2 (marker style square)
+xDataSeries = getDataSeriesFromDoc(xChartDoc, 1);
+CPPUNIT_ASSERT(xDataSeries.is());
+uno::Reference xPropSet_1(xDataSeries, 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT((xPropSet_1->getPropertyValue("Symbol") >>= aSymblProp) && 
(aSymblProp.FillColor == static_cast(0xED7D31)));
+
+// Check the symbol of data series 3 (marker style diagonal cross)
+xDataSeries = getDataSeriesFromDoc(xChartDoc, 2);
+CPPUNIT_ASSERT(xDataSeries.is());
+uno::Reference xPropSet_2(xDataSeries, 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT((xPropSet_2->getPropertyValue("Symbol") >>= aSymblProp) && 
(aSymblProp.BorderColor == static_cast(0xFF)));
+}
+
 void Chart2ImportTest::testTransparentBackground(OUString const & filename)
 {
 load("/chart2/qa/extras/data/xlsx/", filename);
diff --git a/chart2/qa/extras/data/xlsx/tdf124817.xlsx 
b/chart2/qa/extras/data/xlsx/tdf124817.xlsx
new file mode 100644
index ..d9b09644e47e
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf124817.xlsx differ
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx 
b/oox/source/drawingml/chart/typegroupconverter.cxx
index bd592e6adbc5..35bb23a2ccf0 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -500,7 +500,15 @@ void TypeGroupConverter::convertMarker( PropertySet& 
rPropSet, sal_Int32 nOoxSym
 {
 Color aFillColor = xShapeProps->getFillProperties().maFillColor;
 aSymbol.FillColor = 
sal_Int32(aFillColor.getColor(getFilter().getGraphicHelper()));
-rPropSet.setProperty(PROP_Color, aSymbol.FillColor);
+// tdf#124817: if there is no fill color, use line color of the 
symbol
+if( aSymbol.FillColor < 0 )
+{
+Color aLineColor = 
xShapeProps->getLineProperties().maLineFill.maFillColor;
+aSymbol.BorderColor = 
sal_Int32(aLineColor.getColor(getFilter().getGraphicHelper()));
+rPropSet.setProperty(PROP_Color, aSymbol.BorderColor);
+}
+else
+rPropSet.setProperty(PROP_Color, aSymbol.FillColor);
 }
 
 // set the property
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-18 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |   14 ++
 chart2/qa/extras/data/xlsx/tdf111824.xlsx |binary
 oox/source/export/chartexport.cxx |2 ++
 3 files changed, 16 insertions(+)

New commits:
commit 1b26a6e7a4e3865d1555fa0612845c765b114b49
Author: Balazs Varga 
AuthorDate: Mon Jun 17 14:58:54 2019 +0200
Commit: László Németh 
CommitDate: Tue Jun 18 12:55:54 2019 +0200

tdf#111824 Chart OOXML Export: fix Z axis labels

Export 3D barchart Z ("deep") axis properties into
 xml tag, as the OOXML Standard requires.

Change-Id: I8ee2282a28e9b4bdea6e96c96256f832b1a1aada
Reviewed-on: https://gerrit.libreoffice.org/74170
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index b238f35f715a..7a0abcf0bc02 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -128,6 +128,7 @@ public:
 void testChartTitlePropertiesBitmapFillPPTX();
 void testxAxisLabelsRotation();
 void testTdf116163();
+void testTdf111824();
 void testTdf119029();
 void testTdf108022();
 void testTdf121744();
@@ -224,6 +225,7 @@ public:
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillPPTX);
 CPPUNIT_TEST(testxAxisLabelsRotation);
 CPPUNIT_TEST(testTdf116163);
+CPPUNIT_TEST(testTdf111824);
 CPPUNIT_TEST(testTdf119029);
 CPPUNIT_TEST(testTdf108022);
 CPPUNIT_TEST(testTdf121744);
@@ -2081,6 +2083,18 @@ void Chart2ExportTest::testTdf116163()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:catAx/c:txPr/a:bodyPr", "rot", "-540");
 }
 
+void Chart2ExportTest::testTdf111824()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf111824.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// Collect 3D barchart Z axID
+OUString zAxisIdOf3DBarchart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:bar3DChart/c:axId[3]", "val");
+// 3D barchart Z axis properties should be in a serAx OOXML tag instead of 
catAx
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:serAx/c:axId", 
"val", zAxisIdOf3DBarchart);
+}
+
 void Chart2ExportTest::testTdf119029()
 {
 load("/chart2/qa/extras/data/odp/", "tdf119029.odp");
diff --git a/chart2/qa/extras/data/xlsx/tdf111824.xlsx 
b/chart2/qa/extras/data/xlsx/tdf111824.xlsx
new file mode 100644
index ..ae86756c47ee
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf111824.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index ae16670ebe56..65b7bd3c3e23 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2423,6 +2423,8 @@ void ChartExport::exportAxis(const AxisIdPair& 
rAxisIdPair)
 nAxisType = XML_valAx;
 else if( eChartType == chart::TYPEID_STOCK )
 nAxisType = XML_dateAx;
+else if( eChartType == chart::TYPEID_BAR )
+nAxisType = XML_serAx;
 // FIXME: axPos, need to check axis direction
 sAxPos = "b";
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-21 Thread Tamás Zolnai (via logerrit)
 chart2/qa/extras/chart2import.cxx |   23 +++
 chart2/qa/extras/data/pptx/tdf122765.pptx |binary
 oox/source/drawingml/chart/titleconverter.cxx |1 -
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 10609749126ca76eaf12904d4cce9cc5a16d8405
Author: Tamás Zolnai 
AuthorDate: Tue May 21 12:50:31 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Tue May 21 21:35:07 2019 +0200

tdf#122765: Legend interferes with pie chart after pptx import

Revert the commit caused this regression:
0fc41c53dfbd21e526fb0ad68a6651693c4a2ecd

The original issue does not come back with
reverting this commit.

Change-Id: I666c4f92e3b70b416ec6da7a704298d207451649
Reviewed-on: https://gerrit.libreoffice.org/72679
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index cd5e61d03f21..b7eb3e31fc07 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -126,6 +126,7 @@ public:
 void testExternalStrRefsXLSX();
 void testSourceNumberFormatComplexCategoriesXLS();
 void testTdf123504();
+void testTdf122765();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -206,6 +207,7 @@ public:
 CPPUNIT_TEST(testExternalStrRefsXLSX);
 CPPUNIT_TEST(testSourceNumberFormatComplexCategoriesXLS);
 CPPUNIT_TEST(testTdf123504);
+CPPUNIT_TEST(testTdf122765);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1870,6 +1872,27 @@ void Chart2ImportTest::testTdf123504()
 CPPUNIT_ASSERT_GREATER(sal_Int32(8500), aSliceSize.Width);
 }
 
+void Chart2ImportTest::testTdf122765()
+{
+// The horizontal position of the slices was wrong.
+load("/chart2/qa/extras/data/pptx/", "tdf122765.pptx");
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), UNO_QUERY);
+Reference xDrawPageSupplier(xChartDoc, 
UNO_QUERY_THROW);
+Reference xDrawPage(xDrawPageSupplier->getDrawPage(), 
UNO_SET_THROW);
+Reference xShapes(xDrawPage->getByIndex(0), 
UNO_QUERY_THROW);
+Reference xSeriesSlices(getShapeByName(xShapes, 
"CID/D=0:CS=0:CT=0:Series=0"),
+ UNO_SET_THROW);
+
+Reference xIndexAccess(xSeriesSlices, 
UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(9), xIndexAccess->getCount());
+Reference xSlice(xIndexAccess->getByIndex(0), 
UNO_QUERY_THROW);
+
+// Check position of the first slice, all slices move together, so enough 
to check only one.
+// Wrong poisition was around 5856.
+awt::Point aSlicePosition = xSlice->getPosition();
+CPPUNIT_ASSERT_GREATER(sal_Int32(7000), aSlicePosition.X);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/pptx/tdf122765.pptx 
b/chart2/qa/extras/data/pptx/tdf122765.pptx
new file mode 100644
index ..948190c30b55
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf122765.pptx differ
diff --git a/oox/source/drawingml/chart/titleconverter.cxx 
b/oox/source/drawingml/chart/titleconverter.cxx
index a4bb1ec70944..8109ca8a3235 100644
--- a/oox/source/drawingml/chart/titleconverter.cxx
+++ b/oox/source/drawingml/chart/titleconverter.cxx
@@ -238,7 +238,6 @@ void LegendConverter::convertFromModel( const Reference< 
XDiagram >& rxDiagram )
 // manual size needs ChartLegendExpansion_CUSTOM and 
LegendPosition_CUSTOM (tdf#118150)
 if( aLayoutConv.convertFromModel( aPropSet ) )
 {
-eLegendPos = cssc2::LegendPosition_CUSTOM;
 eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
 }
 bManualLayout = !aLayoutConv.getAutoLayout();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-14 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx |2 +-
 oox/source/core/xmlfilterbase.cxx |9 +
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 642389768e634b739a1d8354259b16bfcc695d17
Author: Balazs Varga 
AuthorDate: Mon May 13 16:23:38 2019 +0200
Commit: László Németh 
CommitDate: Tue May 14 08:19:45 2019 +0200

tdf#100084 XLSX import: fix missing charts clean-up

Clean-up the b2fc2ad7beceaff660de684435a5c37d69cf8ae9
commit.

Change-Id: I625373d9661cbe4528ca487af0aef356b40af2e7
Reviewed-on: https://gerrit.libreoffice.org/72237
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index affab028f46e..cd5e61d03f21 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -887,7 +887,7 @@ void Chart2ImportTest::testTdf108021()
 
 void Chart2ImportTest::testTdf100084()
 {
-// The test file was created with IBM Cognos, so just check there is a 
diagram.
+// The test file was created with IBM Cognos, make sure there is a diagram.
 load("/chart2/qa/extras/data/xlsx/", "tdf100084.xlsx");
 Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
 CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index be9b2261c272..6e26fa86595a 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -385,15 +385,16 @@ bool XmlFilterBase::importFragment( const 
rtl::Reference& rxHan
 handler to create specialized input streams, e.g. VML streams that
 have to preprocess the raw input data. */
 Reference< XInputStream > xInStrm = rxHandler->openFragmentStream();
-// Check again the aFragmentPath route if there is no any file with 
lowercase letter. (tdf#100084)
+/*  tdf#100084 Check again the aFragmentPath route with lowercase file 
name
+TODO: complete handling of case-insensitive file paths */
 if ( !xInStrm.is() )
 {
 sal_Int32 nPathLen = aFragmentPath.lastIndexOf('/') + 1;
 OUString fileName = aFragmentPath.copy(nPathLen);
-if ( fileName != fileName.toAsciiLowerCase() )
+OUString sLowerCaseFileName = fileName.toAsciiLowerCase();
+if ( fileName != sLowerCaseFileName )
 {
-fileName = fileName.toAsciiLowerCase();
-aFragmentPath = OUStringBuffer(aFragmentPath.copy(0, 
nPathLen)).append(fileName).makeStringAndClear();
+aFragmentPath = aFragmentPath.copy(0, nPathLen) + 
sLowerCaseFileName;
 xInStrm = openInputStream(aFragmentPath);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-13 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx |   12 
 chart2/qa/extras/data/xlsx/tdf100084.xlsx |binary
 oox/source/core/xmlfilterbase.cxx |   14 +-
 3 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit b2fc2ad7beceaff660de684435a5c37d69cf8ae9
Author: Balazs Varga 
AuthorDate: Fri May 10 09:34:30 2019 +0200
Commit: László Németh 
CommitDate: Mon May 13 13:16:10 2019 +0200

tdf#100084 XLSX import: fix missing charts

caused by case-sensitive path handling of relationship files.

OOXML documents contain case-insensitive file paths, for example,
uppercase "Sheet.xml" can have a lowercase "sheet.xml.rels" in the ZIP
archive, as in the case of the XLSX documents generated by IBM Cognos.

Change-Id: I4210e3b96fb512d61e1687ec8d41a3c77292ec0c
Reviewed-on: https://gerrit.libreoffice.org/72100
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 4510ac447487..affab028f46e 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -70,6 +70,7 @@ public:
 void testTdf105517();
 void testTdf106217();
 void testTdf108021();
+void testTdf100084();
 void testAutoBackgroundXLSX();
 void testAutoChartAreaBorderPropXLSX();
 void testChartAreaStyleBackgroundXLSX();
@@ -158,6 +159,7 @@ public:
 CPPUNIT_TEST(testTdf105517);
 CPPUNIT_TEST(testTdf106217);
 CPPUNIT_TEST(testTdf108021);
+CPPUNIT_TEST(testTdf100084);
 CPPUNIT_TEST(testAutoBackgroundXLSX);
 CPPUNIT_TEST(testAutoChartAreaBorderPropXLSX);
 CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX);
@@ -883,6 +885,16 @@ void Chart2ImportTest::testTdf108021()
 CPPUNIT_ASSERT(bTextBreak);
 }
 
+void Chart2ImportTest::testTdf100084()
+{
+// The test file was created with IBM Cognos, so just check there is a 
diagram.
+load("/chart2/qa/extras/data/xlsx/", "tdf100084.xlsx");
+Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+Reference xDiagram(xChartDoc->getFirstDiagram(), 
UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("There should be a Diagram.", xDiagram.is());
+}
+
 void Chart2ImportTest::testTransparentBackground(OUString const & filename)
 {
 load("/chart2/qa/extras/data/xlsx/", filename);
diff --git a/chart2/qa/extras/data/xlsx/tdf100084.xlsx 
b/chart2/qa/extras/data/xlsx/tdf100084.xlsx
new file mode 100755
index ..5f03f39244e5
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf100084.xlsx differ
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 738412fb182c..be9b2261c272 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -342,7 +342,7 @@ bool XmlFilterBase::importFragment( const 
rtl::Reference& rxHan
 return false;
 
 // fragment handler must contain path to fragment stream
-const OUString aFragmentPath = rxHandler->getFragmentPath();
+OUString aFragmentPath = rxHandler->getFragmentPath();
 OSL_ENSURE( !aFragmentPath.isEmpty(), "XmlFilterBase::importFragment - 
missing fragment path" );
 if( aFragmentPath.isEmpty() )
 return false;
@@ -385,6 +385,18 @@ bool XmlFilterBase::importFragment( const 
rtl::Reference& rxHan
 handler to create specialized input streams, e.g. VML streams that
 have to preprocess the raw input data. */
 Reference< XInputStream > xInStrm = rxHandler->openFragmentStream();
+// Check again the aFragmentPath route if there is no any file with 
lowercase letter. (tdf#100084)
+if ( !xInStrm.is() )
+{
+sal_Int32 nPathLen = aFragmentPath.lastIndexOf('/') + 1;
+OUString fileName = aFragmentPath.copy(nPathLen);
+if ( fileName != fileName.toAsciiLowerCase() )
+{
+fileName = fileName.toAsciiLowerCase();
+aFragmentPath = OUStringBuffer(aFragmentPath.copy(0, 
nPathLen)).append(fileName).makeStringAndClear();
+xInStrm = openInputStream(aFragmentPath);
+}
+}
 
 // own try/catch block for showing parser failure assertion with 
fragment path
 if( xInStrm.is() ) try
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-17 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |   44 ++
 chart2/qa/extras/data/ods/combined_chart_secondary_axis.ods   |binary
 chart2/qa/extras/data/xlsx/combined_chart_secondary_axis.xlsx |binary
 oox/source/export/chartexport.cxx |   31 +--
 4 files changed, 68 insertions(+), 7 deletions(-)

New commits:
commit 9be1b6cf5b97727135c7f5e48c971edd8dc45e70
Author: Balazs Varga 
AuthorDate: Tue Apr 16 11:19:55 2019 +0200
Commit: László Németh 
CommitDate: Wed Apr 17 14:30:17 2019 +0200

tdf#123828 XLSX combined chart export: fix order of axis types

Also fix tdf#123833 and tdf#123837.

In combined charts, now axis types are exported in the right order
(catAx[1], valAx[1], catAx[2], valAx[2]). The Y axes are exported
correctly with the correct axIDs of the chart types: the first one with
the primary axId, the second one with the secondary axId. X category
axis crosses the Y axis at the right place, all data series are attached
to the right Y axis, and the Y major grid doesn't disappear.

Note: don't export the CrossoverPosition/CrossoverValue, if the axis
is deleted and invisible, because MSO will show the secondary X axis,
even if the axis doesn't exist. The problem was the unnecessary export
of the axis with the default css::chart::ChartAxisPosition_END
CrossoverPosition value.

Change-Id: Id429e654ff0ba45b5f9db877b7c4dd6e65433408
Reviewed-on: https://gerrit.libreoffice.org/70814
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 6dd8d7d9e9c1..a5c42530a0b6 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -114,6 +114,8 @@ public:
 void testMultipleAxisXLSX();
 void testSecondaryAxisXLSX();
 void testSetSeriesToSecondaryAxisXLSX();
+void testCombinedChartSecondaryAxisXLSX();
+void testCombinedChartSecondaryAxisODS();
 void testAxisTitleRotationXLSX();
 void testAxisCrossBetweenXSLX();
 void testPieChartDataPointExplosionXLSX();
@@ -208,6 +210,8 @@ public:
 CPPUNIT_TEST(testMultipleAxisXLSX);
 CPPUNIT_TEST(testSecondaryAxisXLSX);
 CPPUNIT_TEST(testSetSeriesToSecondaryAxisXLSX);
+CPPUNIT_TEST(testCombinedChartSecondaryAxisXLSX);
+CPPUNIT_TEST(testCombinedChartSecondaryAxisODS);
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
 CPPUNIT_TEST(testAxisCrossBetweenXSLX);
 CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
@@ -1782,6 +1786,46 @@ void Chart2ExportTest::testSetSeriesToSecondaryAxisXLSX()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart", 2);
 }
 
+void Chart2ExportTest::testCombinedChartSecondaryAxisXLSX()
+{
+// Original file was created with MS Office
+load("/chart2/qa/extras/data/xlsx/", "combined_chart_secondary_axis.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+// Collect barchart axID on secondary Axis
+OUString XValueIdOfBarchart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val");
+OUString YValueIdOfBarchart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[2]", "val");
+// Collect linechart axID on primary Axis
+OUString XValueIdOfLinechart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[1]", "val");
+OUString YValueIdOfLinechart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[2]", "val");
+// Check which c:catAx and c:valAx contain the AxisId of charttypes
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[1]/c:axId", 
"val", XValueIdOfLinechart);
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[1]/c:axId", 
"val", YValueIdOfLinechart);
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[2]/c:axId", 
"val", XValueIdOfBarchart);
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:axId", 
"val", YValueIdOfBarchart);
+}
+
+void Chart2ExportTest::testCombinedChartSecondaryAxisODS()
+{
+// Original file was created with LibreOffice
+load("/chart2/qa/extras/data/ods/", "combined_chart_secondary_axis.ods");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+// Collect barchart axID on secondary Axis
+OUString XValueIdOfBarchart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val");
+OUString YValueIdOfBarchart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[2]", "val");
+// Collect linechart axID on primary Axis
+OUString XValueIdOfLinechart = getXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[1]", "val");
+OUString YValueIdOfLinechart = getXPath(pXmlDoc, 

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

2019-04-15 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2import.cxx |   28 ++
 chart2/qa/extras/data/xlsx/testCombinedChartAxis.xlsx |binary
 oox/source/drawingml/chart/plotareaconverter.cxx  |   34 +++---
 3 files changed, 58 insertions(+), 4 deletions(-)

New commits:
commit 11473832b5717cb3222ce72baee885bc9e8e2386
Author: Balazs Varga 
AuthorDate: Tue Apr 9 16:12:35 2019 +0200
Commit: László Németh 
CommitDate: Mon Apr 15 09:12:59 2019 +0200

tdf#114181 XLSX combined chart: fix swapped primary and secondary axes etc.

In combined charts, now X category axis crosses the Y axis at the right
place, all data series are attached to the right Y axis, and the
Y major grid isn't lost.

Note: Let's check which axis is attached to the first charttype
(in case of combined chart, the first one is a column chart) and create
that axis first. In OOXML standard, the first CT_valAx tag contains the
axID of the primary axis and the second CT_valAx tag contains the axID
of the secondary axis.


Change-Id: Ib123f95ec41ef5dbbf0599efd7a646f4640a9b70
Reviewed-on: https://gerrit.libreoffice.org/70464
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 47d1ce481a77..475b5bbe2209 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -102,6 +102,7 @@ public:
 void testAxisTitleDefaultRotationXLSX();
 void testSecondaryAxisTitleDefaultRotationXLSX();
 void testAxisTitleRotationXLSX();
+void testCombinedChartAttachedAxisXLSX();
 
 void testTdf90510(); // Pie chart label placement settings(XLS)
 void testTdf109858(); // Pie chart label placement settings(XLSX)
@@ -182,6 +183,7 @@ public:
 CPPUNIT_TEST(testAxisTitleDefaultRotationXLSX);
 CPPUNIT_TEST(testSecondaryAxisTitleDefaultRotationXLSX);
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
+CPPUNIT_TEST(testCombinedChartAttachedAxisXLSX);
 CPPUNIT_TEST(testTdf90510);
 CPPUNIT_TEST(testTdf109858);
 CPPUNIT_TEST(testTdf73);
@@ -1399,6 +1401,32 @@ void Chart2ImportTest::testAxisTitleRotationXLSX()
 
 }
 
+void Chart2ImportTest::testCombinedChartAttachedAxisXLSX()
+{
+load("/chart2/qa/extras/data/xlsx/", "testCombinedChartAxis.xlsx");
+Reference< chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+// First series
+Reference xSeries = getDataSeriesFromDoc(xChartDoc, 
0);
+CPPUNIT_ASSERT(xSeries.is());
+
+Reference xPropSet(xSeries, uno::UNO_QUERY_THROW);
+sal_Int32 nAxisIndex = -1;
+// First series (column chart) should be attached to secondary axis!
+uno::Any aAny = xPropSet->getPropertyValue("AttachedAxisIndex");
+CPPUNIT_ASSERT(aAny >>= nAxisIndex);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nAxisIndex);
+
+// Second series
+xSeries = getDataSeriesFromDoc(xChartDoc, 0, 1);
+CPPUNIT_ASSERT(xSeries.is());
+
+xPropSet.set(xSeries, uno::UNO_QUERY_THROW);
+// Second series (line chart) should be attached to primary axis!
+aAny = xPropSet->getPropertyValue("AttachedAxisIndex");
+CPPUNIT_ASSERT(aAny >>= nAxisIndex);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nAxisIndex);
+}
+
 void Chart2ImportTest::testInternalDataProvider() {
 uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/odp/", "chart.odp"), 
uno::UNO_QUERY_THROW);
 const uno::Reference< chart2::data::XDataProvider >& rxDataProvider = 
xChartDoc->getDataProvider();
diff --git a/chart2/qa/extras/data/xlsx/testCombinedChartAxis.xlsx 
b/chart2/qa/extras/data/xlsx/testCombinedChartAxis.xlsx
new file mode 100644
index ..47f8246e23cd
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/testCombinedChartAxis.xlsx differ
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx 
b/oox/source/drawingml/chart/plotareaconverter.cxx
index f3a4b8ebe493..8afdfda365ea 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -335,12 +335,36 @@ void PlotAreaConverter::convertFromModel( View3DModel& 
rView3DModel )
 // store all axis models in a map, keyed by axis identifier
 typedef ModelMap< sal_Int32, AxisModel > AxisMap;
 AxisMap aAxisMap;
+std::vectorrValAxisIds;
+std::vectorrRealValAxisIds;
+
+for (auto const& atypeGroup : mrModel.maTypeGroups)
+{
+if (atypeGroup->maAxisIds.size() > 1)
+{
+// let's collect which axId belongs to the Y Axis according to 
maTypeGroups
+rRealValAxisIds.push_back(atypeGroup->maAxisIds[1]);
+}
+}
+
 for (auto const& axis : mrModel.maAxes)
 {
 OSL_ENSURE( axis->mnAxisId >= 0, "PlotAreaConverter::convertFromModel 
- invalid axis identifier" );
 OSL_ENSURE( !aAxisMap.has( axis->mnAxisId ), 
"PlotAreaConverter::convertFromModel - 

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

2019-04-08 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx |   21 ++
 chart2/qa/extras/data/xlsx/add_series_secondary_axis.xlsx |binary
 oox/source/drawingml/chart/typegroupconverter.cxx |   19 +++-
 3 files changed, 38 insertions(+), 2 deletions(-)

New commits:
commit a3881a66b8ffda4a8a89ecfc4347555e34193665
Author: Balazs Varga 
AuthorDate: Tue Apr 2 16:10:00 2019 +0200
Commit: László Németh 
CommitDate: Mon Apr 8 15:30:03 2019 +0200

tdf#124466 XLSX: fix broken export by removing chart type data redundancy

XLSX import created a redundant series container for data series with the
same chart type, when they were attached to a different axis. Modifying
the loaded chart by the user, ie. attaching one of its data series to a
different axis resulted broken OOXML export later, because based on the
new axis, splitDataSeriesByAxis splitted the first or the redundant series
container further. Now the import creates only a single series container
for the series with the same chart type, preventing potential export 
problems.

Change-Id: If951feaca3cb3b5df7718e9d7bfd59620ef3c4d3
Reviewed-on: https://gerrit.libreoffice.org/70141
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 3d537cf2ab90..6c769f0bbe63 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -113,6 +113,7 @@ public:
 void testBarChartVaryColorsXLSX();
 void testMultipleAxisXLSX();
 void testSecondaryAxisXLSX();
+void testSetSeriesToSecondaryAxisXLSX();
 void testAxisTitleRotationXLSX();
 void testAxisCrossBetweenXSLX();
 void testPieChartDataPointExplosionXLSX();
@@ -206,6 +207,7 @@ public:
 CPPUNIT_TEST(testBarChartVaryColorsXLSX);
 CPPUNIT_TEST(testMultipleAxisXLSX);
 CPPUNIT_TEST(testSecondaryAxisXLSX);
+CPPUNIT_TEST(testSetSeriesToSecondaryAxisXLSX);
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
 CPPUNIT_TEST(testAxisCrossBetweenXSLX);
 CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
@@ -1760,6 +1762,25 @@ void Chart2ExportTest::testSecondaryAxisXLSX()
 assertXPathContent(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart[2]/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v",
 "a");
 }
 
+void Chart2ExportTest::testSetSeriesToSecondaryAxisXLSX()
+{
+load("/chart2/qa/extras/data/xlsx/", "add_series_secondary_axis.xlsx");
+Reference< chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+// Second series
+Reference xSeries = getDataSeriesFromDoc(xChartDoc, 
1);
+CPPUNIT_ASSERT(xSeries.is());
+
+Reference xPropSet(xSeries, uno::UNO_QUERY_THROW);
+sal_Int32 AxisIndex = 1;
+// Attach the second series to the secondary axis. (The third series is 
already attached.)
+xPropSet->setPropertyValue("AttachedAxisIndex", uno::Any(AxisIndex));
+
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+// Check there are only two  tag in the XML, one for the 
primary and one for the secondary axis.
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart", 2);
+}
+
 void Chart2ExportTest::testAxisTitleRotationXLSX()
 {
 load("/chart2/qa/extras/data/xlsx/", "axis_title_rotation.xlsx");
diff --git a/chart2/qa/extras/data/xlsx/add_series_secondary_axis.xlsx 
b/chart2/qa/extras/data/xlsx/add_series_secondary_axis.xlsx
new file mode 100755
index ..03d7a47f6c3d
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/add_series_secondary_axis.xlsx differ
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx 
b/oox/source/drawingml/chart/typegroupconverter.cxx
index 1f6c73e11d0b..bd592e6adbc5 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -312,6 +312,10 @@ void TypeGroupConverter::convertFromModel( const 
Reference< XDiagram >& rxDiagra
 OUString aService = OUString::createFromAscii( 
maTypeInfo.mpcServiceName );
 Reference< XChartType > xChartType( createInstance( aService ), 
UNO_QUERY_THROW );
 
+Reference< XChartTypeContainer > xChartTypeContOld( rxCoordSystem, 
UNO_QUERY_THROW );
+Sequence< Reference< XChartType > > xOldChartTypes( 
xChartTypeContOld->getChartTypes() );
+sal_Int32 nOldChartTypeIdx = -1;
+
 // additional properties
 PropertySet aDiaProp( rxDiagram );
 PropertySet aTypeProp( xChartType );
@@ -419,11 +423,19 @@ void TypeGroupConverter::convertFromModel( const 
Reference< XDiagram >& rxDiagra
 }
 else
 {
+for( sal_Int32 nCTIdx=0; nCTIdxgetChartType() == 
xOldChartTypes[nCTIdx]->getChartType() )
+{
+nOldChartTypeIdx = nCTIdx;
+}
+}
+
 for (auto const& elem : aSeries)
  

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

2019-04-02 Thread Balazs Varga (via logerrit)
 chart2/qa/extras/chart2export.cxx|   18 ++
 chart2/qa/extras/data/ods/secondary_axis.ods |binary
 oox/source/export/chartexport.cxx|   15 +++
 3 files changed, 33 insertions(+)

New commits:
commit ad363fd42e439b43c57b6541988234fbaf1ddb30
Author: Balazs Varga 
AuthorDate: Mon Apr 1 13:57:33 2019 +0200
Commit: László Németh 
CommitDate: Tue Apr 2 08:34:08 2019 +0200

tdf#124463 XLSX export: fix splitDataSeriesByAxis

splitDataSeriesByAxis couldn't split series correctly into two
sequences, because it put all series into the first created sequence,
except the first series of the newer sequence.

Other improvement: first sequence of the return vector always
contains the series attached to the primary axis.

Change-Id: I6e107aa990f9a1a1db49cae2a4f3c9d8a35fb54c
Reviewed-on: https://gerrit.libreoffice.org/70059
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index f4d8f5e981a9..3d537cf2ab90 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -112,6 +112,7 @@ public:
 void testPlotVisOnlyXLSX();
 void testBarChartVaryColorsXLSX();
 void testMultipleAxisXLSX();
+void testSecondaryAxisXLSX();
 void testAxisTitleRotationXLSX();
 void testAxisCrossBetweenXSLX();
 void testPieChartDataPointExplosionXLSX();
@@ -204,6 +205,7 @@ public:
 CPPUNIT_TEST(testPlotVisOnlyXLSX);
 CPPUNIT_TEST(testBarChartVaryColorsXLSX);
 CPPUNIT_TEST(testMultipleAxisXLSX);
+CPPUNIT_TEST(testSecondaryAxisXLSX);
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
 CPPUNIT_TEST(testAxisCrossBetweenXSLX);
 CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
@@ -1742,6 +1744,22 @@ void Chart2ExportTest::testMultipleAxisXLSX()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:valAx/c:axPos[@val='r']", 1);
 }
 
+void Chart2ExportTest::testSecondaryAxisXLSX()
+{
+load("/chart2/qa/extras/data/ods/", "secondary_axis.ods");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart", 2);
+// test there is just those series in the first  tag which are 
attached to the primary axis
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart[1]/c:ser", 2);
+assertXPathContent(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart[1]/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v",
 "b");
+assertXPathContent(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart[1]/c:ser[2]/c:tx/c:strRef/c:strCache/c:pt/c:v",
 "c");
+// test there is just those series in the second  tag which are 
attached to the secondary axis
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart[2]/c:ser", 1);
+assertXPathContent(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart[2]/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v",
 "a");
+}
+
 void Chart2ExportTest::testAxisTitleRotationXLSX()
 {
 load("/chart2/qa/extras/data/xlsx/", "axis_title_rotation.xlsx");
diff --git a/chart2/qa/extras/data/ods/secondary_axis.ods 
b/chart2/qa/extras/data/ods/secondary_axis.ods
new file mode 100755
index ..3f8f269c0f00
Binary files /dev/null and b/chart2/qa/extras/data/ods/secondary_axis.ods differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 47c30b1ba569..062636c91d62 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1592,6 +1592,7 @@ std::vector > > 
splitDataSeriesByAxis(co
 Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, 
uno::UNO_QUERY );
 if(xDSCnt.is())
 {
+sal_Int32 nAxisIndexOfFirstSeries = -1;
 Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( 
xDSCnt->getDataSeries());
 for (sal_Int32 nIndex = 0, nEnd = aSeriesSeq.getLength(); nIndex < 
nEnd; ++nIndex)
 {
@@ -1604,6 +1605,10 @@ std::vector > > 
splitDataSeriesByAxis(co
 uno::Any aAny = xPropSet->getPropertyValue("AttachedAxisIndex");
 aAny >>= nAxisIndex;
 size_t nVectorPos = 0;
+if (nAxisIndexOfFirstSeries == -1)
+{
+nAxisIndexOfFirstSeries = nAxisIndex;
+}
 
 auto it = aMapAxisToIndex.find(nAxisIndex);
 if (it == aMapAxisToIndex.end())
@@ -1612,12 +1617,22 @@ std::vector > > 
splitDataSeriesByAxis(co
 nVectorPos = aSplitSeries.size() - 1;
 aMapAxisToIndex.insert(std::pair(nAxisIndex, nVectorPos));
 }
+else
+{
+nVectorPos = it->second;
+}
 
 uno::Sequence >& rAxisSeriesSeq = 
aSplitSeries[nVectorPos];
 sal_Int32 nLength = rAxisSeriesSeq.getLength();
 

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

2019-03-12 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2export.cxx  |   11 ++
 chart2/qa/extras/data/xlsx/tdf115012.xlsx  |binary
 oox/source/drawingml/chart/chartspaceconverter.cxx |   85 +
 sc/source/ui/unoobj/chart2uno.cxx  |8 +
 4 files changed, 104 insertions(+)

New commits:
commit f684c074d5f66c8b1546a626766bc045c04cebc3
Author: László Németh 
AuthorDate: Mon Mar 11 16:30:36 2019 +0100
Commit: László Németh 
CommitDate: Tue Mar 12 13:16:00 2019 +0100

tdf#115012 XLSX chart import: workaround for no gap

DispBlanksAs=gap mode of OOXML is different from
treat-empty-cells=leave-gap mode of OpenDocument,
because formulas with no numerical values and
strings are no gaps in OOXML line charts, but zeroes.

When the data source of the line charts contains
formulas with no numerical values or strings,
but it doesn't contain empty cells, as a workaround,
the charts will be imported with the
treat-empty-cells=use-zero setting to get the same
line chart as in MSO.

Note: now result of ScChart2DataSequence::getData(),
a sequence of Any values contains UNO void values for
empty cells instead empty strings, allowing the
distinction of the empty cells and cells with empty
string values.

Change-Id: If9a101d66b5b750051928fa7b10b05cea6040071
Reviewed-on: https://gerrit.libreoffice.org/69054
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 8671a4771e21..f4d8f5e981a9 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -128,6 +128,7 @@ public:
 void testTdf108022();
 void testTdf121744();
 void testTdf122031();
+void testTdf115012();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -219,6 +220,7 @@ public:
 CPPUNIT_TEST(testTdf108022);
 CPPUNIT_TEST(testTdf121744);
 CPPUNIT_TEST(testTdf122031);
+CPPUNIT_TEST(testTdf115012);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -2046,6 +2048,15 @@ void Chart2ExportTest::testTdf122031()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[3]/c:numFmt", 
"formatCode", "0.000%");
 }
 
+void Chart2ExportTest::testTdf115012()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf115012.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+// workaround: use-zero instead of leave-gap to show the original line 
chart
+assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", 
"zero");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf115012.xlsx 
b/chart2/qa/extras/data/xlsx/tdf115012.xlsx
new file mode 100644
index ..cf8ac7d81eac
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf115012.xlsx differ
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx 
b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 6ddbb2ab76bb..2e2c8bc3885b 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -22,6 +22,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -67,6 +71,82 @@ ChartSpaceConverter::~ChartSpaceConverter()
 {
 }
 
+// Formulas with no numeric values and strings are zeroes in OOXML line charts 
also in the mode DispBlanksAs=gap,
+// unlike in OpenDocument LEAVE_GAP mode. As a workaround, we will use the 
OpenDocument mode USE_ZERO, if the OOXML
+// line chart has got formulas with no numeric values and strings, but it 
doesn't have empty cells, showing the
+// same chart as in MSO. (Empty cells need gaps, so in that case, we cannot 
use this workaround).
+static bool lcl_useWorkaroundForNoGapInOOXML( Reference< 
chart2::XChartDocument > const & xChartDoc)
+{
+Reference  xDiagram = xChartDoc->getFirstDiagram();
+if ( !xDiagram.is() )
+return false;
+
+Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( 
xDiagram, UNO_QUERY_THROW );
+
+Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( 
xCooSysContainer->getCoordinateSystems());
+if ( xCooSysSequence.getLength() == 0 )
+return false;
+
+Reference< chart2::XChartTypeContainer > xChartTypeContainer( 
xCooSysSequence[0], UNO_QUERY_THROW );
+
+Sequence< Reference< chart2::XChartType > > xChartTypeSequence( 
xChartTypeContainer->getChartTypes() );
+if ( xChartTypeSequence.getLength() == 0 )
+return false;
+
+const Reference& xCT = xChartTypeSequence[0];
+
+if ( xCT->getChartType() != "com.sun.star.chart2.LineChartType" )
+return false;
+
+Reference xDSCont(xCT, uno::UNO_QUERY);
+
+if (!xDSCont.is())
+return false;
+
+Sequence > 

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

2019-02-15 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2export.cxx|   19 +++
 chart2/qa/extras/data/xlsx/testErrorBarProp.xlsx |binary
 oox/source/export/chartexport.cxx|2 ++
 3 files changed, 21 insertions(+)

New commits:
commit b89f239aa9d3d4660380bbd0c893aecde0986032
Author: Balazs Varga 
AuthorDate: Thu Feb 14 16:30:43 2019 +0100
Commit: László Németh 
CommitDate: Fri Feb 15 07:30:09 2019 +0100

tdf#97575 Chart OOXML: Export ShapeProps of Error Bars

Export the shapeProps (fillstyle, linestyle, linewidth,
linecolor etc.) of the Error Bars to OOXML.

Change-Id: Iff74fa463fdd0fb6ed95e4d1bf0d3e906349860c
Reviewed-on: https://gerrit.libreoffice.org/67825
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index b16e773ab776..8671a4771e21 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -40,6 +40,7 @@ protected:
 public:
 Chart2ExportTest() : ChartTest() {}
 void testErrorBarXLSX();
+void testErrorBarPropXLSX();
 void testTrendline();
 void testTrendlineOOXML();
 void testTrendlineXLS();
@@ -130,6 +131,7 @@ public:
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
+CPPUNIT_TEST(testErrorBarPropXLSX);
 CPPUNIT_TEST(testTrendline);
 CPPUNIT_TEST(testTrendlineOOXML);
 CPPUNIT_TEST(testTrendlineXLS);
@@ -495,6 +497,23 @@ void Chart2ExportTest::testErrorBarXLSX()
 }
 }
 
+void Chart2ExportTest::testErrorBarPropXLSX()
+{
+load("/chart2/qa/extras/data/xlsx/", "testErrorBarProp.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// test y error bars property
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:errBars[1]/c:errDir", 
"val", "y");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:errBars[1]/c:spPr/a:ln",
 "w", "12600");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:errBars[1]/c:spPr/a:ln/a:solidFill/a:srgbClr",
 "val", "ff");
+
+// test x error bars property
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:errBars[2]/c:errDir", 
"val", "x");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:errBars[2]/c:spPr/a:ln",
 "w", "9360");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:errBars[2]/c:spPr/a:ln/a:solidFill/a:srgbClr",
 "val", "595959");
+}
+
 // This method tests the preservation of properties for trendlines / 
regression curves
 // in an export -> import cycle using different file formats - ODS, XLS and 
XLSX.
 void Chart2ExportTest::testTrendline()
diff --git a/chart2/qa/extras/data/xlsx/testErrorBarProp.xlsx 
b/chart2/qa/extras/data/xlsx/testErrorBarProp.xlsx
new file mode 100755
index ..ac9dde9b79b6
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/testErrorBarProp.xlsx 
differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b1c437b53dfe..47c30b1ba569 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3885,6 +3885,8 @@ void ChartExport::exportErrorBar(const Reference< 
XPropertySet>& xErrorBarProps,
 FSEND );
 }
 
+exportShapeProps( xErrorBarProps );
+
 pFS->endElement( FSNS( XML_c, XML_errBars) );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-12 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2import.cxx  |   20 
 chart2/qa/extras/data/docx/testTdf16.docx  |binary
 oox/source/drawingml/chart/seriesconverter.cxx |2 +-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit de73efb96fbb1d268caea0f41acbe20a234ec59f
Author: Balazs Varga 
AuthorDate: Fri Feb 8 11:24:07 2019 +0100
Commit: László Németh 
CommitDate: Tue Feb 12 10:15:27 2019 +0100

tdf#16 OOXML Chart Import: data label new line separator

Set the data label separator to "new line" if there is not
present explicit point separator, just like in MS Office.

Change-Id: I9ee0fb9f98fc1bb322892616af50954f4f8db0f9
Reviewed-on: https://gerrit.libreoffice.org/67533
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index f4f87734f27c..0d8eda002a3b 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -105,6 +105,7 @@ public:
 void testTdf109858(); // Pie chart label placement settings(XLSX)
 
 void testTdf73();
+void testTdf16();
 
 void testInternalDataProvider();
 
@@ -180,6 +181,7 @@ public:
 CPPUNIT_TEST(testTdf90510);
 CPPUNIT_TEST(testTdf109858);
 CPPUNIT_TEST(testTdf73);
+CPPUNIT_TEST(testTdf16);
 
 CPPUNIT_TEST(testInternalDataProvider);
 
@@ -1447,6 +1449,24 @@ void Chart2ImportTest::testTdf73()
 uno::Reference< chart::XChartDocument > xChart1Doc( getChartCompFromSheet( 
0, mxComponent ), UNO_QUERY_THROW );
 }
 
+void Chart2ImportTest::testTdf16()
+{
+load( "/chart2/qa/extras/data/docx/", "testTdf16.docx" );
+uno::Reference< chart2::XChartDocument > xChartDoc ( 
getChartDocFromWriter(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT( xChartDoc.is() );
+
+css::uno::Reference 
xDiagram(xChartDoc->getFirstDiagram(), UNO_QUERY_THROW);
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+uno::Reference 
xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT(xPropertySet.is());
+
+uno::Any aAny = xPropertySet->getPropertyValue( "LabelSeparator" );
+CPPUNIT_ASSERT( aAny.hasValue() );
+OUString nLabelSeparator;
+CPPUNIT_ASSERT( aAny >>= nLabelSeparator );
+CPPUNIT_ASSERT_EQUAL_MESSAGE( "Data labels should be separated into new 
lines", OUString("\n"), nLabelSeparator );
+}
+
 void Chart2ImportTest::testTdf115107()
 {
 load("/chart2/qa/extras/data/pptx/", "tdf115107.pptx");
diff --git a/chart2/qa/extras/data/docx/testTdf16.docx 
b/chart2/qa/extras/data/docx/testTdf16.docx
new file mode 100755
index ..7205525a7615
Binary files /dev/null and b/chart2/qa/extras/data/docx/testTdf16.docx 
differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 716a0b234bdd..8fd572d98faf 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -183,7 +183,7 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, 
ObjectFormatter& rFormatt
 
 // data label separator (do not overwrite series separator, if no 
explicit point separator is present)
 if( bDataSeriesLabel || rDataLabel.moaSeparator.has() )
-rPropSet.setProperty( PROP_LabelSeparator, 
rDataLabel.moaSeparator.get( "; " ) );
+rPropSet.setProperty( PROP_LabelSeparator, 
rDataLabel.moaSeparator.get( "\n" ) );
 
 // data label placement (do not overwrite series placement, if no 
explicit point placement is present)
 if( bDataSeriesLabel || rDataLabel.monLabelPos.has() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-01-30 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2export.cxx |   16 +++-
 chart2/qa/extras/data/xlsx/tdf122915.xlsx |binary
 oox/source/export/chartexport.cxx |2 +-
 3 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 2eac095e2a672db180dc816350c1585a65245c7c
Author: Balazs Varga 
AuthorDate: Mon Jan 28 10:09:51 2019 +0100
Commit: László Németh 
CommitDate: Wed Jan 30 09:10:17 2019 +0100

tdf#122915 Chart OOXML: Export individual data label prop

Export the xLabelPropSet instead of the xPropset and the
individual data label formatting will not be disappeared.

Change-Id: Ic8c64543ad1e8b40d6d6a5cb7a9a244923e028f1
Reviewed-on: https://gerrit.libreoffice.org/66995
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index e01ce9381ef9..dc36c3ad3c29 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -82,6 +82,7 @@ public:
 void testDataLabelDoughnutChartDOCX();
 void testDataLabelAreaChartDOCX();
 void testDataLabelDefaultLineChartDOCX();
+void testIndividualDataLabelProps();
 void testChartTitlePropertiesColorFillDOCX();
 void testChartTitlePropertiesGradientFillDOCX();
 void testChartTitlePropertiesBitmapFillDOCX();
@@ -170,6 +171,7 @@ public:
 CPPUNIT_TEST(testDataLabelDoughnutChartDOCX);
 CPPUNIT_TEST(testDataLabelAreaChartDOCX);
 CPPUNIT_TEST(testDataLabelDefaultLineChartDOCX);
+CPPUNIT_TEST(testIndividualDataLabelProps);
 CPPUNIT_TEST(testChartTitlePropertiesColorFillDOCX);
 CPPUNIT_TEST(testChartTitlePropertiesGradientFillDOCX);
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillDOCX);
@@ -1094,6 +1096,17 @@ void 
Chart2ExportTest::testDataLabelDefaultLineChartDOCX()
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Line chart's default label placement 
should be 'right'.", chart::DataLabelPlacement::RIGHT, nLabelPlacement );
 }
 
+void Chart2ExportTest::testIndividualDataLabelProps()
+{
+load("/chart2/qa/extras/data/xlsx/", "tdf122915.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr",
 "b", "1");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr",
 "sz", "1600");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr",
 "val", "ff");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr/a:latin",
 "typeface", "Times New Roman");
+}
+
 void Chart2ExportTest::testChartTitlePropertiesColorFillDOCX()
 {
 load("/chart2/qa/extras/data/docx/", 
"testChartTitlePropertiesColorFill.docx");
@@ -1736,7 +1749,8 @@ void Chart2ExportTest::testCustomDataLabel()
 load("/chart2/qa/extras/data/pptx/", "tdf115107.pptx");
 xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart1", "Impress MS 
PowerPoint 2007 XML");
 CPPUNIT_ASSERT(pXmlDoc);
-assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr",
 "val", "404040");
+// Check the data labels font color for the complete data series
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr",
 "val", "404040");
 
 Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
 CPPUNIT_ASSERT(xChartDoc.is());
diff --git a/chart2/qa/extras/data/xlsx/tdf122915.xlsx 
b/chart2/qa/extras/data/xlsx/tdf122915.xlsx
new file mode 100755
index ..ff20e04baf22
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf122915.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 5e09117183f0..cd344de5ab21 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3247,7 +3247,7 @@ void ChartExport::exportDataLabels(
 }
 
 // Individual label property that overwrites the baseline.
-exportTextProps( xPropSet );
+exportTextProps( xLabelPropSet );
 writeLabelProperties(pFS, this, xLabelPropSet, aParam);
 pFS->endElement(FSNS(XML_c, XML_dLbl));
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-18 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2export.cxx   |   12 
 chart2/qa/extras/data/xlsx/xAxisLabelsRotation.xlsx |binary
 oox/source/export/chartexport.cxx   |   14 +-
 3 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 527772d8dfcedad56b11b5b13540ec1defa464e5
Author: Balazs Varga 
AuthorDate: Sat Dec 15 10:06:03 2018 +0100
Commit: Bartosz Kosiorek 
CommitDate: Tue Dec 18 16:53:24 2018 +0100

tdf#122090 Chart: Fix OOXML export of X axis labels rotation

The MS Office UI allows values only in range of [-90,90].
Because of this, we should reflect the angle if the Textrotation
is between 90 and 270 degree. Also we have to recalculated the
the Textrotation between 270 and 360 degree, because the OOXML
counts clockwise.

Change-Id: I2fbd53d93ab2e8ea4e26840fd056de20b337daa3
Reviewed-on: https://gerrit.libreoffice.org/65194
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 7ed7e6afaee9..5bf1e730f93c 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -120,6 +120,7 @@ public:
 void testChartTitlePropertiesColorFillPPTX();
 void testChartTitlePropertiesGradientFillPPTX();
 void testChartTitlePropertiesBitmapFillPPTX();
+void testxAxisLabelsRotation();
 void testTdf116163();
 void testTdf119029();
 void testTdf108022();
@@ -206,6 +207,7 @@ public:
 CPPUNIT_TEST(testChartTitlePropertiesColorFillPPTX);
 CPPUNIT_TEST(testChartTitlePropertiesGradientFillPPTX);
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillPPTX);
+CPPUNIT_TEST(testxAxisLabelsRotation);
 CPPUNIT_TEST(testTdf116163);
 CPPUNIT_TEST(testTdf119029);
 CPPUNIT_TEST(testTdf108022);
@@ -1920,6 +1922,16 @@ void 
Chart2ExportTest::testChartTitlePropertiesBitmapFillPPTX()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 
1);
 }
 
+void Chart2ExportTest::testxAxisLabelsRotation()
+{
+load ("/chart2/qa/extras/data/xlsx/", "xAxisLabelsRotation.xlsx");
+xmlDocPtr pXmlDoc1 = parseExport("xl/charts/chart","Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc1);
+
+// Chart1 xAxis labels should be 45 degree
+assertXPath(pXmlDoc1, 
"/c:chartSpace/c:chart/c:plotArea/c:catAx/c:txPr/a:bodyPr", "rot", "270");
+}
+
 void Chart2ExportTest::testTdf116163()
 {
 load("/chart2/qa/extras/data/pptx/", "tdf116163.pptx");
diff --git a/chart2/qa/extras/data/xlsx/xAxisLabelsRotation.xlsx 
b/chart2/qa/extras/data/xlsx/xAxisLabelsRotation.xlsx
new file mode 100755
index ..cf511dfaf2d7
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/xAxisLabelsRotation.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index ce3c6984ad40..00b631688b14 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2366,10 +2366,22 @@ void ChartExport::exportTextProps(const 
Reference& xPropSet)
 
 if (fMultiplier)
 {
-double fTextRotation = 0;
+double fTextRotation = 0.0;
 uno::Any aAny = xPropSet->getPropertyValue("TextRotation");
 if (aAny.hasValue() && (aAny >>= fTextRotation))
+{
+// The MS Office UI allows values only in range of [-90,90].
+if (fTextRotation > 9000.0 && fTextRotation < 27000.0)
+{
+// Reflect the angle if the value is between 90° and 270°
+fTextRotation -= 18000.0;
+}
+else if (fTextRotation >=27000.0)
+{
+fTextRotation -= 36000.0;
+}
 nRotation = std::round(fTextRotation * fMultiplier);
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-16 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2import.cxx |   19 ++
 chart2/qa/extras/charttest.hxx|   27 ++
 chart2/qa/extras/data/docx/testTdf114179.docx |binary
 oox/source/drawingml/chart/converterbase.cxx  |8 ++-
 4 files changed, 53 insertions(+), 1 deletion(-)

New commits:
commit 26caf1bc59c81704f11225e3e431e412deb8c475
Author: Jozsef Szakacs 
AuthorDate: Wed Nov 7 09:52:17 2018 +0100
Commit: Bartosz Kosiorek 
CommitDate: Fri Nov 16 18:31:03 2018 +0100

tdf#114179: Custom size and position of the chart wall

By Xlsx files, rChartSize is using the Values that it gets from 
getChartSize(), this is the
same Size as rPageSize. By Docx files rChartSize was a negative number 
everytime,
so the calcAbsRectangle Method gave back a 'false' Value because of this. 
The rPageSize shows
at every Debugging, Width = 16000, and Height = 9000 for Docx files, and 
beacause rChartSize was
equal to rPageSize by Xlsx, I tried rChartSize with this Fixed Size.

Change-Id: Ia29fa3401475c33c1b5e3dde9c3cb030a02cceb4
Reviewed-on: https://gerrit.libreoffice.org/62991
Reviewed-by: Bartosz Kosiorek 
Tested-by: Bartosz Kosiorek 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index e478dbb66803..f9d5343c0317 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -111,8 +111,11 @@ public:
 void testTdf115107_2(); // import complex data point labels in cobo charts 
with multiple data series
 
 void testTdf116163();
+
 void testTdf121205();
 
+void testTdf114179();
+
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
 CPPUNIT_TEST(testSteppedLines);
@@ -177,8 +180,11 @@ public:
 CPPUNIT_TEST(testTdf115107_2);
 
 CPPUNIT_TEST(testTdf116163);
+
 CPPUNIT_TEST(testTdf121205);
 
+CPPUNIT_TEST(testTdf114179);
+
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1598,6 +1604,19 @@ void Chart2ImportTest::testTdf121205()
 CPPUNIT_ASSERT_EQUAL(OUString("Firstline\nSecondline\nThirdline"), aTitle);
 }
 
+void Chart2ImportTest::testTdf114179()
+{
+load( "/chart2/qa/extras/data/docx/", "testTdf114179.docx" );
+uno::Reference< chart2::XChartDocument > xChartDoc ( 
getChartDocFromWriter(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT( xChartDoc.is() );
+css::uno::Reference xDiagram;
+xDiagram.set( xChartDoc->getFirstDiagram() );
+CPPUNIT_ASSERT_MESSAGE( "There is a Diagram." , xDiagram.is() );
+awt::Size aPage = getPageSize( xChartDoc );
+awt::Size aSize = getSize( xDiagram,aPage );
+CPPUNIT_ASSERT( aSize.Width > 0);
+CPPUNIT_ASSERT( aSize.Height > 0);
+}
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 202475e7e4ca..84cea90845c3 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -65,6 +65,9 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
 
 using namespace css;
 using namespace css::uno;
@@ -84,6 +87,8 @@ public:
 uno::Reference getChartDocFromDrawImpress( 
sal_Int32 nPage, sal_Int32 nShape );
 
 uno::Reference getChartDocFromWriter( sal_Int32 
nShape );
+awt::Size getPageSize( const Reference< chart2::XChartDocument > & 
xChartDoc );
+awt::Size getSize(css::uno::Reference xDiagram, const 
awt::Size& rPageSize);
 
 virtual void setUp() override;
 virtual void tearDown() override;
@@ -590,6 +595,28 @@ sal_Int16 getNumberFormatType( const 
Reference& xChartDo
 return nType;
 }
 
+awt::Size ChartTest::getPageSize( const Reference< chart2::XChartDocument > & 
xChartDoc )
+{
+awt::Size aSize( 0, 0 );
+uno::Reference< com::sun::star::embed::XVisualObject > xVisualObject( 
xChartDoc, uno::UNO_QUERY );
+CPPUNIT_ASSERT( xVisualObject.is() );
+aSize = xVisualObject->getVisualAreaSize( 
com::sun::star::embed::Aspects::MSOLE_CONTENT );
+return aSize;
+}
+
+awt::Size ChartTest::getSize(css::uno::Reference xDiagram, 
const awt::Size& rPageSize)
+{
+Reference< beans::XPropertySet > xProp(xDiagram, uno::UNO_QUERY);
+chart2::RelativeSize aRelativeSize;
+xProp->getPropertyValue( "RelativeSize" ) >>= aRelativeSize;
+double fX = aRelativeSize.Primary * rPageSize.Width;
+double fY = aRelativeSize.Secondary * rPageSize.Height;
+awt::Size aSize;
+aSize.Width = static_cast< sal_Int32 >( ::rtl::math::round( fX ) );
+aSize.Height = static_cast< sal_Int32 >( ::rtl::math::round( fY ) );
+return aSize;
+}
+
 #endif // INCLUDED_CHART2_QA_EXTRAS_CHARTTEST_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/qa/extras/data/docx/testTdf114179.docx 
b/chart2/qa/extras/data/docx/testTdf114179.docx
new file mode 100644
index ..36fb11e170f7
Binary files /dev/null and b/chart2/qa/extras/data/docx/testTdf114179.docx 
differ
diff --git 

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

2018-10-09 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2export.cxx   |   10 ++
 chart2/qa/extras/data/odt/testPieChartWallLineStyle.odt |binary
 oox/source/export/chartexport.cxx   |   11 +++
 3 files changed, 21 insertions(+)

New commits:
commit a1d4c2419097169cb2d51f7c11d90073766f6d9d
Author: Balazs Varga 
AuthorDate: Mon Oct 8 19:31:38 2018 +0200
Commit: László Németh 
CommitDate: Tue Oct 9 09:27:56 2018 +0200

tdf#120341 OOXML export: fix export of Pie Chart Wall Borderline

Export LineStyle_NONE instead of default linestyle of PlotArea border,
because LibreOffice make invisible the Wall shape properties in case of
PIE/NET/FILLED_NET charts. Or other solution in the future is set the
default LineStyle of these charts to LineStyle_NONE.

Change-Id: I59e6f18058713f4a0d4c77da8760a319f9c25152
Reviewed-on: https://gerrit.libreoffice.org/61547
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index d170510e2294..c6efff2eaaa0 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -57,6 +57,7 @@ public:
 void testDisplayUnits();
 // void testFdo74115WallGradientFill();
 void testFdo74115WallBitmapFill();
+void testPieChartWallLineStyle();
 void testBarChartRotation();
 void testShapeFollowedByChart();
 void testPieChartDataLabels();
@@ -140,6 +141,7 @@ public:
 CPPUNIT_TEST(testDisplayUnits);
 // CPPUNIT_TEST(testFdo74115WallGradientFill);
 CPPUNIT_TEST(testFdo74115WallBitmapFill);
+CPPUNIT_TEST(testPieChartWallLineStyle);
 CPPUNIT_TEST(testBarChartRotation);
 CPPUNIT_TEST(testShapeFollowedByChart);
 CPPUNIT_TEST(testPieChartDataLabels);
@@ -712,6 +714,14 @@ void Chart2ExportTest::testFdo74115WallBitmapFill()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:blipFill");
 }
 
+void Chart2ExportTest::testPieChartWallLineStyle()
+{
+load("/chart2/qa/extras/data/odt/", "testPieChartWallLineStyle.odt");
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:spPr/a:ln/a:noFill");
+}
+
 //The below test case tests the built in marker 'x' for Office 2010 in Line 
charts
 
 void Chart2ExportTest::testFdo78290LineChartMarkerX()
diff --git a/chart2/qa/extras/data/odt/testPieChartWallLineStyle.odt 
b/chart2/qa/extras/data/odt/testPieChartWallLineStyle.odt
new file mode 100644
index ..0e1ab533b15a
Binary files /dev/null and 
b/chart2/qa/extras/data/odt/testPieChartWallLineStyle.odt differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 63958cdb3f7a..ded91c2b47d1 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -75,6 +75,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1178,6 +1179,16 @@ void ChartExport::exportPlotArea( const Reference< 
css::chart::XChartDocument >&
 Reference< beans::XPropertySet > xWallPropSet( 
xWallFloorSupplier->getWall(), uno::UNO_QUERY );
 if( xWallPropSet.is() )
 {
+uno::Any aAny = xWallPropSet->getPropertyValue("LineStyle");
+sal_Int32 eChartType = getChartType( );
+// Export LineStyle_NONE instead of default linestyle of PlotArea 
border, because LibreOffice
+// make invisible the Wall shape properties, in case of these 
charts. Or in the future set
+// the default LineStyle of these charts to LineStyle_NONE.
+bool noSupportWallProp = ( (eChartType == chart::TYPEID_PIE) || 
(eChartType == chart::TYPEID_RADARLINE) || (eChartType == 
chart::TYPEID_RADARAREA) );
+if ( noSupportWallProp && (aAny != drawing::LineStyle_NONE) )
+{
+xWallPropSet->setPropertyValue( "LineStyle", 
uno::Any(drawing::LineStyle_NONE) );
+}
 exportShapeProps( xWallPropSet );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-23 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2export.cxx |   23 
++
 chart2/qa/extras/data/xlsx/testDataseriesOverlapStackedChart.xlsx |binary
 oox/source/export/chartexport.cxx |   17 
++-
 3 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit 17c2b0af97f73b9103be982b15d7111b3980e027
Author: Balazs Varga 
AuthorDate: Wed Aug 22 11:15:45 2018 +0200
Commit: Markus Mohrhard 
CommitDate: Thu Aug 23 13:45:58 2018 +0200

tdf#94502 Fix overlap export of Stacked Bar Chart to *.xlsx

Export the Overlap value with 100% for stacked charts, because the
default overlap value of the Bar/Column chart is 0% and LibreOffice
do nothing with the overlap value in Stacked Chart case, unlike the
MS Office.

Change-Id: If4e20b88c2b1180f68a8d2b610c407d674a8498b
Reviewed-on: https://gerrit.libreoffice.org/59448
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index cb9b40482aa6..d170510e2294 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -104,6 +104,7 @@ public:
 void testChartTitlePropertiesGradientFillXLSX();
 void testChartTitlePropertiesBitmapFillXLSX();
 void testBarChartDataPointPropXLSX();
+void testDataseriesOverlapStackedChartXLSX();
 void testAxisCharacterPropertiesXLSX();
 void testTitleCharacterPropertiesXLSX();
 void testPlotVisOnlyXLSX();
@@ -186,6 +187,7 @@ public:
 CPPUNIT_TEST(testChartTitlePropertiesGradientFillXLSX);
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillXLSX);
 CPPUNIT_TEST(testBarChartDataPointPropXLSX);
+CPPUNIT_TEST(testDataseriesOverlapStackedChartXLSX);
 CPPUNIT_TEST(testAxisCharacterPropertiesXLSX);
 CPPUNIT_TEST(testTitleCharacterPropertiesXLSX);
 CPPUNIT_TEST(testPlotVisOnlyXLSX);
@@ -1603,6 +1605,27 @@ void Chart2ExportTest::testBarChartDataPointPropXLSX()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[2]/c:spPr/a:ln/a:solidFill/a:srgbClr",
 "val", "70ad47");
 }
 
+void Chart2ExportTest::testDataseriesOverlapStackedChartXLSX()
+{
+load("/chart2/qa/extras/data/xlsx/", 
"testDataseriesOverlapStackedChart.xlsx");
+
+// test the overlap value of a simple Stacked Column Chart
+uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 
0, mxComponent );
+checkSheetForGapWidthAndOverlap(xChartDoc, 100, 0);
+
+// test the overlap value of a Percent Stacked Bar Chart
+xChartDoc = getChartDocFromSheet( 1, mxComponent );
+checkSheetForGapWidthAndOverlap(xChartDoc, 100, 35);
+
+reload("Calc Office Open XML");
+
+xChartDoc = getChartDocFromSheet( 0, mxComponent );
+checkSheetForGapWidthAndOverlap(xChartDoc, 100, 100);
+
+xChartDoc = getChartDocFromSheet( 1, mxComponent );
+checkSheetForGapWidthAndOverlap(xChartDoc, 100, 100);
+}
+
 void Chart2ExportTest::testAxisCharacterPropertiesXLSX()
 {
 load("/chart2/qa/extras/data/xlsx/", "axis_character_properties.xlsx");
diff --git a/chart2/qa/extras/data/xlsx/testDataseriesOverlapStackedChart.xlsx 
b/chart2/qa/extras/data/xlsx/testDataseriesOverlapStackedChart.xlsx
new file mode 100755
index ..ba1c526b41ca
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/testDataseriesOverlapStackedChart.xlsx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 654ffdbfb008..97adab7f5b00 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1498,9 +1498,24 @@ void ChartExport::exportBarChart( const Reference< 
chart2::XChartType >& xChartT
 if( aBarPositionSequence.getLength() )
 {
 sal_Int32 nOverlap = aBarPositionSequence[0];
-pFS->singleElement( FSNS( XML_c, XML_overlap ),
+// Stacked/Percent Bar/Column chart Overlap-workaround
+// Export the Overlap value with 100% for stacked charts,
+// because the default overlap value of the Bar/Column chart is 0% 
and
+// LibreOffice do nothing with the overlap value in Stacked charts 
case,
+// unlike the MS Office, which is interpreted differently.
+if( ( mbStacked || mbPercent ) && nOverlap != 100 )
+{
+nOverlap = 100;
+pFS->singleElement( FSNS( XML_c, XML_overlap ),
+XML_val, I32S( nOverlap ),
+FSEND );
+}
+else // Normal bar chart
+{
+pFS->singleElement( FSNS( XML_c, XML_overlap ),
 XML_val, I32S( nOverlap ),
 FSEND );
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-09 Thread Libreoffice Gerrit user
 chart2/qa/extras/chart2export.cxx |   40 +++
 chart2/qa/extras/data/docx/testBarChartDataPointPropDOCX.docx |binary
 chart2/qa/extras/data/xlsx/testBarChartDataPointPropXLSX.xlsx |binary
 oox/source/export/chartexport.cxx |   51 ++
 4 files changed, 91 insertions(+)

New commits:
commit c958f52b813d34baa9b5236bb34a08a04e6b0aba
Author: Balazs Varga 
AuthorDate: Thu Aug 9 00:06:47 2018 +0200
Commit: Bartosz Kosiorek 
CommitDate: Fri Aug 10 07:05:30 2018 +0200

tdf#96469 Export Data Point properties in Charts on DOCX/XLSX

If the color or other property of a datapoint in the chart
deviates from the dataseries property, this patch will write it
into a separate dPt tag and fixing the lost properies during
OOXML export.

Change-Id: I3d975675ac3691fcafe76de16e46851561eb2807
Reviewed-on: https://gerrit.libreoffice.org/58752
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 5da6eac373bb..cb9b40482aa6 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -85,6 +85,7 @@ public:
 void testChartTitlePropertiesColorFillDOCX();
 void testChartTitlePropertiesGradientFillDOCX();
 void testChartTitlePropertiesBitmapFillDOCX();
+void testBarChartDataPointPropDOCX();
 void testFdo83058dlblPos();
 void testAutoTitleDelXLSX();
 void testDispBlanksAsXLSX();
@@ -102,6 +103,7 @@ public:
 void testChartTitlePropertiesColorFillXLSX();
 void testChartTitlePropertiesGradientFillXLSX();
 void testChartTitlePropertiesBitmapFillXLSX();
+void testBarChartDataPointPropXLSX();
 void testAxisCharacterPropertiesXLSX();
 void testTitleCharacterPropertiesXLSX();
 void testPlotVisOnlyXLSX();
@@ -165,6 +167,7 @@ public:
 CPPUNIT_TEST(testChartTitlePropertiesColorFillDOCX);
 CPPUNIT_TEST(testChartTitlePropertiesGradientFillDOCX);
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillDOCX);
+CPPUNIT_TEST(testBarChartDataPointPropDOCX);
 CPPUNIT_TEST(testFdo83058dlblPos);
 CPPUNIT_TEST(testAutoTitleDelXLSX);
 CPPUNIT_TEST(testDispBlanksAsXLSX);
@@ -182,6 +185,7 @@ public:
 CPPUNIT_TEST(testChartTitlePropertiesColorFillXLSX);
 CPPUNIT_TEST(testChartTitlePropertiesGradientFillXLSX);
 CPPUNIT_TEST(testChartTitlePropertiesBitmapFillXLSX);
+CPPUNIT_TEST(testBarChartDataPointPropXLSX);
 CPPUNIT_TEST(testAxisCharacterPropertiesXLSX);
 CPPUNIT_TEST(testTitleCharacterPropertiesXLSX);
 CPPUNIT_TEST(testPlotVisOnlyXLSX);
@@ -1099,6 +1103,24 @@ void 
Chart2ExportTest::testChartTitlePropertiesBitmapFillDOCX()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 
1);
 }
 
+void Chart2ExportTest::testBarChartDataPointPropDOCX()
+{
+load("/chart2/qa/extras/data/docx/", "testBarChartDataPointPropDOCX.docx");
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:varyColors", "val", "0");
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[1]/c:idx", "val", "1");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[1]/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr",
 "val", "f6f8fc");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[1]/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr",
 "val", "c7d5ed");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[1]/c:spPr/a:ln/a:solidFill/a:srgbClr",
 "val", "70ad47");
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[2]/c:idx", "val", "2");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[2]/c:spPr/a:solidFill/a:srgbClr",
 "val", "ff");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[2]/c:spPr/a:ln/a:solidFill/a:srgbClr",
 "val", "00");
+}
+
 void Chart2ExportTest::testBarChartRotation()
 {
 load ("/chart2/qa/extras/data/docx/", "barChartRotation.docx");
@@ -1563,6 +1585,24 @@ void 
Chart2ExportTest::testChartTitlePropertiesBitmapFillXLSX()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 
1);
 }
 
+void Chart2ExportTest::testBarChartDataPointPropXLSX()
+{
+load("/chart2/qa/extras/data/xlsx/", "testBarChartDataPointPropXLSX.xlsx");
+xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:varyColors", "val", "0");
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt[1]/c:idx", "val", "1");
+assertXPath(pXmlDoc, 

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

2018-06-29 Thread Justin Luth
 chart2/qa/extras/chart2export.cxx |1 +
 oox/source/export/chartexport.cxx |2 ++
 2 files changed, 3 insertions(+)

New commits:
commit ae2fd281e046b2199ef44777b84518cd3abb2952
Author: Justin Luth 
Date:   Thu Jun 28 21:21:29 2018 +0300

tdf#115945 oox export: data label writeRunProperties

DataLabel font was always returning to the default - black.

Change-Id: I6c72a8daa699394b36f69fc54e0ba042f0255c18
Reviewed-on: https://gerrit.libreoffice.org/56616
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Szymon Kłos 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 8ed59e43cf84..2a0d7e5df1c4 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -1580,6 +1580,7 @@ void Chart2ExportTest::testCustomDataLabel()
 load("/chart2/qa/extras/data/pptx/", "tdf115107.pptx");
 xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart1", "Impress MS 
PowerPoint 2007 XML");
 CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr",
 "val", "404040");
 
 Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
 CPPUNIT_ASSERT(xChartDoc.is());
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index c6f30fb5600a..5af781a8ae26 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3178,10 +3178,12 @@ void ChartExport::exportDataLabels(
 // Individual label property that overwrites the baseline.
 pFS->startElement(FSNS(XML_c, XML_dLbl), FSEND);
 pFS->singleElement(FSNS(XML_c, XML_idx), XML_val, I32S(nIdx), FSEND);
+exportTextProps( xPropSet );
 writeLabelProperties(pFS, this, xLabelPropSet, aParam);
 pFS->endElement(FSNS(XML_c, XML_dLbl));
 }
 
+exportTextProps( xPropSet );
 // Baseline label properties for all labels.
 writeLabelProperties(pFS, this, xPropSet, aParam);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-02-28 Thread Szymon Kłos
 chart2/qa/extras/chart2export.cxx |   12 
 chart2/qa/extras/data/pptx/tdf115859.pptx |binary
 oox/source/export/chartexport.cxx |   18 ++
 3 files changed, 30 insertions(+)

New commits:
commit 235fcab47a8dc1e9b0e06a95a77a8c1d440aa619
Author: Szymon Kłos 
Date:   Mon Feb 19 18:18:20 2018 +0100

tdf#115859 Export number format for chart series

Change-Id: I65d30c6b92a530eadbd6fabe87fa8bd3416fee20
Reviewed-on: https://gerrit.libreoffice.org/50385
Tested-by: Jenkins 
Reviewed-by: Andras Timar 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 618a5b877af7..9f5efb140036 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -106,6 +106,7 @@ public:
 void testPieChartDataPointExplosionXLSX();
 void testCustomDataLabel();
 void testCustomDataLabelMultipleSeries();
+void testNumberFormatExportPPTX();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -174,6 +175,7 @@ public:
 CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
 CPPUNIT_TEST(testCustomDataLabel);
 CPPUNIT_TEST(testCustomDataLabelMultipleSeries);
+CPPUNIT_TEST(testNumberFormatExportPPTX);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -1731,6 +1733,16 @@ void 
Chart2ExportTest::testCustomDataLabelMultipleSeries()
 
 }
 
+void Chart2ExportTest::testNumberFormatExportPPTX()
+{
+load("/chart2/qa/extras/data/pptx/", "tdf115859.pptx");
+xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 
2007 XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", 
"formatCode", "#,##0.00,\\K");
+assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", 
"sourceLinked", "0");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/pptx/tdf115859.pptx 
b/chart2/qa/extras/data/pptx/tdf115859.pptx
new file mode 100644
index ..07943041bed8
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf115859.pptx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 19d2908edebe..81ed22c57996 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3093,6 +3093,24 @@ void ChartExport::exportDataLabels(
 FSHelperPtr pFS = GetFS();
 pFS->startElement(FSNS(XML_c, XML_dLbls), FSEND);
 
+bool bLinkedNumFmt = true;
+if (GetProperty(xPropSet, "LinkNumberFormatToSource"))
+mAny >>= bLinkedNumFmt;
+
+if (GetProperty(xPropSet, "NumberFormat"))
+{
+sal_Int32 nKey = 0;
+mAny >>= nKey;
+
+OUString aNumberFormatString = getNumberFormatCode(nKey);
+OString sNumberFormatString = OUStringToOString(aNumberFormatString, 
RTL_TEXTENCODING_UTF8);
+
+pFS->singleElement(FSNS(XML_c, XML_numFmt),
+XML_formatCode, sNumberFormatString.getStr(),
+XML_sourceLinked, bLinkedNumFmt ? "1" : "0",
+FSEND);
+}
+
 uno::Sequence aAttrLabelIndices;
 xPropSet->getPropertyValue("AttributedDataPoints") >>= aAttrLabelIndices;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-29 Thread Szymon Kłos
 chart2/qa/extras/chart2export.cxx |  159 ++
 oox/source/export/chartexport.cxx |  107 -
 2 files changed, 262 insertions(+), 4 deletions(-)

New commits:
commit bad41c8fe40e88e416631d61437e6abe5d00131d
Author: Szymon Kłos 
Date:   Sat Jan 27 20:29:38 2018 +0100

tdf#114821 export complex data labels in charts

Change-Id: I9b0893dfde4efc10bb05e6e17b7128b016efeb71
Reviewed-on: https://gerrit.libreoffice.org/48788
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index deedbc0bee7f..618a5b877af7 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -13,6 +13,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -102,6 +104,8 @@ public:
 void testAxisTitleRotationXLSX();
 void testAxisCrossBetweenXSLX();
 void testPieChartDataPointExplosionXLSX();
+void testCustomDataLabel();
+void testCustomDataLabelMultipleSeries();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -168,6 +172,8 @@ public:
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
 CPPUNIT_TEST(testAxisCrossBetweenXSLX);
 CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
+CPPUNIT_TEST(testCustomDataLabel);
+CPPUNIT_TEST(testCustomDataLabelMultipleSeries);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -1572,6 +1578,159 @@ void 
Chart2ExportTest::testPieChartDataPointExplosionXLSX()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dPt/c:explosion", "val", 
"28");
 }
 
+void Chart2ExportTest::testCustomDataLabel()
+{
+load("/chart2/qa/extras/data/pptx/", "tdf115107.pptx");
+xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart1", "Impress MS 
PowerPoint 2007 XML");
+CPPUNIT_ASSERT(pXmlDoc);
+
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+uno::Reference 
xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+CPPUNIT_ASSERT(xDataSeries.is());
+float nFontSize;
+sal_Int64 nFontColor;
+sal_Int32 nCharUnderline;
+uno::Reference xPropertySet;
+uno::Sequence aFields;
+
+// 1
+xPropertySet.set(xDataSeries->getDataPointByIndex(0), 
uno::UNO_QUERY_THROW);
+xPropertySet->getPropertyValue("CustomLabelFields") >>= aFields;
+CPPUNIT_ASSERT_EQUAL(static_cast(2), aFields.getLength());
+
+
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
 aFields[0]->getFieldType());
+CPPUNIT_ASSERT_EQUAL(OUString("90.0 = "), aFields[0]->getString());
+aFields[0]->getPropertyValue("CharHeight") >>= nFontSize;
+aFields[0]->getPropertyValue("CharColor") >>= nFontColor;
+CPPUNIT_ASSERT_EQUAL(static_cast(18), nFontSize);
+CPPUNIT_ASSERT_EQUAL(static_cast(0xed7d31), nFontColor);
+
+
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_VALUE,
 aFields[1]->getFieldType());
+CPPUNIT_ASSERT_EQUAL(OUString("90"), aFields[1]->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("{0C576297-5A9F-4B4E-A675-B6BA406B7D87}"), 
aFields[1]->getGuid());
+
+// 2
+xPropertySet.set(xDataSeries->getDataPointByIndex(1), 
uno::UNO_QUERY_THROW);
+xPropertySet->getPropertyValue("CustomLabelFields") >>= aFields;
+CPPUNIT_ASSERT_EQUAL(static_cast(8), aFields.getLength());
+
+
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
 aFields[0]->getFieldType());
+CPPUNIT_ASSERT_EQUAL(OUString("Text"), aFields[0]->getString());
+
+
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
 aFields[1]->getFieldType());
+CPPUNIT_ASSERT_EQUAL(OUString(" : "), aFields[1]->getString());
+
+
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CATEGORYNAME,
 aFields[2]->getFieldType());
+CPPUNIT_ASSERT_EQUAL(OUString("B"), aFields[2]->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("{0CCAAACD-B393-42CE-8DBD-82F9F9ADC852}"), 
aFields[2]->getGuid());
+aFields[2]->getPropertyValue("CharHeight") >>= nFontSize;
+aFields[2]->getPropertyValue("CharColor") >>= nFontColor;
+CPPUNIT_ASSERT_EQUAL(static_cast(16), nFontSize);
+CPPUNIT_ASSERT_EQUAL(static_cast(0xed7d31), nFontColor);
+
+
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE,
 aFields[3]->getFieldType());
+
+
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
 aFields[4]->getFieldType());
+CPPUNIT_ASSERT_EQUAL(OUString("Multi"), aFields[4]->getString());
+
+
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
 

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

2017-12-19 Thread Aron Budea
 chart2/qa/extras/chart2import.cxx |   30 ++
 chart2/qa/extras/data/pptx/tdf105517.pptx |binary
 oox/source/drawingml/clrscheme.cxx|6 +-
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 021081823aeebcfa395662d0c04535a243977c2e
Author: Aron Budea 
Date:   Fri Nov 3 02:08:00 2017 +0100

tdf#105517: overwrite existing scheme colors in vector

Theme overrides stopped working once ClrScheme::maClrScheme was
changed to vector, and colors were always appended to it.

Regression from f3121049828596b369e3ea844355d61666e49795.

Change-Id: Iae850dcabf57b12d8a564e84acf38d9988cfe963
Reviewed-on: https://gerrit.libreoffice.org/44242
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 9b95105640f8..a49e80e1b867 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -62,6 +62,7 @@ public:
 void testFdo54361();
 void testFdo54361_1();
 void testTdf86624(); // manually placed legends
+void testTdf105517();
 void testTdf106217();
 void testAutoBackgroundXLSX();
 void testChartAreaStyleBackgroundXLSX();
@@ -129,6 +130,7 @@ public:
 CPPUNIT_TEST(testFdo54361);
 CPPUNIT_TEST(testFdo54361_1);
 CPPUNIT_TEST(testTdf86624);
+CPPUNIT_TEST(testTdf105517);
 CPPUNIT_TEST(testTdf106217);
 CPPUNIT_TEST(testAutoBackgroundXLSX);
 CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX);
@@ -747,6 +749,34 @@ void Chart2ImportTest::testTdf86624()
 CPPUNIT_ASSERT(aPos.Y > 4000); // real value for ms is above 7000
 }
 
+void Chart2ImportTest::testTdf105517()
+{
+load("/chart2/qa/extras/data/pptx/", "tdf105517.pptx");
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+Reference 
xCoordContainer(xChartDoc->getFirstDiagram(), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xCoordContainer.is());
+Reference 
xChartTypeContainer(xCoordContainer->getCoordinateSystems()[0], uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartTypeContainer.is());
+Reference 
xDSContainer(xChartTypeContainer->getChartTypes()[0], uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDSContainer.is());
+Reference xPropSet1(xDSContainer->getDataSeries()[0], 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPropSet1.is());
+
+long lineColor;
+xPropSet1->getPropertyValue("Color") >>= lineColor;
+// incorrect line color was 0x4a7ebb due to not handling themeOverride
+CPPUNIT_ASSERT_EQUAL(lineColor, long(0xeaa700));
+
+Reference xPropSet2(xDSContainer->getDataSeries()[1], 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPropSet2.is());
+
+xPropSet2->getPropertyValue("Color") >>= lineColor;
+// incorrect line color was 0x98b855
+CPPUNIT_ASSERT_EQUAL(lineColor, long(0x1e69a8));
+}
+
 void Chart2ImportTest::testTdf106217()
 {
 load("/chart2/qa/extras/data/pptx/", "tdf106217.pptx");
diff --git a/chart2/qa/extras/data/pptx/tdf105517.pptx 
b/chart2/qa/extras/data/pptx/tdf105517.pptx
new file mode 100644
index ..ff9d747f0349
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf105517.pptx differ
diff --git a/oox/source/drawingml/clrscheme.cxx 
b/oox/source/drawingml/clrscheme.cxx
index 7a99f3685a07..0c6517abfbc3 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -82,7 +82,11 @@ bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, 
sal_Int32& rColor ) const
 
 void ClrScheme::setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor )
 {
-maClrScheme.emplace_back(nSchemeClrToken, nColor);
+const auto aIter = std::find_if(maClrScheme.begin(), maClrScheme.end(), 
find_by_token(nSchemeClrToken) );
+if ( aIter != maClrScheme.end() )
+aIter->second = nColor;
+else
+maClrScheme.emplace_back(nSchemeClrToken, nColor);
 }
 
 bool ClrScheme::getColorByIndex(size_t nIndex, sal_Int32& rColor) const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-11 Thread Tamás Zolnai
 chart2/qa/extras/chart2import.cxx   |   25 
 chart2/qa/extras/data/pptx/tdf106217.pptx   |binary
 oox/source/drawingml/chart/chartdrawingfragment.cxx |5 
 3 files changed, 30 insertions(+)

New commits:
commit aa204f1c09a760d6753c408376ab7307fb13ad91
Author: Tamás Zolnai 
Date:   Sat Mar 11 05:14:47 2017 +0100

tdf#106217: Wrong size and position of a shape inside chart

Same code which was added to the method
DrawingFragment::onEndElement() in
d178d7bef193565a7d6aacbc37a58dfc4bd7b316

A shape's size and position inside a chart object
are primarily defined by  and  tags in
drawing.xml, but in the same file we also have
an  tag which is used for the same thing
(defining size and postion) in general. Testing with
MSO it seems it ignores what values are set to  and
uses only the  and  values.
The test document showing this problem must be created
an earlier version of MSO, becuase  is set to some
random values. Editing the chart and saving it with MSO
2013 the  values are set consistently with
 and  pair.

Change-Id: Icbaff78e5a6fcea36678c3b3755c97f57976b626
Reviewed-on: https://gerrit.libreoffice.org/35069
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index be36047..871b41b 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -60,6 +61,7 @@ public:
 void testFdo54361();
 void testFdo54361_1();
 void testTdf86624(); // manually placed legends
+void testTdf106217();
 void testAutoBackgroundXLSX();
 void testChartAreaStyleBackgroundXLSX();
 void testAxisTextRotationXLSX();
@@ -120,6 +122,7 @@ public:
 CPPUNIT_TEST(testFdo54361);
 CPPUNIT_TEST(testFdo54361_1);
 CPPUNIT_TEST(testTdf86624);
+CPPUNIT_TEST(testTdf106217);
 CPPUNIT_TEST(testAutoBackgroundXLSX);
 CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX);
 CPPUNIT_TEST(testAxisTextRotationXLSX);
@@ -713,6 +716,28 @@ void Chart2ImportTest::testTdf86624()
 CPPUNIT_ASSERT(aPos.Y > 4000); // real value for ms is above 7000
 }
 
+void Chart2ImportTest::testTdf106217()
+{
+load("/chart2/qa/extras/data/pptx/", "tdf106217.pptx");
+uno::Reference< chart::XChartDocument > xChartDoc = 
getChartDocFromDrawImpress(0, 0);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+uno::Reference xDrawPageSupplier(xChartDoc, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+uno::Reference xCircle(xDrawPage->getByIndex(1), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xCircle.is());
+
+uno::Reference xNamedShape(xCircle, uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(xNamedShape->getName(), OUString("Oval 1"));
+
+awt::Point aPosition = xCircle->getPosition();
+CPPUNIT_ASSERT_EQUAL(aPosition.X, sal_Int32(6870));
+CPPUNIT_ASSERT_EQUAL(aPosition.Y, sal_Int32(7261));
+awt::Size aSize = xCircle->getSize();
+CPPUNIT_ASSERT_EQUAL(aSize.Width, sal_Int32(2701));
+CPPUNIT_ASSERT_EQUAL(aSize.Height, sal_Int32(2700));
+}
+
 void Chart2ImportTest::testTransparentBackground(OUString const & filename)
 {
 load("/chart2/qa/extras/data/xlsx/", filename);
diff --git a/chart2/qa/extras/data/pptx/tdf106217.pptx 
b/chart2/qa/extras/data/pptx/tdf106217.pptx
new file mode 100755
index 000..64fb968
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf106217.pptx differ
diff --git a/oox/source/drawingml/chart/chartdrawingfragment.cxx 
b/oox/source/drawingml/chart/chartdrawingfragment.cxx
index de8d3f2..37261bf 100644
--- a/oox/source/drawingml/chart/chartdrawingfragment.cxx
+++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx
@@ -216,6 +216,11 @@ void ChartDrawingFragment::onEndElement()
 getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, 
0, SAL_MAX_INT32 ),
 getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Width, 0, SAL_MAX_INT32 ),
 getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) );
+
+// Set the position and size before calling addShape().
+mxShape->setPosition(awt::Point(aShapeRectEmu.X, 
aShapeRectEmu.Y));
+mxShape->setSize(awt::Size(aShapeRectEmu.Width, 
aShapeRectEmu.Height));
+
 basegfx::B2DHomMatrix aMatrix;
 mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), 
mxDrawPage, aMatrix, mxShape->getFillProperties(),  );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-11-06 Thread Jean-Tiare Le Bigot
 chart2/qa/extras/chart2import.cxx  |   24 +
 chart2/qa/extras/data/pptx/sparse-chart.pptx   |binary
 oox/source/drawingml/chart/chartconverter.cxx  |9 +++
 oox/source/drawingml/chart/datasourceconverter.cxx |2 -
 oox/source/drawingml/chart/typegroupconverter.cxx  |1 
 5 files changed, 30 insertions(+), 6 deletions(-)

New commits:
commit 4bcf1872bbe9db1388769485a7e4c0cbcce3d53c
Author: Jean-Tiare Le Bigot 
Date:   Thu Oct 13 23:43:41 2016 +0200

chartx: fix sparse chart import

Change-Id: I1bcd2257da900c6a88bc78040fabe5696e2bab7d
Reviewed-on: https://gerrit.libreoffice.org/29801
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index c8137b9..b508f3e 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -40,6 +40,7 @@ public:
 void testDOCChartSeries();
 void testDOCXChartSeries();
 void testPPTXChartSeries();
+void testPPTXSparseChartSeries();
 /**
  * Original data contains 3 series but 2 of them are hidden. For now, we
  * detect and skip those hidden series on import (since we don't support
@@ -105,6 +106,7 @@ public:
 CPPUNIT_TEST(testDOCXChartSeries);
 CPPUNIT_TEST(testPPTChartSeries);
 CPPUNIT_TEST(testPPTXChartSeries);
+CPPUNIT_TEST(testPPTXSparseChartSeries);
 CPPUNIT_TEST(testPPTXHiddenDataSeries);
 CPPUNIT_TEST(testPPTXPercentageNumberFormats);
 CPPUNIT_TEST(testPPTXStackedNonStackedYAxis);
@@ -399,6 +401,28 @@ void Chart2ImportTest::testPPTXChartSeries()
 CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), aLabels[2][0].get());
 }
 
+void Chart2ImportTest::testPPTXSparseChartSeries()
+{
+//test chart series sparse data for pptx
+load("/chart2/qa/extras/data/pptx/", "sparse-chart.pptx");
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+Reference xCT = getChartTypeFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xCT.is());
+
+std::vector aValues = 
getDataSeriesYValuesFromChartType(xCT);
+CPPUNIT_ASSERT_EQUAL(size_t(2), aValues.size());
+CPPUNIT_ASSERT_EQUAL(0.0,  aValues[0][0]);
+CPPUNIT_ASSERT_EQUAL(2.5,  aValues[0][1]);
+CPPUNIT_ASSERT_EQUAL(3.5,  aValues[0][2]);
+CPPUNIT_ASSERT_EQUAL(0.0,  aValues[0][3]);
+CPPUNIT_ASSERT_EQUAL(-2.4, aValues[1][0]);
+CPPUNIT_ASSERT_EQUAL(0.0,  aValues[1][1]);
+CPPUNIT_ASSERT_EQUAL(0.0,  aValues[1][2]);
+CPPUNIT_ASSERT_EQUAL(-2.8, aValues[1][3]);
+}
+
 void Chart2ImportTest::testPPTXHiddenDataSeries()
 {
 load("/chart2/qa/extras/data/pptx/", 
"stacked-bar-chart-hidden-series.pptx");
diff --git a/chart2/qa/extras/data/pptx/sparse-chart.pptx 
b/chart2/qa/extras/data/pptx/sparse-chart.pptx
new file mode 100755
index 000..d91e8f5
Binary files /dev/null and b/chart2/qa/extras/data/pptx/sparse-chart.pptx differ
diff --git a/oox/source/drawingml/chart/chartconverter.cxx 
b/oox/source/drawingml/chart/chartconverter.cxx
index d494302..ff43fa7 100644
--- a/oox/source/drawingml/chart/chartconverter.cxx
+++ b/oox/source/drawingml/chart/chartconverter.cxx
@@ -133,11 +133,10 @@ Reference< XDataSequence > 
ChartConverter::createDataSequence(
 if( !rDataSeq.maData.empty() )
 {
 // create a single-row array from constant source data
-Matrix< Any > aMatrix( rDataSeq.maData.size(), 1 );
-Matrix< Any >::iterator aMIt = aMatrix.begin();
-// TODO: how to handle missing values in the map?
-for( DataSequenceModel::AnyMap::const_iterator aDIt = 
rDataSeq.maData.begin(), aDEnd = rDataSeq.maData.end(); aDIt != aDEnd; ++aDIt, 
++aMIt )
-*aMIt = aDIt->second;
+Matrix< Any > aMatrix( rDataSeq.mnPointCount, 1 );
+for( DataSequenceModel::AnyMap::const_iterator aDIt = 
rDataSeq.maData.begin(), aDEnd = rDataSeq.maData.end(); aDIt != aDEnd; ++aDIt )
+*aMatrix.at(aDIt->first, 0) = aDIt->second;
+
 aRangeRep = lclGenerateApiArray( aMatrix );
 }
 
diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx 
b/oox/source/drawingml/chart/datasourceconverter.cxx
index 2c3dbcf..738e705 100644
--- a/oox/source/drawingml/chart/datasourceconverter.cxx
+++ b/oox/source/drawingml/chart/datasourceconverter.cxx
@@ -69,7 +69,7 @@ Reference< XDataSequence > 
DataSequenceConverter::createDataSequence( const OUSt
 if(!bFirst)
 {
 mrModel.maData.clear();
-mrModel.maData.insert(std::make_pair(1, 
Any(aTitle.makeStringAndClear(;
+mrModel.maData.insert(std::make_pair(0, 
Any(aTitle.makeStringAndClear(;
 }
 }
 xDataSeq = 

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

2015-09-07 Thread Markus Mohrhard
 chart2/qa/extras/chart2export.cxx |9 -
 dev/null  |binary
 oox/source/export/chartexport.cxx |7 ---
 3 files changed, 16 deletions(-)

New commits:
commit 0ff4ec7f0a44af22794c2919a13978b3af1bb0b3
Author: Markus Mohrhard 
Date:   Tue Sep 8 02:46:41 2015 +0200

Revert "Related: tdf#93676 in msword chart appears with axis positioned 
between ticks"

This reverts commit 10654c038c0bc20fb348be7164e08f3de98718f4.

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 7004e97..1e73718 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -99,7 +99,6 @@ public:
 void testBarChartVaryColorsXLSX();
 void testMultipleAxisXLSX();
 void testAxisTitleRotationXLSX();
-void testAxisCrossBetweenXSLX();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -163,7 +162,6 @@ public:
 CPPUNIT_TEST(testBarChartVaryColorsXLSX);
 CPPUNIT_TEST(testMultipleAxisXLSX);
 CPPUNIT_TEST(testAxisTitleRotationXLSX);
-CPPUNIT_TEST(testAxisCrossBetweenXSLX);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -1475,13 +1473,6 @@ void Chart2ExportTest::testAxisTitleRotationXLSX()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:valAx/c:title/c:tx/c:rich/a:bodyPr", "rot", 
"0");
 }
 
-void Chart2ExportTest::testAxisCrossBetweenXSLX()
-{
-load("/chart2/qa/extras/data/odt/", "axis-position.odt");
-xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML 
Text");
-assertXPath(pXmlDoc, "(//c:crossBetween)[1]", "val", "midCat");
-}
-
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/odt/axis-position.odt 
b/chart2/qa/extras/data/odt/axis-position.odt
deleted file mode 100644
index 35ea152..000
Binary files a/chart2/qa/extras/data/odt/axis-position.odt and /dev/null differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b60c2b7..5438db3 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2828,13 +2828,6 @@ void ChartExport::_exportAxis(
 
 exportTextProps(xAxisProp);
 
-if (nAxisType == XML_valAx)
-{
-pFS->singleElement( FSNS( XML_c, XML_crossBetween ),
-XML_val, "midCat",
-FSEND );
-}
-
 pFS->singleElement( FSNS( XML_c, XML_crossAx ),
 XML_val, I32S( rAxisIdPair.nCrossAx ),
 FSEND );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-10-11 Thread sushil_shinde
 chart2/qa/extras/chart2import.cxx  |   23 +
 chart2/qa/extras/data/xlsx/chart-text-can-overlap.xlsx |binary
 oox/source/drawingml/chart/axismodel.cxx   |2 -
 3 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 4027bc476a1df9df1924447795ddc2d8b7744e20
Author: sushil_shinde sushilshi...@libreoffice.org
Date:   Fri Oct 10 11:25:42 2014 +0530

fdo#84647 : Fixed default value for TickLableSkip value.

   1. 'TextCanOverlap' property was stored as false if TickLableSkip
  is not equal to one.
   2. For OOXML charts TickLableSkip can be between 1 to 9.
   3. We can not apply zero or less than zero  value to TickLableSkip.
  ( As per specification)
   4. In axis model default value for TickLableSkip was zero which is
  incorrect.
   5. Added unit test to check 'TextCanOverlap' property for chart.

Change-Id: Ib3104b1d932f6e9376c149eabb201c8e9ad23da9
Reviewed-on: https://gerrit.libreoffice.org/11901
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index b853466..3b1f1e7 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -18,9 +18,11 @@
 #include com/sun/star/chart2/XInternalDataProvider.hpp
 #include com/sun/star/chart/XChartDataArray.hpp
 #include com/sun/star/drawing/FillStyle.hpp
+#include com/sun/star/chart/XTwoAxisXSupplier.hpp
 
 #include com/sun/star/util/Color.hpp
 
+
 class Chart2ImportTest : public ChartTest
 {
 public:
@@ -53,6 +55,7 @@ public:
 void testFdo78080();
 void testFdo54361();
 void testAutoBackgroundXLSX();
+void testTextCanOverlapXLSX();
 void testNumberFormatsXLSX();
 
 void testTransparentBackground(OUString const  filename);
@@ -88,6 +91,7 @@ public:
 CPPUNIT_TEST(testFdo78080);
 CPPUNIT_TEST(testFdo54361);
 CPPUNIT_TEST(testAutoBackgroundXLSX);
+CPPUNIT_TEST(testTextCanOverlapXLSX);
 CPPUNIT_TEST(testNumberFormatsXLSX);
 CPPUNIT_TEST_SUITE_END();
 
@@ -635,6 +639,25 @@ void Chart2ImportTest::testAutoBackgroundXLSX()
 (nColor  0x00FF) == 0x00FF); // highest 2 bytes are 
transparency which we ignore here.
 }
 
+void Chart2ImportTest::testTextCanOverlapXLSX()
+{
+// fdo#84647 : To check textoverlap value is imported correclty.
+load(/chart2/qa/extras/data/xlsx/, chart-text-can-overlap.xlsx);
+uno::Reference chart::XDiagram  mxDiagram;
+uno::Reference beans::XPropertySet  xAxisProp;
+bool textCanOverlap = false;
+uno::Reference chart::XChartDocument  xChartDoc ( getChartCompFromSheet( 
0, mxComponent ), UNO_QUERY_THROW);
+CPPUNIT_ASSERT(xChartDoc.is());
+mxDiagram.set(xChartDoc-getDiagram());
+CPPUNIT_ASSERT(mxDiagram.is());
+uno::Reference chart::XAxisXSupplier  xAxisXSupp( mxDiagram, 
uno::UNO_QUERY );
+CPPUNIT_ASSERT(xAxisXSupp.is());
+xAxisProp = xAxisXSupp-getXAxis();
+xAxisProp-getPropertyValue(TextCanOverlap) = textCanOverlap;
+// Expected value of 'TextCanOverlap' is true
+CPPUNIT_ASSERT(textCanOverlap);
+}
+
 void Chart2ImportTest::testNumberFormatsXLSX()
 {
 load(/chart2/qa/extras/data/xlsx/, number-formats.xlsx);
diff --git a/chart2/qa/extras/data/xlsx/chart-text-can-overlap.xlsx 
b/chart2/qa/extras/data/xlsx/chart-text-can-overlap.xlsx
new file mode 100644
index 000..59f907d
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/chart-text-can-overlap.xlsx differ
diff --git a/oox/source/drawingml/chart/axismodel.cxx 
b/oox/source/drawingml/chart/axismodel.cxx
index d4163bc..cbd66b7 100644
--- a/oox/source/drawingml/chart/axismodel.cxx
+++ b/oox/source/drawingml/chart/axismodel.cxx
@@ -46,7 +46,7 @@ AxisModel::AxisModel( sal_Int32 nTypeId ) :
 mnMinorTimeUnit( XML_days ),
 mnOrientation( XML_minMax ),
 mnTickLabelPos( XML_nextTo ),
-mnTickLabelSkip( 0 ),
+mnTickLabelSkip( 1 ),
 mnTickMarkSkip( 0 ),
 mnTypeId( nTypeId ),
 mbAuto( false ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-20 Thread Bisal Singh Nayal
 chart2/qa/extras/chart2export.cxx   |   40 
++
 chart2/qa/extras/data/docx/fdo78290_Combination_Chart_Marker_x.docx |binary
 chart2/qa/extras/data/docx/fdo78290_Line_Chart_Marker_x.docx|binary
 chart2/qa/extras/data/docx/fdo78290_Scatter_Chart_Marker_x.docx |binary
 oox/source/export/chartexport.cxx   |5 -
 5 files changed, 43 insertions(+), 2 deletions(-)

New commits:
commit ee0bb265c90a135afa53c0fa6a586996e67640fa
Author: Bisal Singh Nayal bisal.na...@synerzip.com
Date:   Wed May 7 20:03:11 2014 +0530

fdo#78290 : The File gets corrupted when saved in LO

Problem Description: Docx file containing a chart (line chart / scatter 
chart)which has used a builtin
marker'x' gets corrupted when we save it in LO.The reason was that while 
exporting LO was writing the
marker information 'x' as 'X' which MS Word doesn't 
recognize.‒c:markerc:symbol val=X /. Also
the size of the marker was coming 1 less than the actual value. Ex: if size 
is 7 then it was being
written as  6.

Solution: During export I have made changes so that now LO writes 'x' in 
the tag information
‒c:marker c:symbol val=x /. Now the size of the marker is also 
being correctly exported.

Change-Id: I26b747f9576625bf3acb941322ae418a0bbc6b64
Reviewed-on: https://gerrit.libreoffice.org/9273
Tested-by: Miklos Vajna vmik...@collabora.co.uk
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 30a252a..c75b5c2 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -57,6 +57,9 @@ public:
 void testGapWidthXLSX();
 void testSmoothedLines();
 void testLabelStringODS();
+void testfdo78290_Line_Chart_Marker_x();
+void testfdo78290_Scatter_Chart_Marker_x();
+void testfdo78290_Combination_Chart_Marker_x();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
@@ -86,6 +89,9 @@ public:
 CPPUNIT_TEST(testGapWidthXLSX);
 CPPUNIT_TEST(testSmoothedLines);
 CPPUNIT_TEST(testLabelStringODS);
+CPPUNIT_TEST(testfdo78290_Line_Chart_Marker_x);
+CPPUNIT_TEST(testfdo78290_Scatter_Chart_Marker_x);
+CPPUNIT_TEST(testfdo78290_Combination_Chart_Marker_x);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -629,6 +635,40 @@ void Chart2ExportTest::testFdo74115WallBitmapFill()
 assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:plotArea/c:spPr/a:blipFill);
 }
 
+//The below test case tests the built in marker 'x' for Office 2010 in Line 
charts
+
+void Chart2ExportTest::testfdo78290_Line_Chart_Marker_x()
+{
+load(/chart2/qa/extras/data/docx/, fdo78290_Line_Chart_Marker_x.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart, Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:symbol[1],val,x);
+assertXPath(pXmlDoc, 
/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:size[1],val,7);
+}
+
+// We can also use the built in marker 'x' in scatter chart, hence writing the 
test case for the same.
+
+void Chart2ExportTest::testfdo78290_Scatter_Chart_Marker_x()
+{
+load(/chart2/qa/extras/data/docx/, 
fdo78290_Scatter_Chart_Marker_x.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart, Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:scatterChart[1]/c:ser[1]/c:marker[1]/c:symbol[1],val,x);
+assertXPath(pXmlDoc, 
/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:scatterChart[1]/c:ser[1]/c:marker[1]/c:size[1],val,7);
+}
+
+// Also in a combination of charts like a column chart and line chart, we can 
use the built in marker 'x'
+// for the line chart too. hence put a test case for the combination chart 
also.
+
+void Chart2ExportTest::testfdo78290_Combination_Chart_Marker_x()
+{
+load(/chart2/qa/extras/data/docx/, 
fdo78290_Combination_Chart_Marker_x.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart, Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:symbol[1],val,x);
+assertXPath(pXmlDoc, 
/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:size[1],val,7);
+}
+
 void Chart2ExportTest::testBarChartRotation()
 {
 load (/chart2/qa/extras/data/docx/, barChartRotation.docx);
diff --git 
a/chart2/qa/extras/data/docx/fdo78290_Combination_Chart_Marker_x.docx 
b/chart2/qa/extras/data/docx/fdo78290_Combination_Chart_Marker_x.docx
new file mode 100644
index 000..ee2489d
Binary files /dev/null and 

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

2014-04-28 Thread Sourav
 chart2/qa/extras/chart2export.cxx|   38 +++
 chart2/qa/extras/data/docx/fdo77216.docx |binary
 oox/source/export/chartexport.cxx|   17 +
 3 files changed, 54 insertions(+), 1 deletion(-)

New commits:
commit a211c754003f98bc8f7761224a0b265bd224f61f
Author: Sourav sourav.maha...@synerzip.com
Date:   Tue Apr 15 16:39:52 2014 +0530

fdo77216-Charts-Scattered chart: Chart gets distorted on RT

In case there is some text entered in place of X coordinates for scatter 
chart
then x coordinates should be taken as 1,2,3
MS Word does the same thing

Change-Id: I1db0fd64c6ac0f4d5e77a9676812f5e26577ecf6
Reviewed-on: https://gerrit.libreoffice.org/9011
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index bc1dcd3..eded887 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -36,6 +36,7 @@ public:
 void testStockChart();
 void testBarChart();
 void testCrosses();
+void testScatterChart();
 void testChartDataTable();
 void testChartExternalData();
 void testEmbeddingsGrabBag();
@@ -64,6 +65,7 @@ public:
 CPPUNIT_TEST(testStockChart);
 CPPUNIT_TEST(testBarChart);
 CPPUNIT_TEST(testCrosses);
+CPPUNIT_TEST(testScatterChart);
 CPPUNIT_TEST(testChartDataTable);
 CPPUNIT_TEST(testChartExternalData);
 CPPUNIT_TEST(testEmbeddingsGrabBag);
@@ -117,6 +119,14 @@ protected:
  * Same as the assertXPath(), but don't assert: return the string instead.
  */
 OUString getXPath(xmlDocPtr pXmlDoc, const OString rXPath, const OString 
rAttribute);
+/**
+Assert that rXPath exists, and its content equals rContent.
+*/
+void assertXPathContent(xmlDocPtr pXmlDoc, const OString rXPath, const 
OUString rContent);
+/**
+Same as the assertXPathContent(), but don't assert: return the string 
instead.
+*/
+OUString getXPathContent(xmlDocPtr pXmlDoc, const OString rXPath);
 
 private:
 };
@@ -211,6 +221,24 @@ void Chart2ExportTest::assertXPath(xmlDocPtr pXmlDoc, 
const OString rXPath, int
 nNumberOfNodes, xmlXPathNodeSetGetLength(pXmlNodes));
 }
 
+void Chart2ExportTest::assertXPathContent(xmlDocPtr pXmlDoc, const OString 
rXPath, const OUString rContent)
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE(XPath contents of child does not match, 
rContent, getXPathContent(pXmlDoc, rXPath));
+}
+
+OUString Chart2ExportTest::getXPathContent(xmlDocPtr pXmlDoc, const OString 
rXPath)
+{
+ xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
+
+ CPPUNIT_ASSERT_MESSAGE(OString(XPath ' + rXPath + ' not 
found).getStr(),
+ xmlXPathNodeSetGetLength(pXmlNodes)  0);
+
+ xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
+
+_xmlNode *pNode = (pXmlNode-children[0]);
+ return pNode ? OUString::createFromAscii((const 
char*)((pXmlNode-children[0]).content)) : OUString();
+}
+
 OUString Chart2ExportTest::getXPath(xmlDocPtr pXmlDoc, const OString rXPath, 
const OString rAttribute)
 {
 xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
@@ -479,6 +507,16 @@ void Chart2ExportTest::testCrosses()
 assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses, 
val, autoZero);
 }
 
+void Chart2ExportTest::testScatterChart()
+{
+load(/chart2/qa/extras/data/docx/, fdo77216.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart, Office Open XML 
Text);
+if (!pXmlDoc)
+   return;
+
+assertXPathContent(pXmlDoc, 
//c:scatterChart/c:ser[1]/c:xVal[1]/c:numRef[1]/c:numCache[1]/c:pt[1]/c:v[1], 
1);
+}
+
 void Chart2ExportTest::testChartDataTable()
 {
 load(/chart2/qa/extras/data/docx/, testChartDataTable.docx);
diff --git a/chart2/qa/extras/data/docx/fdo77216.docx 
b/chart2/qa/extras/data/docx/fdo77216.docx
new file mode 100644
index 000..b741bbc
Binary files /dev/null and b/chart2/qa/extras/data/docx/fdo77216.docx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index f6e02db..9b12eb7 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2008,6 +2008,14 @@ void ChartExport::exportSeriesValues( const Reference 
chart2::data::XDataSequen
 pFS-singleElement( FSNS( XML_c, XML_ptCount ),
 XML_val, I32S( ptCount ),
 FSEND );
+
+sal_Bool bIsNumberValue = sal_True;
+sal_Bool bXSeriesValue = sal_False;
+double Value = 1.0;
+
+if(nValueType == XML_xVal)
+bXSeriesValue = sal_True;
+
 for( sal_Int32 i = 0; i  ptCount; i++ )
 {
 pFS-startElement( FSNS( XML_c, XML_pt ),
@@ -2015,8 +2023,15 @@ void ChartExport::exportSeriesValues( const Reference 
chart2::data::XDataSequen
 FSEND );
 pFS-startElement( FSNS( XML_c, XML_v ),
  

[Libreoffice-commits] core.git: chart2/qa oox/source sw/source writerfilter/inc writerfilter/source

2014-03-23 Thread sushil_shinde
 chart2/qa/extras/chart2export.cxx|   39 ++
 chart2/qa/extras/data/docx/testchartoleobjectembeddings.docx |binary
 oox/source/export/chartexport.cxx|6 
 sw/source/filter/ww8/docxexport.cxx  |2 
 writerfilter/inc/ooxml/OOXMLDocument.hxx |2 
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx  |   68 ---
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx  |3 
 writerfilter/source/ooxml/OOXMLStreamImpl.cxx|   23 +++
 8 files changed, 125 insertions(+), 18 deletions(-)

New commits:
commit 23b65a84fd827555dfb84c7e2f78879c479c2f78
Author: sushil_shinde sushil.shi...@synerzip.com
Date:   Wed Mar 19 18:34:45 2014 +0530

fdo#76356 : Docx file contianing chart in footer/header gets corrupted.

-  Docx file with chart in footer/header or .bin file referred in chart
   was getting corrupted.
-  Embedded file for footer.xml was not grabbaged.
-  .bin embedded files were not grab baged.
-  Added grab bag support for both case.
-  Added UT to check .bin files are grab baged properly.

Reviewed on:
https://gerrit.libreoffice.org/8674

Change-Id: I221e3867798fc2a3a42f6385d687e80b80a3678f

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 5a57ea4..c0d20f1 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -52,6 +52,7 @@ public:
 void testErrorBarDataRangeODS();
 void testChartCrash();
 void testPieChartRotation();
+void testEmbeddingsOleObjectGrabBag();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
@@ -76,6 +77,7 @@ public:
 CPPUNIT_TEST(testErrorBarDataRangeODS);
 CPPUNIT_TEST(testChartCrash);
 CPPUNIT_TEST(testPieChartRotation);
+CPPUNIT_TEST(testEmbeddingsOleObjectGrabBag);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -673,6 +675,43 @@ void Chart2ExportTest::testPieChartRotation()
 assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:view3D/c:rotY, val, 30);
 }
 
+void Chart2ExportTest::testEmbeddingsOleObjectGrabBag()
+{
+   // The problem was that .bin files were missing from docx file from 
embeddings folder
+   // after saving file.
+   // This test case tests whether embeddings files grabbagged properly in 
correct object.
+
+   load(/chart2/qa/extras/data/docx/, testchartoleobjectembeddings.docx );
+   uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+   uno::Referencebeans::XPropertySet xTextDocumentPropertySet(xTextDocument, 
uno::UNO_QUERY);
+   uno::Sequencebeans::PropertyValue aGrabBag(0);
+   xTextDocumentPropertySet-getPropertyValue(OUString(InteropGrabBag)) = 
aGrabBag;
+   CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
+   bool bEmbeddings = false;
+   const char* testEmbeddedFileNames[1] = {word/embeddings/oleObject1.bin};
+   for(int i = 0; i  aGrabBag.getLength(); ++i)
+   {
+   if (aGrabBag[i].Name == OOXEmbeddings)
+   {
+   bEmbeddings = true;
+   uno::Sequencebeans::PropertyValue aEmbeddingsList(0);
+   uno::Referenceio::XInputStream aEmbeddingXlsxStream;
+   OUString aEmbeddedfileName;
+   CPPUNIT_ASSERT(aGrabBag[i].Value = aEmbeddingsList); // 
PropertyValue of proper type
+   sal_Int32 length = aEmbeddingsList.getLength();
+   CPPUNIT_ASSERT_EQUAL(sal_Int32(1), length);
+   for(int j = 0; j  length; ++j)
+   {
+   aEmbeddingsList[j].Value = aEmbeddingXlsxStream;
+   aEmbeddedfileName = aEmbeddingsList[j].Name;
+   CPPUNIT_ASSERT(aEmbeddingXlsxStream.get()); // Reference not 
empty
+   
CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(testEmbeddedFileNames[j]),aEmbeddedfileName);
+   }
+   }
+   }
+   CPPUNIT_ASSERT(bEmbeddings); // Grab Bag has all the expected elements
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/testchartoleobjectembeddings.docx 
b/chart2/qa/extras/data/docx/testchartoleobjectembeddings.docx
new file mode 100644
index 000..8167de7
Binary files /dev/null and 
b/chart2/qa/extras/data/docx/testchartoleobjectembeddings.docx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 91d761f..0d30e29 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -801,8 +801,12 @@ void ChartExport::exportExternalData( Reference 
::com::sun::star::chart::XChart
 }
 }
 FSHelperPtr pFS = GetFS();
+OUString type = 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/package;;
+if (relationPath.endsWith(OUString(.bin)))
+type = 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject;;
+
 

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

2014-03-11 Thread Ravindra Vidhate
 chart2/qa/extras/chart2export.cxx|9 +
 chart2/qa/extras/data/docx/FDO75975.docx |binary
 oox/source/export/chartexport.cxx|2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit ede99e0daa0701e2d8568d7ed00e2221a4f6a9f6
Author: Ravindra Vidhate ravindra.vidh...@synerzip.com
Date:   Mon Mar 10 17:36:05 2014 +0530

fdo#75975 crash while saving the DOCX file containing charts

1. Open DOCX file containing Charts
2. Save this file into DOCX format.
3. LO crashed while saving/exporting to DOCX format.

Conflicts:
chart2/qa/extras/chart2export.cxx

Change-Id: I14d4f2c214ce3513b4bd14831771d72498e4486d

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 0dd8d63..e328f90 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -50,6 +50,7 @@ public:
 void testPieChartDataLabels();
 void testSeriesIdxOrder();
 void testErrorBarDataRangeODS();
+void testChartCrash();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
@@ -72,6 +73,7 @@ public:
 CPPUNIT_TEST(testPieChartDataLabels);
 CPPUNIT_TEST(testSeriesIdxOrder);
 CPPUNIT_TEST(testErrorBarDataRangeODS);
+CPPUNIT_TEST(testChartCrash);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -653,6 +655,13 @@ void Chart2ExportTest::testErrorBarDataRangeODS()
 CPPUNIT_ASSERT_EQUAL(OUString($Sheet1.$C$1:$C$3), aNegRange);
 }
 
+void Chart2ExportTest::testChartCrash()
+{
+load(/chart2/qa/extras/data/docx/, FDO75975.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart, Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/FDO75975.docx 
b/chart2/qa/extras/data/docx/FDO75975.docx
new file mode 100644
index 000..30f2510
Binary files /dev/null and b/chart2/qa/extras/data/docx/FDO75975.docx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b912bcf..201d988 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2307,7 +2307,7 @@ void ChartExport::_exportAxis(
 {
 pFS-startElement( FSNS( XML_c, XML_minorGridlines ),
 FSEND );
-exportShapeProps( xMajorGrid );
+exportShapeProps( xMinorGrid );
 pFS-endElement( FSNS( XML_c, XML_minorGridlines ) );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-03-11 Thread PriyankaGaikwad
 chart2/qa/extras/chart2export.cxx|   11 +
 chart2/qa/extras/data/docx/pieChartRotation.docx |binary
 oox/source/export/chartexport.cxx|   43 ++-
 3 files changed, 45 insertions(+), 9 deletions(-)

New commits:
commit 2b6e395152b48e412d3addde7d8b3808b28d32c6
Author: PriyankaGaikwad priyanka.gaik...@synerzip.com
Date:   Tue Jan 28 18:28:39 2014 +0530

fdo#74111 3D Rotation is wrong after Round trip for pie chart

3D Rotation is lost after Round trip for pie chart.
XML Difference:

Original:
c:rotX val=40/
c:rotY val=30/

Round Trip:
c:rotX val=310/
c:rotY val=0/

Conflicts:
chart2/qa/extras/chart2export.cxx

Change-Id: I60132fef071e0573b17c35f509f3a74bd4ffcc66

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index e328f90..3189a22 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -51,6 +51,7 @@ public:
 void testSeriesIdxOrder();
 void testErrorBarDataRangeODS();
 void testChartCrash();
+void testPieChartRotation();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
@@ -74,6 +75,7 @@ public:
 CPPUNIT_TEST(testSeriesIdxOrder);
 CPPUNIT_TEST(testErrorBarDataRangeODS);
 CPPUNIT_TEST(testChartCrash);
+CPPUNIT_TEST(testPieChartRotation);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -662,6 +664,15 @@ void Chart2ExportTest::testChartCrash()
 CPPUNIT_ASSERT(pXmlDoc);
 }
 
+void Chart2ExportTest::testPieChartRotation()
+{
+load (/chart2/qa/extras/data/docx/, pieChartRotation.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart,Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:view3D/c:rotX, val, 40);
+assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:view3D/c:rotY, val, 30);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/pieChartRotation.docx 
b/chart2/qa/extras/data/docx/pieChartRotation.docx
new file mode 100644
index 000..f76f602
Binary files /dev/null and b/chart2/qa/extras/data/docx/pieChartRotation.docx 
differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 201d988..91d761f 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3191,14 +3191,24 @@ void ChartExport::exportView3D()
 FSHelperPtr pFS = GetFS();
 pFS-startElement( FSNS( XML_c, XML_view3D ),
 FSEND );
+sal_Int32 eChartType = getChartType( );
 // rotX
 if( GetProperty( xPropSet, RotationHorizontal ) )
 {
 sal_Int32 nRotationX = 0;
 mAny = nRotationX;
-// X rotation (map Chart2 [-179,180] to OOXML [0..359])
 if( nRotationX  0 )
-nRotationX += 360;
+{
+if(eChartType == chart::TYPEID_PIE)
+{
+/* In OOXML we get value in 0..90 range for pie chart X rotation , 
whereas we expect it to be in -90..90 range,
+   so we conver that during import. It  is modified in 
View3DConverter::convertFromModel()
+   here we convert it back to 0..90 as we received in import */
+   nRotationX += 90;  // X rotation (map Chart2 [-179,180] to 
OOXML [0..90])
+}
+else
+nRotationX += 360; // X rotation (map Chart2 [-179,180] to 
OOXML [-90..90])
+}
 pFS-singleElement( FSNS( XML_c, XML_rotX ),
 XML_val, I32S( nRotationX ),
 FSEND );
@@ -3206,14 +3216,29 @@ void ChartExport::exportView3D()
 // rotY
 if( GetProperty( xPropSet, RotationVertical ) )
 {
-sal_Int32 nRotationY = 0;
-mAny = nRotationY;
 // Y rotation (map Chart2 [-179,180] to OOXML [0..359])
-if( nRotationY  0 )
-nRotationY += 360;
-pFS-singleElement( FSNS( XML_c, XML_rotY ),
-XML_val, I32S( nRotationY ),
-FSEND );
+if( eChartType == chart::TYPEID_PIE  GetProperty( xPropSet, 
StartingAngle ) )
+{
+ // Y rotation used as 'first pie slice angle' in 3D pie charts
+sal_Int32 nStartingAngle=0;
+mAny = nStartingAngle;
+// convert to ooxml angle
+nStartingAngle = (450 - nStartingAngle ) % 360;
+pFS-singleElement( FSNS( XML_c, XML_rotY ),
+   XML_val, I32S( nStartingAngle ),
+   FSEND );
+}
+else
+{
+sal_Int32 nRotationY = 0;
+mAny = nRotationY;
+// Y rotation (map Chart2 [-179,180] to OOXML [0..359])
+if( nRotationY  0 )
+nRotationY += 360;
+pFS-singleElement( FSNS( XML_c, XML_rotY ),
+XML_val, I32S( nRotationY ),
+FSEND );
+}
 

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

2014-03-02 Thread PriyankaGaikwad
 chart2/qa/extras/chart2import.cxx|   10 +++---
 chart2/qa/extras/data/docx/barChart.docx |binary
 oox/source/helper/propertymap.cxx|7 +--
 3 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 0b6a1f2afa7954afcf1f27b066169455ed6cff7a
Author: PriyankaGaikwad priyanka.gaik...@synerzip.com
Date:   Wed Feb 19 17:08:02 2014 +0530

fdo#75200:Libreoffice crash while opening the file

Conflicts:
chart2/qa/extras/chart2import.cxx

Change-Id: Icb2a5bc43ef5fd0f307b43bbe8aaf892a043dc5b
Reviewed-on: https://gerrit.libreoffice.org/8127
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 2d4259b..17940fe 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -34,6 +34,7 @@ public:
 void testPPTChartSeries();
 void testODPChartSeries();
 void testBnc864396();
+void testChartFileOpen();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -45,6 +46,7 @@ public:
 CPPUNIT_TEST(testODTChartSeries);
 CPPUNIT_TEST(testDOCChartSeries);
 CPPUNIT_TEST(testDOCXChartSeries);
+CPPUNIT_TEST(testChartFileOpen);
 /*
  *  Disabling Impress Uts.
  *  ChartTest::tearDown() calls dispose of mxComponent
@@ -260,7 +262,6 @@ void Chart2ImportTest::testPPTChartSeries()
 CPPUNIT_ASSERT_EQUAL(OUString(Column 1), seriesList[0]);
 CPPUNIT_ASSERT_EQUAL(OUString(Column 2), seriesList[1]);
 CPPUNIT_ASSERT_EQUAL(OUString(Column 3), seriesList[2]);
-
 }
 
 void Chart2ImportTest::testPPTXChartSeries()
@@ -270,7 +271,6 @@ void Chart2ImportTest::testPPTXChartSeries()
 CPPUNIT_ASSERT_EQUAL(OUString(Column 1), seriesList[1]);
 CPPUNIT_ASSERT_EQUAL(OUString(Column 2), seriesList[2]);
 CPPUNIT_ASSERT_EQUAL(OUString(Column 3), seriesList[3]);
-
 }
 
 void Chart2ImportTest::testODPChartSeries()
@@ -280,7 +280,6 @@ void Chart2ImportTest::testODPChartSeries()
 CPPUNIT_ASSERT_EQUAL(OUString(Column 1), seriesList[0]);
 CPPUNIT_ASSERT_EQUAL(OUString(Column 2), seriesList[1]);
 CPPUNIT_ASSERT_EQUAL(OUString(Column 3), seriesList[2]);
-
 }
 
 void Chart2ImportTest::testBnc864396()
@@ -298,6 +297,11 @@ void Chart2ImportTest::testBnc864396()
 }
 }
 
+void Chart2ImportTest::testChartFileOpen()
+{
+load(/chart2/qa/extras/data/docx/, barChart.docx);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/barChart.docx 
b/chart2/qa/extras/data/docx/barChart.docx
new file mode 100644
index 000..9b9152b
Binary files /dev/null and b/chart2/qa/extras/data/docx/barChart.docx differ
diff --git a/oox/source/helper/propertymap.cxx 
b/oox/source/helper/propertymap.cxx
index ab37dd3..cd84da0 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -243,8 +243,11 @@ void PropertyMap::fillSequences( Sequence OUString  
rNames, Sequence Any 
 for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt, 
++pNames, ++pValues )
 {
 OSL_ENSURE( (0 = aIt-first)  (aIt-first  PROP_COUNT), 
PropertyMap::fillSequences - invalid property identifier );
-*pNames = (*mpPropNames)[ aIt-first ];
-*pValues = aIt-second;
+if((sal_uInt32)aIt-first = mpPropNames-size())
+{
+   *pNames = (*mpPropNames)[ aIt-first ];
+   *pValues = aIt-second;
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-14 Thread Rohit Deshmukh
 chart2/qa/extras/chart2export.cxx  |9 +
 chart2/qa/extras/data/docx/PieChartDataLabels.docx |binary
 oox/source/drawingml/chart/seriesconverter.cxx |5 +++--
 3 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit a05ad6dd36f73647cdf0839d2c18dbc1d399c792
Author: Rohit Deshmukh rohit.deshm...@synerzip.com
Date:   Thu Feb 6 17:34:20 2014 +0530

fdo#74137: Fix for courruption of Pie chart after roundtrip.

Problem:
  - Pie chart with data labels files gets corrupt because of label position 
is
bestFit in original file.
  - But after round trip, data labels position gets changes to top, left 
and right.
For some data labels postion value is missing.
Implementaion:
  - In LO, while converting data label from model, the position gets 
changed.
So we are ignoring this hack for Pie chart.

Conflicts:
chart2/qa/extras/chart2export.cxx

Change-Id: Ic51845cd6f39bc905439eea8971e878607d25dac

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index c15f5af..b7b3668 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -47,6 +47,7 @@ public:
 void testFdo74115WallBitmapFill();
 void testBarChartRotation();
 void testShapeFollowedByChart();
+void testPieChartDataLabels();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
@@ -66,6 +67,7 @@ public:
 CPPUNIT_TEST(testFdo74115WallBitmapFill);
 CPPUNIT_TEST(testBarChartRotation);
 CPPUNIT_TEST(testShapeFollowedByChart);
+CPPUNIT_TEST(testPieChartDataLabels);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -598,7 +600,14 @@ void Chart2ExportTest::testShapeFollowedByChart()
 OUString aValueOfFirstDocPR = getXPath(pXmlDoc, 
/w:document/w:body/w:p[3]/w:r[1]/w:drawing[1]/wp:inline[1]/wp:docPr[1], id);
 OUString aValueOfSecondDocPR = getXPath(pXmlDoc, 
/w:document/w:body/w:p[3]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1],
 id);
 CPPUNIT_ASSERT( aValueOfFirstDocPR != aValueOfSecondDocPR );
+}
 
+void Chart2ExportTest::testPieChartDataLabels()
+{
+load(/chart2/qa/extras/data/docx/, PieChartDataLabels.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart, Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser[1]/c:dLbls/c:dLbl[1]/c:dLblPos,
 val, bestFit);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
diff --git a/chart2/qa/extras/data/docx/PieChartDataLabels.docx 
b/chart2/qa/extras/data/docx/PieChartDataLabels.docx
new file mode 100644
index 000..99a72c0
Binary files /dev/null and b/chart2/qa/extras/data/docx/PieChartDataLabels.docx 
differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 5c85d99..668847c 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -185,8 +185,9 @@ void DataLabelConverter::convertFromModel( const Reference 
XDataSeries  rxDat
 {
 PropertySet aPropSet( rxDataSeries-getDataPointByIndex( 
mrModel.mnIndex ) );
 lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, 
rTypeGroup, false );
-
-if( mrModel.mxLayout  !mrModel.mxLayout-mbAutoLayout )
+const TypeGroupInfo rTypeInfo = rTypeGroup.getTypeInfo();
+bool bIsPie = rTypeInfo.meTypeCategory == TYPECATEGORY_PIE;
+if( mrModel.mxLayout  !mrModel.mxLayout-mbAutoLayout  !bIsPie )
 {
 // bnc#694340 - nasty hack - chart2 cannot individually
 // place data labels, let's try to find a useful
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-11 Thread sushil_shinde
 chart2/qa/extras/chart2export.cxx|   10 ++
 chart2/qa/extras/data/docx/DisplayUnits.docx |binary
 oox/source/export/chartexport.cxx|   25 +
 3 files changed, 35 insertions(+)

New commits:
commit 1d497297ec9bc2ed00bbc8f586a67c76eaa7013d
Author: sushil_shinde sushil.shi...@synerzip.com
Date:   Wed Jan 29 14:34:35 2014 +0530

fdo#74112  Write Chart Displayunits information back to XML.

   During export access properties stored during import
   and write back those. Currently we just support basic chart
   display unit information such as builtinunit, there are more
   properties ex. custUnit, dispUnitsLbl, extLst.
   which are pending.

Conflicts:

chart2/qa/extras/chart2export.cxx

Change-Id: I87e0a8322fc0b0c3df2b8053b7f29fffea611040
Reviewed-on: https://gerrit.libreoffice.org/7722
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index e164296..399c0bb 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -42,6 +42,7 @@ public:
 void testAreaChartLoad();
 void testUpDownBars();
 void testDoughnutChart();
+void testDisplayUnits();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
@@ -56,6 +57,7 @@ public:
 CPPUNIT_TEST(testAreaChartLoad);
 CPPUNIT_TEST(testUpDownBars);
 CPPUNIT_TEST(testDoughnutChart);
+CPPUNIT_TEST(testDisplayUnits);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -533,6 +535,14 @@ void Chart2ExportTest::testDoughnutChart()
 assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:plotArea/c:doughnutChart, 
1);
 }
 
+void Chart2ExportTest::testDisplayUnits()
+{
+load(/chart2/qa/extras/data/docx/, DisplayUnits.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart, Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
/c:chartSpace/c:chart/c:plotArea/c:valAx/c:dispUnits/c:builtInUnit, val, 
billions);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/DisplayUnits.docx 
b/chart2/qa/extras/data/docx/DisplayUnits.docx
new file mode 100644
index 000..97092a3
Binary files /dev/null and b/chart2/qa/extras/data/docx/DisplayUnits.docx differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 1c82816..dbbeb07 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2389,6 +2389,31 @@ void ChartExport::_exportAxis(
 FSEND );
 }
 
+sal_Bool bDisplayUnits = sal_False;
+if(GetProperty( xAxisProp, DisplayUnits ) )
+{
+mAny = bDisplayUnits;
+if(bDisplayUnits)
+{
+OUString aVal;
+pFS-startElement( FSNS( XML_c, XML_dispUnits ),
+FSEND );
+if(GetProperty( xAxisProp, BuiltInUnit ))
+{
+mAny = aVal;
+if(!aVal.isEmpty())
+{
+OString aBuiltInUnit = OUStringToOString(aVal, 
RTL_TEXTENCODING_UTF8);
+pFS-singleElement( FSNS( XML_c, XML_builtInUnit ),
+XML_val, aBuiltInUnit.getStr(),
+FSEND );
+}
+ }
+ pFS-singleElement(FSNS( XML_c, XML_dispUnitsLbl ),FSEND);
+ pFS-endElement( FSNS( XML_c, XML_dispUnits ) );
+
+}
+}
 // TODO: text properties
 
 pFS-endElement( FSNS( XML_c, nAxisType ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-11 Thread PriyankaGaikwad
 chart2/qa/extras/chart2export.cxx|   12 
 chart2/qa/extras/data/docx/barChartRotation.docx |binary
 oox/source/drawingml/chart/plotareaconverter.cxx |2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit c753c0b937ee4a86ac6a5f2617ffb59f65e7e713
Author: PriyankaGaikwad priyanka.gaik...@synerzip.com
Date:   Mon Feb 3 17:30:49 2014 +0530

fdo#74111 3D Rotation is wrong after Round trip for bar chart

3D Rotation is lost after Round trip for bar chart.

XML Difference:
Original:
 c:rotX val=30/
 c:rotY val=50/
Round Trip:
 c:rotX val=42/
 c:rotY val=42/

Implementation:
The RightAngledAxes should set first then the RotationVertical and 
RotationHorizontal
because the RightAngledAxes is needed while setting Rotation.

Conflicts:
chart2/qa/extras/chart2export.cxx

Change-Id: I64f3b6e56f8515bf6c3d935c59dfaf1d440dba31

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 77140840..1cd52be 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -45,6 +45,7 @@ public:
 void testDisplayUnits();
 void testFdo74115WallGradientFill();
 void testFdo74115WallBitmapFill();
+void testBarChartRotation();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
@@ -62,6 +63,7 @@ public:
 CPPUNIT_TEST(testDisplayUnits);
 CPPUNIT_TEST(testFdo74115WallGradientFill);
 CPPUNIT_TEST(testFdo74115WallBitmapFill);
+CPPUNIT_TEST(testBarChartRotation);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -566,6 +568,16 @@ void Chart2ExportTest::testFdo74115WallBitmapFill()
 assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:plotArea/c:spPr/a:blipFill);
 }
 
+void Chart2ExportTest::testBarChartRotation()
+{
+load (/chart2/qa/extras/data/docx/, barChartRotation.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart,Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+
+assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:view3D/c:rotX, val, 30);
+assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:view3D/c:rotY, val, 50);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/barChartRotation.docx 
b/chart2/qa/extras/data/docx/barChartRotation.docx
new file mode 100644
index 000..bf4be47
Binary files /dev/null and b/chart2/qa/extras/data/docx/barChartRotation.docx 
differ
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx 
b/oox/source/drawingml/chart/plotareaconverter.cxx
index c069078..8fcb625 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -255,10 +255,10 @@ void View3DConverter::convertFromModel( const Reference 
XDiagram  rxDiagram,
 cssd::ProjectionMode eProjMode = bParallel ? cssd::ProjectionMode_PARALLEL 
: cssd::ProjectionMode_PERSPECTIVE;
 
 // set rotation properties
+aPropSet.setProperty( PROP_RightAngledAxes, bRightAngled );
 aPropSet.setProperty( PROP_RotationVertical, nRotationY );
 aPropSet.setProperty( PROP_RotationHorizontal, nRotationX );
 aPropSet.setProperty( PROP_Perspective, nPerspective );
-aPropSet.setProperty( PROP_RightAngledAxes, bRightAngled );
 aPropSet.setProperty( PROP_D3DScenePerspective, eProjMode );
 
 // set light settings
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-01-16 Thread Rajashri
 chart2/qa/extras/chart2export.cxx |   12 +++
 chart2/qa/extras/data/docx/testAreaChartLoad.docx |binary
 oox/source/export/chartexport.cxx |   73 +++---
 3 files changed, 63 insertions(+), 22 deletions(-)

New commits:
commit c7cfe0876d7ca3d861cc6d8c1f84970f9f71def9
Author: Rajashri rajashri.udh...@synerzip.com
Date:   Fri Dec 6 16:20:54 2013 +0530

fdo#72217 : Fix for corruption area chart with data labels after Round Trip.

For labels under one series, there were child tags created for every
data label individually.
for example, if under one series there are five labels, then under
dLbls there were 5 dLbl tags created separately.
This issue is resolved now.

Conflicts:
chart2/qa/extras/chart2export.cxx

Change-Id: I7ae214f413bc27728df8a3d4cb8f4d703cba2f77

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 6cef73b..7b1629a 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -39,6 +39,7 @@ public:
 void testChartDataTable();
 void testChartExternalData();
 void testEmbeddingsGrabBag();
+void testAreaChartLoad();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
@@ -50,6 +51,7 @@ public:
 CPPUNIT_TEST(testChartDataTable);
 CPPUNIT_TEST(testChartExternalData);
 CPPUNIT_TEST(testEmbeddingsGrabBag);
+CPPUNIT_TEST(testAreaChartLoad);
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -440,6 +442,7 @@ void Chart2ExportTest::testCrosses()
 
 assertXPath(pXmlDoc, /c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses, 
val, autoZero);
 }
+
 void Chart2ExportTest::testChartDataTable()
 {
 load(/chart2/qa/extras/data/docx/, testChartDataTable.docx);
@@ -500,6 +503,15 @@ void Chart2ExportTest::testEmbeddingsGrabBag()
CPPUNIT_ASSERT(bEmbeddings); // Grab Bag has all the expected elements
 }
 
+void Chart2ExportTest::testAreaChartLoad()
+{
+load (/chart2/qa/extras/data/docx/, testAreaChartLoad.docx);
+xmlDocPtr pXmlDoc = parseExport(word/charts/chart,Office Open XML 
Text);
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:dLbls/c:showVal, val, 
1);
+assertXPath(pXmlDoc, 
/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:dLbls/c:dLbl, 0);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/testAreaChartLoad.docx 
b/chart2/qa/extras/data/docx/testAreaChartLoad.docx
new file mode 100644
index 000..9383f75
Binary files /dev/null and b/chart2/qa/extras/data/docx/testAreaChartLoad.docx 
differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 8bbf222..a795aac 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2410,15 +2410,38 @@ void ChartExport::exportDataLabels(
 bool showCategoryName = false;
 bool showNumberInPercent = false;
 
-sal_Int32 nElem;
-for( nElem = 0; nElem  nSeriesLength; ++nElem)
+sal_Int32 nElem = 0;
+
+
+uno::Reference beans::XPropertySet  xPropSet;
+if(nSeriesLength != 0)
 {
-uno::Reference beans::XPropertySet  xPropSet;
+   try
+   {
+   xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
+  xSeries, nElem, getModel() );
+   }
+   catch( const uno::Exception  rEx )
+   {
+SAL_WARN(oox, Exception caught during Export of data label: 
  rEx.Message );
+   }
+}
 
+namespace cssc2 = ::com::sun::star::chart2;
+cssc2::DataPointLabel aTempLabel;
+if( xPropSet.is() )
+{
+if (GetProperty( xPropSet, Label))
+   mAny = aTempLabel;
+
+
+
+for( nElem = 1; nElem  nSeriesLength; ++nElem)
+{
 try
 {
 xPropSet = 
SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
-xSeries, nElem, getModel() );
+   xSeries, nElem, getModel() );
 }
 catch( const uno::Exception  rEx )
 {
@@ -2454,39 +2477,45 @@ void ChartExport::exportDataLabels(
case csscd::AVOID_OVERLAP: aPlacement = bestFit;  
break;
}
 
-   if(aLabel.ShowLegendSymbol || aLabel.ShowNumber || 
aLabel.ShowCategoryName || aLabel.ShowNumberInPercent)
-   {
+   if (aLabel.ShowLegendSymbol)
+   showLegendSymbol = true;
+   if(aLabel.ShowNumber)
+   showNumber = true;
+   if(aLabel.ShowCategoryName)
+   showCategoryName =  true;
+   if(aLabel.ShowNumberInPercent)
+   showNumberInPercent = true;
+
+