1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDOOLE2_HXX
21 #define INCLUDED_SVX_SVDOOLE2_HXX
23 #include <svx/svdorect.hxx>
24 #include <svx/svxdllapi.h>
26 #include <com/sun/star/uno/Reference.h>
28 namespace com
{ namespace sun
{ namespace star
{
30 namespace awt
{ class XWindow
; }
32 namespace datatransfer
{ class XTransferable
; }
34 namespace embed
{ class XEmbeddedObject
; }
36 namespace frame
{ class XModel
; }
40 namespace svt
{ class EmbeddedObjectRef
; }
44 class SVX_DLLPUBLIC SdrOle2Obj
: public SdrRectObj
47 SdrOle2ObjImpl
* mpImpl
;
50 SVX_DLLPRIVATE
void Connect_Impl();
51 SVX_DLLPRIVATE
void Disconnect_Impl();
52 SVX_DLLPRIVATE
void Reconnect_Impl();
53 SVX_DLLPRIVATE
void AddListeners_Impl();
54 SVX_DLLPRIVATE
void RemoveListeners_Impl();
55 SVX_DLLPRIVATE ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
> GetTransferable_Impl() const;
56 SVX_DLLPRIVATE
void GetObjRef_Impl();
57 SVX_DLLPRIVATE
void SetGraphic_Impl(const Graphic
* pGrf
);
59 // #i118485# helper added
60 SVX_DLLPRIVATE SdrObject
* createSdrGrafObjReplacement(bool bAddText
, bool bUseHCGraphic
) const;
61 SVX_DLLPRIVATE
void ImpSetVisAreaSize();
64 virtual sdr::contact::ViewContact
* CreateObjectSpecificViewContact() SAL_OVERRIDE
;
65 virtual sdr::properties::BaseProperties
* CreateObjectSpecificProperties() SAL_OVERRIDE
;
68 OUString
GetStyleString();
71 SdrOle2Obj( bool bFrame_
= false );
72 SdrOle2Obj( const svt::EmbeddedObjectRef
& rNewObjRef
, const OUString
& rNewObjName
, const Rectangle
& rNewRect
, bool bFrame_
= false );
73 virtual ~SdrOle2Obj();
75 const svt::EmbeddedObjectRef
& getEmbeddedObjectRef() const;
77 sal_Int64
GetAspect() const;
78 bool isInplaceActive() const;
79 bool isUiActive() const;
80 void SetAspect( sal_Int64 nAspect
);
82 // An OLE graphic object can contain a StarView graphic,
83 // which will be displayed if the OLE object is empty.
84 void SetGraphic(const Graphic
* pGrf
);
85 const Graphic
* GetGraphic() const;
86 void GetNewReplacement();
88 // The original size of the object (size of the icon for iconified object)
89 // no conversion is done if no target mode is provided
90 Size
GetOrigObjSize( MapMode
* pTargetMapMode
= NULL
) const;
92 // #i118524# Allow suppress SetVisAreaSize in changing methods when call
93 // comes from OLE client
94 void setSuppressSetVisAreaSize( bool bNew
);
96 // OLE object has got a separate PersistName member now;
97 // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
98 OUString
GetPersistName() const;
99 void SetPersistName( const OUString
& rPersistName
);
101 // One can add an application name to a SdrOle2Obj, which can be queried for
102 // later on (SD needs this for presentation objects).
103 void SetProgName( const OUString
& rName
);
104 const OUString
& GetProgName() const;
105 bool IsEmpty() const;
107 void SetObjRef(const com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
>& rNewObjRef
);
108 com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
> GetObjRef() const;
110 SVX_DLLPRIVATE
com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
> GetObjRef_NoInit() const;
112 void AbandonObject();
114 virtual void SetPage(SdrPage
* pNewPage
) SAL_OVERRIDE
;
115 virtual void SetModel(SdrModel
* pModel
) SAL_OVERRIDE
;
117 /** Change the IsClosedObj attribute
120 Whether the OLE object is closed, i.e. has opaque background
122 void SetClosedObj( bool bIsClosed
);
125 virtual SdrObject
* getFullDragClone() const SAL_OVERRIDE
;
127 virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const SAL_OVERRIDE
;
128 virtual sal_uInt16
GetObjIdentifier() const SAL_OVERRIDE
;
129 virtual OUString
TakeObjNameSingul() const SAL_OVERRIDE
;
130 virtual OUString
TakeObjNamePlural() const SAL_OVERRIDE
;
132 virtual SdrOle2Obj
* Clone() const SAL_OVERRIDE
;
133 virtual SdrOle2Obj
* CloneWithShellIDs( const OUString
& rSrcShellID
, const OUString
& rDestShellID
) const SAL_OVERRIDE
;
135 SdrOle2Obj
& assignFrom( const SdrOle2Obj
& rObj
, const OUString
& rSrcShellID
, const OUString
& rDestShellID
);
136 SdrOle2Obj
& operator=(const SdrOle2Obj
& rObj
);
138 virtual void NbcMove(const Size
& rSize
) SAL_OVERRIDE
;
139 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) SAL_OVERRIDE
;
140 virtual void NbcSetSnapRect(const Rectangle
& rRect
) SAL_OVERRIDE
;
141 virtual void NbcSetLogicRect(const Rectangle
& rRect
) SAL_OVERRIDE
;
142 virtual void SetGeoData(const SdrObjGeoData
& rGeo
) SAL_OVERRIDE
;
144 static bool CanUnloadRunningObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& xObj
,
146 static bool Unload( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& xObj
, sal_Int64 nAspect
);
152 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> getXModel() const;
155 bool IsChart() const;
156 bool IsReal3DChart() const;
159 bool UpdateLinkURL_Impl();
160 void BreakFileLink_Impl();
161 void DisconnectFileLink_Impl();
162 void CheckFileLink_Impl();
164 // allows to transfer the graphics to the object helper
165 void SetGraphicToObj( const Graphic
& aGraphic
, const OUString
& aMediaType
);
166 void SetGraphicToObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xGrStream
,
167 const OUString
& aMediaType
);
169 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> GetParentXModel() const;
170 bool CalculateNewScaling( Fraction
& aScaleWidth
, Fraction
& aScaleHeight
, Size
& aObjAreaSize
);
171 bool AddOwnLightClient();
173 // handy to get the empty replacement graphic without accessing all the old stuff
174 static Graphic
GetEmptyOLEReplacementGraphic();
176 void SetWindow(const com::sun::star::uno::Reference
< com::sun::star::awt::XWindow
>& _xWindow
);
178 // #i118485# missing converter added
179 virtual SdrObject
* DoConvertToPolyObj(bool bBezier
, bool bAddText
) const SAL_OVERRIDE
;
182 #endif // INCLUDED_SVX_SVDOOLE2_HXX
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */