1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svtools.hxx"
30 
31 #include "svtools/xwindowitem.hxx"
32 
33 #include <vcl/window.hxx>
34 
35 
36 using namespace ::com::sun::star;
37 
38 //////////////////////////////////////////////////////////////////////
39 
40 TYPEINIT1_FACTORY( XWindowItem, SfxPoolItem, new XWindowItem );
41 
42 
43 XWindowItem::XWindowItem() :
44     SfxPoolItem()
45 {
46 }
47 
48 
49 XWindowItem::XWindowItem( sal_uInt16 nWhichId, Window * pWin ) :
50     SfxPoolItem( nWhichId )
51 {
52     if (pWin)
53     {
54         m_xWin = uno::Reference< awt::XWindow >( pWin->GetComponentInterface(), uno::UNO_QUERY );
55         // the assertion can't possibly fails since VCLXWindow implements XWindow...
56         DBG_ASSERT( m_xWin.is(), "failed to get XWindow" );
57     }
58 }
59 
60 
61 XWindowItem::XWindowItem( sal_uInt16 nWhichId, uno::Reference< awt::XWindow > & rxWin ) :
62     SfxPoolItem( nWhichId ),
63     m_xWin( rxWin )
64 {
65 }
66 
67 
68 XWindowItem::XWindowItem( const XWindowItem &rItem ) :
69     SfxPoolItem( Which() ),
70     m_xWin( rItem.m_xWin )
71 {
72 }
73 
74 
75 XWindowItem::~XWindowItem()
76 {
77 }
78 
79 
80 SfxPoolItem * XWindowItem::Clone( SfxItemPool* /*pPool*/ ) const
81 {
82     return new XWindowItem( *this );
83 }
84 
85 
86 int XWindowItem::operator == ( const SfxPoolItem & rAttr ) const
87 {
88     DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
89 
90     const XWindowItem * pItem = dynamic_cast< const XWindowItem * >(&rAttr);
91     return pItem ? m_xWin == pItem->m_xWin : 0;
92 }
93 
94 
95 //////////////////////////////////////////////////////////////////////
96 
97 
98