Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / cppcanvas / source / wrapper / implcustomsprite.cxx
blobc15023f1a6476b4101141523ce43fad15a8452c3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <basegfx/polygon/b2dpolypolygon.hxx>
32 #include "implcustomsprite.hxx"
33 #include "implcanvas.hxx"
35 using namespace ::com::sun::star;
37 namespace cppcanvas
39 namespace internal
41 ImplCustomSprite::ImplCustomSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
42 const uno::Reference< rendering::XCustomSprite >& rSprite,
43 const ImplSpriteCanvas::TransformationArbiterSharedPtr& rTransformArbiter ) :
44 ImplSprite( rParentCanvas,
45 uno::Reference< rendering::XSprite >(rSprite,
46 uno::UNO_QUERY),
47 rTransformArbiter ),
48 mpLastCanvas(),
49 mxCustomSprite( rSprite )
51 OSL_ENSURE( rParentCanvas.is(), "ImplCustomSprite::ImplCustomSprite(): Invalid canvas" );
52 OSL_ENSURE( mxCustomSprite.is(), "ImplCustomSprite::ImplCustomSprite(): Invalid sprite" );
55 ImplCustomSprite::~ImplCustomSprite()
59 CanvasSharedPtr ImplCustomSprite::getContentCanvas() const
61 OSL_ENSURE( mxCustomSprite.is(), "ImplCustomSprite::getContentCanvas(): Invalid sprite" );
63 if( !mxCustomSprite.is() )
64 return CanvasSharedPtr();
66 uno::Reference< rendering::XCanvas > xCanvas( mxCustomSprite->getContentCanvas() );
68 if( !xCanvas.is() )
69 return CanvasSharedPtr();
71 // cache content canvas C++ wrapper
72 if( mpLastCanvas.get() == NULL ||
73 mpLastCanvas->getUNOCanvas() != xCanvas )
75 mpLastCanvas = CanvasSharedPtr( new ImplCanvas( xCanvas ) );
78 return mpLastCanvas;
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */