Files
libreoffice/sd/source/ui/view/drviews1.cxx

1466 lines
46 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* $RCSfile: drviews1.cxx,v $
2000-09-18 16:07:07 +00:00
*
* $Revision: 1.75 $
2000-09-18 16:07:07 +00:00
*
* last change: $Author: rt $ $Date: 2007-04-03 16:29:15 $
2000-09-18 16:07:07 +00: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 16:07:07 +00: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 16:07:07 +00: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 16:07:07 +00: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 16:07:07 +00: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 16:07:07 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
#include "DrawViewShell.hxx"
#include "ViewShellImplementation.hxx"
#include "DrawController.hxx"
#ifndef _COM_SUN_STAR_EMBED_EMBEDSTATES_HPP_
#include <com/sun/star/embed/EmbedStates.hpp>
#endif
#include "comphelper/anytostring.hxx"
#include "cppuhelper/exc_hlp.hxx"
#include "rtl/ref.hxx"
2000-09-18 16:07:07 +00:00
#ifndef _SVXIDS_HRC
#include <svx/svxids.hrc>
#endif
#ifndef _SVDPAGV_HXX //autogen
#include <svx/svdpagv.hxx>
#endif
#ifndef _SFXVIEWFRM_HXX //autogen
#include <sfx2/viewfrm.hxx>
#endif
#ifndef _SFX_BINDINGS_HXX //autogen
#include <sfx2/bindings.hxx>
#endif
#ifndef _SVDOOLE2_HXX //autogen
#include <svx/svdoole2.hxx>
#endif
#ifndef _SFXDISPATCH_HXX //autogen
#include <sfx2/dispatch.hxx>
#endif
#ifndef _SV_SCRBAR_HXX //autogen
#include <vcl/scrbar.hxx>
#endif
#ifndef _SVDOGRAF_HXX //autogen
#include <svx/svdograf.hxx>
#endif
#ifndef _SVDOPAGE_HXX
#include <svx/svdopage.hxx>
#endif
2000-09-18 16:07:07 +00:00
#ifndef _SV_MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
#include <sot/storage.hxx>
2000-09-18 16:07:07 +00:00
#ifndef _SVX_FMSHELL_HXX //autogen
#include <svx/fmshell.hxx>
#endif
#ifndef _E3D_GLOBL3D_HXX
#include <svx/globl3d.hxx>
#endif
#ifndef _SVX_FMGLOB_HXX
#include <svx/fmglob.hxx>
#endif
#ifndef _OUTLINER_HXX //autogen
#include <svx/outliner.hxx>
#endif
#include "misc.hxx"
#ifdef STARIMAGE_AVAILABLE
#ifndef _SIMDLL_HXX
#include <sim2/simdll.hxx>
#endif
#endif
#include <svx/dialogs.hrc>
2000-09-18 16:07:07 +00:00
#include "glob.hrc"
#include "app.hrc"
#include "res_bmp.hrc"
#include "strings.hrc"
#include "helpids.h"
#include "app.hxx"
#ifndef SD_FU_POOR_HXX
2000-09-18 16:07:07 +00:00
#include "fupoor.hxx"
#endif
2000-09-18 16:07:07 +00:00
#include "sdresid.hxx"
#ifndef SD_FU_SELECTION_HXX
2000-09-18 16:07:07 +00:00
#include "fusel.hxx"
#endif
2000-09-18 16:07:07 +00:00
#include "sdpage.hxx"
#ifndef SD_FRAME_VIEW_HXX
#include "FrameView.hxx"
#endif
2000-09-18 16:07:07 +00:00
#include "stlpool.hxx"
#ifndef SD_WINDOW_HXX
#include "Window.hxx"
#endif
#ifndef SD_DRAWVIEW_HXX
2000-09-18 16:07:07 +00:00
#include "drawview.hxx"
#endif
2000-09-18 16:07:07 +00:00
#include "drawdoc.hxx"
#include "DrawDocShell.hxx"
#include "Ruler.hxx"
#ifndef SD_CLIENT_HXX
#include "Client.hxx"
#endif
#ifndef _SD_SLIDESHOW_HXX
#include "slideshow.hxx"
#endif
2000-09-18 16:07:07 +00:00
#include "optsitem.hxx"
#ifndef SD_FU_SEARCH_HXX
2000-09-18 16:07:07 +00:00
#include "fusearch.hxx"
#endif
#ifndef SD_FU_SPELL_HXX
2000-09-18 16:07:07 +00:00
#include "fuspell.hxx"
#endif
#ifndef SD_OUTLINER_HXX
#include "Outliner.hxx"
#endif
#ifndef SD_ANIMATION_CHILD_WINDOW_HXX
#include "AnimationChildWindow.hxx"
#endif
2002-01-24 14:06:27 +00:00
#include "SdUnoDrawView.hxx"
#ifndef SD_TOOL_BAR_MANAGER_HXX
#include "ToolBarManager.hxx"
#endif
#include "FormShellManager.hxx"
#ifndef SD_VIEW_SHELL_BASE_HXX
#include "ViewShellBase.hxx"
#endif
#ifndef SD_LAYER_DIALOG_CHILD_WINDOW_HXX
#include "LayerDialogChildWindow.hxx"
#endif
#include "LayerTabBar.hxx"
#include "ViewShellManager.hxx"
#include "ViewShellHint.hxx"
2000-09-18 16:07:07 +00:00
#include <sfx2/request.hxx>
#include <boost/bind.hpp>
2000-09-18 16:07:07 +00:00
#ifdef WNT
#pragma optimize ( "", off )
#endif
using namespace com::sun::star;
namespace sd {
void DrawViewShell::Activate(BOOL bIsMDIActivate)
2000-09-18 16:07:07 +00:00
{
ViewShell::Activate(bIsMDIActivate);
}
void DrawViewShell::UIActivating( SfxInPlaceClient* pCli )
{
ViewShell::UIActivating(pCli);
// #94252# Disable own controls
maTabControl.Disable();
if (GetLayerTabControl() != NULL)
GetLayerTabControl()->Disable();
}
void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
{
// #94252# Enable own controls
maTabControl.Enable();
if (GetLayerTabControl() != NULL)
GetLayerTabControl()->Enable();
ViewShell::UIDeactivated(pCli);
2000-09-18 16:07:07 +00:00
}
2000-09-18 16:07:07 +00:00
/*************************************************************************
|*
|* Deactivate()
|*
\************************************************************************/
void DrawViewShell::Deactivate(BOOL bIsMDIActivate)
2000-09-18 16:07:07 +00:00
{
ViewShell::Deactivate(bIsMDIActivate);
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* Wird gerufen, wenn sich der Selektionszustand der View aendert
|*
\************************************************************************/
void DrawViewShell::SelectionHasChanged (void)
2000-09-18 16:07:07 +00:00
{
// Um die Performance zu steigern wird jetzt die komplette
// Shell invalidiert statt alle Slots einzeln
Invalidate();
//Update3DWindow(); // 3D-Controller
SfxBoolItem aItem( SID_3D_STATE, TRUE );
GetViewFrame()->GetDispatcher()->Execute(
SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2000-09-18 16:07:07 +00:00
SdrOle2Obj* pOleObj = NULL;
SdrGrafObj* pGrafObj = NULL;
if ( mpDrawView->AreObjectsMarked() )
2000-09-18 16:07:07 +00:00
{
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
2000-09-18 16:07:07 +00:00
if (rMarkList.GetMarkCount() == 1)
{
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObj = pMark->GetMarkedSdrObj();
2000-09-18 16:07:07 +00:00
UINT32 nInv = pObj->GetObjInventor();
UINT16 nSdrObjKind = pObj->GetObjIdentifier();
if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
2000-09-18 16:07:07 +00:00
{
pOleObj = (SdrOle2Obj*) pObj;
UpdateIMapDlg( pObj );
}
else if (nSdrObjKind == OBJ_GRAF)
{
pGrafObj = (SdrGrafObj*) pObj;
UpdateIMapDlg( pObj );
}
}
}
ViewShellBase& rBase = GetViewShellBase();
rBase.SetVerbs(0);
2000-09-18 16:07:07 +00:00
try
2000-09-18 16:07:07 +00:00
{
Client* pIPClient = static_cast<Client*>(rBase.GetIPClient());
if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
2000-09-18 16:07:07 +00:00
{
/**********************************************************************
* Ggf. OLE-Objekt beruecksichtigen und deaktivieren
**********************************************************************/
// this means we recently deselected an inplace active ole object so
// we need to deselect it now
if (!pOleObj)
2000-09-18 16:07:07 +00:00
{
pIPClient->DeactivateObject();
//HMHmpDrView->ShowMarkHdl();
2000-09-18 16:07:07 +00:00
}
else
{
uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef();
if ( xObj.is() )
{
rBase.SetVerbs( xObj->getSupportedVerbs() );
}
else
{
rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
}
2000-09-18 16:07:07 +00:00
}
}
else
2000-09-18 16:07:07 +00:00
{
if ( pOleObj )
2000-09-18 16:07:07 +00:00
{
uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef();
if ( xObj.is() )
{
rBase.SetVerbs( xObj->getSupportedVerbs() );
}
else
{
rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
}
2000-09-18 16:07:07 +00:00
}
else
{
rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
2000-09-18 16:07:07 +00:00
}
}
}
catch( ::com::sun::star::uno::Exception& e )
{
(void)e;
DBG_ERROR(
(rtl::OString("sd::DrawViewShell::SelectionHasChanged(), "
"exception caught: ") +
rtl::OUStringToOString(
comphelper::anyToString( cppu::getCaughtException() ),
RTL_TEXTENCODING_UTF8 )).getStr() );
2000-09-18 16:07:07 +00:00
}
if( HasCurrentFunction() )
2000-09-18 16:07:07 +00:00
{
GetCurrentFunction()->SelectionHasChanged();
2000-09-18 16:07:07 +00:00
}
else
{
GetViewShellBase().GetToolBarManager().SelectionHasChanged(*this,*mpDrawView);
2000-09-18 16:07:07 +00:00
}
// #96124# Invalidate for every subshell
GetViewShellBase().GetViewShellManager().InvalidateAllSubShells(this);
2000-09-18 16:07:07 +00:00
mpDrawView->UpdateSelectionClipboard( FALSE );
2002-01-24 14:06:27 +00:00
GetViewShellBase().GetDrawController().FireSelectionChangeListener();
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* Zoomfaktor setzen
|*
\************************************************************************/
void DrawViewShell::SetZoom( long nZoom )
2000-09-18 16:07:07 +00:00
{
// Make sure that the zoom factor will not be recalculated on
// following window resizings.
mbZoomOnPage = FALSE;
ViewShell::SetZoom( nZoom );
GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* Zoomrechteck fuer aktives Fenster einstellen
|*
\************************************************************************/
void DrawViewShell::SetZoomRect( const Rectangle& rZoomRect )
2000-09-18 16:07:07 +00:00
{
ViewShell::SetZoomRect( rZoomRect );
GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* PrepareClose, ggfs. Texteingabe beenden, damit andere Viewshells ein
|* aktualisiertes Textobjekt vorfinden
|*
\************************************************************************/
USHORT DrawViewShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
2000-09-18 16:07:07 +00:00
{
if ( ViewShell::PrepareClose(bUI, bForBrowsing) != TRUE )
2000-09-18 16:07:07 +00:00
return FALSE;
BOOL bRet = TRUE;
if( bRet && HasCurrentFunction() )
2000-09-18 16:07:07 +00:00
{
USHORT nID = GetCurrentFunction()->GetSlotID();
2000-09-18 16:07:07 +00:00
if (nID == SID_TEXTEDIT || nID == SID_ATTR_CHAR)
{
mpDrawView->SdrEndTextEdit();
2000-09-18 16:07:07 +00:00
}
}
else if( !bRet )
{
maCloseTimer.SetTimeoutHdl( LINK( this, DrawViewShell, CloseHdl ) );
maCloseTimer.SetTimeout( 20 );
maCloseTimer.Start();
2000-09-18 16:07:07 +00:00
}
return bRet;
}
/*************************************************************************
|*
|* Status (Enabled/Disabled) von Menue-SfxSlots setzen
|*
\************************************************************************/
void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
2000-09-18 16:07:07 +00:00
{
if (meEditMode != eEMode || mbIsLayerModeActive != bIsLayerModeActive)
2000-09-18 16:07:07 +00:00
{
ViewShellManager::UpdateLock aLock (GetViewShellBase().GetViewShellManager());
USHORT nActualPageNum = 0;
GetViewShellBase().GetDrawController().FireChangeEditMode (eEMode == EM_MASTERPAGE);
GetViewShellBase().GetDrawController().FireChangeLayerMode (bIsLayerModeActive);
2002-01-24 14:06:27 +00:00
if ( mpDrawView->IsTextEdit() )
2000-09-18 16:07:07 +00:00
{
mpDrawView->SdrEndTextEdit();
2000-09-18 16:07:07 +00:00
}
LayerTabBar* pLayerBar = GetLayerTabControl();
if (pLayerBar != NULL)
pLayerBar->EndEditMode();
maTabControl.EndEditMode();
2000-09-18 16:07:07 +00:00
if (mePageKind == PK_HANDOUT)
2000-09-18 16:07:07 +00:00
{
// Bei Handzetteln nur MasterPage zulassen
eEMode = EM_MASTERPAGE;
}
meEditMode = eEMode;
mbIsLayerModeActive = bIsLayerModeActive;
2000-09-18 16:07:07 +00:00
// Determine whether to show the master view toolbar. The master
// page mode has to be active and the shell must not be a handout
// view.
bool bShowMasterViewToolbar (meEditMode == EM_MASTERPAGE
&& GetShellType() != ViewShell::ST_HANDOUT);
// If the master view toolbar is not shown we hide it before
// switching the edit mode.
if (mpImpl->mbIsInitialized
&& IsMainViewShell()
&& ! bShowMasterViewToolbar)
2000-09-18 16:07:07 +00:00
{
GetViewShellBase().GetToolBarManager().ResetToolBars(ToolBarManager::TBG_MASTER_MODE);
}
if (meEditMode == EM_PAGE)
{
2000-09-18 16:07:07 +00:00
/******************************************************************
* PAGEMODE
******************************************************************/
maTabControl.Clear();
2000-09-18 16:07:07 +00:00
SdPage* pPage;
String aPageName;
USHORT nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
2000-09-18 16:07:07 +00:00
for (USHORT i = 0; i < nPageCnt; i++)
{
pPage = GetDoc()->GetSdPage(i, mePageKind);
2000-09-18 16:07:07 +00:00
aPageName = pPage->GetName();
maTabControl.InsertPage(i + 1, aPageName);
2000-09-18 16:07:07 +00:00
if ( pPage->IsSelected() && nActualPageNum == 0 )
{
nActualPageNum = i;
}
}
maTabControl.SetCurPageId(nActualPageNum + 1);
2000-09-18 16:07:07 +00:00
SwitchPage(nActualPageNum);
}
else
{
/******************************************************************
* MASTERPAGE
******************************************************************/
GetViewFrame()->SetChildWindow(
AnimationChildWindow::GetChildWindowId(), FALSE );
2000-09-18 16:07:07 +00:00
if (!mpActualPage)
2000-09-18 16:07:07 +00:00
{
// Sofern es keine mpActualPage gibt, wird die erste genommen
mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
2000-09-18 16:07:07 +00:00
}
maTabControl.Clear();
2000-09-18 16:07:07 +00:00
USHORT nActualMasterPageNum = 0;
USHORT nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
2000-09-18 16:07:07 +00:00
for (USHORT i = 0; i < nMasterPageCnt; i++)
{
SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind);
2000-09-18 16:07:07 +00:00
String aLayoutName(pMaster->GetLayoutName());
aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
maTabControl.InsertPage(i + 1, aLayoutName);
2000-09-18 16:07:07 +00:00
if (&(mpActualPage->TRG_GetMasterPage()) == pMaster)
2000-09-18 16:07:07 +00:00
{
nActualMasterPageNum = i;
}
}
maTabControl.SetCurPageId(nActualMasterPageNum + 1);
2000-09-18 16:07:07 +00:00
SwitchPage(nActualMasterPageNum);
}
// If the master view toolbar is to be shown we turn it on after the
// edit mode has been changed.
if (mpImpl->mbIsInitialized
&& IsMainViewShell()
&& bShowMasterViewToolbar)
{
GetViewShellBase().GetToolBarManager().SetToolBar(
ToolBarManager::TBG_MASTER_MODE,
ToolBarManager::msMasterViewToolBar);
2000-09-18 16:07:07 +00:00
}
if ( ! mbIsLayerModeActive)
2000-09-18 16:07:07 +00:00
{
maTabControl.Show();
// Set the tab control only for draw pages. For master page
// this has been done already above.
if (meEditMode == EM_PAGE)
maTabControl.SetCurPageId (nActualPageNum + 1);
2000-09-18 16:07:07 +00:00
}
/*AF: The LayerDialogChildWindow is not used anymore (I hope).
if (GetViewFrame()->KnowsChildWindow(
LayerDialogChildWindow::GetChildWindowId()))
{
GetViewFrame()->SetChildWindow(
LayerDialogChildWindow::GetChildWindowId(),
IsLayerModeActive());
}
*/
2000-09-18 16:07:07 +00:00
ResetActualLayer();
Invalidate( SID_PAGEMODE );
Invalidate( SID_LAYERMODE );
Invalidate( SID_MASTERPAGE );
Invalidate( SID_SLIDE_MASTERPAGE );
Invalidate( SID_TITLE_MASTERPAGE );
Invalidate( SID_NOTES_MASTERPAGE );
Invalidate( SID_HANDOUT_MASTERPAGE );
}
}
bool DrawViewShell::IsLayerModeActive (void) const
{
return mbIsLayerModeActive;
}
2000-09-18 16:07:07 +00:00
/*************************************************************************
|*
|* Groesse des TabControls und der ModeButtons zurueckgeben
|*
\************************************************************************/
long DrawViewShell::GetHCtrlWidth()
2000-09-18 16:07:07 +00:00
{
// return maTabControl.GetSizePixel().Width();
return 0;
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* Horizontales Lineal erzeugen
|*
\************************************************************************/
SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin, BOOL bIsFirst)
2000-09-18 16:07:07 +00:00
{
Ruler* pRuler;
2000-09-18 16:07:07 +00:00
WinBits aWBits;
USHORT nFlags = SVXRULER_SUPPORT_OBJECT;
if ( bIsFirst )
{
aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER | WB_EXTRAFIELD;
nFlags |= ( SVXRULER_SUPPORT_SET_NULLOFFSET |
SVXRULER_SUPPORT_TABS |
SVXRULER_SUPPORT_PARAGRAPH_MARGINS ); // Neu
}
else
aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER;
pRuler = new Ruler (*this, GetParentWindow(), pWin, nFlags,
GetViewFrame()->GetBindings(), aWBits);
2000-09-18 16:07:07 +00:00
pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit());
// Metric ...
UINT16 nMetric = (UINT16)GetDoc()->GetUIUnit();
2000-09-18 16:07:07 +00:00
if( nMetric == 0xffff )
nMetric = (UINT16)GetModuleFieldUnit();
2000-09-18 16:07:07 +00:00
pRuler->SetUnit( FieldUnit( nMetric ) );
// ... und auch DefTab am Lineal einstellen
pRuler->SetDefTabDist( GetDoc()->GetDefaultTabulator() ); // Neu
2000-09-18 16:07:07 +00:00
Fraction aUIScale(pWin->GetMapMode().GetScaleX());
aUIScale *= GetDoc()->GetUIScale();
2000-09-18 16:07:07 +00:00
pRuler->SetZoom(aUIScale);
return pRuler;
}
/*************************************************************************
|*
|* Vertikales Lineal erzeugen
|*
\************************************************************************/
SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin)
2000-09-18 16:07:07 +00:00
{
Ruler* pRuler;
2000-09-18 16:07:07 +00:00
WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER;
USHORT nFlags = SVXRULER_SUPPORT_OBJECT;
pRuler = new Ruler(*this, GetParentWindow(), pWin, nFlags,
GetViewFrame()->GetBindings(), aWBits);
2000-09-18 16:07:07 +00:00
pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit());
2002-01-17 12:09:43 +00:00
// #96629# Metric same as HRuler, use document setting
UINT16 nMetric = (UINT16)GetDoc()->GetUIUnit();
2000-09-18 16:07:07 +00:00
if( nMetric == 0xffff )
nMetric = (UINT16)GetModuleFieldUnit();
2000-09-18 16:07:07 +00:00
pRuler->SetUnit( FieldUnit( nMetric ) );
Fraction aUIScale(pWin->GetMapMode().GetScaleY());
aUIScale *= GetDoc()->GetUIScale();
2000-09-18 16:07:07 +00:00
pRuler->SetZoom(aUIScale);
return pRuler;
}
/*************************************************************************
|*
|* Horizontales Lineal aktualisieren
|*
\************************************************************************/
void DrawViewShell::UpdateHRuler()
2000-09-18 16:07:07 +00:00
{
Invalidate( SID_ATTR_LONG_LRSPACE );
Invalidate( SID_RULER_PAGE_POS );
2001-09-18 13:59:01 +00:00
Invalidate( SID_RULER_OBJECT );
2002-09-27 11:41:31 +00:00
Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
2000-09-18 16:07:07 +00:00
if (mpHorizontalRuler.get() != NULL)
mpHorizontalRuler->ForceUpdate();
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* Vertikales Lineal aktualisieren
|*
\************************************************************************/
void DrawViewShell::UpdateVRuler()
2000-09-18 16:07:07 +00:00
{
Invalidate( SID_ATTR_LONG_LRSPACE );
Invalidate( SID_RULER_PAGE_POS );
2001-09-18 13:59:01 +00:00
Invalidate( SID_RULER_OBJECT );
2000-09-18 16:07:07 +00:00
if (mpVerticalRuler.get() != NULL)
mpVerticalRuler->ForceUpdate();
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* Metrik setzen
|*
\************************************************************************/
void DrawViewShell::SetUIUnit(FieldUnit eUnit)
2000-09-18 16:07:07 +00:00
{
ViewShell::SetUIUnit(eUnit);
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* TabControl nach Splitteraenderung aktualisieren
|*
\************************************************************************/
IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab )
2000-09-18 16:07:07 +00:00
{
const long int nMax = maViewSize.Width() - maScrBarWH.Width()
- maTabControl.GetPosPixel().X() ;
2000-09-18 16:07:07 +00:00
Size aTabSize = maTabControl.GetSizePixel();
2000-09-18 16:07:07 +00:00
aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1));
maTabControl.SetSizePixel(aTabSize);
GetLayerTabControl()->SetSizePixel(aTabSize);
2000-09-18 16:07:07 +00:00
Point aPos = maTabControl.GetPosPixel();
2000-09-18 16:07:07 +00:00
aPos.X() += aTabSize.Width();
Size aScrSize(nMax - aTabSize.Width(), maScrBarWH.Height());
mpHorizontalScrollBar->SetPosSizePixel(aPos, aScrSize);
2000-09-18 16:07:07 +00:00
return 0;
}
/// inherited from sd::ViewShell
SdPage* DrawViewShell::getCurrentPage() const
{
const sal_Int32 nPageCount = (meEditMode == EM_PAGE)?
GetDoc()->GetSdPageCount(mePageKind):
GetDoc()->GetMasterSdPageCount(mePageKind);
sal_Int32 nCurrentPage = maTabControl.GetCurPageId() - 1;
DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" );
if( (nPageCount < 0) || (nCurrentPage>=nPageCount) )
nCurrentPage = 0; // play safe here
if (meEditMode == EM_PAGE)
{
return GetDoc()->GetSdPage((USHORT)nCurrentPage, mePageKind);
}
else // EM_MASTERPAGE
{
return GetDoc()->GetMasterSdPage((USHORT)nCurrentPage, mePageKind);
}
}
2000-09-18 16:07:07 +00:00
/*************************************************************************
|*
|* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert
|* hat (z. B. durch Undo)
|*
\************************************************************************/
void DrawViewShell::ResetActualPage()
2000-09-18 16:07:07 +00:00
{
USHORT nCurrentPage = maTabControl.GetCurPageId() - 1;
USHORT nPageCount = (meEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind);
2000-09-18 16:07:07 +00:00
if (nPageCount > 0)
nCurrentPage = Min((USHORT)(nPageCount - 1), nCurrentPage);
else
nCurrentPage = 0;
if (meEditMode == EM_PAGE)
2000-09-18 16:07:07 +00:00
{
// Update fuer TabControl
maTabControl.Clear();
2000-09-18 16:07:07 +00:00
SdPage* pPage = NULL;
String aPageName;
for (USHORT i = 0; i < nPageCount; i++)
{
pPage = GetDoc()->GetSdPage(i, mePageKind);
2000-09-18 16:07:07 +00:00
aPageName = pPage->GetName();
maTabControl.InsertPage(i + 1, aPageName);
2000-09-18 16:07:07 +00:00
// Selektionskennungen der Seiten korrigieren
GetDoc()->SetSelected(pPage, i == nCurrentPage);
2000-09-18 16:07:07 +00:00
}
maTabControl.SetCurPageId(nCurrentPage + 1);
2000-09-18 16:07:07 +00:00
}
else // EM_MASTERPAGE
{
SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind);
maTabControl.Clear();
2000-09-18 16:07:07 +00:00
USHORT nActualMasterPageNum = 0;
USHORT nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
2000-09-18 16:07:07 +00:00
for (USHORT i = 0; i < nMasterPageCnt; i++)
{
SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind);
2000-09-18 16:07:07 +00:00
String aLayoutName(pMaster->GetLayoutName());
aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
maTabControl.InsertPage(i + 1, aLayoutName);
2000-09-18 16:07:07 +00:00
if (pActualPage == pMaster)
nActualMasterPageNum = i;
}
maTabControl.SetCurPageId(nActualMasterPageNum + 1);
2000-09-18 16:07:07 +00:00
SwitchPage(nActualMasterPageNum);
}
GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHPAGE,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
}
/*************************************************************************
|*
|* Verb auf OLE-Objekt anwenden
|*
\************************************************************************/
ErrCode DrawViewShell::DoVerb(long nVerb)
2000-09-18 16:07:07 +00:00
{
if ( mpDrawView->AreObjectsMarked() )
2000-09-18 16:07:07 +00:00
{
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
2000-09-18 16:07:07 +00:00
if (rMarkList.GetMarkCount() == 1)
{
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObj = pMark->GetMarkedSdrObj();
2000-09-18 16:07:07 +00:00
UINT32 nInv = pObj->GetObjInventor();
UINT16 nSdrObjKind = pObj->GetObjIdentifier();
if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
2000-09-18 16:07:07 +00:00
{
ActivateObject( (SdrOle2Obj*) pObj, nVerb);
}
#ifdef STARIMAGE_AVAILABLE
else if (nInv = SdrInventor && nSdrObjKind == OBJ_GRAF &&
((SdrGrafObj*) pObj)->GetGraphicType() == GRAPHIC_BITMAP &&
SFX_APP()->HasFeature(SFX_FEATURE_SIMAGE))
{
SdrGrafObj* pSdrGrafObj = (SdrGrafObj*) pObj;
short nOK = RET_YES;
if ( pSdrGrafObj->GetFileName().Len() )
{
// Graphik ist gelinkt, soll der Link aufgehoben werden?
QueryBox aBox(pWindow, WB_YES_NO | WB_DEF_YES,
String( SdResId(STR_REMOVE_LINK) ) );
nOK = aBox.Execute();
if (nOK == RET_YES)
{
// Link aufheben (File- und Filtername zuruecksetzen)
pSdrGrafObj->SetGraphicLink(String(), String());
}
}
if (nOK == RET_YES)
{
/**************************************************************
* OLE-Objekt erzeugen, StarImage starten
* Grafik-Objekt loeschen (durch OLE-Objekt ersetzt)
**************************************************************/
//HMHmpDrView->HideMarkHdl();
2000-09-18 16:07:07 +00:00
SvStorageRef aStor = new SvStorage(String());
SvInPlaceObjectRef aNewIPObj = &((SvFactory*)SvInPlaceObject::ClassFactory())
->CreateAndInit(SimModuleDummy::GetID(SOFFICE_FILEFORMAT_CURRENT), aStor);
2000-09-18 16:07:07 +00:00
if ( aNewIPObj.Is() )
{
SdrGrafObj* pTempSdrGrafObj = (SdrGrafObj*) pSdrGrafObj->Clone ();
SvEmbeddedInfoObject * pInfo;
pInfo = GetViewFrame()->GetObjectShell()->
InsertObject( aNewIPObj, String() );
String aName;
if (pInfo)
{
aName = pInfo->GetObjName();
}
Rectangle aRect = pObj->GetLogicRect();
SdrOle2Obj* pSdrOle2Obj = new SdrOle2Obj( aNewIPObj,
aName, aRect );
SdrPageView* pPV = mpDrawView->GetSdrPageView();
2000-09-18 16:07:07 +00:00
pPV->GetObjList()->InsertObject( pSdrOle2Obj );
mpDrawView->ReplaceObjectAtView( pObj, *pPV, pTempSdrGrafObj );
2000-09-18 16:07:07 +00:00
pSdrOle2Obj->SetLogicRect(aRect);
aNewIPObj->SetVisAreaSize(aRect.GetSize());
SimDLL::Update(aNewIPObj, pTempSdrGrafObj->GetGraphic(), pWindow);
ActivateObject(pSdrOle2Obj, SVVERB_SHOW);
Client* pClient = (Client*) GetIPClient();
2000-09-18 16:07:07 +00:00
if (pClient)
pClient->SetSdrGrafObj( pTempSdrGrafObj );
}
}
}
#endif
}
}
return 0;
}
/*************************************************************************
|*
|* OLE-Object aktivieren
|*
\************************************************************************/
BOOL DrawViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
2000-09-18 16:07:07 +00:00
{
BOOL bActivated = FALSE;
if ( !GetDocSh()->IsUIActive() )
2000-09-18 16:07:07 +00:00
{
ToolBarManager::UpdateLock aLock (GetViewShellBase().GetToolBarManager());
bActivated = ViewShell::ActivateObject(pObj, nVerb);
2000-09-18 16:07:07 +00:00
OSL_ASSERT(GetViewShell()!=NULL);
Client* pClient = static_cast<Client*>(GetViewShell()->GetIPClient());
2000-09-18 16:07:07 +00:00
if (pClient)
pClient->SetSdrGrafObj(NULL);
}
return(bActivated);
}
/*************************************************************************
|*
|* Auf gewuenschte Seite schalten
|* Der Parameter nSelectedPage bezieht sich auf den aktuellen EditMode
|*
\************************************************************************/
BOOL DrawViewShell::SwitchPage(USHORT nSelectedPage)
2000-09-18 16:07:07 +00:00
{
if (GetActiveWindow()->IsInPaint())
{
// Switching the current page while a Paint is being executed is
// dangerous. So, post it for later execution and return.
maAsynchronousSwitchPageCall.Post(::boost::bind(
::std::mem_fun(&DrawViewShell::SwitchPage),
this,
nSelectedPage));
return FALSE;
}
2000-09-18 16:07:07 +00:00
BOOL bOK = FALSE;
// With the current implementation of FuSlideShow there is a problem
// when it dsplays the show in a window: When the show is stopped it
// returns at one point in time SDRPAGE_NOTFOUND as current page index.
// Because FuSlideShow is currently being rewritten this bug is fixed
// here.
// This is not as bad a hack as it may look because making SwitchPage()
// more robust with respect to invalid page numbers is a good thing
// anyway.
if (nSelectedPage == SDRPAGE_NOTFOUND)
{
nSelectedPage = 0;
}
else
{
// Make sure that the given page index points to an existing page. Move
// the index into the valid range if necessary.
USHORT nPageCount = (meEditMode == EM_PAGE)
? GetDoc()->GetSdPageCount(mePageKind)
: GetDoc()->GetMasterSdPageCount(mePageKind);
if (nSelectedPage >= nPageCount)
nSelectedPage = nPageCount-1;
}
2000-09-18 16:07:07 +00:00
if (IsSwitchPageAllowed())
{
ModifyGuard aGuard( GetDoc() );
2000-09-18 16:07:07 +00:00
bOK = TRUE;
2000-09-18 16:07:07 +00:00
if (mpActualPage)
2000-09-18 16:07:07 +00:00
{
SdPage* pNewPage = NULL;
2000-09-18 16:07:07 +00:00
if (meEditMode == EM_MASTERPAGE)
2000-09-18 16:07:07 +00:00
{
if( GetDoc()->GetMasterSdPageCount(mePageKind) > nSelectedPage )
pNewPage = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
if( pNewPage )
2000-09-18 16:07:07 +00:00
{
SdrPageView* pPV = mpDrawView->GetSdrPageView();
2000-09-18 16:07:07 +00:00
String sPageText (pNewPage->GetLayoutName());
sPageText.Erase(sPageText.SearchAscii(SD_LT_SEPARATOR));
if (pPV
&& pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() )
&& sPageText == maTabControl.GetPageText(nSelectedPage+1))
{
// this slide is already visible
return TRUE;
}
}
}
else
{
if (GetDoc()->GetSdPageCount(mePageKind) > nSelectedPage)
pNewPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind);
2000-09-18 16:07:07 +00:00
if (mpActualPage == pNewPage)
2000-09-18 16:07:07 +00:00
{
SdrPageView* pPV = mpDrawView->GetSdrPageView();
if (pPV && pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() ) &&
pNewPage->GetName() == maTabControl.GetPageText(nSelectedPage+1))
{
// this slide is already visible
return TRUE;
}
2000-09-18 16:07:07 +00:00
}
}
}
if( mpDrawView )
mpDrawView->SdrEndTextEdit();
mpActualPage = NULL;
2000-09-18 16:07:07 +00:00
if (meEditMode == EM_PAGE)
2000-09-18 16:07:07 +00:00
{
mpActualPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind);
2000-09-18 16:07:07 +00:00
}
else
{
SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
2000-09-18 16:07:07 +00:00
// Passt die selektierte Seite zur MasterPage?
USHORT nPageCount = GetDoc()->GetSdPageCount(mePageKind);
2000-09-18 16:07:07 +00:00
for (USHORT i = 0; i < nPageCount; i++)
{
SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
if(pPage && pPage->IsSelected() && pMaster == &(pPage->TRG_GetMasterPage()))
2000-09-18 16:07:07 +00:00
{
mpActualPage = pPage;
2000-09-18 16:07:07 +00:00
break;
}
}
if (!mpActualPage)
2000-09-18 16:07:07 +00:00
{
// Die erste Seite nehmen, welche zur MasterPage passt
for (USHORT i = 0; i < nPageCount; i++)
{
SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
if(pPage && pMaster == &(pPage->TRG_GetMasterPage()))
2000-09-18 16:07:07 +00:00
{
mpActualPage = pPage;
2000-09-18 16:07:07 +00:00
break;
}
}
}
}
for (USHORT i = 0; i < GetDoc()->GetSdPageCount(mePageKind); i++)
2000-09-18 16:07:07 +00:00
{
// Alle Seiten deselektieren
GetDoc()->SetSelected( GetDoc()->GetSdPage(i, mePageKind), FALSE);
2000-09-18 16:07:07 +00:00
}
if (!mpActualPage)
2000-09-18 16:07:07 +00:00
{
// Sofern es keine mpActualPage gibt, wird die erste genommen
mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
2000-09-18 16:07:07 +00:00
}
// diese Seite auch selektieren (mpActualPage zeigt immer auf Zeichenseite,
2000-09-18 16:07:07 +00:00
// nie auf eine Masterpage)
GetDoc()->SetSelected(mpActualPage, TRUE);
2000-09-18 16:07:07 +00:00
if( !mpSlideShow || ( mpSlideShow->getAnimationMode() != ANIMATIONMODE_SHOW ) )
{
// VisArea zuziehen, um ggf. Objekte zu deaktivieren
// !!! only if we are not in presentation mode (#96279) !!!
OSL_ASSERT (GetViewShell()!=NULL);
GetViewShell()->DisconnectAllClients();
VisAreaChanged(Rectangle(Point(), Size(1, 1)));
}
2000-09-18 16:07:07 +00:00
if (meEditMode == EM_PAGE)
2000-09-18 16:07:07 +00:00
{
/**********************************************************************
* PAGEMODE
**********************************************************************/
GetDoc()->SetSelected(mpActualPage, TRUE);
2000-09-18 16:07:07 +00:00
SdrPageView* pPageView = mpDrawView->GetSdrPageView();
2000-09-18 16:07:07 +00:00
if (pPageView)
{
mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
2000-09-18 16:07:07 +00:00
if (mePageKind == PK_NOTES)
2000-09-18 16:07:07 +00:00
{
mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
2000-09-18 16:07:07 +00:00
}
else if (mePageKind == PK_HANDOUT)
2000-09-18 16:07:07 +00:00
{
mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
2000-09-18 16:07:07 +00:00
}
else
{
mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
2000-09-18 16:07:07 +00:00
}
}
mpDrawView->HideSdrPage();
mpDrawView->ShowSdrPage(mpActualPage);
GetViewShellBase().GetDrawController().FireSwitchCurrentPage(mpActualPage);
2000-09-18 16:07:07 +00:00
SdrPageView* pNewPageView = mpDrawView->GetSdrPageView();
2000-09-18 16:07:07 +00:00
if (pNewPageView)
{
pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() );
pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() );
pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() );
2000-09-18 16:07:07 +00:00
if (mePageKind == PK_NOTES)
2000-09-18 16:07:07 +00:00
{
pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() );
2000-09-18 16:07:07 +00:00
}
else if (mePageKind == PK_HANDOUT)
2000-09-18 16:07:07 +00:00
{
pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() );
2000-09-18 16:07:07 +00:00
}
else
{
pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() );
2000-09-18 16:07:07 +00:00
}
}
maTabControl.SetCurPageId(nSelectedPage+1);
String aPageName = mpActualPage->GetName();
2000-09-18 16:07:07 +00:00
if (maTabControl.GetPageText(nSelectedPage+1) != aPageName)
2000-09-18 16:07:07 +00:00
{
maTabControl.SetPageText(nSelectedPage+1, aPageName);
2000-09-18 16:07:07 +00:00
}
}
else
{
/**********************************************************************
* MASTERPAGE
**********************************************************************/
SdrPageView* pPageView = mpDrawView->GetSdrPageView();
2000-09-18 16:07:07 +00:00
if (pPageView)
{
mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
2000-09-18 16:07:07 +00:00
if (mePageKind == PK_NOTES)
2000-09-18 16:07:07 +00:00
{
mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
2000-09-18 16:07:07 +00:00
}
else if (mePageKind == PK_HANDOUT)
2000-09-18 16:07:07 +00:00
{
mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
2000-09-18 16:07:07 +00:00
}
else
{
mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
2000-09-18 16:07:07 +00:00
}
}
mpDrawView->HideSdrPage();
2000-09-18 16:07:07 +00:00
SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
2000-09-18 16:07:07 +00:00
if( !pMaster ) // Falls es diese Page nicht geben sollte
pMaster = GetDoc()->GetMasterSdPage(0, mePageKind);
2000-09-18 16:07:07 +00:00
USHORT nNum = pMaster->GetPageNum();
mpDrawView->ShowSdrPage(mpDrawView->GetModel()->GetMasterPage(nNum));
2000-09-18 16:07:07 +00:00
GetViewShellBase().GetDrawController().FireSwitchCurrentPage(pMaster);
2002-01-30 10:40:42 +00:00
SdrPageView* pNewPageView = mpDrawView->GetSdrPageView();
2000-09-18 16:07:07 +00:00
if (pNewPageView)
{
pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() );
pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() );
pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() );
2000-09-18 16:07:07 +00:00
if (mePageKind == PK_NOTES)
2000-09-18 16:07:07 +00:00
{
pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() );
2000-09-18 16:07:07 +00:00
}
else if (mePageKind == PK_HANDOUT)
2000-09-18 16:07:07 +00:00
{
pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() );
2000-09-18 16:07:07 +00:00
}
else
{
pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() );
2000-09-18 16:07:07 +00:00
}
}
String aLayoutName(pMaster->GetLayoutName());
aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
maTabControl.SetCurPageId(nSelectedPage+1);
2000-09-18 16:07:07 +00:00
if (maTabControl.GetPageText(nSelectedPage+1) != aLayoutName)
2000-09-18 16:07:07 +00:00
{
maTabControl.SetPageText(nSelectedPage+1, aLayoutName);
2000-09-18 16:07:07 +00:00
}
if( mePageKind == PK_HANDOUT )
{
// set pages for all available handout presentation objects
sd::ShapeList& rShapeList = pMaster->GetPresentationShapeList();
sal_uInt16 nPgNum = 0;
SdrObject* pObj = 0;
while( (pObj = rShapeList.getNextShape(pObj)) != 0 )
{
if( pMaster->GetPresObjKind(pObj) == PRESOBJ_HANDOUT )
{
const sal_uInt16 nDestinationPageNum(2 * nPgNum + 1);
if(nDestinationPageNum < GetDoc()->GetPageCount())
{
static_cast<SdrPageObj*>(pObj)->SetReferencedPage(GetDoc()->GetPage(nDestinationPageNum));
}
else
{
static_cast<SdrPageObj*>(pObj)->SetReferencedPage(0L);
}
nPgNum++;
}
}
}
2000-09-18 16:07:07 +00:00
}
Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
2000-09-18 16:07:07 +00:00
VisAreaChanged(aVisAreaWin);
mpDrawView->VisAreaChanged(GetActiveWindow());
2000-09-18 16:07:07 +00:00
// Damit der Navigator (und das Effekte-Window) das mitbekommt (/-men)
SfxBindings& rBindings = GetViewFrame()->GetBindings();
rBindings.Invalidate(SID_NAVIGATOR_PAGENAME, TRUE, FALSE);
rBindings.Invalidate(SID_STATUS_PAGE, TRUE, FALSE);
UpdatePreview( mpActualPage );
2000-09-18 16:07:07 +00:00
}
return (bOK);
}
/*************************************************************************
|*
|* Pruefen, ob ein Seitenwechsel erlaubt ist
|*
\************************************************************************/
BOOL DrawViewShell::IsSwitchPageAllowed() const
2000-09-18 16:07:07 +00:00
{
bool bOK = true;
2000-09-18 16:07:07 +00:00
FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager().GetFormShell();
if (pFormShell!=NULL && !pFormShell->PrepareClose (FALSE))
bOK = false;
2000-09-18 16:07:07 +00:00
return bOK;
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert
|* hat (z. B. durch Undo)
|*
\************************************************************************/
void DrawViewShell::ResetActualLayer()
2000-09-18 16:07:07 +00:00
{
LayerTabBar* pLayerBar = GetLayerTabControl();
if (pLayerBar != NULL)
2000-09-18 16:07:07 +00:00
{
// remember old layer cound and current layer id
// this is needed when one layer is renamed to
// restore current layer
USHORT nOldLayerCnt = pLayerBar->GetPageCount();
USHORT nOldLayerId = pLayerBar->GetCurPageId();
/*************************************************************
* Update fuer LayerTab
*************************************************************/
pLayerBar->Clear();
String aName;
String aActiveLayer = mpDrawView->GetActiveLayer();
String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) );
String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) );
String aLayoutLayer( SdResId(STR_LAYER_LAYOUT) );
String aControlsLayer( SdResId(STR_LAYER_CONTROLS) );
String aMeasureLinesLayer( SdResId(STR_LAYER_MEASURELINES) );
USHORT nActiveLayer = SDRLAYER_NOTFOUND;
SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
USHORT nLayerCnt = rLayerAdmin.GetLayerCount();
for ( USHORT nLayer = 0; nLayer < nLayerCnt; nLayer++ )
2000-09-18 16:07:07 +00:00
{
aName = rLayerAdmin.GetLayer(nLayer)->GetName();
2000-09-18 16:07:07 +00:00
if ( aName == aActiveLayer )
2000-09-18 16:07:07 +00:00
{
nActiveLayer = nLayer;
}
if ( aName != aBackgroundLayer )
{
if (meEditMode == EM_MASTERPAGE)
2000-09-18 16:07:07 +00:00
{
// Layer der Page nicht auf MasterPage anzeigen
if (aName != aLayoutLayer &&
aName != aControlsLayer &&
aName != aMeasureLinesLayer)
{
pLayerBar->InsertPage(nLayer+1, aName);
2000-09-18 16:07:07 +00:00
TabBarPageBits nBits = 0;
SdrPageView* pPV = mpDrawView->GetSdrPageView();
2000-09-18 16:07:07 +00:00
if (pPV && !pPV->IsLayerVisible(aName))
{
// Unsichtbare Layer werden anders dargestellt
nBits = TPB_SPECIAL;
}
2000-09-18 16:07:07 +00:00
pLayerBar->SetPageBits(nLayer+1, nBits);
}
2000-09-18 16:07:07 +00:00
}
else
2000-09-18 16:07:07 +00:00
{
// Layer der MasterPage nicht auf Page anzeigen
if ( aName != aBackgroundObjLayer )
{
pLayerBar->InsertPage(nLayer+1, aName);
2000-09-18 16:07:07 +00:00
TabBarPageBits nBits = 0;
2000-09-18 16:07:07 +00:00
if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName))
{
// Unsichtbare Layer werden anders dargestellt
nBits = TPB_SPECIAL;
}
2000-09-18 16:07:07 +00:00
pLayerBar->SetPageBits(nLayer+1, nBits);
}
2000-09-18 16:07:07 +00:00
}
}
}
if ( nActiveLayer == SDRLAYER_NOTFOUND )
{
if( nOldLayerCnt == pLayerBar->GetPageCount() )
{
nActiveLayer = nOldLayerId - 1;
}
else
{
nActiveLayer = ( meEditMode == EM_MASTERPAGE ) ? 2 : 0;
}
mpDrawView->SetActiveLayer( pLayerBar->GetPageText(nActiveLayer + 1) );
}
pLayerBar->SetCurPageId(nActiveLayer + 1);
GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER );
2000-09-18 16:07:07 +00:00
}
}
/*************************************************************************
|*
|* Verzoegertes Close ausfuehren
|*
\************************************************************************/
IMPL_LINK( DrawViewShell, CloseHdl, Timer*, pTimer )
2000-09-18 16:07:07 +00:00
{
pTimer->Stop();
GetViewFrame()->GetBindings().Execute( SID_CLOSEWIN );
2000-09-18 16:07:07 +00:00
return 0L;
}
2001-03-08 10:28:38 +00:00
/*************************************************************************
|*
|* AcceptDrop
|*
\************************************************************************/
sal_Int8 DrawViewShell::AcceptDrop (
const AcceptDropEvent& rEvt,
DropTargetHelper& rTargetHelper,
::sd::Window* pTargetWindow,
USHORT nPage,
USHORT nLayer )
2001-03-08 10:28:38 +00:00
{
if( nPage != SDRPAGE_NOTFOUND )
nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum();
2001-03-08 10:28:38 +00:00
if( mpSlideShow )
return DND_ACTION_NONE;
2001-03-08 10:28:38 +00:00
return mpDrawView->AcceptDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer );
2001-03-08 10:28:38 +00:00
}
/*************************************************************************
|*
|* ExecuteDrop
|*
\************************************************************************/
sal_Int8 DrawViewShell::ExecuteDrop (
const ExecuteDropEvent& rEvt,
DropTargetHelper& rTargetHelper,
::sd::Window* pTargetWindow,
USHORT nPage,
USHORT nLayer)
2001-03-08 10:28:38 +00:00
{
if( nPage != SDRPAGE_NOTFOUND )
nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum();
2001-03-08 10:28:38 +00:00
if( mpSlideShow )
return DND_ACTION_NONE;
2001-03-08 10:28:38 +00:00
Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
sal_Int8 nResult (mpDrawView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ));
Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
return nResult;
2001-03-08 10:28:38 +00:00
}
2000-09-18 16:07:07 +00:00
} // end of namespace sd
2000-09-18 16:07:07 +00:00
#ifdef WNT
#pragma optimize ( "", on )
#endif