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

2019-08-02 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/tiledrendering/data/image-comment.odt |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   47 +
 sw/source/uibase/docvw/PostItMgr.cxx   |   22 -
 3 files changed, 67 insertions(+), 2 deletions(-)

New commits:
commit d2f4a7518946ac195505308e74f411c25a459fcc
Author: Miklos Vajna 
AuthorDate: Fri Aug 2 12:31:00 2019 +0200
Commit: Miklos Vajna 
CommitDate: Fri Aug 2 19:04:40 2019 +0200

sw comments on frames: no overlay in the LOK API, either: insert case

This is similar to commit 28fcb7d86765194b4015e7023449333f43aba0c5 (sw
comments on frames: no overlay in the LOK API, either, 2019-07-16), but
that one handled the initial fetch of comment states, while this one
does the incremental updates.

With this, there is no overlay on commented images right after inserting
them.

(cherry picked from commit 225930119543975697d3f5f042e271f0ec6c6b15)

[ cp-6.2 backport note: added explicit IsEmpty() check, otherwise we
would expose negative width/height for empty rectangles via LOK, which
doesn't happen on master. ]

[ cp-6.2 backport note: use the comphelper::dispatchCommand() variant
that takes no explicit frames, the default frame seems to working here
and we can't be explicit on this branch. ]

Change-Id: I060303806a6611b113b4813300ed1cafd0b654fa
Reviewed-on: https://gerrit.libreoffice.org/76880
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/tiledrendering/data/image-comment.odt 
b/sw/qa/extras/tiledrendering/data/image-comment.odt
new file mode 100644
index ..0852bedabf7f
Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/image-comment.odt 
differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 9b2984b7af9f..701c135a579e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -98,6 +98,7 @@ public:
 void testCreateViewTextSelection();
 void testRedlineColors();
 void testCommentEndTextEdit();
+void testCommentInsert();
 void testCursorPosition();
 void testPaintCallbacks();
 void testUndoRepairResult();
@@ -156,6 +157,7 @@ public:
 CPPUNIT_TEST(testCreateViewTextSelection);
 CPPUNIT_TEST(testRedlineColors);
 CPPUNIT_TEST(testCommentEndTextEdit);
+CPPUNIT_TEST(testCommentInsert);
 CPPUNIT_TEST(testCursorPosition);
 CPPUNIT_TEST(testPaintCallbacks);
 CPPUNIT_TEST(testUndoRepairResult);
@@ -727,6 +729,8 @@ public:
 boost::property_tree::ptree m_aRedlineTableChanged;
 /// Redline table modified payload
 boost::property_tree::ptree m_aRedlineTableModified;
+/// Post-it / annotation payload.
+boost::property_tree::ptree m_aComment;
 
 ViewCallback()
 : m_bOwnCursorInvalidated(false),
@@ -861,6 +865,14 @@ public:
 m_aRedlineTableModified = 
m_aRedlineTableModified.get_child("redline");
 }
 break;
+case LOK_CALLBACK_COMMENT:
+{
+m_aComment.clear();
+std::stringstream aStream(pPayload);
+boost::property_tree::read_json(aStream, m_aComment);
+m_aComment = m_aComment.get_child("comment");
+}
+break;
 }
 }
 };
@@ -1721,6 +1733,41 @@ void SwTiledRenderingTest::testCommentEndTextEdit()
 CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
 }
 
+void SwTiledRenderingTest::testCommentInsert()
+{
+// Load a document with an as-char image in it.
+comphelper::LibreOfficeKit::setActive();
+comphelper::LibreOfficeKit::setTiledAnnotations(false);
+SwXTextDocument* pXTextDocument = createDoc("image-comment.odt");
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+
+// Select the image.
+pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, 
SfxCallMode::SYNCHRON);
+// Make sure SwTextShell is replaced with SwDrawShell right now, not after 
120 ms, as set in the
+// SwView ctor.
+pView->StopShellTimer();
+
+// Add a comment.
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{"Text", uno::makeAny(OUString("some text"))},
+{"Author", uno::makeAny(OUString("me"))},
+});
+ViewCallback aView;
+
SfxViewShell::Current()->registerLibreOfficeKitViewCallback(::callback,
 );
+comphelper::dispatchCommand(".uno:InsertAnnotation", aPropertyValues);
+Scheduler::ProcessEventsToIdle();
+OString 
aAnchorPos(aView.m_aComment.get_child("anchorPos").get_value().c_str());
+// Without the accompanying fix in place, this test would have failed with
+// - Expected: 1418, 1418, 0, 0
+// - Actual  : 1418, 1418, 1024, 1024
+// i.e. the anchor position was a non-empty rectangle.
+

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

2019-07-17 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx|   19 +++
 sw/source/core/fields/postithelper.cxx |   17 -
 2 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 555bf69bbe4688db160c8d409153ff85bb6e2434
Author: Miklos Vajna 
AuthorDate: Tue Jul 16 12:17:01 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 17 13:06:30 2019 +0200

sw comments on frames: avoid overlay that covers only an as-char image

As-char images had their comment arrow on the bottom left corner,
as-char ones had it at the bottom right one.

Standardize on bottom left and avoid the content overlay in case only
the frame itself is selected.

See commit cf5a3cb687a502e7f71cefb5f7001a73925bee56 (Adapt new test to
actual values observed on macOS, 2019-06-24) on why the test is not for
macOS, till somebody can check if this is working there properly.

(cherry picked from commit 3fb7ffeb85d87551ffcddd63b7c90c6b0e573e5f)

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

Change-Id: I83516ea558182ecc7362f8383894ed07a16d3ad2
Reviewed-on: https://gerrit.libreoffice.org/75765
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 7bff975e94c2..1365b752e8a4 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -32,6 +32,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 namespace
 {
@@ -537,6 +540,22 @@ void SwUiWriterTest2::testImageComment()
 pView->GetViewFrame()->GetDispatcher()->ExecuteList(FN_INSERT_STRING, 
SfxCallMode::SYNCHRON,
 {  });
 pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, 
SfxCallMode::SYNCHRON);
+
+#if !defined(MACOSX)
+// Make sure that the anchor points to the bottom left corner of the image.
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected less or equal than: 1418
+// - Actual: 2442
+// The anchor pointed to the bottom right corner, so as-char and at-char 
was inconsistent.
+Scheduler::ProcessEventsToIdle();
+SwPostItMgr* pPostItMgr = pView->GetPostItMgr();
+for (const auto& pItem : *pPostItMgr)
+{
+const SwRect& rAnchor = pItem->pPostIt->GetAnchorRect();
+CPPUNIT_ASSERT_LESSEQUAL(static_cast(1418), rAnchor.Left());
+}
+#endif
+
 // Now delete the image.
 pView->GetViewFrame()->GetDispatcher()->Execute(SID_DELETE, 
SfxCallMode::SYNCHRON);
 // Without the accompanying fix in place, this test would have failed with 
'Expected: 0; Actual:
diff --git a/sw/source/core/fields/postithelper.cxx 
b/sw/source/core/fields/postithelper.cxx
index 82e8531d4ad7..21041a6de01e 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -58,7 +58,22 @@ bool AnnotationMarkCoversCommentAnchor(const 
sw::mark::IMark* pAnnotationMark,
 
 if (rMarkStart != rAnchorPos)
 {
-return false;
+// This can be the as-char case: the comment placeholder character is 
exactly between the
+// annotation mark start and end.
+SwPosition aPosition(rMarkStart);
+++aPosition.nContent;
+if (aPosition != rAnchorPos)
+{
+return false;
+}
+
+++aPosition.nContent;
+if (aPosition != rMarkEnd)
+{
+return false;
+}
+
+return true;
 }
 
 if (rMarkStart.nNode != rMarkEnd.nNode)
___
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-6.0' - sw/qa sw/source

2019-07-17 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   25 +
 sw/source/uibase/uno/unotxdoc.cxx   |   22 --
 2 files changed, 45 insertions(+), 2 deletions(-)

New commits:
commit f5221894d961cbec0076bf1aac8c0602d3bedf87
Author: Miklos Vajna 
AuthorDate: Tue Jul 16 16:22:29 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 17 13:06:41 2019 +0200

sw comments on frames: no overlay in the LOK API, either

So that the Online and the desktop rendering result match.

(cherry picked from commit 28fcb7d86765194b4015e7023449333f43aba0c5)

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

[ cp-6.0 backport note: added explicit IsEmpty() check, otherwise we
would expose negative width/height for empty rectangles via LOK, which
doesn't happen on master. ]

Change-Id: Iabc62e74f5ce5880b663b4d7217c81729592a356
Reviewed-on: https://gerrit.libreoffice.org/75766
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 1365b752e8a4..07f0214c4b40 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -9,6 +9,11 @@
 
 #include 
 #include 
+
+#include 
+
+#include 
+
 #include 
 #include 
 #include 
@@ -554,6 +559,26 @@ void SwUiWriterTest2::testImageComment()
 const SwRect& rAnchor = pItem->pPostIt->GetAnchorRect();
 CPPUNIT_ASSERT_LESSEQUAL(static_cast(1418), rAnchor.Left());
 }
+
+// Test the comment anchor we expose via the LOK API.
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1418, 1418, 0, 0
+// - Actual  : 1418, 1418, 1024, 1024
+// I.e. the anchor position had a non-empty size, which meant different 
rendering via tiled
+// rendering and on the desktop.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+OUString aPostits = pTextDoc->getPostIts();
+std::stringstream aStream(aPostits.toUtf8().getStr());
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+for (boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("comments"))
+{
+const boost::property_tree::ptree& rComment = rValue.second;
+OString aAnchorPos(rComment.get("anchorPos").c_str());
+CPPUNIT_ASSERT_EQUAL(OString("1418, 1418, 0, 0"), aAnchorPos);
+}
+
 #endif
 
 // Now delete the image.
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 9411a6834971..cd396bcccb81 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3364,10 +3364,17 @@ OUString SwXTextDocument::getPostIts()
 
 const SwPostItField* pField = pWin->GetPostItField();
 const SwRect& aRect = pWin->GetAnchorRect();
-const tools::Rectangle aSVRect(aRect.Pos().getX(),
+tools::Rectangle aSVRect(aRect.Pos().getX(),
 aRect.Pos().getY(),
 aRect.Pos().getX() + aRect.SSize().Width(),
 aRect.Pos().getY() + aRect.SSize().Height());
+
+if (!(*i)->maLayoutInfo.mPositionFromCommentAnchor)
+{
+// Comments on frames: anchor position is the corner position, not 
the whole frame.
+aSVRect.SetSize(Size(0, 0));
+}
+
 std::vector aRects;
 for (const basegfx::B2DRange& aRange : pWin->GetAnnotationTextRanges())
 {
@@ -3382,7 +3389,18 @@ OUString SwXTextDocument::getPostIts()
 aAnnotation.put("author", pField->GetPar1().toUtf8().getStr());
 aAnnotation.put("text", pField->GetPar2().toUtf8().getStr());
 aAnnotation.put("dateTime", 
utl::toISO8601(pField->GetDateTime().GetUNODateTime()));
-aAnnotation.put("anchorPos", aSVRect.toString());
+{
+std::stringstream ss;
+if (aSVRect.IsEmpty())
+{
+ss << aSVRect.getX() << ", " << aSVRect.getY() << ", 0, 0";
+}
+else
+{
+ss << aSVRect.getX() << ", " << aSVRect.getY() << ", " << 
aSVRect.getWidth() << ", " << aSVRect.getHeight();
+}
+aAnnotation.put("anchorPos", ss.str());
+}
 aAnnotation.put("textRange", sRects.getStr());
 
 aAnnotations.push_back(std::make_pair("", aAnnotation));
___
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-6.0' - sw/qa sw/source

2019-07-15 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/uiwriter/data2/shape-page-move.odt |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx |   59 ++--
 sw/source/uibase/shells/drwbassh.cxx|   15 ++
 3 files changed, 71 insertions(+), 3 deletions(-)

New commits:
commit 50ed2c28aeb5598d51b61278cc38b05d13b83a43
Author: Miklos Vajna 
AuthorDate: Wed Jul 10 16:04:05 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jul 15 15:32:18 2019 +0200

sw: fix TransformDialog with args when the shape moves to a different page

When a macro or Online invokes .uno:TransformDialog with arguments, then
instead of showing the dialog, we apply the position/size/etc settings
to the currently selected shape.

This was not working correctly when setting an absolute twips position
where the old and the new containing page frame was different.

The desktop case drag invokes SwFEShell::EndDrag(), which uses
SwFEShell::ChgAnchor() to maintain the invariant that a draw shape
position and its anchor is contained within the same page frame.

The same was not true when SwDrawBaseShell::Execute() calls
SdrEditView::SetGeoAttrToMarked(), so extend that a bit to also update
the anchor position.

With this, moving down a shape from the 1st page to the 2nd one via the
API works and updates the anchor correctly, while in the past the move
was only possible within the bounds of the current page frame. (See the
"determine and set position" code in SwAnchoredDrawObject that enforces
this invariant when the anchor is not updated.)

(cherry picked from commit c54597a8905b07807952aebc24237549302fb941)

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

Change-Id: Ia54470f6f3679ddc78a2f0a842f2fca10d20084d
Reviewed-on: https://gerrit.libreoffice.org/75365
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/uiwriter/data2/shape-page-move.odt 
b/sw/qa/extras/uiwriter/data2/shape-page-move.odt
new file mode 100644
index ..80672b2448a2
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/shape-page-move.odt 
differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index d19db15bae8f..7bff975e94c2 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -27,9 +27,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -57,6 +59,7 @@ public:
 void testDateFormFieldContentOperations();
 void testDateFormFieldCurrentDateHandling();
 void testDateFormFieldCurrentDateInvalidation();
+void testShapePageMove();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest2);
 CPPUNIT_TEST(testTdf101534);
@@ -75,6 +78,7 @@ public:
 CPPUNIT_TEST(testDateFormFieldContentOperations);
 CPPUNIT_TEST(testDateFormFieldCurrentDateHandling);
 CPPUNIT_TEST(testDateFormFieldCurrentDateInvalidation);
+CPPUNIT_TEST(testShapePageMove);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -662,7 +666,8 @@ void SwUiWriterTest2::testDateFormFieldContentOperations()
 // Check whether the fieldmark is created
 auto aIter = pMarkAccess->getAllMarksBegin();
 CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
-::sw::mark::IDateFieldmark* pFieldmark = 
dynamic_cast<::sw::mark::IDateFieldmark*>(aIter->get());
+::sw::mark::IDateFieldmark* pFieldmark
+= dynamic_cast<::sw::mark::IDateFieldmark*>(aIter->get());
 CPPUNIT_ASSERT(pFieldmark);
 CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE), pFieldmark->GetFieldname());
 
@@ -695,7 +700,8 @@ void SwUiWriterTest2::testDateFormFieldCurrentDateHandling()
 // Check whether the fieldmark is created
 auto aIter = pMarkAccess->getAllMarksBegin();
 CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
-::sw::mark::IDateFieldmark* pFieldmark = 
dynamic_cast<::sw::mark::IDateFieldmark*>(aIter->get());
+::sw::mark::IDateFieldmark* pFieldmark
+= dynamic_cast<::sw::mark::IDateFieldmark*>(aIter->get());
 CPPUNIT_ASSERT(pFieldmark);
 CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE), pFieldmark->GetFieldname());
 
@@ -748,7 +754,8 @@ void 
SwUiWriterTest2::testDateFormFieldCurrentDateInvalidation()
 // Check whether the fieldmark is created
 auto aIter = pMarkAccess->getAllMarksBegin();
 CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
-::sw::mark::IDateFieldmark* pFieldmark = 
dynamic_cast<::sw::mark::IDateFieldmark*>(aIter->get());
+::sw::mark::IDateFieldmark* pFieldmark
+= dynamic_cast<::sw::mark::IDateFieldmark*>(aIter->get());
 CPPUNIT_ASSERT(pFieldmark);
 CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE), pFieldmark->GetFieldname());
 
@@ -790,6 +797,52 @@ void 
SwUiWriterTest2::testDateFormFieldCurrentDateInvalidation()
 CPPUNIT_ASSERT_EQUAL(OUString(""), sCurrentDate);
 }
 
+void 

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

2019-07-08 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   20 
 sw/source/ui/frmdlg/frmpage.cxx|8 
 sw/source/uibase/inc/basesh.hxx|2 +-
 sw/source/uibase/shells/basesh.cxx |   10 ++
 4 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit d309bb98618391c78a73177c5af16e23a2631cb4
Author: Miklos Vajna 
AuthorDate: Fri Jul 5 12:48:07 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jul 8 13:46:04 2019 +0200

sw lok: hide UI to set Word-incompatible anchor types

Let's make it a bit harder for users to hurt themselves, at least in
Online. Affects the context/popup menu and the dialog of frames.

This is similar to how certain border types are hidden on the UI,
depending on if MSO supports them. Though that goes a bit further and
disables those types even on the desktop.

(cherry picked from commit 4154d281fbecaadf6cd118c00cc6cff929e339a4)

Conflicts:
sw/source/ui/frmdlg/frmpage.cxx

Change-Id: I6b9205ef3df8a7bc15fbcf787d134743c09e98da
Reviewed-on: https://gerrit.libreoffice.org/75196
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 93ff00e5eb84..9b2984b7af9f 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static char const DATA_DIRECTORY[] = "/sw/qa/extras/tiledrendering/data/";
 
@@ -113,6 +114,7 @@ public:
 void testVisCursorInvalidation();
 void testDeselectCustomShape();
 void testSemiTransparent();
+void testAnchorTypes();
 
 CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
 CPPUNIT_TEST(testRegisterCallback);
@@ -170,6 +172,7 @@ public:
 CPPUNIT_TEST(testVisCursorInvalidation);
 CPPUNIT_TEST(testDeselectCustomShape);
 CPPUNIT_TEST(testSemiTransparent);
+CPPUNIT_TEST(testAnchorTypes);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2438,6 +2441,23 @@ void SwTiledRenderingTest::testSemiTransparent()
 CPPUNIT_ASSERT_GREATEREQUAL(190, static_cast(aColor.GetBlue()));
 }
 
+void SwTiledRenderingTest::testAnchorTypes()
+{
+comphelper::LibreOfficeKit::setActive();
+SwXTextDocument* pXTextDocument = createDoc("shape.fodt");
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pXTextDocument->GetDocShell()->GetView();
+pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, 
SfxCallMode::SYNCHRON);
+SfxItemSet aSet(pDoc->GetAttrPool(), svl::Items{});
+SfxBoolItem aItem(FN_TOOL_ANCHOR_PAGE);
+aSet.Put(aItem);
+auto pShell = dynamic_cast(pView->GetCurShell());
+pShell->GetState(aSet);
+// Without the accompanying fix in place, this test would have failed, 
setting the anchor type
+// to other than as/at-char was possible.
+CPPUNIT_ASSERT(!aSet.HasItem(FN_TOOL_ANCHOR_PAGE));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index a69f8c59d6d8..815bf8b21d59 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -69,6 +69,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -718,6 +719,13 @@ SwFramePage::SwFramePage(vcl::Window *pParent, const 
SfxItemSet )
 
 m_pAutoWidthCB->SetClickHdl( LINK( this, SwFramePage, AutoWidthClickHdl ) 
);
 m_pAutoHeightCB->SetClickHdl( LINK( this, SwFramePage, AutoHeightClickHdl 
) );
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+m_pAnchorAtPageRB->Hide();
+m_pAnchorAtParaRB->Hide();
+m_pAnchorAtFrameRB->Hide();
+}
 }
 
 SwFramePage::~SwFramePage()
diff --git a/sw/source/uibase/inc/basesh.hxx b/sw/source/uibase/inc/basesh.hxx
index 17d0a8336601..41efce245c32 100644
--- a/sw/source/uibase/inc/basesh.hxx
+++ b/sw/source/uibase/inc/basesh.hxx
@@ -36,7 +36,7 @@ class SfxItemSet;
 class SwCursorShell;
 
 struct DBTextStruct_Impl;
-class SAL_DLLPUBLIC_RTTI SwBaseShell: public SfxShell
+class SW_DLLPUBLIC SwBaseShell: public SfxShell
 {
 SwView  
 
diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 3d418e58070b..f3820f141fa9 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -108,6 +108,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1656,6 +1657,15 @@ void SwBaseShell::GetState( SfxItemSet  )
 rSet.DisableItem(nWhich);
 else if(nWhich != FN_TOOL_ANCHOR)
 rSet.Put(SfxBoolItem(nWhich, bSet));
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+if (nWhich 

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

2019-07-08 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   18 --
 sw/source/uibase/wrtsh/wrtsh1.cxx   |   33 ++---
 2 files changed, 30 insertions(+), 21 deletions(-)

New commits:
commit a1545a9f642aa4b3d4c4baafc1951e851b6a6ab5
Author: Miklos Vajna 
AuthorDate: Thu Jul 4 17:40:09 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jul 8 10:32:52 2019 +0200

sw comments on frames: fix comment insert for as-char frame at para start

This adapts SwWrtShell::InsertPostIt() to behave similar to commit
86fd893e32ef7a737b2c4b60e0938146b102fc07 (sw comments on frames: delete
comment of frame when deleting frame, 2019-07-03), i.e. instead of
hoping that the cursor will be at the end of paragraph and traveling
back, just set the cursor to the remembered anchor position.

This is cleaner, and as a side-effect also fixes the scenario when
creating a comment on an as-char image, which happens to be at the start
of the paragraph.

Change-Id: Iedca0feb62242677b6e8b69ef7b813d6da72c8eb
Reviewed-on: https://gerrit.libreoffice.org/75093
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit b382025abcd05ff75dd2cbe46df76213d4913f00)
Reviewed-on: https://gerrit.libreoffice.org/75123
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index bc1fe510dc03..7f161e0d9369 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -492,6 +492,12 @@ void SwUiWriterTest2::testImageComment()
 SwDoc* pDoc = createDoc("image-comment.odt");
 SwView* pView = pDoc->GetDocShell()->GetView();
 
+// Test document has "beforeafter", remove the content before the 
image.
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->SttEndDoc(/*bStart=*/true);
+pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 6, 
/*bBasicCall=*/false);
+pWrtShell->Delete();
+
 // Select the image.
 pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, 
SfxCallMode::SYNCHRON);
 
@@ -501,17 +507,17 @@ void SwUiWriterTest2::testImageComment()
 // Verify that the comment is around the image.
 // Without the accompanying fix in place, this test would have failed, as 
FN_POSTIT was disabled
 // in the frame shell.
+// Then this test would have failed, as in case the as-char anchored image 
was at the start of
+// the paragraph, the comment of the image covered the character after the 
image, not the image.
 uno::Reference xPara = getParagraph(1);
-CPPUNIT_ASSERT_EQUAL(OUString("Text"),
- getProperty(getRun(xPara, 1), 
"TextPortionType"));
 CPPUNIT_ASSERT_EQUAL(OUString("Annotation"),
- getProperty(getRun(xPara, 2), 
"TextPortionType"));
+ getProperty(getRun(xPara, 1), 
"TextPortionType"));
 CPPUNIT_ASSERT_EQUAL(OUString("Frame"),
- getProperty(getRun(xPara, 3), 
"TextPortionType"));
+ getProperty(getRun(xPara, 2), 
"TextPortionType"));
 CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"),
- getProperty(getRun(xPara, 4), 
"TextPortionType"));
+ getProperty(getRun(xPara, 3), 
"TextPortionType"));
 CPPUNIT_ASSERT_EQUAL(OUString("Text"),
- getProperty(getRun(xPara, 5), 
"TextPortionType"));
+ getProperty(getRun(xPara, 4), 
"TextPortionType"));
 
 // Insert content to the comment, and select the image again.
 SfxStringItem aItem(FN_INSERT_STRING, "x");
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 88fcc174dab8..183f964c9d25 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1885,6 +1885,21 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, 
SfxRequest& rReq)
 {
 SwFlyFrame* pFly = GetSelectedFlyFrame();
 
+// Remember the anchor of the selected object before deletion.
+std::unique_ptr pAnchor;
+if (pFly)
+{
+SwFrameFormat* pFormat = pFly->GetFormat();
+if (pFormat)
+{
+RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId();
+if ((eAnchorId == RndStdIds::FLY_AS_CHAR || eAnchorId == 
RndStdIds::FLY_AT_CHAR) && pFormat->GetAnchor().GetContentAnchor())
+{
+pAnchor.reset(new 
SwPosition(*pFormat->GetAnchor().GetContentAnchor()));
+}
+}
+}
+
 // A frame is selected, end frame selection.
 EnterStdMode();
 GetView().AttrChangedNotify(this);
@@ -1893,6 +1908,7 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, 
SfxRequest& 

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

2019-07-04 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/data/image-comment-at-char.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   18 ++
 sw/source/filter/ww8/docxexport.cxx  |4 -
 sw/source/filter/ww8/docxexport.hxx  |2 
 sw/source/filter/ww8/rtfexport.cxx   |5 +
 sw/source/filter/ww8/rtfexport.hxx   |3 -
 sw/source/filter/ww8/wrtw8nds.cxx|   42 ---
 sw/source/filter/ww8/wrtww8.cxx  |4 -
 sw/source/filter/ww8/wrtww8.hxx  |   11 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   19 ++
 10 files changed, 88 insertions(+), 20 deletions(-)

New commits:
commit 9ffd2d9ade3e9c4ecf50a1948637c902486f88bf
Author: Miklos Vajna 
AuthorDate: Tue Jul 2 16:26:03 2019 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jul 4 09:02:48 2019 +0200

sw comments on frames: fix DOCX handling

We used to ignore annotation marks which just cover the comment anchor
since commit fff019debf14a0bf8cd358591a686191347f1542 (MSWordExportBase:
ignore empty annotation marks, 2014-09-17), but this means comments on
images are lost.

Pass around SwWW8AttrIter, so we can decide if we have a relevant
at-char anchored frame in MSWordExportBase::GetAnnotationMarks(),
without iterating over all frames in the document, which would be slow
for large documents.

Regarding the import side, the only problem was that the empty comment
range resulted in a loss of annotation marks; fix that by using a marker
while inserting.

(cherry picked from commit 7fa96a3e4bdd384ad411e0bdc4e7c3f2ab920279)

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
sw/source/filter/ww8/docxexport.cxx
sw/source/filter/ww8/docxexport.hxx
sw/source/filter/ww8/rtfexport.cxx
sw/source/filter/ww8/rtfexport.hxx
sw/source/filter/ww8/wrtw8nds.cxx
sw/source/filter/ww8/wrtww8.cxx
sw/source/filter/ww8/wrtww8.hxx
writerfilter/source/dmapper/DomainMapper_Impl.cxx

Change-Id: I385677d74423bc05824dac4a12d1a991bb3983c4
Reviewed-on: https://gerrit.libreoffice.org/75039
Reviewed-by: Mike Kaganski 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/image-comment-at-char.docx 
b/sw/qa/extras/ooxmlexport/data/image-comment-at-char.docx
new file mode 100644
index ..677464de49f7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/image-comment-at-char.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index b8214f664e42..f77320436ea3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -450,6 +450,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak4, 
"tdf123636_newlinePage
 assertXPath(pDump, "/root/page[2]/body/txt[1]/Text", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testImageCommentAtChar, "image-comment-at-char.docx")
+{
+uno::Reference xPara = getParagraph(1);
+CPPUNIT_ASSERT_EQUAL(OUString("Text"),
+ getProperty(getRun(xPara, 1), 
"TextPortionType"));
+// Without the accompanying fix in place, this test would have failed with 
'Expected:
+// Annotation; Actual: Frame', i.e. the comment start before the image was 
lost.
+CPPUNIT_ASSERT_EQUAL(OUString("Annotation"),
+ getProperty(getRun(xPara, 2), 
"TextPortionType"));
+CPPUNIT_ASSERT_EQUAL(OUString("Frame"),
+ getProperty(getRun(xPara, 3), 
"TextPortionType"));
+CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"),
+ getProperty(getRun(xPara, 4), 
"TextPortionType"));
+CPPUNIT_ASSERT_EQUAL(OUString("Text"),
+ getProperty(getRun(xPara, 5), 
"TextPortionType"));
+}
+
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index becf669cf2fc..ccfce360f49c 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -187,13 +187,13 @@ void DocxExport::AppendBookmark( const OUString& rName )
 m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds );
 }
 
