LibreOffice Module reportdesign (master) 1
RptObject.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#ifndef INCLUDED_REPORTDESIGN_INC_RPTOBJECT_HXX
20#define INCLUDED_REPORTDESIGN_INC_RPTOBJECT_HXX
21
22#include "dllapi.h"
23
24#include <svx/svdoole2.hxx>
25#include <svx/svdouno.hxx>
26
27
28#include <com/sun/star/beans/XPropertyChangeListener.hpp>
29#include <com/sun/star/report/XReportComponent.hpp>
30#include <com/sun/star/report/XSection.hpp>
31#include <svx/svdoashp.hxx>
32
33#include <map>
34
35namespace rptui
36{
37typedef ::std::multimap< sal_Int16, OUString > IndexToNameMap;
39 {
42 };
43
44 class OUnoObject;
46 {
47 private:
49
50 DlgEdHint(DlgEdHint const &) = delete;
51 void operator =(DlgEdHint const &) = delete;
52 public:
53 DlgEdHint( DlgEdHintKind eHint );
54 virtual ~DlgEdHint() override;
55
56 DlgEdHintKind GetKind() const { return eHintKind; }
57 };
58
59
60class OReportPage;
61class OPropertyMediator;
62
64{
65protected:
67 mutable css::uno::Reference< css::beans::XPropertyChangeListener> m_xPropertyChangeListener;
68 mutable css::uno::Reference< css::report::XReportComponent> m_xReportComponent;
69 css::uno::Reference< css::uno::XInterface > m_xKeepShapeAlive;
72
73 OObjectBase(const css::uno::Reference< css::report::XReportComponent>& _xComponent);
74 OObjectBase(OUString _sComponentName);
75
76 virtual ~OObjectBase();
77
78 bool isListening() const { return m_bIsListening; }
79
80 void SetPropsFromRect(const tools::Rectangle& _rRect);
81
82 virtual SdrPage* GetImplPage() const = 0;
83
86 css::uno::Reference< css::drawing::XShape >
87 getUnoShapeOf( SdrObject& _rSdrObject );
88
89private:
90 static void ensureSdrObjectOwnership(
91 const css::uno::Reference< css::uno::XInterface >& _rxShape );
92
93public:
94 OObjectBase(const OObjectBase&) = delete;
96 void StartListening();
97 void EndListening();
98 // PropertyChangeListener
100 virtual void _propertyChange( const css::beans::PropertyChangeEvent& evt );
101 virtual void initializeOle() {}
102
103 bool supportsService( const OUString& _sServiceName ) const;
104
105 const css::uno::Reference< css::report::XReportComponent>& getReportComponent() const { return m_xReportComponent;}
106 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent();
107 css::uno::Reference< css::report::XSection> getSection() const;
108 const OUString& getServiceName() const { return m_sComponentName; }
109
112 void releaseUnoShape() { m_xKeepShapeAlive.clear(); }
113
114 static SdrObject* createObject(
115 SdrModel& rTargetModel,
116 const css::uno::Reference< css::report::XReportComponent>& _xComponent);
117 static SdrObjKind getObjectType(const css::uno::Reference< css::report::XReportComponent>& _xComponent);
118};
119
120// OCustomShape
121
123{
124 friend class OReportPage;
125 friend class DlgEdFactory;
126
127private:
128 // protected destructor - due to final, make private
129 virtual ~OCustomShape() override;
130
131public:
133 SdrModel& rSdrModel,
134 const css::uno::Reference< css::report::XReportComponent>& _xComponent)
135 {
136 return new OCustomShape(rSdrModel, _xComponent );
137 }
138
139 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
140
141 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
142 virtual SdrObjKind GetObjIdentifier() const override;
143 virtual SdrInventor GetObjInventor() const override;
144
145private:
146 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
147
149 SdrModel& rSdrModel,
150 const css::uno::Reference< css::report::XReportComponent>& _xComponent);
152 SdrModel& rSdrModel,
153 const OUString& _sComponentName);
154
155 virtual void NbcMove( const Size& rSize ) override;
156 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
157 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
158 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
159
160 virtual SdrPage* GetImplPage() const override;
161};
162
163
164// OOle2Obj
165
167{
168 friend class OReportPage;
169 friend class DlgEdFactory;
170
171private:
172 // protected destructor - due to final, make private
173 virtual ~OOle2Obj() override;
174
175public:
177 SdrModel& rSdrModel,
178 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
179 SdrObjKind _nType)
180 {
181 return new OOle2Obj(rSdrModel, _xComponent, _nType);
182 }
183
184 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
185
186 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
187 virtual SdrObjKind GetObjIdentifier() const override;
188 virtual SdrInventor GetObjInventor() const override;
189 // Clone() should make a complete copy of the object.
190 virtual OOle2Obj* CloneSdrObject(SdrModel& rTargetModel) const override;
191 virtual void initializeOle() override;
192
193 void initializeChart( const css::uno::Reference< css::frame::XModel>& _xModel);
194
195private:
197 SdrModel& rSdrModel,
198 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
199 SdrObjKind _nType);
200 OOle2Obj(
201 SdrModel& rSdrModel,
202 const OUString& _sComponentName,
203 SdrObjKind _nType);
204 // copy constructor
205 OOle2Obj(SdrModel& rSdrModel, const OOle2Obj& rSource);
206
207 virtual void NbcMove( const Size& rSize ) override;
208 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
209 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
210 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
211
212 virtual SdrPage* GetImplPage() const override;
213
214 void impl_createDataProvider_nothrow( const css::uno::Reference< css::frame::XModel>& _xModel);
215 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
216
219};
220
221
222// OUnoObject
223
225{
226 friend class OReportPage;
227 friend class OObjectBase;
228 friend class DlgEdFactory;
229
231 // tdf#118730 remember if this object was created interactively (due to ::EndCreate being called)
233
234 OUnoObject(SdrModel& rSdrModel,
235 const OUString& _sComponentName,
236 const OUString& rModelName,
237 SdrObjKind _nObjectType);
239 SdrModel& rSdrModel,
240 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
241 const OUString& rModelName,
242 SdrObjKind _nObjectType);
243 // copy constructor
244 OUnoObject(SdrModel& rSdrModel, OUnoObject const & rSource);
245
246 // protected destructor
247 virtual ~OUnoObject() override;
248
249 virtual void NbcMove( const Size& rSize ) override;
250 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
251 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
252 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
253
254 virtual SdrPage* GetImplPage() const override;
255
256public:
257
258 virtual void _propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
259
263 void CreateMediator(bool _bReverse = false);
264
265 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
266
267 static OUString GetDefaultName(const OUnoObject* _pObj);
268
269 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
270 virtual SdrObjKind GetObjIdentifier() const override;
271 virtual SdrInventor GetObjInventor() const override;
272 virtual OUnoObject* CloneSdrObject(SdrModel& rTargetModel) const override;
273
274private:
275 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
276 void impl_initializeModel_nothrow();
277};
278
279
280} // rptui
281
282#endif // INCLUDED_REPORTDESIGN_INC_RPTOBJECT_HXX
283
284/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DlgEdHintKind GetKind() const
Definition: RptObject.hxx:56
DlgEdHintKind eHintKind
Definition: RptObject.hxx:48
DlgEdHint(DlgEdHint const &)=delete
static OCustomShape * Create(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent)
Definition: RptObject.hxx:132
OCustomShape(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent)
OObjectBase(const OObjectBase &)=delete
bool isListening() const
Definition: RptObject.hxx:78
virtual SdrPage * GetImplPage() const =0
virtual void initializeOle()
Definition: RptObject.hxx:101
OObjectBase(const css::uno::Reference< css::report::XReportComponent > &_xComponent)
css::uno::Reference< css::beans::XPropertyChangeListener > m_xPropertyChangeListener
Definition: RptObject.hxx:67
void releaseUnoShape()
releases the reference to our UNO shape (m_xKeepShapeAlive)
Definition: RptObject.hxx:112
css::uno::Reference< css::report::XReportComponent > m_xReportComponent
Definition: RptObject.hxx:68
const OUString & getServiceName() const
Definition: RptObject.hxx:108
OUString m_sComponentName
Definition: RptObject.hxx:70
const css::uno::Reference< css::report::XReportComponent > & getReportComponent() const
Definition: RptObject.hxx:105
OObjectBase & operator=(const OObjectBase &)=delete
css::uno::Reference< css::uno::XInterface > m_xKeepShapeAlive
Definition: RptObject.hxx:69
rtl::Reference< OPropertyMediator > m_xMediator
Definition: RptObject.hxx:66
OOle2Obj(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent, SdrObjKind _nType)
SdrObjKind m_nType
Definition: RptObject.hxx:217
static OOle2Obj * Create(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent, SdrObjKind _nType)
Definition: RptObject.hxx:176
SdrObjKind m_nObjectType
Definition: RptObject.hxx:230
OUnoObject(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent, const OUString &rModelName, SdrObjKind _nObjectType)
#define REPORTDESIGN_DLLPUBLIC
Definition: dllapi.h:28
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
DlgEdHintKind
Definition: RptObject.hxx:39
@ RPTUI_HINT_WINDOWSCROLLED
Definition: RptObject.hxx:40
@ RPTUI_HINT_SELECTIONCHANGED
Definition: RptObject.hxx:41
::std::multimap< sal_Int16, OUString > IndexToNameMap
Definition: RptObject.hxx:37
SdrInventor
SdrObjKind
SdrCreateCmd