2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-16 20:28:09 +00:00
|
|
|
|
2001-02-08 15:02:52 +00:00
|
|
|
#include <SwXMLBlockImport.hxx>
|
2001-07-11 10:32:23 +00:00
|
|
|
#include <xmloff/nmspmap.hxx>
|
|
|
|
#include <xmloff/xmlnmspe.hxx>
|
|
|
|
#include <SwXMLBlockListContext.hxx>
|
|
|
|
#include <SwXMLTextBlocks.hxx>
|
2001-02-08 15:02:52 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star;
|
2001-07-11 10:32:23 +00:00
|
|
|
using namespace ::xmloff::token;
|
2001-02-08 15:02:52 +00:00
|
|
|
|
2010-12-12 10:15:19 +01:00
|
|
|
sal_Char const sXML_np__block_list[] = "_block-list";
|
|
|
|
sal_Char const sXML_np__office[] = "_ooffice";
|
|
|
|
sal_Char const sXML_np__text[] = "_otext";
|
2001-02-08 15:02:52 +00:00
|
|
|
|
2004-05-03 12:13:52 +00:00
|
|
|
SwXMLBlockListImport::SwXMLBlockListImport(
|
2013-02-04 13:20:48 +02:00
|
|
|
const uno::Reference< uno::XComponentContext > xContext,
|
2004-05-03 12:13:52 +00:00
|
|
|
SwXMLTextBlocks &rBlocks )
|
2013-02-04 13:20:48 +02:00
|
|
|
: SvXMLImport( xContext, 0 ),
|
2004-05-03 12:13:52 +00:00
|
|
|
rBlockList (rBlocks)
|
2001-02-08 15:02:52 +00:00
|
|
|
{
|
2013-03-01 13:50:58 +01:00
|
|
|
GetNamespaceMap().Add( OUString ( sXML_np__block_list ),
|
2001-07-11 10:32:23 +00:00
|
|
|
GetXMLToken ( XML_N_BLOCK_LIST ),
|
|
|
|
XML_NAMESPACE_BLOCKLIST );
|
2001-02-08 15:02:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwXMLBlockListImport::~SwXMLBlockListImport ( void )
|
2001-09-13 10:40:05 +00:00
|
|
|
throw ()
|
2001-02-08 15:02:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext *SwXMLBlockListImport::CreateContext(
|
|
|
|
sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName,
|
2007-06-05 16:30:20 +00:00
|
|
|
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
|
2001-02-08 15:02:52 +00:00
|
|
|
{
|
|
|
|
SvXMLImportContext *pContext = 0;
|
2001-07-11 10:32:23 +00:00
|
|
|
if ( XML_NAMESPACE_BLOCKLIST == nPrefix &&
|
|
|
|
IsXMLToken ( rLocalName, XML_BLOCK_LIST ) )
|
2001-02-08 15:02:52 +00:00
|
|
|
pContext = new SwXMLBlockListContext( *this, nPrefix, rLocalName,
|
|
|
|
xAttrList );
|
|
|
|
else
|
|
|
|
pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
2004-05-03 12:13:52 +00:00
|
|
|
SwXMLTextBlockImport::SwXMLTextBlockImport(
|
2013-02-04 13:20:48 +02:00
|
|
|
const uno::Reference< uno::XComponentContext > xContext,
|
2004-05-03 12:13:52 +00:00
|
|
|
SwXMLTextBlocks &rBlocks,
|
2013-07-26 15:37:08 +02:00
|
|
|
OUString & rNewText,
|
2004-05-03 12:13:52 +00:00
|
|
|
sal_Bool bNewTextOnly )
|
2013-02-04 13:20:48 +02:00
|
|
|
: SvXMLImport(xContext, IMPORT_ALL ),
|
2004-05-03 12:13:52 +00:00
|
|
|
rBlockList ( rBlocks ),
|
|
|
|
bTextOnly ( bNewTextOnly ),
|
|
|
|
m_rText ( rNewText )
|
2001-02-08 15:02:52 +00:00
|
|
|
{
|
2013-03-01 13:50:58 +01:00
|
|
|
GetNamespaceMap().Add( OUString( sXML_np__office ),
|
2004-07-13 08:05:30 +00:00
|
|
|
GetXMLToken(XML_N_OFFICE_OOO),
|
|
|
|
XML_NAMESPACE_OFFICE );
|
2013-03-01 13:50:58 +01:00
|
|
|
GetNamespaceMap().Add( OUString( sXML_np__text ),
|
2004-07-13 08:05:30 +00:00
|
|
|
GetXMLToken(XML_N_TEXT_OOO),
|
|
|
|
XML_NAMESPACE_TEXT );
|
2001-02-08 15:02:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwXMLTextBlockImport::~SwXMLTextBlockImport ( void )
|
2001-09-13 10:40:05 +00:00
|
|
|
throw()
|
2001-02-08 15:02:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext *SwXMLTextBlockImport::CreateContext(
|
|
|
|
sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName,
|
2007-06-05 16:30:20 +00:00
|
|
|
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
|
2001-02-08 15:02:52 +00:00
|
|
|
{
|
|
|
|
SvXMLImportContext *pContext = 0;
|
2001-05-02 15:44:35 +00:00
|
|
|
if( XML_NAMESPACE_OFFICE == nPrefix &&
|
2001-07-11 10:32:23 +00:00
|
|
|
IsXMLToken ( rLocalName, bTextOnly ? XML_DOCUMENT : XML_DOCUMENT_CONTENT ) )
|
2001-02-08 15:02:52 +00:00
|
|
|
pContext = new SwXMLTextBlockDocumentContext( *this, nPrefix, rLocalName, xAttrList );
|
|
|
|
else
|
|
|
|
pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
void SAL_CALL SwXMLTextBlockImport::endDocument(void)
|
2007-09-27 08:09:31 +00:00
|
|
|
throw( xml::sax::SAXException, uno::RuntimeException )
|
2001-02-08 15:02:52 +00:00
|
|
|
{
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|