Kaydet (Commit) d776f943 authored tarafından Luboš Luňák's avatar Luboš Luňák

set as outline numbering only those ones that are for headings (bnc#751028)

w:pStyle in a numbering does not necessarily mean it is for outlines,
normal styles can specify numbering too

Change-Id: I0953d94833760ddf4edbe759a19192c477a57bf3
üst 7d327f66
...@@ -596,15 +596,26 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, ...@@ -596,15 +596,26 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( ); StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( );
if ( pParaStyle.get( ) ) if ( pParaStyle.get( ) )
{ {
uno::Reference< text::XChapterNumberingSupplier > xOutlines ( // AFAICT .docx spec does not identify which numberings or paragraph
xFactory, uno::UNO_QUERY_THROW ); // styles are actually the ones to be used for outlines (chapter numbering),
uno::Reference< container::XIndexReplace > xOutlineRules = // it only kind of says somewhere that they should be named Heading1 to Heading9.
xOutlines->getChapterNumberingRules( ); const OUString styleId = pParaStyle->sStyleIdentifierD;
if( styleId.getLength() == RTL_CONSTASCII_LENGTH( "Heading1" )
&& styleId.match( "Heading", 0 )
&& styleId[ RTL_CONSTASCII_LENGTH( "Heading" ) ] >= '1'
&& styleId[ RTL_CONSTASCII_LENGTH( "Heading" ) ] <= '9' )
{
uno::Reference< text::XChapterNumberingSupplier > xOutlines (
xFactory, uno::UNO_QUERY_THROW );
uno::Reference< container::XIndexReplace > xOutlineRules =
xOutlines->getChapterNumberingRules( );
aLvlProps.realloc( aLvlProps.getLength() + 1 ); aLvlProps.realloc( aLvlProps.getLength() + 1 );
aLvlProps[aLvlProps.getLength( ) - 1] = MAKE_PROPVAL( PROP_HEADING_STYLE_NAME, pParaStyle->sConvertedStyleName ); aLvlProps[aLvlProps.getLength( ) - 1] = MAKE_PROPVAL( PROP_HEADING_STYLE_NAME,
pParaStyle->sConvertedStyleName );
xOutlineRules->replaceByIndex( nLevel, uno::makeAny( aLvlProps ) ); xOutlineRules->replaceByIndex( nLevel, uno::makeAny( aLvlProps ) );
}
} }
nLevel++; nLevel++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment