diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-02-19 22:40:09 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-02-19 22:40:09 +0100 |
commit | dabd58773267c42a03cfa6c10ddf76944a40ef38 (patch) | |
tree | f7d0473745f22a7045e8825cc3ee4e4bac35162a | |
parent | a0c5d9c462f98ef6065e5ca31bf25d773bc4d6ad (diff) |
dba33f: use Ctrl-F5 to toggle the focus between a control and the document. At least in Writer.
In this course, SID_FM_GRABCONTROLFOCUS has been renamed to SID_FM_TOGGLECONTROLFOCUS (with the UNO slot name also
being affected.).
Also, now Writer handles the SID_FM_TOGGLECONTROLFOCUS slot (instead of the FmFormShell), and calls the newly
introduced ToggleControlFocus at the FmFormShell.
A part of SwFEShell::GotoObj has been outsourced into SwFEShell::GetBestObject, which now can deliver the
object (not only object group) of the given type, which is neares to the current position.
-rw-r--r-- | configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu | 2 | ||||
-rw-r--r-- | framework/uiconfig/startmodule/accelerator/en-GB/default.xml | 2 | ||||
-rw-r--r-- | framework/uiconfig/startmodule/accelerator/en-US/default.xml | 2 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/Accelerators.xcu | 4 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 2 | ||||
-rw-r--r-- | svx/inc/svx/fmshell.hxx | 22 | ||||
-rw-r--r-- | svx/inc/svx/sdrobjectfilter.hxx | 58 | ||||
-rw-r--r-- | svx/inc/svx/svxids.hrc | 2 | ||||
-rw-r--r-- | svx/prj/d.lst | 1 | ||||
-rw-r--r-- | svx/sdi/fmslots.sdi | 2 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 2 | ||||
-rw-r--r-- | svx/source/form/fmshell.cxx | 101 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 26 | ||||
-rw-r--r-- | svx/source/form/fmvwimp.cxx | 93 | ||||
-rw-r--r-- | svx/source/inc/fmshimp.hxx | 3 | ||||
-rw-r--r-- | svx/source/inc/fmvwimp.hxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 8 | ||||
-rw-r--r-- | svx/uiconfig/accelerator/en-US/default.xml | 2 | ||||
-rw-r--r-- | svx/uiconfig/accelerator/es/default.xml | 2 |
19 files changed, 281 insertions, 58 deletions
diff --git a/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu b/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu index f066fb0b96dc..18675c0025a9 100644 --- a/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu +++ b/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu @@ -1279,7 +1279,7 @@ <value xml:lang="x-no-translate"></value><value xml:lang="en-US">Can't Undo</value> </prop> </node> - <node oor:name=".uno:GrabControlFocus" oor:op="replace"> + <node oor:name=".uno:ToggleControlFocus" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="x-no-translate"></value><value xml:lang="en-US">Control Focus</value> </prop> diff --git a/framework/uiconfig/startmodule/accelerator/en-GB/default.xml b/framework/uiconfig/startmodule/accelerator/en-GB/default.xml index eefe2b0dde23..975f78b39967 100644 --- a/framework/uiconfig/startmodule/accelerator/en-GB/default.xml +++ b/framework/uiconfig/startmodule/accelerator/en-GB/default.xml @@ -23,6 +23,6 @@ <accel:item accel:code="KEY_F" accel:mod1="true" xlink:href=".uno:SearchDialog"/> <accel:item accel:code="KEY_Q" accel:shift="true" accel:mod1="true" xlink:href=".uno:BasicBreak"/> <accel:item accel:code="KEY_F4" xlink:href=".uno:ViewDataSourceBrowser"/> - <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:GrabControlFocus"/> + <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:ToggleControlFocus"/> <accel:item accel:code="KEY_F7" accel:shift="true" accel:mod1="true" xlink:href=".uno:HangulHanjaConversion"/> </accel:acceleratorlist> diff --git a/framework/uiconfig/startmodule/accelerator/en-US/default.xml b/framework/uiconfig/startmodule/accelerator/en-US/default.xml index eefe2b0dde23..975f78b39967 100644 --- a/framework/uiconfig/startmodule/accelerator/en-US/default.xml +++ b/framework/uiconfig/startmodule/accelerator/en-US/default.xml @@ -23,6 +23,6 @@ <accel:item accel:code="KEY_F" accel:mod1="true" xlink:href=".uno:SearchDialog"/> <accel:item accel:code="KEY_Q" accel:shift="true" accel:mod1="true" xlink:href=".uno:BasicBreak"/> <accel:item accel:code="KEY_F4" xlink:href=".uno:ViewDataSourceBrowser"/> - <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:GrabControlFocus"/> + <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:ToggleControlFocus"/> <accel:item accel:code="KEY_F7" accel:shift="true" accel:mod1="true" xlink:href=".uno:HangulHanjaConversion"/> </accel:acceleratorlist> diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index 355879f036ac..861539848cf3 100644 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -70,7 +70,7 @@ </node> <node oor:name="F5_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> - <value xml:lang="en-US">.uno:GrabControlFocus</value> + <value xml:lang="en-US">.uno:ToggleControlFocus</value> </prop> </node> <node oor:name="F7_SHIFT_MOD1" oor:op="replace"> @@ -215,7 +215,7 @@ </node> <node oor:name="F5_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> - <value xml:lang="en-US">.uno:GrabControlFocus</value> + <value xml:lang="en-US">.uno:ToggleControlFocus</value> </prop> </node> <node oor:name="F7_SHIFT_MOD1" oor:op="replace"> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 0dced3ed2f88..855343d581bb 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1280,7 +1280,7 @@ <value xml:lang="en-US">Can't Undo</value> </prop> </node> - <node oor:name=".uno:GrabControlFocus" oor:op="replace"> + <node oor:name=".uno:ToggleControlFocus" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Control Focus</value> </prop> diff --git a/svx/inc/svx/fmshell.hxx b/svx/inc/svx/fmshell.hxx index 9f180156367f..7c679d4d138a 100644 --- a/svx/inc/svx/fmshell.hxx +++ b/svx/inc/svx/fmshell.hxx @@ -63,6 +63,11 @@ namespace com { namespace sun { namespace star { namespace form { } } } } } +namespace svx +{ + class ISdrObjectFilter; +} + //======================================================================== class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint { @@ -149,11 +154,28 @@ public: const OutputDevice& _rDevice, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const SdrView& _rView, const OutputDevice& _rDevice ) const; + + /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus + to the control belonging to the given SdrUnoObj. + */ + void ToggleControlFocus( + const SdrUnoObj& i_rNextCandidate, + const SdrView& i_rView, + OutputDevice& i_rDevice + ) const; + + ::std::auto_ptr< ::svx::ISdrObjectFilter > + CreateFocusableControlFilter( + const SdrView& i_rView, + const OutputDevice& i_rDevice + ) const; + sal_Bool IsDesignMode() const { return m_bDesignMode; } void SetDesignMode( sal_Bool _bDesignMode ); diff --git a/svx/inc/svx/sdrobjectfilter.hxx b/svx/inc/svx/sdrobjectfilter.hxx new file mode 100644 index 000000000000..55eda09c99af --- /dev/null +++ b/svx/inc/svx/sdrobjectfilter.hxx @@ -0,0 +1,58 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef SDROBJECTFILTER_HXX +#define SDROBJECTFILTER_HXX + +#include "svx/svxdllapi.h" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +class SdrObject; + +//........................................................................ +namespace svx +{ +//........................................................................ + + //==================================================================== + //= SdrObjectFilter + //==================================================================== + /** specifies a boolean predicate on the set of all SdrObjects - vulgo a filter. + */ + class SVX_DLLPUBLIC SAL_NO_VTABLE ISdrObjectFilter + { + public: + virtual bool includeObject( const SdrObject& i_rObject ) const = 0; + + virtual ~ISdrObjectFilter() = 0; + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SDROBJECTFILTER_HXX diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index 5c541b3b24dd..7c7d54e2df82 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -1102,7 +1102,7 @@ #define SID_DSBROWSER_EXPLORER ( SID_SVX_START + 764 ) #define SID_FM_CREATE_FIELDCONTROL ( SID_SVX_START + 765 ) #define SID_FM_DATACCESS_DESCRIPTOR ( SID_SVX_START + 766 ) -#define SID_FM_GRABCONTROLFOCUS ( SID_SVX_START + 767 ) +#define SID_FM_TOGGLECONTROLFOCUS ( SID_SVX_START + 767 ) #define SID_FM_SCROLLBAR ( SID_SVX_START + 768 ) #define SID_FM_SPINBUTTON ( SID_SVX_START + 769 ) #define SID_FM_CONVERTTO_SCROLLBAR ( SID_SVX_START + 770 ) diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 8b4675feb3e9..b3a7c30be715 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -577,6 +577,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\databaselocationinput.hxx %_DEST%\inc%_EXT%\svx\databaselocationinput.hxx ..\inc\svx\dbcharsethelper.hxx %_DEST%\inc%_EXT%\svx\dbcharsethelper.hxx ..\inc\svx\dbtoolsclient.hxx %_DEST%\inc%_EXT%\svx\dbtoolsclient.hxx +..\inc\svx\sdrobjectfilter.hxx %_DEST%\inc%_EXT%\svx\sdrobjectfilter.hxx ..\inc\svx\subtoolboxcontrol.hxx %_DEST%\inc%_EXT%\svx\subtoolboxcontrol.hxx ..\inc\svx\svdtext.hxx %_DEST%\inc%_EXT%\svx\svdtext.hxx diff --git a/svx/sdi/fmslots.sdi b/svx/sdi/fmslots.sdi index f372c6ad5e4b..612df2fbafc0 100644 --- a/svx/sdi/fmslots.sdi +++ b/svx/sdi/fmslots.sdi @@ -660,7 +660,7 @@ shell FmFormShell [ ExecMethod = Execute ; ] - SID_FM_GRABCONTROLFOCUS + SID_FM_TOGGLECONTROLFOCUS [ ExecMethod = Execute ; ] diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index e3826708c196..cfdc5f45aa5d 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -11728,7 +11728,7 @@ SfxVoidItem ZoomVisArea SID_SIZE_VISAREA ] //-------------------------------------------------------------------------- -SfxVoidItem GrabControlFocus SID_FM_GRABCONTROLFOCUS +SfxVoidItem ToggleControlFocus SID_FM_TOGGLECONTROLFOCUS () [ /* flags: */ diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 93cf9c1778af..5219ff43ac0c 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -81,6 +81,7 @@ #include <svx/fmglob.hxx> #include <svl/eitem.hxx> #include <tools/shl.hxx> +#include <tools/diagnose_ex.h> #include <svx/svdpage.hxx> #include <svx/fmmodel.hxx> #include <svx/dialmgr.hxx> @@ -101,6 +102,8 @@ #include <svx/svxdlg.hxx> //CHINA001 #include <svx/dialogs.hrc> //CHINA001 +#include "svx/sdrobjectfilter.hxx" + #define HANDLE_SQL_ERRORS( action, successflag, context, message ) \ try \ { \ @@ -550,7 +553,7 @@ void FmFormShell::Execute(SfxRequest &rReq) case SID_FM_SCROLLBAR: case SID_FM_SPINBUTTON: { - SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_GRABCONTROLFOCUS, sal_False ); + SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_TOGGLECONTROLFOCUS, sal_False ); if ( pGrabFocusItem && pGrabFocusItem->GetValue() ) { // see below SfxViewShell* pShell = GetViewShell(); @@ -578,9 +581,9 @@ void FmFormShell::Execute(SfxRequest &rReq) { // #99013# if selected with control key, return focus to current view // do this asynchron, so that the creation can be finished first - // reusing the SID_FM_GRABCONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another + // reusing the SID_FM_TOGGLECONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another // name, so I do not really have a big problem with this .... - SfxBoolItem aGrabFocusIndicatorItem( SID_FM_GRABCONTROLFOCUS, sal_True ); + SfxBoolItem aGrabFocusIndicatorItem( SID_FM_TOGGLECONTROLFOCUS, sal_True ); GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_ASYNCHRON, &aGrabFocusIndicatorItem, NULL ); } @@ -601,11 +604,27 @@ void FmFormShell::Execute(SfxRequest &rReq) } break; - case SID_FM_GRABCONTROLFOCUS: + case SID_FM_TOGGLECONTROLFOCUS: { FmFormView* pFormView = GetFormView(); - if ( pFormView ) + if ( !pFormView ) + break; + + // if we execute this ourself, then either the application does not implement an own handling for this, + // of we're on the top of the dispatcher stack, which means a control has the focus. + // In the latter case, we put the focus to the document window, otherwise, we focus the first control + const bool bHasControlFocus = GetImpl()->HasControlFocus(); + if ( bHasControlFocus ) + { + const OutputDevice* pDevice = GetCurrentViewDevice(); + Window* pWindow = static_cast< Window* >( const_cast< OutputDevice* >( pDevice ) ); + if ( pWindow ) + pWindow->GrabFocus(); + } + else + { pFormView->GrabFirstControlFocus( ); + } } break; @@ -1362,6 +1381,78 @@ namespace } //------------------------------------------------------------------------ +void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrView& i_rView, OutputDevice& i_rDevice ) const +{ + try + { + // check if the focus currently is in a control + // Well, okay, do it the other way 'round: Check whether the current control of the active controller + // actually has the focus. This should be equivalent. + const bool bHasControlFocus = GetImpl()->HasControlFocus(); + + if ( bHasControlFocus ) + { + Window* pWindow( dynamic_cast< Window* >( &i_rDevice ) ); + OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" ); + if ( pWindow ) + pWindow->GrabFocus(); + } + else + { + Reference< XControl > xControl; + GetFormControl( i_rUnoObject.GetUnoControlModel(), i_rView, i_rDevice, xControl ); + Reference< XWindow > xControlWindow( xControl, UNO_QUERY ); + if ( xControlWindow.is() ) + xControlWindow->setFocus(); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------ +namespace +{ + class FocusableControlsFilter : public ::svx::ISdrObjectFilter + { + public: + FocusableControlsFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) + :m_rView( i_rView ) + ,m_rDevice( i_rDevice ) + { + } + + public: + virtual bool includeObject( const SdrObject& i_rObject ) const + { + const SdrUnoObj* pUnoObj = dynamic_cast< const SdrUnoObj* >( &i_rObject ); + if ( !pUnoObj ) + return false; + + Reference< XControl > xControl = pUnoObj->GetUnoControl( m_rView, m_rDevice ); + return FmXFormView::isFocusable( xControl ); + } + + private: + const SdrView& m_rView; + const OutputDevice& m_rDevice; + }; +} + +//------------------------------------------------------------------------ +::std::auto_ptr< ::svx::ISdrObjectFilter > FmFormShell::CreateFocusableControlFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) const +{ + ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter; + + if ( !i_rView.IsDesignMode() ) + pFilter.reset( new FocusableControlsFilter( i_rView, i_rDevice ) ); + + return pFilter; +} + +//------------------------------------------------------------------------ SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const { if ( !_rxModel.is() ) diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 38df41896f13..2ac74c679e09 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -59,6 +59,7 @@ #include "svx/svxids.hrc" /** === begin UNO includes === **/ +#include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/awt/XCheckBox.hpp> #include <com/sun/star/awt/XListBox.hpp> #include <com/sun/star/awt/XTextComponent.hpp> @@ -4508,6 +4509,31 @@ void FmXFormShell::handleMouseButtonDown( const SdrViewEvent& _rViewEvent ) } } +//------------------------------------------------------------------------------ +bool FmXFormShell::HasControlFocus() const +{ + bool bHasControlFocus = false; + + try + { + Reference< XFormController > xController( getActiveController() ); + Reference< XControl > xCurrentControl; + if ( xController.is() ) + xCurrentControl.set( xController->getCurrentControl() ); + if ( xCurrentControl.is() ) + { + Reference< XWindow2 > xPeerWindow( xCurrentControl->getPeer(), UNO_QUERY_THROW ); + bHasControlFocus = xPeerWindow->hasFocus(); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return bHasControlFocus; +} + //============================================================================== //============================================================================== SearchableControlIterator::SearchableControlIterator(Reference< XInterface> xStartingPoint) diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index a272715bbd98..462774c59d3f 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -826,6 +826,48 @@ void FmXFormView::AutoFocus( sal_Bool _bSync ) else m_nAutoFocusEvent = Application::PostUserEvent(LINK(this, FmXFormView, OnAutoFocus)); } + +// ----------------------------------------------------------------------------- +bool FmXFormView::isFocusable( const Reference< XControl >& i_rControl ) +{ + if ( !i_rControl.is() ) + return false; + + try + { + Reference< XPropertySet > xModelProps( i_rControl->getModel(), UNO_QUERY_THROW ); + + // only enabled controls are allowed to participate + sal_Bool bEnabled = sal_False; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled ); + if ( !bEnabled ) + return false; + + // check the class id of the control model + sal_Int16 nClassId = FormComponentType::CONTROL; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId ); + + // controls which are not focussable + if ( ( FormComponentType::CONTROL != nClassId ) + && ( FormComponentType::IMAGEBUTTON != nClassId ) + && ( FormComponentType::GROUPBOX != nClassId ) + && ( FormComponentType::FIXEDTEXT != nClassId ) + && ( FormComponentType::HIDDENCONTROL != nClassId ) + && ( FormComponentType::IMAGECONTROL != nClassId ) + && ( FormComponentType::SCROLLBAR != nClassId ) + && ( FormComponentType::SPINBUTTON!= nClassId ) + ) + { + return true; + } + } + catch( const Exception& e ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; +} + // ----------------------------------------------------------------------------- static Reference< XControl > lcl_firstFocussableControl( const Sequence< Reference< XControl > >& _rControls ) { @@ -836,47 +878,19 @@ static Reference< XControl > lcl_firstFocussableControl( const Sequence< Referen const Reference< XControl >* pControlsEnd = _rControls.getConstArray() + _rControls.getLength(); for ( ; pControls != pControlsEnd; ++pControls ) { - try - { - if ( !pControls->is() ) - continue; - - Reference< XPropertySet > xModelProps( (*pControls)->getModel(), UNO_QUERY_THROW ); - - // only enabled controls are allowed to participate - sal_Bool bEnabled = sal_False; - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled ); - if ( !bEnabled ) - continue; - - // check the class id of the control model - sal_Int16 nClassId = FormComponentType::CONTROL; - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId ); - - // controls which are not focussable - if ( ( FormComponentType::CONTROL != nClassId ) - && ( FormComponentType::IMAGEBUTTON != nClassId ) - && ( FormComponentType::GROUPBOX != nClassId ) - && ( FormComponentType::FIXEDTEXT != nClassId ) - && ( FormComponentType::HIDDENCONTROL != nClassId ) - && ( FormComponentType::IMAGECONTROL != nClassId ) - && ( FormComponentType::SCROLLBAR != nClassId ) - && ( FormComponentType::SPINBUTTON!= nClassId ) - ) - { - xReturn = *pControls; - break; - } - } - catch( const Exception& e ) + if ( !pControls->is() ) + continue; + + if ( FmXFormView::isFocusable( *pControls ) ) { - (void)e; // make compiler happy + xReturn = *pControls; + break; } - - if ( !xReturn.is() && _rControls.getLength() ) - xReturn = _rControls[0]; } + if ( !xReturn.is() && _rControls.getLength() ) + xReturn = _rControls[0]; + return xReturn; } @@ -1011,11 +1025,6 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/) } // ----------------------------------------------------------------------------- -namespace -{ -} - -// ----------------------------------------------------------------------------- void FmXFormView::onCreatedFormObject( FmFormObj& _rFormObject ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::onCreatedFormObject" ); diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index 35a00ccf7427..b61f64ea4f88 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -508,6 +508,9 @@ public: // if the form belongs to the controller (extern) displaying a grid, the according internal form will // be displayed, _xForm else + // check if the current control of the active controler has the focus + bool HasControlFocus() const; + private: DECL_LINK(OnFoundData, FmFoundRecordInformation*); DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation*); diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx index c51c935883ed..3fbef5922a87 100644 --- a/svx/source/inc/fmvwimp.hxx +++ b/svx/source/inc/fmvwimp.hxx @@ -243,6 +243,11 @@ public: void onCreatedFormObject( FmFormObj& _rFormObject ); + static bool + isFocusable( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& i_rControl + ); + private: FmWinRecList::iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ); //void addWindow(const SdrPageViewWinRec*); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index fb26d7b5fc9c..2a4e87c17e93 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -124,6 +124,7 @@ #include <svx/sdrhittesthelper.hxx> #include <svx/svdundo.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <svx/sdrobjectfilter.hxx> using namespace ::com::sun::star; @@ -3332,4 +3333,11 @@ void SdrObjFactory::RemoveMakeUserDataHdl(const Link& rLink) rLL.RemoveLink(rLink); } +namespace svx +{ + ISdrObjectFilter::~ISdrObjectFilter() + { + } +} + // eof diff --git a/svx/uiconfig/accelerator/en-US/default.xml b/svx/uiconfig/accelerator/en-US/default.xml index 67a6e9127c8a..1969c9b00098 100644 --- a/svx/uiconfig/accelerator/en-US/default.xml +++ b/svx/uiconfig/accelerator/en-US/default.xml @@ -23,7 +23,7 @@ <accel:item accel:code="KEY_F" accel:mod1="true" xlink:href=".uno:SearchDialog"/> <accel:item accel:code="KEY_Q" accel:shift="true" accel:mod1="true" xlink:href=".uno:BasicBreak"/> <accel:item accel:code="KEY_F4" xlink:href=".uno:ViewDataSourceBrowser"/> - <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:GrabControlFocus"/> + <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:ToggleControlFocus"/> <accel:item accel:code="KEY_F7" accel:shift="true" accel:mod1="true" xlink:href=".uno:HangulHanjaConversion"/> <accel:item accel:code="KEY_F11" accel:mod2="true" xlink:href=".uno:MacroDialog"/> </accel:acceleratorlist> diff --git a/svx/uiconfig/accelerator/es/default.xml b/svx/uiconfig/accelerator/es/default.xml index 71ba6212d275..3a0c362b61bb 100644 --- a/svx/uiconfig/accelerator/es/default.xml +++ b/svx/uiconfig/accelerator/es/default.xml @@ -23,7 +23,7 @@ <accel:item accel:code="KEY_B" accel:mod1="true" xlink:href=".uno:SearchDialog"/> <accel:item accel:code="KEY_Q" accel:shift="true" accel:mod1="true" xlink:href=".uno:BasicBreak"/> <accel:item accel:code="KEY_F4" xlink:href=".uno:ViewDataSourceBrowser"/> - <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:GrabControlFocus"/> + <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:ToggleControlFocus"/> <accel:item accel:code="KEY_F7" accel:shift="true" accel:mod1="true" xlink:href=".uno:HangulHanjaConversion"/> <accel:item accel:code="KEY_F11" accel:mod2="true" xlink:href=".uno:MacroDialog"/> </accel:acceleratorlist> |