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 <svgio/svgreader/svgtrefnode.hxx>
21 : #include <svgio/svgreader/svgdocument.hxx>
22 :
23 :
24 :
25 : namespace svgio
26 : {
27 : namespace svgreader
28 : {
29 0 : SvgTrefNode::SvgTrefNode(
30 : SvgDocument& rDocument,
31 : SvgNode* pParent)
32 : : SvgNode(SVGTokenTref, rDocument, pParent),
33 : maSvgStyleAttributes(*this),
34 0 : maXLink()
35 : {
36 0 : }
37 :
38 0 : SvgTrefNode::~SvgTrefNode()
39 : {
40 0 : }
41 :
42 0 : const SvgStyleAttributes* SvgTrefNode::getSvgStyleAttributes() const
43 : {
44 0 : return &maSvgStyleAttributes;
45 : }
46 :
47 0 : void SvgTrefNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
48 : {
49 : // call parent
50 0 : SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
51 :
52 : // read style attributes
53 0 : maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent);
54 :
55 : // parse own
56 0 : switch(aSVGToken)
57 : {
58 : case SVGTokenStyle:
59 : {
60 0 : maSvgStyleAttributes.readStyle(aContent);
61 0 : break;
62 : }
63 : case SVGTokenXlinkHref:
64 : {
65 0 : const sal_Int32 nLen(aContent.getLength());
66 :
67 0 : if(nLen && '#' == aContent[0])
68 : {
69 0 : maXLink = aContent.copy(1);
70 : }
71 0 : break;
72 : }
73 : default:
74 : {
75 0 : break;
76 : }
77 : }
78 0 : }
79 :
80 0 : const SvgTextNode* SvgTrefNode::getReferencedSvgTextNode() const
81 : {
82 0 : return dynamic_cast< const SvgTextNode* >(getDocument().findSvgNodeById(maXLink));
83 : }
84 :
85 : } // end of namespace svgreader
86 : } // end of namespace svgio
87 :
88 :
89 : // eof
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|