summaryrefslogtreecommitdiff
path: root/sw/source/ui/shells/txtcrsr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/shells/txtcrsr.cxx')
-rw-r--r--sw/source/ui/shells/txtcrsr.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/sw/source/ui/shells/txtcrsr.cxx b/sw/source/ui/shells/txtcrsr.cxx
index 08d5f1be56..cf0a5f99ac 100644
--- a/sw/source/ui/shells/txtcrsr.cxx
+++ b/sw/source/ui/shells/txtcrsr.cxx
@@ -47,6 +47,8 @@
#include <num.hxx>
#include <edtwin.hxx>
#include <crsskip.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
#ifndef _CMDID_H
#include <cmdid.h>
@@ -56,6 +58,10 @@
#include <globals.hrc>
#endif
+#include <svx/svdouno.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/sdrobjectfilter.hxx>
+
using namespace ::com::sun::star;
void SwTextShell::ExecBasicMove(SfxRequest &rReq)
@@ -246,6 +252,36 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
BOOL bSetRetVal = TRUE, bRet = TRUE;
switch ( nSlot )
{
+ case SID_FM_TOGGLECONTROLFOCUS:
+ {
+ const SwDoc* pDoc = rSh.GetDoc();
+ const SwDocShell* pDocShell = pDoc ? pDoc->GetDocShell() : NULL;
+ const SwView* pView = pDocShell ? pDocShell->GetView() : NULL;
+ const FmFormShell* pFormShell = pView ? pView->GetFormShell() : NULL;
+ SdrView* pDrawView = pView ? pView->GetDrawView() : NULL;
+ Window* pWindow = pView ? pView->GetWrtShell().GetWin() : NULL;
+
+ OSL_ENSURE( pFormShell && pDrawView && pWindow, "SwXTextView::ExecMoveMisc: no chance!" );
+ if ( !pFormShell || !pDrawView || !pWindow )
+ break;
+
+ ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter( pFormShell->CreateFocusableControlFilter(
+ *pDrawView, *pWindow ) );
+ if ( !pFilter.get() )
+ break;
+
+ const SdrObject* pNearestControl = rSh.GetBestObject( TRUE, GOTOOBJ_DRAW_CONTROL, FALSE, pFilter.get() );
+ if ( !pNearestControl )
+ break;
+
+ const SdrUnoObj* pUnoObject = dynamic_cast< const SdrUnoObj* >( pNearestControl );
+ OSL_ENSURE( pUnoObject, "SwTextShell::ExecMoveMisc: GetBestObject returned nonsense!" );
+ if ( !pUnoObject )
+ break;
+
+ pFormShell->ToggleControlFocus( *pUnoObject, *pDrawView, *pWindow );
+ }
+ break;
case FN_CNTNT_TO_NEXT_FRAME:
bRet = rSh.GotoObj(TRUE, GOTOOBJ_GOTO_ANY);
if(bRet)