Update ooo320-m1
[ooovba.git] / dbaccess / source / filter / xml / xmlDocuments.cxx
blobb208dc3aeca1332c55ddc8bf14a344dcf3a9bd1f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlDocuments.cxx,v $
10 * $Revision: 1.8 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBA_XMLDOCUMENTS_HXX
34 #include "xmlDocuments.hxx"
35 #endif
36 #ifndef DBA_XMLFILTER_HXX
37 #include "xmlfilter.hxx"
38 #endif
39 #ifndef _XMLOFF_XMLTOKEN_HXX
40 #include <xmloff/xmltoken.hxx>
41 #endif
42 #ifndef _XMLOFF_XMLNMSPE_HXX
43 #include <xmloff/xmlnmspe.hxx>
44 #endif
45 #ifndef DBA_XMLQUERY_HXX
46 #include "xmlQuery.hxx"
47 #endif
48 #ifndef DBA_XMLTABLE_HXX
49 #include "xmlTable.hxx"
50 #endif
51 #ifndef DBA_XMLCOMPONENT_HXX
52 #include "xmlComponent.hxx"
53 #endif
54 #ifndef DBA_XMLHIERARCHYCOLLECTION_HXX
55 #include "xmlHierarchyCollection.hxx"
56 #endif
57 #ifndef DBA_XMLENUMS_HXX
58 #include "xmlEnums.hxx"
59 #endif
60 #ifndef DBACCESS_SHARED_XMLSTRINGS_HRC
61 #include "xmlstrings.hrc"
62 #endif
63 #ifndef _TOOLS_DEBUG_HXX
64 #include <tools/debug.hxx>
65 #endif
67 namespace dbaxml
69 using namespace ::com::sun::star::uno;
70 using namespace ::com::sun::star::container;
71 using namespace ::com::sun::star::xml::sax;
72 DBG_NAME(OXMLDocuments)
74 OXMLDocuments::OXMLDocuments( ODBFilter& rImport
75 ,sal_uInt16 nPrfx
76 , const ::rtl::OUString& rLName
77 ,const Reference< XNameAccess >& _xContainer
78 ,const ::rtl::OUString& _sCollectionServiceName
79 ,const ::rtl::OUString& _sComponentServiceName) :
80 SvXMLImportContext( rImport, nPrfx, rLName )
81 ,m_xContainer(_xContainer)
82 ,m_sCollectionServiceName(_sCollectionServiceName)
83 ,m_sComponentServiceName(_sComponentServiceName)
85 DBG_CTOR(OXMLDocuments,NULL);
88 // -----------------------------------------------------------------------------
89 OXMLDocuments::OXMLDocuments( ODBFilter& rImport
90 ,sal_uInt16 nPrfx
91 , const ::rtl::OUString& rLName
92 ,const Reference< XNameAccess >& _xContainer
93 ,const ::rtl::OUString& _sCollectionServiceName
94 ) :
95 SvXMLImportContext( rImport, nPrfx, rLName )
96 ,m_xContainer(_xContainer)
97 ,m_sCollectionServiceName(_sCollectionServiceName)
99 DBG_CTOR(OXMLDocuments,NULL);
101 // -----------------------------------------------------------------------------
103 OXMLDocuments::~OXMLDocuments()
106 DBG_DTOR(OXMLDocuments,NULL);
108 // -----------------------------------------------------------------------------
110 SvXMLImportContext* OXMLDocuments::CreateChildContext(
111 sal_uInt16 nPrefix,
112 const ::rtl::OUString& rLocalName,
113 const Reference< XAttributeList > & xAttrList )
115 SvXMLImportContext *pContext = 0;
116 const SvXMLTokenMap& rTokenMap = GetOwnImport().GetDocumentsElemTokenMap();
118 switch( rTokenMap.Get( nPrefix, rLocalName ) )
120 case XML_TOK_TABLE:
121 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
122 pContext = new OXMLTable( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,SERVICE_SDB_TABLEDEFINITION);
123 break;
124 case XML_TOK_QUERY:
125 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
126 pContext = new OXMLQuery( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer );
127 break;
128 case XML_TOK_COMPONENT:
129 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
130 pContext = new OXMLComponent( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_sComponentServiceName );
131 break;
132 // case XML_TOK_QUERY_COLLECTION:
133 case XML_TOK_COMPONENT_COLLECTION:
134 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
135 pContext = new OXMLHierarchyCollection( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_sCollectionServiceName,m_sComponentServiceName );
136 break;
139 if( !pContext )
140 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
143 return pContext;
145 // -----------------------------------------------------------------------------
146 ODBFilter& OXMLDocuments::GetOwnImport()
148 return static_cast<ODBFilter&>(GetImport());
150 // -----------------------------------------------------------------------------
151 //----------------------------------------------------------------------------
152 } // namespace dbaxml
153 // -----------------------------------------------------------------------------