LibreOffice Module sc (master) 1
drwtrans.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 <com/sun/star/embed/XTransactedObject.hpp>
21#include <com/sun/star/embed/XEmbedPersist.hpp>
22#include <com/sun/star/embed/XEmbeddedObject.hpp>
23#include <com/sun/star/uno/Exception.hpp>
24
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/beans/XPropertySetInfo.hpp>
27#include <com/sun/star/form/FormButtonType.hpp>
29
30#include <svx/unomodel.hxx>
31#include <unotools/tempfile.hxx>
36
38#include <sot/storage.hxx>
39#include <svx/svditer.hxx>
40#include <svx/svdograf.hxx>
41#include <svx/svdoole2.hxx>
42#include <svx/svdouno.hxx>
43#include <sfx2/docfile.hxx>
44#include <svl/itempool.hxx>
45#include <svl/urlbmk.hxx>
46#include <tools/urlobj.hxx>
47#include <osl/diagnose.h>
48
49#include <drwtrans.hxx>
50#include <docsh.hxx>
51#include <drwlayer.hxx>
52#include <drawview.hxx>
53#include <utility>
54#include <viewdata.hxx>
55#include <scmod.hxx>
56#include <dragdata.hxx>
57
58#include <editeng/eeitem.hxx>
59
60#include <editeng/fhgtitem.hxx>
61#include <vcl/svapp.hxx>
62
63using namespace com::sun::star;
64
65constexpr sal_uInt32 SCDRAWTRANS_TYPE_EMBOBJ = 1;
66constexpr sal_uInt32 SCDRAWTRANS_TYPE_DRAWMODEL = 2;
67constexpr sal_uInt32 SCDRAWTRANS_TYPE_DOCUMENT = 3;
68
69ScDrawTransferObj::ScDrawTransferObj( std::unique_ptr<SdrModel> pClipModel, ScDocShell* pContainerShell,
71 m_pModel( std::move(pClipModel) ),
72 m_aObjDesc(std::move( aDesc )),
73 m_bGraphic( false ),
74 m_bGrIsBit( false ),
75 m_bOleObj( false ),
76 m_nDragSourceFlags( ScDragSrc::Undefined ),
77 m_bDragWasInternal( false ),
78 maShellID(SfxObjectShell::CreateShellID(pContainerShell))
79{
80
81 // check what kind of objects are contained
82
83 SdrPage* pPage = m_pModel->GetPage(0);
84 if (pPage)
85 {
86 SdrObjListIter aIter( pPage, SdrIterMode::Flat );
87 SdrObject* pObject = aIter.Next();
88 if (pObject && !aIter.Next()) // exactly one object?
89 {
90
91 // OLE object
92
93 SdrObjKind nSdrObjKind = pObject->GetObjIdentifier();
94 if (nSdrObjKind == SdrObjKind::OLE2)
95 {
96 // if object has no persistence it must be copied as a part of document
97 try
98 {
99 uno::Reference< embed::XEmbedPersist > xPersObj( static_cast<SdrOle2Obj*>(pObject)->GetObjRef(), uno::UNO_QUERY );
100 if ( xPersObj.is() && xPersObj->hasEntry() )
101 m_bOleObj = true;
102 }
103 catch( uno::Exception& )
104 {}
105 // aOleData is initialized later
106 }
107
108 // Graphic object
109
110 if (nSdrObjKind == SdrObjKind::Graphic)
111 {
112 m_bGraphic = true;
113 if ( static_cast<SdrGrafObj*>(pObject)->GetGraphic().GetType() == GraphicType::Bitmap )
114 m_bGrIsBit = true;
115 }
116
117 // URL button
118
119 SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObject );
120 if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
121 {
122 const uno::Reference<awt::XControlModel>& xControlModel = pUnoCtrl->GetUnoControlModel();
123 OSL_ENSURE( xControlModel.is(), "uno control without model" );
124 if ( xControlModel.is() )
125 {
126 uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
127 uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
128
129 OUString sPropButtonType( "ButtonType" );
130
131 if(xInfo->hasPropertyByName( sPropButtonType ))
132 {
133 uno::Any aAny = xPropSet->getPropertyValue( sPropButtonType );
134 form::FormButtonType eTmp;
135 if ( (aAny >>= eTmp) && eTmp == form::FormButtonType_URL )
136 {
137 // URL
138 OUString sPropTargetURL( "TargetURL" );
139 if(xInfo->hasPropertyByName( sPropTargetURL ))
140 {
141 aAny = xPropSet->getPropertyValue( sPropTargetURL );
142 OUString sTmp;
143 if ( (aAny >>= sTmp) && !sTmp.isEmpty() )
144 {
145 OUString aUrl = sTmp;
146 OUString aAbs = aUrl;
147 if (pContainerShell)
148 {
149 const SfxMedium* pMedium = pContainerShell->GetMedium();
150 if (pMedium)
151 {
152 bool bWasAbs = true;
153 aAbs = pMedium->GetURLObject().smartRel2Abs( aUrl, bWasAbs ).
155 // full path as stored INetBookmark must be encoded
156 }
157 }
158
159 // Label
160 OUString aLabel;
161 OUString sPropLabel( "Label" );
162 if(xInfo->hasPropertyByName( sPropLabel ))
163 {
164 aAny = xPropSet->getPropertyValue( sPropLabel );
165 if ( (aAny >>= sTmp) && !sTmp.isEmpty() )
166 {
167 aLabel = sTmp;
168 }
169 }
170 m_pBookmark.reset( new INetBookmark( aAbs, aLabel ) );
171 }
172 }
173 }
174 }
175 }
176 }
177 }
178 }
179
180 // get size for object descriptor
181
182 // #i71538# use complete SdrViews
183 // SdrExchangeView aView(pModel);
184 SdrView aView(*m_pModel);
185 SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
186 aView.MarkAllObj(pPv);
188
189 if ( m_bOleObj ) // single OLE object
190 {
191 SdrOle2Obj* pObj = GetSingleObject();
192 if ( pObj && pObj->GetObjRef().is() )
194 }
195
198
199 // remember a unique ID of the source document
200
201 if ( pContainerShell )
202 {
203 ScDocument& rDoc = pContainerShell->GetDocument();
204 if ( pPage )
205 {
207 }
208 }
209}
210
212{
213 SolarMutexGuard aSolarGuard;
214
215 ScModule* pScMod = SC_MOD();
216 if (pScMod && pScMod->GetDragData().pDrawTransfer == this)
217 {
218 OSL_FAIL("ScDrawTransferObj wasn't released");
219 pScMod->ResetDragObject();
220 }
221
222 m_aOleData = TransferableDataHelper(); // clear before releasing the mutex
224
225 m_pModel.reset();
226 m_aDrawPersistRef.clear(); // after the model
227
228 m_pBookmark.reset();
229 m_pDragSourceView.reset();
230}
231
232ScDrawTransferObj* ScDrawTransferObj::GetOwnClipboard(const uno::Reference<datatransfer::XTransferable2>& xTransferable)
233{
234 return comphelper::getFromUnoTunnel<ScDrawTransferObj>(xTransferable);
235}
236
237static bool lcl_HasOnlyControls( SdrModel* pModel )
238{
239 bool bOnlyControls = false; // default if there are no objects
240
241 if ( pModel )
242 {
243 SdrPage* pPage = pModel->GetPage(0);
244 if (pPage)
245 {
246 SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
247 SdrObject* pObj = aIter.Next();
248 if ( pObj )
249 {
250 bOnlyControls = true; // only set if there are any objects at all
251 while ( pObj )
252 {
253 if (dynamic_cast<const SdrUnoObj*>( pObj) == nullptr)
254 {
255 bOnlyControls = false;
256 break;
257 }
258 pObj = aIter.Next();
259 }
260 }
261 }
262 }
263
264 return bOnlyControls;
265}
266
268{
269 if ( m_bGrIsBit ) // single bitmap graphic
270 {
271 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
272 AddFormat( SotClipboardFormatId::SVXB );
273 AddFormat( SotClipboardFormatId::PNG );
274 AddFormat( SotClipboardFormatId::BITMAP );
275 AddFormat( SotClipboardFormatId::GDIMETAFILE );
276 }
277 else if ( m_bGraphic ) // other graphic
278 {
279 // #i25616#
280 AddFormat( SotClipboardFormatId::DRAWING );
281
282 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
283 AddFormat( SotClipboardFormatId::SVXB );
284 AddFormat( SotClipboardFormatId::GDIMETAFILE );
285 AddFormat( SotClipboardFormatId::PNG );
286 AddFormat( SotClipboardFormatId::BITMAP );
287 }
288 else if ( m_pBookmark ) // url button
289 {
290// AddFormat( SotClipboardFormatId::EMBED_SOURCE );
291 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
292 AddFormat( SotClipboardFormatId::SOLK );
293 AddFormat( SotClipboardFormatId::STRING );
294 AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR );
295 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
296 AddFormat( SotClipboardFormatId::DRAWING );
297 }
298 else if ( m_bOleObj ) // single OLE object
299 {
300 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
301 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
302 AddFormat( SotClipboardFormatId::GDIMETAFILE );
303
305
306 if ( m_aOleData.GetTransferable().is() )
307 {
308 // get format list from object snapshot
309 // (this must be after inserting the default formats!)
310
312
313 for( const auto& rItem : aVector )
314 AddFormat( rItem );
315 }
316 }
317 else // any drawing objects
318 {
319 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
320 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
321 AddFormat( SotClipboardFormatId::DRAWING );
322
323 // leave out bitmap and metafile if there are only controls
324 if ( !lcl_HasOnlyControls( m_pModel.get() ) )
325 {
326 AddFormat( SotClipboardFormatId::PNG );
327 AddFormat( SotClipboardFormatId::BITMAP );
328 AddFormat( SotClipboardFormatId::GDIMETAFILE );
329 }
330 }
331
332// if( pImageMap )
333// AddFormat( SotClipboardFormatId::SVIM );
334}
335
336bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
337{
338 bool bOK = false;
339 SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor );
340
341 if ( m_bOleObj && nFormat != SotClipboardFormatId::GDIMETAFILE )
342 {
344
345 if( m_aOleData.GetTransferable().is() && m_aOleData.HasFormat( rFlavor ) )
346 {
347 bOK = SetAny( m_aOleData.GetAny(rFlavor, rDestDoc) );
348
349 return bOK;
350 }
351 }
352
353 if( HasFormat( nFormat ) )
354 {
355 if ( nFormat == SotClipboardFormatId::LINKSRCDESCRIPTOR || nFormat == SotClipboardFormatId::OBJECTDESCRIPTOR )
356 {
358 }
359 else if ( nFormat == SotClipboardFormatId::DRAWING )
360 {
361 bOK = SetObject( m_pModel.get(), SCDRAWTRANS_TYPE_DRAWMODEL, rFlavor );
362 }
363 else if ( nFormat == SotClipboardFormatId::BITMAP
364 || nFormat == SotClipboardFormatId::PNG
365 || nFormat == SotClipboardFormatId::GDIMETAFILE )
366 {
367 // #i71538# use complete SdrViews
368 // SdrExchangeView aView( pModel );
369 SdrView aView(*m_pModel);
370 SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
371 OSL_ENSURE( pPv, "pPv not there..." );
372 aView.MarkAllObj( pPv );
373 if ( nFormat == SotClipboardFormatId::GDIMETAFILE )
374 bOK = SetGDIMetaFile( aView.GetMarkedObjMetaFile(true) );
375 else
376 bOK = SetBitmapEx( aView.GetMarkedObjBitmapEx(true), rFlavor );
377 }
378 else if ( nFormat == SotClipboardFormatId::SVXB )
379 {
380 // only enabled for single graphics object
381
382 SdrPage* pPage = m_pModel->GetPage(0);
383 if (pPage)
384 {
385 SdrObjListIter aIter( pPage, SdrIterMode::Flat );
386 SdrObject* pObject = aIter.Next();
387 if (pObject && pObject->GetObjIdentifier() == SdrObjKind::Graphic)
388 {
389 SdrGrafObj* pGraphObj = static_cast<SdrGrafObj*>(pObject);
390 bOK = SetGraphic( pGraphObj->GetGraphic() );
391 }
392 }
393 }
394 else if ( nFormat == SotClipboardFormatId::EMBED_SOURCE )
395 {
396 if ( m_bOleObj ) // single OLE object
397 {
398 SdrOle2Obj* pObj = GetSingleObject();
399 if ( pObj && pObj->GetObjRef().is() )
400 {
401 bOK = SetObject( pObj->GetObjRef().get(), SCDRAWTRANS_TYPE_EMBOBJ, rFlavor );
402 }
403 }
404 else // create object from contents
405 {
406 //TODO/LATER: needs new Format, because now single OLE and "this" are different
407 InitDocShell(); // set aDocShellRef
408
409 SfxObjectShell* pEmbObj = m_aDocShellRef.get();
410 bOK = SetObject( pEmbObj, SCDRAWTRANS_TYPE_DOCUMENT, rFlavor );
411 }
412 }
413 else if( m_pBookmark )
414 {
415 bOK = SetINetBookmark( *m_pBookmark, rFlavor );
416 }
417 }
418 return bOK;
419}
420
421bool ScDrawTransferObj::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
422 const css::datatransfer::DataFlavor& /* rFlavor */ )
423{
424 // called from SetObject, put data into stream
425
426 bool bRet = false;
427 switch (nUserObjectId)
428 {
430 {
431 SdrModel* pDrawModel = static_cast<SdrModel*>(pUserObject);
432 rxOStm->SetBufferSize( 0xff00 );
433
434 // for the changed pool defaults from drawing layer pool set those
435 // attributes as hard attributes to preserve them for saving
436 const SfxItemPool& rItemPool = m_pModel->GetItemPool();
437 const SvxFontHeightItem& rDefaultFontHeight = rItemPool.GetDefaultItem(EE_CHAR_FONTHEIGHT);
438
439 // SW should have no MasterPages
440 OSL_ENSURE(0 == m_pModel->GetMasterPageCount(), "SW with MasterPages (!)");
441
442 for(sal_uInt16 a(0); a < m_pModel->GetPageCount(); a++)
443 {
444 const SdrPage* pPage(m_pModel->GetPage(a));
445 SdrObjListIter aIter(pPage, SdrIterMode::DeepNoGroups);
446
447 while(aIter.IsMore())
448 {
449 SdrObject* pObj = aIter.Next();
451
452 if(rItem.GetHeight() == rDefaultFontHeight.GetHeight())
453 {
454 pObj->SetMergedItem(rDefaultFontHeight);
455 }
456 }
457 }
458
459 {
460 css::uno::Reference<css::io::XOutputStream> xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) );
461 SvxDrawingLayerExport( pDrawModel, xDocOut );
462 }
463
464 bRet = ( rxOStm->GetError() == ERRCODE_NONE );
465 }
466 break;
467
469 {
470 // impl. for "single OLE"
471 embed::XEmbeddedObject* pEmbObj = static_cast<embed::XEmbeddedObject*>(pUserObject);
472
473 ::utl::TempFileFast aTempFile;
474 SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE);
475 uno::Reference< embed::XStorage > xWorkStore =
477
478 uno::Reference < embed::XEmbedPersist > xPers( static_cast<embed::XVisualObject*>(pEmbObj), uno::UNO_QUERY );
479 if ( xPers.is() )
480 {
481 try
482 {
483 uno::Sequence < beans::PropertyValue > aSeq;
484 OUString aDummyName("Dummy");
485 xPers->storeToEntry( xWorkStore, aDummyName, aSeq, aSeq );
486 if ( xWorkStore->isStreamElement( aDummyName ) )
487 {
488 uno::Reference < io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) );
489 uno::Reference < io::XStream > xNewStream = xWorkStore->openStreamElement( aDummyName, embed::ElementModes::READ );
490 ::comphelper::OStorageHelper::CopyInputToOutput( xNewStream->getInputStream(), xDocOut );
491 }
492 else
493 {
494 uno::Reference < io::XStream > xDocStr( new utl::OStreamWrapper( *rxOStm ) );
495 uno::Reference< embed::XStorage > xDocStg = ::comphelper::OStorageHelper::GetStorageFromStream( xDocStr );
496 uno::Reference < embed::XStorage > xNewStg = xWorkStore->openStorageElement( aDummyName, embed::ElementModes::READ );
497 xNewStg->copyToStorage( xDocStg );
498 uno::Reference < embed::XTransactedObject > xTrans( xDocStg, uno::UNO_QUERY );
499 if ( xTrans.is() )
500 xTrans->commit();
501 }
502 }
503 catch ( uno::Exception& )
504 {
505 }
506 }
507
508 break;
509 }
511 {
512 // impl. for "DocShell"
513 SfxObjectShell* pEmbObj = static_cast<SfxObjectShell*>(pUserObject);
514
515 try
516 {
517 ::utl::TempFileFast aTempFile;
518 SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE);
519 uno::Reference< embed::XStorage > xWorkStore =
521
522 // write document storage
523 pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false );
524
525 // mba: no relative URLs for clipboard!
526 SfxMedium aMedium( xWorkStore, OUString() );
527 pEmbObj->DoSaveObjectAs( aMedium, false );
528 pEmbObj->DoSaveCompleted();
529
530 uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
531 if ( xTransact.is() )
532 xTransact->commit();
533
534 rxOStm->SetBufferSize( 0xff00 );
535 rxOStm->WriteStream( *pTempStream );
536
537 xWorkStore->dispose();
538 xWorkStore.clear();
539 }
540 catch ( uno::Exception& )
541 {}
542
543 bRet = ( rxOStm->GetError() == ERRCODE_NONE );
544 }
545 break;
546
547 default:
548 OSL_FAIL("unknown object id");
549 }
550 return bRet;
551}
552
554{
556 {
557 // move: delete source objects
558
559 if ( m_pDragSourceView )
560 m_pDragSourceView->DeleteMarked();
561 }
562
563 ScModule* pScMod = SC_MOD();
564 if ( pScMod->GetDragData().pDrawTransfer == this )
565 pScMod->ResetDragObject();
566
567 m_pDragSourceView.reset();
568
570}
571
573{
574 m_aDrawPersistRef = rRef;
575}
576
577static void lcl_InitMarks( SdrMarkView& rDest, const SdrMarkView& rSource, SCTAB nTab )
578{
579 rDest.ShowSdrPage(rDest.GetModel()->GetPage(nTab));
580 SdrPageView* pDestPV = rDest.GetSdrPageView();
581 OSL_ENSURE(pDestPV,"PageView ?");
582
583 const SdrMarkList& rMarkList = rSource.GetMarkedObjectList();
584 const size_t nCount = rMarkList.GetMarkCount();
585 for (size_t i=0; i<nCount; ++i)
586 {
587 SdrMark* pMark = rMarkList.GetMark(i);
588 SdrObject* pObj = pMark->GetMarkedSdrObj();
589
590 rDest.MarkObj(pObj, pDestPV);
591 }
592}
593
595{
596 m_pDragSourceView.reset(new SdrView(pView->getSdrModelFromSdrView())); // TTTT pView should be reference
597 lcl_InitMarks( *m_pDragSourceView, *pView, pView->GetTab() );
598
600}
601
603{
605 m_pDragSourceView->ShowSdrPage(m_pDragSourceView->GetModel()->GetPage(nTab));
606 SdrPageView* pPV = m_pDragSourceView->GetSdrPageView();
607 m_pDragSourceView->MarkObj(&rObj, pPV); // TTTT MarkObj should take SdrObject&
608
610}
611
613{
614 m_nDragSourceFlags = nFlags;
615}
616
618{
619 m_bDragWasInternal = true;
620}
621
622const OUString& ScDrawTransferObj::GetShellID() const
623{
624 return maShellID;
625}
626
628{
629 // if single OLE object was copied, get its object
630
631 SdrPage* pPage = m_pModel->GetPage(0);
632 if (pPage)
633 {
634 SdrObjListIter aIter( pPage, SdrIterMode::Flat );
635 SdrObject* pObject = aIter.Next();
636 if (pObject && pObject->GetObjIdentifier() == SdrObjKind::OLE2)
637 {
638 return static_cast<SdrOle2Obj*>(pObject);
639 }
640 }
641
642 return nullptr;
643}
644
646{
647 if (m_aOleData.GetTransferable().is())
648 // Already created.
649 return;
650
651 SdrOle2Obj* pObj = GetSingleObject();
652 if (!pObj || !pObj->GetObjRef().is())
653 // No OLE object present.
654 return;
655
658 pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect());
659
660 pEmbedTransfer->SetParentShellID(maShellID);
661
662 m_aOleData = TransferableDataHelper(pEmbedTransfer);
663}
664
665// initialize aDocShellRef with a live document from the ClipDoc
666
668{
669 if ( m_aDocShellRef.is() )
670 return;
671
672 ScDocShell* pDocSh = new ScDocShell;
673 m_aDocShellRef = pDocSh; // ref must be there before InitNew
674
675 pDocSh->DoInitNew();
676
677 ScDocument& rDestDoc = pDocSh->GetDocument();
678 rDestDoc.InitDrawLayer( pDocSh );
679
680 SdrModel* pDestModel = rDestDoc.GetDrawLayer();
681 // #i71538# use complete SdrViews
682 // SdrExchangeView aDestView( pDestModel );
683 SdrView aDestView(*pDestModel);
684 aDestView.ShowSdrPage(aDestView.GetModel()->GetPage(0));
685 aDestView.Paste(
686 *m_pModel,
688 nullptr, SdrInsertFlags::NONE);
689
690 // put objects to right layer (see ScViewFunc::PasteDataFormat for SotClipboardFormatId::DRAWING)
691
692 SdrPage* pPage = pDestModel->GetPage(0);
693 if (pPage)
694 {
695 SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
696 SdrObject* pObject = aIter.Next();
697 while (pObject)
698 {
699 if ( dynamic_cast<const SdrUnoObj*>( pObject) != nullptr )
700 pObject->NbcSetLayer(SC_LAYER_CONTROLS);
701 else
702 pObject->NbcSetLayer(SC_LAYER_FRONT);
703 pObject = aIter.Next();
704 }
705 }
706
707 tools::Rectangle aDestArea( Point(), m_aSrcSize );
708 pDocSh->SetVisArea( aDestArea );
709
710 ScViewOptions aViewOpt( rDestDoc.GetViewOptions() );
711 aViewOpt.SetOption( VOPT_GRID, false );
712 rDestDoc.SetViewOptions( aViewOpt );
713
714 ScViewData aViewData( *pDocSh, nullptr );
715 aViewData.SetTabNo( 0 );
716 aViewData.SetScreen( aDestArea );
717 aViewData.SetCurX( 0 );
718 aViewData.SetCurY( 0 );
719 pDocSh->UpdateOle(aViewData, true);
720}
721
722const css::uno::Sequence< sal_Int8 >& ScDrawTransferObj::getUnoTunnelId()
723{
724 static const comphelper::UnoIdInit theScDrawTransferObjUnoTunnelId;
725 return theScDrawTransferObjUnoTunnelId.getSeq();
726}
727
728sal_Int64 SAL_CALL ScDrawTransferObj::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
729{
732}
733
734/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
INetURLObject smartRel2Abs(OUString const &rTheRelURIRef, bool &rWasAbsolute, bool bIgnoreFragment=false, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, bool bRelativeNonURIs=false, FSysStyle eStyle=FSysStyle::Detect) const
static void FillProtectedChartRangesVector(ScRangeListVector &rRangesVector, const ScDocument &rDocument, const SdrPage *pPage)
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
void UpdateOle(const ScViewData &rViewData, bool bSnapSize=false)
Definition: docsh6.cxx:152
virtual void SetVisArea(const tools::Rectangle &rVisArea) override
Definition: docsh6.cxx:57
SC_DLLPUBLIC void InitDrawLayer(SfxObjectShell *pDocShell=nullptr)
Definition: documen9.cxx:98
SC_DLLPUBLIC const ScViewOptions & GetViewOptions() const
Definition: documen3.cxx:1967
SC_DLLPUBLIC void SetViewOptions(const ScViewOptions &rOpt)
Definition: documen3.cxx:1973
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1082
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor) override
Definition: drwtrans.cxx:421
virtual ~ScDrawTransferObj() override
Definition: drwtrans.cxx:211
ScDragSrc m_nDragSourceFlags
Definition: drwtrans.hxx:55
void SetDrawPersist(const SfxObjectShellRef &rRef)
Definition: drwtrans.cxx:572
virtual void AddSupportedFormats() override
Definition: drwtrans.cxx:267
ScRangeListVector m_aProtectedChartRangesVector
Definition: drwtrans.hxx:58
OUString maShellID
Definition: drwtrans.hxx:60
void SetDragSource(const ScDrawView *pView)
Definition: drwtrans.cxx:594
static ScDrawTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: drwtrans.cxx:232
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: drwtrans.cxx:722
std::unique_ptr< INetBookmark > m_pBookmark
Definition: drwtrans.hxx:48
void SetDragWasInternal()
Definition: drwtrans.cxx:617
void CreateOLEData()
Definition: drwtrans.cxx:645
ScDrawTransferObj(std::unique_ptr< SdrModel > pClipModel, ScDocShell *pContainerShell, TransferableObjectDescriptor aDesc)
Definition: drwtrans.cxx:69
SdrOle2Obj * GetSingleObject()
Definition: drwtrans.cxx:627
TransferableDataHelper m_aOleData
Definition: drwtrans.hxx:41
virtual void DragFinished(sal_Int8 nDropAction) override
Definition: drwtrans.cxx:553
void SetDragSourceFlags(ScDragSrc nFlags)
Definition: drwtrans.cxx:612
SfxObjectShellRef m_aDocShellRef
Definition: drwtrans.hxx:43
std::unique_ptr< SdrModel > m_pModel
Definition: drwtrans.hxx:40
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
Definition: drwtrans.cxx:336
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rId) override
Definition: drwtrans.cxx:728
void SetDragSourceObj(SdrObject &rObj, SCTAB nTab)
Definition: drwtrans.cxx:602
TransferableObjectDescriptor m_aObjDesc
Definition: drwtrans.hxx:42
std::unique_ptr< SdrView > m_pDragSourceView
Definition: drwtrans.hxx:54
bool m_bDragWasInternal
Definition: drwtrans.hxx:56
SfxObjectShellRef m_aDrawPersistRef
Definition: drwtrans.hxx:44
const OUString & GetShellID() const
Definition: drwtrans.cxx:622
SCTAB GetTab() const
Definition: drawview.hxx:100
const ScDragData & GetDragData() const
Definition: scmod.cxx:598
void ResetDragObject()
Definition: scmod.cxx:577
void SetScreen(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
Definition: viewdata.cxx:3028
void SetTabNo(SCTAB nNewTab)
Definition: viewdata.cxx:2314
void SetCurX(SCCOL nNewCurX)
Definition: viewdata.hxx:431
void SetCurY(SCROW nNewCurY)
Definition: viewdata.hxx:432
void SetOption(ScViewOption eOpt, bool bNew)
Definition: viewopti.hxx:87
GDIMetaFile GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked=false) const
virtual bool Paste(const SdrModel &rMod, const Point &rPos, SdrObjList *pLst, SdrInsertFlags nOptions)
BitmapEx GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked=false, const sal_uInt32 nMaximumQuadraticPixels=500000, const std::optional< Size > &rTargetDPI=std::nullopt) const
const Graphic & GetGraphic() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
void MarkAllObj(SdrPageView *pPV=nullptr)
const tools::Rectangle & GetAllMarkedRect() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
SdrPageView * ShowSdrPage(SdrPage *pPage) override
SdrObject * Next()
bool IsMore() const
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
virtual SdrInventor GetObjInventor() const
SdrModel & getSdrModelFromSdrObject() const
void SetMergedItem(const SfxPoolItem &rItem)
sal_Int64 GetAspect() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
const Graphic * GetGraphic() const
virtual SdrPageView * ShowSdrPage(SdrPage *pPage)
SdrModel * GetModel() const
SdrModel & getSdrModelFromSdrView() const
SdrPageView * GetSdrPageView() const
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const INetURLObject & GetURLObject() const
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
SfxMedium * GetMedium() const
bool DoSaveObjectAs(SfxMedium &rNewStor, bool bCommit)
void SetupStorage(const css::uno::Reference< css::embed::XStorage > &xStorage, sal_Int32 nVersion, bool bTemplate) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
static void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc, const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, const Graphic *pGraphic, sal_Int64 nAspect)
sal_uInt32 GetHeight() const
virtual void DragFinished(sal_Int8 nDropAction) override
const DataFlavorExVector & GetDataFlavorExVector() const
css::uno::Any GetAny(SotClipboardFormatId nFormat, const OUString &rDestDoc) const
bool HasFormat(SotClipboardFormatId nFormat) const
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
bool SetGraphic(const Graphic &rGraphic)
bool SetTransferableObjectDescriptor(const TransferableObjectDescriptor &rDesc)
bool SetAny(const css::uno::Any &rAny)
bool SetObject(void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
bool SetBitmapEx(const BitmapEx &rBitmap, const css::datatransfer::DataFlavor &rFlavor)
bool SetINetBookmark(const INetBookmark &rBmk, const css::datatransfer::DataFlavor &rFlavor)
bool HasFormat(SotClipboardFormatId nFormat)
void PrepareOLE(const TransferableObjectDescriptor &rObjDesc)
void AddFormat(SotClipboardFormatId nFormat)
bool SetGDIMetaFile(const GDIMetaFile &rMtf)
static css::uno::Reference< css::embed::XStorage > GetStorageFromStream(const css::uno::Reference< css::io::XStream > &xStream, sal_Int32 nStorageMode=css::embed::ElementModes::READWRITE, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
static void CopyInputToOutput(const css::uno::Reference< css::io::XInputStream > &xInput, const css::uno::Reference< css::io::XOutputStream > &xOutput)
const css::uno::Sequence< sal_Int8 > & getSeq() const
constexpr Size GetSize() const
T * get() const
bool is() const
SvStream * GetStream(StreamMode eMode)
int nCount
static void lcl_InitMarks(SdrMarkView &rDest, const SdrMarkView &rSource, SCTAB nTab)
Definition: drwtrans.cxx:577
constexpr sal_uInt32 SCDRAWTRANS_TYPE_DRAWMODEL
Definition: drwtrans.cxx:66
constexpr sal_uInt32 SCDRAWTRANS_TYPE_EMBOBJ
Definition: drwtrans.cxx:65
constexpr sal_uInt32 SCDRAWTRANS_TYPE_DOCUMENT
Definition: drwtrans.cxx:67
static bool lcl_HasOnlyControls(SdrModel *pModel)
Definition: drwtrans.cxx:237
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
EmbeddedObjectRef * pObject
#define ERRCODE_NONE
::std::vector< DataFlavorEx > DataFlavorExVector
#define SOFFICE_FILEFORMAT_CURRENT
SotClipboardFormatId
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
uno_Any a
Sequence< sal_Int8 > aSeq
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
int i
#define SC_MOD()
Definition: scmod.hxx:249
ScDrawTransferObj * pDrawTransfer
Definition: dragdata.hxx:21
SdrObjKind
#define DND_ACTION_MOVE
signed char sal_Int8
sal_Int16 SCTAB
Definition: types.hxx:22
OUString aLabel
SVXCORE_DLLPUBLIC bool SvxDrawingLayerExport(SdrModel *pModel, const css::uno::Reference< css::io::XOutputStream > &xOut)
ScDragSrc
Definition: viewdata.hxx:91
@ VOPT_GRID
Definition: viewopti.hxx:41