LibreOffice Module sd (master) 1
sdxfer.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 <sal/config.h>
21
22#include <com/sun/star/embed/XEmbeddedObject.hpp>
23#include <com/sun/star/embed/XTransactedObject.hpp>
24#include <com/sun/star/embed/XEmbedPersist.hpp>
25#include <com/sun/star/embed/ElementModes.hpp>
26#include <com/sun/star/lang/XComponent.hpp>
29#include <unotools/tempfile.hxx>
30#include <editeng/flditem.hxx>
31#include <svx/svdpagv.hxx>
32#include <svx/svdoole2.hxx>
33#include <svx/svdograf.hxx>
34#include <svx/svdotext.hxx>
35#include <editeng/outlobj.hxx>
36#include <sot/storage.hxx>
37#include <editeng/editobj.hxx>
38#include <o3tl/safeint.hxx>
39#include <svx/svdobjkind.hxx>
40#include <svx/svdouno.hxx>
41#include <svx/ImageMapInfo.hxx>
42#include <sot/formats.hxx>
43#include <svl/urlbmk.hxx>
45
46#include <com/sun/star/form/FormButtonType.hpp>
47#include <com/sun/star/beans/XPropertySet.hpp>
49
50#include <svx/svdotable.hxx>
51#include <svx/unomodel.hxx>
52#include <svx/svditer.hxx>
53#include <sfx2/docfile.hxx>
57#include <DrawDocShell.hxx>
58#include <View.hxx>
59#include <sdmod.hxx>
60#include <sdpage.hxx>
61#include <drawdoc.hxx>
62#include <stlpool.hxx>
63#include <sdxfer.hxx>
64#include <unomodel.hxx>
65#include <vcl/virdev.hxx>
66#include <vcl/svapp.hxx>
67
68using namespace ::com::sun::star;
69using namespace ::com::sun::star::lang;
70using namespace ::com::sun::star::uno;
71using namespace ::com::sun::star::io;
72using namespace ::com::sun::star::datatransfer;
74
75constexpr sal_uInt32 SDTRANSFER_OBJECTTYPE_DRAWMODEL = 1;
76constexpr sal_uInt32 SDTRANSFER_OBJECTTYPE_DRAWOLE = 2;
77
78SdTransferable::SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, bool bInitOnGetData )
79: mpPageDocShell( nullptr )
80, mpSdView( pWorkView )
81, mpSdViewIntern( pWorkView )
82, mpSdDrawDocument( nullptr )
83, mpSdDrawDocumentIntern( nullptr )
84, mpSourceDoc( pSrcDoc )
85, mpVDev( nullptr )
86, mbInternalMove( false )
87, mbOwnDocument( false )
88, mbOwnView( false )
89, mbLateInit( bInitOnGetData )
90, mbPageTransferable( false )
91, mbPageTransferablePersistent( false )
92{
93 if( mpSourceDoc )
95
96 if( pWorkView )
97 StartListening( *pWorkView );
98
99 if( !mbLateInit )
100 CreateData();
101}
102
104{
106
107 if( mpSourceDoc )
109
110 if( mpSdView )
111 EndListening( *const_cast< sd::View *>( mpSdView) );
112
114
115 if( mbOwnView )
116 delete mpSdViewIntern;
117
118 mpOLEDataHelper.reset();
119
120 if( maDocShellRef.is() )
121 {
123 ::sd::DrawDocShell* pDocSh = static_cast< ::sd::DrawDocShell*>(pObj);
124 pDocSh->DoClose();
125 }
126
128
129 if( mbOwnDocument )
131
132 moGraphic.reset();
133 moBookmark.reset();
134 mpImageMap.reset();
135
137 mpObjDesc.reset();
138
139 //call explicitly at end of dtor to be covered by above SolarMutex
140 maUserData.clear();
141}
142
144{
145 if( !pObj )
146 return;
147
148 mpOLEDataHelper.reset();
149 moGraphic.reset();
150 moBookmark.reset();
151 mpImageMap.reset();
152
153 if( auto pOleObj = dynamic_cast< SdrOle2Obj* >( pObj ) )
154 {
155 try
156 {
157 uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef();
158 uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
159 if( xObj.is() && xPersist.is() && xPersist->hasEntry() )
160 {
161 mpOLEDataHelper.reset( new TransferableDataHelper( new SvEmbedTransferHelper( xObj, pOleObj->GetGraphic(), pOleObj->GetAspect() ) ) );
162
163 // TODO/LATER: the standalone handling of the graphic should not be used any more in future
164 // The EmbedDataHelper should bring the graphic in future
165 const Graphic* pObjGr = pOleObj->GetGraphic();
166 if ( pObjGr )
167 moGraphic.emplace(*pObjGr);
168 }
169 }
170 catch( uno::Exception& )
171 {}
172 }
173 else if( dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && (mpSourceDoc && !SdDrawDocument::GetAnimationInfo( pObj )) )
174 {
175 moGraphic.emplace( static_cast< SdrGrafObj* >( pObj )->GetTransformedGraphic() );
176 }
177 else if( pObj->IsUnoObj() && SdrInventor::FmForm == pObj->GetObjInventor() && ( pObj->GetObjIdentifier() == SdrObjKind::FormButton ) )
178 {
179 SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pObj );
180
181 if (SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
182 {
183 const Reference< css::awt::XControlModel >& xControlModel( pUnoCtrl->GetUnoControlModel() );
184
185 if( !xControlModel.is() )
186 return;
187
188 Reference< css::beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY );
189
190 if( !xPropSet.is() )
191 return;
192
193 css::form::FormButtonType eButtonType;
194 Any aTmp( xPropSet->getPropertyValue( "ButtonType" ) );
195
196 if( aTmp >>= eButtonType )
197 {
198 OUString aLabel, aURL;
199
200 xPropSet->getPropertyValue( "Label" ) >>= aLabel;
201 xPropSet->getPropertyValue( "TargetURL" ) >>= aURL;
202
203 moBookmark.emplace( aURL, aLabel );
204 }
205 }
206 }
207 else if( auto pTextObj = DynCastSdrTextObj( pObj ) )
208 {
209 const OutlinerParaObject* pPara;
210
211 if( (pPara = pTextObj->GetOutlinerParaObject()) != nullptr )
212 {
213 const SvxFieldItem* pField;
214
215 if( (pField = pPara->GetTextObject().GetField()) != nullptr )
216 {
217 const SvxFieldData* pData = pField->GetField();
218
219 if( auto pURL = dynamic_cast< const SvxURLField *>( pData ) )
220 {
221 // #i63399# This special code identifies TextFrames which have just a URL
222 // as content and directly add this to the clipboard, probably to avoid adding
223 // an unnecessary DrawObject to the target where paste may take place. This is
224 // wanted only for SdrObjects with no fill and no line, else it is necessary to
225 // use the whole SdrObject. Test here for Line/FillStyle and take shortcut only
226 // when both are unused
227 if(!pObj->HasFillStyle() && !pObj->HasLineStyle())
228 {
229 moBookmark.emplace( pURL->GetURL(), pURL->GetRepresentation() );
230 }
231 }
232 }
233 }
234 }
235
236 SvxIMapInfo* pInfo = SvxIMapInfo::GetIMapInfo( pObj );
237
238 if( pInfo )
239 mpImageMap.reset( new ImageMap( pInfo->GetImageMap() ) );
240}
241
243{
245 {
246 mbOwnView = true;
247
249
250 if( pPage && 1 == pPage->GetObjCount() )
251 CreateObjectReplacement( pPage->GetObj( 0 ) );
252
255 mpSdViewIntern = new ::sd::View( *mpSdDrawDocumentIntern, mpVDev );
256 mpSdViewIntern->EndListening(*mpSdDrawDocumentIntern );
258 SdrPageView* pPageView = mpSdViewIntern->ShowSdrPage(pPage);
259 mpSdViewIntern->MarkAllObj(pPageView);
260 }
261 else if( mpSdView && !mpSdDrawDocumentIntern )
262 {
263 const SdrMarkList& rMarkList = mpSdView->GetMarkedObjectList();
264
265 if( rMarkList.GetMarkCount() == 1 )
267
268 if( mpSourceDoc )
271 if( mpSourceDoc )
273
276
277 if( !maDocShellRef.is() )
278 {
279 OSL_FAIL( "SdTransferable::CreateData(), failed to create a model with persist, clipboard operation will fail for OLE objects!" );
280 mbOwnDocument = true;
281 }
282
283 // Use dimension of source page
284 SdrPageView* pPgView = mpSdView->GetSdrPageView();
285 SdPage* pOldPage = static_cast<SdPage*>( pPgView->GetPage() );
286 SdStyleSheetPool* pOldStylePool = static_cast<SdStyleSheetPool*>(mpSdView->GetModel().GetStyleSheetPool());
289 OUString aOldLayoutName( pOldPage->GetLayoutName() );
290
291 pPage->SetSize( pOldPage->GetSize() );
292 pPage->SetLayoutName( aOldLayoutName );
293 pNewStylePool->CopyGraphicSheets( *pOldStylePool );
294 pNewStylePool->CopyCellSheets( *pOldStylePool );
295 pNewStylePool->CopyTableStyles( *pOldStylePool );
296 sal_Int32 nPos = aOldLayoutName.indexOf( SD_LT_SEPARATOR );
297 if( nPos != -1 )
298 aOldLayoutName = aOldLayoutName.copy( 0, nPos );
299 StyleSheetCopyResultVector aCreatedSheets;
300 pNewStylePool->CopyLayoutSheets( aOldLayoutName, *pOldStylePool, aCreatedSheets );
301 }
302
303 // set VisArea and adjust objects if necessary
304 if( !(maVisArea.IsEmpty() &&
307 return;
308
310
312 {
313 // #112978# need to use GetAllMarkedBoundRect instead of GetAllMarkedRect to get
314 // fat lines correctly
316 Point aOrigin( maVisArea.TopLeft() );
317 Size aVector( -aOrigin.X(), -aOrigin.Y() );
318
319 for( size_t nObj = 0, nObjCount = pPage->GetObjCount(); nObj < nObjCount; ++nObj )
320 {
321 SdrObject* pObj = pPage->GetObj( nObj );
322 pObj->NbcMove( aVector );
323 }
324 }
325 else
326 maVisArea.SetSize( pPage->GetSize() );
327
328 // output is at the zero point
330}
331
332static bool lcl_HasOnlyControls( SdrModel* pModel )
333{
334 bool bOnlyControls = false; // default if there are no objects
335
336 if ( pModel )
337 {
338 SdrPage* pPage = pModel->GetPage(0);
339 if (pPage)
340 {
341 SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
342 SdrObject* pObj = aIter.Next();
343 if ( pObj )
344 {
345 bOnlyControls = true; // only set if there are any objects at all
346 while ( pObj )
347 {
348 if (dynamic_cast< const SdrUnoObj *>( pObj ) == nullptr)
349 {
350 bOnlyControls = false;
351 break;
352 }
353 pObj = aIter.Next();
354 }
355 }
356 }
357 }
358
359 return bOnlyControls;
360}
361
362static bool lcl_HasOnlyOneTable( SdrModel* pModel )
363{
364 if ( pModel )
365 {
366 SdrPage* pPage = pModel->GetPage(0);
367 if (pPage && pPage->GetObjCount() == 1 )
368 {
369 if( dynamic_cast< sdr::table::SdrTableObj* >( pPage->GetObj(0) ) != nullptr )
370 return true;
371 }
372 }
373 return false;
374}
375
377{
379 return;
380
381 if( !mbLateInit )
382 CreateData();
383
384 if( mpObjDesc )
385 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
386
387 if( mpOLEDataHelper )
388 {
389 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
390
391 DataFlavorExVector aVector( mpOLEDataHelper->GetDataFlavorExVector() );
392
393 for( const auto& rItem : aVector )
394 AddFormat( rItem );
395 }
396 else if( moGraphic )
397 {
398 // #i25616#
399 AddFormat( SotClipboardFormatId::DRAWING );
400
401 AddFormat( SotClipboardFormatId::SVXB );
402
403 if( moGraphic->GetType() == GraphicType::Bitmap )
404 {
405 AddFormat( SotClipboardFormatId::PNG );
406 AddFormat( SotClipboardFormatId::BITMAP );
407 AddFormat( SotClipboardFormatId::GDIMETAFILE );
408 }
409 else
410 {
411 AddFormat( SotClipboardFormatId::GDIMETAFILE );
412 AddFormat( SotClipboardFormatId::PNG );
413 AddFormat( SotClipboardFormatId::BITMAP );
414 }
415 }
416 else if( moBookmark )
417 {
418 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
419 AddFormat( SotClipboardFormatId::STRING );
420 }
421 else
422 {
423 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
424 AddFormat( SotClipboardFormatId::DRAWING );
426 {
427 AddFormat( SotClipboardFormatId::GDIMETAFILE );
428 AddFormat( SotClipboardFormatId::PNG );
429 AddFormat( SotClipboardFormatId::BITMAP );
430 }
431
433 AddFormat( SotClipboardFormatId::RTF );
434 AddFormat( SotClipboardFormatId::RICHTEXT );
435 }
436 }
437
438 if( mpImageMap )
439 AddFormat( SotClipboardFormatId::SVIM );
440}
441
442bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
443{
444 if (SD_MOD()==nullptr)
445 return false;
446
447 SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor );
448 bool bOK = false;
449
450 CreateData();
451
452 if( nFormat == SotClipboardFormatId::RTF && lcl_HasOnlyOneTable( mpSdDrawDocument ) )
453 {
455 }
456 else if( mpOLEDataHelper && mpOLEDataHelper->HasFormat( rFlavor ) )
457 {
458 // TODO/LATER: support all the graphical formats, the embedded object scenario should not have separated handling
459 if( nFormat == SotClipboardFormatId::GDIMETAFILE && moGraphic )
460 bOK = SetGDIMetaFile( moGraphic->GetGDIMetaFile() );
461 else
462 bOK = SetAny( mpOLEDataHelper->GetAny(rFlavor, rDestDoc) );
463 }
464 else if( HasFormat( nFormat ) )
465 {
466 if( ( nFormat == SotClipboardFormatId::LINKSRCDESCRIPTOR || nFormat == SotClipboardFormatId::OBJECTDESCRIPTOR ) && mpObjDesc )
467 {
469 }
470 else if( nFormat == SotClipboardFormatId::DRAWING )
471 {
473
475
476 if( mpSdViewIntern )
477 {
478 SdDrawDocument& rInternDoc = mpSdViewIntern->GetDoc();
479 rInternDoc.CreatingDataObj(this);
480 SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( mpSdViewIntern->CreateMarkedObjModel().release() );
481 rInternDoc.CreatingDataObj(nullptr);
482
483 bOK = SetObject( pDoc, SDTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor );
484
485 if( maDocShellRef.is() )
486 {
487 maDocShellRef->DoClose();
488 }
489 else
490 {
491 delete pDoc;
492 }
493 }
494
495 maDocShellRef = aOldRef;
496 }
497 else if( nFormat == SotClipboardFormatId::GDIMETAFILE )
498 {
499 if (mpSdViewIntern)
500 {
501 const bool bToggleOnlineSpell = mpSdDrawDocumentIntern && mpSdDrawDocumentIntern->GetOnlineSpell();
502 if (bToggleOnlineSpell)
505 if (bToggleOnlineSpell)
507 }
508 }
509 else if( SotClipboardFormatId::BITMAP == nFormat || SotClipboardFormatId::PNG == nFormat )
510 {
511 if (mpSdViewIntern)
512 {
513 const bool bToggleOnlineSpell = mpSdDrawDocumentIntern && mpSdDrawDocumentIntern->GetOnlineSpell();
514 if (bToggleOnlineSpell)
516 bOK = SetBitmapEx( mpSdViewIntern->GetMarkedObjBitmapEx(true), rFlavor );
517 if (bToggleOnlineSpell)
519 }
520 }
521 else if( ( nFormat == SotClipboardFormatId::STRING ) && moBookmark )
522 {
523 bOK = SetString( moBookmark->GetURL() );
524 }
525 else if( ( nFormat == SotClipboardFormatId::SVXB ) && moGraphic )
526 {
527 bOK = SetGraphic( *moGraphic );
528 }
529 else if( ( nFormat == SotClipboardFormatId::SVIM ) && mpImageMap )
530 {
531 bOK = SetImageMap( *mpImageMap );
532 }
533 else if( moBookmark )
534 {
535 bOK = SetINetBookmark( *moBookmark, rFlavor );
536 }
537 else if( nFormat == SotClipboardFormatId::EMBED_SOURCE )
538 {
540 {
541 if( !maDocShellRef.is() )
542 {
543 maDocShellRef = new ::sd::DrawDocShell(
545 SfxObjectCreateMode::EMBEDDED,
546 true,
548 mbOwnDocument = false;
549 maDocShellRef->DoInitNew();
550 }
551
552 maDocShellRef->SetVisArea( maVisArea );
554 }
555 }
556 }
557
558 return bOK;
559}
560
561bool SdTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pObject, sal_uInt32 nObjectType, const DataFlavor& )
562{
563 bool bRet = false;
564
565 switch( nObjectType )
566 {
568 {
569 try
570 {
571 static const bool bDontBurnInStyleSheet = ( getenv( "AVOID_BURN_IN_FOR_GALLERY_THEME" ) != nullptr );
572 SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pObject);
573 if ( !bDontBurnInStyleSheet )
575 rxOStm->SetBufferSize( 16348 );
576
577 Reference< XComponent > xComponent( new SdXImpressDocument( pDoc, true ) );
578 pDoc->setUnoModel( Reference< XInterface >::query( xComponent ) );
579
580 {
581 css::uno::Reference<css::io::XOutputStream> xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) );
582 SvxDrawingLayerExport( pDoc, xDocOut, xComponent, (pDoc->GetDocumentType() == DocumentType::Impress) ? "com.sun.star.comp.Impress.XMLClipboardExporter" : "com.sun.star.comp.DrawingLayer.XMLExporter" );
583 }
584
585 xComponent->dispose();
586 bRet = ( rxOStm->GetError() == ERRCODE_NONE );
587 }
588 catch( Exception& )
589 {
590 TOOLS_WARN_EXCEPTION( "sd", "sd::SdTransferable::WriteObject()" );
591 bRet = false;
592 }
593 }
594 break;
595
597 {
598 SfxObjectShell* pEmbObj = static_cast<SfxObjectShell*>(pObject);
599 ::utl::TempFileFast aTempFile;
600 SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE);
601
602 try
603 {
604 uno::Reference< embed::XStorage > xWorkStore =
605 ::comphelper::OStorageHelper::GetStorageFromStream( new utl::OStreamWrapper(*pTempStream), embed::ElementModes::READWRITE );
606
607 // write document storage
608 pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false );
609 // mba: no relative URLs for clipboard!
610 SfxMedium aMedium( xWorkStore, OUString() );
611 pEmbObj->DoSaveObjectAs( aMedium, false );
612 pEmbObj->DoSaveCompleted();
613
614 uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
615 if ( xTransact.is() )
616 xTransact->commit();
617
618 rxOStm->SetBufferSize( 0xff00 );
619 rxOStm->WriteStream( *pTempStream );
620
621 bRet = true;
622 }
623 catch ( Exception& )
624 {}
625 }
626
627 break;
628
629 default:
630 break;
631 }
632
633 return bRet;
634}
635
637{
638 if( mpSdView )
639 const_cast< ::sd::View* >(mpSdView)->DragFinished( nDropAction );
640}
641
643{
644 SdModule *pModule = SD_MOD();
645 if (!pModule)
646 return;
647
648 if( this == pModule->pTransferClip )
649 pModule->pTransferClip = nullptr;
650
651 if( this == pModule->pTransferDrag )
652 pModule->pTransferDrag = nullptr;
653
654 if( this == pModule->pTransferSelection )
655 pModule->pTransferSelection = nullptr;
656}
657
658void SdTransferable::SetObjectDescriptor( std::unique_ptr<TransferableObjectDescriptor> pObjDesc )
659{
660 mpObjDesc = std::move(pObjDesc);
662}
663
664void SdTransferable::SetPageBookmarks( std::vector<OUString> && rPageBookmarks, bool bPersistent )
665{
666 if( !mpSourceDoc )
667 return;
668
669 if( mpSdViewIntern )
671
673
674 mpPageDocShell = nullptr;
675
676 maPageBookmarks.clear();
677
678 if( bPersistent )
679 {
681 mpSdDrawDocument->InsertBookmarkAsPage( rPageBookmarks, nullptr, false, true, 1, true,
682 mpSourceDoc->GetDocSh(), true, true, false );
683 }
684 else
685 {
687 maPageBookmarks = std::move(rPageBookmarks);
688 }
689
690 if( mpSdViewIntern )
691 {
693
694 if( pPage )
695 {
697 }
698 }
699
700 // set flags for page transferable; if ( mbPageTransferablePersistent == sal_False ),
701 // don't offer any formats => it's just for internal purposes
702 mbPageTransferable = true;
703 mbPageTransferablePersistent = bPersistent;
704}
705
706void SdTransferable::AddUserData (const std::shared_ptr<UserData>& rpData)
707{
708 maUserData.push_back(rpData);
709}
710
712{
713 return maUserData.size();
714}
715
716std::shared_ptr<SdTransferable::UserData> SdTransferable::GetUserData (const sal_Int32 nIndex) const
717{
719 return maUserData[nIndex];
720 else
721 return std::shared_ptr<UserData>();
722}
723
724SdTransferable* SdTransferable::getImplementation( const Reference< XInterface >& rxData ) noexcept
725{
726 return dynamic_cast<SdTransferable*>(rxData.get());
727}
728
730{
731 if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
732 {
733 const SdrHint* pSdrHint = static_cast< const SdrHint* >( &rHint );
734 if( SdrHintKind::ModelCleared == pSdrHint->GetKind() )
735 {
737 mpSourceDoc = nullptr;
738 }
739 }
740 else
741 {
742 if( rHint.GetId() == SfxHintId::Dying )
743 {
744 if( &rBC == mpSourceDoc )
745 mpSourceDoc = nullptr;
746 if( &rBC == mpSdViewIntern )
747 mpSdViewIntern = nullptr;
748 if( &rBC == mpSdView )
749 mpSdView = nullptr;
750 }
751 }
752}
753
754void SdTransferable::SetView(const ::sd::View* pView)
755{
756 if (mpSdView)
757 EndListening(*const_cast<sd::View*>(mpSdView));
758 mpSdView = pView;
759 if (mpSdView)
760 StartListening(*const_cast<sd::View*>(mpSdView));
761}
762
764{
765 if ( pModel )
766 {
767 SdrPage* pPage = pModel->GetPage(0);
768 if (pPage && pPage->GetObjCount() == 1 )
769 {
770 sdr::table::SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( pPage->GetObj(0) );
771 if( pTableObj )
772 {
773 SvMemoryStream aMemStm( 65535, 65535 );
774 sdr::table::ExportAsRTF( aMemStm, *pTableObj );
775 return SetAny( Any( Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.TellEnd() ) ) );
776 }
777 }
778 }
779
780 return false;
781}
782
783/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static OutputDevice * GetDefaultDevice()
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const override
virtual const SvxFieldItem * GetField() const=0
virtual void HideSdrPage() override
virtual SdrPageView * ShowSdrPage(SdrPage *pPage) override
const EditTextObject & GetTextObject() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
void CreateFirstPages(SdDrawDocument const *pRefDocument=nullptr)
if the document does not contain at least one handout, one slide and one notes page with at least one...
Definition: drawdoc2.cxx:493
SAL_DLLPRIVATE bool InsertBookmarkAsPage(const std::vector< OUString > &rBookmarkList, std::vector< OUString > *pExchangeList, bool bLink, bool bReplace, sal_uInt16 nPgPos, bool bNoDialogs, ::sd::DrawDocShell *pBookmarkDocSh, bool bCopy, bool bMergeMasterPages, bool bPreservePageNames)
Insert pages into this document.
Definition: drawdoc3.cxx:375
SAL_DLLPRIVATE void SetOnlineSpell(bool bIn)
Definition: drawdoc.cxx:962
SAL_DLLPRIVATE bool GetOnlineSpell() const
Definition: drawdoc.hxx:431
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
Definition: drawdoc2.cxx:207
SAL_DLLPRIVATE void CreatingDataObj(SdTransferable *pTransferable)
Definition: drawdoc.hxx:255
static SAL_DLLPRIVATE SdAnimationInfo * GetAnimationInfo(SdrObject *pObject)
deprecated
Definition: drawdoc2.cxx:950
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
Definition: drawdoc.hxx:242
SAL_DLLPRIVATE DocumentType GetDocumentType() const
Definition: drawdoc.hxx:251
SdTransferable * pTransferDrag
Definition: sdmod.hxx:100
SdTransferable * pTransferClip
Definition: sdmod.hxx:99
SdTransferable * pTransferSelection
Definition: sdmod.hxx:101
void SetLayoutName(const OUString &aName)
Definition: sdpage.cxx:2487
virtual OUString GetLayoutName() const override
Definition: sdpage.hxx:255
virtual void SetSize(const Size &aSize) override
Definition: sdpage.cxx:1746
void CopyCellSheets(SdStyleSheetPool &rSourcePool)
Definition: stlpool.cxx:518
void CopyLayoutSheets(std::u16string_view rLayoutName, SdStyleSheetPool &rSourcePool, StyleSheetCopyResultVector &rCreatedSheets)
Definition: stlpool.cxx:718
void CopyGraphicSheets(SdStyleSheetPool &rSourcePool)
Definition: stlpool.cxx:513
void CopyTableStyles(SdStyleSheetPool const &rSourcePool)
Definition: stlpool.cxx:523
std::unique_ptr< ImageMap > mpImageMap
Definition: sdxfer.hxx:126
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
Definition: sdxfer.cxx:442
bool mbLateInit
Definition: sdxfer.hxx:132
void AddUserData(const std::shared_ptr< UserData > &rpData)
Add a user data object.
Definition: sdxfer.cxx:706
::std::vector< std::shared_ptr< UserData > > maUserData
Definition: sdxfer.hxx:135
sal_Int32 GetUserDataCount() const
Return the number of user data objects.
Definition: sdxfer.cxx:711
void CreateData()
Definition: sdxfer.cxx:242
SdDrawDocument * mpSdDrawDocument
Definition: sdxfer.hxx:120
virtual void DragFinished(sal_Int8 nDropAction) override
Definition: sdxfer.cxx:636
virtual void AddSupportedFormats() override
Definition: sdxfer.cxx:376
void CreateObjectReplacement(SdrObject *pObj)
Definition: sdxfer.cxx:143
std::optional< Graphic > moGraphic
Definition: sdxfer.hxx:125
std::shared_ptr< UserData > GetUserData(const sal_Int32 nIndex) const
Return the specified user data object.
Definition: sdxfer.cxx:716
bool mbOwnView
Definition: sdxfer.hxx:131
std::optional< INetBookmark > moBookmark
Definition: sdxfer.hxx:124
virtual ~SdTransferable() override
Definition: sdxfer.cxx:103
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor) override
Definition: sdxfer.cxx:561
SdDrawDocument * mpSdDrawDocumentIntern
Definition: sdxfer.hxx:121
bool mbOwnDocument
Definition: sdxfer.hxx:130
bool SetTableRTF(SdDrawDocument *)
Definition: sdxfer.cxx:763
::sd::View * mpSdViewIntern
Definition: sdxfer.hxx:119
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: sdxfer.cxx:729
std::unique_ptr< TransferableObjectDescriptor > mpObjDesc
Definition: sdxfer.hxx:117
bool mbPageTransferable
Definition: sdxfer.hxx:133
void SetObjectDescriptor(std::unique_ptr< TransferableObjectDescriptor > pObjDesc)
Definition: sdxfer.cxx:658
SfxObjectShellRef maDocShellRef
Definition: sdxfer.hxx:113
std::vector< OUString > maPageBookmarks
Definition: sdxfer.hxx:115
::tools::Rectangle maVisArea
Definition: sdxfer.hxx:127
SdDrawDocument * mpSourceDoc
Definition: sdxfer.hxx:122
::sd::DrawDocShell * mpPageDocShell
Definition: sdxfer.hxx:114
std::unique_ptr< TransferableDataHelper > mpOLEDataHelper
Definition: sdxfer.hxx:116
bool mbPageTransferablePersistent
Definition: sdxfer.hxx:134
void SetView(const ::sd::View *pView)
Definition: sdxfer.cxx:754
VclPtr< VirtualDevice > mpVDev
Definition: sdxfer.hxx:123
SdTransferable(SdDrawDocument *pSrcDoc, ::sd::View *pWorkView, bool bInitOnGetData)
Definition: sdxfer.cxx:78
void SetPageBookmarks(std::vector< OUString > &&rPageBookmarks, bool bPersistent)
Definition: sdxfer.cxx:664
static SdTransferable * getImplementation(const css::uno::Reference< css::uno::XInterface > &rxData) noexcept
Definition: sdxfer.cxx:724
const ::sd::View * mpSdView
Definition: sdxfer.hxx:118
virtual void ObjectReleased() override final
Definition: sdxfer.cxx:642
GDIMetaFile GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked=false) const
BitmapEx GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked=false, const sal_uInt32 nMaximumQuadraticPixels=500000, const std::optional< Size > &rTargetDPI=std::nullopt) const
SdrHintKind GetKind() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
tools::Rectangle GetAllMarkedBoundRect() const
void MarkAllObj(SdrPageView *pPV=nullptr)
void hideMarkHandles()
SdrObject * GetMarkedSdrObj() const
MapUnit GetScaleUnit() const
void ClearModel(bool bCalledFromDestructor)
void setUnoModel(const css::uno::Reference< css::uno::XInterface > &xModel)
SfxStyleSheetBasePool * GetStyleSheetPool() const
void BurnInStyleSheetAttributes()
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
SdrObject * Next()
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
bool IsUnoObj() const
virtual SdrInventor GetObjInventor() const
bool HasLineStyle() const
virtual SdrObjKind GetObjIdentifier() const
bool HasFillStyle() const
virtual void NbcMove(const Size &rSiz)
SdrPage * GetPage() const
Size GetSize() const
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
SfxHintId GetId() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
bool DoSaveObjectAs(SfxMedium &rNewStor, bool bCommit)
void SetupStorage(const css::uno::Reference< css::embed::XStorage > &xStorage, sal_Int32 nVersion, bool bTemplate) const
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
const void * GetData()
virtual sal_uInt64 TellEnd() override
const SvxFieldData * GetField() const
static SvxIMapInfo * GetIMapInfo(const SdrObject *pObject)
const ImageMap & GetImageMap() 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 SetString(const OUString &rString)
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 SetImageMap(const ImageMap &rIMap)
bool SetGDIMetaFile(const GDIMetaFile &rMtf)
void disposeAndClear()
static VclPtr< reference_type > Create(Arg &&... arg)
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 >())
SdDrawDocument & GetDoc() const
Definition: View.hxx:293
void SetSize(const Size &)
constexpr Point TopLeft() const
void SetPos(const Point &rPoint)
constexpr bool IsEmpty() const
T * get() const
bool is() const
SvStream * GetStream(StreamMode eMode)
#define TOOLS_WARN_EXCEPTION(area, stream)
URL aURL
EmbeddedObjectRef * pObject
#define ERRCODE_NONE
::std::vector< DataFlavorEx > DataFlavorExVector
#define SOFFICE_FILEFORMAT_CURRENT
SotClipboardFormatId
constexpr OUStringLiteral SD_LT_SEPARATOR
Definition: glob.hxx:49
sal_Int32 nIndex
sal_uInt16 nPos
std::unique_ptr< sal_Int32[]> pData
@ Exception
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void ExportAsRTF(SvStream &rStrm, SdrTableObj &rObj)
#define SD_MOD()
Definition: sdmod.hxx:184
static bool lcl_HasOnlyOneTable(SdrModel *pModel)
Definition: sdxfer.cxx:362
constexpr sal_uInt32 SDTRANSFER_OBJECTTYPE_DRAWOLE
Definition: sdxfer.cxx:76
constexpr sal_uInt32 SDTRANSFER_OBJECTTYPE_DRAWMODEL
Definition: sdxfer.cxx:75
static bool lcl_HasOnlyControls(SdrModel *pModel)
Definition: sdxfer.cxx:332
std::vector< StyleSheetCopyResult > StyleSheetCopyResultVector
Definition: stlsheet.hxx:184
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
signed char sal_Int8
OUString aLabel
SVXCORE_DLLPUBLIC bool SvxDrawingLayerExport(SdrModel *pModel, const css::uno::Reference< css::io::XOutputStream > &xOut)