bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / svx / svdoole2.hxx
bloba897b797694d652bffadf7a1c2ba04aaf26826ff
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 <memory>
24 #include <svx/svdorect.hxx>
25 #include <svx/svxdllapi.h>
26 #include <sfx2/linkmgr.hxx>
28 #include <com/sun/star/uno/Reference.h>
30 namespace com { namespace sun { namespace star {
32 namespace awt { class XWindow; }
34 namespace datatransfer { class XTransferable; }
36 namespace embed { class XEmbeddedObject; }
38 namespace frame { class XModel; }
40 }}}
42 namespace svt { class EmbeddedObjectRef; }
44 class SdrOle2ObjImpl;
46 class SVX_DLLPUBLIC SdrOle2Obj : public SdrRectObj
48 private:
49 std::unique_ptr<SdrOle2ObjImpl> mpImpl;
51 private:
52 SVX_DLLPRIVATE void Connect_Impl();
53 SVX_DLLPRIVATE void Disconnect_Impl();
54 SVX_DLLPRIVATE void AddListeners_Impl();
55 SVX_DLLPRIVATE void RemoveListeners_Impl();
56 SVX_DLLPRIVATE void GetObjRef_Impl();
58 // #i118485# helper added
59 SVX_DLLPRIVATE SdrObject* createSdrGrafObjReplacement(bool bAddText) const;
60 SVX_DLLPRIVATE void ImpSetVisAreaSize();
62 SVX_DLLPRIVATE void Init();
64 protected:
65 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
66 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
68 // protected destructor
69 virtual ~SdrOle2Obj() override;
71 public:
72 OUString GetStyleString();
74 SdrOle2Obj(
75 SdrModel& rSdrModel,
76 bool bFrame_ = false);
77 SdrOle2Obj(
78 SdrModel& rSdrModel,
79 const svt::EmbeddedObjectRef& rNewObjRef,
80 const OUString& rNewObjName,
81 const tools::Rectangle& rNewRect);
83 const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const;
85 sal_Int64 GetAspect() const;
86 bool isInplaceActive() const;
87 bool isUiActive() const;
88 void SetAspect( sal_Int64 nAspect );
90 // An OLE graphic object can contain a StarView graphic,
91 // which will be displayed if the OLE object is empty.
92 void SetGraphic(const Graphic& rGrf);
93 void ClearGraphic();
94 const Graphic* GetGraphic() const;
95 void GetNewReplacement();
97 // The original size of the object (size of the icon for iconified object)
98 // no conversion is done if no target mode is provided
99 Size GetOrigObjSize( MapMode const * pTargetMapMode = nullptr ) const;
101 // #i118524# Allow suppress SetVisAreaSize in changing methods when call
102 // comes from OLE client
103 void setSuppressSetVisAreaSize( bool bNew );
105 // OLE object has got a separate PersistName member now;
106 // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
107 const OUString& GetPersistName() const;
108 void SetPersistName( const OUString& rPersistName );
110 // One can add an application name to a SdrOle2Obj, which can be queried for
111 // later on (SD needs this for presentation objects).
112 void SetProgName( const OUString& rName );
113 const OUString& GetProgName() const;
114 bool IsEmpty() const;
116 void SetObjRef(const css::uno::Reference < css::embed::XEmbeddedObject >& rNewObjRef);
117 css::uno::Reference < css::embed::XEmbeddedObject > const & GetObjRef() const;
119 SVX_DLLPRIVATE css::uno::Reference < css::embed::XEmbeddedObject > const & GetObjRef_NoInit() const;
121 void AbandonObject();
123 // react on model/page change
124 virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
126 /** Change the IsClosedObj attribute
128 @param bIsClosed
129 Whether the OLE object is closed, i.e. has opaque background
131 void SetClosedObj( bool bIsClosed );
133 // FullDrag support
134 virtual SdrObject* getFullDragClone() const override;
136 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
137 virtual sal_uInt16 GetObjIdentifier() const override;
138 virtual OUString TakeObjNameSingul() const override;
139 virtual OUString TakeObjNamePlural() const override;
141 virtual SdrOle2Obj* CloneSdrObject(SdrModel& rTargetModel) const override;
143 SdrOle2Obj& assignFrom(const SdrOle2Obj& rObj);
144 SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
146 virtual void NbcMove(const Size& rSize) override;
147 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
148 virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
149 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
150 virtual void SetGeoData(const SdrObjGeoData& rGeo) override;
152 static bool CanUnloadRunningObj( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj,
153 sal_Int64 nAspect );
154 static bool Unload( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
155 bool Unload();
156 void Connect();
157 void Disconnect();
158 void ObjectLoaded();
160 css::uno::Reference< css::frame::XModel > getXModel() const;
162 bool IsChart() const;
163 bool IsCalc() const;
165 bool UpdateLinkURL_Impl();
166 void BreakFileLink_Impl();
167 void DisconnectFileLink_Impl();
168 void CheckFileLink_Impl();
170 // allows to transfer the graphics to the object helper
171 void SetGraphicToObj( const Graphic& aGraphic );
172 void SetGraphicToObj( const css::uno::Reference< css::io::XInputStream >& xGrStream,
173 const OUString& aMediaType );
175 css::uno::Reference< css::frame::XModel > GetParentXModel() const;
176 bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
177 bool AddOwnLightClient();
179 // handy to get the empty replacement graphic without accessing all the old stuff
180 static Graphic GetEmptyOLEReplacementGraphic();
182 void SetWindow(const css::uno::Reference < css::awt::XWindow >& _xWindow);
184 // #i118485# missing converter added
185 virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
188 class SVX_DLLPUBLIC SdrEmbedObjectLink : public sfx2::SvBaseLink
190 SdrOle2Obj* pObj;
192 public:
193 explicit SdrEmbedObjectLink(SdrOle2Obj* pObj);
194 virtual ~SdrEmbedObjectLink() override;
196 virtual void Closed() override;
197 virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
198 const OUString& rMimeType, const css::uno::Any & rValue ) override;
200 void Connect() { GetRealObject(); }
203 #endif // INCLUDED_SVX_SVDOOLE2_HXX
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */