2010-10-27 12:53:26 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-27 16:10:40 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-01-19 18:09:07 +00:00
|
|
|
|
2013-10-23 22:38:46 +02:00
|
|
|
#ifndef INCLUDED_SD_SOURCE_UI_INC_SDXFER_HXX
|
|
|
|
#define INCLUDED_SD_SOURCE_UI_INC_SDXFER_HXX
|
2001-01-19 18:09:07 +00:00
|
|
|
|
2018-10-08 09:02:25 +01:00
|
|
|
#include <vcl/transfer.hxx>
|
2004-10-04 17:37:15 +00:00
|
|
|
#include <sfx2/objsh.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/lstner.hxx>
|
2001-01-19 18:09:07 +00:00
|
|
|
|
2014-02-25 23:45:44 +01:00
|
|
|
// SdTransferable
|
2001-01-19 18:09:07 +00:00
|
|
|
class SdDrawDocument;
|
2004-07-13 13:06:47 +00:00
|
|
|
class SdrObject;
|
2001-01-19 18:09:07 +00:00
|
|
|
class INetBookmark;
|
|
|
|
class ImageMap;
|
|
|
|
class VirtualDevice;
|
2004-01-20 11:26:22 +00:00
|
|
|
|
|
|
|
namespace sd {
|
|
|
|
class DrawDocShell;
|
|
|
|
class View;
|
|
|
|
}
|
2001-01-19 18:09:07 +00:00
|
|
|
|
New loplugin:dyncastvisibility
...to find uses of dynamic_cast where the static (base) type has hidden
visibility while the dynamic (derived) one has default visibility, and which may
thus fail at least on macOS like happened in
d5ed3cd6dbd22bb18542778f1c48f4d5b3ae0f95 "Make WinMtfFontStyle's base class
EMFIO_DLLPUBLIC, too".
libcxxabi's __dynamic_cast takes static_type and dst_type arguments. Now, if
dst_type (the derived type, with default visibility) is taken from .so A (and
thus references the version of the base type info hidden in .so A) but the
__dynamic_cast call is made from .so B, it passes for static_type the base type
information hidden in .so B, and __dynamic_cast will consider the cast to fail.
I'm not sure whether hidden intermediary types (in the hierarchy between the
dynamic_cast's base and derived types) acutally cause a problem too, but lets
flag them with the plugin anyway.
The fixes use SAL_DLLPUBLIC_RTTI. For one, there appear to be no other reasons
than type visibility to make those classes SAL_DLLPUBLIC. For another, this
nicely avoids any actual changes on Windows (where SAL_DLLPUBLIC expands to
nothing, and many of the affected classes were explicityl introduced into class
hierarchies as "MSVC hacks").
Change-Id: Ia85a9635cebffb1009a9efc1484b8bd4025585d4
Reviewed-on: https://gerrit.libreoffice.org/41802
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-01 20:14:25 +02:00
|
|
|
class SAL_DLLPUBLIC_RTTI SdTransferable : public TransferableHelper, public SfxListener
|
2001-01-19 18:09:07 +00:00
|
|
|
{
|
2004-01-20 11:26:22 +00:00
|
|
|
public:
|
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, bool bInitOnGetData );
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~SdTransferable() override;
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2006-12-12 16:48:39 +00:00
|
|
|
void SetDocShell( const SfxObjectShellRef& rRef ) { maDocShellRef = rRef; }
|
|
|
|
const SfxObjectShellRef& GetDocShell() const { return maDocShellRef; }
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2015-03-26 15:30:40 +01:00
|
|
|
void SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = const_cast<SdDrawDocument*>(pWorkDoc); }
|
2006-12-12 16:48:39 +00:00
|
|
|
const SdDrawDocument* GetWorkDocument() const { return mpSdDrawDocument; }
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2014-11-18 16:35:06 +00:00
|
|
|
void SetView(const ::sd::View* pView);
|
|
|
|
const ::sd::View* GetView() const { return mpSdView; }
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2018-03-20 13:49:04 +02:00
|
|
|
void SetObjectDescriptor( std::unique_ptr<TransferableObjectDescriptor> pObjDesc );
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2006-12-12 16:48:39 +00:00
|
|
|
void SetStartPos( const Point& rStartPos ) { maStartPos = rStartPos; }
|
|
|
|
const Point& GetStartPos() const { return maStartPos; }
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
void SetInternalMove( bool bSet ) { mbInternalMove = bSet; }
|
|
|
|
bool IsInternalMove() const { return mbInternalMove; }
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
bool HasSourceDoc( const SdDrawDocument* pDoc ) const { return( mpSourceDoc == pDoc ); }
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
void SetPageBookmarks( const std::vector<OUString>& rPageBookmarks, bool bPersistent );
|
|
|
|
bool IsPageTransferable() const { return mbPageTransferable; }
|
|
|
|
bool HasPageBookmarks() const { return( mpPageDocShell && ( !maPageBookmarks.empty() ) ); }
|
2015-10-28 12:01:32 +02:00
|
|
|
const std::vector<OUString>& GetPageBookmarks() const { return maPageBookmarks; }
|
|
|
|
::sd::DrawDocShell* GetPageDocShell() const { return mpPageDocShell; }
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2017-05-16 12:36:22 +02:00
|
|
|
bool SetTableRTF( SdDrawDocument* );
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2015-10-28 12:01:32 +02:00
|
|
|
static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
|
|
|
|
static SdTransferable* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) throw();
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2005-11-08 08:04:48 +00:00
|
|
|
// SfxListener
|
2015-10-28 12:01:32 +02:00
|
|
|
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
|
2005-11-08 08:04:48 +00:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void DragFinished( sal_Int8 nDropAction ) override;
|
2015-04-14 12:44:47 +02:00
|
|
|
SdDrawDocument* GetSourceDoc() const { return mpSourceDoc;}
|
2011-03-08 17:22:13 +01:00
|
|
|
|
|
|
|
/** User data objects can be used to store information temporarily
|
|
|
|
at the transferable. The slide sorter uses this to store
|
|
|
|
previews of the slides that are referenced by the
|
|
|
|
transferable.
|
|
|
|
*/
|
|
|
|
class UserData {public:virtual~UserData(){}};
|
|
|
|
|
|
|
|
/** Add a user data object. When it was added before (and not
|
|
|
|
removed) then this call is ignored.
|
|
|
|
*/
|
2015-09-18 09:09:12 +01:00
|
|
|
void AddUserData (const std::shared_ptr<UserData>& rpData);
|
2011-03-08 17:22:13 +01:00
|
|
|
|
|
|
|
/** Return the number of user data objects.
|
|
|
|
*/
|
2015-04-14 12:44:47 +02:00
|
|
|
sal_Int32 GetUserDataCount() const;
|
2011-03-08 17:22:13 +01:00
|
|
|
|
|
|
|
/** Return the specified user data object. When the index is not
|
|
|
|
valid, ie not in the range [0,count) then an empty pointer is
|
|
|
|
returned.
|
|
|
|
*/
|
2015-09-18 09:09:12 +01:00
|
|
|
std::shared_ptr<UserData> GetUserData (const sal_Int32 nIndex) const;
|
2011-03-08 17:22:13 +01:00
|
|
|
|
2004-01-20 11:26:22 +00:00
|
|
|
protected:
|
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void AddSupportedFormats() override;
|
2015-10-28 12:01:32 +02:00
|
|
|
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
|
2017-11-10 23:18:52 +01:00
|
|
|
virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void ObjectReleased() override;
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override;
|
2004-01-20 11:26:22 +00:00
|
|
|
|
2001-01-19 18:09:07 +00:00
|
|
|
private:
|
|
|
|
|
2006-12-12 16:48:39 +00:00
|
|
|
SfxObjectShellRef maDocShellRef;
|
|
|
|
::sd::DrawDocShell* mpPageDocShell;
|
2013-04-07 12:06:47 +02:00
|
|
|
std::vector<OUString> maPageBookmarks;
|
2018-03-20 13:49:04 +02:00
|
|
|
std::unique_ptr<TransferableDataHelper> mpOLEDataHelper;
|
|
|
|
std::unique_ptr<TransferableObjectDescriptor> mpObjDesc;
|
2006-12-12 16:48:39 +00:00
|
|
|
const ::sd::View* mpSdView;
|
|
|
|
::sd::View* mpSdViewIntern;
|
|
|
|
SdDrawDocument* mpSdDrawDocument;
|
|
|
|
SdDrawDocument* mpSdDrawDocumentIntern;
|
|
|
|
SdDrawDocument* mpSourceDoc;
|
2015-03-20 11:58:25 +00:00
|
|
|
VclPtr<VirtualDevice> mpVDev;
|
2018-03-20 13:49:04 +02:00
|
|
|
std::unique_ptr<INetBookmark> mpBookmark;
|
|
|
|
std::unique_ptr<Graphic> mpGraphic;
|
|
|
|
std::unique_ptr<ImageMap> mpImageMap;
|
2017-03-30 20:27:55 +02:00
|
|
|
::tools::Rectangle maVisArea;
|
2006-12-12 16:48:39 +00:00
|
|
|
Point maStartPos;
|
2014-04-24 10:52:02 +02:00
|
|
|
bool mbInternalMove : 1;
|
|
|
|
bool mbOwnDocument : 1;
|
|
|
|
bool mbOwnView : 1;
|
2018-10-08 16:12:06 +02:00
|
|
|
bool const mbLateInit : 1;
|
2014-04-24 10:52:02 +02:00
|
|
|
bool mbPageTransferable : 1;
|
|
|
|
bool mbPageTransferablePersistent : 1;
|
2015-09-18 09:09:12 +01:00
|
|
|
::std::vector<std::shared_ptr<UserData> > maUserData;
|
2001-01-19 18:09:07 +00:00
|
|
|
|
2015-10-12 15:25:41 +02:00
|
|
|
SdTransferable( const SdTransferable& ) = delete;
|
|
|
|
SdTransferable& operator=( const SdTransferable& ) = delete;
|
2001-01-19 18:09:07 +00:00
|
|
|
|
|
|
|
void CreateObjectReplacement( SdrObject* pObj );
|
|
|
|
void CreateData();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2013-10-23 22:38:46 +02:00
|
|
|
#endif // INCLUDED_SD_SOURCE_UI_INC_SDXFER_HXX
|
2010-10-27 12:53:26 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|