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 
24 #ifndef SC_XMLCODENAMEPROVIDER_HXX
25 #define SC_XMLCODENAMEPROVIDER_HXX
26 
27 #include <com/sun/star/container/XNameAccess.hpp>
28 #include <cppuhelper/implbase1.hxx>
29 
30 class ScDocument;
31 class String;
32 
33 class XMLCodeNameProvider : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XNameAccess >
34 {
35     ScDocument* mpDoc;
36 	::rtl::OUString msDocName;
37 	::rtl::OUString msCodeNameProp;
38 
39 	static sal_Bool _getCodeName( const ::com::sun::star::uno::Any& aAny,
40 			               String& rCodeName );
41 
42 public:
43     XMLCodeNameProvider( ScDocument* pDoc );
44     virtual ~XMLCodeNameProvider();
45 
46     virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
47 		throw (::com::sun::star::uno::RuntimeException );
48 
49 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
50 		throw (::com::sun::star::container::NoSuchElementException,
51 			   ::com::sun::star::lang::WrappedTargetException,
52 			   ::com::sun::star::uno::RuntimeException);
53 
54 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  )
55 		throw (::com::sun::star::uno::RuntimeException);
56 
57 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  )
58 		throw (::com::sun::star::uno::RuntimeException);
59 
60     virtual ::sal_Bool SAL_CALL hasElements()
61 		throw (::com::sun::star::uno::RuntimeException );
62 
63 	static void set( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& xNameAccess, ScDocument *pDoc );
64 };
65 
66 #endif
67