Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "browserview.hxx"
21 : #include "propertyeditor.hxx"
22 : #include "propctrlr.hrc"
23 : #include <tools/debug.hxx>
24 : #include <boost/scoped_ptr.hpp>
25 :
26 :
27 : namespace pcr
28 : {
29 :
30 :
31 : using namespace ::com::sun::star::uno;
32 : using namespace ::com::sun::star::lang;
33 :
34 :
35 :
36 : //= class OPropertyBrowserView
37 :
38 :
39 0 : OPropertyBrowserView::OPropertyBrowserView(Window* _pParent, WinBits nBits)
40 : :Window(_pParent, nBits | WB_3DLOOK)
41 0 : ,m_nActivePage(0)
42 : {
43 0 : m_pPropBox = new OPropertyEditor( this );
44 0 : m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
45 0 : m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
46 :
47 0 : m_pPropBox->Show();
48 0 : }
49 :
50 :
51 0 : IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation)
52 : {
53 0 : m_nActivePage = m_pPropBox->GetCurPage();
54 0 : if (m_aPageActivationHandler.IsSet())
55 0 : m_aPageActivationHandler.Call(NULL);
56 0 : return 0L;
57 : }
58 :
59 :
60 0 : OPropertyBrowserView::~OPropertyBrowserView()
61 : {
62 0 : if(m_pPropBox)
63 : {
64 0 : sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
65 0 : if (nTmpPage)
66 0 : m_nActivePage = nTmpPage;
67 0 : boost::scoped_ptr<Window> aTemp(m_pPropBox);
68 0 : m_pPropBox = NULL;
69 : }
70 :
71 0 : }
72 :
73 :
74 0 : void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
75 : {
76 0 : m_nActivePage = _nPage;
77 0 : getPropertyBox().SetPage(m_nActivePage);
78 0 : }
79 :
80 :
81 0 : void OPropertyBrowserView::GetFocus()
82 : {
83 0 : if (m_pPropBox)
84 0 : m_pPropBox->GrabFocus();
85 : else
86 0 : Window::GetFocus();
87 0 : }
88 :
89 :
90 0 : bool OPropertyBrowserView::Notify( NotifyEvent& _rNEvt )
91 : {
92 0 : if ( EVENT_KEYINPUT == _rNEvt.GetType() )
93 : {
94 0 : sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
95 :
96 0 : if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
97 : // silence this, we don't want to propagate this outside the property
98 : // browser, as it will probably do harm there
99 : // #i63285#
100 0 : return true;
101 : }
102 0 : return Window::Notify( _rNEvt );
103 : }
104 :
105 :
106 0 : void OPropertyBrowserView::Resize()
107 : {
108 0 : Size aSize = GetOutputSizePixel();
109 0 : m_pPropBox->SetSizePixel(aSize);
110 0 : }
111 :
112 : // #95343# ---------------------------------------------------------------
113 0 : ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize()
114 : {
115 0 : Size aSize = GetOutputSizePixel();
116 0 : if( m_pPropBox )
117 : {
118 0 : aSize.setHeight( m_pPropBox->getMinimumHeight() );
119 0 : aSize.setWidth( m_pPropBox->getMinimumWidth() );
120 : }
121 0 : return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
122 : }
123 :
124 :
125 : } // namespace pcr
126 :
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|