summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2012-07-09 15:08:56 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-04-13 10:24:16 +0100
commit4de8beed1c6dd77e379e460d359f79ea73b855f8 (patch)
treea63cdcd1842cc2aba1d29bbbfc8920d7089f9f9d /sw
parent5c012ae5ebb21c65f2f854e55eff2dd637c2f8c8 (diff)
Resolves: #i119953# Fixed crash on File->Insert.
Reported by: Yan Ji Patch by: Oliver-Rainer Wittmann Review by: Andre Fischer (cherry picked from commit 66cef81342b38e23c6785c101fe204a9512f0646) Conflicts: sw/source/filter/ww8/ww8par.cxx Change-Id: Ia014c0c3b9fb78caf8e1d40bd629eb685d40fdd3
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx36
1 files changed, 16 insertions, 20 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 6d890def6579..42c9765d4b18 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4580,31 +4580,27 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
if (!mbNewDoc)
{
- // in ein Dokument einfuegen ?
- // Da immer ganze Zeile eingelesen werden, muessen
- // evtl. Zeilen eingefuegt / aufgebrochen werden
- //
+ // inserting into an existing document:
+ // As only complete paragraphs are inserted, the current one
+ // needs to be splitted - once or even twice.
const SwPosition* pPos = pPaM->GetPoint();
- SwTxtNode const*const pSttNd = pPos->nNode.GetNode().GetTxtNode();
- sal_uInt16 nCntPos = pPos->nContent.GetIndex();
+ // split current paragraph to get new paragraph for the insertion
+ rDoc.SplitNode( *pPos, false );
- // EinfuegePos nicht in leerer Zeile
- if (nCntPos && pSttNd->GetTxt().getLength())
- rDoc.SplitNode( *pPos, false ); // neue Zeile erzeugen
-
- if (pSttNd->GetTxt().getLength())
- { // EinfuegePos nicht am Ende der Zeile
- rDoc.SplitNode( *pPos, false ); // neue Zeile
- pPaM->Move( fnMoveBackward ); // gehe in leere Zeile
+ // another split, if insertion position was not at the end of the current paragraph.
+ SwTxtNode const*const pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+ if ( pTxtNd->GetTxt().getLength() )
+ {
+ rDoc.SplitNode( *pPos, false );
+ // move PaM back to the newly empty paragraph
+ pPaM->Move( fnMoveBackward );
}
- // verhinder das Einlesen von Tabellen in Fussnoten / Tabellen
- sal_uLong nNd = pPos->nNode.GetIndex();
- bReadNoTbl = 0 != pSttNd->FindTableNode() ||
- ( nNd < rDoc.GetNodes().GetEndOfInserts().GetIndex() &&
- rDoc.GetNodes().GetEndOfInserts().StartOfSectionIndex()
- < nNd );
+ // suppress insertion of tables inside footnotes.
+ const sal_uLong nNd = pPos->nNode.GetIndex();
+ bReadNoTbl = ( nNd < rDoc.GetNodes().GetEndOfInserts().GetIndex() &&
+ rDoc.GetNodes().GetEndOfInserts().StartOfSectionIndex() < nNd );
}