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 
28 #ifndef _SAMPLEADDIN_HXX_
29 #define _SAMPLEADDIN_HXX_
30 
31 #include <cppuhelper/implbase9.hxx>
32 
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/chart/XDiagram.hpp>
35 #include <com/sun/star/chart/XAxisXSupplier.hpp>
36 #include <com/sun/star/chart/XAxisYSupplier.hpp>
37 #include <com/sun/star/chart/XStatisticDisplay.hpp>
38 
39 #include <com/sun/star/lang/XServiceName.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/util/XRefreshable.hpp>
42 #include <com/sun/star/lang/XLocalizable.hpp>
43 
44 #include <com/sun/star/chart/XChartDocument.hpp>
45 
46 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
47 	SampleAddIn_CreateInstance(
48 		const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& );
49 
50 class SampleAddIn : public cppu::WeakImplHelper9<
51 	com::sun::star::lang::XInitialization,
52 	com::sun::star::chart::XDiagram,
53 	com::sun::star::chart::XAxisXSupplier,
54 	com::sun::star::chart::XAxisYSupplier,
55 	com::sun::star::chart::XStatisticDisplay,
56 	com::sun::star::lang::XServiceName,
57 	com::sun::star::lang::XServiceInfo,
58 	com::sun::star::util::XRefreshable,
59 	com::sun::star::lang::XLocalizable  >
60 {
61 private:
62 	::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDocument > mxChartDoc;
63 	::com::sun::star::lang::Locale maLocale;
64 
65 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxMyRedLine;
66 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxMyText;
67 
68 public:
69 	SampleAddIn();
70 	virtual ~SampleAddIn();
71 
72 	// class specific code
73 	static ::rtl::OUString	getImplementationName_Static();
74 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static();
75 
76 	sal_Bool getLogicalPosition( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxis,
77 								 double fValue,
78 								 sal_Bool bVertical,
79 								 ::com::sun::star::awt::Point& aOutPosition );
80 
81 	// XInitialization
82 	virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
83 		throw( ::com::sun::star::uno::Exception,
84 			   ::com::sun::star::uno::RuntimeException );
85 
86 	// XDiagram
87     virtual ::rtl::OUString SAL_CALL getDiagramType() throw( ::com::sun::star::uno::RuntimeException );
88     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDataRowProperties( sal_Int32 nRow )
89 		throw( ::com::sun::star::lang::IndexOutOfBoundsException,
90 			   ::com::sun::star::uno::RuntimeException );
91     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
92 		throw( ::com::sun::star::lang::IndexOutOfBoundsException,
93 			   ::com::sun::star::uno::RuntimeException );
94 
95 	// XShape ( ::XDiagram )
96 	virtual ::com::sun::star::awt::Size SAL_CALL getSize()
97 		throw( ::com::sun::star::uno::RuntimeException );
98 	virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& )
99 		throw( ::com::sun::star::beans::PropertyVetoException,
100 		       ::com::sun::star::uno::RuntimeException );
101 	virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
102 		throw( ::com::sun::star::uno::RuntimeException );
103 	virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& )
104 		throw( ::com::sun::star::uno::RuntimeException );
105 
106 	// XShapeDescriptor ( ::XShape ::XDiagram )
107     virtual rtl::OUString SAL_CALL getShapeType() throw( com::sun::star::uno::RuntimeException );
108 
109 	// XAxisXSupplier
110 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getXAxisTitle()
111 		throw( ::com::sun::star::uno::RuntimeException );
112     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXAxis()
113 		throw( ::com::sun::star::uno::RuntimeException );
114     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXMainGrid()
115 		throw( ::com::sun::star::uno::RuntimeException );
116     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXHelpGrid()
117 		throw( ::com::sun::star::uno::RuntimeException );
118 
119 	// XAxisYSupplier
120     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getYAxisTitle()
121 		throw( ::com::sun::star::uno::RuntimeException );
122     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYAxis()
123 		throw( ::com::sun::star::uno::RuntimeException );
124     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYHelpGrid()
125 		throw( ::com::sun::star::uno::RuntimeException );
126     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYMainGrid()
127 		throw( ::com::sun::star::uno::RuntimeException );
128 
129 	// XStatisticDisplay
130 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getUpBar()
131 		throw( ::com::sun::star::uno::RuntimeException );
132     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDownBar()
133 		throw( ::com::sun::star::uno::RuntimeException );
134     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMinMaxLine()
135 		throw( ::com::sun::star::uno::RuntimeException );
136 
137 	// XServiceName
138 	virtual ::rtl::OUString SAL_CALL getServiceName() throw( ::com::sun::star::uno::RuntimeException );
139 
140 	// XServiceInfo
141 	virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
142     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
143 		throw( ::com::sun::star::uno::RuntimeException );
144     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
145 		throw( ::com::sun::star::uno::RuntimeException );
146 
147 	// XRefreshable
148 	virtual void SAL_CALL refresh() throw( ::com::sun::star::uno::RuntimeException );
149     virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l )
150 		throw( ::com::sun::star::uno::RuntimeException );
151     virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l )
152 		throw( ::com::sun::star::uno::RuntimeException );
153 
154 	// XLocalizable
155 	virtual void SAL_CALL setLocale( const ::com::sun::star::lang::Locale& eLocale )
156 		throw( ::com::sun::star::uno::RuntimeException );
157     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale()
158 		throw( ::com::sun::star::uno::RuntimeException );
159 };
160 
161 #endif	// _SAMPLEADDIN_HXX_
162