Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "xmlConnectionData.hxx"
21 : #include "xmlLogin.hxx"
22 : #include "xmlTableFilterList.hxx"
23 : #include "xmlfilter.hxx"
24 : #include <xmloff/xmltoken.hxx>
25 : #include <xmloff/xmlnmspe.hxx>
26 : #include <xmloff/nmspmap.hxx>
27 : #include "xmlEnums.hxx"
28 : #include "xmlDatabaseDescription.hxx"
29 : #include "xmlConnectionResource.hxx"
30 : #include "xmlstrings.hrc"
31 : #include <tools/debug.hxx>
32 : #include <tools/diagnose_ex.h>
33 :
34 : namespace dbaxml
35 : {
36 : using namespace ::com::sun::star::uno;
37 : using namespace ::com::sun::star::xml::sax;
38 : DBG_NAME(OXMLConnectionData)
39 :
40 0 : OXMLConnectionData::OXMLConnectionData( ODBFilter& rImport,
41 : sal_uInt16 nPrfx, const ::rtl::OUString& _sLocalName) :
42 : SvXMLImportContext( rImport, nPrfx, _sLocalName )
43 0 : ,m_bFoundOne(false)
44 : {
45 0 : rImport.setNewFormat(true);
46 : DBG_CTOR(OXMLConnectionData,NULL);
47 0 : }
48 : // -----------------------------------------------------------------------------
49 :
50 0 : OXMLConnectionData::~OXMLConnectionData()
51 : {
52 :
53 : DBG_DTOR(OXMLConnectionData,NULL);
54 0 : }
55 : // -----------------------------------------------------------------------------
56 :
57 0 : SvXMLImportContext* OXMLConnectionData::CreateChildContext(
58 : sal_uInt16 nPrefix,
59 : const ::rtl::OUString& rLocalName,
60 : const Reference< XAttributeList > & xAttrList )
61 : {
62 0 : SvXMLImportContext *pContext = 0;
63 0 : const SvXMLTokenMap& rTokenMap = GetOwnImport().GetDataSourceElemTokenMap();
64 :
65 0 : switch( rTokenMap.Get( nPrefix, rLocalName ) )
66 : {
67 : case XML_TOK_LOGIN:
68 0 : GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
69 0 : pContext = new OXMLLogin( GetOwnImport(), nPrefix, rLocalName,xAttrList );
70 0 : break;
71 : case XML_TOK_DATABASE_DESCRIPTION:
72 0 : if ( !m_bFoundOne )
73 : {
74 0 : m_bFoundOne = true;
75 0 : GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
76 0 : pContext = new OXMLDatabaseDescription( GetOwnImport(), nPrefix, rLocalName);
77 : }
78 0 : break;
79 : case XML_TOK_CONNECTION_RESOURCE:
80 0 : if ( !m_bFoundOne )
81 : {
82 0 : m_bFoundOne = true;
83 0 : GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
84 0 : pContext = new OXMLConnectionResource( GetOwnImport(), nPrefix, rLocalName,xAttrList );
85 : }
86 0 : break;
87 : case XML_TOK_COMPOUND_DATABASE:
88 0 : if ( !m_bFoundOne )
89 : {
90 0 : m_bFoundOne = true;
91 : OSL_FAIL("Not supported yet!");
92 : }
93 0 : break;
94 : }
95 :
96 0 : if( !pContext )
97 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
98 :
99 0 : return pContext;
100 : }
101 : // -----------------------------------------------------------------------------
102 0 : ODBFilter& OXMLConnectionData::GetOwnImport()
103 : {
104 0 : return static_cast<ODBFilter&>(GetImport());
105 : }
106 : // -----------------------------------------------------------------------------
107 : //----------------------------------------------------------------------------
108 : } // namespace dbaxml
109 : // -----------------------------------------------------------------------------
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|