bump product version to 6.3.0.0.beta1
[LibreOffice.git] / extensions / source / propctrlr / commoncontrol.cxx
blob1619bc313c7bfac51e0c405d8e10184bcb577803
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "commoncontrol.hxx"
21 #include "pcrcommon.hxx"
22 #include <tools/debug.hxx>
23 #include <tools/diagnose_ex.h>
24 #include <vcl/combobox.hxx>
27 namespace pcr
31 using ::com::sun::star::uno::Reference;
32 using ::com::sun::star::inspection::XPropertyControlContext;
33 using ::com::sun::star::uno::Exception;
34 using ::com::sun::star::inspection::XPropertyControl;
36 CommonBehaviourControlHelper::CommonBehaviourControlHelper( sal_Int16 _nControlType, XPropertyControl& _rAntiImpl )
37 :m_nControlType( _nControlType )
38 ,m_rAntiImpl( _rAntiImpl )
39 ,m_bModified( false )
44 CommonBehaviourControlHelper::~CommonBehaviourControlHelper()
48 void CommonBehaviourControlHelper::setControlContext( const Reference< XPropertyControlContext >& _controlcontext )
50 m_xContext = _controlcontext;
53 void CommonBehaviourControlHelper::notifyModifiedValue( )
55 if ( isModified() && m_xContext.is() )
57 try
59 m_xContext->valueChanged( &m_rAntiImpl );
60 m_bModified = false;
62 catch( const Exception& )
64 DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
70 void CommonBehaviourControlHelper::autoSizeWindow()
72 ScopedVclPtrInstance< ComboBox > aComboBox(getVclWindow(), WB_DROPDOWN);
73 aComboBox->SetPosSizePixel(Point(0,0), Size(100,100));
74 getVclWindow()->SetSizePixel(aComboBox->GetSizePixel());
76 // TODO/UNOize: why do the controls this themselves? Shouldn't this be the task
77 // of the browser listbox/line?
81 void CommonBehaviourControlHelper::activateNextControl() const
83 try
85 if ( m_xContext.is() )
86 m_xContext->activateNextControl( &m_rAntiImpl );
88 catch( const Exception& )
90 DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
95 IMPL_LINK_NOARG( CommonBehaviourControlHelper, EditModifiedHdl, Edit&, void )
97 setModified();
100 IMPL_LINK_NOARG( CommonBehaviourControlHelper, ModifiedHdl, ListBox&, void )
102 setModified();
105 IMPL_LINK_NOARG( CommonBehaviourControlHelper, ColorModifiedHdl, SvxColorListBox&, void )
107 setModified();
110 IMPL_LINK_NOARG( CommonBehaviourControlHelper, GetFocusHdl, Control&, void )
114 if ( m_xContext.is() )
115 m_xContext->focusGained( &m_rAntiImpl );
117 catch( const Exception& )
119 DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
124 IMPL_LINK_NOARG( CommonBehaviourControlHelper, LoseFocusHdl, Control&, void )
126 // TODO/UNOize: should this be outside the default control's implementations? If somebody
127 // has an own control implementation, which does *not* do this - would this be allowed?
128 // If not, then we must move this logic out of here.
129 notifyModifiedValue();
133 } // namespace pcr
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */