2004-11-26 17:58:09 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 23:27:02 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-11-26 17:58:09 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-11-26 17:58:09 +00:00
|
|
|
*
|
2008-04-10 23:27:02 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-11-26 17:58:09 +00:00
|
|
|
*
|
2008-04-10 23:27:02 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-11-26 17:58:09 +00:00
|
|
|
*
|
2008-04-10 23:27:02 +00: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.
|
2004-11-26 17:58:09 +00:00
|
|
|
*
|
2008-04-10 23:27:02 +00: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).
|
2004-11-26 17:58:09 +00:00
|
|
|
*
|
2008-04-10 23:27:02 +00: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.
|
2004-11-26 17:58:09 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 07:28:12 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_slideshow.hxx"
|
|
|
|
|
2004-11-26 17:58:09 +00:00
|
|
|
#include <canvas/debug.hxx>
|
2008-06-24 11:02:42 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
2004-11-26 17:58:09 +00:00
|
|
|
|
2006-12-13 14:19:38 +00:00
|
|
|
#include <comphelper/anytostring.hxx>
|
|
|
|
#include <cppuhelper/exc_hlp.hxx>
|
2004-11-26 17:58:09 +00:00
|
|
|
|
2006-12-13 14:19:38 +00:00
|
|
|
#include "shapesubset.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
namespace slideshow
|
2004-11-26 17:58:09 +00:00
|
|
|
{
|
|
|
|
namespace internal
|
|
|
|
{
|
2007-07-17 13:39:43 +00:00
|
|
|
ShapeSubset::ShapeSubset( const AttributableShapeSharedPtr& rOriginalShape,
|
|
|
|
const DocTreeNode& rTreeNode,
|
|
|
|
const SubsettableShapeManagerSharedPtr& rShapeManager ) :
|
2004-11-26 17:58:09 +00:00
|
|
|
mpOriginalShape( rOriginalShape ),
|
|
|
|
mpSubsetShape(),
|
|
|
|
maTreeNode( rTreeNode ),
|
2007-07-17 13:39:43 +00:00
|
|
|
mpShapeManager( rShapeManager )
|
2004-11-26 17:58:09 +00:00
|
|
|
{
|
2008-06-24 11:02:42 +00:00
|
|
|
ENSURE_OR_THROW( mpShapeManager,
|
2007-07-17 13:39:43 +00:00
|
|
|
"ShapeSubset::ShapeSubset(): Invalid shape manager" );
|
2004-11-26 17:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ShapeSubset::ShapeSubset( const ShapeSubsetSharedPtr& rOriginalSubset,
|
|
|
|
const DocTreeNode& rTreeNode ) :
|
2006-12-13 14:19:38 +00:00
|
|
|
mpOriginalShape( rOriginalSubset->mpSubsetShape ?
|
2004-11-26 17:58:09 +00:00
|
|
|
rOriginalSubset->mpSubsetShape :
|
|
|
|
rOriginalSubset->mpOriginalShape ),
|
|
|
|
mpSubsetShape(),
|
|
|
|
maTreeNode( rTreeNode ),
|
2007-07-17 13:39:43 +00:00
|
|
|
mpShapeManager( rOriginalSubset->mpShapeManager )
|
2004-11-26 17:58:09 +00:00
|
|
|
{
|
2008-06-24 11:02:42 +00:00
|
|
|
ENSURE_OR_THROW( mpShapeManager,
|
2007-07-17 13:39:43 +00:00
|
|
|
"ShapeSubset::ShapeSubset(): Invalid shape manager" );
|
2008-06-24 11:02:42 +00:00
|
|
|
ENSURE_OR_THROW( rOriginalSubset->maTreeNode.isEmpty() ||
|
2004-11-26 17:58:09 +00:00
|
|
|
(rTreeNode.getStartIndex() >= rOriginalSubset->maTreeNode.getStartIndex() &&
|
|
|
|
rTreeNode.getEndIndex() <= rOriginalSubset->maTreeNode.getEndIndex()),
|
|
|
|
"ShapeSubset::ShapeSubset(): Subset is bigger than parent" );
|
|
|
|
}
|
|
|
|
|
2007-07-17 13:39:43 +00:00
|
|
|
ShapeSubset::ShapeSubset( const AttributableShapeSharedPtr& rOriginalShape,
|
|
|
|
const SubsettableShapeManagerSharedPtr& rShapeManager ) :
|
2004-11-26 17:58:09 +00:00
|
|
|
mpOriginalShape( rOriginalShape ),
|
|
|
|
mpSubsetShape(),
|
|
|
|
maTreeNode(),
|
2007-07-17 13:39:43 +00:00
|
|
|
mpShapeManager( rShapeManager )
|
2004-11-26 17:58:09 +00:00
|
|
|
{
|
2008-06-24 11:02:42 +00:00
|
|
|
ENSURE_OR_THROW( mpShapeManager,
|
2007-07-17 13:39:43 +00:00
|
|
|
"ShapeSubset::ShapeSubset(): Invalid shape manager" );
|
2004-11-26 17:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ShapeSubset::~ShapeSubset()
|
|
|
|
{
|
2006-12-13 14:19:38 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
// if not done yet: revoke subset from original
|
|
|
|
disableSubsetShape();
|
|
|
|
}
|
2007-07-17 13:39:43 +00:00
|
|
|
catch (uno::Exception &)
|
|
|
|
{
|
2006-12-13 14:19:38 +00:00
|
|
|
OSL_ENSURE( false, rtl::OUStringToOString(
|
|
|
|
comphelper::anyToString(
|
|
|
|
cppu::getCaughtException() ),
|
|
|
|
RTL_TEXTENCODING_UTF8 ).getStr() );
|
|
|
|
}
|
2004-11-26 17:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AttributableShapeSharedPtr ShapeSubset::getSubsetShape() const
|
|
|
|
{
|
2006-12-13 14:19:38 +00:00
|
|
|
return mpSubsetShape ? mpSubsetShape : mpOriginalShape;
|
2004-11-26 17:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ShapeSubset::enableSubsetShape()
|
|
|
|
{
|
2006-12-13 14:19:38 +00:00
|
|
|
if( !mpSubsetShape &&
|
2004-11-26 17:58:09 +00:00
|
|
|
!maTreeNode.isEmpty() )
|
|
|
|
{
|
2007-07-17 13:39:43 +00:00
|
|
|
mpSubsetShape = mpShapeManager->getSubsetShape(
|
2004-11-26 17:58:09 +00:00
|
|
|
mpOriginalShape,
|
|
|
|
maTreeNode );
|
|
|
|
}
|
|
|
|
|
2006-12-13 14:19:38 +00:00
|
|
|
return mpSubsetShape;
|
2004-11-26 17:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ShapeSubset::disableSubsetShape()
|
|
|
|
{
|
2006-12-13 14:19:38 +00:00
|
|
|
if( mpSubsetShape )
|
2004-11-26 17:58:09 +00:00
|
|
|
{
|
2007-07-17 13:39:43 +00:00
|
|
|
mpShapeManager->revokeSubset( mpOriginalShape,
|
2004-11-26 17:58:09 +00:00
|
|
|
mpSubsetShape );
|
|
|
|
mpSubsetShape.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ShapeSubset::isFullSet() const
|
|
|
|
{
|
|
|
|
return maTreeNode.isEmpty();
|
|
|
|
}
|
|
|
|
|
2005-05-03 13:05:58 +00:00
|
|
|
DocTreeNode ShapeSubset::getSubset() const
|
|
|
|
{
|
|
|
|
return maTreeNode;
|
|
|
|
}
|
|
|
|
|
2004-11-26 17:58:09 +00:00
|
|
|
}
|
|
|
|
}
|