Files
libreoffice/sd/source/core/cusshow.cxx

139 lines
3.7 KiB
C++
Raw Normal View History

2000-09-18 23:16:46 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:16:46 +00:00
*
* $RCSfile: cusshow.cxx,v $
2000-09-18 23:16:46 +00:00
*
* $Revision: 1.9 $
2000-09-18 23:16:46 +00:00
*
* last change: $Author: obo $ $Date: 2007-01-23 08:53:45 $
2000-09-18 23:16:46 +00:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2000-09-18 23:16:46 +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
2000-09-18 23:16:46 +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.
2000-09-18 23:16:46 +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.
2000-09-18 23:16:46 +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
2000-09-18 23:16:46 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
2000-09-18 23:16:46 +00:00
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
2000-09-18 23:16:46 +00:00
#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;
2000-09-18 23:16:46 +00:00
/*************************************************************************
|*
|* 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 )
{
}
2000-09-18 23:16:46 +00:00
/*************************************************************************
|*
|* Dtor
|*
\************************************************************************/
SdCustomShow::~SdCustomShow()
{
uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
uno::Reference< lang::XComponent > xComponent( xShow, uno::UNO_QUERY );
if( xComponent.is() )
xComponent->dispose();
2000-09-18 23:16:46 +00:00
}
extern uno::Reference< uno::XInterface > createUnoCustomShow( SdCustomShow* pShow );
2000-09-18 23:16:46 +00:00
uno::Reference< uno::XInterface > SdCustomShow::getUnoCustomShow()
{
// try weak reference first
uno::Reference< uno::XInterface > xShow( mxUnoCustomShow );
2000-09-18 23:16:46 +00:00
if( !xShow.is() )
{
xShow = createUnoCustomShow( this );
}
2000-09-18 23:16:46 +00:00
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 );
}
}