Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef _XMLOFF_FORMS_ATTRIBLISTMERGE_HXX_
21 : : #define _XMLOFF_FORMS_ATTRIBLISTMERGE_HXX_
22 : :
23 : : #include <comphelper/stl_types.hxx>
24 : : #include <cppuhelper/implbase1.hxx>
25 : : #include <osl/mutex.hxx>
26 : : #include <com/sun/star/xml/sax/XAttributeList.hpp>
27 : :
28 : : //.........................................................................
29 : : namespace xmloff
30 : : {
31 : : //.........................................................................
32 : :
33 : : //=====================================================================
34 : : //= OAttribListMerger
35 : : //=====================================================================
36 : : typedef ::cppu::WeakImplHelper1 < ::com::sun::star::xml::sax::XAttributeList
37 : : > OAttribListMerger_Base;
38 : : /** implements the XAttributeList list by merging different source attribute lists
39 : :
40 : : <p>Currently, the time behavious is O(n), though it would be possible to change it to O(log n).</p>
41 : : */
42 : : class OAttribListMerger : public OAttribListMerger_Base
43 : : {
44 : : protected:
45 : : ::osl::Mutex m_aMutex;
46 : : DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >, AttributeListArray );
47 : : AttributeListArray m_aLists;
48 : :
49 [ # # ][ # # ]: 0 : ~OAttribListMerger() { }
50 : :
51 : : public:
52 [ # # ][ # # ]: 0 : OAttribListMerger() { }
53 : :
54 : : // attribute list handling
55 : : // (very thinn at the moment ... only adding lists is allowed ... add more if you need it :)
56 : : void addList(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rList);
57 : :
58 : : // XAttributeList
59 : : virtual sal_Int16 SAL_CALL getLength( ) throw(::com::sun::star::uno::RuntimeException);
60 : : virtual ::rtl::OUString SAL_CALL getNameByIndex( sal_Int16 i ) throw(::com::sun::star::uno::RuntimeException);
61 : : virtual ::rtl::OUString SAL_CALL getTypeByIndex( sal_Int16 i ) throw(::com::sun::star::uno::RuntimeException);
62 : : virtual ::rtl::OUString SAL_CALL getTypeByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
63 : : virtual ::rtl::OUString SAL_CALL getValueByIndex( sal_Int16 i ) throw(::com::sun::star::uno::RuntimeException);
64 : : virtual ::rtl::OUString SAL_CALL getValueByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
65 : :
66 : : protected:
67 : : sal_Bool seekToIndex(sal_Int16 _nGlobalIndex, ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rSubList, sal_Int16& _rLocalIndex);
68 : : sal_Bool seekToName(const ::rtl::OUString& _rName, ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rSubList, sal_Int16& _rLocalIndex);
69 : : };
70 : :
71 : :
72 : : //.........................................................................
73 : : } // namespace xmloff
74 : : //.........................................................................
75 : :
76 : : #endif // _XMLOFF_FORMS_ATTRIBLISTMERGE_HXX_
77 : :
78 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|