add three static lines beween tarballs to ease cherry-picking
[LibreOffice.git] / reportdesign / inc / RptObject.hxx
blobf0007d3eadca15a0b653782856b48bba14cd40fe
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_REPORTDESIGN_INC_RPTOBJECT_HXX
20 #define INCLUDED_REPORTDESIGN_INC_RPTOBJECT_HXX
22 #include "dllapi.h"
24 #include <svx/svdoole2.hxx>
25 #include <svx/svdouno.hxx>
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>
33 #include <map>
35 namespace rptui
37 typedef ::std::multimap< sal_Int16, OUString > IndexToNameMap;
38 enum DlgEdHintKind
40 RPTUI_HINT_WINDOWSCROLLED,
41 RPTUI_HINT_SELECTIONCHANGED
44 class OUnoObject;
45 class REPORTDESIGN_DLLPUBLIC DlgEdHint final : public SfxHint
47 private:
48 DlgEdHintKind eHintKind;
50 DlgEdHint(DlgEdHint const &) = delete;
51 void operator =(DlgEdHint const &) = delete;
52 public:
53 DlgEdHint( DlgEdHintKind eHint );
54 virtual ~DlgEdHint() override;
56 DlgEdHintKind GetKind() const { return eHintKind; }
60 class OReportPage;
61 class OPropertyMediator;
63 class REPORTDESIGN_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") OObjectBase
65 protected:
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;
73 OObjectBase(const css::uno::Reference< css::report::XReportComponent>& _xComponent);
74 OObjectBase(OUString _sComponentName);
76 virtual ~OObjectBase();
78 bool isListening() const { return m_bIsListening; }
80 void SetPropsFromRect(const tools::Rectangle& _rRect);
82 virtual SdrPage* GetImplPage() const = 0;
84 /** called by instances of derived classes to implement their overriding of getUnoShape
86 css::uno::Reference< css::drawing::XShape >
87 getUnoShapeOf( SdrObject& _rSdrObject );
89 public:
90 OObjectBase(const OObjectBase&) = delete;
91 OObjectBase& operator=(const OObjectBase&) = delete;
92 void StartListening();
93 void EndListening();
94 // PropertyChangeListener
95 /// @throws css::uno::RuntimeException
96 virtual void _propertyChange( const css::beans::PropertyChangeEvent& evt );
97 virtual void initializeOle() {}
99 bool supportsService( const OUString& _sServiceName ) const;
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; }
106 /** releases the reference to our UNO shape (m_xKeepShapeAlive)
108 void releaseUnoShape() { m_xKeepShapeAlive.clear(); }
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);
116 // OCustomShape
118 class REPORTDESIGN_DLLPUBLIC OCustomShape final : public SdrObjCustomShape , public OObjectBase
120 friend class OReportPage;
121 friend class DlgEdFactory;
123 private:
124 // protected destructor - due to final, make private
125 virtual ~OCustomShape() override;
127 public:
128 static rtl::Reference<OCustomShape> Create(
129 SdrModel& rSdrModel,
130 const css::uno::Reference< css::report::XReportComponent>& _xComponent)
132 return new OCustomShape(rSdrModel, _xComponent );
135 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
137 virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override;
138 virtual SdrObjKind GetObjIdentifier() const override;
139 virtual SdrInventor GetObjInventor() const override;
141 private:
142 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
144 OCustomShape(
145 SdrModel& rSdrModel,
146 const css::uno::Reference< css::report::XReportComponent>& _xComponent);
147 OCustomShape(
148 SdrModel& rSdrModel,
149 const OUString& _sComponentName);
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;
156 virtual SdrPage* GetImplPage() const override;
160 // OOle2Obj
162 class REPORTDESIGN_DLLPUBLIC OOle2Obj final : public SdrOle2Obj , public OObjectBase
164 friend class OReportPage;
165 friend class DlgEdFactory;
167 private:
168 // protected destructor - due to final, make private
169 virtual ~OOle2Obj() override;
171 public:
172 static rtl::Reference<OOle2Obj> Create(
173 SdrModel& rSdrModel,
174 const css::uno::Reference< css::report::XReportComponent>& _xComponent,
175 SdrObjKind _nType)
177 return new OOle2Obj(rSdrModel, _xComponent, _nType);
180 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
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;
189 void initializeChart( const css::uno::Reference< css::frame::XModel>& _xModel);
191 private:
192 OOle2Obj(
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);
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;
208 virtual SdrPage* GetImplPage() const override;
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;
213 SdrObjKind m_nType;
214 bool m_bOnlyOnce;
218 // OUnoObject
220 class REPORTDESIGN_DLLPUBLIC OUnoObject final : public SdrUnoObj , public OObjectBase
222 friend class OReportPage;
223 friend class OObjectBase;
224 friend class DlgEdFactory;
226 SdrObjKind m_nObjectType;
227 // tdf#118730 remember if this object was created interactively (due to ::EndCreate being called)
228 bool m_bSetDefaultLabel;
230 OUnoObject(SdrModel& rSdrModel,
231 const OUString& _sComponentName,
232 const OUString& rModelName,
233 SdrObjKind _nObjectType);
234 OUnoObject(
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);
242 // protected destructor
243 virtual ~OUnoObject() override;
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;
250 virtual SdrPage* GetImplPage() const override;
252 public:
254 virtual void _propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
256 /** creates the m_xMediator when it doesn't already exist.
257 @param _bReverse when set to <TRUE/> then the properties from the uno control will be copied into report control
259 void CreateMediator(bool _bReverse = false);
261 virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override;
263 static OUString GetDefaultName(const OUnoObject* _pObj);
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;
270 private:
271 virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override;
272 void impl_initializeModel_nothrow();
276 } // rptui
278 #endif // INCLUDED_REPORTDESIGN_INC_RPTOBJECT_HXX
280 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */