2001-01-10 19:51:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:56:57 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2008-04-10 21:56:57 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2008-04-10 21:56:57 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2008-04-10 21:56:57 +00:00
|
|
|
* $RCSfile: XMLChangeElementImportContext.cxx,v $
|
|
|
|
* $Revision: 1.9 $
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2008-04-10 21:56:57 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2008-04-10 21:56:57 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2008-04-10 21:56:57 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2008-04-10 21:56:57 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 10:03:28 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_xmloff.hxx"
|
2001-01-10 19:51:01 +00:00
|
|
|
#include "XMLChangeElementImportContext.hxx"
|
|
|
|
#include "XMLChangedRegionImportContext.hxx"
|
|
|
|
#include "XMLChangeInfoContext.hxx"
|
|
|
|
#include <com/sun/star/uno/Reference.h>
|
2007-06-27 14:54:47 +00:00
|
|
|
#include <xmloff/xmlimp.hxx>
|
2001-01-10 19:51:01 +00:00
|
|
|
#include "xmlnmspe.hxx"
|
2007-06-27 14:54:47 +00:00
|
|
|
#include <xmloff/xmltoken.hxx>
|
2001-01-10 19:51:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using ::rtl::OUString;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::xml::sax::XAttributeList;
|
2001-06-29 14:39:36 +00:00
|
|
|
using ::xmloff::token::IsXMLToken;
|
|
|
|
using ::xmloff::token::XML_P;
|
|
|
|
using ::xmloff::token::XML_CHANGE_INFO;
|
2001-01-10 19:51:01 +00:00
|
|
|
|
|
|
|
TYPEINIT1( XMLChangeElementImportContext, SvXMLImportContext );
|
|
|
|
|
|
|
|
XMLChangeElementImportContext::XMLChangeElementImportContext(
|
|
|
|
SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName,
|
|
|
|
sal_Bool bAccContent,
|
|
|
|
XMLChangedRegionImportContext& rParent) :
|
|
|
|
SvXMLImportContext(rImport, nPrefix, rLocalName),
|
|
|
|
bAcceptContent(bAccContent),
|
|
|
|
rChangedRegion(rParent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext* XMLChangeElementImportContext::CreateChildContext(
|
|
|
|
sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName,
|
|
|
|
const Reference<XAttributeList> & xAttrList)
|
|
|
|
{
|
|
|
|
SvXMLImportContext* pContext = NULL;
|
|
|
|
|
|
|
|
if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
|
2001-06-29 14:39:36 +00:00
|
|
|
IsXMLToken( rLocalName, XML_CHANGE_INFO) )
|
2001-01-10 19:51:01 +00:00
|
|
|
{
|
|
|
|
pContext = new XMLChangeInfoContext(GetImport(), nPrefix, rLocalName,
|
|
|
|
rChangedRegion, GetLocalName());
|
|
|
|
}
|
2001-06-29 14:39:36 +00:00
|
|
|
else
|
2001-01-10 19:51:01 +00:00
|
|
|
{
|
2001-06-29 14:39:36 +00:00
|
|
|
// import into redline -> create XText
|
2001-01-10 19:51:01 +00:00
|
|
|
rChangedRegion.UseRedlineText();
|
2001-06-29 14:39:36 +00:00
|
|
|
|
2001-01-10 19:51:01 +00:00
|
|
|
pContext = GetImport().GetTextImport()->CreateTextChildContext(
|
2001-03-13 14:50:56 +00:00
|
|
|
GetImport(), nPrefix, rLocalName, xAttrList,
|
|
|
|
XML_TEXT_TYPE_CHANGED_REGION);
|
2001-01-10 19:51:01 +00:00
|
|
|
|
2001-06-29 14:39:36 +00:00
|
|
|
if (NULL == pContext)
|
|
|
|
{
|
|
|
|
// no text element -> use default
|
|
|
|
pContext = SvXMLImportContext::CreateChildContext(
|
|
|
|
nPrefix, rLocalName, xAttrList);
|
|
|
|
|
|
|
|
// illegal element content! TODO: discard this redline!
|
|
|
|
}
|
2001-01-10 19:51:01 +00:00
|
|
|
}
|
|
|
|
|
2001-06-29 14:39:36 +00:00
|
|
|
|
2001-01-10 19:51:01 +00:00
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
2003-04-08 14:29:49 +00:00
|
|
|
// #107848#
|
2006-06-19 17:38:39 +00:00
|
|
|
void XMLChangeElementImportContext::StartElement( const Reference< XAttributeList >& )
|
2003-04-08 14:29:49 +00:00
|
|
|
{
|
|
|
|
if(bAcceptContent)
|
|
|
|
{
|
|
|
|
GetImport().GetTextImport()->SetInsideDeleteContext(sal_True);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// #107848#
|
|
|
|
void XMLChangeElementImportContext::EndElement()
|
|
|
|
{
|
|
|
|
if(bAcceptContent)
|
|
|
|
{
|
|
|
|
GetImport().GetTextImport()->SetInsideDeleteContext(sal_False);
|
|
|
|
}
|
|
|
|
}
|