LibreOffice Module sd (master) 1
sdview3.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <View.hxx>
21#include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
22#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
23#include <com/sun/star/embed/MSOLEObjectSystemCreator.hpp>
24#include <com/sun/star/lang/XComponent.hpp>
25#include <sot/filelist.hxx>
26#include <editeng/editdata.hxx>
27#include <svx/xfillit0.hxx>
28#include <svx/xflclit.hxx>
29#include <svx/xlnclit.hxx>
30#include <svx/svdpagv.hxx>
31#include <sfx2/docfile.hxx>
32#include <svx/svdoole2.hxx>
33#include <svx/svdograf.hxx>
34#include <svx/svdundo.hxx>
35#include <svl/itempool.hxx>
36#include <sot/formats.hxx>
37#include <editeng/outliner.hxx>
38#include <svx/obj3d.hxx>
39#include <svx/e3dundo.hxx>
40#include <svx/unomodel.hxx>
41#include <svx/ImageMapInfo.hxx>
43#include <vcl/graph.hxx>
44#include <vcl/metaact.hxx>
45#include <vcl/pdfread.hxx>
47#include <svx/svxids.hrc>
49#include <svtools/embedhlp.hxx>
50#include <osl/diagnose.h>
51#include <DrawDocShell.hxx>
52#include <fupoor.hxx>
53#include <tablefunction.hxx>
54#include <Window.hxx>
55#include <sdxfer.hxx>
56#include <sdpage.hxx>
57#include <drawdoc.hxx>
58#include <sdmod.hxx>
59#include <sdresid.hxx>
60#include <strings.hrc>
62#include <unomodel.hxx>
63#include <ViewClipboard.hxx>
64#include <sfx2/ipclient.hxx>
70#include <svx/xbtmpit.hxx>
71#include <memory>
72
73
74using namespace ::com::sun::star;
75using namespace ::com::sun::star::lang;
76using namespace ::com::sun::star::uno;
77using namespace ::com::sun::star::io;
78using namespace ::com::sun::star::datatransfer;
80
81namespace sd {
82
83#define CHECK_FORMAT_TRANS( _def_Type ) ( ( nFormat == (_def_Type) || nFormat == SotClipboardFormatId::NONE ) && aDataHelper.HasFormat( _def_Type ) )
84
85/*************************************************************************
86|*
87|* Paste
88|*
89\************************************************************************/
90
91namespace {
92
93struct ImpRememberOrigAndClone
94{
95 SdrObject* pOrig;
96 SdrObject* pClone;
97};
98
99}
100
101static SdrObject* ImpGetClone(std::vector<ImpRememberOrigAndClone>& aConnectorContainer, SdrObject const * pConnObj)
102{
103 for(const ImpRememberOrigAndClone& rImp : aConnectorContainer)
104 {
105 if(pConnObj == rImp.pOrig)
106 return rImp.pClone;
107 }
108 return nullptr;
109}
110
111// restrict movement to WorkArea
112static void ImpCheckInsertPos(Point& rPos, const Size& rSize, const ::tools::Rectangle& rWorkArea)
113{
114 if(rWorkArea.IsEmpty())
115 return;
116
117 ::tools::Rectangle aMarkRect(Point(rPos.X() - (rSize.Width() / 2), rPos.Y() - (rSize.Height() / 2)), rSize);
118
119 if(aMarkRect.Contains(rWorkArea))
120 return;
121
122 if(aMarkRect.Left() < rWorkArea.Left())
123 {
124 rPos.AdjustX(rWorkArea.Left() - aMarkRect.Left() );
125 }
126
127 if(aMarkRect.Right() > rWorkArea.Right())
128 {
129 rPos.AdjustX( -(aMarkRect.Right() - rWorkArea.Right()) );
130 }
131
132 if(aMarkRect.Top() < rWorkArea.Top())
133 {
134 rPos.AdjustY(rWorkArea.Top() - aMarkRect.Top() );
135 }
136
137 if(aMarkRect.Bottom() > rWorkArea.Bottom())
138 {
139 rPos.AdjustY( -(aMarkRect.Bottom() - rWorkArea.Bottom()) );
140 }
141}
142
143bool View::InsertMetaFile( const TransferableDataHelper& rDataHelper, const Point& rPos, ImageMap const * pImageMap, bool bOptimize )
144{
145 GDIMetaFile aMtf;
146
147 if( !rDataHelper.GetGDIMetaFile( SotClipboardFormatId::GDIMETAFILE, aMtf ) )
148 return false;
149
150 bool bVector = false;
151 Graphic aGraphic;
152
153 // check if metafile only contains a pixel image, if so insert a bitmap instead
154 if( bOptimize )
155 {
156 MetaAction* pAction = aMtf.FirstAction();
157 while( pAction && !bVector )
158 {
159 switch( pAction->GetType() )
160 {
161 case MetaActionType::POINT:
162 case MetaActionType::LINE:
163 case MetaActionType::RECT:
164 case MetaActionType::ROUNDRECT:
165 case MetaActionType::ELLIPSE:
166 case MetaActionType::ARC:
167 case MetaActionType::PIE:
168 case MetaActionType::CHORD:
169 case MetaActionType::POLYLINE:
170 case MetaActionType::POLYGON:
171 case MetaActionType::POLYPOLYGON:
172 case MetaActionType::TEXT:
173 case MetaActionType::TEXTARRAY:
174 case MetaActionType::STRETCHTEXT:
175 case MetaActionType::TEXTRECT:
176 case MetaActionType::GRADIENT:
177 case MetaActionType::HATCH:
178 case MetaActionType::WALLPAPER:
179 case MetaActionType::EPS:
180 case MetaActionType::TEXTLINE:
181 case MetaActionType::FLOATTRANSPARENT:
182 case MetaActionType::GRADIENTEX:
183 case MetaActionType::BMPSCALEPART:
184 case MetaActionType::BMPEXSCALEPART:
185 bVector = true;
186 break;
187 case MetaActionType::BMP:
188 case MetaActionType::BMPSCALE:
189 case MetaActionType::BMPEX:
190 case MetaActionType::BMPEXSCALE:
191 if( aGraphic.GetType() != GraphicType::NONE )
192 {
193 bVector = true;
194 }
195 else switch( pAction->GetType() )
196 {
197 case MetaActionType::BMP:
198 {
199 MetaBmpAction* pBmpAction = dynamic_cast< MetaBmpAction* >( pAction );
200 if( pBmpAction )
201 aGraphic = Graphic(BitmapEx(pBmpAction->GetBitmap()));
202 }
203 break;
204 case MetaActionType::BMPSCALE:
205 {
206 MetaBmpScaleAction* pBmpScaleAction = dynamic_cast< MetaBmpScaleAction* >( pAction );
207 if( pBmpScaleAction )
208 aGraphic = Graphic(BitmapEx(pBmpScaleAction->GetBitmap()));
209 }
210 break;
211 case MetaActionType::BMPEX:
212 {
213 MetaBmpExAction* pBmpExAction = dynamic_cast< MetaBmpExAction* >( pAction );
214 if( pBmpExAction )
215 aGraphic = Graphic(pBmpExAction->GetBitmapEx() );
216 }
217 break;
218 case MetaActionType::BMPEXSCALE:
219 {
220 MetaBmpExScaleAction* pBmpExScaleAction = dynamic_cast< MetaBmpExScaleAction* >( pAction );
221 if( pBmpExScaleAction )
222 aGraphic = Graphic( pBmpExScaleAction->GetBitmapEx() );
223 }
224 break;
225 default: break;
226 }
227 break;
228 default: break;
229 }
230
231 pAction = aMtf.NextAction();
232 }
233 }
234
235 // it is not a vector metafile but it also has no graphic?
236 if( !bVector && (aGraphic.GetType() == GraphicType::NONE) )
237 bVector = true;
238
239 // restrict movement to WorkArea
240 Point aInsertPos( rPos );
241 Size aImageSize = bVector ? aMtf.GetPrefSize() : aGraphic.GetSizePixel();
242 ImpCheckInsertPos(aInsertPos, aImageSize, GetWorkArea());
243
244 if( bVector )
245 aGraphic = Graphic( aMtf );
246
247 aGraphic.SetPrefMapMode( aMtf.GetPrefMapMode() );
248 aGraphic.SetPrefSize( aMtf.GetPrefSize() );
249 InsertGraphic( aGraphic, mnAction, aInsertPos, nullptr, pImageMap );
250
251 return true;
252}
253
255 const Point& rPos, sal_Int8& rDnDAction, bool bDrag,
256 SotClipboardFormatId nFormat, sal_uInt16 nPage, SdrLayerID nLayer )
257{
258 maDropPos = rPos;
259 mnAction = rDnDAction;
260 mbIsDropAllowed = false;
261
262 TransferableDataHelper aDataHelper( rDataHelper );
263 SdrObject* pPickObj = nullptr;
264 SdPage* pPage = nullptr;
265 std::unique_ptr<ImageMap> pImageMap;
266 bool bReturn = false;
267 bool bLink = ( ( mnAction & DND_ACTION_LINK ) != 0 );
268 bool bCopy = ( ( ( mnAction & DND_ACTION_COPY ) != 0 ) || bLink );
269 SdrInsertFlags nPasteOptions = SdrInsertFlags::SETDEFLAYER;
270
271 if (mpViewSh != nullptr)
272 {
273 OSL_ASSERT (mpViewSh->GetViewShell()!=nullptr);
275 if( dynamic_cast< ::sd::slidesorter::SlideSorterViewShell *>( mpViewSh ) != nullptr
276 || (pIpClient!=nullptr && pIpClient->IsObjectInPlaceActive()))
277 nPasteOptions |= SdrInsertFlags::DONTMARK;
278 }
279
280 if( bDrag )
281 {
282 SdrPageView* pPV = nullptr;
283 pPickObj = PickObj(rPos, getHitTolLog(), pPV);
284 }
285
286 if( nPage != SDRPAGE_NOTFOUND )
287 pPage = static_cast<SdPage*>( mrDoc.GetPage( nPage ) );
288
289 SdTransferable* pOwnData = nullptr;
290 SdTransferable* pImplementation = SdTransferable::getImplementation( aDataHelper.GetTransferable() );
291
292 if(pImplementation && (rDnDAction & DND_ACTION_LINK))
293 {
294 // suppress own data when it's intention is to use it as fill information
295 pImplementation = nullptr;
296 }
297
298 bool bSelfDND = false;
299
300 // try to get own transfer data
301 if( pImplementation )
302 {
303 if( SD_MOD()->pTransferClip == pImplementation )
304 pOwnData = SD_MOD()->pTransferClip;
305 else if( SD_MOD()->pTransferDrag == pImplementation )
306 {
307 pOwnData = SD_MOD()->pTransferDrag;
308 bSelfDND = true;
309 }
310 else if( SD_MOD()->pTransferSelection == pImplementation )
311 pOwnData = SD_MOD()->pTransferSelection;
312 }
313
314 const bool bGroupUndoFromDragWithDrop = bSelfDND && mpDragSrcMarkList && IsUndoEnabled();
315 if (bGroupUndoFromDragWithDrop)
316 {
317 OUString aStr(SdResId(STR_UNDO_DRAGDROP));
318 BegUndo(aStr + " " + mpDragSrcMarkList->GetMarkDescription());
319 }
320
321 // ImageMap?
322 if( !pOwnData && aDataHelper.HasFormat( SotClipboardFormatId::SVIM ) )
323 {
325
326 if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVIM, xStm ) )
327 {
328 pImageMap.reset(new ImageMap);
329 // mba: clipboard always must contain absolute URLs (could be from alien source)
330 pImageMap->Read( *xStm );
331 }
332 }
333
334 bool bTable = false;
335 // check special cases for pasting table formats as RTL
336 if( !bLink && (nFormat == SotClipboardFormatId::NONE || (nFormat == SotClipboardFormatId::RTF) || (nFormat == SotClipboardFormatId::RICHTEXT)) )
337 {
338 // if the object supports rtf and there is a table involved, default is to create a table
339 bool bIsRTF = aDataHelper.HasFormat( SotClipboardFormatId::RTF );
340 if( ( bIsRTF || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) )
341 && ! aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) )
342 {
344
345 if( aDataHelper.GetSotStorageStream( bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) )
346 {
347 xStm->Seek( 0 );
348
349 OStringBuffer aLine;
350 while (xStm->ReadLine(aLine))
351 {
352 size_t x = std::string_view(aLine).find( "\\trowd" );
353 if (x != std::string_view::npos)
354 {
355 bTable = true;
356 nFormat = bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT;
357 break;
358 }
359 }
360 }
361 }
362 }
363
364 // Changed the whole decision tree to be dependent of bReturn as a flag that
365 // the work was done; this allows to check multiple formats and not just fail
366 // when a CHECK_FORMAT_TRANS(*format*) detected format does not work. This is
367 // e.g. necessary for SotClipboardFormatId::BITMAP
368
369 if (!bReturn && pOwnData)
370 {
371 // Paste only if SfxClassificationHelper recommends so.
372 const SfxObjectShellRef& pSource = pOwnData->GetDocShell();
373 SfxObjectShell* pDestination = mrDoc.GetDocSh();
374 if (pSource.is() && pDestination)
375 {
376 SfxClassificationCheckPasteResult eResult = SfxClassificationHelper::CheckPaste(pSource->getDocProperties(), pDestination->getDocProperties());
378 bReturn = true;
379 }
380 }
381
382 if( !bReturn && pOwnData && nFormat == SotClipboardFormatId::NONE )
383 {
384 const View* pSourceView = pOwnData->GetView();
385
386 if( pOwnData->GetDocShell().is() && pOwnData->IsPageTransferable() )
387 {
388 mpClipboard->HandlePageDrop (*pOwnData);
389 bReturn = true;
390 }
391 else if( pSourceView )
392 {
393 if( pSourceView == this )
394 {
395 // same view
396 if( nLayer != SDRLAYER_NOTFOUND )
397 {
398 // drop on layer tab bar
399 SdrLayerAdmin& rLayerAdmin = mrDoc.GetLayerAdmin();
400 SdrLayer* pLayer = rLayerAdmin.GetLayerPerID( nLayer );
402 OUString aLayer = pLayer->GetName();
403
404 if( !pPV->IsLayerLocked( aLayer ) )
405 {
406 pOwnData->SetInternalMove( true );
408
409 for( size_t nM = 0; nM < GetMarkedObjectCount(); ++nM )
410 {
411 SdrMark* pM = GetSdrMarkByIndex( nM );
412 SdrObject* pO = pM->GetMarkedSdrObj();
413
414 if( pO )
415 {
416 // #i11702#
417 if( IsUndoEnabled() )
418 {
419 BegUndo(SdResId(STR_MODIFYLAYER));
420 AddUndo(GetModel().GetSdrUndoFactory().CreateUndoObjectLayerChange(*pO, pO->GetLayer(), nLayer));
421 EndUndo();
422 }
423
424 pO->SetLayer( nLayer );
425 }
426 }
427
428 bReturn = true;
429 }
430 }
431 else
432 {
434 bool bDropOnTabBar = true;
435
436 if( !pPage && pPV->GetPage()->GetPageNum() != mnDragSrcPgNum )
437 {
438 pPage = static_cast<SdPage*>( pPV->GetPage() );
439 bDropOnTabBar = false;
440 }
441
442 if( pPage )
443 {
444 // drop on other page
445 OUString aActiveLayer = GetActiveLayer();
446
447 if( !pPV->IsLayerLocked( aActiveLayer ) )
448 {
449 if( !IsPresObjSelected() )
450 {
451 SdrMarkList* pMarkList;
452
454 {
455 pMarkList = mpDragSrcMarkList.get();
456 }
457 else
458 {
459 // actual mark list is used
460 pMarkList = new SdrMarkList( GetMarkedObjectList());
461 }
462
463 pMarkList->ForceSort();
464
465 // stuff to remember originals and clones
466 std::vector<ImpRememberOrigAndClone> aConnectorContainer;
467 size_t nConnectorCount = 0;
468 Point aCurPos;
469
470 // calculate real position of current
471 // source objects, if necessary (#103207)
472 if( pOwnData == SD_MOD()->pTransferSelection )
473 {
474 ::tools::Rectangle aCurBoundRect;
475
476 if( pMarkList->TakeBoundRect( pPV, aCurBoundRect ) )
477 aCurPos = aCurBoundRect.TopLeft();
478 else
479 aCurPos = pOwnData->GetStartPos();
480 }
481 else
482 aCurPos = pOwnData->GetStartPos();
483
484 const Size aVector( maDropPos.X() - aCurPos.X(), maDropPos.Y() - aCurPos.Y() );
485
486 std::unordered_set<rtl::OUString> aNameSet;
487 for(size_t a = 0; a < pMarkList->GetMarkCount(); ++a)
488 {
489 SdrMark* pM = pMarkList->GetMark(a);
491
492 if(pObj)
493 {
494 if(!bDropOnTabBar)
495 {
496 // do a NbcMove(...) instead of setting SnapRects here
497 pObj->NbcMove(aVector);
498 }
499
501 if (bCopy || (pMarkParent && pMarkParent->IsGroupObject()))
502 pPage->InsertObjectThenMakeNameUnique(pObj.get(), aNameSet);
503 else
504 pPage->InsertObject(pObj.get());
505
506 if( IsUndoEnabled() )
507 {
508 BegUndo(SdResId(STR_UNDO_DRAGDROP));
509 AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pObj));
510 EndUndo();
511 }
512
513 ImpRememberOrigAndClone aRem;
514 aRem.pOrig = pM->GetMarkedSdrObj();
515 aRem.pClone = pObj.get();
516 aConnectorContainer.push_back(aRem);
517
518 if(dynamic_cast< SdrEdgeObj *>( pObj.get() ) != nullptr)
519 nConnectorCount++;
520 }
521 }
522
523 // try to re-establish connections at clones
524 if(nConnectorCount)
525 {
526 for(size_t a = 0; a < aConnectorContainer.size(); ++a)
527 {
528 ImpRememberOrigAndClone* pRem = &aConnectorContainer[a];
529
530 if(auto pCloneEdge = dynamic_cast<SdrEdgeObj *>( pRem->pClone ))
531 {
532 SdrEdgeObj* pOrigEdge = static_cast<SdrEdgeObj*>(pRem->pOrig);
533
534 // test first connection
535 SdrObjConnection& rConn0 = pOrigEdge->GetConnection(false);
536 SdrObject* pConnObj = rConn0.GetObject();
537 if(pConnObj)
538 {
539 SdrObject* pConnClone = ImpGetClone(aConnectorContainer, pConnObj);
540 if(pConnClone)
541 {
542 // if dest obj was cloned, too, re-establish connection
543 pCloneEdge->ConnectToNode(false, pConnClone);
544 pCloneEdge->GetConnection(false).SetConnectorId(rConn0.GetConnectorId());
545 }
546 else
547 {
548 // set position of connection point of original connected object
549 const SdrGluePointList* pGlueList = pConnObj->GetGluePointList();
550 if(pGlueList)
551 {
552 sal_uInt16 nInd = pGlueList->FindGluePoint(rConn0.GetConnectorId());
553
554 if(SDRGLUEPOINT_NOTFOUND != nInd)
555 {
556 const SdrGluePoint& rGluePoint = (*pGlueList)[nInd];
557 Point aPosition = rGluePoint.GetAbsolutePos(*pConnObj);
558 aPosition.AdjustX(aVector.Width() );
559 aPosition.AdjustY(aVector.Height() );
560 pCloneEdge->SetTailPoint(false, aPosition);
561 }
562 }
563 }
564 }
565
566 // test second connection
567 SdrObjConnection& rConn1 = pOrigEdge->GetConnection(true);
568 pConnObj = rConn1.GetObject();
569 if(pConnObj)
570 {
571 SdrObject* pConnClone = ImpGetClone(aConnectorContainer, pConnObj);
572 if(pConnClone)
573 {
574 // if dest obj was cloned, too, re-establish connection
575 pCloneEdge->ConnectToNode(true, pConnClone);
576 pCloneEdge->GetConnection(true).SetConnectorId(rConn1.GetConnectorId());
577 }
578 else
579 {
580 // set position of connection point of original connected object
581 const SdrGluePointList* pGlueList = pConnObj->GetGluePointList();
582 if(pGlueList)
583 {
584 sal_uInt16 nInd = pGlueList->FindGluePoint(rConn1.GetConnectorId());
585
586 if(SDRGLUEPOINT_NOTFOUND != nInd)
587 {
588 const SdrGluePoint& rGluePoint = (*pGlueList)[nInd];
589 Point aPosition = rGluePoint.GetAbsolutePos(*pConnObj);
590 aPosition.AdjustX(aVector.Width() );
591 aPosition.AdjustY(aVector.Height() );
592 pCloneEdge->SetTailPoint(true, aPosition);
593 }
594 }
595 }
596 }
597 }
598 }
599 }
600
601 if( pMarkList != mpDragSrcMarkList.get() )
602 delete pMarkList;
603
604 bReturn = true;
605 }
606 else
607 {
609 bReturn = false;
610 }
611 }
612 }
613 else
614 {
615 pOwnData->SetInternalMove( true );
616 MoveAllMarked( Size( maDropPos.X() - pOwnData->GetStartPos().X(),
617 maDropPos.Y() - pOwnData->GetStartPos().Y() ), bCopy );
618 bReturn = true;
619 }
620 }
621 }
622 else
623 {
624 // different views
625 if( !pSourceView->IsPresObjSelected() )
626 {
627 // model is owned by from AllocModel() created DocShell
628 SdDrawDocument* pSourceDoc = static_cast<SdDrawDocument*>(&pSourceView->GetModel());
629 pSourceDoc->CreatingDataObj( pOwnData );
630 SdDrawDocument* pModel = static_cast<SdDrawDocument*>( pSourceView->CreateMarkedObjModel().release() );
631 bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions);
632
633 if( !pPage )
634 pPage = static_cast<SdPage*>( GetSdrPageView()->GetPage() );
635
636 OUString aLayout = pPage->GetLayoutName();
637 sal_Int32 nPos = aLayout.indexOf(SD_LT_SEPARATOR);
638 if (nPos != -1)
639 aLayout = aLayout.copy(0, nPos);
640 pPage->SetPresentationLayout( aLayout, false, false );
641 pSourceDoc->CreatingDataObj( nullptr );
642 }
643 else
644 {
646 bReturn = false;
647 }
648 }
649 }
650 else
651 {
652 SdDrawDocument* pWorkModel = const_cast<SdDrawDocument*>(pOwnData->GetWorkDocument());
653 SdPage* pWorkPage = pWorkModel->GetSdPage( 0, PageKind::Standard );
654
655 pWorkPage->SetSdrObjListRectsDirty();
656
657 // #i120393# Clipboard data uses full object geometry range
658 const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
659
660 maDropPos.setX( pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 ) );
661 maDropPos.setY( pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 ) );
662
663 // delete pages, that are not of any interest for us
664 for( ::tools::Long i = pWorkModel->GetPageCount() - 1; i >= 0; i-- )
665 {
666 SdPage* pP = static_cast< SdPage* >( pWorkModel->GetPage( static_cast<sal_uInt16>(i) ) );
667
668 if( pP->GetPageKind() != PageKind::Standard )
669 pWorkModel->DeletePage( static_cast<sal_uInt16>(i) );
670 }
671
672 bReturn = Paste(*pWorkModel, maDropPos, pPage, nPasteOptions);
673
674 if( !pPage )
675 pPage = static_cast<SdPage*>( GetSdrPageView()->GetPage() );
676
677 OUString aLayout = pPage->GetLayoutName();
678 sal_Int32 nPos = aLayout.indexOf(SD_LT_SEPARATOR);
679 if (nPos != -1)
680 aLayout = aLayout.copy(0, nPos);
681 pPage->SetPresentationLayout( aLayout, false, false );
682 }
683 }
684
685 if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::PDF ))
686 {
688 if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::PDF, xStm ) )
689 {
690 Point aInsertPos(rPos);
691 Graphic aGraphic;
692 if (vcl::ImportPDF(*xStm, aGraphic))
693 {
694 const sal_Int32 nGraphicContentSize(xStm->Tell());
695 xStm->Seek(0);
696 BinaryDataContainer aGraphicContent(*xStm, nGraphicContentSize);
697 aGraphic.SetGfxLink(std::make_shared<GfxLink>(aGraphicContent, GfxLinkType::NativePdf));
698
699 InsertGraphic(aGraphic, mnAction, aInsertPos, nullptr, nullptr);
700 bReturn = true;
701 }
702 }
703 }
704
705 if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::DRAWING ))
706 {
708
709 if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStm ) )
710 {
711 DrawDocShellRef xShell = new DrawDocShell(SfxObjectCreateMode::INTERNAL, false, DocumentType::Impress);
712 xShell->DoInitNew();
713
714 SdDrawDocument* pModel = xShell->GetDoc();
715 pModel->InsertPage(pModel->AllocPage(false).get());
716
717 Reference< XComponent > xComponent = xShell->GetModel();
718 xStm->Seek( 0 );
719
720 css::uno::Reference< css::io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) );
721 bReturn = SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Impress.XMLOasisImporter" );
722
723 if( pModel->GetPageCount() == 0 )
724 {
725 OSL_FAIL("empty or invalid drawing xml document on clipboard!" );
726 }
727 else
728 {
729 bool bChanged = false;
730
731 if( bReturn )
732 {
733 if( pModel->GetSdPage( 0, PageKind::Standard )->GetObjCount() == 1 )
734 {
735 // only one object
736 SdrObject* pObj = pModel->GetSdPage( 0, PageKind::Standard )->GetObj( 0 );
737 SdrPageView* pPV = nullptr;
738 SdrObject* pPickObj2 = PickObj(rPos, getHitTolLog(), pPV);
739
740 if( ( mnAction & DND_ACTION_MOVE ) && pPickObj2 && pObj )
741 {
742 // replace object
743 SdrPage* pWorkPage = GetSdrPageView()->GetPage();
745 ::tools::Rectangle aPickObjRect( pPickObj2->GetCurrentBoundRect() );
746 Size aPickObjSize( aPickObjRect.GetSize() );
747 Point aVec( aPickObjRect.TopLeft() );
748 ::tools::Rectangle aObjRect( pNewObj->GetCurrentBoundRect() );
749 Size aObjSize( aObjRect.GetSize() );
750
751 Fraction aScaleWidth( aPickObjSize.Width(), aObjSize.Width() );
752 Fraction aScaleHeight( aPickObjSize.Height(), aObjSize.Height() );
753 pNewObj->NbcResize( aObjRect.TopLeft(), aScaleWidth, aScaleHeight );
754
755 aVec -= aObjRect.TopLeft();
756 pNewObj->NbcMove( Size( aVec.X(), aVec.Y() ) );
757
758 const bool bUndo = IsUndoEnabled();
759
760 if( bUndo )
761 BegUndo(SdResId(STR_UNDO_DRAGDROP));
762 pNewObj->NbcSetLayer( pPickObj->GetLayer() );
763 pWorkPage->InsertObject( pNewObj.get() );
764 if( bUndo )
765 {
768 }
769 pWorkPage->RemoveObject( pPickObj2->GetOrdNum() );
770
771 if( bUndo )
772 {
773 EndUndo();
774 }
775
776 bChanged = true;
778 }
779 else if( ( mnAction & DND_ACTION_LINK ) && pPickObj && pObj &&
780 dynamic_cast< const SdrGrafObj *>( pPickObj ) == nullptr &&
781 dynamic_cast< const SdrOle2Obj *>( pPickObj ) == nullptr )
782 {
783 SfxItemSet aSet( mrDoc.GetPool() );
784
785 // set new attributes to object
786 const bool bUndo = IsUndoEnabled();
787 if( bUndo )
788 {
789 BegUndo( SdResId(STR_UNDO_DRAGDROP) );
791 }
792
793 aSet.Put( pObj->GetMergedItemSet() );
794
795 /* Do not take over corner radius. There are
796 gradients (rectangles) in the gallery with corner
797 radius of 0. We should not use that on the
798 object. */
800
801 const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
802
803 if(pSdrGrafObj)
804 {
805 // If we have a graphic as source object, use its graphic
806 // content as fill style
807 aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
808 aSet.Put(XFillBitmapItem(pSdrGrafObj->GetGraphic()));
809 }
810
811 pPickObj->SetMergedItemSetAndBroadcast( aSet );
812
813 if( DynCastE3dObject( pPickObj ) && DynCastE3dObject( pObj ) )
814 {
815 // handle 3D attribute in addition
818
819 aOldSet.Put(pPickObj->GetMergedItemSet());
820 aNewSet.Put( pObj->GetMergedItemSet() );
821
822 if( bUndo )
823 AddUndo(
824 std::make_unique<E3dAttributesUndoAction>(
825 *static_cast< E3dObject* >(pPickObj),
826 aNewSet,
827 aOldSet));
828 pPickObj->SetMergedItemSetAndBroadcast( aNewSet );
829 }
830
831 if( bUndo )
832 EndUndo();
833 bChanged = true;
834 }
835 }
836 }
837
838 if( !bChanged )
839 {
840 SdrPage* pWorkPage = pModel->GetSdPage( 0, PageKind::Standard );
841
842 pWorkPage->SetSdrObjListRectsDirty();
843
844 if( pOwnData )
845 {
846 // #i120393# Clipboard data uses full object geometry range
847 const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
848
849 maDropPos.setX( pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 ) );
850 maDropPos.setY( pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 ) );
851 }
852
853 bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions);
854 }
855
856 xShell->DoClose();
857 }
858 }
859 }
860
861 if(!bReturn && CHECK_FORMAT_TRANS(SotClipboardFormatId::SBA_FIELDDATAEXCHANGE))
862 {
863 OUString aOUString;
864
865 if( aDataHelper.GetString( SotClipboardFormatId::SBA_FIELDDATAEXCHANGE, aOUString ) )
866 {
868
869 if( pObj )
870 {
871 ::tools::Rectangle aRect( pObj->GetLogicRect() );
872 Size aSize( aRect.GetSize() );
873
874 maDropPos.AdjustX( -( aSize.Width() >> 1 ) );
875 maDropPos.AdjustY( -( aSize.Height() >> 1 ) );
876
877 aRect.SetPos( maDropPos );
878 pObj->SetLogicRect( aRect );
879 InsertObjectAtView( pObj.get(), *GetSdrPageView(), SdrInsertFlags::SETDEFLAYER );
880 bReturn = true;
881 }
882 }
883 }
884
885 if(!bReturn &&
886 !bLink &&
887 (CHECK_FORMAT_TRANS(SotClipboardFormatId::EMBED_SOURCE) || CHECK_FORMAT_TRANS(SotClipboardFormatId::EMBEDDED_OBJ)) &&
888 aDataHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
889 {
890 //TODO/LATER: is it possible that this format is binary?! (from old versions of SO)
891 uno::Reference < io::XInputStream > xStm;
893
894 if (aDataHelper.GetTransferableObjectDescriptor(SotClipboardFormatId::OBJECTDESCRIPTOR, aObjDesc))
895 {
896 OUString aDocShellID = SfxObjectShell::CreateShellID(mrDoc.GetDocSh());
897 xStm = aDataHelper.GetInputStream(nFormat != SotClipboardFormatId::NONE ? nFormat : SotClipboardFormatId::EMBED_SOURCE, aDocShellID);
898 if (!xStm.is())
899 xStm = aDataHelper.GetInputStream(SotClipboardFormatId::EMBEDDED_OBJ, aDocShellID);
900 }
901
902 if (xStm.is())
903 {
904 if( mrDoc.GetDocSh() && ( mrDoc.GetDocSh()->GetClassName() == aObjDesc.maClassName ) )
905 {
906 uno::Reference < embed::XStorage > xStore( ::comphelper::OStorageHelper::GetStorageFromInputStream( xStm ) );
907 ::sd::DrawDocShellRef xDocShRef( new ::sd::DrawDocShell( SfxObjectCreateMode::EMBEDDED, true, mrDoc.GetDocumentType() ) );
908
909 // mba: BaseURL doesn't make sense for clipboard functionality
910 SfxMedium *pMedium = new SfxMedium( xStore, OUString() );
911 if( xDocShRef->DoLoad( pMedium ) )
912 {
913 SdDrawDocument* pModel = xDocShRef->GetDoc();
914 SdPage* pWorkPage = pModel->GetSdPage( 0, PageKind::Standard );
915
916 pWorkPage->SetSdrObjListRectsDirty();
917
918 if( pOwnData )
919 {
920 // #i120393# Clipboard data uses full object geometry range
921 const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
922
923 maDropPos.setX( pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 ) );
924 maDropPos.setY( pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 ) );
925 }
926
927 // delete pages, that are not of any interest for us
928 for( ::tools::Long i = pModel->GetPageCount() - 1; i >= 0; i-- )
929 {
930 SdPage* pP = static_cast< SdPage* >( pModel->GetPage( static_cast<sal_uInt16>(i) ) );
931
932 if( pP->GetPageKind() != PageKind::Standard )
933 pModel->DeletePage( static_cast<sal_uInt16>(i) );
934 }
935
936 bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions);
937
938 if( !pPage )
939 pPage = static_cast<SdPage*>(GetSdrPageView()->GetPage());
940
941 OUString aLayout = pPage->GetLayoutName();
942 sal_Int32 nPos = aLayout.indexOf(SD_LT_SEPARATOR);
943 if (nPos != -1)
944 aLayout = aLayout.copy(0, nPos);
945 pPage->SetPresentationLayout( aLayout, false, false );
946 }
947
948 xDocShRef->DoClose();
949 xDocShRef.clear();
950
951 }
952 else
953 {
954 OUString aName;
955 uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
956 if ( xObj.is() )
957 {
958 svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
959
960 Size aSize;
961 if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
962 {
963 if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
964 aSize = aObjDesc.maSize;
965 else
966 {
967 MapMode aMapMode( MapUnit::Map100thMM );
968 aSize = aObjRef.GetSize( &aMapMode );
969 }
970 }
971 else
972 {
973 awt::Size aSz;
974 MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
975 if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
976 {
977 Size aTmp(OutputDevice::LogicToLogic(aObjDesc.maSize, MapMode(MapUnit::Map100thMM), MapMode(aMapUnit)));
978 aSz.Width = aTmp.Width();
979 aSz.Height = aTmp.Height();
980 xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
981 }
982
983 try
984 {
985 aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
986 }
987 catch( embed::NoVisualAreaSizeException& )
988 {
989 // if the size still was not set the default size will be set later
990 }
991
992 aSize = Size( aSz.Width, aSz.Height );
993
994 if( !aSize.Width() || !aSize.Height() )
995 {
996 aSize.setWidth( 14100 );
997 aSize.setHeight( 10000 );
998 aSize = OutputDevice::LogicToLogic(Size(14100, 10000), MapMode(MapUnit::Map100thMM), MapMode(aMapUnit));
999 aSz.Width = aSize.Width();
1000 aSz.Height = aSize.Height();
1001 xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
1002 }
1003
1004 aSize = OutputDevice::LogicToLogic(aSize, MapMode(aMapUnit), MapMode(MapUnit::Map100thMM));
1005 }
1006
1007 Size aMaxSize( mrDoc.GetMaxObjSize() );
1008
1009 maDropPos.AdjustX( -(std::min( aSize.Width(), aMaxSize.Width() ) >> 1) );
1010 maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) );
1011
1012 ::tools::Rectangle aRect( maDropPos, aSize );
1015 aObjRef,
1016 aName,
1017 aRect);
1018 SdrPageView* pPV = GetSdrPageView();
1019 SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
1020
1021 if (mpViewSh!=nullptr)
1022 {
1023 OSL_ASSERT (mpViewSh->GetViewShell()!=nullptr);
1024 SfxInPlaceClient* pIpClient
1026 if (pIpClient!=nullptr && pIpClient->IsObjectInPlaceActive())
1027 nOptions |= SdrInsertFlags::DONTMARK;
1028 }
1029
1030 // bInserted of false means that pObj has been deleted
1031 bool bInserted = InsertObjectAtView( pObj.get(), *pPV, nOptions );
1032
1033 if (bInserted && pImageMap)
1034 pObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SvxIMapInfo( *pImageMap )) );
1035
1036 if (bInserted && pObj->IsChart())
1037 {
1038 bool bDisableDataTableDialog = false;
1040 uno::Reference< beans::XPropertySet > xProps( xObj->getComponent(), uno::UNO_QUERY );
1041 if ( xProps.is() &&
1042 ( xProps->getPropertyValue( "DisableDataTableDialog" ) >>= bDisableDataTableDialog ) &&
1043 bDisableDataTableDialog )
1044 {
1045 xProps->setPropertyValue( "DisableDataTableDialog" , uno::Any( false ) );
1046 xProps->setPropertyValue( "DisableComplexChartTypes" , uno::Any( false ) );
1047 uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
1048 if ( xModifiable.is() )
1049 {
1050 xModifiable->setModified( true );
1051 }
1052 }
1053 }
1054
1055 bReturn = true;
1056 }
1057 }
1058 }
1059 }
1060
1061 if(!bReturn &&
1062 !bLink &&
1063 (CHECK_FORMAT_TRANS(SotClipboardFormatId::EMBEDDED_OBJ_OLE) || CHECK_FORMAT_TRANS(SotClipboardFormatId::EMBED_SOURCE_OLE)) &&
1064 aDataHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR_OLE))
1065 {
1066 // online insert ole if format is forced or no gdi metafile is available
1067 if( (nFormat != SotClipboardFormatId::NONE) || !aDataHelper.HasFormat( SotClipboardFormatId::GDIMETAFILE ) )
1068 {
1069 uno::Reference < io::XInputStream > xStm;
1071
1072 if ( aDataHelper.GetTransferableObjectDescriptor( SotClipboardFormatId::OBJECTDESCRIPTOR_OLE, aObjDesc ) )
1073 {
1074 uno::Reference < embed::XEmbeddedObject > xObj;
1075 OUString aName;
1076
1077 xStm = aDataHelper.GetInputStream(nFormat != SotClipboardFormatId::NONE ? nFormat : SotClipboardFormatId::EMBED_SOURCE_OLE, OUString());
1078 if (!xStm.is())
1079 xStm = aDataHelper.GetInputStream(SotClipboardFormatId::EMBEDDED_OBJ_OLE, OUString());
1080
1081 if (xStm.is())
1082 {
1084 }
1085 else
1086 {
1087 try
1088 {
1089 uno::Reference< embed::XStorage > xTmpStor = ::comphelper::OStorageHelper::GetTemporaryStorage();
1090 uno::Reference < embed::XEmbedObjectClipboardCreator > xClipboardCreator =
1091 embed::MSOLEObjectSystemCreator::create( ::comphelper::getProcessComponentContext() );
1092
1093 embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
1094 xTmpStor,
1095 "DummyName" ,
1096 uno::Sequence< beans::PropertyValue >() );
1097
1098 // TODO/LATER: in future InsertedObjectInfo will be used to get container related information
1099 // for example whether the object should be an iconified one
1100 xObj = aInfo.Object;
1101 if ( xObj.is() )
1103 }
1104 catch( uno::Exception& )
1105 {}
1106 }
1107
1108 if ( xObj.is() )
1109 {
1110 svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
1111
1112 // try to get the replacement image from the clipboard
1113 Graphic aGraphic;
1114 SotClipboardFormatId nGrFormat = SotClipboardFormatId::NONE;
1115
1116// (for Selection Manager in Trusted Solaris)
1117#ifndef __sun
1118 if( aDataHelper.GetGraphic( SotClipboardFormatId::SVXB, aGraphic ) )
1119 nGrFormat = SotClipboardFormatId::SVXB;
1120 else if( aDataHelper.GetGraphic( SotClipboardFormatId::GDIMETAFILE, aGraphic ) )
1121 nGrFormat = SotClipboardFormatId::GDIMETAFILE;
1122 else if( aDataHelper.GetGraphic( SotClipboardFormatId::BITMAP, aGraphic ) )
1123 nGrFormat = SotClipboardFormatId::BITMAP;
1124#endif
1125
1126 // insert replacement image ( if there is one ) into the object helper
1127 if ( nGrFormat != SotClipboardFormatId::NONE )
1128 {
1129 datatransfer::DataFlavor aDataFlavor;
1130 SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
1131 aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
1132 }
1133
1134 Size aSize;
1135 if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
1136 {
1137 if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
1138 aSize = aObjDesc.maSize;
1139 else
1140 {
1141 MapMode aMapMode( MapUnit::Map100thMM );
1142 aSize = aObjRef.GetSize( &aMapMode );
1143 }
1144 }
1145 else
1146 {
1147 MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
1148
1149 awt::Size aSz;
1150 try{
1151 aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
1152 }
1153 catch( embed::NoVisualAreaSizeException& )
1154 {
1155 // the default size will be set later
1156 }
1157
1158 if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
1159 {
1160 Size aTmp(OutputDevice::LogicToLogic(aObjDesc.maSize, MapMode(MapUnit::Map100thMM), MapMode(aMapUnit)));
1161 if ( aSz.Width != aTmp.Width() || aSz.Height != aTmp.Height() )
1162 {
1163 aSz.Width = aTmp.Width();
1164 aSz.Height = aTmp.Height();
1165 xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
1166 }
1167 }
1168
1169 aSize = Size( aSz.Width, aSz.Height );
1170
1171 if( !aSize.Width() || !aSize.Height() )
1172 {
1173 aSize = OutputDevice::LogicToLogic(Size(14100, 10000), MapMode(MapUnit::Map100thMM), MapMode(aMapUnit));
1174 aSz.Width = aSize.Width();
1175 aSz.Height = aSize.Height();
1176 xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
1177 }
1178
1179 aSize = OutputDevice::LogicToLogic(aSize, MapMode(aMapUnit), MapMode(MapUnit::Map100thMM));
1180 }
1181
1182 Size aMaxSize( mrDoc.GetMaxObjSize() );
1183
1184 maDropPos.AdjustX( -(std::min( aSize.Width(), aMaxSize.Width() ) >> 1) );
1185 maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) );
1186
1187 ::tools::Rectangle aRect( maDropPos, aSize );
1190 aObjRef,
1191 aName,
1192 aRect);
1193 SdrPageView* pPV = GetSdrPageView();
1194 SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
1195
1196 if (mpViewSh!=nullptr)
1197 {
1198 OSL_ASSERT (mpViewSh->GetViewShell()!=nullptr);
1199 SfxInPlaceClient* pIpClient
1201 if (pIpClient!=nullptr && pIpClient->IsObjectInPlaceActive())
1202 nOptions |= SdrInsertFlags::DONTMARK;
1203 }
1204
1205 bReturn = InsertObjectAtView( pObj.get(), *pPV, nOptions );
1206
1207 if (bReturn)
1208 {
1209 if( pImageMap )
1210 pObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SvxIMapInfo( *pImageMap )) );
1211
1212 // let the object stay in loaded state after insertion
1213 pObj->Unload();
1214 }
1215 }
1216 }
1217 }
1218
1219 if( !bReturn && aDataHelper.HasFormat( SotClipboardFormatId::GDIMETAFILE ) )
1220 {
1221 // if no object was inserted, insert a picture
1222 InsertMetaFile( aDataHelper, rPos, pImageMap.get(), true );
1223 bReturn = true;
1224 }
1225 }
1226
1227 if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(SotClipboardFormatId::SVXB))
1228 {
1230
1231 if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ) )
1232 {
1233 Point aInsertPos( rPos );
1234 Graphic aGraphic;
1235
1236 TypeSerializer aSerializer(*xStm);
1237 aSerializer.readGraphic(aGraphic);
1238
1239 if( pOwnData && pOwnData->GetWorkDocument() )
1240 {
1241 const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument();
1242 SdrPage* pWorkPage = const_cast<SdrPage*>( ( pWorkModel->GetPageCount() > 1 ) ?
1243 pWorkModel->GetSdPage( 0, PageKind::Standard ) :
1244 pWorkModel->GetPage( 0 ) );
1245
1246 pWorkPage->SetSdrObjListRectsDirty();
1247
1248 // #i120393# Clipboard data uses full object geometry range
1249 const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
1250
1251 aInsertPos.setX( pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 ) );
1252 aInsertPos.setY( pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 ) );
1253 }
1254
1255 // restrict movement to WorkArea
1256 Size aImageMapSize = OutputDevice::LogicToLogic(aGraphic.GetPrefSize(),
1257 aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM));
1258
1259 ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea());
1260
1261 InsertGraphic( aGraphic, mnAction, aInsertPos, nullptr, pImageMap.get() );
1262 bReturn = true;
1263 }
1264 }
1265
1266 if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(SotClipboardFormatId::GDIMETAFILE))
1267 {
1268 Point aInsertPos( rPos );
1269
1270 if( pOwnData && pOwnData->GetWorkDocument() )
1271
1272 {
1273 const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument();
1274 SdrPage* pWorkPage = const_cast<SdrPage*>( ( pWorkModel->GetPageCount() > 1 ) ?
1275 pWorkModel->GetSdPage( 0, PageKind::Standard ) :
1276 pWorkModel->GetPage( 0 ) );
1277
1278 pWorkPage->SetSdrObjListRectsDirty();
1279
1280 // #i120393# Clipboard data uses full object geometry range
1281 const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
1282
1283 aInsertPos.setX( pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 ) );
1284 aInsertPos.setY( pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 ) );
1285 }
1286
1287 bReturn = InsertMetaFile( aDataHelper, aInsertPos, pImageMap.get(), nFormat == SotClipboardFormatId::NONE );
1288 }
1289
1290 if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(SotClipboardFormatId::BITMAP))
1291 {
1292 BitmapEx aBmpEx;
1293
1294 // get basic Bitmap data
1295 aDataHelper.GetBitmapEx(SotClipboardFormatId::BITMAP, aBmpEx);
1296
1297 if(aBmpEx.IsEmpty())
1298 {
1299 // if this did not work, try to get graphic formats and convert these to bitmap
1300 Graphic aGraphic;
1301
1302 if(aDataHelper.GetGraphic(SotClipboardFormatId::GDIMETAFILE, aGraphic))
1303 {
1304 aBmpEx = aGraphic.GetBitmapEx();
1305 }
1306 else if(aDataHelper.GetGraphic(SotClipboardFormatId::SVXB, aGraphic))
1307 {
1308 aBmpEx = aGraphic.GetBitmapEx();
1309 }
1310 else if(aDataHelper.GetGraphic(SotClipboardFormatId::BITMAP, aGraphic))
1311 {
1312 aBmpEx = aGraphic.GetBitmapEx();
1313 }
1314 }
1315
1316 if(!aBmpEx.IsEmpty())
1317 {
1318 Point aInsertPos( rPos );
1319
1320 if( pOwnData && pOwnData->GetWorkDocument() )
1321 {
1322 const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument();
1323 SdrPage* pWorkPage = const_cast<SdrPage*>( ( pWorkModel->GetPageCount() > 1 ) ?
1324 pWorkModel->GetSdPage( 0, PageKind::Standard ) :
1325 pWorkModel->GetPage( 0 ) );
1326
1327 pWorkPage->SetSdrObjListRectsDirty();
1328
1329 // #i120393# Clipboard data uses full object geometry range
1330 const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
1331
1332 aInsertPos.setX( pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 ) );
1333 aInsertPos.setY( pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 ) );
1334 }
1335
1336 // restrict movement to WorkArea
1337 Size aImageMapSize(aBmpEx.GetPrefSize());
1338 ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea());
1339
1340 InsertGraphic( aBmpEx, mnAction, aInsertPos, nullptr, pImageMap.get() );
1341 bReturn = true;
1342 }
1343 }
1344
1345 if(!bReturn && pPickObj && CHECK_FORMAT_TRANS( SotClipboardFormatId::XFA ) )
1346 {
1347 uno::Any const data(aDataHelper.GetAny(SotClipboardFormatId::XFA, ""));
1348 uno::Sequence<beans::NamedValue> props;
1349 if (data >>= props)
1350 {
1351 if( IsUndoEnabled() )
1352 {
1353 BegUndo( SdResId(STR_UNDO_DRAGDROP) );
1354 AddUndo(GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
1355 EndUndo();
1356 }
1357
1359 drawing::FillStyle eFill(drawing::FillStyle_BITMAP); // default to something that's ignored
1360 Color aColor(COL_BLACK);
1361 auto it = map.find("FillStyle");
1362 if (it != map.end())
1363 {
1364 XFillStyleItem style;
1365 style.PutValue(it->second, 0);
1366 eFill = style.GetValue();
1367 }
1368 it = map.find("FillColor");
1369 if (it != map.end())
1370 {
1372 color.PutValue(it->second, 0);
1373 aColor = color.GetColorValue();
1374 }
1375
1376 if( eFill == drawing::FillStyle_SOLID || eFill == drawing::FillStyle_NONE )
1377 {
1378 SfxItemSet aSet( mrDoc.GetPool() );
1379 bool bClosed = pPickObj->IsClosedObj();
1381 double fHitLog = pWin->PixelToLogic(Size(FuPoor::HITPIX, 0 ) ).Width();
1382 const ::tools::Long n2HitLog = fHitLog * 2;
1383 Point aHitPosR( rPos );
1384 Point aHitPosL( rPos );
1385 Point aHitPosT( rPos );
1386 Point aHitPosB( rPos );
1387 const SdrLayerIDSet* pVisiLayer = &GetSdrPageView()->GetVisibleLayers();
1388
1389 aHitPosR.AdjustX(n2HitLog );
1390 aHitPosL.AdjustX( -n2HitLog );
1391 aHitPosT.AdjustY(n2HitLog );
1392 aHitPosB.AdjustY( -n2HitLog );
1393
1394 if( bClosed &&
1395 SdrObjectPrimitiveHit(*pPickObj, aHitPosR, {fHitLog, fHitLog}, *GetSdrPageView(), pVisiLayer, false) &&
1396 SdrObjectPrimitiveHit(*pPickObj, aHitPosL, {fHitLog, fHitLog}, *GetSdrPageView(), pVisiLayer, false) &&
1397 SdrObjectPrimitiveHit(*pPickObj, aHitPosT, {fHitLog, fHitLog}, *GetSdrPageView(), pVisiLayer, false) &&
1398 SdrObjectPrimitiveHit(*pPickObj, aHitPosB, {fHitLog, fHitLog}, *GetSdrPageView(), pVisiLayer, false) )
1399 {
1400 // area fill
1401 if(eFill == drawing::FillStyle_SOLID )
1402 aSet.Put(XFillColorItem("", aColor));
1403
1404 aSet.Put( XFillStyleItem( eFill ) );
1405 }
1406 else
1407 aSet.Put( XLineColorItem( "", aColor ) );
1408
1409 // add text color
1410 pPickObj->SetMergedItemSetAndBroadcast( aSet );
1411 }
1412 bReturn = true;
1413 }
1414 }
1415
1416 if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::HTML))
1417 {
1419
1420 if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::HTML, xStm ) )
1421 {
1422 xStm->Seek( 0 );
1423 // mba: clipboard always must contain absolute URLs (could be from alien source)
1424 bReturn = SdrView::Paste( *xStm, EETextFormat::Html, maDropPos, pPage, nPasteOptions );
1425 }
1426 }
1427
1428 if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT))
1429 {
1431 if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, xStm ) )
1432 {
1434
1435 xStm->Seek( 0 );
1436
1437 if( pOLV )
1438 {
1439 ::tools::Rectangle aRect( pOLV->GetOutputArea() );
1440 Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
1441
1442 if( aRect.Contains( aPos ) || ( !bDrag && IsTextEdit() ) )
1443 {
1444 // mba: clipboard always must contain absolute URLs (could be from alien source)
1445 pOLV->Read( *xStm, EETextFormat::Xml, mpDocSh->GetHeaderAttributes() );
1446 bReturn = true;
1447 }
1448 }
1449
1450 if( !bReturn )
1451 // mba: clipboard always must contain absolute URLs (could be from alien source)
1452 bReturn = SdrView::Paste( *xStm, EETextFormat::Xml, maDropPos, pPage, nPasteOptions );
1453 }
1454 }
1455
1456 if(!bReturn && !bLink)
1457 {
1458 bool bIsRTF = CHECK_FORMAT_TRANS(SotClipboardFormatId::RTF);
1459 if (bIsRTF || CHECK_FORMAT_TRANS(SotClipboardFormatId::RICHTEXT))
1460 {
1462
1463 if( aDataHelper.GetSotStorageStream( bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) )
1464 {
1465 xStm->Seek( 0 );
1466
1467 if( bTable )
1468 {
1469 bReturn = PasteRTFTable( xStm, pPage, nPasteOptions );
1470 }
1471 else
1472 {
1474
1475 if( pOLV )
1476 {
1477 ::tools::Rectangle aRect( pOLV->GetOutputArea() );
1478 Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
1479
1480 if( aRect.Contains( aPos ) || ( !bDrag && IsTextEdit() ) )
1481 {
1482 // mba: clipboard always must contain absolute URLs (could be from alien source)
1483 pOLV->Read( *xStm, EETextFormat::Rtf, mpDocSh->GetHeaderAttributes() );
1484 bReturn = true;
1485 }
1486 }
1487
1488 if( !bReturn )
1489 // mba: clipboard always must contain absolute URLs (could be from alien source)
1490 bReturn = SdrView::Paste( *xStm, EETextFormat::Rtf, maDropPos, pPage, nPasteOptions );
1491 }
1492 }
1493 }
1494 }
1495
1496 if(!bReturn && CHECK_FORMAT_TRANS(SotClipboardFormatId::FILE_LIST))
1497 {
1498 FileList aDropFileList;
1499
1500 if( aDataHelper.GetFileList( SotClipboardFormatId::FILE_LIST, aDropFileList ) )
1501 {
1502 maDropFileVector.clear();
1503
1504 for( sal_uLong i = 0, nCount = aDropFileList.Count(); i < nCount; i++ )
1505 maDropFileVector.push_back( aDropFileList.GetFile( i ) );
1506
1508 }
1509
1510 bReturn = true;
1511 }
1512
1513 if(!bReturn && CHECK_FORMAT_TRANS(SotClipboardFormatId::SIMPLE_FILE))
1514 {
1515 OUString aDropFile;
1516
1517 if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aDropFile ) )
1518 {
1519 maDropFileVector.clear();
1520 maDropFileVector.push_back( aDropFile );
1522 }
1523
1524 bReturn = true;
1525 }
1526
1527 if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::STRING))
1528 {
1529 if( ( SotClipboardFormatId::STRING == nFormat ) ||
1530 ( !aDataHelper.HasFormat( SotClipboardFormatId::SOLK ) &&
1531 !aDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) &&
1532 !aDataHelper.HasFormat( SotClipboardFormatId::FILENAME ) ) )
1533 {
1534 OUString aOUString;
1535
1536 if( aDataHelper.GetString( SotClipboardFormatId::STRING, aOUString ) )
1537 {
1539
1540 if( pOLV )
1541 {
1542 pOLV->InsertText( aOUString );
1543 bReturn = true;
1544 }
1545
1546 if( !bReturn )
1547 bReturn = SdrView::Paste( aOUString, maDropPos, pPage, nPasteOptions );
1548 }
1549 }
1550 }
1551
1553 mbIsDropAllowed = true;
1554 rDnDAction = mnAction;
1555
1556 if (bGroupUndoFromDragWithDrop)
1557 {
1558 // this is called eventually by the underlying toolkit anyway in the case of a self-dnd
1559 // but we call it early in this case to group its undo actions into this open dnd undo group
1560 // and rely on that repeated calls to View::DragFinished are safe to do
1562 EndUndo();
1563 }
1564
1565 return bReturn;
1566}
1567
1568bool View::PasteRTFTable( const ::tools::SvRef<SotTempStream>& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions )
1569{
1570 DrawDocShellRef xShell = new DrawDocShell(SfxObjectCreateMode::INTERNAL, false, DocumentType::Impress);
1571 xShell->DoInitNew();
1572
1573 SdDrawDocument* pModel = xShell->GetDoc();
1574 pModel->GetItemPool().SetDefaultMetric(MapUnit::Map100thMM);
1575 pModel->InsertPage(pModel->AllocPage(false).get());
1576
1577 CreateTableFromRTF(*xStm, pModel);
1578 bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions);
1579
1580 xShell->DoClose();
1581
1582 return bRet;
1583}
1584
1585} // end of namespace sd
1586
1587/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsEmpty() const
const Size & GetPrefSize() const
virtual bool Paste(const SdrModel &rMod, const Point &rPos, SdrObjList *pLst, SdrInsertFlags nOptions) override
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const override
size_t Count() const
OUString GetFile(size_t nIndex) const
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
rtl::Reference< SdrObject > CreateFieldControl(std::u16string_view rFieldDesc) const
const Size & GetPrefSize() const
MetaAction * NextAction()
MetaAction * FirstAction()
const MapMode & GetPrefMapMode() const
Size GetPrefSize() const
void SetPrefMapMode(const MapMode &rPrefMapMode)
GraphicType GetType() const
void SetGfxLink(const std::shared_ptr< GfxLink > &rGfxLink)
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
MapMode GetPrefMapMode() const
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
void SetPrefSize(const Size &rPrefSize)
virtual void Start(bool bStartTimer=true) override
MetaActionType GetType() const
const Bitmap & GetBitmap() const
const BitmapEx & GetBitmapEx() const
const BitmapEx & GetBitmapEx() const
const Bitmap & GetBitmap() const
void Read(SvStream &rInput, EETextFormat eFormat, SvKeyValueIterator *pHTTPHeaderAttrs)
void InsertText(const OUString &rNew, bool bSelect=false)
vcl::Window * GetWindow() const
tools::Rectangle const & GetOutputArea() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
virtual SAL_DLLPRIVATE rtl::Reference< SdrPage > AllocPage(bool bMasterPage) override
Definition: drawdoc.cxx:652
SAL_DLLPRIVATE SfxItemPool & GetPool()
Definition: drawdoc.hxx:237
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
Definition: drawdoc2.cxx:207
SAL_DLLPRIVATE void InsertPage(SdrPage *pPage, sal_uInt16 nPos=0xFFFF) override
Definition: drawdoc2.cxx:380
SAL_DLLPRIVATE void CreatingDataObj(SdTransferable *pTransferable)
Definition: drawdoc.hxx:255
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
Definition: drawdoc.hxx:242
SAL_DLLPRIVATE void DeletePage(sal_uInt16 nPgNum) override
Definition: drawdoc2.cxx:401
SAL_DLLPRIVATE DocumentType GetDocumentType() const
Definition: drawdoc.hxx:251
PageKind GetPageKind() const
Definition: sdpage.hxx:205
virtual OUString GetLayoutName() const override
Definition: sdpage.hxx:255
void SetPresentationLayout(std::u16string_view rLayoutName, bool bReplaceStyleSheets=true, bool bSetMasterPage=true, bool bReverseOrder=false)
Definition: sdpage2.cxx:75
const SfxObjectShellRef & GetDocShell() const
Definition: sdxfer.hxx:48
bool IsPageTransferable() const
Definition: sdxfer.hxx:67
const ::sd::View * GetView() const
Definition: sdxfer.hxx:54
void SetInternalMove(bool bSet)
Definition: sdxfer.hxx:61
const Point & GetStartPos() const
Definition: sdxfer.hxx:59
const SdDrawDocument * GetWorkDocument() const
Definition: sdxfer.hxx:51
static SdTransferable * getImplementation(const css::uno::Reference< css::uno::XInterface > &rxData) noexcept
Definition: sdxfer.cxx:724
const tools::Rectangle & GetWorkArea() const
SdrObjConnection & GetConnection(bool bTail1)
bool IsUndoEnabled() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
void BegUndo()
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
void MoveAllMarked(const Size &rSiz, bool bCopy=false)
void EndUndo()
virtual bool Paste(const SdrModel &rMod, const Point &rPos, SdrObjList *pLst, SdrInsertFlags nOptions)
sal_uInt16 FindGluePoint(sal_uInt16 nId) const
Point GetAbsolutePos(const SdrObject &rObj) const
const Graphic & GetGraphic() const
SdrLayer * GetLayerPerID(SdrLayerID nID)
const OUString & GetName() const
void ForceSort() const
size_t GetMarkCount() const
bool TakeBoundRect(SdrPageView const *pPageView, tools::Rectangle &rRect) const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
void SortMarkedObjects() const
SdrObject * PickObj(const Point &rPnt, short nTol, SdrPageView *&rpPV, SdrSearchOptions nOptions, SdrObject **ppRootObj, bool *pbHitPassDirect=nullptr) const
size_t GetMarkedObjectCount() const
SdrMark * GetSdrMarkByIndex(size_t nNum) const
SdrObject * GetMarkedSdrObj() const
const SfxItemPool & GetItemPool() const
const Size & GetMaxObjSize() const
SdrUndoFactory & GetSdrUndoFactory() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const SdrLayerAdmin & GetLayerAdmin() const
sal_uInt16 GetPageCount() const
sal_uInt16 GetConnectorId() const
SdrObject * GetObject() const
const OutlinerView * GetTextEditOutlinerView() const
virtual bool IsTextEdit() const final override
const tools::Rectangle & GetAllObjBoundRect() const
void InsertObjectThenMakeNameUnique(SdrObject *pObj)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
void SetSdrObjListRectsDirty()
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
bool IsClosedObj() const
sal_uInt32 GetOrdNum() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
bool IsGroupObject() const
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const=0
virtual const SdrGluePointList * GetGluePointList() const
const SfxItemSet & GetMergedItemSet() const
SdrObject * getParentSdrObjectFromSdrObject() const
virtual SdrLayerID GetLayer() const
virtual void SetLayer(SdrLayerID nLayer)
const SdrLayerIDSet & GetVisibleLayers() const
SdrPage * GetPage() const
bool IsLayerLocked(const OUString &rName) const
sal_uInt16 GetPageNum() const
SdrModel & getSdrModelFromSdrPage() const
SdrModel & getSdrModelFromSdrView() const
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
sal_uInt16 getHitTolLog() const
const OUString & GetActiveLayer() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoNewObject(SdrObject &rObject, bool bOrdNumDirect=false)
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false)
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeleteObject(SdrObject &rObject, bool bOrdNumDirect=false)
static bool ShowPasteInfo(SfxClassificationCheckPasteResult eResult)
static SfxClassificationCheckPasteResult CheckPaste(const css::uno::Reference< css::document::XDocumentProperties > &xSource, const css::uno::Reference< css::document::XDocumentProperties > &xDestination)
bool IsObjectInPlaceActive() const
void SetDefaultMetric(MapUnit eNewMetric)
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
static OUString CreateShellID(const SfxObjectShell *pShell)
SvKeyValueIterator * GetHeaderAttributes()
SfxViewShell * GetViewShell() const
SfxInPlaceClient * GetIPClient() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
bool GetTransferableObjectDescriptor(SotClipboardFormatId nFormat, TransferableObjectDescriptor &rDesc)
bool GetString(SotClipboardFormatId nFormat, OUString &rStr) const
css::uno::Any GetAny(SotClipboardFormatId nFormat, const OUString &rDestDoc) const
bool GetFileList(SotClipboardFormatId nFormat, FileList &rFileList) const
css::uno::Reference< css::io::XInputStream > GetInputStream(SotClipboardFormatId nFormat, const OUString &rDestDoc) const
bool GetSotStorageStream(SotClipboardFormatId nFormat, tools::SvRef< SotTempStream > &rStreamRef) const
bool GetGDIMetaFile(SotClipboardFormatId nFormat, GDIMetaFile &rMtf, size_t nMaxActions=0) const
bool HasFormat(SotClipboardFormatId nFormat) const
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
bool GetBitmapEx(SotClipboardFormatId nFormat, BitmapEx &rBmp) const
bool GetGraphic(SotClipboardFormatId nFormat, Graphic &rGraphic) const
void readGraphic(Graphic &rGraphic)
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
bool InsertEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString &)
static css::uno::Reference< css::embed::XStorage > GetStorageFromInputStream(const css::uno::Reference< css::io::XInputStream > &xStream, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
static css::uno::Reference< css::embed::XStorage > GetTemporaryStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
SfxClassificationCheckPasteResult
static const int HITPIX
Definition: fupoor.hxx:50
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
Definition: ViewShell.hxx:155
virtual void DragFinished(sal_Int8 nDropAction)
Definition: sdview2.cxx:365
bool IsPresObjSelected(bool bOnPage=true, bool bOnMasterPage=true, bool bCheckPresObjListOnly=false, bool bCheckLayoutOnly=false) const
Is a presentation object selected?
Definition: sdview.cxx:523
SdrGrafObj * InsertGraphic(const Graphic &rGraphic, sal_Int8 &rAction, const Point &rPos, SdrObject *pSelectedObj, ImageMap const *pImageMap)
If an empty graphic object is provided, we fill it.
Definition: sdview4.cxx:78
DrawDocShell * mpDocSh
Definition: View.hxx:262
sal_Int8 mnAction
Definition: View.hxx:270
::std::unique_ptr< ViewClipboard > mpClipboard
Definition: View.hxx:286
ViewShell * mpViewSh
Definition: View.hxx:263
bool mbIsDropAllowed
Definition: View.hxx:275
std::unique_ptr< SdrMarkList > mpDragSrcMarkList
Definition: View.hxx:264
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)
Definition: sdview3.cxx:254
bool PasteRTFTable(const ::tools::SvRef< SotTempStream > &xStm, SdrPage *pPage, SdrInsertFlags nPasteOptions)
Definition: sdview3.cxx:1568
SdDrawDocument & mrDoc
Definition: View.hxx:261
sal_uInt16 mnDragSrcPgNum
Definition: View.hxx:267
::std::vector< OUString > maDropFileVector
Definition: View.hxx:269
Point maDropPos
Definition: View.hxx:268
bool InsertMetaFile(const TransferableDataHelper &rDataHelper, const Point &rInsertPos, ImageMap const *pImageMap, bool bOptimize)
gets the metafile from the given transferable helper and insert it as a graphic shape.
Definition: sdview3.cxx:143
Idle maDropErrorIdle
Definition: View.hxx:271
virtual void MarkListHasChanged() override
Definition: sdview.cxx:501
Idle maDropInsertFileIdle
Definition: View.hxx:272
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
void SetGraphic(const Graphic &rGraphic, const OUString &rMediaType)
Size GetSize(MapMode const *pTargetMapMode) const
bool Contains(const Point &rPOINT) const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
void SetPos(const Point &rPoint)
constexpr Size GetSize() const
constexpr tools::Long Right() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
bool is() const
Point PixelToLogic(const Point &rDevicePt) const
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
int nCount
float x
SotClipboardFormatId
constexpr OUStringLiteral SD_LT_SEPARATOR
Definition: glob.hxx:49
OUString aName
uno_Any a
sal_uInt16 nPos
MapUnit
aStr
int i
dictionary props
static void ImpCheckInsertPos(Point &rPos, const Size &rSize, const ::tools::Rectangle &rWorkArea)
Definition: sdview3.cxx:112
static SdrObject * ImpGetClone(std::vector< ImpRememberOrigAndClone > &aConnectorContainer, SdrObject const *pConnObj)
Definition: sdview3.cxx:101
void CreateTableFromRTF(SvStream &rStream, SdDrawDocument *pModel)
long Long
bool ImportPDF(SvStream &rStream, Graphic &rGraphic)
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
#define SD_MOD()
Definition: sdmod.hxx:184
SVXCORE_DLLPUBLIC SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, const basegfx::B2DVector &rHitTolerance, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer=nullptr)
#define CHECK_FORMAT_TRANS(_def_Type)
Definition: sdview3.cxx:83
sal_uIntPtr sal_uLong
std::map< OUString, rtl::Reference< Entity > > map
constexpr TypedWhichId< SdrMetricItem > SDRATTR_CORNER_RADIUS(SDRATTR_MISC_FIRST+0)
SdrInsertFlags
#define SDRGLUEPOINT_NOTFOUND
SVXCORE_DLLPUBLIC E3dObject * DynCastE3dObject(SdrObject *)
#define SDRPAGE_NOTFOUND
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)
#define DND_ACTION_MOVE
#define DND_ACTION_COPY
#define DND_ACTION_LINK
signed char sal_Int8
SVXCORE_DLLPUBLIC bool SvxDrawingLayerImport(SdrModel *pModel, const css::uno::Reference< css::io::XInputStream > &xInputStream)