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: xmlDocuments.cxx,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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBA_XMLDOCUMENTS_HXX
34 #include "xmlDocuments.hxx"
36 #ifndef DBA_XMLFILTER_HXX
37 #include "xmlfilter.hxx"
39 #ifndef _XMLOFF_XMLTOKEN_HXX
40 #include <xmloff/xmltoken.hxx>
42 #ifndef _XMLOFF_XMLNMSPE_HXX
43 #include <xmloff/xmlnmspe.hxx>
45 #ifndef DBA_XMLQUERY_HXX
46 #include "xmlQuery.hxx"
48 #ifndef DBA_XMLTABLE_HXX
49 #include "xmlTable.hxx"
51 #ifndef DBA_XMLCOMPONENT_HXX
52 #include "xmlComponent.hxx"
54 #ifndef DBA_XMLHIERARCHYCOLLECTION_HXX
55 #include "xmlHierarchyCollection.hxx"
57 #ifndef DBA_XMLENUMS_HXX
58 #include "xmlEnums.hxx"
60 #ifndef DBACCESS_SHARED_XMLSTRINGS_HRC
61 #include "xmlstrings.hrc"
63 #ifndef _TOOLS_DEBUG_HXX
64 #include <tools/debug.hxx>
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
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
91 , const ::rtl::OUString
& rLName
92 ,const Reference
< XNameAccess
>& _xContainer
93 ,const ::rtl::OUString
& _sCollectionServiceName
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(
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
) )
121 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
122 pContext
= new OXMLTable( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
,m_xContainer
,SERVICE_SDB_TABLEDEFINITION
);
125 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
126 pContext
= new OXMLQuery( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
,m_xContainer
);
128 case XML_TOK_COMPONENT
:
129 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
130 pContext
= new OXMLComponent( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
,m_xContainer
,m_sComponentServiceName
);
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
);
140 pContext
= new SvXMLImportContext( GetImport(), nPrefix
, rLocalName
);
145 // -----------------------------------------------------------------------------
146 ODBFilter
& OXMLDocuments::GetOwnImport()
148 return static_cast<ODBFilter
&>(GetImport());
150 // -----------------------------------------------------------------------------
151 //----------------------------------------------------------------------------
152 } // namespace dbaxml
153 // -----------------------------------------------------------------------------