[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2017-03-07 Thread Mike Kaganski
 sw/qa/extras/ww8import/data/tdf106291.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx  |9 ++
 sw/source/filter/ww8/ww8par2.cxx  |  103 --
 3 files changed, 92 insertions(+), 20 deletions(-)

New commits:
commit 7d265e093bc8078471e87da85c625ef2365a1637
Author: Mike Kaganski 
Date:   Thu Mar 2 18:55:50 2017 +0300

tdf#106291: WW8 import: Properly treat column spans

Previous code unconditionally treated all cells in merge groups as
rows span, thus in some conditions it merged incorrectly when there
were cells from same row.

The fix is inspired by SwTable::PrepareMerge().

Also, fixed improper adjustment of too narrow cells in
WW8TabDesc::CalcDefaults(), which also happens in files where
column spans are represented by spanned 1-twip-wide cells.

Unit test included.

Change-Id: If043cfc466879d45141c655f7be1588792f898d3
Reviewed-on: https://gerrit.libreoffice.org/34820
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/34884
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ww8import/data/tdf106291.doc 
b/sw/qa/extras/ww8import/data/tdf106291.doc
new file mode 100644
index 000..893004d
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf106291.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index 1df4a6c..3220a52 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -553,6 +553,15 @@ DECLARE_WW8IMPORT_TEST(testTdf99120, "tdf99120.doc")
 CPPUNIT_ASSERT_EQUAL(OUString("Section 2, even."),  
parseDump("/root/page[4]/header/txt/text()"));
 }
 
