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
89public:
90 OObjectBase(const OObjectBase&) = delete;
92 void StartListening();
93 void EndListening();
94 // PropertyChangeListener
96 virtual void _propertyChange( const css::beans::PropertyChangeEvent& evt );
97 virtual void initializeOle() {}
98
99 bool supportsService( const OUString& _sServiceName ) const;
100
101 const css::uno::Reference< css::report::XReportComponent>& getReportComponent() const { return m_xReportComponent;}
102 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent();
103 css::uno::Reference< css::report::XSection> getSection() const;
104 const OUString& getServiceName() const { return m_sComponentName; }
105
108 void releaseUnoShape() { m_xKeepShapeAlive.clear(); }
109
110 static rtl::Reference<SdrObject> createObject(
111 SdrModel& rTargetModel,
112 const css::uno::Reference< css::report::XReportComponent>& _xComponent);
113 static SdrObjKind getObjectType(const css::uno::Reference< css::report::XReportComponent>& _xComponent);
114};
115
116// OCustomShape
117
119{
120 friend class OReportPage;
121 friend class DlgEdFactory;
122
123private:
124 // protected destructor - due to final, make private
125 virtual ~OCustomShape() override;
126
127public:
129 SdrModel& rSdrModel,
130 const css::uno::Reference< css::report::XReportComponent>& _xComponent)
131 {
132 return new OCustomShape(rSdrModel, _xComponent );
133 }
134
135 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
136
137 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
138 virtual SdrObjKind GetObjIdentifier() const override;
139 virtual SdrInventor GetObjInventor() const override;
140
141private:
142 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
143
145 SdrModel& rSdrModel,
146 const css::uno::Reference< css::report::XReportComponent>& _xComponent);
148 SdrModel& rSdrModel,
149 const OUString& _sComponentName);
150
151 virtual void NbcMove( const Size& rSize ) override;
152 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
153 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
154 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
155
156 virtual SdrPage* GetImplPage() const override;
157};
158
159
160// OOle2Obj
161
163{
164 friend class OReportPage;
165 friend class DlgEdFactory;
166
167private:
168 // protected destructor - due to final, make private
169 virtual ~OOle2Obj() override;
170
171public:
173 SdrModel& rSdrModel,
174 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
175 SdrObjKind _nType)
176 {
177 return new OOle2Obj(rSdrModel, _xComponent, _nType);
178 }
179
180 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
181
182 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
183 virtual SdrObjKind GetObjIdentifier() const override;
184 virtual SdrInventor GetObjInventor() const override;
185 // Clone() should make a complete copy of the object.
186 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
187 virtual void initializeOle() override;
188
189 void initializeChart( const css::uno::Reference< css::frame::XModel>& _xModel);
190
191private:
193 SdrModel& rSdrModel,
194 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
195 SdrObjKind _nType);
196 OOle2Obj(
197 SdrModel& rSdrModel,
198 const OUString& _sComponentName,
199 SdrObjKind _nType);
200 // copy constructor
201 OOle2Obj(SdrModel& rSdrModel, const OOle2Obj& rSource);
202
203 virtual void NbcMove( const Size& rSize ) override;
204 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
205 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
206 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
207
208 virtual SdrPage* GetImplPage() const override;
209
210 void impl_createDataProvider_nothrow( const css::uno::Reference< css::frame::XModel>& _xModel);
211 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
212
215};
216
217
218// OUnoObject
219
221{
222 friend class OReportPage;
223 friend class OObjectBase;
224 friend class DlgEdFactory;
225
227 // tdf#118730 remember if this object was created interactively (due to ::EndCreate being called)
229
230 OUnoObject(SdrModel& rSdrModel,
231 const OUString& _sComponentName,
232 const OUString& rModelName,
233 SdrObjKind _nObjectType);
235 SdrModel& rSdrModel,
236 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
237 const OUString& rModelName,
238 SdrObjKind _nObjectType);
239 // copy constructor
240 OUnoObject(SdrModel& rSdrModel, OUnoObject const & rSource);
241
242 // protected destructor
243 virtual ~OUnoObject() override;
244
245 virtual void NbcMove( const Size& rSize ) override;
246 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
247 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
248 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
249
250 virtual SdrPage* GetImplPage() const override;
251
252public:
253
254 virtual void _propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
255
259 void CreateMediator(bool _bReverse = false);
260
261 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
262
263 static OUString GetDefaultName(const OUnoObject* _pObj);
264
265 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
266 virtual SdrObjKind GetObjIdentifier() const override;
267 virtual SdrInventor GetObjInventor() const override;
268 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
269
270private:
271 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
272 void impl_initializeModel_nothrow();
273};
274
275
276} // rptui
277
278#endif // INCLUDED_REPORTDESIGN_INC_RPTOBJECT_HXX
279
280/* 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 rtl::Reference< OCustomShape > Create(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent)
Definition: RptObject.hxx:128
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:97
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:108
css::uno::Reference< css::report::XReportComponent > m_xReportComponent
Definition: RptObject.hxx:68
const OUString & getServiceName() const
Definition: RptObject.hxx:104
OUString m_sComponentName
Definition: RptObject.hxx:70
const css::uno::Reference< css::report::XReportComponent > & getReportComponent() const
Definition: RptObject.hxx:101
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:213
static rtl::Reference< OOle2Obj > Create(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent, SdrObjKind _nType)
Definition: RptObject.hxx:172
SdrObjKind m_nObjectType
Definition: RptObject.hxx:226
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