INTEGRATION: CWS impressfunctions (1.55.38); FILE MERGED

2005/10/28 10:58:28 cl 1.55.38.1: #125341# reworked FuPoor classes to use refcounting
This commit is contained in:
Rüdiger Timm
2005-12-14 16:29:11 +00:00
parent 29a69e05c7
commit dc5479dcc3

View File

@@ -4,9 +4,9 @@
* *
* $RCSfile: drviewse.cxx,v $ * $RCSfile: drviewse.cxx,v $
* *
* $Revision: 1.55 $ * $Revision: 1.56 $
* *
* last change: $Author: rt $ $Date: 2005-09-09 07:12:08 $ * last change: $Author: rt $ $Date: 2005-12-14 17:29:11 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
@@ -279,36 +279,43 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
USHORT nSId = rReq.GetSlot(); USHORT nSId = rReq.GetSlot();
if( pFuActual && pFuActual->ISA(FuText) && if( HasCurrentFunction() &&
( nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE || ( nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL ) ) nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL ) )
{ {
((FuText*) pFuActual)->SetPermanent(TRUE); FunctionReference xFunc( GetCurrentFunction() );
pFuActual->ReceiveRequest( rReq );
MapSlot( nSId ); FuText* pFuText = dynamic_cast< FuText* >( xFunc.get() );
Invalidate(); if( pFuText )
{
pFuText->SetPermanent(TRUE);
xFunc->ReceiveRequest( rReq );
Invalidate(); MapSlot( nSId );
// #98198# evtl. feed characters to activated textedit Invalidate();
if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
ImpAddPrintableCharactersToTextEdit(rReq, GetView());
rReq.Done(); Invalidate();
return;
// #98198# evtl. feed characters to activated textedit
if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
ImpAddPrintableCharactersToTextEdit(rReq, GetView());
rReq.Done();
return;
}
} }
CheckLineTo (rReq); CheckLineTo (rReq);
USHORT nOldSId = 0; USHORT nOldSId = 0;
BOOL bPermanent = FALSE; BOOL bPermanent = FALSE;
if (pFuActual) if(HasCurrentFunction())
{ {
if (pFuOld == pFuActual) if(GetOldFunction() == GetCurrentFunction())
{ {
pFuOld = NULL; SetOldFunction(0);
} }
if ( nSId != SID_TEXTEDIT && nSId != SID_ATTR_CHAR && nSId != SID_TEXT_FITTOSIZE && if ( nSId != SID_TEXTEDIT && nSId != SID_ATTR_CHAR && nSId != SID_TEXT_FITTOSIZE &&
@@ -318,20 +325,23 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
pDrView->EndTextEdit(); pDrView->EndTextEdit();
} }
nOldSId = pFuActual->GetSlotID(); if( HasCurrentFunction() )
if (nOldSId == nSId ||
((nOldSId == SID_TEXTEDIT || nOldSId == SID_ATTR_CHAR || nOldSId == SID_TEXT_FITTOSIZE ||
nOldSId == SID_ATTR_CHAR_VERTICAL || nOldSId == SID_TEXT_FITTOSIZE_VERTICAL) &&
(nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL )))
{ {
bPermanent = TRUE; nOldSId = GetCurrentFunction()->GetSlotID();
if (nOldSId == nSId ||
((nOldSId == SID_TEXTEDIT || nOldSId == SID_ATTR_CHAR || nOldSId == SID_TEXT_FITTOSIZE ||
nOldSId == SID_ATTR_CHAR_VERTICAL || nOldSId == SID_TEXT_FITTOSIZE_VERTICAL) &&
(nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL )))
{
bPermanent = TRUE;
}
GetCurrentFunction()->Deactivate();
} }
pFuActual->Deactivate(); SetCurrentFunction(0);
delete pFuActual;
pFuActual = NULL;
SfxBindings& rBind = GetViewFrame()->GetBindings(); SfxBindings& rBind = GetViewFrame()->GetBindings();
rBind.Invalidate(nOldSId); rBind.Invalidate(nOldSId);
@@ -349,8 +359,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
case SID_TEXT_FITTOSIZE: case SID_TEXT_FITTOSIZE:
case SID_TEXT_FITTOSIZE_VERTICAL: case SID_TEXT_FITTOSIZE_VERTICAL:
{ {
pFuActual = new FuText(this, GetActiveWindow(), pDrView, GetDoc(), rReq); SetCurrentFunction( FuText::Create(this, GetActiveWindow(), pDrView, GetDoc(), rReq) );
( (FuText*) pFuActual)->DoExecute();
// Das Setzen des Permanent-Status erfolgt weiter oben! // Das Setzen des Permanent-Status erfolgt weiter oben!
SfxBindings& rBindings = GetViewFrame()->GetBindings(); SfxBindings& rBindings = GetViewFrame()->GetBindings();
@@ -369,10 +378,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
case SID_FM_CREATE_CONTROL: case SID_FM_CREATE_CONTROL:
{ {
pFuActual = new FuConstructUnoControl( SetCurrentFunction( FuConstructUnoControl::Create( this, GetActiveWindow(), pDrView, GetDoc(), rReq, bPermanent ) );
this, GetActiveWindow(), pDrView, GetDoc(), rReq);
static_cast<FuConstructUnoControl*>(pFuActual)
->SetPermanent(bPermanent);
rReq.Done(); rReq.Done();
} }
break; break;
@@ -486,9 +492,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
} }
} }
pFuActual = new FuSelection(this, GetActiveWindow(), pDrView, SetCurrentFunction( FuSelection::Create(this, GetActiveWindow(), pDrView, GetDoc(), rReq) );
GetDoc(), rReq);
rReq.Done(); rReq.Done();
Invalidate( SID_OBJECT_SELECT ); Invalidate( SID_OBJECT_SELECT );
} }
@@ -548,11 +552,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
case SID_CONNECTOR_LINES_CIRCLE_END: case SID_CONNECTOR_LINES_CIRCLE_END:
case SID_CONNECTOR_LINES_CIRCLES: case SID_CONNECTOR_LINES_CIRCLES:
{ {
pFuActual = new FuConstructRectangle( SetCurrentFunction( FuConstructRectangle::Create( this, GetActiveWindow(), pDrView, GetDoc(), rReq, bPermanent ) );
this, GetActiveWindow(), pDrView, GetDoc(), rReq);
static_cast<FuConstructRectangle*>(pFuActual)
->SetPermanent(bPermanent);
rReq.Done(); rReq.Done();
} }
break; break;
@@ -565,10 +565,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
case SID_DRAW_BEZIER_FILL: // BASIC case SID_DRAW_BEZIER_FILL: // BASIC
case SID_DRAW_BEZIER_NOFILL: // BASIC case SID_DRAW_BEZIER_NOFILL: // BASIC
{ {
pFuActual = new FuConstructBezierPolygon( SetCurrentFunction( FuConstructBezierPolygon::Create(this, GetActiveWindow(), pDrView, GetDoc(), rReq, bPermanent) );
this, GetActiveWindow(), pDrView, GetDoc(), rReq);
static_cast<FuConstructBezierPolygon*>(pFuActual)
->SetPermanent(bPermanent);
rReq.Done(); rReq.Done();
} }
break; break;
@@ -577,8 +574,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
{ {
if (nOldSId != SID_GLUE_EDITMODE) if (nOldSId != SID_GLUE_EDITMODE)
{ {
pFuActual = new FuEditGluePoints( this, GetActiveWindow(), pDrView, GetDoc(), rReq ); SetCurrentFunction( FuEditGluePoints::Create( this, GetActiveWindow(), pDrView, GetDoc(), rReq, bPermanent ) );
((FuEditGluePoints*) pFuActual)->SetPermanent(bPermanent);
} }
else else
{ {
@@ -600,9 +596,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
case SID_DRAW_CIRCLECUT: case SID_DRAW_CIRCLECUT:
case SID_DRAW_CIRCLECUT_NOFILL: case SID_DRAW_CIRCLECUT_NOFILL:
{ {
pFuActual = new FuConstructArc( SetCurrentFunction( FuConstructArc::Create( this, GetActiveWindow(), pDrView, GetDoc(), rReq, bPermanent) );
this, GetActiveWindow(), pDrView, GetDoc(), rReq);
static_cast<FuConstructArc*>(pFuActual)->SetPermanent(bPermanent);
rReq.Done(); rReq.Done();
} }
break; break;
@@ -616,10 +610,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
case SID_3D_CONE: case SID_3D_CONE:
case SID_3D_PYRAMID: case SID_3D_PYRAMID:
{ {
pFuActual = new FuConstruct3dObject( SetCurrentFunction( FuConstruct3dObject::Create(this, GetActiveWindow(), pDrView, GetDoc(), rReq, bPermanent ) );
this, GetActiveWindow(), pDrView, GetDoc(), rReq);
static_cast<FuConstruct3dObject*>(pFuActual)
->SetPermanent(bPermanent);
rReq.Done(); rReq.Done();
} }
break; break;
@@ -632,10 +623,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
case SID_DRAWTBX_CS_STAR : case SID_DRAWTBX_CS_STAR :
case SID_DRAW_CS_ID : case SID_DRAW_CS_ID :
{ {
pFuActual = new FuConstructCustomShape( SetCurrentFunction( FuConstructCustomShape::Create( this, GetActiveWindow(), pDrView, GetDoc(), rReq, bPermanent ) );
this, GetActiveWindow(), pDrView, GetDoc(), rReq);
static_cast<FuConstructCustomShape*>(pFuActual)
->SetPermanent(bPermanent);
rReq.Done(); rReq.Done();
if ( nSId != SID_DRAW_CS_ID ) if ( nSId != SID_DRAW_CS_ID )
@@ -651,25 +639,24 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
break; break;
} }
if (pFuOld) if(HasOldFunction())
{ {
USHORT nSId = pFuOld->GetSlotID(); USHORT nSId = GetOldFunction()->GetSlotID();
pFuOld->Deactivate(); GetOldFunction()->Deactivate();
delete pFuOld; SetOldFunction(0);
pFuOld = NULL;
SfxBindings& rBind = GetViewFrame()->GetBindings(); SfxBindings& rBind = GetViewFrame()->GetBindings();
rBind.Invalidate( nSId ); rBind.Invalidate( nSId );
rBind.Update( nSId ); rBind.Update( nSId );
} }
if (pFuActual) if(HasCurrentFunction())
{ {
pFuActual->Activate(); GetCurrentFunction()->Activate();
pFuOld = pFuActual; SetOldFunction( GetCurrentFunction() );
SetHelpId( pFuActual->GetSlotID() ); SetHelpId( GetCurrentFunction()->GetSlotID() );
} }
// Shell wird invalidiert, schneller als einzeln (laut MI) // Shell wird invalidiert, schneller als einzeln (laut MI)
@@ -677,7 +664,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
Invalidate(); Invalidate();
// #97016# III CTRL-SID_OBJECT_SELECT -> select first draw object if none is selected yet // #97016# III CTRL-SID_OBJECT_SELECT -> select first draw object if none is selected yet
if(SID_OBJECT_SELECT == nSId && pFuActual && (rReq.GetModifier() & KEY_MOD1)) if(SID_OBJECT_SELECT == nSId && HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
{ {
if(!GetView()->AreObjectsMarked()) if(!GetView()->AreObjectsMarked())
{ {
@@ -692,7 +679,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
} }
// #97016# with qualifier construct directly // #97016# with qualifier construct directly
if(pFuActual && (rReq.GetModifier() & KEY_MOD1)) if(HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
{ {
// get SdOptions // get SdOptions
SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
@@ -710,7 +697,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
if(pPageView) if(pPageView)
{ {
// create the default object // create the default object
SdrObject* pObj = pFuActual->CreateDefaultObject(nSId, aNewObjectRectangle); SdrObject* pObj = GetCurrentFunction()->CreateDefaultObject(nSId, aNewObjectRectangle);
if(pObj) if(pObj)
{ {
@@ -850,9 +837,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
/****************************************************************** /******************************************************************
* ObjectBar einschalten * ObjectBar einschalten
******************************************************************/ ******************************************************************/
if (pFuActual && if( dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) || dynamic_cast< FuConstructBezierPolygon* >( GetCurrentFunction().get() ) )
(pFuActual->ISA(FuSelection)
|| pFuActual->ISA(FuConstructBezierPolygon)))
{ {
GetObjectBarManager().SelectionHasChanged(pDrView);//context has changed GetObjectBarManager().SelectionHasChanged(pDrView);//context has changed
} }
@@ -888,8 +873,14 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
} }
else else
{ {
if (pFuActual) pFuActual->DoCut(); if(HasCurrentFunction())
else if (pDrView) pDrView->DoCut(); {
GetCurrentFunction()->DoCut();
}
else if(pDrView)
{
pDrView->DoCut();
}
} }
rReq.Ignore (); rReq.Ignore ();
} }
@@ -904,10 +895,14 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
} }
else else
{ {
if (pFuActual) if(HasCurrentFunction())
pFuActual->DoCopy(); {
else GetCurrentFunction()->DoCopy();
}
else if( pDrView )
{
pDrView->DoCopy(); pDrView->DoCopy();
}
} }
rReq.Ignore (); rReq.Ignore ();
} }
@@ -917,8 +912,14 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
{ {
WaitObject aWait( (Window*)GetActiveWindow() ); WaitObject aWait( (Window*)GetActiveWindow() );
if (pFuActual) pFuActual->DoPaste(); if(HasCurrentFunction())
else if (pDrView) pDrView->DoPaste(); {
GetCurrentFunction()->DoPaste();
}
else if(pDrView)
{
pDrView->DoPaste();
}
rReq.Ignore (); rReq.Ignore ();
} }
@@ -981,13 +982,15 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
::sd::Window* pWindow = GetActiveWindow(); ::sd::Window* pWindow = GetActiveWindow();
InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
} }
else if (pFuActual) else if( HasCurrentFunction() )
{ {
KeyCode aKCode(KEY_DELETE); KeyCode aKCode(KEY_DELETE);
KeyEvent aKEvt( 0, aKCode); KeyEvent aKEvt( 0, aKCode);
if ( !pFuActual->KeyInput(aKEvt) ) if( !GetCurrentFunction()->KeyInput(aKEvt) && pDrView )
{
pDrView->DeleteMarked(); pDrView->DeleteMarked();
}
} }
else else
{ {
@@ -1114,7 +1117,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
ChangeEditMode(EM_MASTERPAGE, mbIsLayerModeActive); ChangeEditMode(EM_MASTERPAGE, mbIsLayerModeActive);
if (pFuActual && pFuActual->GetSlotID() == SID_BEZIER_EDIT) if(HasCurrentFunction(SID_BEZIER_EDIT))
GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
} }
else else
@@ -1171,8 +1174,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
Broadcast ( Broadcast (
ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END)); ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
if (pFuActual != NULL if(HasCurrentFunction(SID_BEZIER_EDIT))
&& pFuActual->GetSlotID() == SID_BEZIER_EDIT)
{ {
GetViewFrame()->GetDispatcher()->Execute( GetViewFrame()->GetDispatcher()->Execute(
SID_OBJECT_SELECT, SID_OBJECT_SELECT,
@@ -1421,10 +1423,11 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
case SID_GLUE_VERTALIGN_TOP: case SID_GLUE_VERTALIGN_TOP:
case SID_GLUE_VERTALIGN_BOTTOM: case SID_GLUE_VERTALIGN_BOTTOM:
{ {
if (pFuActual && pFuActual->ISA(FuEditGluePoints)) FunctionReference xFunc( GetCurrentFunction() );
{ FuEditGluePoints* pFunc = dynamic_cast< FuEditGluePoints* >( xFunc.get() );
((FuEditGluePoints*) pFuActual)->ReceiveRequest(rReq);
} if(pFunc)
pFunc->ReceiveRequest(rReq);
rReq.Done(); rReq.Done();
} }