summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLuke Deller <luke@deller.id.au>2016-05-09 21:59:10 +1000
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-05-10 07:23:33 +0000
commit77171fc384b3c6359cdae026a0c38f2f112c9d60 (patch)
tree37e8ae53b39258f654a3e8d45186331278508335 /sw
parent02dac9f7c956f6073d810f4a0c80c733f40aea6d (diff)
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 <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ww8import/data/tdf95576.docbin0 -> 23040 bytes
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx41
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx14
-rw-r--r--sw/source/core/doc/number.cxx10
4 files changed, 45 insertions, 20 deletions
diff --git a/sw/qa/extras/ww8import/data/tdf95576.doc b/sw/qa/extras/ww8import/data/tdf95576.doc
new file mode 100644
index 000000000000..a8a601885f33
--- /dev/null
+++ b/sw/qa/extras/ww8import/data/tdf95576.doc
Binary files differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index b2e0f0d15447..d59b9ad8cf1b 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 a335326e3523..66254f434d5a 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 9be80a907a73..a6cbb5e8c8b7 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;
}