bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / propctrlr / browserview.cxx
blob7bfd6915384a0a65d15d464bb0eac96ca009864f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "browserview.hxx"
21 #include "propertyeditor.hxx"
22 #include "propctrlr.hrc"
23 #include <boost/scoped_ptr.hpp>
24 #include <vcl/tabpage.hxx>
26 namespace pcr
28 using namespace ::com::sun::star::uno;
29 using namespace ::com::sun::star::lang;
31 OPropertyBrowserView::OPropertyBrowserView(vcl::Window* _pParent, WinBits nBits)
32 :Window(_pParent, nBits | WB_3DLOOK)
33 ,m_nActivePage(0)
35 m_pPropBox = VclPtr<OPropertyEditor>::Create( this );
36 m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
37 m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
39 m_pPropBox->Show();
43 IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation)
45 m_nActivePage = m_pPropBox->GetCurPage();
46 if (m_aPageActivationHandler.IsSet())
47 m_aPageActivationHandler.Call(NULL);
48 return 0L;
52 OPropertyBrowserView::~OPropertyBrowserView()
54 disposeOnce();
57 void OPropertyBrowserView::dispose()
59 if(m_pPropBox)
61 sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
62 if (nTmpPage)
63 m_nActivePage = nTmpPage;
65 m_pPropBox.disposeAndClear();
66 vcl::Window::dispose();
70 void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
72 m_nActivePage = _nPage;
73 getPropertyBox().SetPage(m_nActivePage);
77 void OPropertyBrowserView::GetFocus()
79 if (m_pPropBox)
80 m_pPropBox->GrabFocus();
81 else
82 Window::GetFocus();
86 bool OPropertyBrowserView::Notify( NotifyEvent& _rNEvt )
88 if ( MouseNotifyEvent::KEYINPUT == _rNEvt.GetType() )
90 sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
92 if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
93 // silence this, we don't want to propagate this outside the property
94 // browser, as it will probably do harm there
95 // #i63285#
96 return true;
98 return Window::Notify( _rNEvt );
102 void OPropertyBrowserView::Resize()
104 Size aSize = GetOutputSizePixel();
105 m_pPropBox->SetSizePixel(aSize);
108 // #95343# ---------------------------------------------------------------
109 ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize()
111 Size aSize = GetOutputSizePixel();
112 if( m_pPropBox )
114 aSize.setHeight( m_pPropBox->getMinimumHeight() );
115 aSize.setWidth( m_pPropBox->getMinimumWidth() );
117 return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
121 } // namespace pcr
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */