[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/source

2020-09-16 Thread Balazs Varga (via logerrit)
 sw/source/filter/ww8/docxexport.cxx |   26 +++---
 1 file changed, 7 insertions(+), 19 deletions(-)

New commits:
commit ac66e1319732139bb41f65b9755e70c8bc5ee3a4
Author: Balazs Varga 
AuthorDate: Tue Jul 21 16:23:29 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Sep 16 20:24:41 2020 +0200

tdf#131288 Chart: fix export of embedded xlsx

To avoid exporting a broken DOCX, we have to seek
the 'embeddingsStream', so we avoid to export an empty
(0 Kb) embedded xlsx.
Co-authored-by: Balázs Regényi

Change-Id: I1723091aab3e2070f3db75ce866897e38021718d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99151
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins
(cherry picked from commit b115d4899d827f885f7d35ced4cb64d2385e3422)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99926
Reviewed-by: Xisco Fauli 
(cherry picked from commit 2a755d748aecd65d1a3d0c2685678a85472481cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102766
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 7fed578100d1..7487ba6cb658 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -425,7 +426,7 @@ OString DocxExport::WriteOLEObject(SwOLEObj& rObject, 
OUString & io_rProgID)
 
 try
 {
-::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
+comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
 }
 catch (uno::Exception const&)
 {
@@ -1445,24 +1446,11 @@ void DocxExport::WriteEmbeddings()
 contentType);
 try
 {
-sal_Int32 nBufferSize = 512;
-uno::Sequence< sal_Int8 > aDataBuffer(nBufferSize);
-sal_Int32 nRead;
-do
-{
-nRead = embeddingsStream->readBytes( aDataBuffer, 
nBufferSize );
-if( nRead )
-{
-if( nRead < nBufferSize )
-{
-nBufferSize = nRead;
-aDataBuffer.realloc(nRead);
-}
-xOutStream->writeBytes( aDataBuffer );
-}
-}
-while( nRead );
-xOutStream->flush();
+// tdf#131288: the stream must be seekable for direct access
+uno::Reference< io::XSeekable > xSeekable(embeddingsStream, 
uno::UNO_QUERY);
+if (xSeekable)
+xSeekable->seek(0); // tdf#131288: a previous save could 
position it elsewhere
+
comphelper::OStorageHelper::CopyInputToOutput(embeddingsStream, xOutStream);
 }
 catch(const uno::Exception&)
 {
___
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-13 Thread Michael Stahl (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 1f6bb28c988c9b03e78180c30ca8fb25d18b593b
Author: Michael Stahl 
AuthorDate: Fri Jul 10 19:29:27 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Sun Sep 13 23:35:54 2020 +0200

tdf#134618 sw: DOCX export: fix order of as-char and at-char fly...

...at same position.

The problem is that in this case the as-char fly was written before the
at-char fly but the positioning of the at-char fly can be relative to
its character position, i.e. before the as-char fly.

Apparently as-char flys are written in
DocxAttributeOutput::EndRunProperties() via WritePostponedDMLDrawing(),
wheras at-char flys are written earlier, in SwWW8AttrIter::OutFlys() via
DocxAttributeOutput::OutputFlyFrame_Impl().

So this undoes the swap that these undergo via the magic of the mark
stack.

Change-Id: I83a72bb2affbf321fc4dea4e7fb37bdb43cea2e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98543
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7b156d37cfc92292323694ec064fe51ae57b3257)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98633
Reviewed-by: Thorsten Behrens 
(cherry picked from commit d449d92b8f1b8c6b572acfd80efe42a875059faf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102571
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 825189c8ccd6..bc01bc3d5c6f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2668,6 +2668,10 @@ void DocxAttributeOutput::EndRunProperties( const 
SwRedlineData* pRedlineData )
 // write footnotes/endnotes if we have any
 FootnoteEndnoteReference();
 
+// merge the properties _before_ the run text (strictly speaking, just
+// after the start of the run)
+m_pSerializer->mergeTopMarks(Tag_StartRunProperties, 
sax_fastparser::MergeMarks::PREPEND);
+
 WritePostponedGraphic();
 
 WritePostponedDiagram();
@@ -2680,10 +2684,6 @@ void DocxAttributeOutput::EndRunProperties( const 
SwRedlineData* pRedlineData )
 WritePostponedOLE();
 
 WritePostponedActiveXControl(true);
-
-// merge the properties _before_ the run text (strictly speaking, just
-// after the start of the run)
-m_pSerializer->mergeTopMarks(Tag_StartRunProperties, 
sax_fastparser::MergeMarks::PREPEND);
 }
 
 void DocxAttributeOutput::GetSdtEndBefore(const SdrObject* pSdrObj)
@@ -5793,7 +5793,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const 
ww8::Frame , const P
 break;
 }
 
-m_pSerializer->mergeTopMarks(Tag_OutputFlyFrame, 
sax_fastparser::MergeMarks::POSTPONE);
+m_pSerializer->mergeTopMarks(Tag_OutputFlyFrame);
 }
 
 void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
___
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-07-23 Thread Attila Bakos (via logerrit)
 sw/source/core/doc/textboxhelper.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 79e289859abfc7552d9dec2aff5d29a247b9a370
Author: Attila Bakos 
AuthorDate: Fri May 29 14:09:30 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Jul 23 17:06:09 2020 +0200

tdf#130802 SwTextBoxHelper::syncFlyFrameAttr: fix dragging

Dragging the selected shapes resulted broken text boxes:
the text showed outside of the shapes. This is fixed in
the case of paragraph, character and page anchoring.

Co-authored-by: Tibor Nagy (NISZ)

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

diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 9ea6fc96b719..34aed05a1fcf 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -686,6 +687,12 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
 const SfxPoolItem* pItem = aIter.GetCurItem();
 do
 {
+if (rShape.GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR)
+{
+SwFormatAnchor pShapeAnch = rShape.GetAnchor();
+aTextBoxSet.Put(pShapeAnch);
+}
+
 switch (pItem->Which())
 {
 case RES_VERT_ORIENT:
@@ -697,6 +704,10 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
 if (!aRect.IsEmpty())
 aOrient.SetPos(aOrient.GetPos() + aRect.getY());
 
+if (rShape.GetAnchor().GetAnchorId() == 
RndStdIds::FLY_AT_PAGE)
+{
+
aOrient.SetRelationOrient(rShape.GetVertOrient().GetRelationOrient());
+}
 aTextBoxSet.Put(aOrient);
 
 // restore height (shrunk for extending beyond the page 
bottom - tdf#91260)
@@ -717,6 +728,10 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
 if (!aRect.IsEmpty())
 aOrient.SetPos(aOrient.GetPos() + aRect.getX());
 
+if (rShape.GetAnchor().GetAnchorId() == 
RndStdIds::FLY_AT_PAGE)
+{
+
aOrient.SetRelationOrient(rShape.GetHoriOrient().GetRelationOrient());
+}
 aTextBoxSet.Put(aOrient);
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits