xref: /aoo41x/main/sd/source/ui/view/tabcontr.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sd.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "TabControl.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
34*cdf0e10cSrcweir #include <svx/svdlayer.hxx>
35*cdf0e10cSrcweir #include <svx/svdpagv.hxx>
36*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include "sdattr.hxx"
40*cdf0e10cSrcweir #include "app.hxx"
41*cdf0e10cSrcweir #include "app.hrc"
42*cdf0e10cSrcweir #include "glob.hrc"
43*cdf0e10cSrcweir #include "res_bmp.hrc"
44*cdf0e10cSrcweir #include "DrawViewShell.hxx"
45*cdf0e10cSrcweir #include "GraphicViewShell.hxx"
46*cdf0e10cSrcweir #include "helpids.h"
47*cdf0e10cSrcweir #include "View.hxx"
48*cdf0e10cSrcweir #include "sdpage.hxx"
49*cdf0e10cSrcweir #include "drawdoc.hxx"
50*cdf0e10cSrcweir #include "Window.hxx"
51*cdf0e10cSrcweir #include "unmodpg.hxx"
52*cdf0e10cSrcweir #include "DrawDocShell.hxx"
53*cdf0e10cSrcweir #include "sdresid.hxx"
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir namespace sd {
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir #define SWITCH_TIMEOUT	20
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir // -----------------------------------------
61*cdf0e10cSrcweir // - SdTabControl::SdPageObjsTransferable -
62*cdf0e10cSrcweir // -----------------------------------------
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir TabControl::TabControlTransferable::~TabControlTransferable()
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir }
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir // -----------------------------------------------------------------------------
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir void TabControl::TabControlTransferable::AddSupportedFormats()
71*cdf0e10cSrcweir {
72*cdf0e10cSrcweir 	AddFormat( SOT_FORMATSTR_ID_STARDRAW_TABBAR );
73*cdf0e10cSrcweir }
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir // -----------------------------------------------------------------------------
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir sal_Bool TabControl::TabControlTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& )
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir 	return sal_False;
80*cdf0e10cSrcweir }
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir // -----------------------------------------------------------------------------
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir void TabControl::TabControlTransferable::DragFinished( sal_Int8 nDropAction )
85*cdf0e10cSrcweir {
86*cdf0e10cSrcweir 	mrParent.DragFinished( nDropAction );
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir /*************************************************************************
90*cdf0e10cSrcweir |*
91*cdf0e10cSrcweir |* Standard-Konstruktor
92*cdf0e10cSrcweir |*
93*cdf0e10cSrcweir \************************************************************************/
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir TabControl::TabControl(DrawViewShell* pViewSh, Window* pParent) :
96*cdf0e10cSrcweir 	TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_SIZEABLE | WB_DRAG) ),
97*cdf0e10cSrcweir 	DragSourceHelper( this ),
98*cdf0e10cSrcweir 	DropTargetHelper( this ),
99*cdf0e10cSrcweir 	pDrViewSh(pViewSh),
100*cdf0e10cSrcweir 	bInternalMove(sal_False)
101*cdf0e10cSrcweir {
102*cdf0e10cSrcweir 	EnableEditMode();
103*cdf0e10cSrcweir 	SetSizePixel(Size(0, 0));
104*cdf0e10cSrcweir 	SetMaxPageWidth( 150 );
105*cdf0e10cSrcweir     SetHelpId( HID_SD_TABBAR_PAGES );
106*cdf0e10cSrcweir }
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir /*************************************************************************
109*cdf0e10cSrcweir |*
110*cdf0e10cSrcweir |* Destruktor
111*cdf0e10cSrcweir |*
112*cdf0e10cSrcweir \************************************************************************/
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir TabControl::~TabControl()
115*cdf0e10cSrcweir {
116*cdf0e10cSrcweir }
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir /*************************************************************************
119*cdf0e10cSrcweir |*
120*cdf0e10cSrcweir \************************************************************************/
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir void TabControl::Select()
123*cdf0e10cSrcweir {
124*cdf0e10cSrcweir 	SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
125*cdf0e10cSrcweir 	pDispatcher->Execute(SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON |
126*cdf0e10cSrcweir 							SFX_CALLMODE_RECORD);
127*cdf0e10cSrcweir }
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir /*************************************************************************
130*cdf0e10cSrcweir |*
131*cdf0e10cSrcweir \************************************************************************/
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir void  TabControl::MouseButtonDown(const MouseEvent& rMEvt)
134*cdf0e10cSrcweir {
135*cdf0e10cSrcweir 	if (rMEvt.IsLeft()
136*cdf0e10cSrcweir         && !rMEvt.IsMod1()
137*cdf0e10cSrcweir         && !rMEvt.IsMod2()
138*cdf0e10cSrcweir         && !rMEvt.IsShift())
139*cdf0e10cSrcweir 	{
140*cdf0e10cSrcweir 		Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
141*cdf0e10cSrcweir 		sal_uInt16 aPageId = GetPageId(aPos);
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 		if (aPageId == 0)
144*cdf0e10cSrcweir 		{
145*cdf0e10cSrcweir 			SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir 			pDispatcher->Execute(SID_INSERTPAGE_QUICK,
148*cdf0e10cSrcweir 								SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
149*cdf0e10cSrcweir 		}
150*cdf0e10cSrcweir 	}
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     // A single left click with pressed control key on a tab page first
153*cdf0e10cSrcweir     // switches to that page before the usual handling (copying with drag
154*cdf0e10cSrcweir     // and drop) takes place.
155*cdf0e10cSrcweir 	else if (rMEvt.IsLeft() && rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift())
156*cdf0e10cSrcweir     {
157*cdf0e10cSrcweir         pDrViewSh->SwitchPage (GetPageId (rMEvt.GetPosPixel()) - 1);
158*cdf0e10cSrcweir     }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     // When only the right button is pressed then first process a
161*cdf0e10cSrcweir     // synthesized left button click to make the page the current one
162*cdf0e10cSrcweir     // whose tab has been clicked.  When then the actual right button
163*cdf0e10cSrcweir     // click is processed the resulting context menu relates to the
164*cdf0e10cSrcweir     // now current page.
165*cdf0e10cSrcweir     if (rMEvt.IsRight() && ! rMEvt.IsLeft())
166*cdf0e10cSrcweir     {
167*cdf0e10cSrcweir         MouseEvent aSyntheticEvent (
168*cdf0e10cSrcweir             rMEvt.GetPosPixel(),
169*cdf0e10cSrcweir             rMEvt.GetClicks(),
170*cdf0e10cSrcweir             rMEvt.GetMode(),
171*cdf0e10cSrcweir             MOUSE_LEFT,
172*cdf0e10cSrcweir             rMEvt.GetModifier());
173*cdf0e10cSrcweir         TabBar::MouseButtonDown(aSyntheticEvent);
174*cdf0e10cSrcweir     }
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 	TabBar::MouseButtonDown(rMEvt);
177*cdf0e10cSrcweir }
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir /*************************************************************************
180*cdf0e10cSrcweir |*
181*cdf0e10cSrcweir \************************************************************************/
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir void TabControl::DoubleClick()
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir 	if (GetCurPageId() != 0)
186*cdf0e10cSrcweir 	{
187*cdf0e10cSrcweir 		SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
188*cdf0e10cSrcweir 		pDispatcher->Execute( SID_MODIFYPAGE,
189*cdf0e10cSrcweir 						SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
190*cdf0e10cSrcweir 	}
191*cdf0e10cSrcweir }
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir /*************************************************************************
194*cdf0e10cSrcweir |*
195*cdf0e10cSrcweir |* StartDrag-Request
196*cdf0e10cSrcweir |*
197*cdf0e10cSrcweir \************************************************************************/
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir void TabControl::StartDrag( sal_Int8, const Point& )
200*cdf0e10cSrcweir {
201*cdf0e10cSrcweir 	bInternalMove = sal_True;
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 	// object is delete by reference mechanismn
204*cdf0e10cSrcweir 	( new TabControl::TabControlTransferable( *this ) )->StartDrag( this, DND_ACTION_COPYMOVE );
205*cdf0e10cSrcweir }
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir /*************************************************************************
208*cdf0e10cSrcweir |*
209*cdf0e10cSrcweir |* DragFinished
210*cdf0e10cSrcweir |*
211*cdf0e10cSrcweir \************************************************************************/
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir void TabControl::DragFinished( sal_Int8 )
214*cdf0e10cSrcweir {
215*cdf0e10cSrcweir 	bInternalMove = sal_False;
216*cdf0e10cSrcweir }
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir /*************************************************************************
219*cdf0e10cSrcweir |*
220*cdf0e10cSrcweir |* AcceptDrop-Event
221*cdf0e10cSrcweir |*
222*cdf0e10cSrcweir \************************************************************************/
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir sal_Int8 TabControl::AcceptDrop( const AcceptDropEvent& rEvt )
225*cdf0e10cSrcweir {
226*cdf0e10cSrcweir 	sal_Int8 nRet = DND_ACTION_NONE;
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 	if( rEvt.mbLeaving )
229*cdf0e10cSrcweir 		EndSwitchPage();
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 	if( !pDrViewSh->GetDocSh()->IsReadOnly() )
232*cdf0e10cSrcweir 	{
233*cdf0e10cSrcweir 		SdDrawDocument* pDoc = pDrViewSh->GetDoc();
234*cdf0e10cSrcweir 		Point			aPos( rEvt.maPosPixel );
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 		if( bInternalMove )
237*cdf0e10cSrcweir 		{
238*cdf0e10cSrcweir 			if( rEvt.mbLeaving || ( pDrViewSh->GetEditMode() == EM_MASTERPAGE ) )
239*cdf0e10cSrcweir 				HideDropPos();
240*cdf0e10cSrcweir 			else
241*cdf0e10cSrcweir 			{
242*cdf0e10cSrcweir 				ShowDropPos( aPos );
243*cdf0e10cSrcweir 				nRet = rEvt.mnAction;
244*cdf0e10cSrcweir 			}
245*cdf0e10cSrcweir 		}
246*cdf0e10cSrcweir 		else
247*cdf0e10cSrcweir 		{
248*cdf0e10cSrcweir 			HideDropPos();
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 			sal_Int32 nPageId = GetPageId( aPos ) - 1;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 			if( ( nPageId >= 0 ) && pDoc->GetPage( (sal_uInt16)nPageId ) )
253*cdf0e10cSrcweir 			{
254*cdf0e10cSrcweir 				nRet = pDrViewSh->AcceptDrop( rEvt, *this, NULL, (sal_uInt16)nPageId, SDRLAYER_NOTFOUND );
255*cdf0e10cSrcweir 				SwitchPage( aPos );
256*cdf0e10cSrcweir 			}
257*cdf0e10cSrcweir 		}
258*cdf0e10cSrcweir 	}
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 	return nRet;
261*cdf0e10cSrcweir }
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir /*************************************************************************
264*cdf0e10cSrcweir |*
265*cdf0e10cSrcweir |* ExecuteDrop-Event
266*cdf0e10cSrcweir |*
267*cdf0e10cSrcweir \************************************************************************/
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir sal_Int8 TabControl::ExecuteDrop( const ExecuteDropEvent& rEvt )
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir 	SdDrawDocument* pDoc = pDrViewSh->GetDoc();
272*cdf0e10cSrcweir 	Point			aPos( rEvt.maPosPixel );
273*cdf0e10cSrcweir 	sal_Int8		nRet = DND_ACTION_NONE;
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 	if( bInternalMove )
276*cdf0e10cSrcweir 	{
277*cdf0e10cSrcweir 		sal_uInt16 nPageId = ShowDropPos( aPos ) - 1;
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir         switch (rEvt.mnAction)
280*cdf0e10cSrcweir         {
281*cdf0e10cSrcweir             case DND_ACTION_MOVE:
282*cdf0e10cSrcweir                 if( pDrViewSh->IsSwitchPageAllowed() && pDoc->MovePages( nPageId ) )
283*cdf0e10cSrcweir                 {
284*cdf0e10cSrcweir                     SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
285*cdf0e10cSrcweir                     pDispatcher->Execute(SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
286*cdf0e10cSrcweir                 }
287*cdf0e10cSrcweir                 break;
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir             case DND_ACTION_COPY:
290*cdf0e10cSrcweir             {
291*cdf0e10cSrcweir                 // Copying the selected page to the place that rEvt points
292*cdf0e10cSrcweir                 // takes place in three steps:
293*cdf0e10cSrcweir                 // 1. Create a copy of the selected page.  This copy will
294*cdf0e10cSrcweir                 // lie directly behind the selected page.
295*cdf0e10cSrcweir                 // 2. Move the copy to the desired place.
296*cdf0e10cSrcweir                 // 3. Select the copy.
297*cdf0e10cSrcweir                 if (pDrViewSh->IsSwitchPageAllowed())
298*cdf0e10cSrcweir                 {
299*cdf0e10cSrcweir                     // 1. Create a copy.
300*cdf0e10cSrcweir                     sal_uInt16 nPageNumOfCopy = pDoc->DuplicatePage (GetCurPageId() - 1);
301*cdf0e10cSrcweir                     // 2. Move page.  For this first switch to the copy:
302*cdf0e10cSrcweir                     // MovePages operates on the currently selected page(s).
303*cdf0e10cSrcweir                     pDrViewSh->SwitchPage (nPageNumOfCopy);
304*cdf0e10cSrcweir                     // Adapt target page id when necessary, i.e. page copy
305*cdf0e10cSrcweir                     // has been inserted in front of the target page.
306*cdf0e10cSrcweir                     sal_uInt16 nPageNum = nPageId;
307*cdf0e10cSrcweir                     if ((nPageNumOfCopy <= nPageNum) && (nPageNum != (sal_uInt16)-1))
308*cdf0e10cSrcweir                         nPageNum += 1;
309*cdf0e10cSrcweir                     if (pDoc->MovePages(nPageNum))
310*cdf0e10cSrcweir                     {
311*cdf0e10cSrcweir                         // 3. Switch to the copy that has been moved to its
312*cdf0e10cSrcweir                         // final destination.  Use an asynchron slot call to
313*cdf0e10cSrcweir                         // be executed after the still pending ones.
314*cdf0e10cSrcweir                         if (nPageNumOfCopy >= nPageNum || (nPageNum == (sal_uInt16)-1))
315*cdf0e10cSrcweir                             nPageNum += 1;
316*cdf0e10cSrcweir                         SetCurPageId (GetPageId(nPageNum));
317*cdf0e10cSrcweir                         SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
318*cdf0e10cSrcweir                         pDispatcher->Execute(SID_SWITCHPAGE,
319*cdf0e10cSrcweir                             SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
320*cdf0e10cSrcweir                     }
321*cdf0e10cSrcweir                 }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir                 break;
324*cdf0e10cSrcweir             }
325*cdf0e10cSrcweir         }
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 		nRet = rEvt.mnAction;
328*cdf0e10cSrcweir 	}
329*cdf0e10cSrcweir 	else
330*cdf0e10cSrcweir 	{
331*cdf0e10cSrcweir 		sal_Int32 nPageId = GetPageId( aPos ) - 1;
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 		if( ( nPageId >= 0 ) && pDoc->GetPage( (sal_uInt16)nPageId ) )
334*cdf0e10cSrcweir 		{
335*cdf0e10cSrcweir 			nRet = pDrViewSh->ExecuteDrop( rEvt, *this, NULL, (sal_uInt16)nPageId, SDRLAYER_NOTFOUND );
336*cdf0e10cSrcweir 		}
337*cdf0e10cSrcweir 	}
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 	HideDropPos();
340*cdf0e10cSrcweir 	EndSwitchPage();
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 	return nRet;
343*cdf0e10cSrcweir }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir /*************************************************************************
346*cdf0e10cSrcweir |*
347*cdf0e10cSrcweir \************************************************************************/
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir void TabControl::Command(const CommandEvent& rCEvt)
350*cdf0e10cSrcweir {
351*cdf0e10cSrcweir 	sal_uInt16 nCmd = rCEvt.GetCommand();
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 	if ( nCmd == COMMAND_CONTEXTMENU )
354*cdf0e10cSrcweir 	{
355*cdf0e10cSrcweir 		sal_Bool bGraphicShell = pDrViewSh->ISA(GraphicViewShell);
356*cdf0e10cSrcweir 		sal_uInt16 nResId = bGraphicShell ? RID_GRAPHIC_PAGETAB_POPUP :
357*cdf0e10cSrcweir 										RID_DRAW_PAGETAB_POPUP;
358*cdf0e10cSrcweir 		SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
359*cdf0e10cSrcweir 		pDispatcher->ExecutePopup( SdResId( nResId ) );
360*cdf0e10cSrcweir 	}
361*cdf0e10cSrcweir }
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir /*************************************************************************
364*cdf0e10cSrcweir |*
365*cdf0e10cSrcweir \************************************************************************/
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir long TabControl::StartRenaming()
368*cdf0e10cSrcweir {
369*cdf0e10cSrcweir 	sal_Bool bOK = sal_False;
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir 	if (pDrViewSh->GetPageKind() == PK_STANDARD)
372*cdf0e10cSrcweir 	{
373*cdf0e10cSrcweir 		bOK = sal_True;
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 		::sd::View* pView = pDrViewSh->GetView();
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir 		if ( pView->IsTextEdit() )
378*cdf0e10cSrcweir 			pView->SdrEndTextEdit();
379*cdf0e10cSrcweir 	}
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 	return( bOK );
382*cdf0e10cSrcweir }
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir /*************************************************************************
385*cdf0e10cSrcweir |*
386*cdf0e10cSrcweir \************************************************************************/
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir long TabControl::AllowRenaming()
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir 	sal_Bool bOK = sal_True;
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 	String aNewName( GetEditText() );
393*cdf0e10cSrcweir 	String aCompareName( GetPageText( GetEditPageId() ) );
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir 	if( aCompareName != aNewName )
396*cdf0e10cSrcweir 	{
397*cdf0e10cSrcweir         // Seite umbenennen
398*cdf0e10cSrcweir         if( pDrViewSh->GetDocSh()->CheckPageName( this, aNewName ) )
399*cdf0e10cSrcweir         {
400*cdf0e10cSrcweir             SetEditText( aNewName );
401*cdf0e10cSrcweir             EndRenaming();
402*cdf0e10cSrcweir         }
403*cdf0e10cSrcweir         else
404*cdf0e10cSrcweir         {
405*cdf0e10cSrcweir             bOK = sal_False;
406*cdf0e10cSrcweir         }
407*cdf0e10cSrcweir 	}
408*cdf0e10cSrcweir 	return( bOK );
409*cdf0e10cSrcweir }
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir /*************************************************************************
412*cdf0e10cSrcweir |*
413*cdf0e10cSrcweir \************************************************************************/
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir void TabControl::EndRenaming()
416*cdf0e10cSrcweir {
417*cdf0e10cSrcweir 	if( !IsEditModeCanceled() )
418*cdf0e10cSrcweir         pDrViewSh->RenameSlide( GetEditPageId(), GetEditText() );
419*cdf0e10cSrcweir }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir /*************************************************************************
423*cdf0e10cSrcweir |*
424*cdf0e10cSrcweir \************************************************************************/
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir void TabControl::ActivatePage()
427*cdf0e10cSrcweir {
428*cdf0e10cSrcweir 	if ( /*IsInSwitching && */ pDrViewSh->IsSwitchPageAllowed() )
429*cdf0e10cSrcweir 	{
430*cdf0e10cSrcweir 		SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
431*cdf0e10cSrcweir 		pDispatcher->Execute(SID_SWITCHPAGE,
432*cdf0e10cSrcweir 							 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
433*cdf0e10cSrcweir 	}
434*cdf0e10cSrcweir }
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir /*************************************************************************
438*cdf0e10cSrcweir |*
439*cdf0e10cSrcweir \************************************************************************/
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir long TabControl::DeactivatePage()
442*cdf0e10cSrcweir {
443*cdf0e10cSrcweir 	return pDrViewSh->IsSwitchPageAllowed();
444*cdf0e10cSrcweir }
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir 
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir void TabControl::SendActivatePageEvent (void)
450*cdf0e10cSrcweir {
451*cdf0e10cSrcweir     CallEventListeners (VCLEVENT_TABBAR_PAGEACTIVATED,
452*cdf0e10cSrcweir         reinterpret_cast<void*>(GetCurPageId()));
453*cdf0e10cSrcweir }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir void TabControl::SendDeactivatePageEvent (void)
459*cdf0e10cSrcweir {
460*cdf0e10cSrcweir 	CallEventListeners (VCLEVENT_TABBAR_PAGEDEACTIVATED,
461*cdf0e10cSrcweir         reinterpret_cast<void*>(GetCurPageId()));
462*cdf0e10cSrcweir }
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir } // end of namespace sd
465