2000-09-18 11:07:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* $RCSfile: tabcontr.cxx,v $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* $Revision: 1.16 $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-09 07:19:11 $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-09 01:19:11 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
#include "TabControl.hxx"
|
|
|
|
|
2004-10-04 12:48:19 -05:00
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
#ifndef _SVDLAYER_HXX
|
|
|
|
#include <svx/svdlayer.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDPAGV_HXX //autogen
|
|
|
|
#include <svx/svdpagv.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXDISPATCH_HXX //autogen
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#pragma hdrstop
|
|
|
|
|
|
|
|
#include "sdattr.hxx"
|
|
|
|
#include "app.hxx"
|
|
|
|
#include "app.hrc"
|
|
|
|
#include "glob.hrc"
|
|
|
|
#include "res_bmp.hrc"
|
2004-01-20 05:56:06 -06:00
|
|
|
#ifndef SD_DRAW_VIEW_SHELL_HXX
|
|
|
|
#include "DrawViewShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_GRAPHIC_VIEW_SHELL_HXX
|
|
|
|
#include "GraphicViewShell.hxx"
|
|
|
|
#endif
|
2002-05-22 06:01:58 -05:00
|
|
|
#include "helpids.h"
|
2004-01-20 05:56:06 -06:00
|
|
|
#ifndef SD_VIEW_HXX
|
|
|
|
#include "View.hxx"
|
|
|
|
#endif
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "sdpage.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
2004-01-20 05:56:06 -06:00
|
|
|
#ifndef SD_WINDOW_HXX
|
|
|
|
#include "Window.hxx"
|
|
|
|
#endif
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "unmodpg.hxx"
|
2004-01-20 05:56:06 -06:00
|
|
|
#include "DrawDocShell.hxx"
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "sdresid.hxx"
|
|
|
|
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
namespace sd {
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
#define SWITCH_TIMEOUT 20
|
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
// -----------------------------------------
|
|
|
|
// - SdTabControl::SdPageObjsTransferable -
|
|
|
|
// -----------------------------------------
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
TabControl::TabControlTransferable::~TabControlTransferable()
|
2001-04-04 10:41:39 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::TabControlTransferable::AddSupportedFormats()
|
2001-04-04 10:41:39 -05:00
|
|
|
{
|
|
|
|
AddFormat( SOT_FORMATSTR_ID_STARDRAW_TABBAR );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
sal_Bool TabControl::TabControlTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
|
2001-04-04 10:41:39 -05:00
|
|
|
{
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::TabControlTransferable::DragFinished( sal_Int8 nDropAction )
|
2001-04-04 10:41:39 -05:00
|
|
|
{
|
|
|
|
mrParent.DragFinished( nDropAction );
|
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Standard-Konstruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
TabControl::TabControl(DrawViewShell* pViewSh, Window* pParent) :
|
2000-09-18 11:07:07 -05:00
|
|
|
TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_SIZEABLE | WB_DRAG) ),
|
2001-04-04 10:41:39 -05:00
|
|
|
DragSourceHelper( this ),
|
|
|
|
DropTargetHelper( this ),
|
2000-09-18 11:07:07 -05:00
|
|
|
pDrViewSh(pViewSh),
|
|
|
|
bInternalMove(FALSE)
|
|
|
|
{
|
|
|
|
EnableEditMode();
|
|
|
|
SetSizePixel(Size(0, 0));
|
|
|
|
SetMaxPageWidth( 150 );
|
2002-05-22 06:01:58 -05:00
|
|
|
SetHelpId( HID_SD_TABBAR_PAGES );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Destruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
TabControl::~TabControl()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::Select()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
|
|
|
|
pDispatcher->Execute(SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON |
|
|
|
|
SFX_CALLMODE_RECORD);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::MouseButtonDown(const MouseEvent& rMEvt)
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2004-05-17 11:22:35 -05:00
|
|
|
if (rMEvt.IsLeft()
|
|
|
|
&& !rMEvt.IsMod1()
|
|
|
|
&& !rMEvt.IsMod2()
|
|
|
|
&& !rMEvt.IsShift())
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
|
|
|
|
USHORT aPageId = GetPageId(aPos);
|
|
|
|
|
|
|
|
if (aPageId == 0)
|
|
|
|
{
|
|
|
|
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
|
|
|
|
|
|
|
|
pDispatcher->Execute(SID_INSERTPAGE_QUICK,
|
|
|
|
SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-04 07:47:19 -06:00
|
|
|
// A single left click with pressed control key on a tab page first
|
|
|
|
// switches to that page before the usual handling (copying with drag
|
|
|
|
// and drop) takes place.
|
|
|
|
else if (rMEvt.IsLeft() && rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift())
|
|
|
|
{
|
|
|
|
pDrViewSh->SwitchPage (GetPageId (rMEvt.GetPosPixel()) - 1);
|
|
|
|
}
|
|
|
|
|
2004-05-17 11:22:35 -05:00
|
|
|
// When only the right button is pressed then first process a
|
|
|
|
// synthesized left button click to make the page the current one
|
|
|
|
// whose tab has been clicked. When then the actual right button
|
|
|
|
// click is processed the resulting context menu relates to the
|
|
|
|
// now current page.
|
|
|
|
if (rMEvt.IsRight() && ! rMEvt.IsLeft())
|
|
|
|
{
|
|
|
|
MouseEvent aSyntheticEvent (
|
|
|
|
rMEvt.GetPosPixel(),
|
|
|
|
rMEvt.GetClicks(),
|
|
|
|
rMEvt.GetMode(),
|
|
|
|
MOUSE_LEFT,
|
|
|
|
rMEvt.GetModifier());
|
|
|
|
TabBar::MouseButtonDown(aSyntheticEvent);
|
|
|
|
}
|
2002-11-04 07:47:19 -06:00
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
TabBar::MouseButtonDown(rMEvt);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::DoubleClick()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
if (GetCurPageId() != 0)
|
|
|
|
{
|
|
|
|
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
|
|
|
|
pDispatcher->Execute( SID_MODIFYPAGE,
|
|
|
|
SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* StartDrag-Request
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
|
2001-04-04 10:41:39 -05:00
|
|
|
{
|
|
|
|
bInternalMove = TRUE;
|
|
|
|
|
|
|
|
// object is delete by reference mechanismn
|
2004-01-20 05:56:06 -06:00
|
|
|
( new TabControl::TabControlTransferable( *this ) )->StartDrag( this, DND_ACTION_COPYMOVE );
|
2001-04-04 10:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* DragFinished
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::DragFinished( sal_Int8 nDropAction )
|
2001-04-04 10:41:39 -05:00
|
|
|
{
|
|
|
|
bInternalMove = FALSE;
|
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2001-04-04 10:41:39 -05:00
|
|
|
|* AcceptDrop-Event
|
2000-09-18 11:07:07 -05:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
sal_Int8 TabControl::AcceptDrop( const AcceptDropEvent& rEvt )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2001-04-04 10:41:39 -05:00
|
|
|
sal_Int8 nRet = DND_ACTION_NONE;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
if( rEvt.mbLeaving )
|
2000-09-18 11:07:07 -05:00
|
|
|
EndSwitchPage();
|
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
if( !pDrViewSh->GetDocSh()->IsReadOnly() )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
SdDrawDocument* pDoc = pDrViewSh->GetDoc();
|
2001-04-04 10:41:39 -05:00
|
|
|
Point aPos( rEvt.maPosPixel );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
if( bInternalMove )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2001-04-04 10:41:39 -05:00
|
|
|
if( rEvt.mbLeaving || ( pDrViewSh->GetEditMode() == EM_MASTERPAGE ) )
|
2000-09-18 11:07:07 -05:00
|
|
|
HideDropPos();
|
|
|
|
else
|
|
|
|
{
|
2001-04-04 10:41:39 -05:00
|
|
|
ShowDropPos( aPos );
|
|
|
|
nRet = rEvt.mnAction;
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HideDropPos();
|
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
USHORT nPageId = GetPageId( aPos ) - 1;
|
|
|
|
|
|
|
|
if( ( nPageId >= 0 ) && pDoc->GetPage( nPageId ) )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2004-01-20 05:56:06 -06:00
|
|
|
::sd::Window* pWindow = NULL;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2001-05-14 09:54:46 -05:00
|
|
|
nRet = pDrViewSh->AcceptDrop( rEvt, *this, NULL, nPageId, SDRLAYER_NOTFOUND );
|
2000-09-18 11:07:07 -05:00
|
|
|
SwitchPage( aPos );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
return nRet;
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2001-04-04 10:41:39 -05:00
|
|
|
|* ExecuteDrop-Event
|
2000-09-18 11:07:07 -05:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
sal_Int8 TabControl::ExecuteDrop( const ExecuteDropEvent& rEvt )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
SdDrawDocument* pDoc = pDrViewSh->GetDoc();
|
2001-04-04 10:41:39 -05:00
|
|
|
Point aPos( rEvt.maPosPixel );
|
|
|
|
sal_Int8 nRet = DND_ACTION_NONE;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
if( bInternalMove )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2001-04-04 10:41:39 -05:00
|
|
|
USHORT nPageId = ShowDropPos( aPos ) - 1;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2002-11-04 07:47:19 -06:00
|
|
|
switch (rEvt.mnAction)
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2002-11-04 07:47:19 -06:00
|
|
|
case DND_ACTION_MOVE:
|
|
|
|
if( pDrViewSh->IsSwitchPageAllowed() && pDoc->MovePages( nPageId ) )
|
|
|
|
{
|
|
|
|
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
|
|
|
|
pDispatcher->Execute(SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DND_ACTION_COPY:
|
|
|
|
{
|
|
|
|
// Copying the selected page to the place that rEvt points
|
|
|
|
// takes place in three steps:
|
|
|
|
// 1. Create a copy of the selected page. This copy will
|
|
|
|
// lie directly behind the selected page.
|
|
|
|
// 2. Move the copy to the desired place.
|
|
|
|
// 3. Select the copy.
|
|
|
|
if (pDrViewSh->IsSwitchPageAllowed())
|
|
|
|
{
|
|
|
|
// 1. Create a copy.
|
|
|
|
USHORT nPageNumOfCopy = pDoc->DuplicatePage (GetCurPageId() - 1);
|
|
|
|
// 2. Move page. For this first switch to the copy:
|
|
|
|
// MovePages operates on the currently selected page(s).
|
|
|
|
pDrViewSh->SwitchPage (nPageNumOfCopy);
|
|
|
|
// Adapt target page id when necessary, i.e. page copy
|
|
|
|
// has been inserted in front of the target page.
|
|
|
|
USHORT nPageNum = nPageId;
|
|
|
|
if ((nPageNumOfCopy <= nPageNum) && (nPageNum != (USHORT)-1))
|
|
|
|
nPageNum += 1;
|
|
|
|
if (pDoc->MovePages(nPageNum))
|
|
|
|
{
|
|
|
|
// 3. Switch to the copy that has been moved to its
|
|
|
|
// final destination. Use an asynchron slot call to
|
|
|
|
// be executed after the still pending ones.
|
|
|
|
if (nPageNumOfCopy >= nPageNum || (nPageNum == (USHORT)-1))
|
|
|
|
nPageNum += 1;
|
|
|
|
SetCurPageId (GetPageId(nPageNum));
|
|
|
|
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
|
|
|
|
pDispatcher->Execute(SID_SWITCHPAGE,
|
|
|
|
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
nRet = rEvt.mnAction;
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-04 10:41:39 -05:00
|
|
|
USHORT nPageId = GetPageId( aPos ) - 1;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
if( ( nPageId >= 0 ) && pDoc->GetPage( nPageId ) )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2001-05-14 09:54:46 -05:00
|
|
|
nRet = pDrViewSh->ExecuteDrop( rEvt, *this, NULL, nPageId, SDRLAYER_NOTFOUND );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HideDropPos();
|
|
|
|
EndSwitchPage();
|
|
|
|
|
2001-04-04 10:41:39 -05:00
|
|
|
return nRet;
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::Command(const CommandEvent& rCEvt)
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
USHORT nCmd = rCEvt.GetCommand();
|
|
|
|
|
|
|
|
if ( nCmd == COMMAND_CONTEXTMENU )
|
|
|
|
{
|
2004-01-20 05:56:06 -06:00
|
|
|
BOOL bGraphicShell = pDrViewSh->ISA(GraphicViewShell);
|
2000-09-18 11:07:07 -05:00
|
|
|
USHORT nResId = bGraphicShell ? RID_GRAPHIC_PAGETAB_POPUP :
|
|
|
|
RID_DRAW_PAGETAB_POPUP;
|
|
|
|
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
|
|
|
|
pDispatcher->ExecutePopup( SdResId( nResId ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
long TabControl::StartRenaming()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
BOOL bOK = FALSE;
|
|
|
|
|
|
|
|
if (pDrViewSh->GetPageKind() == PK_STANDARD)
|
|
|
|
{
|
|
|
|
bOK = TRUE;
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
::sd::View* pView = pDrViewSh->GetView();
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
if ( pView->IsTextEdit() )
|
|
|
|
pView->EndTextEdit();
|
|
|
|
}
|
|
|
|
|
|
|
|
return( bOK );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
long TabControl::AllowRenaming()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
BOOL bOK = TRUE;
|
|
|
|
|
|
|
|
String aNewName( GetEditText() );
|
|
|
|
String aCompareName( GetPageText( GetEditPageId() ) );
|
|
|
|
|
|
|
|
if( aCompareName != aNewName )
|
|
|
|
{
|
2001-10-02 09:45:11 -05:00
|
|
|
// Seite umbenennen
|
|
|
|
if( pDrViewSh->GetDocSh()->CheckPageName( this, aNewName ) )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2001-10-02 09:45:11 -05:00
|
|
|
SetEditText( aNewName );
|
|
|
|
EndRenaming();
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-10-02 09:45:11 -05:00
|
|
|
bOK = FALSE;
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return( bOK );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::EndRenaming()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
if( !IsEditModeCanceled() )
|
2002-11-04 10:42:55 -06:00
|
|
|
pDrViewSh->RenameSlide( GetEditPageId(), GetEditText() );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::ActivatePage()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
if ( /*IsInSwitching && */ pDrViewSh->IsSwitchPageAllowed() )
|
|
|
|
{
|
|
|
|
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
|
|
|
|
pDispatcher->Execute(SID_SWITCHPAGE,
|
|
|
|
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
long TabControl::DeactivatePage()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
return pDrViewSh->IsSwitchPageAllowed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::SendActivatePageEvent (void)
|
2002-10-25 08:17:40 -05:00
|
|
|
{
|
|
|
|
CallEventListeners (VCLEVENT_TABBAR_PAGEACTIVATED,
|
|
|
|
reinterpret_cast<void*>(GetCurPageId()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2002-10-25 08:17:40 -05:00
|
|
|
|
2004-01-20 05:56:06 -06:00
|
|
|
void TabControl::SendDeactivatePageEvent (void)
|
2002-10-25 08:17:40 -05:00
|
|
|
{
|
|
|
|
CallEventListeners (VCLEVENT_TABBAR_PAGEDEACTIVATED,
|
|
|
|
reinterpret_cast<void*>(GetCurPageId()));
|
|
|
|
}
|
2004-01-20 05:56:06 -06:00
|
|
|
|
|
|
|
} // end of namespace sd
|