Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVDOOLE2_HXX
30 : : #define _SVDOOLE2_HXX
31 : :
32 : : #include <svtools/embedhlp.hxx>
33 : : #include <com/sun/star/uno/Reference.h>
34 : : #include <com/sun/star/frame/XModel.hpp>
35 : : #include <com/sun/star/datatransfer/XTransferable.hpp>
36 : : #include "com/sun/star/awt/XWindow.hpp"
37 : : #include <svx/svdorect.hxx>
38 : : #include <vcl/graph.hxx>
39 : : #include <vcl/gdimtf.hxx>
40 : : #include <sot/storage.hxx>
41 : : #include "svx/svxdllapi.h"
42 : :
43 : : //************************************************************
44 : : // SdrOle2Obj
45 : : //************************************************************
46 : :
47 : : class SvxUnoShapeModifyListener;
48 : : class SdrOle2ObjImpl;
49 : :
50 : : class SVX_DLLPUBLIC SdrOle2Obj : public SdrRectObj
51 : : {
52 : : private:
53 : :
54 : : SVX_DLLPRIVATE void Connect_Impl();
55 : : SVX_DLLPRIVATE void Disconnect_Impl();
56 : : SVX_DLLPRIVATE void Reconnect_Impl();
57 : : SVX_DLLPRIVATE void AddListeners_Impl();
58 : : SVX_DLLPRIVATE void RemoveListeners_Impl();
59 : : SVX_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::datatransfer::XTransferable > GetTransferable_Impl() const;
60 : : SVX_DLLPRIVATE void GetObjRef_Impl();
61 : : SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf);
62 : :
63 : : protected:
64 : : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
65 : : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
66 : :
67 : : svt::EmbeddedObjectRef xObjRef;
68 : : Graphic* pGraphic;
69 : : String aProgName;
70 : :
71 : : // wg. Kompatibilitaet erstmal am SdrTextObj
72 : : bool bFrame:1;
73 : : bool bInDestruction:1;
74 : : mutable bool m_bTypeAsked:1;
75 : : mutable bool m_bChart:1;
76 : :
77 : : SdrOle2ObjImpl* mpImpl;
78 : :
79 : : SvxUnoShapeModifyListener* pModifyListener;
80 : :
81 : : protected:
82 : :
83 : : void ImpSetVisAreaSize();
84 : : void Init();
85 : :
86 : : public:
87 : : TYPEINFO();
88 : :
89 : : SdrOle2Obj(bool bFrame_ = false);
90 : : SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, const String& rNewObjName, const Rectangle& rNewRect, bool bFrame_ = false);
91 : : virtual ~SdrOle2Obj();
92 : :
93 : : // access to svt::EmbeddedObjectRef
94 : : const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const { return xObjRef; }
95 : :
96 : 0 : sal_Int64 GetAspect() const { return xObjRef.GetViewAspect(); }
97 : : void SetAspect( sal_Int64 nAspect );
98 : :
99 : : // Ein OLE-Zeichenobjekt kann eine StarView-Grafik beinhalten.
100 : : // Diese wird angezeigt, wenn das OLE-Objekt leer ist.
101 : : void SetGraphic(const Graphic* pGrf);
102 : : Graphic* GetGraphic() const;
103 : : void GetNewReplacement();
104 : :
105 : : // the original size of the object ( size of the icon for iconified object )
106 : : // no conversion is done if no target mode is provided
107 : : Size GetOrigObjSize( MapMode* pTargetMapMode = NULL ) const;
108 : :
109 : :
110 : : // OLE object has got a separate PersistName member now;
111 : : // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
112 : : String GetPersistName() const;
113 : : void SetPersistName( const String& rPersistName );
114 : :
115 : : // Einem SdrOle2Obj kann man ein Applikationsnamen verpassen, den man
116 : : // spaeter wieder abfragen kann (SD braucht das fuer Praesentationsobjekte).
117 : 0 : void SetProgName(const String& rNam) { aProgName=rNam; }
118 : 0 : const String& GetProgName() const { return aProgName; }
119 : : bool IsEmpty() const;
120 : :
121 : : void SetObjRef(const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rNewObjRef);
122 : : com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef() const;
123 : :
124 : : SVX_DLLPRIVATE com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef_NoInit() const;
125 : :
126 : : void AbandonObject();
127 : :
128 : : virtual void SetPage(SdrPage* pNewPage);
129 : : virtual void SetModel(SdrModel* pModel);
130 : :
131 : : /** Change the IsClosedObj attribute
132 : :
133 : : @param bIsClosed
134 : : Whether the OLE object is closed, i.e. has opaque background
135 : : */
136 : : void SetClosedObj( bool bIsClosed );
137 : :
138 : : // FullDrag support
139 : : virtual SdrObject* getFullDragClone() const;
140 : :
141 : : virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
142 : : virtual sal_uInt16 GetObjIdentifier() const;
143 : : virtual void TakeObjNameSingul(String& rName) const;
144 : : virtual void TakeObjNamePlural(String& rName) const;
145 : :
146 : : SdrOle2Obj* Clone() const;
147 : : SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
148 : :
149 : : virtual void NbcMove(const Size& rSize);
150 : : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
151 : : virtual void NbcSetSnapRect(const Rectangle& rRect);
152 : : virtual void NbcSetLogicRect(const Rectangle& rRect);
153 : : virtual void SetGeoData(const SdrObjGeoData& rGeo);
154 : :
155 : : static sal_Bool CanUnloadRunningObj( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
156 : : sal_Int64 nAspect );
157 : : static sal_Bool Unload( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
158 : : sal_Bool Unload();
159 : : void Connect();
160 : : void Disconnect();
161 : : void ObjectLoaded();
162 : :
163 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel() const;
164 : :
165 : : // #109985#
166 : : sal_Bool IsChart() const;
167 : : sal_Bool IsCalc() const;
168 : :
169 : : sal_Bool UpdateLinkURL_Impl();
170 : : void BreakFileLink_Impl();
171 : : void DisconnectFileLink_Impl();
172 : : void CheckFileLink_Impl();
173 : :
174 : : // allows to transfer the graphics to the object helper
175 : : void SetGraphicToObj( const Graphic& aGraphic, const ::rtl::OUString& aMediaType );
176 : : void SetGraphicToObj( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xGrStream,
177 : : const ::rtl::OUString& aMediaType );
178 : :
179 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetParentXModel() const;
180 : : sal_Bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
181 : : sal_Bool AddOwnLightClient();
182 : :
183 : : // handy to get the empty replacement bitmap without accessing all the old stuff
184 : : static Bitmap GetEmtyOLEReplacementBitmap();
185 : :
186 : : void SetWindow(const com::sun::star::uno::Reference < com::sun::star::awt::XWindow >& _xWindow);
187 : : };
188 : :
189 : : #endif //_SVDOOLE2_HXX
190 : :
191 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|