configure.ac | 2 include/oox/ppt/slidepersist.hxx | 4 include/oox/vml/vmlshape.hxx | 4 include/unotools/localedatawrapper.hxx | 6 officecfg/registry/schema/org/openoffice/Office/Common.xcs | 4 oox/source/ppt/pptshapegroupcontext.cxx | 9 oox/source/ppt/slidefragmenthandler.cxx | 3 oox/source/ppt/slidepersist.cxx | 3 oox/source/vml/vmlshape.cxx | 33 ++ oox/source/vml/vmlshapecontext.cxx | 6 sc/source/core/data/column3.cxx | 2 sc/source/filter/excel/xicontent.cxx | 60 ++-- sc/source/filter/excel/xilink.cxx | 5 sc/source/filter/inc/stylesbuffer.hxx | 2 sc/source/filter/oox/stylesbuffer.cxx | 19 - sc/source/ui/docshell/docsh.cxx | 8 sd/qa/unit/data/pptx/tdf93868.pptx |binary sd/qa/unit/import-tests.cxx | 15 + sw/qa/extras/ooxmlimport/data/tdf99074.docx |binary sw/qa/extras/ooxmlimport/data/tdf99135.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 14 + sw/qa/extras/rtfexport/data/pgndec.rtf | 23 + sw/qa/extras/rtfexport/data/pgnlcrm.rtf | 23 + sw/qa/extras/rtfexport/data/pgnucrm.rtf | 23 + sw/qa/extras/rtfexport/rtfexport.cxx | 18 + sw/qa/extras/rtfimport/data/tdf90097.rtf | 162 +++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 19 + sw/source/uibase/uno/SwXDocumentSettings.cxx | 16 + unotools/source/i18n/localedatawrapper.cxx | 34 ++ writerfilter/Library_writerfilter.mk | 1 writerfilter/source/dmapper/DomainMapper.cxx | 12 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 21 + writerfilter/source/rtftok/rtfsdrimport.cxx | 31 ++ 34 files changed, 520 insertions(+), 66 deletions(-)
New commits: commit 89f4282ccfde05ab7ef685a7b572f9c31c4db67a Author: Andras Timar <andras.ti...@collabora.com> Date: Tue May 3 09:17:02 2016 +0200 Bump version to 5.0-33 Change-Id: Ibe8b84379f048548def6a700aebd686b8f936bce diff --git a/configure.ac b/configure.ac index c268169..3d5541a 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([Collabora Office],[5.0.10.32],[],[],[https://CollaboraOffice.com/]) +AC_INIT([Collabora Office],[5.0.10.33],[],[],[https://CollaboraOffice.com/]) AC_PREREQ([2.59]) commit 4d4edcc3d4c27688f5bed4beebf5fee2b0cd1760 Author: Matus Uzak <matus.u...@gmail.com> Date: Tue Mar 8 21:44:21 2016 +0100 tdf#93868: PPTX import: Incorrect inheritance of shape fill properties DrawingML: The useBgFill attribute specifies that the shape fill should be set to that of the slide background. Reviewed-on: https://gerrit.libreoffice.org/23039 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Katarina Behrens <katarina.behr...@cib.de> (cherry picked from commit f3d1ac75c4b7fa63022e54a9cbff46ba99535076) Change-Id: I8b568e730f00326d51e7b604579f4ff990b26f8a diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx index 91cd49b..4e4fcec 100644 --- a/include/oox/ppt/slidepersist.hxx +++ b/include/oox/ppt/slidepersist.hxx @@ -85,7 +85,6 @@ public: void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr& rFillPropertiesPtr ){ mpBackgroundPropertiesPtr = rFillPropertiesPtr; } oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; } - oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; } bool isMasterPage() const { return mbMaster; } bool isNotesPage() const { return mbNotes; } @@ -129,9 +128,8 @@ private: SlidePersistPtr mpMasterPagePtr; oox::drawingml::ShapePtr maShapesPtr; - oox::drawingml::Color maBackgroundColor; oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr; - ::std::list< std::shared_ptr< TimeNode > > maTimeNodeList; + ::std::list< std::shared_ptr< TimeNode > > maTimeNodeList; oox::ppt::HeaderFooter maHeaderFooter; sal_Int32 mnLayoutValueToken; diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index 05044ca..b38cd11 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -98,11 +98,10 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken std::shared_ptr<PPTShape> pShape( new PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) ); if( rAttribs.getBool( XML_useBgFill, false ) ) { - ::oox::drawingml::FillProperties &aFill = pShape->getFillProperties(); - aFill.moFillType = XML_solidFill; - // This is supposed to fill with slide (background) color, but - // TODO: We are using white here, because thats the closest we can assume (?) - aFill.maFillColor.setSrgbClr( API_RGB_WHITE ); + const oox::drawingml::FillPropertiesPtr pBackgroundPropertiesPtr = mpSlidePersistPtr->getBackgroundProperties(); + if ( pBackgroundPropertiesPtr ) { + pShape->getFillProperties().assignUsed( *pBackgroundPropertiesPtr ); + } } pShape->setModelId(rAttribs.getString( XML_modelId ).get()); return new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, pShape ); diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 5a27ea3..ed80535 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -166,9 +166,8 @@ SlideFragmentHandler::~SlideFragmentHandler() if( mpSlidePersistPtr->getTheme() ) pFillProperties = mpSlidePersistPtr->getTheme()->getFillStyle( rAttribs.getInteger( XML_idx, -1 ) ); FillPropertiesPtr pFillPropertiesPtr( pFillProperties ? new FillProperties( *pFillProperties ) : new FillProperties() ); - ContextHandlerRef ret = new ColorContext( *this, mpSlidePersistPtr->getBackgroundColor() ); mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); - return ret; + return this; } break; diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 82d0f9f..45e7b4a 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -166,8 +166,7 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase ) { if ( mpBackgroundPropertiesPtr ) { - sal_Int32 nPhClr = maBackgroundColor.isUsed() ? - maBackgroundColor.getColor( rFilterBase.getGraphicHelper() ) : API_RGB_TRANSPARENT; + sal_Int32 nPhClr = mpBackgroundPropertiesPtr->getBestSolidColor().getColor( rFilterBase.getGraphicHelper() ); ::oox::drawingml::ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() ); mpBackgroundPropertiesPtr->pushToPropMap( aPropMap, rFilterBase.getGraphicHelper(), 0, nPhClr ); diff --git a/sd/qa/unit/data/pptx/tdf93868.pptx b/sd/qa/unit/data/pptx/tdf93868.pptx new file mode 100644 index 0000000..f54fb04 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf93868.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 8f4685b..257aef8 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -108,6 +108,7 @@ public: void testRowHeight(); void testTdf93830(); void testTdf93097(); + void testTdf93868(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -150,6 +151,7 @@ public: CPPUNIT_TEST(testRowHeight); CPPUNIT_TEST(testTdf93830); CPPUNIT_TEST(testTdf93097); + CPPUNIT_TEST(testTdf93868); CPPUNIT_TEST_SUITE_END(); }; @@ -1309,6 +1311,19 @@ void SdImportTest::testTdf93097() xDocShRef->DoClose(); } +void SdImportTest::testTdf93868() +{ + sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf93868.pptx"), PPTX); + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); + const SdrPage *pPage = &(pDoc->GetPage(1)->TRG_GetMasterPage()); + CPPUNIT_ASSERT_EQUAL(size_t(5), pPage->GetObjCount()); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, dynamic_cast<const XFillStyleItem&>(pPage->GetObj(0)->GetMergedItem(XATTR_FILLSTYLE)).GetValue()); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, dynamic_cast<const XFillStyleItem&>(pPage->GetObj(1)->GetMergedItem(XATTR_FILLSTYLE)).GetValue()); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); commit 8d0455e4bba7516550227326c32c46273ffa00da Author: Akshay Deep <akshaydeepi...@gmail.com> Date: Mon Mar 7 08:45:54 2016 +0400 tdf#94760 Better default values for graphics cache Changed Total Graphic Cache Size to 64 Mb. Changed Object Cache Size to 12 Mb. Change-Id: I772b92f9412ccbf40c1df4e4182dcff6d634b7de Reviewed-on: https://gerrit.libreoffice.org/22967 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> (cherry picked from commit 75c272c146045235783e1dfe26a162a8f4dee493) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index dc68cac..a49312f 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -1486,7 +1486,7 @@ objects.</desc> <label>Total Graphic Cache Size</label> </info> - <value>22000000</value> + <value>67110000</value> </prop> <prop oor:name="ObjectCacheSize" oor:type="xs:int" oor:nillable="false"> <info> @@ -1494,7 +1494,7 @@ object.</desc> <label>Graphic Object Cache Size</label> </info> - <value>5500000</value> + <value>12600000</value> </prop> <prop oor:name="ObjectReleaseTime" oor:type="xs:int" oor:nillable="false"> <info> commit 4a4839d93111b90dd1da95be74c35709e0a9a9a2 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Mar 24 00:27:51 2016 +0100 don't allocate and destroy a LocaleDataItem for each cell, tdf#97989 Reviewed-on: https://gerrit.libreoffice.org/23480 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> (cherry picked from commit 7da3a53958695bfb1405fa513f71beddc6c0ecb7) Change-Id: I8bcdc7a42c87d17fde1dc9c79bc361bb625f992b diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx index d644859..f2e7675 100644 --- a/include/unotools/localedatawrapper.hxx +++ b/include/unotools/localedatawrapper.hxx @@ -28,6 +28,7 @@ #include <unotools/readwritemutexguard.hxx> #include <unotools/unotoolsdllapi.h> #include <memory> +#include <map> namespace com { namespace sun { namespace star { namespace uno { @@ -74,6 +75,11 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper bool bLocaleDataItemValid; bool bReservedWordValid; mutable ::utl::ReadWriteMutex aMutex; + struct Locale_Compare + { + bool operator()(const css::lang::Locale& rLocale1, const css::lang::Locale& rLocale2) const; + }; + mutable std::map<css::lang::Locale, css::i18n::LocaleDataItem, Locale_Compare> maDataItemCache; // dummies, to be implemented or provided by XML locale data sal_Unicode cCurrZeroChar; diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index c0376ea..0c8ac2b 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1724,7 +1724,7 @@ bool ScColumn::ParseString( if (!pLocale) break; - LocaleDataItem aLocaleItem = pLocale->getLocaleItem(); + const LocaleDataItem& aLocaleItem = pLocale->getLocaleItem(); const OUString& rDecSep = aLocaleItem.decimalSeparator; const OUString& rGroupSep = aLocaleItem.thousandSeparator; if (rDecSep.getLength() != 1 || rGroupSep.getLength() != 1) diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 45c96ba..318e823 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -63,6 +63,21 @@ namespace {}; } +bool LocaleDataWrapper::Locale_Compare::operator()(const css::lang::Locale& rLocale1, const css::lang::Locale& rLocale2) const +{ + if (rLocale1.Language < rLocale2.Language) + return true; + else if (rLocale1.Language > rLocale2.Language) + return false; + + if (rLocale1.Country < rLocale2.Country) + return true; + else if (rLocale1.Country > rLocale2.Country) + return false; + + return rLocale1.Variant < rLocale2.Variant; +} + sal_uInt8 LocaleDataWrapper::nLocaleDataChecking = 0; LocaleDataWrapper::LocaleDataWrapper( @@ -159,15 +174,30 @@ void LocaleDataWrapper::invalidateData() ::com::sun::star::i18n::LocaleDataItem LocaleDataWrapper::getLocaleItem() const { + { + ::utl::ReadWriteGuard aGuard( aMutex ); + const css::lang::Locale& rLocal = getMyLocale(); + auto itr = maDataItemCache.find(rLocal); + if (itr != maDataItemCache.end()) + return itr->second; + } + try { - return xLD->getLocaleItem( getMyLocale() ); + ::utl::ReadWriteGuard aGuard( aMutex ); + + const css::lang::Locale& rLocal = getMyLocale(); + css::i18n::LocaleDataItem aItem = xLD->getLocaleItem( rLocal ); + auto aRet = maDataItemCache.insert(std::make_pair(rLocal, aItem)); + assert(aRet.second); + return aRet.first->second; } catch (const Exception& e) { SAL_WARN( "unotools.i18n", "getLocaleItem: Exception caught " << e.Message ); } - return ::com::sun::star::i18n::LocaleDataItem(); + static css::i18n::LocaleDataItem aEmptyItem; + return aEmptyItem; } ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency2 > LocaleDataWrapper::getAllCurrencies() const commit 292e525d287d97868b06f37732079128ae0ee2fa Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Mar 24 12:42:52 2016 +0100 don't sanitize value to an insane value, tdf#97863 Change-Id: I0e4de6b676fb61536dadefc96a719cf50be128ed (cherry picked from commit 6aa836329d17bf0aca4aead6bb9c35a6783ec215) diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index fce7ba4..73c5829 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -283,7 +283,10 @@ XclImpExtName::MOper::MOper(svl::SharedStringPool& rPool, XclImpStream& rStrm) : { SAL_WARN("sc", "Parsing error: " << nMaxRows << " max possible rows, but " << nLastRow << " index claimed, truncating"); - nLastRow = nMaxRows-1; + if (nMaxRows > 0) + nLastRow = nMaxRows-1; + else + return; } mxCached->Resize(nLastCol+1, nLastRow+1); commit c2064f99b97f9d7e3806c09d3eb0df8eae257c86 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Apr 4 12:26:11 2016 +0200 tdf#99074 DOCX import: handle <w:view w:val="web"/> Instead of always using the Normal view, use the Web view when the DOCX file contains Web Layout. For this to work, expose sw's DocumentSettingId::BROWSE_MODE via css.document.Settings. Reviewed-on: https://gerrit.libreoffice.org/23806 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit e0f9bb795251d950b5dd960fcd030170c8eb67aa) Change-Id: I7787ca058d8cb8a346b2001a2bd70c3df86d8673 diff --git a/sw/qa/extras/ooxmlimport/data/tdf99074.docx b/sw/qa/extras/ooxmlimport/data/tdf99074.docx new file mode 100644 index 0000000..d7be418 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf99074.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 0b1487a..4a362c3 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2938,6 +2938,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf99140, "tdf99140.docx") CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::LEFT_AND_WIDTH, getProperty<sal_Int16>(xTableProperties, "HoriOrient")); } +DECLARE_OOXMLIMPORT_TEST(testTdf99074, "tdf99074.docx") +{ + uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference<uno::XInterface> xSettings = xFactory->createInstance("com.sun.star.document.Settings"); + // This was false, Web Layout was ignored on import. + CPPUNIT_ASSERT(getProperty<bool>(xSettings, "InBrowseMode")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index a6e454e..8b7083a 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -131,6 +131,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, HANDLE_SUBTRACT_FLYS, + HANDLE_BROWSE_MODE, }; static MasterPropertySetInfo * lcl_createSettingsInfo() @@ -206,6 +207,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0, 0}, { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0, 0}, { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0, 0}, + { OUString("InBrowseMode"), HANDLE_BROWSE_MODE, cppu::UnoType<bool>::get(), 0}, /* * As OS said, we don't have a view when we need to set this, so I have to * find another solution before adding them to this property set - MTG @@ -847,6 +849,15 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } } break; + case HANDLE_BROWSE_MODE: + { + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, bTmp); + } + } + break; default: throw UnknownPropertyException(); } @@ -1253,6 +1264,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS); } break; + case HANDLE_BROWSE_MODE: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE); + } + break; default: throw UnknownPropertyException(); } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 2906e24..856ab75 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4985,6 +4985,10 @@ void DomainMapper_Impl::ApplySettingsTable() if( m_pSettingsTable->GetEmbedSystemFonts()) xSettings->setPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_EMBED_SYSTEM_FONTS ), uno::makeAny(true) ); xSettings->setPropertyValue("AddParaTableSpacing", uno::makeAny(m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing())); + + // Web Layout. + if (m_pSettingsTable->GetView() == NS_ooxml::LN_Value_doc_ST_View_web) + xSettings->setPropertyValue("InBrowseMode", uno::makeAny(true)); } catch(const uno::Exception&) { commit fdb04adc44fc1f1ff85390e55730f78d6c644e41 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Apr 7 08:20:12 2016 +0200 we need the position in the formula converter, tdf#99093 Reviewed-on: https://gerrit.libreoffice.org/23884 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> (cherry picked from commit e214df32fb3637bd7810a299fb8b38810b1a3874) Change-Id: Ic3dd13aa4d4b8190b78f3e6f1cdda844e39cc719 diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 9613019..69e77b5 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -768,35 +768,21 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm ) rStrm.SetNulSubstChar( '\n' ); ::std::unique_ptr< ScTokenArray > xTokArr1; - sal_uInt16 nLen = 0; - nLen = rStrm.ReaduInt16(); + // We can't import the formula directly because we need the range + sal_uInt16 nLenFormula1 = rStrm.ReaduInt16(); rStrm.Ignore( 2 ); - if( nLen > 0 ) - { - const ScTokenArray* pTokArr = 0; - rFmlaConv.Reset(); - rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_CondFormat ); - // formula converter owns pTokArr -> create a copy of the token array - if( pTokArr ) - xTokArr1.reset( pTokArr->Clone() ); - } - rStrm.SetNulSubstChar(); // back to default + XclImpStreamPos aPosFormula1; + rStrm.StorePosition(aPosFormula1); + rStrm.Ignore(nLenFormula1); // second formula ::std::unique_ptr< ScTokenArray > xTokArr2; - nLen = 0; - nLen = rStrm.ReaduInt16(); + sal_uInt16 nLenFormula2 = rStrm.ReaduInt16(); rStrm.Ignore( 2 ); - if( nLen > 0 ) - { - const ScTokenArray* pTokArr = 0; - rFmlaConv.Reset(); - rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_CondFormat ); - // formula converter owns pTokArr -> create a copy of the token array - if( pTokArr ) - xTokArr2.reset( pTokArr->Clone() ); - } + XclImpStreamPos aPosFormula2; + rStrm.StorePosition(aPosFormula2); + rStrm.Ignore(nLenFormula2); // read all cell ranges XclRangeList aXclRanges; @@ -810,6 +796,34 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm ) if ( aScRanges.empty() ) return; + ScRange aCombinedRange = aScRanges.Combine(); + + XclImpStreamPos aCurrentPos; + rStrm.StorePosition(aCurrentPos); + rStrm.RestorePosition(aPosFormula1); + if( nLenFormula1 > 0 ) + { + const ScTokenArray* pTokArr = nullptr; + rFmlaConv.Reset(aCombinedRange.aStart); + rFmlaConv.Convert( pTokArr, rStrm, nLenFormula1, false, FT_CondFormat ); + // formula converter owns pTokArr -> create a copy of the token array + if( pTokArr ) + xTokArr1.reset( pTokArr->Clone() ); + } + rStrm.SetNulSubstChar(); // back to default + if (nLenFormula2 > 0) + { + rStrm.RestorePosition(aPosFormula2); + const ScTokenArray* pTokArr = nullptr; + rFmlaConv.Reset(aCombinedRange.aStart); + rFmlaConv.Convert( pTokArr, rStrm, nLenFormula2, false, FT_CondFormat ); + // formula converter owns pTokArr -> create a copy of the token array + if( pTokArr ) + xTokArr2.reset( pTokArr->Clone() ); + } + + rStrm.RestorePosition(aCurrentPos); + bool bIsValid = true; // valid settings in flags field ScValidationMode eValMode = SC_VALID_ANY; commit d2f262ba4105d7c6d8c30e46f64fc4949e7884fe Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Apr 9 09:36:45 2016 +0200 import all formatting properties for column style, tdf#96549 Reviewed-on: https://gerrit.libreoffice.org/23932 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> (cherry picked from commit e8322dffb4dfc7015ee0842f133b79080eb2b0d8) Change-Id: I782f3ea7cfa9af335bd117b9f4ad6ac9c719115b diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx index 5701244..6b78bc0 100644 --- a/sc/source/filter/inc/stylesbuffer.hxx +++ b/sc/source/filter/inc/stylesbuffer.hxx @@ -678,7 +678,7 @@ public: /** Writes all formatting attributes to the passed property set. */ void writeToPropertySet( PropertySet& rPropSet ) const; - void writeToDoc( ScDocumentImport& rDoc, const css::table::CellRangeAddress& rRange ) const; + void writeToDoc( ScDocumentImport& rDoc, const css::table::CellRangeAddress& rRange ); const ::ScPatternAttr& createPattern( bool bSkipPoolDefs = false ); diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index bf63786..88a4a86 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -2252,7 +2252,7 @@ void Xf::writeToPropertySet( PropertySet& rPropSet ) const rPropSet.setProperties( aPropMap ); } -void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& rRange ) const +void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& rRange ) { const StylesBuffer& rStyles = getStyles(); @@ -2273,22 +2273,9 @@ void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& rRan } } - boost::scoped_ptr<ScPatternAttr> pAttr(new ScPatternAttr(rDoc.getDoc().GetPool())); - - { - SvxRotateMode eRotateMode = SVX_ROTATE_MODE_STANDARD; - - if (maModel.mbBorderUsed && rStyles.hasBorder(maModel.mnBorderId) && maAlignment.getApiData().mnRotation) - eRotateMode = SVX_ROTATE_MODE_BOTTOM; - - SvxRotateModeItem aItem(eRotateMode, ATTR_ROTATE_MODE); - ScfTools::PutItem(pAttr->GetItemSet(), aItem, false); - } - - // TODO : Move more properties from writeToPropertyMap(). - + const ScPatternAttr& rAttr = createPattern(); rDoc.getDoc().ApplyPatternAreaTab( - rRange.StartColumn, rRange.StartRow, rRange.EndColumn, rRange.EndRow, rRange.Sheet, *pAttr); + rRange.StartColumn, rRange.StartRow, rRange.EndColumn, rRange.EndRow, rRange.Sheet, rAttr); } const ::ScPatternAttr& commit 9e65f1bfa3407f234fba9f82c53ca650ca218c88 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Apr 12 09:18:47 2016 +0200 tdf#99135 VML import: handle image crop The spec says in theory a % suffix could be also supported, but let's wait till that is seen in a real-world document. Change-Id: Ie026915e38dcb03c99085a1740075364b00e1c8d (cherry picked from commit bb646c1472d3b77066b01128baf1c9cafdb40233) diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index e4b5c92..3aba0ca 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -104,6 +104,10 @@ struct OOX_DLLPUBLIC ShapeTypeModel OUString maWrapDistanceRight; ///< Distance from the right side of the shape to the text that wraps around it. OUString maWrapDistanceTop; ///< Distance from the top of the shape to the text that wraps around it. OUString maWrapDistanceBottom; ///< Distance from the bottom of the shape to the text that wraps around it. + OptValue<OUString> moCropBottom; ///< Specifies the how much to crop the image from the bottom up as a fraction of picture size. + OptValue<OUString> moCropLeft; ///< Specifies how much to crop the image from the left in as a fraction of picture size. + OptValue<OUString> moCropRight; ///< Specifies how much to crop the image from the right in as a fraction of picture size. + OptValue<OUString> moCropTop; ///< Specifies how much to crop the image from the top down as a fraction of picture size. OUString maLayoutFlowAlt; ///< Specifies the alternate layout flow for text in textboxes. explicit ShapeTypeModel(); diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index aa07015..169f5bd 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/text/XTextFrame.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/GraphicCrop.hpp> #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> #include <svx/svdtrans.hxx> @@ -106,6 +107,19 @@ awt::Rectangle lclGetAbsRect( const awt::Rectangle& rRelRect, const awt::Rectang return aAbsRect; } +/// Count the crop value based on a crop fraction and a reference size. +sal_Int32 lclConvertCrop(const OUString& rCrop, sal_uInt32 nSize) +{ + if (rCrop.endsWith("f")) + { + // Numeric value is specified in 1/65536-ths. + sal_uInt32 nCrop = rCrop.copy(0, rCrop.getLength() - 1).toUInt32(); + return (nCrop * nSize) / 65536; + } + + return 0; +} + } // namespace ShapeTypeModel::ShapeTypeModel(): @@ -848,6 +862,25 @@ Reference< XShape > SimpleShape::createPictureObject( const Reference< XShapes > const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); lcl_SetAnchorType(aPropSet, maTypeModel, rGraphicHelper); + + if (maTypeModel.moCropBottom.has() || maTypeModel.moCropLeft.has() || maTypeModel.moCropRight.has() || maTypeModel.moCropTop.has()) + { + text::GraphicCrop aGraphicCrop; + uno::Reference<graphic::XGraphic> xGraphic; + aPropSet.getProperty(xGraphic, PROP_Graphic); + awt::Size aOriginalSize = rGraphicHelper.getOriginalSize(xGraphic); + + if (maTypeModel.moCropBottom.has()) + aGraphicCrop.Bottom = lclConvertCrop(maTypeModel.moCropBottom.get(), aOriginalSize.Height); + if (maTypeModel.moCropLeft.has()) + aGraphicCrop.Left = lclConvertCrop(maTypeModel.moCropLeft.get(), aOriginalSize.Width); + if (maTypeModel.moCropRight.has()) + aGraphicCrop.Right = lclConvertCrop(maTypeModel.moCropRight.get(), aOriginalSize.Width); + if (maTypeModel.moCropTop.has()) + aGraphicCrop.Top = lclConvertCrop(maTypeModel.moCropTop.get(), aOriginalSize.Height); + + aPropSet.setProperty(PROP_GraphicCrop, aGraphicCrop); + } } return xShape; } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 4ea10e8..c5a0810 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -347,6 +347,12 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A bool bHasORelId = rAttribs.hasAttribute( O_TOKEN( relid ) ); mrTypeModel.moGraphicPath = decodeFragmentPath( rAttribs, bHasORelId ? O_TOKEN( relid ) : R_TOKEN( id ) ); mrTypeModel.moGraphicTitle = rAttribs.getString( O_TOKEN( title ) ); + + // Get crop attributes. + mrTypeModel.moCropBottom = rAttribs.getString(XML_cropbottom); + mrTypeModel.moCropLeft = rAttribs.getString(XML_cropleft); + mrTypeModel.moCropRight = rAttribs.getString(XML_cropright); + mrTypeModel.moCropTop = rAttribs.getString(XML_croptop); } break; case NMSP_vmlWord | XML_wrap: diff --git a/sw/qa/extras/ooxmlimport/data/tdf99135.docx b/sw/qa/extras/ooxmlimport/data/tdf99135.docx new file mode 100644 index 0000000..7ac3836 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf99135.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 39c469a..0b1487a 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2085,6 +2085,12 @@ DECLARE_OOXMLIMPORT_TEST(testPictureWithSchemeColor, "picture-with-schemecolor.d Bitmap::ReleaseAccess(pAccess); } +DECLARE_OOXMLIMPORT_TEST(testTdf99135, "tdf99135.docx") +{ + // This was 0, crop was ignored on VML import. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1825), getProperty<text::GraphicCrop>(getShape(1), "GraphicCrop").Bottom); +} + DECLARE_OOXMLIMPORT_TEST(testFdo69656, "Table_cell_auto_width_fdo69656.docx") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); commit 3dae33bd19062c2328464f6d48a9ee0869679b58 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri Mar 25 20:26:52 2016 +0100 use the ScRefCellValue already available, tdf#97989 Change-Id: Iccfff23f72d33ee012f91a230f2598b8fe3131cf Reviewed-on: https://gerrit.libreoffice.org/23514 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> (cherry picked from commit 007b317fef91aa809deff8380a9e62c350eaf511) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d0c0836..57667ff 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1964,7 +1964,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt if ( bFixedWidth || bSaveAsShown ) { Color* pDummy; - aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter); + ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &aDocument); bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat); } else @@ -1979,7 +1979,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt { sal_uInt32 nFormat = aDocument.GetNumberFormat(aPos); Color* pDummy; - aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter); + ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &aDocument); } else aString = pCell->mpFormula->GetString().getString(); @@ -1992,7 +1992,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt { sal_uInt32 nFormat = aDocument.GetNumberFormat(aPos); Color* pDummy; - aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter); + ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &aDocument); } else aString = pCell->mpString->getString(); @@ -2014,7 +2014,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt if ( bFixedWidth || bSaveAsShown ) { Color* pDummy; - aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter); + ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &aDocument); bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat); } else commit afd2095bd2acd201ff125959b41550f39303cee5 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Apr 14 08:08:04 2016 +0200 Related: tdf#65642 RTF filter: import \pgnucrm This as a side effect also implements support for DOCX <w:pgNumType w:fmt="upperRoman" .../>. Reviewed-on: https://gerrit.libreoffice.org/24073 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit 235dcc11e7e5291188e134f37a03849d741c4f6e) Change-Id: Ibf3bedca03c6c2a2b96eecb36ff6c4cf6e2281b4 diff --git a/sw/qa/extras/rtfexport/data/pgnucrm.rtf b/sw/qa/extras/rtfexport/data/pgnucrm.rtf new file mode 100644 index 0000000..ce0bbf2 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/pgnucrm.rtf @@ -0,0 +1,23 @@ +{\rtf1 +\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 +{\field\fldedit +{\*\fldinst +{ PAGE \\* MERGEFORMAT } +} +{\fldrslt +{1} +} +} +\sect +\sectd\pgnrestart\pgnucrm +{\field\fldedit +{\*\fldinst +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid525329 PAGE \\* MERGEFORMAT } +} +{\fldrslt +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid9597790 A} +} +} +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid13321744 +\par } +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index ed9fa08..d845e09 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -941,6 +941,12 @@ DECLARE_RTFEXPORT_TEST(testPgnlcrm, "pgnlcrm.rtf") CPPUNIT_ASSERT_EQUAL(style::NumberingType::ROMAN_LOWER, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType")); } +DECLARE_RTFEXPORT_TEST(testPgnucrm, "pgnucrm.rtf") +{ + // The second page's numbering type: this was style::NumberingType::ARABIC. + CPPUNIT_ASSERT_EQUAL(style::NumberingType::ROMAN_UPPER, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index b854682..a6f9c45 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -983,6 +983,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) // i, ii, ... pSectionContext->SetPageNumberType(style::NumberingType::ROMAN_LOWER); break; + case NS_ooxml::LN_Value_ST_NumberFormat_upperRoman: + // I, II, ... + pSectionContext->SetPageNumberType(style::NumberingType::ROMAN_UPPER); + break; } } break; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index d02739e..5cdc8e9 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3244,7 +3244,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue); } break; - case RTF_PGNUCRM: case RTF_PGNLCLTR: case RTF_PGNBIDIA: case RTF_PGNBIDIB: @@ -3567,6 +3566,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); } break; + case RTF_PGNUCRM: + { + auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_upperRoman); + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } + break; default: { SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); commit 7aa6e7584464abde91be91d61d66dc6ecd7082d1 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Apr 21 08:36:20 2016 +0200 Related: tdf#65642 RTF filter: import \pgnlcrm This as a side effect also implements support for DOCX <w:pgNumType w:fmt="lowerRoman" .../>. Reviewed-on: https://gerrit.libreoffice.org/24273 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit 91b18cee97b110fe60391faa945a6fd166f1d8aa) Change-Id: Ifb524b25236a8bc774690266a4fa205154204109 diff --git a/sw/qa/extras/rtfexport/data/pgnlcrm.rtf b/sw/qa/extras/rtfexport/data/pgnlcrm.rtf new file mode 100644 index 0000000..4ef9b61 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/pgnlcrm.rtf @@ -0,0 +1,23 @@ +{\rtf1 +\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 +{\field\fldedit +{\*\fldinst +{ PAGE \\* MERGEFORMAT } +} +{\fldrslt +{1} +} +} +\sect +\sectd\pgnrestart\pgnlcrm +{\field\fldedit +{\*\fldinst +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid525329 PAGE \\* MERGEFORMAT } +} +{\fldrslt +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid9597790 i} +} +} +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid13321744 +\par } +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index cda0b35..ed9fa08 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -935,6 +935,12 @@ DECLARE_RTFEXPORT_TEST(testPgndec, "pgndec.rtf") CPPUNIT_ASSERT_EQUAL(style::NumberingType::ARABIC, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType")); } +DECLARE_RTFEXPORT_TEST(testPgnlcrm, "pgnlcrm.rtf") +{ + // The second page's numbering type: this was style::NumberingType::ARABIC. + CPPUNIT_ASSERT_EQUAL(style::NumberingType::ROMAN_LOWER, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 7669dfa..b854682 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -979,6 +979,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) // A, B, ... pSectionContext->SetPageNumberType(style::NumberingType::CHARS_UPPER_LETTER_N); break; + case NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman: + // i, ii, ... + pSectionContext->SetPageNumberType(style::NumberingType::ROMAN_LOWER); + break; } } break; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e5e8f16..d02739e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3245,7 +3245,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } break; case RTF_PGNUCRM: - case RTF_PGNLCRM: case RTF_PGNLCLTR: case RTF_PGNBIDIA: case RTF_PGNBIDIB: @@ -3562,6 +3561,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); } break; + case RTF_PGNLCRM: + { + auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman); + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } + break; default: { SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); commit 40be6ee10a64ea1546579cdef9241ddc0381fe0d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Apr 26 09:33:56 2016 +0200 tdf#90097 RTF import: handle fRelFlipV property for line shapes Can be extended later in every direction: fFlipV, fRelFlipH, non-line shapes. See oox::drawingml::Shape::createAndInsert() on why the convertMm100ToTwip() conversion is necessary. Change-Id: Ifee401dd8dd392c2c9ff85cc871ca0169fcf930b Reviewed-on: https://gerrit.libreoffice.org/24385 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit 6046062719f30849cd97161c6a89d27a0b0d2a20) diff --git a/sw/qa/extras/rtfimport/data/tdf90097.rtf b/sw/qa/extras/rtfimport/data/tdf90097.rtf new file mode 100644 index 0000000..7764fa1 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf90097.rtf @@ -0,0 +1,162 @@ +{\rtf1\ansi\ansicpg1250\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1029\deflangfe1029 +{\shpgrp +{\*\shpinst\shpleft1008\shptop0\shpright2880\shpbottom1920\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn groupLeft} +{\sv 0} +} +{\sp +{\sn groupTop} +{\sv 0} +} +{\sp +{\sn groupRight} +{\sv 1872} +} +{\sp +{\sn groupBottom} +{\sv 1920} +} +{\sp +{\sn fFlipH} +{\sv 0} +} +{\sp +{\sn fFlipV} +{\sv 0} +} +{\sp +{\sn lidRegroup} +{\sv 0} +} +{\sp +{\sn posrelh} +{\sv 2} +} +{\sp +{\sn posrelv} +{\sv 2} +} +{\sp +{\sn fLayoutInCell} +{\sv 0} +} +{\sp +{\sn fLayoutInCell} +{\sv 0} +} +{\shp +{\*\shpinst\shplid1060 +{\sp +{\sn relLeft} +{\sv 393} +} +{\sp +{\sn relTop} +{\sv 201} +} +{\sp +{\sn relRight} +{\sv 755} +} +{\sp +{\sn relBottom} +{\sv 544} +} +{\sp +{\sn fRelFlipH} +{\sv 0} +} +{\sp +{\sn fRelFlipV} +{\sv 1} +} +{\sp +{\sn shapeType} +{\sv 20} +} +{\sp +{\sn shapePath} +{\sv 4} +} +{\sp +{\sn fFilled} +{\sv 0} +} +{\sp +{\sn lineWidth} +{\sv 7400} +} +{\sp +{\sn fLine} +{\sv 1} +} +{\sp +{\sn fLayoutInCell} +{\sv 0} +} +{\sp +{\sn fLayoutInCell} +{\sv 0} +} +} +} +{\shp +{\*\shpinst\shplid1061 +{\sp +{\sn relLeft} +{\sv 755} +} +{\sp +{\sn relTop} +{\sv 201} +} +{\sp +{\sn relRight} +{\sv 1117} +} +{\sp +{\sn relBottom} +{\sv 544} +} +{\sp +{\sn fRelFlipH} +{\sv 0} +} +{\sp +{\sn fRelFlipV} +{\sv 0} +} +{\sp +{\sn shapeType} +{\sv 20} +} +{\sp +{\sn shapePath} +{\sv 4} +} +{\sp +{\sn fFilled} +{\sv 0} +} +{\sp +{\sn lineWidth} +{\sv 7400} +} +{\sp +{\sn fLine} +{\sv 1} +} +{\sp +{\sn fLayoutInCell} +{\sv 0} +} +{\sp +{\sn fLayoutInCell} +{\sv 0} +} +} +} +} +} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 4236a48..642878f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2403,6 +2403,25 @@ DECLARE_RTFIMPORT_TEST(testTdf65642, "tdf65642.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty<sal_Int32>(getParagraph(2), "PageNumberOffset")); } +#ifndef WNT +DECLARE_RTFIMPORT_TEST(testTdf90097, "tdf90097.rtf") +{ + // Get the second child of the group shape. + uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xShape(xGroup->getByIndex(1), uno::UNO_QUERY); + uno::Sequence< uno::Sequence<awt::Point> > aPolyPolySequence; + xShape->getPropertyValue("PolyPolygon") >>= aPolyPolySequence; + uno::Sequence<awt::Point>& rPolygon = aPolyPolySequence[0]; + // Vertical flip for the line shape was ignored, so Y coordinates were swapped. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2819), rPolygon[0].X); + // This was 1619. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1963), rPolygon[0].Y); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3181), rPolygon[1].X); + // This was 1962. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1620), rPolygon[1].Y); +} +#endif + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk index c81ff56..5ec43d2 100644 --- a/writerfilter/Library_writerfilter.mk +++ b/writerfilter/Library_writerfilter.mk @@ -35,6 +35,7 @@ $(eval $(call gb_Library_add_defs,writerfilter,\ )) $(eval $(call gb_Library_use_libraries,writerfilter,\ + basegfx \ comphelper \ cppu \ cppuhelper \ diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index fcc20d4..32846ed 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -33,6 +33,7 @@ #include <oox/drawingml/shapepropertymap.hxx> #include <oox/helper/propertyset.hxx> #include <boost/logic/tribool.hpp> +#include <basegfx/matrix/b2dhommatrix.hxx> using namespace com::sun::star; @@ -346,6 +347,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap boost::optional<sal_Int16> oRelativeWidth, oRelativeHeight; sal_Int16 nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME; sal_Int16 nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME; + boost::logic::tribool obRelFlipV(boost::logic::indeterminate); bool bCustom(false); int const nType = initShape(xShape, xPropertySet, bCustom, rShape, bClose, shapeOrPict); @@ -778,6 +780,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap while (nCharIndex >= 0); rShape.aWrapPolygonSprms = aPolygonSprms; } + else if (i->first == "fRelFlipV") + obRelFlipV = i->second.toInt32() == 1; else SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'"); } @@ -836,6 +840,33 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap } if (!aGeometry.empty() && xPropertySet.is() && !m_bTextFrame) xPropertySet->setPropertyValue("CustomShapeGeometry", uno::Any(comphelper::containerToSequence(aGeometry))); + if (!boost::logic::indeterminate(obRelFlipV) && xPropertySet.is()) + { + if (nType == ESCHER_ShpInst_Line) + { + // Line shape inside group shape: get the polygon sequence and transform it. + uno::Sequence< uno::Sequence<awt::Point> > aPolyPolySequence; + if ((xPropertySet->getPropertyValue("PolyPolygon") >>= aPolyPolySequence) && aPolyPolySequence.hasElements()) + { + uno::Sequence<awt::Point>& rPolygon = aPolyPolySequence[0]; + basegfx::B2DPolygon aPoly; + for (sal_Int32 i = 0; i < rPolygon.getLength(); ++i) + { + const awt::Point& rPoint = rPolygon[i]; + aPoly.insert(i, basegfx::B2DPoint(rPoint.X, rPoint.Y)); + } + basegfx::B2DHomMatrix aTransformation; + aTransformation.scale(1.0, obRelFlipV ? -1.0 : 1.0); + aPoly.transform(aTransformation); + for (sal_Int32 i = 0; i < rPolygon.getLength(); ++i) + { + basegfx::B2DPoint aPoint(aPoly.getB2DPoint(i)); + rPolygon[i] = awt::Point(static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getX())), static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getY()))); + } + xPropertySet->setPropertyValue("PolyPolygon", uno::makeAny(aPolyPolySequence)); + } + } + } // Set position and size if (xShape.is()) commit 0380e89ca16906ae41219244ba7d419a9d126912 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Sat Apr 23 20:34:57 2016 +0200 Related: tdf#65642 RTF filter: import \pgndec This as a side effect also implements support for DOCX <w:pgNumType w:fmt="decimal" .../>. Reviewed-on: https://gerrit.libreoffice.org/24457 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit b94d753ac9e3894da055d31bbb7bb20e11b97b5a) Change-Id: I747c3f610dc13f614b6f962c2a498c987765ebb6 diff --git a/sw/qa/extras/rtfexport/data/pgndec.rtf b/sw/qa/extras/rtfexport/data/pgndec.rtf new file mode 100644 index 0000000..7f38c69 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/pgndec.rtf @@ -0,0 +1,23 @@ +{\rtf1 +\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 +{\field\fldedit +{\*\fldinst +{ PAGE \\* MERGEFORMAT } +} +{\fldrslt +{1} +} +} +\sect +\sectd\pgnrestart\pgnlcrm\pgndec +{\field\fldedit +{\*\fldinst +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid525329 PAGE \\* MERGEFORMAT } +} +{\fldrslt +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid9597790 1} +} +} +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid13321744 +\par } +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index b650888..cda0b35 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -929,6 +929,12 @@ DECLARE_RTFEXPORT_TEST(testTdf96175, "tdf96175.rtf") CPPUNIT_ASSERT_EQUAL(OUString("foobar"), getProperty<OUString>(xUserDefinedProperties, "Company")); } +DECLARE_RTFEXPORT_TEST(testPgndec, "pgndec.rtf") +{ + // The second page's numbering type: this was style::NumberingType::ROMAN_LOWER. + CPPUNIT_ASSERT_EQUAL(style::NumberingType::ARABIC, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 61ff534..7669dfa 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -971,6 +971,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) { switch (nIntValue) { + case NS_ooxml::LN_Value_ST_NumberFormat_decimal: + // 1, 2, ... + pSectionContext->SetPageNumberType(style::NumberingType::ARABIC); + break; case NS_ooxml::LN_Value_ST_NumberFormat_upperLetter: // A, B, ... pSectionContext->SetPageNumberType(style::NumberingType::CHARS_UPPER_LETTER_N); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 799186d..e5e8f16 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3244,7 +3244,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue); } break; - case RTF_PGNDEC: case RTF_PGNUCRM: case RTF_PGNLCRM: case RTF_PGNLCLTR: @@ -3557,6 +3556,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); } break; + case RTF_PGNDEC: + { + auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_decimal); + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } + break; default: { SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits