LibreOffice Module svx (master) 1
svdoole2.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <memory>
23#include <svx/svdorect.hxx>
24#include <svx/svxdllapi.h>
25#include <sfx2/lnkbase.hxx>
26
27#include <com/sun/star/uno/Reference.h>
28
29namespace com::sun::star {
30
31namespace awt { class XWindow; }
32
33namespace datatransfer { class XTransferable; }
34
35namespace embed { class XEmbeddedObject; }
36
37namespace frame { class XModel; }
38
39namespace io { class XInputStream; }
40}
41
42namespace svt { class EmbeddedObjectRef; }
43
44class SdrOle2ObjImpl;
45class SvxOle2Shape;
46
48{
49private:
50 std::unique_ptr<SdrOle2ObjImpl> mpImpl;
51
52private:
53 SVX_DLLPRIVATE void Connect_Impl(SvxOle2Shape* pCreator = nullptr);
54 SVX_DLLPRIVATE void Disconnect_Impl();
55 SVX_DLLPRIVATE void AddListeners_Impl();
56 SVX_DLLPRIVATE void RemoveListeners_Impl();
57 SVX_DLLPRIVATE void GetObjRef_Impl();
58
59 // #i118485# helper added
60 SVX_DLLPRIVATE rtl::Reference<SdrObject> createSdrGrafObjReplacement(bool bAddText) const;
61 SVX_DLLPRIVATE void ImpSetVisAreaSize();
62
63 SVX_DLLPRIVATE void Init();
64
65protected:
66 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
67 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
68
69 // protected destructor
70 virtual ~SdrOle2Obj() override;
71
72public:
73 OUString GetStyleString();
74
76 SdrModel& rSdrModel,
77 bool bFrame_ = false);
78 // Copy constructor
79 SdrOle2Obj(SdrModel& rSdrModel, SdrOle2Obj const & rSource);
81 SdrModel& rSdrModel,
82 const svt::EmbeddedObjectRef& rNewObjRef,
83 const OUString& rNewObjName,
84 const tools::Rectangle& rNewRect);
85
86 const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const;
87
88 sal_Int64 GetAspect() const;
89 bool isInplaceActive() const;
90 bool isUiActive() const;
91 void SetAspect( sal_Int64 nAspect );
92
93 // An OLE graphic object can contain a StarView graphic,
94 // which will be displayed if the OLE object is empty.
95 void SetGraphic(const Graphic& rGrf);
96 void ClearGraphic();
97 const Graphic* GetGraphic() const;
98 void GetNewReplacement();
99
100 // The original size of the object (size of the icon for iconified object)
101 // no conversion is done if no target mode is provided
102 Size GetOrigObjSize( MapMode const * pTargetMapMode = nullptr ) const;
103
104 // #i118524# Allow suppress SetVisAreaSize in changing methods when call
105 // comes from OLE client
106 void setSuppressSetVisAreaSize( bool bNew );
107
108 // OLE object has got a separate PersistName member now;
109 // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
110 const OUString& GetPersistName() const;
111 void SetPersistName( const OUString& rPersistName, SvxOle2Shape* pCreator = nullptr );
112
113 // One can add an application name to a SdrOle2Obj, which can be queried for
114 // later on (SD needs this for presentation objects).
115 void SetProgName( const OUString& rName );
116 const OUString& GetProgName() const;
117 bool IsEmpty() const;
118
119 void SetObjRef(const css::uno::Reference < css::embed::XEmbeddedObject >& rNewObjRef);
120 css::uno::Reference < css::embed::XEmbeddedObject > const & GetObjRef() const;
121
122 SVX_DLLPRIVATE css::uno::Reference < css::embed::XEmbeddedObject > const & GetObjRef_NoInit() const;
123
124 void AbandonObject();
125
126 // react on model/page change
127 virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
128
134 void SetClosedObj( bool bIsClosed );
135
136 // FullDrag support
137 virtual rtl::Reference<SdrObject> getFullDragClone() const override;
138
139 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
140 virtual SdrObjKind GetObjIdentifier() const override;
141 virtual OUString TakeObjNameSingul() const override;
142 virtual OUString TakeObjNamePlural() const override;
143
144 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
145
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;
151
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(SvxOle2Shape* pCreator = nullptr);
157 void Disconnect();
158 void ObjectLoaded();
159
160 css::uno::Reference< css::frame::XModel > getXModel() const;
161
162 bool IsChart() const;
163 bool IsCalc() const;
164
165 bool UpdateLinkURL_Impl();
166 void BreakFileLink_Impl();
167 void DisconnectFileLink_Impl();
168 void CheckFileLink_Impl();
169
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 );
174
175 css::uno::Reference< css::frame::XModel > GetParentXModel() const;
176 bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
177 bool AddOwnLightClient();
178
179 // handy to get the empty replacement graphic without accessing all the old stuff
180 static Graphic GetEmptyOLEReplacementGraphic();
181
182 void SetWindow(const css::uno::Reference < css::awt::XWindow >& _xWindow);
183
184 // #i118485# missing converter added
185 virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
186};
187
189{
191
192public:
193 explicit SdrEmbedObjectLink(SdrOle2Obj* pObj);
194 virtual ~SdrEmbedObjectLink() override;
195
196 virtual void Closed() override;
197 virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
198 const OUString& rMimeType, const css::uno::Any & rValue ) override;
199
200 void Connect() { GetRealObject(); }
201};
202
204{
206
207public:
208 explicit SdrIFrameLink(SdrOle2Obj* pObject);
209 virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
210 const OUString& rMimeType, const css::uno::Any & rValue ) override;
211};
212
213/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:174
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
virtual void SetGeoData(const SdrObjGeoData &rGeo)
Definition: svdobj.cxx:1957
std::unique_ptr< SdrOle2ObjImpl > mpImpl
Definition: svdoole2.hxx:50
void SetGraphicToObj(const css::uno::Reference< css::io::XInputStream > &xGrStream, const OUString &aMediaType)
static bool Unload(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:379
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdorect.cxx:39
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: svdorect.cxx:269
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdorect.cxx:451
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdorect.cxx:275
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdorect.cxx:533
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdorect.cxx:171
virtual OUString TakeObjNamePlural() const override
Definition: svdorect.cxx:226
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdorect.cxx:247
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdorect.cxx:145
virtual OUString TakeObjNameSingul() const override
Definition: svdorect.cxx:200
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdorect.cxx:47
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdorect.cxx:445
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: svdotext.cxx:480
virtual rtl::Reference< SdrObject > getFullDragClone() const override
Definition: svdotext.cxx:2132
void Init()
css::uno::Reference< css::frame::XModel > getXModel(const css::uno::Reference< css::uno::XInterface > &_rxComponent)
SdrObjKind
Definition: svdobjkind.hxx:25
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35