xref: /AOO41X/main/svx/inc/svx/svdoole2.hxx (revision 4d7c9de063a797b8b4f3d45e3561e82ad1f8ef1f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDOOLE2_HXX
25 #define _SVDOOLE2_HXX
26 
27 #include <svtools/embedhlp.hxx>
28 #include <com/sun/star/uno/Reference.h>
29 #include <com/sun/star/frame/XModel.hpp>
30 #include <com/sun/star/datatransfer/XTransferable.hpp>
31 #include "com/sun/star/awt/XWindow.hpp"
32 #include <svx/svdorect.hxx>
33 #include <vcl/graph.hxx>
34 #include <vcl/gdimtf.hxx>
35 #include <sot/storage.hxx>
36 #include "svx/svxdllapi.h"
37 
38 //************************************************************
39 //   SdrOle2Obj
40 //************************************************************
41 
42 class SvxUnoShapeModifyListener;
43 class SdrOle2ObjImpl;
44 
45 class SVX_DLLPUBLIC SdrOle2Obj :  public SdrRectObj
46 {
47 private:
48 
49     SVX_DLLPRIVATE void Connect_Impl();
50     SVX_DLLPRIVATE void Disconnect_Impl();
51     SVX_DLLPRIVATE void Reconnect_Impl();
52     SVX_DLLPRIVATE void AddListeners_Impl();
53     SVX_DLLPRIVATE void RemoveListeners_Impl();
54     SVX_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::datatransfer::XTransferable > GetTransferable_Impl() const;
55     SVX_DLLPRIVATE void GetObjRef_Impl();
56     SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf);
57 
58     // #i118485# helper added
59     SdrObject* createSdrGrafObjReplacement(bool bAddText, bool bUseHCGraphic) const;
60 
61 protected:
62     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
63     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
64 
65     svt::EmbeddedObjectRef      xObjRef;
66     Graphic*                    pGraphic;
67     String                      aProgName;
68 
69     // wg. Kompatibilitaet erstmal am SdrTextObj
70     sal_Bool                        bFrame : 1;
71     sal_Bool                        bInDestruction : 1;
72     // #i118524#
73     bool                        mbSuppressSetVisAreaSize : 1;
74     mutable bool                m_bTypeAsked;
75     mutable bool                m_bChart;
76 
77     SdrOle2ObjImpl*             mpImpl;
78 
79     SvxUnoShapeModifyListener*  pModifyListener;
80 
81 protected:
82 
83     void ImpSetVisAreaSize();
84     void Init();
85 
86 public:
87     String GetStyleString();
88     TYPEINFO();
89 
90     SdrOle2Obj(FASTBOOL bFrame_=sal_False);
91     SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, FASTBOOL bFrame_=sal_False);
92     SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, const String& rNewObjName, FASTBOOL bFrame_=sal_False);
93     SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, const String& rNewObjName, const Rectangle& rNewRect, FASTBOOL bFrame_=sal_False);
94     virtual ~SdrOle2Obj();
95 
96     // access to svt::EmbeddedObjectRef
getEmbeddedObjectRef() const97     const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const { return xObjRef; }
98 
GetAspect() const99     sal_Int64 GetAspect() const { return xObjRef.GetViewAspect(); }
100     bool isInplaceActive() const;
101     bool isUiActive() const;
102     void SetAspect( sal_Int64 nAspect );
103 
104     // Ein OLE-Zeichenobjekt kann eine StarView-Grafik beinhalten.
105     // Diese wird angezeigt, wenn das OLE-Objekt leer ist.
106     void        SetGraphic(const Graphic* pGrf);
107     Graphic*    GetGraphic() const;
108     void        GetNewReplacement();
109 
110     // the original size of the object ( size of the icon for iconified object )
111     // no conversion is done if no target mode is provided
112     Size        GetOrigObjSize( MapMode* pTargetMapMode = NULL ) const;
113 
114     // #i118524# Allow suppress SetVisAreaSize in changing methods when call
115     // comes from OLE client
setSuppressSetVisAreaSize(bool bNew)116     void setSuppressSetVisAreaSize(bool bNew) { mbSuppressSetVisAreaSize = bNew; }
117 
118     // OLE object has got a separate PersistName member now;
119     // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
120     String      GetPersistName() const;
121     void        SetPersistName( const String& rPersistName );
122 
123     // Einem SdrOle2Obj kann man ein Applikationsnamen verpassen, den man
124     // spaeter wieder abfragen kann (SD braucht das fuer Praesentationsobjekte).
SetProgName(const String & rNam)125     void SetProgName(const String& rNam) { aProgName=rNam; }
GetProgName() const126     const String& GetProgName() const { return aProgName; }
127     FASTBOOL IsEmpty() const;
128 
129     void SetObjRef(const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rNewObjRef);
130     com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef() const;
131 
132     SVX_DLLPRIVATE com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef_NoInit() const;
133 
134     void AbandonObject();
135 
136     virtual void SetPage(SdrPage* pNewPage);
137     virtual void SetModel(SdrModel* pModel);
138 
139     /** Change the IsClosedObj attribute
140 
141         @param bIsClosed
142         Whether the OLE object is closed, i.e. has opaque background
143      */
144     void SetClosedObj( bool bIsClosed );
145 
146     // FullDrag support
147     virtual SdrObject* getFullDragClone() const;
148 
149     virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
150     virtual sal_uInt16 GetObjIdentifier() const;
151     virtual void TakeObjNameSingul(String& rName) const;
152     virtual void TakeObjNamePlural(String& rName) const;
153 
154     virtual void operator=(const SdrObject& rObj);
155 
156     virtual void NbcMove(const Size& rSize);
157     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
158     virtual void NbcSetSnapRect(const Rectangle& rRect);
159     virtual void NbcSetLogicRect(const Rectangle& rRect);
160     virtual void SetGeoData(const SdrObjGeoData& rGeo);
161 
162     static sal_Bool CanUnloadRunningObj( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
163                                          sal_Int64 nAspect );
164     static sal_Bool Unload( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
165     sal_Bool Unload();
166     void Connect();
167     void Disconnect();
168     void ObjectLoaded();
169 
170     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel() const;
171 
172     // #109985#
173     sal_Bool IsChart() const;
174     sal_Bool IsCalc() const;
175 
176     sal_Bool UpdateLinkURL_Impl();
177     void BreakFileLink_Impl();
178     void DisconnectFileLink_Impl();
179     void CheckFileLink_Impl();
180 
181     // allows to transfer the graphics to the object helper
182     void SetGraphicToObj( const Graphic& aGraphic, const ::rtl::OUString& aMediaType );
183     void SetGraphicToObj( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xGrStream,
184                           const ::rtl::OUString& aMediaType );
185 
186     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetParentXModel()  const;
187     sal_Bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
188     sal_Bool AddOwnLightClient();
189 
190     // handy to get the empty replacement bitmap without accessing all the old stuff
191     static Bitmap GetEmtyOLEReplacementBitmap();
192 
193     void SetWindow(const com::sun::star::uno::Reference < com::sun::star::awt::XWindow >& _xWindow);
194 
195     // #i118485# missing converter added
196     virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
197 };
198 
199 #endif //_SVDOOLE2_HXX
200 
201