lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / reportdesign / source / core / inc / ImageControl.hxx
blob63ed5468efc6a54136edd4076ec58b1f64e7bdcb
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_SOURCE_CORE_INC_IMAGECONTROL_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX
22 #include <comphelper/uno3.hxx>
23 #include <cppuhelper/propertysetmixin.hxx>
24 #include <com/sun/star/report/XImageControl.hpp>
25 #include "ReportControlModel.hxx"
26 #include <cppuhelper/compbase.hxx>
27 #include <cppuhelper/basemutex.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <ReportHelperDefines.hxx>
31 namespace reportdesign
33 typedef ::cppu::PropertySetMixin< css::report::XImageControl > ImageControlPropertySet;
34 typedef ::cppu::WeakComponentImplHelper< css::report::XImageControl
35 ,css::lang::XServiceInfo > ImageControlBase;
37 /** \class OImageControl Defines the implementation of a \interface com:::sun::star::report::XImageControl
38 * \ingroup reportdesign_api
41 class OImageControl : public cppu::BaseMutex,
42 public ImageControlBase,
43 public ImageControlPropertySet
45 friend class OShapeHelper;
46 OReportControlModel m_aProps;
47 OUString m_aImageURL;
48 sal_Int16 m_nScaleMode;
49 bool m_bPreserveIRI;
50 private:
51 OImageControl(const OImageControl&) = delete;
52 OImageControl& operator=(const OImageControl&) = delete;
54 template <typename T> void set( const OUString& _sProperty
55 ,const T& Value
56 ,T& _member)
58 BoundListeners l;
60 ::osl::MutexGuard aGuard(m_aMutex);
61 prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
62 _member = Value;
64 l.notify();
66 void set( const OUString& _sProperty
67 ,bool Value
68 ,bool& _member)
70 BoundListeners l;
72 ::osl::MutexGuard aGuard(m_aMutex);
73 prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
74 _member = Value;
76 l.notify();
78 protected:
79 virtual ~OImageControl() override;
80 public:
81 explicit OImageControl(css::uno::Reference< css::uno::XComponentContext > const & _xContext);
82 explicit OImageControl(css::uno::Reference< css::uno::XComponentContext > const & _xContext
83 ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory
84 ,css::uno::Reference< css::drawing::XShape >& _xShape);
86 DECLARE_XINTERFACE( )
87 // css::lang::XServiceInfo
88 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
89 virtual OUString SAL_CALL getImplementationName( ) override;
90 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
92 /// @throws css::uno::RuntimeException
93 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
94 /// @throws css::uno::RuntimeException
95 static OUString getImplementationName_Static();
96 static css::uno::Reference< css::uno::XInterface >
97 create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
98 // css::beans::XPropertySet
99 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
100 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
101 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
102 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
103 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
104 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
105 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
107 // XReportComponent
108 REPORTCOMPONENT_HEADER()
109 // XShape
110 SHAPE_HEADER()
112 // XShapeDescriptor
113 virtual OUString SAL_CALL getShapeType( ) override;
115 // XReportControlModel
116 REPORTCONTROLMODEL_HEADER()
118 // XReportControlFormat
119 REPORTCONTROLFORMAT_HEADER()
121 // XCloneable
122 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
124 // XImageControl
125 virtual OUString SAL_CALL getImageURL() override;
126 virtual void SAL_CALL setImageURL( const OUString& _imageurl ) override;
127 virtual sal_Bool SAL_CALL getPreserveIRI() override;
128 virtual void SAL_CALL setPreserveIRI( sal_Bool _preserveiri ) override;
129 virtual ::sal_Int16 SAL_CALL getScaleMode() override;
130 virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) override;
132 // XImageProducerSupplier
133 virtual css::uno::Reference< css::awt::XImageProducer > SAL_CALL getImageProducer( ) override;
135 // XComponent
136 virtual void SAL_CALL dispose() override;
137 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
139 cppu::WeakComponentImplHelperBase::addEventListener(aListener);
141 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
143 cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
146 // XChild
147 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
148 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
149 // XContainer
150 virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
151 virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
153 // XElementAccess
154 virtual css::uno::Type SAL_CALL getElementType( ) override;
155 virtual sal_Bool SAL_CALL hasElements( ) override;
157 // XIndexReplace
158 virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
160 // XIndexContainer
161 virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
162 virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override;
164 // XIndexAccess
165 virtual ::sal_Int32 SAL_CALL getCount( ) override;
166 virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
169 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */