1*2a97ec55SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2a97ec55SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2a97ec55SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2a97ec55SAndrew Rist  * distributed with this work for additional information
6*2a97ec55SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2a97ec55SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2a97ec55SAndrew Rist  * "License"); you may not use this file except in compliance
9*2a97ec55SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2a97ec55SAndrew Rist  *
11*2a97ec55SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2a97ec55SAndrew Rist  *
13*2a97ec55SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2a97ec55SAndrew Rist  * software distributed under the License is distributed on an
15*2a97ec55SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2a97ec55SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2a97ec55SAndrew Rist  * specific language governing permissions and limitations
18*2a97ec55SAndrew Rist  * under the License.
19*2a97ec55SAndrew Rist  *
20*2a97ec55SAndrew Rist  *************************************************************/
21*2a97ec55SAndrew Rist 
22*2a97ec55SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_extensions.hxx"
26cdf0e10cSrcweir #include "browserview.hxx"
27cdf0e10cSrcweir #include "propertyeditor.hxx"
28cdf0e10cSrcweir #include "propctrlr.hrc"
29cdf0e10cSrcweir #include <tools/debug.hxx>
30cdf0e10cSrcweir #include <memory>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //............................................................................
33cdf0e10cSrcweir namespace pcr
34cdf0e10cSrcweir {
35cdf0e10cSrcweir //............................................................................
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
38cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	//========================================================================
42cdf0e10cSrcweir 	//= class OPropertyBrowserView
43cdf0e10cSrcweir 	//========================================================================
DBG_NAME(OPropertyBrowserView)44cdf0e10cSrcweir 	DBG_NAME(OPropertyBrowserView)
45cdf0e10cSrcweir 	//------------------------------------------------------------------------
46cdf0e10cSrcweir 	OPropertyBrowserView::OPropertyBrowserView( const Reference< XMultiServiceFactory >& _rxORB,
47cdf0e10cSrcweir 								 Window* _pParent, WinBits nBits)
48cdf0e10cSrcweir 				  :Window(_pParent, nBits | WB_3DLOOK)
49cdf0e10cSrcweir 				  ,m_xORB(_rxORB)
50cdf0e10cSrcweir 				  ,m_nActivePage(0)
51cdf0e10cSrcweir 	{
52cdf0e10cSrcweir 		DBG_CTOR(OPropertyBrowserView,NULL);
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 		m_pPropBox = new OPropertyEditor( this );
55cdf0e10cSrcweir 		m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
56cdf0e10cSrcweir 		m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 		m_pPropBox->Show();
59cdf0e10cSrcweir 	}
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	//------------------------------------------------------------------------
IMPL_LINK(OPropertyBrowserView,OnPageActivation,void *,EMPTYARG)62cdf0e10cSrcweir 	IMPL_LINK(OPropertyBrowserView, OnPageActivation, void*, EMPTYARG)
63cdf0e10cSrcweir 	{
64cdf0e10cSrcweir 		m_nActivePage = m_pPropBox->GetCurPage();
65cdf0e10cSrcweir 		if (m_aPageActivationHandler.IsSet())
66cdf0e10cSrcweir 			m_aPageActivationHandler.Call(NULL);
67cdf0e10cSrcweir 		return 0L;
68cdf0e10cSrcweir 	}
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	//------------------------------------------------------------------------
~OPropertyBrowserView()71cdf0e10cSrcweir 	OPropertyBrowserView::~OPropertyBrowserView()
72cdf0e10cSrcweir 	{
73cdf0e10cSrcweir 		if(m_pPropBox)
74cdf0e10cSrcweir 		{
75cdf0e10cSrcweir 			sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
76cdf0e10cSrcweir 			if (nTmpPage)
77cdf0e10cSrcweir 				m_nActivePage = nTmpPage;
78cdf0e10cSrcweir 			::std::auto_ptr<Window> aTemp(m_pPropBox);
79cdf0e10cSrcweir 			m_pPropBox = NULL;
80cdf0e10cSrcweir 		}
81cdf0e10cSrcweir 		m_xORB = NULL;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 		DBG_DTOR(OPropertyBrowserView, NULL);
84cdf0e10cSrcweir 	}
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	//------------------------------------------------------------------------
activatePage(sal_uInt16 _nPage)87cdf0e10cSrcweir 	void OPropertyBrowserView::activatePage(sal_uInt16 _nPage)
88cdf0e10cSrcweir 	{
89cdf0e10cSrcweir 		m_nActivePage = _nPage;
90cdf0e10cSrcweir 		getPropertyBox().SetPage(m_nActivePage);
91cdf0e10cSrcweir 	}
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	//------------------------------------------------------------------------
GetFocus()94cdf0e10cSrcweir 	void OPropertyBrowserView::GetFocus()
95cdf0e10cSrcweir 	{
96cdf0e10cSrcweir 		if (m_pPropBox)
97cdf0e10cSrcweir 			m_pPropBox->GrabFocus();
98cdf0e10cSrcweir 		else
99cdf0e10cSrcweir 			Window::GetFocus();
100cdf0e10cSrcweir 	}
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	//------------------------------------------------------------------------
Notify(NotifyEvent & _rNEvt)103cdf0e10cSrcweir 	long OPropertyBrowserView::Notify( NotifyEvent& _rNEvt )
104cdf0e10cSrcweir     {
105cdf0e10cSrcweir 		if ( EVENT_KEYINPUT == _rNEvt.GetType() )
106cdf0e10cSrcweir 		{
107cdf0e10cSrcweir 			sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 			if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) )
110cdf0e10cSrcweir                 // silence this, we don't want to propagate this outside the property
111cdf0e10cSrcweir                 // browser, as it will probably do harm there
112cdf0e10cSrcweir                 // #i63285# / 2006-12-06 / frank.schoenheit@sun.com
113cdf0e10cSrcweir 				return 1;
114cdf0e10cSrcweir 		}
115cdf0e10cSrcweir         return Window::Notify( _rNEvt );
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	//------------------------------------------------------------------------
Resize()119cdf0e10cSrcweir 	void OPropertyBrowserView::Resize()
120cdf0e10cSrcweir 	{
121cdf0e10cSrcweir 		Size aSize = GetOutputSizePixel();
122cdf0e10cSrcweir 		m_pPropBox->SetSizePixel(aSize);
123cdf0e10cSrcweir 	}
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	// #95343# ---------------------------------------------------------------
getMinimumSize()126cdf0e10cSrcweir 	::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize()
127cdf0e10cSrcweir 	{
128cdf0e10cSrcweir 		Size aSize = GetOutputSizePixel();
129cdf0e10cSrcweir 		if( m_pPropBox )
130cdf0e10cSrcweir         {
131cdf0e10cSrcweir 		    aSize.setHeight( m_pPropBox->getMinimumHeight() );
132cdf0e10cSrcweir 			aSize.setWidth( m_pPropBox->getMinimumWidth() );
133cdf0e10cSrcweir         }
134cdf0e10cSrcweir 		return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
135cdf0e10cSrcweir 	}
136cdf0e10cSrcweir 
137cdf0e10cSrcweir //............................................................................
138cdf0e10cSrcweir } // namespace pcr
139cdf0e10cSrcweir //............................................................................
140cdf0e10cSrcweir 
141