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
...@@ -595,6 +595,15 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, ...@@ -595,6 +595,15 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
// Handle the outline level here // Handle the outline level here
StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( ); StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( );
if ( pParaStyle.get( ) ) if ( pParaStyle.get( ) )
{
// AFAICT .docx spec does not identify which numberings or paragraph
// styles are actually the ones to be used for outlines (chapter numbering),
// it only kind of says somewhere that they should be named Heading1 to Heading9.
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 ( uno::Reference< text::XChapterNumberingSupplier > xOutlines (
xFactory, uno::UNO_QUERY_THROW ); xFactory, uno::UNO_QUERY_THROW );
...@@ -602,10 +611,12 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, ...@@ -602,10 +611,12 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
xOutlines->getChapterNumberingRules( ); 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