summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-07-07 16:07:28 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-12 12:01:33 +0200
commitb8c99a081676dff667710f842ea8ed7cc0086b5f (patch)
tree246eac436a91ff2a1fbd61ee60b0e9be3e6947c9
parentf7d3c18da48822b7105b93395aaa4406b87df23f (diff)
tdf#108986 : no arrow for "Data" button on pivot chart
Also changed the fill color of "Data" button to a lighter shade to distiguish it from other buttons, for both row and column fields. Added matching testcase in chart2dump.cxx Change-Id: I2ae5da6c3552372f606da41055f1e0663b6f0802 Reviewed-on: https://gerrit.libreoffice.org/39687 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Toma┼ż Vajngerl <quikee@gmail.com> (cherry picked from commit c86be45d343635f2e137b8ea710d87e1a612101d) Reviewed-on: https://gerrit.libreoffice.org/39854 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rwxr-xr-xchart2/qa/extras/chart2dump/chart2dump.cxx44
-rw-r--r--chart2/qa/extras/chart2dump/data/pivotchart_data_button.odsbin0 -> 18366 bytes
-rw-r--r--chart2/qa/extras/chart2dump/reference/pivotchartdatabuttontest/pivotchart_data_button.txt2
-rw-r--r--chart2/source/view/main/ChartView.cxx7
-rw-r--r--chart2/source/view/main/VButton.cxx3
-rw-r--r--chart2/source/view/main/VButton.hxx5
-rw-r--r--chart2/source/view/main/VLegend.cxx3
7 files changed, 62 insertions, 2 deletions
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index 7fc78e2f76a4..e572237f410d 100755
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -1119,6 +1119,50 @@ DECLARE_DUMP_TEST(PointLineChartTest, Chart2DumpTest, false)
}
}
+DECLARE_DUMP_TEST( PivotChartDataButtonTest, Chart2DumpTest, false )
+{
+ const OUString aTestFile = "pivotchart_data_button.ods";
+
+ setTestFileName( aTestFile );
+ load( getTestFileDirName(), getTestFileName() );
+
+ // Check that we have pivot chart in the document
+ uno::Reference<table::XTablePivotCharts> xTablePivotCharts = getTablePivotChartsFromSheet( 1, mxComponent );
+ uno::Reference<container::XIndexAccess> xIndexAccess( xTablePivotCharts, UNO_QUERY_THROW );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xIndexAccess->getCount() );
+
+ // Get the pivot chart document so we ca access its data
+ uno::Reference<chart2::XChartDocument> xChartDoc;
+ xChartDoc.set( getPivotChartDocFromSheet( xTablePivotCharts, 0 ) );
+ CPPUNIT_ASSERT( xChartDoc.is() );
+
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier( xChartDoc, uno::UNO_QUERY );
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference<drawing::XShapes> xShapes( xDrawPage->getByIndex(0), uno::UNO_QUERY );
+ CPPUNIT_ASSERT( xShapes.is() );
+
+ // Get the shape that represents the "Data" button.
+ uno::Reference<drawing::XShape> xButton = getShapeByName( xShapes, "FieldButton.Row.8",
+ []( const uno::Reference<drawing::XShape>& xShapeNode )
+ {
+ return xShapeNode->getShapeType() == "com.sun.star.drawing.TextShape";
+ } );
+ CPPUNIT_ASSERT_MESSAGE( OString( "Cannot find Data button shape" ).getStr(), xButton.is() );
+
+ // Make sure that there is no arrow shape with the Data button
+ uno::Reference<drawing::XShape> xArrow = getShapeByName( xShapes, "FieldButton.Row.8",
+ []( const uno::Reference<drawing::XShape>& xShapeNode )
+ {
+ return xShapeNode->getShapeType() == "com.sun.star.drawing.PolyPolygonShape";
+ } );
+ CPPUNIT_ASSERT_MESSAGE( OString( "Arrow shape should not be present for the Data button" ).getStr(), !xArrow.is() );
+
+ // Assert the background color of the Data button
+ util::Color aButtonFillColor = 0;
+ uno::Reference<beans::XPropertySet> xPropSet( xButton, UNO_QUERY_THROW );
+ xPropSet->getPropertyValue( UNO_NAME_FILLCOLOR ) >>= aButtonFillColor;
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL( static_cast<sal_Int32>( aButtonFillColor ) );
+}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/chart2dump/data/pivotchart_data_button.ods b/chart2/qa/extras/chart2dump/data/pivotchart_data_button.ods
new file mode 100644
index 000000000000..d57edf66d29b
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/data/pivotchart_data_button.ods
Binary files differ
diff --git a/chart2/qa/extras/chart2dump/reference/pivotchartdatabuttontest/pivotchart_data_button.txt b/chart2/qa/extras/chart2dump/reference/pivotchartdatabuttontest/pivotchart_data_button.txt
new file mode 100644
index 000000000000..3d7d8a55c6cc
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/reference/pivotchartdatabuttontest/pivotchart_data_button.txt
@@ -0,0 +1,2 @@
+// static_cast<sal_Int32>( aButtonFillColor )
+16185078
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index ccaa3f868444..67ad6e497e90 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2544,7 +2544,12 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
pButton->setCID("FieldButton.Row." + OUString::number(rRowFieldEntry.DimensionIndex));
pButton->setPosition(aNewPosition);
pButton->setSize(aSize);
- if (rRowFieldEntry.HasHiddenMembers)
+ if ( rRowFieldEntry.Name == "Data" )
+ {
+ pButton->setBGColor( 0x00F6F6F6 );
+ pButton->showArrow( false );
+ }
+ else if (rRowFieldEntry.HasHiddenMembers)
pButton->setArrowColor(0x0000FF);
pButton->createShapes(xModelPage);
x += aSize.Width + 100;
diff --git a/chart2/source/view/main/VButton.cxx b/chart2/source/view/main/VButton.cxx
index a8854ac4a951..dfa2f6a19a92 100644
--- a/chart2/source/view/main/VButton.cxx
+++ b/chart2/source/view/main/VButton.cxx
@@ -33,6 +33,7 @@ VButton::VButton()
, m_xShape(nullptr)
, m_bShowArrow(true)
, m_nArrowColor(0x00000000)
+ , m_nBGColor(0x00E6E6E6)
{
}
@@ -109,7 +110,7 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp)
tPropertyNameValueMap aTextValueMap;
aTextValueMap["CharHeight"] <<= 10.0f;
- aTextValueMap["FillColor"] <<= sal_Int32(0xe6e6e6);
+ aTextValueMap["FillColor"] <<= m_nBGColor;
aTextValueMap["FillStyle"] <<= drawing::FillStyle_SOLID;
aTextValueMap["LineColor"] <<= sal_Int32(0xcccccc);
aTextValueMap["LineStyle"] <<= drawing::LineStyle_SOLID;
diff --git a/chart2/source/view/main/VButton.hxx b/chart2/source/view/main/VButton.hxx
index e64a1049e726..9af9318cb1f6 100644
--- a/chart2/source/view/main/VButton.hxx
+++ b/chart2/source/view/main/VButton.hxx
@@ -29,6 +29,7 @@ private:
css::awt::Size m_aSize;
bool m_bShowArrow;
sal_Int32 m_nArrowColor;
+ sal_Int32 m_nBGColor;
css::uno::Reference<css::drawing::XShape>
createTriangle(css::awt::Size aSize);
@@ -49,6 +50,10 @@ public:
{
m_nArrowColor = nArrowColor;
}
+ void setBGColor(sal_Int32 nBGColor)
+ {
+ m_nBGColor = nBGColor;
+ }
void setLabel(OUString const & rLabel)
{
m_sLabel = rLabel;
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index ac6347e0f26d..f971be6b1a2b 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -804,7 +804,10 @@ std::vector<std::shared_ptr<VButton>> lcl_createButtons(
pButton->setPosition(aNewPosition);
pButton->setSize(aSize);
if (sColumnFieldEntry.Name == "Data")
+ {
pButton->showArrow(false);
+ pButton->setBGColor(0x00F6F6F6);
+ }
if (sColumnFieldEntry.HasHiddenMembers)
pButton->setArrowColor(0x0000FF);