[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-08-02 Thread Justin Luth
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx   |3 +++
 writerfilter/source/dmapper/PropertyMap.cxx |   21 +++--
 2 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 234df2fb5901588ccf20cb35cb4c5922aeb89817
Author: Justin Luth 
Date:   Sat Jul 29 11:38:10 2017 -0400

tdf#108944 writerfilter: fix missing footnote separator

Fix regression from e79ef12b7a904f17d4147fa409d055c12b70f952
   tdf#107033 DOCX import: fix unexpected missing footnote separator.
Initially related to tdf#68787.

If HandleMarginsHeaderFooter was called twice, then it automatically
would have disabled the separator. Clearing the HasFtn/HasFtnSep flags
also shouldn't be run when in the footnote sections.

Reviewed-on: https://gerrit.libreoffice.org/40551
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 6f57c09aadd40009173f8ae3654004dd0cad9fb8)

Change-Id: I00cbd1cbc8dc86edf426f852c59c3f943e373b13
Reviewed-on: https://gerrit.libreoffice.org/40590
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 08fafb1f25b3..6844e3ead9fc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -117,6 +117,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92470_footnoteRestart, 
"tdf92470_footnoteRestart
 SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
 CPPUNIT_ASSERT( pDoc );
 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote doesn't restart every Page", 
FTNNUM_PAGE, pDoc->GetFootnoteInfo().eNum );
+
+uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(static_cast(25), 
getProperty(xPageStyle, "FootnoteLineRelativeWidth"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt")
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 29fa2ab8c727..9ee8c0dacc65 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1037,17 +1037,12 @@ void SectionPropertyMap::HandleMarginsHeaderFooter(bool 
bFirstPage, DomainMapper
 
 if (rDM_Impl.m_oBackgroundColor)
 Insert(PROP_BACK_COLOR, uno::makeAny(*rDM_Impl.m_oBackgroundColor));
-if (rDM_Impl.m_bHasFtn)
+// Check for missing footnote separator only in case there is at least
+// one footnote.
+if (rDM_Impl.m_bHasFtn && !rDM_Impl.m_bHasFtnSep)
 {
-// Check for missing footnote separator only in case there is at least
-// one footnote.
-if (!rDM_Impl.m_bHasFtnSep)
-{
-// Set footnote line width to zero, document has no footnote 
separator.
-Insert(PROP_FOOTNOTE_LINE_RELATIVE_WIDTH, 
uno::makeAny(sal_Int32(0)));
-rDM_Impl.m_bHasFtn = false;
-}
-rDM_Impl.m_bHasFtnSep = false;
+// Set footnote line width to zero, document has no footnote separator.
+Insert(PROP_FOOTNOTE_LINE_RELATIVE_WIDTH, uno::makeAny(sal_Int32(0)));
 }
 
 /*** if headers/footers are available then the top/bottom margins of the
@@ -1449,6 +1444,12 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 }
 rDM_Impl.SetIsLastSectionGroup(false);
 rDM_Impl.SetIsFirstParagraphInSection(true);
+
+if ( !rDM_Impl.IsInFootOrEndnote() )
+{
+rDM_Impl.m_bHasFtn = false;
+rDM_Impl.m_bHasFtnSep = false;
+}
 }
 
 // Clear the flag that says we should take the header/footer content from
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-07-14 Thread Tamás Zolnai
 sw/qa/extras/ooxmlimport/data/tdf109053.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |7 +++
 writerfilter/source/dmapper/PropertyMap.cxx  |   27 +++
 3 files changed, 26 insertions(+), 8 deletions(-)

New commits:
commit 961afc771228c77c355a0c5fd8ff051e7e241bd2
Author: Tamás Zolnai 
Date:   Wed Jul 12 16:07:10 2017 +0200

tdf#109053: DOCX: Multipage table is not imported properly

An other use case when converting to a "floating table" is
not a good idea. In this case we can check whether next to
the table anything fits in the text area. If not then we
can avoid floating table conversion.

Reviewed-on: https://gerrit.libreoffice.org/39811
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 
(cherry picked from commit fc55711f01af172eb3a034454405fa941454c781)

Change-Id: I798a2f4c7a9dfe6aecbe4a73e3162b49ea5f0adc
Reviewed-on: https://gerrit.libreoffice.org/39931
Tested-by: Jenkins 
Reviewed-by: Andras Timar 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf109053.docx 
b/sw/qa/extras/ooxmlimport/data/tdf109053.docx
new file mode 100755
index ..f700c4d6a48d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf109053.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 32ec82962ed9..0c654b89c492 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1419,6 +1419,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf100072, "tdf100072.docx")
 CPPUNIT_ASSERT_MESSAGE("Shape line width does not match", abs(nFirstEnd - 
nSecondEnd) < 10);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf109053, "tdf109053.docx")
+{
+// Table was imported into a text frame which led to a one page document
+// Originally the table takes two pages, so Writer should import it 
accordingly.
+CPPUNIT_ASSERT_EQUAL(getPages(), 2);
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index ec79cb1ba653..29fa2ab8c727 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1094,16 +1094,27 @@ bool 
SectionPropertyMap::FloatingTableConversion(FloatingTableInfo& rInfo)
 }
 }
 
-// If the table is wider than the text area, then don't create a fly
-// for the table: no wrapping will be performed anyway, but multi-page
-// tables will be broken.
-if (nTableWidth < nTextAreaWidth)
+// It seems Word has a limit here, so that in case the table width is quite
+// close to the text area width, then it won't perform a wrapping, even in
+// case the content (e.g. an empty paragraph) would fit. The magic constant
+// here represents this limit.
+const sal_Int32 nMagicNumber = 469;
+
+// If the table's with is smaller than the text area width, text might
+// be next to the table and so it should behave as a floating table.
+if ( nTableWidth < nTextAreaWidth )
 return true;
 
-// If the position is relative to the edge of the page, then we always
-// create the fly.
-if (rInfo.getPropertyValue("HoriOrientRelation") == 
text::RelOrientation::PAGE_FRAME)
-return true;
+// If the position is relative to the edge of the page, then we need to 
check the whole
+// page width to see whether text can fit next to the table.
+if ( rInfo.getPropertyValue( "HoriOrientRelation" ) == 
text::RelOrientation::PAGE_FRAME )
+{
+// If the table is wide enough to that no text fits next to it, then 
don't create a fly
+// for the table: no wrapping will be performed anyway, but multi-page
+// tables will be broken.
+if ((nTableWidth + nMagicNumber) < (nPageWidth - 
std::min(GetLeftMargin(), GetRightMargin(
+return true;
+}
 
 // If there are columns, always create the fly, otherwise the columns would
 // restrict geometry of the table.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-05-25 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf106953.rtf |   23 +++
 sw/qa/extras/rtfimport/rtfimport.cxx  |9 +
 writerfilter/source/rtftok/rtfsprm.cxx|5 +
 3 files changed, 37 insertions(+)

New commits:
commit 0022ae02cfea1c5d69d9f4fedeeeb7a30cc4184b
Author: Miklos Vajna 
Date:   Tue May 16 08:34:40 2017 +0200

tdf#106953 RTF import: fix missing paragraph left margin

See commit 3915bf2dc877d5f1140798e24933db0f21386a4a (tdf#95376 DOCX
import: fix incorrectly indented tab stops, 2016-01-26) for the various
sources that can determine the paragraph indentation.

In this case the problem was that too aggressive RTF style deduplication
removed a direct indent, which then meant a fallback to the ind-from-num
value, not to the ind-from-parastyle one.

(cherry picked from commit f528f9499bd91b700c549575e88fa102cfffede9)

Change-Id: I3b47b2bbeaaedf405baef24505d23dc49bd01865
Reviewed-on: https://gerrit.libreoffice.org/37670
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/tdf106953.rtf 
b/sw/qa/extras/rtfimport/data/tdf106953.rtf
new file mode 100644
index ..398f9df78dcf
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf106953.rtf
@@ -0,0 +1,23 @@
+{\rtf \ansi \ansicpg0 \deff0 \stshfdbch1 \stshfloch0 \stshfhich0 \deflang1033 
\deflangfe1033
+{\stylesheet
+{\s19 \li720
+style;
+}
+}
+{\*\listtable
+{\list
+{\listlevel \levelnfc0 \levelnfcn0 \leveljc0 \leveljcn0 \levelstartat1 
\levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0
+{\leveltext\'02\'00.;
+}
+{\levelnumbers \'01
+{\uc1 \u59 ?}
+}
+\li720 \fi-360 }
+\listid697112958 }
+}
+{\*\listoverridetable
+{\listoverride \listid697112958 \listoverridecount0 \ls1 }
+}
+\pard \plain \s19 \fi-360 \li720 \ls1
+{hello\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index ca696d9c84f8..9d863e7c76a9 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1330,6 +1330,15 @@ DECLARE_RTFIMPORT_TEST(testN825305, "n825305.rtf")
 CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf106953, "tdf106953.rtf")
+{
+CPPUNIT_ASSERT_EQUAL(static_cast(1270), 
getProperty(getParagraph(1), "ParaLeftMargin"));
+uno::Reference xPropertyState(getParagraph(1), 
uno::UNO_QUERY);
+beans::PropertyState ePropertyState = 
xPropertyState->getPropertyState("ParaLeftMargin");
+// Was beans::PropertyState_DEFAULT_VALUE.
+CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
+}
+
 DECLARE_RTFIMPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf")
 {
 uno::Reference 
xPropertySet(getStyles("ParagraphStyles")->getByName("Standard"), 
uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx 
b/writerfilter/source/rtftok/rtfsprm.cxx
index 3f4f6659d2e8..b8f32ea48b69 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -163,6 +163,11 @@ static bool isSPRMDeduplicateBlacklist(Id nId)
 case NS_ooxml::LN_CT_TabStop_pos:
 // See the NS_ooxml::LN_CT_PPrBase_tabs handler in DomainMapper,
 // deduplication is explicitly not wanted for these tokens.
+// Erasing these just because they equal to the style one is
+// problematic, as then the used value won't be from the style, but
+// possibly from the numbering.
+case NS_ooxml::LN_CT_Ind_left:
+case NS_ooxml::LN_CT_Ind_right:
 return true;
 
 default:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-05-04 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf107033.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |   10 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |4 +++-
 writerfilter/source/dmapper/PropertyMap.cxx   |   15 ---
 5 files changed, 30 insertions(+), 5 deletions(-)

New commits:
commit cc6a55d687581db1a174b2a7d01f8a62887b5e24
Author: Miklos Vajna 
Date:   Wed May 3 08:39:31 2017 +0200

tdf#107033 DOCX import: fix unexpected missing footnote separator

Regression from commit 330b860205c7ba69dd6603f65324d0f89ad9cd5f
(fdo#68787 DOCX import: handle when w:separator is missing for
footnotes, 2013-09-04), the problem was footnote settings were modified
also in case there were no footnotes at all in the document.

Make the bug scenario and the original one working at the same time by
touching footnote settings only in case there is at least one footnote
in the current section.

(cherry picked from commit e79ef12b7a904f17d4147fa409d055c12b70f952)

Change-Id: I163d11769cbd97957662607fbedfba404181e002
Reviewed-on: https://gerrit.libreoffice.org/37228
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf107033.docx 
b/sw/qa/extras/ooxmlexport/data/tdf107033.docx
new file mode 100644
index ..f4e08a3d36e5
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107033.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 9e00e77da235..093aecd16901 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -246,10 +246,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103931, "tdf103931.docx")
 DECLARE_OOXMLEXPORT_TEST(testTdf107104, "tdf107104.docx")
 {
 CPPUNIT_ASSERT(getShape(1)->getSize().Width > 0);
-// This failed: the second arrow was invisible because it had zero height.
+// This failed: the second arrow was invisible because it had zero width.
 CPPUNIT_ASSERT(getShape(2)->getSize().Width > 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf107033, "tdf107033.docx")
+{
+uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+// This was 0: footnote separator was disabled even in case the document
+// had no footnotes.
+CPPUNIT_ASSERT_EQUAL(static_cast(25), 
getProperty(xPageStyle, "FootnoteLineRelativeWidth"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a9473ef74c68..d5348c8b0e6b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -236,6 +236,7 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_nTableDepth(0),
 m_nTableCellDepth(0),
 m_nLastTableCellParagraphDepth(0),
+m_bHasFtn(false),
 m_bHasFtnSep(false),
 m_bIgnoreNextPara(false),
 m_bIgnoreNextTab(false),
@@ -5337,6 +5338,9 @@ void DomainMapper_Impl::substream(Id rName,
 propSize[i] = m_aPropertyStacks[i].size();
 }
 #endif
+// Save "has footnote" state, which is specific to a section in the body
+// text, so state from substreams is not relevant.
+bool bHasFtn = m_bHasFtn;
 
 //finalize any waiting frames before starting alternate streams
 CheckUnregisteredFrameConversion();
@@ -5406,12 +5410,14 @@ void DomainMapper_Impl::substream(Id rName,
 
 getTableManager().endLevel();
 popTableManager();
+m_bHasFtn = bHasFtn;
 
 switch(rName)
 {
 case NS_ooxml::LN_footnote:
 case NS_ooxml::LN_endnote:
 m_pTableHandler->setHadFootOrEndnote(true);
+m_bHasFtn = true;
 break;
 }
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 7ec425151ee9..1b3daf38bb1b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -825,7 +825,9 @@ public:
 /// Table cell depth of the last finished paragraph.
 sal_Int32 m_nLastTableCellParagraphDepth;
 
-/// If the document has a footnote separator.
+/// If the current section has footnotes.
+bool m_bHasFtn;
+/// If the current section has a footnote separator.
 bool m_bHasFtnSep;
 
 /// If the next newline should be ignored, used by the special footnote 
separator paragraph.
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index cea2dc473a8d..0e7f0678aed3 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1037,9 +1037,18 @@ void 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-04-27 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf107104.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |4 +++-
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |7 +++
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |4 ++--
 writerfilter/source/dmapper/GraphicImport.cxx |6 ++
 5 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 7d3baea4a726d6c0cf6cb0d6a8b2c83cef4f580d
Author: Miklos Vajna 
Date:   Tue Apr 25 09:25:34 2017 +0200

tdf#107104 DOCX drawingML import: fix invisible arrow shape

This is the drawingML equivalent of commit
3d9ebded1358395ed81db7a63629b046aec2aeac (Misc improvements for docx VML
import, 2010-10-06), which made sure that shapes are never invisible
just because they have zero height or width.

For this particular bugdoc the Word-produced WW8 equivalent width is 20
twips, but let's be consistent with the VML import and just round up to
1 mm100.

Also fix two existing tests that wanted to test something else, but
implicitly asserted that some shapes indeed have zero width/height.

(cherry picked from commit e6e5a68f52f4e06b73f0ece3a3886f3bfc30f56d)

Change-Id: I9600424520d0a3deecc711b44622eccc041a59da
Reviewed-on: https://gerrit.libreoffice.org/36953
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf107104.docx 
b/sw/qa/extras/ooxmlexport/data/tdf107104.docx
new file mode 100644
index ..2f8c87d8d3d5
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107104.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 80f28f09875a..2891b3ff162f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -909,7 +909,9 @@ DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx")
 xmlDocPtr pXmlDoc = parseExport();
 if (!pXmlDoc)
 return;
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent","cx","0");
+sal_Int32 nX = getXPath(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent",
 "cx").toInt32();
+// This was negative.
+CPPUNIT_ASSERT(nX >= 0);
 }
 
 // part of tdf#93676, word gives the frame in the exported .docx a huge height,
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 99695f570cc7..9e00e77da235 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -243,6 +243,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103931, "tdf103931.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(3), xTextSections->getCount());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf107104, "tdf107104.docx")
+{
+CPPUNIT_ASSERT(getShape(1)->getSize().Width > 0);
+// This failed: the second arrow was invisible because it had zero height.
+CPPUNIT_ASSERT(getShape(2)->getSize().Width > 0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 65ca9029923c..989d5fb34f34 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1215,8 +1215,8 @@ DECLARE_OOXMLIMPORT_TEST(testTdf96674, "tdf96674.docx")
 uno::Reference xShape(getShape(1), uno::UNO_QUERY);
 CPPUNIT_ASSERT(xShape.is());
 awt::Size aActualSize(xShape->getSize());
-// This was 3493: the vertical line was horizontal.
-CPPUNIT_ASSERT_EQUAL(static_cast(0), aActualSize.Width);
+// Width was 3493: the vertical line was horizontal.
+CPPUNIT_ASSERT(aActualSize.Width < aActualSize.Height);
 CPPUNIT_ASSERT(aActualSize.Height > 0);
 }
 
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index f9458182505f..991b1461ed8d 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -543,6 +543,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 case NS_ooxml::LN_CT_PositiveSize2D_cy:
 {
 sal_Int32 nDim = oox::drawingml::convertEmuToHmm(nIntValue);
+// drawingML equivalent of oox::vml::ShapeType::getAbsRectangle():
+// make sure a shape isn't hidden implicitly just because it has
+// zero height or width.
+if (nDim == 0)
+nDim = 1;
+
 if( nName == NS_ooxml::LN_CT_PositiveSize2D_cx )
 m_pImpl->setXSize(nDim);
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-04-20 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf107116.rtf |   10 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |6 ++
 writerfilter/source/rtftok/rtfsprm.cxx|   21 -
 3 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit c8c90854506cc7f1c3d7084ab97c156aead003e2
Author: Miklos Vajna 
Date:   Wed Apr 19 09:08:46 2017 +0200

tdf#107116 RTF import: fix missing upper and lower borders around text

See commit 1be0a3fa9ebb22b607c54b47739d4467acfed259 (n#825305:
writerfilter RTF import: override style properties like Word,
2014-06-17) for the context.

Here the problem was that various details of the top border were removed
during the style deduplication, but not the top border sprm itself. That
was interpreted (correctly) by dmapper as "no border", rather than
"inherit from style".

(cherry picked from commit e9f0d8d02885eca619552b19eab30c1eade9e7ef)

Change-Id: I3dec8df789fc7b75fccfff91ce66f457fecd2f6e
Reviewed-on: https://gerrit.libreoffice.org/36692
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfimport/data/tdf107116.rtf 
b/sw/qa/extras/rtfimport/data/tdf107116.rtf
new file mode 100644
index ..17c2f5b61a59
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf107116.rtf
@@ -0,0 +1,10 @@
+{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;
+\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+{\stylesheet
+{\s15\brdrt\brdrs\brdrw15\brsp120\brdrcf15 
\brdrb\brdrs\brdrw15\brsp120\brdrcf15 \snext15 style;}
+}
+\pard\plain before\par
+\pard\plain \s15\brdrt\brdrs\brdrw15\brsp120\brdrcf15 
\brdrb\brdrs\brdrw15\brsp120\brdrcf15 border \par
+\pard\plain after\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 8fee2ab2fcd1..ca696d9c84f8 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2760,6 +2760,12 @@ DECLARE_RTFIMPORT_TEST(testTdf106694, "tdf106694.rtf")
 CPPUNIT_ASSERT_EQUAL(static_cast(14605), aTabs[0].Position);
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf107116, "tdf107116.rtf")
+{
+// This was 0, upper border around text (and its distance) was missing.
+CPPUNIT_ASSERT_EQUAL(static_cast(convertTwipToMm100(120)), 
getProperty(getParagraph(2), "TopBorderDistance"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx 
b/writerfilter/source/rtftok/rtfsprm.cxx
index 7afee14a4189..3f4f6659d2e8 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -170,6 +170,23 @@ static bool isSPRMDeduplicateBlacklist(Id nId)
 }
 }
 
+/// Should this SPRM be removed if all its children is removed?
+static bool isSPRMChildrenExpected(Id nId)
+{
+switch (nId)
+{
+case NS_ooxml::LN_CT_PBdr_top:
+case NS_ooxml::LN_CT_PBdr_left:
+case NS_ooxml::LN_CT_PBdr_bottom:
+case NS_ooxml::LN_CT_PBdr_right:
+// Expected children are NS_ooxml::LN_CT_Border_*.
+return true;
+
+default:
+return false;
+}
+}
+
 /// Does the clone / deduplication of a single sprm.
 static void cloneAndDeduplicateSprm(std::pair& rSprm, 
RTFSprms& ret)
 {
@@ -185,7 +202,9 @@ static void cloneAndDeduplicateSprm(std::pair& rSprm, R
 {
 RTFSprms const 
sprms(pValue->getSprms().cloneAndDeduplicate(rSprm.second->getSprms()));
 RTFSprms const 
attributes(pValue->getAttributes().cloneAndDeduplicate(rSprm.second->getAttributes()));
-ret.set(rSprm.first, 
RTFValue::Pointer_t(pValue->CloneWithSprms(attributes, sprms)));
+// Don't copy the sprm in case we expect it to have children but 
it doesn't have some.
+if (!isSPRMChildrenExpected(rSprm.first) || !sprms.empty() || 
!attributes.empty())
+ret.set(rSprm.first, 
RTFValue::Pointer_t(pValue->CloneWithSprms(attributes, sprms)));
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-04-13 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf106970.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |9 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   18 +++---
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit e57873156d3c04ecc34bb5f38b186ebe29567f0c
Author: Miklos Vajna 
Date:   Tue Apr 11 08:54:36 2017 +0200

tdf#106970 DOCX import: don't collapse para auto space for different nums

Commit 1bf7f6a1a50ee9f24a3687240fe6ae390b905a6b (tdf#106690 DOCX import:
fix automatic spacing before/after numbered para block, 2017-04-04) made
sure that autospacing is only collapsed in case the adjacent text nodes
both have a numbering rule.

It turns out there is an additional condition: even if both text nodes
have a numbering rule, do the collapsing only in case they have the same
numbering rule.

(cherry picked from commit e1c83d0514e6123faa50ad0a7aa6a9031b271c9a)

Change-Id: Idb7a2b24d7eaa9094cc36f86b8a483045a33d028
Reviewed-on: https://gerrit.libreoffice.org/36510
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf106970.docx 
b/sw/qa/extras/ooxmlexport/data/tdf106970.docx
new file mode 100644
index ..8a534558b641
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106970.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index e48f51824749..99695f570cc7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -58,6 +58,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106690, "tdf106690.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(494), 
getProperty(getParagraph(2), "ParaTopMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf106970, "tdf106970.docx")
+{
+// The second paragraph (first numbered one) had 0 bottom margin:
+// autospacing was even collapsed between different numbering styles.
+CPPUNIT_ASSERT_EQUAL(static_cast(494), 
getProperty(getParagraph(2), "ParaBottomMargin"));
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(getParagraph(3), "ParaBottomMargin"));
+CPPUNIT_ASSERT_EQUAL(static_cast(494), 
getProperty(getParagraph(4), "ParaBottomMargin"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf89377, 
"tdf89377_tableWithBreakBeforeParaStyle.docx")
 {
 // the paragraph style should set table's text-flow break-before-page
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 236436cbd362..a9473ef74c68 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1178,10 +1178,22 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap )
 });
 if (itNumberingRules != aProperties.end())
 {
-// This textnode has numbering.
-if (m_xPreviousParagraph.is() && 
m_xPreviousParagraph->getPropertyValue("NumberingRules").hasValue())
+// This textnode has numbering. Look up the numbering 
style name of the current and previous paragraph.
+OUString aCurrentNumberingRuleName;
+uno::Reference 
xCurrentNumberingRules(itNumberingRules->Value, uno::UNO_QUERY);
+if (xCurrentNumberingRules.is())
+aCurrentNumberingRuleName = 
xCurrentNumberingRules->getName();
+OUString aPreviousNumberingRuleName;
+if (m_xPreviousParagraph.is())
 {
-// There was a previous textnode and it had 
numbering.
+uno::Reference 
xPreviousNumberingRules(m_xPreviousParagraph->getPropertyValue("NumberingRules"),
 uno::UNO_QUERY);
+if (xPreviousNumberingRules.is())
+aPreviousNumberingRuleName = 
xPreviousNumberingRules->getName();
+}
+
+if (!aPreviousNumberingRuleName.isEmpty() && 
aCurrentNumberingRuleName == aPreviousNumberingRuleName)
+{
+// There was a previous textnode and it had the 
same numbering.
 if (m_bParaAutoBefore)
 {
 // This before spacing is set to auto, set 
before space to 0.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-04-12 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf106690.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |9 
 writerfilter/source/dmapper/DomainMapper.cxx  |7 ---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   45 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |5 ++
 5 files changed, 59 insertions(+), 7 deletions(-)

New commits:
commit 776839b8bfc6eed905ce97c6fe32af8deb8d1451
Author: Miklos Vajna 
Date:   Tue Apr 4 09:12:34 2017 +0200

tdf#106690 DOCX import: fix automatic spacing before/after numbered para 
block

The context is text nodes with automatic before/after spacing and
numbering rules set, like:

A
* B
* C
* D
E

The correct behavior seems to be (though I haven't found this explicitly
written in the OOXML spec) to drop spacing between B and C and C and D,
but not before B and not after D. Originally no spacing was dropped,
then commit c486e875de7c8e845594f5043a37ee8800865782 (tdf#95031 DOCX
import: auto spacing inside numbering means no spacing, 2016-10-18)
removed spacing around all B/C/D.

Fix the problem by checking the numbering rules and automatic after
spacing of the previous paragraph, so spacing before B and after D is
not removed.

Change-Id: Icbdb36e31057ab0e8ac033888cf5cc7c52dad5d0
Reviewed-on: https://gerrit.libreoffice.org/36062
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 
(cherry picked from commit 1bf7f6a1a50ee9f24a3687240fe6ae390b905a6b)
Reviewed-on: https://gerrit.libreoffice.org/36142
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf106690.docx 
b/sw/qa/extras/ooxmlexport/data/tdf106690.docx
new file mode 100644
index ..b233ef81c6cf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106690.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 786074a40849..e48f51824749 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -49,6 +49,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95031, "tdf95031.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(getParagraph(3), "ParaTopMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf106690, "tdf106690.docx")
+{
+// This was 0, numbering rules with automatic spacing meant 0
+// before/autospacing for all text nodes, even for ones at the start/end of
+// a numbered text node block.
+CPPUNIT_ASSERT_EQUAL(static_cast(494), 
getProperty(getParagraph(2), "ParaBottomMargin"));
+CPPUNIT_ASSERT_EQUAL(static_cast(494), 
getProperty(getParagraph(2), "ParaTopMargin"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf89377, 
"tdf89377_tableWithBreakBeforeParaStyle.docx")
 {
 // the paragraph style should set table's text-flow break-before-page
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 79a12523f999..f2dfd37e727c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -620,9 +620,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 }
 if  (nIntValue) // If auto spacing is set, then only store set 
value in InteropGrabBag
 {
-if (m_pImpl->GetTopContext()->isSet(PROP_NUMBERING_RULES))
-// Numbering is set -> auto space is 0.
-default_spacing = 0;
+m_pImpl->SetParaAutoBefore(true);
 m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, 
uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
 }
 else
@@ -645,9 +643,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 }
 if  (nIntValue) // If auto spacing is set, then only store set 
value in InteropGrabBag
 {
-if (m_pImpl->GetTopContext()->isSet(PROP_NUMBERING_RULES))
-// Numbering is set -> auto space is 0.
-default_spacing = 0;
 m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, 
uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
 }
 else
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index bebfaa7f8e02..236436cbd362 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -242,7 +242,8 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bFrameBtLr(false),
 m_bIsSplitPara(false),
 m_vTextFramesForChaining(),
-m_bParaHadField(false)
+m_bParaHadField(false),
+m_bParaAutoBefore(false)
 
 {
 m_aBaseUrl = 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-04-10 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/hexcrlf.rtf|6 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 --
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit fd93d09a5b6226a8297b5dd995301d514ec7b8ca
Author: Michael Stahl 
Date:   Fri Apr 7 22:29:15 2017 +0200

tdf#106692 writerfilter: RTF import: fix \'0d in \leveltext

It's not a newline but yet another one of those bizarre RTF-encodings.

(regression from 10e733908038407791f9c14af2a86417cc4a653c)

Change-Id: I568050b031b95ac0b6ebfa1a0c39107e62f68bed
(cherry picked from commit 69b7204164945cfed385d58e64592ce1b17937d7)
Reviewed-on: https://gerrit.libreoffice.org/36284
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfimport/data/hexcrlf.rtf 
b/sw/qa/extras/rtfimport/data/hexcrlf.rtf
index 7c7ed1a9b5f8..1aaa0839c7eb 100644
--- a/sw/qa/extras/rtfimport/data/hexcrlf.rtf
+++ b/sw/qa/extras/rtfimport/data/hexcrlf.rtf
@@ -1,4 +1,10 @@
 {\rtf1
+{\*\listtable
+{\list\listtemplateid1
+{\listlevel{\leveltext \'0d\'00.\'01.\'02.\'03.\'04.\'05.\'06}{\levelnumbers 
\'01\'03\'05\'07\'09\'0b\'0d}}
+{\listname Heading;}\listid1199164
+}}
+
 foo\'0dba
 r\'0abaz\'0d\'0aquux
 \par }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 07ecb5fd5c2c..e1932c050847 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1116,8 +1116,10 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
 if (!bSkipped)
 {
 // note: apparently \'0d\'0a is interpreted as 2 breaks, not 1
-if (m_aStates.top().eDestination != Destination::DOCCOMM
-&& (ch == '\r' || ch == '\n'))
+if ((ch == '\r' || ch == '\n')
+&& m_aStates.top().eDestination != Destination::DOCCOMM
+&& m_aStates.top().eDestination != 
Destination::LEVELNUMBERS
+&& m_aStates.top().eDestination != Destination::LEVELTEXT)
 {
 checkUnicode(/*bUnicode =*/ false, /*bHex =*/ true);
 dispatchSymbol(RTF_PAR);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-03-30 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf106694.rtf |   10 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |8 
 writerfilter/source/rtftok/rtfsprm.cxx|   20 +++-
 3 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit 4370a2f96dd117f4e87291e5a8493f3413dc191a
Author: Miklos Vajna 
Date:   Tue Mar 28 09:06:09 2017 +0200

tdf#106694 RTF import: fix missing paragraph tab position

The problem here was that while in general paragraph style / direct
formatting deduplication is supposed to happen in the tokenizer,
paragraph tab positions is an exception, and dmapper expects to see the
duplicated tokens.

Fix the problem by introducing a blacklist that contains tokens not to
deduplicate.

(cherry picked from commit fea174753b1c6b0882aebb044bf1a1eef6fa50e0)

Change-Id: I1cca53e99cfdb082df389ff295f3447cc8f9d3b8
Reviewed-on: https://gerrit.libreoffice.org/35833
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfimport/data/tdf106694.rtf 
b/sw/qa/extras/rtfimport/data/tdf106694.rtf
new file mode 100644
index ..9abcb205bbeb
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf106694.rtf
@@ -0,0 +1,10 @@
+{\rtf1\ansi\deflang3081\ftnbj\uc1\deff0
+{\colortbl ;\red255\green255\blue255 ;\red0\green0\blue0 
;\red54\green95\blue145 ;\red79\green129\blue188 ;\red255\green0\blue0 
;\red255\green255\blue128 ;\red128\green0\blue0 ;\red127\green127\blue127 
;\red35\green62\blue95 ;\red63\green63\blue63 ;\red95\green95\blue95 
;\red47\green47\blue47 ;\red0\green64\blue128 ;\red79\green79\blue79 
;\red111\green111\blue111 ;\red0\green0\blue255 ;\red239\green239\blue239 
;\red192\green1\blue1 ;}
+{\stylesheet
+{\f0\fs24 Normal;}
+{\s22\snext0\f1\fs18\b\tqr\tldot\tx8280\fi0\li0\ri720\sb120\sa40\sl0 TOC 1
+;}
+}
+\pard\ssparaaux0\s22\tqr\tldot\tx8280\ri720\sb120\sa40\ql\outlinelevel0\plain\f0\fs24\plain\f2\fs18\hich\f2\dbch\f2\loch\f2\fs18\b
+Model Detail\tab 2\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 79f82d72dedb..8fee2ab2fcd1 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2752,6 +2752,14 @@ DECLARE_RTFIMPORT_TEST(testTdf105729, "tdf105729.rtf")
 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(getProperty(getParagraph(1), 
"ParaAdjust")));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf106694, "tdf106694.rtf")
+{
+auto aTabs = getProperty< uno::Sequence >(getParagraph(1), 
"ParaTabStops");
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aTabs.getLength());
+// This was 0, tab position was incorrect, looked like it was missing.
+CPPUNIT_ASSERT_EQUAL(static_cast(14605), aTabs[0].Position);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx 
b/writerfilter/source/rtftok/rtfsprm.cxx
index da7bc815c6ca..7afee14a4189 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -153,6 +153,23 @@ static RTFValue::Pointer_t getDefaultSPRM(Id const id)
 }
 }
 
+/// Is it problematic to deduplicate this SPRM?
+static bool isSPRMDeduplicateBlacklist(Id nId)
+{
+switch (nId)
+{
+case NS_ooxml::LN_CT_TabStop_val:
+case NS_ooxml::LN_CT_TabStop_leader:
+case NS_ooxml::LN_CT_TabStop_pos:
+// See the NS_ooxml::LN_CT_PPrBase_tabs handler in DomainMapper,
+// deduplication is explicitly not wanted for these tokens.
+return true;
+
+default:
+return false;
+}
+}
+
 /// Does the clone / deduplication of a single sprm.
 static void cloneAndDeduplicateSprm(std::pair& rSprm, 
RTFSprms& ret)
 {
@@ -161,7 +178,8 @@ static void cloneAndDeduplicateSprm(std::pair& rSprm, R
 {
 if (rSprm.second->equals(*pValue))
 {
-ret.erase(rSprm.first); // duplicate to style
+if (!isSPRMDeduplicateBlacklist(rSprm.first))
+ret.erase(rSprm.first); // duplicate to style
 }
 else if (!rSprm.second->getSprms().empty() || 
!rSprm.second->getAttributes().empty())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-03-17 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf105729.rtf|9 +
 sw/qa/extras/rtfimport/rtfimport.cxx |6 ++
 writerfilter/source/dmapper/DomainMapper.cxx |6 --
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit b5c4e120540053d0cb737720503cb7038f12d5bd
Author: Miklos Vajna 
Date:   Tue Mar 14 09:38:44 2017 +0100

tdf#105729 RTF import: \ltrpar should not override \qc from style

This is similar to commit 92fd894ea18672cba4cf961bdc4c0bc98f168102
(tdf#94435 RTF import: \ltrpar should not override \qc, 2015-10-05),
except that here the \qc is inherited from the style, it's not a direct
formatting. The problematic code was added in commit
2638faa2e834c2da4c195224fd88d32c29b3d0cc (writerfilter08ooo330: applied
patch for writerfilter08, 2010-07-28), and it's not really clear to me
what is its purpose, given that the DOC import equivalent in
SwWW8ImplReader::Read_ParaBiDi() doesn't set the paragraph alignment.

Fix the situation by not touching the paragraph alignment for the RTF
case at least.

(cherry picked from commit 2cc5f18d10cf6ef1349d9518e6f67977f7c5d9bf)

Change-Id: I2baa2c8c8012d972740da7cf3f710117812859b3
Reviewed-on: https://gerrit.libreoffice.org/35190
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/qa/extras/rtfimport/data/tdf105729.rtf 
b/sw/qa/extras/rtfimport/data/tdf105729.rtf
new file mode 100644
index ..996dd37b0057
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf105729.rtf
@@ -0,0 +1,9 @@
+{\rtf1
+{\stylesheet
+{\s16\qc
+Titel 1;}
+}
+\pard\plain \ltrpar\s16\qc
+Centered Title
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 1b9a2cc368a1..79f82d72dedb 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2746,6 +2746,12 @@ DECLARE_RTFIMPORT_TEST(testTdf104287, "tdf104287.rtf")
 CPPUNIT_ASSERT(xShape->getAnchor().is());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf105729, "tdf105729.rtf")
+{
+// This was style::ParagraphAdjust_LEFT, \ltrpar undone the effect of \qc 
from style.
+CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(getProperty(getParagraph(1), 
"ParaAdjust")));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index fe7b9a97b0b4..79a12523f999 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1445,12 +1445,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 if (nIntValue != 0)
 {
 rContext->Insert(PROP_WRITING_MODE, uno::makeAny( 
text::WritingMode2::RL_TB ));
-rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( 
style::ParagraphAdjust_RIGHT ), /*bOverwrite=*/false);
+if (!IsRTFImport())
+rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( 
style::ParagraphAdjust_RIGHT ), /*bOverwrite=*/false);
 }
 else
 {
 rContext->Insert(PROP_WRITING_MODE, uno::makeAny( 
text::WritingMode2::LR_TB ));
-rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( 
style::ParagraphAdjust_LEFT ), /*bOverwrite=*/false);
+if (!IsRTFImport())
+rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( 
style::ParagraphAdjust_LEFT ), /*bOverwrite=*/false);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-03-17 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf103931.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|8 
 writerfilter/source/ooxml/model.xml  |1 +
 3 files changed, 9 insertions(+)

New commits:
commit 1e88c10327642e6867db5708e3fd0fb7065bc74c
Author: Miklos Vajna 
Date:   Tue Feb 28 09:16:48 2017 +0100

tdf#103931 DOCX import: fix lost section break

When there are multiple sections in a document, every  element
triggers a handleLastParagraphInSection() call, and that's how the
previous section is ended and the next one is started if necessary. In
case the section contains no paragraphs at all, the section was lost on
import. Fix this by also calling handleLastParagraphInSection() on
 as well.

It's not a problem if there are both  and  in a section
(which is the usual situation) as only the first call closes the
previous section / starts the next one.

(cherry picked from commit 6603947329a7b372a173a3c60e013e532d0bc5cf)

Change-Id: I64f2c403dcb2ceca76d444ab06df3052235d2795
Reviewed-on: https://gerrit.libreoffice.org/34718
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf103931.docx 
b/sw/qa/extras/ooxmlexport/data/tdf103931.docx
new file mode 100644
index ..094fe1ba91cf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103931.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index ef278f245757..001f5b026251 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -207,6 +207,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106001, "tdf106001.docx")
 CPPUNIT_ASSERT_EQUAL( static_cast( 100 ), 
getProperty(getRun(getParagraph(1), 1), "CharScaleWidth" ));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf103931, "tdf103931.docx")
+{
+uno::Reference 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+// This was 2, the last (empty) section of the document was lost on import.
+CPPUNIT_ASSERT_EQUAL(static_cast(3), xTextSections->getCount());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 24a020b1bc58..19339d3ee040 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17822,6 +17822,7 @@
 
 
 
+  
   
   
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-03-08 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf104287.rtf  |   38 ++
 sw/qa/extras/rtfimport/rtfimport.cxx   |8 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   13 ++
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |4 +
 writerfilter/source/rtftok/rtfvalue.cxx|   52 ++---
 writerfilter/source/rtftok/rtfvalue.hxx|6 ++
 6 files changed, 106 insertions(+), 15 deletions(-)

New commits:
commit 9a899023db876630b74493da588b4a5490f90894
Author: Miklos Vajna 
Date:   Tue Mar 7 09:34:38 2017 +0100

tdf#104287 RTF import: handle bitmap shapes inside tables

Regression from commit 015fd55c94b7b650ed8e572cafaf3b0f903b01b9
(tdf#96275 RTF import: fix anchor of shapes inside tables, 2016-05-10),
the problem was that since shapes inside tables are now buffered, some
previously hidden problems in the buffering became visible.

For one, there was no code to make sure that a bitmap shape is not
appended at the end of the buffer again when it gets re-played. For
another, only the bitmap shape itself was buffered, not its size.

(cherry picked from commit 8240be9170cc473506531dad2fda82469ae84443)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
writerfilter/source/rtftok/rtfvalue.cxx
writerfilter/source/rtftok/rtfvalue.hxx

Change-Id: I04d65eb794ff6b160ef77af85479ba25ea5f8aa7
Reviewed-on: https://gerrit.libreoffice.org/34953
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/tdf104287.rtf 
b/sw/qa/extras/rtfimport/data/tdf104287.rtf
new file mode 100644
index 000..2ec87e6
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf104287.rtf
@@ -0,0 +1,38 @@
+{\rtf1\ansi\deff3\adeflang1025
+\deftab709
+\viewscale100
+\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+{\*\ftnsep\chftnsep}
+\trowd\trql\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\clbrdrt\brdrhair\brdrw1\brdrcf1\clpadfl3\clpadl55\clbrdrl\brdrhair\brdrw1\brdrcf1\clpadft3\clpadt55\clbrdrb\brdrhair\brdrw1\brdrcf1\clpadfb3\clpadb55\clbrdrr\brdrhair\brdrw1\brdrcf1\clpadfr3\clpadr55\cellx9638\shpwr2\shpwrk3\shpbypara\shpbyignore\shptop0\shpbxcolumn\shpbxignore\shpleft0\pgndec\pard\plain
 \s20\noline\intbl\rtlch \ltrch\loch
+{\*\flymaincnt5\flyanchor0\flycntnt}
+{\shp
+{\*\shpinst\shpwr2\shpwrk3\shpbypara\shpbyignore\shptop0\shpbottom6332\shpbxcolumn\shpbxignore\shpleft0\shpright9528
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+{\sp
+{\sn wzDescription}
+{\sv }
+}
+{\sp
+{\sn wzName}
+{\sv }
+}
+{\sp
+{\sn pib}
+{\sv 
+{\pict\picscalex63\picscaley63\piccropl0\piccropr0\piccropt0\piccropb0\picw1002\pich666\picwgoal15030\pichgoal9990\pngblip
+{\*\blipuid ebd28c5d3cbcfd4779e8e481da18cc69}
+89504e470d0a1a0a000d494844520010001008020090916836015049444154789c9592c14a02511486bf99714ccb322d7521140541cb
+6a11448b164150fb8a363d41f4083d40cba0655044d0a637a837682fd1a6a2488b10b23475bcb77b671c491dc1cee23077e67cf7fcff39139252f29f08b59e3e
+1dae8b4c45998ff501a82e070f5cbd3366733acb5c6fa609fc0872651236df0deeca7d002a6cc33d1b941a146ab49ca937e37610e0c590c5c92b67f926a07243
+b293613f8b1108a8a84aadb01575c9799edd0c895010a0ae71048e77b99b6a92e53861a387a48a6033c5d208c297a43ca8a3697601d217b010632dd9a9f34be0
+9968021698bea4c76ab72f5dd0d6216c3211e1bec2a0c5e59bce9303baa770c7bd38aca7d729692bcd4d512b53bb3b7cc2f45dd604ab098e67b499366025ce5e
+96a317fd2162e2d76725bdcd80b12a603aca4581e7aade97e14ec2916ca719ed96e4c54692f5241f755de7019641eacfaff10b469261dc6a800dd349454e44ae426082}
+}
+}
+}
+}
+\cell\row\pard\pard\plain 
\s0\widctlpar\hyphpar0\cf0\kerning1\dbch\af8\langfe2052\dbch\af6\afs24\alang1081\loch\f3\hich\af3\fs24\lang1043\rtlch
 \ltrch\loch
+\par }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 54e4758..1b9a2cc 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2738,6 +2738,14 @@ DECLARE_RTFIMPORT_TEST(testTdf104744, "tdf104744.rtf")
 CPPUNIT_ASSERT_EQUAL(static_cast(1270), 
getProperty(getParagraph(1), "ParaLeftMargin"));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf104287, "tdf104287.rtf")
+{
+uno::Reference xShape(getShape(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xShape.is());
+// This failed, the bitmap had no valid anchor.
+CPPUNIT_ASSERT(xShape->getAnchor().is());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 19bc159..07ecb5f 100644
--- 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-02-24 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/hexcrlf.rtf|4 
 sw/qa/extras/rtfimport/rtfimport.cxx   |   10 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   14 +-
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 7a26194b05029f68e58ff71285c7be1c5b4c2c42
Author: Michael Stahl 
Date:   Thu Feb 23 15:33:55 2017 +0100

writerfilter: RTF import: hex-escaped \r and \n create paragraph break

... in Word 2010, while the spec doesn't say what they do.
So just handle \'0d and \'0a like \par.

This fixes an assert failure on importing lp556169-2.rtf, where
insertTextPortion was called with a string containing "\r", which split
the paragraph and that messed up the SwPaM.

Change-Id: Iee8b5b47e15d18232de841adfbc9c6498727c384
(cherry picked from commit 10e733908038407791f9c14af2a86417cc4a653c)
Reviewed-on: https://gerrit.libreoffice.org/34584
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfimport/data/hexcrlf.rtf 
b/sw/qa/extras/rtfimport/data/hexcrlf.rtf
new file mode 100644
index 000..7c7ed1a
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/hexcrlf.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+foo\'0dba
+r\'0abaz\'0d\'0aquux
+\par }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index c860f3d..54e4758 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1099,6 +1099,16 @@ DECLARE_RTFIMPORT_TEST(testFdo59419, "fdo59419.rtf")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
 }
 
+DECLARE_RTFIMPORT_TEST(testHexCRLF, "hexcrlf.rtf")
+{
+// hex-escaped \r and \n should create a paragraph break
+getParagraph(1, "foo");
+getParagraph(2, "bar");
+getParagraph(3, "baz");
+getParagraph(4, "");
+getParagraph(5, "quux");
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo58076_2, "fdo58076-2.rtf")
 {
 // Position of the picture wasn't correct.
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2264493..19bc159 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1114,7 +1114,19 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
 if (m_aStates.top().nInternalState == RTFInternalState::HEX && 
m_aStates.top().eDestination != Destination::LEVELNUMBERS)
 {
 if (!bSkipped)
-m_aHexBuffer.append(ch);
+{
+// note: apparently \'0d\'0a is interpreted as 2 breaks, not 1
+if (m_aStates.top().eDestination != Destination::DOCCOMM
+&& (ch == '\r' || ch == '\n'))
+{
+checkUnicode(/*bUnicode =*/ false, /*bHex =*/ true);
+dispatchSymbol(RTF_PAR);
+}
+else
+{
+m_aHexBuffer.append(ch);
+}
+}
 return RTFError::OK;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-02-23 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/fdo82006.rtf  |2 +-
 sw/qa/extras/rtfexport/data/tdf104081.rtf |4 
 sw/qa/extras/rtfexport/rtfexport.cxx  |7 +++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 +-
 writerfilter/source/dmapper/SettingsTable.cxx |7 +--
 writerfilter/source/dmapper/SettingsTable.hxx |2 +-
 writerfilter/source/rtftok/rtfdispatchflag.cxx|3 +++
 7 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit af9d9f274ff26b462048746069a5bb38493ff115
Author: Miklos Vajna 
Date:   Tue Feb 21 09:06:20 2017 +0100

tdf#104081 RTF import: handle \htmautsp

It's the opposite of OOXML's , so
the default is different.

Also adapt the fdo82006 bugdoc where the original bugdoc contained this
flag, but the testcase did not.

(cherry picked from commit 291c9122b23ce7aa619e828b895b08dcd21bf025)

Change-Id: I2fd757a8f95be9b1bee63570c9f587c17d3b22bc
Reviewed-on: https://gerrit.libreoffice.org/34568
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfexport/data/fdo82006.rtf 
b/sw/qa/extras/rtfexport/data/fdo82006.rtf
index 0f5ee43..e108d4c 100644
--- a/sw/qa/extras/rtfexport/data/fdo82006.rtf
+++ b/sw/qa/extras/rtfexport/data/fdo82006.rtf
@@ -1,4 +1,4 @@
-{\rtf1
+{\rtf1\htmautsp
 \pard\plain
 \ql \sb100\sa100\sbauto1\saauto1 hello\par
 }
diff --git a/sw/qa/extras/rtfexport/data/tdf104081.rtf 
b/sw/qa/extras/rtfexport/data/tdf104081.rtf
new file mode 100644
index 000..0f5ee43
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf104081.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+\pard\plain
+\ql \sb100\sa100\sbauto1\saauto1 hello\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 18a2a0e..19b3235 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -891,6 +891,13 @@ DECLARE_RTFEXPORT_TEST(testFdo82006, "fdo82006.rtf")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), 
getProperty(getParagraph(1), "ParaBottomMargin"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf104081, "tdf104081.rtf")
+{
+// These were 494 (280 twips), as \htmautsp was ignored.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), 
getProperty(getParagraph(1), "ParaTopMargin"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), 
getProperty(getParagraph(1), "ParaBottomMargin"));
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt")
 {
 // This was FillStyle_NONE, as background color was missing from the color 
table during export.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 9e4ca9a..8540dd1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -596,7 +596,7 @@ public:
 SettingsTablePtr const & GetSettingsTable()
 {
 if( !m_pSettingsTable )
-m_pSettingsTable.reset( new SettingsTable );
+m_pSettingsTable.reset(new SettingsTable(m_rDMapper));
 return m_pSettingsTable;
 }
 
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index 8d7bace..9a52c41 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "util.hxx"
 
 using namespace com::sun::star;
@@ -99,12 +100,14 @@ struct SettingsTable_Impl
 
 };
 
-SettingsTable::SettingsTable()
+SettingsTable::SettingsTable(const DomainMapper& rDomainMapper)
 : LoggedProperties("SettingsTable")
 , LoggedTable("SettingsTable")
 , m_pImpl( new SettingsTable_Impl )
 {
-
+// HTML paragraph auto-spacing is opt-in for RTF, opt-out for OOXML.
+if (rDomainMapper.IsRTFImport())
+m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing = true;
 }
 
 SettingsTable::~SettingsTable()
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx 
b/writerfilter/source/dmapper/SettingsTable.hxx
index 6ef0a30..75c0d76 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -45,7 +45,7 @@ class SettingsTable : public LoggedProperties, public 
LoggedTable
 std::unique_ptr m_pImpl;
 
  public:
-SettingsTable();
+SettingsTable(const DomainMapper& rDomainMapper);
 virtual ~SettingsTable() override;
 
 //returns default TabStop in 1/100th mm
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index b99876e..18eac50 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -1069,6 +1069,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-02-21 Thread Aron Budea
 sw/qa/extras/ooxmlexport/data/tdf106001.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|6 ++
 writerfilter/source/dmapper/DomainMapper.cxx |   13 +++--
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 06c81a3e61e2d5743ffd8a50d85e5ecee989e46b
Author: Aron Budea 
Date:   Thu Feb 16 19:36:54 2017 +0100

tdf#106001: Treat CharScaleWidth outliers as 100 in DOCX import

Spec limit is [1..600], sometimes documents contain 0,
which, similar to other values outside the limit should be
treated as 100.

Change-Id: I04aec25b638762392de3f9881cd72588f2753e71
Reviewed-on: https://gerrit.libreoffice.org/34341
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 6e3a84023b46f6be632b43d2f5713d8d4bb2ba62)
Reviewed-on: https://gerrit.libreoffice.org/34368

diff --git a/sw/qa/extras/ooxmlexport/data/tdf106001.docx 
b/sw/qa/extras/ooxmlexport/data/tdf106001.docx
new file mode 100644
index 000..efe4104
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106001.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 4dd08ae..ef278f2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -201,6 +201,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103976, "tdf103976.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(convertTwipToMm100(60)), 
getProperty(getParagraphOfText(1, xCell->getText()), 
"ParaBottomMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf106001, "tdf106001.docx")
+{
+// This was 0 (1 on UI), while Word treats outliers as 100 (outlier = not 
in [1..600])
+CPPUNIT_ASSERT_EQUAL( static_cast( 100 ), 
getProperty(getRun(getParagraph(1), 1), "CharScaleWidth" ));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 823640c..fe7b9a9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1694,8 +1694,17 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 rContext->Insert(PROP_CHAR_AUTO_KERNING, uno::makeAny( nIntValue != 0 
) );
 break;
 case NS_ooxml::LN_EG_RPrBase_w:
-rContext->Insert(PROP_CHAR_SCALE_WIDTH,
- uno::makeAny( sal_Int16(nIntValue) ));
+// ST_TextScale must fall between 1% and 600% according to spec, 
otherwise resets to 100% according to experience
+if ((1 <= nIntValue) && (nIntValue <= 600))
+{
+rContext->Insert(PROP_CHAR_SCALE_WIDTH,
+ uno::makeAny( sal_Int16(nIntValue) ));
+}
+else
+{
+rContext->Insert(PROP_CHAR_SCALE_WIDTH,
+ uno::makeAny( sal_Int16(100) ));
+}
 break;
 case NS_ooxml::LN_EG_RPrBase_imprint:
 // FontRelief: NONE, EMBOSSED, ENGRAVED
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-02-02 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf103976.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|   10 ++
 writerfilter/source/dmapper/DomainMapper.cxx |   10 --
 3 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit df18f96a3a30701286691bfeeacd34c3bba68ce0
Author: Miklos Vajna 
Date:   Tue Jan 31 09:14:11 2017 +0100

tdf#103976 DOCX import: disable incomplete w:before/afterLines style 
handling

Regression from commit 9e7eb63989ef1cf4b9a0e0404b84ef890db3d8e3 (DOCX
import: parse 's w:before/afterLines attribute, 2014-10-17),
the problem is that OOXML has 3 different attributes for the paragraph
bottom margin (and other 3 for the top one), while in Writer we just
have a top margin.

Now the import filter tries to work out which one of these should have
priority and ignore the rest, but this is way more complicated when
style inheritance has to be taken into account as well.

To avoid the regression just restrict w:before/afterLines handling for
the case when it's used as direct formatting, that's why this was
introduced after all.

(cherry picked from commit 353a45aa1b1a15047aa2a92c1383996070e87405)

Change-Id: Ie8642c7a9771596def6b8899e098b26c4f8be0b4
Reviewed-on: https://gerrit.libreoffice.org/33774
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf103976.docx 
b/sw/qa/extras/ooxmlexport/data/tdf103976.docx
new file mode 100644
index 000..2081fcf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103976.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 0f05214..4dd08ae 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -191,6 +191,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104150, "tdf104150.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(-1), 
getProperty(xPageStyle, "BackColor"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf103976, "tdf103976.docx")
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+// This was 0, table style inheritance went wrong and w:afterLines had 
priority over w:after.
+CPPUNIT_ASSERT_EQUAL(static_cast(convertTwipToMm100(60)), 
getProperty(getParagraphOfText(1, xCell->getText()), 
"ParaBottomMargin"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f2a076c..823640c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -377,7 +377,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 break;
 case NS_ooxml::LN_CT_Spacing_beforeLines:
 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
"beforeLines", OUString::number(nIntValue));
-if (m_pImpl->GetTopContext())
+// We would need to make sure that this doesn't overwrite any
+// NS_ooxml::LN_CT_Spacing_before in parent styles before style
+// sheet support can be enabled.
+if (m_pImpl->GetTopContext() && !IsStyleSheetImport())
 m_pImpl->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN, 
uno::makeAny(ConversionHelper::convertTwipToMM100(nIntValue * 
nSingleLineSpacing / 100)), false);
 break;
 case NS_ooxml::LN_CT_Spacing_after:
@@ -388,7 +391,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 break;
 case NS_ooxml::LN_CT_Spacing_afterLines:
 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
"afterLines", OUString::number(nIntValue));
-if (m_pImpl->GetTopContext())
+// We would need to make sure that this doesn't overwrite any
+// NS_ooxml::LN_CT_Spacing_after in parent styles before style
+// sheet support can be enabled.
+if (m_pImpl->GetTopContext() && !IsStyleSheetImport())
 m_pImpl->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN, 
uno::makeAny(ConversionHelper::convertTwipToMM100(nIntValue * 
nSingleLineSpacing / 100)), false);
 break;
 case NS_ooxml::LN_CT_Spacing_line: //91434
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-01-22 Thread Justin Luth
 sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |7 +++
 writerfilter/source/dmapper/OLEHandler.cxx   |8 
+++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 9f0b05a64733fcaac39127db5e5f2fa3ad80a1b9
Author: Justin Luth 
Date:   Mon Jan 16 09:44:32 2017 +0300

tdf#48658 writerfilter: only set THROUGH wraps as transparent

commit 15c3a08b8b1e8060f9659c7bc98480a39d1802c5 set transparency
before the wrap type was known (which is good in case wrap type is
never defined, and the default wrap type IS through, so that fits)
but transparency was never re-evaluated once the wrap type was known.

In MSWord, the header is at a lower zOrder than the body,
so objects that are OVER the header text are still UNDER
the body text. Writer emulates this by insisting that ALL
through-wrapped header objects are UNDER the header text.
(This ought to only apply to objects that spill into the
body text area, but that’s pretty hard to calculate, so
transparency was applied to any object anchored in the header.)

Change-Id: Ie3916c6b7f3fa80caf5994fd910ba4d4d89ec702
Reviewed-on: https://gerrit.libreoffice.org/33152
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit c0688e8bf047bb123680806317fe040ba2cde407)
Reviewed-on: https://gerrit.libreoffice.org/33360
Tested-by: Jenkins 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx 
b/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx
new file mode 100755
index 000..5b6649c
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index f002fa7..65ca902 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -817,6 +817,13 @@ DECLARE_OOXMLIMPORT_TEST(testOleAnchor, "ole-anchor.docx")
 CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, 
getProperty(getShape(1), "Surround"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf48658_transparentOLEheader, 
"tdf48658_transparentOLEheader.docx")
+{
+// The problem was that the shape in the header was hidden in the 
background.
+// The round-tripped document was always fine (even before the fix) but 
the shape numbers change, so import-only test.
+CPPUNIT_ASSERT_EQUAL(true, bool(getProperty(getShape(1), "Opaque")));
+}
+
 DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeParaAdjust, 
"dml-groupshape-paraadjust.docx")
 {
 // Paragraph adjustment inside a group shape was not imported
diff --git a/writerfilter/source/dmapper/OLEHandler.cxx 
b/writerfilter/source/dmapper/OLEHandler.cxx
index 26f12c1..194d1d3 100644
--- a/writerfilter/source/dmapper/OLEHandler.cxx
+++ b/writerfilter/source/dmapper/OLEHandler.cxx
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 namespace writerfilter {
@@ -111,7 +112,7 @@ void OLEHandler::lcl_attribute(Id rName, Value & rVal)
 
 try
 {
-// Shapes in the header or footer should be in the 
background.
+// Shapes in the header or footer should be in the 
background, since the default is WrapTextMode_THROUGH.
 if (m_rDomainMapper.IsInHeaderFooter())
 xShapeProps->setPropertyValue("Opaque", 
uno::makeAny(false));
 
@@ -165,6 +166,11 @@ void OLEHandler::lcl_sprm(Sprm & rSprm)
 xShapeProps->setPropertyValue(
 getPropertyName( PROP_SURROUND ),
 uno::makeAny( m_nWrapMode ) );
+
+// Through shapes in the header or footer(that spill into 
the body) should be in the background.
+// It is just assumed that all shapes will spill into the 
body.
+if( m_rDomainMapper.IsInHeaderFooter() )
+xShapeProps->setPropertyValue("Opaque", 
uno::makeAny(m_nWrapMode != text::WrapTextMode_THROUGHT));
 }
 catch( const uno::Exception& e )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-01-17 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf104150.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx   |7 +++
 writerfilter/source/dmapper/DomainMapper.cxx|3 ++-
 writerfilter/source/dmapper/SettingsTable.cxx   |   10 ++
 writerfilter/source/dmapper/SettingsTable.hxx   |1 +
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |8 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  |   16 ++--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx  |2 ++
 8 files changed, 40 insertions(+), 7 deletions(-)

New commits:
commit 9093bd7295c677fa1888d3d805fccbc07e85f1f4
Author: Miklos Vajna 
Date:   Tue Jan 17 09:15:07 2017 +0100

tdf#104150 DOCX import: handle 

Regression from commit 992da0d5cf04497bad55637f6a6ebfcdaec03e16
(bnc#817956 DOCX import of document background color, 2013-05-27),
 should be ignored when  is
missing from settings.xml, it turns out.

This also requires generating the
ooxml:CT_Settings_displayBackgroundShape token from the RTF tokenizer.

(cherry picked from commit 38a1e19ae49ac30757e4020b60adee7c30f3deb9)

Change-Id: I6d7986904cedb952998a87e7648919ae34adc360
Reviewed-on: https://gerrit.libreoffice.org/33224
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf104150.docx 
b/sw/qa/extras/ooxmlexport/data/tdf104150.docx
new file mode 100644
index 000..9898846
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104150.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 2668d34..0f05214 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -184,6 +184,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx")
 CPPUNIT_ASSERT(xTextFields->hasElements());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf104150, "tdf104150.docx")
+{
+uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+// This was 0xff, i.e. red: background shape wasn't ignored.
+CPPUNIT_ASSERT_EQUAL(static_cast(-1), 
getProperty(xPageStyle, "BackColor"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 0a4041c..f2a076c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -987,7 +987,8 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, 
"ooxml:CT_SdtDate_fullDate", sStringValue);
 break;
 case NS_ooxml::LN_CT_Background_color:
-m_pImpl->m_oBackgroundColor.reset(nIntValue);
+if (m_pImpl->GetSettingsTable()->GetDisplayBackgroundShape())
+m_pImpl->m_oBackgroundColor.reset(nIntValue);
 break;
 case NS_ooxml::LN_CT_PageNumber_start:
 if (pSectionContext != nullptr)
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index 10791f0..8d7bace 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -65,6 +65,7 @@ struct SettingsTable_Impl
 boolm_bSplitPgBreakAndParaMark;
 boolm_bMirrorMargin;
 boolm_bProtectForm;
+boolm_bDisplayBackgroundShape;
 
 uno::Sequence m_pThemeFontLangProps;
 
@@ -91,6 +92,7 @@ struct SettingsTable_Impl
 , m_bSplitPgBreakAndParaMark(false)
 , m_bMirrorMargin(false)
 , m_bProtectForm(false)
+, m_bDisplayBackgroundShape(false)
 , m_pThemeFontLangProps(3)
 , m_pCurrentCompatSetting(3)
 {}
@@ -274,6 +276,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
 case NS_ooxml::LN_CT_Settings_widowControl:
 m_pImpl->m_bWidowControl = nIntValue;
 break;
+case NS_ooxml::LN_CT_Settings_displayBackgroundShape:
+m_pImpl->m_bDisplayBackgroundShape = nIntValue;
+break;
 default:
 {
 #ifdef DEBUG_WRITERFILTER
@@ -349,6 +354,11 @@ bool SettingsTable::GetMirrorMarginSettings() const
 return m_pImpl->m_bMirrorMargin;
 }
 
+bool SettingsTable::GetDisplayBackgroundShape() const
+{
+return m_pImpl->m_bDisplayBackgroundShape;
+}
+
 bool SettingsTable::GetProtectForm() const
 {
 return m_pImpl->m_bProtectForm;
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx 
b/writerfilter/source/dmapper/SettingsTable.hxx
index 8328ec2..6ef0a30 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -70,6 +70,7 @@ class SettingsTable : public LoggedProperties, public 
LoggedTable
 bool GetDoNotUseHTMLParagraphAutoSpacing() const;
 bool 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-01-09 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/tdf105143.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |8 
 writerfilter/source/filter/WriterFilter.cxx  |1 +
 3 files changed, 9 insertions(+)

New commits:
commit 68c05e360a65a3984d3839f563daa34e2cce0b14
Author: Miklos Vajna 
Date:   Fri Jan 6 13:49:06 2017 +0100

tdf#105143 DOCX import: enable DoNotCaptureDrawObjsOnPage layout compat 
option

Because that's what Word does to show only part of the shape in the
bugdoc.

Conflicts:
writerfilter/source/filter/WriterFilter.cxx

Change-Id: Ic5cb84cace9237671d71eda0c64e9dadfe244cb9
Reviewed-on: https://gerrit.libreoffice.org/32782
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 
Reviewed-on: https://gerrit.libreoffice.org/32784
Reviewed-by: Jan Holesovsky 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf105143.docx 
b/sw/qa/extras/ooxmlimport/data/tdf105143.docx
new file mode 100644
index 000..aa4bf40
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf105143.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 0acf8f0..2d1c66b 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -699,6 +699,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf105127, "tdf105127.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(3257), 
aPolyPolygon.Coordinates[0][0].Y);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf105143, "tdf105143.docx")
+{
+OUString aTop = 
parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top");
+// This was 6272, i.e. the shape was moved up (incorrect position) to be
+// inside the page rectangle.
+CPPUNIT_ASSERT_EQUAL(OUString("6674"), aTop);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testfdo76583, "fdo76583.docx")
 {
 // The problem was that the floating table was imported as a non-floating 
one.
diff --git a/writerfilter/source/filter/WriterFilter.cxx 
b/writerfilter/source/filter/WriterFilter.cxx
index c59718f..b50a8f4 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -300,6 +300,7 @@ void WriterFilter::setTargetDocument(const uno::Reference< 
lang::XComponent >& x
 xSettings->setPropertyValue("TreatSingleColumnBreakAsPageBreak", 
uno::makeAny(true));
 xSettings->setPropertyValue("PropLineSpacingShrinksFirstLine", 
uno::makeAny(true));
 xSettings->setPropertyValue("AllowPaddingWithoutBorders", 
uno::makeAny(true));
+xSettings->setPropertyValue("DoNotCaptureDrawObjsOnPage", 
uno::makeAny(true));
 }
 
 void WriterFilter::setSourceDocument(const uno::Reference< lang::XComponent >& 
xDoc) throw (lang::IllegalArgumentException, uno::RuntimeException, 
std::exception)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-01-04 Thread Justin Luth
 sw/qa/extras/ooxmlexport/data/tdf99616_hidemarkb.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|   13 +
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |4 +---
 3 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 3d5ccc1577ff89bd13c26a8cde787a39482a8b81
Author: Justin Luth 
Date:   Fri Dec 23 13:49:19 2016 +0300

tdf#99616 writerfilter: hideMark shouldn't force min size

hideMark in Word does not force the minimum possible row size,
but simply ignores any cell marker styles/sizings. So an empty row
then takes on the "at least" size defined for the row.

Change-Id: Id24a52f2a360a5040c2eed5c17757c0d32d03520
Reviewed-on: https://gerrit.libreoffice.org/32380
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 1a58cdf8af1aba52ce0a37dd7d742234d7cf)
Reviewed-on: https://gerrit.libreoffice.org/32721

diff --git a/sw/qa/extras/ooxmlexport/data/tdf99616_hidemarkb.docx 
b/sw/qa/extras/ooxmlexport/data/tdf99616_hidemarkb.docx
new file mode 100755
index 000..825108a
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf99616_hidemarkb.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index ace0580..0dce2c5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -1739,6 +1739,19 @@ DECLARE_OOXMLEXPORT_TEST(testHidemark, "hidemark.docx")
 CPPUNIT_ASSERT_MESSAGE("table size is less than 7000?",sal_Int32(7000) > 
getProperty(xTextTable, "Width"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testHidemarkb, "tdf99616_hidemarkb.docx")
+{
+// Problem was that the smallest possible height was forced, not the min 
specified size.
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xTableRows(xTextTable->getRows(), 
uno::UNO_QUERY);
+// Height should be .5cm
+CPPUNIT_ASSERT_EQUAL(sal_Int64(501), 
getProperty(xTableRows->getByIndex(1), "Height"));
+// Size type was MIN, should be FIX to avoid considering the end of 
paragraph marker.
+CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, 
getProperty(xTableRows->getByIndex(1), "SizeType"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testBnc891663, "bnc891663.docx")
 {
 // The image should be inside a cell, so the text in the following cell 
should be below it.
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 3af9e3b..81220bd 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -928,7 +928,6 @@ css::uno::Sequence 
DomainMapperTableHandler::endTabl
 TagLogger::getInstance().startElement("getRowProperties");
 #endif
 
-static const int MINLAY = 23; // sw/inc/swtypes.hxx, minimal possible size 
of frames.
 css::uno::Sequence aRowProperties( 
m_aRowProperties.size() );
 PropertyMapVector1::const_iterator aRowIter = m_aRowProperties.begin();
 PropertyMapVector1::const_iterator aRowIterEnd = m_aRowProperties.end();
@@ -948,9 +947,8 @@ css::uno::Sequence 
DomainMapperTableHandler::endTabl
 if (lcl_hideMarks(m_aCellProperties[nRow]) && 
lcl_emptyRow(m_aTableRanges, nRow))
 {
 // We have CellHideMark on all cells, and also all cells are 
empty:
-// Set the row height to minimal as Word does.
+// Force the row height to be exactly as specified, and not 
just as the minimum suggestion.
 (*aRowIter)->Insert(PROP_SIZE_TYPE, 
uno::makeAny(text::SizeType::FIX));
-(*aRowIter)->Insert(PROP_HEIGHT, 
uno::makeAny(static_cast(ConversionHelper::convertTwipToMM100(MINLAY;
 }
 
 aRowProperties[nRow] = (*aRowIter)->GetPropertyValues();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-01-04 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf104744.rtf |   24 +
 sw/qa/extras/rtfimport/rtfimport.cxx  |7 ++
 writerfilter/source/rtftok/rtfsprm.cxx|   74 ++
 3 files changed, 76 insertions(+), 29 deletions(-)

New commits:
commit d66a9721913e89f1cc76068ee1a64b1cf0eef8d8
Author: Miklos Vajna 
Date:   Tue Jan 3 08:49:43 2017 +0100

tdf#104744 RTF import: fix unexpected zero para left margin wrt style dedup

See commit 1be0a3fa9ebb22b607c54b47739d4467acfed259 (n#825305:
writerfilter RTF import: override style properties like Word,
2014-06-17) for the details on style override in RTF.

Here the problem was that we added an unneeded "reset to 0" property, the
opposite situation that commit 657c6cc3acec0528209a8584b838cd6de581c437
(tdf#104228 RTF import: fix override of style left/right para margin,
2016-12-13) was fixing (there a "reset to 0" was missing).

(cherry picked from commit a9e029ace41562e28e9242d63230ad1ca275f5d3)

Change-Id: I37f079b9cb4773214d2531c2e34920b3b8927211
Reviewed-on: https://gerrit.libreoffice.org/32718
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfimport/data/tdf104744.rtf 
b/sw/qa/extras/rtfimport/data/tdf104744.rtf
new file mode 100644
index 000..ef32998
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf104744.rtf
@@ -0,0 +1,24 @@
+{\rtf1
+{\fonttbl
+{\f3\fcharset2 Symbol;}
+}
+{\stylesheet
+{\s15\li720 List Paragraph;}
+}
+{\*\listtable
+{\list\listtemplateid1145476866\listhybrid
+{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1
+\levelspace360\levelindent0
+{\leveltext\leveltemplateid67698689\'01\u-3913 ?;}
+{\levelnumbers;}
+\f3\li720 }
+\listid1805847239}
+}
+{\*\listoverridetable
+{\listoverride\listid1805847239\listoverridecount0\ls1}
+}
+{\pard\plain \ltrpar\s15\li720\ls1 bullet
+\par 
+}
+{\pard\plain after}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 2f554e1..c860f3d 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2721,6 +2721,13 @@ DECLARE_RTFIMPORT_TEST(testTdf104317, "tdf104317.rtf")
 CPPUNIT_ASSERT_EQUAL(static_cast(1), xDrawPage->getCount());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf104744, "tdf104744.rtf")
+{
+// This was 0, as an unexpected "left margin is 0" token was created during
+// import.
+CPPUNIT_ASSERT_EQUAL(static_cast(1270), 
getProperty(getParagraph(1), "ParaLeftMargin"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx 
b/writerfilter/source/rtftok/rtfsprm.cxx
index c7096f1..da7bc81 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -153,6 +153,43 @@ static RTFValue::Pointer_t getDefaultSPRM(Id const id)
 }
 }
 
+/// Does the clone / deduplication of a single sprm.
+static void cloneAndDeduplicateSprm(std::pair& rSprm, 
RTFSprms& ret)
+{
+RTFValue::Pointer_t const pValue(ret.find(rSprm.first));
+if (pValue)
+{
+if (rSprm.second->equals(*pValue))
+{
+ret.erase(rSprm.first); // duplicate to style
+}
+else if (!rSprm.second->getSprms().empty() || 
!rSprm.second->getAttributes().empty())
+{
+RTFSprms const 
sprms(pValue->getSprms().cloneAndDeduplicate(rSprm.second->getSprms()));
+RTFSprms const 
attributes(pValue->getAttributes().cloneAndDeduplicate(rSprm.second->getAttributes()));
+ret.set(rSprm.first, 
RTFValue::Pointer_t(pValue->CloneWithSprms(attributes, sprms)));
+}
+}
+else
+{
+// not found - try to override style with default
+RTFValue::Pointer_t const pDefault(getDefaultSPRM(rSprm.first));
+if (pDefault)
+{
+ret.set(rSprm.first, pDefault);
+}
+else if (!rSprm.second->getSprms().empty() || 
!rSprm.second->getAttributes().empty())
+{
+RTFSprms const 
sprms(RTFSprms().cloneAndDeduplicate(rSprm.second->getSprms()));
+RTFSprms const 
attributes(RTFSprms().cloneAndDeduplicate(rSprm.second->getAttributes()));
+if (!sprms.empty() || !attributes.empty())
+{
+ret.set(rSprm.first, std::make_shared(attributes, 
sprms));
+}
+}
+}
+}
+
 RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference) const
 {
 RTFSprms ret(*this);
@@ -162,38 +199,17 @@ RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& 
rReference) const
 // it is probably a bad idea to mess with those in any way here?
 for (auto& rSprm : rReference)
 {
-RTFValue::Pointer_t const pValue(ret.find(rSprm.first));
-if (pValue)
+// Paragraph formatting sprms are directly contained in 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2017-01-02 Thread Justin Luth
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|3 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 91867c343d858e7365c06f2953e979bc038af186
Author: Justin Luth 
Date:   Fri Dec 23 17:52:46 2016 +0300

tdf#104876 writerfilter: m_bTableSizeTypeInserted = false here

fixes commit cbd0fbc287051f918e4adb32b3e9b58dfbf8059d
which removed the insertion code with the explanation saying
  we should simply not do anything,
  and that'll lead to the right behavior,
  don't try to be smart and try to set TABLE_WIDTH here
but still left the flag set, falsely indicating that the
tableSizeType had been inserted.

Change-Id: I0720083c992d1d03a5fe259d5b4b177a0c8108f8
TODO: the table size still isn't correct.
Reviewed-on: https://gerrit.libreoffice.org/32385
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit e73c961a7fb23246dc4a9c27d7ed0808b9ba74b5)
Reviewed-on: https://gerrit.libreoffice.org/32636

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 732730f..ace0580 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -1734,6 +1734,9 @@ DECLARE_OOXMLEXPORT_TEST(testHidemark, "hidemark.docx")
 CPPUNIT_ASSERT_EQUAL(convertTwipToMm100(MINLAY), 
getProperty(xTableRows->getByIndex(1), "Height"));
 // Size type was MIN, should be FIX to avoid considering the end of 
paragraph marker.
 CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, 
getProperty(xTableRows->getByIndex(1), "SizeType"));
+
+//tdf#104876: Width was not recognized during import when table size was 
'auto'
+CPPUNIT_ASSERT_MESSAGE("table size is less than 7000?",sal_Int32(7000) > 
getProperty(xTextTable, "Width"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testBnc891663, "bnc891663.docx")
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index ef71cdc..1c1a3c1 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -157,6 +157,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 {
 pPropMap->setValue( 
TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX );
 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, 
m_nTableWidth );
+m_bTableSizeTypeInserted = true;
 }
 else if( 
sal::static_int_cast(pMeasureHandler->getUnit()) == 
NS_ooxml::LN_Value_ST_TblWidth_pct )
 {
@@ -165,6 +166,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 nPercent = 100;
 pPropMap->setValue( 
TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, 
nPercent );
+m_bTableSizeTypeInserted = true;
 }
 else if( 
sal::static_int_cast(pMeasureHandler->getUnit()) == 
NS_ooxml::LN_Value_ST_TblWidth_auto )
 {
@@ -192,9 +194,9 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 // Set the width type of table with 'Auto' and 
set the width value to 0 (as per grid values)
 pPropMap->setValue( 
TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
 pPropMap->setValue( 
TablePropertyMap::TABLE_WIDTH, 0 );
+m_bTableSizeTypeInserted = true;
 }
 }
-m_bTableSizeTypeInserted = true;
 }
 #ifdef DEBUG_WRITERFILTER
 pPropMap->dumpXml();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-22 Thread Justin Luth
 sw/qa/extras/ooxmlimport/data/tdf75573_lostTable.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   13 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 
 3 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 4cbe2e712bab42e95fb55d78da6b1daf326f7f1b
Author: Justin Luth 
Date:   Wed Dec 21 07:32:14 2016 +0300

tdf#75573 - relocate code: alternate stream already started

moving this keeps the original fix and prevents losing a table
in this unit test

fixes regression commit ecea3431ca761369d8180a74eba2877533050516

Change-Id: I5e94760649020ddf1c468d52b91aaf0521bbfdda
Reviewed-on: https://gerrit.libreoffice.org/32269
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
(cherry picked from commit 34324bff1252dc5a51c9408f9502654453f319b6)
Reviewed-on: https://gerrit.libreoffice.org/32324
Tested-by: Jenkins 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf75573_lostTable.docx 
b/sw/qa/extras/ooxmlimport/data/tdf75573_lostTable.docx
new file mode 100644
index 000..8ddb661
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf75573_lostTable.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index eb45e22..b1ccafc 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -726,6 +726,19 @@ DECLARE_OOXMLIMPORT_TEST(testTdf75573, 
"tdf75573_page1frame.docx")
 CPPUNIT_ASSERT(!bProt);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf75573_lostTable, "tdf75573_lostTable.docx")
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("# of tables", sal_Int32(1), 
xTables->getCount() );
+
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("# of frames/shapes", sal_Int32(0), 
xDraws->getCount() );
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE("# of pages", 3, getPages() );
+}
+
 DECLARE_OOXMLIMPORT_TEST(testMultiColumnSeparator, 
"multi-column-separator-with-line.docx")
 {
 uno::Reference xTextSection = getProperty< 
uno::Reference >(getParagraph(1, "First data."), 
"TextSection");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 013518f..bfecc4e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5282,16 +5282,16 @@ void DomainMapper_Impl::substream(Id rName,
 }
 #endif
 
+//finalize any waiting frames before starting alternate streams
+CheckUnregisteredFrameConversion();
+ExecuteFrameConversion();
+
 appendTableManager();
 // Appending a TableManager resets its TableHandler, so we need to append
 // that as well, or tables won't be imported properly in headers/footers.
 appendTableHandler();
 getTableManager().startLevel();
 
-//finalize any waiting frames before starting alternate streams
-CheckUnregisteredFrameConversion();
-ExecuteFrameConversion();
-
 //import of page header/footer
 
 switch( rName )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-22 Thread Justin Luth
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx  |4 
 sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakB.docx |binary
 sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakC.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |   56 +
 writerfilter/source/dmapper/DomainMapper.cxx   |3 
 writerfilter/source/dmapper/PropertyMap.hxx|2 
 6 files changed, 62 insertions(+), 3 deletions(-)

New commits:
commit 2a08419ef27afe756402eb18ffd2434a476c9bc5
Author: Justin Luth 
Date:   Tue Dec 20 15:54:18 2016 +0300

tdf#104710 bRemove: only prevent w/BREAK_TYPE for defined Sections

fixes regression from fix for bug 103975 which prevented removal of
empty paragraphs if there was a page/column break.  This patch adds
the requirement that there is also a defined SectionBreak.

I did a bad thing with unit test rhbz988516 (which was re-used as
the unit test for bug 103975). I didn't first check in MSWord
to see how many pages it really ought to have, and when it started
round-tripping with 3 pages I was happy.  Well, the proper page count
according to MSO is 2 (a hard page/break and Section/newPage combine
to form a single pagebreak). Undoing the regression fixes that too.

The regression was commit 7b250d56981f78e77454a2a3fd670731b2358e75

Change-Id: I15e9df2d260954f02a9e183d9f48c1d267494b49
Reviewed-on: https://gerrit.libreoffice.org/32236
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
Reviewed-by: Justin Luth 
(cherry picked from commit e37563c304e52f1d2385868c9b33e0145493d2bd)
Reviewed-on: https://gerrit.libreoffice.org/32328

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 8bf2b5b..2668d34 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -81,13 +81,13 @@ DECLARE_OOXMLEXPORT_TEST(testRhbz988516, "rhbz988516.docx")
 {
 // The problem was that the list properties of the footer leaked into body
 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(1), 
"NumberingStyleName"));
-CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), 
getParagraph(3)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), 
getParagraph(2)->getString());
 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(2), 
"NumberingStyleName"));
 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(3), 
"NumberingStyleName"));
 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(4), 
"NumberingStyleName"));
 
 // tdf#103975 The problem was that an empty paragraph with page break info 
was removed.
-CPPUNIT_ASSERT_EQUAL( 3, getPages() );
+CPPUNIT_ASSERT_EQUAL( 2, getPages() );
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx")
diff --git a/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakB.docx 
b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakB.docx
new file mode 100755
index 000..a7b880d
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakB.docx differ
diff --git a/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakC.docx 
b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakC.docx
new file mode 100755
index 000..52767ab
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakC.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 14be1f8..eb45e22 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -130,6 +130,62 @@ DECLARE_SW_IMPORT_TEST(testMathMalformedXml, 
"math-malformed_xml.docx", FailTest
 CPPUNIT_ASSERT(!mxComponent.is());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakB, 
"tdf103975_notPageBreakB.docx")
+{
+// turn on View Formatting Marks to see these documents.
+uno::Reference xTextSection = getProperty< 
uno::Reference >(getParagraph(1), "TextSection");
+CPPUNIT_ASSERT(xTextSection.is());
+uno::Reference xTextColumns = getProperty< 
uno::Reference >(xTextSection, "TextColumns");
+CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+xTextSection = getProperty< uno::Reference 
>(getParagraph(2), "TextSection");
+CPPUNIT_ASSERT(xTextSection.is());
+xTextColumns = getProperty< uno::Reference 
>(xTextSection, "TextColumns");
+CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+xTextSection = getProperty< uno::Reference 
>(getParagraph(3), "TextSection");
+CPPUNIT_ASSERT(xTextSection.is());
+xTextColumns = getProperty< uno::Reference 
>(xTextSection, "TextColumns");
+CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
+
+xTextSection = getProperty< uno::Reference 
>(getParagraph(4), "TextSection");

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-21 Thread Justin Luth
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|4 ++--
 writerfilter/source/dmapper/DomainMapper.cxx |4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit a21035c779167ec0e84ac21b9e5cdf6f2553ab30
Author: Justin Luth 
Date:   Tue Dec 20 13:51:26 2016 +0300

related to tdf#97417: fix unit test's early para numbering

The unit test's first blank page already started the paragraph
numbering. Setting it so that a contentless, single paragraph
section will not display numbering.  In fact, no dummy paragraph
should have numbering, but that would get complicated.

This is in preparation for tdf#104710.

Change-Id: I98c9926cb3cd1e3fe3cd43bf46cab22bfbec7eba
Reviewed-on: https://gerrit.libreoffice.org/32235
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit c829e01e973ac32fb625925ce83f843ad30d94db)
Reviewed-on: https://gerrit.libreoffice.org/32326
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 52e6806..732730f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -2017,8 +2017,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92157, "tdf92157.docx")
 DECLARE_OOXMLEXPORT_TEST(testTdf97417, "section_break_numbering.docx")
 {
 uno::Reference xProps(getParagraph(1), 
uno::UNO_QUERY_THROW);
-//CPPUNIT_ASSERT_MESSAGE("1st page: first paragraph erroneous numbering",
-//!xProps->getPropertyValue("NumberingRules").hasValue());
+CPPUNIT_ASSERT_MESSAGE("1st page: first paragraph erroneous numbering",
+!xProps->getPropertyValue("NumberingRules").hasValue());
 // paragraph with numbering and section break was removed by writerfilter
 // but its numbering was copied to all following paragraphs
 CPPUNIT_ASSERT_MESSAGE("2nd page: first paragraph missing numbering",
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 45f2764..f79ad82 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3281,7 +3281,9 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
&& !( pContext && pContext->isSet(PROP_BREAK_TYPE) )
&& !m_pImpl->GetIsDummyParaAddedForTableInSection()
&& !m_pImpl->GetIsPreviousParagraphFramed();
-PropertyMapPtr xContext = bRemove ? 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
+
+const bool bNoNumbering = bRemove || (!m_pImpl->GetParaChanged() 
&& m_pImpl->GetParaSectpr() && bSingleParagraph);
+PropertyMapPtr xContext = bNoNumbering ? 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
 if (xContext)
 {
 // tdf#97417 delete numbering of the paragraph
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-21 Thread Justin Luth
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |   12 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 7e38087bf2a4d9d9edd0c98f965531002e0be777
Author: Justin Luth 
Date:   Tue Dec 20 12:19:43 2016 +0300

related to tdf#97417: fix unit test page count

The unit test should have been showing a blank page before the
content page.

Non-section paragraphs should not remove the first/last status.
Frames were already excluded, now this patch also
excludes header/footer paragraphs.

This is in preparation for tdf#104710.

Change-Id: I686944843302160d6f6bbbcb73f01c836179aa9f
Reviewed-on: https://gerrit.libreoffice.org/32234
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
(cherry picked from commit 893698741a78e56d74b87caff24f67742ddd892b)
Reviewed-on: https://gerrit.libreoffice.org/32323
Tested-by: Jenkins 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index eff96c7..52e6806 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -2016,14 +2016,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92157, "tdf92157.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTdf97417, "section_break_numbering.docx")
 {
+uno::Reference xProps(getParagraph(1), 
uno::UNO_QUERY_THROW);
+//CPPUNIT_ASSERT_MESSAGE("1st page: first paragraph erroneous numbering",
+//!xProps->getPropertyValue("NumberingRules").hasValue());
 // paragraph with numbering and section break was removed by writerfilter
 // but its numbering was copied to all following paragraphs
-CPPUNIT_ASSERT_MESSAGE("first paragraph missing numbering",
-getProperty(getParagraph(1), 
"NumberingRules").is());
-uno::Reference const xProps(getParagraph(2), 
uno::UNO_QUERY_THROW);
-CPPUNIT_ASSERT_MESSAGE("second paragraph erroneous numbering",
+CPPUNIT_ASSERT_MESSAGE("2nd page: first paragraph missing numbering",
+getProperty(getParagraph(2), 
"NumberingRules").is());
+xProps = uno::Reference(getParagraph(3), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("2nd page: second paragraph erroneous numbering",
 !xProps->getPropertyValue("NumberingRules").hasValue());
 
+CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf94043, "tdf94043.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1268634..013518f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1210,8 +1210,8 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap )
 SetIsPreviousParagraphFramed(false);
 
 m_bParaChanged = false;
-if (!pParaContext || !pParaContext->IsFrameMode())
-{ // If the paragraph is in a frame, it's not a paragraph of the section 
itself.
+if( !IsInHeaderFooter() && (!pParaContext || !pParaContext->IsFrameMode()) 
)
+{ // If the paragraph is in a frame or header/footer, it's not a paragraph 
of the section itself.
 m_bIsFirstParaInSection = false;
 m_bIsLastParaInSection = false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-21 Thread Tamás Zolnai
 sw/qa/extras/ooxmlimport/data/tdf96218.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |6 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |5 +
 writerfilter/source/dmapper/DomainMapper.hxx  |1 +
 writerfilter/source/dmapper/GraphicImport.cxx |2 +-
 5 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 15d821aa366265f86fda4484574e598b5744d23b
Author: Tamás Zolnai 
Date:   Tue Dec 20 17:14:58 2016 +

tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position

layoutInCell attribute should be ignored when we are not
in a table.

Change-Id: Ieed29c690f8516f63d0956a4f0495500908a0d27
Reviewed-on: https://gerrit.libreoffice.org/32253
Reviewed-by: Tamás Zolnai 
Tested-by: Tamás Zolnai 
(cherry picked from commit 36750bc977b3210b23b7822abd395b30a78af6f5)
Reviewed-on: https://gerrit.libreoffice.org/32267
Tested-by: Jenkins 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf96218.docx 
b/sw/qa/extras/ooxmlimport/data/tdf96218.docx
new file mode 100644
index 000..a6a269f
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf96218.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4fd658d..14be1f8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1274,6 +1274,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf82824, "tdf82824.docx")
 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, 
getProperty(getShape(1), "AnchorType"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf96218, "tdf96218.docx")
+{
+// Image had a bad position because layoutInCell attribute was not ignored
+CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow"));
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 8d47e98..45f2764 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3680,6 +3680,11 @@ bool DomainMapper::IsInHeaderFooter() const
 return m_pImpl->IsInHeaderFooter();
 }
 
+bool DomainMapper::IsInTable() const
+{
+return m_pImpl->hasTableManager() && m_pImpl->getTableManager().isInCell();
+}
+
 bool DomainMapper::IsStyleSheetImport() const
 {
 return m_pImpl->IsStyleSheetImport();
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx 
b/writerfilter/source/dmapper/DomainMapper.hxx
index d1b3622..4f05118 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -108,6 +108,7 @@ public:
 css::uno::Reference PopPendingShape();
 
 bool IsInHeaderFooter() const;
+bool IsInTable() const;
 bool IsStyleSheetImport() const;
 /**
  @see DomainMapper_Impl::processDeferredCharacterProperties()
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 837308c..f945818 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1272,7 +1272,7 @@ uno::Reference< text::XTextContent > 
GraphicImport::createGraphicObject( const b
 }
 xGraphicObjectProperties->setPropertyValue(getPropertyName( 
PROP_SURROUND ),
 uno::makeAny(m_pImpl->nWrap));
-if( m_pImpl->bLayoutInCell && m_pImpl->nWrap != 
text::WrapTextMode_THROUGHT )
+if( m_pImpl->rDomainMapper.IsInTable() && 
m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT )
 
xGraphicObjectProperties->setPropertyValue(getPropertyName( 
PROP_FOLLOW_TEXT_FLOW ),
 uno::makeAny(true));
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-20 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf104162.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|8 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |8 
 3 files changed, 16 insertions(+)

New commits:
commit e4be3c9810ecbf2733f7e5884dbba19c426749ef
Author: Miklos Vajna 
Date:   Mon Dec 19 19:35:20 2016 +0100

tdf#104162 DOCX import: fix crash on  in a comment table

sw comments are handled by editeng, so tables in comments aren't
imported. That means lcl_emptyRow() may get a row where the first cell's
start is an empty reference, so handle that case.

(cherry picked from commit 748b483d89dc7915471441cc30a1aa342363)

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx

Change-Id: I43e286314143934c20e6cbbd656d32883b6b2efe
Reviewed-on: https://gerrit.libreoffice.org/32223
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf104162.docx 
b/sw/qa/extras/ooxmlexport/data/tdf104162.docx
new file mode 100644
index 000..61b51c0
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104162.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 5487a07..8bf2b5b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -176,6 +176,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx")
 CPPUNIT_ASSERT_EQUAL( sal_Int32( -1 ) , sContent.indexOf( sal_Unicode( 
0xf04a ) ));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx")
+{
+// This crashed: the comment field contained a table with a .
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTextFields(xTextFieldsSupplier->getTextFields());
+CPPUNIT_ASSERT(xTextFields->hasElements());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 0b89aa1..3af9e3b 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -896,6 +896,14 @@ bool lcl_emptyRow(std::vector& 
rTableRanges, sal_Int32 nRow)
 return false;
 }
 
+if (!rRowSeq[0][0].is())
+{
+// This can happen when we can't import the table, e.g. we're inside a
+// comment.
+SAL_WARN("writerfilter.dmapper", "rRowSeq[0][0] is an empty 
reference");
+return false;
+}
+
 uno::Reference 
xTextRangeCompare(rRowSeq[0][0]->getText(), uno::UNO_QUERY);
 try
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-19 Thread Justin Luth
 sw/qa/extras/ooxmlexport/data/tdf104713_undefinedStyles.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |7 +
 writerfilter/source/dmapper/StyleSheetTable.cxx  |   13 +--
 3 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit b8179d0add55f4df6b0611154bbe35d34e0b81a1
Author: Justin Luth 
Date:   Fri Dec 16 19:51:55 2016 +0300

tdf#104713 writerfilter: parentless styles - only if default defined

LibreOffice's default paragraph style is very different from Word's normal
style? Anyway, if normal is not defined in styles.xml, then don't
re-assign any other automatic styles to be based off of it, since that
indicates that the style information being imported is not complete.

avoids regression from commit b79b5e0df6dc5a0ba18054b0503d6fa804b69f02

Change-Id: I1bfa8505d6b89b2bba255ad727ebadbacc8d3651
Reviewed-on: https://gerrit.libreoffice.org/32103
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit b8fa395288a1f3a24a4fca392afdf3a9b58373ea)
Reviewed-on: https://gerrit.libreoffice.org/32173
Tested-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf104713_undefinedStyles.docx 
b/sw/qa/extras/ooxmlexport/data/tdf104713_undefinedStyles.docx
new file mode 100644
index 000..5114a06
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf104713_undefinedStyles.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ef5857a..a767a6e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -357,6 +357,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf53856_conflictingStyle, 
"tdf53856_conflictingSty
 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, 
getProperty(xStyle, "CharPosture"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf104713_undefinedStyles, 
"tdf104713_undefinedStyles.docx")
+{
+// Normal paragraph style was not defined, so don't replace conflicting 
styles
+uno::Reference 
xStyle(getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(static_cast(212), 
getProperty(xStyle, "ParaBottomMargin"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testDrawingmlFlipv, "drawingml-flipv.docx")
 {
 // The problem was that the shape had vertical flip only, but then we 
added rotation as well on export.
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index c9ef060..e2ee7b6 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -267,6 +267,7 @@ struct StyleSheetTable_Impl
 /// Style names which should not be used without a " (user)" suffix.
 std::set  m_aReservedStyleNames;
 ListCharStylePropertyVector_t   m_aListCharStylePropertyVector;
+boolm_bHasImportedDefaultParaStyle;
 boolm_bIsNewDoc;
 
 StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< 
text::XTextDocument> const& xTextDocument, bool bIsNewDoc);
@@ -289,6 +290,7 @@ StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& 
rDMapper,
 m_pCurrentEntry(),
 m_pDefaultParaProps(new PropertyMap),
 m_pDefaultCharProps(new PropertyMap),
+m_bHasImportedDefaultParaStyle(false),
 m_bIsNewDoc(bIsNewDoc)
 {
 //set font height default to 10pt
@@ -456,6 +458,9 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
 break;
 case NS_ooxml::LN_CT_Style_default:
 m_pImpl->m_pCurrentEntry->bIsDefaultStyle = (nIntValue != 0);
+if (m_pImpl->m_pCurrentEntry->bIsDefaultStyle && 
m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_PARA)
+m_pImpl->m_bHasImportedDefaultParaStyle = true;
+
 if (m_pImpl->m_pCurrentEntry->nStyleTypeCode != STYLE_TYPE_UNKNOWN)
 {
 beans::PropertyValue aValue;
@@ -946,9 +951,13 @@ void StyleSheetTable::ApplyStyleSheets( const 
FontTablePtr& rFontTable )
 {
 
StyleSheetTable_Impl::SetPropertiesToDefault(xStyle);
 
-// resolve import conflicts with built-in styles
-if( pEntry->sBaseStyleIdentifier.isEmpty() && 
!xStyle->getParentStyle().isEmpty() )
+// resolve import conflicts with built-in styles 
(only if normal style has been defined)
+if( m_pImpl->m_bHasImportedDefaultParaStyle
+&& pEntry->sBaseStyleIdentifier.isEmpty()
+&& !xStyle->getParentStyle().isEmpty() )
+

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-14 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/tdf104228.rtf |   37 ++
 sw/qa/extras/rtfexport/rtfexport.cxx  |   10 
 writerfilter/source/rtftok/rtfsprm.cxx|2 +
 3 files changed, 49 insertions(+)

New commits:
commit 8f79e709e7452267e30c0744e7f906a70830bd58
Author: Miklos Vajna 
Date:   Tue Dec 13 08:20:23 2016 +0100

tdf#104228 RTF import: fix override of style left/right para margin

See commit 1be0a3fa9ebb22b607c54b47739d4467acfed259 (n#825305:
writerfilter RTF import: override style properties like Word,
2014-06-17) for the details, this bug was about the same, just for two
more paragraph properties. Specify the default values for them, so
override of style value as direct formatting works as expected.

Change-Id: I353cc3ae8c35baf1b5ed5a83a8bd131c7bfbbe64
(cherry picked from commit 657c6cc3acec0528209a8584b838cd6de581c437)
Reviewed-on: https://gerrit.libreoffice.org/32005
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfexport/data/tdf104228.rtf 
b/sw/qa/extras/rtfexport/data/tdf104228.rtf
new file mode 100644
index 000..4e5d7cf
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf104228.rtf
@@ -0,0 +1,37 @@
+{\rtf1\sste18000\ansi\deflang1040\ftnbj\uc1\deff0
+{\stylesheet
+{\f2\fs22\fi0\li0\ri0 Normal;}
+{\s2\snext0\outlinelevel1\f5\fs26\cf2\fi0\li0\ri0\sb40\sa0\sl0\outlinelevel1\keep\keepn
 heading 2;}
+{\s3\snext0\outlinelevel3\f5\fs22\i\cf2\fi0\li0\ri0\sb40\sa0\sl0\outlinelevel3\keep\keepn
 heading 4;}
+{\s4\snext4\outlinelevel1\f1\fs18\b\cf2\fi0\li0\ri0\outlinelevel1 MyTitolo 2
+;}
+{\s7\snext7\f1\fs19\fi0\li1192\ri0 Body Text;}
+{\s10\snext10\f2\fs22\tqc\tx4819\tqr\tx9638\fi0\li0\ri0 header;}
+{\s12\snext12\f2\fs22\tqc\tx4819\tqr\tx9638\fi0\li0\ri0 footer
+;}
+}
+\paperw11908\paperh16833\margl851\margr851\margt851\margb851\headery567\footery567\htmautsp1\nogrowautofit\deftab708\formshade\nofeaturethrottle1\fet4\aenddoc\aftnnrlc\pgbrdrhead\pgbrdrfoot
+\sectd\pgwsxn11908\pghsxn16833\marglsxn851\margrsxn851\margtsxn851\margbsxn851\headery567\footery567\sbkpage\pgncont\pgndec\ltrsect
+\plain\plain\f0\fs24
+\pard\ssparaaux0\s4\sb240\ltrpar\qj\outlinelevel1\lang1040\hich\f3\dbch\f3\loch\f3\fs18\expnd0\expndtw-2\ltrch\b
 Before\par
+\trowd\trgaph28\lastrow\trftsWidth3\trwWidth10010\trpaddl28\trpaddfl3\trpaddr28\trpaddfr3\trpaddt28\trpaddft3\trpaddb28\trpaddfb3\trleft-31\ltrrow
+\clvertalt\clbrdrt\brdrs\brdrw5\clbrdrb\brdrs\brdrw5\clbrdrl\brdrs\brdrw5\clbrdrr\brdrs\brdrw5\clpadl28\clpadfl3\clpadr28\clpadfr3\clpadt28\clpadft3\clpadb28\clpadfb3\cellx422
+\clvertalt\clbrdrt\brdrs\brdrw5\clbrdrb\brdrs\brdrw5\clbrdrl\brdrs\brdrw5\clbrdrr\brdrs\brdrw5\clpadl28\clpadfl3\clpadr28\clpadfr3\clpadt28\clpadft3\clpadb28\clpadfb3\cellx3853
+\clvertalt\clbrdrt\brdrs\brdrw5\clbrdrb\brdrs\brdrw5\clbrdrl\brdrs\brdrw5\clbrdrr\brdrs\brdrw5\clpadl28\clpadfl3\clpadr28\clpadfr3\clpadt28\clpadft3\clpadb28\clpadfb3\cellx4874
+\clvertalt\clbrdrt\brdrs\brdrw5\clbrdrb\brdrs\brdrw5\clbrdrl\brdrs\brdrw5\clbrdrr\brdrs\brdrw5\clpadl28\clpadfl3\clpadr28\clpadfr3\clpadt28\clpadft3\clpadb28\clpadfb3\cellx5895
+\clvertalt\clbrdrt\brdrs\brdrw5\clbrdrb\brdrs\brdrw5\clbrdrl\brdrs\brdrw5\clbrdrr\brdrs\brdrw5\clpadl28\clpadfl3\clpadr28\clpadfr3\clpadt28\clpadft3\clpadb28\clpadfb3\cellx6916
+\clvertalt\clbrdrt\brdrs\brdrw5\clbrdrb\brdrs\brdrw5\clbrdrl\brdrs\brdrw5\clbrdrr\brdrs\brdrw5\clpadl28\clpadfl3\clpadr28\clpadfr3\clpadt28\clpadft3\clpadb28\clpadfb3\cellx7937
+\clvertalt\clbrdrt\brdrs\brdrw5\clbrdrb\brdrs\brdrw5\clbrdrl\brdrs\brdrw5\clbrdrr\brdrs\brdrw5\clpadl28\clpadfl3\clpadr28\clpadfr3\clpadt28\clpadft3\clpadb28\clpadfb3\cellx8958
+\clvertalt\clbrdrt\brdrs\brdrw5\clbrdrb\brdrs\brdrw5\clbrdrl\brdrs\brdrw5\clbrdrr\brdrs\brdrw5\clpadl28\clpadfl3\clpadr28\clpadfr3\clpadt28\clpadft3\clpadb28\clpadfb3\cellx9979
+\pard\intbl\ssparaaux0\s7\ltrpar\ql\keep\keepn\widctlpar\plain\f0\fs24\lang1033\hich\f3\dbch\f3\loch\f3\fs16\ltrch\b
 A1\cell
+\pard\intbl\ssparaaux0\s7\ltrpar\ql\keep\keepn\widctlpar\plain\f0\fs24\lang1033\hich\f3\dbch\f3\loch\f3\fs16\ltrch\b
 B1\cell
+\pard\intbl\ssparaaux0\s7\ltrpar\qc\keep\keepn\widctlpar\plain\f0\fs24\lang1033\hich\f3\dbch\f3\loch\f3\fs16\ltrch\b
 C1\cell
+\pard\intbl\ssparaaux0\s7\ltrpar\qc\keep\keepn\widctlpar\plain\f0\fs24\lang1033\hich\f4\dbch\f4\loch\f4\fs16\ltrch\b
 D1\cell
+\pard\intbl\ssparaaux0\s7\ltrpar\qc\keep\keepn\widctlpar\plain\f0\fs24\lang1033\hich\f3\dbch\f3\loch\f3\fs16\ltrch\b
 E1\cell
+\pard\intbl\ssparaaux0\s7\ltrpar\qc\keep\keepn\widctlpar\plain\f0\fs24\lang1033\hich\f4\dbch\f4\loch\f4\fs16\ltrch\b
 F1\cell
+\pard\intbl\ssparaaux0\s7\ltrpar\qc\keep\keepn\widctlpar\plain\f0\fs24\lang1033\hich\f4\dbch\f4\loch\f4\fs16\ltrch\b
 G1\cell
+\pard\intbl\ssparaaux0\s7\ltrpar\qc\keep\keepn\widctlpar\plain\f0\fs24\lang1033\hich\f3\dbch\f3\loch\f3\fs16\ltrch\b
 H1\cell
+\hich\f2\dbch\f2\loch\f2\fs22\ltrch\b0\intbl\row

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-13 Thread Justin Luth
 sw/qa/extras/ooxmlexport/data/tdf104420_lostParagraph.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx  |6 ++
 writerfilter/source/dmapper/DomainMapper.cxx   |3 ++-
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit cc2824e3ab600e1863f52899bc2149694bd44972
Author: Justin Luth 
Date:   Tue Dec 6 19:20:51 2016 +0300

tdf#104420 writerfilter: no dummy para in headers

Change-Id: I22bf2d85e01ce5a084babdc07a11ada0790f4933
Reviewed-on: https://gerrit.libreoffice.org/31710
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
(cherry picked from commit b71c09a31c245f2fc1e1ff3760206bb121869633)
Reviewed-on: https://gerrit.libreoffice.org/31988

diff --git a/sw/qa/extras/ooxmlexport/data/tdf104420_lostParagraph.docx 
b/sw/qa/extras/ooxmlexport/data/tdf104420_lostParagraph.docx
new file mode 100755
index 000..b5d9988
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf104420_lostParagraph.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 2206afe..5487a07 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -55,6 +55,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf89377, 
"tdf89377_tableWithBreakBeforeParaStyle.d
 CPPUNIT_ASSERT_EQUAL( 3, getPages() );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf104420, "tdf104420_lostParagraph.docx")
+{
+// the add/remove dummy paragraph was losing an entire header and paragraph
+CPPUNIT_ASSERT_EQUAL( 2, getPages() );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf41542_borderlessPadding, 
"tdf41542_borderlessPadding.odt")
 {
 // the page style's borderless padding should force this to 3 pages, not 1
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 439ecf2..929671a 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2547,7 +2547,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
  * and remove it again when lcl_endSectionGroup is called
  */
 if(m_pImpl->m_nTableDepth == 0 && 
m_pImpl->GetIsFirstParagraphInSection()
-&& !m_pImpl->GetIsDummyParaAddedForTableInSection() && 
!m_pImpl->GetIsTextFrameInserted())
+&& !m_pImpl->GetIsDummyParaAddedForTableInSection() && 
!m_pImpl->GetIsTextFrameInserted()
+&& !IsInHeaderFooter())
 {
 m_pImpl->AddDummyParaForTableInSection();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-13 Thread Justin Luth
 sw/qa/extras/ooxmlexport/data/tdf46940_dontEquallyDistributeColumns.docx 
|binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|   
10 
 writerfilter/source/dmapper/PropertyMap.cxx  |   
21 +-
 writerfilter/source/dmapper/PropertyMap.hxx  |
2 
 4 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit 8820ca525a40f33fbb067868bc19a944597148af
Author: Justin Luth 
Date:   Sat Dec 10 09:35:09 2016 +0300

tdf#46941 docx: don't balance columns before page-break-section

Pleasantly surprised to see we already don't balance before
regular page-breaks or at the end of the document. This adds
not balancing before a page-break-section.

Change-Id: Ifedff5cc45b154a005f13b3212154c443727e286
Reviewed-on: https://gerrit.libreoffice.org/31826
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit ede1a83e110ce7bc7d3560f415d6269ea3feb947)
Reviewed-on: https://gerrit.libreoffice.org/31943

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf46940_dontEquallyDistributeColumns.docx 
b/sw/qa/extras/ooxmlexport/data/tdf46940_dontEquallyDistributeColumns.docx
new file mode 100644
index 000..657da5e
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf46940_dontEquallyDistributeColumns.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 476f553..2206afe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -61,6 +61,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf41542_borderlessPadding, 
"tdf41542_borderlessPad
 CPPUNIT_ASSERT_EQUAL( 3, getPages() );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf46940_dontEquallyDistributeColumns, 
"tdf46940_dontEquallyDistributeColumns.docx")
+{
+uno::Reference 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(false, 
getProperty(xTextSections->getByIndex(0), "DontBalanceTextColumns"));
+// This was false, columns before a section-page-break were balanced.
+CPPUNIT_ASSERT_EQUAL(true, getProperty(xTextSections->getByIndex(2), 
"DontBalanceTextColumns"));
+CPPUNIT_ASSERT_EQUAL(true, getProperty(xTextSections->getByIndex(3), 
"DontBalanceTextColumns"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testRhbz988516, "rhbz988516.docx")
 {
 // The problem was that the list properties of the footer leaked into body
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 03198f3..cea2dc4 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -398,6 +398,7 @@ SectionPropertyMap::SectionPropertyMap(bool 
bIsFirstSection) :
 ,m_bTitlePage( false )
 ,m_nColumnCount( 0 )
 ,m_nColumnDistance( 1249 )
+,m_xColumnContainer( nullptr )
 ,m_bSeparatorLineIsOn( false )
 ,m_bEvenlySpaced( false )
 ,m_bIsLandscape( false )
@@ -698,6 +699,18 @@ void SectionPropertyMap::SetBorderDistance( 
uno::Reference< beans::XPropertySet
 xStyle->setPropertyValue( sBorderDistanceName, uno::makeAny( nDist ));
 }
 
+void SectionPropertyMap::DontBalanceTextColumns()
+{
+try
+{
+if( m_xColumnContainer.is() )
+m_xColumnContainer->setPropertyValue("DontBalanceTextColumns", 
uno::makeAny(true));
+}
+catch( const uno::Exception& )
+{
+OSL_FAIL( "Exception in SectionPropertyMap::DontBalanceTextColumns");
+}
+}
 
 uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
 uno::Reference< beans::XPropertySet > const& 
xColumnContainer, DomainMapper_Impl& rDM_Impl )
@@ -757,8 +770,9 @@ uno::Reference< text::XTextColumns > 
SectionPropertyMap::ApplyColumnProperties(
 }
 xColumnContainer->setPropertyValue( sTextColumns, uno::makeAny( 
xColumns ) );
 // Set the columns to be unbalanced if that compatibility option is 
set or this is the last section.
+m_xColumnContainer = xColumnContainer;
 if (rDM_Impl.GetSettingsTable()->GetNoColumnBalance() || 
rDM_Impl.GetIsLastSectionGroup())
-xColumnContainer->setPropertyValue("DontBalanceTextColumns", 
uno::makeAny(true));
+DontBalanceTextColumns();
 }
 catch( const uno::Exception& )
 {
@@ -1236,6 +1250,11 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 if( m_nColumnCount > 0 )
 xColumns = ApplyColumnProperties( xFollowPageStyle, rDM_Impl );
 
+// these BreakTypes are effectively page-breaks: don't evenly 
distribute text in columns before a page break;
+SectionPropertyMap* pLastContext = 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-13 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/tdf103925.rtf   |1 +
 sw/qa/extras/rtfexport/rtfexport.cxx|6 ++
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |   20 +---
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 26217b01d5630ddf63c60b4400d3a58d3c0dd789
Author: Miklos Vajna 
Date:   Fri Dec 9 16:27:30 2016 +0100

tdf#103925 RTF import: fix handling of \animtext0

Since commit ac6bfd85df271b650dbd24b45391dac346ecd72c (tdf#92045 DOCX
import:  doesn't mean blinking, 2016-01-06) the
"no blink" blink type is not 0, but
NS_ooxml::LN_Value_ST_TextEffect_none.

(cherry picked from commit c260580daa4fe78093265c1359c4d54677d76470)

Change-Id: If854e57d125a365f829797f027ca5e131705e137
Reviewed-on: https://gerrit.libreoffice.org/31899
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfexport/data/tdf103925.rtf 
b/sw/qa/extras/rtfexport/data/tdf103925.rtf
new file mode 100644
index 000..91183fa
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf103925.rtf
@@ -0,0 +1 @@
+{\rtf1 \animtext0 This is not blinking.\par }
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 37e9ba7..84496ac 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -,6 +,12 @@ DECLARE_RTFEXPORT_TEST(testTdf61901, "tdf61901.rtf")
 }
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf103925, "tdf103925.rtf")
+{
+// This was true, \animtext0 resulted in setting the blinking font effect.
+CPPUNIT_ASSERT_EQUAL(false, getProperty(getRun(getParagraph(1), 1), 
"CharFlash"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx 
b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 0a77075..4c1d217 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -154,9 +154,6 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword 
nKeyword, int nParam)
 nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == 
RTFParserState::RunType::HICH)
 ? NS_ooxml::LN_EG_RPrBase_szCs : NS_ooxml::LN_EG_RPrBase_sz;
 break;
-case RTF_ANIMTEXT:
-nSprm = NS_ooxml::LN_EG_RPrBase_effect;
-break;
 case RTF_EXPNDTW:
 nSprm = NS_ooxml::LN_EG_RPrBase_spacing;
 break;
@@ -1406,6 +1403,23 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword 
nKeyword, int nParam)
 case RTF_TRWWIDTHA:
 m_aStates.top().nTableRowWidthAfter = nParam;
 break;
+case RTF_ANIMTEXT:
+{
+nId = 0;
+switch (nParam)
+{
+case 0:
+nId = NS_ooxml::LN_Value_ST_TextEffect_none;
+break;
+case 2:
+nId = NS_ooxml::LN_Value_ST_TextEffect_blinkBackground;
+break;
+}
+
+if (nId > 0)
+
m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_effect, 
std::make_shared(nId));
+break;
+}
 default:
 {
 SAL_INFO("writerfilter", "TODO handle value '" << 
keywordToString(nKeyword) << "'");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-08 Thread Mark Hung
 sw/qa/extras/ooxmlexport/data/tdf103651.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |9 +
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |6 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |1 +
 writerfilter/source/ooxml/model.xml   |2 +-
 5 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 7f47d68c4310b8bae09286a81036a6fa669a1705
Author: Mark Hung 
Date:   Sat Dec 3 23:06:23 2016 +0800

tdf#103651 check isForwardEvents() for symbols in comments

Every time a comment is referred, the whole comment stream is parsed
but only the referred comment is extracted. But the symbol is always
processed so it is added to all the comments.

Change-Id: I3264de2d011ff188ef64f6500ae426cde0106c16
Reviewed-on: https://gerrit.libreoffice.org/31584
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 3caf89200c8fa7b38d6c340b666ca6cc8c2eb766)
Reviewed-on: https://gerrit.libreoffice.org/31759

diff --git a/sw/qa/extras/ooxmlexport/data/tdf103651.docx 
b/sw/qa/extras/ooxmlexport/data/tdf103651.docx
new file mode 100755
index 000..de4c2d6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103651.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index f4bd83e..476f553 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -151,6 +151,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104115, "tdf104115.docx")
 assertXPath(pXmlDoc, "//a:custGeom", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx")
+{
+uno::Reference xTextField = getProperty< 
uno::Reference >(getRun(getParagraph(1), 1), "TextField");
+OUString sContent;
+xTextField->getPropertyValue("Content") >>= sContent;
+// Comment in the first paragraph should not have smiley ( 0xf04a ).
+CPPUNIT_ASSERT_EQUAL( sal_Int32( -1 ) , sContent.indexOf( sal_Unicode( 
0xf04a ) ));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 17ce14f..0715e0e 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -553,6 +553,12 @@ void OOXMLFastContextHandler::tab()
 mpStream->utext(reinterpret_cast(), 1);
 }
 
+void OOXMLFastContextHandler::symbol()
+{
+if (isForwardEvents())
+sendPropertiesWithId(NS_ooxml::LN_EG_RunInnerContent_sym);
+}
+
 void OOXMLFastContextHandler::cr()
 {
 if (isForwardEvents())
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index d761b46..d0df17f 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -156,6 +156,7 @@ public:
 void ftnednsep();
 void pgNum();
 void tab();
+void symbol();
 void cr();
 void noBreakHyphen();
 void softHyphen();
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 3040eb9..24a020b 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17866,7 +17866,7 @@
 
   
   
-  
+  
 
 
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-07 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf104317.rtf   |   39 
 sw/qa/extras/rtfimport/rtfimport.cxx|8 +
 writerfilter/source/rtftok/rtfsdrimport.cxx |   18 +++-
 3 files changed, 58 insertions(+), 7 deletions(-)

New commits:
commit 0a5dccacc37338abf22785fe0a196dbad0691b0d
Author: Miklos Vajna 
Date:   Tue Dec 6 09:22:53 2016 +0100

tdf#104317 RTF import: avoid setting CustomShapeGeometry on a line shape

Even Santa Claus knows it has no such property.

(cherry picked from commit c2e070d9a8192e7aceed64a63c716c7317843747)

Change-Id: I46e27868c62fabd10c6447956e40e55962ee284b
Reviewed-on: https://gerrit.libreoffice.org/31723
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfimport/data/tdf104317.rtf 
b/sw/qa/extras/rtfimport/data/tdf104317.rtf
new file mode 100644
index 000..3f80f3f
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf104317.rtf
@@ -0,0 +1,39 @@
+{\rtf1\ansi\ansicpg1251\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1049\deflangfe1049
+{\shp
+{\*\shpinst\shpleft5940\shptop8200\shpright5940\shpbottom8480\shpfhdr0\shpbxpage\shpbxignore\shpbypage\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz37\shplid1064
+{\sp
+{\sn shapeType}
+{\sv 20}
+}
+{\sp
+{\sn fFlipV}
+{\sv 1}
+}
+{\sp
+{\sn fShadow}
+{\sv 0}
+}
+{\sp
+{\sn posrelh}
+{\sv 1}
+}
+{\sp
+{\sn posrelv}
+{\sv 1}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 0}
+}
+{\sp
+{\sn fBehindDocument}
+{\sv 1}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 0}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 344a3a4..2f554e1 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2713,6 +2713,14 @@ DECLARE_RTFIMPORT_TEST(testTdf90697, "tdf90697.rtf")
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf104317, "tdf104317.rtf")
+{
+// This failed to load, we tried to set CustomShapeGeometry on a line 
shape.
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), xDrawPage->getCount());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 61cde99..fa05c83 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -941,13 +941,17 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, 
ShapeOrPict const shap
 
 if (obFlipH == true || obFlipV == true)
 {
-// This has to be set after position and size is set, otherwise 
flip will affect the position.
-comphelper::SequenceAsHashMap 
aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
-if (obFlipH == true)
-aCustomShapeGeometry["MirroredX"] <<= true;
-if (obFlipV == true)
-aCustomShapeGeometry["MirroredY"] <<= true;
-xPropertySet->setPropertyValue("CustomShapeGeometry", 
uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList()));
+// Line shapes have no CustomShapeGeometry.
+if (nType != ESCHER_ShpInst_Line)
+{
+// This has to be set after position and size is set, 
otherwise flip will affect the position.
+comphelper::SequenceAsHashMap 
aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
+if (obFlipH == true)
+aCustomShapeGeometry["MirroredX"] <<= true;
+if (obFlipV == true)
+aCustomShapeGeometry["MirroredY"] <<= true;
+xPropertySet->setPropertyValue("CustomShapeGeometry", 
uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList()));
+}
 }
 
 if (rShape.nHoriOrientRelation != 0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-12-02 Thread Justin Luth
 sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |7 +++
 writerfilter/source/dmapper/DomainMapper.cxx   |5 +++--
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 5e74df1c3a09bd00caa4f9b8d3d0cd5539d1acff
Author: Justin Luth 
Date:   Tue Nov 29 08:15:40 2016 +0300

tdf#103975 docx import: don't lose column break #2

Change-Id: I871e10d675d9009c163dd2b0fc74d29206934e34
Reviewed-on: https://gerrit.libreoffice.org/31342
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
(cherry picked from commit 4307a850a310c0371bee1f79a8eb41fa8ff7fed2)
Reviewed-on: https://gerrit.libreoffice.org/31396

diff --git a/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx 
b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx
new file mode 100755
index 000..37c7524
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 78845fd..4fd658d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -130,6 +130,13 @@ DECLARE_SW_IMPORT_TEST(testMathMalformedXml, 
"math-malformed_xml.docx", FailTest
 CPPUNIT_ASSERT(!mxComponent.is());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakD, 
"tdf103975_notPageBreakD.docx")
+{
+// The problem was that the column break was moving outside of the 
columns, making a page break.
+CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, 
getProperty(getParagraph(2), "BreakType"));
+CPPUNIT_ASSERT_EQUAL( 1, getPages() );
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakE, 
"tdf103975_notPageBreakE.docx")
 {
 // The problem was that the column break was getting lost.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index aa279d6..439ecf2 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3252,8 +3252,10 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 m_pImpl->m_bIgnoreNextPara = false;
 return;
 }
+
+const bool bSingleParagraph = 
m_pImpl->GetIsFirstParagraphInSection() && 
m_pImpl->GetIsLastParagraphInSection();
 PropertyMapPtr pContext = 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
-if (pContext && 
m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark())
+if (pContext && 
(m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark() || bSingleParagraph))
 {
 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
 pContext->Insert(PROP_BREAK_TYPE, 
uno::makeAny(style::BreakType_PAGE_BEFORE));
@@ -3271,7 +3273,6 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 m_pImpl->clearDeferredBreaks();
 }
 
-bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && 
m_pImpl->GetIsLastParagraphInSection();
 // If the paragraph contains only the section properties and it has
 // no runs, we should not create a paragraph for it in Writer, 
unless that would remove the whole section.
 bool bRemove = !m_pImpl->GetParaChanged() && 
m_pImpl->GetParaSectpr()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-11-29 Thread Justin Luth
 sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakE.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |7 +++
 writerfilter/source/dmapper/DomainMapper.cxx   |9 +
 3 files changed, 16 insertions(+)

New commits:
commit 3de0128ec4e0fce998c84043a7f8f173f1f8ac96
Author: Justin Luth 
Date:   Mon Nov 28 21:59:22 2016 +0300

tdf#103975 docx import: don't lose column break

This round-trips terribly, but that was equally true before these patches.

Change-Id: I4ed191c77e7f519d4c013fc83ef8b866b53d0c70
Reviewed-on: https://gerrit.libreoffice.org/31326
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
(cherry picked from commit bbc7ed9c379019f31dc7ac234cf83ea151601465)
Reviewed-on: https://gerrit.libreoffice.org/31341

diff --git a/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakE.docx 
b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakE.docx
new file mode 100755
index 000..ac3eb9f
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakE.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 05a4904..78845fd 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -129,6 +130,12 @@ DECLARE_SW_IMPORT_TEST(testMathMalformedXml, 
"math-malformed_xml.docx", FailTest
 CPPUNIT_ASSERT(!mxComponent.is());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakE, 
"tdf103975_notPageBreakE.docx")
+{
+// The problem was that the column break was getting lost.
+CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, 
getProperty(getParagraph(2), "BreakType"));
+}
+
 DECLARE_OOXMLIMPORT_TEST(testN751017, "n751017.docx")
 {
 uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 26168b8..aa279d6 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3258,7 +3258,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
 pContext->Insert(PROP_BREAK_TYPE, 
uno::makeAny(style::BreakType_PAGE_BEFORE));
 else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
+{
+if ( m_pImpl->GetIsFirstParagraphInSection() || 
!m_pImpl->IsFirstRun() )
+{
+mbIsSplitPara = true;
+m_pImpl->finishParagraph( 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) );
+lcl_startParagraphGroup();
+}
+
 pContext->Insert(PROP_BREAK_TYPE, 
uno::makeAny(style::BreakType_COLUMN_BEFORE));
+}
 m_pImpl->clearDeferredBreaks();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

2016-11-29 Thread Justin Luth
 dev/null  |binary
 sw/qa/extras/ooxmlexport/data/rhbz988516.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |   13 +
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   12 
 writerfilter/source/dmapper/DomainMapper.cxx  |1 +
 5 files changed, 14 insertions(+), 12 deletions(-)

New commits:
commit d1c06ed189e9af7871961f72acae2dfd938d71d5
Author: Justin Luth 
Date:   Sat Nov 26 12:30:03 2016 +0300

tdf#103975 docx import: don't remove sectPr with BreakItem

If an empty sectPr paragraph contains Page/Column break
information, do not discard it.

Change-Id: If817debccb924eb9cf0ffdc374c960d25908370f
Reviewed-on: https://gerrit.libreoffice.org/31227
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
(cherry picked from commit 7b250d56981f78e77454a2a3fd670731b2358e75)
Reviewed-on: https://gerrit.libreoffice.org/31233
Tested-by: Jenkins 

diff --git a/sw/qa/extras/ooxmlimport/data/rhbz988516.docx 
b/sw/qa/extras/ooxmlexport/data/rhbz988516.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/rhbz988516.docx
rename to sw/qa/extras/ooxmlexport/data/rhbz988516.docx
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 2182cbc1..8d117e6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -61,6 +61,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf41542_borderlessPadding, 
"tdf41542_borderlessPad
 CPPUNIT_ASSERT_EQUAL( 3, getPages() );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRhbz988516, "rhbz988516.docx")
+{
+// The problem was that the list properties of the footer leaked into body
+CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(1), 
"NumberingStyleName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), 
getParagraph(3)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(2), 
"NumberingStyleName"));
+CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(3), 
"NumberingStyleName"));
+CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(4), 
"NumberingStyleName"));
+
+// tdf#103975 The problem was that an empty paragraph with page break info 
was removed.
+CPPUNIT_ASSERT_EQUAL( 3, getPages() );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx")
 {
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 1e9a5e6..05a4904 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -175,18 +175,6 @@ DECLARE_OOXMLIMPORT_TEST(testN751017, "n751017.docx")
 CPPUNIT_ASSERT(bFoundGet);
 }
 
-DECLARE_OOXMLIMPORT_TEST(testRhbz988516, "rhbz988516.docx")
-{
-// The problem was that the list properties of the footer leaked into body
-CPPUNIT_ASSERT_EQUAL(OUString(),
-getProperty(getParagraph(1), "NumberingStyleName"));
-CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), 
getParagraph(2)->getString());
-CPPUNIT_ASSERT_EQUAL(OUString(),
-getProperty(getParagraph(2), "NumberingStyleName"));
-CPPUNIT_ASSERT_EQUAL(OUString(),
-getProperty(getParagraph(3), "NumberingStyleName"));
-}
-
 DECLARE_OOXMLIMPORT_TEST(testN751077, "n751077.docx")
 {
 /*
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 18c991b..26168b8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3267,6 +3267,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 // no runs, we should not create a paragraph for it in Writer, 
unless that would remove the whole section.
 bool bRemove = !m_pImpl->GetParaChanged() && 
m_pImpl->GetParaSectpr()
&& !bSingleParagraph
+   && !( pContext && pContext->isSet(PROP_BREAK_TYPE) )
&& !m_pImpl->GetIsDummyParaAddedForTableInSection()
&& !m_pImpl->GetIsLastParagraphFramed();
 PropertyMapPtr xContext = bRemove ? 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits