diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-07-20 17:21:43 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2018-08-02 17:16:08 +0200 |
commit | bf3420110cdd21490bc8d49a471340e747585159 (patch) | |
tree | 7ab84ace33c8dc6f5c1872c50d9c5b0e58636ee2 /sd | |
parent | 587d2c036bbd250c9186c927ab7097d64742c5bb (diff) |
tdf#116350 Import preset text geometry (text effects)
"Font effect" implementation, instead of normal
text, content is converted to "fontwork".
Change-Id: I5d02c7faedb66a4b919e64ae1b830bffb69984c1
Reviewed-on: https://gerrit.libreoffice.org/58358
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/tdf116350-texteffects.pptx | bin | 0 -> 38359 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 50 |
2 files changed, 50 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx b/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx Binary files differnew file mode 100644 index 000000000000..52a3fe000a9b --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 3f9ff8fffbc5..01873908cfdb 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -10,6 +10,7 @@ #include "sdmodeltestbase.hxx" #include <Outliner.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/sequence.hxx> #include <svl/stritem.hxx> #include <editeng/editobj.hxx> #include <editeng/outlobj.hxx> @@ -151,6 +152,7 @@ public: void testTdf118835(); void testTdf118768(); void testTdf118836(); + void testTdf116350TextEffects(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -223,6 +225,7 @@ public: CPPUNIT_TEST(testTdf118835); CPPUNIT_TEST(testTdf118768); CPPUNIT_TEST(testTdf118836); + CPPUNIT_TEST(testTdf116350TextEffects); CPPUNIT_TEST_SUITE_END(); @@ -1788,6 +1791,53 @@ void SdOOXMLExportTest2::testTdf118836() xDocShRef->DoClose(); } +static inline double getAdjustmentValue( uno::Reference<beans::XPropertySet>& xSet ) +{ + auto aGeomPropSeq = xSet->getPropertyValue( "CustomShapeGeometry" ) + .get<uno::Sequence<beans::PropertyValue>>(); + auto aGeomPropVec + = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>( + aGeomPropSeq ); + + const OUString sName = "AdjustmentValues"; + auto aIterator = std::find_if( + aGeomPropVec.begin(), aGeomPropVec.end(), + [sName]( const beans::PropertyValue& rValue ) { return rValue.Name == sName; } ); + + if (aIterator != aGeomPropVec.end()) + { + uno::Sequence<drawing::EnhancedCustomShapeAdjustmentValue> aAdjustment; + double fResult; + aIterator->Value >>= aAdjustment; + aAdjustment[0].Value >>= fResult; + return fResult; + } + + return -1.0; +} + +void SdOOXMLExportTest2::testTdf116350TextEffects() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "sd/qa/unit/data/pptx/tdf116350-texteffects.pptx" ), PPTX ); + + // Default angle for ArchUp + uno::Reference<beans::XPropertySet> xShape0( getShapeFromPage( 0, 0, xDocShRef ) ); + double fAdjust = getAdjustmentValue( xShape0 ); + CPPUNIT_ASSERT_EQUAL( 180.0, fAdjust ); + + // Default angle for ArchDown + uno::Reference<beans::XPropertySet> xShape14( getShapeFromPage( 14, 0, xDocShRef ) ); + fAdjust = getAdjustmentValue( xShape14 ); + CPPUNIT_ASSERT_EQUAL( 0.0, fAdjust ); + + // Angle directly set + uno::Reference<beans::XPropertySet> xShape1( getShapeFromPage( 1, 0, xDocShRef ) ); + fAdjust = getAdjustmentValue( xShape1 ); + CPPUNIT_ASSERT_EQUAL( 213.25, fAdjust ); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); |