chart2/qa/extras/chart2export.cxx                  |   20 +++++++++++++
 chart2/qa/extras/data/docx/testLabelSeparator.docx |binary
 oox/source/export/chartexport.cxx                  |   11 +++++++
 sd/source/ui/dlg/copydlg.cxx                       |    5 ++-
 sd/source/ui/dlg/dlgsnap.cxx                       |   31 +++++++--------------
 sd/uiconfig/sdraw/ui/copydlg.ui                    |   28 ------------------
 sd/uiconfig/sdraw/ui/dlgsnap.ui                    |   14 ---------
 7 files changed, 45 insertions(+), 64 deletions(-)

New commits:
commit e32e5e61b509dcae0462419acfc556d445895840
Author:     Balazs Varga <balazs.varga...@gmail.com>
AuthorDate: Wed Feb 13 08:40:55 2019 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Feb 13 10:06:29 2019 +0100

    tdf#123400 OOXML Chart: Export Data Label Separator
    
    Export the data label separator XML tag and
    the separated character to OOXML.
    
    Change-Id: I9b3bcb588e42a42494107ebde70f4a72492cfac4
    Reviewed-on: https://gerrit.libreoffice.org/67753
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index dc36c3ad3c29..b16e773ab776 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -117,6 +117,7 @@ public:
     void testCustomDataLabel();
     void testCustomDataLabelMultipleSeries();
     void testNumberFormatExportPPTX();
+    void testLabelSeparatorExportDOCX();
     void testChartTitlePropertiesColorFillPPTX();
     void testChartTitlePropertiesGradientFillPPTX();
     void testChartTitlePropertiesBitmapFillPPTX();
@@ -206,6 +207,7 @@ public:
     CPPUNIT_TEST(testCustomDataLabel);
     CPPUNIT_TEST(testCustomDataLabelMultipleSeries);
     CPPUNIT_TEST(testNumberFormatExportPPTX);
+    CPPUNIT_TEST(testLabelSeparatorExportDOCX);
     CPPUNIT_TEST(testChartTitlePropertiesColorFillPPTX);
     CPPUNIT_TEST(testChartTitlePropertiesGradientFillPPTX);
     CPPUNIT_TEST(testChartTitlePropertiesBitmapFillPPTX);
@@ -1909,6 +1911,24 @@ void Chart2ExportTest::testNumberFormatExportPPTX()
     assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", 
"sourceLinked", "0");
 }
 