+DECLARE_WW8IMPORT_TEST(testTdf106291, "tdf106291.doc")
+{
+// Table cell was merged vertically instead of horizontally -> had 
incorrect dimensions
+OUString cellWidth = 
parseDump("/root/page[1]/body/tab/row/cell[1]/infos/bounds", "width");
+OUString cellHeight = 
parseDump("/root/page[1]/body/tab/row/cell[1]/infos/bounds", "height");
+CPPUNIT_ASSERT_EQUAL(sal_Int32(8660), cellWidth.toInt32());
+CPPUNIT_ASSERT(cellHeight.toInt32() > 200); // height might depend on font 
size
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 80d5ca7c..f7693b0 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -75,9 +75,16 @@
 
 using namespace ::com::sun::star;
 
+// Gets filled in WW8TabDesc::MergeCells().
+// Algorithm must ensure proper row and column order in WW8SelBoxInfo!
 class WW8SelBoxInfo
-: public std::vector, private boost::noncopyable
 {
+private:
+std::vector > m_vRows;
+
+WW8SelBoxInfo(WW8SelBoxInfo const&) = delete;
+WW8SelBoxInfo& operator=(WW8SelBoxInfo const&) = delete;
+
 public:
 short nGroupXStart;
 short nGroupWidth;
@@ -86,6 +93,36 @@ public:
 WW8SelBoxInfo(short nXCenter, short nWidth)
 : nGroupXStart( nXCenter ), nGroupWidth( nWidth ), bGroupLocked(false)
 {}
+
+size_t size() const
+{
+size_t nResult = 0;
+for (auto& it : m_vRows)
+nResult += it.size();
+return nResult;
+}
+
+size_t rowsCount() const { return m_vRows.size(); }
+
+const std::vector& row( size_t nIndex ) { return 
m_vRows[nIndex]; }
+
+void push_back( SwTableBox* pBox )
+{
+bool bDone = false;
+for (auto& iRow : m_vRows)
+if (iRow[0]->GetUpper() == pBox->GetUpper())
+{
+iRow.push_back(pBox);
+bDone = true;
+break;
+}
+if (!bDone)
+{
+const size_t sz = m_vRows.size();
+m_vRows.resize(sz+1);
+m_vRows[sz].push_back(pBox);
+}
+}
 };
 
 WW8TabBandDesc::WW8TabBandDesc()
@@ -162,7 +199,7 @@ class WW8TabDesc: private boost::noncopyable
 
 // single box - maybe used in a merge group
 // (the merge groups are processed later at once)
-SwTableBox* UpdateTableMergeGroup(WW8_TCell& rCell,
+void UpdateTableMergeGroup(WW8_TCell& rCell,
 WW8SelBoxInfo* pActGroup, SwTableBox* pActBox, sal_uInt16 nCol  );
 void StartMiserableHackForUnsupportedDirection(short nWwCol);
 void EndMiserableHackForUnsupportedDirection(short nWwCol);
@@ -2104,6 +2141,15 @@ void WW8TabDesc::CalcDefaults()
 if( pR->nCenter[0] < nMinLeft )
 nMinLeft = pR->nCenter[0];
 
+// Following adjustment moves a border and then uses it to find width
+// of next cell, so collect current widths, to avoid situation when 
width
+// adjustment 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa

2017-02-13 Thread Mike Kaganski
 sw/qa/extras/uiwriter/uiwriter.cxx |   17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

New commits:
commit a1bd94fc01641989e83ea177ac57ccdbacf43c8b
Author: Mike Kaganski 
Date:   Tue Feb 14 00:04:16 2017 +1000

fix unit test

Change-Id: Id7ed11ae03da5e28a4c40fb4fa3019dd6fae89bf
Reviewed-on: https://gerrit.libreoffice.org/34224
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index c50e26a..f159d03 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -93,6 +93,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
@@ -2628,21 +2629,18 @@ void SwUiWriterTest::testTdf88899()
 
 void SwUiWriterTest::testTdf90362()
 {
+// First check if the end of the second paragraph is indeed protected.
 SwDoc* pDoc = createDoc("tdf90362.fodt");
 SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-uno::Reference 
xComponentContext(comphelper::getProcessComponentContext());
-// Ensure correct initial setting
-comphelper::ConfigurationHelper::writeDirectKey(xComponentContext, 
"org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea", 
css::uno::Any(false), comphelper::EConfigurationModes::Standard);
-// First check if the end of the second paragraph is indeed protected.
 pWrtShell->EndPara();
 pWrtShell->Down(/*bSelect=*/false);
 CPPUNIT_ASSERT_EQUAL(true, pWrtShell->HasReadonlySel());
 
 // Then enable ignoring of protected areas and make sure that this time 
the cursor is read-write.
-comphelper::ConfigurationHelper::writeDirectKey(xComponentContext, 
"org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea", 
css::uno::Any(true), comphelper::EConfigurationModes::Standard);
+SwViewOption aViewOptions(*pWrtShell->GetViewOptions());
+aViewOptions.SetIgnoreProtectedArea(true);
+pWrtShell->ApplyViewOptions(aViewOptions);
 CPPUNIT_ASSERT_EQUAL(false, pWrtShell->HasReadonlySel());
-// Clean up, otherwise following tests will have that option set
-comphelper::ConfigurationHelper::writeDirectKey(xComponentContext, 
"org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea", 
css::uno::Any(false), comphelper::EConfigurationModes::Standard);
 }
 
 void SwUiWriterTest::testUndoCharAttribute()
@@ -3564,11 +3562,6 @@ void SwUiWriterTest::testTdf105625()
 {
 SwDoc* pDoc = createDoc("tdf105625.fodt");
 SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-uno::Reference 
xComponentContext(comphelper::getProcessComponentContext());
-// Ensure correct initial setting
-comphelper::ConfigurationHelper::writeDirectKey(xComponentContext,
-"org.openoffice.Office.Writer/", "Cursor/Option", 
"IgnoreProtectedArea",
-css::uno::Any(false), comphelper::EConfigurationModes::Standard);
 // We should be able to edit at positions adjacent to fields.
 // Check if the start and the end of the 1st paragraph are not protected
 // (they are adjacent to FORMCHECKBOX)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2017-02-12 Thread Mike Kaganski
 sw/qa/extras/uiwriter/data/tdf105625.fodt   |9 ++
 sw/qa/extras/uiwriter/data/tdf90362.fodt|6 +
 sw/qa/extras/uiwriter/uiwriter.cxx  |   47 -
 sw/source/core/crsr/callnk.cxx  |4 -
 sw/source/core/crsr/pam.cxx |   54 +---
 sw/source/core/doc/DocumentContentOperationsManager.cxx |9 ++
 sw/source/uibase/wrtsh/delete.cxx   |   24 ++-
 7 files changed, 107 insertions(+), 46 deletions(-)

New commits:
commit 00e2a8b58f152cce8070311da821f3db5f45afd3
Author: Mike Kaganski 
Date:   Fri Feb 10 13:29:38 2017 +1000

Tdf#105625: backport commits

f72b866c9cf4f07fce6744fbf482c4c6488106e2
c34fc4520dfee4ca068f249ee0756dacaa7a60cf
af42aab836626fdf7b29921dff5d344a8b0e47c6
c484c5532a9508606d65dfbb805163cd00178f4c
d4036d3a89b65a4912f62e3930eb1a31cd90a16b

Change-Id: I2d27a12dcc51e4213d6cf1332749d32fe1cc630f
Reviewed-on: https://gerrit.libreoffice.org/34124
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sw/qa/extras/uiwriter/data/tdf105625.fodt 
b/sw/qa/extras/uiwriter/data/tdf105625.fodt
new file mode 100644
index 000..9a1d573
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf105625.fodt
@@ -0,0 +1,9 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+   Field
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/uiwriter/data/tdf90362.fodt 
b/sw/qa/extras/uiwriter/data/tdf90362.fodt
index bf74255..97db3d5 100644
--- a/sw/qa/extras/uiwriter/data/tdf90362.fodt
+++ b/sw/qa/extras/uiwriter/data/tdf90362.fodt
@@ -3,8 +3,10 @@
  
   
Before
-   
+   
+Inside
+   
After
   
  
-
+
\ No newline at end of file
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 61c2cbf..c50e26a 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -205,6 +205,7 @@ public:
 void testTdf104425();
 void testTdf104814();
 void testTdf105417();
+void testTdf105625();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -309,6 +310,7 @@ public:
 CPPUNIT_TEST(testTdf104425);
 CPPUNIT_TEST(testTdf104814);
 CPPUNIT_TEST(testTdf105417);
+CPPUNIT_TEST(testTdf105625);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2626,20 +2628,21 @@ void SwUiWriterTest::testTdf88899()
 
 void SwUiWriterTest::testTdf90362()
 {
-// First check if the end of the second paragraph is indeed protected.
 SwDoc* pDoc = createDoc("tdf90362.fodt");
 SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+uno::Reference 
xComponentContext(comphelper::getProcessComponentContext());
+// Ensure correct initial setting
+comphelper::ConfigurationHelper::writeDirectKey(xComponentContext, 
"org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea", 
css::uno::Any(false), comphelper::EConfigurationModes::Standard);
+// First check if the end of the second paragraph is indeed protected.
 pWrtShell->EndPara();
 pWrtShell->Down(/*bSelect=*/false);
 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2017-01-26 Thread Miklos Vajna
 sw/qa/extras/uiwriter/data/tdf105417.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx   |   27 +++
 sw/source/core/text/txthyph.cxx  |5 +
 sw/source/uibase/inc/hyp.hxx |3 ++-
 sw/source/uibase/lingu/hyp.cxx   |2 +-
 5 files changed, 35 insertions(+), 2 deletions(-)

New commits:
commit d3fe36ac90c3186f14405305e07b700de6f01581
Author: Miklos Vajna 
Date:   Thu Jan 19 11:11:43 2017 +0100

bnc#1014896 tdf#105417 sw hyphenation: avoid infinite loop on ...

... zero-length last line

This hang happened when the user executed Tools -> Language ->
Hyphenation -> Hyphenate All.

This problem is visible only if all of these conditions are met:
- a line in a paragraph has a word that already contains a soft-hyphen,
  but not at the position where the automatic hyphenation would insert
  it
- the last line ends with a word that can be hyphenated
- there is a fly frame in the document

In this case it happens during hyphenation that the layout has an
additional empty line at the end (which is removed by the time the
layout finishes), so we hit the case when SwTextFormatter::Hyphenate()
skips the "if( m_pCurr->PrtWidth() && m_pCurr->GetLen() )" block.

Normally hyphenation terminates when it iterates over the portions of the
line and no overrun nor any existing hyphen portion are seen, but in
this case that never happened. Fix the problem by terminating not only
when we reach the end of the portion iteration, but also when the
portion list is non-existing (has zero length).

(cherry picked from commit 1b6fa616087e7415be9dc7113bbd8bf381aadd70)

Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
sw/source/uibase/lingu/hyp.cxx

Change-Id: I71d4b040a2d4692ae6eb92807d42b077a0f8
Reviewed-on: https://gerrit.libreoffice.org/33310
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sw/qa/extras/uiwriter/data/tdf105417.odt 
b/sw/qa/extras/uiwriter/data/tdf105417.odt
new file mode 100644
index 000..d594d2a
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf105417.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index b3f4d63..d68e957 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -85,6 +85,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,6 +93,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
 
@@ -201,6 +203,7 @@ public:
 void testTdf95699();
 void testTdf104440();
 void testTdf104425();
+void testTdf105417();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -303,6 +306,7 @@ public:
 CPPUNIT_TEST(testTdf95699);
 CPPUNIT_TEST(testTdf104440);
 CPPUNIT_TEST(testTdf104425);
+CPPUNIT_TEST(testTdf105417);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3516,6 +3520,29 @@ void SwUiWriterTest::testTdf104425()
 CPPUNIT_ASSERT_DOUBLES_EQUAL(700.0, fSumHeight_mm, 0.05);
 }
 
+void SwUiWriterTest::testTdf105417()
+{
+SwDoc* pDoc = createDoc("tdf105417.odt");
+CPPUNIT_ASSERT(pDoc);
+SwView* pView = pDoc->GetDocShell()->GetView();
+CPPUNIT_ASSERT(pView);
+uno::Reference xHyphenator = 
LinguMgr::GetHyphenator();
+CPPUNIT_ASSERT(xHyphenator.is());
+// If there are no English hyphenation rules installed, we can't test
+// hyphenation.
+if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString(
+return;
+
+uno::Reference 
xLinguProperties(LinguMgr::GetLinguPropertySet());
+// Automatic hyphenation means not opening a dialog, but going ahead
+// non-interactively.
+xLinguProperties->setIsHyphAuto(true);
+SwHyphWrapper aWrap(pView, xHyphenator, /*bStart=*/false, /*bOther=*/true, 
/*bSelection=*/false);
+// This never returned, it kept trying to hyphenate the last word
+// (greenbacks) again and again.
+aWrap.SpellDocument();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index 369a22a..6b5bd84 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -197,6 +197,11 @@ bool SwTextFormatter::Hyphenate( SwInterHyphInfo  
)
 if( !pPos )
 nWrdStart = 0;
 }
+else
+// In case the whole line is zero-length, that's the same situation as
+// above when the portion iteration ends without explicitly breaking
+// from the loop.
+nWrdStart = 0;
 
 // Das alte LineLayout wird wieder eingestellt ...
 delete m_pCurr;
diff --git a/sw/source/uibase/inc/hyp.hxx b/sw/source/uibase/inc/hyp.hxx

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa writerfilter/source

2017-01-06 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 3753e2010d0acd5f4ff25e2cb75a33cb580d310f
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 

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 097b749..7168d17 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1740,6 +1740,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 1ab28c2..0b95b45 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("BackgroundParaOverDrawings", 
uno::makeAny(sal_True));
 xSettings->setPropertyValue("TabOverMargin", uno::makeAny(sal_True));
 xSettings->setPropertyValue("PropLineSpacingShrinksFirstLine", 
uno::makeAny(sal_True));
+xSettings->setPropertyValue("DoNotCaptureDrawObjsOnPage", 
uno::makeAny(sal_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 'distro/collabora/cp-5.1' - sw/qa writerfilter/source

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

New commits:
commit 32b1b00c4e94445610585e9c5b2ca74ec36c3173
Author: Tamás Zolnai 
Date:   Wed Dec 21 01:33:49 2016 +

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

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

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

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Change-Id: Ieed29c690f8516f63d0956a4f0495500908a0d27

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 b70f270..1a457c3 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -3265,6 +3265,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf103664, "tdf103664.docx")
 CPPUNIT_ASSERT_EQUAL(awt::CharSet::SYMBOL, getProperty(xRun, 
"CharFontCharSet"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf96218, "tdf96218.docx")
+{
+// Image had a bad position because layoutInCell attribute was not ignored
+CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow"));
+}
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index ab8948fd..7f2d246 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3624,6 +3624,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 305ec87..99cbbdf 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -114,6 +114,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 947bd72..944ce4f 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1276,7 +1276,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 'distro/collabora/cp-5.1' - sw/qa sw/source

2016-12-20 Thread Miklos Vajna
 sw/qa/extras/ww8export/data/tdf104805.doc |binary
 sw/qa/extras/ww8export/ww8export.cxx  |   17 +
 sw/source/filter/ww8/ww8par3.cxx  |   14 +++---
 3 files changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 4c6904c4e491d4211d06f65b759433c59fe0de6b
Author: Miklos Vajna 
Date:   Tue Dec 20 10:46:51 2016 +0100

tdf#104805 DOC import: fix non-0-starting LVL.xst with none-type prev level

Interesting parts of the bugdoc:

- it has a numbering definition with two levels
- first level's type is none
- second level has a numbering string: "\x01."

Usually these placeholder bytes in the numbering string start from 0x00,
but there it starts at 0x01, which means the layout has to replace it
with the numbering from the second level.

Mapping from the spec to the code:

- nLevelB is an index into rgbxchNums
- aOfsNumsXCH is rgbxchNums
- sNumString is xst

So when the rNotReallyThere added in commit
251ba90d863c2695c9f46ef922e49d72a65da9ea (INTEGRATION: CWS
soberfilterteam06 (1.44.26); FILE MERGED, 2003-05-19) wants to clear out
indexes from aOfsNumsXCH, it talks about numbering levels. The old code
assumed that nLevelB is the same as nPosValue, which is true in many
cases (when the levels are like 1, 1.1, 1.1.1), but not in this
particular case, where nLevelB is 0, but nPosValue is 1.

(cherry picked from commit 19d08bbf704332d727cfbe8e101e7d14c62326a0)

Conflicts:
sw/qa/extras/ww8export/ww8export2.cxx

Change-Id: I590d9b2725a3330c26a04a526ce22d95970a974f
Reviewed-on: https://gerrit.libreoffice.org/32233
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/sw/qa/extras/ww8export/data/tdf104805.doc 
b/sw/qa/extras/ww8export/data/tdf104805.doc
new file mode 100644
index 000..a2dd81d
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf104805.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 792f582..4ac070b 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -691,6 +691,23 @@ DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt")
 CPPUNIT_ASSERT_EQUAL(COL_AUTO, charColor);
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
+{
+uno::Reference 
xPropertySet(getStyles("NumberingStyles")->getByName("WW8Num1"), 
uno::UNO_QUERY);
+uno::Reference 
xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+uno::Sequence aNumberingRule;
+xLevels->getByIndex(1) >>= aNumberingRule; // 2nd level
+for (const auto& rPair : aNumberingRule)
+{
+if (rPair.Name == "Prefix")
+// This was "." instead of empty, so the second paragraph was
+// rendered as ".1" instead of "1.".
+CPPUNIT_ASSERT_EQUAL(OUString(), rPair.Value.get());
+else if (rPair.Name == "Suffix")
+CPPUNIT_ASSERT_EQUAL(OUString("."), rPair.Value.get());
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index eaefccb..b04c165 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -812,13 +812,21 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, 
SfxItemSet*& rpItemSet,
 for(nLevelB = 0; nLevelB < nMaxLevel; ++nLevelB)
 aOfsNumsXCH.push_back(aLVL.aOfsNumsXCH[nLevelB]);
 
+// nLevelB is an index in the aOfsNumsXCH array.
 for(nLevelB = 0; nLevelB <= nLevel; ++nLevelB)
 {
+// nPos is a one-based character offset to a level placeholder in
+// sNumString.
 sal_uInt8 nPos = aOfsNumsXCH[nLevelB];
-if (nPos && nPos < sNumString.getLength()  && sNumString[nPos-1] < 
nMaxLevel)
+if (nPos && nPos < sNumString.getLength())
 {
-if (rNotReallyThere[nLevelB])
-aOfsNumsXCH[nLevelB] = 0;
+// nPosValue is the actual numbering level.
+sal_Unicode nPosValue = sNumString[nPos-1];
+if (nPosValue < nMaxLevel)
+{
+if (rNotReallyThere[nPosValue])
+aOfsNumsXCH[nLevelB] = 0;
+}
 }
 }
 myIter aIter = std::remove(aOfsNumsXCH.begin(), aOfsNumsXCH.end(), 0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2016-12-12 Thread Mike Kaganski
 sw/qa/extras/uiwriter/data/tdf104425.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx   |   17 +++
 sw/source/core/inc/rowfrm.hxx|   19 +++
 sw/source/core/layout/tabfrm.cxx |  153 ++-
 4 files changed, 145 insertions(+), 44 deletions(-)

New commits:
commit 4a43b3092731daaabb7a97be530ccb2edc0ffc3a
Author: Mike Kaganski 
Date:   Thu Dec 8 23:01:03 2016 +0300

tdf#104425 sw: split rows w/large min height (fix layout loop)

This solves the problem of rows with too big minimal height causing
layout failure (the table just goes out of page, does not flow to
next page).

It does so with three steps:
1. Currently, a row with a minimum height that flows to next page
repeats whole min height on that (and possibly following) pages.
If this behaviour continued, then that would cause layout loop:
the row min height would be too high for the page, so it would
keep flowing to next pages (actually just go beyond the botom
because of layout failure). To mitigate this, the patch changes
the behaviour to measure total height of all frames of the row:
the function lcl_calcHeightOfRowBeforeThisFrame calculates the
total height of previous row frames for the same row, then in
places where we need to get min height, this value is subtracted
from row min total height. On following pages the min height of
frames will get less each time.

2. When the row is split, the possibility to split depends on if
the minimum height of the row fits into the vertical space left.
The minimum height is found as maxinum of two values: minimal
contents of the row (e.g., height of first line of text, or an
object, or lower table cell), and the minimum height setting.
As the minimum height setting should not prevent the cell to
flow, (it only should ensure that total height is no less), we
should not consider the setting when the split is performed
(we should be able to keep on first page as little as required).
To allow this, a new bool member introduced in SwRowFrame:
m_bIsInSplit, with its setter and getter. When it is true,
the routines that calculate min height ignore the min height
setting. It is set in lcl_RecalcSplitLine around lcl_RecalcRow
and SwRowFrame::Calc that decide if it's possible to keep part of
row's content on first page, and update table's height to fit
the rest of space.

3. It turns out, that if contents of the splitted cell has less
height than the min height setting, then following happens.
In SwTabFrame::Split, all rows below splitted one are moved to
follow flow table; then table frame's Shrink method used to shrink
the freed height. At this moment, still, the height of splitted
row is too high, and total height of table is too high. Then,
lcl_RecalcSplitLine is called, where row is first shrunk, and then
lcl_RecalcRow and SwRowFrame::Calc try to move contents and resize
the splitted row. They get the minimum height of content (we already
don't consider the min height setting), but then "last row will fill
the space in its upper" (see SwRowFrame::Format). Row returns its
previous size, table does not resize, it doesn't fit to page, and
split fails.
To try to fix that, I call SwTabFrame::Shrink in lcl_RecalcSplitLine
after lcl_ShrinkCellsAndAllContent before lcl_RecalcRow.

Unit test included.

Change-Id: I37a6b3589abf287dd5efc991a6336fc378410df9
Reviewed-on: https://gerrit.libreoffice.org/31774
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/31915
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sw/qa/extras/uiwriter/data/tdf104425.odt 
b/sw/qa/extras/uiwriter/data/tdf104425.odt
new file mode 100644
index 000..8bbf265
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf104425.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index d7827ae..b3f4d63 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -200,6 +200,7 @@ public:
 void testLandscape();
 void testTdf95699();
 void testTdf104440();
+void testTdf104425();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -301,6 +302,7 @@ public:
 CPPUNIT_TEST(testLandscape);
 CPPUNIT_TEST(testTdf95699);
 CPPUNIT_TEST(testTdf104440);
+CPPUNIT_TEST(testTdf104425);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3499,6 +3501,21 @@ void SwUiWriterTest::testTdf104440()
 xmlXPathFreeObject(pXmlObj);
 }
 
+void SwUiWriterTest::testTdf104425()
+{
+createDoc("tdf104425.odt");
+ 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2016-12-08 Thread Miklos Vajna
 sw/qa/extras/uiwriter/data/tdf104440.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx   |   15 +++
 sw/source/core/text/txtfly.cxx   |7 +++
 3 files changed, 22 insertions(+)

New commits:
commit c1ae11db4a56dea9369d379a83c8a2a7afc2b99b
Author: Miklos Vajna 
Date:   Wed Dec 7 10:00:10 2016 +0100

tdf#104440 sw: fix layout inconsistency with dynamic wrapping and undo

The problem was that the second fly frame was placed on the first page
initially, but after typing a character (which moved it to the second
page) and then undoing, it wasn't moved back.

Fix the inconsistency by handling the "fly frame takes all horizontal
space" case as parallel wrapping (which will result in no wrapping at
the end), this way the second fly frame appears on the second page both
initially and after editing.

As an additional data point, the DOC export of the bugdoc is now
rendered in Word the same way as in Writer.

(cherry picked from commit 862c12396585661606d4e6ae583d1d024a19d222)

Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx

Change-Id: Ifc9f17458ad0501b8ab6077e5a4998d48fd6f1d8
Reviewed-on: https://gerrit.libreoffice.org/31725
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sw/qa/extras/uiwriter/data/tdf104440.odt 
b/sw/qa/extras/uiwriter/data/tdf104440.odt
new file mode 100644
index 000..b226bb5
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf104440.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 1a37476..d7827ae 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -199,6 +199,7 @@ public:
 void testCursorWindows();
 void testLandscape();
 void testTdf95699();
+void testTdf104440();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -299,6 +300,7 @@ public:
 CPPUNIT_TEST(testCursorWindows);
 CPPUNIT_TEST(testLandscape);
 CPPUNIT_TEST(testTdf95699);
+CPPUNIT_TEST(testTdf104440);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3484,6 +3486,19 @@ void SwUiWriterTest::testTdf95699()
 
CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"), 
pFieldMark->GetFieldname());
 }
 
+void SwUiWriterTest::testTdf104440()
+{
+createDoc("tdf104440.odt");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"//page[2]/body/txt/anchored");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+// This was 0: both Text Frames in the document were anchored to a
+// paragraph on page 1, while we expect that the second Text Frame is
+// anchored to a paragraph on page 2.
+CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes));
+xmlXPathFreeObject(pXmlObj);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 8c041c6..efc5abe 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -1386,6 +1386,13 @@ SwSurround SwTextFly::_GetSurroundForTextWrap( const 
SwAnchoredObject* pAnchored
 const int textMin = GetMaster()->GetNode()
 
->getIDocumentSettingAccess()->get(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL )
 ? TEXT_MIN_SMALL : TEXT_MIN;
+
+// In case there is no space on either side, then SURROUND_PARALLEL
+// gives the same result when doing the initial layout or a layout
+// update after editing, so prefer that over SURROUND_NONE.
+if (nLeft == 0 && nRight == 0)
+return SURROUND_PARALLEL;
+
 if( nLeft < textMin )
 nLeft = 0;
 if( nRight < textMin )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2016-11-21 Thread Mike Kaganski
 sw/qa/extras/uiwriter/data/tdf95699.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx  |   20 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 +++-
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 79e518039504496aa8ce1c6b2b36ede88de0fe1c
Author: Mike Kaganski 
Date:   Fri Nov 18 11:17:40 2016 +0300

tdf#95699: allow copy FORMCHECKBOX and FORMDROPDOWN ...

... when they are selected alone (no adjacent text selected).
Unit test included.

Change-Id: Ia278ae2ea86a3e6d83e1a628880f770f1eb11cd7
Reviewed-on: https://gerrit.libreoffice.org/30954
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
Reviewed-by: Miklos Vajna 
(cherry picked from commit de524d2051abd700f93da4e0e9f273504b12515a)

diff --git a/sw/qa/extras/uiwriter/data/tdf95699.odt 
b/sw/qa/extras/uiwriter/data/tdf95699.odt
new file mode 100644
index 000..79cf858
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf95699.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 531d15e..1a37476 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -198,6 +198,7 @@ public:
 void testRedlineTimestamp();
 void testCursorWindows();
 void testLandscape();
+void testTdf95699();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -297,6 +298,7 @@ public:
 CPPUNIT_TEST(testRedlineTimestamp);
 CPPUNIT_TEST(testCursorWindows);
 CPPUNIT_TEST(testLandscape);
+CPPUNIT_TEST(testTdf95699);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3464,6 +3466,24 @@ void SwUiWriterTest::testLandscape()
 CPPUNIT_ASSERT(pWrtShell->GetPageDesc(nPageDesc).GetLandscape());
 }
 
+void SwUiWriterTest::testTdf95699()
+{
+// Open the document with single FORMCHECKBOX field, select all and copy 
to clipboard
+// then check that clipboard contains the FORMCHECKBOX in text body.
+// Previously that failed.
+SwDoc* pDoc = createDoc("tdf95699.odt");
+IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
+SwDoc aClipboard;
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->SelAll();
+pWrtShell->Copy();
+pMarkAccess = aClipboard.getIDocumentMarkAccess();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
+::sw::mark::IFieldmark* pFieldMark = 
pMarkAccess->getFieldmarkAfter(SwPosition(pDoc->GetNodes().GetEndOfExtras()));
+
CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"), 
pFieldMark->GetFieldname());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 7aa3bdf..33533cf 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -233,14 +233,16 @@ namespace
 const SwPosition& rMarkStart = pMark->GetMarkStart();
 const SwPosition& rMarkEnd = pMark->GetMarkEnd();
 // only include marks that are in the range and not touching both 
start and end
-// - not for annotation marks.
+// - not for annotation or checkbox marks.
 const bool bIsNotOnBoundary =
 pMark->IsExpanded()
 ? (rMarkStart != rStt || rMarkEnd != rEnd)  // rMarkStart != 
rMarkEnd
 : (rMarkStart != rStt && rMarkEnd != rEnd); // rMarkStart == 
rMarkEnd
+const IDocumentMarkAccess::MarkType aMarkType = 
IDocumentMarkAccess::GetType(*pMark);
 if ( rMarkStart >= rStt && rMarkEnd <= rEnd
  && ( bIsNotOnBoundary
-  || IDocumentMarkAccess::GetType( *pMark ) == 
IDocumentMarkAccess::MarkType::ANNOTATIONMARK ) )
+  || aMarkType == 
IDocumentMarkAccess::MarkType::ANNOTATIONMARK
+  || aMarkType == 
IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK ) )
 {
 vMarksToCopy.push_back(pMark);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa writerfilter/source

2016-11-05 Thread Tamás Zolnai
 sw/qa/extras/ooxmlimport/data/tdf103664.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   20 
 writerfilter/source/dmapper/DomainMapper.cxx |2 ++
 3 files changed, 22 insertions(+)

New commits:
commit 630f06d222c339e86ca3133123931b9262264e3a
Author: Tamás Zolnai 
Date:   Sat Nov 5 12:30:20 2016 +

tdf#103664: FILEOPEN: DOCX: Wingdings symbols are imported as rectangles

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

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Change-Id: Ifd9ff26f2460e5570ec1b736308d48acdb3e56a8

diff --git a/sw/qa/extras/ooxmlimport/data/tdf103664.docx 
b/sw/qa/extras/ooxmlimport/data/tdf103664.docx
new file mode 100644
index 000..4d299a6
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf103664.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index c3c4728..b70f270 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -81,6 +81,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -3246,6 +3247,25 @@ DECLARE_OOXMLIMPORT_TEST(testTdf99074, "tdf99074.docx")
 CPPUNIT_ASSERT(getProperty(xSettings, "InBrowseMode"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf103664, "tdf103664.docx")
+{
+// Wingdings symbols was displayed as rectangles
+uno::Reference xPara(getParagraph(1));
+CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf020), xPara->getString()[0] );
+CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf0fc), xPara->getString()[1] );
+CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf0dc), xPara->getString()[2] );
+CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf081), xPara->getString()[3] );
+
+uno::Reference xRun(getRun(xPara,1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, 
"CharFontName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, 
"CharFontNameAsian"));
+CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, 
"CharFontNameComplex"));
+
+// Make sure these special characters imported as symbols
+CPPUNIT_ASSERT_EQUAL(awt::CharSet::SYMBOL, getProperty(xRun, 
"CharFontCharSet"));
+}
+
+
 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 ae201aa..ab8948fd 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -62,6 +62,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2635,6 +2636,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext )
 rContext->Insert(PROP_CHAR_FONT_NAME, aVal);
 rContext->Insert(PROP_CHAR_FONT_NAME_ASIAN, aVal);
 rContext->Insert(PROP_CHAR_FONT_NAME_COMPLEX, aVal);
