summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-06-13 17:42:08 +0200
committerLászló Németh <nemeth@numbertext.org>2019-06-14 08:02:17 +0200
commitbe9379d0a955bd06a8d22c4dc8d99a87ed062ac4 (patch)
tree89f74155e348b8e21bf0108f4a229717f5efd184 /sw
parentaf64c87144bcb951f789553a0490297ec8c4dc38 (diff)
tdf#125881 DOCX import: handle list level after tracked deletion
to avoid bad numbering (for example import "II.1" instead of "I.3"). Commit cbd894925e6b9869baedcd6476484c14d3a3df87 "tdf#125319 DOCX track changes: don't change numbering" fixed losing numbering after tracked deletion (for example, during switching off the Show Changes mode or by DOCX export of the attached test document), but not handling list levels still changed the numbering. Change-Id: I67cd9459bc44e9bb470bfed6834be2e88edfe0d0 Reviewed-on: https://gerrit.libreoffice.org/73978 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data2/tdf125881.docxbin0 -> 34448 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx16
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx11
3 files changed, 23 insertions, 4 deletions
diff --git a/sw/qa/extras/uiwriter/data2/tdf125881.docx b/sw/qa/extras/uiwriter/data2/tdf125881.docx
new file mode 100644
index 000000000000..569d048eefe3
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data2/tdf125881.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index da1838597825..1be95f8a0ea5 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1252,6 +1252,22 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf118699_redline_numbering)
.is());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125881_redline_list_level)
+{
+ load(DATA_DIRECTORY, "tdf125881.docx");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ // deleted paragraph gets the numbering of the next paragraph
+ uno::Reference<beans::XPropertySet> xProps(getParagraph(8), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("first paragraph after the first deletion: missing numbering",
+ xProps->getPropertyValue("NumberingRules").hasValue());
+
+ // check numbering level at deletion (1 instead of 0)
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(getParagraph(8), "NumberingLevel"));
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310)
{
load(DATA_DIRECTORY, "tdf125310.fodt");
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 94a361e14f37..8548768793eb 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -3029,7 +3029,7 @@ void DocumentRedlineManager::SetAutoFormatRedlineComment( const OUString* pText,
void DocumentRedlineManager::FinalizeImport()
{
- // tdf#118699 fix numbering after deletion of numbered list items
+ // set correct numbering after deletion
for( SwRedlineTable::size_type n = 0; n < mpRedlineTable->size(); ++n )
{
SwRangeRedline* pRedl = (*mpRedlineTable)[ n ];
@@ -3040,19 +3040,22 @@ void DocumentRedlineManager::FinalizeImport()
? pRedl->GetMark() : pRedl->GetPoint();
SwTextNode* pDelNode = pStt->nNode.GetNode().GetTextNode();
SwTextNode* pTextNode = pEnd->nNode.GetNode().GetTextNode();
- // avoid of incorrect numbering after the deletion
+
if ( pDelNode->GetNumRule() && !pTextNode->GetNumRule() )
{
- // remove numbering of the first deleted list item
+ // tdf#118699 remove numbering of the first deleted list item
const SwPaM aPam( *pStt, *pStt );
m_rDoc.DelNumRules( aPam );
}
else if ( pDelNode->GetNumRule() != pTextNode->GetNumRule() )
{
- // copy numbering to the first deleted list item
+ // tdf#125319 copy numbering to the first deleted list item
const SwPaM aPam( *pStt, *pStt );
SwNumRule *pRule = pTextNode->GetNumRule();
m_rDoc.SetNumRule( aPam, *pRule, false );
+
+ // tdf#125881 copy also numbering level
+ pDelNode->SetAttrListLevel( pTextNode->GetAttrListLevel() );
}
}
}