diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-28 13:31:52 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-28 16:43:05 +0100 |
commit | 552361aaad740e55fcfa7993b4111aba354f863f (patch) | |
tree | 404e58340d40ca54a9485c5a5f7f52ed1e00f5d3 /sw | |
parent | 13ebef097dbbf1e8663bcb3649daba4ee8295a40 (diff) |
sw: add AnchorType parameter to .uno:Paste
Which allows not hardcoding as-char for LOK.
Change-Id: I3b2987abbaf1f259c614b7b2a8709f15048d362d
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/inc/swdtflvr.hxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/inc/wrtsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 8 |
5 files changed, 21 insertions, 15 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 0c4e60e0326a..1aa955a93dc3 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1131,7 +1131,7 @@ bool SwTransferable::IsPaste( const SwWrtShell& rSh, return bIsPaste; } -bool SwTransferable::Paste( SwWrtShell& rSh, TransferableDataHelper& rData ) +bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, sal_uInt16 nAnchorType) { sal_uInt16 nEventAction, nAction=0; SotExchangeDest nDestination = SwTransferable::GetSotDestination( rSh ); @@ -1172,7 +1172,7 @@ bool SwTransferable::Paste( SwWrtShell& rSh, TransferableDataHelper& rData ) return EXCHG_INOUT_ACTION_NONE != nAction && SwTransferable::PasteData( rData, rSh, nAction, nFormat, - nDestination, false, false ); + nDestination, false, false, nullptr, 0, false, nAnchorType ); } bool SwTransferable::PasteData( TransferableDataHelper& rData, @@ -1180,7 +1180,7 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData, SotExchangeDest nDestination, bool bIsPasteFormat, bool bIsDefault, const Point* pPt, sal_Int8 nDropAction, - bool bPasteSelection ) + bool bPasteSelection, sal_uInt16 nAnchorType ) { SwWait aWait( *rSh.GetView().GetDocShell(), false ); std::unique_ptr<SwTrnsfrActionAndUndo> pAction; @@ -1513,7 +1513,7 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData, case EXCHG_OUT_ACTION_INSERT_GRAPH: bRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SwPasteSdr::Insert, pPt, - nActionFlags, nDropAction, bNeedToSelectBeforePaste); + nActionFlags, nDropAction, bNeedToSelectBeforePaste, nAnchorType ); break; case EXCHG_OUT_ACTION_REPLACE_DRAWOBJ: @@ -2256,7 +2256,7 @@ bool SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData, bool SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, SotClipboardFormatId nFormat, SwPasteSdr nAction, const Point* pPt, - sal_uInt8 nActionFlags, sal_Int8 nDropAction, bool bNeedToSelectBeforePaste) + sal_uInt8 nActionFlags, sal_Int8 nDropAction, bool bNeedToSelectBeforePaste, sal_uInt16 nAnchorType ) { bool bRet = false; @@ -2364,7 +2364,7 @@ bool SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, case SwPasteSdr::Insert: { SwTransferable::SetSelInShell( rSh, false, pPt ); - rSh.Insert( sURL, aEmptyOUStr, aGraphic ); + rSh.Insert( sURL, aEmptyOUStr, aGraphic, nullptr, false, nAnchorType ); break; } diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx index 8f9bd43b407b..852fbe6c0c35 100644 --- a/sw/source/uibase/inc/swdtflvr.hxx +++ b/sw/source/uibase/inc/swdtflvr.hxx @@ -104,7 +104,7 @@ class SW_DLLPUBLIC SwTransferable : public TransferableHelper static bool _PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, SotClipboardFormatId nFormat, SwPasteSdr nAction, const Point* pPt, - sal_uInt8 nActionFlags, sal_Int8 nDropAction, bool bNeedToSelectBeforePaste); + sal_uInt8 nActionFlags, sal_Int8 nDropAction, bool bNeedToSelectBeforePaste, sal_uInt16 nAnchorType = 0 ); static bool _PasteImageMap( TransferableDataHelper& rData, SwWrtShell& rSh ); @@ -167,13 +167,13 @@ public: // paste - methods and helper methods for the paste static bool IsPaste( const SwWrtShell&, const TransferableDataHelper& ); - static bool Paste( SwWrtShell&, TransferableDataHelper& ); + static bool Paste( SwWrtShell&, TransferableDataHelper&, sal_uInt16 nAnchorType = 0 ); static bool PasteData( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uInt16 nAction, SotClipboardFormatId nFormat, SotExchangeDest nDestination, bool bIsPasteFormat, bool bIsDefault, const Point* pDDPos = nullptr, sal_Int8 nDropAction = 0, - bool bPasteSelection = false ); + bool bPasteSelection = false, sal_uInt16 nAnchorType = 0 ); static bool IsPasteSpecial( const SwWrtShell& rWrtShell, const TransferableDataHelper& ); diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index dae1c2cdcf3e..ff159305dd6d 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -291,7 +291,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); // graphic void Insert( const OUString &rPath, const OUString &rFilter, const Graphic &, SwFlyFrameAttrMgr * = nullptr, - bool bRule = false ); + bool bRule = false, sal_uInt16 nAnchorType = 0 ); void InsertByWord( const OUString & ); void InsertPageBreak(const OUString *pPageDesc = nullptr, const ::boost::optional<sal_uInt16>& rPgNum = boost::none); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index b11d402ffc32..be0bc3d4dc4a 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -285,7 +285,13 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq) // Temporary variables, because the shell could already be // destroyed after the paste. SwView* pView = &rView; - SwTransferable::Paste( rSh, aDataHelper ); + + const SfxUInt16Item* pAnchorType = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1); + if (pAnchorType) + SwTransferable::Paste(rSh, aDataHelper, pAnchorType->GetValue()); + else + SwTransferable::Paste(rSh, aDataHelper); + if( rSh.IsFrameSelected() || rSh.IsObjSelected() ) rSh.EnterSelFrameMode(); pView->AttrChangedNotify( &rSh ); diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index aa4324e2315b..b03c8926bdec 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -241,7 +241,7 @@ void SwWrtShell::Insert( const OUString &rStr ) void SwWrtShell::Insert( const OUString &rPath, const OUString &rFilter, const Graphic &rGrf, SwFlyFrameAttrMgr *pFrameMgr, - bool bRule ) + bool bRule, sal_uInt16 nAnchorType ) { ResetCursorStack(); if ( !CanInsert() ) @@ -277,9 +277,9 @@ void SwWrtShell::Insert( const OUString &rPath, const OUString &rFilter, // These must be removed explicitly for the optimal size. pFrameMgr->DelAttr(RES_FRM_SIZE); - if (comphelper::LibreOfficeKit::isActive()) - // LOK: anchor inserted images as-char by default. - pFrameMgr->SetAnchor(FLY_AS_CHAR); + if (nAnchorType != 0) + // Something other than at-para was requested. + pFrameMgr->SetAnchor(static_cast<RndStdIds>(nAnchorType)); } else { |