2002-10-24 09:33:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 06:17:46 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2002-10-24 09:33:07 -05:00
|
|
|
*
|
2008-04-11 06:17:46 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2002-10-24 09:33:07 -05:00
|
|
|
*
|
2008-04-11 06:17:46 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-10-24 09:33:07 -05:00
|
|
|
*
|
2008-04-11 06:17:46 -05:00
|
|
|
* $RCSfile: basicimporthandler.cxx,v $
|
|
|
|
* $Revision: 1.7 $
|
2002-10-24 09:33:07 -05:00
|
|
|
*
|
2008-04-11 06:17:46 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-10-24 09:33:07 -05:00
|
|
|
*
|
2008-04-11 06:17:46 -05: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.
|
2002-10-24 09:33:07 -05:00
|
|
|
*
|
2008-04-11 06:17:46 -05: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).
|
2002-10-24 09:33:07 -05:00
|
|
|
*
|
2008-04-11 06:17:46 -05: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.
|
2002-10-24 09:33:07 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 09:02:10 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_configmgr.hxx"
|
|
|
|
|
2002-10-24 09:33:07 -05:00
|
|
|
#include "basicimporthandler.hxx"
|
2004-06-18 09:47:26 -05:00
|
|
|
#include <com/sun/star/configuration/backend/ComponentChangeEvent.hpp>
|
|
|
|
#include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
|
2002-10-24 09:33:07 -05:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace configmgr
|
|
|
|
{
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
namespace backend
|
|
|
|
{
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2004-06-18 09:47:26 -05:00
|
|
|
BasicImportHandler::BasicImportHandler(
|
|
|
|
Backend const & xBackend,OUString const & aEntity, const sal_Bool& bNotify)
|
2006-06-19 17:18:10 -05:00
|
|
|
: m_bSendNotification(bNotify)
|
|
|
|
, m_xBackend(xBackend)
|
2002-10-24 09:33:07 -05:00
|
|
|
, m_aComponentName()
|
|
|
|
, m_aEntity(aEntity)
|
|
|
|
{
|
|
|
|
OSL_ENSURE( m_xBackend.is(), "Creating an import handler without a target backend" );
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BasicImportHandler::~BasicImportHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL
|
|
|
|
BasicImportHandler::startLayer( )
|
2003-04-17 07:13:35 -05:00
|
|
|
throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
|
2002-10-24 09:33:07 -05:00
|
|
|
{
|
|
|
|
m_aComponentName = OUString();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL
|
|
|
|
BasicImportHandler::endLayer( )
|
2003-04-17 07:13:35 -05:00
|
|
|
throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
|
2002-10-24 09:33:07 -05:00
|
|
|
{
|
2004-06-18 09:47:26 -05:00
|
|
|
if ( m_bSendNotification)
|
|
|
|
{
|
|
|
|
backenduno::ComponentChangeEvent aEvent;
|
|
|
|
aEvent.Source=*this;
|
|
|
|
aEvent.Component = m_aComponentName;
|
|
|
|
|
|
|
|
uno::Reference<backenduno::XBackendChangesListener> xListener(m_xBackend, uno::UNO_QUERY);
|
|
|
|
if( xListener.is())
|
|
|
|
{
|
|
|
|
xListener->componentDataChanged(aEvent);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OSL_ENSURE(false, "ImportMergeHandler: target backend does not support notifications");
|
|
|
|
}
|
|
|
|
}
|
2002-10-24 09:33:07 -05:00
|
|
|
m_aComponentName = OUString();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
bool BasicImportHandler::startComponent( const OUString& aName )
|
|
|
|
{
|
|
|
|
if (hasComponent()) return false;
|
|
|
|
|
|
|
|
m_aComponentName = aName;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void BasicImportHandler::raiseMalformedDataException(sal_Char const * pMsg)
|
|
|
|
{
|
|
|
|
OUString sMsg = OUString::createFromAscii(pMsg);
|
|
|
|
|
2003-04-17 07:13:35 -05:00
|
|
|
throw MalformedDataException(sMsg, *this, uno::Any());
|
2002-10-24 09:33:07 -05:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
} // namespace
|
|
|
|
|