masterfix DEV300: #i10000# build fix
[LibreOffice.git] / extensions / source / propctrlr / browserview.cxx
bloba023c5ef6b0151e8258c9a72fb55477113572f8b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
30 #include "browserview.hxx"
31 #include "propertyeditor.hxx"
32 #include "propctrlr.hrc"
33 #include <tools/debug.hxx>
34 #include <memory>
36 //............................................................................
37 namespace pcr
39 //............................................................................
41 using namespace ::com::sun::star::uno;
42 using namespace ::com::sun::star::lang;
45 //========================================================================
46 //= class OPropertyBrowserView
47 //========================================================================
48 DBG_NAME(OPropertyBrowserView)
49 //------------------------------------------------------------------------
50 OPropertyBrowserView::OPropertyBrowserView( const Reference< XMultiServiceFactory >& _rxORB,
51 Window* _pParent, WinBits nBits)
52 :Window(_pParent, nBits | WB_3DLOOK)
53 ,m_xORB(_rxORB)
54 ,m_nActivePage(0)
56 DBG_CTOR(OPropertyBrowserView,NULL);
58 m_pPropBox = new OPropertyEditor( this );
59 m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
60 m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
62 m_pPropBox->Show();
65 //------------------------------------------------------------------------
66 IMPL_LINK(OPropertyBrowserView, OnPageActivation, void*, EMPTYARG)
68 m_nActivePage = m_pPropBox->GetCurPage();
69 if (m_aPageActivationHandler.IsSet())
70 m_aPageActivationHandler.Call(NULL);
71 return 0L;
74 //------------------------------------------------------------------------
75 OPropertyBrowserView::~OPropertyBrowserView()
77 if(m_pPropBox)
79 sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
80 if (nTmpPage)
81 m_nActivePage = nTmpPage;
82 ::std::auto_ptr<Window> aTemp(m_pPropBox);
83 m_pPropBox = NULL;
85 m_xORB = NULL;
87 DBG_DTOR(OPropertyBrowserView, NULL);
90 //------------------------------------------------------------------------
91 void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
93 m_nActivePage = _nPage;
94 getPropertyBox().SetPage(m_nActivePage);
97 //------------------------------------------------------------------------
98 void OPropertyBrowserView::GetFocus()
100 if (m_pPropBox)
101 m_pPropBox->GrabFocus();
102 else
103 Window::GetFocus();
106 //------------------------------------------------------------------------
107 long OPropertyBrowserView::Notify( NotifyEvent& _rNEvt )
109 if ( EVENT_KEYINPUT == _rNEvt.GetType() )
111 sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
113 if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
114 // silence this, we don't want to propagate this outside the property
115 // browser, as it will probably do harm there
116 // #i63285# / 2006-12-06 / frank.schoenheit@sun.com
117 return 1;
119 return Window::Notify( _rNEvt );
122 //------------------------------------------------------------------------
123 void OPropertyBrowserView::Resize()
125 Size aSize = GetOutputSizePixel();
126 m_pPropBox->SetSizePixel(aSize);
129 // #95343# ---------------------------------------------------------------
130 ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize()
132 Size aSize = GetOutputSizePixel();
133 if( m_pPropBox )
135 aSize.setHeight( m_pPropBox->getMinimumHeight() );
136 aSize.setWidth( m_pPropBox->getMinimumWidth() );
138 return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
141 //............................................................................
142 } // namespace pcr
143 //............................................................................