summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-05-08 19:00:18 +0200
committerLászló Németh <nemeth@numbertext.org>2019-05-15 08:18:17 +0200
commit8acc15b5113c798ecdbeed91456a92e7b0c1334e (patch)
treeec85163bd491d187e2c8182359ddf22ed40377f1 /sw/source
parent051f0dca87745bef19adee20393b3b45991f60a2 (diff)
tdf#118699 DOCX import: don't add numbering
after a tracked deletion of a numbered list to the next not numbered paragraph. Note: we remove the numbering of the first item of the deleted numbered list to import the actual text content correctly, giving correct numbering after accepting the changes or in the Hide Changes mode. Change-Id: I98767937bc783cb5e8ecb05558a5ad05a57ff281 Reviewed-on: https://gerrit.libreoffice.org/72001 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx32
-rw-r--r--sw/source/core/inc/DocumentRedlineManager.hxx3
2 files changed, 35 insertions, 0 deletions
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 3056f8f27d12..9735e50390e4 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -820,6 +820,12 @@ RedlineFlags DocumentRedlineManager::GetRedlineFlags() const
void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
{
+ if ( m_bFinalizeImport )
+ {
+ FinalizeImport();
+ m_bFinalizeImport = false;
+ }
+
if( meRedlineFlags != eMode )
{
if( (RedlineFlags::ShowMask & meRedlineFlags) != (RedlineFlags::ShowMask & eMode)
@@ -1418,6 +1424,8 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
// better fix it.
n = 0;
bDec = true;
+ // or simply this is an OOXML import
+ m_bFinalizeImport = true;
}
mpRedlineTable->DeleteAndDestroy( nToBeDeleted );
@@ -3011,6 +3019,30 @@ void DocumentRedlineManager::SetAutoFormatRedlineComment( const OUString* pText,
mnAutoFormatRedlnCommentNo = nSeqNo;
}
+void DocumentRedlineManager::FinalizeImport()
+{
+ // tdf#118699 fix numbering after deletion of numbered list items
+ for( SwRedlineTable::size_type n = 0; n < mpRedlineTable->size(); ++n )
+ {
+ SwRangeRedline* pRedl = (*mpRedlineTable)[ n ];
+ if ( nsRedlineType_t::REDLINE_DELETE == pRedl->GetType() )
+ {
+ const SwPosition* pStt = pRedl->Start(),
+ * pEnd = pStt == pRedl->GetPoint()
+ ? pRedl->GetMark() : pRedl->GetPoint();
+ SwTextNode* pDelNode = pStt->nNode.GetNode().GetTextNode();
+ SwTextNode* pTextNode = pEnd->nNode.GetNode().GetTextNode();
+ // remove numbering of the first deleted list item
+ // to avoid of incorrect numbering after the deletion
+ if ( pDelNode->GetNumRule() && !pTextNode->GetNumRule() )
+ {
+ const SwPaM aPam( *pStt, *pStt );
+ m_rDoc.DelNumRules( aPam );
+ }
+ }
+ }
+}
+
DocumentRedlineManager::~DocumentRedlineManager()
{
}
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx
index f962d4fb6a70..56ff92942de9 100644
--- a/sw/source/core/inc/DocumentRedlineManager.hxx
+++ b/sw/source/core/inc/DocumentRedlineManager.hxx
@@ -127,6 +127,7 @@ public:
bool IsHideRedlines() const { return m_bHideRedlines; }
void SetHideRedlines(bool const bHideRedlines) { m_bHideRedlines = bHideRedlines; }
+ void FinalizeImport();
virtual ~DocumentRedlineManager() override;
private:
@@ -148,6 +149,8 @@ private:
/// this flag is necessary for file import because the ViewShell/layout is
/// created "too late" and the ShowRedlineChanges item is not below "Views"
bool m_bHideRedlines = false;
+ /// need post-processing, eg. for OOXML import
+ bool m_bFinalizeImport = false;
};
}