LibreOffice Module reportdesign (master)  1
ImageControl.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_SOURCE_CORE_INC_IMAGECONTROL_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX
21 
22 #include <comphelper/uno3.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>
30 
31 namespace reportdesign
32 {
33  typedef ::cppu::PropertySetMixin< css::report::XImageControl > ImageControlPropertySet;
34  typedef ::cppu::WeakComponentImplHelper< css::report::XImageControl
35  ,css::lang::XServiceInfo > ImageControlBase;
36 
42  public ImageControlBase,
43  public ImageControlPropertySet
44  {
45  friend class OShapeHelper;
47  OUString m_aImageURL;
48  sal_Int16 m_nScaleMode;
50  private:
51  OImageControl(const OImageControl&) = delete;
52  OImageControl& operator=(const OImageControl&) = delete;
53 
54  template <typename T> void set( const OUString& _sProperty
55  ,const T& Value
56  ,T& _member)
57  {
58  BoundListeners l;
59  {
60  ::osl::MutexGuard aGuard(m_aMutex);
61  prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
62  _member = Value;
63  }
64  l.notify();
65  }
66  void set( const OUString& _sProperty
67  ,bool Value
68  ,bool& _member)
69  {
70  BoundListeners l;
71  {
72  ::osl::MutexGuard aGuard(m_aMutex);
73  prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
74  _member = Value;
75  }
76  l.notify();
77  }
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);
85 
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;
91 
92  // css::beans::XPropertySet
93  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
94  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
95  virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
96  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
97  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
98  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
99  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
100 
101  // XReportComponent
103  // XShape
104  SHAPE_HEADER()
105 
106  // XShapeDescriptor
107  virtual OUString SAL_CALL getShapeType( ) override;
108 
109  // XReportControlModel
111 
112  // XReportControlFormat
114 
115  // XCloneable
116  virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
117 
118  // XImageControl
119  virtual OUString SAL_CALL getImageURL() override;
120  virtual void SAL_CALL setImageURL( const OUString& _imageurl ) override;
121  virtual sal_Bool SAL_CALL getPreserveIRI() override;
122  virtual void SAL_CALL setPreserveIRI( sal_Bool _preserveiri ) override;
123  virtual ::sal_Int16 SAL_CALL getScaleMode() override;
124  virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) override;
125 
126  // XImageProducerSupplier
127  virtual css::uno::Reference< css::awt::XImageProducer > SAL_CALL getImageProducer( ) override;
128 
129  // XComponent
130  virtual void SAL_CALL dispose() override;
131  virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
132  {
133  cppu::WeakComponentImplHelperBase::addEventListener(aListener);
134  }
135  virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
136  {
137  cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
138  }
139 
140  // XChild
141  virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
142  virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
143  // XContainer
144  virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
145  virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
146 
147  // XElementAccess
148  virtual css::uno::Type SAL_CALL getElementType( ) override;
149  virtual sal_Bool SAL_CALL hasElements( ) override;
150 
151  // XIndexReplace
152  virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
153 
154  // XIndexContainer
155  virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
156  virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override;
157 
158  // XIndexAccess
159  virtual ::sal_Int32 SAL_CALL getCount( ) override;
160  virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
161  };
162 }
163 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX
164 
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL dispose() override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
virtual void SAL_CALL insertByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
mutable::osl::Mutex m_aMutex
#define REPORTCONTROLFORMAT_HEADER()
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL removeByIndex(::sal_Int32 Index) override
virtual OUString SAL_CALL getShapeType() override
virtual css::uno::Any SAL_CALL getByIndex(::sal_Int32 Index) override
virtual ::sal_Int16 SAL_CALL getScaleMode() override
virtual sal_Bool SAL_CALL getPreserveIRI() override
::cppu::PropertySetMixin< css::report::XImageControl > ImageControlPropertySet
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual css::uno::Reference< css::awt::XImageProducer > SAL_CALL getImageProducer() override
OImageControl & operator=(const OImageControl &)=delete
#define REPORTCOMPONENT_HEADER()
OImageControl(const OImageControl &)=delete
implementation of a
virtual void SAL_CALL setPreserveIRI(sal_Bool _preserveiri) override
virtual void SAL_CALL setScaleMode(::sal_Int16 _scalemode) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
#define SHAPE_HEADER()
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImageURL() override
unsigned char sal_Bool
::cppu::WeakComponentImplHelper< css::report::XImageControl,css::lang::XServiceInfo > ImageControlBase
virtual void SAL_CALL setImageURL(const OUString &_imageurl) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
OReportControlModel m_aProps
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual ~OImageControl() override
virtual ::sal_Int32 SAL_CALL getCount() override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
void set(const OUString &_sProperty, bool Value, bool &_member)
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
#define REPORTCONTROLMODEL_HEADER()
virtual void SAL_CALL replaceByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
void set(const OUString &_sProperty, const T &Value, T &_member)
struct _ADOIndex Index
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Type SAL_CALL getElementType() override
#define DECLARE_XINTERFACE()