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