1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "XMLChangeElementImportContext.hxx"
21 #include "XMLChangedRegionImportContext.hxx"
22 #include "XMLChangeInfoContext.hxx"
23 #include <com/sun/star/uno/Reference.h>
24 #include <xmloff/xmlimp.hxx>
25 #include <xmloff/xmlnmspe.hxx>
26 #include <xmloff/xmltoken.hxx>
30 using ::com::sun::star::uno::Reference
;
31 using ::com::sun::star::xml::sax::XAttributeList
;
32 using ::xmloff::token::IsXMLToken
;
33 using ::xmloff::token::XML_P
;
34 using ::xmloff::token::XML_CHANGE_INFO
;
36 TYPEINIT1( XMLChangeElementImportContext
, SvXMLImportContext
);
38 XMLChangeElementImportContext::XMLChangeElementImportContext(
41 const OUString
& rLocalName
,
43 XMLChangedRegionImportContext
& rParent
) :
44 SvXMLImportContext(rImport
, nPrefix
, rLocalName
),
45 bAcceptContent(bAccContent
),
46 rChangedRegion(rParent
)
50 SvXMLImportContext
* XMLChangeElementImportContext::CreateChildContext(
52 const OUString
& rLocalName
,
53 const Reference
<XAttributeList
> & xAttrList
)
55 SvXMLImportContext
* pContext
= NULL
;
57 if ( (XML_NAMESPACE_OFFICE
== nPrefix
) &&
58 IsXMLToken( rLocalName
, XML_CHANGE_INFO
) )
60 pContext
= new XMLChangeInfoContext(GetImport(), nPrefix
, rLocalName
,
61 rChangedRegion
, GetLocalName());
65 // import into redline -> create XText
66 rChangedRegion
.UseRedlineText();
68 pContext
= GetImport().GetTextImport()->CreateTextChildContext(
69 GetImport(), nPrefix
, rLocalName
, xAttrList
,
70 XML_TEXT_TYPE_CHANGED_REGION
);
75 // illegal element content! TODO: discard this redline!
76 // for the moment -> use default
77 pContext
= SvXMLImportContext::CreateChildContext(
78 nPrefix
, rLocalName
, xAttrList
);
86 void XMLChangeElementImportContext::StartElement( const Reference
< XAttributeList
>& )
90 GetImport().GetTextImport()->SetInsideDeleteContext(true);
95 void XMLChangeElementImportContext::EndElement()
99 GetImport().GetTextImport()->SetInsideDeleteContext(false);
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */