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 .
23 #include <svtools/embedhlp.hxx>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/frame/XModel.hpp>
26 #include <com/sun/star/datatransfer/XTransferable.hpp>
27 #include "com/sun/star/awt/XWindow.hpp"
28 #include <svx/svdorect.hxx>
29 #include <vcl/graph.hxx>
30 #include <vcl/gdimtf.hxx>
31 #include <sot/storage.hxx>
32 #include "svx/svxdllapi.h"
34 //************************************************************
36 //************************************************************
38 class SvxUnoShapeModifyListener
;
41 class SVX_DLLPUBLIC SdrOle2Obj
: public SdrRectObj
45 SVX_DLLPRIVATE
void Connect_Impl();
46 SVX_DLLPRIVATE
void Disconnect_Impl();
47 SVX_DLLPRIVATE
void Reconnect_Impl();
48 SVX_DLLPRIVATE
void AddListeners_Impl();
49 SVX_DLLPRIVATE
void RemoveListeners_Impl();
50 SVX_DLLPRIVATE ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
> GetTransferable_Impl() const;
51 SVX_DLLPRIVATE
void GetObjRef_Impl();
52 SVX_DLLPRIVATE
void SetGraphic_Impl(const Graphic
* pGrf
);
54 // #i118485# helper added
55 SdrObject
* createSdrGrafObjReplacement(bool bAddText
, bool bUseHCGraphic
) const;
58 virtual sdr::contact::ViewContact
* CreateObjectSpecificViewContact();
59 virtual sdr::properties::BaseProperties
* CreateObjectSpecificProperties();
61 svt::EmbeddedObjectRef xObjRef
;
65 // wg. Kompatibilitaet erstmal am SdrTextObj
67 bool bInDestruction
:1;
69 bool mbSuppressSetVisAreaSize
:1;
70 mutable bool m_bTypeAsked
:1;
71 mutable bool m_bChart
:1;
73 SdrOle2ObjImpl
* mpImpl
;
75 SvxUnoShapeModifyListener
* pModifyListener
;
79 void ImpSetVisAreaSize();
85 SdrOle2Obj(bool bFrame_
= false);
86 SdrOle2Obj(const svt::EmbeddedObjectRef
& rNewObjRef
, const String
& rNewObjName
, const Rectangle
& rNewRect
, bool bFrame_
= false);
87 virtual ~SdrOle2Obj();
89 // access to svt::EmbeddedObjectRef
90 const svt::EmbeddedObjectRef
& getEmbeddedObjectRef() const { return xObjRef
; }
92 sal_Int64
GetAspect() const { return xObjRef
.GetViewAspect(); }
93 bool isInplaceActive() const;
94 bool isUiActive() const;
95 void SetAspect( sal_Int64 nAspect
);
97 // Ein OLE-Zeichenobjekt kann eine StarView-Grafik beinhalten.
98 // Diese wird angezeigt, wenn das OLE-Objekt leer ist.
99 void SetGraphic(const Graphic
* pGrf
);
100 const Graphic
* GetGraphic() const;
101 void GetNewReplacement();
103 // the original size of the object ( size of the icon for iconified object )
104 // no conversion is done if no target mode is provided
105 Size
GetOrigObjSize( MapMode
* pTargetMapMode
= NULL
) const;
107 // #i118524# Allow suppress SetVisAreaSize in changing methods when call
108 // comes from OLE client
109 void setSuppressSetVisAreaSize(bool bNew
) { mbSuppressSetVisAreaSize
= bNew
; }
111 // OLE object has got a separate PersistName member now;
112 // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
113 String
GetPersistName() const;
114 void SetPersistName( const String
& rPersistName
);
116 // Einem SdrOle2Obj kann man ein Applikationsnamen verpassen, den man
117 // spaeter wieder abfragen kann (SD braucht das fuer Praesentationsobjekte).
118 void SetProgName(const String
& rNam
) { aProgName
=rNam
; }
119 const String
& GetProgName() const { return aProgName
; }
120 bool IsEmpty() const;
122 void SetObjRef(const com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
>& rNewObjRef
);
123 com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
> GetObjRef() const;
125 SVX_DLLPRIVATE
com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
> GetObjRef_NoInit() const;
127 void AbandonObject();
129 virtual void SetPage(SdrPage
* pNewPage
);
130 virtual void SetModel(SdrModel
* pModel
);
132 /** Change the IsClosedObj attribute
135 Whether the OLE object is closed, i.e. has opaque background
137 void SetClosedObj( bool bIsClosed
);
140 virtual SdrObject
* getFullDragClone() const;
142 virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const;
143 virtual sal_uInt16
GetObjIdentifier() const;
144 virtual void TakeObjNameSingul(String
& rName
) const;
145 virtual void TakeObjNamePlural(String
& rName
) const;
147 SdrOle2Obj
* Clone() const;
148 SdrOle2Obj
& operator=(const SdrOle2Obj
& rObj
);
150 virtual void NbcMove(const Size
& rSize
);
151 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
);
152 virtual void NbcSetSnapRect(const Rectangle
& rRect
);
153 virtual void NbcSetLogicRect(const Rectangle
& rRect
);
154 virtual void SetGeoData(const SdrObjGeoData
& rGeo
);
156 static sal_Bool
CanUnloadRunningObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& xObj
,
158 static sal_Bool
Unload( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedObject
>& xObj
, sal_Int64 nAspect
);
164 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> getXModel() const;
167 sal_Bool
IsChart() const;
168 sal_Bool
IsCalc() const;
170 sal_Bool
UpdateLinkURL_Impl();
171 void BreakFileLink_Impl();
172 void DisconnectFileLink_Impl();
173 void CheckFileLink_Impl();
175 // allows to transfer the graphics to the object helper
176 void SetGraphicToObj( const Graphic
& aGraphic
, const OUString
& aMediaType
);
177 void SetGraphicToObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xGrStream
,
178 const OUString
& aMediaType
);
180 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> GetParentXModel() const;
181 sal_Bool
CalculateNewScaling( Fraction
& aScaleWidth
, Fraction
& aScaleHeight
, Size
& aObjAreaSize
);
182 sal_Bool
AddOwnLightClient();
184 // handy to get the empty replacement bitmap without accessing all the old stuff
185 static Bitmap
GetEmtyOLEReplacementBitmap();
187 void SetWindow(const com::sun::star::uno::Reference
< com::sun::star::awt::XWindow
>& _xWindow
);
189 // #i118485# missing converter added
190 virtual SdrObject
* DoConvertToPolyObj(sal_Bool bBezier
, bool bAddText
) const;
193 #endif //_SVDOOLE2_HXX
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */