diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-04 15:35:18 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-09-19 15:32:23 +0000 |
commit | dc46c86f56e0573d13d6b8140ef1aaf6f0db7895 (patch) | |
tree | b129e87a87554dd43b26553a074d4940d4fd08a0 | |
parent | 195ac805ee3350adb5971c90edee3ee8481f41a9 (diff) |
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-eric@lanedo.com>
Tested-by: Pierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@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 <erack@redhat.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | include/xmloff/xmlexppr.hxx | 11 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlstyle.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlstyle.hxx | 2 | ||||
-rw-r--r-- | xmloff/inc/XMLChartPropertySetMapper.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/chart/PropertyMaps.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/draw/sdpropls.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/draw/sdpropls.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterExportPropMapper.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterExportPropMapper.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/style/styleexp.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/xmlexppr.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 38 | ||||
-rw-r--r-- | xmloff/source/text/txtexppr.hxx | 2 |
13 files changed, 53 insertions, 29 deletions
diff --git a/include/xmloff/xmlexppr.hxx b/include/xmloff/xmlexppr.hxx index 7e7bb7658903..66e83d3df28b 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 6b4d8a1a154f..3a5fe2bb5629 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 e879ddf6e069..888a093ef81d 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 b5655c0db6fa..e2463e255c8d 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 9962a09d0f5d..da811523940c 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 9fa89b35f7d7..8e243fa7e330 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 77bfe0053df7..70ac1b718109 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 db50eb6a5669..961c5eb08382 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 0d24df5f0885..78b00285134d 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 b9ca2ad2e67e..58991dff96b7 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 c2c414b100d7..6808db5e5bca 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 a13c5875602b..3a881dc490f1 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 2736cd22b7f7..204141869564 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; |