2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-12 17:21:24 +00: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 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-01-03 15:13:13 +01:00
|
|
|
#include <osl/thread.h>
|
2013-02-04 13:20:48 +02:00
|
|
|
#include <comphelper/processfactory.hxx>
|
2007-01-23 07:51:56 +00:00
|
|
|
|
2007-06-27 14:05:34 +00:00
|
|
|
#include <xmloff/xmlscripti.hxx>
|
2014-04-09 12:04:12 +02:00
|
|
|
#include "facreg.hxx"
|
2000-12-05 22:31:17 +00:00
|
|
|
#include "sdxmlimp_impl.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "ximpbody.hxx"
|
|
|
|
|
2007-06-27 14:05:34 +00:00
|
|
|
#include <xmloff/xmlmetai.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "ximpstyl.hxx"
|
2013-11-11 22:30:35 -06:00
|
|
|
#include <xmloff/xmlnmspe.hxx>
|
2007-06-27 14:05:34 +00:00
|
|
|
#include <xmloff/xmltoken.hxx>
|
|
|
|
#include <xmloff/xmluconv.hxx>
|
|
|
|
#include <xmloff/DocumentSettingsContext.hxx>
|
2001-04-26 17:05:46 +00:00
|
|
|
#include <com/sun/star/form/XFormsSupplier.hpp>
|
2014-11-18 00:06:30 +01:00
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
|
|
|
|
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
|
|
|
|
#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
|
|
|
|
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
|
|
|
#include "sdpropls.hxx"
|
2007-06-27 14:05:34 +00:00
|
|
|
#include <xmloff/xmlexppr.hxx>
|
2013-11-11 22:30:35 -06:00
|
|
|
#include <xmloff/xmlerror.hxx>
|
2011-09-10 09:36:23 +01:00
|
|
|
#include <xmloff/settingsstore.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <com/sun/star/style/XStyle.hpp>
|
|
|
|
|
2007-06-27 14:05:34 +00:00
|
|
|
#include <xmloff/XMLFontStylesContext.hxx>
|
2007-01-23 07:51:56 +00:00
|
|
|
|
2008-02-26 12:35:47 +00:00
|
|
|
#include <com/sun/star/document/XDocumentProperties.hpp>
|
|
|
|
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
using namespace ::com::sun::star;
|
2001-06-15 16:16:59 +00:00
|
|
|
using namespace ::xmloff::token;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-07-13 07:09:19 +00:00
|
|
|
class SdXMLBodyContext_Impl : public SvXMLImportContext
|
|
|
|
{
|
2014-10-01 12:11:52 +02:00
|
|
|
SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
|
2004-07-13 07:09:19 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SdXMLBodyContext_Impl( SdXMLImport& rImport, sal_uInt16 nPrfx,
|
|
|
|
const OUString& rLName,
|
|
|
|
const uno::Reference< xml::sax::XAttributeList > & xAttrList );
|
|
|
|
virtual ~SdXMLBodyContext_Impl();
|
|
|
|
|
|
|
|
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName,
|
2015-10-12 16:04:04 +02:00
|
|
|
const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override;
|
2004-07-13 07:09:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SdXMLBodyContext_Impl::SdXMLBodyContext_Impl( SdXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrfx, const OUString& rLName,
|
2006-06-19 17:11:47 +00:00
|
|
|
const uno::Reference< xml::sax::XAttributeList > & ) :
|
2004-07-13 07:09:19 +00:00
|
|
|
SvXMLImportContext( rImport, nPrfx, rLName )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SdXMLBodyContext_Impl::~SdXMLBodyContext_Impl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext *SdXMLBodyContext_Impl::CreateChildContext(
|
2006-06-19 17:11:47 +00:00
|
|
|
sal_uInt16 /*nPrefix*/,
|
2004-07-13 07:09:19 +00:00
|
|
|
const OUString& rLocalName,
|
|
|
|
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
|
|
|
|
{
|
|
|
|
return GetSdImport().CreateBodyContext(rLocalName, xAttrList);
|
|
|
|
}
|
|
|
|
|
2008-02-26 12:35:47 +00:00
|
|
|
// NB: virtually inherit so we can multiply inherit properly
|
|
|
|
// in SdXMLFlatDocContext_Impl
|
|
|
|
class SdXMLDocContext_Impl : public virtual SvXMLImportContext
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-02-26 12:35:47 +00:00
|
|
|
protected:
|
2014-10-01 12:11:52 +02:00
|
|
|
SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
SdXMLDocContext_Impl(
|
|
|
|
SdXMLImport& rImport,
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 nPrfx,
|
2000-09-18 16:07:07 +00:00
|
|
|
const OUString& rLName,
|
|
|
|
const uno::Reference<xml::sax::XAttributeList>& xAttrList);
|
|
|
|
virtual ~SdXMLDocContext_Impl();
|
|
|
|
|
2004-11-26 12:00:12 +00:00
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
|
2000-09-18 16:07:07 +00:00
|
|
|
const OUString& rLocalName,
|
2015-10-12 16:04:04 +02:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>& xAttrList) override;
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SdXMLDocContext_Impl::SdXMLDocContext_Impl(
|
|
|
|
SdXMLImport& rImport,
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 nPrfx,
|
2000-09-18 16:07:07 +00:00
|
|
|
const OUString& rLName,
|
2006-06-19 17:11:47 +00:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>&)
|
2000-09-18 16:07:07 +00:00
|
|
|
: SvXMLImportContext(rImport, nPrfx, rLName)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SdXMLDocContext_Impl::~SdXMLDocContext_Impl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-11-26 12:00:12 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SvXMLImportContext *SdXMLDocContext_Impl::CreateChildContext(
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 nPrefix,
|
2000-09-18 16:07:07 +00:00
|
|
|
const OUString& rLocalName,
|
|
|
|
const uno::Reference<xml::sax::XAttributeList>& xAttrList)
|
|
|
|
{
|
2015-11-10 10:29:15 +01:00
|
|
|
SvXMLImportContext* pContext = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
const SvXMLTokenMap& rTokenMap = GetSdImport().GetDocElemTokenMap();
|
|
|
|
switch(rTokenMap.Get(nPrefix, rLocalName))
|
|
|
|
{
|
2007-01-23 07:51:56 +00:00
|
|
|
case XML_TOK_DOC_FONTDECLS:
|
|
|
|
{
|
|
|
|
pContext = GetSdImport().CreateFontDeclsContext( rLocalName, xAttrList );
|
|
|
|
break;
|
|
|
|
}
|
2001-03-27 21:03:08 +00:00
|
|
|
case XML_TOK_DOC_SETTINGS:
|
2001-02-21 17:04:45 +00:00
|
|
|
{
|
2014-12-25 15:17:55 +02:00
|
|
|
if( GetImport().getImportFlags() & SvXMLImportFlags::SETTINGS )
|
2001-03-01 15:31:32 +00:00
|
|
|
{
|
2001-03-27 21:03:08 +00:00
|
|
|
pContext = new XMLDocumentSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList );
|
2001-03-01 15:31:32 +00:00
|
|
|
}
|
2001-02-21 17:04:45 +00:00
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
case XML_TOK_DOC_STYLES:
|
|
|
|
{
|
2014-12-25 15:17:55 +02:00
|
|
|
if( GetImport().getImportFlags() & SvXMLImportFlags::STYLES )
|
2001-03-01 15:31:32 +00:00
|
|
|
{
|
|
|
|
// office:styles inside office:document
|
|
|
|
pContext = GetSdImport().CreateStylesContext(rLocalName, xAttrList);
|
|
|
|
}
|
2001-03-04 12:06:33 +00:00
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
case XML_TOK_DOC_AUTOSTYLES:
|
|
|
|
{
|
2014-12-25 15:17:55 +02:00
|
|
|
if( GetImport().getImportFlags() & SvXMLImportFlags::AUTOSTYLES )
|
2001-03-01 15:31:32 +00:00
|
|
|
{
|
|
|
|
// office:automatic-styles inside office:document
|
|
|
|
pContext = GetSdImport().CreateAutoStylesContext(rLocalName, xAttrList);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XML_TOK_DOC_MASTERSTYLES:
|
|
|
|
{
|
2014-12-25 15:17:55 +02:00
|
|
|
if( GetImport().getImportFlags() & SvXMLImportFlags::MASTERSTYLES )
|
2001-03-01 15:31:32 +00:00
|
|
|
{
|
|
|
|
// office:master-styles inside office:document
|
|
|
|
pContext = GetSdImport().CreateMasterStylesContext(rLocalName, xAttrList);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XML_TOK_DOC_META:
|
|
|
|
{
|
2013-05-04 01:40:09 +03:00
|
|
|
SAL_INFO("xmloff.draw", "XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2000-12-12 13:38:12 +00:00
|
|
|
case XML_TOK_DOC_SCRIPT:
|
|
|
|
{
|
2014-12-25 15:17:55 +02:00
|
|
|
if( GetImport().getImportFlags() & SvXMLImportFlags::SCRIPTS )
|
2001-03-01 15:31:32 +00:00
|
|
|
{
|
|
|
|
// office:script inside office:document
|
|
|
|
pContext = GetSdImport().CreateScriptContext( rLocalName );
|
|
|
|
}
|
2000-12-12 13:38:12 +00:00
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
case XML_TOK_DOC_BODY:
|
|
|
|
{
|
2014-12-25 15:17:55 +02:00
|
|
|
if( GetImport().getImportFlags() & SvXMLImportFlags::CONTENT )
|
2001-03-01 15:31:32 +00:00
|
|
|
{
|
|
|
|
// office:body inside office:document
|
2004-07-13 07:09:19 +00:00
|
|
|
pContext = new SdXMLBodyContext_Impl(GetSdImport(),nPrefix,
|
|
|
|
rLocalName, xAttrList);
|
2001-03-01 15:31:32 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// call parent when no own context was created
|
|
|
|
if(!pContext)
|
|
|
|
pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
|
|
|
|
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
2008-02-26 12:35:47 +00:00
|
|
|
// context for flat file xml format
|
|
|
|
class SdXMLFlatDocContext_Impl
|
|
|
|
: public SdXMLDocContext_Impl, public SvXMLMetaDocumentContext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 i_nPrefix, const OUString & i_rLName,
|
2008-02-26 12:35:47 +00:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
|
2012-09-12 10:24:08 +02:00
|
|
|
const uno::Reference<document::XDocumentProperties>& i_xDocProps);
|
2008-02-26 12:35:47 +00:00
|
|
|
|
|
|
|
virtual ~SdXMLFlatDocContext_Impl();
|
|
|
|
|
|
|
|
virtual SvXMLImportContext *CreateChildContext(
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
|
2015-10-12 16:04:04 +02:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>& i_xAttrList) override;
|
2008-02-26 12:35:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 i_nPrefix, const OUString & i_rLName,
|
2008-02-26 12:35:47 +00:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
|
2012-09-12 10:24:08 +02:00
|
|
|
const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
|
2008-02-26 12:35:47 +00:00
|
|
|
SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
|
|
|
|
SdXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
|
|
|
|
SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
|
2012-09-12 10:24:08 +02:00
|
|
|
i_xDocProps)
|
2008-02-26 12:35:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SdXMLFlatDocContext_Impl::~SdXMLFlatDocContext_Impl() { }
|
|
|
|
|
|
|
|
SvXMLImportContext *SdXMLFlatDocContext_Impl::CreateChildContext(
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
|
2008-02-26 12:35:47 +00:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
|
|
|
|
{
|
2015-06-23 20:42:27 +02:00
|
|
|
// behave like meta base class iff we encounter office:meta
|
2008-02-26 12:35:47 +00:00
|
|
|
const SvXMLTokenMap& rTokenMap = GetSdImport().GetDocElemTokenMap();
|
|
|
|
if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) {
|
|
|
|
return SvXMLMetaDocumentContext::CreateChildContext(
|
|
|
|
i_nPrefix, i_rLocalName, i_xAttrList );
|
|
|
|
} else {
|
|
|
|
return SdXMLDocContext_Impl::CreateChildContext(
|
|
|
|
i_nPrefix, i_rLocalName, i_xAttrList );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-13 07:09:19 +00:00
|
|
|
#define SERVICE(classname,servicename,implementationname,draw,flags)\
|
|
|
|
uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
|
|
|
|
{\
|
2015-11-06 09:23:33 +02:00
|
|
|
return uno::Sequence< OUString > { servicename };\
|
2004-07-13 07:09:19 +00:00
|
|
|
}\
|
|
|
|
OUString SAL_CALL classname##_getImplementationName() throw()\
|
|
|
|
{\
|
2015-11-06 09:23:33 +02:00
|
|
|
return OUString( implementationname );\
|
2004-07-13 07:09:19 +00:00
|
|
|
}\
|
|
|
|
uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\
|
|
|
|
{\
|
2015-06-08 16:30:03 +02:00
|
|
|
return static_cast<cppu::OWeakObject*>(new SdXMLImport( comphelper::getComponentContext(rSMgr), implementationname, draw, flags )); \
|
2001-03-01 15:31:32 +00:00
|
|
|
}
|
|
|
|
|
2014-12-25 15:17:55 +02:00
|
|
|
SERVICE( XMLImpressImportOasis, "com.sun.star.comp.Impress.XMLOasisImporter", "XMLImpressImportOasis", false, SvXMLImportFlags::ALL )
|
|
|
|
SERVICE( XMLDrawImportOasis, "com.sun.star.comp.Draw.XMLOasisImporter", "XMLDrawImportOasis", true, SvXMLImportFlags::ALL )
|
2001-03-04 15:10:26 +00:00
|
|
|
|
2014-12-25 15:17:55 +02:00
|
|
|
SERVICE( XMLImpressStylesImportOasis, "com.sun.star.comp.Impress.XMLOasisStylesImporter", "XMLImpressStylesImportOasis", false, SvXMLImportFlags::STYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::MASTERSTYLES )
|
|
|
|
SERVICE( XMLDrawStylesImportOasis, "com.sun.star.comp.Draw.XMLOasisStylesImporter", "XMLImpressStylesImportOasis", true, SvXMLImportFlags::STYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::MASTERSTYLES )
|
2001-03-04 15:10:26 +00:00
|
|
|
|
2014-12-25 15:17:55 +02:00
|
|
|
SERVICE( XMLImpressContentImportOasis, "com.sun.star.comp.Impress.XMLOasisContentImporter", "XMLImpressContentImportOasis", false, SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::CONTENT|SvXMLImportFlags::SCRIPTS|SvXMLImportFlags::FONTDECLS )
|
|
|
|
SERVICE( XMLDrawContentImportOasis, "com.sun.star.comp.Draw.XMLOasisContentImporter", "XMLImpressContentImportOasis", true, SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::CONTENT|SvXMLImportFlags::SCRIPTS|SvXMLImportFlags::FONTDECLS )
|
2001-03-04 15:10:26 +00:00
|
|
|
|
2014-12-25 15:17:55 +02:00
|
|
|
SERVICE( XMLImpressMetaImportOasis, "com.sun.star.comp.Impress.XMLOasisMetaImporter", "XMLImpressMetaImportOasis", false, SvXMLImportFlags::META )
|
|
|
|
SERVICE( XMLDrawMetaImportOasis, "com.sun.star.comp.Draw.XMLOasisMetaImporter", "XMLImpressMetaImportOasis", true, SvXMLImportFlags::META )
|
2001-03-04 15:10:26 +00:00
|
|
|
|
2014-12-25 15:17:55 +02:00
|
|
|
SERVICE( XMLImpressSettingsImportOasis, "com.sun.star.comp.Impress.XMLOasisSettingsImporter", "XMLImpressSettingsImportOasis", false, SvXMLImportFlags::SETTINGS )
|
|
|
|
SERVICE( XMLDrawSettingsImportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsImporter", "XMLImpressSettingsImportOasis", true, SvXMLImportFlags::SETTINGS )
|
2001-03-27 21:03:08 +00:00
|
|
|
|
2004-05-03 12:34:15 +00:00
|
|
|
SdXMLImport::SdXMLImport(
|
2015-11-26 08:43:00 +02:00
|
|
|
const css::uno::Reference< css::uno::XComponentContext >& xContext,
|
2014-01-09 10:12:01 +01:00
|
|
|
OUString const & implementationName,
|
2014-12-25 15:17:55 +02:00
|
|
|
bool bIsDraw, SvXMLImportFlags nImportFlags )
|
2014-01-09 10:12:01 +01:00
|
|
|
: SvXMLImport( xContext, implementationName, nImportFlags ),
|
2015-11-10 10:29:15 +01:00
|
|
|
mpMasterStylesContext(nullptr),
|
|
|
|
mpDocElemTokenMap(nullptr),
|
|
|
|
mpBodyElemTokenMap(nullptr),
|
|
|
|
mpStylesElemTokenMap(nullptr),
|
|
|
|
mpMasterPageElemTokenMap(nullptr),
|
|
|
|
mpMasterPageAttrTokenMap(nullptr),
|
|
|
|
mpPageMasterAttrTokenMap(nullptr),
|
|
|
|
mpPageMasterStyleAttrTokenMap(nullptr),
|
|
|
|
mpDrawPageAttrTokenMap(nullptr),
|
|
|
|
mpDrawPageElemTokenMap(nullptr),
|
|
|
|
mpPresentationPlaceholderAttrTokenMap(nullptr),
|
2000-09-18 16:07:07 +00:00
|
|
|
mnNewPageCount(0L),
|
|
|
|
mnNewMasterPageCount(0L),
|
2001-03-20 19:08:37 +00:00
|
|
|
mbIsDraw(bIsDraw),
|
2014-04-07 16:42:18 +02:00
|
|
|
mbLoadDoc(true),
|
|
|
|
mbPreview(false),
|
2012-06-02 08:58:21 -05:00
|
|
|
msPageLayouts( "PageLayouts" ),
|
|
|
|
msPreview( "Preview" )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-12 15:16:13 +00:00
|
|
|
// add namespaces
|
2001-07-10 16:12:09 +00:00
|
|
|
GetNamespaceMap().Add(
|
|
|
|
GetXMLToken(XML_NP_PRESENTATION),
|
|
|
|
GetXMLToken(XML_N_PRESENTATION),
|
|
|
|
XML_NAMESPACE_PRESENTATION);
|
2004-11-26 18:32:46 +00:00
|
|
|
|
|
|
|
GetNamespaceMap().Add(
|
|
|
|
GetXMLToken(XML_NP_SMIL),
|
2005-03-08 13:56:10 +00:00
|
|
|
GetXMLToken(XML_N_SMIL_COMPAT),
|
2004-11-26 18:32:46 +00:00
|
|
|
XML_NAMESPACE_SMIL);
|
|
|
|
|
|
|
|
GetNamespaceMap().Add(
|
|
|
|
GetXMLToken(XML_NP_ANIMATION),
|
|
|
|
GetXMLToken(XML_N_ANIMATION),
|
|
|
|
XML_NAMESPACE_ANIMATION);
|
2001-01-12 15:16:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// XImporter
|
|
|
|
void SAL_CALL SdXMLImport::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(lang::IllegalArgumentException, uno::RuntimeException, std::exception)
|
2001-01-12 15:16:13 +00:00
|
|
|
{
|
|
|
|
SvXMLImport::setTargetDocument( xDoc );
|
|
|
|
|
|
|
|
uno::Reference< lang::XServiceInfo > xDocServices( GetModel(), uno::UNO_QUERY );
|
|
|
|
if( !xDocServices.is() )
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
2013-06-29 21:24:12 +02:00
|
|
|
mbIsDraw = !xDocServices->supportsService("com.sun.star.presentation.PresentationDocument");
|
2001-01-12 15:16:13 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// prepare access to styles
|
|
|
|
uno::Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), uno::UNO_QUERY );
|
2001-09-28 09:52:49 +00:00
|
|
|
if(xFamSup.is())
|
|
|
|
mxDocStyleFamilies = xFamSup->getStyleFamilies();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// prepare access to master pages
|
|
|
|
uno::Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), uno::UNO_QUERY);
|
2001-09-28 09:52:49 +00:00
|
|
|
if(xMasterPagesSupplier.is())
|
2014-06-13 17:53:15 +02:00
|
|
|
mxDocMasterPages.set(xMasterPagesSupplier->getMasterPages(), css::uno::UNO_QUERY);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// prepare access to draw pages
|
|
|
|
uno::Reference <drawing::XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), uno::UNO_QUERY);
|
2001-01-12 15:16:13 +00:00
|
|
|
if(!xDrawPagesSupplier.is())
|
|
|
|
throw lang::IllegalArgumentException();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-13 17:53:15 +02:00
|
|
|
mxDocDrawPages.set(xDrawPagesSupplier->getDrawPages(), css::uno::UNO_QUERY);
|
2001-01-12 15:16:13 +00:00
|
|
|
if(!mxDocDrawPages.is())
|
|
|
|
throw lang::IllegalArgumentException();
|
2001-04-26 17:05:46 +00:00
|
|
|
|
2001-09-28 09:52:49 +00:00
|
|
|
if( mxDocDrawPages.is() && mxDocDrawPages->getCount() > 0 )
|
|
|
|
{
|
|
|
|
uno::Reference< form::XFormsSupplier > xFormsSupp;
|
|
|
|
mxDocDrawPages->getByIndex(0) >>= xFormsSupp;
|
|
|
|
mbIsFormsSupported = xFormsSupp.is();
|
|
|
|
}
|
2001-11-08 14:44:42 +00:00
|
|
|
|
|
|
|
// #88546# enable progress bar increments, SdXMLImport is only used for
|
|
|
|
// draw/impress import
|
|
|
|
GetShapeImport()->enableHandleProgressBar();
|
2008-03-12 09:34:55 +00:00
|
|
|
|
|
|
|
uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
|
|
|
|
if( xFac.is() )
|
|
|
|
{
|
|
|
|
uno::Sequence< OUString > sSNS( xFac->getAvailableServiceNames() );
|
|
|
|
sal_Int32 n = sSNS.getLength();
|
|
|
|
const OUString* pSNS( sSNS.getConstArray() );
|
|
|
|
while( --n > 0 )
|
|
|
|
{
|
2012-04-06 19:49:53 +02:00
|
|
|
if( (*pSNS++) == "com.sun.star.drawing.TableShape" )
|
2008-03-12 09:34:55 +00:00
|
|
|
{
|
|
|
|
mbIsTableShapeSupported = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-03-20 19:08:37 +00:00
|
|
|
// XInitialization
|
|
|
|
void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArguments )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::Exception, uno::RuntimeException, std::exception)
|
2001-03-20 19:08:37 +00:00
|
|
|
{
|
|
|
|
SvXMLImport::initialize( aArguments );
|
|
|
|
|
|
|
|
uno::Reference< beans::XPropertySet > xInfoSet( getImportInfo() );
|
|
|
|
if( xInfoSet.is() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
|
|
|
|
|
|
|
|
if( xInfoSetInfo->hasPropertyByName( msPageLayouts ) )
|
|
|
|
xInfoSet->getPropertyValue( msPageLayouts ) >>= mxPageLayouts;
|
2001-08-24 12:05:27 +00:00
|
|
|
|
|
|
|
if( xInfoSetInfo->hasPropertyByName( msPreview ) )
|
|
|
|
xInfoSet->getPropertyValue( msPreview ) >>= mbPreview;
|
2011-03-01 16:05:30 +01:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const sOrganizerMode(
|
2012-06-02 08:58:21 -05:00
|
|
|
"OrganizerMode");
|
2011-03-01 16:05:30 +01:00
|
|
|
if (xInfoSetInfo->hasPropertyByName(sOrganizerMode))
|
|
|
|
{
|
2014-04-07 16:42:18 +02:00
|
|
|
bool bStyleOnly(false);
|
2011-03-01 16:05:30 +01:00
|
|
|
if (xInfoSet->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
|
|
|
|
{
|
|
|
|
mbLoadDoc = !bStyleOnly;
|
|
|
|
}
|
|
|
|
}
|
2001-03-20 19:08:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-09-12 09:33:50 +00:00
|
|
|
SdXMLImport::~SdXMLImport() throw ()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Styles or AutoStyles context?
|
|
|
|
if(mpMasterStylesContext)
|
|
|
|
mpMasterStylesContext->ReleaseRef();
|
|
|
|
|
|
|
|
// delete all token maps
|
2015-06-13 22:15:31 +02:00
|
|
|
delete mpDocElemTokenMap;
|
|
|
|
delete mpBodyElemTokenMap;
|
|
|
|
delete mpStylesElemTokenMap;
|
|
|
|
delete mpMasterPageElemTokenMap;
|
|
|
|
delete mpMasterPageAttrTokenMap;
|
|
|
|
delete mpPageMasterAttrTokenMap;
|
|
|
|
delete mpPageMasterStyleAttrTokenMap;
|
|
|
|
delete mpDrawPageAttrTokenMap;
|
|
|
|
delete mpDrawPageElemTokenMap;
|
|
|
|
delete mpPresentationPlaceholderAttrTokenMap;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const SvXMLTokenMap& SdXMLImport::GetDocElemTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpDocElemTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aDocElemTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS },
|
|
|
|
{ XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
|
|
|
|
{ XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
|
|
|
|
{ XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_DOC_MASTERSTYLES },
|
|
|
|
{ XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
|
|
|
|
{ XML_NAMESPACE_OFFICE, XML_SCRIPTS, XML_TOK_DOC_SCRIPT },
|
|
|
|
{ XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
|
|
|
|
{ XML_NAMESPACE_OFFICE, XML_SETTINGS, XML_TOK_DOC_SETTINGS },
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpDocElemTokenMap = new SvXMLTokenMap(aDocElemTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpDocElemTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpDocElemTokenMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvXMLTokenMap& SdXMLImport::GetBodyElemTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpBodyElemTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aBodyElemTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_DRAW, XML_PAGE, XML_TOK_BODY_PAGE },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_SETTINGS, XML_TOK_BODY_SETTINGS },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, XML_TOK_BODY_HEADER_DECL },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, XML_TOK_BODY_FOOTER_DECL },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL,XML_TOK_BODY_DATE_TIME_DECL },
|
|
|
|
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpBodyElemTokenMap = new SvXMLTokenMap(aBodyElemTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpBodyElemTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpBodyElemTokenMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvXMLTokenMap& SdXMLImport::GetStylesElemTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpStylesElemTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aStylesElemTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, XML_TOK_STYLES_PAGE_MASTER },
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT },
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_STYLES_STYLE },
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpStylesElemTokenMap = new SvXMLTokenMap(aStylesElemTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpStylesElemTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpStylesElemTokenMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvXMLTokenMap& SdXMLImport::GetMasterPageElemTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpMasterPageElemTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aMasterPageElemTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_MASTERPAGE_STYLE },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_NOTES, XML_TOK_MASTERPAGE_NOTES },
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpMasterPageElemTokenMap = new SvXMLTokenMap(aMasterPageElemTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpMasterPageElemTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpMasterPageElemTokenMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvXMLTokenMap& SdXMLImport::GetMasterPageAttrTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpMasterPageAttrTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aMasterPageAttrTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_NAME, XML_TOK_MASTERPAGE_NAME },
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, XML_TOK_MASTERPAGE_DISPLAY_NAME },
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, XML_TOK_MASTERPAGE_PAGE_MASTER_NAME },
|
|
|
|
{ XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_MASTERPAGE_STYLE_NAME },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_MASTERPAGE_USE_HEADER_NAME },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_MASTERPAGE_USE_FOOTER_NAME },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME },
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpMasterPageAttrTokenMap = new SvXMLTokenMap(aMasterPageAttrTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpMasterPageAttrTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpMasterPageAttrTokenMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvXMLTokenMap& SdXMLImport::GetPageMasterAttrTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpPageMasterAttrTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aPageMasterAttrTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_NAME, XML_TOK_PAGEMASTER_NAME },
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpPageMasterAttrTokenMap = new SvXMLTokenMap(aPageMasterAttrTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpPageMasterAttrTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpPageMasterAttrTokenMap;
|
|
|
|
}
|
|
|
|
|
2000-11-27 11:52:59 +00:00
|
|
|
const SvXMLTokenMap& SdXMLImport::GetPageMasterStyleAttrTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpPageMasterStyleAttrTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aPageMasterStyleAttrTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP },
|
|
|
|
{ XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM },
|
|
|
|
{ XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT },
|
|
|
|
{ XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT },
|
|
|
|
{ XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH },
|
|
|
|
{ XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT },
|
|
|
|
{ XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION },
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-11-27 11:52:59 +00:00
|
|
|
mpPageMasterStyleAttrTokenMap = new SvXMLTokenMap(aPageMasterStyleAttrTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpPageMasterStyleAttrTokenMap)
|
|
|
|
|
2000-11-27 11:52:59 +00:00
|
|
|
return *mpPageMasterStyleAttrTokenMap;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvXMLTokenMap& SdXMLImport::GetDrawPageAttrTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpDrawPageAttrTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aDrawPageAttrTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_DRAWPAGE_NAME },
|
|
|
|
{ XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_DRAWPAGE_STYLE_NAME },
|
|
|
|
{ XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, XML_TOK_DRAWPAGE_MASTER_PAGE_NAME },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME },
|
2010-04-19 18:27:16 +02:00
|
|
|
{ XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_DRAWID },
|
|
|
|
{ XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_XMLID },
|
2009-04-23 10:42:05 +00:00
|
|
|
{ XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_DRAWPAGE_HREF },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_DRAWPAGE_USE_HEADER_NAME },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_DRAWPAGE_USE_FOOTER_NAME },
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, XML_TOK_DRAWPAGE_USE_DATE_TIME_NAME },
|
|
|
|
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpDrawPageAttrTokenMap = new SvXMLTokenMap(aDrawPageAttrTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpDrawPageAttrTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpDrawPageAttrTokenMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvXMLTokenMap& SdXMLImport::GetDrawPageElemTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpDrawPageElemTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aDrawPageElemTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_NOTES, XML_TOK_DRAWPAGE_NOTES },
|
|
|
|
{ XML_NAMESPACE_ANIMATION, XML_PAR, XML_TOK_DRAWPAGE_PAR },
|
|
|
|
{ XML_NAMESPACE_ANIMATION, XML_SEQ, XML_TOK_DRAWPAGE_SEQ },
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpDrawPageElemTokenMap = new SvXMLTokenMap(aDrawPageElemTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpDrawPageElemTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpDrawPageElemTokenMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvXMLTokenMap& SdXMLImport::GetPresentationPlaceholderAttrTokenMap()
|
|
|
|
{
|
|
|
|
if(!mpPresentationPlaceholderAttrTokenMap)
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
2013-07-18 22:16:42 +09:00
|
|
|
static const SvXMLTokenMapEntry aPresentationPlaceholderAttrTokenMap[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_NAMESPACE_PRESENTATION, XML_OBJECT, XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME },
|
|
|
|
{ XML_NAMESPACE_SVG, XML_X, XML_TOK_PRESENTATIONPLACEHOLDER_X },
|
|
|
|
{ XML_NAMESPACE_SVG, XML_Y, XML_TOK_PRESENTATIONPLACEHOLDER_Y },
|
|
|
|
{ XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH },
|
|
|
|
{ XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT },
|
|
|
|
XML_TOKEN_MAP_END
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mpPresentationPlaceholderAttrTokenMap = new SvXMLTokenMap(aPresentationPlaceholderAttrTokenMap);
|
2009-04-23 10:42:05 +00:00
|
|
|
} // if(!mpPresentationPlaceholderAttrTokenMap)
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *mpPresentationPlaceholderAttrTokenMap;
|
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
SvXMLImportContext *SdXMLImport::CreateContext(sal_uInt16 nPrefix,
|
2000-09-18 16:07:07 +00:00
|
|
|
const OUString& rLocalName,
|
|
|
|
const uno::Reference<xml::sax::XAttributeList>& xAttrList)
|
|
|
|
{
|
2015-11-10 10:29:15 +01:00
|
|
|
SvXMLImportContext* pContext = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-04 15:10:26 +00:00
|
|
|
if(XML_NAMESPACE_OFFICE == nPrefix &&
|
2008-02-26 12:35:47 +00:00
|
|
|
( IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ||
|
2001-06-29 20:07:26 +00:00
|
|
|
IsXMLToken( rLocalName, XML_DOCUMENT_CONTENT ) ||
|
|
|
|
IsXMLToken( rLocalName, XML_DOCUMENT_SETTINGS ) ))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pContext = new SdXMLDocContext_Impl(*this, nPrefix, rLocalName, xAttrList);
|
2008-02-26 12:35:47 +00:00
|
|
|
} else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
|
|
|
|
( IsXMLToken(rLocalName, XML_DOCUMENT_META)) ) {
|
|
|
|
pContext = CreateMetaContext(rLocalName, xAttrList);
|
|
|
|
} else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
|
|
|
|
( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
|
|
|
|
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
|
|
|
|
GetModel(), uno::UNO_QUERY_THROW);
|
|
|
|
// flat OpenDocument file format
|
|
|
|
pContext = new SdXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
|
2012-09-12 10:24:08 +02:00
|
|
|
xAttrList, xDPS->getDocumentProperties());
|
2008-02-26 12:35:47 +00:00
|
|
|
} else {
|
2000-09-18 16:07:07 +00:00
|
|
|
pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
|
|
|
|
}
|
|
|
|
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName,
|
2006-06-19 17:11:47 +00:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>&)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-11-10 10:29:15 +01:00
|
|
|
SvXMLImportContext* pContext = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-12-25 15:17:55 +02:00
|
|
|
if (getImportFlags() & SvXMLImportFlags::META)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-02-26 12:35:47 +00:00
|
|
|
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
|
|
|
|
GetModel(), uno::UNO_QUERY_THROW);
|
2011-03-01 16:05:30 +01:00
|
|
|
uno::Reference<document::XDocumentProperties> const xDocProps(
|
2015-11-10 10:29:15 +01:00
|
|
|
(IsStylesOnlyMode()) ? nullptr : xDPS->getDocumentProperties());
|
2008-02-26 12:35:47 +00:00
|
|
|
pContext = new SvXMLMetaDocumentContext(*this,
|
|
|
|
XML_NAMESPACE_OFFICE, rLocalName,
|
2012-09-12 10:24:08 +02:00
|
|
|
xDocProps);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!pContext)
|
|
|
|
{
|
|
|
|
pContext = new SvXMLImportContext(*this, XML_NAMESPACE_OFFICE, rLocalName);
|
|
|
|
}
|
|
|
|
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext *SdXMLImport::CreateBodyContext(const OUString& rLocalName,
|
2006-06-19 17:11:47 +00:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>&)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-11-10 10:29:15 +01:00
|
|
|
SvXMLImportContext *pContext = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
pContext = new SdXMLBodyContext(*this, XML_NAMESPACE_OFFICE, rLocalName);
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLStylesContext *SdXMLImport::CreateStylesContext(const OUString& rLocalName,
|
|
|
|
const uno::Reference<xml::sax::XAttributeList>& xAttrList)
|
|
|
|
{
|
|
|
|
if(GetShapeImport()->GetStylesContext())
|
|
|
|
return GetShapeImport()->GetStylesContext();
|
|
|
|
|
|
|
|
GetShapeImport()->SetStylesContext(new SdXMLStylesContext(
|
2014-04-07 16:42:18 +02:00
|
|
|
*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, false));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return GetShapeImport()->GetStylesContext();
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLStylesContext *SdXMLImport::CreateAutoStylesContext(const OUString& rLocalName,
|
|
|
|
const uno::Reference<xml::sax::XAttributeList>& xAttrList)
|
|
|
|
{
|
|
|
|
if(GetShapeImport()->GetAutoStylesContext())
|
|
|
|
return GetShapeImport()->GetAutoStylesContext();
|
|
|
|
|
|
|
|
GetShapeImport()->SetAutoStylesContext(new SdXMLStylesContext(
|
2014-04-07 16:42:18 +02:00
|
|
|
*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, true));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return GetShapeImport()->GetAutoStylesContext();
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext* SdXMLImport::CreateMasterStylesContext(const OUString& rLocalName,
|
2006-06-19 17:11:47 +00:00
|
|
|
const uno::Reference<xml::sax::XAttributeList>&)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(mpMasterStylesContext)
|
|
|
|
return mpMasterStylesContext;
|
|
|
|
|
|
|
|
mpMasterStylesContext = new SdXMLMasterStylesContext(
|
|
|
|
*this, XML_NAMESPACE_OFFICE, rLocalName);
|
2014-10-02 14:37:06 +02:00
|
|
|
mpMasterStylesContext->AddFirstRef();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return mpMasterStylesContext;
|
|
|
|
}
|
|
|
|
|
2007-01-23 07:51:56 +00:00
|
|
|
SvXMLImportContext *SdXMLImport::CreateFontDeclsContext(const OUString& rLocalName,
|
|
|
|
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
|
|
|
|
{
|
|
|
|
XMLFontStylesContext *pFSContext =
|
|
|
|
new XMLFontStylesContext( *this, XML_NAMESPACE_OFFICE,
|
|
|
|
rLocalName, xAttrList,
|
2011-08-21 23:49:54 +01:00
|
|
|
osl_getThreadTextEncoding() );
|
2007-01-23 07:51:56 +00:00
|
|
|
SetFontDecls( pFSContext );
|
|
|
|
return pFSContext;
|
|
|
|
}
|
|
|
|
|
2000-12-12 13:38:12 +00:00
|
|
|
SvXMLImportContext *SdXMLImport::CreateScriptContext(
|
|
|
|
const OUString& rLocalName )
|
|
|
|
{
|
2015-11-10 10:29:15 +01:00
|
|
|
SvXMLImportContext *pContext = nullptr;
|
2000-12-12 13:38:12 +00:00
|
|
|
|
|
|
|
pContext = new XMLScriptContext( *this,
|
|
|
|
XML_NAMESPACE_OFFICE, rLocalName,
|
|
|
|
GetModel() );
|
|
|
|
return pContext;
|
|
|
|
}
|
2000-12-19 15:23:48 +00:00
|
|
|
|
2015-11-26 08:43:00 +02:00
|
|
|
void SdXMLImport::SetViewSettings(const css::uno::Sequence<css::beans::PropertyValue>& aViewProps)
|
2001-03-27 21:03:08 +00:00
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySet > xPropSet( GetModel(), uno::UNO_QUERY );
|
|
|
|
if( !xPropSet.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
awt::Rectangle aVisArea( 0,0, 28000, 21000 );
|
|
|
|
sal_Int32 nCount = aViewProps.getLength();
|
|
|
|
|
|
|
|
const beans::PropertyValue* pValues = aViewProps.getConstArray();
|
|
|
|
|
|
|
|
while( nCount-- )
|
|
|
|
{
|
|
|
|
const OUString& rName = pValues->Name;
|
|
|
|
const uno::Any rValue = pValues->Value;
|
|
|
|
|
2012-04-06 15:05:52 +02:00
|
|
|
if ( rName == "VisibleAreaTop" )
|
2001-03-27 21:03:08 +00:00
|
|
|
{
|
|
|
|
rValue >>= aVisArea.Y;
|
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( rName == "VisibleAreaLeft" )
|
2001-03-27 21:03:08 +00:00
|
|
|
{
|
|
|
|
rValue >>= aVisArea.X;
|
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( rName == "VisibleAreaWidth" )
|
2001-03-27 21:03:08 +00:00
|
|
|
{
|
|
|
|
rValue >>= aVisArea.Width;
|
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( rName == "VisibleAreaHeight" )
|
2001-03-27 21:03:08 +00:00
|
|
|
{
|
|
|
|
rValue >>= aVisArea.Height;
|
|
|
|
}
|
|
|
|
|
|
|
|
pValues++;
|
|
|
|
}
|
|
|
|
|
2002-07-15 12:09:03 +00:00
|
|
|
try
|
|
|
|
{
|
2013-06-29 21:24:12 +02:00
|
|
|
xPropSet->setPropertyValue("VisibleArea", uno::makeAny( aVisArea ) );
|
2002-07-15 12:09:03 +00:00
|
|
|
}
|
2015-11-26 08:43:00 +02:00
|
|
|
catch(const css::uno::Exception&)
|
2002-07-15 12:09:03 +00:00
|
|
|
{
|
2010-10-04 14:39:37 +02:00
|
|
|
/* #i79978# since old documents may contain invalid view settings, this is nothing to worry the user about.
|
2002-07-15 12:09:03 +00:00
|
|
|
uno::Sequence<OUString> aSeq(0);
|
|
|
|
SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
|
2010-10-04 14:39:37 +02:00
|
|
|
*/
|
2002-07-15 12:09:03 +00:00
|
|
|
}
|
2001-03-27 21:03:08 +00:00
|
|
|
}
|
|
|
|
|
2015-11-26 08:43:00 +02:00
|
|
|
void SdXMLImport::SetConfigurationSettings(const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps)
|
2001-03-27 21:03:08 +00:00
|
|
|
{
|
|
|
|
uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
|
|
|
|
if( !xFac.is() )
|
|
|
|
return;
|
|
|
|
|
2013-06-29 21:24:12 +02:00
|
|
|
uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY );
|
2001-03-27 21:03:08 +00:00
|
|
|
if( !xProps.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
uno::Reference< beans::XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
|
|
|
|
if( !xInfo.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
sal_Int32 nCount = aConfigProps.getLength();
|
|
|
|
const beans::PropertyValue* pValues = aConfigProps.getConstArray();
|
|
|
|
|
2011-09-10 09:36:23 +01:00
|
|
|
DocumentSettingsSerializer *pFilter;
|
|
|
|
pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
|
|
|
|
uno::Sequence<beans::PropertyValue> aFiltered;
|
|
|
|
if( pFilter )
|
|
|
|
{
|
rhbz#887420 Implement "block untrusted referer links" feature
For now, this checks for a trusted referer (if the BlockUntrustedRefererLinks
configuration prop is set) in utl::MediaDescriptor::impl_openStreamWithURL and
SvxBrushItem::GetGraphicObject. Checking in additional places will probably be
necessary to block /all/ unwanted communication. Also, some places marked
/*TODO?*/ currently pass in an empty referer (which is always considered
trusted) and will probably need to be adapted.
Ideally, Referer URIs would never be empty (and consistently use something like
<private:user> for cases where access is explicitly initiated by the user and
should never be blocked), but that's a very daunting task, so start small by
identifying the places that potentially need blocking and adding appropriate
Referer URIs there. Also, Referer information should always be computed as
freshly as possible from the context in which an access attempt is made, but,
again, always carrying the information from the context all the way to the
relevant functions is a very daunting task, so for now store the information
upon object instantiation in some cases (SvxBrushItem, SdrGrafObj, ...).
The Referer URI (css.document.MediaDescriptor property; SID_REFERER) was already
used to track macro execution, and there is one place in
SfxApplication::OpenDocExec_Impl where opening of hyperlinks (explicitly clicked
by the user) is done that needs the current document's URI as Referer to check
execution of macro URIs but needs an empty (or <private:user>, see above)
Referer to not block non-macro URIs. Special code has been added there to
handle that.
Change-Id: Iafbdc07a9fe925d9ee580d4f5778448f18f2ebd9
2013-11-14 10:39:27 +01:00
|
|
|
aFiltered = pFilter->filterStreamsFromStorage( GetDocumentBase(), GetSourceStorage(), aConfigProps );
|
2011-09-10 09:36:23 +01:00
|
|
|
nCount = aFiltered.getLength();
|
|
|
|
pValues = aFiltered.getConstArray();
|
|
|
|
}
|
|
|
|
|
2001-03-27 21:03:08 +00:00
|
|
|
while( nCount-- )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2004-11-03 15:40:04 +00:00
|
|
|
const OUString& rProperty = pValues->Name;
|
|
|
|
if( xInfo->hasPropertyByName( rProperty ) )
|
|
|
|
xProps->setPropertyValue( rProperty, pValues->Value );
|
2001-03-27 21:03:08 +00:00
|
|
|
}
|
2011-06-16 00:26:29 +01:00
|
|
|
catch(const uno::Exception&)
|
2001-03-27 21:03:08 +00:00
|
|
|
{
|
2013-05-04 01:40:09 +03:00
|
|
|
SAL_INFO("xmloff.draw", "#SdXMLImport::SetConfigurationSettings: Exception!" );
|
2001-03-27 21:03:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pValues++;
|
|
|
|
}
|
|
|
|
}
|
2001-07-31 15:31:45 +00:00
|
|
|
|
2015-01-08 23:08:34 +01:00
|
|
|
// #80365# override this method to read and use the hint value from the
|
2001-07-31 15:31:45 +00:00
|
|
|
// written meta information. If no info is found, guess 10 draw objects
|
2008-02-26 12:35:47 +00:00
|
|
|
//void SdXMLImport::SetStatisticAttributes(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
|
|
|
|
void SdXMLImport::SetStatistics(
|
|
|
|
const uno::Sequence<beans::NamedValue> & i_rStats)
|
2001-07-31 15:31:45 +00:00
|
|
|
{
|
2008-02-26 12:35:47 +00:00
|
|
|
static const char* s_stats[] =
|
2015-11-10 10:29:15 +01:00
|
|
|
{ "ObjectCount", nullptr };
|
2001-07-31 15:31:45 +00:00
|
|
|
|
2008-02-26 12:35:47 +00:00
|
|
|
SvXMLImport::SetStatistics(i_rStats);
|
2001-07-31 15:31:45 +00:00
|
|
|
|
2008-02-26 12:35:47 +00:00
|
|
|
sal_uInt32 nCount(10);
|
|
|
|
for (sal_Int32 i = 0; i < i_rStats.getLength(); ++i) {
|
2015-11-10 10:29:15 +01:00
|
|
|
for (const char** pStat = s_stats; *pStat != nullptr; ++pStat) {
|
2008-02-26 12:35:47 +00:00
|
|
|
if (i_rStats[i].Name.equalsAscii(*pStat)) {
|
2008-03-03 06:16:00 +00:00
|
|
|
sal_Int32 val = 0;
|
2008-02-26 12:35:47 +00:00
|
|
|
if (i_rStats[i].Value >>= val) {
|
|
|
|
nCount = val;
|
|
|
|
} else {
|
2013-05-04 01:40:09 +03:00
|
|
|
SAL_WARN("xmloff.draw", "SdXMLImport::SetStatistics: invalid entry");
|
2008-02-26 12:35:47 +00:00
|
|
|
}
|
2001-07-31 15:31:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nCount)
|
|
|
|
{
|
|
|
|
GetProgressBarHelper()->SetReference(nCount);
|
|
|
|
GetProgressBarHelper()->SetValue(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void SdXMLImport::AddHeaderDecl( const OUString& rName, const OUString& rText )
|
2004-11-03 15:40:04 +00:00
|
|
|
{
|
2012-01-25 17:00:07 -02:00
|
|
|
if( !rName.isEmpty() && !rText.isEmpty() )
|
2004-11-03 15:40:04 +00:00
|
|
|
maHeaderDeclsMap[rName] = rText;
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void SdXMLImport::AddFooterDecl( const OUString& rName, const OUString& rText )
|
2004-11-03 15:40:04 +00:00
|
|
|
{
|
2012-01-25 17:00:07 -02:00
|
|
|
if( !rName.isEmpty() && !rText.isEmpty() )
|
2004-11-03 15:40:04 +00:00
|
|
|
maFooterDeclsMap[rName] = rText;
|
|
|
|
}
|
|
|
|
|
2014-04-07 16:42:18 +02:00
|
|
|
void SdXMLImport::AddDateTimeDecl( const OUString& rName, const OUString& rText, bool bFixed, const OUString& rDateTimeFormat )
|
2004-11-03 15:40:04 +00:00
|
|
|
{
|
2012-01-25 17:00:07 -02:00
|
|
|
if( !rName.isEmpty() && (!rText.isEmpty() || !bFixed) )
|
2004-11-03 15:40:04 +00:00
|
|
|
{
|
|
|
|
DateTimeDeclContextImpl aDecl;
|
|
|
|
aDecl.maStrText = rText;
|
|
|
|
aDecl.mbFixed = bFixed;
|
|
|
|
aDecl.maStrDateTimeFormat = rDateTimeFormat;
|
|
|
|
maDateTimeDeclsMap[rName] = aDecl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString SdXMLImport::GetHeaderDecl( const OUString& rName ) const
|
2004-11-03 15:40:04 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aRet;
|
2004-11-03 15:40:04 +00:00
|
|
|
HeaderFooterDeclMap::const_iterator aIter( maHeaderDeclsMap.find( rName ) );
|
|
|
|
if( aIter != maHeaderDeclsMap.end() )
|
|
|
|
aRet = (*aIter).second;
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString SdXMLImport::GetFooterDecl( const OUString& rName ) const
|
2004-11-03 15:40:04 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aRet;
|
2004-11-03 15:40:04 +00:00
|
|
|
HeaderFooterDeclMap::const_iterator aIter( maFooterDeclsMap.find( rName ) );
|
|
|
|
if( aIter != maFooterDeclsMap.end() )
|
|
|
|
aRet = (*aIter).second;
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2014-04-07 16:42:18 +02:00
|
|
|
OUString SdXMLImport::GetDateTimeDecl( const OUString& rName, bool& rbFixed, OUString& rDateTimeFormat )
|
2004-11-03 15:40:04 +00:00
|
|
|
{
|
|
|
|
DateTimeDeclContextImpl aDecl;
|
|
|
|
|
|
|
|
DateTimeDeclMap::const_iterator aIter( maDateTimeDeclsMap.find( rName ) );
|
|
|
|
if( aIter != maDateTimeDeclsMap.end() )
|
|
|
|
aDecl = (*aIter).second;
|
|
|
|
|
|
|
|
rbFixed = aDecl.mbFixed;
|
|
|
|
rDateTimeFormat = aDecl.maStrDateTimeFormat;
|
|
|
|
return aDecl.maStrText;
|
|
|
|
}
|
|
|
|
|
2013-02-22 18:15:22 +01:00
|
|
|
void SdXMLImport::NotifyEmbeddedFontRead()
|
|
|
|
{
|
|
|
|
uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
|
|
|
|
if( xFac.is() )
|
|
|
|
{
|
2013-06-29 21:24:12 +02:00
|
|
|
uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY );
|
2013-02-22 18:15:22 +01:00
|
|
|
if( xProps.is() )
|
|
|
|
xProps->setPropertyValue("EmbedFonts", uno::makeAny( true ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|