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_LEGENDWRAPPER_HXX
28 #define CHART_LEGENDWRAPPER_HXX
29 
30 #include "WrappedPropertySet.hxx"
31 #include "ReferenceSizePropertyProvider.hxx"
32 #include "ServiceMacros.hxx"
33 #include <cppuhelper/implbase3.hxx>
34 #include <comphelper/uno3.hxx>
35 #include <cppuhelper/interfacecontainer.hxx>
36 #include <com/sun/star/drawing/XShape.hpp>
37 #include <com/sun/star/lang/XComponent.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/chart2/XChartDocument.hpp>
40 #include <com/sun/star/uno/XComponentContext.hpp>
41 #include <com/sun/star/chart2/XLegend.hpp>
42 
43 #include <boost/shared_ptr.hpp>
44 
45 namespace chart
46 {
47 
48 namespace wrapper
49 {
50 
51 class Chart2ModelContact;
52 
53 class LegendWrapper : public ::cppu::ImplInheritanceHelper3<
54                       WrappedPropertySet
55                     , com::sun::star::drawing::XShape
56                     , com::sun::star::lang::XComponent
57                     , com::sun::star::lang::XServiceInfo
58                     >
59                     , public ReferenceSizePropertyProvider
60 {
61 public:
62     LegendWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
63 	virtual ~LegendWrapper();
64 
65     /// XServiceInfo declarations
66     APPHELPER_XSERVICEINFO_DECL()
67 
68     //ReferenceSizePropertyProvider
69     virtual void updateReferenceSize();
70     virtual ::com::sun::star::uno::Any getReferenceSize();
71     virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
72 
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 protected:
99     // ____ WrappedPropertySet ____
100     virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
101     virtual const std::vector< WrappedProperty* > createWrappedProperties();
102     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
103 
104 private:
105     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
106 	::cppu::OInterfaceContainerHelper           m_aEventListenerContainer;
107 };
108 
109 } //  namespace wrapper
110 } //  namespace chart
111 
112 // CHART_LEGENDWRAPPER_HXX
113 #endif
114