2001-01-10 19:51:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 13:58:59 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2005-09-09 13:58:59 +00:00
|
|
|
* $RCSfile: XMLChangeElementImportContext.cxx,v $
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2007-06-27 14:54:47 +00:00
|
|
|
* $Revision: 1.8 $
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2007-06-27 14:54:47 +00:00
|
|
|
* last change: $Author: hr $ $Date: 2007-06-27 15:52:42 $
|
2001-01-10 19:51:01 +00:00
|
|
|
*
|
2005-09-09 13:58:59 +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 13:58:59 +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 13:58:59 +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 13:58:59 +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 13:58:59 +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
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
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
|
|
|
#ifndef _XMLOFF_XMLCHANGEELEMENTIMPORTCONTEXT_HXX
|
|
|
|
#include "XMLChangeElementImportContext.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLCHANGEDREGIONIMPORTCONTEXT_HXX
|
|
|
|
#include "XMLChangedRegionImportContext.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLCHANGEINFOCONTEXT_HXX
|
|
|
|
#include "XMLChangeInfoContext.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
|
|
|
|
#include <com/sun/star/uno/Reference.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLIMP_HXX
|
2007-06-27 14:54:47 +00:00
|
|
|
#include <xmloff/xmlimp.hxx>
|
2001-01-10 19:51:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLNMSPE_HXX
|
|
|
|
#include "xmlnmspe.hxx"
|
|
|
|
#endif
|
|
|
|
|
2001-06-29 14:39:36 +00:00
|
|
|
#ifndef _XMLOFF_XMLTOKEN_HXX
|
2007-06-27 14:54:47 +00:00
|
|
|
#include <xmloff/xmltoken.hxx>
|
2001-01-10 19:51:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|