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

1686 lines
51 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* $RCSfile: drviews1.cxx,v $
*
* $Revision: 1.39 $
2000-09-18 16:07:07 +00:00
*
* last change: $Author: rt $ $Date: 2004-07-12 15:16:00 $
2000-09-18 16:07:07 +00:00
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* 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.
*
* 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.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <so3/iface.hxx>
#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
#ifndef _SVSTOR_HXX //autogen
#include <so3/svstor.hxx>
#endif
#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
#pragma hdrstop
#include "misc.hxx"
#ifdef STARIMAGE_AVAILABLE
#ifndef _SIMDLL_HXX
#include <sim2/simdll.hxx>
#endif
#endif
#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"
#ifndef SD_DRAW_VIEW_SHELL_HXX
#include "DrawViewShell.hxx"
#endif
#include "Ruler.hxx"
#ifndef SD_CLIENT_HXX
#include "Client.hxx"
#endif
#ifndef SD_PREVIEW_WINDOW_HXX
#include "PreviewWindow.hxx"
#endif
#ifndef SD_PREVIEW_CHILD_WINDOW_HXX
#include "PreviewChildWindow.hxx"
#endif
#ifndef SD_FU_SLIDE_SHOW_HXX
2000-09-18 16:07:07 +00:00
#include "fuslshow.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_OBJECT_BAR_MANAGER_HXX
#include "ObjectBarManager.hxx"
#endif
#ifndef SD_VIEW_SHELL_BASE_HXX
#include "ViewShellBase.hxx"
#endif
2000-09-18 16:07:07 +00:00
#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
#define SO2_DECL_SVINPLACEOBJECT_DEFINED
SO2_DECL_REF(SvInPlaceObject)
#endif
#ifndef SO2_DECL_SVSTORAGE_DEFINED
#define SO2_DECL_SVSTORAGE_DEFINED
SO2_DECL_REF(SvStorage)
#endif
#ifdef WNT
#pragma optimize ( "", off )
#endif
namespace sd {
2000-09-18 16:07:07 +00:00
/*************************************************************************
|*
|* Activate(), beim ersten Aufruf wird eine Shell fuer den Object Bar erzeugt
|*
\************************************************************************/
void DrawViewShell::Activate(BOOL bIsMDIActivate)
2000-09-18 16:07:07 +00:00
{
ViewShell::Activate(bIsMDIActivate);
ObjectBarManager &rObjectBarManager (GetObjectBarManager());
2000-09-18 16:07:07 +00:00
if (rObjectBarManager.GetTopObjectBarId() == 0)
{
/*
// There is not yet an active object bar.
rObjectBarManager.PushObjectBar (RID_FORMLAYER_TOOLBOX);
rObjectBarManager.PushObjectBar (RID_DRAW_OBJ_TOOLBOX);
*/
2000-09-18 16:07:07 +00:00
}
if (bIsMDIActivate)
{
BOOL bPreview = FALSE;
if (eEditMode == EM_PAGE)
2001-03-08 10:28:38 +00:00
bPreview = pFrameView->IsShowPreviewInPageMode() != 0;
2000-09-18 16:07:07 +00:00
else
2001-03-08 10:28:38 +00:00
bPreview = pFrameView->IsShowPreviewInMasterPageMode() != 0;
2000-09-18 16:07:07 +00:00
SfxBoolItem aItem(SID_PREVIEW_WIN, bPreview);
GetViewFrame()->GetDispatcher()->Execute(
SID_PREVIEW_WIN, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L);
2000-09-18 16:07:07 +00:00
}
}
void DrawViewShell::UIActivate( SvInPlaceObject *pIPObj )
{
ViewShell::UIActivate(pIPObj);
// #94252# Disable own controls
aTabControl.Disable();
aLayerTab.Disable();
aPageBtn.Disable();
aMasterPageBtn.Disable();
aLayerBtn.Disable();
}
void DrawViewShell::UIDeactivate( SvInPlaceObject *pIPObj )
{
// #94252# Enable own controls
aTabControl.Enable();
aLayerTab.Enable();
// #94951# handout and notes are no separate views,
// handle difference in enabled functionality
if (ePageKind == PK_NOTES)
{
aPageBtn.Enable();
aMasterPageBtn.Enable();
aLayerBtn.Disable();
}
else if (ePageKind == PK_HANDOUT)
{
aPageBtn.Disable();
aMasterPageBtn.Enable();
aLayerBtn.Disable();
}
else
{
aPageBtn.Enable();
aMasterPageBtn.Enable();
aLayerBtn.Enable();
}
ViewShell::UIDeactivate(pIPObj);
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()
2000-09-18 16:07:07 +00:00
{
// Um die Performance zu steigern wird jetzt die komplette
// Shell invalidiert statt alle Slots einzeln
Invalidate();
// Damit das Effekte-Window auch einen aktuellen Status bekommt
UpdateEffectWindow();
//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 ( pDrView->AreObjectsMarked() )
2000-09-18 16:07:07 +00:00
{
const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
2000-09-18 16:07:07 +00:00
if (rMarkList.GetMarkCount() == 1)
{
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObj = pMark->GetObj();
UINT32 nInv = pObj->GetObjInventor();
UINT16 nSdrObjKind = pObj->GetObjIdentifier();
if (nInv = SdrInventor && nSdrObjKind == OBJ_OLE2)
{
pOleObj = (SdrOle2Obj*) pObj;
UpdateIMapDlg( pObj );
}
else if (nSdrObjKind == OBJ_GRAF)
{
pGrafObj = (SdrGrafObj*) pObj;
UpdateIMapDlg( pObj );
}
}
}
ViewShellBase& rBase = GetViewShellBase();
Client* pIPClient = static_cast<Client*>(rBase.GetIPClient());
2000-09-18 16:07:07 +00:00
if ( pIPClient && pIPClient->IsInPlaceActive() )
{
/**********************************************************************
* Ggf. OLE-Objekt beruecksichtigen und deaktivieren
**********************************************************************/
// this means we recently deselected an inplace active ole object so
// we need to deselect it now
2000-09-18 16:07:07 +00:00
if (!pOleObj)
{
pIPClient->GetProtocol().Reset2Open();
SFX_APP()->SetViewFrame( GetViewFrame() );
rBase.SetVerbs(0);
2000-09-18 16:07:07 +00:00
pDrView->ShowMarkHdl(NULL);
}
else
{
SvInPlaceObjectRef aIPObj = pOleObj->GetObjRef();
if ( aIPObj.Is() )
{
rBase.SetVerbs( &aIPObj->GetVerbList() );
2000-09-18 16:07:07 +00:00
}
else
{
rBase.SetVerbs(NULL);
2000-09-18 16:07:07 +00:00
}
}
}
else
{
#ifdef STARIMAGE_AVAILABLE
if ( pGrafObj && pGrafObj->GetGraphicType() == GRAPHIC_BITMAP && SFX_APP()->HasFeature(SFX_FEATURE_SIMAGE))
{
SvVerb aVerb( 0, String( SdResId(STR_EDIT_OBJ) ) );
SvVerbList aVerbList;
aVerbList.Append( aVerb );
rBase.SetVerbs( &aVerbList );
2000-09-18 16:07:07 +00:00
}
else
#endif
if ( pOleObj )
{
SvInPlaceObjectRef aIPObj = pOleObj->GetObjRef();
if ( aIPObj.Is() )
{
rBase.SetVerbs( &aIPObj->GetVerbList() );
2000-09-18 16:07:07 +00:00
}
else
{
rBase.SetVerbs(NULL);
2000-09-18 16:07:07 +00:00
}
}
else
{
rBase.SetVerbs(NULL);
2000-09-18 16:07:07 +00:00
}
}
if( pFuActual )
{
pFuActual->SelectionHasChanged();
}
else
{
USHORT nObjBarId;
if (pView->GetContext() == SDRCONTEXT_POINTEDIT)
nObjBarId = RID_BEZIER_TOOLBOX;
else if (pView->GetContext() == SDRCONTEXT_GRAPHIC)
nObjBarId = RID_DRAW_GRAF_TOOLBOX;
else if (pView->GetContext() == SDRCONTEXT_TEXTEDIT)
nObjBarId = RID_DRAW_TEXT_TOOLBOX; // #96124# Keep text bar when in textedit
2000-09-18 16:07:07 +00:00
else
nObjBarId = RID_DRAW_OBJ_TOOLBOX;
GetObjectBarManager().SwitchObjectBar (nObjBarId);
2000-09-18 16:07:07 +00:00
}
// #96124# Invalidate the currently active object bar.
SfxShell* pShell = GetObjectBarManager().GetTopObjectBar();
if (pShell != NULL)
2000-09-18 16:07:07 +00:00
pShell->Invalidate();
if( SFX_APP()->GetHelpPI() )
SetHelpIdBySelection();
pDrView->UpdateSelectionClipboard( FALSE );
2002-01-24 14:06:27 +00:00
if (GetController() != NULL)
GetController()->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.
bZoomOnPage = 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
}
/*************************************************************************
|*
|* Modus-Umschaltung (Draw, Slide, Outline)
|*
\************************************************************************/
IMPL_LINK( DrawViewShell, TabModeBtnHdl, Button *, pButton )
2000-09-18 16:07:07 +00:00
{
if ( !((ImageButton*) pButton)->IsChecked() ||
pButton == &aLayerBtn)
{
USHORT nSlotId;
if ( pButton == &aPageBtn )
nSlotId = SID_PAGEMODE;
else if ( pButton == &aMasterPageBtn )
nSlotId = SID_MASTERPAGE;
else if ( pButton == &aLayerBtn )
nSlotId = SID_LAYERMODE;
GetViewFrame()->GetDispatcher()->Execute(nSlotId,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
}
pWindow->GrabFocus(); // SdWindow soll den Focus erhalten
return 0;
}
/*************************************************************************
|*
|* 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;
SfxChildWindow* pPreviewChild = GetViewFrame()->GetChildWindow(
PreviewChildWindow::GetChildWindowId() );
2000-09-18 16:07:07 +00:00
BOOL bRet = TRUE;
if( pFuSlideShow )
{
pFuSlideShow->Terminate();
bRet = FALSE;
}
if( pPreviewChild && pPreviewChild->GetWindow() )
{
PreviewWindow* pPreviewWin = static_cast<PreviewWindow*>(
pPreviewChild->GetWindow());
FuSlideShow* pShow = pPreviewWin ? pPreviewWin->GetSlideShow() : NULL;
2000-09-18 16:07:07 +00:00
if( pPreviewWin->GetDoc() == GetDoc() && pShow && pShow->IsInputLocked() )
2000-09-18 16:07:07 +00:00
{
// pShow->Terminate();
// bRet = FALSE;
pShow->Destroy ();
2000-09-18 16:07:07 +00:00
}
}
if( bRet && pFuActual )
{
USHORT nID = pFuActual->GetSlotID();
if (nID == SID_TEXTEDIT || nID == SID_ATTR_CHAR)
{
pDrView->EndTextEdit();
}
}
else if( !bRet )
{
aCloseTimer.SetTimeoutHdl( LINK( this, DrawViewShell, CloseHdl ) );
2000-09-18 16:07:07 +00:00
aCloseTimer.SetTimeout( 20 );
aCloseTimer.Start();
}
return bRet;
}
/*************************************************************************
|*
|* Status (Enabled/Disabled) von Menue-SfxSlots setzen
|*
\************************************************************************/
void DrawViewShell::ChangeEditMode(EditMode eEMode, BOOL bLMode)
2000-09-18 16:07:07 +00:00
{
if (eEditMode != eEMode || bLayerMode != bLMode)
{
USHORT nActualPageNum = 0;
SdUnoDrawView* pController =
static_cast<SdUnoDrawView*>(GetController());
if (pController != NULL)
2002-01-24 14:06:27 +00:00
{
pController->FireChangeEditMode (eEMode == EM_MASTERPAGE);
pController->FireChangeLayerMode (bLMode);
2002-01-24 14:06:27 +00:00
}
2000-09-18 16:07:07 +00:00
if ( pDrView->IsTextEdit() )
{
pDrView->EndTextEdit();
}
aLayerTab.EndEditMode();
aTabControl.EndEditMode();
if (ePageKind == PK_HANDOUT)
{
// Bei Handzetteln nur MasterPage zulassen
eEMode = EM_MASTERPAGE;
}
eEditMode = eEMode;
bLayerMode = bLMode;
if (eEditMode == EM_PAGE)
{
/******************************************************************
* PAGEMODE
******************************************************************/
// Emulate radio button behaviour. Order of checking buttons on
// or off is important for accessibility.
2000-09-18 16:07:07 +00:00
aMasterPageBtn.Check(FALSE);
aPageBtn.Check(TRUE);
2000-09-18 16:07:07 +00:00
aTabControl.Clear();
SdPage* pPage;
String aPageName;
USHORT nPageCnt = GetDoc()->GetSdPageCount(ePageKind);
2000-09-18 16:07:07 +00:00
for (USHORT i = 0; i < nPageCnt; i++)
{
pPage = GetDoc()->GetSdPage(i, ePageKind);
2000-09-18 16:07:07 +00:00
aPageName = pPage->GetName();
aTabControl.InsertPage(i + 1, aPageName);
if ( pPage->IsSelected() && nActualPageNum == 0 )
{
nActualPageNum = i;
}
}
aTabControl.SetCurPageId(nActualPageNum + 1);
2000-09-18 16:07:07 +00:00
SwitchPage(nActualPageNum);
2001-03-08 10:28:38 +00:00
SfxBoolItem aItem(SID_PREVIEW_WIN, pFrameView->IsShowPreviewInPageMode() != 0 );
GetViewFrame()->GetDispatcher()->Execute(
SID_PREVIEW_WIN, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2000-09-18 16:07:07 +00:00
}
else
{
/******************************************************************
* MASTERPAGE
******************************************************************/
GetViewFrame()->SetChildWindow(
AnimationChildWindow::GetChildWindowId(), FALSE );
2000-09-18 16:07:07 +00:00
// Emulate radio button behaviour. Order of checking buttons on
// or off is important for accessibility.
2000-09-18 16:07:07 +00:00
aPageBtn.Check(FALSE);
aMasterPageBtn.Check(TRUE);
if (!pActualPage)
{
// Sofern es keine pActualPage gibt, wird die erste genommen
pActualPage = GetDoc()->GetSdPage(0, ePageKind);
2000-09-18 16:07:07 +00:00
}
SdPage* pPreviewPage = pActualPage;
aTabControl.Clear();
USHORT nActualMasterPageNum = 0;
USHORT nMasterPageCnt = GetDoc()->GetMasterSdPageCount(ePageKind);
2000-09-18 16:07:07 +00:00
for (USHORT i = 0; i < nMasterPageCnt; i++)
{
SdPage* pMaster = GetDoc()->GetMasterSdPage(i, ePageKind);
2000-09-18 16:07:07 +00:00
String aLayoutName(pMaster->GetLayoutName());
aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
aTabControl.InsertPage(i + 1, aLayoutName);
if (&(pActualPage->TRG_GetMasterPage()) == pMaster)
2000-09-18 16:07:07 +00:00
{
nActualMasterPageNum = i;
}
}
aTabControl.SetCurPageId(nActualMasterPageNum + 1);
SwitchPage(nActualMasterPageNum);
2001-03-08 10:28:38 +00:00
SfxBoolItem aItem(SID_PREVIEW_WIN, pFrameView->IsShowPreviewInMasterPageMode() != 0 );
GetViewFrame()->GetDispatcher()->Execute(
SID_PREVIEW_WIN, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2000-09-18 16:07:07 +00:00
}
if (bLayerMode)
{
/******************************************************************
* LAYER ein
******************************************************************/
aTabControl.Hide();
aLayerTab.Show();
aLayerBtn.Check(TRUE);
}
else
{
/******************************************************************
* LAYER aus
******************************************************************/
aTabControl.Show();
aLayerTab.Hide();
aLayerBtn.Check(FALSE);
// Set the tab control only for draw pages. For master page
// this has been done already above.
if (eEditMode == EM_PAGE)
aTabControl.SetCurPageId (nActualPageNum + 1);
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 );
Invalidate(SID_PREVIEW_WIN);
}
}
/*************************************************************************
|*
|* Groesse des TabControls und der ModeButtons zurueckgeben
|*
\************************************************************************/
long DrawViewShell::GetHCtrlWidth()
2000-09-18 16:07:07 +00:00
{
return ( aTabControl.GetSizePixel().Width() +
aPageBtn.GetSizePixel().Width() * 3 );
}
/*************************************************************************
|*
|* 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, &GetViewFrame()->GetWindow(), pWin, nFlags,
GetViewFrame()->GetBindings(), aWBits);
2000-09-18 16:07:07 +00:00
pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit());
// Metric ...
UINT16 nMetric = GetDoc()->GetUIUnit();
2000-09-18 16:07:07 +00:00
if( nMetric == 0xffff )
nMetric = 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, &GetViewFrame()->GetWindow(), 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 = GetDoc()->GetUIUnit();
2000-09-18 16:07:07 +00:00
if( nMetric == 0xffff )
nMetric = 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
for (USHORT nIndex=0; nIndex<MAX_HSPLIT_CNT; nIndex++)
{
if (pHRulerArray[nIndex])
{
pHRulerArray[nIndex]->ForceUpdate();
}
}
}
/*************************************************************************
|*
|* 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
for (USHORT nIndex=0; nIndex<MAX_VSPLIT_CNT; nIndex++)
{
if (pVRulerArray[nIndex])
{
pVRulerArray[nIndex]->ForceUpdate();
}
}
}
/*************************************************************************
|*
|* 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
{
long nMax = aHSplit.GetPosPixel().X() - aTabControl.GetPosPixel().X();
Size aTabSize = aTabControl.GetSizePixel();
aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1));
aTabControl.SetSizePixel(aTabSize);
aLayerTab.SetSizePixel(aTabSize);
Point aPos = aTabControl.GetPosPixel();
aPos.X() += aTabSize.Width();
Size aScrSize(nMax - aTabSize.Width(), aScrBarWH.Height());
pHScrlArray[0]->SetPosSizePixel(aPos, aScrSize);
return 0;
}
/*************************************************************************
|*
|* 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 = aTabControl.GetCurPageId() - 1;
USHORT nPageCount = (eEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(ePageKind):GetDoc()->GetMasterSdPageCount(ePageKind);
2000-09-18 16:07:07 +00:00
if (nPageCount > 0)
nCurrentPage = Min((USHORT)(nPageCount - 1), nCurrentPage);
else
nCurrentPage = 0;
if (eEditMode == EM_PAGE)
{
// Update fuer TabControl
aTabControl.Clear();
SdPage* pPage = NULL;
String aPageName;
for (USHORT i = 0; i < nPageCount; i++)
{
pPage = GetDoc()->GetSdPage(i, ePageKind);
2000-09-18 16:07:07 +00:00
aPageName = pPage->GetName();
aTabControl.InsertPage(i + 1, aPageName);
// Selektionskennungen der Seiten korrigieren
GetDoc()->SetSelected(pPage, i == nCurrentPage);
2000-09-18 16:07:07 +00:00
}
aTabControl.SetCurPageId(nCurrentPage + 1);
}
else // EM_MASTERPAGE
{
SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, ePageKind);
2000-09-18 16:07:07 +00:00
aTabControl.Clear();
USHORT nActualMasterPageNum = 0;
USHORT nMasterPageCnt = GetDoc()->GetMasterSdPageCount(ePageKind);
2000-09-18 16:07:07 +00:00
for (USHORT i = 0; i < nMasterPageCnt; i++)
{
SdPage* pMaster = GetDoc()->GetMasterSdPage(i, ePageKind);
2000-09-18 16:07:07 +00:00
String aLayoutName(pMaster->GetLayoutName());
aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
aTabControl.InsertPage(i + 1, aLayoutName);
if (pActualPage == pMaster)
nActualMasterPageNum = i;
}
aTabControl.SetCurPageId(nActualMasterPageNum + 1);
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 ( pDrView->AreObjectsMarked() )
2000-09-18 16:07:07 +00:00
{
const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
2000-09-18 16:07:07 +00:00
if (rMarkList.GetMarkCount() == 1)
{
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObj = pMark->GetObj();
UINT32 nInv = pObj->GetObjInventor();
UINT16 nSdrObjKind = pObj->GetObjIdentifier();
if (nInv = SdrInventor && nSdrObjKind == OBJ_OLE2)
{
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)
**************************************************************/
pDrView->HideMarkHdl(NULL);
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 = pDrView->GetPageViewPvNum(0);
pPV->GetObjList()->InsertObject( pSdrOle2Obj );
pDrView->ReplaceObject( pObj, *pPV, pTempSdrGrafObj );
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
{
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
{
BOOL bOK = FALSE;
if (IsSwitchPageAllowed())
{
bOK = TRUE;
BOOL bIsChanged = GetDoc()->IsChanged();
2000-09-18 16:07:07 +00:00
if (pActualPage)
{
SdPage* pNewPage = GetDoc()->GetSdPage(nSelectedPage, ePageKind);
2000-09-18 16:07:07 +00:00
if (pActualPage == pNewPage)
{
if (eEditMode == EM_MASTERPAGE)
{
pNewPage = (SdPage*)(&(pNewPage->TRG_GetMasterPage()));
2000-09-18 16:07:07 +00:00
}
SdrPageView* pPV = pDrView->GetPageViewPvNum(0);
if (pPV && pNewPage == (SdPage*) pPV->GetPage() &&
pNewPage->GetName() == aTabControl.GetPageText(nSelectedPage+1))
{
// Die Seite wird schon angezeigt
return(TRUE);
}
}
}
pActualPage = NULL;
if (eEditMode == EM_PAGE)
{
pActualPage = GetDoc()->GetSdPage(nSelectedPage, ePageKind);
2000-09-18 16:07:07 +00:00
}
else
{
SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, ePageKind);
2000-09-18 16:07:07 +00:00
// Passt die selektierte Seite zur MasterPage?
USHORT nPageCount = GetDoc()->GetSdPageCount(ePageKind);
2000-09-18 16:07:07 +00:00
for (USHORT i = 0; i < nPageCount; i++)
{
SdPage* pPage = GetDoc()->GetSdPage(i, ePageKind);
if(pPage && pPage->IsSelected() && pMaster == &(pPage->TRG_GetMasterPage()))
2000-09-18 16:07:07 +00:00
{
pActualPage = pPage;
break;
}
}
if (!pActualPage)
{
// Die erste Seite nehmen, welche zur MasterPage passt
for (USHORT i = 0; i < nPageCount; i++)
{
SdPage* pPage = GetDoc()->GetSdPage(i, ePageKind);
if(pPage && pMaster == &(pPage->TRG_GetMasterPage()))
2000-09-18 16:07:07 +00:00
{
pActualPage = pPage;
break;
}
}
}
}
for (USHORT i = 0; i < GetDoc()->GetSdPageCount(ePageKind); i++)
2000-09-18 16:07:07 +00:00
{
// Alle Seiten deselektieren
GetDoc()->SetSelected( GetDoc()->GetSdPage(i, ePageKind), FALSE);
2000-09-18 16:07:07 +00:00
}
if (!pActualPage)
{
// Sofern es keine pActualPage gibt, wird die erste genommen
pActualPage = GetDoc()->GetSdPage(0, ePageKind);
2000-09-18 16:07:07 +00:00
}
// diese Seite auch selektieren (pActualPage zeigt immer auf Zeichenseite,
// nie auf eine Masterpage)
GetDoc()->SetSelected(pActualPage, TRUE);
2000-09-18 16:07:07 +00:00
if( !pFuSlideShow || ( pFuSlideShow->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( pActualPage )
pActualPage->SetAutoLayout( pActualPage->GetAutoLayout() );
2000-09-18 16:07:07 +00:00
if (eEditMode == EM_PAGE)
{
/**********************************************************************
* PAGEMODE
**********************************************************************/
GetDoc()->SetSelected(pActualPage, TRUE);
2000-09-18 16:07:07 +00:00
SdrPageView* pPageView = pDrView->GetPageViewPvNum(0);
if (pPageView)
{
pFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
pFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
pFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
if (ePageKind == PK_NOTES)
{
pFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
}
else if (ePageKind == PK_HANDOUT)
{
pFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
}
else
{
pFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
}
}
pDrView->HideAllPages();
pDrView->ShowPage(pActualPage, Point(0, 0));
SdUnoDrawView* pController =
static_cast<SdUnoDrawView*>(GetController());
if (pController != NULL)
pController->FireSwitchCurrentPage (pActualPage);
2000-09-18 16:07:07 +00:00
SdrPageView* pNewPageView = pDrView->GetPageViewPvNum(0);
if (pNewPageView)
{
pNewPageView->SetVisibleLayers( pFrameView->GetVisibleLayers() );
pNewPageView->SetPrintableLayers( pFrameView->GetPrintableLayers() );
pNewPageView->SetLockedLayers( pFrameView->GetLockedLayers() );
if (ePageKind == PK_NOTES)
{
pNewPageView->SetHelpLines( pFrameView->GetNotesHelpLines() );
}
else if (ePageKind == PK_HANDOUT)
{
pNewPageView->SetHelpLines( pFrameView->GetHandoutHelpLines() );
}
else
{
pNewPageView->SetHelpLines( pFrameView->GetStandardHelpLines() );
}
}
aTabControl.SetCurPageId(nSelectedPage+1);
String aPageName = pActualPage->GetName();
if (aTabControl.GetPageText(nSelectedPage+1) != aPageName)
{
aTabControl.SetPageText(nSelectedPage+1, aPageName);
}
}
else
{
/**********************************************************************
* MASTERPAGE
**********************************************************************/
SdrPageView* pPageView = pDrView->GetPageViewPvNum(0);
if (pPageView)
{
pFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
pFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
pFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
if (ePageKind == PK_NOTES)
{
pFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
}
else if (ePageKind == PK_HANDOUT)
{
pFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
}
else
{
pFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
}
}
pDrView->HideAllPages();
SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, ePageKind);
2000-09-18 16:07:07 +00:00
if( !pMaster ) // Falls es diese Page nicht geben sollte
pMaster = GetDoc()->GetMasterSdPage(0, ePageKind);
2000-09-18 16:07:07 +00:00
USHORT nNum = pMaster->GetPageNum();
pDrView->ShowMasterPagePgNum(nNum, Point(0, 0));
SdUnoDrawView* pController =
static_cast<SdUnoDrawView*>(GetController());
if (pController != NULL)
pController->FireSwitchCurrentPage (pMaster);
2002-01-30 10:40:42 +00:00
2000-09-18 16:07:07 +00:00
SdrPageView* pNewPageView = pDrView->GetPageViewPvNum(0);
if (pNewPageView)
{
pNewPageView->SetVisibleLayers( pFrameView->GetVisibleLayers() );
pNewPageView->SetPrintableLayers( pFrameView->GetPrintableLayers() );
pNewPageView->SetLockedLayers( pFrameView->GetLockedLayers() );
if (ePageKind == PK_NOTES)
{
pNewPageView->SetHelpLines( pFrameView->GetNotesHelpLines() );
}
else if (ePageKind == PK_HANDOUT)
{
pNewPageView->SetHelpLines( pFrameView->GetHandoutHelpLines() );
}
else
{
pNewPageView->SetHelpLines( pFrameView->GetStandardHelpLines() );
}
}
String aLayoutName(pMaster->GetLayoutName());
aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
aTabControl.SetCurPageId(nSelectedPage+1);
if (aTabControl.GetPageText(nSelectedPage+1) != aLayoutName)
{
aTabControl.SetPageText(nSelectedPage+1, aLayoutName);
}
if( ePageKind == PK_HANDOUT )
{
// set pages for all available handout presentation objects
sd::PresentationObjectList::iterator aIter( pMaster->GetPresObjList().begin() );
const sd::PresentationObjectList::iterator aEnd( pMaster->GetPresObjList().end() );
sal_uInt16 nPgNum = 0;
while( aIter != aEnd )
{
if( (*aIter).meKind == PRESOBJ_HANDOUT )
{
const sal_uInt16 nDestinationPageNum(2 * nPgNum + 1);
if(nDestinationPageNum < GetDoc()->GetPageCount())
{
static_cast<SdrPageObj*>((*aIter).mpObject)->SetReferencedPage(GetDoc()->GetPage(nDestinationPageNum));
}
else
{
static_cast<SdrPageObj*>((*aIter).mpObject)->SetReferencedPage(0L);
}
nPgNum++;
}
aIter++;
}
}
2000-09-18 16:07:07 +00:00
}
Size aVisSizePixel = pWindow->GetOutputSizePixel();
Rectangle aVisAreaWin = pWindow->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
VisAreaChanged(aVisAreaWin);
pDrView->VisAreaChanged(pWindow);
// Damit der Navigator (und das Effekte-Window) das mitbekommt (/-men)
SfxBindings& rBindings = GetViewFrame()->GetBindings();
rBindings.Invalidate(SID_NAVIGATOR_PAGENAME, TRUE, FALSE);
rBindings.Invalidate(SID_EFFECT_STATE, TRUE, FALSE);
rBindings.Invalidate(SID_STATUS_PAGE, TRUE, FALSE);
2000-09-18 16:07:07 +00:00
UpdateSlideChangeWindow();
2001-09-13 10:22:42 +00:00
UpdatePreview( pActualPage );
2000-09-18 16:07:07 +00:00
if (pDrView->GetSlideShow())
{
pDrView->SetAnimationMode(TRUE);
}
GetDoc()->SetChanged(bIsChanged);
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 = GetObjectBarManager().GetFormShell();
if (pFormShell!=NULL && !pFormShell->PrepareClose (FALSE))
bOK = false;
2000-09-18 16:07:07 +00:00
return bOK && !bInEffectAssignment;
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
{
// remember old layer cound and current layer id
// this is needed when one layer is renamed to
// restore current layer
USHORT nOldLayerCnt = aLayerTab.GetPageCount();
USHORT nOldLayerId = aLayerTab.GetCurPageId();
2000-09-18 16:07:07 +00:00
/*************************************************************
* Update fuer LayerTab
*************************************************************/
aLayerTab.Clear();
String aName;
String aActiveLayer = pDrView->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 nNewLayer = 0;
USHORT nActiveLayer = SDRLAYER_NOTFOUND;
SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
2000-09-18 16:07:07 +00:00
USHORT nLayerCnt = rLayerAdmin.GetLayerCount();
for ( USHORT nLayer = 0; nLayer < nLayerCnt; nLayer++ )
{
aName = rLayerAdmin.GetLayer(nLayer)->GetName();
if ( aName == aActiveLayer )
{
nActiveLayer = nLayer;
}
if ( aName != aBackgroundLayer )
{
if (eEditMode == EM_MASTERPAGE)
{
// Layer der Page nicht auf MasterPage anzeigen
if (aName != aLayoutLayer &&
aName != aControlsLayer &&
aName != aMeasureLinesLayer)
{
aLayerTab.InsertPage(nLayer+1, aName);
TabBarPageBits nBits = 0;
SdrPageView* pPV = pDrView->GetPageViewPvNum(0);
if (pPV && !pPV->IsLayerVisible(aName))
{
// Unsichtbare Layer werden anders dargestellt
nBits = TPB_SPECIAL;
}
aLayerTab.SetPageBits(nLayer+1, nBits);
}
}
else
{
// Layer der MasterPage nicht auf Page anzeigen
if ( aName != aBackgroundObjLayer )
{
aLayerTab.InsertPage(nLayer+1, aName);
TabBarPageBits nBits = 0;
if (!pDrView->GetPageViewPvNum(0)->IsLayerVisible(aName))
{
// Unsichtbare Layer werden anders dargestellt
nBits = TPB_SPECIAL;
}
aLayerTab.SetPageBits(nLayer+1, nBits);
}
}
}
}
if ( nActiveLayer == SDRLAYER_NOTFOUND )
{
if( nOldLayerCnt == aLayerTab.GetPageCount() )
{
nActiveLayer = nOldLayerId - 1;
}
else
{
nActiveLayer = ( eEditMode == EM_MASTERPAGE ) ? 2 : 0;
}
2000-09-18 16:07:07 +00:00
pDrView->SetActiveLayer( aLayerTab.GetPageText(nActiveLayer + 1) );
}
aLayerTab.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;
}
/*************************************************************************
|*
|* Setzt die HelpId in Abhaengigkeit von der Selektion
|*
\************************************************************************/
void DrawViewShell::SetHelpIdBySelection()
2000-09-18 16:07:07 +00:00
{
UINT32 nHelpId = 0;
const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
2000-09-18 16:07:07 +00:00
if( rMarkList.GetMarkCount() > 0 )
{
SdrObject* pObj = rMarkList.GetMark(0)->GetObj();
UINT32 nInventor = pObj->GetObjInventor();
UINT16 nObjId = pObj->GetObjIdentifier();
if( nInventor == SdrInventor)
{
switch ( nObjId )
{
case OBJ_LINE:
// Alle Linien
nHelpId = SID_DRAWTBX_LINES;
break;
case OBJ_RECT:
// Gefuellt: Rechteck, Quadrat, Rechteck abgerundet, Quadrat abgerundet
// Ungefuellt: Rechteck, Quadrat, Rechteck abgerundet, Quadrat abgerundet
nHelpId = SID_DRAWTBX_RECTANGLES;
break;
case OBJ_CIRC:
// Gefuellt: Ellipse, Kreis
// Ungefuellt: Ellipse, Kreis
nHelpId = SID_DRAWTBX_ELLIPSES;
break;
case OBJ_SECT:
// Gefuellt: Ellipsensektor, Kreissektor
// Ungefuellt: Ellipsensektor, Kreissektor
nHelpId = SID_DRAWTBX_ELLIPSES;
break;
case OBJ_CARC:
// Ellipsenbogen, Kreisbogen
nHelpId = SID_DRAWTBX_ELLIPSES;
break;
case OBJ_CCUT:
// Gefuellt: Ellipsensegment, Kreissegment
// Ungefuellt: Ellipsensegment, Kreissegment
nHelpId = SID_DRAWTBX_ELLIPSES;
break;
case OBJ_POLY:
// Gefuellt: Polygon, Polygon 45
nHelpId = SID_DRAWTBX_LINES;
break;
case OBJ_PLIN:
// Ungefuellt: Polygon, Polygon 45
nHelpId = SID_DRAWTBX_LINES;
break;
case OBJ_PATHLINE:
// Ungefuellt: Kurve, Freihandlinie
nHelpId = SID_DRAWTBX_LINES;
break;
case OBJ_PATHFILL:
// Gefuellt: Kurve, Freihandlinie
nHelpId = SID_DRAWTBX_LINES;
break;
case OBJ_TEXT:
// Text, Text an Rahmen
nHelpId = SID_DRAWTBX_TEXT;
break;
case OBJ_TITLETEXT:
nHelpId = SID_DRAWTBX_TEXT;
break;
case OBJ_OUTLINETEXT:
nHelpId = SID_DRAWTBX_TEXT;
break;
case OBJ_GRAF:
// Graphik
nHelpId = 0;
break;
case OBJ_OLE2:
// OLE
nHelpId = 0;
break;
case OBJ_EDGE:
// Alle Verbinder
nHelpId = SID_DRAWTBX_CONNECTORS;
break;
case OBJ_CAPTION:
// Legende
nHelpId = SID_DRAWTBX_TEXT;
break;
case OBJ_PAGE:
// Seitendarstellungsobjekt
nHelpId = 0;
break;
case OBJ_MEASURE:
// Masslinie
nHelpId = SID_DRAWTBX_LINES;
break;
case OBJ_UNO:
// UNO
nHelpId = 0;
break;
}
}
else if( nInventor == E3dInventor)
{
// Alle 3D-Objekte
nHelpId = SID_DRAWTBX_3D_OBJECTS;
}
else if( nInventor == FmFormInventor)
{
// Alle FormControls
nHelpId = HID_FM_CTL_SELECTION;
}
}
}
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, ePageKind )->GetPageNum();
2001-03-08 10:28:38 +00:00
if( pFuSlideShow )
2001-03-08 10:28:38 +00:00
{
if( !pFuSlideShow->IsLivePresentation() )
{
return DND_ACTION_NONE;
}
2001-03-08 10:28:38 +00:00
}
return pDrView->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, ePageKind )->GetPageNum();
2001-03-08 10:28:38 +00:00
if( pFuSlideShow )
2001-03-08 10:28:38 +00:00
{
if( !pFuSlideShow->IsLivePresentation() )
{
return DND_ACTION_NONE;
}
2001-03-08 10:28:38 +00:00
}
return pDrView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer );
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