The following commit has been merged in the ubuntu-precise-3.5 branch: commit ce3e84b72b98796c3ae6d13c5ab537c44d1e36a5 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Wed Jan 9 15:03:50 2013 +0100
lp#1097760: better fix for DOCX table import crash fix lp#1097760 containers for backport diff --git a/changelog b/changelog index c507e77..c4d572c 100644 --- a/changelog +++ b/changelog @@ -14,7 +14,8 @@ libreoffice (1:3.5.7-0ubuntu3) UNRELEASED; urgency=low * backport Clipboard must be disposed before Selection (LP: #1097727) * backport fix default hori/vert frame anchor during RTF import (LP: #1097735) * backport Load Java scripts with class loaders (LP: #1097744) - * backport Do not consider timestamp differences as corruption (LP: #1097748) + * backport Do not consider timestamp differences as corruption (LP: #1097748) + * backport sw: better fix for DOCX table import crash (LP: #1097760) -- Bjoern Michaelsen <bjoern.michael...@canonical.com> Tue, 08 Jan 2013 17:09:36 +0100 diff --git a/patches/lp-1097760-rhbz-820283-fdo-55462-sw-better-fix-for-DOCX-table-i.diff b/patches/lp-1097760-rhbz-820283-fdo-55462-sw-better-fix-for-DOCX-table-i.diff new file mode 100644 index 0000000..67adc6b --- /dev/null +++ b/patches/lp-1097760-rhbz-820283-fdo-55462-sw-better-fix-for-DOCX-table-i.diff @@ -0,0 +1,97 @@ +From 8adcdcac0b0c65e3d22610ae0df68e180bf59022 Mon Sep 17 00:00:00 2001 +From: Michael Stahl <mst...@redhat.com> +Date: Thu, 4 Oct 2012 19:17:56 +0200 +Subject: [PATCH 09/14] rhbz#820283, fdo#55462: sw: better fix for DOCX table + import crash: + +The fix in 6d2e09db4a677068095b0bebd08fbbb96620d60c is completely bogus. +Only vertically merged boxes result in dummy boxes with negative span, +while horizontally merged boxes result in different numbers of boxes per +line. So instead of inserting boxes, adjust the width of the last box +in rows that are missing boxes, such that all lines have the same width. + +(cherry picked from commit 4113d9664c60d004474dfc1cffbcd7dc50fa6dc4) + +Conflicts: + sw/source/core/docnode/ndtbl.cxx + +Change-Id: I4e90e852b314bf6f7885bde7b450dab7c668469e +Reviewed-on: https://gerrit.libreoffice.org/764 +Reviewed-by: Fridrich Strba <fridr...@documentfoundation.org> +Tested-by: Fridrich Strba <fridr...@documentfoundation.org> +--- + sw/source/core/docnode/ndtbl.cxx | 51 ++++++++++++++++++-------------------- + 1 file changed, 24 insertions(+), 27 deletions(-) + +diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx +index ca006bc..248378a 100644 +--- a/sw/source/core/docnode/ndtbl.cxx ++++ b/sw/source/core/docnode/ndtbl.cxx +@@ -1260,6 +1260,29 @@ SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange) + return pResult; + } + ++static void ++lcl_SetTableBoxWidths2(SwTable & rTable, size_t const nMaxBoxes, ++ SwTableBoxFmt & rBoxFmt, SwDoc & rDoc) ++{ ++ // rhbz#820283, fdo#55462: set default box widths so table width is covered ++ SwTableLines & rLines = rTable.GetTabLines(); ++ for (size_t nTmpLine = 0; nTmpLine < rLines.Count(); ++nTmpLine) ++ { ++ SwTableBoxes & rBoxes = rLines[nTmpLine]->GetTabBoxes(); ++ size_t const nMissing = nMaxBoxes - rBoxes.Count(); ++ if (nMissing) ++ { ++ // default width for box at the end of an incomplete line ++ SwTableBoxFmt *const pNewFmt = rDoc.MakeTableBoxFmt(); ++ pNewFmt->SetFmtAttr( SwFmtFrmSize(ATT_VAR_SIZE, ++ (USHRT_MAX / nMaxBoxes) * (nMissing + 1)) ); ++ pNewFmt->Add(rBoxes[rBoxes.Count() - 1]); ++ } ++ } ++ // default width for all boxes not at the end of an incomplete line ++ rBoxFmt.SetFmtAttr(SwFmtFrmSize(ATT_VAR_SIZE, USHRT_MAX / nMaxBoxes)); ++} ++ + SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, + SwTableFmt* pTblFmt, + SwTableLineFmt* pLineFmt, +@@ -1371,33 +1394,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, + nMaxBoxes = nBoxes; + } + +- // die Tabelle ausgleichen, leere Sections einfuegen +- sal_uInt16 n; +- +- if( !aPosArr.empty() ) +- { +- SwTableLines& rLns = pTable->GetTabLines(); +- sal_uInt16 nLastPos = 0; +- for( n = 0; n < aPosArr.size(); ++n ) +- { +- SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt(); +- pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, +- aPosArr[ n ] - nLastPos )); +- for( sal_uInt16 nLines2 = 0; nLines2 < rLns.Count(); ++nLines2 ) +- //JP 24.06.98: hier muss ein Add erfolgen, da das BoxFormat +- // von der rufenden Methode noch gebraucht wird! +- pNewFmt->Add( rLns[ nLines2 ]->GetTabBoxes()[ n ] ); +- +- nLastPos = aPosArr[ n ]; +- } +- +- // damit die Tabelle die richtige Groesse bekommt, im BoxFormat die +- // Groesse nach "oben" transportieren. +- OSL_ENSURE( !pBoxFmt->GetDepends(), "wer ist in dem Format noch angemeldet" ); +- pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nLastPos )); +- } +- else +- pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX / nMaxBoxes )); ++ lcl_SetTableBoxWidths2(*pTable, nMaxBoxes, *pBoxFmt, *pDoc); + + // das wars doch wohl ?? + return pTblNd; +-- +1.7.10.4 + diff --git a/patches/series b/patches/series index 4908b91..0561256 100644 --- a/patches/series +++ b/patches/series @@ -50,3 +50,4 @@ lp-1097727-rhbz-846775-Clipboard-must-be-disposed-befo.diff lp-1097735-fdo-48442-fix-default-hori-vert-frame-anchor-during-.diff lp-1097744-fdo-49517-Revert-fdo-46102-Load-Java-scripts-with-cl.diff lp-1097748-fdo-49819-fdo-54609-Do-not-consider-timestamp-differ.diff +lp-1097760-rhbz-820283-fdo-55462-sw-better-fix-for-DOCX-table-i.diff -- LibreOffice packaging repository -- To UNSUBSCRIBE, email to debian-openoffice-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1ttcmm-0003ad...@vasks.debian.org