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: ManifestImport.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 ************************************************************************/
31 #ifndef _MANIFEST_IMPORT_HXX
32 #define _MANIFEST_IMPORT_HXX
34 #include <cppuhelper/implbase1.hxx> // helper for implementations
35 #ifndef _COM_SUN_STAR_XML_SAX_XDUCUMENTHANDLER_HPP_
36 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
40 #include <HashMaps.hxx>
42 namespace com
{ namespace sun
{ namespace star
{
43 namespace xml
{ namespace sax
{ class XAttributeList
; } }
44 namespace beans
{ struct PropertyValue
; }
47 typedef ::std::hash_map
< ::rtl::OUString
, ::rtl::OUString
, ::rtl::OUStringHash
, eqFunc
> StringHashMap
;
49 struct ManifestScopeEntry
51 ::rtl::OUString m_aConvertedName
;
52 StringHashMap m_aNamespaces
;
54 ManifestScopeEntry( const ::rtl::OUString
& aConvertedName
, const StringHashMap
& aNamespaces
)
55 : m_aConvertedName( aConvertedName
)
56 , m_aNamespaces( aNamespaces
)
63 typedef ::std::vector
< ManifestScopeEntry
> ManifestStack
;
65 class ManifestImport
: public cppu::WeakImplHelper1
< com::sun::star::xml::sax::XDocumentHandler
>
68 com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
> aSequence
;
69 sal_Int16 nNumProperty
;
71 sal_Bool bIgnoreEncryptData
;
72 ::std::vector
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> > & rManVector
;
74 const ::rtl::OUString sFileEntryElement
;
75 const ::rtl::OUString sManifestElement
;
76 const ::rtl::OUString sEncryptionDataElement
;
77 const ::rtl::OUString sAlgorithmElement
;
78 const ::rtl::OUString sKeyDerivationElement
;
80 const ::rtl::OUString sCdataAttribute
;
81 const ::rtl::OUString sMediaTypeAttribute
;
82 const ::rtl::OUString sVersionAttribute
;
83 const ::rtl::OUString sFullPathAttribute
;
84 const ::rtl::OUString sSizeAttribute
;
85 const ::rtl::OUString sSaltAttribute
;
86 const ::rtl::OUString sInitialisationVectorAttribute
;
87 const ::rtl::OUString sIterationCountAttribute
;
88 const ::rtl::OUString sAlgorithmNameAttribute
;
89 const ::rtl::OUString sKeyDerivationNameAttribute
;
90 const ::rtl::OUString sChecksumAttribute
;
91 const ::rtl::OUString sChecksumTypeAttribute
;
93 const ::rtl::OUString sFullPathProperty
;
94 const ::rtl::OUString sMediaTypeProperty
;
95 const ::rtl::OUString sVersionProperty
;
96 const ::rtl::OUString sIterationCountProperty
;
97 const ::rtl::OUString sSaltProperty
;
98 const ::rtl::OUString sInitialisationVectorProperty
;
99 const ::rtl::OUString sSizeProperty
;
100 const ::rtl::OUString sDigestProperty
;
102 const ::rtl::OUString sWhiteSpace
;
103 const ::rtl::OUString sBlowfish
;
104 const ::rtl::OUString sPBKDF2
;
105 const ::rtl::OUString sChecksumType
;
108 ::rtl::OUString
PushNameAndNamespaces( const ::rtl::OUString
& aName
,
109 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttribs
,
110 StringHashMap
& o_aConvertedAttribs
);
111 ::rtl::OUString
ConvertNameWithNamespace( const ::rtl::OUString
& aName
, const StringHashMap
& aNamespaces
);
112 ::rtl::OUString
ConvertName( const ::rtl::OUString
& aName
);
115 ManifestImport( std::vector
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> > & rNewVector
);
116 ~ManifestImport( void );
117 virtual void SAL_CALL
startDocument( )
118 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
119 virtual void SAL_CALL
endDocument( )
120 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
121 virtual void SAL_CALL
startElement( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttribs
)
122 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
123 virtual void SAL_CALL
endElement( const ::rtl::OUString
& aName
)
124 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
125 virtual void SAL_CALL
characters( const ::rtl::OUString
& aChars
)
126 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
127 virtual void SAL_CALL
ignorableWhitespace( const ::rtl::OUString
& aWhitespaces
)
128 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
129 virtual void SAL_CALL
processingInstruction( const ::rtl::OUString
& aTarget
, const ::rtl::OUString
& aData
)
130 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
131 virtual void SAL_CALL
setDocumentLocator( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XLocator
>& xLocator
)
132 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);