diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-04-26 12:10:33 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-04-28 11:24:16 +0200 |
commit | 7ef5e1cebab76b55dacca3f8eea10884a6a90d74 (patch) | |
tree | b7a106bef0f3234a4ad87f0f383e2df507a0a517 | |
parent | 9c69984f8bf4830c6c0831bc66b128f86143d98f (diff) |
don't overwrite numbering properties with paragraph properties (bnc#751028)
Part of bnc#751028, that is. The origin of this function is unclear,
without good repo history, and it's a question if it is still needed
after my previous fixes for bnc#751028 that fixed applying some of numbering
properties. Keeping it there just in case, but prevent it from overwriting
w:ind that's been read from the .docx file.
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 32 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.hxx | 3 |
2 files changed, 18 insertions, 17 deletions
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 0b8000a72423..3119db4762c4 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -189,11 +189,7 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetProperties( ) { uno::Sequence< beans::PropertyValue > aLevelProps = GetLevelProperties( ); if ( m_pParaStyle.get( ) ) - { - // Merge with the paragraph properties - uno::Sequence< beans::PropertyValue > aParaProps = GetParaProperties( ); - lcl_mergeProperties( aParaProps, aLevelProps ); - } + AddParaProperties( &aLevelProps ); return aLevelProps; } @@ -330,35 +326,43 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetLevelProperties( ) return aRet; } -uno::Sequence< beans::PropertyValue > ListLevel::GetParaProperties( ) +// Add the properties only if they do not already exist in the sequence. +void ListLevel::AddParaProperties( uno::Sequence< beans::PropertyValue >* props ) { + uno::Sequence< beans::PropertyValue >& aProps = *props; PropertyNameSupplier& aPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); + OUString sFirstLineIndent = aPropNameSupplier.GetName( + PROP_FIRST_LINE_INDENT ); + OUString sIndentAt = aPropNameSupplier.GetName( + PROP_INDENT_AT ); + + bool hasFirstLineIndent = lcl_findProperty( aProps, sFirstLineIndent ); + bool hasIndentAt = lcl_findProperty( aProps, sIndentAt ); + + if( hasFirstLineIndent && hasIndentAt ) + return; // has them all, nothing to add + uno::Sequence< beans::PropertyValue > aParaProps = m_pParaStyle->pProperties->GetPropertyValues( ); - uno::Sequence< beans::PropertyValue > aProps; // ParaFirstLineIndent -> FirstLineIndent // ParaLeftMargin -> IndentAt OUString sParaIndent = aPropNameSupplier.GetName( PROP_PARA_FIRST_LINE_INDENT ); - OUString sFirstLineIndent = aPropNameSupplier.GetName( - PROP_FIRST_LINE_INDENT ); OUString sParaLeftMargin = aPropNameSupplier.GetName( PROP_PARA_LEFT_MARGIN ); - OUString sIndentAt = aPropNameSupplier.GetName( - PROP_INDENT_AT ); sal_Int32 nLen = aParaProps.getLength( ); for ( sal_Int32 i = 0; i < nLen; i++ ) { - if ( aParaProps[i].Name.equals( sParaIndent ) ) + if ( !hasFirstLineIndent && aParaProps[i].Name.equals( sParaIndent ) ) { aProps.realloc( aProps.getLength() + 1 ); aProps[aProps.getLength( ) - 1] = aParaProps[i]; aProps[aProps.getLength( ) - 1].Name = sFirstLineIndent; } - else if ( aParaProps[i].Name.equals( sParaLeftMargin ) ) + else if ( !hasIndentAt && aParaProps[i].Name.equals( sParaLeftMargin ) ) { aProps.realloc( aProps.getLength() + 1 ); aProps[aProps.getLength( ) - 1] = aParaProps[i]; @@ -366,8 +370,6 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetParaProperties( ) } } - - return aProps; } //--------------------------------------- AbstractListDef implementation diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx index d6964395d540..54f7bb7d1a6c 100644 --- a/writerfilter/source/dmapper/NumberingManager.hxx +++ b/writerfilter/source/dmapper/NumberingManager.hxx @@ -85,8 +85,7 @@ private: com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetLevelProperties( ); - com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > - GetParaProperties( ); + void AddParaProperties( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* props ); }; class AbstractListDef |