diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-04-12 19:56:14 +0200 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-04-12 19:56:14 +0200 |
commit | 8bbd9662a33c709ce3e8a410d4d32f3e4a096096 (patch) | |
tree | 0095eaf39b95132b5c99f06791437fdc3d2f865c /sw/source | |
parent | 218b9fbea9ebed99ca4d37399a49d5a65fd66828 (diff) | |
parent | ece8d7b09ffca05b3f59a4294cb284e05feeaae5 (diff) |
CWS-TOOLING: integrate CWS writerfilter07
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 64 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 20 |
2 files changed, 83 insertions, 1 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 1f62d5f66d..77d98ab890 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1265,10 +1265,72 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > return pNdTbl; } +SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange) +{ + SwNodeRange * pResult = NULL; + bool bChanged = false; + + SwNodeIndex aNewStart = rRange.aStart; + SwNodeIndex aNewEnd = rRange.aEnd; + + SwNodeIndex aEndIndex = rRange.aEnd; + SwNodeIndex aIndex = rRange.aStart; + + while (aIndex < aEndIndex) + { + SwNode& rNode = aIndex.GetNode(); + + if (rNode.IsStartNode()) + { + // advance aIndex to the end node of this start node + SwNode * pEndNode = rNode.EndOfSectionNode(); + aIndex = *pEndNode; + + if (aIndex > aNewEnd) + { + aNewEnd = aIndex; + bChanged = true; + } + } + else if (rNode.IsEndNode()) + { + SwNode * pStartNode = rNode.StartOfSectionNode(); + SwNodeIndex aStartIndex = *pStartNode; + + if (aStartIndex < aNewStart) + { + aNewStart = aStartIndex; + bChanged = true; + } + } + + if (aIndex < aEndIndex) + ++aIndex; + } + + SwNode * pNode = &aIndex.GetNode(); + while (pNode->IsEndNode()) + { + SwNode * pStartNode = pNode->StartOfSectionNode(); + SwNodeIndex aStartIndex(*pStartNode); + aNewStart = aStartIndex; + aNewEnd = aIndex; + bChanged = true; + + ++aIndex; + pNode = &aIndex.GetNode(); + } + + if (bChanged) + pResult = new SwNodeRange(aNewStart, aNewEnd); + + return pResult; +} + /*-- 18.05.2006 08:23:28--------------------------------------------------- -----------------------------------------------------------------------*/ -SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes, +SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, SwTableFmt* pTblFmt, SwTableLineFmt* pLineFmt, SwTableBoxFmt* pBoxFmt, diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 133ad4d278..089cba42ad 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1885,6 +1885,26 @@ void SwXText::Impl::ConvertCell( { throw lang::IllegalArgumentException(); } + + SwNodeRange aTmpRange(aStartCellPam.Start()->nNode, + aEndCellPam.End()->nNode); + SwNodeRange * pCorrectedRange = + m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange); + + if (pCorrectedRange != NULL) + { + SwPaM aNewStartPaM(pCorrectedRange->aStart, 0); + aStartCellPam = aNewStartPaM; + + xub_StrLen nEndLen = 0; + SwTxtNode * pTxtNode = pCorrectedRange->aEnd.GetNode().GetTxtNode(); + if (pTxtNode != NULL) + nEndLen = pTxtNode->Len(); + + SwPaM aNewEndPaM(pCorrectedRange->aEnd, nEndLen); + aEndCellPam = aNewEndPaM; + } + /** check the nodes between start and end it is allowed to have pairs of StartNode/EndNodes */ |