summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-04-30 18:38:17 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-05-02 16:45:48 +0200
commitd776f9433b6ca51472f4d6099526f71400b7bfda (patch)
treef998ed4f00f10cc7a9192f04f0ba92791cb7e194
parent7d327f66dbf7befa92e5f02c36748ed8b5ba0235 (diff)
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
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 45af950ba996..2f0e7847b745 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -596,15 +596,26 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( );
if ( pParaStyle.get( ) )
{
- uno::Reference< text::XChapterNumberingSupplier > xOutlines (
- xFactory, uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexReplace > xOutlineRules =
- xOutlines->getChapterNumberingRules( );
+ // 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 (
+ xFactory, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexReplace > xOutlineRules =
+ xOutlines->getChapterNumberingRules( );
- aLvlProps.realloc( aLvlProps.getLength() + 1 );
- aLvlProps[aLvlProps.getLength( ) - 1] = MAKE_PROPVAL( PROP_HEADING_STYLE_NAME, pParaStyle->sConvertedStyleName );
+ aLvlProps.realloc( aLvlProps.getLength() + 1 );
+ 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++;