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 <memory>
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 : DBG_NAME(OPropertyBrowserView)
39 : //------------------------------------------------------------------------
40 0 : OPropertyBrowserView::OPropertyBrowserView( const Reference< XMultiServiceFactory >& _rxORB,
41 : Window* _pParent, WinBits nBits)
42 : :Window(_pParent, nBits | WB_3DLOOK)
43 : ,m_xORB(_rxORB)
44 0 : ,m_nActivePage(0)
45 : {
46 : DBG_CTOR(OPropertyBrowserView,NULL);
47 :
48 0 : m_pPropBox = new OPropertyEditor( this );
49 0 : m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
50 0 : m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
51 :
52 0 : m_pPropBox->Show();
53 0 : }
54 :
55 : //------------------------------------------------------------------------
56 0 : IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation)
57 : {
58 0 : m_nActivePage = m_pPropBox->GetCurPage();
59 0 : if (m_aPageActivationHandler.IsSet())
60 0 : m_aPageActivationHandler.Call(NULL);
61 0 : return 0L;
62 : }
63 :
64 : //------------------------------------------------------------------------
65 0 : OPropertyBrowserView::~OPropertyBrowserView()
66 : {
67 0 : if(m_pPropBox)
68 : {
69 0 : sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
70 0 : if (nTmpPage)
71 0 : m_nActivePage = nTmpPage;
72 0 : ::std::auto_ptr<Window> aTemp(m_pPropBox);
73 0 : m_pPropBox = NULL;
74 : }
75 0 : m_xORB = NULL;
76 :
77 : DBG_DTOR(OPropertyBrowserView, NULL);
78 0 : }
79 :
80 : //------------------------------------------------------------------------
81 0 : void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
82 : {
83 0 : m_nActivePage = _nPage;
84 0 : getPropertyBox().SetPage(m_nActivePage);
85 0 : }
86 :
87 : //------------------------------------------------------------------------
88 0 : void OPropertyBrowserView::GetFocus()
89 : {
90 0 : if (m_pPropBox)
91 0 : m_pPropBox->GrabFocus();
92 : else
93 0 : Window::GetFocus();
94 0 : }
95 :
96 : //------------------------------------------------------------------------
97 0 : long OPropertyBrowserView::Notify( NotifyEvent& _rNEvt )
98 : {
99 0 : if ( EVENT_KEYINPUT == _rNEvt.GetType() )
100 : {
101 0 : sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
102 :
103 0 : if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
104 : // silence this, we don't want to propagate this outside the property
105 : // browser, as it will probably do harm there
106 : // #i63285#
107 0 : return 1;
108 : }
109 0 : return Window::Notify( _rNEvt );
110 : }
111 :
112 : //------------------------------------------------------------------------
113 0 : void OPropertyBrowserView::Resize()
114 : {
115 0 : Size aSize = GetOutputSizePixel();
116 0 : m_pPropBox->SetSizePixel(aSize);
117 0 : }
118 :
119 : // #95343# ---------------------------------------------------------------
120 0 : ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize()
121 : {
122 0 : Size aSize = GetOutputSizePixel();
123 0 : if( m_pPropBox )
124 : {
125 0 : aSize.setHeight( m_pPropBox->getMinimumHeight() );
126 0 : aSize.setWidth( m_pPropBox->getMinimumWidth() );
127 : }
128 0 : return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
129 : }
130 :
131 : //............................................................................
132 : } // namespace pcr
133 : //............................................................................
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|