-void DocxExport::AppendAnnotationMarks( const SwTextNode& rNode, sal_Int32 
nAktPos, sal_Int32 nLen )
+void DocxExport::AppendAnnotationMarks( const SwWW8AttrIter& rAttrs, sal_Int32 
nAktPos, sal_Int32 nLen )
 {
 std::vector< OUString > aStarts;
 std::vector< OUString > aEnds;
 
 IMarkVector aMarks;
-if ( GetAnnotationMarks( rNode, nAktPos, nAktPos + nLen, aMarks ) )
+if ( GetAnnotationMarks( rAttrs, nAktPos, nAktPos + nLen, aMarks ) )
 {
 for ( IMarkVector::const_iterator it = aMarks.begin(), end = 

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

2019-06-04 Thread Regina Henschel (via logerrit)
 sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx |   23 ++
 sw/source/filter/ww8/wrtw8esh.cxx |   30 ++
 sw/source/filter/ww8/ww8graf.cxx  |   11 +
 4 files changed, 64 insertions(+)

New commits:
commit 4977bf684097247d7121a43d6d3e9374684b0d07
Author: Regina Henschel 
AuthorDate: Tue Apr 2 21:36:57 2019 +0200
Commit: Aron Budea 
CommitDate: Tue Jun 4 22:55:20 2019 +0200

tdf#118375, tdf#70838 correct position of rotated shape in doc

Word relates the position to the unrotated shape in legacy doc
format. Writer uses the rotated shape. The patch corrects the
difference on import and export.

Reviewed-on: https://gerrit.libreoffice.org/70152
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
(cherry picked from commit 421e6fc3cd2e6fe37afbef341e2d0ad7b8edde37)

Change-Id: I25537123656e62d6ffae5118ee8d621a4b5c5be0

diff --git a/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc 
b/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc
new file mode 100644
index ..99d15e20cea5
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 84f9e2f2d6cf..32b4197452b1 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -106,6 +106,29 @@ DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, 
"tdf94009_zeroPgMargin.odt")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(defaultStyle, 
"TopMargin"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf118375export, "tdf118375_240degClockwise.doc")
+{
+// The input document has one custom shape, which is rotated 240deg. Check
+// that it has the same position as in Word.
+uno::Reference xDrawPagesSupplier(mxComponent,
+   
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", 
xDrawPagesSupplier.is());
+uno::Reference 
xDrawPages(xDrawPagesSupplier->getDrawPages());
+uno::Reference xDrawPage(xDrawPages->getByIndex(0), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is());
+uno::Reference xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is());
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", 
xShapeProps.is());
+sal_Int32 nPosX, nPosY;
+xShapeProps->getPropertyValue("HoriOrientPosition") >>= nPosX;
+xShapeProps->getPropertyValue("VertOrientPosition") >>= nPosY;
+// Allow some tolerance because rounding errors through integer arithmethic
+// in rotation.
+CPPUNIT_ASSERT_DOUBLES_EQUAL(5200.0, static_cast(nPosX), 1.0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1152.0, static_cast(nPosY), 1.0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 0ae92a2aec2d..e1655946c80c 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -663,6 +663,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
 WinwordAnchoring::ConvertPosition( rHOr, rVOr, rFormat );
 
 Point aObjPos;
+bool bHasHeightWidthSwapped(false);
 if (RES_FLYFRMFMT == rFormat.Which())
 {
 SwRect aLayRect(rFormat.FindLayoutRect(false, ));
@@ -698,6 +699,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
 const long nHeight = aRect.getHeight();
 aRect.setWidth( nHeight );
 aRect.setHeight( nWidth );
+bHasHeightWidthSwapped = true;
 }
 }
 }
@@ -759,6 +761,34 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
 //Nasty swap for bidi if necessary
 rWrt.MiserableRTLFrameFormatHack(nLeft, nRight, rFrameFormat);
 
+// tdf#70838. Word relates the position to the unrotated rectangle,
+// Writer to the rotated one. Because the rotation is around 
center,
+// the difference counts half.
+if(pObj && pObj->GetRotateAngle())
+{
+SwTwips nXOff;
+SwTwips nYOff;
+SwTwips nSnapWidth = pObj->GetSnapRect().getWidth();
+SwTwips nSnapHeight = pObj->GetSnapRect().getHeight();
+SwTwips nLogicWidth = pObj->GetLogicRect().getWidth();
+SwTwips nLogicHeight = pObj->GetLogicRect().getHeight();
+// +1 for to compensate integer arithmetic rounding errors
+

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

2019-06-04 Thread Justin Luth (via logerrit)
 sw/qa/extras/ww8import/ww8import.cxx |   16 ++--
 sw/source/filter/ww8/ww8par.cxx  |2 +-
 2 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 676ce0ce2a278a75c92fb5916f4add373f46f88d
Author: Justin Luth 
AuthorDate: Fri Jan 11 13:01:26 2019 +0300
Commit: Aron Budea 
CommitDate: Tue Jun 4 14:46:40 2019 +0200

tdf#120145 ww8import: ignoreCols if section is inserted

Otherwise, the column setting is duplicated both in the section
and in the page style.

Change-Id: I14383c646e709a3653f1054f0d4170a2963529c1
Reviewed-on: https://gerrit.libreoffice.org/66151
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 84fefd7c295fc05499ca222dff50c2fe4e0fb27e)
Reviewed-on: https://gerrit.libreoffice.org/66217
Reviewed-by: Miklos Vajna 
(cherry picked from commit 0e863f5529318e07f46568150e489cb0bef9b616)

diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index 31cfce841d3c..abbdedbea194 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -9,6 +9,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -33,12 +34,23 @@ DECLARE_WW8IMPORT_TEST(testFloatingTableSectionMargins, 
"floating-table-section-
 {
 sal_Int32 pageLeft = parseDump("/root/page[2]/infos/bounds", 
"left").toInt32();
 sal_Int32 pageWidth = parseDump("/root/page[2]/infos/bounds", 
"width").toInt32();
-sal_Int32 tableLeft = 
parseDump("/root/page[2]/body/column/body/section/column/body/txt[2]/anchored/fly/tab/infos/bounds",
 "left").toInt32();
-sal_Int32 tableWidth = 
parseDump("/root/page[2]/body/column/body/section/column/body/txt[2]/anchored/fly/tab/infos/bounds",
 "width").toInt32();
+sal_Int32 tableLeft = parseDump("//tab/infos/bounds", "left").toInt32();
+sal_Int32 tableWidth = parseDump("//tab/infos/bounds", "width").toInt32();
 CPPUNIT_ASSERT( pageWidth > 0 );
 CPPUNIT_ASSERT( tableWidth > 0 );
 // The table's resulting position should be roughly centered.
 CPPUNIT_ASSERT( abs(( pageLeft + pageWidth / 2 ) - ( tableLeft + 
tableWidth / 2 )) < 20 );
+
+uno::Reference xTextSection = getProperty< 
uno::Reference >(getParagraph(2), "TextSection");
+CPPUNIT_ASSERT(xTextSection.is());
+uno::Reference xTextColumns = getProperty< 
uno::Reference >(xTextSection, "TextColumns");
+OUString pageStyleName = getProperty(getParagraph(2), 
"PageStyleName");
+uno::Reference pageStyle( 
getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
+uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
+uno::Reference xPageColumns = getProperty< 
uno::Reference >(xPageStyle, "TextColumns");
+
+//either one or the other should get the column's, not both.
+CPPUNIT_ASSERT( xTextColumns->getColumnCount() != 
xPageColumns->getColumnCount());
 }
 
 DECLARE_WW8IMPORT_TEST(testN816593, "n816593.doc")
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b09cf7ded47f..ad340445d383 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4480,7 +4480,7 @@ void wwSectionManager::InsertSegments()
  descriptor.
 */
 
-bool bIgnoreCols = false;
+bool bIgnoreCols = bInsertSection;
 bool bThisAndNextAreCompatible = (aNext == aEnd) ||
 ((aIter->GetPageWidth() == aNext->GetPageWidth()) &&
  (aIter->GetPageHeight() == aNext->GetPageHeight()) &&
___
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-6.0' - sw/qa sw/source

2019-05-14 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/tiledrendering/data/semi-transparent.odt |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx|   33 ++
 sw/source/core/layout/paintfrm.cxx|7 +++
 3 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit b5de4785e0622b84820d1737b20f970b482bd799
Author: Miklos Vajna 
AuthorDate: Tue May 14 12:02:55 2019 +0200
Commit: Andras Timar 
CommitDate: Tue May 14 14:45:11 2019 +0200

sw lok: assume no windows in SwLayoutFrame::PaintSwFrame()

The high-level problem was that a watermark shape in the background was
rendered with lighter and darker gray as the user typed. The reason for
this was that depending on what larger combined tile was rendered we did
or did not repaint the layout frame.

Handle the situation similar to when we have no vcl::Window at all,
which ensures that we always paint only once. The rgb value matches the
desktop rendering result this way.

(Just assert that we render the gray light enough, the actual color
channel value may be 190 or 191.)

(cherry picked from commit 93abdf39b01bb7b404dc09ef37369a4350fb0d10)

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

diff --git a/sw/qa/extras/tiledrendering/data/semi-transparent.odt 
b/sw/qa/extras/tiledrendering/data/semi-transparent.odt
new file mode 100644
index ..eb76980e7406
Binary files /dev/null and 
b/sw/qa/extras/tiledrendering/data/semi-transparent.odt differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index e68ec068d3bc..56e947813d99 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static char const DATA_DIRECTORY[] = "/sw/qa/extras/tiledrendering/data/";
@@ -110,6 +111,7 @@ public:
 void testDeleteNodeRedlineCallback();
 void testVisCursorInvalidation();
 void testDeselectCustomShape();
+void testSemiTransparent();
 
 CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
 CPPUNIT_TEST(testRegisterCallback);
@@ -166,6 +168,7 @@ public:
 CPPUNIT_TEST(testDeleteNodeRedlineCallback);
 CPPUNIT_TEST(testVisCursorInvalidation);
 CPPUNIT_TEST(testDeselectCustomShape);
+CPPUNIT_TEST(testSemiTransparent);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2405,6 +2408,36 @@ void SwTiledRenderingTest::testDeselectCustomShape()
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
pWrtShell->GetDrawView()->GetMarkedObjectList().GetMarkCount());
 }
 
+void SwTiledRenderingTest::testSemiTransparent()
+{
+// Load a document where the top left tile contains a semi-transparent 
rectangle shape.
+comphelper::LibreOfficeKit::setActive();
+SwXTextDocument* pXTextDocument = createDoc("semi-transparent.odt");
+
+// Render a larger area, and then get the color of the bottom right corner 
of our tile.
+size_t nCanvasWidth = 1024;
+size_t nCanvasHeight = 512;
+size_t nTileSize = 256;
+std::vector aPixmap(nCanvasWidth * nCanvasHeight * 4, 0);
+ScopedVclPtrInstance pDevice(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT);
+pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nCanvasWidth, 
nCanvasHeight),
+Fraction(1.0), Point(), 
aPixmap.data());
+pXTextDocument->paintTile(*pDevice, nCanvasWidth, nCanvasHeight, 
/*nTilePosX=*/0,
+  /*nTilePosY=*/0, /*nTileWidth=*/15360, 
/*nTileHeight=*/7680);
+pDevice->EnableMapMode(false);
+Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, 
nTileSize));
+Bitmap::ScopedReadAccess pAccess(aBitmap);
+Color aColor(pAccess->GetPixel(255, 255));
+
+// Without the accompanying fix in place, this test would have failed with 
'Expected greater or
+// equal than: 190; Actual: 159'. This means the semi-transparent gray 
rectangle was darker than
+// expected, as it was painted twice.
+CPPUNIT_ASSERT_GREATEREQUAL(190, static_cast(aColor.GetRed()));
+CPPUNIT_ASSERT_GREATEREQUAL(190, static_cast(aColor.GetGreen()));
+CPPUNIT_ASSERT_GREATEREQUAL(190, static_cast(aColor.GetBlue()));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index b9a157d5b313..282256ef06e3 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -104,6 +104,7 @@
 #include 
 
 #include 
+#include 
 
 #define COL_NOTES_SIDEPANE  RGB_COLORDATA(230,230,230)
 #define COL_NOTES_SIDEPANE_BORDER   RGB_COLORDATA(200,200,200)
@@ -3415,7 +3416,11 @@ void 

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

2019-04-23 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx  |   16 
 sw/source/core/layout/anchoreddrawobject.cxx |   18 --
 2 files changed, 28 insertions(+), 6 deletions(-)

New commits:
commit da21956366a13b62b056d6074262f44c1559b29d
Author: Miklos Vajna 
AuthorDate: Thu Feb 7 11:06:24 2019 +0100
Commit: Aron Budea 
CommitDate: Tue Apr 23 16:33:12 2019 +0200

tdf#123032 sw, AddVerticalFrameOffsets: fix shape pos after mouse move

Regression from commit 50223ea6e212b60b7d33839c2753c5601fb50f95
(tdf#98987 sw: add AddVerticalFrameOffsets compat mode, 2016-03-31),
the problem was that vertical position of the shape was wrong after
mouse move, even if we attempted to take fly frames of the paragraph
into account. (Similar situation is when saving and loading the file;
which is much easier to test.)

Fly frames are created as the
text frames is formatted, and then SwTextFrame::CalcBaseOfstForFly() can
calculate the vertical offset correctly. But in the "move with mouse"
case SwToContentAnchoredObjectPosition::CalcPosition() was invoked by
the time the old flys of the text frame were already removed, but the
new ones were not yet added.

Solve the problem by formatting the text frame from
SwAnchoredDrawObject::MakeObjPosAnchoredAtPara() (if any of its validity
flags are set to false) -- this is expected to be safe, as the object
formatter is invoked by SwLayAction::FormatContent(), i.e. there is no
recursive SwFrame::Calc() call here.

(cherry picked from commit 961ba62df045473e5793d9e103be86eaad8d9575)

Change-Id: I95851874e3da3f50f304421537c6743e04bdfc7b
Reviewed-on: https://gerrit.libreoffice.org/71127
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index df4fef72e547..6d3355af30bb 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -460,6 +460,22 @@ void SwUiWriterTest2::testTdf122942()
 // paragraph mark, not above it.
 const SwFormatVertOrient& rVert = rFormats[1]->GetVertOrient();
 CPPUNIT_ASSERT_LESS(static_cast(0), rVert.GetPos());
+
+reload("writer8", "tdf122942.odt");
+pTextDoc = dynamic_cast(mxComponent.get());
+pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+pDoc = pWrtShell->GetDoc();
+const SwFrameFormats& rFormats2 = *pDoc->GetSpzFrameFormats();
+CPPUNIT_ASSERT_EQUAL(static_cast(2), rFormats2.size());
+
+SdrObject* pObject = rFormats2[1]->FindSdrObject();
+CPPUNIT_ASSERT(pObject);
+
+const tools::Rectangle& rOutRect = pObject->GetLastBoundRect();
+// Without the accompanying fix in place, this test would have failed with
+// 'Expected greater than: 5000; Actual  : 2817', i.e. the shape moved up
+// after a reload(), while it's expected to not change its position (5773).
+CPPUNIT_ASSERT_GREATER(static_cast(5000), rOutRect.Top());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx 
b/sw/source/core/layout/anchoreddrawobject.cxx
index ca5014f7e9b5..1706fafe4372 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -391,12 +391,18 @@ void SwAnchoredDrawObject::MakeObjPosAnchoredAtPara()
 // --> #i50356# - format anchor frame containing the anchor
 // position. E.g., for at-character anchored object this can be the follow
 // frame of the anchor frame, which contains the anchor character.
-const bool bFormatAnchor =
-!static_cast( 
GetAnchorFrameContainingAnchPos() )->IsAnyJoinLocked() &&
-!ConsiderObjWrapInfluenceOnObjPos() &&
-!ConsiderObjWrapInfluenceOfOtherObjs();
-
-if ( bFormatAnchor )
+bool bJoinLocked
+= static_cast(GetAnchorFrameContainingAnchPos())->IsAnyJoinLocked();
+const bool bFormatAnchor = !bJoinLocked && 
!ConsiderObjWrapInfluenceOnObjPos()
+   && !ConsiderObjWrapInfluenceOfOtherObjs();
+
+// Format of anchor is needed for (vertical) fly offsets, otherwise the
+// lack of fly portions will result in an incorrect 0 offset.
+bool bAddVerticalFlyOffsets = 
GetFrameFormat().getIDocumentSettingAccess().get(
+DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS);
+bool bFormatAnchorOnce = !bJoinLocked && bAddVerticalFlyOffsets;
+
+if (bFormatAnchor || bFormatAnchorOnce)
 {
 // --> #i50356#
 
GetAnchorFrameContainingAnchPos()->Calc(GetAnchorFrameContainingAnchPos()->getRootFrame()->GetCurrShell()->GetOut());
___
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-6.0' - sw/qa sw/source

2019-04-23 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/layout/data/tdf123651.docx |binary
 sw/qa/extras/layout/layout.cxx  |   11 +++
 sw/qa/extras/uiwriter/uiwriter2.cxx |   23 +--
 sw/source/core/text/txtfrm.cxx  |3 ++-
 4 files changed, 22 insertions(+), 15 deletions(-)

New commits:
commit 08985dcb5df638a67934f22aa628744fb3441aba
Author: Miklos Vajna 
AuthorDate: Mon Mar 25 21:36:02 2019 +0100
Commit: Aron Budea 
CommitDate: Tue Apr 23 16:34:00 2019 +0200

tdf#123651 sw AddVerticalFrameOffsets: make vert offset depend on hori 
offset

Regression from commit 961ba62df045473e5793d9e103be86eaad8d9575
(tdf#123032 sw, AddVerticalFrameOffsets: fix shape pos after mouse move,
2019-02-07), the vertical position of the bugdoc was too large, and
turns out Word only works with vertical offsets if there is already a
horizontal offset.

For example open tdf98987.docx in Word, remove the left square shape,
notice how the other square shape jumps up due to no longer working with
a vertical offset (while the doc model vertical position of the shape is
unchanged).

Change our layout, so that in case the AddVerticalFrameOffsets
compatibility flag is on (which was added to emulate Word's behavior),
we also consider the horizontal offset before setting the vertical
offset.

Also improve the SwUiWriterTest2::testTdf122942() test that asserted doc
model positions, which are now different (needed so that at the end the
layout position visible to the user is unchanged).

(cherry picked from commit 27894be916d5d03ee820e757d2f4abbf21d54615)

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

Change-Id: I8ac451efbacefdd3578b3a578260e7b2060c16a6
Reviewed-on: https://gerrit.libreoffice.org/71128
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/sw/qa/extras/layout/data/tdf123651.docx 
b/sw/qa/extras/layout/data/tdf123651.docx
new file mode 100644
index ..4cda0b4e7f36
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf123651.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 5dee5c580402..59f73e0b78bd 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -24,6 +24,7 @@ public:
 void testTdf118058();
 void testTdf117188();
 void testTdf119875();
+void testTdf123651();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
@@ -33,6 +34,7 @@ public:
 CPPUNIT_TEST(testTdf118058);
 CPPUNIT_TEST(testTdf117188);
 CPPUNIT_TEST(testTdf119875);
+CPPUNIT_TEST(testTdf123651);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -171,6 +173,15 @@ void SwLayoutWriter::testTdf119875()
 CPPUNIT_ASSERT_LESS(nSecondTop, nFirstTop);
 }
 
+void SwLayoutWriter::testTdf123651()
+{
+createDoc("tdf123651.docx");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+// Without the accompanying fix in place, this test would have failed with 
'Expected: 7639;
+// Actual: 12926'. The shape was below the second "Lorem ipsum" text, not 
above it.
+assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "top", "7639");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 6d3355af30bb..a5b74cc8265b 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -455,12 +455,6 @@ void SwUiWriterTest2::testTdf122942()
 const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats();
 CPPUNIT_ASSERT_EQUAL(static_cast(2), rFormats.size());
 
-// Without the accompanying fix in place, this test would have failed with
-// 'Expected less than: 0; Actual  : 1030', i.e. the shape was below the
-// paragraph mark, not above it.
-const SwFormatVertOrient& rVert = rFormats[1]->GetVertOrient();
-CPPUNIT_ASSERT_LESS(static_cast(0), rVert.GetPos());
-
 reload("writer8", "tdf122942.odt");
 pTextDoc = dynamic_cast(mxComponent.get());
 pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
@@ -468,14 +462,15 @@ void SwUiWriterTest2::testTdf122942()
 const SwFrameFormats& rFormats2 = *pDoc->GetSpzFrameFormats();
 CPPUNIT_ASSERT_EQUAL(static_cast(2), rFormats2.size());
 
-SdrObject* pObject = rFormats2[1]->FindSdrObject();
-CPPUNIT_ASSERT(pObject);
-
-const tools::Rectangle& rOutRect = pObject->GetLastBoundRect();
-// Without the accompanying fix in place, this test would have failed with
-// 'Expected greater than: 5000; Actual  : 2817', i.e. the shape moved up
-// after a reload(), while it's expected to not change its position (5773).
-CPPUNIT_ASSERT_GREATER(static_cast(5000), rOutRect.Top());
+// Make sure the top of the inserted shape does not move outside the 
existing shape, even after
+// reload.
+  

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

2019-04-23 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/uiwriter/data2/tdf122942.odt |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   43 +++---
 sw/source/core/frmedt/feshview.cxx|   23 +---
 3 files changed, 54 insertions(+), 12 deletions(-)

New commits:
commit aafafca61527fb650d3f9f11ec6c8226cd612fae
Author: Miklos Vajna 
AuthorDate: Mon Jan 28 17:18:34 2019 +0100
Commit: Aron Budea 
CommitDate: Tue Apr 23 16:32:53 2019 +0200

tdf#122942 sw: update shape insert UI for the AddVerticalFrameOffsets option

Regression from commit 50223ea6e212b60b7d33839c2753c5601fb50f95
(tdf#98987 sw: add AddVerticalFrameOffsets compat mode, 2016-03-31),
SwFEShell::ImpEndCreate() was not adapted to call
SwTextFrame::GetBaseVertOffsetForFly() when determining the vertical
position of the inserted shape.

The call can be unconditional, the returned value is already 0 when the
DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS compat setting is false.

(cherry picked from commit 4218caf142a7ecac34548c6d38c6f6fbebb898b9)

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

Change-Id: Iec6af5a6d1ff3466e08377853cc8ca84f33a76d1
Reviewed-on: https://gerrit.libreoffice.org/71126
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/sw/qa/extras/uiwriter/data2/tdf122942.odt 
b/sw/qa/extras/uiwriter/data2/tdf122942.odt
new file mode 100644
index ..c56583d305f2
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf122942.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index e104e2e4dde4..df4fef72e547 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -43,6 +44,7 @@ public:
 void testCheckboxFormFieldInsertion();
 void testDropDownFormFieldInsertion();
 void testMixedFormFieldInsertion();
+void testTdf122942();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest2);
 CPPUNIT_TEST(testTdf101534);
@@ -54,6 +56,7 @@ public:
 CPPUNIT_TEST(testCheckboxFormFieldInsertion);
 CPPUNIT_TEST(testDropDownFormFieldInsertion);
 CPPUNIT_TEST(testMixedFormFieldInsertion);
+CPPUNIT_TEST(testTdf122942);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -67,14 +70,17 @@ SwDoc* SwUiWriterTest2::createDoc(const char* pName)
 else
 load(DATA_DIRECTORY, pName);
 
-SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
 CPPUNIT_ASSERT(pTextDoc);
 return pTextDoc->GetDocShell()->GetDoc();
 }
 
-static void lcl_dispatchCommand(const uno::Reference& 
xComponent, const OUString& rCommand, const 
uno::Sequence& rPropertyValues)
+static void lcl_dispatchCommand(const uno::Reference& 
xComponent,
+const OUString& rCommand,
+const uno::Sequence& 
rPropertyValues)
 {
-uno::Reference xController = 
uno::Reference(xComponent, 
uno::UNO_QUERY)->getCurrentController();
+uno::Reference xController
+= uno::Reference(xComponent, 
uno::UNO_QUERY)->getCurrentController();
 CPPUNIT_ASSERT(xController.is());
 uno::Reference xFrame(xController->getFrame(), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT(xFrame.is());
@@ -425,6 +431,37 @@ void SwUiWriterTest2::testMixedFormFieldInsertion()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pMarkAccess->getAllMarksCount());
 }
 
+void SwUiWriterTest2::testTdf122942()
+{
+load(DATA_DIRECTORY, "tdf122942.odt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+
+// Do the moral equivalent of mouse button down, move and up.
+// Start creating a custom shape that overlaps with the rounded rectangle
+// already present in the document.
+Point aStartPos(8000, 3000);
+pWrtShell->BeginCreate(static_cast(OBJ_CUSTOMSHAPE), 
aStartPos);
+
+// Set its size.
+Point aMovePos(1, 5000);
+pWrtShell->MoveCreate(aMovePos);
+
+// Finish creation.
+pWrtShell->EndCreate(SdrCreateCmd::ForceEnd);
+
+// Make sure that the shape is inserted.
+SwDoc* pDoc = pWrtShell->GetDoc();
+const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats();
+CPPUNIT_ASSERT_EQUAL(static_cast(2), rFormats.size());
+
+// Without the accompanying fix in place, this test would have failed with
+// 'Expected less than: 0; Actual  : 1030', i.e. the shape was below the
+// paragraph mark, not above it.
+const SwFormatVertOrient& rVert = rFormats[1]->GetVertOrient();
+CPPUNIT_ASSERT_LESS(static_cast(0), rVert.GetPos());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 4f17c72777f1..8066f9f4108e 

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

2019-03-26 Thread Aron Budea (via logerrit)
 sw/qa/extras/ww8export/ww8export3.cxx |1 +
 sw/source/filter/ww8/wrtw8sty.cxx |4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d2fd88f8fab892185ab0d845fdba6e8fac1ad1c5
Author: Aron Budea 
AuthorDate: Tue Mar 26 11:06:29 2019 +0100
Commit: Aron Budea 
CommitDate: Tue Mar 26 11:52:24 2019 +0100

Revert "sw mso export: PROTECT_FORM shouldn't force section to protected"

Causes tdf#123912.

This reverts commit 0507a1578da0de9cebda999ec4d916d3bc8b290c.

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index d5a888e60dd6..84f9e2f2d6cf 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -63,6 +63,7 @@ DECLARE_WW8EXPORT_TEST(testFdo53985, "fdo53985.doc")
 uno::Reference xSect(xSections->getByIndex(0), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Section1 is protected", true, 
getProperty(xSect, "IsProtected"));
 xSect.set(xSections->getByIndex(3), uno::UNO_QUERY);
+if ( !mbExported )
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Section4 is protected", false, 
getProperty(xSect, "IsProtected"));
 }
 
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 437220ee0763..3353084ef6e3 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1535,7 +1535,9 @@ void MSWordExportBase::SectionProperties( const 
WW8_SepInfo& rSepInfo, WW8_PdAtt
 AttrOutput().SectFootnoteEndnotePr();
 
 // forms
-AttrOutput().SectionFormProtection( rSepInfo.IsProtected() );
+bool formProtection = m_pDoc->getIDocumentSettingAccess().get( 
DocumentSettingId::PROTECT_FORM );
+formProtection |= rSepInfo.IsProtected();
+AttrOutput().SectionFormProtection( formProtection );
 
 // line numbers
 const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo();
___
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-6.0' - sw/qa sw/source

2019-03-18 Thread Libreoffice Gerrit user
 sw/qa/extras/globalfilter/globalfilter.cxx |2 +-
 sw/source/core/inc/UndoBookmark.hxx|2 ++
 sw/source/core/inc/rolbck.hxx  |4 
 3 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 3736cfce7aaf3d03f4ca0e496a279f93f451ebad
Author: Tamás Zolnai 
AuthorDate: Wed Mar 6 15:48:05 2019 +0100
Commit: Andras Timar 
CommitDate: Mon Mar 18 10:18:57 2019 +0100

MSForms: Add some extra comments for the new code

Change-Id: I4b70eb2164032623a12f9e703c660eca1d6768ec
Reviewed-on: https://gerrit.libreoffice.org/68965
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 
(cherry picked from commit d47f037a220636d70297bc098ed08e0bcb763aa9)

diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 782f778e04e8..d762a8d5f8cd 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -1097,7 +1097,7 @@ void Test::testDropDownFormField()
 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
sal_Int32(0), vListEntries.getLength());
 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
sal_Int32(-1), nSelection);
 }
-else
+else // The second one has list and also a selected item
 {
 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
sal_Int32(4), vListEntries.getLength());
 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
sal_Int32(1), nSelection);
diff --git a/sw/source/core/inc/UndoBookmark.hxx 
b/sw/source/core/inc/UndoBookmark.hxx
index 7b9dd4fc68e5..3e2017d0721d 100644
--- a/sw/source/core/inc/UndoBookmark.hxx
+++ b/sw/source/core/inc/UndoBookmark.hxx
@@ -98,6 +98,7 @@ private:
 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
 };
 
+/// Handling undo / redo of checkbox and drop-down form field insertion
 class SwUndoInsNoTextFieldmark : public SwUndo
 {
 private:
@@ -110,6 +111,7 @@ public:
 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
 };
 
+/// Handling undo / redo of text form field insertion
 class SwUndoInsTextFieldmark : public SwUndo
 {
 private:
diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index d7985fde8592..240eedcd3cd2 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -261,6 +261,8 @@ class SwHistoryBookmark : public SwHistoryHint
 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo;
 };
 
+/// History object containing all information used during undo / redo
+/// of checkbox and drop-down form field insertion.
 class SwHistoryNoTextFieldmark : public SwHistoryHint
 {
 public:
@@ -274,6 +276,8 @@ class SwHistoryNoTextFieldmark : public SwHistoryHint
 const sal_Int32 m_nContent;
 };
 
+/// History object containing all information used during undo / redo
+/// of text form field insertion.
 class SwHistoryTextFieldmark : public SwHistoryHint
 {
 public:
___
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-6.0' - sw/qa sw/source

2019-03-04 Thread Libreoffice Gerrit user
 sw/qa/extras/rtfexport/rtfexport.cxx |2 ++
 sw/source/filter/ww8/wrtww8.cxx  |4 
 2 files changed, 6 insertions(+)

New commits:
commit a070675cfc5a9b474f7b7062303d0ba6b3b532b6
Author: Justin Luth 
AuthorDate: Tue Jan 8 11:17:12 2019 +0300
Commit: Andras Timar 
CommitDate: Mon Mar 4 15:13:20 2019 +0100

tdf#122456 filter/ww8 export: no fake section at end of document

If Writer has a section that is ending, then the part after
that would need to be another section for MS formats. However,
if the section ends at the end of the document, there is
no need to start a new section.

This is particularly important for exporting RTF (preventing
accumulating sections/paragraphs), but it also affects
docx and doc (without noticable benefit or harm, but
now instead of "fake" section properties it will end with
the properties of the real section - which can only be a
good thing, right?)

This is one step in the right direction for resolving the comment
//0x, what ... is going on with that!, fixme most terribly
reinterpret_cast(sal_IntPtr(-1))

Change-Id: Ie0641eb78c11103b33e3d849fe0b7935476a6505
Reviewed-on: https://gerrit.libreoffice.org/65974
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/66051
Reviewed-by: Miklos Vajna 
(cherry picked from commit 5deec1c02ca1f2df30b0c33d516d3aa10285fb3b)
Reviewed-on: https://gerrit.libreoffice.org/68500
Tested-by: Mike Kaganski 
Reviewed-by: Andras Timar 

diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index b59e0c6efc6e..fb5d261249a3 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1124,6 +1124,8 @@ DECLARE_RTFEXPORT_TEST(testTdf94043, "tdf94043.rtf")
 // This was 0, the separator line was not visible due to 0 width.
 CPPUNIT_ASSERT_EQUAL(static_cast(2),
  getProperty(xTextColumns, 
"SeparatorLineWidth"));
+
+CPPUNIT_ASSERT_EQUAL(7, getParagraphs());
 }
 
 DECLARE_RTFEXPORT_TEST(testTdf94377, "tdf94377.rtf")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 15e5506abfc4..64bf90dfdac5 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2773,6 +2773,10 @@ void MSWordExportBase::WriteText()
 {
 bNeedExportBreakHere = false;
 }
+// No need to create a "fake" section if this is the end 
of the document,
+// except to emulate balanced columns.
+else if ( nColumnCount < 2 && aIdx == 
m_pDoc->GetNodes().GetEndOfContent() )
+bNeedExportBreakHere = false;
 }
 
 if (bNeedExportBreakHere)  //#120140# End of check
___
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-6.0' - sw/qa sw/source

2019-02-19 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8import/data/tdf110987 |binary
 sw/qa/extras/ww8import/ww8import.cxx  |   13 +
 sw/source/ui/uno/swdetect.cxx |   22 ++
 3 files changed, 35 insertions(+)

New commits:
commit a7d09d82ee25a0880a5d4adb59d102cbf886f7cc
Author: Tor Lillqvist 
AuthorDate: Tue Feb 19 11:03:20 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Feb 19 17:42:29 2019 +0200

tdf#110987: Don't mis-detect .doc files as .dot

Also add a unit test for that.

Change-Id: I86c195cebbe12b2bdf498954956db882f6f0d12b

diff --git a/sw/qa/extras/ww8import/data/tdf110987 
b/sw/qa/extras/ww8import/data/tdf110987
new file mode 100755
index ..16195c0e1579
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf110987 differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index 76eb495bb499..31cfce841d3c 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -16,6 +16,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -248,6 +250,17 @@ DECLARE_WW8IMPORT_TEST(testTdf122425_2, "tdf122425_2.doc")
 }
 }
 
+DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987")
+{
+// The input document is an empty .doc, but without file name
+// extension. Check that it was loaded as a normal .doc document,
+// and not a template.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+OUString s = 
pTextDoc->GetDocShell()->GetMedium()->GetFilter()->GetFilterName();
+CPPUNIT_ASSERT(s != "MS Word 97 Vorlage");
+}
+
 // tests should only be added to ww8IMPORT *if* they fail round-tripping in 
ww8EXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index 44d5c205eb6a..1f7bc3a76bc9 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -95,7 +95,29 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< 
PropertyValue >& lDescriptor
 {
 bIsDetected = aStorage->IsContained( "WordDocument" );
 if ( bIsDetected && aTypeName.startsWith( "writer_MS_Word_97" 
) )
+{
 bIsDetected = ( aStorage->IsContained("0Table") || 
aStorage->IsContained("1Table") );
+
+// If we are checking the template type, and the document 
is not a .dot, don't
+// mis-detect it.
+if ( bIsDetected && aTypeName == 
"writer_MS_Word_97_Vorlage" )
+{
+// Super ugly hack, but we don't want to use the whole 
WW8Fib thing here in
+// the swd library, apparently. We know (do we?) that 
the "aBits1" byte, as
+// the variable is called in 
WW8Fib::WW8Fib(SvStream&,sal_uInt8,sal_uInt32),
+// is at offset 10 in the WordDocument stream. The 
fDot bit is bit 0x01 of
+// that byte.
+tools::SvRef xWordDocument = 
aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ);
+xWordDocument->Seek( 10 );
+if ( xWordDocument->Tell() == 10 )
+{
+sal_uInt8 aBits1;
+xWordDocument->ReadUChar( aBits1 );
+// Check fDot bit
+bIsDetected = ((aBits1 & 0x01) == 0x01);
+}
+}
+}
 }
 }
 catch (...)
___
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-6.0' - sw/qa sw/source

2019-02-12 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf116371.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   10 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   37 ---
 3 files changed, 33 insertions(+), 14 deletions(-)

New commits:
commit 641004969ffd053bde90bdd6c4ea629baea8d18e
Author: Mike Kaganski 
AuthorDate: Sat Jan 26 17:13:28 2019 +0300
Commit: Mike Kaganski 
CommitDate: Tue Feb 12 07:04:08 2019 +0100

tdf#116371: export rotation of SwGrfNode

Change-Id: I42620da798a35dfada67d9a9fb23d554cc20b16f
Reviewed-on: https://gerrit.libreoffice.org/66963
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/67670
Tested-by: Mike Kaganski 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116371.odt 
b/sw/qa/extras/ooxmlexport/data/tdf116371.odt
new file mode 100644
index ..257696616e8c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116371.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 4163921e073f..d5e98bebfde0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -413,6 +413,16 @@ DECLARE_OOXMLEXPORT_TEST(testInputListExport, 
"tdf122186_input_list.odt")
 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[4]/w:t", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt")
+{
+// Make sure the rotation is exported correctly, and size not distorted
+auto xShape(getShape(1));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(4700.0, getProperty(xShape, 
"RotateAngle"), 10);
+auto frameRect = getProperty(xShape, "FrameRect");
+CPPUNIT_ASSERT_EQUAL(sal_Int32(24070), frameRect.Height);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(24188), frameRect.Width);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 04f491205700..a1629f0d7210 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4602,7 +4602,27 @@ void DocxAttributeOutput::FlyFrameGraphic( const 
SwGrfNode* pGrfNode, const Size
 CharGrabBag(*pGrabBag);
 }
 
-m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, rSize);
+rtl::Reference xFrameAttributes(
+FastSerializerHelper::createAttrList());
+Size aSize = rSize;
+if (pGrfNode)
+{
+const SwAttrSet& rSet = pGrfNode->GetSwAttrSet();
+MirrorGraph eMirror = rSet.GetMirrorGrf().GetValue();
+if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both)
+// Mirror on the vertical axis is a horizontal flip.
+xFrameAttributes->add(XML_flipH, "1");
+// RES_GRFATR_ROTATION is sal_uInt16; use sal_uInt32 for 
multiplication later
+if (sal_uInt32 nRot = rSet.GetRotationGrf().GetValue())
+{
+// RES_GRFATR_ROTATION is in 10ths of degree; convert to 100ths 
for macro
+sal_uInt32 mOOXMLRot = 
OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRot*10);
+xFrameAttributes->add(XML_rot, OString::number(mOOXMLRot));
+aSize = pGrfNode->GetTwipSize();
+}
+}
+
+m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, aSize);
 
 // picture description (used for pic:cNvPr later too)
 ::sax_fastparser::FastAttributeList* docPrattrList = 
FastSerializerHelper::createAttrList();
@@ -4709,25 +4729,14 @@ void DocxAttributeOutput::FlyFrameGraphic( const 
SwGrfNode* pGrfNode, const Size
 XML_bwMode, "auto",
 FSEND );
 
-rtl::Reference xFrameAttributes(
-FastSerializerHelper::createAttrList());
-
-if (pGrfNode)
-{
-MirrorGraph eMirror = 
pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue();
-if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both)
-// Mirror on the vertical axis is a horizontal flip.
-xFrameAttributes->add(XML_flipH, "1");
-}
-
 m_pSerializer->startElementNS(
 XML_a, XML_xfrm, 
uno::Reference(xFrameAttributes.get()));
 
 m_pSerializer->singleElementNS( XML_a, XML_off,
 XML_x, "0", XML_y, "0",
 FSEND );
-OString aWidth( OString::number( TwipsToEMU( rSize.Width() ) ) );
-OString aHeight( OString::number( TwipsToEMU( rSize.Height() ) ) );
+OString aWidth( OString::number( TwipsToEMU( aSize.Width() ) ) );
+OString aHeight( OString::number( TwipsToEMU( aSize.Height() ) ) );
 m_pSerializer->singleElementNS( XML_a, XML_ext,
 XML_cx, aWidth.getStr(),
 XML_cy, aHeight.getStr(),
___
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-6.0' - sw/qa sw/source

2019-01-30 Thread Libreoffice Gerrit user
 sw/qa/extras/uiwriter/uiwriter2.cxx|  102 +++--
 sw/source/uibase/docvw/FloatingTableButton.cxx |   37 -
 2 files changed, 97 insertions(+), 42 deletions(-)

New commits:
commit 79f84cf94dd26c4fee14a0db4a98df7791df78f2
Author: Tamás Zolnai 
AuthorDate: Wed Jan 30 16:43:28 2019 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 30 18:51:43 2019 +0100

Unfloat: Fix some issues with unfloat operation

- Use the correct method to remove the frame, so DOC
export will work correctly.
- Remove pagedesc attribute of the first text node if
the table is moved before it to avoid to generate a page
break.

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

Unfloat: Need to move the page desc into the table node AttrSet

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

Change-Id: I02802c4d25c947ec140b846c594848117815f1ce
b9868bb31238905dd178fcf54c79f013079a037b
Reviewed-on: https://gerrit.libreoffice.org/67098
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 274bec37d0b1..d6d8c989fb2f 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -174,49 +175,70 @@ void SwUiWriterTest2::testUnfloatButtonReadOnlyMode()
 
 void SwUiWriterTest2::testUnfloating()
 {
-// Test what happens when pushing the unfloat button
-load(FLOATING_TABLE_DATA_DIRECTORY, "unfloatable_floating_table.odt");
-SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
-CPPUNIT_ASSERT(pTextDoc);
-SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
-CPPUNIT_ASSERT(pWrtShell);
-
-SwFlyFrame* pFlyFrame;
+// Test unfloating with tables imported from different file formats
+const std::vector aTestFiles = {
+"unfloatable_floating_table.odt",
+"unfloatable_floating_table.docx",
+"unfloatable_floating_table.doc",
+};
 
-// Before unfloating we have only one page with a fly frame
+for (const OUString& aTestFile : aTestFiles)
 {
-CPPUNIT_ASSERT_EQUAL(SwFrameType::Page, 
pWrtShell->GetLayout()->GetLower()->GetType());
-CPPUNIT_ASSERT(!pWrtShell->GetLayout()->GetLower()->GetNext());
-CPPUNIT_ASSERT_EQUAL(SwFrameType::Txt,
- 
pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetType());
-const SwSortedObjs* pAnchored
-= 
pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetDrawObjs();
-CPPUNIT_ASSERT(pAnchored);
-CPPUNIT_ASSERT_EQUAL(static_cast(1), pAnchored->size());
-SwAnchoredObject* pAnchoredObj = (*pAnchored)[0];
-pFlyFrame = dynamic_cast(pAnchoredObj);
-CPPUNIT_ASSERT(pFlyFrame);
-}
+OString sTestFileName = OUStringToOString(aTestFile, 
RTL_TEXTENCODING_UTF8);
+OString sFailureMessage = OString("Failure in the test file: ") + 
sTestFileName;
 
-// Select the floating table
-SdrObject* pObj = pFlyFrame->GetFormat()->FindRealSdrObject();
-CPPUNIT_ASSERT(pObj);
-pWrtShell->SelectObj(Point(), 0, pObj);
-CPPUNIT_ASSERT(pFlyFrame->IsShowUnfloatButton(pWrtShell));
-
-// Push the unfloat button
-pFlyFrame->ActiveUnfloatButton(pWrtShell);
-
-// After unfloating we have two pages with one tablre frame on each page
-CPPUNIT_ASSERT(pWrtShell->GetLayout()->GetLower()->GetNext());
-CPPUNIT_ASSERT_EQUAL(SwFrameType::Page,
- 
pWrtShell->GetLayout()->GetLower()->GetNext()->GetType());
-CPPUNIT_ASSERT(!pWrtShell->GetLayout()->GetLower()->GetNext()->GetNext());
-CPPUNIT_ASSERT_EQUAL(SwFrameType::Tab,
- 
pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetType());
-CPPUNIT_ASSERT_EQUAL(
-SwFrameType::Tab,
-
pWrtShell->GetLayout()->GetLower()->GetNext()->GetLower()->GetLower()->GetType());
+// Test what happens when pushing the unfloat button
+load(FLOATING_TABLE_DATA_DIRECTORY, "unfloatable_floating_table.docx");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pTextDoc);
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pWrtShell);
+
+SwFlyFrame* pFlyFrame;
+
+// Before unfloating we have only one page with a fly frame
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailureMessage.getStr(), 
SwFrameType::Page,
+ 

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

2019-01-17 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf122186_input_list.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |   10 ++
 sw/source/filter/ww8/docxattributeoutput.cxx   |2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 38ef8e9eba55b55a64488c7e452ec24a7a360a05
Author: Tamás Zolnai 
AuthorDate: Mon Jan 14 15:12:16 2019 +0100
Commit: Andras Timar 
CommitDate: Thu Jan 17 13:36:48 2019 +0100

tdf#122186: Fix broken Input list after RT in DOCX format

We should not write out the text of the field, because it
confuses the import code and it's unneeded anyway.

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

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf122186_input_list.odt 
b/sw/qa/extras/ooxmlexport/data/tdf122186_input_list.odt
new file mode 100755
index ..76a6289f7045
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf122186_input_list.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 9216e4369dd6..4163921e073f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -403,6 +403,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf58944RepeatingTableHeader, 
"tdf58944-repeating-t
  
parseDump("/root/page[2]/body/tab/row[2]/cell[1]/txt/text()"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testInputListExport, "tdf122186_input_list.odt")
+{
+// We need to make sure we don't export the text itself next to the input 
list field
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r", 5);
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[4]/w:t", 0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 67846f34f73a..04f491205700 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1921,7 +1921,7 @@ void DocxAttributeOutput::EndField_Impl( const 
SwTextNode* pNode, sal_Int32 nPos
 sExpand = static_cast(rInfos.pField.get())
 ->ExpandCitation(AUTH_FIELD_TITLE);
 }
-else
+else if(rInfos.eType != ww::eFORMDROPDOWN)
 {
 sExpand = rInfos.pField->ExpandField( 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-6.0' - sw/qa sw/source

2019-01-08 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8import/data/tdf122425_1.doc |binary
 sw/qa/extras/ww8import/data/tdf122425_2.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx|   66 
 sw/source/filter/ww8/ww8graf.cxx|1 
 sw/source/filter/ww8/ww8par.cxx |7 ++
 5 files changed, 73 insertions(+), 1 deletion(-)

New commits:
commit 988f4db332a723ca5c6af569328605a7c5a12bb7
Author: Mike Kaganski 
AuthorDate: Sun Jan 6 19:35:41 2019 +0300
Commit: Andras Timar 
CommitDate: Tue Jan 8 11:33:16 2019 +0100

tdf#122425: explicitly remove borders for newly created flys

After commit d398e9248c183cf988b6d985b342b0cbff93ea02, it's necessary
to make sure that each created floating object has proper default
border and spacing values (empty and 0), to not inherit frame style's
non-0 values unintentionally.

This fixes two places for objects in headers/footers.

Change-Id: I2632bcd4066609c97aa15e39d69e9089ac691ff2
Reviewed-on: https://gerrit.libreoffice.org/65906
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 2e189c2464de007b3d59ba37d4f3f1cfbe5b480c)
Reviewed-on: https://gerrit.libreoffice.org/65908
Tested-by: Mike Kaganski 
Reviewed-by: Andras Timar 

diff --git a/sw/qa/extras/ww8import/data/tdf122425_1.doc 
b/sw/qa/extras/ww8import/data/tdf122425_1.doc
new file mode 100644
index ..f0e5b148d347
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf122425_1.doc differ
diff --git a/sw/qa/extras/ww8import/data/tdf122425_2.doc 
b/sw/qa/extras/ww8import/data/tdf122425_2.doc
new file mode 100644
index ..8debcddc1690
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf122425_2.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index 718c8948645d..76eb495bb499 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -182,6 +182,72 @@ DECLARE_WW8IMPORT_TEST(testTdf121734, "tdf121734.doc")
 }
 }
 
+DECLARE_WW8IMPORT_TEST(testTdf122425_1, "tdf122425_1.doc")
+{
+// This is for header text in case we use a hack for fixed-height headers
+// (see SwWW8ImplReader::Read_HdFtTextAsHackedFrame)
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false);
+// There are two fly frames in the document: for first page's header, and 
for other pages'
+CPPUNIT_ASSERT_EQUAL(size_t(2), aPosFlyFrames.size());
+for (const auto& rPosFlyFrame : aPosFlyFrames)
+{
+const SwFrameFormat& rFormat = rPosFlyFrame->GetFormat();
+const SfxPoolItem* pItem = nullptr;
+
+// The LR and UL spacings and borders must all be set explicitly;
+// spacings and border distances must be 0; borders must be absent
+
+CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, 
rFormat.GetItemState(RES_LR_SPACE, false, ));
+auto pLR = static_cast(pItem);
+CPPUNIT_ASSERT(pLR);
+CPPUNIT_ASSERT_EQUAL(long(0), pLR->GetLeft());
+CPPUNIT_ASSERT_EQUAL(long(0), pLR->GetRight());
+
+CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, 
rFormat.GetItemState(RES_UL_SPACE, false, ));
+auto pUL = static_cast(pItem);
+CPPUNIT_ASSERT(pUL);
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pUL->GetUpper());
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pUL->GetLower());
+
+CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_BOX, 
false, ));
+auto pBox = static_cast(pItem);
+CPPUNIT_ASSERT(pBox);
+for (auto eLine : { SvxBoxItemLine::TOP, SvxBoxItemLine::BOTTOM,
+SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT })
+{
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pBox->GetDistance(eLine));
+CPPUNIT_ASSERT(!pBox->GetLine(eLine));
+}
+}
+}
+
+DECLARE_WW8IMPORT_TEST(testTdf122425_2, "tdf122425_2.doc")
+{
+// This is for graphic objects in headers/footers
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false);
+// There is one fly frame in the document: the text box
+CPPUNIT_ASSERT_EQUAL(size_t(1), aPosFlyFrames.size());
+for (const auto& rPosFlyFrame : aPosFlyFrames)
+{
+const SwFrameFormat& rFormat = rPosFlyFrame->GetFormat();
+const SfxPoolItem* pItem = nullptr;
+
+// Check for correct explicitly-set values of UL spacings. Previously 
this was "DEFAULT",
+// and resulted in inherited values (114 = 2 mm) used.
+CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, 
rFormat.GetItemState(RES_UL_SPACE, false, ));
+auto pUL = static_cast(pItem);
+

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

2019-01-08 Thread Libreoffice Gerrit user
 sw/qa/extras/uiwriter/uiwriter2.cxx |   52 ++--
 sw/source/core/inc/flyfrm.hxx   |3 ++
 sw/source/core/layout/fly.cxx   |   11 +++
 3 files changed, 64 insertions(+), 2 deletions(-)

New commits:
commit 419ce1399c496e062676b7a8e4f87277f552d3d5
Author: Tamás Zolnai 
AuthorDate: Fri Jan 4 11:23:59 2019 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 8 09:07:21 2019 +0100

Unfloat: Test layout change of unfloat operation

Change-Id: I75298a392de6a10861ac96e1bc58a30173cd2dd2
Reviewed-on: https://gerrit.libreoffice.org/65823
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 
(cherry picked from commit dd0b559d6aac5bf09566af735bd00b28c00fb2e4)
Reviewed-on: https://gerrit.libreoffice.org/65874
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 088d02ca4761..274bec37d0b1 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -18,8 +18,7 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 
 namespace
 {
@@ -35,12 +34,14 @@ public:
 void testUnfloatButtonSmallTable();
 void testUnfloatButton();
 void testUnfloatButtonReadOnlyMode();
+void testUnfloating();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest2);
 CPPUNIT_TEST(testTdf101534);
 CPPUNIT_TEST(testUnfloatButtonSmallTable);
 CPPUNIT_TEST(testUnfloatButton);
 CPPUNIT_TEST(testUnfloatButtonReadOnlyMode);
+CPPUNIT_TEST(testUnfloating);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -171,6 +172,53 @@ void SwUiWriterTest2::testUnfloatButtonReadOnlyMode()
 CPPUNIT_ASSERT(!pFlyFrame->IsShowUnfloatButton(pWrtShell));
 }
 
+void SwUiWriterTest2::testUnfloating()
+{
+// Test what happens when pushing the unfloat button
+load(FLOATING_TABLE_DATA_DIRECTORY, "unfloatable_floating_table.odt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+SwFlyFrame* pFlyFrame;
+
+// Before unfloating we have only one page with a fly frame
+{
+CPPUNIT_ASSERT_EQUAL(SwFrameType::Page, 
pWrtShell->GetLayout()->GetLower()->GetType());
+CPPUNIT_ASSERT(!pWrtShell->GetLayout()->GetLower()->GetNext());
+CPPUNIT_ASSERT_EQUAL(SwFrameType::Txt,
+ 
pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetType());
+const SwSortedObjs* pAnchored
+= 
pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetDrawObjs();
+CPPUNIT_ASSERT(pAnchored);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), pAnchored->size());
+SwAnchoredObject* pAnchoredObj = (*pAnchored)[0];
+pFlyFrame = dynamic_cast(pAnchoredObj);
+CPPUNIT_ASSERT(pFlyFrame);
+}
+
+// Select the floating table
+SdrObject* pObj = pFlyFrame->GetFormat()->FindRealSdrObject();
+CPPUNIT_ASSERT(pObj);
+pWrtShell->SelectObj(Point(), 0, pObj);
+CPPUNIT_ASSERT(pFlyFrame->IsShowUnfloatButton(pWrtShell));
+
+// Push the unfloat button
+pFlyFrame->ActiveUnfloatButton(pWrtShell);
+
+// After unfloating we have two pages with one tablre frame on each page
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->GetLower()->GetNext());
+CPPUNIT_ASSERT_EQUAL(SwFrameType::Page,
+ 
pWrtShell->GetLayout()->GetLower()->GetNext()->GetType());
+CPPUNIT_ASSERT(!pWrtShell->GetLayout()->GetLower()->GetNext()->GetNext());
+CPPUNIT_ASSERT_EQUAL(SwFrameType::Tab,
+ 
pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetType());
+CPPUNIT_ASSERT_EQUAL(
+SwFrameType::Tab,
+
pWrtShell->GetLayout()->GetLower()->GetNext()->GetLower()->GetLower()->GetType());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index bc9cea59e963..65ba6d636676 100644
--- a/sw/source/core/inc/flyfrm.hxx
+++ b/sw/source/core/inc/flyfrm.hxx
@@ -273,6 +273,9 @@ public:
 void SelectionHasChanged(SwFEShell* pShell);
 bool IsShowUnfloatButton(SwWrtShell* pWrtSh) const;
 
+// For testing only (see uiwriter)
+void ActiveUnfloatButton(SwWrtShell* pWrtSh);
+
 private:
 void UpdateUnfloatButton(SwWrtShell* pWrtSh, bool bShow) const;
 void PaintDecorators() const;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 59c825239e60..e19893fb62ce 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1840,6 +1840,17 @@ bool SwFlyFrame::IsShowUnfloatButton(SwWrtShell* pWrtSh) 
const
 return nBodyHeight < nTableHeight + nFrameOffset;
 }
 
+void SwFlyFrame::ActiveUnfloatButton(SwWrtShell* pWrtSh)
+{
+SwEditWin& rEditWin = 

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

2019-01-07 Thread Libreoffice Gerrit user
 sw/qa/extras/uiwriter/data/floating_table/small_floating_table.odt 
 |binary
 sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.doc   
 |binary
 sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.docx  
 |binary
 sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.odt   
 |binary
 
sw/qa/extras/uiwriter/data/floating_table/unfloatable_small_floating_table.docx 
|binary
 sw/qa/extras/uiwriter/uiwriter2.cxx
 |  118 +-
 sw/source/core/inc/flyfrm.hxx  
 |5 
 sw/source/core/inc/layfrm.hxx  
 |3 
 sw/source/core/inc/sortedobjs.hxx  
 |3 
 9 files changed, 124 insertions(+), 5 deletions(-)

New commits:
commit 51f4cc7daba8df5f995702405631c24c8d9bf36c
Author: Tamás Zolnai 
AuthorDate: Fri Jan 4 02:51:36 2019 +0100
Commit: Miklos Vajna 
CommitDate: Mon Jan 7 10:16:07 2019 +0100

Unfloat: Add some tests about the visibility of the unfloat button

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

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

diff --git a/sw/qa/extras/uiwriter/data/floating_table/small_floating_table.odt 
b/sw/qa/extras/uiwriter/data/floating_table/small_floating_table.odt
new file mode 100644
index ..6b77569f2583
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/floating_table/small_floating_table.odt differ
diff --git 
a/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.doc 
b/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.doc
new file mode 100644
index ..e5247f1598c2
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.doc 
differ
diff --git 
a/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.docx 
b/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.docx
new file mode 100644
index ..cef1f7bf685d
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.docx 
differ
diff --git 
a/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.odt 
b/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.odt
new file mode 100644
index ..eb2534ba4c52
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/floating_table/unfloatable_floating_table.odt 
differ
diff --git 
a/sw/qa/extras/uiwriter/data/floating_table/unfloatable_small_floating_table.docx
 
b/sw/qa/extras/uiwriter/data/floating_table/unfloatable_small_floating_table.docx
new file mode 100644
index ..d51056af1177
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/floating_table/unfloatable_small_floating_table.docx
 differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 239700294b71..088d02ca4761 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -11,20 +11,36 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 namespace
 {
 char const DATA_DIRECTORY[] = "/sw/qa/extras/uiwriter/data2/";
-}
+char const FLOATING_TABLE_DATA_DIRECTORY[] = 
"/sw/qa/extras/uiwriter/data/floating_table/";
+} // namespace
 
 /// Second set of tests asserting the behavior of Writer user interface shells.
 class SwUiWriterTest2 : public SwModelTestBase
 {
 public:
 void testTdf101534();
+void testUnfloatButtonSmallTable();
+void testUnfloatButton();
+void testUnfloatButtonReadOnlyMode();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest2);
 CPPUNIT_TEST(testTdf101534);
+CPPUNIT_TEST(testUnfloatButtonSmallTable);
+CPPUNIT_TEST(testUnfloatButton);
+CPPUNIT_TEST(testUnfloatButtonReadOnlyMode);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -55,6 +71,106 @@ void SwUiWriterTest2::testTdf101534()
 CPPUNIT_ASSERT(aSet.HasItem(RES_LR_SPACE));
 }
 
+void SwUiWriterTest2::testUnfloatButtonSmallTable()
+{
+// The floating table in the test document is too small, so we don't 
provide an unfloat button
+load(FLOATING_TABLE_DATA_DIRECTORY, "small_floating_table.odt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+const SwSortedObjs* pAnchored
+= 
pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetDrawObjs();
+CPPUNIT_ASSERT(pAnchored);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 

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

2018-12-29 Thread Libreoffice Gerrit user
 sw/qa/extras/mailmerge/data/linked-with-condition.odt |binary
 sw/qa/extras/mailmerge/mailmerge.cxx  |   81 ++
 sw/source/core/docnode/section.cxx|1 
 3 files changed, 81 insertions(+), 1 deletion(-)

New commits:
commit 5d4af68bdd2bb167e527d42f21bfe6cfbf3f25b0
Author: Mike Kaganski 
AuthorDate: Mon Dec 17 16:15:59 2018 +0300
Commit: Andras Timar 
CommitDate: Sat Dec 29 20:24:06 2018 +0100

tdf#122156: closing a section link should not clear its Hidden flag

If a section is hidden or not does not depend on whether it's linked
or not. Clearing the Hidden flag made all linked sections not hidden
in DocumentLinksAdministrationManager::EmbedAllLinks() during mail
merge.

Existed since commit 84a3db80b4fd66c6854b3135b5f69b61fd828e62
initial import

Reviewed-on: https://gerrit.libreoffice.org/65286
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit fdf4afb25ba38c7be3278bb4bde462c3f9e722fc)

Change-Id: If347008e4cf48ab1327eb04db9fdf69750ce8fa5

diff --git a/sw/qa/extras/mailmerge/data/linked-with-condition.odt 
b/sw/qa/extras/mailmerge/data/linked-with-condition.odt
new file mode 100644
index ..17fefa29b6b8
Binary files /dev/null and 
b/sw/qa/extras/mailmerge/data/linked-with-condition.odt differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index 731927e3b77d..b5063d3c6357 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -900,5 +900,86 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf121168, 
"section_ps.odt", "4_v01.ods", "Tabe
 }
 }
 
+DECLARE_SHELL_MAILMERGE_TEST(testTdf122156_shell, "linked-with-condition.odt", 
"5-with-blanks.ods",
+ "names")
+{
+// A document with a linked section hidden on an "empty field" condition
+// For combined documents, hidden sections are removed completely
+executeMailMerge();
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxMMComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+// 5 documents 1 page each, starting at odd page numbers => 9
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(9), 
pTextDoc->GetDocShell()->GetWrtShell()->GetPhyPageNum());
+uno::Reference 
xSectionsSupplier(mxMMComponent,
+  
uno::UNO_QUERY_THROW);
+uno::Reference 
xSections(xSectionsSupplier->getTextSections(),
+  uno::UNO_QUERY_THROW);
+// 2 out of 5 dataset records have empty "Title" field => no sections in 
respective documents
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xSections->getCount());
+}
+
+DECLARE_FILE_MAILMERGE_TEST(testTdf122156_file, "linked-with-condition.odt", 
"5-with-blanks.ods",
+"names")
+{
+// A document with a linked section hidden on an "empty field" condition
+// For separate documents, the sections are hidden, but not removed
+executeMailMerge();
+{
+loadMailMergeDocument(0);
+uno::Reference 
xSectionsSupplier(mxComponent,
+  
uno::UNO_QUERY_THROW);
+uno::Reference 
xSections(xSectionsSupplier->getTextSections(),
+  
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+uno::Reference xSect(xSections->getByIndex(0), 
uno::UNO_QUERY_THROW);
+// Record 1 has empty "Title" field => section is not shown
+CPPUNIT_ASSERT_EQUAL(false, getProperty(xSect, 
"IsCurrentlyVisible"));
+}
+{
+loadMailMergeDocument(1);
+uno::Reference 
xSectionsSupplier(mxComponent,
+  
uno::UNO_QUERY_THROW);
+uno::Reference 
xSections(xSectionsSupplier->getTextSections(),
+  
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+uno::Reference xSect(xSections->getByIndex(0), 
uno::UNO_QUERY_THROW);
+// Record 2 has non-empty "Title" field => section is shown
+CPPUNIT_ASSERT_EQUAL(true, getProperty(xSect, 
"IsCurrentlyVisible"));
+}
+{
+loadMailMergeDocument(2);
+uno::Reference 
xSectionsSupplier(mxComponent,
+  
uno::UNO_QUERY_THROW);
+uno::Reference 
xSections(xSectionsSupplier->getTextSections(),
+  
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+uno::Reference xSect(xSections->getByIndex(0), 
uno::UNO_QUERY_THROW);
+// Record 3 has non-empty "Title" field => section is shown
+CPPUNIT_ASSERT_EQUAL(true, getProperty(xSect, 

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

2018-12-29 Thread Libreoffice Gerrit user
 sw/qa/extras/mailmerge/data/section_ps.odt |binary
 sw/qa/extras/mailmerge/mailmerge.cxx   |   33 +
 sw/source/uibase/dbui/dbmgr.cxx|9 +++
 3 files changed, 42 insertions(+)

New commits:
commit 81dc538bdebf7e2c8c0b259eed3b3f8b77309c59
Author: Mike Kaganski 
AuthorDate: Wed Dec 19 00:35:32 2018 +0300
Commit: Andras Timar 
CommitDate: Sat Dec 29 20:17:43 2018 +0100

tdf#121168: Ensure page descriptions are correct in work document

When first node on a page is a section, then creation of a copy with
lcl_CreateWorkingDocument initially produces a document with layout
frames having wrong page descriptions applied (set to "Default Style").
The reason is that when SfxViewFrame::LoadHiddenDocument indirectly
calls SwRootFrame::Init, the sections in the document have hidden
flag set, which causes SwNodes::GoNextSection return the first node
after the first section. The returned node naturally doesn't have a
page description set, thus the initialized page frame doesn't get it.

This makes following copy to destination document use that wrong style;
if the correct page style had header/footer, then it would not be
properly copied per record in single-document output; headers/footers
would be wrong/absent.

This change forces check of page descriptions after the work document
had been created and initialized.

Change-Id: Ic196eb7fac0241f002eddd2c1d1b66dfb489bc60
Reviewed-on: https://gerrit.libreoffice.org/65383
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 
(cherry picked from commit ec928ac5d84273b4bc1f923c545834dc59d3e394)
Reviewed-on: https://gerrit.libreoffice.org/65408
Reviewed-by: Andras Timar 

diff --git a/sw/qa/extras/mailmerge/data/section_ps.odt 
b/sw/qa/extras/mailmerge/data/section_ps.odt
new file mode 100644
index ..dd9704845fac
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/section_ps.odt differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index ba4c5dd401bd..731927e3b77d 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -867,5 +867,38 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf118845, 
"tdf118845.fodt", "4_v01.ods", "Tabe
 CPPUNIT_ASSERT_EQUAL(OUString(""), xParagraph->getString());
 }
 
+DECLARE_SHELL_MAILMERGE_TEST(testTdf121168, "section_ps.odt", "4_v01.ods", 
"Tabelle1")
+{
+// A document starting with a section on a page with non-default page 
style with header
+executeMailMerge();
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxMMComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+// 4 documents 1 page each, starting at odd page numbers => 7
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(7), 
pTextDoc->GetDocShell()->GetWrtShell()->GetPhyPageNum());
+
+SwDoc* pDocMM = pTextDoc->GetDocShell()->GetDoc();
+sal_uLong nSizeMM = pDocMM->GetNodes().GetEndOfContent().GetIndex()
+- pDocMM->GetNodes().GetEndOfExtras().GetIndex() - 2;
+CPPUNIT_ASSERT_EQUAL(sal_uLong(16), nSizeMM);
+
+// All even pages should be empty, all sub-documents have one page
+const SwRootFrame* pLayout = 
pDocMM->getIDocumentLayoutAccess().GetCurrentLayout();
+const SwPageFrame* pPageFrm = static_cast(pLayout->Lower());
+while (pPageFrm)
+{
+sal_uInt16 nPageNum = pPageFrm->GetPhyPageNum();
+bool bOdd = (1 == (nPageNum % 2));
+CPPUNIT_ASSERT_EQUAL(!bOdd, pPageFrm->IsEmptyPage());
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(bOdd ? 1 : 2), 
pPageFrm->GetVirtPageNum());
+if (bOdd)
+{
+const SwPageDesc* pDesc = pPageFrm->GetPageDesc();
+CPPUNIT_ASSERT_EQUAL(OUString("Teststyle" + 
OUString::number(nPageNum / 2 + 1)),
+ pDesc->GetName());
+}
+pPageFrm = static_cast(pPageFrm->GetNext());
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 51f0dde9ae05..55e82e50e8f0 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1421,6 +1421,15 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* 
pSourceShell,
 // ExpFields update during printing, generation of preview, 
etc.
 pWorkShell->LockExpFields();
 pWorkShell->CalcLayout();
+// tdf#121168: Now force correct page descriptions applied to 
page frames. Without
+// this, e.g., page frames starting with sections could have 
page descriptions set
+// wrong. This would lead to wrong page styles applied in 
SwDoc::AppendDoc below.
+pWorkShell->GetViewOptions()->SetIdle(true);
+for (auto aLayout : pWorkShell->GetDoc()->GetAllLayouts())
+{
+

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

2018-07-20 Thread Libreoffice Gerrit user
 sw/qa/extras/uiwriter/data/tdf116403-considerborders.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx   |   26 +++
 sw/source/core/tox/ToxTabStopTokenHandler.cxx|5 ++
 3 files changed, 31 insertions(+)

New commits:
commit aca48fbf7b7c33ebabf6f1e479959838693e2508
Author: Mike Kaganski 
AuthorDate: Fri Mar 16 11:22:41 2018 +0300
Commit: Jan Holesovsky 
CommitDate: Fri Jul 20 12:14:42 2018 +0200

tdf#116403: consider borders when updating right-aligned tab in index

Change-Id: I415d8fcfdd75e6d608ec2e3ba228146cf8139278
Reviewed-on: https://gerrit.libreoffice.org/51388
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
(cherry picked from commit 1f3630e2fb35389835cb326a46bd539660942632)
Reviewed-on: https://gerrit.libreoffice.org/57625
Tested-by: Mike Kaganski 
Reviewed-by: Jan Holesovsky 

diff --git a/sw/qa/extras/uiwriter/data/tdf116403-considerborders.odt 
b/sw/qa/extras/uiwriter/data/tdf116403-considerborders.odt
new file mode 100644
index ..c0fb91ad7eb3
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf116403-considerborders.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index a103ab5f52a8..4ea7de52b6a7 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -305,6 +305,7 @@ public:
 void testTdf108048();
 void testTdf115132();
 void testXDrawPagesSupplier();
+void testTdf116403();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -489,6 +490,7 @@ public:
 CPPUNIT_TEST(testTdf108048);
 CPPUNIT_TEST(testTdf115132);
 CPPUNIT_TEST(testXDrawPagesSupplier);
+CPPUNIT_TEST(testTdf116403);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -5940,6 +5942,30 @@ void SwUiWriterTest::testXDrawPagesSupplier()
 xDrawPage.get(), xDrawPageFromXDrawPages.get());
 }
 
+void SwUiWriterTest::testTdf116403()
+{
+createDoc("tdf116403-considerborders.odt");
+// Check that before ToX update, the tab stop position is the old one
+uno::Reference xParagraph = getParagraph(2, "1\t1");
+auto aTabs = getProperty>(xParagraph, 
"ParaTabStops");
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aTabs.getLength());
+CPPUNIT_ASSERT_EQUAL(static_cast(17000), aTabs[0].Position);
+
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+const SwTOXBase* pTOX = pWrtShell->GetTOX(0);
+CPPUNIT_ASSERT(pTOX);
+pWrtShell->UpdateTableOf(*pTOX);
+
+xParagraph = getParagraph(2, "1\t1");
+aTabs = getProperty>(xParagraph, 
"ParaTabStops");
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aTabs.getLength());
+// This was still 17000, refreshing ToX didn't take borders spacings and 
widths into account
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Page borders must be considered for 
right-aligned tabstop",
+static_cast(17000 - 2 * 500 - 2 * 1), aTabs[0].Position);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/tox/ToxTabStopTokenHandler.cxx 
b/sw/source/core/tox/ToxTabStopTokenHandler.cxx
index 6de76cb4f2c7..3fd3abb8abb1 100644
--- a/sw/source/core/tox/ToxTabStopTokenHandler.cxx
+++ b/sw/source/core/tox/ToxTabStopTokenHandler.cxx
@@ -93,6 +93,11 @@ 
DefaultToxTabStopTokenHandler::CalculatePageMarginFromPageDescription(const SwTe
 const SwFrameFormat& rPgDscFormat = pPageDesc->GetMaster();
 long result = rPgDscFormat.GetFrameSize().GetWidth() - 
rPgDscFormat.GetLRSpace().GetLeft()
 - rPgDscFormat.GetLRSpace().GetRight();
+// Also consider borders
+const SvxBoxItem& rBox = rPgDscFormat.GetBox();
+for (SvxBoxItemLine eLine : { SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT 
})
+if (const editeng::SvxBorderLine* pBorder = rBox.GetLine(eLine))
+result -= pBorder->GetWidth() + rBox.GetDistance(eLine);
 return result;
 }
 
___
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-6.0' - sw/qa sw/source writerfilter/source

2018-07-20 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf112118.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |   32 
 sw/source/filter/ww8/docxattributeoutput.cxx   |  165 +
 sw/source/filter/ww8/docxattributeoutput.hxx   |   18 +-
 writerfilter/source/dmapper/DomainMapper.cxx   |1 
 writerfilter/source/dmapper/PageBordersHandler.cxx |   16 +-
 writerfilter/source/dmapper/PageBordersHandler.hxx |8 -
 writerfilter/source/dmapper/PropertyMap.cxx|   73 +
 writerfilter/source/dmapper/PropertyMap.hxx|   23 ++
 9 files changed, 226 insertions(+), 110 deletions(-)

New commits:
commit 0f3ba021f7a9072306beec3d279179f4bae35afc
Author: Mike Kaganski 
AuthorDate: Wed Mar 14 10:18:15 2018 +0300
Commit: Jan Holesovsky 
CommitDate: Fri Jul 20 12:13:14 2018 +0200

tdf#112118: DOCX: properly import/export border distance

https://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder
discusses implementation differences between ODF model and MS formats
wrt dealing with page margins and distances to borders.

This patch corrects import from DOCX, so that the border distance and
width doesn't add to the margin size imported from file anymore. It
takes care to preserve size from page edge to text (the most important
size that affects document layout). When borders go outside of range
valid for ODF, the margin is set to keep text area intact, and the
border is placed as close to intended position as possible.

Export code now also properly handles border width. Also, an improved
heuristic implemented to better export cases unsupported by Word, so
that the result would look closer to ODF original. We still write
correct sizes to OOXML, so that when reopened by LO, the borders will
be in correct places; but as Word cannot handle sizes more than 31 pt,
it will show borders shifted.

This prevents from adding border widths and distances to page margins
at each opening of DOCX, saving back the changed value, increasing
the margins each time.

This also backports commit 6d20aeeda8a346ac10782d44214a89878fd00c40

Change-Id: Ia978ab119dd661949d6c321aea91397f28d205b0
Reviewed-on: https://gerrit.libreoffice.org/51267
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/57703
Tested-by: Mike Kaganski 
Reviewed-by: Jan Holesovsky 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf112118.docx 
b/sw/qa/extras/ooxmlexport/data/tdf112118.docx
new file mode 100644
index ..87081d8c6dd9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf112118.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index ace8af95abc8..406bafb58c57 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -253,6 +254,37 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116801, "tdf116801.docx")
 CPPUNIT_ASSERT_EQUAL(OUString("D1"), xCell->getString());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf112118, "tdf112118.docx")
+{
+auto xStyles = getStyles("PageStyles");
+auto testProc = [&](const OUString& sStyleName, sal_Int32 nMargin, 
sal_Int32 nBorderDistance,
+sal_Int16 nBorderWidth)
+{
+typedef std::initializer_list StringList;
+uno::Reference 
xStyle(xStyles->getByName(sStyleName), uno::UNO_QUERY_THROW);
+for (const auto& side : StringList{ "Top", "Left", "Bottom", "Right" })
+{
+table::BorderLine aBorder = getProperty(xStyle, 
side + "Border");
+CPPUNIT_ASSERT_EQUAL(sal_Int16(nBorderWidth), 
aBorder.OuterLineWidth);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aBorder.InnerLineWidth);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aBorder.LineDistance);
+
+sal_Int32 nMarginActual = getProperty(xStyle, side + 
"Margin");
+CPPUNIT_ASSERT_EQUAL(nMargin, nMarginActual);
+
+sal_Int32 nBorderDistanceActual = getProperty(xStyle, 
side + "BorderDistance");
+CPPUNIT_ASSERT_EQUAL(nBorderDistance, nBorderDistanceActual);
+}
+};
+
+// For both styles used in document, the total distance from page edge to 
text must be 2.54 cm.
+// The first style uses "from edge" border distance; the second uses "from 
text" border distance
+// Border distances in both cases are 24 pt = 847 mm100; line widths are 6 
pt = 212 mm100.
+// 1482 + 847 + 212 = 2541
+testProc("Standard", 847, 1482, 212);
+testProc("Converted1", 1482, 847, 212);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b569bc25b5c3..e3419a539a5e 

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

2018-07-09 Thread Mike Kaganski
 sw/qa/extras/layout/data/tdf117923.doc |binary
 sw/qa/extras/layout/layout.cxx |   15 +++
 sw/source/filter/ww8/ww8par.cxx|3 +++
 test/source/xmltesttools.cxx   |7 ++-
 4 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit aeacbbee40de4009c60a28e39c3698eeeb85f566
Author: Mike Kaganski 
Date:   Mon Jul 2 20:31:32 2018 +1000

tdf#117923: handle direct formatting for numbering in .doc

Since commit df07d6cb9f62c0a2c4b29bd850d4efb4fcd4790b, we do for DOCX.
DOC also has this problem, so set the relevant compatibility flag on
import for this format, too.

Change-Id: I3aef593341edffa878a06566da815cb72aa38004
Reviewed-on: https://gerrit.libreoffice.org/56812
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/57048
Tested-by: Aron Budea 
Reviewed-by: Aron Budea 

diff --git a/sw/qa/extras/layout/data/tdf117923.doc 
b/sw/qa/extras/layout/data/tdf117923.doc
new file mode 100644
index ..c43cf40c9f52
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf117923.doc differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 9a73e2025147..6344a29fd1d4 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -19,11 +19,13 @@ public:
 void testTdf116830();
 void testTdf116925();
 void testTdf117028();
+void testTdf117923();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
 CPPUNIT_TEST(testTdf116925);
 CPPUNIT_TEST(testTdf117028);
+CPPUNIT_TEST(testTdf117923);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -108,6 +110,19 @@ void SwLayoutWriter::testTdf117028()
 assertXPathContent(pXmlDoc, "//textarray/text", "Hello");
 }
 
+void SwLayoutWriter::testTdf117923()
+{
+createDoc("tdf117923.doc");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+
+// Check that we actually test the line we need
+assertXPathContent(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]", "GHI 
GHI GHI GHI");
+assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", 
"nType", "POR_NUMBER");
+assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", 
"rText", "2.");
+// The numbering height was 960.
+assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", 
"nHeight", "220");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 5aebb80ee873..7e9c686b67e8 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1804,6 +1804,9 @@ void SwWW8ImplReader::ImportDop()
 m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::TAB_COMPAT, 
true);
 // #i24363# tab stops relative to indent
 
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::TABS_RELATIVE_TO_INDENT,
 false);
+// tdf#117923
+m_rDoc.getIDocumentSettingAccess().set(
+DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, true);
 
 // Import Default Tabs
 long nDefTabSiz = m_xWDop->dxaTab;
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 57baa91fe9f6..7a6f035fc986 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -88,7 +88,12 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, 
const OString& rXPath)
 xmlXPathNodeSetGetLength(pXmlNodes) > 0);
 
 xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
-OUString s(convert((pXmlNode->children[0]).content));
+xmlNodePtr pXmlChild = pXmlNode->children;
+OUString s;
+while (pXmlChild && pXmlChild->type != XML_TEXT_NODE)
+pXmlChild = pXmlChild->next;
+if (pXmlChild && pXmlChild->type == XML_TEXT_NODE)
+s = convert(pXmlChild->content);
 xmlXPathFreeObject(pXmlObj);
 return s;
 }
___
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-6.0' - sw/qa sw/source

2018-07-06 Thread Justin Luth
 sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt |binary
 sw/qa/extras/ww8export/ww8export2.cxx  |   12 
 sw/source/filter/ww8/wrtw8esh.cxx  |3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 2a832bacd7e7945c16e4473626811472458de9bc
Author: Justin Luth 
Date:   Thu Jun 28 15:48:40 2018 +0300

tdf#118421 ww8export: rotate vertically: not Lines or groups

Lines and Groups often are exceptions.
Normally, the import code swaps vertical rotations also. In the case
of lines (from the tests that I observed) lines don't have a rotation
value at that point during import, so no correction is made.
Grouping always messes things up.

Change-Id: I344c5a29f887294b751ffc87c01b30e472cfb4c2
Reviewed-on: https://gerrit.libreoffice.org/56595
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/56860
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 
Reviewed-by: Aron Budea 

diff --git a/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt 
b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt
new file mode 100644
index ..556f2564c7a2
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index f7cf692a4860..7a7dcf7e8db1 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -302,6 +302,18 @@ DECLARE_WW8EXPORT_TEST(testTdf70838, "tdf70838.odt")
 CPPUNIT_ASSERT( aRect.GetHeight() > aRect.GetWidth() );
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf70838b_verticalRotation, 
"tdf70838b_verticalRotation.odt")
+{
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+SdrPage* pPage = 
pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+tools::Rectangle aGroupShape = pPage->GetObj(0)->GetSnapRect();
+tools::Rectangle aLine = pPage->GetObj(2)->GetSnapRect();
+
+CPPUNIT_ASSERT_MESSAGE("Smiley faces are round", aGroupShape.GetHeight() > 
aGroupShape.GetWidth());
+CPPUNIT_ASSERT_MESSAGE("Line is taller, not wider", aLine.GetHeight() > 
aLine.GetWidth());
+}
+
 DECLARE_WW8EXPORT_TEST( testActiveXCheckbox, "checkbox_control.odt" )
 {
 // First check box anchored as a floating object
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index dd74436c6bf6..0ae92a2aec2d 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -691,7 +691,8 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
 
 // rotating to vertical means swapping height and width as 
seen in SvxMSDffManager::ImportShape
 const long nAngle = NormAngle360( pObj->GetRotateAngle() );
-if ( ( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 
22500 && nAngle <= 31500 ) )
+const bool bAllowSwap = pObj->GetObjIdentifier() != 
OBJ_LINE && pObj->GetObjIdentifier() != OBJ_GRUP;
+if ( bAllowSwap && (( nAngle > 4500 && nAngle <= 13500 ) 
|| ( nAngle > 22500 && nAngle <= 31500 )) )
 {
 const long nWidth  = aRect.getWidth();
 const long nHeight = aRect.getHeight();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits