Bump for 3.6-28
[LibreOffice.git] / extensions / source / propctrlr / browserview.cxx
blob31a98fe127485db89768f0772fa42cbcf92fc483
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
29 #include "browserview.hxx"
30 #include "propertyeditor.hxx"
31 #include "propctrlr.hrc"
32 #include <tools/debug.hxx>
33 #include <memory>
35 //............................................................................
36 namespace pcr
38 //............................................................................
40 using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::lang;
44 //========================================================================
45 //= class OPropertyBrowserView
46 //========================================================================
47 DBG_NAME(OPropertyBrowserView)
48 //------------------------------------------------------------------------
49 OPropertyBrowserView::OPropertyBrowserView( const Reference< XMultiServiceFactory >& _rxORB,
50 Window* _pParent, WinBits nBits)
51 :Window(_pParent, nBits | WB_3DLOOK)
52 ,m_xORB(_rxORB)
53 ,m_nActivePage(0)
55 DBG_CTOR(OPropertyBrowserView,NULL);
57 m_pPropBox = new OPropertyEditor( this );
58 m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
59 m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
61 m_pPropBox->Show();
64 //------------------------------------------------------------------------
65 IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation)
67 m_nActivePage = m_pPropBox->GetCurPage();
68 if (m_aPageActivationHandler.IsSet())
69 m_aPageActivationHandler.Call(NULL);
70 return 0L;
73 //------------------------------------------------------------------------
74 OPropertyBrowserView::~OPropertyBrowserView()
76 if(m_pPropBox)
78 sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
79 if (nTmpPage)
80 m_nActivePage = nTmpPage;
81 ::std::auto_ptr<Window> aTemp(m_pPropBox);
82 m_pPropBox = NULL;
84 m_xORB = NULL;
86 DBG_DTOR(OPropertyBrowserView, NULL);
89 //------------------------------------------------------------------------
90 void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
92 m_nActivePage = _nPage;
93 getPropertyBox().SetPage(m_nActivePage);
96 //------------------------------------------------------------------------
97 void OPropertyBrowserView::GetFocus()
99 if (m_pPropBox)
100 m_pPropBox->GrabFocus();
101 else
102 Window::GetFocus();
105 //------------------------------------------------------------------------
106 long OPropertyBrowserView::Notify( NotifyEvent& _rNEvt )
108 if ( EVENT_KEYINPUT == _rNEvt.GetType() )
110 sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
112 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 return 1;
118 return Window::Notify( _rNEvt );
121 //------------------------------------------------------------------------
122 void OPropertyBrowserView::Resize()
124 Size aSize = GetOutputSizePixel();
125 m_pPropBox->SetSizePixel(aSize);
128 // #95343# ---------------------------------------------------------------
129 ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize()
131 Size aSize = GetOutputSizePixel();
132 if( m_pPropBox )
134 aSize.setHeight( m_pPropBox->getMinimumHeight() );
135 aSize.setWidth( m_pPropBox->getMinimumWidth() );
137 return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
140 //............................................................................
141 } // namespace pcr
142 //............................................................................
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */