1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/frame/XModel.hpp>
26 SfxPoolItem
* SfxObjectShellItem::CreateDefault() { return new SfxObjectShellItem
; }
28 SfxPoolItem
* SfxObjectItem::CreateDefault() { return new SfxObjectItem
; }
30 bool SfxObjectShellItem::operator==( const SfxPoolItem
&rItem
) const
32 return SfxPoolItem::operator==(rItem
) &&
33 static_cast<const SfxObjectShellItem
&>(rItem
).pObjSh
== pObjSh
;
36 SfxObjectShellItem
* SfxObjectShellItem::Clone( SfxItemPool
*) const
38 return new SfxObjectShellItem( *this );
41 bool SfxObjectShellItem::QueryValue( css::uno::Any
& rVal
, sal_uInt8
/*nMemberId*/ ) const
45 // This item MUST provide a model. Please don't change this, there are UNO-based
46 // implementations which need it!!
47 rVal
<<= pObjSh
->GetModel();
51 rVal
<<= css::uno::Reference
< css::frame::XModel
>();
56 bool SfxObjectShellItem::PutValue( const css::uno::Any
& rVal
, sal_uInt8
/*nMemberId*/ )
58 // This item MUST have a model. Please don't change this, there are UNO-based
59 // implementations which need it!!
60 css::uno::Reference
< css::frame::XModel
> xModel
;
62 if ( rVal
>>= xModel
)
64 pObjSh
= SfxObjectShell::GetShellFromComponent(xModel
);
71 SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId
, SfxShell
*pSh
)
72 : SfxPoolItem( nWhichId
),
76 bool SfxObjectItem::operator==( const SfxPoolItem
&rItem
) const
78 return SfxPoolItem::operator==(rItem
) &&
79 static_cast<const SfxObjectItem
&>(rItem
)._pSh
== _pSh
;
82 SfxObjectItem
* SfxObjectItem::Clone( SfxItemPool
*) const
84 return new SfxObjectItem( *this );
87 bool SfxObjectItem::QueryValue(css::uno::Any
&, sal_uInt8
) const
92 bool SfxObjectItem::PutValue(const css::uno::Any
&, sal_uInt8
)
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */