chart2/qa/extras/chart2import.cxx | 19 +++++++++++++++++++ chart2/qa/extras/data/xlsx/axis-label-rotation.xlsx |binary oox/README | 9 +++++++++ oox/source/drawingml/chart/chartspacemodel.cxx | 2 +- oox/source/drawingml/chart/objectformatter.cxx | 2 +- sc/source/filter/oox/sheetdatabuffer.cxx | 12 +++++++----- 6 files changed, 37 insertions(+), 7 deletions(-)
New commits: commit b13534de022972131b46f93f5ada90af155eec9e Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Thu Feb 19 01:03:48 2015 +0100 add test for tdf#89454 Change-Id: Iefb52f6fa77cf90955dbb47c1b9ca7ab699a43eb diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 1eaa74d..c334713 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -57,6 +57,7 @@ public: void testFdo54361_1(); void testAutoBackgroundXLSX(); void testChartAreaStyleBackgroundXLSX(); + void testAxisTextRotationXLSX(); // void testTextCanOverlapXLSX(); // TODO : temporarily disabled. void testNumberFormatsXLSX(); @@ -89,6 +90,7 @@ public: CPPUNIT_TEST(testFdo54361_1); CPPUNIT_TEST(testAutoBackgroundXLSX); CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX); + CPPUNIT_TEST(testAxisTextRotationXLSX); // CPPUNIT_TEST(testTextCanOverlapXLSX); // TODO : temporarily disabled. CPPUNIT_TEST(testNumberFormatsXLSX); CPPUNIT_TEST_SUITE_END(); @@ -658,6 +660,23 @@ void Chart2ImportTest::testChartAreaStyleBackgroundXLSX() sal_Int32(0), nColor); } +void Chart2ImportTest::testAxisTextRotationXLSX() +{ + load("/chart2/qa/extras/data/xlsx/", "axis-label-rotation.xlsx"); + uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); + + Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); + CPPUNIT_ASSERT(xYAxis.is()); + + Reference<beans::XPropertySet> xPS(xYAxis, uno::UNO_QUERY_THROW); + double nRotation = 0; + bool bSuccess = xPS->getPropertyValue("TextRotation") >>= nRotation; + + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT_DOUBLES_EQUAL(90, nRotation, 1e-10); +} + /* TODO : temporarily disabled. void Chart2ImportTest::testTextCanOverlapXLSX() { diff --git a/chart2/qa/extras/data/xlsx/axis-label-rotation.xlsx b/chart2/qa/extras/data/xlsx/axis-label-rotation.xlsx new file mode 100644 index 0000000..cc3b1df Binary files /dev/null and b/chart2/qa/extras/data/xlsx/axis-label-rotation.xlsx differ commit 0d1bd8c4f12d4e60d1f33f7df0a201d2affb7767 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Thu Feb 19 00:36:49 2015 +0100 this should be [-90, 90] and not (-90, 90), tdf#89454 Change-Id: I943be2cf660d2dc77eebd776208af96c0b5f67a4 diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index d66726d..95bda7b 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1094,7 +1094,7 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef OOXML counts clockwise, Chart2 counts counterclockwise. */ double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.get( 0 ) ); // MS Office UI allows values only in range of [-90,90]. - if ( fAngle <= -5400000.0 || fAngle >= 5400000.0 ) + if ( fAngle < -5400000.0 || fAngle > 5400000.0 ) { fAngle = 0.0; } commit ffc0391e2e9d797ef8ce3d1089e8d9d2b11a5ead Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Wed Feb 18 19:53:36 2015 +0100 start documenting problems around OOXML spec We implement in many places wrong default values based on how MSO 2007 behaves. Newer MSO versions produce correct files so our import is wrong. Instead of changing the default value we need to be able to use default values based on the document producer. Change-Id: I6a2a0b30885ebccc384d17f896709ecdd475d786 diff --git a/oox/README b/oox/README index 6d01ca5..2d18786 100644 --- a/oox/README +++ b/oox/README @@ -3,6 +3,15 @@ Support for Office Open XML, the office XML-format designed by Microsoft. See also: [http://wiki.openoffice.org/wiki/OOX] + +The "TODO: OOXML_spec" comments are related to wrong implementation of the spec. The oox code was +written against the OOXML dialect produced by MSO 2007, +which is not standard compliant. Newer MSO version use the correct +default values as desribed in the spec. We need a way to handle both in the future. +The first step is to mark these places when you see them. Many of them +already have a comment that the implemented default value is not +in line with the spec. + == DrawingML Custom shapes and presets == custom shapes are part of DrawingML and are different to binary ppt diff --git a/oox/source/drawingml/chart/chartspacemodel.cxx b/oox/source/drawingml/chart/chartspacemodel.cxx index a1c107e..ea14c3c 100644 --- a/oox/source/drawingml/chart/chartspacemodel.cxx +++ b/oox/source/drawingml/chart/chartspacemodel.cxx @@ -25,7 +25,7 @@ namespace drawingml { namespace chart { ChartSpaceModel::ChartSpaceModel() : - mnDispBlanksAs( XML_gap ), // not zero as specified + mnDispBlanksAs( XML_gap ), // not zero as specified, TODO: OOXML_spec mnStyle( 2 ), mbAutoTitleDel( true ), mbPlotVisOnly( false ), commit 3488d0a42f6a09723f5fd3fb972b0e778b26f8b3 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Fri Feb 6 01:31:49 2015 +0100 make the code easier to read Change-Id: I8cdfe1cddf57a36054bfe850173ef6130aa608b5 diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index d27061c..c6df96f 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -333,12 +333,14 @@ void SheetDataBuffer::setStandardNumFmt( const CellAddress& rCellAddr, sal_Int16 } } -void addIfNotInMyMap( StylesBuffer& rStyles, std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList >& rMap, sal_Int32 nXfId, sal_Int32 nFormatId, const ApiCellRangeList& rRangeList ) +typedef std::pair<sal_Int32, sal_Int32> FormatKeyPair; + +void addIfNotInMyMap( StylesBuffer& rStyles, std::map< FormatKeyPair, ApiCellRangeList >& rMap, sal_Int32 nXfId, sal_Int32 nFormatId, const ApiCellRangeList& rRangeList ) { Xf* pXf1 = rStyles.getCellXf( nXfId ).get(); if ( pXf1 ) { - for ( std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList >::iterator it = rMap.begin(), it_end = rMap.end(); it != it_end; ++it ) + for ( std::map< FormatKeyPair, ApiCellRangeList >::iterator it = rMap.begin(), it_end = rMap.end(); it != it_end; ++it ) { if ( it->first.second == nFormatId ) { @@ -353,7 +355,7 @@ void addIfNotInMyMap( StylesBuffer& rStyles, std::map< std::pair< sal_Int32, sal } } } - rMap[ std::pair<sal_Int32, sal_Int32>( nXfId, nFormatId ) ] = rRangeList; + rMap[ FormatKeyPair( nXfId, nFormatId ) ] = rRangeList; } } @@ -433,13 +435,13 @@ void SheetDataBuffer::finalizeImport() // write default formatting of remaining row range maXfIdRowRangeList[ maXfIdRowRange.mnXfId ].push_back( maXfIdRowRange.maRowRange ); - std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList > rangeStyleListMap; + std::map< FormatKeyPair, ApiCellRangeList > rangeStyleListMap; for( XfIdRangeListMap::const_iterator aIt = maXfIdRangeLists.begin(), aEnd = maXfIdRangeLists.end(); aIt != aEnd; ++aIt ) { addIfNotInMyMap( getStyles(), rangeStyleListMap, aIt->first.first, aIt->first.second, aIt->second ); } // gather all ranges that have the same style and apply them in bulk - for ( std::map< std::pair< sal_Int32, sal_Int32 >, ApiCellRangeList >::iterator it = rangeStyleListMap.begin(), it_end = rangeStyleListMap.end(); it != it_end; ++it ) + for ( std::map< FormatKeyPair, ApiCellRangeList >::iterator it = rangeStyleListMap.begin(), it_end = rangeStyleListMap.end(); it != it_end; ++it ) { const ApiCellRangeList& rRanges( it->second ); for ( ::std::vector< CellRangeAddress >::const_iterator it_range = rRanges.begin(), it_rangeend = rRanges.end(); it_range!=it_rangeend; ++it_range ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits