summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-01-19 16:27:41 +0300
committerCaolán McNamara <caolanm@redhat.com>2017-01-25 20:34:14 +0000
commita47cada052427bc5cf6123b11e3643a3a8a8516a (patch)
tree74d156eb5f61c09f083c259478e0d09f66c7a12e
parentdcd89d24f0837f85a359f2630981d985a9811d86 (diff)
tdf#96277 revert ww8 import: fix upper margin of floating table
commit 3755c87d0426a499d4755e82d8fbc77caa240764 mis-positions non-textframed floating tables. The patch only worked under very ideal circumstances that cannot be identified during import time. Lots of bug reports indicate real world problems with it. This is a pretty safe revert because the code only processes a document one time, so old documents don't depend on this to work. Change-Id: I3b94d27901a20e46c2f5fd4305041d1d28acf33a Reviewed-on: https://gerrit.libreoffice.org/33322 Reviewed-by: Justin Luth <justin_luth@sil.org> Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 895f4bc27d518ecaa054d812fa6c24fd4301d327) Reviewed-on: https://gerrit.libreoffice.org/33503 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rwxr-xr-x[-rw-r--r--]sw/qa/extras/ww8export/data/bnc863018b.doc (renamed from sw/qa/extras/ww8import/data/bnc863018.doc)bin26624 -> 26624 bytes
-rwxr-xr-xsw/qa/extras/ww8export/data/tdf96277.docbin0 -> 48128 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx13
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx10
-rw-r--r--sw/source/filter/ww8/ww8par.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par.hxx4
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx11
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx20
8 files changed, 22 insertions, 44 deletions
diff --git a/sw/qa/extras/ww8import/data/bnc863018.doc b/sw/qa/extras/ww8export/data/bnc863018b.doc
index ab7511b57e0a..c9744b856d27 100644..100755
--- a/sw/qa/extras/ww8import/data/bnc863018.doc
+++ b/sw/qa/extras/ww8export/data/bnc863018b.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf96277.doc b/sw/qa/extras/ww8export/data/tdf96277.doc
new file mode 100755
index 000000000000..904b2da13277
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf96277.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index bf6b36feef99..3259d230c6f0 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -40,6 +40,19 @@ DECLARE_WW8EXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.doc
CPPUNIT_ASSERT_EQUAL( 2, getPages() );
}
+DECLARE_WW8EXPORT_TEST(testTdf96277, "tdf96277.doc")
+{
+ // mismatch between anchoring at paragraph and ULSpacing to Page
+ CPPUNIT_ASSERT_EQUAL( 1, getPages() );
+}
+
+DECLARE_WW8EXPORT_TEST(testBnc863018b, "bnc863018b.doc")
+{
+ // The whitespace above the table should allow text to flow between the table anchor and the table.
+ // Since it doesn't, don't add the whitespace.
+ CPPUNIT_ASSERT_EQUAL( 1, getPages() );
+}
+
DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
{
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WW8Num1"), uno::UNO_QUERY);
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 85f4ca311e9c..b26c3dba9dcb 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -42,16 +42,6 @@ DECLARE_WW8IMPORT_TEST(testN816593, "n816593.doc")
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
}
-DECLARE_WW8IMPORT_TEST(testBnc863018, "bnc863018.doc")
-{
- // The problem was that there should be some whitespace above the table,
- // but there wasn't.
- uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
- // This was 0.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(5002), getProperty<sal_Int32>(xTable, "TopMargin"));
-}
DECLARE_WW8IMPORT_TEST(testBnc875715, "bnc875715.doc")
{
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 10094cf44931..80749085cb86 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2714,13 +2714,9 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
m_aApos[m_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)
{
- m_aApos[m_nInTable] = StartApo(aApo, pTabPos, &aULSpaceItem);
+ m_aApos[m_nInTable] = StartApo(aApo, pTabPos);
// We need an ReSync after StartApo
// (actually only if the Apo extends past a FKP border)
rbReSync = true;
@@ -2736,7 +2732,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
if(m_nInTable < nCellLevel)
{
- if (StartTable(nStartCp, &aULSpaceItem))
+ if (StartTable(nStartCp))
++m_nInTable;
else
break;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index dd7e397796c1..7a986b677b05 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1468,7 +1468,7 @@ private:
//Apo == Absolutely Positioned Object, MSWord's old-style frames
WW8FlyPara *ConstructApo(const ApoTestResults &rApo,
const WW8_TablePos *pTabPos);
- bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos, SvxULSpaceItem* pULSpaceItem);
+ bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
void StopApo();
bool TestSameApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd,
@@ -1519,7 +1519,7 @@ private:
void ReadDocVars();
- bool StartTable(WW8_CP nStartCp, SvxULSpaceItem* pULSpaceItem);
+ bool StartTable(WW8_CP nStartCp);
bool InEqualApo(int nLvl) const;
bool InLocalApo() const { return InEqualApo(m_nInTable); }
bool InEqualOrHigherApo(int nLvl) const;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 7bf86eb8e748..1ec8199bd1c6 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -191,7 +191,7 @@ public:
WW8TabDesc( SwWW8ImplReader* pIoClass, WW8_CP nStartCp );
bool Ok() const { return m_bOk; }
- void CreateSwTable(SvxULSpaceItem* pULSpaceItem);
+ void CreateSwTable();
void UseSwTable();
void SetSizePosition(SwFrameFormat* pFrameFormat);
void TableCellEnd();
@@ -2340,7 +2340,7 @@ void wwSectionManager::PrependedInlineNode(const SwPosition &rPos,
maSegments.back().maStart.Assign(rNode);
}
-void WW8TabDesc::CreateSwTable(SvxULSpaceItem* pULSpaceItem)
+void WW8TabDesc::CreateSwTable()
{
::SetProgressState(m_pIo->m_nProgress, m_pIo->m_pDocShell); // Update
@@ -2396,9 +2396,6 @@ void WW8TabDesc::CreateSwTable(SvxULSpaceItem* pULSpaceItem)
if (!m_pTable || !m_pTable->GetFrameFormat())
return;
- if (pULSpaceItem && pULSpaceItem->GetUpper() != 0)
- m_aItemSet.Put(*pULSpaceItem);
-
SwTableNode* pTableNode = m_pTable->GetTableNode();
OSL_ENSURE(pTableNode, "no table node!");
if (pTableNode)
@@ -3330,7 +3327,7 @@ void WW8TabDesc::SetNumRuleName( const OUString& rName )
m_aNumRuleNames[nCol] = rName;
}
-bool SwWW8ImplReader::StartTable(WW8_CP nStartCp, SvxULSpaceItem* pULSpaceItem)
+bool SwWW8ImplReader::StartTable(WW8_CP nStartCp)
{
// Entering a table so make sure the FirstPara flag gets set
m_bFirstPara = true;
@@ -3413,7 +3410,7 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp, SvxULSpaceItem* pULSpaceItem)
"Not the anchor type requested!" );
MoveInsideFly(m_pTableDesc->m_pFlyFormat);
}
- m_pTableDesc->CreateSwTable(pULSpaceItem);
+ m_pTableDesc->CreateSwTable();
if (m_pTableDesc->m_pFlyFormat)
{
m_pTableDesc->SetSizePosition(m_pTableDesc->m_pFlyFormat);
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 0477795fe412..d1f9e76ba051 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2307,9 +2307,7 @@ bool SwWW8ImplReader::IsDropCap()
return false;
}
-bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo,
- const WW8_TablePos *pTabPos,
- SvxULSpaceItem* pULSpaceItem)
+bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos)
{
if (nullptr == (m_pWFlyPara = ConstructApo(rApo, pTabPos)))
return false;
@@ -2344,22 +2342,6 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo,
if (pTabPos && pTabPos->bNoFly)
{
m_pSFlyPara->pFlyFormat = nullptr;
- if (pULSpaceItem)
- {
- // Word positioned tables can have a position (like a
- // fly-frame), but they also support flowing across multiple
- // pages. If we decide to import this as a normal table (so it
- // can flow across multiple pages), then turn the vertical
- // orientation position of the fly into a table upper margin.
- const SfxPoolItem* pItem = nullptr;
- if (aFlySet.HasItem(RES_VERT_ORIENT, &pItem))
- {
- const SwFormatVertOrient* pOrient = static_cast<const SwFormatVertOrient*>(pItem);
- SwTwips nPos = pOrient->GetPos();
- if( 0 < nPos && nPos <= SAL_MAX_UINT16 )
- pULSpaceItem->SetUpper( sal_uInt16(nPos) );
- }
- }
}
else
{