Kaydet (Commit) c86be45d authored tarafından Dennis Francis's avatar Dennis Francis Kaydeden (comit) Tomaž Vajngerl

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/39687Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 18909d45
...@@ -1119,6 +1119,50 @@ DECLARE_DUMP_TEST(PointLineChartTest, Chart2DumpTest, false) ...@@ -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(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -2540,7 +2540,12 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes, ...@@ -2540,7 +2540,12 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
pButton->setCID("FieldButton.Row." + OUString::number(rRowFieldEntry.DimensionIndex)); pButton->setCID("FieldButton.Row." + OUString::number(rRowFieldEntry.DimensionIndex));
pButton->setPosition(aNewPosition); pButton->setPosition(aNewPosition);
pButton->setSize(aSize); pButton->setSize(aSize);
if (rRowFieldEntry.HasHiddenMembers) if ( rRowFieldEntry.Name == "Data" )
{
pButton->setBGColor( 0x00F6F6F6 );
pButton->showArrow( false );
}
else if (rRowFieldEntry.HasHiddenMembers)
pButton->setArrowColor(0x0000FF); pButton->setArrowColor(0x0000FF);
pButton->createShapes(xModelPage); pButton->createShapes(xModelPage);
x += aSize.Width + 100; x += aSize.Width + 100;
......
...@@ -33,6 +33,7 @@ VButton::VButton() ...@@ -33,6 +33,7 @@ VButton::VButton()
, m_xShape(nullptr) , m_xShape(nullptr)
, m_bShowArrow(true) , m_bShowArrow(true)
, m_nArrowColor(0x00000000) , m_nArrowColor(0x00000000)
, m_nBGColor(0x00E6E6E6)
{ {
} }
...@@ -109,7 +110,7 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp) ...@@ -109,7 +110,7 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp)
tPropertyNameValueMap aTextValueMap; tPropertyNameValueMap aTextValueMap;
aTextValueMap["CharHeight"] <<= 10.0f; aTextValueMap["CharHeight"] <<= 10.0f;
aTextValueMap["FillColor"] <<= sal_Int32(0xe6e6e6); aTextValueMap["FillColor"] <<= m_nBGColor;
aTextValueMap["FillStyle"] <<= drawing::FillStyle_SOLID; aTextValueMap["FillStyle"] <<= drawing::FillStyle_SOLID;
aTextValueMap["LineColor"] <<= sal_Int32(0xcccccc); aTextValueMap["LineColor"] <<= sal_Int32(0xcccccc);
aTextValueMap["LineStyle"] <<= drawing::LineStyle_SOLID; aTextValueMap["LineStyle"] <<= drawing::LineStyle_SOLID;
......
...@@ -29,6 +29,7 @@ private: ...@@ -29,6 +29,7 @@ private:
css::awt::Size m_aSize; css::awt::Size m_aSize;
bool m_bShowArrow; bool m_bShowArrow;
sal_Int32 m_nArrowColor; sal_Int32 m_nArrowColor;
sal_Int32 m_nBGColor;
css::uno::Reference<css::drawing::XShape> css::uno::Reference<css::drawing::XShape>
createTriangle(css::awt::Size aSize); createTriangle(css::awt::Size aSize);
...@@ -49,6 +50,10 @@ public: ...@@ -49,6 +50,10 @@ public:
{ {
m_nArrowColor = nArrowColor; m_nArrowColor = nArrowColor;
} }
void setBGColor(sal_Int32 nBGColor)
{
m_nBGColor = nBGColor;
}
void setLabel(OUString const & rLabel) void setLabel(OUString const & rLabel)
{ {
m_sLabel = rLabel; m_sLabel = rLabel;
......
...@@ -803,7 +803,10 @@ std::vector<std::shared_ptr<VButton>> lcl_createButtons( ...@@ -803,7 +803,10 @@ std::vector<std::shared_ptr<VButton>> lcl_createButtons(
pButton->setPosition(aNewPosition); pButton->setPosition(aNewPosition);
pButton->setSize(aSize); pButton->setSize(aSize);
if (sColumnFieldEntry.Name == "Data") if (sColumnFieldEntry.Name == "Data")
{
pButton->showArrow(false); pButton->showArrow(false);
pButton->setBGColor(0x00F6F6F6);
}
if (sColumnFieldEntry.HasHiddenMembers) if (sColumnFieldEntry.HasHiddenMembers)
pButton->setArrowColor(0x0000FF); pButton->setArrowColor(0x0000FF);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment