diff options
author | Matthew Pottage <matthewpottage@invincitech.com> | 2014-07-26 17:17:27 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-07-31 15:48:32 +0000 |
commit | 4c3ba3a413be7339115ea5e6edc825a8434cd345 (patch) | |
tree | a07c20989ba32fede18bce7d449c45ccbbc18430 /writerfilter/source/dmapper/NumberingManager.cxx | |
parent | 8fea536cebefe319a7fd5971b28e0936ac91ecb9 (diff) |
fdo#75757: Remove inheritance from std::map.
Done for writerfilter::dmapper::PropertyMap.
Added public functions getPropertyValue, bool isSet and Erase. The function
getPropertyValue returns boost::optional<PropertyMap::Property>,
where PropertyMap::Property is an alias for std::pair<PropertyIds,css::uno::Any>.
Fixed all resulting compilation errors. The functions which iterated the map
(ListLevel::GetCharStyleProperties, ListLevel::GetLevelProperties and
SectionPropertyMap::_ApplyProperties) have been written to either used
GetPropertyValues or not iterate over the PropertyMap's attributes.
The properties of the public member functions are now properly used
(Erase and Insert(...,false)).
Change-Id: Ibd90a4ad831c9b7d18b2a50d4aa4eb3f2610cff8
Reviewed-on: https://gerrit.libreoffice.org/10558
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'writerfilter/source/dmapper/NumberingManager.cxx')
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 85 |
1 files changed, 39 insertions, 46 deletions
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 7fc2066368f2..d5cf4129ae2a 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -210,33 +210,36 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetProperties( ) return aLevelProps; } +static bool IgnoreForCharStyle(const OUString& aStr) +{ + //Names found in PropertyIds.cxx, Lines 56-396 + return (aStr=="Adjust" || aStr=="IndentAt" || aStr=="FirstLineIndent" + || aStr=="FirstLineOffset" || aStr=="LeftMargin" || aStr=="CharFontName" + ); +} uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( ) { PropertyValueVector_t rProperties; PropertyNameSupplier& aPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); - _PropertyMap::const_iterator aMapIter = begin(); - _PropertyMap::const_iterator aEndIter = end(); - for( ; aMapIter != aEndIter; ++aMapIter ) + uno::Sequence< beans::PropertyValue > vPropVals = PropertyMap::GetPropertyValues(); + beans::PropertyValue* aValIter = vPropVals.begin(); + beans::PropertyValue* aEndIter = vPropVals.end(); + for( ; aValIter != aEndIter; ++aValIter ) { - switch( aMapIter->first ) - { - case PROP_ADJUST: - case PROP_INDENT_AT: - case PROP_FIRST_LINE_INDENT: - case PROP_FIRST_LINE_OFFSET: - case PROP_LEFT_MARGIN: - case PROP_CHAR_FONT_NAME: - // Do nothing: handled in the GetPropertyValues method - break; - default: - { - rProperties.push_back( - beans::PropertyValue( - aPropNameSupplier.GetName( aMapIter->first ), 0, - aMapIter->second.getValue(), beans::PropertyState_DIRECT_VALUE )); + if (IgnoreForCharStyle(aValIter->Name)) + continue; + else if(aValIter->Name=="CharInteropGrabBag" || aValIter->Name=="ParaInteropGrabBag") { + uno::Sequence<beans::PropertyValue> vGrabVals; + aValIter->Value >>= vGrabVals; + beans::PropertyValue* aGrabIter = vGrabVals.begin(); + for(; aGrabIter!=vGrabVals.end(); ++aGrabIter) { + if(!IgnoreForCharStyle(aGrabIter->Name)) + rProperties.push_back(beans::PropertyValue(aGrabIter->Name, 0, aGrabIter->Value, beans::PropertyState_DIRECT_VALUE)); } } + else + rProperties.push_back(beans::PropertyValue(aValIter->Name, 0, aValIter->Value, beans::PropertyState_DIRECT_VALUE)); } uno::Sequence< beans::PropertyValue > aRet( rProperties.size() ); @@ -320,36 +323,26 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetLevelProperties( ) // nXChFollow; following character 0 - tab, 1 - space, 2 - nothing aNumberingProperties.push_back( MAKE_PROPVAL( PROP_LEVEL_FOLLOW, m_nXChFollow )); - - _PropertyMap::const_iterator aMapIter = begin(); - _PropertyMap::const_iterator aEndIter = end(); - for( ; aMapIter != aEndIter; ++aMapIter ) + const int nIds = 5; + PropertyIds aReadIds[nIds] = { - switch( aMapIter->first ) - { - case PROP_ADJUST: - case PROP_INDENT_AT: - case PROP_FIRST_LINE_INDENT: - case PROP_FIRST_LINE_OFFSET: - case PROP_LEFT_MARGIN: - aNumberingProperties.push_back( - beans::PropertyValue( aPropNameSupplier.GetName( aMapIter->first ), 0, aMapIter->second.getValue(), beans::PropertyState_DIRECT_VALUE )); - break; - case PROP_CHAR_FONT_NAME: - if( !isOutlineNumbering()) - { - aNumberingProperties.push_back( - beans::PropertyValue( aPropNameSupplier.GetName( PROP_BULLET_FONT_NAME ), 0, aMapIter->second.getValue(), beans::PropertyState_DIRECT_VALUE )); - } - break; - default: - { - // Handled in GetCharStyleProperties method - } - - } + PROP_ADJUST, PROP_INDENT_AT, PROP_FIRST_LINE_INDENT, + PROP_FIRST_LINE_OFFSET, PROP_LEFT_MARGIN + }; + for(int i=0; i<nIds; ++i) { + boost::optional<PropertyMap::Property> aProp = getProperty(aReadIds[i]); + if (aProp) + aNumberingProperties.push_back( + beans::PropertyValue( aPropNameSupplier.GetName(aProp->first), 0, aProp->second, beans::PropertyState_DIRECT_VALUE ) + ); } + boost::optional<PropertyMap::Property> aPropFont = getProperty(PROP_CHAR_FONT_NAME); + if(aPropFont && !isOutlineNumbering()) + aNumberingProperties.push_back( + beans::PropertyValue( aPropNameSupplier.GetName(PROP_BULLET_FONT_NAME), 0, aPropFont->second, beans::PropertyState_DIRECT_VALUE ) + ); + uno::Sequence< beans::PropertyValue > aRet(aNumberingProperties.size()); beans::PropertyValue* pValues = aRet.getArray(); PropertyValueVector_t::const_iterator aIt = aNumberingProperties.begin(); |