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