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

2020-05-09 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |2 ++
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit d91a2c8691f50806ec68d163edb38ccb4b011bd9
Author: Tamas Bunth 
AuthorDate: Thu Apr 25 12:17:06 2019 +0200
Commit: Michael Meeks 
CommitDate: Sat May 9 19:12:44 2020 +0100

mysqlc: move template specialization to namespace

so gcc 4.8 would be happy about it.
See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Change-Id: I7e696758c5598b9e64947bc9b1606c653becddce
Reviewed-on: https://gerrit.libreoffice.org/71294
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76732
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 984914016a13..e39e90b1b8b4 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -255,6 +255,7 @@ template  T 
OPreparedResultSet::retrieveValue(sal_Int32 nColumnIndex
 return getRowSetValue(nColumnIndex);
 }
 
+namespace connectivity { namespace mysqlc {
 template <> uno::Sequence 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 {
 // TODO make conversion possible
@@ -315,6 +316,7 @@ template <> OUString 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 
 return OUString(sStr, *m_aData[column - 1].length, m_encoding);
 }
+}}
 
 ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 nColumnIndex)
 {
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
index 4ff64d5b4320..78e9e79b1d75 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
@@ -93,8 +93,8 @@ class OPreparedResultSet final : public OBase_Mutex,
 
 void SAL_CALL getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const 
override;
 
-template  T safelyRetrieveValue(const sal_Int32 nColumnIndex);
-template  T retrieveValue(const sal_Int32 nColumnIndex);
+template  T safelyRetrieveValue(sal_Int32 nColumnIndex);
+template  T retrieveValue(sal_Int32 nColumnIndex);
 connectivity::ORowSetValue getRowSetValue(sal_Int32 nColumnIndex);
 
 bool fetchResult();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: drawinglayer/Library_drawinglayer.mk drawinglayer/source include/drawinglayer include/oox include/svx include/vcl include/xmloff oox/source sd/qa svx/inc svx/source sw/

2020-03-03 Thread Tamas Bunth (via logerrit)
 drawinglayer/Library_drawinglayer.mk   |2 
 drawinglayer/source/attribute/sdrglowattribute.cxx |   80 +
 drawinglayer/source/primitive2d/Tools.cxx  |2 
 drawinglayer/source/primitive2d/glowprimitive2d.cxx|   87 +
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx|   46 
 include/drawinglayer/attribute/sdrglowattribute.hxx|   54 
 include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx |1 
 include/drawinglayer/primitive2d/glowprimitive2d.hxx   |   71 +
 include/oox/export/drawingml.hxx   |2 
 include/svx/sdglowmetricitem.hxx   |   37 
 include/svx/strings.hrc|3 
 include/svx/svddef.hxx |9 
 include/svx/unoshprp.hxx   |5 
 include/vcl/BitmapFilterStackBlur.hxx  |   34 
 include/xmloff/xmltoken.hxx|3 
 oox/source/drawingml/effectproperties.cxx  |7 
 oox/source/drawingml/effectproperties.hxx  |   10 
 oox/source/drawingml/effectpropertiescontext.cxx   |   13 
 oox/source/drawingml/shape.cxx |   10 
 oox/source/export/drawingml.cxx|   67 -
 oox/source/token/properties.txt|2 
 sd/qa/unit/data/pptx/shape-glow-effect.pptx|binary
 sd/qa/unit/export-tests-ooxml2.cxx |   18 
 sd/qa/unit/import-tests.cxx|   19 
 svx/inc/sdr/attribute/sdrlinefillshadowtextattribute.hxx   |3 
 svx/inc/sdr/attribute/sdrlineshadowtextattribute.hxx   |4 
 svx/inc/sdr/attribute/sdrshadowtextattribute.hxx   |8 
 svx/inc/sdr/primitive2d/sdrattributecreator.hxx|4 
 svx/inc/sdr/primitive2d/sdrdecompositiontools.hxx  |6 
 svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx|5 
 svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx|5 
 svx/source/sdr/attribute/sdrshadowtextattribute.cxx|   15 
 svx/source/sdr/primitive2d/sdrattributecreator.cxx |   28 
 svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx   |8 
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx   |   21 
 svx/source/sdr/properties/customshapeproperties.cxx|3 
 svx/source/svdraw/svdattr.cxx  |8 
 svx/source/unodraw/unoprov.cxx |   11 
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx  |   53 
 vcl/CppunitTest_vcl_bitmap_test.mk |1 
 vcl/Library_vcl.mk |1 
 vcl/qa/cppunit/BitmapFilterTest.cxx|  159 ++
 vcl/source/bitmap/BitmapFilterStackBlur.cxx|  554 
++
 vcl/source/outdev/bitmap.cxx   |4 
 xmloff/inc/xmlsdtypes.hxx  |1 
 xmloff/source/core/xmltoken.cxx|3 
 xmloff/source/draw/sdpropls.cxx|   10 
 xmloff/source/token/tokens.txt |3 
 48 files changed, 1409 insertions(+), 91 deletions(-)

New commits:
commit f9fc420dceb1ece2c98767da16a21aaff771f140
Author: Tamas Bunth 
AuthorDate: Tue Jan 21 19:04:13 2020 +0100
Commit: Tamás Bunth 
CommitDate: Tue Mar 3 15:52:47 2020 +0100

tdf#101181 Implement glow effect on shapes

Glow effect is a color-blurred outline outside of the shape. In ooxml
document it is specified with the  element.

The commit contains the following:
- Add support for importing and exporting  from ooxml documents.
- Assign new properties to XShape which stores glow-related attributes.
- A new 2D primitive is introduced in module 'drawinglayer' which is
  responsible for representing the glow primitive which is to be rendered.
  + A glow primitive is a clone of the original shape which has been
scaled up slightly and a new color has been assigned to it. The
radius of the glow effect and the color is defined in the 
element being imported.
- A blur algorithm is introduced in module 'vcl', which is called during
  rendering the primitive.
  + The blur algorithm works on a bitmap.
  + Since the algorithm is CPU-intensive, the result is cached in the
processor and it is recalculated only if needed.
- Add support for importing and 

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

2020-02-22 Thread Tamas Bunth (via logerrit)
 svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit edfe1dbc674bfb7043f2f352daf8f190950853cf
Author: Tamas Bunth 
AuthorDate: Sat Jan 11 18:26:39 2020 +0100
Commit: Tamás Bunth 
CommitDate: Sat Feb 22 11:33:53 2020 +0100

Fix typo

Change-Id: I4308e9957368845059d837a3ace79b5c78b7db51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89124
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx 
b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
index 5c002c1347d8..8ba6b03bbe1a 100644
--- a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
@@ -505,7 +505,7 @@ namespace
  *  - do not forget to consequently use -rX for rMyVector
  *  - definitions have to be ClockWise for the EndBorderLines, 
will be ensured by sorting
  *
- *  If you take all this into account, you will gett correctly extended 
BorderLinePrimitive2D
+ *  If you take all this into account, you will get correctly extended 
BorderLinePrimitive2D
  *  representations for the new to be defined BorderLine. That extensions 
will overlap nicely
  *  with the corresponding BorderLines and take all multiple line 
definitions in the ::Style into
  *  account.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - chart2/qa xmloff/source

2020-01-08 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   21 -
 chart2/qa/extras/data/odp/tdf123206.odp   |binary
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |2 ++
 3 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit a57f273da44ec4f3a1364e77679146bf535941ff
Author: Tamas Bunth 
AuthorDate: Thu Jan 2 12:55:16 2020 +0100
Commit: Andras Timar 
CommitDate: Wed Jan 8 14:31:30 2020 +0100

tdf#123206 Add test: import custom-label-field

Add test for deprecated custom-label-field attribute of the data-point
element.

Change-Id: I9a7619898fa72900323e5b41728d2146c14203e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86103
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86123
Reviewed-by: Andras Timar 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 6ff60e1e6c00..9fa051df2bc1 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -150,6 +150,7 @@ public:
 void testTdf122765();
 void testTdf121991();
 void testTdf125444PercentageCustomLabel();
+void testTdf123206CustomLabelField();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -249,7 +250,7 @@ public:
 CPPUNIT_TEST(testTdf122765);
 CPPUNIT_TEST(testTdf121991);
 CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
-
+CPPUNIT_TEST(testTdf123206CustomLabelField);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2318,6 +2319,24 @@ void 
Chart2ImportTest::testTdf125444PercentageCustomLabel()
 
 }
 
+void Chart2ImportTest::testTdf123206CustomLabelField()
+{
+// File contains the deprecated "custom-label-field" attribute of the
+// "data-point" element. It should be interpreted and stored as a data 
point
+// property.
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/odp/", 
"tdf123206.odp"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xDp = xDataSeries->getDataPointByIndex(1);
+Sequence> aLabelFields;
+CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= 
aLabelFields);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aLabelFields.getLength());
+CPPUNIT_ASSERT_EQUAL(OUString("Kiskacsa"), aLabelFields[0]->getString());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/odp/tdf123206.odp 
b/chart2/qa/extras/data/odp/tdf123206.odp
new file mode 100644
index ..1975756bce18
Binary files /dev/null and b/chart2/qa/extras/data/odp/tdf123206.odp differ
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx 
b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 9767efd933dc..f488244e142f 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -702,6 +702,8 @@ void SchXMLDataPointContext::StartElement( const 
uno::Reference< xml::sax::XAttr
 }
 else if( nPrefix == XML_NAMESPACE_LO_EXT)
 {
+// Deprecated. New documents use the chart:data-label element
+// instead in order to store custom label text.
 if( IsXMLToken( aLocalName, XML_CUSTOM_LABEL_FIELD) && 
!mbHasLabelParagraph)
 {
 sCustomLabelField = xAttrList->getValueByIndex( i );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - include/xmloff xmloff/inc xmloff/source

2020-01-08 Thread Tamas Bunth (via logerrit)
 include/xmloff/xmltoken.hxx   |1 
 xmloff/inc/SchXMLImport.hxx   |1 
 xmloff/source/chart/SchXMLExport.cxx  |   55 --
 xmloff/source/chart/SchXMLImport.cxx  |1 
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |  100 ++
 xmloff/source/chart/SchXMLPlotAreaContext.hxx |   47 +++-
 xmloff/source/chart/SchXMLSeries2Context.cxx  |   18 ++--
 xmloff/source/chart/transporttypes.hxx|7 +
 xmloff/source/core/xmltoken.cxx   |1 
 xmloff/source/token/tokens.txt|1 
 10 files changed, 186 insertions(+), 46 deletions(-)

New commits:
commit cdacee1de7cd8d98d79ef13bc165ce016c8b2e1a
Author: Tamas Bunth 
AuthorDate: Wed Dec 18 13:08:11 2019 +0100
Commit: Andras Timar 
CommitDate: Wed Jan 8 12:44:08 2020 +0100

tdf#123206 Store custom label as chart:data-label

Use the chart:data-label element instead of using the
loext:custom-label-field attribute.

chart:data-label stores can be a child of chart:data-point and it may
contain a text:o element for holding one or more paragraphs of custom
label text.

This commit aims to export and import chart:data-label with paragraphs
put into different text:span elements. These span elements may hold a
text:style-name attribute in order to achieve formatted text.

This structure is already in the ODF format.

Change-Id: I0bea7ce1a16af9c47b33555e18545bdaae7e95ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85659
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86122
Reviewed-by: Andras Timar 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 02bd9702d980..1175958548ff 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -551,6 +551,7 @@ namespace xmloff { namespace token {
 XML_DATA_BAR,
 XML_DATA_BAR_ENTRY,
 XML_DATA_CELL_RANGE_ADDRESS,
+XML_DATA_LABEL,
 XML_DATA_LABEL_NUMBER,
 XML_DATA_LABEL_SYMBOL,
 XML_DATA_LABEL_TEXT,
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 5b587a4abdb1..2978ac66b5ab 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -73,6 +73,7 @@ enum SchXMLPlotAreaElemTokenMap
 enum SchXMLSeriesElemTokenMap
 {
 XML_TOK_SERIES_DATA_POINT,
+XML_TOK_SERIES_DATA_LABEL,
 XML_TOK_SERIES_DOMAIN,
 XML_TOK_SERIES_MEAN_VALUE_LINE,
 XML_TOK_SERIES_REGRESSION_CURVE,
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index 4dd2bc43b6c8..e277b73758b7 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -113,11 +113,13 @@ using ::std::vector;
 
 namespace
 {
+using CustomLabelSeq = 
Sequence>;
+
 struct SchXMLDataPointStruct
 {
 OUString   maStyleName;
 sal_Int32  mnRepeat;
-OUString   msCustomLabelText;
+CustomLabelSeq   mCustomLabelText;
 
 SchXMLDataPointStruct() : mnRepeat( 1 ) {}
 };
@@ -229,6 +231,8 @@ public:
 const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
 bool bExportContent );
 
+void exportCustomLabel(const CustomLabelSeq & xCustomLabel);
+
 void exportRegressionCurve(
 const css::uno::Reference& xSeries,
 const css::awt::Size& rPageSize,
@@ -277,31 +281,26 @@ public:
 namespace
 {
 
-OUString lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
+CustomLabelSeq lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
 const uno::Reference< chart2::XDataSeries >& rSeries)
 {
 if( !rSeries.is() )
-return OUString{};
+return CustomLabelSeq();
 
 const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( 
SvtSaveOptions().GetODFDefaultVersion() );
 if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to 
ODF 1.2 or older
-return OUString{};
+return CustomLabelSeq();
 
-// export custom label text
 if(Reference xLabels = 
rSeries->getDataPointByIndex(nDataPointIndex); xLabels.is())
 {
 if(Any aAny = xLabels->getPropertyValue("CustomLabelFields"); 
aAny.hasValue())
 {
 Sequence> 
aCustomLabels;
 aAny >>= aCustomLabels;
-OUString sLabel;
-// TODO export formatted string instead of simple characters
-for(auto& aLabel : aCustomLabels)
-sLabel += aLabel->getString();
-return sLabel;
+return aCustomLabels;
 }
 }
-return OUString{};
+return CustomLabelSeq();
 }
 
 class lcl_MatchesRole
@@ -3266,7 +3265,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
 SchXMLDataPointStruct aPoint;
 aPoint.maStyleName = maAutoStyleNameQueue.front();
 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - chart2/qa xmloff/source

2020-01-07 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   21 -
 chart2/qa/extras/data/odp/tdf123206.odp   |binary
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |2 ++
 3 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit a08d63312cea0464f465c1a3fde0e9abd142e696
Author: Tamas Bunth 
AuthorDate: Thu Jan 2 12:55:16 2020 +0100
Commit: Andras Timar 
CommitDate: Tue Jan 7 16:44:22 2020 +0100

tdf#123206 Add test: import custom-label-field

Add test for deprecated custom-label-field attribute of the data-point
element.

Change-Id: I9a7619898fa72900323e5b41728d2146c14203e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86103
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86114
Reviewed-by: Andras Timar 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index c11c5cdf28ad..0a0cd3ed8957 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -134,6 +134,7 @@ public:
 void testTdf123504();
 void testTdf122765();
 void testTdf125444PercentageCustomLabel();
+void testTdf123206CustomLabelField();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -220,7 +221,7 @@ public:
 CPPUNIT_TEST(testTdf123504);
 CPPUNIT_TEST(testTdf122765);
 CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
-
+CPPUNIT_TEST(testTdf123206CustomLabelField);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2013,6 +2014,24 @@ void 
Chart2ImportTest::testTdf125444PercentageCustomLabel()
 
 }
 
+void Chart2ImportTest::testTdf123206CustomLabelField()
+{
+// File contains the deprecated "custom-label-field" attribute of the
+// "data-point" element. It should be interpreted and stored as a data 
point
+// property.
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/odp/", 
"tdf123206.odp"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xDp = xDataSeries->getDataPointByIndex(1);
+Sequence> aLabelFields;
+CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= 
aLabelFields);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aLabelFields.getLength());
+CPPUNIT_ASSERT_EQUAL(OUString("Kiskacsa"), aLabelFields[0]->getString());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/odp/tdf123206.odp 
b/chart2/qa/extras/data/odp/tdf123206.odp
new file mode 100644
index ..1975756bce18
Binary files /dev/null and b/chart2/qa/extras/data/odp/tdf123206.odp differ
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx 
b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 385b59d48bd2..fe6a196005f7 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -711,6 +711,8 @@ void SchXMLDataPointContext::StartElement( const 
uno::Reference< xml::sax::XAttr
 }
 else if( nPrefix == XML_NAMESPACE_LO_EXT)
 {
+// Deprecated. New documents use the chart:data-label element
+// instead in order to store custom label text.
 if( IsXMLToken( aLocalName, XML_CUSTOM_LABEL_FIELD) && 
!mbHasLabelParagraph)
 {
 sCustomLabelField = xAttrList->getValueByIndex( i );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - chart2/qa

2020-01-07 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   22 ++
 chart2/qa/extras/data/pptx/tdf125444.pptx |binary
 2 files changed, 22 insertions(+)

New commits:
commit 363b7ab405f70fe0f61d57103d5ae28a0b24e0c5
Author: Tamas Bunth 
AuthorDate: Thu Jan 2 14:52:08 2020 +0100
Commit: Xisco Faulí 
CommitDate: Tue Jan 7 12:45:42 2020 +0100

tdf#125444 Add pptx import test for percentage

Add test for imporing custom label field of type "PERCENTAGE" from a
pptx document.

Change-Id: Ide6baa95d07836cafb97efc9c00ec2ab224a1d1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86109
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86128
Reviewed-by: Xisco Faulí 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index be010f3b309f..6ff60e1e6c00 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -149,6 +149,7 @@ public:
 void testTdf123504();
 void testTdf122765();
 void testTdf121991();
+void testTdf125444PercentageCustomLabel();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -247,6 +248,7 @@ public:
 CPPUNIT_TEST(testTdf123504);
 CPPUNIT_TEST(testTdf122765);
 CPPUNIT_TEST(testTdf121991);
+CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2296,6 +2298,26 @@ void Chart2ImportTest::testTdf121991()
 CPPUNIT_ASSERT(!bShowLegendEntry);
 }
 
+void Chart2ImportTest::testTdf125444PercentageCustomLabel()
+{
+load("/chart2/qa/extras/data/pptx/", "tdf125444.pptx");
+
+// 1st chart
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+uno::Reference 
xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xDp = xDataSeries->getDataPointByIndex(1);
+Sequence> aLabelFields;
+CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= 
aLabelFields);
+// There are three label field: a value label, a newline and a percentage 
label. We want
+// to assert the latter.
+CPPUNIT_ASSERT_EQUAL(static_cast(3), aLabelFields.getLength());
+CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType_PERCENTAGE, 
aLabelFields[2]->getFieldType());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/pptx/tdf125444.pptx 
b/chart2/qa/extras/data/pptx/tdf125444.pptx
new file mode 100755
index ..e78efecd652b
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf125444.pptx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - chart2/qa

2020-01-07 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   22 ++
 chart2/qa/extras/data/pptx/tdf125444.pptx |binary
 2 files changed, 22 insertions(+)

New commits:
commit f05e5581badb9a258f778333007173512076fe0b
Author: Tamas Bunth 
AuthorDate: Thu Jan 2 14:52:08 2020 +0100
Commit: Xisco Faulí 
CommitDate: Tue Jan 7 12:45:58 2020 +0100

tdf#125444 Add pptx import test for percentage

Add test for imporing custom label field of type "PERCENTAGE" from a
pptx document.

Change-Id: Ide6baa95d07836cafb97efc9c00ec2ab224a1d1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86109
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86129

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index da62dfd5e87d..c11c5cdf28ad 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -133,6 +133,7 @@ public:
 void testXaxisValues();
 void testTdf123504();
 void testTdf122765();
+void testTdf125444PercentageCustomLabel();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
@@ -218,6 +219,7 @@ public:
 CPPUNIT_TEST(testXaxisValues);
 CPPUNIT_TEST(testTdf123504);
 CPPUNIT_TEST(testTdf122765);
+CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1991,6 +1993,26 @@ void Chart2ImportTest::testTdf122765()
 CPPUNIT_ASSERT_GREATER(sal_Int32(7000), aSlicePosition.X);
 }
 
+void Chart2ImportTest::testTdf125444PercentageCustomLabel()
+{
+load("/chart2/qa/extras/data/pptx/", "tdf125444.pptx");
+
+// 1st chart
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+uno::Reference 
xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xDp = xDataSeries->getDataPointByIndex(1);
+Sequence> aLabelFields;
+CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= 
aLabelFields);
+// There are three label field: a value label, a newline and a percentage 
label. We want
+// to assert the latter.
+CPPUNIT_ASSERT_EQUAL(static_cast(3), aLabelFields.getLength());
+CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType_PERCENTAGE, 
aLabelFields[2]->getFieldType());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/pptx/tdf125444.pptx 
b/chart2/qa/extras/data/pptx/tdf125444.pptx
new file mode 100755
index ..e78efecd652b
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf125444.pptx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/xmloff xmloff/inc xmloff/source

2020-01-07 Thread Tamas Bunth (via logerrit)
 include/xmloff/xmltoken.hxx   |1 
 xmloff/inc/SchXMLImport.hxx   |1 
 xmloff/source/chart/SchXMLExport.cxx  |   55 --
 xmloff/source/chart/SchXMLImport.cxx  |1 
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |  100 ++
 xmloff/source/chart/SchXMLPlotAreaContext.hxx |   47 +++-
 xmloff/source/chart/SchXMLSeries2Context.cxx  |   18 ++--
 xmloff/source/chart/transporttypes.hxx|7 +
 xmloff/source/core/xmltoken.cxx   |1 
 xmloff/source/token/tokens.txt|1 
 10 files changed, 186 insertions(+), 46 deletions(-)

New commits:
commit d797bdbf6f54770b74c8f319c4f08dd685cb0656
Author: Tamas Bunth 
AuthorDate: Wed Dec 18 13:08:11 2019 +0100
Commit: Andras Timar 
CommitDate: Tue Jan 7 10:44:59 2020 +0100

tdf#123206 Store custom label as chart:data-label

Use the chart:data-label element instead of using the
loext:custom-label-field attribute.

chart:data-label stores can be a child of chart:data-point and it may
contain a text:o element for holding one or more paragraphs of custom
label text.

This commit aims to export and import chart:data-label with paragraphs
put into different text:span elements. These span elements may hold a
text:style-name attribute in order to achieve formatted text.

This structure is already in the ODF format.

Change-Id: I0bea7ce1a16af9c47b33555e18545bdaae7e95ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85659
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86113
Reviewed-by: Andras Timar 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 97748c0f9c30..2b536228926a 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -548,6 +548,7 @@ namespace xmloff { namespace token {
 XML_DATA_BAR,
 XML_DATA_BAR_ENTRY,
 XML_DATA_CELL_RANGE_ADDRESS,
+XML_DATA_LABEL,
 XML_DATA_LABEL_NUMBER,
 XML_DATA_LABEL_SYMBOL,
 XML_DATA_LABEL_TEXT,
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index e8ca86cd589a..10bb46cf1b1e 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -76,6 +76,7 @@ enum SchXMLPlotAreaElemTokenMap
 enum SchXMLSeriesElemTokenMap
 {
 XML_TOK_SERIES_DATA_POINT,
+XML_TOK_SERIES_DATA_LABEL,
 XML_TOK_SERIES_DOMAIN,
 XML_TOK_SERIES_MEAN_VALUE_LINE,
 XML_TOK_SERIES_REGRESSION_CURVE,
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index 5f5bd225de1e..e17d903e3ae8 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -123,11 +123,13 @@ using ::std::vector;
 
 namespace
 {
+using CustomLabelSeq = 
Sequence>;
+
 struct SchXMLDataPointStruct
 {
 OUString   maStyleName;
 sal_Int32  mnRepeat;
-OUString   msCustomLabelText;
+CustomLabelSeq   mCustomLabelText;
 
 SchXMLDataPointStruct() : mnRepeat( 1 ) {}
 };
@@ -239,6 +241,8 @@ public:
 const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
 bool bExportContent );
 
+void exportCustomLabel(const CustomLabelSeq & xCustomLabel);
+
 void exportRegressionCurve(
 const css::uno::Reference& xSeries,
 const css::awt::Size& rPageSize,
@@ -287,31 +291,26 @@ public:
 namespace
 {
 
-OUString lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
+CustomLabelSeq lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
 const uno::Reference< chart2::XDataSeries >& rSeries)
 {
 if( !rSeries.is() )
-return OUString{};
+return CustomLabelSeq();
 
 const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( 
SvtSaveOptions().GetODFDefaultVersion() );
 if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to 
ODF 1.2 or older
-return OUString{};
+return CustomLabelSeq();
 
-// export custom label text
 if(Reference xLabels = 
rSeries->getDataPointByIndex(nDataPointIndex); xLabels.is())
 {
 if(Any aAny = xLabels->getPropertyValue("CustomLabelFields"); 
aAny.hasValue())
 {
 Sequence> 
aCustomLabels;
 aAny >>= aCustomLabels;
-OUString sLabel;
-// TODO export formatted string instead of simple characters
-for(auto& aLabel : aCustomLabels)
-sLabel += aLabel->getString();
-return sLabel;
+return aCustomLabels;
 }
 }
-return OUString{};
+return CustomLabelSeq();
 }
 
 class lcl_MatchesRole
@@ -3321,7 +3320,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
 SchXMLDataPointStruct aPoint;
 aPoint.maStyleName = maAutoStyleNameQueue.front();
 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - chart2/source offapi/com oox/source

2020-01-07 Thread Tamas Bunth (via logerrit)
 chart2/source/view/charttypes/VSeriesPlotter.cxx |5 +
 offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl |5 +++--
 oox/source/drawingml/chart/seriesconverter.cxx   |2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 39716e0624bdfbab51d1ab342cfd102e5200cdb5
Author: Tamas Bunth 
AuthorDate: Wed Jan 1 15:31:40 2020 +0100
Commit: Andras Timar 
CommitDate: Tue Jan 7 10:43:59 2020 +0100

tdf#125444 Percentage as custom chart label

Support importing ooxml charts with a field of type "PERCENTAGE" as
custom label.

Change-Id: Ie8931f77e3b6199d98635422d11d776e675f6e5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86067
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86115
Reviewed-by: Andras Timar 

diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 350254c14764..6a3b142a0ce9 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -531,6 +531,11 @@ uno::Reference< drawing::XShape > 
VSeriesPlotter::createDataLabel( const uno::Re
 aTextList[i] = DataSeriesHelper::getDataSeriesLabel( 
xSeries, aRole );
 break;
 }
+case DataPointCustomLabelFieldType_PERCENTAGE:
+{
+aTextList[i] = getLabelTextForValue( rDataSeries, 
nPointIndex, fValue, true );
+break;
+}
 case DataPointCustomLabelFieldType_CELLREF:
 {
 // TODO: for now doesn't show placeholder
diff --git a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl 
b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
index 0b7f925342a6..05c26a738684 100644
--- a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
+++ b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
@@ -23,11 +23,12 @@ enum DataPointCustomLabelFieldType
 SERIESNAME,
 CATEGORYNAME,
 CELLREF,
-NEWLINE
+NEWLINE,
+PERCENTAGE
 };
 
 }; }; }; };
 
 #endif
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 01e1d72562c5..8397b190fb8a 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -245,6 +245,8 @@ DataPointCustomLabelFieldType 
lcl_ConvertFieldNameToFieldEnum( const OUString& r
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CATEGORYNAME;
 else if (rField == "CELLREF")
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLREF;
+else if (rField == "PERCENTAGE")
+return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_PERCENTAGE;
 else
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - chart2/source offapi/com oox/source

2020-01-07 Thread Tamas Bunth (via logerrit)
 chart2/source/view/charttypes/VSeriesPlotter.cxx |5 +
 offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl |5 +++--
 oox/source/drawingml/chart/seriesconverter.cxx   |2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 8c1dc30cc9fc96ef3d3ab0c4445959473248ae4d
Author: Tamas Bunth 
AuthorDate: Wed Jan 1 15:31:40 2020 +0100
Commit: Xisco Faulí 
CommitDate: Tue Jan 7 10:40:44 2020 +0100

tdf#125444 Percentage as custom chart label

Support importing ooxml charts with a field of type "PERCENTAGE" as
custom label.

Change-Id: Ie8931f77e3b6199d98635422d11d776e675f6e5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86067
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86124
Reviewed-by: Xisco Faulí 

diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 2a814e2fd73a..8189ece987e9 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -528,6 +528,11 @@ uno::Reference< drawing::XShape > 
VSeriesPlotter::createDataLabel( const uno::Re
 aTextList[i] = DataSeriesHelper::getDataSeriesLabel( 
xSeries, aRole );
 break;
 }
+case DataPointCustomLabelFieldType_PERCENTAGE:
+{
+aTextList[i] = getLabelTextForValue( rDataSeries, 
nPointIndex, fValue, true );
+break;
+}
 case DataPointCustomLabelFieldType_CELLREF:
 {
 // TODO: for now doesn't show placeholder
diff --git a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl 
b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
index 0b7f925342a6..05c26a738684 100644
--- a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
+++ b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
@@ -23,11 +23,12 @@ enum DataPointCustomLabelFieldType
 SERIESNAME,
 CATEGORYNAME,
 CELLREF,
-NEWLINE
+NEWLINE,
+PERCENTAGE
 };
 
 }; }; }; };
 
 #endif
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index a310549e0535..10edab47fd11 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -245,6 +245,8 @@ DataPointCustomLabelFieldType 
lcl_ConvertFieldNameToFieldEnum( const OUString& r
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CATEGORYNAME;
 else if (rField == "CELLREF")
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLREF;
+else if (rField == "PERCENTAGE")
+return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_PERCENTAGE;
 else
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - chart2/qa xmloff/source

2020-01-06 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   22 --
 chart2/qa/extras/data/odp/tdf123206.odp   |binary
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |2 ++
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit ab142e036dfdaa05fa990d998e3380aa54c4d9a8
Author: Tamas Bunth 
AuthorDate: Thu Jan 2 12:55:16 2020 +0100
Commit: Andras Timar 
CommitDate: Mon Jan 6 14:47:36 2020 +0100

tdf#123206 Add test: import custom-label-field

Add test for deprecated custom-label-field attribute of the data-point
element.

Change-Id: I9a7619898fa72900323e5b41728d2146c14203e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86103
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86117
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 960d12b72a57..a4c5313cf4a1 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -120,7 +120,7 @@ public:
 void testTdf114179();
 void testTdf123504();
 void testTdf122765();
-
+void testTdf123206CustomLabelField();
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
 CPPUNIT_TEST(testSteppedLines);
@@ -194,7 +194,7 @@ public:
 CPPUNIT_TEST(testTdf114179);
 CPPUNIT_TEST(testTdf123504);
 CPPUNIT_TEST(testTdf122765);
-
+CPPUNIT_TEST(testTdf123206CustomLabelField);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1755,6 +1755,24 @@ void Chart2ImportTest::testTdf122765()
 CPPUNIT_ASSERT_GREATER(sal_Int32(7000), aSlicePosition.X);
 }
 
+void Chart2ImportTest::testTdf123206CustomLabelField()
+{
+// File contains the deprecated "custom-label-field" attribute of the
+// "data-point" element. It should be interpreted and stored as a data 
point
+// property.
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/odp/", 
"tdf123206.odp"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xDp = xDataSeries->getDataPointByIndex(1);
+Sequence> aLabelFields;
+CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= 
aLabelFields);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aLabelFields.getLength());
+CPPUNIT_ASSERT_EQUAL(OUString("Kiskacsa"), aLabelFields[0]->getString());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/odp/tdf123206.odp 
b/chart2/qa/extras/data/odp/tdf123206.odp
new file mode 100644
index ..1975756bce18
Binary files /dev/null and b/chart2/qa/extras/data/odp/tdf123206.odp differ
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx 
b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 385b59d48bd2..fe6a196005f7 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -711,6 +711,8 @@ void SchXMLDataPointContext::StartElement( const 
uno::Reference< xml::sax::XAttr
 }
 else if( nPrefix == XML_NAMESPACE_LO_EXT)
 {
+// Deprecated. New documents use the chart:data-label element
+// instead in order to store custom label text.
 if( IsXMLToken( aLocalName, XML_CUSTOM_LABEL_FIELD) && 
!mbHasLabelParagraph)
 {
 sCustomLabelField = xAttrList->getValueByIndex( i );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - chart2/qa

2020-01-06 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   23 +++
 chart2/qa/extras/data/pptx/tdf125444.pptx |binary
 2 files changed, 23 insertions(+)

New commits:
commit d3d3ebc5d4f19a682ab0e52bf13c6c591878bb97
Author: Tamas Bunth 
AuthorDate: Thu Jan 2 14:52:08 2020 +0100
Commit: Andras Timar 
CommitDate: Mon Jan 6 14:48:14 2020 +0100

tdf#125444 Add pptx import test for percentage

Add test for imporing custom label field of type "PERCENTAGE" from a
pptx document.

Change-Id: Ide6baa95d07836cafb97efc9c00ec2ab224a1d1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86109
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86127
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index a4c5313cf4a1..5aacca0c9a30 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -121,6 +121,8 @@ public:
 void testTdf123504();
 void testTdf122765();
 void testTdf123206CustomLabelField();
+void testTdf125444PercentageCustomLabel();
+
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
 CPPUNIT_TEST(testSteppedLines);
@@ -195,6 +197,7 @@ public:
 CPPUNIT_TEST(testTdf123504);
 CPPUNIT_TEST(testTdf122765);
 CPPUNIT_TEST(testTdf123206CustomLabelField);
+CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1773,6 +1776,26 @@ void Chart2ImportTest::testTdf123206CustomLabelField()
 
 }
 
+void Chart2ImportTest::testTdf125444PercentageCustomLabel()
+{
+load("/chart2/qa/extras/data/pptx/", "tdf125444.pptx");
+
+// 1st chart
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+uno::Reference 
xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xDp = xDataSeries->getDataPointByIndex(1);
+Sequence> aLabelFields;
+CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= 
aLabelFields);
+// There are three label field: a value label, a newline and a percentage 
label. We want
+// to assert the latter.
+CPPUNIT_ASSERT_EQUAL(static_cast(3), aLabelFields.getLength());
+CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType_PERCENTAGE, 
aLabelFields[2]->getFieldType());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/pptx/tdf125444.pptx 
b/chart2/qa/extras/data/pptx/tdf125444.pptx
new file mode 100755
index ..e78efecd652b
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf125444.pptx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - chart2/source offapi/com oox/source

2020-01-06 Thread Tamas Bunth (via logerrit)
 chart2/source/view/charttypes/VSeriesPlotter.cxx |5 +
 offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl |5 +++--
 oox/source/drawingml/chart/seriesconverter.cxx   |2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit e360137531d2686815a95596bba121db1e6738ff
Author: Tamas Bunth 
AuthorDate: Wed Jan 1 15:31:40 2020 +0100
Commit: Andras Timar 
CommitDate: Mon Jan 6 14:47:56 2020 +0100

tdf#125444 Percentage as custom chart label

Support importing ooxml charts with a field of type "PERCENTAGE" as
custom label.

Change-Id: Ie8931f77e3b6199d98635422d11d776e675f6e5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86067
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86118
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 7a45aa8b2d13..923555fad41f 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -543,6 +543,11 @@ uno::Reference< drawing::XShape > 
VSeriesPlotter::createDataLabel( const uno::Re
 aTextList[i] = DataSeriesHelper::getDataSeriesLabel( 
xSeries, aRole );
 break;
 }
+case DataPointCustomLabelFieldType_PERCENTAGE:
+{
+aTextList[i] = getLabelTextForValue( rDataSeries, 
nPointIndex, fValue, true );
+break;
+}
 case DataPointCustomLabelFieldType_CELLREF:
 {
 // TODO: for now doesn't show placeholder
diff --git a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl 
b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
index 0b7f925342a6..05c26a738684 100644
--- a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
+++ b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
@@ -23,11 +23,12 @@ enum DataPointCustomLabelFieldType
 SERIESNAME,
 CATEGORYNAME,
 CELLREF,
-NEWLINE
+NEWLINE,
+PERCENTAGE
 };
 
 }; }; }; };
 
 #endif
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 01e1d72562c5..8397b190fb8a 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -245,6 +245,8 @@ DataPointCustomLabelFieldType 
lcl_ConvertFieldNameToFieldEnum( const OUString& r
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CATEGORYNAME;
 else if (rField == "CELLREF")
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLREF;
+else if (rField == "PERCENTAGE")
+return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_PERCENTAGE;
 else
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/xmloff xmloff/inc xmloff/source

2020-01-06 Thread Tamas Bunth (via logerrit)
 include/xmloff/xmltoken.hxx   |1 
 xmloff/inc/SchXMLImport.hxx   |1 
 xmloff/source/chart/SchXMLExport.cxx  |   55 --
 xmloff/source/chart/SchXMLImport.cxx  |1 
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |  100 ++
 xmloff/source/chart/SchXMLPlotAreaContext.hxx |   47 +++-
 xmloff/source/chart/SchXMLSeries2Context.cxx  |   18 ++--
 xmloff/source/chart/transporttypes.hxx|7 +
 xmloff/source/core/xmltoken.cxx   |1 
 xmloff/source/token/tokens.txt|1 
 10 files changed, 186 insertions(+), 46 deletions(-)

New commits:
commit 892f784856288645226e2339c9bd5c614f58d333
Author: Tamas Bunth 
AuthorDate: Wed Dec 18 13:08:11 2019 +0100
Commit: Andras Timar 
CommitDate: Mon Jan 6 14:46:59 2020 +0100

tdf#123206 Store custom label as chart:data-label

Use the chart:data-label element instead of using the
loext:custom-label-field attribute.

chart:data-label stores can be a child of chart:data-point and it may
contain a text:o element for holding one or more paragraphs of custom
label text.

This commit aims to export and import chart:data-label with paragraphs
put into different text:span elements. These span elements may hold a
text:style-name attribute in order to achieve formatted text.

This structure is already in the ODF format.

Change-Id: I0bea7ce1a16af9c47b33555e18545bdaae7e95ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85659
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86116
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index a750c7fe4587..f572e338715e 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -549,6 +549,7 @@ namespace xmloff { namespace token {
 XML_DATA_BAR,
 XML_DATA_BAR_ENTRY,
 XML_DATA_CELL_RANGE_ADDRESS,
+XML_DATA_LABEL,
 XML_DATA_LABEL_NUMBER,
 XML_DATA_LABEL_SYMBOL,
 XML_DATA_LABEL_TEXT,
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 5b9db7bdac34..55e66e8fd06e 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -76,6 +76,7 @@ enum SchXMLPlotAreaElemTokenMap
 enum SchXMLSeriesElemTokenMap
 {
 XML_TOK_SERIES_DATA_POINT,
+XML_TOK_SERIES_DATA_LABEL,
 XML_TOK_SERIES_DOMAIN,
 XML_TOK_SERIES_MEAN_VALUE_LINE,
 XML_TOK_SERIES_REGRESSION_CURVE,
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index d13f58e19a62..2fe73a3ed7cc 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -121,11 +121,13 @@ using ::std::vector;
 
 namespace
 {
+using CustomLabelSeq = 
Sequence>;
+
 struct SchXMLDataPointStruct
 {
 OUString   maStyleName;
 sal_Int32  mnRepeat;
-OUString   msCustomLabelText;
+CustomLabelSeq   mCustomLabelText;
 
 SchXMLDataPointStruct() : mnRepeat( 1 ) {}
 };
@@ -239,6 +241,8 @@ public:
 const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
 bool bExportContent );
 
+void exportCustomLabel(const CustomLabelSeq & xCustomLabel);
+
 void exportRegressionCurve(
 const css::uno::Reference& xSeries,
 const css::awt::Size& rPageSize,
@@ -292,31 +296,26 @@ constexpr OUStringLiteral 
SchXMLExportHelper_Impl::gsTableName;
 namespace
 {
 
-OUString lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
+CustomLabelSeq lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
 const uno::Reference< chart2::XDataSeries >& rSeries)
 {
 if( !rSeries.is() )
-return OUString{};
+return CustomLabelSeq();
 
 const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( 
SvtSaveOptions().GetODFDefaultVersion() );
 if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to 
ODF 1.2 or older
-return OUString{};
+return CustomLabelSeq();
 
-// export custom label text
 if(Reference xLabels = 
rSeries->getDataPointByIndex(nDataPointIndex); xLabels.is())
 {
 if(Any aAny = xLabels->getPropertyValue("CustomLabelFields"); 
aAny.hasValue())
 {
 Sequence> 
aCustomLabels;
 aAny >>= aCustomLabels;
-OUString sLabel;
-// TODO export formatted string instead of simple characters
-for(auto& aLabel : aCustomLabels)
-sLabel += aLabel->getString();
-return sLabel;
+return aCustomLabels;
 }
 }
-return OUString{};
+return CustomLabelSeq();
 }
 
 class lcl_MatchesRole
@@ -3323,7 +3322,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
 SchXMLDataPointStruct aPoint;
   

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

2020-01-02 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   23 +++
 chart2/qa/extras/data/pptx/tdf125444.pptx |binary
 2 files changed, 23 insertions(+)

New commits:
commit 0f2d4ce014afc5ba2b6d85db08fb3f6e544366e1
Author: Tamas Bunth 
AuthorDate: Thu Jan 2 14:52:08 2020 +0100
Commit: Tamás Bunth 
CommitDate: Thu Jan 2 15:45:03 2020 +0100

tdf#125444 Add pptx import test for percentage

Add test for imporing custom label field of type "PERCENTAGE" from a
pptx document.

Change-Id: Ide6baa95d07836cafb97efc9c00ec2ab224a1d1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86109
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 3c505c8c201d..ccb75649a3f1 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -150,6 +150,8 @@ public:
 void testTdf122765();
 void testTdf121991();
 void testTdf123206CustomLabelField();
+void testTdf125444PercentageCustomLabel();
+
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
 CPPUNIT_TEST(testSteppedLines);
@@ -248,6 +250,7 @@ public:
 CPPUNIT_TEST(testTdf122765);
 CPPUNIT_TEST(testTdf121991);
 CPPUNIT_TEST(testTdf123206CustomLabelField);
+CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2314,6 +2317,26 @@ void Chart2ImportTest::testTdf123206CustomLabelField()
 
 }
 
+void Chart2ImportTest::testTdf125444PercentageCustomLabel()
+{
+load("/chart2/qa/extras/data/pptx/", "tdf125444.pptx");
+
+// 1st chart
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+uno::Reference 
xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xDp = xDataSeries->getDataPointByIndex(1);
+Sequence> aLabelFields;
+CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= 
aLabelFields);
+// There are three label field: a value label, a newline and a percentage 
label. We want
+// to assert the latter.
+CPPUNIT_ASSERT_EQUAL(static_cast(3), aLabelFields.getLength());
+CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType_PERCENTAGE, 
aLabelFields[2]->getFieldType());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/pptx/tdf125444.pptx 
b/chart2/qa/extras/data/pptx/tdf125444.pptx
new file mode 100755
index ..e78efecd652b
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf125444.pptx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-02 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2import.cxx |   22 --
 chart2/qa/extras/data/odp/tdf123206.odp   |binary
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |2 ++
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 2c7ef73e99dcecb6c86bcbf19135b89ad9e7db3a
Author: Tamas Bunth 
AuthorDate: Thu Jan 2 12:55:16 2020 +0100
Commit: Tamás Bunth 
CommitDate: Thu Jan 2 14:38:12 2020 +0100

tdf#123206 Add test: import custom-label-field

Add test for deprecated custom-label-field attribute of the data-point
element.

Change-Id: I9a7619898fa72900323e5b41728d2146c14203e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86103
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index be010f3b309f..3c505c8c201d 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -149,7 +149,7 @@ public:
 void testTdf123504();
 void testTdf122765();
 void testTdf121991();
-
+void testTdf123206CustomLabelField();
 CPPUNIT_TEST_SUITE(Chart2ImportTest);
 CPPUNIT_TEST(Fdo60083);
 CPPUNIT_TEST(testSteppedLines);
@@ -247,7 +247,7 @@ public:
 CPPUNIT_TEST(testTdf123504);
 CPPUNIT_TEST(testTdf122765);
 CPPUNIT_TEST(testTdf121991);
-
+CPPUNIT_TEST(testTdf123206CustomLabelField);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2296,6 +2296,24 @@ void Chart2ImportTest::testTdf121991()
 CPPUNIT_ASSERT(!bShowLegendEntry);
 }
 
+void Chart2ImportTest::testTdf123206CustomLabelField()
+{
+// File contains the deprecated "custom-label-field" attribute of the
+// "data-point" element. It should be interpreted and stored as a data 
point
+// property.
+uno::Reference< chart2::XChartDocument > 
xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/odp/", 
"tdf123206.odp"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference xDataSeries = 
getDataSeriesFromDoc(xChartDoc, 0);
+CPPUNIT_ASSERT(xDataSeries.is());
+Reference xDp = xDataSeries->getDataPointByIndex(1);
+Sequence> aLabelFields;
+CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= 
aLabelFields);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aLabelFields.getLength());
+CPPUNIT_ASSERT_EQUAL(OUString("Kiskacsa"), aLabelFields[0]->getString());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/odp/tdf123206.odp 
b/chart2/qa/extras/data/odp/tdf123206.odp
new file mode 100644
index ..1975756bce18
Binary files /dev/null and b/chart2/qa/extras/data/odp/tdf123206.odp differ
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx 
b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 9767efd933dc..f488244e142f 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -702,6 +702,8 @@ void SchXMLDataPointContext::StartElement( const 
uno::Reference< xml::sax::XAttr
 }
 else if( nPrefix == XML_NAMESPACE_LO_EXT)
 {
+// Deprecated. New documents use the chart:data-label element
+// instead in order to store custom label text.
 if( IsXMLToken( aLocalName, XML_CUSTOM_LABEL_FIELD) && 
!mbHasLabelParagraph)
 {
 sCustomLabelField = xAttrList->getValueByIndex( i );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-01 Thread Tamas Bunth (via logerrit)
 chart2/source/view/charttypes/VSeriesPlotter.cxx |5 +
 offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl |5 +++--
 oox/source/drawingml/chart/seriesconverter.cxx   |2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit fa0df1035bbede2ad93b08366abb1d7a508bd3d6
Author: Tamas Bunth 
AuthorDate: Wed Jan 1 15:31:40 2020 +0100
Commit: Tamás Bunth 
CommitDate: Wed Jan 1 17:36:04 2020 +0100

tdf#125444 Percentage as custom chart label

Support importing ooxml charts with a field of type "PERCENTAGE" as
custom label.

Change-Id: Ie8931f77e3b6199d98635422d11d776e675f6e5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86067
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 2a814e2fd73a..8189ece987e9 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -528,6 +528,11 @@ uno::Reference< drawing::XShape > 
VSeriesPlotter::createDataLabel( const uno::Re
 aTextList[i] = DataSeriesHelper::getDataSeriesLabel( 
xSeries, aRole );
 break;
 }
+case DataPointCustomLabelFieldType_PERCENTAGE:
+{
+aTextList[i] = getLabelTextForValue( rDataSeries, 
nPointIndex, fValue, true );
+break;
+}
 case DataPointCustomLabelFieldType_CELLREF:
 {
 // TODO: for now doesn't show placeholder
diff --git a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl 
b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
index 0b7f925342a6..05c26a738684 100644
--- a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
+++ b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl
@@ -23,11 +23,12 @@ enum DataPointCustomLabelFieldType
 SERIESNAME,
 CATEGORYNAME,
 CELLREF,
-NEWLINE
+NEWLINE,
+PERCENTAGE
 };
 
 }; }; }; };
 
 #endif
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index a310549e0535..10edab47fd11 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -245,6 +245,8 @@ DataPointCustomLabelFieldType 
lcl_ConvertFieldNameToFieldEnum( const OUString& r
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CATEGORYNAME;
 else if (rField == "CELLREF")
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLREF;
+else if (rField == "PERCENTAGE")
+return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_PERCENTAGE;
 else
 return 
DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/xmloff xmloff/inc xmloff/source

2020-01-01 Thread Tamas Bunth (via logerrit)
 include/xmloff/xmltoken.hxx   |1 
 xmloff/inc/SchXMLImport.hxx   |1 
 xmloff/source/chart/SchXMLExport.cxx  |   55 --
 xmloff/source/chart/SchXMLImport.cxx  |1 
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |  100 ++
 xmloff/source/chart/SchXMLPlotAreaContext.hxx |   47 +++-
 xmloff/source/chart/SchXMLSeries2Context.cxx  |   18 ++--
 xmloff/source/chart/transporttypes.hxx|7 +
 xmloff/source/core/xmltoken.cxx   |1 
 xmloff/source/token/tokens.txt|1 
 10 files changed, 186 insertions(+), 46 deletions(-)

New commits:
commit 7d2c7e7af04d9604d86d2d605ef95b9abb10966c
Author: Tamas Bunth 
AuthorDate: Wed Dec 18 13:08:11 2019 +0100
Commit: Tamás Bunth 
CommitDate: Wed Jan 1 17:35:50 2020 +0100

tdf#123206 Store custom label as chart:data-label

Use the chart:data-label element instead of using the
loext:custom-label-field attribute.

chart:data-label stores can be a child of chart:data-point and it may
contain a text:o element for holding one or more paragraphs of custom
label text.

This commit aims to export and import chart:data-label with paragraphs
put into different text:span elements. These span elements may hold a
text:style-name attribute in order to achieve formatted text.

This structure is already in the ODF format.

Change-Id: I0bea7ce1a16af9c47b33555e18545bdaae7e95ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85659
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 02bd9702d980..1175958548ff 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -551,6 +551,7 @@ namespace xmloff { namespace token {
 XML_DATA_BAR,
 XML_DATA_BAR_ENTRY,
 XML_DATA_CELL_RANGE_ADDRESS,
+XML_DATA_LABEL,
 XML_DATA_LABEL_NUMBER,
 XML_DATA_LABEL_SYMBOL,
 XML_DATA_LABEL_TEXT,
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 51aec6dc5c46..2a1080bf1eec 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -73,6 +73,7 @@ enum SchXMLPlotAreaElemTokenMap
 enum SchXMLSeriesElemTokenMap
 {
 XML_TOK_SERIES_DATA_POINT,
+XML_TOK_SERIES_DATA_LABEL,
 XML_TOK_SERIES_DOMAIN,
 XML_TOK_SERIES_MEAN_VALUE_LINE,
 XML_TOK_SERIES_REGRESSION_CURVE,
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index 25ec8022bf70..b3d18c7c758c 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -113,11 +113,13 @@ using ::std::vector;
 
 namespace
 {
+using CustomLabelSeq = 
Sequence>;
+
 struct SchXMLDataPointStruct
 {
 OUString   maStyleName;
 sal_Int32  mnRepeat;
-OUString   msCustomLabelText;
+CustomLabelSeq   mCustomLabelText;
 
 SchXMLDataPointStruct() : mnRepeat( 1 ) {}
 };
@@ -225,6 +227,8 @@ public:
 const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
 bool bExportContent );
 
+void exportCustomLabel(const CustomLabelSeq & xCustomLabel);
+
 void exportRegressionCurve(
 const css::uno::Reference& xSeries,
 const css::awt::Size& rPageSize,
@@ -273,31 +277,26 @@ public:
 namespace
 {
 
-OUString lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
+CustomLabelSeq lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
 const uno::Reference< chart2::XDataSeries >& rSeries)
 {
 if( !rSeries.is() )
-return OUString{};
+return CustomLabelSeq();
 
 const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( 
SvtSaveOptions().GetODFDefaultVersion() );
 if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to 
ODF 1.2 or older
-return OUString{};
+return CustomLabelSeq();
 
-// export custom label text
 if(Reference xLabels = 
rSeries->getDataPointByIndex(nDataPointIndex); xLabels.is())
 {
 if(Any aAny = xLabels->getPropertyValue("CustomLabelFields"); 
aAny.hasValue())
 {
 Sequence> 
aCustomLabels;
 aAny >>= aCustomLabels;
-OUString sLabel;
-// TODO export formatted string instead of simple characters
-for(auto& aLabel : aCustomLabels)
-sLabel += aLabel->getString();
-return sLabel;
+return aCustomLabels;
 }
 }
-return OUString{};
+return CustomLabelSeq();
 }
 
 class lcl_MatchesRole
@@ -3261,7 +3260,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
 SchXMLDataPointStruct aPoint;
 aPoint.maStyleName = maAutoStyleNameQueue.front();
 if(bExportNumFmt)
-aPoint.msCustomLabelText = 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - chart2/qa include/xmloff schema/libreoffice xmloff/source

2019-12-04 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   16 +++
 chart2/qa/extras/data/docx/tdf123206.docx   |binary
 include/xmloff/xmltoken.hxx |1 
 schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng |9 +
 xmloff/source/chart/SchXMLExport.cxx|   63 ++--
 xmloff/source/chart/SchXMLPlotAreaContext.cxx   |9 +
 xmloff/source/chart/SchXMLSeries2Context.cxx|   15 ++
 xmloff/source/chart/transporttypes.hxx  |1 
 xmloff/source/core/xmltoken.cxx |1 
 xmloff/source/token/tokens.txt  |1 
 10 files changed, 107 insertions(+), 9 deletions(-)

New commits:
commit 10f9096a4fb1969e57123dbf031a312ed1e8d8c6
Author: Tamas Bunth 
AuthorDate: Thu Oct 3 19:49:57 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Dec 4 10:16:23 2019 +0100

tdf#123206 Import/Export chart custom label text

OOX import supports custom label texts in chart diagrams (produced by
e.g. double clicking on a data label, and write custom text), but -
since embedded objects are exported and imported to odf right after 
migration -
it is not displayed in case of a Writer document.

In order to make it work, we have to support custom label text in the
odf structure. This commit only allows the import/export of pure text,
it should be improved to store and load formatted string.

A new XML token is added, which currently refers to an attribute of the
chart:data-point tag. If we want to store formatted string, something
more clever has to be done.

Change-Id: I80c4a3a0dbcf59f1dc732d795fb716da318411cb
Reviewed-on: https://gerrit.libreoffice.org/80156
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/84214
Reviewed-by: Miklos Vajna 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 28bc0f34b53e..a7403e715cc4 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -136,6 +136,7 @@ public:
 void testTdf121744();
 void testTdf122031();
 void testTdf115012();
+void testTdf123206_customLabelText();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -235,6 +236,8 @@ public:
 CPPUNIT_TEST(testTdf121744);
 CPPUNIT_TEST(testTdf122031);
 CPPUNIT_TEST(testTdf115012);
+CPPUNIT_TEST(testTdf123206_customLabelText);
+
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -2191,6 +2194,19 @@ void Chart2ExportTest::testTdf115012()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", 
"zero");
 }
 
+void Chart2ExportTest::testTdf123206_customLabelText()
+{
+load("/chart2/qa/extras/data/docx/", "tdf123206.docx");
+
+Reference xChartDoc(getChartDocFromWriter(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+
+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");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf123206.docx 
b/chart2/qa/extras/data/docx/tdf123206.docx
new file mode 100755
index ..f47089fe3b1b
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf123206.docx differ
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 69ef7e889455..97748c0f9c30 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -533,6 +533,7 @@ namespace xmloff { namespace token {
 XML_CUSTOM_ICONSET,
 XML_CUSTOM_ICONSET_INDEX,
 XML_CUSTOM_ICONSET_NAME,
+XML_CUSTOM_LABEL_FIELD,
 XML_CUT,
 XML_CUT_OFFS,
 XML_CX,
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng 
b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index e5a0116bd029..32a3a85583a3 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2348,4 +2348,13 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 
   
 
+  
+  
+
+  
+
+  
+
+  
+
 
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index 6507cb91b926..5f5bd225de1e 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -88,6 +88,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -119,6 +120,19 @@ using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Any;
 using ::std::vector;
 
+
+namespace
+{
+struct SchXMLDataPointStruct
+{
+OUString   

[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - chart2/qa include/xmloff schema/libreoffice xmloff/source

2019-12-02 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   16 +++
 chart2/qa/extras/data/docx/tdf123206.docx   |binary
 include/xmloff/xmltoken.hxx |1 
 schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng |9 +
 xmloff/source/chart/SchXMLExport.cxx|   63 ++--
 xmloff/source/chart/SchXMLPlotAreaContext.cxx   |9 +
 xmloff/source/chart/SchXMLSeries2Context.cxx|   15 ++
 xmloff/source/chart/transporttypes.hxx  |1 
 xmloff/source/core/xmltoken.cxx |1 
 xmloff/source/token/tokens.txt  |1 
 10 files changed, 107 insertions(+), 9 deletions(-)

New commits:
commit 60464cb113f558d174e5adaa3c012f3df10519c5
Author: Tamas Bunth 
AuthorDate: Thu Oct 3 19:49:57 2019 +0200
Commit: Xisco Faulí 
CommitDate: Mon Dec 2 09:15:44 2019 +0100

tdf#123206 Import/Export chart custom label text

OOX import supports custom label texts in chart diagrams (produced by
e.g. double clicking on a data label, and write custom text), but -
since embedded objects are exported and imported to odf right after 
migration -
it is not displayed in case of a Writer document.

In order to make it work, we have to support custom label text in the
odf structure. This commit only allows the import/export of pure text,
it should be improved to store and load formatted string.

A new XML token is added, which currently refers to an attribute of the
chart:data-point tag. If we want to store formatted string, something
more clever has to be done.

Change-Id: I80c4a3a0dbcf59f1dc732d795fb716da318411cb
Reviewed-on: https://gerrit.libreoffice.org/80156
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/84076

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 8d42c8ac93ac..1645c1c1d1ae 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -149,6 +149,7 @@ public:
 void testTdf121744();
 void testTdf122031();
 void testTdf115012();
+void testTdf123206_customLabelText();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -261,6 +262,8 @@ public:
 CPPUNIT_TEST(testTdf121744);
 CPPUNIT_TEST(testTdf122031);
 CPPUNIT_TEST(testTdf115012);
+CPPUNIT_TEST(testTdf123206_customLabelText);
+
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -2386,6 +2389,19 @@ void Chart2ExportTest::testTdf115012()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", 
"zero");
 }
 
+void Chart2ExportTest::testTdf123206_customLabelText()
+{
+load("/chart2/qa/extras/data/docx/", "tdf123206.docx");
+
+Reference xChartDoc(getChartDocFromWriter(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+
+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");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf123206.docx 
b/chart2/qa/extras/data/docx/tdf123206.docx
new file mode 100755
index ..f47089fe3b1b
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf123206.docx differ
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 751cd423556d..4418f9ba54a0 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -536,6 +536,7 @@ namespace xmloff { namespace token {
 XML_CUSTOM_ICONSET,
 XML_CUSTOM_ICONSET_INDEX,
 XML_CUSTOM_ICONSET_NAME,
+XML_CUSTOM_LABEL_FIELD,
 XML_CUT,
 XML_CUT_OFFS,
 XML_CX,
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng 
b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 47c1ef790dbd..85cbe5debacb 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2394,4 +2394,13 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 
   
 
+  
+  
+
+  
+
+  
+
+  
+
 
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index d94732c7e4b0..4dd2bc43b6c8 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -81,6 +81,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -109,6 +110,19 @@ using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Any;
 using ::std::vector;
 
+
+namespace
+{
+struct SchXMLDataPointStruct
+{
+OUString   

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - chart2/qa include/xmloff schema/libreoffice xmloff/source

2019-12-01 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   16 +++
 chart2/qa/extras/data/docx/tdf123206.docx   |binary
 include/xmloff/xmltoken.hxx |1 
 schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng |9 +
 xmloff/source/chart/SchXMLExport.cxx|   63 ++--
 xmloff/source/chart/SchXMLPlotAreaContext.cxx   |9 +
 xmloff/source/chart/SchXMLSeries2Context.cxx|   15 ++
 xmloff/source/chart/transporttypes.hxx  |1 
 xmloff/source/core/xmltoken.cxx |1 
 xmloff/source/token/tokens.txt  |1 
 10 files changed, 107 insertions(+), 9 deletions(-)

New commits:
commit 6afe2368a9ffa8e97148efc719d9983de803e2f9
Author: Tamas Bunth 
AuthorDate: Thu Oct 3 19:49:57 2019 +0200
Commit: Tamás Bunth 
CommitDate: Sun Dec 1 22:13:25 2019 +0100

tdf#123206 Import/Export chart custom label text

OOX import supports custom label texts in chart diagrams (produced by
e.g. double clicking on a data label, and write custom text), but -
since embedded objects are exported and imported to odf right after 
migration -
it is not displayed in case of a Writer document.

In order to make it work, we have to support custom label text in the
odf structure. This commit only allows the import/export of pure text,
it should be improved to store and load formatted string.

A new XML token is added, which currently refers to an attribute of the
chart:data-point tag. If we want to store formatted string, something
more clever has to be done.

Change-Id: I80c4a3a0dbcf59f1dc732d795fb716da318411cb
Reviewed-on: https://gerrit.libreoffice.org/80156
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/84075
Tested-by: Jenkins CollaboraOffice 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 77bc24a7ac46..e15cd39a20da 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -127,6 +127,7 @@ public:
 void testTdf119029();
 void testTdf121744();
 void testTdf122031();
+void testTdf123206_customLabelText();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -216,6 +217,8 @@ public:
 CPPUNIT_TEST(testTdf119029);
 CPPUNIT_TEST(testTdf121744);
 CPPUNIT_TEST(testTdf122031);
+CPPUNIT_TEST(testTdf123206_customLabelText);
+
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -2022,6 +2025,19 @@ 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::testTdf123206_customLabelText()
+{
+load("/chart2/qa/extras/data/docx/", "tdf123206.docx");
+
+Reference xChartDoc(getChartDocFromWriter(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+
+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");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf123206.docx 
b/chart2/qa/extras/data/docx/tdf123206.docx
new file mode 100755
index ..f47089fe3b1b
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf123206.docx differ
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index aba87d7d5825..a750c7fe4587 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -534,6 +534,7 @@ namespace xmloff { namespace token {
 XML_CUSTOM_ICONSET,
 XML_CUSTOM_ICONSET_INDEX,
 XML_CUSTOM_ICONSET_NAME,
+XML_CUSTOM_LABEL_FIELD,
 XML_CUT,
 XML_CUT_OFFS,
 XML_CX,
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng 
b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 8e8fecbf7895..24607fe6cf2f 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2361,4 +2361,13 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 
   
 
+  
+  
+
+  
+
+  
+
+  
+
 
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index e9e755dde3d1..d13f58e19a62 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -86,6 +86,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -117,6 +118,19 @@ using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Any;
 using ::std::vector;
 
+
+namespace
+{
+

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

2019-11-29 Thread Tamas Bunth (via logerrit)
 chart2/qa/extras/chart2export.cxx   |   16 +++
 chart2/qa/extras/data/docx/tdf123206.docx   |binary
 include/xmloff/xmltoken.hxx |1 
 schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng |9 +
 xmloff/source/chart/SchXMLExport.cxx|   63 ++--
 xmloff/source/chart/SchXMLPlotAreaContext.cxx   |9 +
 xmloff/source/chart/SchXMLSeries2Context.cxx|   15 ++
 xmloff/source/chart/transporttypes.hxx  |1 
 xmloff/source/core/xmltoken.cxx |1 
 xmloff/source/token/tokens.txt  |1 
 10 files changed, 107 insertions(+), 9 deletions(-)

New commits:
commit c2b36cd6f7cf70e77dac5938f18146b0687523e6
Author: Tamas Bunth 
AuthorDate: Thu Oct 3 19:49:57 2019 +0200
Commit: Tamás Bunth 
CommitDate: Fri Nov 29 16:44:12 2019 +0100

tdf#123206 Import/Export chart custom label text

OOX import supports custom label texts in chart diagrams (produced by
e.g. double clicking on a data label, and write custom text), but -
since embedded objects are exported and imported to odf right after 
migration -
it is not displayed in case of a Writer document.

In order to make it work, we have to support custom label text in the
odf structure. This commit only allows the import/export of pure text,
it should be improved to store and load formatted string.

A new XML token is added, which currently refers to an attribute of the
chart:data-point tag. If we want to store formatted string, something
more clever has to be done.

Change-Id: I80c4a3a0dbcf59f1dc732d795fb716da318411cb
Reviewed-on: https://gerrit.libreoffice.org/80156
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 8d42c8ac93ac..1645c1c1d1ae 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -149,6 +149,7 @@ public:
 void testTdf121744();
 void testTdf122031();
 void testTdf115012();
+void testTdf123206_customLabelText();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(testErrorBarXLSX);
@@ -261,6 +262,8 @@ public:
 CPPUNIT_TEST(testTdf121744);
 CPPUNIT_TEST(testTdf122031);
 CPPUNIT_TEST(testTdf115012);
+CPPUNIT_TEST(testTdf123206_customLabelText);
+
 CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -2386,6 +2389,19 @@ void Chart2ExportTest::testTdf115012()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", 
"zero");
 }
 
+void Chart2ExportTest::testTdf123206_customLabelText()
+{
+load("/chart2/qa/extras/data/docx/", "tdf123206.docx");
+
+Reference xChartDoc(getChartDocFromWriter(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML 
Text");
+CPPUNIT_ASSERT(pXmlDoc);
+
+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");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf123206.docx 
b/chart2/qa/extras/data/docx/tdf123206.docx
new file mode 100755
index ..f47089fe3b1b
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf123206.docx differ
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 751cd423556d..4418f9ba54a0 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -536,6 +536,7 @@ namespace xmloff { namespace token {
 XML_CUSTOM_ICONSET,
 XML_CUSTOM_ICONSET_INDEX,
 XML_CUSTOM_ICONSET_NAME,
+XML_CUSTOM_LABEL_FIELD,
 XML_CUT,
 XML_CUT_OFFS,
 XML_CX,
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng 
b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 5da3958ef15e..766added79c3 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2400,4 +2400,13 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 
   
 
+  
+  
+
+  
+
+  
+
+  
+
 
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index 337a322fc469..4dd2bc43b6c8 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -81,6 +81,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -109,6 +110,19 @@ using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Any;
 using ::std::vector;
 
+
+namespace
+{
+struct SchXMLDataPointStruct
+{
+OUString   maStyleName;
+sal_Int32  mnRepeat;
+OUString   msCustomLabelText;
+
+

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

2019-11-29 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/shape.cxx  |2 +-
 sd/qa/unit/data/pptx/tdf113198.pptx |binary
 sd/qa/unit/import-tests.cxx |   16 ++--
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit baac2e608dd0781cdce0e038b2a2d80537b77974
Author: Tamas Bunth 
AuthorDate: Tue Nov 19 12:38:56 2019 +0100
Commit: Andras Timar 
CommitDate: Fri Nov 29 10:51:32 2019 +0100

tdf#113198 set default shape paragraph alignment..

to center when importing oox document.

Using MS Office, the default aligment of a (text) paragraph
inside a shape is centered.

Reviewed-on: https://gerrit.libreoffice.org/83193
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 89f0af144c18efafe2573801641689a1432c0cae)
Reviewed-on: https://gerrit.libreoffice.org/83971
Reviewed-by: Xisco Faulí 
Signed-off-by: Xisco Fauli 

Change-Id: Id9bcaaab109df65f4124f733b2cfee438e82b79b
Reviewed-on: https://gerrit.libreoffice.org/83988
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
Reviewed-on: https://gerrit.libreoffice.org/84038
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 93619d0e7642..baf9b66a996e 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -206,7 +206,7 @@ void Shape::setDefaults(bool bHeight)
 if (bHeight)
 maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< 
float >( 18.0 ));
 maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, 
TextVerticalAdjust_TOP);
-maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_LEFT )); // check for RTL?
+maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_CENTER ));
 }
 
 ::oox::vml::OleObjectInfo& Shape::setOleObjectType()
diff --git a/sd/qa/unit/data/pptx/tdf113198.pptx 
b/sd/qa/unit/data/pptx/tdf113198.pptx
new file mode 100755
index ..a541a2b2647d
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf113198.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index b38d5e51d0c9..c525444c5b26 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -186,7 +186,6 @@ public:
 void testTdf77747();
 void testTdf116266();
 void testTdf126324();
-void testTdf128684();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -196,6 +195,8 @@ public:
 void testTdf120028();
 void testTdf120028b();
 void testCropToShape();
+void testTdf128684();
+void testTdf113198();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -284,6 +285,7 @@ public:
 CPPUNIT_TEST(testTdf120028b);
 CPPUNIT_TEST(testCropToShape);
 CPPUNIT_TEST(testTdf128684);
+CPPUNIT_TEST(testTdf113198);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2694,7 +2696,6 @@ void SdImportTest::testCropToShape()
 CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode);
 }
 
-
 void SdImportTest::testTdf128684()
 {
 sd::DrawDocShellRef xDocShRef
@@ -2722,6 +2723,17 @@ void SdImportTest::testTdf128684()
 CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
 }
 
+void SdImportTest::testTdf113198()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf113198.pptx"), 
PPTX);
+
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef));
+sal_Int16 nParaAdjust = -1;
+xShape->getPropertyValue("ParaAdjust") >>= nParaAdjust;
+CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(nParaAdjust));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-28 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/shape.cxx  |2 +-
 sd/qa/unit/data/pptx/tdf113198.pptx |binary
 sd/qa/unit/import-tests.cxx |   16 ++--
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit dfacdb99208be964111b8c7bdfa2458b080fba71
Author: Tamas Bunth 
AuthorDate: Tue Nov 19 12:38:56 2019 +0100
Commit: Xisco Faulí 
CommitDate: Thu Nov 28 14:07:35 2019 +0100

tdf#113198 set default shape paragraph alignment..

to center when importing oox document.

Using MS Office, the default aligment of a (text) paragraph
inside a shape is centered.

Reviewed-on: https://gerrit.libreoffice.org/83193
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 89f0af144c18efafe2573801641689a1432c0cae)
Reviewed-on: https://gerrit.libreoffice.org/83971
Reviewed-by: Xisco Faulí 
Signed-off-by: Xisco Fauli 

Change-Id: Id9bcaaab109df65f4124f733b2cfee438e82b79b
Reviewed-on: https://gerrit.libreoffice.org/83988
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 7bb7b39e482b..e061902096f6 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -208,7 +208,7 @@ void Shape::setDefaults(bool bHeight)
 if (bHeight)
 maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< 
float >( 18.0 ));
 maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, 
TextVerticalAdjust_TOP);
-maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_LEFT )); // check for RTL?
+maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_CENTER ));
 }
 
 ::oox::vml::OleObjectInfo& Shape::setOleObjectType()
diff --git a/sd/qa/unit/data/pptx/tdf113198.pptx 
b/sd/qa/unit/data/pptx/tdf113198.pptx
new file mode 100755
index ..a541a2b2647d
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf113198.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 943fc49cfc3f..5cab4e7ae8cd 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -196,7 +196,6 @@ public:
 void testTdf77747();
 void testTdf116266();
 void testTdf126324();
-void testTdf128684();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -212,6 +211,8 @@ public:
 void testOOXTheme();
 void testCropToShape();
 void testTdf127964();
+void testTdf128684();
+void testTdf113198();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -308,6 +309,7 @@ public:
 CPPUNIT_TEST(testCropToShape);
 CPPUNIT_TEST(testTdf127964);
 CPPUNIT_TEST(testTdf128684);
+CPPUNIT_TEST(testTdf113198);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2923,7 +2925,6 @@ void SdImportTest::testTdf127964()
 xDocShRef->DoClose();
 }
 
-
 void SdImportTest::testTdf128684()
 {
 sd::DrawDocShellRef xDocShRef
@@ -2950,6 +2951,17 @@ void SdImportTest::testTdf128684()
 CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
 }
 
+void SdImportTest::testTdf113198()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf113198.pptx"), 
PPTX);
+
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef));
+sal_Int16 nParaAdjust = -1;
+xShape->getPropertyValue("ParaAdjust") >>= nParaAdjust;
+CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(nParaAdjust));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-28 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/shape.cxx  |2 +-
 sd/qa/unit/data/pptx/tdf113198.pptx |binary
 sd/qa/unit/import-tests.cxx |   14 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit af6e4633ca12bc2f08db1e86d77847b7793d5791
Author: Tamas Bunth 
AuthorDate: Tue Nov 19 12:38:56 2019 +0100
Commit: Xisco Faulí 
CommitDate: Thu Nov 28 12:07:42 2019 +0100

tdf#113198 set default shape paragraph alignment..

to center when importing oox document.

Using MS Office, the default aligment of a (text) paragraph
inside a shape is centered.

Change-Id: Id9bcaaab109df65f4124f733b2cfee438e82b79b
Reviewed-on: https://gerrit.libreoffice.org/83193
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 89f0af144c18efafe2573801641689a1432c0cae)
Reviewed-on: https://gerrit.libreoffice.org/83971
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 4e574af50869..f1da411ec4af 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -214,7 +214,7 @@ void Shape::setDefaults(bool bHeight)
 if (bHeight)
 maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< 
float >( 18.0 ));
 maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, 
TextVerticalAdjust_TOP);
-maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_LEFT )); // check for RTL?
+maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_CENTER ));
 }
 
 ::oox::vml::OleObjectInfo& Shape::setOleObjectType()
diff --git a/sd/qa/unit/data/pptx/tdf113198.pptx 
b/sd/qa/unit/data/pptx/tdf113198.pptx
new file mode 100755
index ..a541a2b2647d
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf113198.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 3b50bce311ad..025b53077405 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -213,6 +213,7 @@ public:
 void testCropToShape();
 void testTdf127964();
 void testTdf106638();
+void testTdf113198();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -313,6 +314,7 @@ public:
 CPPUNIT_TEST(testTdf127964);
 CPPUNIT_TEST(testTdf106638);
 CPPUNIT_TEST(testTdf128684);
+CPPUNIT_TEST(testTdf113198);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3008,7 +3010,6 @@ void SdImportTest::testTdf106638()
 CPPUNIT_ASSERT(aCharFontName != "Wingdings");
 }
 
-
 void SdImportTest::testTdf128684()
 {
 sd::DrawDocShellRef xDocShRef
@@ -3035,6 +3036,17 @@ void SdImportTest::testTdf128684()
 CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
 }
 
+void SdImportTest::testTdf113198()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf113198.pptx"), 
PPTX);
+
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef));
+sal_Int16 nParaAdjust = -1;
+xShape->getPropertyValue("ParaAdjust") >>= nParaAdjust;
+CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(nParaAdjust));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-27 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/shape.cxx  |2 +-
 sd/qa/unit/data/pptx/tdf113198.pptx |binary
 sd/qa/unit/import-tests.cxx |   14 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 89f0af144c18efafe2573801641689a1432c0cae
Author: Tamas Bunth 
AuthorDate: Tue Nov 19 12:38:56 2019 +0100
Commit: Tamás Bunth 
CommitDate: Thu Nov 28 01:47:13 2019 +0100

tdf#113198 set default shape paragraph alignment..

to center when importing oox document.

Using MS Office, the default aligment of a (text) paragraph
inside a shape is centered.

Change-Id: Id9bcaaab109df65f4124f733b2cfee438e82b79b
Reviewed-on: https://gerrit.libreoffice.org/83193
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 68f0d3c62b51..464961ee5a02 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -214,7 +214,7 @@ void Shape::setDefaults(bool bHeight)
 if (bHeight)
 maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< 
float >( 18.0 ));
 maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, 
TextVerticalAdjust_TOP);
-maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_LEFT )); // check for RTL?
+maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_CENTER ));
 }
 
 ::oox::vml::OleObjectInfo& Shape::setOleObjectType()
diff --git a/sd/qa/unit/data/pptx/tdf113198.pptx 
b/sd/qa/unit/data/pptx/tdf113198.pptx
new file mode 100755
index ..a541a2b2647d
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf113198.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 779a6503577a..600f16ad4957 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -214,6 +214,7 @@ public:
 void testCropToShape();
 void testTdf127964();
 void testTdf106638();
+void testTdf113198();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -315,6 +316,7 @@ public:
 CPPUNIT_TEST(testTdf127964);
 CPPUNIT_TEST(testTdf106638);
 CPPUNIT_TEST(testTdf128684);
+CPPUNIT_TEST(testTdf113198);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3030,7 +3032,6 @@ void SdImportTest::testTdf106638()
 CPPUNIT_ASSERT(aCharFontName != "Wingdings");
 }
 
-
 void SdImportTest::testTdf128684()
 {
 sd::DrawDocShellRef xDocShRef
@@ -3057,6 +3058,17 @@ void SdImportTest::testTdf128684()
 CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
 }
 
+void SdImportTest::testTdf113198()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf113198.pptx"), 
PPTX);
+
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef));
+sal_Int16 nParaAdjust = -1;
+xShape->getPropertyValue("ParaAdjust") >>= nParaAdjust;
+CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(nParaAdjust));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-17 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx |2 +
 sd/qa/unit/data/pptx/tdf128684.pptx|binary
 sd/qa/unit/import-tests.cxx|   30 +
 3 files changed, 32 insertions(+)

New commits:
commit 15606d7539d5f82598f522e7f00be70433b2
Author: Tamas Bunth 
AuthorDate: Thu Nov 14 00:56:08 2019 +0100
Commit: Andras Timar 
CommitDate: Sun Nov 17 16:55:10 2019 +0100

tdf128684: Rotate text in not preset custom shape

The TextPreRotateAngle property should be set in case of a not preset
custom shape as well during ooxml import.

Also add unit test for testing the TextPreRotateAngle property.

Change-Id: Ib5b822286f8a78fe8398bf7e2014a36d7e0a24d5
Reviewed-on: https://gerrit.libreoffice.org/82643
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/83022
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 1b1f6513ab22..3f6d58b07e9f 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -234,6 +234,8 @@ void CustomShapeProperties::pushToPropSet(
 aPropertyMap.setProperty( PROP_Type, OUString( "ooxml-non-primitive" 
));
 aPropertyMap.setProperty( PROP_MirroredX, mbMirroredX );
 aPropertyMap.setProperty( PROP_MirroredY, mbMirroredY );
+if( mnTextRotateAngle )
+aPropertyMap.setProperty( PROP_TextPreRotateAngle, 
mnTextRotateAngle );
 // Note 1: If Equations are defined - they are processed using 
internal div by 360 coordinates
 // while if they are not, standard ooxml coordinates are used.
 // This size specifically affects scaling.
diff --git a/sd/qa/unit/data/pptx/tdf128684.pptx 
b/sd/qa/unit/data/pptx/tdf128684.pptx
new file mode 100755
index ..80a5f30568d3
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf128684.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 0de7cf85963e..b38d5e51d0c9 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -186,6 +186,7 @@ public:
 void testTdf77747();
 void testTdf116266();
 void testTdf126324();
+void testTdf128684();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -282,6 +283,7 @@ public:
 CPPUNIT_TEST(testTdf120028);
 CPPUNIT_TEST(testTdf120028b);
 CPPUNIT_TEST(testCropToShape);
+CPPUNIT_TEST(testTdf128684);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2692,6 +2694,34 @@ void SdImportTest::testCropToShape()
 CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode);
 }
 
+
+void SdImportTest::testTdf128684()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf128684.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDoc.is());
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPage.is());
+uno::Reference xShape(getShape(0, xPage));
+CPPUNIT_ASSERT(xShape.is());
+uno::Any aAny = xShape->getPropertyValue("CustomShapeGeometry");
+CPPUNIT_ASSERT(aAny.hasValue());
+uno::Sequence aProps;
+CPPUNIT_ASSERT(aAny >>= aProps);
+sal_Int32 nRotateAngle = 0;
+for(int i=0;i>= nRotateAngle;
+}
+}
+CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-17 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx |2 +
 sd/qa/unit/data/pptx/tdf128684.pptx|binary
 sd/qa/unit/import-tests.cxx|   29 +
 3 files changed, 31 insertions(+)

New commits:
commit d6c3f1d37f651637ed4d803a2226ead4392fd85f
Author: Tamas Bunth 
AuthorDate: Thu Nov 14 00:56:08 2019 +0100
Commit: Andras Timar 
CommitDate: Sun Nov 17 16:48:41 2019 +0100

tdf128684: Rotate text in not preset custom shape

The TextPreRotateAngle property should be set in case of a not preset
custom shape as well during ooxml import.

Also add unit test for testing the TextPreRotateAngle property.

Change-Id: Ib5b822286f8a78fe8398bf7e2014a36d7e0a24d5
Reviewed-on: https://gerrit.libreoffice.org/82643
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/83021
Reviewed-by: Andras Timar 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index fe3be0c97de2..b937140c04d9 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -234,6 +234,8 @@ void CustomShapeProperties::pushToPropSet(
 aPropertyMap.setProperty( PROP_Type, OUString( "ooxml-non-primitive" 
));
 aPropertyMap.setProperty( PROP_MirroredX, mbMirroredX );
 aPropertyMap.setProperty( PROP_MirroredY, mbMirroredY );
+if( mnTextRotateAngle )
+aPropertyMap.setProperty( PROP_TextPreRotateAngle, 
mnTextRotateAngle );
 // Note 1: If Equations are defined - they are processed using 
internal div by 360 coordinates
 // while if they are not, standard ooxml coordinates are used.
 // This size specifically affects scaling.
diff --git a/sd/qa/unit/data/pptx/tdf128684.pptx 
b/sd/qa/unit/data/pptx/tdf128684.pptx
new file mode 100755
index ..80a5f30568d3
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf128684.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 1d1f5a6a46d1..943fc49cfc3f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -196,6 +196,7 @@ public:
 void testTdf77747();
 void testTdf116266();
 void testTdf126324();
+void testTdf128684();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -306,6 +307,7 @@ public:
 CPPUNIT_TEST(testOOXTheme);
 CPPUNIT_TEST(testCropToShape);
 CPPUNIT_TEST(testTdf127964);
+CPPUNIT_TEST(testTdf128684);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2921,6 +2923,33 @@ void SdImportTest::testTdf127964()
 xDocShRef->DoClose();
 }
 
+
+void SdImportTest::testTdf128684()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf128684.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDoc.is());
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPage.is());
+uno::Reference xShape(getShape(0, xPage));
+CPPUNIT_ASSERT(xShape.is());
+uno::Any aAny = xShape->getPropertyValue("CustomShapeGeometry");
+CPPUNIT_ASSERT(aAny.hasValue());
+uno::Sequence aProps;
+CPPUNIT_ASSERT(aAny >>= aProps);
+sal_Int32 nRotateAngle = 0;
+for( const auto& rProp : std::as_const(aProps) )
+{
+if( rProp.Name == "TextPreRotateAngle")
+{
+rProp.Value >>= nRotateAngle;
+}
+}
+CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-17 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx |2 +
 sd/qa/unit/data/pptx/tdf128684.pptx|binary
 sd/qa/unit/import-tests.cxx|   29 +
 3 files changed, 31 insertions(+)

New commits:
commit c2097477e3a43d75c170a6f7a5daf5dcb2169329
Author: Tamas Bunth 
AuthorDate: Thu Nov 14 00:56:08 2019 +0100
Commit: Andras Timar 
CommitDate: Sun Nov 17 16:15:04 2019 +0100

tdf128684: Rotate text in not preset custom shape

The TextPreRotateAngle property should be set in case of a not preset
custom shape as well during ooxml import.

Also add unit test for testing the TextPreRotateAngle property.

Change-Id: Ib5b822286f8a78fe8398bf7e2014a36d7e0a24d5
Reviewed-on: https://gerrit.libreoffice.org/82643
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 742f59eaa38a3f13b6110573b1428de45c55b035)
Reviewed-on: https://gerrit.libreoffice.org/83020
Reviewed-by: Andras Timar 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index df878d39eec3..2f4848088cc4 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -230,6 +230,8 @@ void CustomShapeProperties::pushToPropSet(
 aPropertyMap.setProperty( PROP_Type, OUString( "ooxml-non-primitive" 
));
 aPropertyMap.setProperty( PROP_MirroredX, mbMirroredX );
 aPropertyMap.setProperty( PROP_MirroredY, mbMirroredY );
+if( mnTextRotateAngle )
+aPropertyMap.setProperty( PROP_TextPreRotateAngle, 
mnTextRotateAngle );
 // Note 1: If Equations are defined - they are processed using 
internal div by 360 coordinates
 // while if they are not, standard ooxml coordinates are used.
 // This size specifically affects scaling.
diff --git a/sd/qa/unit/data/pptx/tdf128684.pptx 
b/sd/qa/unit/data/pptx/tdf128684.pptx
new file mode 100755
index ..80a5f30568d3
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf128684.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 191592bbc592..3b50bce311ad 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -196,6 +196,7 @@ public:
 void testTdf77747();
 void testTdf116266();
 void testTdf126324();
+void testTdf128684();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -311,6 +312,7 @@ public:
 CPPUNIT_TEST(testCropToShape);
 CPPUNIT_TEST(testTdf127964);
 CPPUNIT_TEST(testTdf106638);
+CPPUNIT_TEST(testTdf128684);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3006,6 +3008,33 @@ void SdImportTest::testTdf106638()
 CPPUNIT_ASSERT(aCharFontName != "Wingdings");
 }
 
+
+void SdImportTest::testTdf128684()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf128684.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDoc.is());
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPage.is());
+uno::Reference xShape(getShape(0, xPage));
+CPPUNIT_ASSERT(xShape.is());
+uno::Any aAny = xShape->getPropertyValue("CustomShapeGeometry");
+CPPUNIT_ASSERT(aAny.hasValue());
+uno::Sequence aProps;
+CPPUNIT_ASSERT(aAny >>= aProps);
+sal_Int32 nRotateAngle = 0;
+for( const auto& rProp : std::as_const(aProps) )
+{
+if( rProp.Name == "TextPreRotateAngle")
+{
+rProp.Value >>= nRotateAngle;
+}
+}
+CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-16 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx |2 +
 sd/qa/unit/data/pptx/tdf128684.pptx|binary
 sd/qa/unit/import-tests.cxx|   29 +
 3 files changed, 31 insertions(+)

New commits:
commit 742f59eaa38a3f13b6110573b1428de45c55b035
Author: Tamas Bunth 
AuthorDate: Thu Nov 14 00:56:08 2019 +0100
Commit: Tamás Bunth 
CommitDate: Sat Nov 16 13:41:20 2019 +0100

tdf128684: Rotate text in not preset custom shape

The TextPreRotateAngle property should be set in case of a not preset
custom shape as well during ooxml import.

Also add unit test for testing the TextPreRotateAngle property.

Change-Id: Ib5b822286f8a78fe8398bf7e2014a36d7e0a24d5
Reviewed-on: https://gerrit.libreoffice.org/82643
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index df878d39eec3..2f4848088cc4 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -230,6 +230,8 @@ void CustomShapeProperties::pushToPropSet(
 aPropertyMap.setProperty( PROP_Type, OUString( "ooxml-non-primitive" 
));
 aPropertyMap.setProperty( PROP_MirroredX, mbMirroredX );
 aPropertyMap.setProperty( PROP_MirroredY, mbMirroredY );
+if( mnTextRotateAngle )
+aPropertyMap.setProperty( PROP_TextPreRotateAngle, 
mnTextRotateAngle );
 // Note 1: If Equations are defined - they are processed using 
internal div by 360 coordinates
 // while if they are not, standard ooxml coordinates are used.
 // This size specifically affects scaling.
diff --git a/sd/qa/unit/data/pptx/tdf128684.pptx 
b/sd/qa/unit/data/pptx/tdf128684.pptx
new file mode 100755
index ..80a5f30568d3
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf128684.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 191592bbc592..3b50bce311ad 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -196,6 +196,7 @@ public:
 void testTdf77747();
 void testTdf116266();
 void testTdf126324();
+void testTdf128684();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -311,6 +312,7 @@ public:
 CPPUNIT_TEST(testCropToShape);
 CPPUNIT_TEST(testTdf127964);
 CPPUNIT_TEST(testTdf106638);
+CPPUNIT_TEST(testTdf128684);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3006,6 +3008,33 @@ void SdImportTest::testTdf106638()
 CPPUNIT_ASSERT(aCharFontName != "Wingdings");
 }
 
+
+void SdImportTest::testTdf128684()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf128684.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDoc.is());
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPage.is());
+uno::Reference xShape(getShape(0, xPage));
+CPPUNIT_ASSERT(xShape.is());
+uno::Any aAny = xShape->getPropertyValue("CustomShapeGeometry");
+CPPUNIT_ASSERT(aAny.hasValue());
+uno::Sequence aProps;
+CPPUNIT_ASSERT(aAny >>= aProps);
+sal_Int32 nRotateAngle = 0;
+for( const auto& rProp : std::as_const(aProps) )
+{
+if( rProp.Name == "TextPreRotateAngle")
+{
+rProp.Value >>= nRotateAngle;
+}
+}
+CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-04 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx |   40 
+-
 1 file changed, 23 insertions(+), 17 deletions(-)

New commits:
commit 8349e919a8a6d6b8c81956806e13b567261c8853
Author: Tamas Bunth 
AuthorDate: Sun Jan 6 17:10:26 2019 +0100
Commit: Andras Timar 
CommitDate: Sun Nov 3 23:08:50 2019 +0100

mysqlc: replace initializer list with assignment

Because visual c++ compiler may not support it without creating a
constructor for the struct.

Change-Id: I6c8868c4e34cbe7b67e413b1db18aed01378c959
Reviewed-on: https://gerrit.libreoffice.org/65905
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76727
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/81901
Tested-by: Jenkins

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
index 49873f8e5841..3edcaeaab5de 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
@@ -37,23 +37,29 @@ OResultSetMetaData::OResultSetMetaData(OConnection& rConn, 
MYSQL_RES* pResult)
 unsigned nFieldCount = mysql_num_fields(pResult);
 for (unsigned i = 0; i < nFieldCount; ++i)
 {
-MySqlFieldInfo fieldInfo{
-OUString{ fields[i].name, 
static_cast(fields[i].name_length),
-  m_rConnection.getConnectionEncoding() }, // column name
-static_cast(fields[i].length), // length
-mysqlc_sdbc_driver::mysqlToOOOType(fields[i].type, 
fields[i].charsetnr), // type
-fields[i].type, // mysql_type
-fields[i].charsetnr, // charset number
-fields[i].flags,
-OUString{ fields[i].db, 
static_cast(fields[i].db_length),
-  m_rConnection.getConnectionEncoding() }, // schema name
-OUString{ fields[i].table, 
static_cast(fields[i].table_length),
-  m_rConnection.getConnectionEncoding() }, // table name
-OUString{ fields[i].catalog, 
static_cast(fields[i].catalog_length),
-  m_rConnection.getConnectionEncoding() }, // catalog
-static_cast(fields[i].decimals),
-static_cast(fields[i].max_length)
-};
+MySqlFieldInfo fieldInfo;
+{
+fieldInfo.columnName
+= OUString{ fields[i].name, 
static_cast(fields[i].name_length),
+m_rConnection.getConnectionEncoding() };
+fieldInfo.length = static_cast(fields[i].length);
+fieldInfo.type
+= mysqlc_sdbc_driver::mysqlToOOOType(fields[i].type, 
fields[i].charsetnr);
+fieldInfo.mysql_type = fields[i].type;
+fieldInfo.charsetNumber = fields[i].charsetnr;
+fieldInfo.flags = fields[i].flags;
+fieldInfo.schemaName
+= OUString{ fields[i].db, 
static_cast(fields[i].db_length),
+m_rConnection.getConnectionEncoding() };
+fieldInfo.tableName
+= OUString{ fields[i].table, 
static_cast(fields[i].table_length),
+m_rConnection.getConnectionEncoding() };
+fieldInfo.catalogName
+= OUString{ fields[i].catalog, 
static_cast(fields[i].catalog_length),
+m_rConnection.getConnectionEncoding() };
+fieldInfo.decimals = static_cast(fields[i].decimals);
+fieldInfo.max_length = 
static_cast(fields[i].max_length);
+}
 m_fields.push_back(std::move(fieldInfo));
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: connectivity/Module_connectivity.mk postprocess/CustomTarget_registry.mk

2019-11-04 Thread Tamas Bunth (via logerrit)
 connectivity/Module_connectivity.mk  |1 +
 postprocess/CustomTarget_registry.mk |5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit f9fb1e1abc2f6326e3c495e11eca7d64f8fdfc27
Author: Tamas Bunth 
AuthorDate: Tue Sep 17 12:30:12 2019 +0200
Commit: Andras Timar 
CommitDate: Mon Nov 4 09:25:55 2019 +0100

Build mysql_jdbc library even when building without java

Change-Id: Iecf49ab466a77f8342e69bf245a30e1529fe0078
Reviewed-on: https://gerrit.libreoffice.org/79056
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/81917
Tested-by: Jenkins

diff --git a/connectivity/Module_connectivity.mk 
b/connectivity/Module_connectivity.mk
index 1a29e0798948..6a5dd926331b 100644
--- a/connectivity/Module_connectivity.mk
+++ b/connectivity/Module_connectivity.mk
@@ -22,6 +22,7 @@ $(eval $(call gb_Module_add_targets,connectivity,\
Configuration_flat \
Configuration_mysql_jdbc \
Configuration_odbc \
+   Configuration_mysql_jdbc \
Configuration_writer \
Library_calc \
Library_dbase \
diff --git a/postprocess/CustomTarget_registry.mk 
b/postprocess/CustomTarget_registry.mk
index a2560f2e2d74..579c608cf7fb 100644
--- a/postprocess/CustomTarget_registry.mk
+++ b/postprocess/CustomTarget_registry.mk
@@ -277,8 +277,9 @@ ifeq (DBCONNECTIVITY,$(filter DBCONNECTIVITY,$(BUILD_TYPE)))
 postprocess_FILES_main += \
$(call 
gb_XcuModuleTarget_get_target,connectivity/registry/dbase)/org/openoffice/Office/DataAccess/Drivers-dbase.xcu
 \
$(call 
gb_XcuModuleTarget_get_target,connectivity/registry/flat)/org/openoffice/Office/DataAccess/Drivers-flat.xcu
 \
-   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/odbc)/org/openoffice/Office/DataAccess/Drivers-odbc.xcu
-postprocess_DRIVERS += dbase flat odbc
+   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/odbc)/org/openoffice/Office/DataAccess/Drivers-odbc.xcu
 \
+   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/mysql_jdbc)/org/openoffice/Office/DataAccess/Drivers-mysql_jdbc.xcu
+postprocess_DRIVERS += dbase flat odbc mysql_jdbc
 ifeq (WNT,$(OS))
 else ifeq (DBCONNECTIVITY,$(filter DBCONNECTIVITY,$(BUILD_TYPE)))
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-01 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/textfield.cxx  |6 ++
 sd/qa/unit/data/pptx/tdf126324.pptx |binary
 sd/qa/unit/import-tests.cxx |   17 +
 3 files changed, 23 insertions(+)

New commits:
commit 834fb2bf399d2fb1f2ab6f7a3f39c02b37744104
Author: Tamas Bunth 
AuthorDate: Tue Oct 29 14:53:05 2019 +0100
Commit: Andras Timar 
CommitDate: Fri Nov 1 10:46:50 2019 +0100

tdf#126324 pptx unit test for custom date import

Add unit test for importing custom date field ( element of type
"datetime")

Change-Id: Ifcb5641c99eeb79afe54b801750e68792880c000
Reviewed-on: https://gerrit.libreoffice.org/81687
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sd/qa/unit/data/pptx/tdf126324.pptx 
b/sd/qa/unit/data/pptx/tdf126324.pptx
new file mode 100644
index ..d5540cdc4de4
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf126324.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 362d67814d91..0de7cf85963e 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -185,6 +185,7 @@ public:
 void testTdf116899();
 void testTdf77747();
 void testTdf116266();
+void testTdf126324();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -269,6 +270,7 @@ public:
 CPPUNIT_TEST(testTdf114913);
 CPPUNIT_TEST(testTdf114821);
 CPPUNIT_TEST(testTdf115394);
+CPPUNIT_TEST(testTdf126324);
 CPPUNIT_TEST(testTdf115394PPT);
 CPPUNIT_TEST(testTdf51340);
 CPPUNIT_TEST(testTdf116899);
@@ -2652,6 +2654,21 @@ void SdImportTest::testTdf120028b()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf126324()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126324.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDoc.is());
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPage.is());
+uno::Reference xShape(getShape(0, xPage));
+CPPUNIT_ASSERT(xShape.is());
+uno::Reference< text::XText > xText = uno::Reference< text::XTextRange>( 
xShape, uno::UNO_QUERY_THROW )->getText();
+CPPUNIT_ASSERT_EQUAL(OUString{"17"}, xText->getString());
+}
+
 void SdImportTest::testCropToShape()
 {
 sd::DrawDocShellRef xDocShRef
commit 43446b54a2642e367bddca63f14f1b6da58e2149
Author: Tamas Bunth 
AuthorDate: Fri Oct 25 17:45:01 2019 +0200
Commit: Andras Timar 
CommitDate: Fri Nov 1 10:46:39 2019 +0100

tdf#126324 Import custom date as custom XTextField

Change-Id: I89f96490a47210e7daa3b21b2399e0dfe0cf3abf
Reviewed-on: https://gerrit.libreoffice.org/81513
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/81662
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/oox/source/drawingml/textfield.cxx 
b/oox/source/drawingml/textfield.cxx
index a3e2bf4948c6..ae0672896e50 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -66,6 +66,12 @@ void lclCreateTextFields( std::vector< Reference< XTextField 
> > & aFields,
 OString p( s.pData->buffer + 8 );
 try
 {
+if(p.startsWith("'"))
+{
+xIface = xFactory->createInstance( 
"com.sun.star.text.TextField.Custom" );
+aFields.emplace_back( xIface, UNO_QUERY );
+return;
+}
 bool bIsDate = true;
 int idx = p.toInt32();
 sal_uInt16 nNumFmt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-30 Thread Tamas Bunth (via logerrit)
 sd/qa/unit/data/pptx/tdf126324.pptx |binary
 sd/qa/unit/import-tests.cxx |   17 +
 2 files changed, 17 insertions(+)

New commits:
commit fddfbeff8a8989a1e8852d77f69f834c79eff62f
Author: Tamas Bunth 
AuthorDate: Tue Oct 29 14:53:05 2019 +0100
Commit: Xisco Faulí 
CommitDate: Wed Oct 30 09:19:47 2019 +0100

tdf#126324 pptx unit test for custom date import

Add unit test for importing custom date field ( element of type
"datetime")

Change-Id: Ifcb5641c99eeb79afe54b801750e68792880c000
Reviewed-on: https://gerrit.libreoffice.org/81682
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/sd/qa/unit/data/pptx/tdf126324.pptx 
b/sd/qa/unit/data/pptx/tdf126324.pptx
new file mode 100644
index ..d5540cdc4de4
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf126324.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 298fc53c14a1..a7f1a9a344e5 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -194,6 +194,7 @@ public:
 void testTdf116899();
 void testTdf77747();
 void testTdf116266();
+void testTdf126324();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -289,6 +290,7 @@ public:
 CPPUNIT_TEST(testTdf114913);
 CPPUNIT_TEST(testTdf114821);
 CPPUNIT_TEST(testTdf115394);
+CPPUNIT_TEST(testTdf126324);
 CPPUNIT_TEST(testTdf115394PPT);
 CPPUNIT_TEST(testTdf51340);
 CPPUNIT_TEST(testTdf116899);
@@ -2811,6 +2813,21 @@ void SdImportTest::testTdf120028b()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf126324()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126324.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDoc.is());
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPage.is());
+uno::Reference xShape(getShape(0, xPage));
+CPPUNIT_ASSERT(xShape.is());
+uno::Reference< text::XText > xText = uno::Reference< text::XTextRange>( 
xShape, uno::UNO_QUERY_THROW )->getText();
+CPPUNIT_ASSERT_EQUAL(OUString{"17"}, xText->getString());
+}
+
 void SdImportTest::testDescriptionImport()
 {
 sd::DrawDocShellRef xDocShRef
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - oox/source

2019-10-30 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/textfield.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit a8a97925f79bb1859604988483168c9dded44052
Author: Tamas Bunth 
AuthorDate: Fri Oct 25 17:45:01 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Oct 30 09:09:01 2019 +0100

tdf#126324 Import custom date as custom XTextField

Change-Id: I89f96490a47210e7daa3b21b2399e0dfe0cf3abf
Reviewed-on: https://gerrit.libreoffice.org/81513
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit df9672b1fada6fc847bfa4c8a8f016fb2af6a7b5)
Reviewed-on: https://gerrit.libreoffice.org/81592
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/drawingml/textfield.cxx 
b/oox/source/drawingml/textfield.cxx
index 713c5a745b3d..f7f9a6f28f40 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -67,6 +67,12 @@ void lclCreateTextFields( std::vector< Reference< XTextField 
> > & aFields,
 OString p( s.pData->buffer + 8 );
 try
 {
+if(p.startsWith("'"))
+{
+xIface = xFactory->createInstance( 
"com.sun.star.text.TextField.Custom" );
+aFields.emplace_back( xIface, UNO_QUERY );
+return;
+}
 bool bIsDate = true;
 int idx = p.toInt32();
 sal_uInt16 nNumFmt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sd/qa

2019-10-29 Thread Tamas Bunth (via logerrit)
 sd/qa/unit/data/pptx/tdf126324.pptx |binary
 sd/qa/unit/import-tests.cxx |   17 +
 2 files changed, 17 insertions(+)

New commits:
commit bf10253dd556b69fa771320c986c05c653e6d220
Author: Tamas Bunth 
AuthorDate: Tue Oct 29 14:53:05 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 29 21:15:37 2019 +0100

tdf#126324 pptx unit test for custom date import

Add unit test for importing custom date field ( element of type
"datetime")

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

diff --git a/sd/qa/unit/data/pptx/tdf126324.pptx 
b/sd/qa/unit/data/pptx/tdf126324.pptx
new file mode 100644
index ..d5540cdc4de4
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf126324.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index f083b38bbc58..1d1f5a6a46d1 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -195,6 +195,7 @@ public:
 void testTdf116899();
 void testTdf77747();
 void testTdf116266();
+void testTdf126324();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -287,6 +288,7 @@ public:
 CPPUNIT_TEST(testTdf114913);
 CPPUNIT_TEST(testTdf114821);
 CPPUNIT_TEST(testTdf115394);
+CPPUNIT_TEST(testTdf126324);
 CPPUNIT_TEST(testTdf115394PPT);
 CPPUNIT_TEST(testTdf51340);
 CPPUNIT_TEST(testTdf116899);
@@ -2749,6 +2751,21 @@ void SdImportTest::testTdf120028b()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf126324()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126324.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDoc.is());
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPage.is());
+uno::Reference xShape(getShape(0, xPage));
+CPPUNIT_ASSERT(xShape.is());
+uno::Reference< text::XText > xText = uno::Reference< text::XTextRange>( 
xShape, uno::UNO_QUERY_THROW )->getText();
+CPPUNIT_ASSERT_EQUAL(OUString{"17"}, xText->getString());
+}
+
 void SdImportTest::testDescriptionImport()
 {
 sd::DrawDocShellRef xDocShRef
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-25 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/textfield.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit df9672b1fada6fc847bfa4c8a8f016fb2af6a7b5
Author: Tamas Bunth 
AuthorDate: Fri Oct 25 17:45:01 2019 +0200
Commit: Tamás Bunth 
CommitDate: Fri Oct 25 20:22:35 2019 +0200

tdf#126324 Import custom date as custom XTextField

Change-Id: I89f96490a47210e7daa3b21b2399e0dfe0cf3abf
Reviewed-on: https://gerrit.libreoffice.org/81513
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/oox/source/drawingml/textfield.cxx 
b/oox/source/drawingml/textfield.cxx
index 1151f31d1a6d..61b50e8ef549 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -67,6 +67,12 @@ void lclCreateTextFields( std::vector< Reference< XTextField 
> > & aFields,
 OString p( s.pData->buffer + 8 );
 try
 {
+if(p.startsWith("'"))
+{
+xIface = xFactory->createInstance( 
"com.sun.star.text.TextField.Custom" );
+aFields.emplace_back( xIface, UNO_QUERY );
+return;
+}
 bool bIsDate = true;
 int idx = p.toInt32();
 sal_uInt16 nNumFmt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - connectivity/Module_connectivity.mk postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk Repository.mk

2019-09-19 Thread Tamas Bunth (via logerrit)
 Repository.mk|2 +-
 connectivity/Module_connectivity.mk  |4 ++--
 postprocess/CustomTarget_registry.mk |   10 +-
 postprocess/Rdb_services.mk  |2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 1fb358bcd50d6729dde8071c857206ce7560f1a0
Author: Tamas Bunth 
AuthorDate: Tue Sep 17 12:30:12 2019 +0200
Commit: Andras Timar 
CommitDate: Thu Sep 19 13:32:10 2019 +0200

Build mysql_jdbc library even when building without java

Change-Id: Iecf49ab466a77f8342e69bf245a30e1529fe0078
Reviewed-on: https://gerrit.libreoffice.org/79056
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/Repository.mk b/Repository.mk
index 91b080963b6d..c8a4afba4a51 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -404,7 +404,7 @@ $(eval $(call 
gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
msfilter \
$(call gb_Helper_optional,SCRIPTING,msforms) \
mtfrenderer \
-   $(if $(ENABLE_JAVA),mysql_jdbc) \
+   $(call gb_Helper_optional,DBCONNECTIVITY,mysql_jdbc) \
$(call gb_Helper_optional,MARIADBC,$(call 
gb_Helper_optional,DBCONNECTIVITY,mysqlc)) \
numbertext \
odbc \
diff --git a/connectivity/Module_connectivity.mk 
b/connectivity/Module_connectivity.mk
index 4d2596c4602e..b4f813739c0e 100644
--- a/connectivity/Module_connectivity.mk
+++ b/connectivity/Module_connectivity.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_Module_add_targets,connectivity,\
Configuration_dbase \
Configuration_flat \
Configuration_odbc \
+   Configuration_mysql_jdbc \
Configuration_writer \
Library_calc \
Library_dbase \
@@ -28,6 +29,7 @@ $(eval $(call gb_Module_add_targets,connectivity,\
Library_file \
Library_flat \
$(if $(filter ANDROID iOS,$(OS)),,Library_odbc) \
+   Library_mysql_jdbc \
Library_sdbc2 \
Library_writer \
 ))
@@ -40,8 +42,6 @@ ifneq ($(ENABLE_JAVA),)
 $(eval $(call gb_Module_add_targets,connectivity,\
Configuration_hsqldb \
Configuration_jdbc \
-   Configuration_mysql_jdbc \
-   Library_mysql_jdbc \
Jar_sdbc_hsqldb \
Library_hsqldb \
Library_jdbc \
diff --git a/postprocess/CustomTarget_registry.mk 
b/postprocess/CustomTarget_registry.mk
index 43a401db5092..f8460eae30ba 100644
--- a/postprocess/CustomTarget_registry.mk
+++ b/postprocess/CustomTarget_registry.mk
@@ -277,8 +277,9 @@ ifeq (DBCONNECTIVITY,$(filter DBCONNECTIVITY,$(BUILD_TYPE)))
 postprocess_FILES_main += \
$(call 
gb_XcuModuleTarget_get_target,connectivity/registry/dbase)/org/openoffice/Office/DataAccess/Drivers-dbase.xcu
 \
$(call 
gb_XcuModuleTarget_get_target,connectivity/registry/flat)/org/openoffice/Office/DataAccess/Drivers-flat.xcu
 \
-   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/odbc)/org/openoffice/Office/DataAccess/Drivers-odbc.xcu
-postprocess_DRIVERS += dbase flat odbc
+   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/odbc)/org/openoffice/Office/DataAccess/Drivers-odbc.xcu
 \
+   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/mysql_jdbc)/org/openoffice/Office/DataAccess/Drivers-mysql_jdbc.xcu
+postprocess_DRIVERS += dbase flat odbc mysql_jdbc
 ifeq (WNT,$(OS))
 else ifeq (DBCONNECTIVITY,$(filter DBCONNECTIVITY,$(BUILD_TYPE)))
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
@@ -331,9 +332,8 @@ endif
 ifeq ($(ENABLE_JAVA),TRUE)
 postprocess_FILES_main += \
$(call 
gb_XcuModuleTarget_get_target,connectivity/registry/hsqldb)/org/openoffice/Office/DataAccess/Drivers-hsqldb.xcu
 \
-   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/jdbc)/org/openoffice/Office/DataAccess/Drivers-jdbc.xcu
 \
-   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/mysql_jdbc)/org/openoffice/Office/DataAccess/Drivers-mysql_jdbc.xcu
-postprocess_DRIVERS += hsqldb jdbc mysql_jdbc
+   $(call 
gb_XcuModuleTarget_get_target,connectivity/registry/jdbc)/org/openoffice/Office/DataAccess/Drivers-jdbc.xcu
+postprocess_DRIVERS += hsqldb jdbc
 endif
 ifeq ($(ENABLE_FIREBIRD_SDBC),TRUE)
 postprocess_FILES_main += \
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index 6e92e790339f..f53ed61c8eb1 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -263,8 +263,8 @@ $(eval $(call gb_Rdb_add_components,services,\
$(if $(ENABLE_JAVA), \
connectivity/source/drivers/hsqldb/hsqldb \
connectivity/source/drivers/jdbc/jdbc \
-   connectivity/source/drivers/mysql_jdbc/mysql_jdbc \
) \
+   connectivity/source/drivers/mysql_jdbc/mysql_jdbc \
connectivity/source/manager/sdbc2 \
connectivity/source/drivers/writer/writer \
dbaccess/source/ext/macromigration/dbmm \
___
Libreoffice-commits mailing list

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

2019-09-18 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_general.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 882cfc31f88cf62b46c29b737c24afd11b6d560c
Author: Tamas Bunth 
AuthorDate: Wed Sep 11 12:55:20 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Sep 18 12:33:17 2019 +0200

tdf#126852 Bind TEXT mysql type to Clob

Change-Id: I5a71666f1fafa9507032deffafebf885813a0369
Reviewed-on: https://gerrit.libreoffice.org/78815
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 47a62ede2403772b8743bfcfa0b6dd4be17fec9c)
Reviewed-on: https://gerrit.libreoffice.org/79083
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
index 75b97b4028de..4c7c8465c798 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
@@ -202,8 +202,10 @@ sal_Int32 mysqlStrToOOOType(const OUString& sType)
 return css::sdbc::DataType::BLOB;
 if (sType.equalsIgnoreAsciiCase("varbinary"))
 return css::sdbc::DataType::VARBINARY;
-if (sType.equalsIgnoreAsciiCase("text") || 
sType.equalsIgnoreAsciiCase("char"))
+if (sType.equalsIgnoreAsciiCase("char"))
 return css::sdbc::DataType::CHAR;
+if (sType.equalsIgnoreAsciiCase("text"))
+return css::sdbc::DataType::CLOB;
 if (sType.equalsIgnoreAsciiCase("binary"))
 return css::sdbc::DataType::BINARY;
 if (sType.equalsIgnoreAsciiCase("time"))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-09-17 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_general.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 47a62ede2403772b8743bfcfa0b6dd4be17fec9c
Author: Tamas Bunth 
AuthorDate: Wed Sep 11 12:55:20 2019 +0200
Commit: Tamás Bunth 
CommitDate: Tue Sep 17 13:24:34 2019 +0200

tdf#126852 Bind TEXT mysql type to Clob

Change-Id: I5a71666f1fafa9507032deffafebf885813a0369
Reviewed-on: https://gerrit.libreoffice.org/78815
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
index 75b97b4028de..4c7c8465c798 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
@@ -202,8 +202,10 @@ sal_Int32 mysqlStrToOOOType(const OUString& sType)
 return css::sdbc::DataType::BLOB;
 if (sType.equalsIgnoreAsciiCase("varbinary"))
 return css::sdbc::DataType::VARBINARY;
-if (sType.equalsIgnoreAsciiCase("text") || 
sType.equalsIgnoreAsciiCase("char"))
+if (sType.equalsIgnoreAsciiCase("char"))
 return css::sdbc::DataType::CHAR;
+if (sType.equalsIgnoreAsciiCase("text"))
+return css::sdbc::DataType::CLOB;
 if (sType.equalsIgnoreAsciiCase("binary"))
 return css::sdbc::DataType::BINARY;
 if (sType.equalsIgnoreAsciiCase("time"))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - connectivity/source

2019-09-17 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 3598b74da8240190076f975fd7d1ff2b2d7d65dc
Author: Tamas Bunth 
AuthorDate: Thu Sep 5 14:31:35 2019 +0200
Commit: Andras Timar 
CommitDate: Tue Sep 17 12:52:30 2019 +0200

mysqlc: Support connection to utf8mb4 server

This charset is backward compatible with 'normal' utf-8.

Change-Id: I4407894bf9029b9c56eb0d2530796e85bd226591
Reviewed-on: https://gerrit.libreoffice.org/78655
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 981fe7392aa5..0c40866dc3e6 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -88,6 +88,8 @@ void OConnection::construct(const OUString& url, const 
Sequence&
 // use TCP as connection
 mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
 mysql_options(_mysql, MYSQL_OPT_PROTOCOL, );
+OString charset_name{ "utf8mb4" };
+mysql_options(_mysql, MYSQL_SET_CHARSET_NAME, charset_name.getStr());
 
 sal_Int32 nIndex;
 OUString token;
@@ -198,8 +200,9 @@ void OConnection::construct(const OUString& url, const 
Sequence&
*this, OUString(), 0, Any());
 }
 
-lcl_executeUpdate(_mysql, OString{ "SET session sql_mode='ANSI_QUOTES'" 
});
-lcl_executeUpdate(_mysql, OString{ "SET NAMES utf8" });
+lcl_executeUpdate(_mysql,
+  OString{ "SET session 
sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" });
+lcl_executeUpdate(_mysql, OString{ "SET NAMES utf8mb4" });
 }
 
 OUString OConnection::getImplementationName()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

2019-09-09 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit e0932464fd8dc19de4f2c25bf9ef0812d8c02a64
Author: Tamas Bunth 
AuthorDate: Thu Sep 5 14:31:35 2019 +0200
Commit: Xisco Faulí 
CommitDate: Tue Sep 10 00:42:18 2019 +0200

mysqlc: Support connection to utf8mb4 server

This charset is backward compatible with 'normal' utf-8.

Change-Id: I4407894bf9029b9c56eb0d2530796e85bd226591
Reviewed-on: https://gerrit.libreoffice.org/78650
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit cc876706b1626078ee056c35f7dda1efcc315df9)
Reviewed-on: https://gerrit.libreoffice.org/78784
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 4ad4d2c6f29b..fb64dd0339e1 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -88,6 +88,8 @@ void OConnection::construct(const OUString& url, const 
Sequence&
 // use TCP as connection
 mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
 mysql_options(_mysql, MYSQL_OPT_PROTOCOL, );
+OString charset_name{ "utf8mb4" };
+mysql_options(_mysql, MYSQL_SET_CHARSET_NAME, charset_name.getStr());
 
 sal_Int32 nIndex;
 OUString token;
@@ -198,7 +200,7 @@ void OConnection::construct(const OUString& url, const 
Sequence&
 
 lcl_executeUpdate(_mysql,
   OString{ "SET session 
sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" });
-lcl_executeUpdate(_mysql, OString{ "SET NAMES utf8" });
+lcl_executeUpdate(_mysql, OString{ "SET NAMES utf8mb4" });
 }
 
 OUString OConnection::getImplementationName()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - connectivity/source

2019-09-07 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 2454cbd3d810679b0703b0764abf2d05b01c89e7
Author: Tamas Bunth 
AuthorDate: Thu Sep 5 14:31:35 2019 +0200
Commit: Tamás Bunth 
CommitDate: Sat Sep 7 10:30:13 2019 +0200

mysqlc: Support connection to utf8mb4 server

This charset is backward compatible with 'normal' utf-8.

Change-Id: I4407894bf9029b9c56eb0d2530796e85bd226591
Reviewed-on: https://gerrit.libreoffice.org/78654
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index e6149975be9c..56be89aaf4e7 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -88,6 +88,8 @@ void OConnection::construct(const rtl::OUString& url, const 
Sequencehttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-09-06 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit cc876706b1626078ee056c35f7dda1efcc315df9
Author: Tamas Bunth 
AuthorDate: Thu Sep 5 14:31:35 2019 +0200
Commit: Tamás Bunth 
CommitDate: Fri Sep 6 16:05:01 2019 +0200

mysqlc: Support connection to utf8mb4 server

This charset is backward compatible with 'normal' utf-8.

Change-Id: I4407894bf9029b9c56eb0d2530796e85bd226591
Reviewed-on: https://gerrit.libreoffice.org/78650
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index a9d4438dfa97..48cc6aca3a00 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -88,6 +88,8 @@ void OConnection::construct(const OUString& url, const 
Sequence&
 // use TCP as connection
 mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
 mysql_options(_mysql, MYSQL_OPT_PROTOCOL, );
+OString charset_name{ "utf8mb4" };
+mysql_options(_mysql, MYSQL_SET_CHARSET_NAME, charset_name.getStr());
 
 sal_Int32 nIndex;
 OUString token;
@@ -198,7 +200,7 @@ void OConnection::construct(const OUString& url, const 
Sequence&
 
 lcl_executeUpdate(_mysql,
   OString{ "SET session 
sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" });
-lcl_executeUpdate(_mysql, OString{ "SET NAMES utf8" });
+lcl_executeUpdate(_mysql, OString{ "SET NAMES utf8mb4" });
 }
 
 OUString OConnection::getImplementationName()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

2019-09-04 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 8483f48aa90d9c487320af855e333c1e6c9453c2
Author: Tamas Bunth 
AuthorDate: Tue Sep 3 15:29:55 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Sep 4 12:19:00 2019 +0200

tdf#127093 mysqlc: set NO_AUTO_VALUE_ON_ZERO

Without setting this sql_mode, NULL or 0 inserted to an auto-incremented 
column
of a prepared statement would cause that to be auto generated.

Setting NO_AUTO_VALUE_ON_ZERO allows us to copy/paste auto-incremented
columns which may contain zero values as well.

Change-Id: I9602746371c75c82c99ff63240025e8cfb03776a
Reviewed-on: https://gerrit.libreoffice.org/78560
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 91a97c5e0b7b760ec0b46ad38b28ec1419c7d48f)
Reviewed-on: https://gerrit.libreoffice.org/78582
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 74613a733a3a..4ad4d2c6f29b 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -196,7 +196,8 @@ void OConnection::construct(const OUString& url, const 
Sequence&
*this, OUString(), 0, Any());
 }
 
-lcl_executeUpdate(_mysql, OString{ "SET session sql_mode='ANSI_QUOTES'" 
});
+lcl_executeUpdate(_mysql,
+  OString{ "SET session 
sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" });
 lcl_executeUpdate(_mysql, OString{ "SET NAMES utf8" });
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - dbaccess/source

2019-09-04 Thread Tamas Bunth (via logerrit)
 dbaccess/source/ui/inc/DExport.hxx |3 ---
 dbaccess/source/ui/uno/copytablewizard.cxx |6 --
 2 files changed, 9 deletions(-)

New commits:
commit 8a9ce8164aedda16e6732845adfdae03a7c810de
Author: Tamas Bunth 
AuthorDate: Tue Sep 3 15:28:05 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Sep 4 11:55:57 2019 +0200

Revert "tdf#127093, tdf#127092 Fix pasting autoincremented"

This reverts commit fa177231cd20bf3c3f4bb9b50f6646da139c6766.

Change-Id: Ia0c2d83c840c0ff8981b721766a6a1df810f971d
Reviewed-on: https://gerrit.libreoffice.org/78559
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit d783017c1ccb4e62e99f26b42250ac4e15780cff)
Reviewed-on: https://gerrit.libreoffice.org/78581
Reviewed-by: Xisco Faulí 

diff --git a/dbaccess/source/ui/inc/DExport.hxx 
b/dbaccess/source/ui/inc/DExport.hxx
index 7dbcbf31fc6a..397b527d6d7d 100644
--- a/dbaccess/source/ui/inc/DExport.hxx
+++ b/dbaccess/source/ui/inc/DExport.hxx
@@ -61,9 +61,6 @@ namespace dbaui
 public:
 typedef std::map TColumns;
 typedef std::vector 
TColumnVector;
-
-// first value is the position in the destination table. The second
-// value is the position of the column in the source table.
 typedef std::vector< std::pair >   TPositions;
 
 protected:
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx 
b/dbaccess/source/ui/uno/copytablewizard.cxx
index d8dd195701cf..e7004aa8d29b 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1183,12 +1183,6 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 // otherwise we don't get the correct value when only the 
2nd source column was selected
 continue;
 }
-else if( xMeta->isAutoIncrement( rColumnPos.second ) )
-{
-// it is auto incremented. Let the DBMS deal with it.
-++nSourceColumn;
-continue;
-}
 
 if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= 
static_cast(aSourceColTypes.size()) ) )
 {   // ( we have to check here against 1 because the 
parameters are 1 based)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: 2 commits - connectivity/source dbaccess/source

2019-09-03 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |3 ++-
 dbaccess/source/ui/inc/DExport.hxx   |3 ---
 dbaccess/source/ui/uno/copytablewizard.cxx   |6 --
 3 files changed, 2 insertions(+), 10 deletions(-)

New commits:
commit 91a97c5e0b7b760ec0b46ad38b28ec1419c7d48f
Author: Tamas Bunth 
AuthorDate: Tue Sep 3 15:29:55 2019 +0200
Commit: Tamás Bunth 
CommitDate: Tue Sep 3 19:59:17 2019 +0200

tdf#127093 mysqlc: set NO_AUTO_VALUE_ON_ZERO

Without setting this sql_mode, NULL or 0 inserted to an auto-incremented 
column
of a prepared statement would cause that to be auto generated.

Setting NO_AUTO_VALUE_ON_ZERO allows us to copy/paste auto-incremented
columns which may contain zero values as well.

Change-Id: I9602746371c75c82c99ff63240025e8cfb03776a
Reviewed-on: https://gerrit.libreoffice.org/78560
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 193cc1c6ffe2..a9d4438dfa97 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -196,7 +196,8 @@ void OConnection::construct(const OUString& url, const 
Sequence&
*this, OUString(), 0, Any());
 }
 
-lcl_executeUpdate(_mysql, OString{ "SET session sql_mode='ANSI_QUOTES'" 
});
+lcl_executeUpdate(_mysql,
+  OString{ "SET session 
sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" });
 lcl_executeUpdate(_mysql, OString{ "SET NAMES utf8" });
 }
 
commit d783017c1ccb4e62e99f26b42250ac4e15780cff
Author: Tamas Bunth 
AuthorDate: Tue Sep 3 15:28:05 2019 +0200
Commit: Tamás Bunth 
CommitDate: Tue Sep 3 19:59:07 2019 +0200

Revert "tdf#127093, tdf#127092 Fix pasting autoincremented"

This reverts commit fa177231cd20bf3c3f4bb9b50f6646da139c6766.

Change-Id: Ia0c2d83c840c0ff8981b721766a6a1df810f971d
Reviewed-on: https://gerrit.libreoffice.org/78559
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/dbaccess/source/ui/inc/DExport.hxx 
b/dbaccess/source/ui/inc/DExport.hxx
index 7dbcbf31fc6a..397b527d6d7d 100644
--- a/dbaccess/source/ui/inc/DExport.hxx
+++ b/dbaccess/source/ui/inc/DExport.hxx
@@ -61,9 +61,6 @@ namespace dbaui
 public:
 typedef std::map TColumns;
 typedef std::vector 
TColumnVector;
-
-// first value is the position in the destination table. The second
-// value is the position of the column in the source table.
 typedef std::vector< std::pair >   TPositions;
 
 protected:
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx 
b/dbaccess/source/ui/uno/copytablewizard.cxx
index 6abaa55f9d54..8565ce5949de 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1183,12 +1183,6 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 // otherwise we don't get the correct value when only the 
2nd source column was selected
 continue;
 }
-else if( xMeta->isAutoIncrement( rColumnPos.second ) )
-{
-// it is auto incremented. Let the DBMS deal with it.
-++nSourceColumn;
-continue;
-}
 
 if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= 
static_cast(aSourceColTypes.size()) ) )
 {   // ( we have to check here against 1 because the 
parameters are 1 based)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - dbaccess/source

2019-09-02 Thread Tamas Bunth (via logerrit)
 dbaccess/source/ui/uno/copytablewizard.cxx |   11 ---
 1 file changed, 11 deletions(-)

New commits:
commit 3ae4ce3919a4e61afa94c7eb02c03c05cb1cc3f5
Author: Tamas Bunth 
AuthorDate: Sat Aug 31 18:27:44 2019 +0200
Commit: Xisco Faulí 
CommitDate: Mon Sep 2 17:24:30 2019 +0200

dbaccess: delete old paste autoincrement logic

Change-Id: I6a4392c9e93842838022370fe6c54908adcc627b
Reviewed-on: https://gerrit.libreoffice.org/78358
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 376cc3ea0fc2e0f209763a2a27c5852136332c86)
Reviewed-on: https://gerrit.libreoffice.org/78400
Reviewed-by: Xisco Faulí 

diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx 
b/dbaccess/source/ui/uno/copytablewizard.cxx
index 8d9bc43a4193..d8dd195701cf 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1096,7 +1096,6 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 
 const OCopyTableWizard& rWizard = impl_getDialog_throw();
 ODatabaseExport::TPositions aColumnPositions = 
rWizard.GetColumnPositions();
-bool bAutoIncrement = 
rWizard.shouldCreatePrimaryKey();
 
 Reference< XRow > xRow  ( _rxSourceResultSet, UNO_QUERY_THROW 
);
 Reference< XRowLocate > xRowLocate  ( _rxSourceResultSet, UNO_QUERY_THROW 
);
@@ -1168,7 +1167,6 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 aCopyEvent.Error.clear();
 try
 {
-bool bInsertAutoIncrement = true;
 // notify listeners
 m_aCopyTableListeners.notifyEach( ::copyingRow, 
aCopyEvent );
 
@@ -1188,19 +1186,10 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 else if( xMeta->isAutoIncrement( rColumnPos.second ) )
 {
 // it is auto incremented. Let the DBMS deal with it.
-// TODO initial value could be set when defining the
-// table
 ++nSourceColumn;
 continue;
 }
 
-if ( bAutoIncrement && bInsertAutoIncrement )
-{
-xStatementParams->setInt( 1, nRowCount );
-bInsertAutoIncrement = false;
-continue;
-}
-
 if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= 
static_cast(aSourceColTypes.size()) ) )
 {   // ( we have to check here against 1 because the 
parameters are 1 based)
 ::dbtools::throwSQLException("Internal error: invalid 
column type index.",
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - dbaccess/source

2019-09-02 Thread Tamas Bunth (via logerrit)
 dbaccess/source/ui/misc/WCopyTable.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit 0eb27ca7e8e2e07a478b7eb1a7ecc08aa6d472af
Author: Tamas Bunth 
AuthorDate: Fri Aug 30 14:01:19 2019 +0200
Commit: Xisco Faulí 
CommitDate: Mon Sep 2 17:24:55 2019 +0200

Query MySQL schema name when pasting table

In case of a MySQL direct connection the current schema in use cannot be
queried with the getUserName() method of the DatabaseMetadata interface,
because the user name and the schema name can (and usually do) differ.

Instead, we can always query for the current schema with the DATABASE()
SQL function.

Change-Id: Ibb026519e1a63e29c5a7c9b04ab64901faec0f85
Reviewed-on: https://gerrit.libreoffice.org/78297
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit c635364120ab8b6cea1e78ebeda4fb028df7678a)
Reviewed-on: https://gerrit.libreoffice.org/78387
Reviewed-by: Xisco Faulí 

diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx 
b/dbaccess/source/ui/misc/WCopyTable.cxx
index ca8dac4694f4..14608b3c5d71 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1204,7 +1205,18 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
 
 if ( sSchema.isEmpty() && 
xMetaData->supportsSchemasInTableDefinitions() )
 {
+// query of current schema is quite inconsistent. In case of some
+// DBMS's each user has their own schema.
 sSchema = xMetaData->getUserName();
+// In case of mysql it is not that simple
+if(xMetaData->getDatabaseProductName() == "MySQL")
+{
+Reference< XStatement > xSelect = 
m_xDestConnection->createStatement();
+Reference< XResultSet > xRs = xSelect->executeQuery("select 
database()");
+xRs->next(); // first and only result
+Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
+sSchema = xRow->getString(1);
+}
 }
 
 xTable->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - dbaccess/source

2019-09-02 Thread Tamas Bunth (via logerrit)
 dbaccess/source/ui/inc/DExport.hxx |3 +++
 dbaccess/source/ui/uno/copytablewizard.cxx |8 
 2 files changed, 11 insertions(+)

New commits:
commit 2ddd1a5ca306ed6bfdcd375af094cdbd9e6212ca
Author: Tamas Bunth 
AuthorDate: Fri Aug 30 14:57:31 2019 +0200
Commit: Xisco Faulí 
CommitDate: Mon Sep 2 15:19:12 2019 +0200

tdf#127093, tdf#127092 Fix pasting autoincremented

Fix copy/paste functionality when trying to paste a table with auto
incremental column in it. In that case we should let the DBMS handle the
values in that column.

Change-Id: Ia40a0056402ec540f469b94694629dd6db7d4e71
Reviewed-on: https://gerrit.libreoffice.org/78298
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit fa177231cd20bf3c3f4bb9b50f6646da139c6766)
Reviewed-on: https://gerrit.libreoffice.org/78388
Reviewed-by: Xisco Faulí 

diff --git a/dbaccess/source/ui/inc/DExport.hxx 
b/dbaccess/source/ui/inc/DExport.hxx
index 397b527d6d7d..7dbcbf31fc6a 100644
--- a/dbaccess/source/ui/inc/DExport.hxx
+++ b/dbaccess/source/ui/inc/DExport.hxx
@@ -61,6 +61,9 @@ namespace dbaui
 public:
 typedef std::map TColumns;
 typedef std::vector 
TColumnVector;
+
+// first value is the position in the destination table. The second
+// value is the position of the column in the source table.
 typedef std::vector< std::pair >   TPositions;
 
 protected:
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx 
b/dbaccess/source/ui/uno/copytablewizard.cxx
index 295575187044..8d9bc43a4193 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1185,6 +1185,14 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 // otherwise we don't get the correct value when only the 
2nd source column was selected
 continue;
 }
+else if( xMeta->isAutoIncrement( rColumnPos.second ) )
+{
+// it is auto incremented. Let the DBMS deal with it.
+// TODO initial value could be set when defining the
+// table
+++nSourceColumn;
+continue;
+}
 
 if ( bAutoIncrement && bInsertAutoIncrement )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

2019-09-02 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |   16 
--
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit c4d5da753aaad2df86f64d328d3bb838146df6a9
Author: Tamas Bunth 
AuthorDate: Fri Aug 30 13:59:35 2019 +0200
Commit: Xisco Faulí 
CommitDate: Mon Sep 2 12:33:21 2019 +0200

mysqlc: Implement DatabaseMetadata::getUserName

Change-Id: Id3518a049a55d64e7272d265f22e930881a70161
Reviewed-on: https://gerrit.libreoffice.org/78296
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit f5c09ac04860f779532fe83f8ebce237d46eb1f5)
Reviewed-on: https://gerrit.libreoffice.org/78386
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index f04b8928714b..a433c9d81bea 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -361,9 +361,19 @@ OUString SAL_CALL ODatabaseMetaData::getURL()
 
 OUString SAL_CALL ODatabaseMetaData::getUserName()
 {
-// TODO execute "SELECT USER()"
-SAL_WARN("connectivity.mysqlc", "method not implemented");
-return OUString();
+Reference statement = m_rConnection.createStatement();
+Reference rs = statement->executeQuery("select user()");
+Reference xRow(rs, UNO_QUERY_THROW);
+rs->next(); // the first and only result
+// e.g. root@localhost
+OUString userWithConnection = xRow->getString(1);
+sal_Int32 nIndexOfAt = userWithConnection.indexOf("@");
+if (nIndexOfAt > 0)
+{
+OUString user = userWithConnection.copy(0, nIndexOfAt);
+return user;
+}
+return userWithConnection;
 }
 
 OUString SAL_CALL ODatabaseMetaData::getDriverName() { return OUString("MySQL 
Connector/OO.org"); }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: 2 commits - dbaccess/source

2019-08-31 Thread Tamas Bunth (via logerrit)
 dbaccess/source/ui/inc/DExport.hxx |3 +++
 dbaccess/source/ui/uno/copytablewizard.cxx |9 +++--
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 376cc3ea0fc2e0f209763a2a27c5852136332c86
Author: Tamas Bunth 
AuthorDate: Sat Aug 31 18:27:44 2019 +0200
Commit: Tamás Bunth 
CommitDate: Sat Aug 31 19:43:36 2019 +0200

dbaccess: delete old paste autoincrement logic

Change-Id: I6a4392c9e93842838022370fe6c54908adcc627b
Reviewed-on: https://gerrit.libreoffice.org/78358
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx 
b/dbaccess/source/ui/uno/copytablewizard.cxx
index 5f25b06ef784..6abaa55f9d54 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1096,7 +1096,6 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 
 const OCopyTableWizard& rWizard = impl_getDialog_throw();
 ODatabaseExport::TPositions aColumnPositions = 
rWizard.GetColumnPositions();
-bool bAutoIncrement = 
rWizard.shouldCreatePrimaryKey();
 
 Reference< XRow > xRow  ( _rxSourceResultSet, UNO_QUERY_THROW 
);
 Reference< XRowLocate > xRowLocate  ( _rxSourceResultSet, UNO_QUERY_THROW 
);
@@ -1168,7 +1167,6 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 aCopyEvent.Error.clear();
 try
 {
-bool bInsertAutoIncrement = true;
 // notify listeners
 m_aCopyTableListeners.notifyEach( ::copyingRow, 
aCopyEvent );
 
@@ -1188,19 +1186,10 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 else if( xMeta->isAutoIncrement( rColumnPos.second ) )
 {
 // it is auto incremented. Let the DBMS deal with it.
-// TODO initial value could be set when defining the
-// table
 ++nSourceColumn;
 continue;
 }
 
-if ( bAutoIncrement && bInsertAutoIncrement )
-{
-xStatementParams->setInt( 1, nRowCount );
-bInsertAutoIncrement = false;
-continue;
-}
-
 if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= 
static_cast(aSourceColTypes.size()) ) )
 {   // ( we have to check here against 1 because the 
parameters are 1 based)
 ::dbtools::throwSQLException("Internal error: invalid 
column type index.",
commit fa177231cd20bf3c3f4bb9b50f6646da139c6766
Author: Tamas Bunth 
AuthorDate: Fri Aug 30 14:57:31 2019 +0200
Commit: Tamás Bunth 
CommitDate: Sat Aug 31 19:43:25 2019 +0200

tdf#127093, tdf#127092 Fix pasting autoincremented

Fix copy/paste functionality when trying to paste a table with auto
incremental column in it. In that case we should let the DBMS handle the
values in that column.

Change-Id: Ia40a0056402ec540f469b94694629dd6db7d4e71
Reviewed-on: https://gerrit.libreoffice.org/78298
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/dbaccess/source/ui/inc/DExport.hxx 
b/dbaccess/source/ui/inc/DExport.hxx
index 397b527d6d7d..7dbcbf31fc6a 100644
--- a/dbaccess/source/ui/inc/DExport.hxx
+++ b/dbaccess/source/ui/inc/DExport.hxx
@@ -61,6 +61,9 @@ namespace dbaui
 public:
 typedef std::map TColumns;
 typedef std::vector 
TColumnVector;
+
+// first value is the position in the destination table. The second
+// value is the position of the column in the source table.
 typedef std::vector< std::pair >   TPositions;
 
 protected:
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx 
b/dbaccess/source/ui/uno/copytablewizard.cxx
index 3c2a25af6a14..5f25b06ef784 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1185,6 +1185,14 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
 // otherwise we don't get the correct value when only the 
2nd source column was selected
 continue;
 }
+else if( xMeta->isAutoIncrement( rColumnPos.second ) )
+{
+// it is auto incremented. Let the DBMS deal with it.
+// TODO initial value could be set when defining the
+// table
+++nSourceColumn;
+continue;
+}
 
 if ( bAutoIncrement && bInsertAutoIncrement )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: 2 commits - connectivity/source dbaccess/source

2019-08-31 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |   16 
--
 dbaccess/source/ui/misc/WCopyTable.cxx |   12 +++
 2 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit c635364120ab8b6cea1e78ebeda4fb028df7678a
Author: Tamas Bunth 
AuthorDate: Fri Aug 30 14:01:19 2019 +0200
Commit: Tamás Bunth 
CommitDate: Sat Aug 31 17:50:02 2019 +0200

Query MySQL schema name when pasting table

In case of a MySQL direct connection the current schema in use cannot be
queried with the getUserName() method of the DatabaseMetadata interface,
because the user name and the schema name can (and usually do) differ.

Instead, we can always query for the current schema with the DATABASE()
SQL function.

Change-Id: Ibb026519e1a63e29c5a7c9b04ab64901faec0f85
Reviewed-on: https://gerrit.libreoffice.org/78297
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx 
b/dbaccess/source/ui/misc/WCopyTable.cxx
index fc1b2ac38d82..46f563d62959 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1205,7 +1206,18 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
 
 if ( sSchema.isEmpty() && 
xMetaData->supportsSchemasInTableDefinitions() )
 {
+// query of current schema is quite inconsistent. In case of some
+// DBMS's each user has their own schema.
 sSchema = xMetaData->getUserName();
+// In case of mysql it is not that simple
+if(xMetaData->getDatabaseProductName() == "MySQL")
+{
+Reference< XStatement > xSelect = 
m_xDestConnection->createStatement();
+Reference< XResultSet > xRs = xSelect->executeQuery("select 
database()");
+xRs->next(); // first and only result
+Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
+sSchema = xRow->getString(1);
+}
 }
 
 xTable->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
commit f5c09ac04860f779532fe83f8ebce237d46eb1f5
Author: Tamas Bunth 
AuthorDate: Fri Aug 30 13:59:35 2019 +0200
Commit: Tamás Bunth 
CommitDate: Sat Aug 31 17:49:51 2019 +0200

mysqlc: Implement DatabaseMetadata::getUserName

Change-Id: Id3518a049a55d64e7272d265f22e930881a70161
Reviewed-on: https://gerrit.libreoffice.org/78296
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index bca56e119626..a57f10720104 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -361,9 +361,19 @@ OUString SAL_CALL ODatabaseMetaData::getURL()
 
 OUString SAL_CALL ODatabaseMetaData::getUserName()
 {
-// TODO execute "SELECT USER()"
-SAL_WARN("connectivity.mysqlc", "method not implemented");
-return OUString();
+Reference statement = m_rConnection.createStatement();
+Reference rs = statement->executeQuery("select user()");
+Reference xRow(rs, UNO_QUERY_THROW);
+rs->next(); // the first and only result
+// e.g. root@localhost
+OUString userWithConnection = xRow->getString(1);
+sal_Int32 nIndexOfAt = userWithConnection.indexOf("@");
+if (nIndexOfAt > 0)
+{
+OUString user = userWithConnection.copy(0, nIndexOfAt);
+return user;
+}
+return userWithConnection;
 }
 
 OUString SAL_CALL ODatabaseMetaData::getDriverName() { return "MySQL 
Connector/OO.org"; }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - connectivity/qa connectivity/source

2019-08-06 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx |   45 
++
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |8 +
 2 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit 2459458a0d9bb194a1f0de63b8b4fd591b2c5d5f
Author: Tamas Bunth 
AuthorDate: Wed Jul 31 14:20:21 2019 +0200
Commit: Tamás Bunth 
CommitDate: Tue Aug 6 16:25:29 2019 +0200

mysqlc: Add test for textual blob types

Test setting and querying the following data types:
TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT

Test them using prepared statements.

Change-Id: I43387034ad8c32c3731cde70a22cc8b3dd652b78
Reviewed-on: https://gerrit.libreoffice.org/76749
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/76872

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index a3d88c065219..ce382f8efba7 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -54,6 +54,7 @@ public:
 void testTimestampField();
 void testNumericConversionPrepared();
 void testPreparedStmtIsAfterLast();
+void testGetStringFromBloColumnb();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -64,6 +65,7 @@ public:
 CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST(testNumericConversionPrepared);
 CPPUNIT_TEST(testPreparedStmtIsAfterLast);
+CPPUNIT_TEST(testGetStringFromBloColumnb);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -429,6 +431,49 @@ void MysqlTestDriver::testPreparedStmtIsAfterLast()
 bool hasData = xResultSet->next();
 CPPUNIT_ASSERT(!hasData); // now we are on "AfterLast"
 CPPUNIT_ASSERT(xResultSet->isAfterLast());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+}
+
+void MysqlTestDriver::testGetStringFromBloColumnb()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+// create test table
+xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY 
KEY, tinytexty "
+  "TINYTEXT, texty TEXT, mediumTexty MEDIUMTEXT, 
longtexty LONGTEXT)");
+Reference xPrepared = xConnection->prepareStatement(
+OUString{ "INSERT INTO myTestTable VALUES (?, ?, ?, ?, ?)" });
+Reference xParams(xPrepared, UNO_QUERY);
+constexpr int ROW_COUNT = 6;
+for (int i = 0; i < ROW_COUNT; ++i)
+{
+xParams->setShort(1, i);
+xParams->setString(2, OUString::number(i));
+xParams->setString(3, OUString::number(i));
+xParams->setString(4, OUString::number(i));
+xParams->setString(5, OUString::number(i));
+xPrepared->executeUpdate();
+}
+
+// query test table
+xPrepared = xConnection->prepareStatement(
+"SELECT tinytexty, texty, mediumtexty, longtexty from myTestTable 
where texty LIKE '3'");
+Reference xResultSet = xPrepared->executeQuery();
+xResultSet->next();
+Reference xRow(xResultSet, UNO_QUERY);
+
+// all the textual blob types should be able to be queried via getString().
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(1));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(2));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(3));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(4));
+
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
commit e04322c3adcff323c06b043f19c5b300c5b75d1d
Author: Tamas Bunth 
AuthorDate: Tue Jul 30 15:05:35 2019 +0200
Commit: Tamás Bunth 
CommitDate: Tue Aug 6 16:25:21 2019 +0200

mysqlc: Support reading blob as string

Change-Id: I1ef0c3817bc255e7f0c38aca73c475b19d5d7d9b
Reviewed-on: https://gerrit.libreoffice.org/76600
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/76734
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/76871

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 3d69eb5d2248..ad240292de1c 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -313,7 +313,10 @@ template <> DateTime 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 
 template <> OUString OPreparedResultSet::retrieveValue(sal_Int32 column)
 {
-if (getTypeFromMysqlType(m_aFields[column - 1].type) != 
std::type_index(typeid(OUString)))
+// redirect call 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - connectivity/qa connectivity/source

2019-08-06 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx |   41 ++
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |  172 
+-
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |7 
 connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx  |   82 ++--
 connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx  |   22 +
 5 files changed, 199 insertions(+), 125 deletions(-)

New commits:
commit ea97f1e39015e36958374157e98b120bec47cb69
Author: Tamas Bunth 
AuthorDate: Mon Jul 29 13:27:38 2019 +0200
Commit: Tamás Bunth 
CommitDate: Tue Aug 6 16:25:12 2019 +0200

mysqlc: Fix query of cursor position in result set

Fix queries like "IsAfterLast" in result sets of prepared statements in
the mysql driver.

Cursor position is stored in the driver, since the mysql C driver does
not support the query of the cursor position.

The cursor position works the following way:
- 0 means the cursor is on "BeforeFirst". In that state calling of
  getXXX() methods is user error.
- 1 means the first row is already fetched.
- n means the last fow is fetched, where n is the total number of rows
  in the result set.
- Everything bigger than n is "AfterLast"

Change-Id: I131f2042606897019cc0f868dbc4151faf4850ac
Reviewed-on: https://gerrit.libreoffice.org/76549
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/76583
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/76870

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 546e916bd0a7..a3d88c065219 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -53,6 +53,7 @@ public:
 void testDBMetaData();
 void testTimestampField();
 void testNumericConversionPrepared();
+void testPreparedStmtIsAfterLast();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -62,6 +63,7 @@ public:
 CPPUNIT_TEST(testDBMetaData);
 CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST(testNumericConversionPrepared);
+CPPUNIT_TEST(testPreparedStmtIsAfterLast);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -390,6 +392,45 @@ void MysqlTestDriver::testNumericConversionPrepared()
 xStatement->executeUpdate("DROP TABLE myTestTable");
 }
 
+/**
+ * Test cursor positioning method isAfterLast in case of using prepared
+ * statement.
+ */
+void MysqlTestDriver::testPreparedStmtIsAfterLast()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+// create test table
+xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY 
KEY)");
+Reference xPrepared
+= xConnection->prepareStatement(OUString{ "INSERT INTO myTestTable 
VALUES (?)" });
+Reference xParams(xPrepared, UNO_QUERY);
+constexpr int ROW_COUNT = 6;
+for (int i = 0; i < ROW_COUNT; ++i)
+{
+xParams->setShort(1, i);
+xPrepared->executeUpdate();
+}
+
+// query test table
+xPrepared = xConnection->prepareStatement("SELECT id from myTestTable 
where id = 3");
+Reference xResultSet = xPrepared->executeQuery();
+
+// There should be exactly one row, therefore IsAfterLast is false at 
first.
+xResultSet->next();
+CPPUNIT_ASSERT(!xResultSet->isAfterLast());
+
+// attempt to fetch more data
+bool hasData = xResultSet->next();
+CPPUNIT_ASSERT(!hasData); // now we are on "AfterLast"
+CPPUNIT_ASSERT(xResultSet->isAfterLast());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index ead866968ead..3d69eb5d2248 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -100,6 +100,62 @@ const std::type_index 
getTypeFromMysqlType(enum_field_types type)
 }
 }
 
+bool OPreparedResultSet::fetchResult()
+{
+// allocate array if it does not exist
+if (m_aData == nullptr)
+{
+m_aData.reset(new MYSQL_BIND[m_nColumnCount]);
+memset(m_aData.get(), 0, m_nColumnCount * sizeof(MYSQL_BIND));
+m_aMetaData.reset(new BindMetaData[m_nColumnCount]);
+}
+for (sal_Int32 i = 0; i < m_nColumnCount; ++i)
+{
+m_aMetaData[i].is_null = 0;
+m_aMetaData[i].length = 0l;
+m_aMetaData[i].error = 0;
+
+m_aData[i].is_null = _aMetaData[i].is_null;
+

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - connectivity/source external/nss

2019-08-05 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/firebird/Connection.cxx |6 +-
 external/nss/UnpackedTarball_nss.mk |1 +
 external/nss/nss.fix-freebl-add-lcc-support.patch.1 |   11 +++
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 30f97ed015f2c2d25d6a1545943363829355dbdc
Author: Tamas Bunth 
AuthorDate: Sat Jul 13 16:39:31 2019 +0200
Commit: Andras Timar 
CommitDate: Mon Aug 5 09:53:31 2019 +0200

tdf#123150: Firebird: set UTF-8 client connection

There are two options related to character sets when attaching or
creating a database with the C API:

- isc_dpb_lc_ctype: Sets the character set of the connection between the
Firebird server and the Client (which is the sdbc driver in that case).
That is required in order to pass UTF 8 literals correctly.

- isc_dpb_set_db_charset: Sets the default character set of the database
itself. It has the same effect as the following SQL statement:
 ALTER DATABASE SET DEFAULT CHARACTER SET 

We need to set both of them to UTF-8.

Change-Id: Ia9e5a4b87a3997c084be8abb68c2de813fbd631b
Reviewed-on: https://gerrit.libreoffice.org/75557
Reviewed-by: Tamás Bunth 
Tested-by: Tamás Bunth 
(cherry picked from commit c19c206cf42ac178906a855ae3cd198e0fcf8d14)
Reviewed-on: https://gerrit.libreoffice.org/75755
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit 3173e00f428ea8cf79f36efb38d15028aca01d4a)
Reviewed-on: https://gerrit.libreoffice.org/76928
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/connectivity/source/drivers/firebird/Connection.cxx 
b/connectivity/source/drivers/firebird/Connection.cxx
index ba2fba974d78..c707ca2c15ad 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -227,11 +227,15 @@ void Connection::construct(const OUString& url, const 
Sequence< PropertyValue >&
 dpbBuffer.push_back(1); // 1 byte long
 dpbBuffer.push_back(FIREBIRD_SQL_DIALECT);
 
-// set UTF8 as default character set
+// set UTF8 as default character set of the database
 const char sCharset[] = "UTF8";
 dpbBuffer.push_back(isc_dpb_set_db_charset);
 dpbBuffer.push_back(sizeof(sCharset) - 1);
 dpbBuffer.append(sCharset);
+// set UTF8 as default character set of the connection
+dpbBuffer.push_back(isc_dpb_lc_ctype);
+dpbBuffer.push_back(sizeof(sCharset) - 1);
+dpbBuffer.append(sCharset);
 
 // Do any more dpbBuffer additions here
 
commit 587ab613e033845795a255a2f83aff023ea2ddf7
Author: Jan-Marek Glogowski 
AuthorDate: Fri Jul 12 15:01:41 2019 +0200
Commit: Andras Timar 
CommitDate: Mon Aug 5 09:53:20 2019 +0200

NSS fix lcc support patch

This hangs the build process with current MSVC cl.exe. It even
hangs when just calling "cl -? >/dev/null". Probably
a cl.exe bug to detect redirection properly?

This adds stdin redirection to /dev/null, like in configure.ac checks.

Change-Id: Ie03c3103ac68cd131dc280755621a8ce0417314f
Reviewed-on: https://gerrit.libreoffice.org/75495
Reviewed-by: Jan-Marek Glogowski 
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 
(cherry picked from commit b11ea5e9c37b19f0d60a4075146668954a7bf728)
Reviewed-on: https://gerrit.libreoffice.org/75509
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit d250c94d78ac7e79753aa30f869db919b01fc450)
Reviewed-on: https://gerrit.libreoffice.org/76927
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/external/nss/UnpackedTarball_nss.mk 
b/external/nss/UnpackedTarball_nss.mk
index 9783b1928097..916fa0df171b 100644
--- a/external/nss/UnpackedTarball_nss.mk
+++ b/external/nss/UnpackedTarball_nss.mk
@@ -22,6 +22,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,nss,\
external/nss/nss.vs2015.patch) \
 external/nss/ubsan.patch.0 \
 external/nss/clang-cl.patch.0 \
+external/nss/nss.fix-freebl-add-lcc-support.patch.1 \
 $(if $(filter iOS,$(OS)), \
 external/nss/nss-ios.patch) \
$(if $(filter MSC-INTEL,$(COM)-$(CPUNAME)), \
diff --git a/external/nss/nss.fix-freebl-add-lcc-support.patch.1 
b/external/nss/nss.fix-freebl-add-lcc-support.patch.1
new file mode 100644
index ..3e3c06327dde
--- /dev/null
+++ b/external/nss/nss.fix-freebl-add-lcc-support.patch.1
@@ -0,0 +1,11 @@
+--- b/nss/lib/freebl/Makefile
 a/nss/lib/freebl/Makefile
+@@ -495,7 +495,7 @@
+ ifdef USE_64
+ # no __int128 at least up to lcc 1.23 (pretending to be gcc5)
+ # NB: CC_NAME is not defined here
+-ifneq ($(shell $(CC) -? 2>&1 >/dev/null | sed -e 's/:.*//;1q'),lcc)
++ifneq ($(shell $(CC) -? 2>&1 >/dev/null 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/qa

2019-08-03 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx |   45 +++
 1 file changed, 45 insertions(+)

New commits:
commit fbaa95177333c8ca5cb4c0f07c7bf9f53a01af26
Author: Tamas Bunth 
AuthorDate: Wed Jul 31 14:20:21 2019 +0200
Commit: Xisco Faulí 
CommitDate: Sat Aug 3 14:22:13 2019 +0200

mysqlc: Add test for textual blob types

Test setting and querying the following data types:
TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT

Test them using prepared statements.

Change-Id: I43387034ad8c32c3731cde70a22cc8b3dd652b78
Reviewed-on: https://gerrit.libreoffice.org/76747
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit cbbda5b9267f9f7c7028ebc3f0867ddc6715543a)
Reviewed-on: https://gerrit.libreoffice.org/76874
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 24af725b0110..47d1d7929e44 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -55,6 +55,7 @@ public:
 void testTimestampField();
 void testNumericConversionPrepared();
 void testPreparedStmtIsAfterLast();
+void testGetStringFromBloColumnb();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -65,6 +66,7 @@ public:
 CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST(testNumericConversionPrepared);
 CPPUNIT_TEST(testPreparedStmtIsAfterLast);
+CPPUNIT_TEST(testGetStringFromBloColumnb);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -444,6 +446,49 @@ void MysqlTestDriver::testPreparedStmtIsAfterLast()
 bool hasData = xResultSet->next();
 CPPUNIT_ASSERT(!hasData); // now we are on "AfterLast"
 CPPUNIT_ASSERT(xResultSet->isAfterLast());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+}
+
+void MysqlTestDriver::testGetStringFromBloColumnb()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+// create test table
+xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY 
KEY, tinytexty "
+  "TINYTEXT, texty TEXT, mediumTexty MEDIUMTEXT, 
longtexty LONGTEXT)");
+Reference xPrepared = xConnection->prepareStatement(
+OUString{ "INSERT INTO myTestTable VALUES (?, ?, ?, ?, ?)" });
+Reference xParams(xPrepared, UNO_QUERY);
+constexpr int ROW_COUNT = 6;
+for (int i = 0; i < ROW_COUNT; ++i)
+{
+xParams->setShort(1, i);
+xParams->setString(2, OUString::number(i));
+xParams->setString(3, OUString::number(i));
+xParams->setString(4, OUString::number(i));
+xParams->setString(5, OUString::number(i));
+xPrepared->executeUpdate();
+}
+
+// query test table
+xPrepared = xConnection->prepareStatement(
+"SELECT tinytexty, texty, mediumtexty, longtexty from myTestTable 
where texty LIKE '3'");
+Reference xResultSet = xPrepared->executeQuery();
+xResultSet->next();
+Reference xRow(xResultSet, UNO_QUERY);
+
+// all the textual blob types should be able to be queried via getString().
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(1));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(2));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(3));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(4));
+
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 2 commits - connectivity/source filter/source sw/source

2019-08-03 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |7 -
 filter/source/pdf/impdialog.cxx|   12 
+++---
 sw/source/core/view/printdata.cxx  |3 +-
 3 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 587c828640c799729b00e1d96c96c161f97293c5
Author: Tamas Bunth 
AuthorDate: Wed Sep 12 17:31:26 2018 +0200
Commit: Xisco Faulí 
CommitDate: Sat Aug 3 14:21:54 2019 +0200

mysqlc: getTablePrivileges not implemented, so..

it should throw an exception.

Reviewed-on: https://gerrit.libreoffice.org/60460
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
(cherry picked from commit 19f8ea668833a4dc90244792cbf91881b0ca9a07)

Change-Id: I32b0b5dde0bcfd8cc59d0814a9f35d43c0f58ae1
Reviewed-on: https://gerrit.libreoffice.org/76750
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit acafd1ac87cb23a447353b8f0419a25fbe1c4430)
Reviewed-on: https://gerrit.libreoffice.org/76873
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index 3bdc27e7744b..f04b8928714b 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -1046,14 +1046,9 @@ Reference SAL_CALL 
ODatabaseMetaData::getBestRowIdentifier(const Any
 Reference SAL_CALL ODatabaseMetaData::getTablePrivileges(
 const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& 
/*tableNamePattern*/)
 {
-Reference 
xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- 
"org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
-std::vector> rRows;
 // TODO
 SAL_WARN("connectivity.mysqlc", "method not implemented");
-lcl_setRows_throw(xResultSet, 12, rRows);
-return xResultSet;
+throw SQLException("getTablePrivileges method not implemented", *this, 
"IM001", 0, Any());
 }
 
 Reference SAL_CALL ODatabaseMetaData::getCrossReference(
commit 87d5c863109f7991e3f2f3a1eb970c00d5a27bd5
Author: Daniel Silva 
AuthorDate: Sat Dec 8 10:15:26 2018 -0200
Commit: Xisco Faulí 
CommitDate: Sat Aug 3 14:21:41 2019 +0200

tdf#54908 Make selection active if there's a selection (Writer)

If the user make a selection in Writer and then opens print dialog or PDF
export dialog, Print Selection is the default option.

Change-Id: I46ba90cfeabafef1c05dd3e5008ecf55f177a146
Reviewed-on: https://gerrit.libreoffice.org/64804
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit f50363c7008c239d302944144beb256de6a55f38)
Reviewed-on: https://gerrit.libreoffice.org/76879
Reviewed-by: Xisco Faulí 

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 213f2cc2dc02..14738ff2e723 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -503,8 +503,9 @@ void 
ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
 mxRbAll->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleAllHdl ) 
);
 TogglePagesHdl();
 
-mxRbSelection->set_sensitive( pParent->mbSelectionPresent );
-if ( pParent->mbSelectionPresent )
+const bool bSelectionPresent = pParent->mbSelectionPresent;
+mxRbSelection->set_sensitive( bSelectionPresent );
+if ( bSelectionPresent )
 mxRbSelection->connect_toggled( LINK( this, ImpPDFTabGeneralPage, 
ToggleSelectionHdl ) );
 mbIsPresentation = pParent->mbIsPresentation;
 mbIsWriter = pParent->mbIsWriter;
@@ -611,7 +612,12 @@ void 
ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
 }
 
 mxCbExportPlaceholders->set_visible(mbIsWriter);
-if( !mbIsWriter )
+if( mbIsWriter )
+{
+// tdf#54908 Make selection active if there is a selection in Writer's 
version
+mxRbSelection->set_active( bSelectionPresent );
+}
+else
 {
 mxCbExportPlaceholders->set_active(false);
 }
diff --git a/sw/source/core/view/printdata.cxx 
b/sw/source/core/view/printdata.cxx
index 44f34d1e2a5f..2e9d9d3a7606 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -301,7 +301,8 @@ SwPrintUIOptions::SwPrintUIOptions(
 aWidgetIds[4] = "rbRangeSelection";
 m_aUIProperties[nIdx++].Value = setChoiceRadiosControlOpt(aWidgetIds, 
OUString(),
 aHelpIds, 
aPrintRangeName,
-aChoices, 0 /* always 
default to 'All pages' */,
+aChoices,
+bHasSelection ? 4 : 0,

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/qa connectivity/source

2019-08-02 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx |   41 ++
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |  164 
+-
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |7 
 3 files changed, 130 insertions(+), 82 deletions(-)

New commits:
commit 8c32cc30dbba3ee466b75628436ab790d6561e36
Author: Tamas Bunth 
AuthorDate: Mon Jul 29 13:27:38 2019 +0200
Commit: Xisco Faulí 
CommitDate: Fri Aug 2 17:12:57 2019 +0200

mysqlc: Fix query of cursor position in result set

Fix queries like "IsAfterLast" in result sets of prepared statements in
the mysql driver.

Cursor position is stored in the driver, since the mysql C driver does
not support the query of the cursor position.

The cursor position works the following way:
- 0 means the cursor is on "BeforeFirst". In that state calling of
  getXXX() methods is user error.
- 1 means the first row is already fetched.
- n means the last fow is fetched, where n is the total number of rows
  in the result set.
- Everything bigger than n is "AfterLast"

Change-Id: I131f2042606897019cc0f868dbc4151faf4850ac
Reviewed-on: https://gerrit.libreoffice.org/76549
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 41d3be4a48ea2abe019cd4f9b51bef703a2dc454)
Reviewed-on: https://gerrit.libreoffice.org/76585
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 3e48ce5b3750..24af725b0110 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -54,6 +54,7 @@ public:
 void testDBMetaData();
 void testTimestampField();
 void testNumericConversionPrepared();
+void testPreparedStmtIsAfterLast();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -63,6 +64,7 @@ public:
 CPPUNIT_TEST(testDBMetaData);
 CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST(testNumericConversionPrepared);
+CPPUNIT_TEST(testPreparedStmtIsAfterLast);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -405,6 +407,45 @@ void MysqlTestDriver::testNumericConversionPrepared()
 xStatement->executeUpdate("DROP TABLE myTestTable");
 }
 
+/**
+ * Test cursor positioning method isAfterLast in case of using prepared
+ * statement.
+ */
+void MysqlTestDriver::testPreparedStmtIsAfterLast()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+// create test table
+xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY 
KEY)");
+Reference xPrepared
+= xConnection->prepareStatement(OUString{ "INSERT INTO myTestTable 
VALUES (?)" });
+Reference xParams(xPrepared, UNO_QUERY);
+constexpr int ROW_COUNT = 6;
+for (int i = 0; i < ROW_COUNT; ++i)
+{
+xParams->setShort(1, i);
+xPrepared->executeUpdate();
+}
+
+// query test table
+xPrepared = xConnection->prepareStatement("SELECT id from myTestTable 
where id = 3");
+Reference xResultSet = xPrepared->executeQuery();
+
+// There should be exactly one row, therefore IsAfterLast is false at 
first.
+xResultSet->next();
+CPPUNIT_ASSERT(!xResultSet->isAfterLast());
+
+// attempt to fetch more data
+bool hasData = xResultSet->next();
+CPPUNIT_ASSERT(!hasData); // now we are on "AfterLast"
+CPPUNIT_ASSERT(xResultSet->isAfterLast());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 3b9e4a2aeb57..6c4711f65c71 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -100,6 +100,62 @@ const std::type_index 
getTypeFromMysqlType(enum_field_types type)
 }
 }
 
+bool OPreparedResultSet::fetchResult()
+{
+// allocate array if it does not exist
+if (m_aData == nullptr)
+{
+m_aData.reset(new MYSQL_BIND[m_nColumnCount]);
+memset(m_aData.get(), 0, m_nColumnCount * sizeof(MYSQL_BIND));
+m_aMetaData.reset(new BindMetaData[m_nColumnCount]);
+}
+for (sal_Int32 i = 0; i < m_nColumnCount; ++i)
+{
+m_aMetaData[i].is_null = 0;
+m_aMetaData[i].length = 0l;
+m_aMetaData[i].error = 0;
+
+m_aData[i].is_null = _aMetaData[i].is_null;
+m_aData[i].buffer_length = m_aFields[i].type == MYSQL_TYPE_BLOB ? 0 : 
m_aFields[i].length;
+m_aData[i].length = _aMetaData[i].length;
+ 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

2019-08-02 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |8 
+++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 7b2fa9b757f0860d82a7bea9efa503a50a6b70a0
Author: Tamas Bunth 
AuthorDate: Tue Jul 30 15:05:35 2019 +0200
Commit: Xisco Faulí 
CommitDate: Fri Aug 2 17:13:29 2019 +0200

mysqlc: Support reading blob as string

Change-Id: I1ef0c3817bc255e7f0c38aca73c475b19d5d7d9b
Reviewed-on: https://gerrit.libreoffice.org/76600
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit cc4c20d08fca59819e121c0678d1e595a97c92c9)
Reviewed-on: https://gerrit.libreoffice.org/76746
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 6c4711f65c71..6146ff6a9816 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -309,7 +309,10 @@ template <> DateTime 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 
 template <> OUString OPreparedResultSet::retrieveValue(sal_Int32 column)
 {
-if (getTypeFromMysqlType(m_aFields[column - 1].type) != 
std::type_index(typeid(OUString)))
+// redirect call to the appropiate method if needed
+// BLOB can be simply read out as string
+if (getTypeFromMysqlType(m_aFields[column - 1].type) != 
std::type_index(typeid(OUString))
+&& m_aFields[column - 1].type != MYSQL_TYPE_BLOB)
 return getRowSetValue(column);
 const char* sStr = static_cast(m_aData[column - 1].buffer);
 
@@ -345,6 +348,9 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_DECIMAL:
 case MYSQL_TYPE_NEWDECIMAL:
 return getString(nColumnIndex);
+case MYSQL_TYPE_BLOB:
+throw SQLException("Column with type BLOB cannot be converted", 
*this, OUString(), 1,
+   Any());
 default:
 SAL_WARN("connectivity.mysqlc", 
"OPreparedResultSet::getRowSetValue: unknown type: "
 << m_aFields[nColumnIndex - 
1].type);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - connectivity/source

2019-08-02 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |   13 
++
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |4 +--
 2 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 52a396d4a676021d595bde0af3bd7f3254193ea8
Author: Tamas Bunth 
AuthorDate: Thu May 30 18:34:03 2019 +0200
Commit: Tamás Bunth 
CommitDate: Fri Aug 2 16:50:37 2019 +0200

mysqlc: Add support for mysql type INT24

Which is mapped to sal_Int32.

Change-Id: Ibf12e92a20034440fa990ed0c6f1196f4ca3f40f
Reviewed-on: https://gerrit.libreoffice.org/73218
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76733
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 2eaeceb66b90..ead866968ead 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace rtl;
 #include 
@@ -66,6 +67,7 @@ const std::type_index getTypeFromMysqlType(enum_field_types 
type)
 case MYSQL_TYPE_SHORT:
 return std::type_index(typeid(sal_Int16));
 case MYSQL_TYPE_LONG:
+case MYSQL_TYPE_INT24:
 return std::type_index(typeid(sal_Int32));
 case MYSQL_TYPE_LONGLONG:
 return std::type_index(typeid(sal_Int64));
@@ -88,7 +90,6 @@ const std::type_index getTypeFromMysqlType(enum_field_types 
type)
 case MYSQL_TYPE_BLOB:
 case MYSQL_TYPE_YEAR:
 case MYSQL_TYPE_BIT:
-case MYSQL_TYPE_INT24:
 case MYSQL_TYPE_SET:
 case MYSQL_TYPE_ENUM:
 case MYSQL_TYPE_GEOMETRY:
@@ -268,6 +269,7 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_SHORT:
 return getShort(nColumnIndex);
 case MYSQL_TYPE_LONG:
+case MYSQL_TYPE_INT24:
 return getInt(nColumnIndex);
 case MYSQL_TYPE_LONGLONG:
 return getLong(nColumnIndex);
@@ -287,9 +289,10 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_NEWDECIMAL:
 return getString(nColumnIndex);
 default:
-mysqlc_sdbc_driver::throwFeatureNotImplementedException(
-"OPreparedResultSet::getRowSetValue", *this);
-return ORowSetValue();
+SAL_WARN("connectivity.mysqlc", 
"OPreparedResultSet::getRowSetValue: unknown type: "
+<< m_aFields[nColumnIndex - 
1].type);
+throw SQLException("Unknown column type when fetching result", 
*this, OUString(), 1,
+   Any());
 }
 }
 
commit 62bd8daf20b66cea5b84b05fb04b9ed5240b1ab9
Author: Tamas Bunth 
AuthorDate: Thu Apr 25 12:17:06 2019 +0200
Commit: Tamás Bunth 
CommitDate: Fri Aug 2 16:50:19 2019 +0200

mysqlc: move template specialization to namespace

so gcc 4.8 would be happy about it.
See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Change-Id: I7e696758c5598b9e64947bc9b1606c653becddce
Reviewed-on: https://gerrit.libreoffice.org/71294
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76732
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index b3630072c143..2eaeceb66b90 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -198,6 +198,7 @@ template  T 
OPreparedResultSet::retrieveValue(sal_Int32 nColumnIndex
 return getRowSetValue(nColumnIndex);
 }
 
+namespace connectivity { namespace mysqlc {
 template <> uno::Sequence 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 {
 // TODO make conversion possible
@@ -256,6 +257,7 @@ template <> OUString 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 OUString sReturn = OUString(sStr, *m_aData[column - 1].length, m_encoding);
 return sReturn;
 }
+}}
 
 ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 nColumnIndex)
 {
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
index b43935039efe..d10c8df5dacd 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
@@ -92,8 +92,8 @@ class OPreparedResultSet final : public OBase_Mutex,
 
 void SAL_CALL getFastPropertyValue(Any& rValue, sal_Int32 nHandle) 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - connectivity/Library_mysqlc.mk connectivity/qa connectivity/source

2019-08-02 Thread Tamas Bunth (via logerrit)
 connectivity/Library_mysqlc.mk   |1 
 connectivity/qa/connectivity/mysql/mysql.cxx |   32 
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |  353 
--
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |5 
 4 files changed, 210 insertions(+), 181 deletions(-)

New commits:
commit e7d3a95d9c87150bcaaf78d5a790ea44e6c1e41b
Author: Tamas Bunth 
AuthorDate: Mon Apr 22 19:09:24 2019 +0200
Commit: Tamás Bunth 
CommitDate: Fri Aug 2 16:49:55 2019 +0200

mysqlc: Allow conversions between different types

Change-Id: I54c1f438a755267db0896637c79f915de9113f83
Reviewed-on: https://gerrit.libreoffice.org/71246
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76731
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/Library_mysqlc.mk b/connectivity/Library_mysqlc.mk
index 9dba7769a9a2..455f9b2224df 100644
--- a/connectivity/Library_mysqlc.mk
+++ b/connectivity/Library_mysqlc.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_Library_use_sdk_api,mysqlc))
 
 $(eval $(call gb_Library_use_libraries,mysqlc,\
cppu \
+dbtools \
sal \
salhelper \
comphelper \
diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 38683149d432..546e916bd0a7 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -52,6 +52,7 @@ public:
 void testMultipleResultsets();
 void testDBMetaData();
 void testTimestampField();
+void testNumericConversionPrepared();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -60,6 +61,7 @@ public:
 CPPUNIT_TEST(testMultipleResultsets);
 CPPUNIT_TEST(testDBMetaData);
 CPPUNIT_TEST(testTimestampField);
+CPPUNIT_TEST(testNumericConversionPrepared);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -358,6 +360,36 @@ void MysqlTestDriver::testTimestampField()
 xStatement->executeUpdate("DROP TABLE myTestTable");
 }
 
+/**
+ * Test getting value from a decimal type column from a result set of a
+ * prepared statement, getting as a tinyint, string, short, int, long.
+ */
+void MysqlTestDriver::testNumericConversionPrepared()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+xStatement->executeUpdate("CREATE TABLE myTestTable (myDecimal 
DECIMAL(4,2))");
+xStatement->executeUpdate("INSERT INTO myTestTable VALUES (11.22)");
+Reference xPrepared
+= xConnection->prepareStatement("SELECT * from myTestTable");
+Reference xResultSet = xPrepared->executeQuery();
+xResultSet->next(); // use it
+Reference xRow(xResultSet, UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("11.22"), xRow->getString(1));
+// converting to integer types results in rounding down the number
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getByte(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getShort(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getInt(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getLong(1));
+
+xStatement->executeUpdate("DROP TABLE myTestTable");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index a3e45937b610..b3630072c143 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -38,6 +38,7 @@ using namespace rtl;
 #include 
 
 using namespace connectivity::mysqlc;
+using namespace connectivity;
 using namespace cppu;
 using namespace com::sun::star;
 using namespace com::sun::star::lang;
@@ -51,6 +52,52 @@ using namespace ::comphelper;
 using ::osl::MutexGuard;
 
 #include 
+#include 
+#include 
+
+namespace
+{
+const std::type_index getTypeFromMysqlType(enum_field_types type)
+{
+switch (type)
+{
+case MYSQL_TYPE_TINY:
+return std::type_index(typeid(sal_Int8));
+case MYSQL_TYPE_SHORT:
+return std::type_index(typeid(sal_Int16));
+case MYSQL_TYPE_LONG:
+return std::type_index(typeid(sal_Int32));
+case MYSQL_TYPE_LONGLONG:
+return std::type_index(typeid(sal_Int64));
+case MYSQL_TYPE_FLOAT:
+return std::type_index(typeid(float));
+case MYSQL_TYPE_DOUBLE:
+return std::type_index(typeid(double));
+case MYSQL_TYPE_TIMESTAMP:
+case 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - connectivity/qa connectivity/source

2019-08-02 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx|   36 
+
 connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx |   11 +-
 connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx |2 
 connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx |   40 
+-
 4 files changed, 67 insertions(+), 22 deletions(-)

New commits:
commit 4f2271cef80ade0edfc272afd13388a8d67ccf2e
Author: Tamas Bunth 
AuthorDate: Tue Jan 29 13:00:21 2019 +0100
Commit: Tamás Bunth 
CommitDate: Fri Aug 2 16:49:35 2019 +0200

mysqlc: fix timestamp query of result set

Also add test for inserting and reading timestamp values.

Change-Id: I2ba997c438f4e33965b0fe0602e58eddeff38b01
Reviewed-on: https://gerrit.libreoffice.org/67066
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/67091
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76730
Tested-by: Jenkins CollaboraOffice 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 77e82c9cdfc5..38683149d432 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -20,6 +20,8 @@
 #include 
 #include 
 #include 
+
+#include 
 #include 
 #include 
 
@@ -49,6 +51,7 @@ public:
 void testDBPositionChange();
 void testMultipleResultsets();
 void testDBMetaData();
+void testTimestampField();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -56,6 +59,7 @@ public:
 CPPUNIT_TEST(testIntegerInsertAndQuery);
 CPPUNIT_TEST(testMultipleResultsets);
 CPPUNIT_TEST(testDBMetaData);
+CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -322,6 +326,38 @@ void MysqlTestDriver::testDBMetaData()
 nUpdateCount = xStatement->executeUpdate("DROP TABLE myTestTable");
 }
 
+void MysqlTestDriver::testTimestampField()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+xStatement->executeUpdate(
+"CREATE TABLE myTestTable (id INTEGER PRIMARY KEY, mytimestamp 
timestamp)");
+xStatement->executeUpdate("INSERT INTO myTestTable VALUES (1, '2008-02-16 
20:15:03')");
+
+// now let's query
+Reference xResultSet
+= xStatement->executeQuery("SELECT mytimestamp from myTestTable");
+
+xResultSet->next(); // use it
+Reference xRow(xResultSet, UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("cannot extract row from result set!", xRow.is());
+util::DateTime dt = xRow->getTimestamp(1);
+CPPUNIT_ASSERT_EQUAL(static_cast(2008), dt.Year);
+CPPUNIT_ASSERT_EQUAL(static_cast(2), dt.Month);
+CPPUNIT_ASSERT_EQUAL(static_cast(16), dt.Day);
+
+CPPUNIT_ASSERT_EQUAL(static_cast(20), dt.Hours);
+CPPUNIT_ASSERT_EQUAL(static_cast(15), dt.Minutes);
+CPPUNIT_ASSERT_EQUAL(static_cast(3), dt.Seconds);
+
+xStatement->executeUpdate("DROP TABLE myTestTable");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
index 1d93aa952383..6fb5f1e3ee61 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
@@ -235,7 +235,7 @@ uno::Reference SAL_CALL 
OResultSet::getBinaryStream(sal_Int32 colu
 
 OString sVal = m_aRows[m_nRowPosition][column - 1];
 return new SequenceInputStream{ uno::Sequence(
-reinterpret_cast(sVal.getStr()), getDataLength(column 
- 1)) };
+reinterpret_cast(sVal.getStr()), 
getDataLength(column)) };
 }
 
 uno::Reference SAL_CALL OResultSet::getCharacterStream(sal_Int32 
column)
@@ -285,7 +285,7 @@ uno::Sequence SAL_CALL 
OResultSet::getBytes(sal_Int32 column)
 return uno::Sequence();
 
 return uno::Sequence(reinterpret_cast(sVal.getStr()),
-   getDataLength(column - 1));
+   getDataLength(column));
 }
 
 Date SAL_CALL OResultSet::getDate(sal_Int32 column)
@@ -488,7 +488,7 @@ Time SAL_CALL OResultSet::getTime(sal_Int32 column)
 return t;
 
 OString sVal = m_aRows[m_nRowPosition][column - 1];
-OString timeString{ sVal.getStr(), getDataLength(column - 1) };
+OString timeString{ sVal.getStr(), getDataLength(column) };
 OString token;
 sal_Int32 nIndex, i = 0;
 
@@ -528,11 +528,14 @@ DateTime SAL_CALL OResultSet::getTimestamp(sal_Int32 
column)
 
 // YY-MM-DD HH:MM:SS
 std::vector dateAndTime
-= lcl_split(OString{ 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - connectivity/qa connectivity/source

2019-08-02 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx|   84 
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx  |2 
 connectivity/source/drivers/mysqlc/mysqlc_general.cxx   |   26 +-
 connectivity/source/drivers/mysqlc/mysqlc_general.hxx   |4 
 connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx |2 
 connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx |9 
 connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx |   99 
+-
 connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx |   31 +--
 8 files changed, 182 insertions(+), 75 deletions(-)

New commits:
commit 3d5adeab32a1b40dff203face30223ce7d298c26
Author: Tamas Bunth 
AuthorDate: Tue Jan 22 13:06:45 2019 +0100
Commit: Tamás Bunth 
CommitDate: Fri Aug 2 16:49:13 2019 +0200

mysqlc: resultset's previous() on first position..

.. should move the cursor backwards to beforeFirst position and return
false.

Change-Id: Icbb4bed0ea39ea3a0bf375d5616e3ef768fc69d9
Reviewed-on: https://gerrit.libreoffice.org/66730
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76729
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 414a0de569e2..77e82c9cdfc5 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -241,6 +241,12 @@ void MysqlTestDriver::testDBPositionChange()
 xResultSet->first();
 CPPUNIT_ASSERT_EQUAL(1, xResultSet->getRow());
 
+// Now previous should put the cursor to before-first position, but it
+// should return with false.
+successPrevious = xResultSet->previous();
+CPPUNIT_ASSERT(!successPrevious);
+CPPUNIT_ASSERT_EQUAL(0, xResultSet->getRow());
+
 nUpdateCount = xStatement->executeUpdate("DROP TABLE myTestTable");
 CPPUNIT_ASSERT_EQUAL(0, nUpdateCount); // it's a DDL statement
 }
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
index be02c7c73ee3..1d93aa952383 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
@@ -659,8 +659,15 @@ sal_Bool SAL_CALL OResultSet::previous()
 MutexGuard aGuard(m_aMutex);
 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
-if (m_nRowPosition <= 0)
+if (m_nRowPosition == 0)
+{
+m_nRowPosition--;
 return false;
+}
+else if (m_nRowPosition < 0)
+{
+return false;
+}
 
 m_nRowPosition--;
 return true;
commit 4348e54817da8b8b4348935fff74ca9d8b7ab4e0
Author: Tamas Bunth 
AuthorDate: Sat Dec 29 15:22:56 2018 +0100
Commit: Tamás Bunth 
CommitDate: Fri Aug 2 16:49:03 2019 +0200

mysqlc: Fix result set metadata related issue

In order to allow fetching result of multiple result sets at time same
time, all the data is fetched and copied on demand from the mysql result
set. The mysql result set (MYSQL_RES) is freed afterwards.

That means we need a copy of the meta information as well. Now all the
meta data is stored in the driver for each result set, so it does not
depend on the MYSQL_RES structure anymore.

Also add test case for invoking some meta data queries before and after
fetching the result set.

Change-Id: Ie8bf993926ebe89cd362ab0b311d1f3d164b84df
Reviewed-on: https://gerrit.libreoffice.org/65855
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76726
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 24436641fe6c..414a0de569e2 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -13,7 +13,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -44,11 +47,15 @@ public:
 void testCreateAndDropTable();
 void testIntegerInsertAndQuery();
 void testDBPositionChange();
+void testMultipleResultsets();
+void testDBMetaData();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
 CPPUNIT_TEST(testCreateAndDropTable);
 CPPUNIT_TEST(testIntegerInsertAndQuery);
+CPPUNIT_TEST(testMultipleResultsets);
+CPPUNIT_TEST(testDBMetaData);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -238,6 +245,77 @@ void MysqlTestDriver::testDBPositionChange()
 CPPUNIT_ASSERT_EQUAL(0, nUpdateCount); // it's a DDL statement
 }
 
+void MysqlTestDriver::testMultipleResultsets()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - connectivity/source

2019-08-01 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 6cd885243952bec4b71aa95d77820b08d70a94dc
Author: Tamas Bunth 
AuthorDate: Sat Dec 29 15:19:57 2018 +0100
Commit: Tamás Bunth 
CommitDate: Thu Aug 1 14:35:30 2019 +0200

mysqlc: ensure fetched result while invoking last

Change-Id: Ia1872973eefff1d8d677aa443b0c03d3ea569d60
Reviewed-on: https://gerrit.libreoffice.org/65854
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76725
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
index d6c2a9b724b4..be02c7c73ee3 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
@@ -612,6 +612,7 @@ sal_Bool SAL_CALL OResultSet::last()
 {
 MutexGuard aGuard(m_aMutex);
 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ensureResultFetched();
 m_nRowPosition = m_nRowCount - 1;
 
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - connectivity/qa connectivity/source

2019-08-01 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx|   13 -
 connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx |   37 +++-
 connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx |4 -
 3 files changed, 40 insertions(+), 14 deletions(-)

New commits:
commit 366915de3f1f123b345eebbeb3a4646d69ae72da
Author: Tamas Bunth 
AuthorDate: Mon Dec 10 10:43:14 2018 +0100
Commit: Tamás Bunth 
CommitDate: Thu Aug 1 13:50:31 2019 +0200

mysqlc: Fix obtaining field information in rs

Result set field information should be stored correctly. It is queried
from database on demand and stored locally.

Change-Id: Ia62c62e6db32b45640b9fcd5f48c6249aecc41a2
Reviewed-on: https://gerrit.libreoffice.org/64861
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/65160
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76724
Tested-by: Jenkins CollaboraOffice 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 16172439df0f..24436641fe6c 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -165,6 +165,7 @@ void MysqlTestDriver::testIntegerInsertAndQuery()
 Reference xResultSet = xStatement->executeQuery("SELECT id 
from myTestTable");
 CPPUNIT_ASSERT_MESSAGE("result set cannot be instantiated after query", 
xResultSet.is());
 Reference xRow(xResultSet, UNO_QUERY);
+Reference xColumnLocate(xResultSet, UNO_QUERY);
 CPPUNIT_ASSERT_MESSAGE("cannot extract row from result set!", xRow.is());
 
 for (long i = 0; i < ROW_COUNT; ++i)
@@ -172,6 +173,7 @@ void MysqlTestDriver::testIntegerInsertAndQuery()
 bool hasRow = xResultSet->next();
 CPPUNIT_ASSERT_MESSAGE("not enough result after query", hasRow);
 CPPUNIT_ASSERT_EQUAL(i, xRow->getLong(1)); // first and only column
+CPPUNIT_ASSERT_EQUAL(i, 
xRow->getLong(xColumnLocate->findColumn("id"))); // test findColumn
 }
 CPPUNIT_ASSERT_MESSAGE("Cursor is not on last position.",
xResultSet->isLast()); // cursor is on last position
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
index 5ee7aa943206..d6c2a9b724b4 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
@@ -134,6 +134,18 @@ void OResultSet::ensureResultFetched()
 }
 }
 
+void OResultSet::ensureFieldInfoFetched()
+{
+if (!m_aFields.empty())
+return;
+unsigned nFieldCount = mysql_num_fields(m_pResult);
+MYSQL_FIELD* pFields = mysql_fetch_fields(m_pResult);
+m_aFields.reserve(nFieldCount);
+for (unsigned i = 0; i < nFieldCount; ++i)
+m_aFields.push_back(OUString{
+pFields[i].name, static_cast(strlen(pFields[i].name)), 
m_encoding });
+}
+
 void OResultSet::fetchResult()
 {
 // Mysql C API does not allow simultaneously opened result sets, but sdbc 
does.
@@ -143,20 +155,18 @@ void OResultSet::fetchResult()
 // TODO ensure that
 m_nRowCount = mysql_num_rows(m_pResult);
 
+ensureFieldInfoFetched();
+
 // fetch all the data
 m_aRows.reserve(m_nRowCount);
 
-m_nFieldCount = mysql_num_fields(m_pResult);
-MYSQL_FIELD* pFields = mysql_fetch_fields(m_pResult);
-m_aFields.assign(pFields, pFields + m_nFieldCount);
-
 for (sal_Int32 row = 0; row < m_nRowCount; ++row)
 {
 MYSQL_ROW data = mysql_fetch_row(m_pResult);
 unsigned long* lengths = mysql_fetch_lengths(m_pResult);
 m_aRows.push_back(DataFields{});
 // MYSQL_ROW is char**, array of strings
-for (unsigned col = 0; col < m_nFieldCount; ++col)
+for (std::size_t col = 0; col < m_aFields.size(); ++col)
 {
 m_aRows.back().push_back(OString{ data[col], 
static_cast(lengths[col]) });
 }
@@ -202,11 +212,12 @@ sal_Int32 SAL_CALL OResultSet::findColumn(const OUString& 
columnName)
 {
 MutexGuard aGuard(m_aMutex);
 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ensureFieldInfoFetched();
 
-for (unsigned int i = 0; i < m_nFieldCount; ++i)
+for (std::size_t i = 0; i < m_aFields.size(); ++i)
 {
-if (columnName.equalsIgnoreAsciiCaseAscii(m_aFields[i].name))
-return i + 1; // sdbc indexes from 1
+if (columnName.equalsIgnoreAsciiCase(m_aFields[i]))
+return static_cast(i) + 1; // sdbc indexes from 1
 }
 
 throw SQLException("The column name '" + columnName + "' is not valid.", 
*this, "42S22", 0,
@@ -1092,7 +1103,7 @@ css::uno::Reference 
SAL_CALL OResultSet::getProper
 
 void OResultSet::checkColumnIndex(sal_Int32 index)
 {
-if (index < 1 || index > static_cast(m_nFieldCount))
+if (index < 1 || index > 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - connectivity/qa

2019-08-01 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx |   45 +++
 1 file changed, 45 insertions(+)

New commits:
commit 6098a6d92c7e4155eaa73e1b547463a2bee14430
Author: Tamas Bunth 
AuthorDate: Wed Jul 31 14:20:21 2019 +0200
Commit: Tamás Bunth 
CommitDate: Thu Aug 1 11:38:55 2019 +0200

mysqlc: Add test for textual blob types

Test setting and querying the following data types:
TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT

Test them using prepared statements.

Change-Id: I43387034ad8c32c3731cde70a22cc8b3dd652b78
Reviewed-on: https://gerrit.libreoffice.org/76749
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index d0ab2ce28806..cffd755e22ff 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -54,6 +54,7 @@ public:
 void testTimestampField();
 void testNumericConversionPrepared();
 void testPreparedStmtIsAfterLast();
+void testGetStringFromBloColumnb();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -64,6 +65,7 @@ public:
 CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST(testNumericConversionPrepared);
 CPPUNIT_TEST(testPreparedStmtIsAfterLast);
+CPPUNIT_TEST(testGetStringFromBloColumnb);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -429,6 +431,49 @@ void MysqlTestDriver::testPreparedStmtIsAfterLast()
 bool hasData = xResultSet->next();
 CPPUNIT_ASSERT(!hasData); // now we are on "AfterLast"
 CPPUNIT_ASSERT(xResultSet->isAfterLast());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+}
+
+void MysqlTestDriver::testGetStringFromBloColumnb()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+// create test table
+xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY 
KEY, tinytexty "
+  "TINYTEXT, texty TEXT, mediumTexty MEDIUMTEXT, 
longtexty LONGTEXT)");
+Reference xPrepared = xConnection->prepareStatement(
+OUString{ "INSERT INTO myTestTable VALUES (?, ?, ?, ?, ?)" });
+Reference xParams(xPrepared, UNO_QUERY);
+constexpr int ROW_COUNT = 6;
+for (int i = 0; i < ROW_COUNT; ++i)
+{
+xParams->setShort(1, i);
+xParams->setString(2, OUString::number(i));
+xParams->setString(3, OUString::number(i));
+xParams->setString(4, OUString::number(i));
+xParams->setString(5, OUString::number(i));
+xPrepared->executeUpdate();
+}
+
+// query test table
+xPrepared = xConnection->prepareStatement(
+"SELECT tinytexty, texty, mediumtexty, longtexty from myTestTable 
where texty LIKE '3'");
+Reference xResultSet = xPrepared->executeQuery();
+xResultSet->next();
+Reference xRow(xResultSet, UNO_QUERY);
+
+// all the textual blob types should be able to be queried via getString().
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(1));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(2));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(3));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(4));
+
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-01 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx |   45 +++
 1 file changed, 45 insertions(+)

New commits:
commit cbbda5b9267f9f7c7028ebc3f0867ddc6715543a
Author: Tamas Bunth 
AuthorDate: Wed Jul 31 14:20:21 2019 +0200
Commit: Tamás Bunth 
CommitDate: Thu Aug 1 11:38:46 2019 +0200

mysqlc: Add test for textual blob types

Test setting and querying the following data types:
TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT

Test them using prepared statements.

Change-Id: I43387034ad8c32c3731cde70a22cc8b3dd652b78
Reviewed-on: https://gerrit.libreoffice.org/76747
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 24af725b0110..47d1d7929e44 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -55,6 +55,7 @@ public:
 void testTimestampField();
 void testNumericConversionPrepared();
 void testPreparedStmtIsAfterLast();
+void testGetStringFromBloColumnb();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -65,6 +66,7 @@ public:
 CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST(testNumericConversionPrepared);
 CPPUNIT_TEST(testPreparedStmtIsAfterLast);
+CPPUNIT_TEST(testGetStringFromBloColumnb);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -444,6 +446,49 @@ void MysqlTestDriver::testPreparedStmtIsAfterLast()
 bool hasData = xResultSet->next();
 CPPUNIT_ASSERT(!hasData); // now we are on "AfterLast"
 CPPUNIT_ASSERT(xResultSet->isAfterLast());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+}
+
+void MysqlTestDriver::testGetStringFromBloColumnb()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+// create test table
+xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY 
KEY, tinytexty "
+  "TINYTEXT, texty TEXT, mediumTexty MEDIUMTEXT, 
longtexty LONGTEXT)");
+Reference xPrepared = xConnection->prepareStatement(
+OUString{ "INSERT INTO myTestTable VALUES (?, ?, ?, ?, ?)" });
+Reference xParams(xPrepared, UNO_QUERY);
+constexpr int ROW_COUNT = 6;
+for (int i = 0; i < ROW_COUNT; ++i)
+{
+xParams->setShort(1, i);
+xParams->setString(2, OUString::number(i));
+xParams->setString(3, OUString::number(i));
+xParams->setString(4, OUString::number(i));
+xParams->setString(5, OUString::number(i));
+xPrepared->executeUpdate();
+}
+
+// query test table
+xPrepared = xConnection->prepareStatement(
+"SELECT tinytexty, texty, mediumtexty, longtexty from myTestTable 
where texty LIKE '3'");
+Reference xResultSet = xPrepared->executeQuery();
+xResultSet->next();
+Reference xRow(xResultSet, UNO_QUERY);
+
+// all the textual blob types should be able to be queried via getString().
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(1));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(2));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(3));
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xRow->getString(4));
+
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-31 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

New commits:
commit acafd1ac87cb23a447353b8f0419a25fbe1c4430
Author: Tamas Bunth 
AuthorDate: Wed Sep 12 17:31:26 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 31 19:58:09 2019 +0200

mysqlc: getTablePrivileges not implemented, so..

it should throw an exception.

Reviewed-on: https://gerrit.libreoffice.org/60460
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
(cherry picked from commit 19f8ea668833a4dc90244792cbf91881b0ca9a07)

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

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index be8dc496de2e..bca56e119626 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -1046,14 +1046,9 @@ Reference SAL_CALL 
ODatabaseMetaData::getBestRowIdentifier(const Any
 Reference SAL_CALL ODatabaseMetaData::getTablePrivileges(
 const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& 
/*tableNamePattern*/)
 {
-Reference 
xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- 
"org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
-std::vector> rRows;
 // TODO
 SAL_WARN("connectivity.mysqlc", "method not implemented");
-lcl_setRows_throw(xResultSet, 12, rRows);
-return xResultSet;
+throw SQLException("getTablePrivileges method not implemented", *this, 
"IM001", 0, Any());
 }
 
 Reference SAL_CALL ODatabaseMetaData::getCrossReference(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - connectivity/source

2019-07-31 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit c2857c8acd90a7c832321ba0f30db2f6fc9279b3
Author: Tamas Bunth 
AuthorDate: Wed Sep 12 17:31:26 2018 +0200
Commit: Tamás Bunth 
CommitDate: Wed Jul 31 14:26:45 2019 +0200

mysqlc: getTablePrivileges not implemented, so..

it should throw an exception.

Change-Id: I55fd8ed5d92a28096b9bde6b0161e16d7543203b
Reviewed-on: https://gerrit.libreoffice.org/60460
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/76721
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index 890f31de666a..f4355ae7a169 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -1050,10 +1050,9 @@ Reference SAL_CALL 
ODatabaseMetaData::getTablePrivileges(
 Reference 
xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
  
"org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
  UNO_QUERY);
-std::vector> rRows;
 // TODO
 SAL_WARN("connectivity.mysqlc", "method not implemented");
-lcl_setRows_throw(xResultSet, 12, rRows);
+throw SQLException("getTablePrivileges method not implemented", *this, 
"IM001", 0, Any());
 return xResultSet;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - connectivity/source

2019-07-31 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |8 
+++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 8e106d00371a201d97c53240d34a346cbf9c0b09
Author: Tamas Bunth 
AuthorDate: Tue Jul 30 15:05:35 2019 +0200
Commit: Tamás Bunth 
CommitDate: Wed Jul 31 14:27:05 2019 +0200

mysqlc: Support reading blob as string

Change-Id: I1ef0c3817bc255e7f0c38aca73c475b19d5d7d9b
Reviewed-on: https://gerrit.libreoffice.org/76600
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/76734
Tested-by: Jenkins CollaboraOffice 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 1faded9d64b9..dcaaf319265b 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -314,7 +314,10 @@ template <> DateTime 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 
 template <> OUString OPreparedResultSet::retrieveValue(sal_Int32 column)
 {
-if (getTypeFromMysqlType(m_aFields[column - 1].type) != 
std::type_index(typeid(OUString)))
+// redirect call to the appropiate method if needed
+// BLOB can be simply read out as string
+if (getTypeFromMysqlType(m_aFields[column - 1].type) != 
std::type_index(typeid(OUString))
+&& m_aFields[column - 1].type != MYSQL_TYPE_BLOB)
 return getRowSetValue(column);
 const char* sStr = static_cast(m_aData[column - 1].buffer);
 
@@ -352,6 +355,9 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_DECIMAL:
 case MYSQL_TYPE_NEWDECIMAL:
 return getString(nColumnIndex);
+case MYSQL_TYPE_BLOB:
+throw SQLException("Column with type BLOB cannot be converted", 
*this, OUString(), 1,
+   Any());
 default:
 SAL_WARN("connectivity.mysqlc", 
"OPreparedResultSet::getRowSetValue: unknown type: "
 << m_aFields[nColumnIndex - 
1].type);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - connectivity/qa connectivity/source

2019-07-31 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx |   41 ++
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |  172 
+-
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |7 
 3 files changed, 136 insertions(+), 84 deletions(-)

New commits:
commit c646107b1b6a58d44533e44d5bf6fc69faf93a0c
Author: Tamas Bunth 
AuthorDate: Mon Jul 29 13:27:38 2019 +0200
Commit: Tamás Bunth 
CommitDate: Wed Jul 31 14:26:54 2019 +0200

mysqlc: Fix query of cursor position in result set

Fix queries like "IsAfterLast" in result sets of prepared statements in
the mysql driver.

Cursor position is stored in the driver, since the mysql C driver does
not support the query of the cursor position.

The cursor position works the following way:
- 0 means the cursor is on "BeforeFirst". In that state calling of
  getXXX() methods is user error.
- 1 means the first row is already fetched.
- n means the last fow is fetched, where n is the total number of rows
  in the result set.
- Everything bigger than n is "AfterLast"

Change-Id: I131f2042606897019cc0f868dbc4151faf4850ac
Reviewed-on: https://gerrit.libreoffice.org/76549
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/76583
Tested-by: Jenkins CollaboraOffice 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 98e068b65f2a..d0ab2ce28806 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -53,6 +53,7 @@ public:
 void testDBMetaData();
 void testTimestampField();
 void testNumericConversionPrepared();
+void testPreparedStmtIsAfterLast();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -62,6 +63,7 @@ public:
 CPPUNIT_TEST(testDBMetaData);
 CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST(testNumericConversionPrepared);
+CPPUNIT_TEST(testPreparedStmtIsAfterLast);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -390,6 +392,45 @@ void MysqlTestDriver::testNumericConversionPrepared()
 xStatement->executeUpdate("DROP TABLE myTestTable");
 }
 
+/**
+ * Test cursor positioning method isAfterLast in case of using prepared
+ * statement.
+ */
+void MysqlTestDriver::testPreparedStmtIsAfterLast()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+// create test table
+xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY 
KEY)");
+Reference xPrepared
+= xConnection->prepareStatement(OUString{ "INSERT INTO myTestTable 
VALUES (?)" });
+Reference xParams(xPrepared, UNO_QUERY);
+constexpr int ROW_COUNT = 6;
+for (int i = 0; i < ROW_COUNT; ++i)
+{
+xParams->setShort(1, i);
+xPrepared->executeUpdate();
+}
+
+// query test table
+xPrepared = xConnection->prepareStatement("SELECT id from myTestTable 
where id = 3");
+Reference xResultSet = xPrepared->executeQuery();
+
+// There should be exactly one row, therefore IsAfterLast is false at 
first.
+xResultSet->next();
+CPPUNIT_ASSERT(!xResultSet->isAfterLast());
+
+// attempt to fetch more data
+bool hasData = xResultSet->next();
+CPPUNIT_ASSERT(!hasData); // now we are on "AfterLast"
+CPPUNIT_ASSERT(xResultSet->isAfterLast());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 7d261160bfae..1faded9d64b9 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -100,6 +100,62 @@ const std::type_index 
getTypeFromMysqlType(enum_field_types type)
 }
 }
 
+bool OPreparedResultSet::fetchResult()
+{
+// allocate array if it does not exist
+if (m_aData == nullptr)
+{
+m_aData.reset(new MYSQL_BIND[m_nColumnCount]);
+memset(m_aData.get(), 0, m_nColumnCount * sizeof(MYSQL_BIND));
+m_aMetaData.reset(new BindMetaData[m_nColumnCount]);
+}
+for (sal_Int32 i = 0; i < m_nColumnCount; ++i)
+{
+m_aMetaData[i].is_null = 0;
+m_aMetaData[i].length = 0l;
+m_aMetaData[i].error = 0;
+
+m_aData[i].is_null = _aMetaData[i].is_null;
+m_aData[i].buffer_length = m_aFields[i].type == MYSQL_TYPE_BLOB ? 0 : 
m_aFields[i].length;
+m_aData[i].length = _aMetaData[i].length;
+m_aData[i].error = _aMetaData[i].error;
+

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

2019-07-31 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |8 
+++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit cc4c20d08fca59819e121c0678d1e595a97c92c9
Author: Tamas Bunth 
AuthorDate: Tue Jul 30 15:05:35 2019 +0200
Commit: Tamás Bunth 
CommitDate: Wed Jul 31 10:53:18 2019 +0200

mysqlc: Support reading blob as string

Change-Id: I1ef0c3817bc255e7f0c38aca73c475b19d5d7d9b
Reviewed-on: https://gerrit.libreoffice.org/76600
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 7d2c5276d142..df5702605945 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -309,7 +309,10 @@ template <> DateTime 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 
 template <> OUString OPreparedResultSet::retrieveValue(sal_Int32 column)
 {
-if (getTypeFromMysqlType(m_aFields[column - 1].type) != 
std::type_index(typeid(OUString)))
+// redirect call to the appropiate method if needed
+// BLOB can be simply read out as string
+if (getTypeFromMysqlType(m_aFields[column - 1].type) != 
std::type_index(typeid(OUString))
+&& m_aFields[column - 1].type != MYSQL_TYPE_BLOB)
 return getRowSetValue(column);
 const char* sStr = static_cast(m_aData[column - 1].buffer);
 
@@ -344,6 +347,9 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_DECIMAL:
 case MYSQL_TYPE_NEWDECIMAL:
 return getString(nColumnIndex);
+case MYSQL_TYPE_BLOB:
+throw SQLException("Column with type BLOB cannot be converted", 
*this, OUString(), 1,
+   Any());
 default:
 SAL_WARN("connectivity.mysqlc", 
"OPreparedResultSet::getRowSetValue: unknown type: "
 << m_aFields[nColumnIndex - 
1].type);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-29 Thread Tamas Bunth (via logerrit)
 connectivity/qa/connectivity/mysql/mysql.cxx |   41 ++
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |  164 
+-
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |7 
 3 files changed, 130 insertions(+), 82 deletions(-)

New commits:
commit 41d3be4a48ea2abe019cd4f9b51bef703a2dc454
Author: Tamas Bunth 
AuthorDate: Mon Jul 29 13:27:38 2019 +0200
Commit: Tamás Bunth 
CommitDate: Mon Jul 29 22:33:38 2019 +0200

mysqlc: Fix query of cursor position in result set

Fix queries like "IsAfterLast" in result sets of prepared statements in
the mysql driver.

Cursor position is stored in the driver, since the mysql C driver does
not support the query of the cursor position.

The cursor position works the following way:
- 0 means the cursor is on "BeforeFirst". In that state calling of
  getXXX() methods is user error.
- 1 means the first row is already fetched.
- n means the last fow is fetched, where n is the total number of rows
  in the result set.
- Everything bigger than n is "AfterLast"

Change-Id: I131f2042606897019cc0f868dbc4151faf4850ac
Reviewed-on: https://gerrit.libreoffice.org/76549
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 3e48ce5b3750..24af725b0110 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -54,6 +54,7 @@ public:
 void testDBMetaData();
 void testTimestampField();
 void testNumericConversionPrepared();
+void testPreparedStmtIsAfterLast();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -63,6 +64,7 @@ public:
 CPPUNIT_TEST(testDBMetaData);
 CPPUNIT_TEST(testTimestampField);
 CPPUNIT_TEST(testNumericConversionPrepared);
+CPPUNIT_TEST(testPreparedStmtIsAfterLast);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -405,6 +407,45 @@ void MysqlTestDriver::testNumericConversionPrepared()
 xStatement->executeUpdate("DROP TABLE myTestTable");
 }
 
+/**
+ * Test cursor positioning method isAfterLast in case of using prepared
+ * statement.
+ */
+void MysqlTestDriver::testPreparedStmtIsAfterLast()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+// create test table
+xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY 
KEY)");
+Reference xPrepared
+= xConnection->prepareStatement(OUString{ "INSERT INTO myTestTable 
VALUES (?)" });
+Reference xParams(xPrepared, UNO_QUERY);
+constexpr int ROW_COUNT = 6;
+for (int i = 0; i < ROW_COUNT; ++i)
+{
+xParams->setShort(1, i);
+xPrepared->executeUpdate();
+}
+
+// query test table
+xPrepared = xConnection->prepareStatement("SELECT id from myTestTable 
where id = 3");
+Reference xResultSet = xPrepared->executeQuery();
+
+// There should be exactly one row, therefore IsAfterLast is false at 
first.
+xResultSet->next();
+CPPUNIT_ASSERT(!xResultSet->isAfterLast());
+
+// attempt to fetch more data
+bool hasData = xResultSet->next();
+CPPUNIT_ASSERT(!hasData); // now we are on "AfterLast"
+CPPUNIT_ASSERT(xResultSet->isAfterLast());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index ae573a6d8fbc..7d2c5276d142 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -100,6 +100,62 @@ const std::type_index 
getTypeFromMysqlType(enum_field_types type)
 }
 }
 
+bool OPreparedResultSet::fetchResult()
+{
+// allocate array if it does not exist
+if (m_aData == nullptr)
+{
+m_aData.reset(new MYSQL_BIND[m_nColumnCount]);
+memset(m_aData.get(), 0, m_nColumnCount * sizeof(MYSQL_BIND));
+m_aMetaData.reset(new BindMetaData[m_nColumnCount]);
+}
+for (sal_Int32 i = 0; i < m_nColumnCount; ++i)
+{
+m_aMetaData[i].is_null = 0;
+m_aMetaData[i].length = 0l;
+m_aMetaData[i].error = 0;
+
+m_aData[i].is_null = _aMetaData[i].is_null;
+m_aData[i].buffer_length = m_aFields[i].type == MYSQL_TYPE_BLOB ? 0 : 
m_aFields[i].length;
+m_aData[i].length = _aMetaData[i].length;
+m_aData[i].error = _aMetaData[i].error;
+m_aData[i].buffer = nullptr;
+m_aData[i].buffer_type = m_aFields[i].type;
+
+// 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - dbaccess/source

2019-07-22 Thread Tamas Bunth (via logerrit)
 dbaccess/source/filter/hsqldb/parseschema.cxx |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit ed9acbe6057f535bca8d4ce98aa0eda7be34e15b
Author: Tamas Bunth 
AuthorDate: Tue Jul 16 21:44:38 2019 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 22 11:33:30 2019 +0200

tdf#123020 dbahsql: Support string delimiter

Support multi-word table names while migrating HSQLDB data.

Change-Id: I5129f995ea90a3fdbcbcb844774cf074f3ffddb2
Reviewed-on: https://gerrit.libreoffice.org/75734
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
(cherry picked from commit b5890bf269214a47833bc9514b80650455e77ef6)
Reviewed-on: https://gerrit.libreoffice.org/75820
Reviewed-by: Christian Lohmaier 
(cherry picked from commit 47d6c43c19aa6ea05f0f65db58e5cdcf1c603660)
Reviewed-on: https://gerrit.libreoffice.org/75853
Reviewed-by: Michael Stahl 

diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx 
b/dbaccess/source/filter/hsqldb/parseschema.cxx
index e04998c80f28..f8e17d90b312 100644
--- a/dbaccess/source/filter/hsqldb/parseschema.cxx
+++ b/dbaccess/source/filter/hsqldb/parseschema.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -74,8 +75,17 @@ public:
 
 OUString getTableName() const
 {
-// SET TABLE 
-return string::split(m_sql, u' ')[2];
+// SET TABLE  or SET TABLE ""
+OUString sName = string::split(m_sql, u' ')[2];
+if (sName.indexOf('"') >= 0)
+{
+// Table name with string delimiter
+OUStringBuffer sMultiName("\"");
+sMultiName.append(string::split(m_sql, u'"')[1]);
+sMultiName.append("\"");
+sName = sMultiName.makeStringAndClear();
+}
+return sName;
 }
 };
 
@@ -169,6 +179,12 @@ void SchemaParser::parseSchema()
 
 ColumnTypeVector SchemaParser::getTableColumnTypes(const OUString& sTableName) 
const
 {
+if (m_ColumnTypes.count(sTableName) < 1)
+{
+constexpr char NOT_EXIST[] = "Internal error while getting column 
information of table";
+SAL_WARN("dbaccess", NOT_EXIST << ". Table name is: " << sTableName);
+dbtools::throwGenericSQLException(NOT_EXIST, 
::comphelper::getProcessComponentContext());
+}
 return m_ColumnTypes.at(sTableName);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - dbaccess/source

2019-07-18 Thread Tamas Bunth (via logerrit)
 dbaccess/source/filter/hsqldb/parseschema.cxx |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 47d6c43c19aa6ea05f0f65db58e5cdcf1c603660
Author: Tamas Bunth 
AuthorDate: Tue Jul 16 21:44:38 2019 +0200
Commit: Christian Lohmaier 
CommitDate: Thu Jul 18 12:05:03 2019 +0200

tdf#123020 dbahsql: Support string delimiter

Support multi-word table names while migrating HSQLDB data.

Change-Id: I5129f995ea90a3fdbcbcb844774cf074f3ffddb2
Reviewed-on: https://gerrit.libreoffice.org/75734
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
(cherry picked from commit b5890bf269214a47833bc9514b80650455e77ef6)
Reviewed-on: https://gerrit.libreoffice.org/75820
Reviewed-by: Christian Lohmaier 

diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx 
b/dbaccess/source/filter/hsqldb/parseschema.cxx
index be08037b7be5..60e7103cdfa2 100644
--- a/dbaccess/source/filter/hsqldb/parseschema.cxx
+++ b/dbaccess/source/filter/hsqldb/parseschema.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -74,8 +75,17 @@ public:
 
 OUString getTableName() const
 {
-// SET TABLE 
-return string::split(m_sql, u' ')[2];
+// SET TABLE  or SET TABLE ""
+OUString sName = string::split(m_sql, u' ')[2];
+if (sName.indexOf('"') >= 0)
+{
+// Table name with string delimiter
+OUStringBuffer sMultiName("\"");
+sMultiName.append(string::split(m_sql, u'"')[1]);
+sMultiName.append("\"");
+sName = sMultiName.makeStringAndClear();
+}
+return sName;
 }
 };
 
@@ -169,6 +179,12 @@ void SchemaParser::parseSchema()
 
 std::vector SchemaParser::getTableColumnTypes(const 
OUString& sTableName) const
 {
+if (m_ColumnTypes.count(sTableName) < 1)
+{
+constexpr char NOT_EXIST[] = "Internal error while getting column 
information of table";
+SAL_WARN("dbaccess", NOT_EXIST << ". Table name is: " << sTableName);
+dbtools::throwGenericSQLException(NOT_EXIST, 
::comphelper::getProcessComponentContext());
+}
 return m_ColumnTypes.at(sTableName);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-17 Thread Tamas Bunth (via logerrit)
 dbaccess/source/filter/hsqldb/parseschema.cxx |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit b5890bf269214a47833bc9514b80650455e77ef6
Author: Tamas Bunth 
AuthorDate: Tue Jul 16 21:44:38 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Jul 17 22:49:54 2019 +0200

tdf#123020 dbahsql: Support string delimiter

Support multi-word table names while migrating HSQLDB data.

Change-Id: I5129f995ea90a3fdbcbcb844774cf074f3ffddb2
Reviewed-on: https://gerrit.libreoffice.org/75734
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx 
b/dbaccess/source/filter/hsqldb/parseschema.cxx
index be08037b7be5..60e7103cdfa2 100644
--- a/dbaccess/source/filter/hsqldb/parseschema.cxx
+++ b/dbaccess/source/filter/hsqldb/parseschema.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -74,8 +75,17 @@ public:
 
 OUString getTableName() const
 {
-// SET TABLE 
-return string::split(m_sql, u' ')[2];
+// SET TABLE  or SET TABLE ""
+OUString sName = string::split(m_sql, u' ')[2];
+if (sName.indexOf('"') >= 0)
+{
+// Table name with string delimiter
+OUStringBuffer sMultiName("\"");
+sMultiName.append(string::split(m_sql, u'"')[1]);
+sMultiName.append("\"");
+sName = sMultiName.makeStringAndClear();
+}
+return sName;
 }
 };
 
@@ -169,6 +179,12 @@ void SchemaParser::parseSchema()
 
 std::vector SchemaParser::getTableColumnTypes(const 
OUString& sTableName) const
 {
+if (m_ColumnTypes.count(sTableName) < 1)
+{
+constexpr char NOT_EXIST[] = "Internal error while getting column 
information of table";
+SAL_WARN("dbaccess", NOT_EXIST << ". Table name is: " << sTableName);
+dbtools::throwGenericSQLException(NOT_EXIST, 
::comphelper::getProcessComponentContext());
+}
 return m_ColumnTypes.at(sTableName);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - connectivity/source

2019-07-17 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/firebird/Connection.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 3173e00f428ea8cf79f36efb38d15028aca01d4a
Author: Tamas Bunth 
AuthorDate: Sat Jul 13 16:39:31 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Jul 17 12:26:55 2019 +0200

tdf#123150: Firebird: set UTF-8 client connection

There are two options related to character sets when attaching or
creating a database with the C API:

- isc_dpb_lc_ctype: Sets the character set of the connection between the
Firebird server and the Client (which is the sdbc driver in that case).
That is required in order to pass UTF 8 literals correctly.

- isc_dpb_set_db_charset: Sets the default character set of the database
itself. It has the same effect as the following SQL statement:
 ALTER DATABASE SET DEFAULT CHARACTER SET 

We need to set both of them to UTF-8.

Change-Id: Ia9e5a4b87a3997c084be8abb68c2de813fbd631b
Reviewed-on: https://gerrit.libreoffice.org/75557
Reviewed-by: Tamás Bunth 
Tested-by: Tamás Bunth 
(cherry picked from commit c19c206cf42ac178906a855ae3cd198e0fcf8d14)
Reviewed-on: https://gerrit.libreoffice.org/75755
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/connectivity/source/drivers/firebird/Connection.cxx 
b/connectivity/source/drivers/firebird/Connection.cxx
index ba2fba974d78..c707ca2c15ad 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -227,11 +227,15 @@ void Connection::construct(const OUString& url, const 
Sequence< PropertyValue >&
 dpbBuffer.push_back(1); // 1 byte long
 dpbBuffer.push_back(FIREBIRD_SQL_DIALECT);
 
-// set UTF8 as default character set
+// set UTF8 as default character set of the database
 const char sCharset[] = "UTF8";
 dpbBuffer.push_back(isc_dpb_set_db_charset);
 dpbBuffer.push_back(sizeof(sCharset) - 1);
 dpbBuffer.append(sCharset);
+// set UTF8 as default character set of the connection
+dpbBuffer.push_back(isc_dpb_lc_ctype);
+dpbBuffer.push_back(sizeof(sCharset) - 1);
+dpbBuffer.append(sCharset);
 
 // Do any more dpbBuffer additions here
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

2019-07-15 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/firebird/Connection.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 4897c78c4b0ce88b65d509066990bdf5ae444d9a
Author: Tamas Bunth 
AuthorDate: Sat Jul 13 16:39:31 2019 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 15 12:16:16 2019 +0200

tdf#123150: Firebird: set UTF-8 client connection

There are two options related to character sets when attaching or
creating a database with the C API:

- isc_dpb_lc_ctype: Sets the character set of the connection between the
Firebird server and the Client (which is the sdbc driver in that case).
That is required in order to pass UTF 8 literals correctly.

- isc_dpb_set_db_charset: Sets the default character set of the database
itself. It has the same effect as the following SQL statement:
 ALTER DATABASE SET DEFAULT CHARACTER SET 

We need to set both of them to UTF-8.

Change-Id: Ia9e5a4b87a3997c084be8abb68c2de813fbd631b
Reviewed-on: https://gerrit.libreoffice.org/75557
Reviewed-by: Tamás Bunth 
Tested-by: Tamás Bunth 
(cherry picked from commit c19c206cf42ac178906a855ae3cd198e0fcf8d14)
Reviewed-on: https://gerrit.libreoffice.org/75567
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/connectivity/source/drivers/firebird/Connection.cxx 
b/connectivity/source/drivers/firebird/Connection.cxx
index b12eafb35cdf..6c2a6862e8bd 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -222,11 +222,15 @@ void Connection::construct(const OUString& url, const 
Sequence< PropertyValue >&
 dpbBuffer.push_back(1); // 1 byte long
 dpbBuffer.push_back(FIREBIRD_SQL_DIALECT);
 
-// set UTF8 as default character set
+// set UTF8 as default character set of the database
 const char sCharset[] = "UTF8";
 dpbBuffer.push_back(isc_dpb_set_db_charset);
 dpbBuffer.push_back(sizeof(sCharset) - 1);
 dpbBuffer.append(sCharset);
+// set UTF8 as default character set of the connection
+dpbBuffer.push_back(isc_dpb_lc_ctype);
+dpbBuffer.push_back(sizeof(sCharset) - 1);
+dpbBuffer.append(sCharset);
 
 // Do any more dpbBuffer additions here
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

2019-07-14 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/firebird/PreparedStatement.cxx |   34 -
 connectivity/source/drivers/firebird/Util.hxx  |   16 +-
 2 files changed, 36 insertions(+), 14 deletions(-)

New commits:
commit cc09dc2480cae51233538f7eede78906f9a5a2c9
Author: Tamas Bunth 
AuthorDate: Sat Jul 13 14:19:15 2019 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Jul 15 03:50:34 2019 +0200

tdf#123591: Firebird: Fix setting double values

Handle numerical and decimal values separately. In order to do that
we have to indentify the exact type first. That can be achieved using
sqltype and sqlsubtype in Firebird API.

Change-Id: Ie664dead51bae5522ee53009cda1cddbe0d64b16
Reviewed-on: https://gerrit.libreoffice.org/75525
Reviewed-by: Tamás Bunth 
Tested-by: Tamás Bunth 
(cherry picked from commit a0d85d526c7a4407ac555a35730afd5003243bcb)
Reviewed-on: https://gerrit.libreoffice.org/75566
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx 
b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 737875e96b5a..69ce91f42da1 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -420,34 +420,44 @@ void SAL_CALL OPreparedStatement::setDouble(sal_Int32 
nIndex, double nValue)
 ensurePrepared();
 
 XSQLVAR* pVar = m_pInSqlda->sqlvar + (nIndex - 1);
-int dType = (pVar->sqltype & ~1); // drop flag bit for now
-
-// take decimal places into account, later on they are removed in 
makeNumericString
-// minus because firebird stores scale as a negative number
-int nDecimalCount = -pVar->sqlscale;
-sal_Int64 nDecimalCountExp = pow10Integer(nDecimalCount);
-
-nValue = static_cast(nValue * nDecimalCountExp);
+short dType = (pVar->sqltype & ~1); // drop flag bit for now
+short dSubType = pVar->sqlsubtype;
+// Assume it is a sub type of a number.
+if(dSubType < 0 || dSubType > 2)
+{
+::dbtools::throwSQLException(
+"Incorrect number sub type",
+::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE,
+*this);
+}
+// firebird stores scale as a negative number
+ColumnTypeInfo columnType{ dType, dSubType,
+static_cast(-pVar->sqlscale) };
 
 // Caller might try to set an integer type here. It makes sense to convert
 // it instead of throwing an error.
-switch(dType)
+switch(columnType.getSdbcType())
 {
-case SQL_SHORT:
+case DataType::SMALLINT:
 setValue< sal_Int16 >(nIndex,
 static_cast(nValue),
 dType);
 break;
-case SQL_LONG:
+case DataType::INTEGER:
 setValue< sal_Int32 >(nIndex,
 static_cast(nValue),
 dType);
 break;
-case SQL_INT64:
+case DataType::BIGINT:
 setValue< sal_Int64 >(nIndex,
 static_cast(nValue),
 dType);
 break;
+case DataType::NUMERIC:
+case DataType::DECIMAL:
+// take decimal places into account, later on they are removed in 
makeNumericString
+setObjectWithInfo(nIndex,Any{nValue}, columnType.getSdbcType(), 
columnType.getScale());
+break;
 default:
 setValue< double >(nIndex, nValue, SQL_DOUBLE); // TODO: 
SQL_D_FLOAT?
 }
diff --git a/connectivity/source/drivers/firebird/Util.hxx 
b/connectivity/source/drivers/firebird/Util.hxx
index 26929a9de162..f380ab6caab5 100644
--- a/connectivity/source/drivers/firebird/Util.hxx
+++ b/connectivity/source/drivers/firebird/Util.hxx
@@ -34,8 +34,10 @@ namespace connectivity
 Image = -9546
 };
 
-// Numeric and decimal types can be identified by their subtype
-// 1 for NUMERIC, 2 for DECIMAL
+/**
+ * Numeric and decimal types can be identified by their subtype in
+ * Firebird API. 1 for NUMERIC, 2 for DECIMAL.
+ */
 enum class NumberSubType {
 Other = 0,
 Numeric = 1,
@@ -49,6 +51,16 @@ private:
 short m_nScale;
 OUString m_sCharsetName;
 public:
+/**
+ * @param tType SQL type of column defined by Firebird (e.g.
+ * SQL_DOUBLE)
+ * @param aSubType SQL sub type as in firebird API. See
+ * NumberSubType.
+ * @param scale: Scale of the number. It is ignored in case it's 
not
+ * a number. Scale obtained from the Firebird API is negative, so
+ * that should be negated before passing to this constructor.
+ *
+ */
 explicit ColumnTypeInfo( short aType, short aSubType = 0,
 short nScale = 0, const OUString& sCharset = 

[Libreoffice-commits] core.git: 2 commits - connectivity/source

2019-07-13 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/firebird/Connection.cxx|6 +-
 connectivity/source/drivers/firebird/PreparedStatement.cxx |   34 -
 connectivity/source/drivers/firebird/Util.hxx  |   16 +-
 3 files changed, 41 insertions(+), 15 deletions(-)

New commits:
commit c19c206cf42ac178906a855ae3cd198e0fcf8d14
Author: Tamas Bunth 
AuthorDate: Sat Jul 13 16:39:31 2019 +0200
Commit: Tamás Bunth 
CommitDate: Sat Jul 13 21:21:18 2019 +0200

tdf#123150: Firebird: set UTF-8 client connection

There are two options related to character sets when attaching or
creating a database with the C API:

- isc_dpb_lc_ctype: Sets the character set of the connection between the
Firebird server and the Client (which is the sdbc driver in that case).
That is required in order to pass UTF 8 literals correctly.

- isc_dpb_set_db_charset: Sets the default character set of the database
itself. It has the same effect as the following SQL statement:
 ALTER DATABASE SET DEFAULT CHARACTER SET 

We need to set both of them to UTF-8.

Change-Id: Ia9e5a4b87a3997c084be8abb68c2de813fbd631b
Reviewed-on: https://gerrit.libreoffice.org/75557
Reviewed-by: Tamás Bunth 
Tested-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/firebird/Connection.cxx 
b/connectivity/source/drivers/firebird/Connection.cxx
index b12eafb35cdf..6c2a6862e8bd 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -222,11 +222,15 @@ void Connection::construct(const OUString& url, const 
Sequence< PropertyValue >&
 dpbBuffer.push_back(1); // 1 byte long
 dpbBuffer.push_back(FIREBIRD_SQL_DIALECT);
 
-// set UTF8 as default character set
+// set UTF8 as default character set of the database
 const char sCharset[] = "UTF8";
 dpbBuffer.push_back(isc_dpb_set_db_charset);
 dpbBuffer.push_back(sizeof(sCharset) - 1);
 dpbBuffer.append(sCharset);
+// set UTF8 as default character set of the connection
+dpbBuffer.push_back(isc_dpb_lc_ctype);
+dpbBuffer.push_back(sizeof(sCharset) - 1);
+dpbBuffer.append(sCharset);
 
 // Do any more dpbBuffer additions here
 
commit a0d85d526c7a4407ac555a35730afd5003243bcb
Author: Tamas Bunth 
AuthorDate: Sat Jul 13 14:19:15 2019 +0200
Commit: Tamás Bunth 
CommitDate: Sat Jul 13 21:21:09 2019 +0200

tdf#123591: Firebird: Fix setting double values

Handle numerical and decimal values separately. In order to do that
we have to indentify the exact type first. That can be achieved using
sqltype and sqlsubtype in Firebird API.

Change-Id: Ie664dead51bae5522ee53009cda1cddbe0d64b16
Reviewed-on: https://gerrit.libreoffice.org/75525
Reviewed-by: Tamás Bunth 
Tested-by: Tamás Bunth 

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx 
b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 737875e96b5a..69ce91f42da1 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -420,34 +420,44 @@ void SAL_CALL OPreparedStatement::setDouble(sal_Int32 
nIndex, double nValue)
 ensurePrepared();
 
 XSQLVAR* pVar = m_pInSqlda->sqlvar + (nIndex - 1);
-int dType = (pVar->sqltype & ~1); // drop flag bit for now
-
-// take decimal places into account, later on they are removed in 
makeNumericString
-// minus because firebird stores scale as a negative number
-int nDecimalCount = -pVar->sqlscale;
-sal_Int64 nDecimalCountExp = pow10Integer(nDecimalCount);
-
-nValue = static_cast(nValue * nDecimalCountExp);
+short dType = (pVar->sqltype & ~1); // drop flag bit for now
+short dSubType = pVar->sqlsubtype;
+// Assume it is a sub type of a number.
+if(dSubType < 0 || dSubType > 2)
+{
+::dbtools::throwSQLException(
+"Incorrect number sub type",
+::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE,
+*this);
+}
+// firebird stores scale as a negative number
+ColumnTypeInfo columnType{ dType, dSubType,
+static_cast(-pVar->sqlscale) };
 
 // Caller might try to set an integer type here. It makes sense to convert
 // it instead of throwing an error.
-switch(dType)
+switch(columnType.getSdbcType())
 {
-case SQL_SHORT:
+case DataType::SMALLINT:
 setValue< sal_Int16 >(nIndex,
 static_cast(nValue),
 dType);
 break;
-case SQL_LONG:
+case DataType::INTEGER:
 setValue< sal_Int32 >(nIndex,
 static_cast(nValue),
 dType);
 break;
-case SQL_INT64:
+case DataType::BIGINT:
 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

2019-06-05 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |   11 
++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 4b3a1d249748b0589f74fb63a7849edeec543c0f
Author: Tamas Bunth 
AuthorDate: Thu May 30 18:34:03 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Jun 5 11:30:33 2019 +0200

mysqlc: Add support for mysql type INT24

Which is mapped to sal_Int32.

Change-Id: Ibf12e92a20034440fa990ed0c6f1196f4ca3f40f
Reviewed-on: https://gerrit.libreoffice.org/73217
Tested-by: Jenkins
Reviewed-by: Andras Timar 
(cherry picked from commit 3a4c4482ecdc7a7ef4dd944a49d17a9d30d27b78)
Reviewed-on: https://gerrit.libreoffice.org/73459
Reviewed-by: Xisco Faulí 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index b3630072c143..3b9e4a2aeb57 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace rtl;
 #include 
@@ -66,6 +67,7 @@ const std::type_index getTypeFromMysqlType(enum_field_types 
type)
 case MYSQL_TYPE_SHORT:
 return std::type_index(typeid(sal_Int16));
 case MYSQL_TYPE_LONG:
+case MYSQL_TYPE_INT24:
 return std::type_index(typeid(sal_Int32));
 case MYSQL_TYPE_LONGLONG:
 return std::type_index(typeid(sal_Int64));
@@ -88,7 +90,6 @@ const std::type_index getTypeFromMysqlType(enum_field_types 
type)
 case MYSQL_TYPE_BLOB:
 case MYSQL_TYPE_YEAR:
 case MYSQL_TYPE_BIT:
-case MYSQL_TYPE_INT24:
 case MYSQL_TYPE_SET:
 case MYSQL_TYPE_ENUM:
 case MYSQL_TYPE_GEOMETRY:
@@ -266,6 +267,7 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_SHORT:
 return getShort(nColumnIndex);
 case MYSQL_TYPE_LONG:
+case MYSQL_TYPE_INT24:
 return getInt(nColumnIndex);
 case MYSQL_TYPE_LONGLONG:
 return getLong(nColumnIndex);
@@ -285,9 +287,10 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_NEWDECIMAL:
 return getString(nColumnIndex);
 default:
-mysqlc_sdbc_driver::throwFeatureNotImplementedException(
-"OPreparedResultSet::getRowSetValue", *this);
-return ORowSetValue();
+SAL_WARN("connectivity.mysqlc", 
"OPreparedResultSet::getRowSetValue: unknown type: "
+<< m_aFields[nColumnIndex - 
1].type);
+throw SQLException("Unknown column type when fetching result", 
*this, OUString(), 1,
+   Any());
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - connectivity/source

2019-06-03 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |   11 
++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 1489620499d25a8f5188cc83f6a3558e9a1f9b61
Author: Tamas Bunth 
AuthorDate: Thu May 30 18:34:03 2019 +0200
Commit: Andras Timar 
CommitDate: Mon Jun 3 18:44:38 2019 +0200

mysqlc: Add support for mysql type INT24

Which is mapped to sal_Int32.

Change-Id: Ibf12e92a20034440fa990ed0c6f1196f4ca3f40f
Reviewed-on: https://gerrit.libreoffice.org/73218
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index cc9348860d7a..7d261160bfae 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace rtl;
 #include 
@@ -66,6 +67,7 @@ const std::type_index getTypeFromMysqlType(enum_field_types 
type)
 case MYSQL_TYPE_SHORT:
 return std::type_index(typeid(sal_Int16));
 case MYSQL_TYPE_LONG:
+case MYSQL_TYPE_INT24:
 return std::type_index(typeid(sal_Int32));
 case MYSQL_TYPE_LONGLONG:
 return std::type_index(typeid(sal_Int64));
@@ -88,7 +90,6 @@ const std::type_index getTypeFromMysqlType(enum_field_types 
type)
 case MYSQL_TYPE_BLOB:
 case MYSQL_TYPE_YEAR:
 case MYSQL_TYPE_BIT:
-case MYSQL_TYPE_INT24:
 case MYSQL_TYPE_SET:
 case MYSQL_TYPE_ENUM:
 case MYSQL_TYPE_GEOMETRY:
@@ -269,6 +270,7 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_SHORT:
 return getShort(nColumnIndex);
 case MYSQL_TYPE_LONG:
+case MYSQL_TYPE_INT24:
 return getInt(nColumnIndex);
 case MYSQL_TYPE_LONGLONG:
 return getLong(nColumnIndex);
@@ -288,9 +290,10 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_NEWDECIMAL:
 return getString(nColumnIndex);
 default:
-mysqlc_sdbc_driver::throwFeatureNotImplementedException(
-"OPreparedResultSet::getRowSetValue", *this);
-return ORowSetValue();
+SAL_WARN("connectivity.mysqlc", 
"OPreparedResultSet::getRowSetValue: unknown type: "
+<< m_aFields[nColumnIndex - 
1].type);
+throw SQLException("Unknown column type when fetching result", 
*this, OUString(), 1,
+   Any());
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-03 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |   11 
++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 3a4c4482ecdc7a7ef4dd944a49d17a9d30d27b78
Author: Tamas Bunth 
AuthorDate: Thu May 30 18:34:03 2019 +0200
Commit: Andras Timar 
CommitDate: Mon Jun 3 18:44:07 2019 +0200

mysqlc: Add support for mysql type INT24

Which is mapped to sal_Int32.

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

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index b3630072c143..3b9e4a2aeb57 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace rtl;
 #include 
@@ -66,6 +67,7 @@ const std::type_index getTypeFromMysqlType(enum_field_types 
type)
 case MYSQL_TYPE_SHORT:
 return std::type_index(typeid(sal_Int16));
 case MYSQL_TYPE_LONG:
+case MYSQL_TYPE_INT24:
 return std::type_index(typeid(sal_Int32));
 case MYSQL_TYPE_LONGLONG:
 return std::type_index(typeid(sal_Int64));
@@ -88,7 +90,6 @@ const std::type_index getTypeFromMysqlType(enum_field_types 
type)
 case MYSQL_TYPE_BLOB:
 case MYSQL_TYPE_YEAR:
 case MYSQL_TYPE_BIT:
-case MYSQL_TYPE_INT24:
 case MYSQL_TYPE_SET:
 case MYSQL_TYPE_ENUM:
 case MYSQL_TYPE_GEOMETRY:
@@ -266,6 +267,7 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_SHORT:
 return getShort(nColumnIndex);
 case MYSQL_TYPE_LONG:
+case MYSQL_TYPE_INT24:
 return getInt(nColumnIndex);
 case MYSQL_TYPE_LONGLONG:
 return getLong(nColumnIndex);
@@ -285,9 +287,10 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_NEWDECIMAL:
 return getString(nColumnIndex);
 default:
-mysqlc_sdbc_driver::throwFeatureNotImplementedException(
-"OPreparedResultSet::getRowSetValue", *this);
-return ORowSetValue();
+SAL_WARN("connectivity.mysqlc", 
"OPreparedResultSet::getRowSetValue: unknown type: "
+<< m_aFields[nColumnIndex - 
1].type);
+throw SQLException("Unknown column type when fetching result", 
*this, OUString(), 1,
+   Any());
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sd/qa

2019-05-15 Thread Tamas Bunth (via logerrit)
 sd/qa/unit/data/pptx/crop-to-shape.pptx |binary
 sd/qa/unit/import-tests.cxx |   26 ++
 2 files changed, 26 insertions(+)

New commits:
commit da284440060f69d43399277a3d2596140675545c
Author: Tamas Bunth 
AuthorDate: Tue May 14 19:16:44 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 15 09:26:30 2019 +0200

Add unit test for pptx import, crop to shape

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

diff --git a/sd/qa/unit/data/pptx/crop-to-shape.pptx 
b/sd/qa/unit/data/pptx/crop-to-shape.pptx
new file mode 100644
index ..929b07e009ce
Binary files /dev/null and b/sd/qa/unit/data/pptx/crop-to-shape.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 879e13d8f90f..14a907316d70 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -192,6 +193,7 @@ public:
 void testTdf123090();
 void testTdf120028();
 void testTdf120028b();
+void testCropToShape();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -277,6 +279,7 @@ public:
 CPPUNIT_TEST(testTdf123090);
 CPPUNIT_TEST(testTdf120028);
 CPPUNIT_TEST(testTdf120028b);
+CPPUNIT_TEST(testCropToShape);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2647,6 +2650,29 @@ void SdImportTest::testTdf120028b()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testCropToShape()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/crop-to-shape.pptx"),
 PPTX);
+uno::Reference xDrawPagesSupplier(
+xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", 
xDrawPagesSupplier.is());
+uno::Reference 
xDrawPages(xDrawPagesSupplier->getDrawPages());
+uno::Reference xDrawPage(xDrawPages->getByIndex(0), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is());
+uno::Reference xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xDesc(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString{"com.sun.star.drawing.CustomShape"}, 
xDesc->getShapeType());
+CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is());
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+css::drawing::FillStyle fillStyle;
+xShapeProps->getPropertyValue("FillStyle") >>= fillStyle;
+CPPUNIT_ASSERT_EQUAL(css::drawing::FillStyle_BITMAP, fillStyle);
+css::drawing::BitmapMode bitmapmode;
+xShapeProps->getPropertyValue("FillBitmapMode") >>= bitmapmode;
+CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - oox/inc oox/source

2019-05-15 Thread Tamas Bunth (via logerrit)
 oox/inc/drawingml/graphicproperties.hxx |3 ++-
 oox/source/drawingml/fillproperties.cxx |   12 ++--
 oox/source/drawingml/shape.cxx  |   17 ++---
 3 files changed, 26 insertions(+), 6 deletions(-)

New commits:
commit 8af919d30f0f17a17ee6f5190bb31652476a52df
Author: Tamas Bunth 
AuthorDate: Mon May 13 01:02:07 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 15 09:26:00 2019 +0200

ooxml import: supprt cropping to shape

Change-Id: I7bdc959921ecb0cbf19037a78b63eaeb8fc52814
Reviewed-on: https://gerrit.libreoffice.org/72206
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
Reviewed-on: https://gerrit.libreoffice.org/72310
Reviewed-by: Miklos Vajna 

diff --git a/oox/inc/drawingml/graphicproperties.hxx 
b/oox/inc/drawingml/graphicproperties.hxx
index 01dd96cf8f2d..7a227f8cc949 100644
--- a/oox/inc/drawingml/graphicproperties.hxx
+++ b/oox/inc/drawingml/graphicproperties.hxx
@@ -40,12 +40,13 @@ struct GraphicProperties
 {
 BlipFillProperties  maBlipProps;///< Properties for the 
graphic.
 OUStringm_sMediaPackageURL; ///< Audio/Video URL.
+boolmbIsCustomShape = false;
 css::uno::Reference m_xMediaStream; ///< 
Audio/Video input stream.
 
 /** Writes the properties to the passed property map. */
 voidpushToPropMap(
 PropertyMap& rPropMap,
-const GraphicHelper& rGraphicHelper ) const;
+const GraphicHelper& rGraphicHelper) const;
 };
 
 } // namespace drawingml
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index a2fb6ee7a6c6..be91daa81b92 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -703,7 +703,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 }
 }
 
-void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const 
GraphicHelper& rGraphicHelper ) const
+void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const 
GraphicHelper& rGraphicHelper) const
 {
 sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( 
maBlipProps.moBrightness.get( 0 ) / PER_PERCENT, -100, 100 );
 sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( 
maBlipProps.moContrast.get( 0 ) / PER_PERCENT, -100, 100 );
@@ -734,7 +734,15 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 nBrightness = 0;
 nContrast = 0;
 }
-rPropMap.setProperty(PROP_Graphic, xGraphic);
+if(mbIsCustomShape)
+{
+// it is a cropped graphic.
+rPropMap.setProperty(PROP_FillStyle, FillStyle_BITMAP);
+rPropMap.setProperty(PROP_FillBitmapMode, BitmapMode_STRETCH);
+rPropMap.setProperty(PROP_FillBitmap, xGraphic);
+}
+else
+rPropMap.setProperty(PROP_Graphic, xGraphic);
 
 // cropping
 if ( maBlipProps.moClipRect.has() )
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 933d909c1d27..ba3e8d7fdb5d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -647,8 +647,18 @@ Reference< XShape > const & Shape::createAndInsert(
 {
 aServiceName = finalizeServiceName( rFilterBase, rServiceName, 
aShapeRectHmm );
 }
+// Use custom shape instead of GraphicObjectShape if the image is cropped 
to
+// shape. Except rectangle, which does not require further cropping
+bool bIsCroppedGraphic = (aServiceName == 
"com.sun.star.drawing.GraphicObjectShape" && 
mpCustomShapePropertiesPtr->getShapePresetType() >= 0
+&& mpCustomShapePropertiesPtr->getShapePresetType() != XML_Rect && 
mpCustomShapePropertiesPtr->getShapePresetType() != XML_rect);
 bool bIsCustomShape = ( aServiceName == "com.sun.star.drawing.CustomShape" 
||
-aServiceName == 
"com.sun.star.drawing.ConnectorShape" );
+aServiceName == 
"com.sun.star.drawing.ConnectorShape" ||
+bIsCroppedGraphic);
+if(bIsCroppedGraphic)
+{
+aServiceName = "com.sun.star.drawing.CustomShape";
+mpGraphicPropertiesPtr->mbIsCustomShape = true;
+}
 bool bUseRotationTransform = ( !mbWps ||
 aServiceName == "com.sun.star.drawing.LineShape" ||
 aServiceName == "com.sun.star.drawing.GroupShape" ||
@@ -949,13 +959,14 @@ Reference< XShape > const & Shape::createAndInsert(
 // applying properties
 aShapeProps.assignUsed( getShapeProperties() );
 aShapeProps.assignUsed( maDefaultShapeProperties );
-if ( bIsEmbMedia || aServiceName == 
"com.sun.star.drawing.GraphicObjectShape" || aServiceName == 
"com.sun.star.drawing.OLE2Shape" )
+if ( bIsEmbMedia || aServiceName == 

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

2019-05-15 Thread Tamas Bunth (via logerrit)
 sd/qa/unit/data/pptx/crop-to-shape.pptx |binary
 sd/qa/unit/import-tests.cxx |   26 ++
 2 files changed, 26 insertions(+)

New commits:
commit 0efccbc58b41008b03f5b1ecc0a97cfcd1d4eafd
Author: Tamas Bunth 
AuthorDate: Tue May 14 19:16:44 2019 +0200
Commit: Tamás Bunth 
CommitDate: Wed May 15 09:10:40 2019 +0200

Add unit test for pptx import, crop to shape

Change-Id: I2a987278320a5685780962de2d3dfc165f3ef3aa
Reviewed-on: https://gerrit.libreoffice.org/72309
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/sd/qa/unit/data/pptx/crop-to-shape.pptx 
b/sd/qa/unit/data/pptx/crop-to-shape.pptx
new file mode 100644
index ..929b07e009ce
Binary files /dev/null and b/sd/qa/unit/data/pptx/crop-to-shape.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 331bc251c82f..04ac4b474ab8 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -204,6 +205,7 @@ public:
 void testTdf47365();
 void testTdf122899();
 void testOOXTheme();
+void testCropToShape();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -294,6 +296,7 @@ public:
 CPPUNIT_TEST(testTdf47365);
 CPPUNIT_TEST(testTdf122899);
 CPPUNIT_TEST(testOOXTheme);
+CPPUNIT_TEST(testCropToShape);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2775,6 +2778,29 @@ void SdImportTest::testOOXTheme()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testCropToShape()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/crop-to-shape.pptx"),
 PPTX);
+uno::Reference xDrawPagesSupplier(
+xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", 
xDrawPagesSupplier.is());
+uno::Reference 
xDrawPages(xDrawPagesSupplier->getDrawPages());
+uno::Reference xDrawPage(xDrawPages->getByIndex(0), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is());
+uno::Reference xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xDesc(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString{"com.sun.star.drawing.CustomShape"}, 
xDesc->getShapeType());
+CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is());
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+css::drawing::FillStyle fillStyle;
+xShapeProps->getPropertyValue("FillStyle") >>= fillStyle;
+CPPUNIT_ASSERT_EQUAL(css::drawing::FillStyle_BITMAP, fillStyle);
+css::drawing::BitmapMode bitmapmode;
+xShapeProps->getPropertyValue("FillBitmapMode") >>= bitmapmode;
+CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-13 Thread Tamas Bunth (via logerrit)
 oox/inc/drawingml/graphicproperties.hxx |3 ++-
 oox/source/drawingml/fillproperties.cxx |   12 ++--
 oox/source/drawingml/shape.cxx  |   17 ++---
 3 files changed, 26 insertions(+), 6 deletions(-)

New commits:
commit f4ba484183a1e7b9824f10580d633466c266828f
Author: Tamas Bunth 
AuthorDate: Mon May 13 01:02:07 2019 +0200
Commit: Tamás Bunth 
CommitDate: Mon May 13 18:14:26 2019 +0200

ooxml import: supprt cropping to shape

Change-Id: I7bdc959921ecb0cbf19037a78b63eaeb8fc52814
Reviewed-on: https://gerrit.libreoffice.org/72206
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 

diff --git a/oox/inc/drawingml/graphicproperties.hxx 
b/oox/inc/drawingml/graphicproperties.hxx
index 01dd96cf8f2d..7a227f8cc949 100644
--- a/oox/inc/drawingml/graphicproperties.hxx
+++ b/oox/inc/drawingml/graphicproperties.hxx
@@ -40,12 +40,13 @@ struct GraphicProperties
 {
 BlipFillProperties  maBlipProps;///< Properties for the 
graphic.
 OUStringm_sMediaPackageURL; ///< Audio/Video URL.
+boolmbIsCustomShape = false;
 css::uno::Reference m_xMediaStream; ///< 
Audio/Video input stream.
 
 /** Writes the properties to the passed property map. */
 voidpushToPropMap(
 PropertyMap& rPropMap,
-const GraphicHelper& rGraphicHelper ) const;
+const GraphicHelper& rGraphicHelper) const;
 };
 
 } // namespace drawingml
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 0b99d83733f3..9c5338ce8975 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -739,7 +739,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 }
 }
 
-void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const 
GraphicHelper& rGraphicHelper ) const
+void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const 
GraphicHelper& rGraphicHelper) const
 {
 sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( 
maBlipProps.moBrightness.get( 0 ) / PER_PERCENT, -100, 100 );
 sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( 
maBlipProps.moContrast.get( 0 ) / PER_PERCENT, -100, 100 );
@@ -770,7 +770,15 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 nBrightness = 0;
 nContrast = 0;
 }
-rPropMap.setProperty(PROP_Graphic, xGraphic);
+if(mbIsCustomShape)
+{
+// it is a cropped graphic.
+rPropMap.setProperty(PROP_FillStyle, FillStyle_BITMAP);
+rPropMap.setProperty(PROP_FillBitmapMode, BitmapMode_STRETCH);
+rPropMap.setProperty(PROP_FillBitmap, xGraphic);
+}
+else
+rPropMap.setProperty(PROP_Graphic, xGraphic);
 
 // cropping
 if ( maBlipProps.moClipRect.has() )
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 64c80568f7a8..1003b66e386c 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -658,8 +658,18 @@ Reference< XShape > const & Shape::createAndInsert(
 {
 aServiceName = finalizeServiceName( rFilterBase, rServiceName, 
aShapeRectHmm );
 }
+// Use custom shape instead of GraphicObjectShape if the image is cropped 
to
+// shape. Except rectangle, which does not require further cropping
+bool bIsCroppedGraphic = (aServiceName == 
"com.sun.star.drawing.GraphicObjectShape" && 
mpCustomShapePropertiesPtr->getShapePresetType() >= 0
+&& mpCustomShapePropertiesPtr->getShapePresetType() != XML_Rect && 
mpCustomShapePropertiesPtr->getShapePresetType() != XML_rect);
 bool bIsCustomShape = ( aServiceName == "com.sun.star.drawing.CustomShape" 
||
-aServiceName == 
"com.sun.star.drawing.ConnectorShape" );
+aServiceName == 
"com.sun.star.drawing.ConnectorShape" ||
+bIsCroppedGraphic);
+if(bIsCroppedGraphic)
+{
+aServiceName = "com.sun.star.drawing.CustomShape";
+mpGraphicPropertiesPtr->mbIsCustomShape = true;
+}
 bool bUseRotationTransform = ( !mbWps ||
 aServiceName == "com.sun.star.drawing.LineShape" ||
 aServiceName == "com.sun.star.drawing.GroupShape" ||
@@ -971,13 +981,14 @@ Reference< XShape > const & Shape::createAndInsert(
 // applying properties
 aShapeProps.assignUsed( getShapeProperties() );
 aShapeProps.assignUsed( maDefaultShapeProperties );
-if ( bIsEmbMedia || aServiceName == 
"com.sun.star.drawing.GraphicObjectShape" || aServiceName == 
"com.sun.star.drawing.OLE2Shape" )
+if ( bIsEmbMedia || aServiceName == 
"com.sun.star.drawing.GraphicObjectShape" || aServiceName == 
"com.sun.star.drawing.OLE2Shape" || bIsCustomShape 

[Libreoffice-commits] core.git: connectivity/Library_mysqlc.mk connectivity/qa connectivity/source

2019-04-25 Thread Tamas Bunth (via logerrit)
 connectivity/Library_mysqlc.mk   |1 
 connectivity/qa/connectivity/mysql/mysql.cxx |   32 
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |  353 
--
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |5 
 4 files changed, 210 insertions(+), 181 deletions(-)

New commits:
commit 406aef41d1368a46d36757072592e93efd9ae08e
Author: Tamas Bunth 
AuthorDate: Mon Apr 22 19:09:24 2019 +0200
Commit: Andras Timar 
CommitDate: Thu Apr 25 15:47:38 2019 +0200

mysqlc: Allow conversions between different types

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

diff --git a/connectivity/Library_mysqlc.mk b/connectivity/Library_mysqlc.mk
index 9dba7769a9a2..455f9b2224df 100644
--- a/connectivity/Library_mysqlc.mk
+++ b/connectivity/Library_mysqlc.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_Library_use_sdk_api,mysqlc))
 
 $(eval $(call gb_Library_use_libraries,mysqlc,\
cppu \
+dbtools \
sal \
salhelper \
comphelper \
diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 1cbe34790421..00ff9423aa4a 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -53,6 +53,7 @@ public:
 void testMultipleResultsets();
 void testDBMetaData();
 void testTimestampField();
+void testNumericConversionPrepared();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -61,6 +62,7 @@ public:
 CPPUNIT_TEST(testMultipleResultsets);
 CPPUNIT_TEST(testDBMetaData);
 CPPUNIT_TEST(testTimestampField);
+CPPUNIT_TEST(testNumericConversionPrepared);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -373,6 +375,36 @@ void MysqlTestDriver::testTimestampField()
 xStatement->executeUpdate("DROP TABLE myTestTable");
 }
 
+/**
+ * Test getting value from a decimal type column from a result set of a
+ * prepared statement, getting as a tinyint, string, short, int, long.
+ */
+void MysqlTestDriver::testNumericConversionPrepared()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+xStatement->executeUpdate("CREATE TABLE myTestTable (myDecimal 
DECIMAL(4,2))");
+xStatement->executeUpdate("INSERT INTO myTestTable VALUES (11.22)");
+Reference xPrepared
+= xConnection->prepareStatement("SELECT * from myTestTable");
+Reference xResultSet = xPrepared->executeQuery();
+xResultSet->next(); // use it
+Reference xRow(xResultSet, UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("11.22"), xRow->getString(1));
+// converting to integer types results in rounding down the number
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getByte(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getShort(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getInt(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getLong(1));
+
+xStatement->executeUpdate("DROP TABLE myTestTable");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index a3e45937b610..b3630072c143 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -38,6 +38,7 @@ using namespace rtl;
 #include 
 
 using namespace connectivity::mysqlc;
+using namespace connectivity;
 using namespace cppu;
 using namespace com::sun::star;
 using namespace com::sun::star::lang;
@@ -51,6 +52,52 @@ using namespace ::comphelper;
 using ::osl::MutexGuard;
 
 #include 
+#include 
+#include 
+
+namespace
+{
+const std::type_index getTypeFromMysqlType(enum_field_types type)
+{
+switch (type)
+{
+case MYSQL_TYPE_TINY:
+return std::type_index(typeid(sal_Int8));
+case MYSQL_TYPE_SHORT:
+return std::type_index(typeid(sal_Int16));
+case MYSQL_TYPE_LONG:
+return std::type_index(typeid(sal_Int32));
+case MYSQL_TYPE_LONGLONG:
+return std::type_index(typeid(sal_Int64));
+case MYSQL_TYPE_FLOAT:
+return std::type_index(typeid(float));
+case MYSQL_TYPE_DOUBLE:
+return std::type_index(typeid(double));
+case MYSQL_TYPE_TIMESTAMP:
+case MYSQL_TYPE_DATETIME:
+return std::type_index(typeid(DateTime));
+case MYSQL_TYPE_DATE:
+return 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - connectivity/source

2019-04-25 Thread Tamas Bunth (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |2 ++
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit e884223505535d497bb5c7cd96dd17daaf4c415c
Author: Tamas Bunth 
AuthorDate: Thu Apr 25 12:17:06 2019 +0200
Commit: Andras Timar 
CommitDate: Thu Apr 25 15:46:25 2019 +0200

mysqlc: move template specialization to namespace

so gcc 4.8 would be happy about it.
See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Change-Id: I7e696758c5598b9e64947bc9b1606c653becddce
Reviewed-on: https://gerrit.libreoffice.org/71294
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 10cc65122dfa..cc9348860d7a 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -199,6 +199,7 @@ template  T 
OPreparedResultSet::retrieveValue(sal_Int32 nColumnIndex
 return getRowSetValue(nColumnIndex);
 }
 
+namespace connectivity { namespace mysqlc {
 template <> uno::Sequence 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 {
 // TODO make conversion possible
@@ -257,6 +258,7 @@ template <> OUString 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 OUString sReturn = OUString(sStr, *m_aData[column - 1].length, m_encoding);
 return sReturn;
 }
+}}
 
 ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 nColumnIndex)
 {
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
index e89345ba0196..048d7a44217c 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
@@ -93,8 +93,8 @@ class OPreparedResultSet final : public OBase_Mutex,
 
 void SAL_CALL getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const 
SAL_OVERRIDE;
 
-template  T safelyRetrieveValue(const sal_Int32 nColumnIndex);
-template  T retrieveValue(const sal_Int32 nColumnIndex);
+template  T safelyRetrieveValue(sal_Int32 nColumnIndex);
+template  T retrieveValue(sal_Int32 nColumnIndex);
 connectivity::ORowSetValue getRowSetValue(sal_Int32 nColumnIndex);
 
 // you can't delete objects of this type
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - connectivity/Library_mysqlc.mk connectivity/qa connectivity/source

2019-04-24 Thread Tamas Bunth (via logerrit)
 connectivity/Library_mysqlc.mk   |1 
 connectivity/qa/connectivity/mysql/mysql.cxx |   32 
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |  353 
--
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |5 
 4 files changed, 210 insertions(+), 181 deletions(-)

New commits:
commit 930074a919da821813fd4e9e11a3b74b2822b1b6
Author: Tamas Bunth 
AuthorDate: Mon Apr 22 19:09:24 2019 +0200
Commit: Andras Timar 
CommitDate: Wed Apr 24 17:20:00 2019 +0200

mysqlc: Allow conversions between different types

Change-Id: I54c1f438a755267db0896637c79f915de9113f83
Reviewed-on: https://gerrit.libreoffice.org/71246
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/connectivity/Library_mysqlc.mk b/connectivity/Library_mysqlc.mk
index eac56916c479..817dbb689d3e 100644
--- a/connectivity/Library_mysqlc.mk
+++ b/connectivity/Library_mysqlc.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_Library_use_sdk_api,mysqlc))
 
 $(eval $(call gb_Library_use_libraries,mysqlc,\
cppu \
+dbtools \
sal \
salhelper \
comphelper \
diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx 
b/connectivity/qa/connectivity/mysql/mysql.cxx
index 115347e64f42..98e068b65f2a 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -52,6 +52,7 @@ public:
 void testMultipleResultsets();
 void testDBMetaData();
 void testTimestampField();
+void testNumericConversionPrepared();
 
 CPPUNIT_TEST_SUITE(MysqlTestDriver);
 CPPUNIT_TEST(testDBConnection);
@@ -60,6 +61,7 @@ public:
 CPPUNIT_TEST(testMultipleResultsets);
 CPPUNIT_TEST(testDBMetaData);
 CPPUNIT_TEST(testTimestampField);
+CPPUNIT_TEST(testNumericConversionPrepared);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -358,6 +360,36 @@ void MysqlTestDriver::testTimestampField()
 xStatement->executeUpdate("DROP TABLE myTestTable");
 }
 
+/**
+ * Test getting value from a decimal type column from a result set of a
+ * prepared statement, getting as a tinyint, string, short, int, long.
+ */
+void MysqlTestDriver::testNumericConversionPrepared()
+{
+Reference xConnection = m_xDriver->connect(m_sUrl, m_infos);
+if (!xConnection.is())
+CPPUNIT_ASSERT_MESSAGE("cannot connect to data source!", 
xConnection.is());
+uno::Reference xStatement = xConnection->createStatement();
+CPPUNIT_ASSERT(xStatement.is());
+xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
+
+xStatement->executeUpdate("CREATE TABLE myTestTable (myDecimal 
DECIMAL(4,2))");
+xStatement->executeUpdate("INSERT INTO myTestTable VALUES (11.22)");
+Reference xPrepared
+= xConnection->prepareStatement("SELECT * from myTestTable");
+Reference xResultSet = xPrepared->executeQuery();
+xResultSet->next(); // use it
+Reference xRow(xResultSet, UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("11.22"), xRow->getString(1));
+// converting to integer types results in rounding down the number
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getByte(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getShort(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getInt(1));
+CPPUNIT_ASSERT_EQUAL(static_cast(11), xRow->getLong(1));
+
+xStatement->executeUpdate("DROP TABLE myTestTable");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MysqlTestDriver);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index e9f07f8947c0..10cc65122dfa 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -38,6 +38,7 @@ using namespace rtl;
 #include 
 
 using namespace connectivity::mysqlc;
+using namespace connectivity;
 using namespace cppu;
 using namespace com::sun::star;
 using namespace com::sun::star::lang;
@@ -51,6 +52,52 @@ using namespace ::comphelper;
 using ::osl::MutexGuard;
 
 #include 
+#include 
+#include 
+
+namespace
+{
+const std::type_index getTypeFromMysqlType(enum_field_types type)
+{
+switch (type)
+{
+case MYSQL_TYPE_TINY:
+return std::type_index(typeid(sal_Int8));
+case MYSQL_TYPE_SHORT:
+return std::type_index(typeid(sal_Int16));
+case MYSQL_TYPE_LONG:
+return std::type_index(typeid(sal_Int32));
+case MYSQL_TYPE_LONGLONG:
+return std::type_index(typeid(sal_Int64));
+case MYSQL_TYPE_FLOAT:
+return std::type_index(typeid(float));
+case MYSQL_TYPE_DOUBLE:
+return std::type_index(typeid(double));
+case MYSQL_TYPE_TIMESTAMP:
+case MYSQL_TYPE_DATETIME:
+return std::type_index(typeid(DateTime));
+case MYSQL_TYPE_DATE:
+return