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: binarywritehandler.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_BINARYWRITEHANDLER_HXX
31 #define CONFIGMGR_BINARYWRITEHANDLER_HXX
33 #include "valuenode.hxx"
34 #include "binarywriter.hxx"
35 #include "binarytype.hxx"
36 #include "attributes.hxx"
37 #include "matchlocale.hxx"
38 #include <com/sun/star/configuration/backend/XLayer.hpp>
39 #include <com/sun/star/io/IOException.hpp>
43 // -----------------------------------------------------------------------------
46 namespace css
= com::sun::star
;
48 namespace io
= css::io
;
49 namespace uno
= css::uno
;
50 namespace backenduno
= css::configuration::backend
;
52 // -----------------------------------------------------------------------------
53 class BinaryWriteHandler
: private NodeAction
55 BinaryWriter m_BinaryWriter
;
56 rtl::OUString m_aComponentName
;
59 BinaryWriteHandler(rtl::OUString
const & _aFileURL
, rtl::OUString
const & _aComponentName
, uno::Reference
<lang::XMultiServiceFactory
> const & _aFactory
);
61 bool generateHeader( const uno::Reference
<backenduno::XLayer
> * pLayers
,
63 const rtl::OUString
& aEntity
,
64 const std::vector
< com::sun::star::lang::Locale
> & aKnownLocales
)
65 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
67 void writeComponentTree(const ISubtree
* _pComponentTree
)
68 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
69 void writeTemplatesTree(const ISubtree
* _pTemplatesTree
)
70 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
72 void writeTree(ISubtree
const & rTree
)
73 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
76 virtual void handle(ISubtree
const & aSubtree
);
77 virtual void handle(ValueNode
const & aValue
);
79 void writeFileHeader( rtl::OUString
const & _aSchemaVersion
,
80 const uno::Sequence
<rtl::OUString
> & aKnownLocales
,
81 const uno::Sequence
<rtl::OUString
> & aDataLocales
)
82 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
84 void writeLayerInfoList(uno::Reference
<backenduno::XLayer
> const * pLayers
, sal_Int32 nNumlayers
)
85 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
87 void writeGroupNode(rtl::OUString
const& _aName
,node::Attributes
const& _aAttributes
)
88 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
90 void writeValueNode(rtl::OUString
const& _aName
,
91 node::Attributes
const& _aAttributes
,
92 uno::Type
const& _aType
,
93 uno::Any
const& _aUserValue
,
94 uno::Any
const& _aDefaultValue
)
95 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
97 void writeSetNode(rtl::OUString
const& _aName
,
98 rtl::OUString
const& _aTemplateName
,
99 rtl::OUString
const& _aTemplateModule
,
100 node::Attributes
const& _aAttributes
)
101 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
103 void writeAttributes(node::Attributes
const& _aAttributes
)
104 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
106 void writeNodeType(binary::NodeType::Type _eType
)
107 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
110 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
112 void writeValue( uno::Any
const& _aValue
)
113 SAL_THROW( (io::IOException
, uno::RuntimeException
) );
116 // ---------------------------------------------------------------------------
118 // -----------------------------------------------------------------------------
119 }// namespace configmgr