include/xmloff/xmlexppr.hxx | 11 +++--- sc/source/filter/xml/xmlstyle.cxx | 4 +- sc/source/filter/xml/xmlstyle.hxx | 2 + xmloff/inc/XMLChartPropertySetMapper.hxx | 1 xmloff/source/chart/PropertyMaps.cxx | 3 + xmloff/source/draw/sdpropls.cxx | 6 ++- xmloff/source/draw/sdpropls.hxx | 2 + xmloff/source/style/PageMasterExportPropMapper.cxx | 3 + xmloff/source/style/PageMasterExportPropMapper.hxx | 1 xmloff/source/style/styleexp.cxx | 2 - xmloff/source/style/xmlexppr.cxx | 7 ++- xmloff/source/text/txtexppr.cxx | 38 ++++++++++++--------- xmloff/source/text/txtexppr.hxx | 2 + 13 files changed, 53 insertions(+), 29 deletions(-)
New commits: commit dc46c86f56e0573d13d6b8140ef1aaf6f0db7895 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Sep 4 15:35:18 2013 +0100 Resolves: fdo#68431 style:font-name unknown in non autostyles in impress/draw Reviewed-on: https://gerrit.libreoffice.org/5810 Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-e...@lanedo.com> Tested-by: Pierre-Eric Pelloux-Prayer <pierre-e...@lanedo.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit d87cb77b42b591b1333aacd60e107514d6e20864) Conflicts: xmloff/source/style/xmlexppr.cxx Change-Id: Ib904af4fac5659821ba3b5dbbf62370df8243001 Reviewed-on: https://gerrit.libreoffice.org/5988 Reviewed-by: Eike Rathke <er...@redhat.com> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/include/xmloff/xmlexppr.hxx b/include/xmloff/xmlexppr.hxx index 7e7bb76..66e83d3 100644 --- a/include/xmloff/xmlexppr.hxx +++ b/include/xmloff/xmlexppr.hxx @@ -59,10 +59,11 @@ protected: ::std::vector< XMLPropertyState > _Filter( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet, - const sal_Bool bDefault ) const; + bool bDefault, bool bDisableFoFontFamily) const; /** Application-specific filter. By default do nothing. */ virtual void ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const; @@ -111,8 +112,8 @@ public: filter-processes. */ ::std::vector< XMLPropertyState > Filter( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > rPropSet ) const - { return _Filter(rPropSet, sal_False); } + ::com::sun::star::beans::XPropertySet > rPropSet, bool bEnableFoFontFamily = false) const + { return _Filter(rPropSet, false, bEnableFoFontFamily); } /** Like Filter(), except that: * - only properties that have the map flag MID_FLAG_DEFAULT_ITEM_EXPORT @@ -121,8 +122,8 @@ public: */ ::std::vector< XMLPropertyState > FilterDefaults( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > rPropSet ) const - { return _Filter(rPropSet, sal_True); } + ::com::sun::star::beans::XPropertySet > rPropSet, bool bEnableFoFontFamily = false) const + { return _Filter(rPropSet, true, bEnableFoFontFamily); } /** Compare to arrays of XMLPropertyState */ sal_Bool Equals( const ::std::vector< XMLPropertyState >& aProperties1, diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index 6b4d8a1..3a5fe2b 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -186,6 +186,7 @@ ScXMLCellExportPropertyMapper::~ScXMLCellExportPropertyMapper() } void ScXMLCellExportPropertyMapper::ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, uno::Reference< beans::XPropertySet > rPropSet ) const { @@ -503,7 +504,7 @@ void ScXMLCellExportPropertyMapper::ContextFilter( pDiagonalBLTRWidthState->maValue.clear(); } - SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet); + SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet); } /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */ @@ -553,6 +554,7 @@ ScXMLRowExportPropertyMapper::~ScXMLRowExportPropertyMapper() } void ScXMLRowExportPropertyMapper::ContextFilter( + bool /* bEnableFoFontFamily */, ::std::vector< XMLPropertyState >& /* rProperties */, uno::Reference< beans::XPropertySet > /* rPropSet */ ) const { diff --git a/sc/source/filter/xml/xmlstyle.hxx b/sc/source/filter/xml/xmlstyle.hxx index e879ddf..888a093 100644 --- a/sc/source/filter/xml/xmlstyle.hxx +++ b/sc/source/filter/xml/xmlstyle.hxx @@ -106,6 +106,7 @@ class ScXMLCellExportPropertyMapper : public SvXMLExportPropertyMapper protected: /** Application-specific filter. By default do nothing. */ virtual void ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const; @@ -135,6 +136,7 @@ class ScXMLRowExportPropertyMapper : public SvXMLExportPropertyMapper protected: /** Application-specific filter. By default do nothing. */ virtual void ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const; diff --git a/xmloff/inc/XMLChartPropertySetMapper.hxx b/xmloff/inc/XMLChartPropertySetMapper.hxx index b5655c0..e2463e2 100644 --- a/xmloff/inc/XMLChartPropertySetMapper.hxx +++ b/xmloff/inc/XMLChartPropertySetMapper.hxx @@ -65,6 +65,7 @@ private: protected: virtual void ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const; diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 9962a09d..da81152 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -201,6 +201,7 @@ XMLChartExportPropertyMapper::~XMLChartExportPropertyMapper() } void XMLChartExportPropertyMapper::ContextFilter( + bool bEnableFoFontFamily, std::vector< XMLPropertyState >& rProperties, uno::Reference< beans::XPropertySet > rPropSet ) const { @@ -276,7 +277,7 @@ void XMLChartExportPropertyMapper::ContextFilter( } } - SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet); + SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet); } void XMLChartExportPropertyMapper::handleElementItem( diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 9fa89b3..8e243fa 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -1206,6 +1206,7 @@ XMLShapeExportPropertyMapper::~XMLShapeExportPropertyMapper() } void XMLShapeExportPropertyMapper::ContextFilter( + bool bEnableFoFontFamily, std::vector< XMLPropertyState >& rProperties, uno::Reference< beans::XPropertySet > rPropSet ) const { @@ -1526,7 +1527,7 @@ void XMLShapeExportPropertyMapper::ContextFilter( if( pClipState != NULL && pClip11State != NULL ) pClip11State->mnIndex = -1; - SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet); + SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet); } void XMLShapeExportPropertyMapper::handleSpecialItem( @@ -1589,6 +1590,7 @@ XMLPageExportPropertyMapper::~XMLPageExportPropertyMapper() } void XMLPageExportPropertyMapper::ContextFilter( + bool bEnableFoFontFamily, std::vector< XMLPropertyState >& rProperties, uno::Reference< beans::XPropertySet > rPropSet ) const { @@ -1733,7 +1735,7 @@ void XMLPageExportPropertyMapper::ContextFilter( pTransType->mnIndex = -1; } - SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet); + SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet); } void XMLPageExportPropertyMapper::handleElementItem( diff --git a/xmloff/source/draw/sdpropls.hxx b/xmloff/source/draw/sdpropls.hxx index 77bfe00..70ac1b7 100644 --- a/xmloff/source/draw/sdpropls.hxx +++ b/xmloff/source/draw/sdpropls.hxx @@ -260,6 +260,7 @@ private: protected: virtual void ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const; @@ -297,6 +298,7 @@ private: protected: virtual void ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const; diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx index db50eb6..961c5eb 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -310,6 +310,7 @@ void XMLPageMasterExportPropMapper::handleSpecialItem( } void XMLPageMasterExportPropMapper::ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rPropState, Reference< XPropertySet > rPropSet ) const { @@ -458,7 +459,7 @@ void XMLPageMasterExportPropMapper::ContextFilter( lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ZEROVALUES), "PrintZeroValues", rPropSet); } - SvXMLExportPropertyMapper::ContextFilter(rPropState,rPropSet); + SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rPropState, rPropSet); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/PageMasterExportPropMapper.hxx b/xmloff/source/style/PageMasterExportPropMapper.hxx index 0d24df5..78b0028 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.hxx +++ b/xmloff/source/style/PageMasterExportPropMapper.hxx @@ -35,6 +35,7 @@ protected: XMLFootnoteSeparatorExport aFootnoteSeparatorExport; virtual void ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const; diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index b9ca2ad..58991df 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -320,7 +320,7 @@ sal_Bool XMLStyleExport::exportStyle( // <style:properties> ::std::vector< XMLPropertyState > xPropStates = - rPropMapper->Filter( xPropSet ); + rPropMapper->Filter( xPropSet, true ); rPropMapper->exportXML( GetExport(), xPropStates, XML_EXPORT_FLAG_IGN_WS ); diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index c2c414b..6808db5 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -605,7 +605,7 @@ void SvXMLExportPropertyMapper::ChainExportMapper( vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter( const Reference< XPropertySet > xPropSet, - const sal_Bool bDefault ) const + bool bDefault, bool bEnableFoFontFamily) const { vector< XMLPropertyState > aPropStateArray; @@ -706,7 +706,7 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter( // Call centext-filter if( !aPropStateArray.empty() ) - ContextFilter( aPropStateArray, xPropSet ); + ContextFilter(bEnableFoFontFamily, aPropStateArray, xPropSet); // Have to do if we change from a vector to a list or something like that @@ -717,12 +717,13 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter( } void SvXMLExportPropertyMapper::ContextFilter( + bool bEnableFoFontFamily, vector< XMLPropertyState >& rProperties, Reference< XPropertySet > rPropSet ) const { // Derived class could implement this. if( mxNextMapper.is() ) - mxNextMapper->ContextFilter( rProperties, rPropSet ); + mxNextMapper->ContextFilter( bEnableFoFontFamily, rProperties, rPropSet ); } /////////////////////////////////////////////////////////////////////////// diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index a13c587..3a881dc 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -190,6 +190,7 @@ XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper() } void XMLTextExportPropertySetMapper::ContextFontFilter( + bool bEnableFoFontFamily, XMLPropertyState *pFontNameState, XMLPropertyState *pFontFamilyNameState, XMLPropertyState *pFontStyleNameState, @@ -241,19 +242,25 @@ void XMLTextExportPropertySetMapper::ContextFontFilter( { OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find( sFamilyName, sStyleName, nFamily, nPitch, eEnc ) ); - if( !sName.isEmpty() ) + if (!sName.isEmpty()) { pFontNameState->maValue <<= sName; - if( pFontFamilyNameState ) - pFontFamilyNameState->mnIndex = -1; - if( pFontStyleNameState ) - pFontStyleNameState->mnIndex = -1; - if( pFontFamilyState ) - pFontFamilyState->mnIndex = -1; - if( pFontPitchState ) - pFontPitchState->mnIndex = -1; - if( pFontCharsetState ) - pFontCharsetState->mnIndex = -1; + //Resolves: fdo#68431 style:font-name unrecognized by LibreOffice + //<= 4.1 in styles (but recognized in autostyles) so add + //fo:font-family, etc + if (!bEnableFoFontFamily) + { + if( pFontFamilyNameState ) + pFontFamilyNameState->mnIndex = -1; + if( pFontStyleNameState ) + pFontStyleNameState->mnIndex = -1; + if( pFontFamilyState ) + pFontFamilyState->mnIndex = -1; + if( pFontPitchState ) + pFontPitchState->mnIndex = -1; + if( pFontCharsetState ) + pFontCharsetState->mnIndex = -1; + } } else { @@ -335,6 +342,7 @@ lcl_checkMultiProperty(XMLPropertyState *const pState, } void XMLTextExportPropertySetMapper::ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, Reference< XPropertySet > rPropSet ) const { @@ -599,15 +607,15 @@ void XMLTextExportPropertySetMapper::ContextFilter( } if( pFontNameState ) - ContextFontFilter( pFontNameState, pFontFamilyNameState, + ContextFontFilter( bEnableFoFontFamily, pFontNameState, pFontFamilyNameState, pFontStyleNameState, pFontFamilyState, pFontPitchState, pFontCharsetState ); if( pFontNameCJKState ) - ContextFontFilter( pFontNameCJKState, pFontFamilyNameCJKState, + ContextFontFilter( bEnableFoFontFamily, pFontNameCJKState, pFontFamilyNameCJKState, pFontStyleNameCJKState, pFontFamilyCJKState, pFontPitchCJKState, pFontCharsetCJKState ); if( pFontNameCTLState ) - ContextFontFilter( pFontNameCTLState, pFontFamilyNameCTLState, + ContextFontFilter( bEnableFoFontFamily, pFontNameCTLState, pFontFamilyNameCTLState, pFontStyleNameCTLState, pFontFamilyCTLState, pFontPitchCTLState, pFontCharsetCTLState ); @@ -983,7 +991,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( if( pClipState != NULL && pClip11State != NULL ) pClip11State->mnIndex = -1; - SvXMLExportPropertyMapper::ContextFilter(rProperties,rPropSet); + SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet); } diff --git a/xmloff/source/text/txtexppr.hxx b/xmloff/source/text/txtexppr.hxx index 2736cd2..2041418 100644 --- a/xmloff/source/text/txtexppr.hxx +++ b/xmloff/source/text/txtexppr.hxx @@ -35,6 +35,7 @@ class XMLTextExportPropertySetMapper: public SvXMLExportPropertyMapper sal_Bool bDropWholeWord; void ContextFontFilter( + bool bEnableFoFontFamily, XMLPropertyState *pFontNameState, XMLPropertyState *pFontFamilyNameState, XMLPropertyState *pFontStyleNameState, @@ -56,6 +57,7 @@ protected: /** Application-specific filter. By default do nothing. */ virtual void ContextFilter( + bool bEnableFoFontFamily, ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits