Bump version to 6.4-15
[LibreOffice.git] / unoxml / source / dom / documenttype.cxx
blobd79e2d0d0f24b014ffd8afc3f30e41e70850a0b6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "documenttype.hxx"
22 #include <string.h>
24 #include <osl/diagnose.h>
26 #include "entitiesmap.hxx"
27 #include "notationsmap.hxx"
29 using namespace css::uno;
30 using namespace css::xml::dom;
32 namespace DOM
35 CDocumentType::CDocumentType(
36 CDocument const& rDocument, ::osl::Mutex const& rMutex,
37 xmlDtdPtr const pDtd)
38 : CDocumentType_Base(rDocument, rMutex,
39 NodeType_DOCUMENT_TYPE_NODE, reinterpret_cast<xmlNodePtr>(pDtd))
40 , m_aDtdPtr(pDtd)
44 /**
45 A NamedNodeMap containing the general entities, both external and
46 internal, declared in the DTD.
48 css::uno::Reference< XNamedNodeMap > SAL_CALL CDocumentType::getEntities()
50 ::osl::MutexGuard const g(m_rMutex);
52 css::uno::Reference< XNamedNodeMap > aMap;
53 if (m_aDtdPtr != nullptr)
55 aMap.set(new CEntitiesMap);
57 return aMap;
60 /**
61 The internal subset as a string, or null if there is none.
63 OUString SAL_CALL CDocumentType::getInternalSubset()
65 OSL_ENSURE(false,
66 "CDocumentType::getInternalSubset: not implemented (#i113683#)");
67 return OUString();
70 /**
71 The name of DTD; i.e., the name immediately following the DOCTYPE
72 keyword.
74 OUString SAL_CALL CDocumentType::getName()
76 ::osl::MutexGuard const g(m_rMutex);
78 OUString aName;
79 if (m_aDtdPtr != nullptr)
81 aName = OUString(reinterpret_cast<char const *>(m_aDtdPtr->name), strlen(reinterpret_cast<char const *>(m_aDtdPtr->name)), RTL_TEXTENCODING_UTF8);
83 return aName;
86 /**
87 A NamedNodeMap containing the notations declared in the DTD.
89 css::uno::Reference< XNamedNodeMap > SAL_CALL CDocumentType::getNotations()
91 ::osl::MutexGuard const g(m_rMutex);
93 css::uno::Reference< XNamedNodeMap > aMap;
94 if (m_aDtdPtr != nullptr)
96 aMap.set(new CNotationsMap);
98 return aMap;
102 The public identifier of the external subset.
104 OUString SAL_CALL CDocumentType::getPublicId()
106 ::osl::MutexGuard const g(m_rMutex);
108 OUString aId;
109 if (m_aDtdPtr != nullptr)
111 aId = OUString(reinterpret_cast<char const *>(m_aDtdPtr->name), strlen(reinterpret_cast<char const *>(m_aDtdPtr->ExternalID)), RTL_TEXTENCODING_UTF8);
113 return aId;
117 The system identifier of the external subset.
119 OUString SAL_CALL CDocumentType::getSystemId()
121 ::osl::MutexGuard const g(m_rMutex);
123 OUString aId;
124 if (m_aDtdPtr != nullptr)
126 aId = OUString(reinterpret_cast<char const *>(m_aDtdPtr->name), strlen(reinterpret_cast<char const *>(m_aDtdPtr->SystemID)), RTL_TEXTENCODING_UTF8);
128 return aId;
131 OUString SAL_CALL CDocumentType::getNodeName()
133 return getName();
136 OUString SAL_CALL CDocumentType::getNodeValue()
138 return OUString();
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */