Line data Source code
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_SOURCE_CORE_INC_SHAPE_HXX
20 : #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SHAPE_HXX
21 :
22 : #include <cppuhelper/propertysetmixin.hxx>
23 : #include <com/sun/star/report/XShape.hpp>
24 : #include "ReportControlModel.hxx"
25 : #include <cppuhelper/compbase2.hxx>
26 : #include <comphelper/broadcasthelper.hxx>
27 : #include <com/sun/star/lang/XServiceInfo.hpp>
28 : #include "ReportHelperDefines.hxx"
29 : #include <comphelper/propagg.hxx>
30 : #include <memory>
31 :
32 : namespace reportdesign
33 : {
34 : typedef ::cppu::PropertySetMixin< com::sun::star::report::XShape > ShapePropertySet;
35 : typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XShape
36 : ,com::sun::star::lang::XServiceInfo > ShapeBase;
37 :
38 : /** \class OShape Defines the implementation of a \interface com:::sun::star::report::XShape
39 : * \ingroup reportdesign_api
40 : *
41 : */
42 : class OShape : public comphelper::OBaseMutex,
43 : public ShapeBase,
44 : public ShapePropertySet
45 : {
46 : friend class OShapeHelper;
47 : ::std::unique_ptr< ::comphelper::OPropertyArrayAggregationHelper> m_pAggHelper;
48 : OReportControlModel m_aProps;
49 : com::sun::star::drawing::HomogenMatrix3 m_Transformation;
50 : sal_Int32 m_nZOrder;
51 : bool m_bOpaque;
52 :
53 : OUString m_sServiceName;
54 : OUString m_CustomShapeEngine;
55 : OUString m_CustomShapeData;
56 : com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
57 : m_CustomShapeGeometry;
58 :
59 : private:
60 : OShape(const OShape&);
61 : OShape& operator=(const OShape&);
62 :
63 0 : template <typename T> void set( const OUString& _sProperty
64 : ,const T& _Value
65 : ,T& _member)
66 : {
67 0 : BoundListeners l;
68 : {
69 0 : ::osl::MutexGuard aGuard(m_aMutex);
70 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
71 0 : _member = _Value;
72 : }
73 0 : l.notify();
74 0 : }
75 0 : void set( const OUString& _sProperty
76 : ,bool _Value
77 : ,bool& _member)
78 : {
79 0 : BoundListeners l;
80 : {
81 0 : ::osl::MutexGuard aGuard(m_aMutex);
82 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
83 0 : _member = _Value;
84 : }
85 0 : l.notify();
86 0 : }
87 : void checkIndex(sal_Int32 _nIndex);
88 : cppu::IPropertyArrayHelper& getInfoHelper();
89 : protected:
90 : virtual ~OShape();
91 : public:
92 : explicit OShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext);
93 : explicit OShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext
94 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _xFactory
95 : ,::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _xShape
96 : ,const OUString& _sServiceName);
97 :
98 : DECLARE_XINTERFACE( )
99 : // ::com::sun::star::lang::XServiceInfo
100 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 :
104 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
105 : static OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
106 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
107 : create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
108 : // com::sun::star::beans::XPropertySet
109 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 :
117 : // XReportComponent
118 : REPORTCOMPONENT_HEADER()
119 :
120 : // XShape
121 : SHAPE_HEADER()
122 :
123 : virtual OUString SAL_CALL getCustomShapeEngine() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : virtual void SAL_CALL setCustomShapeEngine( const OUString& _customshapeengine ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : virtual OUString SAL_CALL getCustomShapeData() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : virtual void SAL_CALL setCustomShapeData( const OUString& _customshapedata ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCustomShapeGeometry() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 : virtual void SAL_CALL setCustomShapeGeometry( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _customshapegeometry ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 :
130 : virtual sal_Bool SAL_CALL getOpaque() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 : virtual void SAL_CALL setOpaque( sal_Bool _opaque ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 :
133 : // XShapeDescriptor
134 : virtual OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 :
136 : // XReportControlModel
137 : REPORTCONTROLMODEL_HEADER()
138 :
139 : // XReportControlFormat
140 : REPORTCONTROLFORMAT_HEADER()
141 : // XShape
142 : virtual ::sal_Int32 SAL_CALL getZOrder() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 : virtual void SAL_CALL setZOrder( ::sal_Int32 _zorder ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 : virtual ::com::sun::star::drawing::HomogenMatrix3 SAL_CALL getTransformation() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
145 : virtual void SAL_CALL setTransformation( const ::com::sun::star::drawing::HomogenMatrix3& _transformation ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 :
147 : // XCloneable
148 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 :
150 : // XComponent
151 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
152 0 : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
153 : {
154 0 : cppu::WeakComponentImplHelperBase::addEventListener(aListener);
155 0 : }
156 0 : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
157 : {
158 0 : cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
159 0 : }
160 :
161 : // XChild
162 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 : virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 :
165 : // XContainer
166 : virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 : virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 :
169 : // XElementAccess
170 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 : virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 :
173 : // XIndexReplace
174 : virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
175 :
176 : // XIndexContainer
177 : virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
178 : virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 :
180 : // XIndexAccess
181 : virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
183 : };
184 : }
185 : #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SHAPE_HXX
186 :
187 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|