/src/libreoffice/xmloff/source/text/XMLChangeInfoContext.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 "XMLChangeInfoContext.hxx" |
21 | | #include "XMLChangedRegionImportContext.hxx" |
22 | | #include <XMLStringBufferImportContext.hxx> |
23 | | #include <com/sun/star/uno/Reference.h> |
24 | | #include <xmloff/xmlnamespace.hxx> |
25 | | #include <xmloff/xmltoken.hxx> |
26 | | #include <xmloff/xmlimp.hxx> |
27 | | #include <sal/log.hxx> |
28 | | |
29 | | |
30 | | using namespace ::xmloff::token; |
31 | | |
32 | | using ::com::sun::star::uno::Reference; |
33 | | |
34 | | |
35 | | XMLChangeInfoContext::XMLChangeInfoContext( |
36 | | SvXMLImport& rImport, |
37 | | XMLChangedRegionImportContext& rPParent, |
38 | | const OUString& rChangeType) |
39 | 0 | : SvXMLImportContext(rImport) |
40 | 0 | , rType(rChangeType) |
41 | 0 | , rChangedRegion(rPParent) |
42 | 0 | { |
43 | 0 | } |
44 | | |
45 | | XMLChangeInfoContext::~XMLChangeInfoContext() |
46 | 0 | { |
47 | 0 | } |
48 | | |
49 | | css::uno::Reference< css::xml::sax::XFastContextHandler > XMLChangeInfoContext::createFastChildContext( |
50 | | sal_Int32 nElement, |
51 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) |
52 | 0 | { |
53 | 0 | SvXMLImportContextRef xContext; |
54 | |
|
55 | 0 | switch (nElement) |
56 | 0 | { |
57 | 0 | case XML_ELEMENT(DC, XML_CREATOR): |
58 | 0 | xContext = new XMLStringBufferImportContext(GetImport(), sAuthorBuffer); |
59 | 0 | break; |
60 | 0 | case XML_ELEMENT(DC, XML_DATE): |
61 | 0 | xContext = new XMLStringBufferImportContext(GetImport(), sDateTimeBuffer); |
62 | 0 | break; |
63 | 0 | case XML_ELEMENT(LO_EXT, XML_MOVE_ID): |
64 | 0 | xContext = new XMLStringBufferImportContext(GetImport(), sMovedIDBuffer); |
65 | 0 | break; |
66 | 0 | case XML_ELEMENT(TEXT, XML_P): |
67 | 0 | case XML_ELEMENT(LO_EXT, XML_P): |
68 | 0 | xContext = new XMLStringBufferImportContext(GetImport(), sCommentBuffer); |
69 | 0 | break; |
70 | 0 | default: |
71 | 0 | XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); |
72 | 0 | } |
73 | | |
74 | 0 | return xContext; |
75 | 0 | } |
76 | | |
77 | | void XMLChangeInfoContext::endFastElement(sal_Int32 ) |
78 | 0 | { |
79 | | // set values at changed region context |
80 | 0 | rChangedRegion.SetChangeInfo(rType, sAuthorBuffer.makeStringAndClear(), |
81 | 0 | sCommentBuffer.makeStringAndClear(), sDateTimeBuffer, |
82 | 0 | sMovedIDBuffer.makeStringAndClear()); |
83 | 0 | sDateTimeBuffer.setLength(0); |
84 | 0 | } |
85 | | |
86 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |