d07df49824
* impress-table-performance.patch - bnc#863018 - LO-L3: Missing text in imported .doc file * WW8-import-fix-upper-margin-of-multi-page.patch - bnc#875717 - LO-L3: DOCX import: font size of numbering is bigger * direct-format-numbering.patch - bnc#875718 - LO-L3: DOCX import: extra page numbers * discard-more-header-footer-stuff.patch - Security update CVE-2014-0247 * Use-varying-aElement-name.patch OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=157
172 lines
6.6 KiB
Diff
172 lines
6.6 KiB
Diff
From 9d981abc3f310adf9af3454dd515ea356b31d3c1 Mon Sep 17 00:00:00 2001
|
|
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
|
Date: Mon, 26 May 2014 12:04:39 +0200
|
|
Subject: [PATCH] bnc#863018 WW8 import: fix upper margin of multi-page
|
|
floating table
|
|
|
|
A vert orient position was already handled in case a floating table was
|
|
imported as a TextFrame, but in case we didn't do that, the vert orient
|
|
position was simply lost.
|
|
|
|
Fix this by importing it as the upper margin of the table (assuming that
|
|
the position is relative from the anchor position).
|
|
|
|
(cherry picked from commit 3755c87d0426a499d4755e82d8fbc77caa240764)
|
|
|
|
Change-Id: I3e96f3068605fd6313dfb3e55483e1bce6c063a5
|
|
Reviewed-on: https://gerrit.libreoffice.org/9487
|
|
Reviewed-by: Andras Timar <andras.timar@collabora.com>
|
|
Tested-by: Andras Timar <andras.timar@collabora.com>
|
|
---
|
|
|
|
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
|
|
index 213e996..0725a9a 100644
|
|
--- a/sw/source/filter/ww8/ww8par.cxx
|
|
+++ b/sw/source/filter/ww8/ww8par.cxx
|
|
@@ -2726,9 +2726,13 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
|
|
maApos[nInTable] = false;
|
|
}
|
|
|
|
+ // So that SwWW8ImplReader::StartApo() can write into this, and
|
|
+ // WW8TabDesc::CreateSwTable() can read it, if necessary.
|
|
+ SvxULSpaceItem aULSpaceItem(RES_UL_SPACE);
|
|
+
|
|
if (aApo.mbStartApo)
|
|
{
|
|
- maApos[nInTable] = StartApo(aApo, pTabPos);
|
|
+ maApos[nInTable] = StartApo(aApo, pTabPos, &aULSpaceItem);
|
|
// We need an ReSync after StartApo
|
|
// (actually only if the Apo extends past a FKP border)
|
|
rbReSync = true;
|
|
@@ -2744,7 +2748,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
|
|
|
|
if(nInTable < nCellLevel)
|
|
{
|
|
- if (StartTable(nStartCp))
|
|
+ if (StartTable(nStartCp, &aULSpaceItem))
|
|
++nInTable;
|
|
else
|
|
break;
|
|
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
|
|
index 28dca2e..772da4c 100644
|
|
--- a/sw/source/filter/ww8/ww8par.hxx
|
|
+++ b/sw/source/filter/ww8/ww8par.hxx
|
|
@@ -1473,7 +1473,7 @@ private:
|
|
|
|
WW8FlyPara *ConstructApo(const ApoTestResults &rApo,
|
|
const WW8_TablePos *pTabPos);
|
|
- bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
|
|
+ bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos, SvxULSpaceItem* pULSpaceItem = 0);
|
|
void StopApo();
|
|
bool TestSameApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
|
|
ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd,
|
|
@@ -1523,7 +1523,7 @@ private:
|
|
|
|
void ReadDocVars();
|
|
|
|
- bool StartTable(WW8_CP nStartCp);
|
|
+ bool StartTable(WW8_CP nStartCp, SvxULSpaceItem* pULSpaceItem = 0);
|
|
bool InEqualApo(int nLvl) const;
|
|
bool InLocalApo() const { return InEqualApo(nInTable); }
|
|
bool InEqualOrHigherApo(int nLvl) const;
|
|
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
|
|
index f94e055..fcb5b50 100644
|
|
--- a/sw/source/filter/ww8/ww8par2.cxx
|
|
+++ b/sw/source/filter/ww8/ww8par2.cxx
|
|
@@ -29,6 +29,7 @@
|
|
#include <editeng/brushitem.hxx>
|
|
#include <editeng/boxitem.hxx>
|
|
#include <editeng/lrspitem.hxx>
|
|
+#include <editeng/ulspitem.hxx>
|
|
#include <editeng/fhgtitem.hxx>
|
|
#include <editeng/hyphenzoneitem.hxx>
|
|
#include <editeng/frmdiritem.hxx>
|
|
@@ -178,7 +179,7 @@ public:
|
|
|
|
WW8TabDesc( SwWW8ImplReader* pIoClass, WW8_CP nStartCp );
|
|
bool Ok() const { return bOk; }
|
|
- void CreateSwTable();
|
|
+ void CreateSwTable(SvxULSpaceItem* pULSpaceItem = 0);
|
|
void UseSwTable();
|
|
void SetSizePosition(SwFrmFmt* pFrmFmt);
|
|
void TableCellEnd();
|
|
@@ -2324,7 +2325,7 @@ void wwSectionManager::PrependedInlineNode(const SwPosition &rPos,
|
|
maSegments.back().maStart = SwNodeIndex(rNode);
|
|
}
|
|
|
|
-void WW8TabDesc::CreateSwTable()
|
|
+void WW8TabDesc::CreateSwTable(SvxULSpaceItem* pULSpaceItem)
|
|
{
|
|
::SetProgressState(pIo->nProgress, pIo->mpDocShell); // Update
|
|
|
|
@@ -2380,6 +2381,9 @@ void WW8TabDesc::CreateSwTable()
|
|
if (!pTable || !pTable->GetFrmFmt())
|
|
return;
|
|
|
|
+ if (pULSpaceItem && pULSpaceItem->GetUpper() != 0)
|
|
+ aItemSet.Put(*pULSpaceItem);
|
|
+
|
|
SwTableNode* pTableNode = pTable->GetTableNode();
|
|
OSL_ENSURE(pTableNode, "no table node!");
|
|
if (pTableNode)
|
|
@@ -3319,7 +3323,7 @@ void WW8TabDesc::SetNumRuleName( const OUString& rName )
|
|
aNumRuleNames[nCol] = rName;
|
|
}
|
|
|
|
-bool SwWW8ImplReader::StartTable(WW8_CP nStartCp)
|
|
+bool SwWW8ImplReader::StartTable(WW8_CP nStartCp, SvxULSpaceItem* pULSpaceItem)
|
|
{
|
|
// Entering a table so make sure the FirstPara flag gets set
|
|
bFirstPara = true;
|
|
@@ -3395,7 +3399,7 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp)
|
|
"Not the anchor type requested!" );
|
|
MoveInsideFly(pTableDesc->pFlyFmt);
|
|
}
|
|
- pTableDesc->CreateSwTable();
|
|
+ pTableDesc->CreateSwTable(pULSpaceItem);
|
|
if (pTableDesc->pFlyFmt)
|
|
{
|
|
pTableDesc->SetSizePosition(pTableDesc->pFlyFmt);
|
|
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
|
|
index 43c93cd..066b8db 100644
|
|
--- a/sw/source/filter/ww8/ww8par6.cxx
|
|
+++ b/sw/source/filter/ww8/ww8par6.cxx
|
|
@@ -2286,7 +2286,8 @@ bool SwWW8ImplReader::IsDropCap()
|
|
}
|
|
|
|
bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo,
|
|
- const WW8_TablePos *pTabPos)
|
|
+ const WW8_TablePos *pTabPos,
|
|
+ SvxULSpaceItem* pULSpaceItem)
|
|
{
|
|
if (0 == (pWFlyPara = ConstructApo(rApo, pTabPos)))
|
|
return false;
|
|
@@ -2321,7 +2322,24 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo,
|
|
WW8FlySet aFlySet(*this, pWFlyPara, pSFlyPara, false);
|
|
|
|
if (pTabPos && pTabPos->bNoFly)
|
|
+ {
|
|
pSFlyPara->pFlyFmt = 0;
|
|
+ if (pULSpaceItem)
|
|
+ {
|
|
+ // Word positioned tables can have a position (like a
|
|
+ // fly-frame), but they also support flowing accross multiple
|
|
+ // pages. If we decide to import this as a normal table (so it
|
|
+ // can flow accross multiple pages), then turn the vertical
|
|
+ // orientation position of the fly into a table upper margin.
|
|
+ const SfxPoolItem* pItem = 0;
|
|
+ if (aFlySet.HasItem(RES_VERT_ORIENT, &pItem))
|
|
+ {
|
|
+ const SwFmtVertOrient* pOrient = static_cast<const SwFmtVertOrient*>(pItem);
|
|
+ if (pOrient->GetPos() != 0)
|
|
+ pULSpaceItem->SetUpper(pOrient->GetPos());
|
|
+ }
|
|
+ }
|
|
+ }
|
|
else
|
|
{
|
|
pSFlyPara->pFlyFmt = rDoc.MakeFlySection( pSFlyPara->eAnchor,
|
|
--
|
|
1.8.4.5
|
|
|