/src/libreoffice/xmloff/source/text/XMLChangeImportContext.cxx
Line | Count | Source |
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 "XMLChangeImportContext.hxx" |
21 | | #include <xmloff/xmlimp.hxx> |
22 | | #include <xmloff/xmlnamespace.hxx> |
23 | | #include <xmloff/xmltoken.hxx> |
24 | | #include <sal/log.hxx> |
25 | | |
26 | | using ::com::sun::star::uno::Reference; |
27 | | using ::xmloff::token::XML_CHANGE_ID; |
28 | | |
29 | | |
30 | | XMLChangeImportContext::XMLChangeImportContext( |
31 | | SvXMLImport& rImport, |
32 | | Element const eElement, |
33 | | bool bOutsideOfParagraph) |
34 | 5 | : SvXMLImportContext(rImport) |
35 | 5 | , m_Element(eElement) |
36 | 5 | , m_bIsOutsideOfParagraph(bOutsideOfParagraph) |
37 | 5 | { |
38 | 5 | } |
39 | | |
40 | | XMLChangeImportContext::~XMLChangeImportContext() |
41 | 5 | { |
42 | 5 | } |
43 | | |
44 | | void XMLChangeImportContext::startFastElement( |
45 | | sal_Int32 /*nElement*/, |
46 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) |
47 | 5 | { |
48 | 5 | for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) |
49 | 0 | { |
50 | 0 | switch(aIter.getToken()) |
51 | 0 | { |
52 | 0 | case XML_ELEMENT(TEXT, XML_CHANGE_ID): |
53 | 0 | { |
54 | | // Id found! Now call RedlineImportHelper |
55 | | |
56 | | // prepare parameters |
57 | 0 | rtl::Reference<XMLTextImportHelper> rHelper = |
58 | 0 | GetImport().GetTextImport(); |
59 | 0 | OUString sID = aIter.toString(); |
60 | | |
61 | | // <text:change> is both start and end |
62 | 0 | if (Element::START == m_Element || Element::POINT == m_Element) |
63 | 0 | rHelper->RedlineSetCursor(sID, true, m_bIsOutsideOfParagraph); |
64 | 0 | if (Element::END == m_Element || Element::POINT == m_Element) |
65 | 0 | rHelper->RedlineSetCursor(sID, false, m_bIsOutsideOfParagraph); |
66 | | |
67 | | // outside of paragraph and still open? set open redline ID |
68 | 0 | if (m_bIsOutsideOfParagraph) |
69 | 0 | { |
70 | 0 | rHelper->SetOpenRedlineId(sID); |
71 | 0 | } |
72 | 0 | break; |
73 | 0 | } |
74 | | // else: ignore |
75 | 0 | default: |
76 | 0 | XMLOFF_WARN_UNKNOWN("xmloff", aIter); |
77 | 0 | } |
78 | 0 | } |
79 | 5 | } |
80 | | |
81 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |