Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / extensions / source / propctrlr / browserview.cxx
blob48f19b53bae925a7ea9b63d273ff390060b6307f
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 <vcl/tabpage.hxx>
24 #include <memory>
26 namespace pcr
28 using namespace ::com::sun::star::uno;
29 using namespace ::com::sun::star::lang;
31 OPropertyBrowserView::OPropertyBrowserView(vcl::Window* _pParent)
32 :Window(_pParent, 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, LinkParamNone*, void)
45 m_nActivePage = m_pPropBox->GetCurPage();
46 m_aPageActivationHandler.Call(nullptr);
50 OPropertyBrowserView::~OPropertyBrowserView()
52 disposeOnce();
55 void OPropertyBrowserView::dispose()
57 if(m_pPropBox)
59 sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
60 if (nTmpPage)
61 m_nActivePage = nTmpPage;
63 m_pPropBox.disposeAndClear();
64 vcl::Window::dispose();
68 void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
70 m_nActivePage = _nPage;
71 getPropertyBox().SetPage(m_nActivePage);
75 void OPropertyBrowserView::GetFocus()
77 if (m_pPropBox)
78 m_pPropBox->GrabFocus();
79 else
80 Window::GetFocus();
84 bool OPropertyBrowserView::EventNotify( NotifyEvent& _rNEvt )
86 if ( MouseNotifyEvent::KEYINPUT == _rNEvt.GetType() )
88 sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
90 if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
91 // silence this, we don't want to propagate this outside the property
92 // browser, as it will probably do harm there
93 // #i63285#
94 return true;
96 return Window::EventNotify(_rNEvt);
100 void OPropertyBrowserView::Resize()
102 Size aSize = GetOutputSizePixel();
103 m_pPropBox->SetSizePixel(aSize);
106 css::awt::Size OPropertyBrowserView::getMinimumSize()
108 Size aSize = GetOutputSizePixel();
109 if( m_pPropBox )
111 aSize.setHeight( m_pPropBox->getMinimumHeight() );
112 aSize.setWidth( m_pPropBox->getMinimumWidth() );
114 return css::awt::Size( aSize.Width(), aSize.Height() );
118 } // namespace pcr
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */