lok: impress: show only supported transitions in the side pane
[LibreOffice.git] / sfx2 / source / doc / objitem.cxx
blob5b5483df5ce883d2a7dd52377b6fbcb8577e4add
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <sfx2/objsh.hxx>
22 #include <sfx2/objitem.hxx>
23 #include <com/sun/star/lang/XUnoTunnel.hpp>
24 #include <com/sun/star/frame/XModel.hpp>
26 #include <tools/globname.hxx>
29 SfxPoolItem* SfxObjectShellItem::CreateDefault() { return new SfxObjectShellItem; }
31 SfxPoolItem* SfxObjectItem::CreateDefault() { return new SfxObjectItem; }
33 bool SfxObjectShellItem::operator==( const SfxPoolItem &rItem ) const
35 return SfxPoolItem::operator==(rItem) &&
36 static_cast<const SfxObjectShellItem&>(rItem).pObjSh == pObjSh;
39 SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const
41 return new SfxObjectShellItem( *this );
44 bool SfxObjectShellItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
46 if ( pObjSh )
48 // This item MUST provide a model. Please don't change this, there are UNO-based
49 // implementations which need it!!
50 rVal <<= pObjSh->GetModel();
52 else
54 rVal <<= css::uno::Reference< css::frame::XModel >();
56 return true;
59 bool SfxObjectShellItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
61 // This item MUST have a model. Please don't change this, there are UNO-based
62 // implementations which need it!!
63 css::uno::Reference< css::frame::XModel > xModel;
65 if ( rVal >>= xModel )
67 if ( xModel.is() )
69 css::uno::Reference< css::lang::XUnoTunnel > xTunnel( xModel, css::uno::UNO_QUERY );
70 if ( xTunnel.is() )
72 css::uno::Sequence < sal_Int8 > aSeq = SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence();
73 sal_Int64 nHandle = xTunnel->getSomething( aSeq );
74 if ( nHandle )
76 pObjSh = reinterpret_cast< SfxObjectShell* >(sal::static_int_cast<sal_IntPtr>( nHandle ));
77 return true;
82 pObjSh = nullptr;
83 return true;
86 return true;
89 SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId, SfxShell *pSh )
90 : SfxPoolItem( nWhichId ),
91 _pSh( pSh )
94 bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const
96 return SfxPoolItem::operator==(rItem) &&
97 static_cast<const SfxObjectItem&>(rItem)._pSh == _pSh;
100 SfxPoolItem* SfxObjectItem::Clone( SfxItemPool *) const
102 return new SfxObjectItem( *this );
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */