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 INCLUDED_SVX_SVDOOLE2_HXX
21 : #define INCLUDED_SVX_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() SAL_OVERRIDE;
59 : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
60 :
61 : svt::EmbeddedObjectRef xObjRef;
62 : Graphic* pGraphic;
63 : OUString aProgName;
64 :
65 : // Due to compatibility at SdrTextObj for now
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 : OUString GetStyleString();
84 : TYPEINFO_OVERRIDE();
85 :
86 : SdrOle2Obj(bool bFrame_ = false);
87 : SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, const OUString& rNewObjName, const Rectangle& rNewRect, bool bFrame_ = false);
88 : virtual ~SdrOle2Obj();
89 :
90 : // access to svt::EmbeddedObjectRef
91 0 : const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const { return xObjRef; }
92 :
93 0 : sal_Int64 GetAspect() const { return xObjRef.GetViewAspect(); }
94 : bool isInplaceActive() const;
95 : bool isUiActive() const;
96 : void SetAspect( sal_Int64 nAspect );
97 :
98 : // An OLE graphic object can contain a StarView graphic,
99 : // which will be displayed if the OLE object is empty.
100 : void SetGraphic(const Graphic* pGrf);
101 : const Graphic* GetGraphic() const;
102 : void GetNewReplacement();
103 :
104 : // The original size of the object (size of the icon for iconified object)
105 : // no conversion is done if no target mode is provided
106 : Size GetOrigObjSize( MapMode* pTargetMapMode = NULL ) const;
107 :
108 : // #i118524# Allow suppress SetVisAreaSize in changing methods when call
109 : // comes from OLE client
110 0 : void setSuppressSetVisAreaSize(bool bNew) { mbSuppressSetVisAreaSize = bNew; }
111 :
112 : // OLE object has got a separate PersistName member now;
113 : // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
114 : OUString GetPersistName() const;
115 : void SetPersistName( const OUString& rPersistName );
116 :
117 : // One can add an application name to a SdrOle2Obj, which can be queried for
118 : // later on (SD needs this for presentation objects).
119 0 : void SetProgName(const OUString& rNam) { aProgName=rNam; }
120 0 : const OUString& GetProgName() const { return aProgName; }
121 : bool IsEmpty() const;
122 :
123 : void SetObjRef(const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rNewObjRef);
124 : com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef() const;
125 :
126 : SVX_DLLPRIVATE com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef_NoInit() const;
127 :
128 : void AbandonObject();
129 :
130 : virtual void SetPage(SdrPage* pNewPage) SAL_OVERRIDE;
131 : virtual void SetModel(SdrModel* pModel) SAL_OVERRIDE;
132 :
133 : /** Change the IsClosedObj attribute
134 :
135 : @param bIsClosed
136 : Whether the OLE object is closed, i.e. has opaque background
137 : */
138 : void SetClosedObj( bool bIsClosed );
139 :
140 : // FullDrag support
141 : virtual SdrObject* getFullDragClone() const SAL_OVERRIDE;
142 :
143 : virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const SAL_OVERRIDE;
144 : virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
145 : virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
146 : virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
147 :
148 : SdrOle2Obj* Clone() const SAL_OVERRIDE;
149 : SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
150 :
151 : virtual void NbcMove(const Size& rSize) SAL_OVERRIDE;
152 : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
153 : virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
154 : virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
155 : virtual void SetGeoData(const SdrObjGeoData& rGeo) SAL_OVERRIDE;
156 :
157 : static bool CanUnloadRunningObj( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
158 : sal_Int64 nAspect );
159 : static bool Unload( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
160 : bool Unload();
161 : void Connect();
162 : void Disconnect();
163 : void ObjectLoaded();
164 :
165 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel() const;
166 :
167 : // #109985#
168 : bool IsChart() const;
169 : bool IsCalc() const;
170 :
171 : bool UpdateLinkURL_Impl();
172 : void BreakFileLink_Impl();
173 : void DisconnectFileLink_Impl();
174 : void CheckFileLink_Impl();
175 :
176 : // allows to transfer the graphics to the object helper
177 : void SetGraphicToObj( const Graphic& aGraphic, const OUString& aMediaType );
178 : void SetGraphicToObj( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xGrStream,
179 : const OUString& aMediaType );
180 :
181 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetParentXModel() const;
182 : bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
183 : bool AddOwnLightClient();
184 :
185 : // handy to get the empty replacement graphic without accessing all the old stuff
186 : static Graphic GetEmptyOLEReplacementGraphic();
187 :
188 : void SetWindow(const com::sun::star::uno::Reference < com::sun::star::awt::XWindow >& _xWindow);
189 :
190 : // #i118485# missing converter added
191 : virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
192 : };
193 :
194 : #endif // INCLUDED_SVX_SVDOOLE2_HXX
195 :
196 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|