[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - oox/source sd/qa
oox/source/export/drawingml.cxx |4 +++- sd/qa/unit/data/fdo71961.odp|binary sd/qa/unit/import-tests.cxx | 36 3 files changed, 39 insertions(+), 1 deletion(-) New commits: commit dac36077c3823a9f4ac738e35a9421c4c403328a Author: LuboÅ¡ LuÅák l.lu...@collabora.com Date: Thu Mar 27 18:46:16 2014 +0100 write (no)wrap of text only for custom shapes to .pptx (fdo#71961) Apparently checking the TextWordWrap property in DrawingML::WriteText() gives false by default for objects that do not have it set, which happens to be everything except for custom shapes, which seem to be the only ones to actually obey it. So all normal text would be exported as nowrap to .pptx and read back as custom shape that has non-wrapping text. I tried to make the property return true (which is what it should be in practice), but that appears to be an exercise in futility, or I'm not mad enough to follow the complicated property sets and whatnot. So just write it out only for custom shapes. UNO purists, if any, are welcome to change the dynamic_cast to something UNO-better if they manage without an ambiguous base class error. Conflicts: sd/qa/unit/import-tests.cxx Change-Id: I3ed906285fde88d902ac9c801986a82a7515638b diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index b3bfd7f..d4a3edc 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -70,6 +70,7 @@ #include editeng/svxenum.hxx #include svx/unoapi.hxx #include svx/svdoashp.hxx +#include svx/unoshape.hxx using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -1327,7 +1328,8 @@ void DrawingML::WriteText( Reference XInterface rXIface ) sal_Bool bHasWrap = sal_False; sal_Bool bWrap = sal_False; -if( GETA( TextWordWrap ) ) { +// Only custom shapes obey the TextWordWrap option, normal text always wraps. +if( dynamic_castSvxCustomShape*(rXIface.get()) GETA( TextWordWrap ) ) { mAny = bWrap; bHasWrap = sal_True; } diff --git a/sd/qa/unit/data/fdo71961.odp b/sd/qa/unit/data/fdo71961.odp new file mode 100644 index 000..323fbe8 Binary files /dev/null and b/sd/qa/unit/data/fdo71961.odp differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index ba67b22..518b022 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -36,6 +36,7 @@ public: void testN759180(); void testN778859(); void testFdo64512(); +void testFdo71961(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -43,6 +44,8 @@ public: CPPUNIT_TEST(testN759180); CPPUNIT_TEST(testN778859); CPPUNIT_TEST(testFdo64512); +CPPUNIT_TEST(testFdo71961); + CPPUNIT_TEST_SUITE_END(); }; @@ -208,6 +211,39 @@ void SdFiltersTest::testFdo64512() xTargetShape != xSvgShape ); } +void SdFiltersTest::testFdo71961() +{ +::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc(/sd/qa/unit/data/fdo71961.odp)); +CPPUNIT_ASSERT_MESSAGE( failed to load, xDocShRef.Is() ); +CPPUNIT_ASSERT_MESSAGE( not in destruction, !xDocShRef-IsInDestruction() ); + +xDocShRef = saveAndReload( xDocShRef, PPTX ); +CPPUNIT_ASSERT_MESSAGE( failed to load, xDocShRef.Is() ); +CPPUNIT_ASSERT_MESSAGE( not in destruction, !xDocShRef-IsInDestruction() ); + +SdDrawDocument *pDoc = xDocShRef-GetDoc(); +CPPUNIT_ASSERT_MESSAGE( no document, pDoc != NULL ); +const SdrPage *pPage = pDoc-GetPage (1); +CPPUNIT_ASSERT_MESSAGE( no page, pPage != NULL ); + +// Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property +// (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do. +SdrObjCustomShape *pTxtObj = dynamic_castSdrObjCustomShape *( pPage-GetObj( 1 )); +CPPUNIT_ASSERT_MESSAGE( no text object, pTxtObj != NULL); +CPPUNIT_ASSERT_EQUAL( OUString( Text to be always wrapped ), pTxtObj-GetOutlinerParaObject()-GetTextObject().GetText(0)); +CPPUNIT_ASSERT_EQUAL( true, (static_castconst SdrTextWordWrapItem(pTxtObj-GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue()); + +pTxtObj = dynamic_castSdrObjCustomShape *( pPage-GetObj( 2 )); +CPPUNIT_ASSERT_MESSAGE( no text object, pTxtObj != NULL); +CPPUNIT_ASSERT_EQUAL( OUString( Custom shape non-wrapped text ), pTxtObj-GetOutlinerParaObject()-GetTextObject().GetText(0)); +CPPUNIT_ASSERT_EQUAL( false, (static_castconst SdrTextWordWrapItem(pTxtObj-GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue()); + +pTxtObj = dynamic_castSdrObjCustomShape *( pPage-GetObj( 3 )); +CPPUNIT_ASSERT_MESSAGE( no text object, pTxtObj != NULL); +CPPUNIT_ASSERT_EQUAL( OUString( Custom shape wrapped text ),
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - oox/source
oox/source/drawingml/textcharacterpropertiescontext.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 88faa076da606e8611aea4c4b2d10fee694943a5 Author: Muthu Subramanian sumu...@collabora.com Date: Fri Mar 14 20:03:45 2014 +0530 n#862510: Ignore baseline attributes with zero. Ported from 19abfaffe74b925e4428943d14187a7008797982 Change-Id: I5447c16193f7c3e619ce10658c9696014d3d5a22 diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 19b54c6..6835149 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -55,7 +55,7 @@ TextCharacterPropertiesContext::TextCharacterPropertiesContext( mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u ); if ( aAttribs.hasAttribute( XML_strike ) ) mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike ); -if ( aAttribs.hasAttribute( XML_baseline ) ) +if ( aAttribs.hasAttribute( XML_baseline ) aAttribs.getInteger( XML_baseline ).get() != 0 ) mrTextCharacterProperties.moBaseline = aAttribs.getInteger( XML_baseline ); if( aAttribs.hasAttribute( XML_cap ) ) mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - oox/source
oox/source/drawingml/chart/objectformatter.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit aa759923b6195c6397545b3e9f4c462727f027ea Author: Andras Timar andras.ti...@collabora.com Date: Mon Feb 24 14:55:05 2014 +0100 OOXML chart import: ignore rot values outside the valid range Change-Id: I506a78a024d761d1d263a7bb1dcbf09a4bbcf4ef diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 29cc07b..2541d42 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1096,6 +1096,11 @@ void ObjectFormatter::convertTextRotation( PropertySet rPropSet, const ModelRef /* Chart2 expects rotation angle as double value in range of [0,360). 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 = -540.0 || fAngle = 540.0 ) +{ +fAngle = 0.0; +} fAngle = getDoubleIntervalValue double ( -fAngle / 6.0, 0.0, 360.0 ); rPropSet.setProperty( PROP_TextRotation, fAngle ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - oox/source
oox/source/drawingml/chart/datasourceconverter.cxx | 28 + 1 file changed, 28 insertions(+) New commits: commit b8741791fbe9b053875df74c060f405c5253830e Author: Markus Mohrhard markus.mohrh...@collabora.co.uk Date: Sat Feb 22 05:49:39 2014 +0100 we only support simple labels in the InternalDataProvider, bnc#864396 Change-Id: Ie31c5c73bb5185125fd4493c4e476997e2e9bc63 diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx b/oox/source/drawingml/chart/datasourceconverter.cxx index 6be4710..ea22348 100644 --- a/oox/source/drawingml/chart/datasourceconverter.cxx +++ b/oox/source/drawingml/chart/datasourceconverter.cxx @@ -50,6 +50,34 @@ Reference XDataSequence DataSequenceConverter::createDataSequence( const OUSt Reference XDataSequence xDataSeq; if( getChartConverter() ) { +// the internal data table does not support complex labels +// this is only supported in Calc!!! +// merge the labels into a single one +if(rRole == label) +{ +mrModel.mnPointCount = std::minsal_Int32(mrModel.mnPointCount, 1); +OUStringBuffer aTitle; +bool bFirst = true; +for(DataSequenceModel::AnyMap::const_iterator itr = mrModel.maData.begin(), +itrEnd = mrModel.maData.end(); itr != itrEnd; ++itr) +{ +Any aAny = itr-second; +if(aAny.hasOUString()) +{ +if(!bFirst) +aTitle.append( ); + +aTitle.append(aAny.getOUString()); +bFirst = false; +} +} + +if(!bFirst) +{ +mrModel.maData.clear(); +mrModel.maData.insert(std::make_pairsal_Int32, Any(1, Any(aTitle.makeStringAndClear(; +} +} xDataSeq = getChartConverter()-createDataSequence( getChartDocument()-getDataProvider(), mrModel ); // set sequen ce role ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - oox/source sd/qa
oox/source/drawingml/customshapeproperties.cxx |6 ++ sd/qa/unit/data/xml/n762695_0.xml |2 +- sd/qa/unit/data/xml/n762695_1.xml |4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) New commits: commit d08422551128967bdabcd4a844c8598df129f2e5 Author: Muthu Subramanian sumu...@collabora.com Date: Fri Dec 27 19:59:22 2013 +0530 fdo#72998: Custom shapes have improper size. diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index d83b3e3..c54a021 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -213,7 +213,13 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase /* rFi aPropertyMap[ PROP_Type ] = OUString( ooxml-non-primitive ); aPropertyMap[ PROP_MirroredX ] = Any( mbMirroredX ); aPropertyMap[ PROP_MirroredY ] = Any( mbMirroredY ); +// Note 1: If Equations are defined - they are processed using internal div by 360 coordinates +// while if they are not, standard ooxml coordinates are used. +// This size specifically affects scaling. +// Note 2: Width and Height are set to 0 to force scaling to 1. awt::Rectangle aViewBox( 0, 0, aSize.Width, aSize.Height ); +if( maGuideList.size() ) +aViewBox = awt::Rectangle( 0, 0, 0, 0 ); aPropertyMap[ PROP_ViewBox ] = aViewBox; Sequence EnhancedCustomShapeAdjustmentValue aAdjustmentValues( maAdjustmentGuideList.size() ); diff --git a/sd/qa/unit/data/xml/n762695_0.xml b/sd/qa/unit/data/xml/n762695_0.xml index 68b99ab..a2eba94 100644 --- a/sd/qa/unit/data/xml/n762695_0.xml +++ b/sd/qa/unit/data/xml/n762695_0.xml @@ -82,7 +82,7 @@ /PropertyValue PropertyValue name=Type value=ooxml-non-primitive handle=0 propertyState=DIRECT_VALUE/ PropertyValue name=ViewBox -ViewBox x=0 y=0 width=4820911 height=3908235/ +ViewBox x=0 y=0 width=0 height=0/ /PropertyValue /CustomShapeGeometry /XShape diff --git a/sd/qa/unit/data/xml/n762695_1.xml b/sd/qa/unit/data/xml/n762695_1.xml index b5293ab..8d7b6fa 100644 --- a/sd/qa/unit/data/xml/n762695_1.xml +++ b/sd/qa/unit/data/xml/n762695_1.xml @@ -82,7 +82,7 @@ /PropertyValue PropertyValue name=Type value=ooxml-non-primitive handle=0 propertyState=DIRECT_VALUE/ PropertyValue name=ViewBox -ViewBox x=0 y=0 width=6477000 height=2743200/ +ViewBox x=0 y=0 width=0 height=0/ /PropertyValue /CustomShapeGeometry /XShape @@ -168,7 +168,7 @@ /PropertyValue PropertyValue name=Type value=ooxml-non-primitive handle=0 propertyState=DIRECT_VALUE/ PropertyValue name=ViewBox -ViewBox x=0 y=0 width=6365875 height=3430587/ +ViewBox x=0 y=0 width=0 height=0/ /PropertyValue /CustomShapeGeometry /XShape ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - oox/source
oox/source/export/drawingml.cxx | 13 + 1 file changed, 13 insertions(+) New commits: commit d2a10c321485b19cab498e401819a704ad88ca68 Author: Muthu Subramanian sumu...@collabora.com Date: Wed Nov 13 20:54:46 2013 +0530 n#828390: Export subscript text. diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 5a9b50e..b3bfd7f 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -698,6 +698,7 @@ void DrawingML::WriteRunProperties( Reference XPropertySet rRun, sal_Bool bIs const char* italic = NULL; const char* underline = NULL; sal_Int32 nSize = 1800; +sal_Int32 nCharEscapement = 0; if( GETAD( CharHeight ) ) nSize = (sal_Int32) (100*(*((float*) mAny.getValue(; @@ -784,12 +785,24 @@ void DrawingML::WriteRunProperties( Reference XPropertySet rRun, sal_Bool bIs usLanguage = usLanguageBuffer.makeStringAndClear(); } +if( GETAD( CharEscapement ) ) +mAny = nCharEscapement; + +if( nCharEscapement GETAD( CharEscapementHeight ) ) { +sal_uInt32 nCharEscapementHeight; +mAny = nCharEscapementHeight; +nSize = (nSize * nCharEscapementHeight) / 100; +// MSO uses default ~58% size +nSize = (nSize / 0.58); +} + mpFS-startElementNS( XML_a, XML_rPr, XML_b, bold, XML_i, italic, XML_lang, usLanguage.isEmpty() ? NULL : USS( usLanguage ), XML_sz, nSize == 1800 ? NULL : IS( nSize ), XML_u, underline, + XML_baseline, nCharEscapement == 0 ? NULL : IS( nCharEscapement*1000 ), FSEND ); // mso doesn't like text color to be placed after typeface ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits