23#include <com/sun/star/embed/XEmbedPersist.hpp>
24#include <com/sun/star/embed/XEmbeddedObject.hpp>
36#include <editeng/editeng.hxx>
70 SdNavigatorDropEvent (
86 SD_MOD()->pTransferClip = pTransferable.get();
99 SdPage* pNewPage =
const_cast<SdPage*
>(
static_cast<const SdPage*
>( pTransferable->GetWorkDocument()->GetPage( 0 ) ));
111 if(
auto pOle2Obj =
dynamic_cast<SdrOle2Obj *
>( pObj ) )
112 if( pOle2Obj->GetObjRef() )
117 uno::Reference< embed::XEmbedPersist > xPersObj( pOle2Obj->GetObjRef(), uno::UNO_QUERY );
118 if ( xPersObj.is() && xPersObj->hasEntry() )
119 pSdrOleObj = pOle2Obj;
121 catch( uno::Exception& )
129 pTransferable->GetWorkDocument()->GetDocSh()->FillTransferableObjectDescriptor( *pObjDesc );
134 pObjDesc->maSize = aMarkRect.GetSize();
136 pTransferable->SetStartPos( aMarkRect.TopLeft() );
137 pTransferable->SetObjectDescriptor( std::move(pObjDesc) );
140 return pTransferable;
147 SD_MOD()->pTransferDrag = pTransferable.get();
150 OUString aDisplayName;
157 if(
auto pOle2Obj =
dynamic_cast<SdrOle2Obj *
>( pObj ) )
158 if( pOle2Obj->GetObjRef() )
163 uno::Reference< embed::XEmbedPersist > xPersObj( pOle2Obj->GetObjRef(), uno::UNO_QUERY );
164 if ( xPersObj.is() && xPersObj->hasEntry() )
165 pSdrOleObj = pOle2Obj;
167 catch( uno::Exception& )
181 pObjDesc->maDragStartPos = rDragPos;
182 pObjDesc->maDisplayName = aDisplayName;
184 pTransferable->SetStartPos( rDragPos );
185 pTransferable->SetObjectDescriptor( std::move(pObjDesc) );
188 return pTransferable;
197 SD_MOD()->pTransferSelection = pTransferable.get();
205 pObjDesc->maSize = aMarkRect.GetSize();
207 pTransferable->SetStartPos( aMarkRect.TopLeft() );
208 pTransferable->SetObjectDescriptor( std::move(pObjDesc) );
209 pTransferable->CopyToPrimarySelection();
211 return pTransferable;
232 if (
SD_MOD()->pTransferSelection &&
SD_MOD()->pTransferSelection->GetView() ==
this)
235 SD_MOD()->pTransferSelection =
nullptr;
297 for( sal_Int32 nPara = nParaCount - 2; nPara >= 0; nPara-- )
299 const sal_Int32 nParaLen = rEdit.
GetTextLen( nPara );
321 if (pDrViewSh !=
nullptr)
324 if( !
InsertData( aDataHelper, aPos, nDnDAction,
false ) )
328 if( ( aDataHelper.
HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) &&
329 aDataHelper.
GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
330 ( aDataHelper.
HasFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ) &&
331 aDataHelper.
GetINetBookmark( SotClipboardFormatId::FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
332 ( aDataHelper.
HasFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) &&
333 aDataHelper.
GetINetBookmark( SotClipboardFormatId::UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
355 if (
FuDraw* pFunction =
dynamic_cast<FuDraw*
>(xFunction.get()))
356 pFunction->ForcePointer();
377 if( pDragTransferable )
378 pDragTransferable->
SetView(
nullptr );
392 for(
size_t nm = nCnt; nm>0; )
402 for (
size_t nm = nCnt; nm>0;)
412 DBG_ASSERT(pChkObj.get()==pObj,
"pChkObj!=pObj in RemoveObject()");
420 if( pDragTransferable )
441 assert(pLayer &&
"layer missing");
442 aLayerName = pLayer->
GetName();
448 bool bIsInsideOutlinerView =
false;
463 bIsInsideOutlinerView =
true;
467 if( !bIsInsideOutlinerView )
474 pDragTransferable =
nullptr;
477 if( pDragTransferable )
479 const View* pSourceView = pDragTransferable->
GetView();
485 else if( pSourceView )
496 const bool bDrawing = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::DRAWING );
497 const bool bGraphic = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::SVXB );
498 const bool bMtf = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::GDIMETAFILE );
499 const bool bBitmap = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::BITMAP );
500 bool bBookmark = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK );
501 bool bXFillExchange = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::XFA );
504 if ((bXFillExchange && (SdrDragMode::Gradient ==
GetDragMode()))
513 if( pIAOHandle && ( SdrHdlKind::Color == pIAOHandle->
GetKind() ) )
529 if( !nRet && ( bXFillExchange || ( ( bDrawing || bGraphic || bMtf || bBitmap || bBookmark ) && ( nDropAction &
DND_ACTION_LINK ) ) ) )
535 bool bIsPresTarget =
false;
542 bIsPresTarget = pPage->
IsPresObj( pPickObj );
545 if (pPickObj && !bIsPresTarget && (bGraphic || bMtf || bBitmap || bXFillExchange))
561 bXFillExchange =
false;
567 const bool bSBAFormat = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::SVX_FORMFIELDEXCH );
568 const bool bEditEngineODF = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT );
569 const bool bString = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::STRING );
570 const bool bRTF = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::RTF );
571 const bool bFile = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE );
572 const bool bFileList = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::FILE_LIST );
583 if( bDrawing || bGraphic || bMtf || bBitmap || bBookmark || bFile || bFileList || bXFillExchange || bSBAFormat || bEditEngineODF || bString || bRTF )
588 && rTargetHelper.IsDropFormatSupported(
627 bool bIsInsideOutlinerView =
false;
644 bIsInsideOutlinerView =
true;
648 if( !bIsInsideOutlinerView )
659 && aDataHelper.
HasFormat(SotClipboardFormatId::XFA)))
667 if( pIAOHandle && ( SdrHdlKind::Color == pIAOHandle->
GetKind() ) )
671 uno::Any const data(aDataHelper.
GetAny(SotClipboardFormatId::XFA,
""));
672 uno::Sequence<beans::NamedValue>
props;
677 auto const it =
map.find(
"FillColor");
681 color.PutValue(it->second, 0);
682 aColor =
color.GetColorValue();
684 static_cast< SdrHdlColor*
>( pIAOHandle )->SetColor( aColor,
true );
693 if( !nRet &&
InsertData( aDataHelper, aPos, nDropAction,
true, SotClipboardFormatId::NONE, nPage, nLayer ) )
699 INetBookmark aINetBookmark( (OUString()), (OUString()) );
702 if( aDataHelper.
HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) &&
703 aDataHelper.
GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) )
707 if( pPageObjsTransferable &&
713 new SdNavigatorDropEvent( rEvt, pTargetWindow ) );
724 OUString aBookmark( aINetBookmark.
GetURL() );
727 if( !aBookmark.isEmpty() )
729 bool bCreated =
false;
731 presentation::ClickAction eClickAction = presentation::ClickAction_DOCUMENT;
733 sal_Int32
nIndex = aBookmark.indexOf(
'#' );
736 const std::u16string_view aDocName( aBookmark.subView( 0,
nIndex ) );
741 eClickAction = presentation::ClickAction_BOOKMARK;
742 aBookmark = aBookmark.copy(
nIndex+1 );
765 pAction->SetBookmark(pInfo->
GetBookmark(), aBookmark);
772 OUString aString(
SdResId(STR_UNDO_ANIMATION));
773 pAction->SetComment(aString);
785 pDrawViewShell->InsertURLButton( aINetBookmark.
GetURL(), aINetBookmark.
GetDescription(), OUString(), &aPos );
799 SdNavigatorDropEvent* pSdNavigatorDropEvent =
static_cast<SdNavigatorDropEvent*
>(
p);
804 if( pPageObjsTransferable && aDataHelper.
GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) )
808 SdPage* pPage =
static_cast<SdPage*
>( GetSdrPageView()->GetPage() );
809 sal_uInt16 nPgPos = 0xFFFF;
811 if( pSdNavigatorDropEvent->mpTargetWindow )
812 aPos = pSdNavigatorDropEvent->mpTargetWindow->PixelToLogic( pSdNavigatorDropEvent->maPosPixel );
814 const OUString&
aURL( aINetBookmark.
GetURL() );
819 std::vector<OUString> aExchangeList;
820 std::vector<OUString> aBookmarkList(1,aBookmark);
834 bool bNameOK = GetExchangeList( aExchangeList, aBookmarkList, 2 );
842 mrDoc.InsertBookmark( aBookmarkList, aExchangeList,
849 delete pSdNavigatorDropEvent;
853 std::vector<OUString> &rBookmarkList,
854 const sal_uInt16 nType)
856 assert(rExchangeList.empty());
858 bool bListIdentical =
true;
861 for (
const auto& rBookmark : rBookmarkList )
863 OUString aNewName = rBookmark;
872 OUString aTitle(
SdResId(STR_TITLE_NAMEGROUP));
873 OUString aDesc(
SdResId(STR_DESC_NAMEGROUP));
881 pDlg->SetText( aTitle );
883 while( !bNameOK && pDlg->Execute() ==
RET_OK )
885 pDlg->GetName( aNewName );
893 bListIdentical = rBookmark == aNewName;
895 rExchangeList.push_back(aNewName);
902 if( !rExchangeList.empty() && bListIdentical )
903 rExchangeList.
clear();
VclPtr< sd::Window > mpTargetWindow
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const override
sal_Int32 GetParagraphCount() const
sal_Int32 GetTextLen() const
static bool HasValidData(const css::uno::Reference< css::datatransfer::XTransferable > &rTransferable)
const OUString & GetDescription() const
const OUString & GetURL() const
OUString GetURLNoPass(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
vcl::Window * GetWindow() const
tools::Rectangle const & GetOutputArea() const
Outliner * GetOutliner() const
const EditEngine & GetEditEngine() const
bool SetUpdateLayout(bool bUpdate)
void QuickDelete(const ESelection &rSel)
void QuickInsertLineBreak(const ESelection &rSel)
sal_Int32 GetParagraphCount() const
bool mbPlayFull
play sound completely.
css::presentation::AnimationEffect meTextEffect
Animation effect for text content.
bool mbDimHide
hide rather than dim
css::presentation::AnimationEffect meEffect
Animation effect.
void SetBookmark(const OUString &rBookmark)
css::presentation::ClickAction meClickAction
Action at mouse click.
Color maDimColor
for fading the object
sal_uInt16 mnVerb
for OLE object
css::presentation::AnimationEffect meSecondEffect
for object fading.
bool mbSecondSoundOn
for object fading.
OUString GetBookmark() const
OUString maSoundFile
Path to the sound file in MS DOS notation.
css::presentation::AnimationSpeed meSpeed
Speed of the animation.
bool mbDimPrevious
Object fade out.
bool mbSoundOn
Sound on / off.
bool mbSecondPlayFull
for object fading.
css::presentation::AnimationSpeed meSecondSpeed
for object fading.
static SdAnimationInfo * GetShapeUserData(SdrObject &rObject, bool bCreate=false)
SAL_DLLPRIVATE void CreatingDataObj(SdTransferable *pTransferable)
static SAL_DLLPRIVATE SdAnimationInfo * GetAnimationInfo(SdrObject *pObject)
deprecated
SAL_DLLPRIVATE SdrObject * GetObj(std::u16string_view rObjName) const
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
static SdPageObjsTransferable * getImplementation(const css::uno::Reference< css::uno::XInterface > &rxData) noexcept
NavigatorDragType GetDragType() const
static SotClipboardFormatId GetListBoxDropFormatId()
Return a temporary transferable data flavor that is used internally in the navigator for reordering e...
::sd::DrawDocShell & GetDocShell() const
bool IsPresObj(const SdrObject *pObj)
PageKind GetPageKind() const
PresObjKind GetPresObjKind(SdrObject *pObj) const
virtual OUString GetLayoutName() const override
virtual void SetSize(const Size &aSize) override
bool IsPageTransferable() const
const ::sd::View * GetView() const
void SetInternalMove(bool bSet)
bool IsInternalMove() const
void SetView(const ::sd::View *pView)
virtual void BrkAction() override
virtual bool IsAction() const override
bool IsUndoEnabled() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
size_t GetHdlCount() const
SdrHdl * GetHdl(size_t nNum) const
SdrHdlKind GetKind() const
const sdr::overlay::OverlayObjectList & getOverlayObjectList() const
SdrLayer * GetLayerPerID(SdrLayerID nID)
const OUString & GetName() const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
SdrObject * GetMarkedObjectByIndex(size_t nNum) const
const SdrHdlList & GetHdlList() const
SdrObject * PickObj(const Point &rPnt, short nTol, SdrPageView *&rpPV, SdrSearchOptions nOptions, SdrObject **ppRootObj, bool *pbHitPassDirect=nullptr) const
tools::Rectangle GetAllMarkedBoundRect() const
size_t GetMarkedObjectCount() const
SdrMark * GetSdrMarkByIndex(size_t nNum) const
SdrDragMode GetDragMode() const
OUString const & GetDescriptionOfMarkedObjects() const
const tools::Rectangle & GetAllMarkedRect() const
SdrObject * GetMarkedSdrObj() const
SdrUndoFactory & GetSdrUndoFactory() const
const SdrLayerAdmin & GetLayerAdmin() const
SdrTextObj * GetTextEditObject() const
const OutlinerView * GetTextEditOutlinerView() const
virtual bool IsTextEdit() const final override
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
sal_uInt32 GetOrdNumDirect() const
SdrObjUserCall * GetUserCall() const
bool IsEmptyPresObj() const
SdrPage * getSdrPageFromSdrObject() const
virtual const tools::Rectangle & GetLogicRect() const
sal_Int64 GetAspect() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
const Graphic * GetGraphic() const
bool IsLayerVisible(const OUString &rName) const
SdrPage * GetPage() const
bool IsLayerLocked(const OUString &rName) const
sal_uInt16 GetPageNum() const
bool IsMasterPage() const
SdrPageView * GetSdrPageView() const
sal_uInt16 getHitTolLog() const
const OUString & GetActiveLayer() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeleteObject(SdrObject &rObject, bool bOrdNumDirect=false)
virtual void DeleteMarked()
const INetURLObject & GetURLObject() const
const OUString & GetName() const
void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc) const
SfxMedium * GetMedium() const
const OUString & GetName() const
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
static void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc, const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, const Graphic *pGraphic, sal_Int64 nAspect)
virtual VclPtr< AbstractSvxNameDialog > CreateSvxNameDialog(weld::Window *pParent, const OUString &rName, const OUString &rDesc)=0
static SvxAbstractDialogFactory * Create()
css::uno::Any GetAny(SotClipboardFormatId nFormat, const OUString &rDestDoc) const
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
bool HasFormat(SotClipboardFormatId nFormat) const
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
bool GetINetBookmark(SotClipboardFormatId nFormat, INetBookmark &rBmk) const
css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable() const
static void ClearPrimarySelection()
virtual SfxUndoManager * GetUndoManager() override
sd::ViewShell * GetViewShell()
bool CheckPageName(weld::Window *pWin, OUString &rName)
checks, if the given name is a valid new name for a slide
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
void InsertURLField(const OUString &rURL, const OUString &rText, const OUString &rTarget)
Base class for all Draw specific functions.
static bool IsRunning(ViewShellBase const &rBase)
returns true if there is a running presentation for the given ViewShellBase
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
SD_DLLPUBLIC weld::Window * GetFrameWeld() const
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
css::uno::Reference< css::datatransfer::XTransferable > CreateSelectionDataObject(::sd::View *)
virtual void DragFinished(sal_Int8 nDropAction)
bool IsPresObjSelected(bool bOnPage=true, bool bOnMasterPage=true, bool bCheckPresObjListOnly=false, bool bCheckLayoutOnly=false) const
Is a presentation object selected?
css::uno::Reference< css::datatransfer::XTransferable > CreateDragDataObject(::sd::View *, vcl::Window &rWindow, const Point &rDragPos)
DrawDocShell * GetDocSh() const
bool GetExchangeList(std::vector< OUString > &rExchangeList, std::vector< OUString > &rBookmarkList, const sal_uInt16 nType)
return parameter: pExchangeList == NULL -> all names are unique bNameOK == false -> cancel by user nT...
SdrObject * mpDropMarkerObj
css::uno::Reference< css::datatransfer::XTransferable > CreateClipboardDataObject()
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt, DropTargetHelper &rTargetHelper, SdrLayerID nLayer)
void StartDrag(const Point &rStartPos, vcl::Window *pWindow)
void ClearSelectionClipboard()
std::unique_ptr< SdrMarkList > mpDragSrcMarkList
bool InsertData(const TransferableDataHelper &rDataHelper, const Point &rPos, sal_Int8 &rDnDAction, bool bDrag, SotClipboardFormatId nFormat=SotClipboardFormatId::NONE, sal_uInt16 nPage=SDRPAGE_NOTFOUND, SdrLayerID nLayer=SDRLAYER_NOTFOUND)
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
ends current text editing
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt, ::sd::Window *pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer)
void UpdateSelectionClipboard()
void ImplClearDrawDropMarker()
std::unique_ptr< SdrDropMarkerOverlay > mpDropMarker
sal_uInt16 mnDragSrcPgNum
void DoPaste(::sd::Window *pWindow=nullptr)
An SdWindow contains the actual working area of ViewShell.
bool isHitPixel(const Point &rDiscretePosition) const
Point PixelToLogic(const Point &rDevicePt) const
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define DBG_ASSERT(sCon, aError)
constexpr OUStringLiteral HID_SD_NAMEDIALOG_OBJECT
#define LINK(Instance, Class, Member)
IMPL_LINK(SdCharHeightPropertyBox, implMenuSelectHdl, const OUString &, rIdent, void)
@ NAVIGATOR_DRAGTYPE_EMBEDDED
@ NAVIGATOR_DRAGTYPE_LINK
OUString SdResId(TranslateId aId)
std::map< OUString, rtl::Reference< Entity > > map
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
#define SDR_HANDLE_COLOR_SIZE_SELECTED
#define SDR_HANDLE_COLOR_SIZE_NORMAL
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)
#define DND_ACTION_COPYMOVE