diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/unowriter/unowriter.cxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/frmdlg/frmmgr.cxx | 5 |
2 files changed, 18 insertions, 0 deletions
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 ) { |