+void Chart2ExportTest::testLabelSeparatorExportDOCX()
+{
+    load("/chart2/qa/extras/data/docx/", "testLabelSeparator.docx");
+
+    Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), 
uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xChartDoc.is());
+
+    xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML 
Text");
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    // The text separator should be a new line
+    assertXPathContent(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:separator", 
"\n");
+    // The text separator should be a comma
+    assertXPathContent(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:dLbls/c:separator", ", 
");
+    // The text separator should be a semicolon
+    assertXPathContent(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[3]/c:dLbls/c:separator", "; 
");
+}
+
 void Chart2ExportTest::testChartTitlePropertiesColorFillPPTX()
 {
     load("/chart2/qa/extras/data/pptx/", 
"testChartTitlePropertiesColorFill.pptx");
diff --git a/chart2/qa/extras/data/docx/testLabelSeparator.docx 
b/chart2/qa/extras/data/docx/testLabelSeparator.docx
new file mode 100755
index 000000000000..452fdccc9403
Binary files /dev/null and b/chart2/qa/extras/data/docx/testLabelSeparator.docx 
differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 624d1922a35a..b1c437b53dfe 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3135,6 +3135,17 @@ void writeLabelProperties( const FSHelperPtr& pFS, 
ChartExport* pChartExport,
     pFS->singleElement(FSNS(XML_c, XML_showCatName), XML_val, 
ToPsz10(aLabel.ShowCategoryName), FSEND);
     pFS->singleElement(FSNS(XML_c, XML_showSerName), XML_val, ToPsz10(false), 
FSEND);
     pFS->singleElement(FSNS(XML_c, XML_showPercent), XML_val, 
ToPsz10(aLabel.ShowNumberInPercent), FSEND);
+
+    // Export the text "separator" if exists
+    uno::Any aAny = xPropSet->getPropertyValue("LabelSeparator");
+    if( aAny.hasValue() )
+    {
+        OUString nLabelSeparator;
+        aAny >>= nLabelSeparator;
+        pFS->startElement( FSNS( XML_c, XML_separator ), FSEND );
+        pFS->writeEscaped( nLabelSeparator );
+        pFS->endElement( FSNS( XML_c, XML_separator ) );
+    }
 }
 
 }
commit bbab991c70e2a1867493d701168f49a0d0dcbd48
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Feb 12 15:21:12 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Feb 13 10:06:21 2019 +0100

    Avoid -fsanitize=implicit-signed-integer-truncation in 
weld::MetricSpinButton
    
    Both of Draw's "Insert - Snap Guide..." and "Shape - Duplicate..." dialogs 
have
    MetricSpinButtons with ranges set programmatically in the dialogs' ctors.
    Computing the ranges' min and max values was done via SetMetricValue, which 
does
    any necessary unit conversions and then sets the MetricSpinButton's current
    value, which is then read back out in the dialog ctors (again, doing any
    necessary unit conversions) and finally set as the min or max range value.
    
    However, setting a MetricSpinButton's current value clamps it to the min 
and max
    range values that are currently in effect (i.e., before they have been set
    programmatically), so the corresponding .ui files specified very large 
initial
    values for those.  Large enough so that any actually set current values 
will not
    artificially be clamped, but also so large that
    weld::MetricSpinButton::ConvertValue, which indirectly gets called during 
the
    above computations and converts from sal_Int64 to int, would produce Clang
    -fsanitize=implicit-signed-integer-truncation warnings (e.g., "implicit
    conversion from type 'sal_Int64' (aka 'long') of value -56692913386 (64-bit,
    signed) to type 'int' changed the value to -858338538 (32-bit, signed)" from
    within the CopyDlg ctor).
    
    So don't use SetMetricValue to compute the min/max range values.  That way, 
the
    MetricSpinButton's current value is not set before the computed min/max 
range
    values are actually set, so the .ui file doesn't need to contain any static
    min/max range values.  Also, both dialogs call SetFieldUnit, which also 
sets the
    MetricSpinButtons' increment values, so those don't need to be set 
statically in
    the .ui files, either.
    
    Change-Id: I191cfc3837278530e0c3a87e00708c4c76a76361
    Reviewed-on: https://gerrit.libreoffice.org/67734
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index afaf7d89c873..9abcb751787f 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -94,8 +94,9 @@ void CopyDlg::Reset()
     // Set Min/Max values
     ::tools::Rectangle aRect = mpView->GetAllMarkedRect();
     Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize();
-    SetMetricValue( *m_xMtrFldMoveX, long(1000000 / maUIScale), 
MapUnit::Map100thMM);
-    double fScaleFactor = m_xMtrFldMoveX->get_value(FieldUnit::NONE)/1000000.0;
+    auto const n1 = m_xMtrFldMoveX->normalize(long(1000000 / maUIScale));
+    auto const n2 = m_xMtrFldMoveX->convert_value_from(n1, 
FieldUnit::MM_100TH);
+    double fScaleFactor = m_xMtrFldMoveX->convert_value_to(n2, 
FieldUnit::NONE)/1000000.0;
 
     long nPageWidth  = aPageSize.Width()  * fScaleFactor;
     long nPageHeight = aPageSize.Height() * fScaleFactor;
diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx
index 0401ed7a8596..43f38c37cfac 100644
--- a/sd/source/ui/dlg/dlgsnap.cxx
+++ b/sd/source/ui/dlg/dlgsnap.cxx
@@ -71,26 +71,17 @@ SdSnapLineDlg::SdSnapLineDlg(weld::Window* pWindow, const 
SfxItemSet& rInAttrs,
 
     // determine max and min values depending on
     // WorkArea, PoolUnit and FieldUnit:
-    SetMetricValue(*m_xMtrFldX, aLeftTop.X(), ePoolUnit );
-
-    int nValue = m_xMtrFldX->get_value(FieldUnit::NONE);
-    nValue = sal_Int32(nValue / aUIScale);
-    m_xMtrFldX->set_min(nValue, FieldUnit::NONE);
-
-    SetMetricValue(*m_xMtrFldX, aRightBottom.X(), ePoolUnit);
-    nValue = m_xMtrFldX->get_value(FieldUnit::NONE);
-    nValue = sal_Int32(nValue / aUIScale);
-    m_xMtrFldX->set_max(nValue, FieldUnit::NONE);
-
-    SetMetricValue(*m_xMtrFldY, aLeftTop.Y(), ePoolUnit);
-    nValue = m_xMtrFldY->get_value(FieldUnit::NONE);
-    nValue = sal_Int32(nValue / aUIScale);
-    m_xMtrFldY->set_min(nValue, FieldUnit::NONE);
-
-    SetMetricValue(*m_xMtrFldY, aRightBottom.Y(), ePoolUnit);
-    nValue = m_xMtrFldY->get_value(FieldUnit::NONE);
-    nValue = sal_Int32(nValue / aUIScale);
-    m_xMtrFldY->set_max(nValue, FieldUnit::NONE);
+    auto const map = [ePoolUnit](std::unique_ptr<weld::MetricSpinButton> const 
& msb, long value) {
+            auto const n1 = OutputDevice::LogicToLogic(value, ePoolUnit, 
MapUnit::Map100thMM);
+            auto const n2 = msb->normalize(n1);
+            auto const n3 = msb->convert_value_from(n2, FieldUnit::MM_100TH);
+            auto const n4 = msb->convert_value_to(n3, FieldUnit::NONE);
+            return n4;
+        };
+    m_xMtrFldX->set_min(map(m_xMtrFldX, aLeftTop.X()), FieldUnit::NONE);
+    m_xMtrFldX->set_max(map(m_xMtrFldX, aRightBottom.X()), FieldUnit::NONE);
+    m_xMtrFldY->set_min(map(m_xMtrFldY, aLeftTop.Y()), FieldUnit::NONE);
+    m_xMtrFldY->set_max(map(m_xMtrFldY, aRightBottom.Y()), FieldUnit::NONE);
 
     // set values
     nXValue = static_cast<const SfxInt32Item&>( 
rInAttrs.Get(ATTR_SNAPLINE_X)).GetValue();
diff --git a/sd/uiconfig/sdraw/ui/copydlg.ui b/sd/uiconfig/sdraw/ui/copydlg.ui
index 31f2a48f0cf9..1bb828ece646 100644
--- a/sd/uiconfig/sdraw/ui/copydlg.ui
+++ b/sd/uiconfig/sdraw/ui/copydlg.ui
@@ -15,30 +15,6 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkAdjustment" id="adjustment3">
-    <property name="lower">-1000000</property>
-    <property name="upper">1000000</property>
-    <property name="step_increment">0.10000000000000001</property>
-    <property name="page_increment">1</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment4">
-    <property name="lower">-1000000</property>
-    <property name="upper">1000000</property>
-    <property name="step_increment">0.10000000000000001</property>
-    <property name="page_increment">1</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment5">
-    <property name="lower">-1000000</property>
-    <property name="upper">1000000</property>
-    <property name="step_increment">0.10000000000000001</property>
-    <property name="page_increment">1</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment6">
-    <property name="lower">-1000000</property>
-    <property name="upper">1000000</property>
-    <property name="step_increment">0.10000000000000001</property>
-    <property name="page_increment">1</property>
-  </object>
   <object class="GtkImage" id="image1">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -269,7 +245,6 @@
                             <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
                             <property name="activates_default">True</property>
-                            <property name="adjustment">adjustment3</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
@@ -283,7 +258,6 @@
                             <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
                             <property name="activates_default">True</property>
-                            <property name="adjustment">adjustment4</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
@@ -381,7 +355,6 @@
                             <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
                             <property name="activates_default">True</property>
-                            <property name="adjustment">adjustment5</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
@@ -395,7 +368,6 @@
                             <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
                             <property name="activates_default">True</property>
-                            <property name="adjustment">adjustment6</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
diff --git a/sd/uiconfig/sdraw/ui/dlgsnap.ui b/sd/uiconfig/sdraw/ui/dlgsnap.ui
index 0bb64dc9e5eb..3a766c1abc0a 100644
--- a/sd/uiconfig/sdraw/ui/dlgsnap.ui
+++ b/sd/uiconfig/sdraw/ui/dlgsnap.ui
@@ -2,18 +2,6 @@
 <!-- Generated with glade 3.20.4 -->
 <interface domain="sd">
   <requires lib="gtk+" version="3.18"/>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="lower">-5000000</property>
-    <property name="upper">5000000</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment2">
-    <property name="lower">-5000000</property>
-    <property name="upper">5000000</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
   <object class="GtkImage" id="image1">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -142,7 +130,6 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="activates_default">True</property>
-                            <property name="adjustment">adjustment1</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
@@ -155,7 +142,6 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="activates_default">True</property>
-                            <property name="adjustment">adjustment2</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to