diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-07-24 10:53:29 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-07-24 12:11:12 +0200 |
commit | 41bf9d4cc32436ab3e43e8905236dd61ba511815 (patch) | |
tree | 54efa7b7cc6cc3b3776233522aa0309087d5ce74 | |
parent | 288bcd68bdccd7a57b2c6da2c0bb91b71e8fcd3b (diff) |
writerfilter: import w:mirrorIndents as a grab bag property
Change-Id: I500c6af08326ea226b3774fb1e02709d278fa509
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 39 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.hxx | 7 |
5 files changed, 40 insertions, 11 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 4fda96befec4..cab21d823242 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3326,6 +3326,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case NS_sprm::LN_PContextualSpacing: rContext->Insert(PROP_PARA_CONTEXT_MARGIN, uno::makeAny( sal_Bool( nIntValue ) )); break; + case 0x2470: // mirrorIndents + rContext->Insert(PROP_MIRROR_INDENTS, uno::makeAny(sal_Bool(nIntValue)), true, true); + break; case NS_ooxml::LN_EG_SectPrContents_formProt: //section protection, only form editing is enabled - unsupported case NS_ooxml::LN_EG_SectPrContents_vAlign: case NS_ooxml::LN_EG_RPrBase_fitText: diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index f71ed969ebaa..1d62f00f5d2f 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -328,6 +328,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_CHAR_SHADING_VALUE: sName = "CharShadingValue"; break; case PROP_LABEL_CATEGORY: sName = "LabelCategory"; break; case PROP_FIRST_IS_SHARED : sName = "FirstIsShared"; break; + case PROP_MIRROR_INDENTS : sName = "MirrorIndents"; break; } ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 64e81feb9297..19ee4ff0fdb0 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -299,6 +299,7 @@ enum PropertyIds ,PROP_GRAPHIC_BITMAP ,PROP_CHAR_SHADING_VALUE ,PROP_FIRST_IS_SHARED + ,PROP_MIRROR_INDENTS }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 3a6668e9dc02..12380f7698c1 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -64,11 +64,19 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues() { if(!m_aValues.getLength() && size()) { - m_aValues.realloc( size() ); + size_t nGrabBag = 0; + for (PropertyMap::iterator i = begin(); i != end(); ++i) + if (i->first.m_bGrabBag) + nGrabBag++; + // If there are any grab bag properties, we need one slot for them. + m_aValues.realloc( size() - nGrabBag + (nGrabBag ? 1 : 0)); ::com::sun::star::beans::PropertyValue* pValues = m_aValues.getArray(); + uno::Sequence<beans::PropertyValue> aGrabBagValues(nGrabBag); + beans::PropertyValue* pGrabBagValues = aGrabBagValues.getArray(); //style names have to be the first elements within the property sequence //otherwise they will overwrite 'hard' attributes sal_Int32 nValue = 0; + sal_Int32 nGrabBagValue = 0; PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); PropertyMap::iterator aParaStyleIter = find(PropertyDefinition( PROP_PARA_STYLE_NAME ) ); if( aParaStyleIter != end()) @@ -93,15 +101,30 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues() ++nValue; } PropertyMap::iterator aMapIter = begin(); - for( ; nValue < m_aValues.getLength(); ++aMapIter ) + for( ; aMapIter != end(); ++aMapIter ) { if( aMapIter != aParaStyleIter && aMapIter != aCharStyleIter && aMapIter != aNumRuleIter ) { - pValues[nValue].Name = rPropNameSupplier.GetName( aMapIter->first.eId ); - pValues[nValue].Value = aMapIter->second; - ++nValue; + if (!aMapIter->first.m_bGrabBag) + { + pValues[nValue].Name = rPropNameSupplier.GetName( aMapIter->first.eId ); + pValues[nValue].Value = aMapIter->second; + ++nValue; + } + else + { + pGrabBagValues[nGrabBagValue].Name = rPropNameSupplier.GetName( aMapIter->first.eId ); + pGrabBagValues[nGrabBagValue].Value = aMapIter->second; + ++nGrabBagValue; + } } } + if (nGrabBag) + { + pValues[nValue].Name = "ParaInteropGrabBag"; + pValues[nValue].Value = uno::makeAny(aGrabBagValues); + ++nValue; + } } return m_aValues; } @@ -131,7 +154,7 @@ static void lcl_AnyToTag(const uno::Any & rAny) } #endif -void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite ) +void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite, bool bGrabBag ) { #ifdef DEBUG_DMAPPER_PROPERTY_MAP const OUString& rInsert = PropertyNameSupplier:: @@ -143,7 +166,7 @@ void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite dmapper_logger->endElement(); #endif - PropertyMap::iterator aElement = find(PropertyDefinition( eId ) ); + PropertyMap::iterator aElement = find(PropertyDefinition( eId, bGrabBag ) ); if( aElement != end()) { if(!bOverwrite) @@ -151,7 +174,7 @@ void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite erase( aElement ); } _PropertyMap::insert( PropertyMap::value_type - (PropertyDefinition( eId ), + (PropertyDefinition( eId, bGrabBag ), rAny )); Invalidate(); } diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index ba15e89300ee..d5d70d71823e 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -67,9 +67,10 @@ enum BorderPosition struct PropertyDefinition { PropertyIds eId; + bool m_bGrabBag; - PropertyDefinition( PropertyIds _eId ) : - eId( _eId ){} + PropertyDefinition( PropertyIds _eId, bool bGrabBag = false ) : + eId( _eId ), m_bGrabBag(bGrabBag){} bool operator== (const PropertyDefinition& rDef) const { return rDef.eId == eId; } @@ -102,7 +103,7 @@ public: bool hasEmptyPropertyValues() const {return !m_aValues.getLength();} /** Add property, usually overwrites already available attributes. It shouldn't overwrite in case of default attributes */ - void Insert( PropertyIds eId, const ::com::sun::star::uno::Any& rAny, bool bOverwrite = true ); + void Insert( PropertyIds eId, const ::com::sun::star::uno::Any& rAny, bool bOverwrite = true, bool bGrabBag = false ); void InsertProps(const boost::shared_ptr<PropertyMap> pMap); const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote>& GetFootnote() const; |