2001-01-10 19:51:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 14:00:04 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2005-09-09 14:00:04 +00:00
|
|
|
* $RCSfile: XMLChangeInfoContext.cxx,v $
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2006-06-19 17:38:50 +00:00
|
|
|
* $Revision: 1.6 $
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2006-06-19 17:38:50 +00:00
|
|
|
* last change: $Author: hr $ $Date: 2006-06-19 18:38:50 $
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2005-09-09 14:00:04 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 14:00:04 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2005-09-09 14:00:04 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2005-09-09 14:00:04 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2005-09-09 14:00:04 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLCHANGEINFOCONTEXT_HXX
|
|
|
|
#include "XMLChangeInfoContext.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLCHANGEDREGIONIMPORTCONTEXT_HXX
|
|
|
|
#include "XMLChangedRegionImportContext.hxx"
|
|
|
|
#endif
|
|
|
|
|
2001-01-24 15:49:52 +00:00
|
|
|
#ifndef _XMLOFF_XMLSTRINGBUFFERIMPORTCONTEXT_HXX
|
|
|
|
#include "XMLStringBufferImportContext.hxx"
|
|
|
|
#endif
|
|
|
|
|
2001-01-10 19:51:01 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
|
|
|
|
#include <com/sun/star/uno/Reference.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLNMSPE_HXX
|
|
|
|
#include "xmlnmspe.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_NMSPMAP_HXX
|
|
|
|
#include "nmspmap.hxx"
|
|
|
|
#endif
|
|
|
|
|
2001-06-29 20:07:26 +00:00
|
|
|
#ifndef _XMLOFF_XMLTOKEN_HXX
|
|
|
|
#include "xmltoken.hxx"
|
2001-01-10 19:51:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLIMP_HXX
|
|
|
|
#include "xmlimp.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-06-29 20:07:26 +00:00
|
|
|
using namespace ::xmloff::token;
|
|
|
|
|
2001-01-10 19:51:01 +00:00
|
|
|
using ::rtl::OUString;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::xml::sax::XAttributeList;
|
|
|
|
|
|
|
|
|
|
|
|
TYPEINIT1(XMLChangeInfoContext, SvXMLImportContext);
|
|
|
|
|
|
|
|
XMLChangeInfoContext::XMLChangeInfoContext(
|
|
|
|
SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName,
|
|
|
|
XMLChangedRegionImportContext& rPParent,
|
2006-06-19 17:38:50 +00:00
|
|
|
const OUString& rChangeType)
|
|
|
|
: SvXMLImportContext(rImport, nPrefix, rLocalName)
|
|
|
|
, rType(rChangeType)
|
|
|
|
, rChangedRegion(rPParent)
|
2001-01-10 19:51:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLChangeInfoContext::~XMLChangeInfoContext()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-06-19 17:38:50 +00:00
|
|
|
void XMLChangeInfoContext::StartElement(const Reference<XAttributeList> &)
|
2001-01-10 19:51:01 +00:00
|
|
|
{
|
2004-07-13 07:30:52 +00:00
|
|
|
// no attributes
|
2001-01-24 15:49:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext* XMLChangeInfoContext::CreateChildContext(
|
|
|
|
USHORT nPrefix,
|
|
|
|
const OUString& rLocalName,
|
|
|
|
const Reference<XAttributeList >& xAttrList )
|
|
|
|
{
|
|
|
|
SvXMLImportContext* pContext = NULL;
|
|
|
|
|
2004-07-13 07:30:52 +00:00
|
|
|
if( XML_NAMESPACE_DC == nPrefix )
|
|
|
|
{
|
|
|
|
if( IsXMLToken( rLocalName, XML_CREATOR ) )
|
|
|
|
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
|
|
|
|
rLocalName, sAuthorBuffer);
|
|
|
|
else if( IsXMLToken( rLocalName, XML_DATE ) )
|
|
|
|
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
|
|
|
|
rLocalName, sDateTimeBuffer);
|
|
|
|
}
|
|
|
|
else if ( ( XML_NAMESPACE_TEXT == nPrefix ) &&
|
2001-06-29 20:07:26 +00:00
|
|
|
IsXMLToken( rLocalName, XML_P ) )
|
2001-01-24 15:49:52 +00:00
|
|
|
{
|
|
|
|
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
|
|
|
|
rLocalName, sCommentBuffer);
|
|
|
|
}
|
2004-07-13 07:30:52 +00:00
|
|
|
|
|
|
|
if( !pContext )
|
2001-01-24 15:49:52 +00:00
|
|
|
{
|
|
|
|
pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
|
|
|
|
xAttrList);
|
|
|
|
}
|
|
|
|
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
void XMLChangeInfoContext::EndElement()
|
|
|
|
{
|
2001-01-10 19:51:01 +00:00
|
|
|
// set values at changed region context
|
2004-07-13 07:30:52 +00:00
|
|
|
rChangedRegion.SetChangeInfo(rType, sAuthorBuffer.makeStringAndClear(),
|
2001-01-24 15:49:52 +00:00
|
|
|
sCommentBuffer.makeStringAndClear(),
|
2004-07-13 07:30:52 +00:00
|
|
|
sDateTimeBuffer.makeStringAndClear());
|
2001-01-10 19:51:01 +00:00
|
|
|
}
|