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 SC_VBA_CHARTOBJECTS_HXX
24 #define SC_VBA_CHARTOBJECTS_HXX
25 #include <ooo/vba/excel/XChartObjects.hpp>
26 #include <ooo/vba/excel/XChartObject.hpp>
27 #include <cppuhelper/implbase1.hxx>
28 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <com/sun/star/table/XTableCharts.hpp>
30 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
31 #include <com/sun/star/container/XEnumerationAccess.hpp>
32 #include <vbahelper/vbacollectionimpl.hxx>
33 #include "excelvbahelper.hxx"
34 #include <hash_map>
35 
36 typedef CollTestImplHelper< ov::excel::XChartObjects > ChartObjects_BASE;
37 /* #TODO see if this hash table is 'really' necessary
38 typedef ::std::hash_map< ::rtl::OUString,
39 css::uno::Reference< ov::excel::XChartObject >,
40     ::rtl::OUStringHash,
41     ::std::equal_to< ::rtl::OUString > > aHashTable;
42 */
43 
44 class ScVbaChartObjects : public ChartObjects_BASE
45 {
46 
47 	css::uno::Reference< css::table::XTableCharts > xTableCharts;
48 	css::uno::Reference< css::drawing::XDrawPageSupplier > xDrawPageSupplier;
49 	// method associated with populating the hashmap ( I'm not convinced this is necessary )
50 	//css::uno::Reference< ov::excel::XChartObject > putByPersistName( const rtl:::OUString& _sPersistChartName );
51 public:
52 	ScVbaChartObjects( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableCharts >& _xTableCharts, const css::uno::Reference< css::drawing::XDrawPageSupplier >&  _xDrawPageSupplier );
53 
54 	css::uno::Sequence< rtl::OUString > getChartObjectNames() throw( css::script::BasicErrorException );
55 	void removeByName(const rtl::OUString& _sChartName);
56 
57 	// XChartObjects
58 	virtual ::com::sun::star::uno::Any SAL_CALL Add( double Left, double Top, double Width, double Height ) throw (::com::sun::star::script::BasicErrorException);
59 	virtual void SAL_CALL Delete(  ) throw (::com::sun::star::script::BasicErrorException);
60 	// XEnumerationAccess
61 	virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
62 	// XElementAccess
63 	virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
64 	// ScVbaCollectionBaseImpl
65 	virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
66 	// ChartObjects_BASE
67 	virtual rtl::OUString& getServiceImplName();
68 	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
69 };
70 
71 #endif //SC_VBA_WINDOW_HXX
72