From f60167ddb925220edec2b9c0ee4826292d24b355 Mon Sep 17 00:00:00 2001 From: Oliver Düsterhoff Date: Fri, 13 Nov 2009 09:38:27 +0000 Subject: #i106218# method - First collect all paragraph styles chosen for assignment to the outline style. Then perform the intrinsic assignment. Reason: side effect of assignment in Writer. --- xmloff/source/text/txtimp.cxx | 48 +++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 27 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 613a4688389f..cad922d48fdd 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1508,8 +1508,6 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( return sStyleName; } -// --> OD 2006-10-12 #i69629# -// adjustments to reflect change of internal data structure void XMLTextImportHelper::FindOutlineStyleName( ::rtl::OUString& rStyleName, sal_Int8 nOutlineLevel ) { @@ -1560,9 +1558,7 @@ void XMLTextImportHelper::FindOutlineStyleName( ::rtl::OUString& rStyleName, } // else: we already had a style name, so we let it pass. } -// <-- -// --> OD 2006-10-12 #i69629# void XMLTextImportHelper::AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel, const OUString& rStyleName ) { @@ -1585,16 +1581,13 @@ void XMLTextImportHelper::AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel mpOutlineStylesCandidates[nOutlineLevel-1].push_back( rStyleName ); } } -// <-- -// --> OD 2006-10-12 #i69629# void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) { if ( ( mpOutlineStylesCandidates != NULL || bSetEmptyLevels ) && xChapterNumbering.is() && !IsInsertMode() ) { - // --> OD 2007-12-19 #152540# bool bChooseLastOne( false ); { if ( GetXMLImport().IsTextDocInOOoFileFormat() ) @@ -1607,15 +1600,12 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) sal_Int32 nBuild( 0 ); if ( GetXMLImport().getBuildIds( nUPD, nBuild ) ) { - // --> OD 2008-03-19 #i86058# // check explicitly on certain versions bChooseLastOne = ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0 ( nUPD == 680 && nBuild <= 9073 ); // OOo 2.0 - OOo 2.0.4 - // <-- } } } - // <-- OUString sOutlineStyleName; { @@ -1624,8 +1614,15 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) xChapterNumRule->getPropertyValue(sName) >>= sOutlineStyleName; } - OUString sEmpty; - sal_Int32 nCount = xChapterNumbering->getCount(); + const sal_Int32 nCount = xChapterNumbering->getCount(); + // --> OD 2009-11-13 #i106218# + // First collect all paragraph styles choosen for assignment to each + // list level of the outline style, then perform the intrinsic assignment. + // Reason: The assignment of a certain paragraph style to a list level + // of the outline style causes side effects on the children + // paragraph styles in Writer. + ::std::vector sChosenStyles(nCount); + // <-- for( sal_Int32 i=0; i < nCount; ++i ) { if ( bSetEmptyLevels || @@ -1634,17 +1631,12 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) { // determine, which candidate is one to be assigned to the list // level of the outline style - OUString sChoosenStyle( sEmpty ); if ( mpOutlineStylesCandidates && !mpOutlineStylesCandidates[i].empty() ) { - // --> OD 2007-12-19 #152540# if ( bChooseLastOne ) - // <-- { - // --> OD 2006-11-06 #i71249# - take last added one - sChoosenStyle = mpOutlineStylesCandidates[i].back(); - // <-- + sChosenStyles[i] = mpOutlineStylesCandidates[i].back(); } else { @@ -1655,24 +1647,26 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) sNumberingStyleName, sOutlineStyleName ) ) { - sChoosenStyle = mpOutlineStylesCandidates[i][j]; + sChosenStyles[i] = mpOutlineStylesCandidates[i][j]; break; } } } } - - Sequence < PropertyValue > aProps( 1 ); - PropertyValue *pProps = aProps.getArray(); - pProps->Name = sHeadingStyleName; - pProps->Value <<= sChoosenStyle; - - xChapterNumbering->replaceByIndex( i, makeAny( aProps ) ); } } + // --> OD 2009-11-13 #i106218# + Sequence < PropertyValue > aProps( 1 ); + PropertyValue *pProps = aProps.getArray(); + pProps->Name = sHeadingStyleName; + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + pProps->Value <<= sChosenStyles[i]; + xChapterNumbering->replaceByIndex( i, makeAny( aProps ) ); + } + // <-- } } -// <-- void XMLTextImportHelper::SetHyperlink( SvXMLImport& rImport, -- cgit