summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rwxr-xr-xsw/source/core/doc/doc.cxx10
-rw-r--r--sw/source/core/frmedt/feshview.cxx350
-rw-r--r--sw/source/core/unocore/unodraw.cxx42
-rw-r--r--sw/source/ui/app/apphdl.cxx1
-rw-r--r--sw/source/ui/inc/view.hxx1
-rw-r--r--sw/source/ui/shells/txtcrsr.cxx36
-rw-r--r--sw/source/ui/uno/unotxvw.cxx2
7 files changed, 265 insertions, 177 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 4d428b4987..d25e4bd169 100755
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -477,6 +477,16 @@ void SwDoc::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDeleteOld,/*[in]*/
delete pPrt;
pPrt = pP;
+ // our printer should always use TWIP. Don't rely on this being set in ViewShell::InitPrt, there
+ // are situations where this isn't called.
+ // #i108712# / 2010-02-26 / frank.schoenheit@sun.com
+ if ( pPrt )
+ {
+ MapMode aMapMode( pPrt->GetMapMode() );
+ aMapMode.SetMapUnit( MAP_TWIP );
+ pPrt->SetMapMode( aMapMode );
+ }
+
if ( pDrawModel && !get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
pDrawModel->SetRefDevice( pPrt );
}
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 8840e69aac..2eb597f887 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -34,6 +34,8 @@
#define _FESHVIEW_ONLY_INLINE_NEEDED
#endif
+#include <svx/sdrobjectfilter.hxx>
+#include <svx/svditer.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdouno.hxx>
#include <svx/svdoole2.hxx>
@@ -1307,197 +1309,225 @@ BOOL lcl_IsControlGroup( const SdrObject *pObj )
return bRet;
}
-BOOL SwFEShell::GotoObj( BOOL bNext, USHORT /*GOTOOBJ_...*/ eType )
+namespace
{
- if( !Imp()->HasDrawView() )
- return FALSE;
- else
+ class MarkableObjectsOnly : public ::svx::ISdrObjectFilter
{
- const SdrObject *pBest = 0,
- *pTop = 0;
-
- const long nTmp = bNext ? LONG_MAX : 0;
- Point aBestPos( nTmp, nTmp );
- Point aTopPos( nTmp, nTmp );
- Point aCurPos;
- Point aPos;
- BOOL bRet = FALSE;
- BOOL bNoDraw = 0 == (GOTOOBJ_DRAW_ANY & eType);
- BOOL bNoFly = 0 == (GOTOOBJ_FLY_ANY & eType);
-
- if( !bNoFly && bNoDraw )
+ public:
+ MarkableObjectsOnly( SdrPageView* i_pPV )
+ :m_pPV( i_pPV )
{
- SwFlyFrm *pFly = GetCurrFrm( FALSE )->FindFlyFrm();
- if( pFly )
- pBest = pFly->GetVirtDrawObj();
}
- const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
- SdrPageView* pPV = Imp()->GetDrawView()->GetSdrPageView();
- if( !pBest || rMrkList.GetMarkCount() == 1 )
+ virtual bool includeObject( const SdrObject& i_rObject ) const
{
- // Ausgangspunkt bestimmen.
- SdrObjList* pList = NULL;
- if ( rMrkList.GetMarkCount() )
- {
- const SdrObject* pStartObj = rMrkList.GetMark(0)->GetMarkedSdrObj();
- if( pStartObj->ISA(SwVirtFlyDrawObj) )
- aPos = ((SwVirtFlyDrawObj*)pStartObj)->GetFlyFrm()->Frm().Pos();
- else
- aPos = pStartObj->GetSnapRect().TopLeft();
+ return m_pPV && m_pPV->GetView().IsObjMarkable( const_cast< SdrObject* >( &i_rObject ), m_pPV );
+ }
- // If an object inside a group is selected, we want to
- // iterate over the group members.
- if ( ! pStartObj->GetUserCall() )
- pList = pStartObj->GetObjList();
- }
+ private:
+ SdrPageView* m_pPV;
+ };
+}
+
+const SdrObject* SwFEShell::GetBestObject( BOOL bNext, USHORT /*GOTOOBJ_...*/ eType, BOOL bFlat, const ::svx::ISdrObjectFilter* pFilter )
+{
+ if( !Imp()->HasDrawView() )
+ return NULL;
+
+ const SdrObject *pBest = 0,
+ *pTop = 0;
+
+ const long nTmp = bNext ? LONG_MAX : 0;
+ Point aBestPos( nTmp, nTmp );
+ Point aTopPos( nTmp, nTmp );
+ Point aCurPos;
+ Point aPos;
+ BOOL bNoDraw = 0 == (GOTOOBJ_DRAW_ANY & eType);
+ BOOL bNoFly = 0 == (GOTOOBJ_FLY_ANY & eType);
+
+ if( !bNoFly && bNoDraw )
+ {
+ SwFlyFrm *pFly = GetCurrFrm( FALSE )->FindFlyFrm();
+ if( pFly )
+ pBest = pFly->GetVirtDrawObj();
+ }
+ const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
+ SdrPageView* pPV = Imp()->GetDrawView()->GetSdrPageView();
+
+ MarkableObjectsOnly aDefaultFilter( pPV );
+ if ( !pFilter )
+ pFilter = &aDefaultFilter;
+
+ if( !pBest || rMrkList.GetMarkCount() == 1 )
+ {
+ // Ausgangspunkt bestimmen.
+ SdrObjList* pList = NULL;
+ if ( rMrkList.GetMarkCount() )
+ {
+ const SdrObject* pStartObj = rMrkList.GetMark(0)->GetMarkedSdrObj();
+ if( pStartObj->ISA(SwVirtFlyDrawObj) )
+ aPos = ((SwVirtFlyDrawObj*)pStartObj)->GetFlyFrm()->Frm().Pos();
else
- {
- // If no object is selected, we check if we just entered a group.
- // In this case we want to iterate over the group members.
- aPos = GetCharRect().Center();
- const SdrObject* pStartObj = pPV ? pPV->GetAktGroup() : 0;
- if ( pStartObj && pStartObj->ISA( SdrObjGroup ) )
- pList = pStartObj->GetSubList();
- }
+ aPos = pStartObj->GetSnapRect().TopLeft();
- if ( ! pList )
- {
- // Here we are if
- // A No object has been selected and no group has been entered or
- // B An object has been selected and it is not inside a group
- pList = getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 );
- }
+ // If an object inside a group is selected, we want to
+ // iterate over the group members.
+ if ( ! pStartObj->GetUserCall() )
+ pList = pStartObj->GetObjList();
+ }
+ else
+ {
+ // If no object is selected, we check if we just entered a group.
+ // In this case we want to iterate over the group members.
+ aPos = GetCharRect().Center();
+ const SdrObject* pStartObj = pPV ? pPV->GetAktGroup() : 0;
+ if ( pStartObj && pStartObj->ISA( SdrObjGroup ) )
+ pList = pStartObj->GetSubList();
+ }
+
+ if ( ! pList )
+ {
+ // Here we are if
+ // A No object has been selected and no group has been entered or
+ // B An object has been selected and it is not inside a group
+ pList = getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 );
+ }
- ASSERT( pList, "No object list to iterate" )
+ ASSERT( pList, "No object list to iterate" )
- const ULONG nObjs = pList->GetObjCount();
- for( ULONG nObj = 0; nObj < nObjs; ++nObj )
+ SdrObjListIter aObjIter( *pList, bFlat ? IM_FLAT : IM_DEEPNOGROUPS );
+ while ( aObjIter.IsMore() )
+ {
+ SdrObject* pObj = aObjIter.Next();
+ BOOL bFlyFrm = pObj->ISA(SwVirtFlyDrawObj);
+ if( ( bNoFly && bFlyFrm ) ||
+ ( bNoDraw && !bFlyFrm ) ||
+ ( eType == GOTOOBJ_DRAW_SIMPLE && lcl_IsControlGroup( pObj ) ) ||
+ ( eType == GOTOOBJ_DRAW_CONTROL && !lcl_IsControlGroup( pObj ) ) ||
+ ( pFilter && !pFilter->includeObject( *pObj ) ) )
+ continue;
+ if( bFlyFrm )
{
- SdrObject* pObj = pList->GetObj( nObj );
- BOOL bFlyFrm = pObj->ISA(SwVirtFlyDrawObj);
- if( ( bNoFly && bFlyFrm ) ||
- ( bNoDraw && !bFlyFrm ) ||
- ( eType == GOTOOBJ_DRAW_SIMPLE && lcl_IsControlGroup( pObj ) ) ||
- ( eType == GOTOOBJ_DRAW_CONTROL && !lcl_IsControlGroup( pObj ) ) ||
- ( pPV && ! pPV->GetView().IsObjMarkable( pObj, pPV ) ) )
- continue;
- if( bFlyFrm )
+ SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pObj;
+ SwFlyFrm *pFly = pO->GetFlyFrm();
+ if( GOTOOBJ_FLY_ANY != ( GOTOOBJ_FLY_ANY & eType ) )
{
- SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pObj;
- SwFlyFrm *pFly = pO->GetFlyFrm();
- if( GOTOOBJ_FLY_ANY != ( GOTOOBJ_FLY_ANY & eType ) )
+ switch ( eType )
{
- switch ( eType )
- {
- case GOTOOBJ_FLY_FRM:
- if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
- continue;
- break;
- case GOTOOBJ_FLY_GRF:
- if ( pFly->Lower() &&
- (pFly->Lower()->IsLayoutFrm() ||
- !((SwCntntFrm*)pFly->Lower())->GetNode()->GetGrfNode()))
- continue;
- break;
- case GOTOOBJ_FLY_OLE:
- if ( pFly->Lower() &&
- (pFly->Lower()->IsLayoutFrm() ||
- !((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode()))
- continue;
- break;
- }
+ case GOTOOBJ_FLY_FRM:
+ if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
+ continue;
+ break;
+ case GOTOOBJ_FLY_GRF:
+ if ( pFly->Lower() &&
+ (pFly->Lower()->IsLayoutFrm() ||
+ !((SwCntntFrm*)pFly->Lower())->GetNode()->GetGrfNode()))
+ continue;
+ break;
+ case GOTOOBJ_FLY_OLE:
+ if ( pFly->Lower() &&
+ (pFly->Lower()->IsLayoutFrm() ||
+ !((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode()))
+ continue;
+ break;
}
- aCurPos = pFly->Frm().Pos();
}
- else
- aCurPos = pObj->GetCurrentBoundRect().TopLeft();
+ aCurPos = pFly->Frm().Pos();
+ }
+ else
+ aCurPos = pObj->GetCurrentBoundRect().TopLeft();
- // Sonderfall wenn ein anderes Obj auf selber Y steht.
- if( aCurPos != aPos && // nur wenn ich es nicht selber bin
- aCurPos.Y() == aPos.Y() && // ist die Y Position gleich
- (bNext? (aCurPos.X() > aPos.X()) : // liegt neben mir
- (aCurPos.X() < aPos.X())) ) // " reverse
+ // Sonderfall wenn ein anderes Obj auf selber Y steht.
+ if( aCurPos != aPos && // nur wenn ich es nicht selber bin
+ aCurPos.Y() == aPos.Y() && // ist die Y Position gleich
+ (bNext? (aCurPos.X() > aPos.X()) : // liegt neben mir
+ (aCurPos.X() < aPos.X())) ) // " reverse
+ {
+ aBestPos = Point( nTmp, nTmp );
+ SdrObjListIter aTmpIter( *pList, bFlat ? IM_FLAT : IM_DEEPNOGROUPS );
+ while ( aTmpIter.IsMore() )
{
- aBestPos = Point( nTmp, nTmp );
- for( ULONG i = 0; i < nObjs; ++i )
+ SdrObject* pTmpObj = aTmpIter.Next();
+ bFlyFrm = pTmpObj->ISA(SwVirtFlyDrawObj);
+ if( ( bNoFly && bFlyFrm ) || ( bNoDraw && !bFlyFrm ) )
+ continue;
+ if( bFlyFrm )
{
- SdrObject *pTmpObj = pList->GetObj( i );
- bFlyFrm = pTmpObj->ISA(SwVirtFlyDrawObj);
- if( ( bNoFly && bFlyFrm ) || ( bNoDraw && !bFlyFrm ) )
- continue;
- if( bFlyFrm )
- {
- SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pTmpObj;
- aCurPos = pO->GetFlyFrm()->Frm().Pos();
- }
- else
- aCurPos = pTmpObj->GetCurrentBoundRect().TopLeft();
-
- if( aCurPos != aPos && aCurPos.Y() == aPos.Y() &&
- (bNext? (aCurPos.X() > aPos.X()) : // liegt neben mir
- (aCurPos.X() < aPos.X())) && // " reverse
- (bNext? (aCurPos.X() < aBestPos.X()) : // besser als Beste
- (aCurPos.X() > aBestPos.X())) ) // " reverse
- {
- aBestPos = aCurPos;
- pBest = pTmpObj;
- }
+ SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pTmpObj;
+ aCurPos = pO->GetFlyFrm()->Frm().Pos();
}
- break;
- }
-
- if( (bNext? (aPos.Y() < aCurPos.Y()) : // nur unter mir
- (aPos.Y() > aCurPos.Y())) && // " reverse
- (bNext? (aBestPos.Y() > aCurPos.Y()) : // naeher drunter
- (aBestPos.Y() < aCurPos.Y())) || // " reverse
- (aBestPos.Y() == aCurPos.Y() &&
- (bNext? (aBestPos.X() > aCurPos.X()) : // weiter links
- (aBestPos.X() < aCurPos.X())))) // " reverse
-
- {
- aBestPos = aCurPos;
- pBest = pObj;
- }
+ else
+ aCurPos = pTmpObj->GetCurrentBoundRect().TopLeft();
- if( (bNext? (aTopPos.Y() > aCurPos.Y()) : // hoeher als Beste
- (aTopPos.Y() < aCurPos.Y())) || // " reverse
- (aTopPos.Y() == aCurPos.Y() &&
- (bNext? (aTopPos.X() > aCurPos.X()) : // weiter links
- (aTopPos.X() < aCurPos.X())))) // " reverse
- {
- aTopPos = aCurPos;
- pTop = pObj;
+ if( aCurPos != aPos && aCurPos.Y() == aPos.Y() &&
+ (bNext? (aCurPos.X() > aPos.X()) : // liegt neben mir
+ (aCurPos.X() < aPos.X())) && // " reverse
+ (bNext? (aCurPos.X() < aBestPos.X()) : // besser als Beste
+ (aCurPos.X() > aBestPos.X())) ) // " reverse
+ {
+ aBestPos = aCurPos;
+ pBest = pTmpObj;
+ }
}
+ break;
}
- // leider nichts gefunden
- if( (bNext? (aBestPos.X() == LONG_MAX) : (aBestPos.X() == 0)) )
- pBest = pTop;
- }
- if( pBest )
- {
- BOOL bFlyFrm = pBest->ISA(SwVirtFlyDrawObj);
- if( bFlyFrm )
+ if( (bNext? (aPos.Y() < aCurPos.Y()) : // nur unter mir
+ (aPos.Y() > aCurPos.Y())) && // " reverse
+ (bNext? (aBestPos.Y() > aCurPos.Y()) : // naeher drunter
+ (aBestPos.Y() < aCurPos.Y())) || // " reverse
+ (aBestPos.Y() == aCurPos.Y() &&
+ (bNext? (aBestPos.X() > aCurPos.X()) : // weiter links
+ (aBestPos.X() < aCurPos.X())))) // " reverse
+
{
- SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pBest;
- const SwRect& rFrm = pO->GetFlyFrm()->Frm();
- SelectObj( rFrm.Pos(), 0, (SdrObject*)pBest );
- if( !ActionPend() )
- MakeVisible( rFrm );
+ aBestPos = aCurPos;
+ pBest = pObj;
}
- else
+
+ if( (bNext? (aTopPos.Y() > aCurPos.Y()) : // hoeher als Beste
+ (aTopPos.Y() < aCurPos.Y())) || // " reverse
+ (aTopPos.Y() == aCurPos.Y() &&
+ (bNext? (aTopPos.X() > aCurPos.X()) : // weiter links
+ (aTopPos.X() < aCurPos.X())))) // " reverse
{
- SelectObj( Point(), 0, (SdrObject*)pBest );
- if( !ActionPend() )
- MakeVisible( pBest->GetCurrentBoundRect() );
+ aTopPos = aCurPos;
+ pTop = pObj;
}
- CallChgLnk();
- bRet = TRUE;
}
- return bRet;
+ // leider nichts gefunden
+ if( (bNext? (aBestPos.X() == LONG_MAX) : (aBestPos.X() == 0)) )
+ pBest = pTop;
}
+
+ return pBest;
+}
+
+BOOL SwFEShell::GotoObj( BOOL bNext, USHORT /*GOTOOBJ_...*/ eType )
+{
+ const SdrObject* pBest = GetBestObject( bNext, eType );
+
+ if ( !pBest )
+ return FALSE;
+
+ BOOL bFlyFrm = pBest->ISA(SwVirtFlyDrawObj);
+ if( bFlyFrm )
+ {
+ SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pBest;
+ const SwRect& rFrm = pO->GetFlyFrm()->Frm();
+ SelectObj( rFrm.Pos(), 0, (SdrObject*)pBest );
+ if( !ActionPend() )
+ MakeVisible( rFrm );
+ }
+ else
+ {
+ SelectObj( Point(), 0, (SdrObject*)pBest );
+ if( !ActionPend() )
+ MakeVisible( pBest->GetCurrentBoundRect() );
+ }
+ CallChgLnk();
+ return TRUE;
}
/*************************************************************************
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 27a31ce70f..943a46587d 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -39,6 +39,7 @@
#include <unotextrange.hxx>
#include <unoprnms.hxx>
#include <editeng/unoprnms.hxx>
+#include <svx/svditer.hxx>
#include <swunohelper.hxx>
#include <doc.hxx>
#include <fmtcntnt.hxx>
@@ -1052,25 +1053,34 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) :
-----------------------------------------------------------------------*/
void SwXShape::AddExistingShapeToFmt( SdrObject& _rObj )
{
- SwXShape* pSwShape = NULL;
- uno::Reference< lang::XUnoTunnel > xShapeTunnel( _rObj.getWeakUnoShape(), uno::UNO_QUERY );
- if ( xShapeTunnel.is() )
- pSwShape = reinterpret_cast< SwXShape * >(
- sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) );
- if ( pSwShape )
+ SdrObjListIter aIter( _rObj, IM_DEEPNOGROUPS );
+ while ( aIter.IsMore() )
{
- if ( pSwShape->m_bDescriptor )
- {
- SwFrmFmt* pFmt = ::FindFrmFmt( &const_cast< SdrObject& >( _rObj ) );
- if ( pFmt )
- pFmt->Add( pSwShape );
- pSwShape->m_bDescriptor = sal_False;
- }
+ SdrObject* pCurrent = aIter.Next();
+ OSL_ENSURE( pCurrent, "SwXShape::AddExistingShapeToFmt: invalid object list element!" );
+ if ( !pCurrent )
+ continue;
- if ( !pSwShape->pImpl->bInitializedPropertyNotifier )
+ SwXShape* pSwShape = NULL;
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel( pCurrent->getWeakUnoShape(), uno::UNO_QUERY );
+ if ( xShapeTunnel.is() )
+ pSwShape = reinterpret_cast< SwXShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) );
+ if ( pSwShape )
{
- lcl_addShapePropertyEventFactories( _rObj, *pSwShape );
- pSwShape->pImpl->bInitializedPropertyNotifier = true;
+ if ( pSwShape->m_bDescriptor )
+ {
+ SwFrmFmt* pFmt = ::FindFrmFmt( const_cast< SdrObject* >( pCurrent ) );
+ if ( pFmt )
+ pFmt->Add( pSwShape );
+ pSwShape->m_bDescriptor = sal_False;
+ }
+
+ if ( !pSwShape->pImpl->bInitializedPropertyNotifier )
+ {
+ lcl_addShapePropertyEventFactories( *pCurrent, *pSwShape );
+ pSwShape->pImpl->bInitializedPropertyNotifier = true;
+ }
}
}
}
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx
index d57e22b985..93e88b3b74 100644
--- a/sw/source/ui/app/apphdl.cxx
+++ b/sw/source/ui/app/apphdl.cxx
@@ -765,6 +765,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
DELETEZ(pWebToolbarConfig) ;
DELETEZ(pAuthorNames) ;
DELETEZ(pDBConfig);
+
if (pColorConfig != 0) {
pColorConfig->RemoveListener(this);
DELETEZ(pColorConfig);
diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
index 4712c76e24..dff25a84d1 100644
--- a/sw/source/ui/inc/view.hxx
+++ b/sw/source/ui/inc/view.hxx
@@ -599,6 +599,7 @@ public:
SwDocShell *GetDocShell();
inline const SwDocShell *GetDocShell() const;
inline FmFormShell *GetFormShell() { return pFormShell; }
+ inline const FmFormShell *GetFormShell() const { return pFormShell; }
//damit in DToren der SubShells ggf. pShell zurueckgesetzt werden kann
void ResetSubShell() { pShell = 0; }
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)
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index 84b6e86e70..8ba286f926 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -710,7 +710,7 @@ uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormCo
FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
SdrView* pDrawView = pView2 ? pView2->GetDrawView() : NULL;
Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL;
- DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::GetControl: how could I?" );
+ DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::getFormController: how could I?" );
uno::Reference< form::runtime::XFormController > xController;
if ( pFormShell && pDrawView && pWindow )