Branch data 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 "xmlDocuments.hxx"
21 : : #include "xmlfilter.hxx"
22 : : #include <xmloff/xmltoken.hxx>
23 : : #include <xmloff/xmlnmspe.hxx>
24 : : #include "xmlQuery.hxx"
25 : : #include "xmlTable.hxx"
26 : : #include "xmlComponent.hxx"
27 : : #include "xmlHierarchyCollection.hxx"
28 : : #include "xmlEnums.hxx"
29 : : #include "xmlstrings.hrc"
30 : : #include <tools/debug.hxx>
31 : :
32 : : namespace dbaxml
33 : : {
34 : : using namespace ::com::sun::star::uno;
35 : : using namespace ::com::sun::star::container;
36 : : using namespace ::com::sun::star::xml::sax;
37 : : DBG_NAME(OXMLDocuments)
38 : :
39 : 0 : OXMLDocuments::OXMLDocuments( ODBFilter& rImport
40 : : ,sal_uInt16 nPrfx
41 : : , const ::rtl::OUString& rLName
42 : : ,const Reference< XNameAccess >& _xContainer
43 : : ,const ::rtl::OUString& _sCollectionServiceName
44 : : ,const ::rtl::OUString& _sComponentServiceName) :
45 : : SvXMLImportContext( rImport, nPrfx, rLName )
46 : : ,m_xContainer(_xContainer)
47 : : ,m_sCollectionServiceName(_sCollectionServiceName)
48 : 0 : ,m_sComponentServiceName(_sComponentServiceName)
49 : : {
50 : : DBG_CTOR(OXMLDocuments,NULL);
51 : :
52 : 0 : }
53 : : // -----------------------------------------------------------------------------
54 : 12 : OXMLDocuments::OXMLDocuments( ODBFilter& rImport
55 : : ,sal_uInt16 nPrfx
56 : : , const ::rtl::OUString& rLName
57 : : ,const Reference< XNameAccess >& _xContainer
58 : : ,const ::rtl::OUString& _sCollectionServiceName
59 : : ) :
60 : : SvXMLImportContext( rImport, nPrfx, rLName )
61 : : ,m_xContainer(_xContainer)
62 : 12 : ,m_sCollectionServiceName(_sCollectionServiceName)
63 : : {
64 : : DBG_CTOR(OXMLDocuments,NULL);
65 : 12 : }
66 : : // -----------------------------------------------------------------------------
67 : :
68 : 12 : OXMLDocuments::~OXMLDocuments()
69 : : {
70 : :
71 : : DBG_DTOR(OXMLDocuments,NULL);
72 [ - + ]: 24 : }
73 : : // -----------------------------------------------------------------------------
74 : :
75 : 24 : SvXMLImportContext* OXMLDocuments::CreateChildContext(
76 : : sal_uInt16 nPrefix,
77 : : const ::rtl::OUString& rLocalName,
78 : : const Reference< XAttributeList > & xAttrList )
79 : : {
80 : 24 : SvXMLImportContext *pContext = 0;
81 : 24 : const SvXMLTokenMap& rTokenMap = GetOwnImport().GetDocumentsElemTokenMap();
82 : :
83 [ + - - - : 24 : switch( rTokenMap.Get( nPrefix, rLocalName ) )
- ]
84 : : {
85 : : case XML_TOK_TABLE:
86 : 24 : GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
87 [ + - ][ + - ]: 24 : pContext = new OXMLTable( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,SERVICE_SDB_TABLEDEFINITION);
88 : 24 : break;
89 : : case XML_TOK_QUERY:
90 : 0 : GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
91 [ # # ]: 0 : pContext = new OXMLQuery( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer );
92 : 0 : break;
93 : : case XML_TOK_COMPONENT:
94 : 0 : GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
95 [ # # ]: 0 : pContext = new OXMLComponent( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_sComponentServiceName );
96 : 0 : break;
97 : : case XML_TOK_COMPONENT_COLLECTION:
98 : 0 : GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
99 [ # # ]: 0 : pContext = new OXMLHierarchyCollection( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_sCollectionServiceName,m_sComponentServiceName );
100 : 0 : break;
101 : : }
102 : :
103 [ - + ]: 24 : if( !pContext )
104 [ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
105 : :
106 : :
107 : 24 : return pContext;
108 : : }
109 : : // -----------------------------------------------------------------------------
110 : 72 : ODBFilter& OXMLDocuments::GetOwnImport()
111 : : {
112 : 72 : return static_cast<ODBFilter&>(GetImport());
113 : : }
114 : : // -----------------------------------------------------------------------------
115 : : //----------------------------------------------------------------------------
116 : : } // namespace dbaxml
117 : : // -----------------------------------------------------------------------------
118 : :
119 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|