1*353d8f4dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*353d8f4dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*353d8f4dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*353d8f4dSAndrew Rist * distributed with this work for additional information 6*353d8f4dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*353d8f4dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*353d8f4dSAndrew Rist * "License"); you may not use this file except in compliance 9*353d8f4dSAndrew Rist * with the License. You may obtain a copy of the License at 10*353d8f4dSAndrew Rist * 11*353d8f4dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*353d8f4dSAndrew Rist * 13*353d8f4dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*353d8f4dSAndrew Rist * software distributed under the License is distributed on an 15*353d8f4dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*353d8f4dSAndrew Rist * KIND, either express or implied. See the License for the 17*353d8f4dSAndrew Rist * specific language governing permissions and limitations 18*353d8f4dSAndrew Rist * under the License. 19*353d8f4dSAndrew Rist * 20*353d8f4dSAndrew Rist *************************************************************/ 21*353d8f4dSAndrew Rist 22*353d8f4dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SFX_DOCTEMPLATESLOCAL_HXX 25cdf0e10cSrcweir #define _SFX_DOCTEMPLATESLOCAL_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef _COM_SUN_STAR_XML_SAX_XDUCUMENTHANDLER_HPP_ 28cdf0e10cSrcweir #include <com/sun/star/xml/sax/XDocumentHandler.hpp> 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir #include <com/sun/star/beans/StringPair.hpp> 31cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 32cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 33cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir 36cdf0e10cSrcweir class DocTemplLocaleHelper : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler > 37cdf0e10cSrcweir { 38cdf0e10cSrcweir // Relations info related strings 39cdf0e10cSrcweir ::rtl::OUString m_aGroupListElement; 40cdf0e10cSrcweir ::rtl::OUString m_aGroupElement; 41cdf0e10cSrcweir ::rtl::OUString m_aNameAttr; 42cdf0e10cSrcweir ::rtl::OUString m_aUINameAttr; 43cdf0e10cSrcweir 44cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > m_aResultSeq; 45cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aElementsSeq; // stack of elements being parsed 46cdf0e10cSrcweir 47cdf0e10cSrcweir DocTemplLocaleHelper(); // must not be created directly 48cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > GetParsingResult(); 49cdf0e10cSrcweir 50cdf0e10cSrcweir 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 ) 51cdf0e10cSrcweir throw( ::com::sun::star::uno::Exception ); 52cdf0e10cSrcweir 53cdf0e10cSrcweir public: 54cdf0e10cSrcweir ~DocTemplLocaleHelper(); 55cdf0e10cSrcweir 56cdf0e10cSrcweir // returns sequence of pairs ( GroupName, GroupUIName ) 57cdf0e10cSrcweir static 58cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > 59cdf0e10cSrcweir ReadGroupLocalizationSequence( 60cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, 61cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ) 62cdf0e10cSrcweir throw( ::com::sun::star::uno::Exception ); 63cdf0e10cSrcweir 64cdf0e10cSrcweir // writes sequence of elements ( GroupName, GroupUIName ) 65cdf0e10cSrcweir static 66cdf0e10cSrcweir void SAL_CALL WriteGroupLocalizationSequence( 67cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream, 68cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aSequence, 69cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ) 70cdf0e10cSrcweir throw( ::com::sun::star::uno::Exception ); 71cdf0e10cSrcweir 72cdf0e10cSrcweir // XDocumentHandler 73cdf0e10cSrcweir virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 74cdf0e10cSrcweir virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 75cdf0e10cSrcweir 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); 76cdf0e10cSrcweir virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 77cdf0e10cSrcweir virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 78cdf0e10cSrcweir virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 79cdf0e10cSrcweir 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); 80cdf0e10cSrcweir 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); 81cdf0e10cSrcweir }; 82cdf0e10cSrcweir 83cdf0e10cSrcweir #endif 84cdf0e10cSrcweir 85