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
63class REPORTDESIGN_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") OObjectBase
64{
65protected:
66 mutable rtl::Reference<OPropertyMediator> m_xMediator;
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;
70 OUString m_sComponentName;
71 bool m_bIsListening;
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;
91 OObjectBase& operator=(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
118class REPORTDESIGN_DLLPUBLIC OCustomShape final : public SdrObjCustomShape , public OObjectBase
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
150 virtual void NbcMove( const Size& rSize ) override;
151 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
152 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
153 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
154
155 virtual SdrPage* GetImplPage() const override;
156};
157
158
159// OOle2Obj
160
161class REPORTDESIGN_DLLPUBLIC OOle2Obj final : public SdrOle2Obj , public OObjectBase
162{
163 friend class OReportPage;
164 friend class DlgEdFactory;
165
166private:
167 // protected destructor - due to final, make private
168 virtual ~OOle2Obj() override;
169
170public:
172 SdrModel& rSdrModel,
173 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
174 SdrObjKind _nType)
175 {
176 return new OOle2Obj(rSdrModel, _xComponent, _nType);
177 }
178
179 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
180
181 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
182 virtual SdrObjKind GetObjIdentifier() const override;
183 virtual SdrInventor GetObjInventor() const override;
184 // Clone() should make a complete copy of the object.
185 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
186 virtual void initializeOle() override;
187
188 void initializeChart( const css::uno::Reference< css::frame::XModel>& _xModel);
189
190private:
192 SdrModel& rSdrModel,
193 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
194 SdrObjKind _nType);
195 OOle2Obj(
196 SdrModel& rSdrModel,
197 SdrObjKind _nType);
198 // copy constructor
199 OOle2Obj(SdrModel& rSdrModel, const OOle2Obj& rSource);
200
201 virtual void NbcMove( const Size& rSize ) override;
202 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
203 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
204 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
205
206 virtual SdrPage* GetImplPage() const override;
207
208 void impl_createDataProvider_nothrow( const css::uno::Reference< css::frame::XModel>& _xModel);
209 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
210
213};
214
215
216// OUnoObject
217
218class REPORTDESIGN_DLLPUBLIC OUnoObject final : public SdrUnoObj , public OObjectBase
219{
220 friend class OReportPage;
221 friend class OObjectBase;
222 friend class DlgEdFactory;
223
225 // tdf#118730 remember if this object was created interactively (due to ::EndCreate being called)
227
228 OUnoObject(SdrModel& rSdrModel,
229 const OUString& rModelName,
230 SdrObjKind _nObjectType);
232 SdrModel& rSdrModel,
233 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
234 const OUString& rModelName,
235 SdrObjKind _nObjectType);
236 // copy constructor
237 OUnoObject(SdrModel& rSdrModel, OUnoObject const & rSource);
238
239 // protected destructor
240 virtual ~OUnoObject() override;
241
242 virtual void NbcMove( const Size& rSize ) override;
243 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
244 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
245 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
246
247 virtual SdrPage* GetImplPage() const override;
248
249public:
250
251 virtual void _propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
252
256 void CreateMediator(bool _bReverse = false);
257
258 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
259
260 static OUString GetDefaultName(const OUnoObject* _pObj);
261
262 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
263 virtual SdrObjKind GetObjIdentifier() const override;
264 virtual SdrInventor GetObjInventor() const override;
265 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
266
267private:
268 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
269 void impl_initializeModel_nothrow();
270};
271
272
273} // rptui
274
275#endif // INCLUDED_REPORTDESIGN_INC_RPTOBJECT_HXX
276
277/* 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)
OOle2Obj(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent, SdrObjKind _nType)
SdrObjKind m_nType
Definition: RptObject.hxx:211
static rtl::Reference< OOle2Obj > Create(SdrModel &rSdrModel, const css::uno::Reference< css::report::XReportComponent > &_xComponent, SdrObjKind _nType)
Definition: RptObject.hxx:171
SdrObjKind m_nObjectType
Definition: RptObject.hxx:224
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
class REPORTDESIGN_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") OObjectBase
Definition: RptObject.hxx:63
::std::multimap< sal_Int16, OUString > IndexToNameMap
Definition: RptObject.hxx:37
SdrInventor
SdrObjKind
SdrCreateCmd