xref: /trunk/main/chart2/source/model/main/FormattedString.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CHART_FORMATTEDSTRING_HXX
24 #define CHART_FORMATTEDSTRING_HXX
25 
26 #include "MutexContainer.hxx"
27 #include "OPropertySet.hxx"
28 #include <cppuhelper/implbase5.hxx>
29 #include <comphelper/uno3.hxx>
30 #include "ServiceMacros.hxx"
31 #include "ModifyListenerHelper.hxx"
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/chart2/XFormattedString.hpp>
34 #include <com/sun/star/util/XCloneable.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 
37 namespace chart
38 {
39 
40 namespace impl
41 {
42 typedef ::cppu::WeakImplHelper5<
43     ::com::sun::star::chart2::XFormattedString,
44     ::com::sun::star::lang::XServiceInfo,
45     ::com::sun::star::util::XCloneable,
46     ::com::sun::star::util::XModifyBroadcaster,
47     ::com::sun::star::util::XModifyListener >
48     FormattedString_Base;
49 }
50 
51 class FormattedString :
52     public MutexContainer,
53     public impl::FormattedString_Base,
54     public ::property::OPropertySet
55 {
56 public:
57     FormattedString( ::com::sun::star::uno::Reference<
58            ::com::sun::star::uno::XComponentContext > const & xContext );
59     virtual ~FormattedString();
60 
61     /// declare XServiceInfo methods
62     APPHELPER_XSERVICEINFO_DECL()
63     /// establish methods for factory instantiation
64     APPHELPER_SERVICE_FACTORY_HELPER( FormattedString )
65 
66     /// merge XInterface implementations
67     DECLARE_XINTERFACE()
68     /// merge XTypeProvider implementations
69     DECLARE_XTYPEPROVIDER()
70 
71 protected:
72     explicit FormattedString( const FormattedString & rOther );
73 
74     // ____ XFormattedString ____
75     virtual ::rtl::OUString SAL_CALL getString();
76     virtual void SAL_CALL setString( const ::rtl::OUString& String );
77 
78     // ____ OPropertySet ____
79     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const;
80 
81     // ____ OPropertySet ____
82     virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
83 
84     // ____ XPropertySet ____
85     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
86         getPropertySetInfo();
87 
88 //  virtual sal_Bool SAL_CALL convertFastPropertyValue
89 //         ( ::com::sun::star::uno::Any & rConvertedValue,
90 //           ::com::sun::star::uno::Any & rOldValue,
91 //           sal_Int32 nHandle,
92 //           const ::com::sun::star::uno::Any& rValue )
93 //      throw (::com::sun::star::lang::IllegalArgumentException);
94 
95     // ____ XCloneable ____
96     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone();
97 
98     // ____ XModifyBroadcaster ____
99     virtual void SAL_CALL addModifyListener(
100         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener );
101     virtual void SAL_CALL removeModifyListener(
102         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener );
103 
104     // ____ XModifyListener ____
105     virtual void SAL_CALL modified(
106         const ::com::sun::star::lang::EventObject& aEvent );
107 
108     // ____ XEventListener (base of XModifyListener) ____
109     virtual void SAL_CALL disposing(
110         const ::com::sun::star::lang::EventObject& Source );
111 
112     // ____ OPropertySet ____
113     virtual void firePropertyChangeEvent();
114     using OPropertySet::disposing;
115 
116     void fireModifyEvent();
117 
118 private:
119     ::rtl::OUString m_aString;
120 
121     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
122 };
123 
124 } //  namespace chart
125 
126 // CHART_FORMATTEDSTRING_HXX
127 #endif
128