1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: binaryreadhandler.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CONFIGMGR_BINARYREADHANDLER_HXX
31 #define CONFIGMGR_BINARYREADHANDLER_HXX
33 #include "binaryreader.hxx"
34 #include "componentdatahelper.hxx"
35 #include "valuenode.hxx"
36 #include "binarytype.hxx"
37 #include "attributes.hxx"
38 #include "matchlocale.hxx"
39 #include <com/sun/star/configuration/backend/XLayer.hpp>
40 #include <com/sun/star/io/IOException.hpp>
42 #ifndef INCLUDED_MEMORY
44 #define INCLUDED_MEMORY
45 #endif // INCLUDED_MEMORY
47 #ifndef INCLUDED_VECTOR
49 #define INCLUDED_VECTOR
50 #endif // INCLUDED_VECTOR
55 // -----------------------------------------------------------------------------
58 namespace css
= com::sun::star
;
60 namespace io
= css::io
;
61 namespace uno
= css::uno
;
62 namespace backenduno
= css::configuration::backend
;
64 // -----------------------------------------------------------------------------
66 class BinaryReadHandler
68 BinaryReader m_BinaryReader
;
69 ComponentDataFactory m_aNodeFactory
;
70 rtl::OUString m_aComponentName
;
73 BinaryReadHandler(rtl::OUString
const & _aFileURL
, rtl::OUString
const & _aComponentName
, uno::Reference
<lang::XMultiServiceFactory
> const & _aFactory
);
76 bool validateHeader( const uno::Reference
<backenduno::XLayer
> * pLayers
,
78 const rtl::OUString
& _aSchemaVersion
,
79 com::sun::star::lang::Locale
const & aRequestedLocale
,
80 std::vector
< com::sun::star::lang::Locale
> & outKnownLocales
)
81 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
83 std::auto_ptr
<ISubtree
> readComponentTree()
84 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
86 std::auto_ptr
<ISubtree
> readTemplatesTree()
87 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
90 std::auto_ptr
<ISubtree
> readToplevelTree()
91 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
93 void readChildren(ISubtree
& rTree
)
94 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
97 bool verifyFileHeader( const uno::Reference
<backenduno::XLayer
> * pLayers
,
99 const rtl::OUString
& _aSchemaVersion
,
100 com::sun::star::lang::Locale
const & aRequestedLocale
,
101 std::vector
< com::sun::star::lang::Locale
> & outKnownLocales
);
103 bool isUptodate(const std::vector
<rtl::OUString
> & _timeStamps
)
104 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
106 void readChildNodes(ISubtree
& rSubTree
)
107 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
109 binary::NodeType::Type
readNodeType()
110 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
112 binary::ValueFlags::Type
readValueFlags(bool& bSeq
, bool& hasValue
, bool& hasDefault
)
113 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
115 void readAttributes(node::Attributes
&_aAttributes
)
116 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
118 void readGroup(rtl::OUString
&_aName
, node::Attributes
&_aAttributes
)
119 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
121 void readSet(rtl::OUString
&_aName
, node::Attributes
&_aAttributes
,
122 rtl::OUString
&_sInstanceName
, rtl::OUString
&_sInstanceModule
)
123 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
125 void readValue(rtl::OUString
&_aName
, node::Attributes
&_aAttributes
,
126 uno::Any
& _aValue
, uno::Any
& _aDefaultValue
,uno::Type
& _aType
)
127 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
129 void readName(rtl::OUString
&_aString
)
130 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
132 // ---------------------------------------------------------------------------
134 // -----------------------------------------------------------------------------
135 }// namespace configmgr