[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sw/source

2021-01-06 Thread Bakos Attila (via logerrit)
 sw/source/core/doc/DocumentLayoutManager.cxx |3 -
 sw/source/core/doc/textboxhelper.cxx |   60 +--
 sw/source/core/frmedt/fefly1.cxx |4 +
 3 files changed, 54 insertions(+), 13 deletions(-)

New commits:
commit b3097f355b755ded53058ae8a104af08a3f24452
Author: Bakos Attila 
AuthorDate: Thu Jul 16 16:56:33 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Jan 6 11:36:21 2021 +0100

tdf#107225 tdf#122887 sw: fix reanchoring of textboxes

This commit fixes the following commits:
-tdf#130805 SwTextBoxHelper::create:
 fix frame position in shape
 (2479ae3ee20fc5f3cbb0c88eb09110a36e86710c)
-tdf#130802 SwTextBoxHelper::syncFlyFrameAttr:
 fix dragging
 (c1c93987acbb83d8352656d77ee515e98c63d46b)

Change-Id: I31abf364549778a4bbd3c4effc84df7d8b59d9e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98915
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit fd88bb81236ad6d1a63436b7ce20f2f93410d359)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108855
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index 8d5cc79dc648..7df5d2871f91 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -472,7 +472,8 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
 boxAnchor.SetType(RndStdIds::FLY_AT_CHAR);
 }
 // presumably these anchors are supported though not sure
-assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || 
RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId());
+assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || 
RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId()
+|| boxAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE);
 SwFrameFormat* pDestTextBox = CopyLayoutFormat(*pSourceTextBox,
 boxAnchor, bSetTextFlyAtt, bMakeFrames);
 SwAttrSet aSet(pDest->GetAttrSet());
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 9a2cc95dc0d7..d00d039647d4 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -142,6 +142,36 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
 text::WritingMode eMode;
 if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= 
eMode)
 syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode)));
+
+const SwFormatAnchor& rAnch = pShape->GetAnchor();
+if ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE && rAnch.GetPageNum() 
!= 0)
+|| ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA
+ || rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
+&& rAnch.GetContentAnchor()))
+{
+SfxItemSet aTxFrmSet(pFormat->GetDoc()->GetAttrPool(), 
aFrameFormatSetRange);
+SwFormatAnchor aNewAnch = pFormat->GetAnchor();
+
+if (pShape->GetAnchor().GetContentAnchor())
+aNewAnch.SetAnchor(pShape->GetAnchor().GetContentAnchor());
+if (pShape->GetAnchor().GetPageNum() > 0)
+aNewAnch.SetPageNum(pShape->GetAnchor().GetPageNum());
+
+aNewAnch.SetType(pShape->GetAnchor().GetAnchorId());
+aTxFrmSet.Put(aNewAnch);
+
+SwFormatVertOrient aVOri(pFormat->GetVertOrient());
+SwFormatHoriOrient aHOri(pFormat->GetHoriOrient());
+aVOri.SetVertOrient(pShape->GetVertOrient().GetVertOrient());
+aHOri.SetHoriOrient(pShape->GetHoriOrient().GetHoriOrient());
+aVOri.SetRelationOrient(pShape->GetVertOrient().GetRelationOrient());
+aHOri.SetRelationOrient(pShape->GetHoriOrient().GetRelationOrient());
+aTxFrmSet.Put(aVOri);
+aTxFrmSet.Put(aHOri);
+
+if (aTxFrmSet.Count())
+pFormat->SetFormatAttr(aTxFrmSet);
+}
 }
 
 void SwTextBoxHelper::destroy(SwFrameFormat* pShape)
@@ -682,14 +712,22 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
 
 SfxItemIter aIter(rSet);
 const SfxPoolItem* pItem = aIter.GetCurItem();
+
+const RndStdIds aAnchId = rShape.GetAnchor().GetAnchorId();
+if ((aAnchId == RndStdIds::FLY_AT_PAGE && 
rShape.GetAnchor().GetPageNum() != 0)
+|| ((aAnchId == RndStdIds::FLY_AT_PARA || aAnchId == 
RndStdIds::FLY_AT_CHAR)
+&& rShape.GetAnchor().GetContentAnchor()))
+{
+SwFormatAnchor aNewAnch = pFormat->GetAnchor();
+if (rShape.GetAnchor().GetContentAnchor())
+aNewAnch.SetAnchor(rShape.GetAnchor().GetContentAnchor());
+if (rShape.GetAnchor().GetPageNum() > 0)
+aNewAnch.SetPageNum(rShape.GetAnchor().GetPageNum());
+aNewAnch.SetType(rShape.GetAnchor().GetAnchorId());
+aTextBoxSet.Put(aNewAnch);
+}
   

[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sw/qa writerfilter/source

2021-01-05 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf118701.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx|5 +
 writerfilter/source/dmapper/DomainMapper.cxx  |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   16 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 +
 5 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 7214899e06143966564b036b49c18ab5c6fb9d73
Author: Bakos Attila 
AuthorDate: Tue Jun 30 15:03:31 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Jan 5 19:10:43 2021 +0100

tdf#118701 DOCX import: fix image position on page break

If an image anchored to an empty paragraph only with
section properties, don't remove that paragraph to keep
the image on the page before the page break.

IsLastParaEmpty() tries to move a text cursor over the
empty paragraph marked for deletion. If it contains an
image anchored as a character, the cursor won't reach
the end of the previous paragraph by goLeft(2).

Co-authored-by: Attila Bánhegyi (NISZ)

Change-Id: Ic22c7553948eb06739232d7e35fc49ad14f96518
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97518
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit b216fc5b583050cfb1cdf9bd82ec3c1bd2e09d70)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108724
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf118701.docx 
b/sw/qa/extras/ooxmlexport/data/tdf118701.docx
new file mode 100644
index ..654a22709919
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf118701.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 1fd8ad4a7d84..7bc5d9c49d12 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -46,6 +46,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf14_followPgStyle, 
"tdf14_followPgStyle.o
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf118701, "tdf118701.docx")
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE("At least one paragraph is missing from the 
file!", 3, getParagraphs());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, 
"tdf133370_columnBreak.odt")
 {
 // Since non-DOCX formats ignores column breaks in non-column situtations, 
don't export to docx.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 76fc96b9f56c..2cc14b6b11ea 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3525,7 +3525,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 }
 m_pImpl->SetParaSectpr(false);
 finishParagraph(bRemove);
-if (bRemove)
+if (bRemove && m_pImpl->IsLastParaEmpty())
 m_pImpl->RemoveLastParagraph();
 }
 else
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 12aa623de2b2..a1e33965a278 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -479,6 +479,22 @@ void DomainMapper_Impl::AddDummyParaForTableInSection()
 }
 }
 
+bool DomainMapper_Impl::IsLastParaEmpty()
+{
+bool bRet = true;
+if (!m_aTextAppendStack.empty() && m_aTextAppendStack.top().xTextAppend)
+{
+//creating cursor for finding text content
+uno::Reference xCursor = 
m_aTextAppendStack.top().xTextAppend->createTextCursor();
+xCursor->gotoEnd(false);
+//selecting the last 2 characters in the document
+xCursor->goLeft(2, true);
+//the last paragraph is empty, if they are newlines
+bRet = 
xCursor->getString().match(OUString(SAL_NEWLINE_STRING).concat(SAL_NEWLINE_STRING));
+}
+return bRet;
+}
+
 void DomainMapper_Impl::RemoveLastParagraph( )
 {
 if (m_bDiscardHeaderFooter)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index dc0693ecae6e..5c4cc16f3549 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -626,6 +626,7 @@ public:
 
 void RemoveDummyParaForTableInSection();
 void AddDummyParaForTableInSection();
+bool IsLastParaEmpty();
 void RemoveLastParagraph( );
 void SetIsLastParagraphInSection( bool bIsLast );
 bool GetIsLastParagraphInSection() const { return m_bIsLastParaInSection;}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/source

2020-10-16 Thread Bakos Attila (via logerrit)
 sw/source/uibase/shells/drwbassh.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit d7b67e6fe3e449c8c5b95a57d8cc7b9ca70c7a99
Author: Bakos Attila 
AuthorDate: Mon Jul 20 14:30:39 2020 +0200
Commit: Michael Stahl 
CommitDate: Fri Oct 16 11:07:51 2020 +0200

tdf#124430 Writer Editing: Fix textbox aligning

Before, when align function was used the textboxes
(shape+frame) went apart, now the textframe follows
the shape.

Co-authored-by: Attila Bánhegyi (NISZ)
Change-Id: I4d69a2f7f4e5ef50d17bb0871c501d6e0026d0e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99048
Reviewed-by: Attila Bakos 
Reviewed-by: László Németh 
Tested-by: Jenkins
Tested-by: László Németh 
(cherry picked from commit 06fd06597796d9e92117602245f3968c93707708)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102769
Reviewed-by: Michael Stahl 

diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index bccbe313bdf9..c707b803736b 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -478,6 +479,8 @@ void SwDrawBaseShell::Execute(SfxRequest const )
 SwFormatHoriOrient 
aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
 aHOrient.SetHoriOrient( nHorizOrient );
 pFrameFormat->SetFormatAttr(aHOrient);
+if (auto pTxFrm = 
SwTextBoxHelper::getOtherTextBoxFormat(pFrameFormat, RES_DRAWFRMFMT))
+pTxFrm->SetFormatAttr(aHOrient);
 pSh->EndAction();
 }
 
@@ -489,6 +492,8 @@ void SwDrawBaseShell::Execute(SfxRequest const )
 SwFormatVertOrient 
aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
 aVOrient.SetVertOrient( nVertOrient );
 pFrameFormat->SetFormatAttr(aVOrient);
+if (auto pTxFrm = 
SwTextBoxHelper::getOtherTextBoxFormat(pFrameFormat, RES_DRAWFRMFMT))
+pTxFrm->SetFormatAttr(aVOrient);
 pSh->EndAction();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/source

2020-09-17 Thread Bakos Attila (via logerrit)
 sw/source/core/doc/DocumentLayoutManager.cxx |3 -
 sw/source/core/doc/textboxhelper.cxx |   60 +--
 sw/source/core/frmedt/fefly1.cxx |4 +
 3 files changed, 54 insertions(+), 13 deletions(-)

New commits:
commit 0fc835f5d9effe1b53b563583adda879b83f1d2a
Author: Bakos Attila 
AuthorDate: Thu Jul 16 16:56:33 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Sep 17 08:50:28 2020 +0200

tdf#107225 tdf#122887 sw: fix reanchoring of textboxes

This commit fixes the following commits:
-tdf#130805 SwTextBoxHelper::create:
 fix frame position in shape
 (2479ae3ee20fc5f3cbb0c88eb09110a36e86710c)
-tdf#130802 SwTextBoxHelper::syncFlyFrameAttr:
 fix dragging
 (c1c93987acbb83d8352656d77ee515e98c63d46b)

Change-Id: I31abf364549778a4bbd3c4effc84df7d8b59d9e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98915
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit fd88bb81236ad6d1a63436b7ce20f2f93410d359)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102767
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index 67875e86efbb..4d594165ca3c 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -470,7 +470,8 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
 boxAnchor.SetType(RndStdIds::FLY_AT_CHAR);
 }
 // presumably these anchors are supported though not sure
-assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || 
RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId());
+assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || 
RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId()
+|| boxAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE);
 SwFrameFormat* pDestTextBox = CopyLayoutFormat(*pSourceTextBox,
 boxAnchor, bSetTextFlyAtt, bMakeFrames);
 SwAttrSet aSet(pDest->GetAttrSet());
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 34aed05a1fcf..e9ca4e46a219 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -141,6 +141,36 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
 text::WritingMode eMode;
 if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= 
eMode)
 syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode)));
+
+const SwFormatAnchor& rAnch = pShape->GetAnchor();
+if ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE && rAnch.GetPageNum() 
!= 0)
+|| ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA
+ || rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
+&& rAnch.GetContentAnchor()))
+{
+SfxItemSet aTxFrmSet(pFormat->GetDoc()->GetAttrPool(), 
aFrameFormatSetRange);
+SwFormatAnchor aNewAnch = pFormat->GetAnchor();
+
+if (pShape->GetAnchor().GetContentAnchor())
+aNewAnch.SetAnchor(pShape->GetAnchor().GetContentAnchor());
+if (pShape->GetAnchor().GetPageNum() > 0)
+aNewAnch.SetPageNum(pShape->GetAnchor().GetPageNum());
+
+aNewAnch.SetType(pShape->GetAnchor().GetAnchorId());
+aTxFrmSet.Put(aNewAnch);
+
+SwFormatVertOrient aVOri(pFormat->GetVertOrient());
+SwFormatHoriOrient aHOri(pFormat->GetHoriOrient());
+aVOri.SetVertOrient(pShape->GetVertOrient().GetVertOrient());
+aHOri.SetHoriOrient(pShape->GetHoriOrient().GetHoriOrient());
+aVOri.SetRelationOrient(pShape->GetVertOrient().GetRelationOrient());
+aHOri.SetRelationOrient(pShape->GetHoriOrient().GetRelationOrient());
+aTxFrmSet.Put(aVOri);
+aTxFrmSet.Put(aHOri);
+
+if (aTxFrmSet.Count())
+pFormat->SetFormatAttr(aTxFrmSet);
+}
 }
 
 void SwTextBoxHelper::destroy(SwFrameFormat* pShape)
@@ -685,14 +715,22 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
 
 SfxItemIter aIter(rSet);
 const SfxPoolItem* pItem = aIter.GetCurItem();
+
+const RndStdIds aAnchId = rShape.GetAnchor().GetAnchorId();
+if ((aAnchId == RndStdIds::FLY_AT_PAGE && 
rShape.GetAnchor().GetPageNum() != 0)
+|| ((aAnchId == RndStdIds::FLY_AT_PARA || aAnchId == 
RndStdIds::FLY_AT_CHAR)
+&& rShape.GetAnchor().GetContentAnchor()))
+{
+SwFormatAnchor aNewAnch = pFormat->GetAnchor();
+if (rShape.GetAnchor().GetContentAnchor())
+aNewAnch.SetAnchor(rShape.GetAnchor().GetContentAnchor());
+if (rShape.GetAnchor().GetPageNum() > 0)
+aNewAnch.SetPageNum(rShape.GetAnchor().GetPageNum());
+aNewAnch.SetType(rShape.GetAnchor().GetAnchorId());
+aTextBoxSet.Put(aNewAnch);
+}
  

[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/source

2020-09-16 Thread Bakos Attila (via logerrit)
 sw/source/uibase/shells/drwbassh.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 0f8f643ada57b66f4868c13457b610aab35a6a0a
Author: Bakos Attila 
AuthorDate: Mon Jul 20 14:30:39 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Sep 16 23:16:55 2020 +0200

tdf#124430 Writer Editing: Fix textbox aligning

Before, when align function was used the textboxes
(shape+frame) went apart, now the textframe follows
the shape.

Co-dev: Attila Bánhegyi (NISZ)
Change-Id: I4d69a2f7f4e5ef50d17bb0871c501d6e0026d0e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99048
Reviewed-by: Attila Bakos 
Reviewed-by: László Németh 
Tested-by: Jenkins
Tested-by: László Németh 
(cherry picked from commit 06fd06597796d9e92117602245f3968c93707708)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102768
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index 12d87bab691b..ba966feefccc 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -62,6 +62,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -487,6 +488,8 @@ void SwDrawBaseShell::Execute(SfxRequest const )
 SwFormatHoriOrient 
aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
 aHOrient.SetHoriOrient( nHorizOrient );
 pFrameFormat->SetFormatAttr(aHOrient);
+if (auto pTxFrm = 
SwTextBoxHelper::getOtherTextBoxFormat(pFrameFormat, RES_DRAWFRMFMT))
+pTxFrm->SetFormatAttr(aHOrient);
 pSh->EndAction();
 }
 
@@ -498,6 +501,8 @@ void SwDrawBaseShell::Execute(SfxRequest const )
 SwFormatVertOrient 
aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
 aVOrient.SetVertOrient( nVertOrient );
 pFrameFormat->SetFormatAttr(aVOrient);
+if (auto pTxFrm = 
SwTextBoxHelper::getOtherTextBoxFormat(pFrameFormat, RES_DRAWFRMFMT))
+pTxFrm->SetFormatAttr(aVOrient);
 pSh->EndAction();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa writerfilter/source

2020-09-15 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf118701.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|5 +
 writerfilter/source/dmapper/DomainMapper.cxx  |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   16 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 +
 5 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit d8b5dbc8be757ef64b4d09dd1a72cb52c11d6d10
Author: Bakos Attila 
AuthorDate: Tue Jun 30 15:03:31 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Sep 15 13:27:44 2020 +0200

tdf#118701 DOCX import: fix image position on page break

If an image anchored to an empty paragraph only with
section properties, don't remove that paragraph to keep
the image on the page before the page break.

IsLastParaEmpty() tries to move a text cursor over the
empty paragraph marked for deletion. If it contains an
image anchored as a character, the cursor won't reach
the end of the previous paragraph by goLeft(2).

Co-authored-by: Attila Bánhegyi (NISZ)

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97518
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit b216fc5b583050cfb1cdf9bd82ec3c1bd2e09d70)

Change-Id: Ic22c7553948eb06739232d7e35fc49ad14f96518
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102563
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf118701.docx 
b/sw/qa/extras/ooxmlexport/data/tdf118701.docx
new file mode 100644
index ..654a22709919
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf118701.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 92d2d7869662..8ec18a49eb4a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -466,6 +466,11 @@ DECLARE_OOXMLIMPORT_TEST(TestTdf132483, "tdf132483.docx")
 text::RelOrientation::PAGE_FRAME , nHRelPos);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf118701, "tdf118701.docx")
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE("At least one paragraph is missing from the 
file!", 3, getParagraphs());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index ec3809cd291a..3339bb27e220 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3475,7 +3475,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 }
 m_pImpl->SetParaSectpr(false);
 finishParagraph(bRemove);
-if (bRemove)
+if (bRemove && m_pImpl->IsLastParaEmpty())
 m_pImpl->RemoveLastParagraph();
 }
 else
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6e6a074dad43..b77428a35f53 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -477,6 +477,22 @@ void DomainMapper_Impl::AddDummyParaForTableInSection()
 }
 }
 
+bool DomainMapper_Impl::IsLastParaEmpty()
+{
+bool bRet = true;
+if (!m_aTextAppendStack.empty() && m_aTextAppendStack.top().xTextAppend)
+{
+//creating cursor for finding text content
+uno::Reference xCursor = 
m_aTextAppendStack.top().xTextAppend->createTextCursor();
+xCursor->gotoEnd(false);
+//selecting the last 2 characters in the document
+xCursor->goLeft(2, true);
+//the last paragraph is empty, if they are newlines
+bRet = 
xCursor->getString().match(OUString(SAL_NEWLINE_STRING).concat(SAL_NEWLINE_STRING));
+}
+return bRet;
+}
+
 void DomainMapper_Impl::RemoveLastParagraph( )
 {
 if (m_bDiscardHeaderFooter)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 7291973be2a1..9eef8dbee58d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -619,6 +619,7 @@ public:
 
 void RemoveDummyParaForTableInSection();
 void AddDummyParaForTableInSection();
+bool IsLastParaEmpty();
 void RemoveLastParagraph( );
 void SetIsLastParagraphInSection( bool bIsLast );
 bool GetIsLastParagraphInSection() const { return m_bIsLastParaInSection;}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-15 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf132483.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx|   14 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit e48eb426bbef20b9f5646d3fe3978a6f476be5cb
Author: Bakos Attila 
AuthorDate: Fri Jul 10 12:42:11 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 15 10:22:56 2020 +0200

tdf#132483: DOCX import: fix OLE anchoring position

The relative orientation of OLE objects was
not copied from the replacement object to
OLE, resulting bad position.

Co-authored-by: Attila Bánhegyi (NISZ)

Change-Id: If62124e5a40218a224e047efbe86a09606b44af5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98493
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 54031e6a2912ebe723b4423b5d737c13c9bb03c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102565
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf132483.docx 
b/sw/qa/extras/ooxmlexport/data/tdf132483.docx
new file mode 100644
index ..e4ebf4b78511
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132483.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index f17d9ad3f668..792e919394b7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
 
@@ -178,6 +179,19 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter,
 CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight);
 }
 
+DECLARE_OOXMLIMPORT_TEST(TestTdf132483, "tdf132483.docx")
+{
+uno::Reference xOLEProps(getShape(1), 
uno::UNO_QUERY_THROW);
+sal_Int16 nVRelPos = -1;
+sal_Int16 nHRelPos = -1;
+xOLEProps->getPropertyValue("VertOrientRelation") >>= nVRelPos;
+xOLEProps->getPropertyValue("HoriOrientRelation") >>= nHRelPos;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted vertically",
+text::RelOrientation::PAGE_FRAME , nVRelPos);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted horizontally",
+text::RelOrientation::PAGE_FRAME , nHRelPos);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter,
  
"tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx")
 {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0f468e43937e..3c6d165facb6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2228,7 +2228,9 @@ void DomainMapper_Impl::appendOLE( const OUString& 
rStreamName, const std::share
 OUString("HoriOrient"),
 OUString("HoriOrientPosition"),
 OUString("VertOrient"),
-OUString("VertOrientPosition")
+OUString("VertOrientPosition"),
+OUString("VertOrientRelation"),
+OUString("HoriOrientRelation")
 };
 for (const OUString & s : pProperties)
 xOLEProperties->setPropertyValue(s, 
xReplacementProperties->getPropertyValue(s));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa writerfilter/source

2020-09-13 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf132483.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   13 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +++-
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit a7d8293072b157438c2881c4a866d78b0ca72422
Author: Bakos Attila 
AuthorDate: Fri Jul 10 12:42:11 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Sun Sep 13 21:28:04 2020 +0200

tdf#132483: DOCX import: fix OLE anchoring position

The relative orientation of OLE objects was
not copied from the replacement object to
OLE, resulting bad position.

Co-authored-by: Attila Bánhegyi (NISZ)

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98493
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 54031e6a2912ebe723b4423b5d737c13c9bb03c5)

Change-Id: If62124e5a40218a224e047efbe86a09606b44af5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102566
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf132483.docx 
b/sw/qa/extras/ooxmlexport/data/tdf132483.docx
new file mode 100644
index ..e4ebf4b78511
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132483.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 18c2648becd3..92d2d7869662 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -453,6 +453,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131539, 
"tdf131539.odt")
 CPPUNIT_ASSERT(aXmlVal.indexOf("margin-left:139.95")>-1);
 }
 
+DECLARE_OOXMLIMPORT_TEST(TestTdf132483, "tdf132483.docx")
+{
+uno::Reference xOLEProps(getShape(1), 
uno::UNO_QUERY_THROW);
+sal_Int16 nVRelPos = -1;
+sal_Int16 nHRelPos = -1;
+xOLEProps->getPropertyValue("VertOrientRelation") >>= nVRelPos;
+xOLEProps->getPropertyValue("HoriOrientRelation") >>= nHRelPos;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted vertically",
+text::RelOrientation::PAGE_FRAME , nVRelPos);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted horizontally",
+text::RelOrientation::PAGE_FRAME , nHRelPos);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c882ac586745..6e6a074dad43 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2062,7 +2062,9 @@ void DomainMapper_Impl::appendOLE( const OUString& 
rStreamName, const std::share
 OUString("HoriOrient"),
 OUString("HoriOrientPosition"),
 OUString("VertOrient"),
-OUString("VertOrientPosition")
+OUString("VertOrientPosition"),
+OUString("VertOrientRelation"),
+OUString("HoriOrientRelation")
 };
 for (const OUString & s : pProperties)
 xOLEProperties->setPropertyValue(s, 
xReplacementProperties->getPropertyValue(s));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa sw/source

2020-07-28 Thread Bakos Attila (via logerrit)
 sw/qa/extras/layout/data/tdf134277.docx |binary
 sw/qa/extras/layout/layout.cxx  |   18 ++
 sw/source/core/layout/tabfrm.cxx|   11 ---
 3 files changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 979e10a2c5b1b085e28757f7b40682cce9672a20
Author: Bakos Attila 
AuthorDate: Fri Jun 26 13:05:22 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Jul 28 13:17:07 2020 +0200

tdf#134277 sw table: fix lagging shape at page break

Shapes anchored to characters in table cells didn't follow
their cells at page break, resulting lonely shapes at the end
of the previous page.

Co-authored-by: Attila Bánhegyi (NISZ)

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97209
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 117011cf10032e6ca93a8d502f794deb16c13a8f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97674
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 
(cherry picked from commit 7842038e2ddbc9c1596fb732f5fb555b1c2ffdf0)

Change-Id: I2149ef58696a8f5dc6f41959060d2d57f938d025
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99547
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/layout/data/tdf134277.docx 
b/sw/qa/extras/layout/data/tdf134277.docx
new file mode 100644
index ..cf4ecfbb1caa
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134277.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index c23672f9e562..fc3115da74c6 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1131,6 +1131,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277)
+{
+SwDoc* pDoc = createDoc("tdf134277.docx");
+CPPUNIT_ASSERT(pDoc);
+SwDocShell* pShell = pDoc->GetDocShell();
+
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+
+xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"/metafile/push/push/push/layoutmode[2]");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Bad position of shape in page break!", 0,
+ xmlXPathNodeSetGetLength(pXmlNodes));
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
 {
 loadURL("private:factory/swriter", nullptr);
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index a75a250c7fc9..f2c11d1c68e3 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3841,11 +3841,16 @@ long CalcHeightWithFlys( const SwFrame *pFrame )
 // the text flow have to be considered.
 const SwFrameFormat& rFrameFormat = 
pAnchoredObj->GetFrameFormat();
 bool bFollowTextFlow = 
rFrameFormat.GetFollowTextFlow().GetValue();
+bool bIsFarAway = pAnchoredObj->GetObjRect().Top() != 
FAR_AWAY;
+const SwPageFrame* pPageFrm = pTmp->FindPageFrame();
+bool bIsAnchoredToTmpFrm = false;
+if ( pPageFrm && pPageFrm->IsPageFrame() && 
pAnchoredObj->GetPageFrame())
+bIsAnchoredToTmpFrm = pAnchoredObj->GetPageFrame() == 
pPageFrm ||
+(pPageFrm->GetFormatPage().GetPhyPageNum() == 
pAnchoredObj->GetPageFrame()->GetFormatPage().GetPhyPageNum() + 1);
 const bool bConsiderObj =
 (rFrameFormat.GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR) &&
-pAnchoredObj->GetObjRect().Top() != FAR_AWAY &&
-bFollowTextFlow &&
-pAnchoredObj->GetPageFrame() == 
pTmp->FindPageFrame();
+bIsFarAway &&
+bFollowTextFlow && bIsAnchoredToTmpFrm;
 bool bWrapThrough = rFrameFormat.GetSurround().GetValue() 
== text::WrapTextMode_THROUGH;
 if (pFrame->IsInTab() && bFollowTextFlow && bWrapThrough)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2020-07-27 Thread Bakos Attila (via logerrit)
 sw/source/uibase/shells/drwbassh.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 06fd06597796d9e92117602245f3968c93707708
Author: Bakos Attila 
AuthorDate: Mon Jul 20 14:30:39 2020 +0200
Commit: László Németh 
CommitDate: Mon Jul 27 11:56:23 2020 +0200

tdf#124430 Writer Editing: Fix textbox aligning

Before, when align function was used the textboxes
(shape+frame) went apart, now the textframe follows
the shape.

Co-dev: Attila Bánhegyi (NISZ)
Change-Id: I4d69a2f7f4e5ef50d17bb0871c501d6e0026d0e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99048
Reviewed-by: Attila Bakos 
Reviewed-by: László Németh 
Tested-by: Jenkins
Tested-by: László Németh 

diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index bccbe313bdf9..c707b803736b 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -478,6 +479,8 @@ void SwDrawBaseShell::Execute(SfxRequest const )
 SwFormatHoriOrient 
aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
 aHOrient.SetHoriOrient( nHorizOrient );
 pFrameFormat->SetFormatAttr(aHOrient);
+if (auto pTxFrm = 
SwTextBoxHelper::getOtherTextBoxFormat(pFrameFormat, RES_DRAWFRMFMT))
+pTxFrm->SetFormatAttr(aHOrient);
 pSh->EndAction();
 }
 
@@ -489,6 +492,8 @@ void SwDrawBaseShell::Execute(SfxRequest const )
 SwFormatVertOrient 
aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
 aVOrient.SetVertOrient( nVertOrient );
 pFrameFormat->SetFormatAttr(aVOrient);
+if (auto pTxFrm = 
SwTextBoxHelper::getOtherTextBoxFormat(pFrameFormat, RES_DRAWFRMFMT))
+pTxFrm->SetFormatAttr(aVOrient);
 pSh->EndAction();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2020-07-23 Thread Bakos Attila (via logerrit)
 sw/source/core/doc/DocumentLayoutManager.cxx |3 -
 sw/source/core/doc/textboxhelper.cxx |   60 +--
 sw/source/core/frmedt/fefly1.cxx |4 +
 3 files changed, 54 insertions(+), 13 deletions(-)

New commits:
commit fd88bb81236ad6d1a63436b7ce20f2f93410d359
Author: Bakos Attila 
AuthorDate: Thu Jul 16 16:56:33 2020 +0200
Commit: László Németh 
CommitDate: Thu Jul 23 17:28:00 2020 +0200

tdf#107225 tdf#122887 sw: fix reanchoring of textboxes

This commit fixes the following commits:
-tdf#130805 SwTextBoxHelper::create:
 fix frame position in shape
 (2479ae3ee20fc5f3cbb0c88eb09110a36e86710c)
-tdf#130802 SwTextBoxHelper::syncFlyFrameAttr:
 fix dragging
 (c1c93987acbb83d8352656d77ee515e98c63d46b)

Change-Id: I31abf364549778a4bbd3c4effc84df7d8b59d9e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98915
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index 57f8af08920b..a582fddaa1cb 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -471,7 +471,8 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
 boxAnchor.SetType(RndStdIds::FLY_AT_CHAR);
 }
 // presumably these anchors are supported though not sure
-assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || 
RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId());
+assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || 
RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId()
+|| boxAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE);
 SwFrameFormat* pDestTextBox = CopyLayoutFormat(*pSourceTextBox,
 boxAnchor, bSetTextFlyAtt, bMakeFrames);
 SwAttrSet aSet(pDest->GetAttrSet());
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index fb1a9f4bf764..d80440c916f5 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -141,6 +141,36 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
 text::WritingMode eMode;
 if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= 
eMode)
 syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode)));
+
+const SwFormatAnchor& rAnch = pShape->GetAnchor();
+if ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE && rAnch.GetPageNum() 
!= 0)
+|| ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA
+ || rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
+&& rAnch.GetContentAnchor()))
+{
+SfxItemSet aTxFrmSet(pFormat->GetDoc()->GetAttrPool(), 
aFrameFormatSetRange);
+SwFormatAnchor aNewAnch = pFormat->GetAnchor();
+
+if (pShape->GetAnchor().GetContentAnchor())
+aNewAnch.SetAnchor(pShape->GetAnchor().GetContentAnchor());
+if (pShape->GetAnchor().GetPageNum() > 0)
+aNewAnch.SetPageNum(pShape->GetAnchor().GetPageNum());
+
+aNewAnch.SetType(pShape->GetAnchor().GetAnchorId());
+aTxFrmSet.Put(aNewAnch);
+
+SwFormatVertOrient aVOri(pFormat->GetVertOrient());
+SwFormatHoriOrient aHOri(pFormat->GetHoriOrient());
+aVOri.SetVertOrient(pShape->GetVertOrient().GetVertOrient());
+aHOri.SetHoriOrient(pShape->GetHoriOrient().GetHoriOrient());
+aVOri.SetRelationOrient(pShape->GetVertOrient().GetRelationOrient());
+aHOri.SetRelationOrient(pShape->GetHoriOrient().GetRelationOrient());
+aTxFrmSet.Put(aVOri);
+aTxFrmSet.Put(aHOri);
+
+if (aTxFrmSet.Count())
+pFormat->SetFormatAttr(aTxFrmSet);
+}
 }
 
 void SwTextBoxHelper::destroy(SwFrameFormat* pShape)
@@ -695,14 +725,22 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
 
 SfxItemIter aIter(rSet);
 const SfxPoolItem* pItem = aIter.GetCurItem();
+
+const RndStdIds aAnchId = rShape.GetAnchor().GetAnchorId();
+if ((aAnchId == RndStdIds::FLY_AT_PAGE && 
rShape.GetAnchor().GetPageNum() != 0)
+|| ((aAnchId == RndStdIds::FLY_AT_PARA || aAnchId == 
RndStdIds::FLY_AT_CHAR)
+&& rShape.GetAnchor().GetContentAnchor()))
+{
+SwFormatAnchor aNewAnch = pFormat->GetAnchor();
+if (rShape.GetAnchor().GetContentAnchor())
+aNewAnch.SetAnchor(rShape.GetAnchor().GetContentAnchor());
+if (rShape.GetAnchor().GetPageNum() > 0)
+aNewAnch.SetPageNum(rShape.GetAnchor().GetPageNum());
+aNewAnch.SetType(rShape.GetAnchor().GetAnchorId());
+aTextBoxSet.Put(aNewAnch);
+}
 do
 {
-if (rShape.GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR)
-{
-const SwFormatAnchor& rShapeAnch = rShape.GetAnchor();
- 

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2020-07-13 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf132483.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx|   14 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 54031e6a2912ebe723b4423b5d737c13c9bb03c5
Author: Bakos Attila 
AuthorDate: Fri Jul 10 12:42:11 2020 +0200
Commit: László Németh 
CommitDate: Mon Jul 13 15:47:15 2020 +0200

tdf#132483: DOCX import: fix OLE anchoring position

The relative orientation of OLE objects was
not copied from the replacement object to
OLE, resulting bad position.

Co-authored-by: Attila Bánhegyi (NISZ)

Change-Id: If62124e5a40218a224e047efbe86a09606b44af5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98493
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf132483.docx 
b/sw/qa/extras/ooxmlexport/data/tdf132483.docx
new file mode 100644
index ..e4ebf4b78511
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132483.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 67e9a9555b24..27e2f22c2dbc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -10,6 +10,7 @@
 #include 
 
 #include 
+#include 
 
 char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
 
@@ -73,6 +74,19 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter,
 CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight);
 }
 
+DECLARE_OOXMLIMPORT_TEST(TestTdf132483, "tdf132483.docx")
+{
+uno::Reference xOLEProps(getShape(1), 
uno::UNO_QUERY_THROW);
+sal_Int16 nVRelPos = -1;
+sal_Int16 nHRelPos = -1;
+xOLEProps->getPropertyValue("VertOrientRelation") >>= nVRelPos;
+xOLEProps->getPropertyValue("HoriOrientRelation") >>= nHRelPos;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted vertically",
+text::RelOrientation::PAGE_FRAME , nVRelPos);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted horizontally",
+text::RelOrientation::PAGE_FRAME , nHRelPos);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter,
  
"tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx")
 {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 16b56a6ecae8..777006bb58de 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2249,7 +2249,9 @@ void DomainMapper_Impl::appendOLE( const OUString& 
rStreamName, const std::share
 OUString("HoriOrient"),
 OUString("HoriOrientPosition"),
 OUString("VertOrient"),
-OUString("VertOrientPosition")
+OUString("VertOrientPosition"),
+OUString("VertOrientRelation"),
+OUString("HoriOrientRelation")
 };
 for (const OUString & s : pProperties)
 xOLEProperties->setPropertyValue(s, 
xReplacementProperties->getPropertyValue(s));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa writerfilter/source

2020-07-10 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf118701.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx|5 +
 writerfilter/source/dmapper/DomainMapper.cxx  |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   16 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 +
 5 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit b216fc5b583050cfb1cdf9bd82ec3c1bd2e09d70
Author: Bakos Attila 
AuthorDate: Tue Jun 30 15:03:31 2020 +0200
Commit: László Németh 
CommitDate: Fri Jul 10 14:44:50 2020 +0200

tdf#118701 DOCX import: fix image position on page break

If an image anchored to an empty paragraph only with
section properties, don't remove that paragraph to keep
the image on the page before the page break.

IsLastParaEmpty() tries to move a text cursor over the
empty paragraph marked for deletion. If it contains an
image anchored as a character, the cursor won't reach
the end of the previous paragraph by goLeft(2).

Co-authored-by: Attila Bánhegyi (NISZ)

Change-Id: Ic22c7553948eb06739232d7e35fc49ad14f96518
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97518
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf118701.docx 
b/sw/qa/extras/ooxmlexport/data/tdf118701.docx
new file mode 100644
index ..654a22709919
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf118701.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 9c1fb2c02edf..67e9a9555b24 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -33,6 +33,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf14_followPgStyle, 
"tdf14_followPgStyle.o
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf118701, "tdf118701.docx")
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE("At least one paragraph is missing from the 
file!", 3, getParagraphs());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, 
"tdf133370_columnBreak.odt")
 {
 // Since non-DOCX formats ignores column breaks in non-column situations, 
don't export to docx.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index d07f045de806..5df7bb33b1ae 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3516,7 +3516,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 }
 m_pImpl->SetParaSectpr(false);
 finishParagraph(bRemove);
-if (bRemove)
+if (bRemove && m_pImpl->IsLastParaEmpty())
 m_pImpl->RemoveLastParagraph();
 }
 else
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 04e087fc4d30..16b56a6ecae8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -474,6 +474,22 @@ void DomainMapper_Impl::AddDummyParaForTableInSection()
 }
 }
 
+bool DomainMapper_Impl::IsLastParaEmpty()
+{
+bool bRet = true;
+if (!m_aTextAppendStack.empty() && m_aTextAppendStack.top().xTextAppend)
+{
+//creating cursor for finding text content
+uno::Reference xCursor = 
m_aTextAppendStack.top().xTextAppend->createTextCursor();
+xCursor->gotoEnd(false);
+//selecting the last 2 characters in the document
+xCursor->goLeft(2, true);
+//the last paragraph is empty, if they are newlines
+bRet = 
xCursor->getString().match(OUString(SAL_NEWLINE_STRING).concat(SAL_NEWLINE_STRING));
+}
+return bRet;
+}
+
 void DomainMapper_Impl::RemoveLastParagraph( )
 {
 if (m_bDiscardHeaderFooter)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index db0a03fa7792..e145547f3ddd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -626,6 +626,7 @@ public:
 
 void RemoveDummyParaForTableInSection();
 void AddDummyParaForTableInSection();
+bool IsLastParaEmpty();
 void RemoveLastParagraph( );
 void SetIsLastParagraphInSection( bool bIsLast );
 bool GetIsLastParagraphInSection() const { return m_bIsLastParaInSection;}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - 2 commits - sc/source sw/qa sw/source

2020-07-02 Thread Bakos Attila (via logerrit)
 sc/source/core/data/colorscale.cxx  |4 ++--
 sw/qa/extras/layout/data/tdf134277.docx |binary
 sw/qa/extras/layout/layout.cxx  |   18 ++
 sw/source/core/layout/tabfrm.cxx|   12 
 4 files changed, 28 insertions(+), 6 deletions(-)

New commits:
commit 7842038e2ddbc9c1596fb732f5fb555b1c2ffdf0
Author: Bakos Attila 
AuthorDate: Fri Jun 26 13:05:22 2020 +0200
Commit: Christian Lohmaier 
CommitDate: Thu Jul 2 21:35:00 2020 +0200

tdf#134277 sw table: fix lagging shape at page break

Shapes anchored to characters in table cells didn't follow
their cells at page break, resulting lonely shapes at the end
of the previous page.

Co-authored-by: Attila Bánhegyi (NISZ)

Change-Id: I2149ef58696a8f5dc6f41959060d2d57f938d025
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97209
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 117011cf10032e6ca93a8d502f794deb16c13a8f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97674
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sw/qa/extras/layout/data/tdf134277.docx 
b/sw/qa/extras/layout/data/tdf134277.docx
new file mode 100644
index ..cf4ecfbb1caa
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134277.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 4f9ed8ec7f6f..a1eae5558356 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1114,6 +1114,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277)
+{
+SwDoc* pDoc = createDoc("tdf134277.docx");
+CPPUNIT_ASSERT(pDoc);
+SwDocShell* pShell = pDoc->GetDocShell();
+
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"/metafile/push/push/push/layoutmode[2]");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Bad position of shape in page break!", 0,
+ xmlXPathNodeSetGetLength(pXmlNodes));
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
 {
 loadURL("private:factory/swriter", nullptr);
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index f4aed1ed650d..02bcb593e323 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1066,7 +1066,6 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool 
bTryToSplit, bool bTableRowK
 else
 bSplitRowAllowed = false;
 }
-
 // #i29438#
 // #i26945# - Floating screen objects no longer forbid
 // a splitting of the table row.
@@ -3890,11 +3889,16 @@ long CalcHeightWithFlys( const SwFrame *pFrame )
 // the text flow have to be considered.
 const SwFrameFormat& rFrameFormat = 
pAnchoredObj->GetFrameFormat();
 bool bFollowTextFlow = 
rFrameFormat.GetFollowTextFlow().GetValue();
+bool bIsFarAway = pAnchoredObj->GetObjRect().Top() != 
FAR_AWAY;
+const SwPageFrame* pPageFrm = pTmp->FindPageFrame();
+bool bIsAnchoredToTmpFrm = false;
+if ( pPageFrm && pPageFrm->IsPageFrame() && 
pAnchoredObj->GetPageFrame())
+bIsAnchoredToTmpFrm = pAnchoredObj->GetPageFrame() == 
pPageFrm ||
+(pPageFrm->GetFormatPage().GetPhyPageNum() == 
pAnchoredObj->GetPageFrame()->GetFormatPage().GetPhyPageNum() + 1);
 const bool bConsiderObj =
 (rFrameFormat.GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR) &&
-pAnchoredObj->GetObjRect().Top() != FAR_AWAY &&
-bFollowTextFlow &&
-pAnchoredObj->GetPageFrame() == 
pTmp->FindPageFrame();
+bIsFarAway &&
+bFollowTextFlow && bIsAnchoredToTmpFrm;
 bool bWrapThrough = rFrameFormat.GetSurround().GetValue() 
== text::WrapTextMode_THROUGH;
 if (pFrame->IsInTab() && bFollowTextFlow && bWrapThrough)
 {
commit 23d0bc0b948ecd22860abf247e57ac6dda82b8a1
Author: Julien Nabet 
AuthorDate: Wed Jul 1 16:47:07 2020 +0200
Commit: Christian Lohmaier 
CommitDate: Thu Jul 2 21:34:40 2020 +0200

tdf#126733: inverted emoticons sets for the conditional formatting

Change-Id: I5bd631b17c1008355c299ffceb622e6ea8c39d45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97636
(cherry picked from commit a76cb42a75b1694f20a1c95c99e3137369527dd3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97677
Tested-by: Jenkins
   

[Libreoffice-commits] core.git: sw/qa sw/source

2020-06-30 Thread Bakos Attila (via logerrit)
 sw/qa/extras/layout/data/tdf134277.docx |binary
 sw/qa/extras/layout/layout.cxx  |   18 ++
 sw/source/core/layout/tabfrm.cxx|   12 
 3 files changed, 26 insertions(+), 4 deletions(-)

New commits:
commit 117011cf10032e6ca93a8d502f794deb16c13a8f
Author: Bakos Attila 
AuthorDate: Fri Jun 26 13:05:22 2020 +0200
Commit: László Németh 
CommitDate: Tue Jun 30 22:52:40 2020 +0200

tdf#134277 sw table: fix lagging shape at page break

Shapes anchored to characters in table cells didn't follow
their cells at page break, resulting lonely shapes at the end
of the previous page.

Co-authored-by: Attila Bánhegyi (NISZ)

Change-Id: I2149ef58696a8f5dc6f41959060d2d57f938d025
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97209
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/data/tdf134277.docx 
b/sw/qa/extras/layout/data/tdf134277.docx
new file mode 100644
index ..cf4ecfbb1caa
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134277.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index c8b5665c5e00..6840d6dda2e9 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1112,6 +1112,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277)
+{
+SwDoc* pDoc = createDoc("tdf134277.docx");
+CPPUNIT_ASSERT(pDoc);
+SwDocShell* pShell = pDoc->GetDocShell();
+
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"/metafile/push/push/push/layoutmode[2]");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Bad position of shape in page break!", 0,
+ xmlXPathNodeSetGetLength(pXmlNodes));
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys)
 {
 loadURL("private:factory/swriter", nullptr);
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 2642c5018f1d..fda00cee5c3f 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1066,7 +1066,6 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool 
bTryToSplit, bool bTableRowK
 else
 bSplitRowAllowed = false;
 }
-
 // #i29438#
 // #i26945# - Floating screen objects no longer forbid
 // a splitting of the table row.
@@ -3892,11 +3891,16 @@ long CalcHeightWithFlys( const SwFrame *pFrame )
 // the text flow have to be considered.
 const SwFrameFormat& rFrameFormat = 
pAnchoredObj->GetFrameFormat();
 bool bFollowTextFlow = 
rFrameFormat.GetFollowTextFlow().GetValue();
+bool bIsFarAway = pAnchoredObj->GetObjRect().Top() != 
FAR_AWAY;
+const SwPageFrame* pPageFrm = pTmp->FindPageFrame();
+bool bIsAnchoredToTmpFrm = false;
+if ( pPageFrm && pPageFrm->IsPageFrame() && 
pAnchoredObj->GetPageFrame())
+bIsAnchoredToTmpFrm = pAnchoredObj->GetPageFrame() == 
pPageFrm ||
+(pPageFrm->GetFormatPage().GetPhyPageNum() == 
pAnchoredObj->GetPageFrame()->GetFormatPage().GetPhyPageNum() + 1);
 const bool bConsiderObj =
 (rFrameFormat.GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR) &&
-pAnchoredObj->GetObjRect().Top() != FAR_AWAY &&
-bFollowTextFlow &&
-pAnchoredObj->GetPageFrame() == 
pTmp->FindPageFrame();
+bIsFarAway &&
+bFollowTextFlow && bIsAnchoredToTmpFrm;
 bool bWrapThrough = rFrameFormat.GetSurround().GetValue() 
== text::WrapTextMode_THROUGH;
 if (pFrame->IsInTab() && bFollowTextFlow && bWrapThrough)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa sw/source writerfilter/source

2020-06-11 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf130120.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|9 +++
 sw/source/filter/ww8/docxsdrexport.cxx|   23 --
 sw/source/filter/ww8/ww8graf.cxx  |1 
 writerfilter/source/dmapper/GraphicImport.cxx |   14 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   19 ++
 6 files changed, 62 insertions(+), 4 deletions(-)

New commits:
commit 24aff342ae648706b2f1ff0cdf1202e2d88067d9
Author: Bakos Attila 
AuthorDate: Tue Feb 11 11:43:48 2020 +0100
Commit: Gabor Kelemen 
CommitDate: Thu Jun 11 17:29:30 2020 +0200

tdf#130120 DOCX: export o:allowincell

Object anchors are set by allowincell/
LayoutInCell attributes in table cells.
Export it by grab bag method temporarily,
instead of using the suggested FollowTextFlow,
related also to the missing GUI support.

Follow-up of commit 14ad64270e4fbca3c24da6f55f260b1fb229556a
(tdf#129888 DOCX shape import: handle o:allowincell)

Change-Id: If883511b6114e8f60d673ecbd3a11095fcafddc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88438
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit ad8857dab30e099a0cf6ec18d184a6c836b33317)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96140
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf130120.docx 
b/sw/qa/extras/ooxmlexport/data/tdf130120.docx
new file mode 100644
index ..5ca2adc76d60
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf130120.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 6561bbeb6cb8..8d347be29038 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -91,6 +91,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, 
"tdf129888dml.docx")
  text::RelOrientation::PAGE_FRAME, nValue);
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130120, "tdf130120.docx")
+{
+   //Text for exporting the allowincell attribute:
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+assertXPath(p_XmlDoc, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/"
+  "mc:Choice/w:drawing/wp:anchor","layoutInCell","0");
+}
+
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 7cacc4eb3173..1663ab98e30e 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -31,8 +31,9 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace oox;
@@ -469,7 +470,25 @@ void DocxSdrExport::startDMLAnchorInline(const 
SwFrameFormat* pFrameFormat, cons
 attrList->add(XML_distR, OString::number(nDistR).getStr());
 attrList->add(XML_simplePos, "0");
 attrList->add(XML_locked, "0");
-attrList->add(XML_layoutInCell, "1");
+bool bLclInTabCell = true;
+if (pObj)
+{
+uno::Reference 
xShape((const_cast(pObj)->getUnoShape()),
+   uno::UNO_QUERY);
+uno::Sequence propList = 
lclGetProperty(xShape, "InteropGrabBag");
+if (propList.hasElements())
+{
+auto pLclProp = std::find_if(
+std::begin(propList), std::end(propList),
+[](const beans::PropertyValue& rProp) { return rProp.Name 
== "LayoutInCell"; });
+if (pLclProp && pLclProp != propList.end())
+pLclProp->Value >>= bLclInTabCell;
+}
+}
+if (bLclInTabCell)
+attrList->add(XML_layoutInCell, "1");
+else
+attrList->add(XML_layoutInCell, "0");
 bool bAllowOverlap = 
pFrameFormat->GetWrapInfluenceOnObjPos().GetAllowOverlap();
 attrList->add(XML_allowOverlap, bAllowOverlap ? "1" : "0");
 if (pObj != nullptr)
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index a49d9dea7054..c622366bd954 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2703,7 +2703,6 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long 
nGrafAnchorCp )
 SdrObject::Free(pObject);
 return nullptr;
 }
-
 const bool bLayoutInTableCell =
 m_nInTable && IsObjectLayoutInTableCell( pRecord->nLayoutInTableCell );
 
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index a2c19383c95d..174674ae46a0 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ 

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

2020-03-04 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf123873.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   10 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 ++
 3 files changed, 12 insertions(+)

New commits:
commit 612a8bd9cfda531b6c610118f7c3b22fef047e83
Author: Bakos Attila 
AuthorDate: Thu Feb 6 12:01:17 2020 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Wed Mar 4 10:55:32 2020 +0100

tdf#123873 DOCX IMPORT: fix unhandled textwrap for objects

The OLE objects (in this case charts) had bad wrap option setting
and this lead to misplaced objects. Now this parameter is set
according to the file.

Change-Id: I506be91b6801f0ffc3942e514f81119d895fdcb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88091
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit affe9c8384475fc85027703332bc0f1b36eaa0a6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89908
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf123873.docx 
b/sw/qa/extras/ooxmlexport/data/tdf123873.docx
new file mode 100644
index ..b1de7f71f75a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123873.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 2365be2a5984..5c1bdc0582b9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -43,6 +43,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, 
"tdf128207.docx")
 assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123873, "tdf123873.docx")
+{
+//OLE Object were overlapped due to missing wrap import
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(p_XmlDoc);
+assertXPath(
+p_XmlDoc, 
"/w:document/w:body/w:p[2]/w:r[2]/w:drawing/wp:anchor/wp:wrapTopAndBottom");
+}
+
+
 DECLARE_OOXMLIMPORT_TEST(testTdf129888vml, "tdf129888vml.docx")
 {
 //the line shape has anchor in the first cell however it has to
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fc189d7dcf9d..8e13daa08efb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6142,6 +6142,8 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 xEmbeddedProps->setPropertyValue("VertOrient", 
xShapeProps->getPropertyValue("VertOrient"));
 xEmbeddedProps->setPropertyValue("VertOrientPosition", 
xShapeProps->getPropertyValue("VertOrientPosition"));
 xEmbeddedProps->setPropertyValue("VertOrientRelation", 
xShapeProps->getPropertyValue("VertOrientRelation"));
+//tdf123873 fix missing textwrap import
+xEmbeddedProps->setPropertyValue("TextWrap", 
xShapeProps->getPropertyValue("TextWrap"));
 }
 }
 //insert it into the document at the current cursor position
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

2020-02-21 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf130120.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|9 +++
 sw/source/filter/ww8/docxsdrexport.cxx|   23 --
 sw/source/filter/ww8/ww8graf.cxx  |1 
 writerfilter/source/dmapper/GraphicImport.cxx |   14 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   19 ++
 6 files changed, 62 insertions(+), 4 deletions(-)

New commits:
commit ad8857dab30e099a0cf6ec18d184a6c836b33317
Author: Bakos Attila 
AuthorDate: Tue Feb 11 11:43:48 2020 +0100
Commit: László Németh 
CommitDate: Fri Feb 21 16:08:51 2020 +0100

tdf#130120 DOCX: export o:allowincell

Object anchors are set by allowincell/
LayoutInCell attributes in table cells.
Export it by grab bag method temporarily,
instead of using the suggested FollowTextFlow,
related also to the missing GUI support.

Follow-up of commit 14ad64270e4fbca3c24da6f55f260b1fb229556a
(tdf#129888 DOCX shape import: handle o:allowincell)

Change-Id: If883511b6114e8f60d673ecbd3a11095fcafddc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88438
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf130120.docx 
b/sw/qa/extras/ooxmlexport/data/tdf130120.docx
new file mode 100644
index ..5ca2adc76d60
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf130120.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c78dbf3ddd95..7c02ef57d4fc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -88,6 +88,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, 
"tdf129888dml.docx")
  text::RelOrientation::PAGE_FRAME, nValue);
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130120, "tdf130120.docx")
+{
+   //Text for exporting the allowincell attribute:
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+assertXPath(p_XmlDoc, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/"
+  "mc:Choice/w:drawing/wp:anchor","layoutInCell","0");
+}
+
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 8ab399a46fe3..e18cbd532a18 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -31,8 +31,9 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace oox;
@@ -465,7 +466,25 @@ void DocxSdrExport::startDMLAnchorInline(const 
SwFrameFormat* pFrameFormat, cons
 attrList->add(XML_distR, OString::number(nDistR).getStr());
 attrList->add(XML_simplePos, "0");
 attrList->add(XML_locked, "0");
-attrList->add(XML_layoutInCell, "1");
+bool bLclInTabCell = true;
+if (pObj)
+{
+uno::Reference 
xShape((const_cast(pObj)->getUnoShape()),
+   uno::UNO_QUERY);
+uno::Sequence propList = 
lclGetProperty(xShape, "InteropGrabBag");
+if (propList.hasElements())
+{
+auto pLclProp = std::find_if(
+std::begin(propList), std::end(propList),
+[](const beans::PropertyValue& rProp) { return rProp.Name 
== "LayoutInCell"; });
+if (pLclProp && pLclProp != propList.end())
+pLclProp->Value >>= bLclInTabCell;
+}
+}
+if (bLclInTabCell)
+attrList->add(XML_layoutInCell, "1");
+else
+attrList->add(XML_layoutInCell, "0");
 bool bAllowOverlap = 
pFrameFormat->GetWrapInfluenceOnObjPos().GetAllowOverlap();
 attrList->add(XML_allowOverlap, bAllowOverlap ? "1" : "0");
 if (pObj != nullptr)
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 9e93aef7c14a..8bd5b6f42b78 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2684,7 +2684,6 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long 
nGrafAnchorCp )
 SdrObject::Free(pObject);
 return nullptr;
 }
-
 const bool bLayoutInTableCell =
 m_nInTable && IsObjectLayoutInTableCell( pRecord->nLayoutInTableCell );
 
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index c4a5f045b794..50b5d51733fb 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -68,6 +68,8 @@
 #include "WrapPolygonHandler.hxx"
 #include "util.hxx"
 
+#include 
+
 using namespace css;
 
 namespace
@@ -884,6 +886,18 @@ void 

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2020-02-07 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf123873.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   10 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 ++
 3 files changed, 12 insertions(+)

New commits:
commit affe9c8384475fc85027703332bc0f1b36eaa0a6
Author: Bakos Attila 
AuthorDate: Thu Feb 6 12:01:17 2020 +0100
Commit: László Németh 
CommitDate: Fri Feb 7 18:05:08 2020 +0100

tdf#123873 DOCX IMPORT: fix unhandled textwrap for objects

The OLE objects (in this case charts) had bad wrap option setting
and this lead to misplaced objects. Now this parameter is set
according to the file.

Change-Id: I506be91b6801f0ffc3942e514f81119d895fdcb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88091
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf123873.docx 
b/sw/qa/extras/ooxmlexport/data/tdf123873.docx
new file mode 100644
index ..b1de7f71f75a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123873.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 9fe75ca0f2e8..7817c26ad5ac 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -49,6 +49,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, 
"tdf128207.docx")
 assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123873, "tdf123873.docx")
+{
+//OLE Object were overlapped due to missing wrap import
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(p_XmlDoc);
+assertXPath(
+p_XmlDoc, 
"/w:document/w:body/w:p[2]/w:r[2]/w:drawing/wp:anchor/wp:wrapTopAndBottom");
+}
+
+
 DECLARE_OOXMLIMPORT_TEST(testTdf129888vml, "tdf129888vml.docx")
 {
 //the line shape has anchor in the first cell however it has to
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index cac4cdceb49b..fa4e089192d9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6233,6 +6233,8 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 xEmbeddedProps->setPropertyValue("VertOrient", 
xShapeProps->getPropertyValue("VertOrient"));
 xEmbeddedProps->setPropertyValue("VertOrientPosition", 
xShapeProps->getPropertyValue("VertOrientPosition"));
 xEmbeddedProps->setPropertyValue("VertOrientRelation", 
xShapeProps->getPropertyValue("VertOrientRelation"));
+//tdf123873 fix missing textwrap import
+xEmbeddedProps->setPropertyValue("TextWrap", 
xShapeProps->getPropertyValue("TextWrap"));
 }
 }
 //insert it into the document at the current cursor position
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-19 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf129888dml.docx   |binary
 sw/qa/extras/ooxmlexport/data/tdf129888vml.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   28 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |   15 -
 writerfilter/source/dmapper/GraphicImport.cxx |2 -
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   24 +++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |1 
 7 files changed, 54 insertions(+), 16 deletions(-)

New commits:
commit 47bc0ff1ad0f07b07a75f55d3bb898e113a415b2
Author: Bakos Attila 
AuthorDate: Thu Jan 16 13:45:47 2020 +0100
Commit: László Németh 
CommitDate: Mon Jan 20 08:35:11 2020 +0100

tdf#129888 DOCX shape import: handle o:allowincell

(VML) and layoutInCell (DrawingML) attributes to fix
regressions caused by commit 10f29d8bf05d44ca8bc11d34d1294ec17f8ac0f1
(tdf#87569 tdf#109411 DOCX import: fix shape anchor in tables).

Position of shapes anchored to tables is calculated from
the cell margin only if the previous attributes allow that.

Change-Id: Ifcfcb7f4959aea522dd45dff00cefd1bb9f4edda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86922
Tested-by: Jenkins
Reviewed-by: László Németh 
Signed-off-by: xisco 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86980
Reviewed-by: Attila Bakos 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx
new file mode 100644
index ..1f6b03034fda
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx
new file mode 100644
index ..ee7c60f8a8dc
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 516d65d9bcb8..bb9e3932320f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -42,6 +42,34 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, 
"tdf128207.docx")
 assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf129888vml, "tdf129888vml.docx")
+{
+//the line shape has anchor in the first cell however it has to
+//be positioned to an another cell. To reach this we must handle
+//the o:allowincell attribute of the shape, and its position has
+//to be calculated from the page frame instead of the table:
+
+uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
+sal_Int16 nValue;
+xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888vml The line shape has bad place!",
+ text::RelOrientation::PAGE_FRAME, nValue);
+}
+
+DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, "tdf129888dml.docx")
+{
+//the shape has anchor in the first cell however it has to
+//be positioned to the right side of the page. To reach this we must handle
+//the layoutInCell attribute of the shape, and its position has
+//to be calculated from the page frame instead of the table:
+
+uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
+sal_Int16 nValue;
+xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888dml The shape has bad place!",
+ text::RelOrientation::PAGE_FRAME, nValue);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 3fd2e98fe018..f7f24546def8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3046,21 +3046,6 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 m_pImpl->PushPendingShape(xShape);
 
 m_pImpl->SetIsFirstParagraphInShape(true);
-
-//tdf#87569: Fix table layout with correcting anchoring
-//If anchored object is in table, Word calculates its position from cell 
border
-//instead of page (what is set in the sample document)
-if (m_pImpl->m_nTableDepth > 0) //if we had a table
-{
-uno::Reference xShapePropSet(xShape, 
uno::UNO_QUERY);
-sal_Int16 nCurrentHorOriRel; //A temp variable for storaging the 
current setting
-xShapePropSet->getPropertyValue("HoriOrientRelation") >>= 
nCurrentHorOriRel;
-//and the correction:
-if (nCurrentHorOriRel == text::RelOrientation::PAGE_FRAME)
-xShapePropSet->setPropertyValue("HoriOrientRelation",
- 

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2020-01-17 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf129888dml.docx   |binary
 sw/qa/extras/ooxmlexport/data/tdf129888vml.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   28 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |   14 -
 writerfilter/source/dmapper/GraphicImport.cxx |2 -
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   24 +++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |1 
 7 files changed, 54 insertions(+), 15 deletions(-)

New commits:
commit 14ad64270e4fbca3c24da6f55f260b1fb229556a
Author: Bakos Attila 
AuthorDate: Thu Jan 16 13:45:47 2020 +0100
Commit: László Németh 
CommitDate: Fri Jan 17 12:51:52 2020 +0100

tdf#129888 DOCX shape import: handle o:allowincell

(VML) and layoutInCell (DrawingML) attributes to fix
regressions caused by commit 10f29d8bf05d44ca8bc11d34d1294ec17f8ac0f1
(tdf#87569 tdf#109411 DOCX import: fix shape anchor in tables).

Position of shapes anchored to tables is calculated from
the cell margin only if the previous attributes allow that.

Change-Id: Ifcfcb7f4959aea522dd45dff00cefd1bb9f4edda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86922
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx
new file mode 100644
index ..1f6b03034fda
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx
new file mode 100644
index ..ee7c60f8a8dc
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 61f3a2ab60a7..a94263f05c41 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -43,6 +43,34 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, 
"tdf128207.docx")
 assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf129888vml, "tdf129888vml.docx")
+{
+//the line shape has anchor in the first cell however it has to
+//be positioned to an another cell. To reach this we must handle
+//the o:allowincell attribute of the shape, and its position has
+//to be calculated from the page frame instead of the table:
+
+uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
+sal_Int16 nValue;
+xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888vml The line shape has bad place!",
+ text::RelOrientation::PAGE_FRAME, nValue);
+}
+
+DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, "tdf129888dml.docx")
+{
+//the shape has anchor in the first cell however it has to
+//be positioned to the right side of the page. To reach this we must handle
+//the layoutInCell attribute of the shape, and its position has
+//to be calculated from the page frame instead of the table:
+
+uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
+sal_Int16 nValue;
+xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888dml The shape has bad place!",
+ text::RelOrientation::PAGE_FRAME, nValue);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 8a62a2ebda83..0da610f7ab53 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3043,20 +3043,6 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 
 m_pImpl->SetIsFirstParagraphInShape(true);
 
-//tdf#87569: Fix table layout with correcting anchoring
-//If anchored object is in table, Word calculates its position from cell 
border
-//instead of page (what is set in the sample document)
-if (m_pImpl->m_nTableDepth > 0) //if we had a table
-{
-uno::Reference xShapePropSet(xShape, 
uno::UNO_QUERY);
-sal_Int16 nCurrentHorOriRel; //A temp variable to store the current 
setting
-xShapePropSet->getPropertyValue("HoriOrientRelation") >>= 
nCurrentHorOriRel;
-//and the correction:
-if (nCurrentHorOriRel == text::RelOrientation::PAGE_FRAME)
-xShapePropSet->setPropertyValue("HoriOrientRelation",
-
uno::makeAny(text::RelOrientation::FRAME));
-}
-
 }
 
 void DomainMapper::lcl_endShape( )
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 

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

2020-01-13 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf128207.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|8 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 
 writerfilter/source/dmapper/GraphicImport.cxx |5 +
 writerfilter/source/dmapper/GraphicImport.hxx |2 ++
 5 files changed, 19 insertions(+)

New commits:
commit 4fcc04d134644a3013df7f331fe36072b96adb9f
Author: Bakos Attila 
AuthorDate: Fri Jan 10 10:49:14 2020 +0100
Commit: Miklos Vajna 
CommitDate: Mon Jan 13 12:27:47 2020 +0100

tdf#128207: DOCX import: fix chart positioning

Embedded graphic objects had got 0 values for vertical and horizontal
positioning before, resulting overlapping, hidden charts,
but now they are positioned according to the values in the document.

Change-Id: Ia5403ac65ff7192d61072e8a9d8a7f80c7178b9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86521
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit d9c535ead688e9f156dbcf43948df08a69e218be)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86536
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf128207.docx 
b/sw/qa/extras/ooxmlexport/data/tdf128207.docx
new file mode 100644
index ..c234ec8bc10f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf128207.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 062831503404..516d65d9bcb8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -34,6 +34,14 @@ protected:
 }
 };
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, "tdf128207.docx")
+{
+//There was the charts on each other, because their horizontal and 
vertical position was 0!
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(p_XmlDoc);
+assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f60d188c4c01..0f79bb73334e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6101,6 +6101,10 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 
 // Update the shape properties if it is embedded object.
 if(m_xEmbedded.is()){
+if (m_pGraphicImport->GetXShapeObject())
+m_pGraphicImport->GetXShapeObject()->setPosition(
+m_pGraphicImport->GetGraphicObjectPosition());
+
 uno::Reference xShape = 
m_pGraphicImport->GetXShapeObject();
 UpdateEmbeddedShapeProps(xShape);
 if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index da2b9ce04ef4..df4ae45f7671 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -424,6 +424,11 @@ GraphicImport::~GraphicImport()
 {
 }
 
+com::sun::star::awt::Point GraphicImport::GetGraphicObjectPosition()
+{
+return (com::sun::star::awt::Point(m_pImpl->nLeftPosition, 
m_pImpl->nTopPosition));
+}
+
 void GraphicImport::handleWrapTextValue(sal_uInt32 nVal)
 {
 switch (nVal)
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx 
b/writerfilter/source/dmapper/GraphicImport.hxx
index d83f41cb161d..7807e48ede00 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -99,6 +99,8 @@ public:
 bool IsGraphic() const;
 sal_Int32 GetLeftMarginOrig() const;
 
+com::sun::star::awt::Point GetGraphicObjectPosition();
+
  private:
 // Properties
 virtual void lcl_attribute(Id Name, Value & val) override;
___
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.2' - sw/qa writerfilter/source

2020-01-10 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf128207.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx|6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 
 writerfilter/source/dmapper/GraphicImport.cxx |5 +
 writerfilter/source/dmapper/GraphicImport.hxx |2 ++
 5 files changed, 17 insertions(+)

New commits:
commit a0c9bfc8186ca6fae43f611554f4a23e99250f54
Author: Bakos Attila 
AuthorDate: Fri Jan 10 10:49:14 2020 +0100
Commit: Miklos Vajna 
CommitDate: Fri Jan 10 19:55:16 2020 +0100

tdf#128207: DOCX import: fix chart positioning

Embedded graphic objects had got 0 values for vertical and horizontal
positioning before, resulting overlapping, hidden charts,
but now they are positioned according to the values in the document.

(cherry picked from commit d9c535ead688e9f156dbcf43948df08a69e218be)

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

[ Miklos: reworked the testcase to use the UNO API, the other way would
only work on master. ]

Change-Id: Ia5403ac65ff7192d61072e8a9d8a7f80c7178b9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86557
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf128207.docx 
b/sw/qa/extras/ooxmlexport/data/tdf128207.docx
new file mode 100644
index ..c234ec8bc10f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf128207.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 27cb3a804b0b..a90130c7118c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -355,6 +355,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf129353, "tdf129353.docx")
  aIndexString);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf128207, "tdf128207.docx")
+{
+//There was the charts on each other, because their horizontal and 
vertical position was 0!
+CPPUNIT_ASSERT_EQUAL(sal_Int32(12), getProperty(getShape(1), 
"HoriOrientPosition"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0efe88acffbd..8356ecb8e8ee 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5635,6 +5635,10 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 
 // Update the shape properties if it is embedded object.
 if(m_xEmbedded.is()){
+if (m_pGraphicImport->GetXShapeObject())
+m_pGraphicImport->GetXShapeObject()->setPosition(
+m_pGraphicImport->GetGraphicObjectPosition());
+
 uno::Reference xShape = 
m_pGraphicImport->GetXShapeObject();
 UpdateEmbeddedShapeProps(xShape);
 if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 8afaad814777..d2e36a5aa638 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -424,6 +424,11 @@ GraphicImport::~GraphicImport()
 {
 }
 
+com::sun::star::awt::Point GraphicImport::GetGraphicObjectPosition()
+{
+return (com::sun::star::awt::Point(m_pImpl->nLeftPosition, 
m_pImpl->nTopPosition));
+}
+
 void GraphicImport::handleWrapTextValue(sal_uInt32 nVal)
 {
 switch (nVal)
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx 
b/writerfilter/source/dmapper/GraphicImport.hxx
index 70b02d353e8f..028096fd350a 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -99,6 +99,8 @@ public:
 bool IsGraphic() const;
 sal_Int32 GetLeftMarginOrig() const;
 
+com::sun::star::awt::Point GetGraphicObjectPosition();
+
  private:
 // Properties
 virtual void lcl_attribute(Id Name, Value & val) override;
___
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-29' - sw/qa writerfilter/source

2020-01-10 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf128207.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 
 writerfilter/source/dmapper/GraphicImport.cxx |5 +
 writerfilter/source/dmapper/GraphicImport.hxx |2 ++
 5 files changed, 17 insertions(+)

New commits:
commit ba18069e9708f60452f7b5f2306b407780dd898d
Author: Bakos Attila 
AuthorDate: Fri Jan 10 10:49:14 2020 +0100
Commit: Miklos Vajna 
CommitDate: Fri Jan 10 16:17:15 2020 +0100

tdf#128207: DOCX import: fix chart positioning

Embedded graphic objects had got 0 values for vertical and horizontal
positioning before, resulting overlapping, hidden charts,
but now they are positioned according to the values in the document.

(cherry picked from commit d9c535ead688e9f156dbcf43948df08a69e218be)

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

[ Miklos: reworked the testcase to use the UNO API, the other way would
only work on master. ]

Change-Id: Ia5403ac65ff7192d61072e8a9d8a7f80c7178b9b

diff --git a/sw/qa/extras/ooxmlexport/data/tdf128207.docx 
b/sw/qa/extras/ooxmlexport/data/tdf128207.docx
new file mode 100644
index ..c234ec8bc10f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf128207.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index b8214f664e42..a4e435c62f78 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -450,6 +450,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak4, 
"tdf123636_newlinePage
 assertXPath(pDump, "/root/page[2]/body/txt[1]/Text", 0);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf128207, "tdf128207.docx")
+{
+//There was the charts on each other, because their horizontal and 
vertical position was 0!
+CPPUNIT_ASSERT_EQUAL(sal_Int32(12), getProperty(getShape(1), 
"HoriOrientPosition"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f17a52da1697..d5fbaa9f2af6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5146,6 +5146,10 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 
 // Update the shape properties if it is embedded object.
 if(m_xEmbedded.is()){
+if (m_pGraphicImport->GetXShapeObject())
+m_pGraphicImport->GetXShapeObject()->setPosition(
+m_pGraphicImport->GetGraphicObjectPosition());
+
 uno::Reference xShape = 
m_pGraphicImport->GetXShapeObject();
 UpdateEmbeddedShapeProps(xShape);
 if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 6830e9db71b1..76f36045ea4e 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -423,6 +423,11 @@ GraphicImport::~GraphicImport()
 {
 }
 
+com::sun::star::awt::Point GraphicImport::GetGraphicObjectPosition()
+{
+return (com::sun::star::awt::Point(m_pImpl->nLeftPosition, 
m_pImpl->nTopPosition));
+}
+
 void GraphicImport::handleWrapTextValue(sal_uInt32 nVal)
 {
 switch (nVal)
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx 
b/writerfilter/source/dmapper/GraphicImport.hxx
index f513632e966b..c2dc01a51317 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -94,6 +94,8 @@ public:
 const css::uno::Reference& GetXShapeObject() { 
return m_xShape;}
 bool IsGraphic() const;
 
+com::sun::star::awt::Point GetGraphicObjectPosition();
+
  private:
 // Properties
 virtual void lcl_attribute(Id Name, Value & val) override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa writerfilter/source

2020-01-10 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf128207.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|8 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 
 writerfilter/source/dmapper/GraphicImport.cxx |5 +
 writerfilter/source/dmapper/GraphicImport.hxx |2 ++
 5 files changed, 19 insertions(+)

New commits:
commit d9c535ead688e9f156dbcf43948df08a69e218be
Author: Bakos Attila 
AuthorDate: Fri Jan 10 10:49:14 2020 +0100
Commit: László Németh 
CommitDate: Fri Jan 10 13:08:21 2020 +0100

tdf#128207: DOCX import: fix chart positioning

Embedded graphic objects had got 0 values for vertical and horizontal
positioning before, resulting overlapping, hidden charts,
but now they are positioned according to the values in the document.

Change-Id: Ia5403ac65ff7192d61072e8a9d8a7f80c7178b9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86521
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf128207.docx 
b/sw/qa/extras/ooxmlexport/data/tdf128207.docx
new file mode 100644
index ..c234ec8bc10f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf128207.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 4ddfe28a71c0..bab071d92a54 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -35,6 +35,14 @@ protected:
 }
 };
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, "tdf128207.docx")
+{
+//There was the charts on each other, because their horizontal and 
vertical position was 0!
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(p_XmlDoc);
+assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e53229985fe1..3bc15298442f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6171,6 +6171,10 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 
 // Update the shape properties if it is embedded object.
 if(m_xEmbedded.is()){
+if (m_pGraphicImport->GetXShapeObject())
+m_pGraphicImport->GetXShapeObject()->setPosition(
+m_pGraphicImport->GetGraphicObjectPosition());
+
 uno::Reference xShape = 
m_pGraphicImport->GetXShapeObject();
 UpdateEmbeddedShapeProps(xShape);
 if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index bf2ffb859ab6..6c2b7ba81511 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -431,6 +431,11 @@ GraphicImport::~GraphicImport()
 {
 }
 
+com::sun::star::awt::Point GraphicImport::GetGraphicObjectPosition()
+{
+return (com::sun::star::awt::Point(m_pImpl->nLeftPosition, 
m_pImpl->nTopPosition));
+}
+
 void GraphicImport::handleWrapTextValue(sal_uInt32 nVal)
 {
 switch (nVal)
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx 
b/writerfilter/source/dmapper/GraphicImport.hxx
index d83f41cb161d..7807e48ede00 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -99,6 +99,8 @@ public:
 bool IsGraphic() const;
 sal_Int32 GetLeftMarginOrig() const;
 
+com::sun::star::awt::Point GetGraphicObjectPosition();
+
  private:
 // Properties
 virtual void lcl_attribute(Id Name, Value & val) override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-12-20 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx |binary
 sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   20 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |   15 +
 writerfilter/source/dmapper/GraphicImport.cxx |9 
 5 files changed, 44 insertions(+)

New commits:
commit b83d394a16a9a93b314f20ea8fb2ccbb99d9d07f
Author: Bakos Attila 
AuthorDate: Sat Dec 14 12:36:13 2019 +0100
Commit: László Németh 
CommitDate: Fri Dec 20 17:59:14 2019 +0100

tdf#87569 tdf#109411 DOCX import: fix shape anchor in tables

Import "relative from page" horizontal setting of
VML and DrawingML shapes as "relative from column"
in tables, just as MSO handles it.

Change-Id: If71f2e52bbba324a98651e701feaeb99acfefc48
Reviewed-on: https://gerrit.libreoffice.org/85141
Tested-by: Jenkins
Reviewed-by: László Németh 
Reviewed-on: https://gerrit.libreoffice.org/85572

diff --git a/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx
new file mode 100644
index ..7f00a46e2cc6
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx
new file mode 100644
index ..0223ad71d4e2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 1c4d89028fbd..2271aa413dd6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -31,6 +32,25 @@ protected:
 }
 };
 
+DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
+{
+//the original tdf87569 sample has vml shapes...
+uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
+sal_Int16 nValue;
+xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_vml: The Shape is not in the 
table!",
+ text::RelOrientation::FRAME, nValue);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx")
+{
+//if the original tdf87569 sample is upgraded it will have drawingml 
shapes...
+uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
+sal_Int16 nValue;
+xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_drawingml: The Shape is not in the 
table!",
+ text::RelOrientation::FRAME, nValue);
+}
 
 DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx")
 {
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 16d42193ac6a..5417b6a05e0b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3035,6 +3035,21 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 m_pImpl->PushPendingShape(xShape);
 
 m_pImpl->SetIsFirstParagraphInShape(true);
+
+//tdf#87569: Fix table layout with correcting anchoring
+//If anchored object is in table, Word calculates its position from cell 
border
+//instead of page (what is set in the sample document)
+if (m_pImpl->m_nTableDepth > 0) //if we had a table
+{
+uno::Reference xShapePropSet(xShape, 
uno::UNO_QUERY);
+sal_Int16 nCurrentHorOriRel; //A temp variable for storaging the 
current setting
+xShapePropSet->getPropertyValue("HoriOrientRelation") >>= 
nCurrentHorOriRel;
+//and the correction:
+if (nCurrentHorOriRel == text::RelOrientation::PAGE_FRAME)
+xShapePropSet->setPropertyValue("HoriOrientRelation",
+
uno::makeAny(text::RelOrientation::FRAME));
+}
+
 }
 
 void DomainMapper::lcl_endShape( )
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 33275d9f0d55..da2b9ce04ef4 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -860,6 +860,15 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 if (nRotation)
 xShapeProps->setPropertyValue("RotateAngle", 
uno::makeAny(nRotation));
 }
+
+//tdf#109411 If anchored object is in table, Word 
calculates its position from cell border
+//instead of page (what is set in the sample document)
+if (m_pImpl->rDomainMapper.IsInTable() &&
+

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2019-12-19 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx |binary
 sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   20 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |   15 +
 writerfilter/source/dmapper/GraphicImport.cxx |9 
 5 files changed, 44 insertions(+)

New commits:
commit 10f29d8bf05d44ca8bc11d34d1294ec17f8ac0f1
Author: Bakos Attila 
AuthorDate: Sat Dec 14 12:36:13 2019 +0100
Commit: László Németh 
CommitDate: Fri Dec 20 08:04:15 2019 +0100

tdf#87569 tdf#109411 DOCX import: fix shape anchor in tables

Import "relative from page" horizontal setting of
VML and DrawingML shapes as "relative from column"
in tables, just as MSO handles it.

Change-Id: If71f2e52bbba324a98651e701feaeb99acfefc48
Reviewed-on: https://gerrit.libreoffice.org/85141
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx
new file mode 100644
index ..7f00a46e2cc6
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx
new file mode 100644
index ..0223ad71d4e2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 51c2ee7acc2c..fb93572bf725 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -33,6 +34,25 @@ protected:
 }
 };
 
+DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
+{
+//the original tdf87569 sample has vml shapes...
+uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
+sal_Int16 nValue;
+xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_vml: The Shape is not in the 
table!",
+ text::RelOrientation::FRAME, nValue);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx")
+{
+//if the original tdf87569 sample is upgraded it will have drawingml 
shapes...
+uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
+sal_Int16 nValue;
+xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_drawingml: The Shape is not in the 
table!",
+ text::RelOrientation::FRAME, nValue);
+}
 
 DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx")
 {
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 9bbbedf64f9c..ccbe8d8d197b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3023,6 +3023,21 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 m_pImpl->PushPendingShape(xShape);
 
 m_pImpl->SetIsFirstParagraphInShape(true);
+
+//tdf#87569: Fix table layout with correcting anchoring
+//If anchored object is in table, Word calculates its position from cell 
border
+//instead of page (what is set in the sample document)
+if (m_pImpl->m_nTableDepth > 0) //if we had a table
+{
+uno::Reference xShapePropSet(xShape, 
uno::UNO_QUERY);
+sal_Int16 nCurrentHorOriRel; //A temp variable for storaging the 
current setting
+xShapePropSet->getPropertyValue("HoriOrientRelation") >>= 
nCurrentHorOriRel;
+//and the correction:
+if (nCurrentHorOriRel == text::RelOrientation::PAGE_FRAME)
+xShapePropSet->setPropertyValue("HoriOrientRelation",
+
uno::makeAny(text::RelOrientation::FRAME));
+}
+
 }
 
 void DomainMapper::lcl_endShape( )
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 74fa991eeb10..63a0e7491fb4 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -867,6 +867,15 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 if (nRotation)
 xShapeProps->setPropertyValue("RotateAngle", 
uno::makeAny(nRotation));
 }
+
+//tdf#109411 If anchored object is in table, Word 
calculates its position from cell border
+//instead of page (what is set in the sample document)
+if (m_pImpl->rDomainMapper.IsInTable() &&
+m_pImpl->nHoriRelation == 
text::RelOrientation::PAGE_FRAME && 

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

2019-11-13 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf124367.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   14 ++
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|5 -
 sw/qa/extras/rtfexport/rtfexport5.cxx|2 +-
 sw/qa/extras/rtfimport/rtfimport.cxx |2 +-
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |4 ++--
 7 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit 23d8c2b148f88575a9c971602d3a1bc71dabf0b1
Author: Bakos Attila 
AuthorDate: Tue Nov 5 15:30:22 2019 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 13 09:33:07 2019 +0100

tdf#124367 DOCX import: fix rounding error in table cell widths

Follow-up of commit 29cbbad64088354425c606f9eb6c267bdf7731dc
(DOCX import: fix rounding error in table cell widths),
its revert in commit e502463fa9a601963aa9f5a8783eb1318de36c13
(tdf#123104 DOCX import: fix lack of vertical merge due to rounding)
and commit 44e44239de35c1548809c96e13bfa9d64c7ca441
(tdf#120315 DOCX import: fix cells merged vertically).

Change-Id: Id85e8fd25dba26af77fe2fd3024db2ae834b5052
Reviewed-on: https://gerrit.libreoffice.org/82072
Reviewed-by: László Németh 
Tested-by: László Németh 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/82421
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf124367.docx 
b/sw/qa/extras/ooxmlexport/data/tdf124367.docx
new file mode 100644
index ..0a1356dd0d2b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124367.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index a0a7f4169a1f..0d6d771b7362 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -108,6 +108,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx")
 assertXPath(pXmlSettings, "/w:settings/w:hyphenationZone", "val", "851");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf124367, "tdf124367.docx")
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xTableRows = xTextTable->getRows();
+// it was 2761 at the first import, and 2760 at the second import, due to 
incorrect rounding
+CPPUNIT_ASSERT_EQUAL(static_cast(2762),
+ 
getProperty>(
+ xTableRows->getByIndex(2), 
"TableColumnSeparators")[0]
+ .Position);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index ac0cd45112fb..b26a8a737d4a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -271,7 +271,7 @@ DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, 
"test_segfault_while_save.docx")
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
 if (!pXmlDoc)
 return;
-CPPUNIT_ASSERT_EQUAL(static_cast(6138), getXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
+CPPUNIT_ASSERT_EQUAL(static_cast(6137), getXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
 
 // tdf#106572 - preventative test matching danger conditions, but imported 
OK anyway
 CPPUNIT_ASSERT_EQUAL(OUString("First Page"), 
getProperty(getParagraphOrTable(1), "PageDescName"));
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index f798ad98000e..4a033ec79df0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -883,7 +883,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo59273, "fdo59273.docx")
 
 uno::Reference xTableRows(xTextTable->getRows(), 
uno::UNO_QUERY);
 // Was 9997, so the 4th column had ~zero width
-CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty< 
uno::Sequence >(xTableRows->getByIndex(0), 
"TableColumnSeparators")[2].Position);
+CPPUNIT_ASSERT_LESSEQUAL(2, (sal_Int16(7500)
+ - 
getProperty>(
+   xTableRows->getByIndex(0), 
"TableColumnSeparators")[2]
+   .Position));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testConditionalstylesTablelook, 
"conditionalstyles-tbllook.docx")
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx 
b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 7f11ece22fa8..7c734c42a932 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ 

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2019-11-09 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf124367.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   14 ++
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|5 -
 sw/qa/extras/rtfexport/rtfexport5.cxx|2 +-
 sw/qa/extras/rtfimport/rtfimport.cxx |2 +-
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |4 ++--
 7 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit c401aa9f632758157021c2c45c5cc4d00ee12dab
Author: Bakos Attila 
AuthorDate: Tue Nov 5 15:30:22 2019 +0100
Commit: László Németh 
CommitDate: Sat Nov 9 18:20:27 2019 +0100

tdf124367 DOCX import: fix rounding error in table cell widths

Follow-up of commit 29cbbad64088354425c606f9eb6c267bdf7731dc
(DOCX import: fix rounding error in table cell widths),
its revert in commit e502463fa9a601963aa9f5a8783eb1318de36c13
(tdf#123104 DOCX import: fix lack of vertical merge due to rounding)
and commit 44e44239de35c1548809c96e13bfa9d64c7ca441
(tdf#120315 DOCX import: fix cells merged vertically).

Change-Id: Id85e8fd25dba26af77fe2fd3024db2ae834b5052
Reviewed-on: https://gerrit.libreoffice.org/82072
Reviewed-by: László Németh 
Tested-by: László Németh 
Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/tdf124367.docx 
b/sw/qa/extras/ooxmlexport/data/tdf124367.docx
new file mode 100644
index ..0a1356dd0d2b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124367.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c7f022d68311..12950c8451a7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -108,6 +108,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx")
 assertXPath(pXmlSettings, "/w:settings/w:hyphenationZone", "val", "851");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf124367, "tdf124367.docx")
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xTableRows = xTextTable->getRows();
+// it was 2761 at the first import, and 2760 at the second import, due to 
incorrect rounding
+CPPUNIT_ASSERT_EQUAL(static_cast(2762),
+ 
getProperty>(
+ xTableRows->getByIndex(2), 
"TableColumnSeparators")[0]
+ .Position);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index f2ce3fb3fe2a..a09479e44ea0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -272,7 +272,7 @@ DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, 
"test_segfault_while_save.docx")
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
 if (!pXmlDoc)
 return;
-CPPUNIT_ASSERT_EQUAL(static_cast(6138), getXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
+CPPUNIT_ASSERT_EQUAL(static_cast(6137), getXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
 
 // tdf#106572 - preventative test matching danger conditions, but imported 
OK anyway
 CPPUNIT_ASSERT_EQUAL(OUString("First Page"), 
getProperty(getParagraphOrTable(1), "PageDescName"));
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index a46e3fb5eb63..e5b4ffc9cfdd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -884,7 +884,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo59273, "fdo59273.docx")
 
 uno::Reference xTableRows = xTextTable->getRows();
 // Was 9997, so the 4th column had ~zero width
-CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty< 
uno::Sequence >(xTableRows->getByIndex(0), 
"TableColumnSeparators")[2].Position);
+CPPUNIT_ASSERT_LESSEQUAL(2, (sal_Int16(7500)
+ - 
getProperty>(
+   xTableRows->getByIndex(0), 
"TableColumnSeparators")[2]
+   .Position));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testConditionalstylesTablelook, 
"conditionalstyles-tbllook.docx")
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx 
b/sw/qa/extras/rtfexport/rtfexport5.cxx
index e74e79073348..2a44ad72f1ff 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -944,7 +944,7 @@ DECLARE_RTFEXPORT_TEST(testTdf97035, "tdf97035.rtf")
 
 // First cell width of the second row should be 2300
 

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

2019-11-08 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf120315.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   18 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |7 ++---
 3 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit d99d2ad9f7a03663ed34008c8c3582f2999512d6
Author: Bakos Attila 
AuthorDate: Mon Oct 28 14:03:11 2019 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 8 09:23:09 2019 +0100

tdf#120315 DOCX import: fix cells merged vertically

Due to rounding mistake cells weren't merged vertically,
when their horizontal positions are different a little bit.

Change-Id: I10623719a3759b35fcd04b154590b8ac6ec3ac45
Reviewed-on: https://gerrit.libreoffice.org/81604
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 44e44239de35c1548809c96e13bfa9d64c7ca441)
Reviewed-on: https://gerrit.libreoffice.org/81992
Reviewed-by: Attila Bakos 
Tested-by: Xisco Faulí 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf120315.docx 
b/sw/qa/extras/ooxmlexport/data/tdf120315.docx
new file mode 100644
index ..d3943ea0b291
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120315.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index d6294544c68e..a0a7f4169a1f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -31,6 +32,23 @@ protected:
 };
 
 
+DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx")
+{
+// tdf#120315 cells of the second column weren't vertically merged
+// because their horizontal positions are different a little bit
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xTableRows = xTextTable->getRows();
+
CPPUNIT_ASSERT_EQUAL(getProperty>(
+ xTableRows->getByIndex(0), 
"TableColumnSeparators")[0]
+ .Position,
+ 
getProperty>(
+ xTableRows->getByIndex(1), 
"TableColumnSeparators")[2]
+ .Position);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, 
"tdf108350_noFontdefaults.docx")
 {
 uno::Reference< container::XNameAccess > paragraphStyles = 
getStyles("ParagraphStyles");
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 2c33628615be..368e4b59c411 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -641,7 +641,7 @@ void DomainMapperTableManager::endOfRowAction()
 }
 uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( 
) - 1 );
 text::TableColumnSeparator* pSeparators = aSeparators.getArray();
-sal_Int16 nLastRelPos = 0;
+double nLastRelPos = 0.0;
 sal_uInt32 nBorderGridIndex = m_nGridBefore;
 
 size_t nWidthsBound =  m_nCell.back( ) - 1;
@@ -657,10 +657,9 @@ void DomainMapperTableManager::endOfRowAction()
 for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; 
--nGridCount )
 fGridWidth += (*pTableGrid)[nBorderGridIndex++];
 
-sal_Int16 nRelPos =
-sal::static_int_cast< sal_Int16 >((fGridWidth * 1) / 
nFullWidthRelative);
+double nRelPos = static_cast((fGridWidth * 1) / 
nFullWidthRelative);
 
-pSeparators[nBorder].Position =  nRelPos + nLastRelPos;
+pSeparators[nBorder].Position = sal::static_int_cast< 
sal_Int16 >( nRelPos + nLastRelPos );
 pSeparators[nBorder].IsVisible = true;
 nLastRelPos = nLastRelPos + nRelPos;
 ++aSpansIter;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2019-11-04 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf120315.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   18 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |7 ++---
 3 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 44e44239de35c1548809c96e13bfa9d64c7ca441
Author: Bakos Attila 
AuthorDate: Mon Oct 28 14:03:11 2019 +0100
Commit: László Németh 
CommitDate: Mon Nov 4 09:48:37 2019 +0100

tdf#120315 DOCX import: fix cells merged vertically

Due to rounding mistake cells weren't merged vertically,
when their horizontal positions are different a little bit.

Change-Id: I10623719a3759b35fcd04b154590b8ac6ec3ac45
Reviewed-on: https://gerrit.libreoffice.org/81604
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf120315.docx 
b/sw/qa/extras/ooxmlexport/data/tdf120315.docx
new file mode 100644
index ..d3943ea0b291
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120315.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index ceee45bc9bc1..93d896837a36 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -31,6 +32,23 @@ protected:
 };
 
 
+DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx")
+{
+// tdf#120315 cells of the second column weren't vertically merged
+// because their horizontal positions are different a little bit
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xTableRows = xTextTable->getRows();
+
CPPUNIT_ASSERT_EQUAL(getProperty>(
+ xTableRows->getByIndex(0), 
"TableColumnSeparators")[0]
+ .Position,
+ 
getProperty>(
+ xTableRows->getByIndex(1), 
"TableColumnSeparators")[2]
+ .Position);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, 
"tdf108350_noFontdefaults.docx")
 {
 uno::Reference< container::XNameAccess > paragraphStyles = 
getStyles("ParagraphStyles");
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 6adbcdc075f7..e09dd45f1642 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -650,7 +650,7 @@ void DomainMapperTableManager::endOfRowAction()
 }
 uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( 
) - 1 );
 text::TableColumnSeparator* pSeparators = aSeparators.getArray();
-sal_Int16 nLastRelPos = 0;
+double nLastRelPos = 0.0;
 sal_uInt32 nBorderGridIndex = m_nGridBefore;
 
 size_t nWidthsBound =  m_nCell.back( ) - 1;
@@ -666,10 +666,9 @@ void DomainMapperTableManager::endOfRowAction()
 for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; 
--nGridCount )
 fGridWidth += (*pTableGrid)[nBorderGridIndex++];
 
-sal_Int16 nRelPos =
-sal::static_int_cast< sal_Int16 >((fGridWidth * 1) / 
nFullWidthRelative);
+double nRelPos = static_cast((fGridWidth * 1) / 
nFullWidthRelative);
 
-pSeparators[nBorder].Position =  nRelPos + nLastRelPos;
+pSeparators[nBorder].Position = sal::static_int_cast< 
sal_Int16 >( nRelPos + nLastRelPos );
 pSeparators[nBorder].IsVisible = true;
 nLastRelPos = nLastRelPos + nRelPos;
 ++aSpansIter;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits