Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "browserview.hxx"
30 : : #include "propertyeditor.hxx"
31 : : #include "propctrlr.hrc"
32 : : #include <tools/debug.hxx>
33 : : #include <memory>
34 : :
35 : : //............................................................................
36 : : namespace pcr
37 : : {
38 : : //............................................................................
39 : :
40 : : using namespace ::com::sun::star::uno;
41 : : using namespace ::com::sun::star::lang;
42 : :
43 : :
44 : : //========================================================================
45 : : //= class OPropertyBrowserView
46 : : //========================================================================
47 : : DBG_NAME(OPropertyBrowserView)
48 : : //------------------------------------------------------------------------
49 : 0 : OPropertyBrowserView::OPropertyBrowserView( const Reference< XMultiServiceFactory >& _rxORB,
50 : : Window* _pParent, WinBits nBits)
51 : : :Window(_pParent, nBits | WB_3DLOOK)
52 : : ,m_xORB(_rxORB)
53 : 0 : ,m_nActivePage(0)
54 : : {
55 : : DBG_CTOR(OPropertyBrowserView,NULL);
56 : :
57 : 0 : m_pPropBox = new OPropertyEditor( this );
58 : 0 : m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
59 : 0 : m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
60 : :
61 : 0 : m_pPropBox->Show();
62 : 0 : }
63 : :
64 : : //------------------------------------------------------------------------
65 : 0 : IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation)
66 : : {
67 : 0 : m_nActivePage = m_pPropBox->GetCurPage();
68 : 0 : if (m_aPageActivationHandler.IsSet())
69 : 0 : m_aPageActivationHandler.Call(NULL);
70 : 0 : return 0L;
71 : : }
72 : :
73 : : //------------------------------------------------------------------------
74 : 0 : OPropertyBrowserView::~OPropertyBrowserView()
75 : : {
76 : 0 : if(m_pPropBox)
77 : : {
78 : 0 : sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
79 : 0 : if (nTmpPage)
80 : 0 : m_nActivePage = nTmpPage;
81 : 0 : ::std::auto_ptr<Window> aTemp(m_pPropBox);
82 : 0 : m_pPropBox = NULL;
83 : : }
84 : 0 : m_xORB = NULL;
85 : :
86 : : DBG_DTOR(OPropertyBrowserView, NULL);
87 : 0 : }
88 : :
89 : : //------------------------------------------------------------------------
90 : 0 : void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
91 : : {
92 : 0 : m_nActivePage = _nPage;
93 : 0 : getPropertyBox().SetPage(m_nActivePage);
94 : 0 : }
95 : :
96 : : //------------------------------------------------------------------------
97 : 0 : void OPropertyBrowserView::GetFocus()
98 : : {
99 : 0 : if (m_pPropBox)
100 : 0 : m_pPropBox->GrabFocus();
101 : : else
102 : 0 : Window::GetFocus();
103 : 0 : }
104 : :
105 : : //------------------------------------------------------------------------
106 : 0 : long OPropertyBrowserView::Notify( NotifyEvent& _rNEvt )
107 : : {
108 : 0 : if ( EVENT_KEYINPUT == _rNEvt.GetType() )
109 : : {
110 : 0 : sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
111 : :
112 : 0 : if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
113 : : // silence this, we don't want to propagate this outside the property
114 : : // browser, as it will probably do harm there
115 : : // #i63285#
116 : 0 : return 1;
117 : : }
118 : 0 : return Window::Notify( _rNEvt );
119 : : }
120 : :
121 : : //------------------------------------------------------------------------
122 : 0 : void OPropertyBrowserView::Resize()
123 : : {
124 : 0 : Size aSize = GetOutputSizePixel();
125 : 0 : m_pPropBox->SetSizePixel(aSize);
126 : 0 : }
127 : :
128 : : // #95343# ---------------------------------------------------------------
129 : 0 : ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize()
130 : : {
131 : 0 : Size aSize = GetOutputSizePixel();
132 : 0 : if( m_pPropBox )
133 : : {
134 : 0 : aSize.setHeight( m_pPropBox->getMinimumHeight() );
135 : 0 : aSize.setWidth( m_pPropBox->getMinimumWidth() );
136 : : }
137 : 0 : return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
138 : : }
139 : :
140 : : //............................................................................
141 : : } // namespace pcr
142 : : //............................................................................
143 : :
144 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|