sw/qa/extras/unowriter/unowriter.cxx | 13 +++++++++++++ sw/source/uibase/frmdlg/frmmgr.cxx | 5 +++++ 2 files changed, 18 insertions(+)
New commits: commit 4f40bf6a79de6d60da0a5090cdfeda6242e889f0 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Jul 4 15:50:31 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Jul 4 16:40:51 2019 +0200 sw: insert image: set anchor to as-char by default See the mailing list thread at https://www.mail-archive.com/search?l=mid&q=999e55c8-5d15-1014-e6f9-9f3d19d00...@collabora.com (minutes of ESC call ..., 2019-05-09) for motivation, this is meant to improve Word compatibility, by not defaulting to the at-paragraph anchor type, which is unavailable in Word. See tdf#45778 and tdf#87720 for related bugs. Change-Id: I2699ce04dce02e8436dc3af3b2cc8778f8dc476c Reviewed-on: https://gerrit.libreoffice.org/75091 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 31c7571b7153..ae042c1210a3 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -27,6 +27,8 @@ #include <PostItMgr.hxx> #include <postithelper.hxx> #include <AnnotationWin.hxx> +#include <flyfrm.hxx> +#include <fmtanchr.hxx> using namespace ::com::sun::star; @@ -521,6 +523,17 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testPasteListener) OUString aGraphicURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "test.jpg"; rView.InsertGraphic(aGraphicURL, OUString(), /*bAsLink=*/false, &GraphicFilter::GetGraphicFilter()); + + // Test that the pasted image is anchored as-char. + SwFlyFrame* pFly = pWrtShell->GetSelectedFlyFrame(); + CPPUNIT_ASSERT(pFly); + SwFrameFormat* pFlyFormat = pFly->GetFormat(); + CPPUNIT_ASSERT(pFlyFormat); + RndStdIds eFlyAnchor = pFlyFormat->GetAnchor().GetAnchorId(); + // Without the working image listener in place, this test would have + // failed, eFlyAnchor was FLY_AT_PARA. + CPPUNIT_ASSERT_EQUAL(RndStdIds::FLY_AS_CHAR, eFlyAnchor); + pTransfer->Cut(); pListener->GetString().clear(); SwTransferable::Paste(*pWrtShell, aHelper); diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx index 5dbca0fcfe59..2c2205b1597c 100644 --- a/sw/source/uibase/frmdlg/frmmgr.cxx +++ b/sw/source/uibase/frmdlg/frmmgr.cxx @@ -85,6 +85,11 @@ SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nT m_aSet.Put( SwFormatFrameSize( ATT_MIN_SIZE, DFLT_WIDTH, DFLT_HEIGHT )); if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) ) m_aSet.Put( SwFormatHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::PRINT_AREA ) ); + + if (nType == Frmmgr_Type::GRF || nType == Frmmgr_Type::OLE) + { + m_aSet.Put(SwFormatAnchor(RndStdIds::FLY_AS_CHAR)); + } } else if ( nType == Frmmgr_Type::NONE ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits