build fix
[LibreOffice.git] / include / svx / svdoole2.hxx
blob345f6ebba16bf273de58570af710ed801ed98d81
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_SVX_SVDOOLE2_HXX
21 #define INCLUDED_SVX_SVDOOLE2_HXX
23 #include <svx/svdorect.hxx>
24 #include <svx/svxdllapi.h>
25 #include <sfx2/linkmgr.hxx>
27 #include <com/sun/star/uno/Reference.h>
29 namespace com { namespace sun { namespace star {
31 namespace awt { class XWindow; }
33 namespace datatransfer { class XTransferable; }
35 namespace embed { class XEmbeddedObject; }
37 namespace frame { class XModel; }
39 }}}
41 namespace svt { class EmbeddedObjectRef; }
43 class SdrOle2ObjImpl;
45 class SVX_DLLPUBLIC SdrOle2Obj : public SdrRectObj
47 private:
48 std::unique_ptr<SdrOle2ObjImpl> mpImpl;
50 private:
51 SVX_DLLPRIVATE void Connect_Impl();
52 SVX_DLLPRIVATE void Disconnect_Impl();
53 SVX_DLLPRIVATE void Reconnect_Impl();
54 SVX_DLLPRIVATE void AddListeners_Impl();
55 SVX_DLLPRIVATE void RemoveListeners_Impl();
56 SVX_DLLPRIVATE void GetObjRef_Impl();
57 SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf);
59 // #i118485# helper added
60 SVX_DLLPRIVATE SdrObject* createSdrGrafObjReplacement(bool bAddText, bool bUseHCGraphic) const;
61 SVX_DLLPRIVATE void ImpSetVisAreaSize();
63 protected:
64 virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
65 virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
67 public:
68 OUString GetStyleString();
70 SdrOle2Obj( bool bFrame_ = false );
71 SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const OUString& rNewObjName, const Rectangle& rNewRect );
72 virtual ~SdrOle2Obj() override;
74 const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const;
76 sal_Int64 GetAspect() const;
77 bool isInplaceActive() const;
78 bool isUiActive() const;
79 void SetAspect( sal_Int64 nAspect );
81 // An OLE graphic object can contain a StarView graphic,
82 // which will be displayed if the OLE object is empty.
83 void SetGraphic(const Graphic* pGrf);
84 const Graphic* GetGraphic() const;
85 void GetNewReplacement();
87 // The original size of the object (size of the icon for iconified object)
88 // no conversion is done if no target mode is provided
89 Size GetOrigObjSize( MapMode* pTargetMapMode = nullptr ) const;
91 // #i118524# Allow suppress SetVisAreaSize in changing methods when call
92 // comes from OLE client
93 void setSuppressSetVisAreaSize( bool bNew );
95 // OLE object has got a separate PersistName member now;
96 // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
97 const OUString& GetPersistName() const;
98 void SetPersistName( const OUString& rPersistName );
100 // One can add an application name to a SdrOle2Obj, which can be queried for
101 // later on (SD needs this for presentation objects).
102 void SetProgName( const OUString& rName );
103 const OUString& GetProgName() const;
104 bool IsEmpty() const;
106 void SetObjRef(const css::uno::Reference < css::embed::XEmbeddedObject >& rNewObjRef);
107 css::uno::Reference < css::embed::XEmbeddedObject > GetObjRef() const;
109 SVX_DLLPRIVATE css::uno::Reference < css::embed::XEmbeddedObject > GetObjRef_NoInit() const;
111 void AbandonObject();
113 virtual void SetPage(SdrPage* pNewPage) override;
114 virtual void SetModel(SdrModel* pModel) override;
116 /** Change the IsClosedObj attribute
118 @param bIsClosed
119 Whether the OLE object is closed, i.e. has opaque background
121 void SetClosedObj( bool bIsClosed );
123 // FullDrag support
124 virtual SdrObject* getFullDragClone() const override;
126 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
127 virtual sal_uInt16 GetObjIdentifier() const override;
128 virtual OUString TakeObjNameSingul() const override;
129 virtual OUString TakeObjNamePlural() const override;
131 virtual SdrOle2Obj* Clone() const override;
133 SdrOle2Obj& assignFrom(const SdrOle2Obj& rObj);
134 SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
136 virtual void NbcMove(const Size& rSize) override;
137 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
138 virtual void NbcSetSnapRect(const Rectangle& rRect) override;
139 virtual void NbcSetLogicRect(const Rectangle& rRect) override;
140 virtual void SetGeoData(const SdrObjGeoData& rGeo) override;
142 static bool CanUnloadRunningObj( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj,
143 sal_Int64 nAspect );
144 static bool Unload( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
145 bool Unload();
146 void Connect();
147 void Disconnect();
148 void ObjectLoaded();
150 css::uno::Reference< css::frame::XModel > getXModel() const;
152 bool IsChart() const;
153 bool IsReal3DChart() const;
154 bool IsCalc() const;
156 bool UpdateLinkURL_Impl();
157 void BreakFileLink_Impl();
158 void DisconnectFileLink_Impl();
159 void CheckFileLink_Impl();
161 // allows to transfer the graphics to the object helper
162 void SetGraphicToObj( const Graphic& aGraphic, const OUString& aMediaType );
163 void SetGraphicToObj( const css::uno::Reference< css::io::XInputStream >& xGrStream,
164 const OUString& aMediaType );
166 css::uno::Reference< css::frame::XModel > GetParentXModel() const;
167 bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
168 bool AddOwnLightClient();
170 // handy to get the empty replacement graphic without accessing all the old stuff
171 static Graphic GetEmptyOLEReplacementGraphic();
173 void SetWindow(const css::uno::Reference < css::awt::XWindow >& _xWindow);
175 // #i118485# missing converter added
176 virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
179 class SVX_DLLPUBLIC SdrEmbedObjectLink : public sfx2::SvBaseLink
181 SdrOle2Obj* pObj;
183 public:
184 explicit SdrEmbedObjectLink(SdrOle2Obj* pObj);
185 virtual ~SdrEmbedObjectLink() override;
187 virtual void Closed() override;
188 virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
189 const OUString& rMimeType, const css::uno::Any & rValue ) override;
191 bool Connect() { return GetRealObject() != nullptr; }
194 #endif // INCLUDED_SVX_SVDOOLE2_HXX
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */