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