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