1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove 25*b1cdbd2cSJim Jagielski #include "precompiled_extensions.hxx" 26*b1cdbd2cSJim Jagielski #include "browserview.hxx" 27*b1cdbd2cSJim Jagielski #include "propertyeditor.hxx" 28*b1cdbd2cSJim Jagielski #include "propctrlr.hrc" 29*b1cdbd2cSJim Jagielski #include <tools/debug.hxx> 30*b1cdbd2cSJim Jagielski #include <memory> 31*b1cdbd2cSJim Jagielski 32*b1cdbd2cSJim Jagielski //............................................................................ 33*b1cdbd2cSJim Jagielski namespace pcr 34*b1cdbd2cSJim Jagielski { 35*b1cdbd2cSJim Jagielski //............................................................................ 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::uno; 38*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::lang; 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski //======================================================================== 42*b1cdbd2cSJim Jagielski //= class OPropertyBrowserView 43*b1cdbd2cSJim Jagielski //======================================================================== DBG_NAME(OPropertyBrowserView)44*b1cdbd2cSJim Jagielski DBG_NAME(OPropertyBrowserView) 45*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ 46*b1cdbd2cSJim Jagielski OPropertyBrowserView::OPropertyBrowserView( const Reference< XMultiServiceFactory >& _rxORB, 47*b1cdbd2cSJim Jagielski Window* _pParent, WinBits nBits) 48*b1cdbd2cSJim Jagielski :Window(_pParent, nBits | WB_3DLOOK) 49*b1cdbd2cSJim Jagielski ,m_xORB(_rxORB) 50*b1cdbd2cSJim Jagielski ,m_nActivePage(0) 51*b1cdbd2cSJim Jagielski { 52*b1cdbd2cSJim Jagielski DBG_CTOR(OPropertyBrowserView,NULL); 53*b1cdbd2cSJim Jagielski 54*b1cdbd2cSJim Jagielski m_pPropBox = new OPropertyEditor( this ); 55*b1cdbd2cSJim Jagielski m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR); 56*b1cdbd2cSJim Jagielski m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation)); 57*b1cdbd2cSJim Jagielski 58*b1cdbd2cSJim Jagielski m_pPropBox->Show(); 59*b1cdbd2cSJim Jagielski } 60*b1cdbd2cSJim Jagielski 61*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ IMPL_LINK(OPropertyBrowserView,OnPageActivation,void *,EMPTYARG)62*b1cdbd2cSJim Jagielski IMPL_LINK(OPropertyBrowserView, OnPageActivation, void*, EMPTYARG) 63*b1cdbd2cSJim Jagielski { 64*b1cdbd2cSJim Jagielski m_nActivePage = m_pPropBox->GetCurPage(); 65*b1cdbd2cSJim Jagielski if (m_aPageActivationHandler.IsSet()) 66*b1cdbd2cSJim Jagielski m_aPageActivationHandler.Call(NULL); 67*b1cdbd2cSJim Jagielski return 0L; 68*b1cdbd2cSJim Jagielski } 69*b1cdbd2cSJim Jagielski 70*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ ~OPropertyBrowserView()71*b1cdbd2cSJim Jagielski OPropertyBrowserView::~OPropertyBrowserView() 72*b1cdbd2cSJim Jagielski { 73*b1cdbd2cSJim Jagielski if(m_pPropBox) 74*b1cdbd2cSJim Jagielski { 75*b1cdbd2cSJim Jagielski sal_uInt16 nTmpPage = m_pPropBox->GetCurPage(); 76*b1cdbd2cSJim Jagielski if (nTmpPage) 77*b1cdbd2cSJim Jagielski m_nActivePage = nTmpPage; 78*b1cdbd2cSJim Jagielski ::std::auto_ptr<Window> aTemp(m_pPropBox); 79*b1cdbd2cSJim Jagielski m_pPropBox = NULL; 80*b1cdbd2cSJim Jagielski } 81*b1cdbd2cSJim Jagielski m_xORB = NULL; 82*b1cdbd2cSJim Jagielski 83*b1cdbd2cSJim Jagielski DBG_DTOR(OPropertyBrowserView, NULL); 84*b1cdbd2cSJim Jagielski } 85*b1cdbd2cSJim Jagielski 86*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ activatePage(sal_uInt16 _nPage)87*b1cdbd2cSJim Jagielski void OPropertyBrowserView::activatePage(sal_uInt16 _nPage) 88*b1cdbd2cSJim Jagielski { 89*b1cdbd2cSJim Jagielski m_nActivePage = _nPage; 90*b1cdbd2cSJim Jagielski getPropertyBox().SetPage(m_nActivePage); 91*b1cdbd2cSJim Jagielski } 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ GetFocus()94*b1cdbd2cSJim Jagielski void OPropertyBrowserView::GetFocus() 95*b1cdbd2cSJim Jagielski { 96*b1cdbd2cSJim Jagielski if (m_pPropBox) 97*b1cdbd2cSJim Jagielski m_pPropBox->GrabFocus(); 98*b1cdbd2cSJim Jagielski else 99*b1cdbd2cSJim Jagielski Window::GetFocus(); 100*b1cdbd2cSJim Jagielski } 101*b1cdbd2cSJim Jagielski 102*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ Notify(NotifyEvent & _rNEvt)103*b1cdbd2cSJim Jagielski long OPropertyBrowserView::Notify( NotifyEvent& _rNEvt ) 104*b1cdbd2cSJim Jagielski { 105*b1cdbd2cSJim Jagielski if ( EVENT_KEYINPUT == _rNEvt.GetType() ) 106*b1cdbd2cSJim Jagielski { 107*b1cdbd2cSJim Jagielski sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); 108*b1cdbd2cSJim Jagielski 109*b1cdbd2cSJim Jagielski if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) ) 110*b1cdbd2cSJim Jagielski // silence this, we don't want to propagate this outside the property 111*b1cdbd2cSJim Jagielski // browser, as it will probably do harm there 112*b1cdbd2cSJim Jagielski // #i63285# / 2006-12-06 / frank.schoenheit@sun.com 113*b1cdbd2cSJim Jagielski return 1; 114*b1cdbd2cSJim Jagielski } 115*b1cdbd2cSJim Jagielski return Window::Notify( _rNEvt ); 116*b1cdbd2cSJim Jagielski } 117*b1cdbd2cSJim Jagielski 118*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ Resize()119*b1cdbd2cSJim Jagielski void OPropertyBrowserView::Resize() 120*b1cdbd2cSJim Jagielski { 121*b1cdbd2cSJim Jagielski Size aSize = GetOutputSizePixel(); 122*b1cdbd2cSJim Jagielski m_pPropBox->SetSizePixel(aSize); 123*b1cdbd2cSJim Jagielski } 124*b1cdbd2cSJim Jagielski 125*b1cdbd2cSJim Jagielski // #95343# --------------------------------------------------------------- getMinimumSize()126*b1cdbd2cSJim Jagielski ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize() 127*b1cdbd2cSJim Jagielski { 128*b1cdbd2cSJim Jagielski Size aSize = GetOutputSizePixel(); 129*b1cdbd2cSJim Jagielski if( m_pPropBox ) 130*b1cdbd2cSJim Jagielski { 131*b1cdbd2cSJim Jagielski aSize.setHeight( m_pPropBox->getMinimumHeight() ); 132*b1cdbd2cSJim Jagielski aSize.setWidth( m_pPropBox->getMinimumWidth() ); 133*b1cdbd2cSJim Jagielski } 134*b1cdbd2cSJim Jagielski return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() ); 135*b1cdbd2cSJim Jagielski } 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski //............................................................................ 138*b1cdbd2cSJim Jagielski } // namespace pcr 139*b1cdbd2cSJim Jagielski //............................................................................ 140*b1cdbd2cSJim Jagielski 141