Files
libreoffice/sd/source/core/cusshow.cxx
Oliver Bolte 7cd09cf2bb INTEGRATION: CWS impress115 (1.8.32); FILE MERGED
2007/01/05 15:05:55 cl 1.8.32.1: #i43124# fixed replacing of slides in custom shows
2007-01-23 07:53:45 +00:00

139 lines
3.7 KiB
C++

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cusshow.cxx,v $
*
* $Revision: 1.9 $
*
* last change: $Author: obo $ $Date: 2007-01-23 08:53:45 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* 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.
*
* 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.
*
* 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
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
#include "sdiocmpt.hxx"
#include "cusshow.hxx"
#include "sdpage.hxx"
#include "drawdoc.hxx"
// #90477#
#ifndef _TOOLS_TENCCVT_HXX
#include <tools/tenccvt.hxx>
#endif
using namespace ::com::sun::star;
/*************************************************************************
|*
|* Ctor
|*
\************************************************************************/
SdCustomShow::SdCustomShow(SdDrawDocument* pDrawDoc)
: List(),
pDoc(pDrawDoc)
{
}
/*************************************************************************
|*
|* Copy-Ctor
|*
\************************************************************************/
SdCustomShow::SdCustomShow( const SdCustomShow& rShow )
: List( rShow )
{
aName = rShow.GetName();
pDoc = rShow.GetDoc();
}
SdCustomShow::SdCustomShow(SdDrawDocument* pDrawDoc, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xShow )
: List(),
pDoc(pDrawDoc),
mxUnoCustomShow( xShow )
{
}
/*************************************************************************
|*
|* Dtor
|*
\************************************************************************/
SdCustomShow::~SdCustomShow()
{
uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
uno::Reference< lang::XComponent > xComponent( xShow, uno::UNO_QUERY );
if( xComponent.is() )
xComponent->dispose();
}
extern uno::Reference< uno::XInterface > createUnoCustomShow( SdCustomShow* pShow );
uno::Reference< uno::XInterface > SdCustomShow::getUnoCustomShow()
{
// try weak reference first
uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
if( !xShow.is() )
{
xShow = createUnoCustomShow( this );
}
return xShow;
}
void SdCustomShow::ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage )
{
if( !pNewPage )
{
RemovePage( pOldPage );
}
else
{
ULONG nPos;
while( (nPos = GetPos( (void*)pOldPage )) != CONTAINER_ENTRY_NOTFOUND )
{
Replace( (void*)pNewPage, nPos );
}
}
}
void SdCustomShow::RemovePage( const SdPage* pPage )
{
ULONG nPos;
while( (nPos = GetPos( (void*)pPage )) != CONTAINER_ENTRY_NOTFOUND )
{
Remove( nPos );
}
}