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_CHART2_SOURCE_MODEL_MAIN_FORMATTEDSTRING_HXX
20 : #define INCLUDED_CHART2_SOURCE_MODEL_MAIN_FORMATTEDSTRING_HXX
21 :
22 : #include "MutexContainer.hxx"
23 : #include "OPropertySet.hxx"
24 : #include <cppuhelper/implbase5.hxx>
25 : #include <comphelper/uno3.hxx>
26 : #include "ModifyListenerHelper.hxx"
27 : #include <com/sun/star/lang/XServiceInfo.hpp>
28 : #include <com/sun/star/chart2/XFormattedString2.hpp>
29 : #include <com/sun/star/util/XCloneable.hpp>
30 : #include <com/sun/star/uno/XComponentContext.hpp>
31 :
32 : namespace chart
33 : {
34 :
35 : namespace impl
36 : {
37 : typedef ::cppu::WeakImplHelper5<
38 : css::chart2::XFormattedString2,
39 : css::lang::XServiceInfo,
40 : css::util::XCloneable,
41 : css::util::XModifyBroadcaster,
42 : css::util::XModifyListener >
43 : FormattedString_Base;
44 : }
45 :
46 : class FormattedString :
47 : public MutexContainer,
48 : public impl::FormattedString_Base,
49 : public ::property::OPropertySet
50 : {
51 : public:
52 : explicit FormattedString( css::uno::Reference<
53 : css::uno::XComponentContext > const & xContext );
54 : virtual ~FormattedString();
55 :
56 : /// declare XServiceInfo methods
57 : virtual OUString SAL_CALL getImplementationName()
58 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
59 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
60 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
61 : virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
62 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
63 :
64 : static OUString getImplementationName_Static();
65 : static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
66 : /// establish methods for factory instatiation
67 : static css::uno::Reference< css::uno::XInterface > SAL_CALL create( css::uno::Reference< css::uno::XComponentContext > const & xContext)
68 : throw(css::uno::Exception)
69 : {
70 : return static_cast<cppu::OWeakObject *>(new FormattedString( xContext ));
71 : }
72 :
73 : /// merge XInterface implementations
74 : DECLARE_XINTERFACE()
75 : /// merge XTypeProvider implementations
76 : DECLARE_XTYPEPROVIDER()
77 :
78 124872 : virtual void SAL_CALL setPropertyValue(const OUString& p1, const css::uno::Any& p2) throw (css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
79 124872 : { ::property::OPropertySet::setPropertyValue(p1, p2); }
80 40054 : virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& p1) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
81 40054 : { return ::property::OPropertySet::getPropertyValue(p1); }
82 66 : virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
83 66 : { ::property::OPropertySet::addPropertyChangeListener(p1, p2); }
84 66 : virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
85 66 : { ::property::OPropertySet::removePropertyChangeListener(p1, p2); }
86 0 : virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
87 0 : { ::property::OPropertySet::addVetoableChangeListener(p1, p2); }
88 0 : virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
89 0 : { ::property::OPropertySet::removeVetoableChangeListener(p1, p2); }
90 :
91 : protected:
92 : explicit FormattedString( const FormattedString & rOther );
93 :
94 : // ____ XFormattedString ____
95 : virtual OUString SAL_CALL getString()
96 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : virtual void SAL_CALL setString( const OUString& String )
98 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : // ____ OPropertySet ____
101 : virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
102 : throw (css::beans::UnknownPropertyException,
103 : css::uno::RuntimeException) SAL_OVERRIDE;
104 :
105 : // ____ OPropertySet ____
106 : virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
107 :
108 : // ____ XPropertySet ____
109 : virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
110 : getPropertySetInfo()
111 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 :
113 : // ____ XCloneable ____
114 : virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone()
115 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 :
117 : // ____ XModifyBroadcaster ____
118 : virtual void SAL_CALL addModifyListener(
119 : const css::uno::Reference< css::util::XModifyListener >& aListener )
120 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual void SAL_CALL removeModifyListener(
122 : const css::uno::Reference< css::util::XModifyListener >& aListener )
123 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 :
125 : // ____ XModifyListener ____
126 : virtual void SAL_CALL modified(
127 : const css::lang::EventObject& aEvent )
128 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 :
130 : // ____ XEventListener (base of XModifyListener) ____
131 : virtual void SAL_CALL disposing(
132 : const css::lang::EventObject& Source )
133 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 :
135 : // ____ OPropertySet ____
136 : virtual void firePropertyChangeEvent() SAL_OVERRIDE;
137 : using OPropertySet::disposing;
138 :
139 : void fireModifyEvent();
140 :
141 : private:
142 : OUString m_aString;
143 :
144 : css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
145 : };
146 :
147 : } // namespace chart
148 :
149 : // INCLUDED_CHART2_SOURCE_MODEL_MAIN_FORMATTEDSTRING_HXX
150 : #endif
151 :
152 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|