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 <tools/debug.hxx>
26 //............................................................................
29 //............................................................................
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star::lang
;
35 //========================================================================
36 //= class OPropertyBrowserView
37 //========================================================================
38 DBG_NAME(OPropertyBrowserView
)
39 //------------------------------------------------------------------------
40 OPropertyBrowserView::OPropertyBrowserView( const Reference
< XMultiServiceFactory
>& _rxORB
,
41 Window
* _pParent
, WinBits nBits
)
42 :Window(_pParent
, nBits
| WB_3DLOOK
)
46 DBG_CTOR(OPropertyBrowserView
,NULL
);
48 m_pPropBox
= new OPropertyEditor( this );
49 m_pPropBox
->SetHelpId(HID_FM_PROPDLG_TABCTR
);
50 m_pPropBox
->setPageActivationHandler(LINK(this, OPropertyBrowserView
, OnPageActivation
));
55 //------------------------------------------------------------------------
56 IMPL_LINK_NOARG(OPropertyBrowserView
, OnPageActivation
)
58 m_nActivePage
= m_pPropBox
->GetCurPage();
59 if (m_aPageActivationHandler
.IsSet())
60 m_aPageActivationHandler
.Call(NULL
);
64 //------------------------------------------------------------------------
65 OPropertyBrowserView::~OPropertyBrowserView()
69 sal_uInt16 nTmpPage
= m_pPropBox
->GetCurPage();
71 m_nActivePage
= nTmpPage
;
72 ::std::auto_ptr
<Window
> aTemp(m_pPropBox
);
77 DBG_DTOR(OPropertyBrowserView
, NULL
);
80 //------------------------------------------------------------------------
81 void OPropertyBrowserView::activatePage(sal_uInt16 _nPage
)
83 m_nActivePage
= _nPage
;
84 getPropertyBox().SetPage(m_nActivePage
);
87 //------------------------------------------------------------------------
88 void OPropertyBrowserView::GetFocus()
91 m_pPropBox
->GrabFocus();
96 //------------------------------------------------------------------------
97 long OPropertyBrowserView::Notify( NotifyEvent
& _rNEvt
)
99 if ( EVENT_KEYINPUT
== _rNEvt
.GetType() )
101 sal_uInt16 nKey
= _rNEvt
.GetKeyEvent()->GetKeyCode().GetCode();
103 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
109 return Window::Notify( _rNEvt
);
112 //------------------------------------------------------------------------
113 void OPropertyBrowserView::Resize()
115 Size aSize
= GetOutputSizePixel();
116 m_pPropBox
->SetSizePixel(aSize
);
119 // #95343# ---------------------------------------------------------------
120 ::com::sun::star::awt::Size
OPropertyBrowserView::getMinimumSize()
122 Size aSize
= GetOutputSizePixel();
125 aSize
.setHeight( m_pPropBox
->getMinimumHeight() );
126 aSize
.setWidth( m_pPropBox
->getMinimumWidth() );
128 return ::com::sun::star::awt::Size( aSize
.Width(), aSize
.Height() );
131 //............................................................................
133 //............................................................................
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */