1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_extensions.hxx" 30*cdf0e10cSrcweir #include "browserview.hxx" 31*cdf0e10cSrcweir #include "propertyeditor.hxx" 32*cdf0e10cSrcweir #include "propctrlr.hrc" 33*cdf0e10cSrcweir #include <tools/debug.hxx> 34*cdf0e10cSrcweir #include <memory> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir //............................................................................ 37*cdf0e10cSrcweir namespace pcr 38*cdf0e10cSrcweir { 39*cdf0e10cSrcweir //............................................................................ 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 42*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //======================================================================== 46*cdf0e10cSrcweir //= class OPropertyBrowserView 47*cdf0e10cSrcweir //======================================================================== 48*cdf0e10cSrcweir DBG_NAME(OPropertyBrowserView) 49*cdf0e10cSrcweir //------------------------------------------------------------------------ 50*cdf0e10cSrcweir OPropertyBrowserView::OPropertyBrowserView( const Reference< XMultiServiceFactory >& _rxORB, 51*cdf0e10cSrcweir Window* _pParent, WinBits nBits) 52*cdf0e10cSrcweir :Window(_pParent, nBits | WB_3DLOOK) 53*cdf0e10cSrcweir ,m_xORB(_rxORB) 54*cdf0e10cSrcweir ,m_nActivePage(0) 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir DBG_CTOR(OPropertyBrowserView,NULL); 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir m_pPropBox = new OPropertyEditor( this ); 59*cdf0e10cSrcweir m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR); 60*cdf0e10cSrcweir m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation)); 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir m_pPropBox->Show(); 63*cdf0e10cSrcweir } 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir //------------------------------------------------------------------------ 66*cdf0e10cSrcweir IMPL_LINK(OPropertyBrowserView, OnPageActivation, void*, EMPTYARG) 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir m_nActivePage = m_pPropBox->GetCurPage(); 69*cdf0e10cSrcweir if (m_aPageActivationHandler.IsSet()) 70*cdf0e10cSrcweir m_aPageActivationHandler.Call(NULL); 71*cdf0e10cSrcweir return 0L; 72*cdf0e10cSrcweir } 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir //------------------------------------------------------------------------ 75*cdf0e10cSrcweir OPropertyBrowserView::~OPropertyBrowserView() 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir if(m_pPropBox) 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir sal_uInt16 nTmpPage = m_pPropBox->GetCurPage(); 80*cdf0e10cSrcweir if (nTmpPage) 81*cdf0e10cSrcweir m_nActivePage = nTmpPage; 82*cdf0e10cSrcweir ::std::auto_ptr<Window> aTemp(m_pPropBox); 83*cdf0e10cSrcweir m_pPropBox = NULL; 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir m_xORB = NULL; 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir DBG_DTOR(OPropertyBrowserView, NULL); 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir //------------------------------------------------------------------------ 91*cdf0e10cSrcweir void OPropertyBrowserView::activatePage(sal_uInt16 _nPage) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir m_nActivePage = _nPage; 94*cdf0e10cSrcweir getPropertyBox().SetPage(m_nActivePage); 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir //------------------------------------------------------------------------ 98*cdf0e10cSrcweir void OPropertyBrowserView::GetFocus() 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir if (m_pPropBox) 101*cdf0e10cSrcweir m_pPropBox->GrabFocus(); 102*cdf0e10cSrcweir else 103*cdf0e10cSrcweir Window::GetFocus(); 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir //------------------------------------------------------------------------ 107*cdf0e10cSrcweir long OPropertyBrowserView::Notify( NotifyEvent& _rNEvt ) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir if ( EVENT_KEYINPUT == _rNEvt.GetType() ) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) ) 114*cdf0e10cSrcweir // silence this, we don't want to propagate this outside the property 115*cdf0e10cSrcweir // browser, as it will probably do harm there 116*cdf0e10cSrcweir // #i63285# / 2006-12-06 / frank.schoenheit@sun.com 117*cdf0e10cSrcweir return 1; 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir return Window::Notify( _rNEvt ); 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir //------------------------------------------------------------------------ 123*cdf0e10cSrcweir void OPropertyBrowserView::Resize() 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir Size aSize = GetOutputSizePixel(); 126*cdf0e10cSrcweir m_pPropBox->SetSizePixel(aSize); 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir // #95343# --------------------------------------------------------------- 130*cdf0e10cSrcweir ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize() 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir Size aSize = GetOutputSizePixel(); 133*cdf0e10cSrcweir if( m_pPropBox ) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir aSize.setHeight( m_pPropBox->getMinimumHeight() ); 136*cdf0e10cSrcweir aSize.setWidth( m_pPropBox->getMinimumWidth() ); 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() ); 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir //............................................................................ 142*cdf0e10cSrcweir } // namespace pcr 143*cdf0e10cSrcweir //............................................................................ 144*cdf0e10cSrcweir 145