1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef CHART_TITLEWRAPPER_HXX
28 #define CHART_TITLEWRAPPER_HXX
29 
30 #include "WrappedPropertySet.hxx"
31 #include "ReferenceSizePropertyProvider.hxx"
32 #include "Chart2ModelContact.hxx"
33 #include "ServiceMacros.hxx"
34 #include "TitleHelper.hxx"
35 #include <cppuhelper/implbase3.hxx>
36 #include <comphelper/uno3.hxx>
37 #include <cppuhelper/interfacecontainer.hxx>
38 #include <com/sun/star/drawing/XShape.hpp>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/chart2/XTitle.hpp>
42 #include <com/sun/star/uno/XComponentContext.hpp>
43 
44 #include <boost/shared_ptr.hpp>
45 
46 namespace chart
47 {
48 namespace wrapper
49 {
50 
51 class TitleWrapper : public ::cppu::ImplInheritanceHelper3<
52                       WrappedPropertySet
53                     , com::sun::star::drawing::XShape
54                     , com::sun::star::lang::XComponent
55                     , com::sun::star::lang::XServiceInfo
56                     >
57                     , public ReferenceSizePropertyProvider
58 {
59 public:
60     TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
61                   ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
62 	virtual ~TitleWrapper();
63 
64     /// XServiceInfo declarations
65     APPHELPER_XSERVICEINFO_DECL()
66 
67     //ReferenceSizePropertyProvider
68     virtual void updateReferenceSize();
69     virtual ::com::sun::star::uno::Any getReferenceSize();
70     virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
71 
72 protected:
73     // ____ XShape ____
74     virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
75         throw (::com::sun::star::uno::RuntimeException);
76     virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
77         throw (::com::sun::star::uno::RuntimeException);
78     virtual ::com::sun::star::awt::Size SAL_CALL getSize()
79         throw (::com::sun::star::uno::RuntimeException);
80     virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
81         throw (::com::sun::star::beans::PropertyVetoException,
82                ::com::sun::star::uno::RuntimeException);
83 
84     // ____ XShapeDescriptor (base of XShape) ____
85     virtual ::rtl::OUString SAL_CALL getShapeType()
86         throw (::com::sun::star::uno::RuntimeException);
87 
88     // ____ XComponent ____
89     virtual void SAL_CALL dispose()
90         throw (::com::sun::star::uno::RuntimeException);
91     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
92                                             ::com::sun::star::lang::XEventListener >& xListener )
93         throw (::com::sun::star::uno::RuntimeException);
94     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
95                                                ::com::sun::star::lang::XEventListener >& aListener )
96         throw (::com::sun::star::uno::RuntimeException);
97 
98     // character properties have to be handled differently (via the XFormattedString elements)
99     void getFastCharacterPropertyValue( sal_Int32 nHandle, ::com::sun::star::uno::Any& rValue );
100     void setFastCharacterPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
101         throw (::com::sun::star::uno::Exception);
102 
103     // ____ WrappedPropertySet ____
104     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
105     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
106 
107     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
108     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
109 
110     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
111 
112     virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
113     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
114 
115     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
116 
117     virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
118     virtual const std::vector< WrappedProperty* > createWrappedProperties();
119 
120     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getFirstCharacterPropertySet();
121 
122 private:
123     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > getTitleObject();
124 
125 private:
126     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
127 	::cppu::OInterfaceContainerHelper           m_aEventListenerContainer;
128 
129     ::chart::TitleHelper::eTitleType        m_eTitleType;
130 };
131 
132 } //  namespace wrapper
133 } //  namespace chart
134 
135 // CHART_TITLEWRAPPER_HXX
136 #endif
137