summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-01-03 00:41:56 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-01-06 02:16:33 +0100
commit17f7655b6dedb7349c3ecd8445f119c4d14641b0 (patch)
treea5e604ccb8de0e4c749a22ebaf4ccd27e84e1dc3 /sw/source/filter/ww8
parentd3a5776b00ee07ac371dd180a6d962d50da4baf5 (diff)
cp#2013101510000026: doc import of comments affecting more text nodes
Change-Id: I3932d82cb4cd640b19957b93cc7e59711af1b564 (cherry picked from commit f2945255df273404ee2457dcf761cb8f334b732b) (cherry picked from commit e0bd7b01f31bfbaeac3bce86403bf25929c61c84)
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx49
1 files changed, 44 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 56040b7332ab..645d2466e7f4 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1825,11 +1825,50 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
WW8_CP nStart = GetAnnotationStart(nAtnIndex);
WW8_CP nEnd = GetAnnotationEnd(nAtnIndex);
sal_Int32 nLen = nEnd - nStart;
- // Don't support ranges affecting multiple SwTxtNode for now.
- if (nLen && pPaM->GetPoint()->nContent.GetIndex() >= nLen)
- {
- pPaM->SetMark();
- pPaM->GetPoint()->nContent -= nLen;
+ if( nLen )
+ {
+ if (pPaM->GetPoint()->nContent.GetIndex() >= nLen)
+ {
+ pPaM->SetMark();
+ pPaM->GetPoint()->nContent -= nLen;
+ }
+ else if (pPaM->GetPoint()->nNode.GetNode().IsTxtNode() )
+ {
+ pPaM->SetMark();
+ nLen -= pPaM->GetPoint()->nContent.GetIndex();
+
+ SwTxtNode* pTxtNode = 0;
+ // Find first text node which affected by the comment
+ while( pPaM->GetPoint()->nNode >= 0 )
+ {
+ SwNode* pNode = 0;
+ // Find previous text node
+ do
+ {
+ pPaM->GetPoint()->nNode--;
+ nLen--; // End line character
+ pNode = &pPaM->GetPoint()->nNode.GetNode();
+ }
+ while( !pNode->IsTxtNode() && pPaM->GetPoint()->nNode >= 0 );
+
+ // Subtrackt previous text node's length
+ if( pNode && pNode->IsTxtNode() )
+ {
+ pTxtNode = pNode->GetTxtNode();
+ if( nLen < pTxtNode->Len() )
+ break;
+ else
+ nLen -= pTxtNode->Len();
+ }
+ }
+
+ // Set postion of the text range's first character
+ if( pTxtNode )
+ {
+ pTxtNode->MakeStartIndex(&pPaM->GetPoint()->nContent);
+ pPaM->GetPoint()->nContent += pTxtNode->Len() - nLen;
+ }
+ }
}
}
}