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