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>
46#include <com/sun/star/form/FormButtonType.hpp>
47#include <com/sun/star/beans/XPropertySet.hpp>
79: mpPageDocShell( nullptr )
80, mpSdView( pWorkView )
81, mpSdViewIntern( pWorkView )
82, mpSdDrawDocument( nullptr )
83, mpSdDrawDocumentIntern( nullptr )
84, mpSourceDoc( pSrcDoc )
86, mbInternalMove( false )
87, mbOwnDocument( false )
89, mbLateInit( bInitOnGetData )
90, mbPageTransferable( false )
91, mbPageTransferablePersistent( false )
153 if(
auto pOleObj =
dynamic_cast< SdrOle2Obj*
>( pObj ) )
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() )
165 const Graphic* pObjGr = pOleObj->GetGraphic();
170 catch( uno::Exception& )
183 const Reference< css::awt::XControlModel >& xControlModel( pUnoCtrl->
GetUnoControlModel() );
185 if( !xControlModel.is() )
188 Reference< css::beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY );
193 css::form::FormButtonType eButtonType;
194 Any aTmp( xPropSet->getPropertyValue(
"ButtonType" ) );
196 if( aTmp >>= eButtonType )
200 xPropSet->getPropertyValue(
"Label" ) >>=
aLabel;
201 xPropSet->getPropertyValue(
"TargetURL" ) >>=
aURL;
211 if( (pPara = pTextObj->GetOutlinerParaObject()) !=
nullptr )
229 moBookmark.emplace( pURL->GetURL(), pURL->GetRepresentation() );
279 OSL_FAIL(
"SdTransferable::CreateData(), failed to create a model with persist, clipboard operation will fail for OLE objects!" );
298 aOldLayoutName = aOldLayoutName.copy( 0,
nPos );
300 pNewStylePool->
CopyLayoutSheets( aOldLayoutName, *pOldStylePool, aCreatedSheets );
317 Size aVector( -aOrigin.
X(), -aOrigin.
Y() );
319 for(
size_t nObj = 0, nObjCount = pPage->
GetObjCount(); nObj < nObjCount; ++nObj )
334 bool bOnlyControls =
false;
345 bOnlyControls =
true;
348 if (
dynamic_cast< const SdrUnoObj *
>( pObj ) ==
nullptr)
350 bOnlyControls =
false;
359 return bOnlyControls;
385 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
389 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
393 for(
const auto& rItem : aVector )
399 AddFormat( SotClipboardFormatId::DRAWING );
403 if(
moGraphic->GetType() == GraphicType::Bitmap )
406 AddFormat( SotClipboardFormatId::BITMAP );
407 AddFormat( SotClipboardFormatId::GDIMETAFILE );
411 AddFormat( SotClipboardFormatId::GDIMETAFILE );
413 AddFormat( SotClipboardFormatId::BITMAP );
418 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
419 AddFormat( SotClipboardFormatId::STRING );
423 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
424 AddFormat( SotClipboardFormatId::DRAWING );
427 AddFormat( SotClipboardFormatId::GDIMETAFILE );
429 AddFormat( SotClipboardFormatId::BITMAP );
434 AddFormat( SotClipboardFormatId::RICHTEXT );
459 if( nFormat == SotClipboardFormatId::GDIMETAFILE &&
moGraphic )
466 if( ( nFormat == SotClipboardFormatId::LINKSRCDESCRIPTOR || nFormat == SotClipboardFormatId::OBJECTDESCRIPTOR ) &&
mpObjDesc )
470 else if( nFormat == SotClipboardFormatId::DRAWING )
497 else if( nFormat == SotClipboardFormatId::GDIMETAFILE )
502 if (bToggleOnlineSpell)
505 if (bToggleOnlineSpell)
509 else if( SotClipboardFormatId::BITMAP == nFormat || SotClipboardFormatId::PNG == nFormat )
514 if (bToggleOnlineSpell)
517 if (bToggleOnlineSpell)
521 else if( ( nFormat == SotClipboardFormatId::STRING ) &&
moBookmark )
525 else if( ( nFormat == SotClipboardFormatId::SVXB ) &&
moGraphic )
529 else if( ( nFormat == SotClipboardFormatId::SVIM ) &&
mpImageMap )
537 else if( nFormat == SotClipboardFormatId::EMBED_SOURCE )
545 SfxObjectCreateMode::EMBEDDED,
565 switch( nObjectType )
571 static const bool bDontBurnInStyleSheet = ( getenv(
"AVOID_BURN_IN_FOR_GALLERY_THEME" ) != nullptr );
573 if ( !bDontBurnInStyleSheet )
575 rxOStm->SetBufferSize( 16348 );
578 pDoc->
setUnoModel( Reference< XInterface >::query( xComponent ) );
585 xComponent->dispose();
604 uno::Reference< embed::XStorage > xWorkStore =
610 SfxMedium aMedium( xWorkStore, OUString() );
614 uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
615 if ( xTransact.is() )
618 rxOStm->SetBufferSize( 0xff00 );
619 rxOStm->WriteStream( *pTempStream );
721 return std::shared_ptr<UserData>();
731 if (rHint.
GetId() == SfxHintId::ThisIsAnSdrHint)
733 const SdrHint* pSdrHint =
static_cast< const SdrHint*
>( &rHint );
734 if( SdrHintKind::ModelCleared == pSdrHint->
GetKind() )
742 if( rHint.
GetId() == SfxHintId::Dying )
static OutputDevice * GetDefaultDevice()
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const override
virtual const SvxFieldItem * GetField() const=0
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...
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.
SAL_DLLPRIVATE void SetOnlineSpell(bool bIn)
SAL_DLLPRIVATE bool GetOnlineSpell() const
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SAL_DLLPRIVATE void CreatingDataObj(SdTransferable *pTransferable)
static SAL_DLLPRIVATE SdAnimationInfo * GetAnimationInfo(SdrObject *pObject)
deprecated
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
SAL_DLLPRIVATE DocumentType GetDocumentType() const
SdTransferable * pTransferDrag
SdTransferable * pTransferClip
SdTransferable * pTransferSelection
void SetLayoutName(const OUString &aName)
virtual OUString GetLayoutName() const override
virtual void SetSize(const Size &aSize) override
void CopyCellSheets(SdStyleSheetPool &rSourcePool)
void CopyLayoutSheets(std::u16string_view rLayoutName, SdStyleSheetPool &rSourcePool, StyleSheetCopyResultVector &rCreatedSheets)
void CopyGraphicSheets(SdStyleSheetPool &rSourcePool)
void CopyTableStyles(SdStyleSheetPool const &rSourcePool)
std::unique_ptr< ImageMap > mpImageMap
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
void AddUserData(const std::shared_ptr< UserData > &rpData)
Add a user data object.
::std::vector< std::shared_ptr< UserData > > maUserData
sal_Int32 GetUserDataCount() const
Return the number of user data objects.
SdDrawDocument * mpSdDrawDocument
virtual void DragFinished(sal_Int8 nDropAction) override
virtual void AddSupportedFormats() override
void CreateObjectReplacement(SdrObject *pObj)
std::optional< Graphic > moGraphic
std::shared_ptr< UserData > GetUserData(const sal_Int32 nIndex) const
Return the specified user data object.
std::optional< INetBookmark > moBookmark
virtual ~SdTransferable() override
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor) override
SdDrawDocument * mpSdDrawDocumentIntern
bool SetTableRTF(SdDrawDocument *)
::sd::View * mpSdViewIntern
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
std::unique_ptr< TransferableObjectDescriptor > mpObjDesc
void SetObjectDescriptor(std::unique_ptr< TransferableObjectDescriptor > pObjDesc)
SfxObjectShellRef maDocShellRef
std::vector< OUString > maPageBookmarks
::tools::Rectangle maVisArea
SdDrawDocument * mpSourceDoc
::sd::DrawDocShell * mpPageDocShell
std::unique_ptr< TransferableDataHelper > mpOLEDataHelper
bool mbPageTransferablePersistent
void SetView(const ::sd::View *pView)
VclPtr< VirtualDevice > mpVDev
SdTransferable(SdDrawDocument *pSrcDoc, ::sd::View *pWorkView, bool bInitOnGetData)
void SetPageBookmarks(std::vector< OUString > &&rPageBookmarks, bool bPersistent)
static SdTransferable * getImplementation(const css::uno::Reference< css::uno::XInterface > &rxData) noexcept
const ::sd::View * mpSdView
virtual void ObjectReleased() override final
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)
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 * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual SdrInventor GetObjInventor() const
bool HasLineStyle() const
virtual SdrObjKind GetObjIdentifier() const
bool HasFillStyle() const
virtual void NbcMove(const Size &rSiz)
SdrPage * GetPage() const
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() 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)
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)
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
SvStream * GetStream(StreamMode eMode)
#define TOOLS_WARN_EXCEPTION(area, stream)
EmbeddedObjectRef * pObject
::std::vector< DataFlavorEx > DataFlavorExVector
constexpr OUStringLiteral SD_LT_SEPARATOR
std::unique_ptr< sal_Int32[]> pData
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)
static bool lcl_HasOnlyOneTable(SdrModel *pModel)
constexpr sal_uInt32 SDTRANSFER_OBJECTTYPE_DRAWOLE
constexpr sal_uInt32 SDTRANSFER_OBJECTTYPE_DRAWMODEL
static bool lcl_HasOnlyControls(SdrModel *pModel)
std::vector< StyleSheetCopyResult > StyleSheetCopyResultVector
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
SVXCORE_DLLPUBLIC bool SvxDrawingLayerExport(SdrModel *pModel, const css::uno::Reference< css::io::XOutputStream > &xOut)