1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XMLChangeInfoContext.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include "XMLChangeInfoContext.hxx"
34 #include "XMLChangedRegionImportContext.hxx"
35 #include "XMLStringBufferImportContext.hxx"
36 #include <com/sun/star/uno/Reference.h>
37 #include "xmlnmspe.hxx"
38 #include <xmloff/nmspmap.hxx>
39 #include <xmloff/xmltoken.hxx>
40 #include <xmloff/xmlimp.hxx>
44 using namespace ::xmloff::token
;
46 using ::rtl::OUString
;
47 using ::com::sun::star::uno::Reference
;
48 using ::com::sun::star::xml::sax::XAttributeList
;
51 TYPEINIT1(XMLChangeInfoContext
, SvXMLImportContext
);
53 XMLChangeInfoContext::XMLChangeInfoContext(
56 const OUString
& rLocalName
,
57 XMLChangedRegionImportContext
& rPParent
,
58 const OUString
& rChangeType
)
59 : SvXMLImportContext(rImport
, nPrefix
, rLocalName
)
61 , rChangedRegion(rPParent
)
65 XMLChangeInfoContext::~XMLChangeInfoContext()
69 void XMLChangeInfoContext::StartElement(const Reference
<XAttributeList
> &)
74 SvXMLImportContext
* XMLChangeInfoContext::CreateChildContext(
76 const OUString
& rLocalName
,
77 const Reference
<XAttributeList
>& xAttrList
)
79 SvXMLImportContext
* pContext
= NULL
;
81 if( XML_NAMESPACE_DC
== nPrefix
)
83 if( IsXMLToken( rLocalName
, XML_CREATOR
) )
84 pContext
= new XMLStringBufferImportContext(GetImport(), nPrefix
,
85 rLocalName
, sAuthorBuffer
);
86 else if( IsXMLToken( rLocalName
, XML_DATE
) )
87 pContext
= new XMLStringBufferImportContext(GetImport(), nPrefix
,
88 rLocalName
, sDateTimeBuffer
);
90 else if ( ( XML_NAMESPACE_TEXT
== nPrefix
) &&
91 IsXMLToken( rLocalName
, XML_P
) )
93 pContext
= new XMLStringBufferImportContext(GetImport(), nPrefix
,
94 rLocalName
, sCommentBuffer
);
99 pContext
= SvXMLImportContext::CreateChildContext(nPrefix
, rLocalName
,
106 void XMLChangeInfoContext::EndElement()
108 // set values at changed region context
109 rChangedRegion
.SetChangeInfo(rType
, sAuthorBuffer
.makeStringAndClear(),
110 sCommentBuffer
.makeStringAndClear(),
111 sDateTimeBuffer
.makeStringAndClear());