1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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
)
35 m_pPropBox
= VclPtr
<OPropertyEditor
>::Create( this );
36 m_pPropBox
->SetHelpId(HID_FM_PROPDLG_TABCTR
);
37 m_pPropBox
->setPageActivationHandler(LINK(this, OPropertyBrowserView
, OnPageActivation
));
43 IMPL_LINK_NOARG(OPropertyBrowserView
, OnPageActivation
)
45 m_nActivePage
= m_pPropBox
->GetCurPage();
46 if (m_aPageActivationHandler
.IsSet())
47 m_aPageActivationHandler
.Call(NULL
);
52 OPropertyBrowserView::~OPropertyBrowserView()
57 void OPropertyBrowserView::dispose()
61 sal_uInt16 nTmpPage
= m_pPropBox
->GetCurPage();
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()
80 m_pPropBox
->GrabFocus();
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
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();
114 aSize
.setHeight( m_pPropBox
->getMinimumHeight() );
115 aSize
.setWidth( m_pPropBox
->getMinimumWidth() );
117 return ::com::sun::star::awt::Size( aSize
.Width(), aSize
.Height() );
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */