[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth
justin_luth at sil.org
Mon Jan 23 09:17:09 UTC 2017
dev/null |binary
sw/qa/extras/ww8export/data/bnc863018b.doc |binary
sw/qa/extras/ww8export/data/tdf96277.doc |binary
sw/qa/extras/ww8export/ww8export2.cxx | 13 +++++++++++++
sw/qa/extras/ww8import/ww8import.cxx | 10 ----------
sw/source/filter/ww8/ww8par.cxx | 8 ++------
sw/source/filter/ww8/ww8par.hxx | 4 ++--
sw/source/filter/ww8/ww8par2.cxx | 11 ++++-------
sw/source/filter/ww8/ww8par6.cxx | 20 +-------------------
9 files changed, 22 insertions(+), 44 deletions(-)
New commits:
commit 895f4bc27d518ecaa054d812fa6c24fd4301d327
Author: Justin Luth <justin_luth at sil.org>
Date: Thu Jan 19 16:27:41 2017 +0300
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 at sil.org>
Tested-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/extras/ww8import/data/bnc863018.doc b/sw/qa/extras/ww8export/data/bnc863018b.doc
old mode 100644
new mode 100755
similarity index 63%
rename from sw/qa/extras/ww8import/data/bnc863018.doc
rename to sw/qa/extras/ww8export/data/bnc863018b.doc
index ab7511b..c9744b8
Binary files a/sw/qa/extras/ww8import/data/bnc863018.doc and b/sw/qa/extras/ww8export/data/bnc863018b.doc differ
diff --git a/sw/qa/extras/ww8export/data/tdf96277.doc b/sw/qa/extras/ww8export/data/tdf96277.doc
new file mode 100755
index 0000000..904b2da
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf96277.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 6f72cd8..6dc17cc 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -44,6 +44,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 f26f1cb..c7f488f 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 25f499a..130808a 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2709,13 +2709,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;
@@ -2731,7 +2727,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 dd7e397..7a986b6 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 bc1c24e..4d20e67 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)
@@ -3345,7 +3342,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;
@@ -3428,7 +3425,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 0477795..d1f9e76 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
{
More information about the Libreoffice-commits
mailing list