summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKelemen Gábor <kelemeng@ubuntu.com>2019-11-12 15:03:04 +0100
committerLászló Németh <nemeth@numbertext.org>2020-09-28 09:18:06 +0200
commit41fa7244746819411f209110f13af43941f17ce8 (patch)
tree216c7b532e3cd38936396722c4a109e5d0ac6726
parentupload libmwaw 0.3.17 (diff)
downloadcore-41fa7244746819411f209110f13af43941f17ce8.tar.gz
core-41fa7244746819411f209110f13af43941f17ce8.zip
tdf#108059 Introduce compatibility key for pie chart orientation
There is no similar setting in MSO, it just always uses clockwise. LO on the other hand confuses users by using counterclockwise which turns to clockwise upon save to OOXML and reload. Eliminate this behavior by introducing a compatibility key for OOXML-heavy environments that: - sets the orientation to clockwise when pie chart type is selected - hides the checkbox that would have no effect after a save to OOXML Default value is false to keep current behavior Change-Id: I9e12ecad8e9978f960c921a521461aee023a5063 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/82524 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: Balazs Varga <balazs.varga991@gmail.com> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--chart2/Library_chartcontroller.mk4
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx4
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx11
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs8
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx17
5 files changed, 42 insertions, 2 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 48115dd2a33b..05f031415213 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -22,6 +22,10 @@ $(eval $(call gb_Library_use_external,chartcontroller,boost_headers))
$(eval $(call gb_Library_use_sdk_api,chartcontroller))
+$(eval $(call gb_Library_use_custom_headers,chartcontroller,\
+ officecfg/registry \
+))
+
$(eval $(call gb_Library_use_libraries,chartcontroller,\
basegfx \
chartcore \
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index 804c4221247a..e858813bb39f 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -22,6 +22,7 @@
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
+#include <officecfg/Office/Compatibility.hxx>
namespace chart
{
@@ -80,7 +81,8 @@ void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs)
{
m_xFL_StartingAngle->hide();
}
- if (rInAttrs->GetItemState(SCHATTR_CLOCKWISE, true, &pPoolItem) == SfxItemState::SET)
+ // tdf#108059 Hide clockwise orientation checkbox in OOXML-heavy environments it would be useless anyways
+ if (!officecfg::Office::Compatibility::View::ClockwisePieChartDirection::get() && rInAttrs->GetItemState(SCHATTR_CLOCKWISE, true, &pPoolItem) == SfxItemState::SET)
{
bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
m_xCB_Clockwise->set_active(bCheck);
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index ec08764a7509..7f58b6e856e6 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <officecfg/Office/Compatibility.hxx>
#include <tools/diagnose_ex.h>
+#include <officecfg/Office/Compatibility.hxx>
#include <rtl/math.hxx>
@@ -237,7 +238,15 @@ void PieChartTypeTemplate::adaptScales(
{
chart2::ScaleData aScaleData( xAxis->getScaleData() );
AxisHelper::removeExplicitScaling( aScaleData );
- aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ // tdf#108059 Create new pie/donut charts with clockwise orientation
+ if (!officecfg::Office::Compatibility::View::ClockwisePieChartDirection::get())
+ {
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ }
+ else
+ {
+ aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
+ }
xAxis->setScaleData( aScaleData );
}
diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
index 5b89f9498005..87d139fb9116 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
@@ -193,6 +193,14 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="ClockwisePieChartDirection" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <!-- See tdf#108059 for rationale -->
+ <desc>Specifies whether the default orientation of pie charts should be clockwise. In OOXML-heavy environments it might be confusing to see charts being mirrored after save, avoid that by setting this key to true.</desc>
+ <label>Pie chart default orientation. Set to true for more OOXML-ish UX.</label>
+ </info>
+ <value>false</value>
+ </prop>
</group>
</component>
</oor:component-schema>
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 8fb14a87c945..a6efc4a5ee60 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -2977,9 +2977,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123218)
}
~ReverseXAxisOrientationDoughnutChart() = delete;
};
+
+ struct ClockwisePieChartDirection
+ : public comphelper::ConfigurationProperty<ClockwisePieChartDirection, bool>
+ {
+ static OUString path()
+ {
+ return "/org.openoffice.Office.Compatibility/View/ClockwisePieChartDirection";
+ }
+ ~ClockwisePieChartDirection() = delete;
+ };
auto batch = comphelper::ConfigurationChanges::create();
ReverseXAxisOrientationDoughnutChart::set(false, batch);
+ ClockwisePieChartDirection::set(true, batch);
batch->commit();
createDoc();
@@ -3028,5 +3039,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123218)
CPPUNIT_ASSERT(xAxis.is());
chart2::ScaleData aScaleData = xAxis->getScaleData();
CPPUNIT_ASSERT_EQUAL(chart2::AxisOrientation_MATHEMATICAL, aScaleData.Orientation);
+
+ // tdf#108059 test primary Y axis Orientation value
+ uno::Reference<chart2::XAxis> xYAxis = xCoord->getAxisByDimension(1, 0);
+ CPPUNIT_ASSERT(xYAxis.is());
+ aScaleData = xYAxis->getScaleData();
+ CPPUNIT_ASSERT_EQUAL(chart2::AxisOrientation_REVERSE, aScaleData.Orientation);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */