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 <documenttype.hxx>
21 : :
22 : : #include <string.h>
23 : :
24 : : #include <entitiesmap.hxx>
25 : : #include <notationsmap.hxx>
26 : :
27 : :
28 : : namespace DOM
29 : : {
30 : :
31 : 0 : CDocumentType::CDocumentType(
32 : : CDocument const& rDocument, ::osl::Mutex const& rMutex,
33 : : xmlDtdPtr const pDtd)
34 : : : CDocumentType_Base(rDocument, rMutex,
35 : : NodeType_DOCUMENT_TYPE_NODE, reinterpret_cast<xmlNodePtr>(pDtd))
36 [ # # ]: 0 : , m_aDtdPtr(pDtd)
37 : : {
38 : 0 : }
39 : :
40 : : /**
41 : : A NamedNodeMap containing the general entities, both external and
42 : : internal, declared in the DTD.
43 : : */
44 : 0 : Reference< XNamedNodeMap > SAL_CALL CDocumentType::getEntities() throw (RuntimeException)
45 : : {
46 [ # # ]: 0 : ::osl::MutexGuard const g(m_rMutex);
47 : :
48 : 0 : Reference< XNamedNodeMap > aMap;
49 [ # # ]: 0 : if (m_aDtdPtr != NULL)
50 : : {
51 [ # # ][ # # ]: 0 : aMap.set(new CEntitiesMap(this));
[ # # ]
52 : : }
53 [ # # ]: 0 : return aMap;
54 : : }
55 : :
56 : : /**
57 : : The internal subset as a string, or null if there is none.
58 : : */
59 : 0 : OUString SAL_CALL CDocumentType::getInternalSubset() throw (RuntimeException)
60 : : {
61 : : OSL_ENSURE(false,
62 : : "CDocumentType::getInternalSubset: not implemented (#i113683#)");
63 : 0 : return OUString();
64 : : }
65 : :
66 : : /**
67 : : The name of DTD; i.e., the name immediately following the DOCTYPE
68 : : keyword.
69 : : */
70 : 0 : OUString SAL_CALL CDocumentType::getName() throw (RuntimeException)
71 : : {
72 [ # # ]: 0 : ::osl::MutexGuard const g(m_rMutex);
73 : :
74 : 0 : OUString aName;
75 [ # # ]: 0 : if (m_aDtdPtr != NULL)
76 : : {
77 [ # # ]: 0 : aName = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->name), RTL_TEXTENCODING_UTF8);
78 : : }
79 [ # # ]: 0 : return aName;
80 : : }
81 : :
82 : : /**
83 : : A NamedNodeMap containing the notations declared in the DTD.
84 : : */
85 : 0 : Reference< XNamedNodeMap > SAL_CALL CDocumentType::getNotations() throw (RuntimeException)
86 : : {
87 [ # # ]: 0 : ::osl::MutexGuard const g(m_rMutex);
88 : :
89 : 0 : Reference< XNamedNodeMap > aMap;
90 [ # # ]: 0 : if (m_aDtdPtr != NULL)
91 : : {
92 [ # # ][ # # ]: 0 : aMap.set(new CNotationsMap(this));
[ # # ]
93 : : }
94 [ # # ]: 0 : return aMap;
95 : : }
96 : :
97 : : /**
98 : : The public identifier of the external subset.
99 : : */
100 : 0 : OUString SAL_CALL CDocumentType::getPublicId() throw (RuntimeException)
101 : : {
102 [ # # ]: 0 : ::osl::MutexGuard const g(m_rMutex);
103 : :
104 : 0 : OUString aId;
105 [ # # ]: 0 : if (m_aDtdPtr != NULL)
106 : : {
107 [ # # ]: 0 : aId = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->ExternalID), RTL_TEXTENCODING_UTF8);
108 : : }
109 [ # # ]: 0 : return aId;
110 : : }
111 : :
112 : : /**
113 : : The system identifier of the external subset.
114 : : */
115 : 0 : OUString SAL_CALL CDocumentType::getSystemId() throw (RuntimeException)
116 : : {
117 [ # # ]: 0 : ::osl::MutexGuard const g(m_rMutex);
118 : :
119 : 0 : OUString aId;
120 [ # # ]: 0 : if (m_aDtdPtr != NULL)
121 : : {
122 [ # # ]: 0 : aId = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->SystemID), RTL_TEXTENCODING_UTF8);
123 : : }
124 [ # # ]: 0 : return aId;
125 : : }
126 : :
127 : 0 : OUString SAL_CALL CDocumentType::getNodeName()throw (RuntimeException)
128 : : {
129 : 0 : return getName();
130 : : }
131 : :
132 : 0 : OUString SAL_CALL CDocumentType::getNodeValue() throw (RuntimeException)
133 : : {
134 : 0 : return OUString();
135 : : }
136 : : }
137 : :
138 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|