sw/qa/extras/ww8import/data/tdf95576.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 41 ++++++++++++++++++++++++ sw/source/core/doc/DocumentStylePoolManager.cxx | 14 ++------ sw/source/core/doc/number.cxx | 10 ----- 4 files changed, 45 insertions(+), 20 deletions(-)
New commits: commit 77171fc384b3c6359cdae026a0c38f2f112c9d60 Author: Luke Deller <[email protected]> Date: Mon May 9 21:59:10 2016 +1000 Remove default outline indent, fixes tdf#95576 The default document outline style has indents set appropriately for numbered headings. However numbering was disabled in the default outline style 20 years ago (!) so update the indents accordingly. Also revert commit 05fd8cb848ecba425124d61cd76e2f9418d5378c which attempted to work around this issue by explicitly setting a zero indent on the default paragraph styles "Heading 1", "Heading 2", etc, as this is no longer required. This change fixes a DOC import issue tdf#95576 (!) Reference: see this old German comment https://cgit.freedesktop.org/libreoffice/core/tree/sw/source/core/doc/number.cxx?id=84a3db80#%6E647 Change-Id: Id289143ed859861f2584e21969f16f348e215f6f Reviewed-on: https://gerrit.libreoffice.org/24806 Tested-by: Jenkins <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sw/qa/extras/ww8import/data/tdf95576.doc b/sw/qa/extras/ww8import/data/tdf95576.doc new file mode 100644 index 0000000..a8a6018 Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf95576.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index b2e0f0d..d59b9ad 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -567,6 +567,47 @@ reading page numbers at sections > 255, in this case 256 CPPUNIT_ASSERT_EQUAL(sal_Int16(256), nOffset); } +DECLARE_WW8IMPORT_TEST(testTdf95576, "tdf95576.doc") +{ + // The first three paragraphs in this document (which are headings) + // should have zero indent and first line indent + for (int nPara = 1; nPara <= 3; ++nPara) { + std::cout << "nPara = " << nPara << "\n"; + auto xPara = getParagraph(nPara); + + // get the numbering rules effective at this paragraph + uno::Reference<container::XIndexReplace> xNumRules( + getProperty< uno::Reference<container::XIndexReplace> >( + xPara, "NumberingRules"), + uno::UNO_QUERY); + + // get the numbering level of this paragraph, and the properties + // associated with that numbering level + int numLevel = getProperty<sal_Int32>(xPara, "NumberingLevel"); + uno::Sequence< beans::PropertyValue > aPropertyValues; + xNumRules->getByIndex(numLevel) >>= aPropertyValues; + + // Now look through these properties for the indent and + // first line indent settings + sal_Int32 nIndentAt = -1; + sal_Int32 nFirstLineIndent = -1; + for(int j = 0 ; j< aPropertyValues.getLength() ; ++j) + { + auto aProp = aPropertyValues[j]; + std::cout << "Prop.Name: " << aProp.Name << "\n"; + if (aProp.Name == "FirstLineIndent") { + nFirstLineIndent = aProp.Value.get<sal_Int32>(); + } else if (aProp.Name == "IndentAt") { + nIndentAt = aProp.Value.get<sal_Int32>(); + } + } + + // The indent and first line indent should be zero + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nIndentAt); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nFirstLineIndent); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index a335326..66254f4 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -195,21 +195,15 @@ namespace SwNumRule * pOutlineRule = pDoc->GetOutlineNumRule(); const SwNumFormat& rNFormat = pOutlineRule->Get( nLevel ); - SvxLRSpaceItem aLR( static_cast<const SvxLRSpaceItem&>(pColl->GetFormatAttr( RES_LR_SPACE )) ); - if ( rNFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION && + if ( rNFormat.GetPositionAndSpaceMode() == + SvxNumberFormat::LABEL_WIDTH_AND_POSITION && ( rNFormat.GetAbsLSpace() || rNFormat.GetFirstLineOffset() ) ) { + SvxLRSpaceItem aLR( static_cast<const SvxLRSpaceItem&>(pColl->GetFormatAttr( RES_LR_SPACE )) ); aLR.SetTextFirstLineOfstValue( rNFormat.GetFirstLineOffset() ); aLR.SetTextLeft( rNFormat.GetAbsLSpace() ); + pColl->SetFormatAttr( aLR ); } - else - { - // tdf#93970 The indent set at the associated outline style also affects this paragraph. - // We don't want this here, so override it. This doesn't affect the outline style properties. - aLR.SetTextFirstLineOfstValue( 0 ); - aLR.SetTextLeft( 0 ); - } - pColl->SetFormatAttr( aLR ); // All paragraph styles, which are assigned to a level of the // outline style has to have the outline style set as its list style. diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 9be80a9..a6cbb5e 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -445,12 +445,6 @@ SwNumRule::SwNumRule( const OUString& rNm, SwNumRule::maBaseFormats[ OUTLINE_RULE ][ n ] = pFormat; } // position-and-space mode LABEL_ALIGNMENT: - // indent values of default outline numbering in inch: - // 0,3 0,4 0,5 0,6 0,7 - // 0,8 0,9 1,0 1,1 1,2 - const long cOutlineIndentAt[ MAXLEVEL ] = { - 1440*3/10, 1440*2/5, 1440/2, 1440*3/5, 1440*7/10, - 1440*4/5, 1440*9/10, 1440, 1440*11/10, 1440*6/5 }; for( n = 0; n < MAXLEVEL; ++n ) { pFormat = new SwNumFormat; @@ -458,10 +452,6 @@ SwNumRule::SwNumRule( const OUString& rNm, pFormat->SetIncludeUpperLevels( MAXLEVEL ); pFormat->SetStart( 1 ); pFormat->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT ); - pFormat->SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); - pFormat->SetListtabPos( cOutlineIndentAt[ n ] ); - pFormat->SetFirstLineIndent( -cOutlineIndentAt[ n ] ); - pFormat->SetIndentAt( cOutlineIndentAt[ n ] ); pFormat->SetBulletChar( numfunc::GetBulletChar(n)); SwNumRule::maLabelAlignmentBaseFormats[ OUTLINE_RULE ][ n ] = pFormat; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
