diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-03-29 17:14:23 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-03-29 17:14:23 +0100 |
commit | d31d06e3d59abdc77e0b1cb5b3575d7fa5357445 (patch) | |
tree | c2e43d64d0d676da5602ce8ab7ee06d40827438c | |
parent | c7ea9ac9d5f572b647f7e83ce9ae109b773052ba (diff) |
Revert "hacky fix for export of cell anchored flipped custom shapes (fdo#62448)"
This fails on at least two tinderboxes.
This reverts commit 2058479575e4a3e003eb1917c4f0947db9145623.
-rw-r--r-- | sc/CppunitTest_sc_subsequent_export_test.mk | 1 | ||||
-rw-r--r-- | sc/qa/unit/data/ods/rotflipshapes.ods | bin | 9980 -> 0 bytes | |||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 5 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 78 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 32 | ||||
-rw-r--r-- | xmloff/inc/xmloff/shapeexport.hxx | 2 |
6 files changed, 1 insertions, 117 deletions
diff --git a/sc/CppunitTest_sc_subsequent_export_test.mk b/sc/CppunitTest_sc_subsequent_export_test.mk index 02d1aeb9afe3..41a6855d061f 100644 --- a/sc/CppunitTest_sc_subsequent_export_test.mk +++ b/sc/CppunitTest_sc_subsequent_export_test.mk @@ -101,7 +101,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\ framework/util/fwk \ i18npool/util/i18npool \ i18npool/source/search/i18nsearch \ - linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sc/qa/unit/data/ods/rotflipshapes.ods b/sc/qa/unit/data/ods/rotflipshapes.ods Binary files differdeleted file mode 100644 index 2bd104f1893a..000000000000 --- a/sc/qa/unit/data/ods/rotflipshapes.ods +++ /dev/null diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 8557452090f1..32f7f7a59229 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -38,11 +38,6 @@ #include <osl/detail/android-bootstrap.h> -bool testEqualsWithTolerance( long nVal1, long nVal2, long nTol ) -{ - return ( labs( nVal1 - nVal2 ) <= nTol ); -} - // Why is this here and not in osl, and using the already existing file // handling APIs? Do we really want to add arbitrary new file handling // wrappers here and there (and then having to handle the Android (and diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index aee44e0ee3f3..844020d71461 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -34,9 +34,6 @@ #include "scitems.hxx" #include "document.hxx" #include "cellform.hxx" -#include "drwlayer.hxx" -#include "userdat.hxx" -#include "svx/svdpage.hxx" #define ODS_FORMAT_TYPE 50331943 #define XLS_FORMAT_TYPE 318767171 @@ -81,7 +78,6 @@ public: void testPasswordExport(); void testConditionalFormatExportXLSX(); void testMiscRowHeightExport(); - void testRotatedFlippedShapes(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -90,7 +86,6 @@ public: #endif CPPUNIT_TEST(testConditionalFormatExportXLSX); CPPUNIT_TEST(testMiscRowHeightExport); - CPPUNIT_TEST(testRotatedFlippedShapes); CPPUNIT_TEST_SUITE_END(); private: @@ -376,79 +371,6 @@ void ScExportTest::testMiscRowHeightExport() } } -void ScExportTest::testRotatedFlippedShapes() -{ - ScDocShellRef xShell = loadDocument("rotflipshapes.", ODS); - CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(&(*xShell), ODS); - CPPUNIT_ASSERT(xDocSh.Is()); - ScDocument* pDoc = xDocSh->GetDocument(); - ScDrawLayer *pDrawLayer = pDoc->GetDrawLayer(); - CPPUNIT_ASSERT_MESSAGE("must have a draw layer", pDrawLayer != NULL); - SdrPage* pPage = pDrawLayer->GetPage(0); - CPPUNIT_ASSERT_MESSAGE("must have a draw page", pPage != NULL); - struct TestData - { - long mnShapeX; - long mnShapeY; - long mnShapeWidth; - long mnShapeHeight; - SCROW startAnchorRow; - SCCOL startAnchorCol; - SCROW endAnchorRow; - SCCOL endAnchorCol; - }; - - TestData testData[] = - { - { 1, 1356, 2194, 1255, 3, 0, 5, 0 }, - { 2194, 5771, 2195, 1205, 12, 0, 15, 1 }, - { 5154, 1382, 904, 1170, 3, 2, 5, 2 }, - { 6085, 5712, 903, 1120, 12, 2, 15, 3 }, - { 9367, 1906, 1382, 772, 4, 4, 5, 4 }, - { 10557, 5732, 1383, 745, 12, 4, 14, 5 }, - { 14106, 1674, 957, 957, 3, 6, 5, 6 }, - { 15087, 5447, 956, 932, 12, 6, 14, 7 }, - { 18087, 2050, 904, 1010, 4, 8, 6, 8 }, - { 19122, 5569, 904, 985, 12, 8, 14, 8 } - }; - - int nCount( pPage->GetObjCount() ); - int nData = SAL_N_ELEMENTS(testData); - CPPUNIT_ASSERT_MESSAGE("must have test data for all objects", nCount == nData ); - - for (int i = 0; i < nData; ++i ) - - { - SdrObject* pObj = pPage->GetObj(i); - CPPUNIT_ASSERT_MESSAGE("Failed to get drawing object.", pObj); - ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj, false); - Point aObjPos( pObj->GetLogicRect().TopLeft() ); - - long nTol = 20; // 20hmm - printf( "comparing object[%d] pos ( %ld, %ld ) with expected ( %ld, %ld ) - with tolerance %ld\n", - i, aObjPos.X(), aObjPos.Y(), testData[ i ].mnShapeX, testData[ i ].mnShapeY, nTol ); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aObjPos.X(), testData[ i ].mnShapeX, nTol ) ); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aObjPos.Y(), testData[ i ].mnShapeY, nTol ) ); - - printf( "comparing object[%d] Width, Height ( %ld, %ld ) with expected ( %ld, %ld ) - with tolerance %ld\n", - i, pObj->GetLogicRect().GetWidth(), pObj->GetLogicRect().GetHeight(), - testData[ i ].mnShapeWidth, testData[ i ].mnShapeHeight, nTol ); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance(pObj->GetLogicRect().GetWidth(), testData[ i ].mnShapeWidth, nTol ) ); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance(pObj->GetLogicRect().GetHeight(), testData[ i ].mnShapeHeight, nTol ) ); - - printf( "comparing object[%d] anchor start ( %" SAL_PRIdINT32 ", %d ) with expected ( %" SAL_PRIdINT32 ", %d ) \n", - i, pData->maStart.Row(), pData->maStart.Col(), testData[ i ].startAnchorRow, testData[ i ].startAnchorCol ); - - CPPUNIT_ASSERT_EQUAL( pData->maStart.Row(), testData[ i ].startAnchorRow ); - CPPUNIT_ASSERT_EQUAL( pData->maStart.Col(), testData[ i ].startAnchorCol ); - - printf( "comparing object[%d] anchor end ( %" SAL_PRIdINT32 ", %d ) with expected ( %" SAL_PRIdINT32 ", %d ) \n", - i, pData->maEnd.Row(), pData->maEnd.Col(), testData[ i ].endAnchorRow, testData[ i ].endAnchorCol ); - CPPUNIT_ASSERT_EQUAL( pData->maEnd.Row(), testData[ i ].endAnchorRow ); - CPPUNIT_ASSERT_EQUAL( pData->maEnd.Col(), testData[ i ].endAnchorCol ); - } -} ScExportTest::ScExportTest() : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data")) { diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 620383c108f1..3882e2f2baa9 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -128,7 +128,6 @@ #include <vector> #include <vbahelper/vbaaccesshelper.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> //! not found in unonames.hxx #define SC_LAYERID "LayerID" @@ -3150,37 +3149,6 @@ void ScXMLExport::WriteShapes(const ScMyCell& rMyCell) { if (aItr->xShape.is()) { - SdrObject* pObj = SdrObject::getSdrObjectFromXShape( aItr->xShape ); - if ( pObj ) - { - // Sometimes the position indicated by aTRTranslate and - // the position reported by the object are different - // ( seems to happen when objects are flipped say - // vertically ) This doesn't seem to happen when the - // objects are just rotated in a similar way e.g. - // although a rotation of 180 deg. is roughly equivalent - // to a vertical flip, the Transformation and Obj position - // are equal wheras in the vertical flip case they are not. - // This difference when exporting ( which attempts to - // output the position of the object relative to the top - // left corner of the nearest cell ) results in incorrect - // values being generated. - basegfx::B2DPolyPolygon aTmp; - basegfx::B2DHomMatrix aTmpMatrix; - uno::Reference<beans::XPropertySet> xPropertySet(aItr->xShape, uno::UNO_QUERY); - GetShapeExport()->ImpExportNewTrans_GetB2DHomMatrix( aTmpMatrix, xPropertySet ); - double fTRShear(0.0); - double fTRRotate(0.0); - basegfx::B2DTuple aTRTranslate; - basegfx::B2DTuple aTRScale; - - aTmpMatrix.decompose(aTRScale, aTRTranslate, fTRRotate, fTRShear); - Point aObjPos = pObj->GetLogicRect().TopLeft(); - Point aTransPos( aTRTranslate.getX(), aTRTranslate.getY() ); - aObjPos -= aTransPos; - aPoint.X = aPoint.X - aObjPos.X(); - aPoint.Y = aPoint.Y - aObjPos.Y(); - } if (bNegativePage) aPoint.X = 2 * aItr->xShape->getPosition().X + aItr->xShape->getSize().Width - aPoint.X; if ( !aItr->xShape->getShapeType().equals(sCaptionShape) ) diff --git a/xmloff/inc/xmloff/shapeexport.hxx b/xmloff/inc/xmloff/shapeexport.hxx index d89acbaaee9d..55cc16037b65 100644 --- a/xmloff/inc/xmloff/shapeexport.hxx +++ b/xmloff/inc/xmloff/shapeexport.hxx @@ -210,6 +210,7 @@ private: SAL_DLLPRIVATE void ImpCalcShapeType(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType& eShapeType); SAL_DLLPRIVATE void ImpExportNewTrans(const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint); + SAL_DLLPRIVATE void ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix, const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet); SAL_DLLPRIVATE void ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMat, ::basegfx::B2DTuple& rTRScale, double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint); SAL_DLLPRIVATE void ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear, double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const sal_Int32 nFeatures); SAL_DLLPRIVATE sal_Bool ImpExportPresentationAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, const rtl::OUString& rClass ); @@ -322,7 +323,6 @@ public: virtual void onExport( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape ); const rtl::Reference< XMLTableExport >& GetShapeTableExport(); - void ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix, const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet); }; |