Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / extensions / source / propctrlr / browserview.cxx
blob2b7f003bf54ec244e077c1513dcefe8944785c19
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 <memory>
27 namespace pcr
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::lang;
32 OPropertyBrowserView::OPropertyBrowserView(vcl::Window* _pParent)
33 :Window(_pParent, WB_3DLOOK)
34 ,m_nActivePage(0)
36 m_pPropBox = VclPtr<OPropertyEditor>::Create( this );
37 m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
38 m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
40 m_pPropBox->Show();
44 IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation, LinkParamNone*, void)
46 m_nActivePage = m_pPropBox->GetCurPage();
47 m_aPageActivationHandler.Call(nullptr);
51 OPropertyBrowserView::~OPropertyBrowserView()
53 disposeOnce();
56 void OPropertyBrowserView::dispose()
58 if(m_pPropBox)
60 sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
61 if (nTmpPage)
62 m_nActivePage = nTmpPage;
64 m_pPropBox.disposeAndClear();
65 vcl::Window::dispose();
69 void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
71 m_nActivePage = _nPage;
72 getPropertyBox().SetPage(m_nActivePage);
76 void OPropertyBrowserView::GetFocus()
78 if (m_pPropBox)
79 m_pPropBox->GrabFocus();
80 else
81 Window::GetFocus();
85 bool OPropertyBrowserView::EventNotify( NotifyEvent& _rNEvt )
87 if ( MouseNotifyEvent::KEYINPUT == _rNEvt.GetType() )
89 sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
91 if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
92 // silence this, we don't want to propagate this outside the property
93 // browser, as it will probably do harm there
94 // #i63285#
95 return true;
97 return Window::EventNotify(_rNEvt);
101 void OPropertyBrowserView::Resize()
103 Size aSize = GetOutputSizePixel();
104 m_pPropBox->SetSizePixel(aSize);
107 css::awt::Size OPropertyBrowserView::getMinimumSize() const
109 Size aSize = GetOutputSizePixel();
110 if( m_pPropBox )
112 aSize.setHeight( m_pPropBox->getMinimumHeight() );
113 aSize.setWidth( m_pPropBox->getMinimumWidth() );
115 return css::awt::Size( aSize.Width(), aSize.Height() );
119 } // namespace pcr
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */