1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _REPORT_RPTUIOBJ_HXX
#define _REPORT_RPTUIOBJ_HXX
#include "dllapi.h"
#include <svx/svdoole2.hxx>
#include <svx/svdouno.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/report/XReportComponent.hpp>
#include <com/sun/star/report/XSection.hpp>
#include <svx/svdocirc.hxx>
#include <svx/svdogrp.hxx>
#include <svx/svdoashp.hxx>
#include <comphelper/stl_types.hxx>
#include <comphelper/implementationreference.hxx>
namespace rptui
{
typedef ::std::multimap< sal_Int16, ::rtl::OUString, ::std::less< sal_Int16 > > IndexToNameMap;
enum DlgEdHintKind
{
RPTUI_HINT_UNKNOWN,
RPTUI_HINT_WINDOWSCROLLED,
RPTUI_HINT_LAYERCHANGED,
RPTUI_HINT_OBJORDERCHANGED,
RPTUI_HINT_SELECTIONCHANGED
};
class OUnoObject;
class REPORTDESIGN_DLLPUBLIC DlgEdHint: public SfxHint
{
private:
DlgEdHintKind eHintKind;
OUnoObject* pDlgEdObj;
DlgEdHint(DlgEdHint&);
void operator =(DlgEdHint&);
public:
TYPEINFO();
DlgEdHint( DlgEdHintKind eHint );
virtual ~DlgEdHint();
inline DlgEdHintKind GetKind() const { return eHintKind; }
inline OUnoObject* GetObject() const { return pDlgEdObj; }
};
class OReportPage;
class OPropertyMediator;
class REPORTDESIGN_DLLPUBLIC OObjectBase
{
public:
typedef ::comphelper::ImplementationReference<OPropertyMediator,::com::sun::star::beans::XPropertyChangeListener> TMediator;
protected:
mutable TMediator m_xMediator;
mutable ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener;
//mutable ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>
mutable ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> m_xReportComponent;
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener> m_xContainerListener;
::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> m_xSection;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xKeepShapeAlive;
::rtl::OUString m_sComponentName;
sal_Bool m_bIsListening;
OObjectBase(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
OObjectBase(const ::rtl::OUString& _sComponentName);
virtual ~OObjectBase();
inline sal_Bool isListening() const { return m_bIsListening; }
void SetPropsFromRect(const Rectangle& _rRect);
virtual void SetSnapRectImpl(const Rectangle& _rRect) = 0;
virtual SdrPage* GetImplPage() const = 0;
virtual void SetObjectItemHelper(const SfxPoolItem& rItem);
/** called by instances of derived classes to implement their overloading of getUnoShape
*/
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
getUnoShapeOf( SdrObject& _rSdrObject );
private:
static void ensureSdrObjectOwnership(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxShape );
public:
void StartListening();
void EndListening(sal_Bool bRemoveListener = sal_True);
// PropertyChangeListener
virtual void _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
virtual void initializeOle() {}
sal_Bool supportsService( const ::rtl::OUString& _sServiceName ) const;
::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> getReportComponent() const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent();
inline void setOldParent(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) { m_xSection = _xSection; }
inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> getOldParent() const { return m_xSection;}
::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> getSection() const;
inline const ::rtl::OUString getServiceName() const { return m_sComponentName; }
/** releases the reference to our UNO shape (m_xKeepShapeAlive)
*/
void releaseUnoShape() { m_xKeepShapeAlive.clear(); }
static SdrObject* createObject(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
static sal_uInt16 getObjectType(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
};
//============================================================================
// OCustomShape
//============================================================================
class REPORTDESIGN_DLLPUBLIC OCustomShape: public SdrObjCustomShape , public OObjectBase
{
friend class OReportPage;
friend class DlgEdFactory;
public:
static OCustomShape* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent )
{
return new OCustomShape( _xComponent );
}
protected:
OCustomShape(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
OCustomShape(const ::rtl::OUString& _sComponentName);
virtual void NbcMove( const Size& rSize );
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
virtual void NbcSetLogicRect(const Rectangle& rRect);
virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
virtual void SetSnapRectImpl(const Rectangle& _rRect);
virtual SdrPage* GetImplPage() const;
void SetObjectItemHelper(const SfxPoolItem& rItem);
public:
TYPEINFO();
virtual ~OCustomShape();
virtual sal_Int32 GetStep() const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
virtual sal_uInt16 GetObjIdentifier() const;
virtual sal_uInt32 GetObjInventor() const;
};
//============================================================================
// OOle2Obj
//============================================================================
class REPORTDESIGN_DLLPUBLIC OOle2Obj: public SdrOle2Obj , public OObjectBase
{
friend class OReportPage;
friend class DlgEdFactory;
sal_uInt16 m_nType;
bool m_bOnlyOnce;
void impl_createDataProvider_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel);
public:
static OOle2Obj* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent,sal_uInt16 _nType )
{
return new OOle2Obj( _xComponent,_nType );
}
protected:
OOle2Obj(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent,sal_uInt16 _nType);
OOle2Obj(const ::rtl::OUString& _sComponentName,sal_uInt16 _nType);
virtual void NbcMove( const Size& rSize );
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
virtual void NbcSetLogicRect(const Rectangle& rRect);
virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
virtual void SetSnapRectImpl(const Rectangle& _rRect);
virtual SdrPage* GetImplPage() const;
public:
TYPEINFO();
virtual ~OOle2Obj();
virtual sal_Int32 GetStep() const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
virtual sal_uInt16 GetObjIdentifier() const;
virtual sal_uInt32 GetObjInventor() const;
// Clone() soll eine komplette Kopie des Objektes erzeugen.
virtual SdrObject* Clone() const;
virtual void initializeOle();
void initializeChart( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel);
};
//============================================================================
// OUnoObject
//============================================================================
class REPORTDESIGN_DLLPUBLIC OUnoObject: public SdrUnoObj , public OObjectBase
{
friend class OReportPage;
friend class OObjectBase;
friend class DlgEdFactory;
sal_uInt16 m_nObjectType;
protected:
OUnoObject(const ::rtl::OUString& _sComponentName
,const ::rtl::OUString& rModelName
,sal_uInt16 _nObjectType);
OUnoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent
,const ::rtl::OUString& rModelName
,sal_uInt16 _nObjectType);
virtual ~OUnoObject();
virtual void NbcMove( const Size& rSize );
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
virtual void NbcSetLogicRect(const Rectangle& rRect);
virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
virtual void SetSnapRectImpl(const Rectangle& _rRect);
virtual SdrPage* GetImplPage() const;
public:
TYPEINFO();
virtual sal_Int32 GetStep() const;
virtual void _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
/** creates the m_xMediator when it doesn't already exist.
@param _bReverse when set to <TRUE/> then the properties from the uno control will be copied into report control
*/
void CreateMediator(sal_Bool _bReverse = sal_False);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent();
static ::rtl::OUString GetDefaultName(const OUnoObject* _pObj);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
virtual sal_uInt16 GetObjIdentifier() const;
virtual sal_uInt32 GetObjInventor() const;
virtual SdrObject* Clone() const;
private:
void impl_setReportComponent_nothrow();
void impl_initializeModel_nothrow();
};
//============================================================================
} // rptui
//============================================================================
#endif // _REPORT_RPTUIOBJ_HXX
|