bump product version to 6.3.0.0.beta1
[LibreOffice.git] / extensions / source / propctrlr / browserview.cxx
blob804c55d9191496d2539875e52df629080f1e01fe
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 <helpids.h>
23 #include <propctrlr.h>
24 #include <vcl/event.hxx>
25 #include <vcl/tabpage.hxx>
26 #include <memory>
28 namespace pcr
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::lang;
33 OPropertyBrowserView::OPropertyBrowserView(vcl::Window* _pParent)
34 :Window(_pParent, WB_3DLOOK)
35 ,m_nActivePage(0)
37 m_pPropBox = VclPtr<OPropertyEditor>::Create( this );
38 m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
39 m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
41 m_pPropBox->Show();
45 IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation, LinkParamNone*, void)
47 m_nActivePage = m_pPropBox->GetCurPage();
48 m_aPageActivationHandler.Call(nullptr);
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::EventNotify( 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::EventNotify(_rNEvt);
102 void OPropertyBrowserView::Resize()
104 Size aSize = GetOutputSizePixel();
105 m_pPropBox->SetSizePixel(aSize);
108 css::awt::Size OPropertyBrowserView::getMinimumSize()
110 Size aSize = GetOutputSizePixel();
111 if( m_pPropBox )
113 aSize.setHeight( m_pPropBox->getMinimumHeight() );
114 aSize.setWidth( m_pPropBox->getMinimumWidth() );
116 return css::awt::Size( aSize.Width(), aSize.Height() );
120 } // namespace pcr
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */