Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SVDOOLE2_HXX
21 : #define _SVDOOLE2_HXX
22 :
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"
33 :
34 : //************************************************************
35 : // SdrOle2Obj
36 : //************************************************************
37 :
38 : class SvxUnoShapeModifyListener;
39 : class SdrOle2ObjImpl;
40 :
41 : class SVX_DLLPUBLIC SdrOle2Obj : public SdrRectObj
42 : {
43 : private:
44 :
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);
53 :
54 : // #i118485# helper added
55 : SdrObject* createSdrGrafObjReplacement(bool bAddText, bool bUseHCGraphic) const;
56 :
57 : protected:
58 : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
59 : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
60 :
61 : svt::EmbeddedObjectRef xObjRef;
62 : Graphic* pGraphic;
63 : String aProgName;
64 :
65 : // wg. Kompatibilitaet erstmal am SdrTextObj
66 : bool bFrame:1;
67 : bool bInDestruction:1;
68 : // #i118524#
69 : bool mbSuppressSetVisAreaSize:1;
70 : mutable bool m_bTypeAsked:1;
71 : mutable bool m_bChart:1;
72 :
73 : SdrOle2ObjImpl* mpImpl;
74 :
75 : SvxUnoShapeModifyListener* pModifyListener;
76 :
77 : protected:
78 :
79 : void ImpSetVisAreaSize();
80 : void Init();
81 :
82 : public:
83 : TYPEINFO();
84 :
85 : SdrOle2Obj(bool bFrame_ = false);
86 : SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, const String& rNewObjName, const Rectangle& rNewRect, bool bFrame_ = false);
87 : virtual ~SdrOle2Obj();
88 :
89 : // access to svt::EmbeddedObjectRef
90 170 : const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const { return xObjRef; }
91 :
92 296 : sal_Int64 GetAspect() const { return xObjRef.GetViewAspect(); }
93 : bool isInplaceActive() const;
94 : bool isUiActive() const;
95 : void SetAspect( sal_Int64 nAspect );
96 :
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();
102 :
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;
106 :
107 : // #i118524# Allow suppress SetVisAreaSize in changing methods when call
108 : // comes from OLE client
109 0 : void setSuppressSetVisAreaSize(bool bNew) { mbSuppressSetVisAreaSize = bNew; }
110 :
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 );
115 :
116 : // Einem SdrOle2Obj kann man ein Applikationsnamen verpassen, den man
117 : // spaeter wieder abfragen kann (SD braucht das fuer Praesentationsobjekte).
118 0 : void SetProgName(const String& rNam) { aProgName=rNam; }
119 0 : const String& GetProgName() const { return aProgName; }
120 : bool IsEmpty() const;
121 :
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;
124 :
125 : SVX_DLLPRIVATE com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef_NoInit() const;
126 :
127 : void AbandonObject();
128 :
129 : virtual void SetPage(SdrPage* pNewPage);
130 : virtual void SetModel(SdrModel* pModel);
131 :
132 : /** Change the IsClosedObj attribute
133 :
134 : @param bIsClosed
135 : Whether the OLE object is closed, i.e. has opaque background
136 : */
137 : void SetClosedObj( bool bIsClosed );
138 :
139 : // FullDrag support
140 : virtual SdrObject* getFullDragClone() const;
141 :
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;
146 :
147 : SdrOle2Obj* Clone() const;
148 : SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
149 :
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);
155 :
156 : static sal_Bool CanUnloadRunningObj( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
157 : sal_Int64 nAspect );
158 : static sal_Bool Unload( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
159 : sal_Bool Unload();
160 : void Connect();
161 : void Disconnect();
162 : void ObjectLoaded();
163 :
164 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel() const;
165 :
166 : // #109985#
167 : sal_Bool IsChart() const;
168 : sal_Bool IsCalc() const;
169 :
170 : sal_Bool UpdateLinkURL_Impl();
171 : void BreakFileLink_Impl();
172 : void DisconnectFileLink_Impl();
173 : void CheckFileLink_Impl();
174 :
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 );
179 :
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();
183 :
184 : // handy to get the empty replacement graphic without accessing all the old stuff
185 : static Graphic GetEmptyOLEReplacementGraphic();
186 :
187 : void SetWindow(const com::sun::star::uno::Reference < com::sun::star::awt::XWindow >& _xWindow);
188 :
189 : // #i118485# missing converter added
190 : virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
191 : };
192 :
193 : #endif //_SVDOOLE2_HXX
194 :
195 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|