xref: /trunk/main/chart2/source/controller/chartapiwrapper/TitleWrapper.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_TITLEWRAPPER_HXX
24 #define CHART_TITLEWRAPPER_HXX
25 
26 #include "WrappedPropertySet.hxx"
27 #include "ReferenceSizePropertyProvider.hxx"
28 #include "Chart2ModelContact.hxx"
29 #include "ServiceMacros.hxx"
30 #include "TitleHelper.hxx"
31 #include <cppuhelper/implbase3.hxx>
32 #include <comphelper/uno3.hxx>
33 #include <cppuhelper/interfacecontainer.hxx>
34 #include <com/sun/star/drawing/XShape.hpp>
35 #include <com/sun/star/lang/XComponent.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/chart2/XTitle.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
39 
40 #include <boost/shared_ptr.hpp>
41 
42 namespace chart
43 {
44 namespace wrapper
45 {
46 
47 class TitleWrapper : public ::cppu::ImplInheritanceHelper3<
48                       WrappedPropertySet
49                     , com::sun::star::drawing::XShape
50                     , com::sun::star::lang::XComponent
51                     , com::sun::star::lang::XServiceInfo
52                     >
53                     , public ReferenceSizePropertyProvider
54 {
55 public:
56     TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
57                   ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
58     virtual ~TitleWrapper();
59 
60     /// XServiceInfo declarations
61     APPHELPER_XSERVICEINFO_DECL()
62 
63     //ReferenceSizePropertyProvider
64     virtual void updateReferenceSize();
65     virtual ::com::sun::star::uno::Any getReferenceSize();
66     virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
67 
68 protected:
69     // ____ XShape ____
70     virtual ::com::sun::star::awt::Point SAL_CALL getPosition();
71     virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition );
72     virtual ::com::sun::star::awt::Size SAL_CALL getSize();
73     virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize );
74 
75     // ____ XShapeDescriptor (base of XShape) ____
76     virtual ::rtl::OUString SAL_CALL getShapeType();
77 
78     // ____ XComponent ____
79     virtual void SAL_CALL dispose();
80     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
81                                             ::com::sun::star::lang::XEventListener >& xListener );
82     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
83                                                ::com::sun::star::lang::XEventListener >& aListener );
84 
85     // character properties have to be handled differently (via the XFormattedString elements)
86     void getFastCharacterPropertyValue( sal_Int32 nHandle, ::com::sun::star::uno::Any& rValue );
87     void setFastCharacterPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue );
88 
89     // ____ WrappedPropertySet ____
90     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue );
91     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName );
92 
93     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener );
94     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener );
95 
96     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName );
97 
98     virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName );
99     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName );
100 
101     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
102 
103     virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
104     virtual const std::vector< WrappedProperty* > createWrappedProperties();
105 
106     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getFirstCharacterPropertySet();
107 
108 private:
109     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > getTitleObject();
110 
111 private:
112     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
113     ::cppu::OInterfaceContainerHelper           m_aEventListenerContainer;
114 
115     ::chart::TitleHelper::eTitleType        m_eTitleType;
116 };
117 
118 } //  namespace wrapper
119 } //  namespace chart
120 
121 // CHART_TITLEWRAPPER_HXX
122 #endif
123