1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svtools.hxx" 26 27 #include "svtools/xwindowitem.hxx" 28 29 #include <vcl/window.hxx> 30 31 32 using namespace ::com::sun::star; 33 34 ////////////////////////////////////////////////////////////////////// 35 36 TYPEINIT1_FACTORY( XWindowItem, SfxPoolItem, new XWindowItem ); 37 38 39 XWindowItem::XWindowItem() : 40 SfxPoolItem() 41 { 42 } 43 44 45 XWindowItem::XWindowItem( sal_uInt16 nWhichId, Window * pWin ) : 46 SfxPoolItem( nWhichId ) 47 { 48 if (pWin) 49 { 50 m_xWin = uno::Reference< awt::XWindow >( pWin->GetComponentInterface(), uno::UNO_QUERY ); 51 // the assertion can't possibly fails since VCLXWindow implements XWindow... 52 DBG_ASSERT( m_xWin.is(), "failed to get XWindow" ); 53 } 54 } 55 56 57 XWindowItem::XWindowItem( sal_uInt16 nWhichId, uno::Reference< awt::XWindow > & rxWin ) : 58 SfxPoolItem( nWhichId ), 59 m_xWin( rxWin ) 60 { 61 } 62 63 64 XWindowItem::XWindowItem( const XWindowItem &rItem ) : 65 SfxPoolItem( Which() ), 66 m_xWin( rItem.m_xWin ) 67 { 68 } 69 70 71 XWindowItem::~XWindowItem() 72 { 73 } 74 75 76 SfxPoolItem * XWindowItem::Clone( SfxItemPool* /*pPool*/ ) const 77 { 78 return new XWindowItem( *this ); 79 } 80 81 82 int XWindowItem::operator == ( const SfxPoolItem & rAttr ) const 83 { 84 DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); 85 86 const XWindowItem * pItem = dynamic_cast< const XWindowItem * >(&rAttr); 87 return pItem ? m_xWin == pItem->m_xWin : 0; 88 } 89 90 91 ////////////////////////////////////////////////////////////////////// 92 93 94