+rContext->Insert(PROP_CHAR_FONT_CHAR_SET, 
uno::makeAny(awt::CharSet::SYMBOL));
 utext( reinterpret_cast < const sal_uInt8 * >( 
&(aSymbolData.cSymbol) ), 1 );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa

2016-10-31 Thread Tamás Zolnai
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 48d66f24e8cf38cb5deca8cc380ae4712c55b1e3
Author: Tamás Zolnai 
Date:   Mon Oct 31 13:25:47 2016 +

tdf#103544: This unit test update was missed to cherry-pick

Change-Id: I4127e6dc2aa89ed6df07d0908340840f36b8fc43

diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 09c0840..0d6116a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -498,8 +498,8 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78590, "FDO78590.docx")
 return;
 
 // This is to ensure that the fld starts and ends inside a hyperlink...
-assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "w", 
"9851" );
-assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "h", 
"1669" );
+assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "w", 
"9851" );
+assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "h", 
"1669" );
 }
 
 DECLARE_OOXMLEXPORT_TEST(testSdtCitationRun, "sdt-citation-run.docx")
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2016-09-30 Thread Miklos Vajna
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   26 +
 sw/source/core/crsr/viscrs.cxx |8 +--
 2 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit 59cff0dbbdcbe1382f09fb23c71eadbe7d471fa8
Author: Miklos Vajna 
Date:   Thu Sep 29 16:53:59 2016 +0200

sw lok: disable pixel alignment of cursor logic values

It just makes harder for a client to find out if the cursor of one view
is at the same position as the cursor of an other view.

Change-Id: Ifaebd1c93c45918c87f3c2c3d12bbb3af949184e
Reviewed-on: https://gerrit.libreoffice.org/29393
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 
(cherry picked from commit b32b6c09d190effbe29389a87a80df36007d2e99)

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 9da36aa..e7b78b7 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -77,6 +77,7 @@ public:
 void testCreateViewTextSelection();
 void testRedlineColors();
 void testCommentEndTextEdit();
+void testCursorPosition();
 
 CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
 CPPUNIT_TEST(testRegisterCallback);
@@ -117,6 +118,7 @@ public:
 CPPUNIT_TEST(testCreateViewTextSelection);
 CPPUNIT_TEST(testRedlineColors);
 CPPUNIT_TEST(testCommentEndTextEdit);
+CPPUNIT_TEST(testCursorPosition);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1504,6 +1506,30 @@ void SwTiledRenderingTest::testCommentEndTextEdit()
 comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SwTiledRenderingTest::testCursorPosition()
+{
+// Load a document and register a callback, should get an own cursor.
+comphelper::LibreOfficeKit::setActive();
+SwXTextDocument* pXTextDocument = createDoc();
+ViewCallback aView1;
+
SfxViewShell::Current()->registerLibreOfficeKitViewCallback(::callback,
 );
+
+// Crete a second view, so the first view gets a collaborative cursor.
+SfxLokHelper::createView();
+pXTextDocument->initializeForTiledRendering({});
+ViewCallback aView2;
+
SfxViewShell::Current()->registerLibreOfficeKitViewCallback(::callback,
 );
+
+// Make sure the two are exactly the same.
+// This failed, own cursor was at '1418, 1418', collaborative cursor was at
+// '1425, 1425', due to pixel alignment.
+CPPUNIT_ASSERT_EQUAL(aView1.m_aOwnCursor.toString(), 
aView1.m_aViewCursor.toString());
+
+mxComponent->dispose();
+mxComponent.clear();
+comphelper::LibreOfficeKit::setActive(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 19e3762..64154fe 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -170,10 +170,14 @@ void SwVisibleCursor::_SetPosAndShow(SfxViewShell* 
pViewShell)
 }
 }
 
-if( aRect.Height() )
+if( aRect.Height())
 {
 ::SwCalcPixStatics( m_pCursorShell->GetOut() );
-::SwAlignRect( aRect, static_cast(m_pCursorShell), m_pCursorShell->GetOut() );
+
+// Disable pixel alignment when tiled rendering, so that twip values of
+// the cursor don't depend on statics.
+if (!comphelper::LibreOfficeKit::isActive())
+::SwAlignRect( aRect, static_cast(m_pCursorShell), m_pCursorShell->GetOut() );
 }
 if( !m_pCursorShell->IsOverwriteCursor() || m_bIsDragCursor ||
 m_pCursorShell->IsSelection() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2016-07-04 Thread Justin Luth
 sw/qa/extras/odfimport/data/tdf76322_columnBreakInHeader.docx |binary
 sw/qa/extras/odfimport/odfimport.cxx  |6 ++
 sw/source/core/layout/flowfrm.cxx |2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit e7cea34113baa840de61208fa56da2cf043e0297
Author: Justin Luth 
Date:   Sat Jun 11 21:58:11 2016 +0300

tdf#76322 writer: allow column breaks in headers/footers

The code blocking this came in the original OpenOffice flowfrm.
Either IsInSct() or FindFooterOrHeader() works to resolve
this bug.  I chose FindFooterOrHeader because it seemed
to match the existing targets (docbody, flyframe) better.

Change-Id: I51fc3bdc51c76e290b47ec7b9044780e5b67136c
Reviewed-on: https://gerrit.libreoffice.org/26208
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 121109610f9af0b294cf042c6ae5abc6fcc4f326)

