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 _SFX_DOCTEMPLATESLOCAL_HXX
25 #define _SFX_DOCTEMPLATESLOCAL_HXX
26 
27 #ifndef _COM_SUN_STAR_XML_SAX_XDUCUMENTHANDLER_HPP_
28 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
29 #endif
30 #include <com/sun/star/beans/StringPair.hpp>
31 #include <com/sun/star/io/XInputStream.hpp>
32 #include <com/sun/star/io/XOutputStream.hpp>
33 #include <cppuhelper/implbase1.hxx>
34 
35 
36 class DocTemplLocaleHelper : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
37 {
38 	// Relations info related strings
39 	::rtl::OUString m_aGroupListElement;
40 	::rtl::OUString m_aGroupElement;
41 	::rtl::OUString m_aNameAttr;
42 	::rtl::OUString m_aUINameAttr;
43 
44 	::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > m_aResultSeq;
45 	::com::sun::star::uno::Sequence< ::rtl::OUString > m_aElementsSeq; // stack of elements being parsed
46 
47 	DocTemplLocaleHelper(); // must not be created directly
48 	::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > GetParsingResult();
49 
50 	static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > SAL_CALL ReadLocalizationSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory )
51 	throw( ::com::sun::star::uno::Exception );
52 
53 public:
54 	~DocTemplLocaleHelper();
55 
56 	// returns sequence of pairs ( GroupName, GroupUIName )
57 	static
58 	::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >
59 	ReadGroupLocalizationSequence(
60 		const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
61 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory )
62 			throw( ::com::sun::star::uno::Exception );
63 
64 	// writes sequence of elements ( GroupName, GroupUIName )
65 	static
66 	void SAL_CALL WriteGroupLocalizationSequence(
67 		const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream,
68 		const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aSequence,
69 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory )
70 			throw( ::com::sun::star::uno::Exception );
71 
72 	// XDocumentHandler
73     virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
74     virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
75     virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
76     virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
77     virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
78     virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
79     virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
80     virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
81 };
82 
83 #endif
84 
85