diff --git a/sw/qa/extras/odfimport/data/tdf76322_columnBreakInHeader.docx 
b/sw/qa/extras/odfimport/data/tdf76322_columnBreakInHeader.docx
new file mode 100755
index 000..6c050ae
Binary files /dev/null and 
b/sw/qa/extras/odfimport/data/tdf76322_columnBreakInHeader.docx differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index c944d44..79dae52 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -631,6 +631,12 @@ DECLARE_ODFIMPORT_TEST(testBnc800714, "bnc800714.fodt")
 CPPUNIT_ASSERT(getProperty(getParagraph(2), "ParaKeepTogether"));
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf76322_columnBreakInHeader, 
"tdf76322_columnBreakInHeader.docx")
+{
+// column breaks were ignored. First line should start in column 2
+CPPUNIT_ASSERT_EQUAL( OUString("Test1"), 
parseDump("/root/page[1]/header/section/column[2]/body/txt/text()") );
+}
+
 DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt")
 {
 // Background of the formula frame was white (0xff), not green.
diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 0dba6fd..e148afe 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1164,7 +1164,7 @@ bool SwFlowFrame::IsColBreak( bool bAct ) const
 {
 // Determine predecessor
 const SwFrame *pPrev = m_rThis.FindPrev();
-while( pPrev && ( ( !pPrev->IsInDocBody() && !m_rThis.IsInFly() ) 
||
+while( pPrev && ( ( !pPrev->IsInDocBody() && !m_rThis.IsInFly() && 
!m_rThis.FindFooterOrHeader() ) ||
( pPrev->IsTextFrame() && static_cast(pPrev)->IsHiddenNow() ) ) )
 pPrev = pPrev->FindPrev();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

2016-06-22 Thread Mike Kaganski
 sw/qa/extras/ooxmlimport/data/tdf92157.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|5 +
 sw/source/core/layout/atrfrm.cxx|5 +
 3 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 979ac216d62ac4ba2c2b65eb48456ec63ef35c5e
Author: Mike Kaganski 
Date:   Sat Jan 9 18:39:26 2016 +1000

tdf#92157: allow both dimensions of a graphic to be 0

Commit ca80f73 made it possible for one of dimensions to be zero.
This commit goes further, allowing opening real-life documents
with graphics having both width and height equal to 0.
Thanks to libreoff...@arbruijn.dds.nl for debugging and initial
patch!

Change-Id: I96a13b776adfd9fe46fc2c7691eb7904400c20a1
Reviewed-on: https://gerrit.libreoffice.org/21287
Tested-by: Jenkins 
Reviewed-by: Chris Sherlock 
(cherry picked from commit 654f6ff28d7a148950b48ed8905d8f13a015a5b5)

diff --git a/sw/qa/extras/ooxmlimport/data/tdf92157.docx 
b/sw/qa/extras/ooxmlimport/data/tdf92157.docx
new file mode 100644
index 000..ba5bc2a
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf92157.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 1bd5a87..b59caa0 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2971,6 +2971,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf95775, "tdf95775.docx")
 // This must not fail in layout
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf92157, "tdf92157.docx")
+{
+// A graphic with dimensions 0,0 should not fail on load
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf60351, "tdf60351.docx")
 {
 // Get the first image in the document and check its contour polygon.
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 9e0b50c..e0f9418 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -282,10 +282,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 aTmp.Height() = convertMm100ToTwip(aTmp.Height());
 aTmp.Width() = convertMm100ToTwip(aTmp.Width());
 }
-if(aTmp.Height() || aTmp.Width())
-m_aSize = aTmp;
-else
-bRet = false;
+m_aSize = aTmp;
 }
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits