2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 03:49:49 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 03:49:49 +00:00
|
|
|
* $RCSfile: fuscale.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-12-14 16:02:51 +00:00
|
|
|
* $Revision: 1.8 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-12-14 16:02:51 +00:00
|
|
|
* last change: $Author: rt $ $Date: 2005-12-14 17:02:51 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 03:49:49 +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
|
|
|
*
|
|
|
|
*
|
2005-09-09 03:49:49 +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
|
|
|
*
|
2005-09-09 03:49:49 +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
|
|
|
*
|
2005-09-09 03:49:49 +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
|
|
|
*
|
2005-09-09 03:49:49 +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
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#pragma hdrstop
|
|
|
|
|
2004-01-20 10:11:41 +00:00
|
|
|
#include "fuscale.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svx/dialogs.hrc>
|
|
|
|
|
|
|
|
#include "app.hrc"
|
2004-01-20 10:11:41 +00:00
|
|
|
#ifndef SD_VIEW_HXX
|
|
|
|
#include "View.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_WINDOW_SHELL_HXX
|
|
|
|
#include "Window.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_SLIDE_VIEW_SHELL_HXX
|
|
|
|
#include "SlideViewShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_OUTLINE_VIEW_SHELL_HXX
|
|
|
|
#include "OutlineViewShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_DRAW_VIEW_HXX
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "drawview.hxx"
|
2004-01-20 10:11:41 +00:00
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "drawdoc.hxx"
|
2004-01-20 10:11:41 +00:00
|
|
|
#ifndef SD_DRAW_VIEW_SHELL_HXX
|
|
|
|
#include "DrawViewShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_VIEW_SHELL_HXX
|
|
|
|
#include "ViewShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_FU_ZOOM_HXX
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "fuzoom.hxx" // wegen SidArrayZoom[]
|
2004-01-20 10:11:41 +00:00
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#ifndef _MSGBOX_HXX //autogen
|
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDPAGV_HXX //autogen
|
|
|
|
#include <svx/svdpagv.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXVIEWFRM_HXX //autogen
|
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXDISPATCH_HXX //autogen
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#endif
|
2004-02-04 09:11:21 +00:00
|
|
|
//CHINA001 #ifndef _SVX_ZOOM_HXX //autogen
|
|
|
|
//CHINA001 #include <svx/zoom.hxx>
|
|
|
|
//CHINA001 #endif
|
|
|
|
#ifndef _SVX_ZOOM_DEF_HXX //autogen
|
|
|
|
#include <svx/zoom_def.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _SVX_ZOOMITEM_HXX //autogen
|
|
|
|
#include <svx/zoomitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXREQUEST_HXX //autogen
|
|
|
|
#include <sfx2/request.hxx>
|
|
|
|
#endif
|
2004-02-04 09:11:21 +00:00
|
|
|
#include <svx/svxdlg.hxx> //CHINA001
|
|
|
|
#include <svx/dialogs.hrc> //CHINA001
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-01-20 10:11:41 +00:00
|
|
|
namespace sd {
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
TYPEINIT1( FuScale, FuPoor );
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Konstruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 10:11:41 +00:00
|
|
|
FuScale::FuScale (
|
|
|
|
ViewShell* pViewSh,
|
|
|
|
::sd::Window* pWin,
|
|
|
|
::sd::View* pView,
|
|
|
|
SdDrawDocument* pDoc,
|
|
|
|
SfxRequest& rReq)
|
|
|
|
: FuPoor(pViewSh, pWin, pView, pDoc, rReq)
|
2005-12-14 16:02:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionReference FuScale::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
|
|
|
|
{
|
|
|
|
FunctionReference xFunc( new FuScale( pViewSh, pWin, pView, pDoc, rReq ) );
|
|
|
|
xFunc->DoExecute(rReq);
|
|
|
|
return xFunc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FuScale::DoExecute( SfxRequest& rReq )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
INT16 nValue;
|
|
|
|
|
|
|
|
const SfxItemSet* pArgs = rReq.GetArgs();
|
|
|
|
|
|
|
|
if( !pArgs )
|
|
|
|
{
|
|
|
|
SfxItemSet aNewAttr( pDoc->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM );
|
|
|
|
SvxZoomItem* pZoomItem;
|
|
|
|
USHORT nZoomValues = SVX_ZOOM_ENABLE_ALL;
|
|
|
|
|
|
|
|
nValue = (INT16) pWindow->GetZoom();
|
|
|
|
|
|
|
|
// Zoom auf Seitengroesse ?
|
2005-12-14 16:02:51 +00:00
|
|
|
if( pViewShell && pViewShell->ISA( DrawViewShell ) &&
|
|
|
|
static_cast<DrawViewShell*>(pViewShell)->IsZoomOnPage() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pZoomItem = new SvxZoomItem( SVX_ZOOM_WHOLEPAGE, nValue );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bereich einschraenken
|
2005-12-14 16:02:51 +00:00
|
|
|
if( pViewShell )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-12-14 16:02:51 +00:00
|
|
|
if( pViewShell->ISA( DrawViewShell ) )
|
|
|
|
{
|
|
|
|
SdrPageView* pPageView = pView->GetPageViewPvNum( 0 );
|
|
|
|
if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) )
|
|
|
|
// || ( pView->GetMarkedObjectList().GetMarkCount() == 0 ) )
|
|
|
|
{
|
|
|
|
nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( pViewShell->ISA( OutlineViewShell ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
|
2005-12-14 16:02:51 +00:00
|
|
|
nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE;
|
|
|
|
nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
|
|
|
|
}
|
|
|
|
else if( pViewShell->ISA( SlideViewShell ) )
|
|
|
|
{
|
|
|
|
nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
|
|
|
|
nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
|
|
|
|
nZoomValues &= ~(SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_150|SVX_ZOOM_ENABLE_200);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pZoomItem->SetValueSet( nZoomValues );
|
|
|
|
aNewAttr.Put( *pZoomItem );
|
|
|
|
|
2004-02-04 09:11:21 +00:00
|
|
|
//CHINA001 SvxZoomDialog* pDlg = new SvxZoomDialog( NULL, aNewAttr );
|
|
|
|
AbstractSvxZoomDialog* pDlg=NULL;
|
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
|
|
|
if(pFact)
|
|
|
|
{
|
|
|
|
pDlg = pFact->CreateSvxZoomDialog(NULL, aNewAttr, ResId(RID_SVXDLG_ZOOM));
|
|
|
|
DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
|
|
|
|
}
|
2005-12-14 16:02:51 +00:00
|
|
|
|
|
|
|
if( pDlg )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-12-14 16:02:51 +00:00
|
|
|
pDlg->SetLimits( pWindow->GetMinZoom(), pWindow->GetMaxZoom() );
|
|
|
|
USHORT nResult = pDlg->Execute();
|
|
|
|
switch( nResult )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-12-14 16:02:51 +00:00
|
|
|
case RET_CANCEL:
|
|
|
|
{
|
|
|
|
delete pDlg;
|
|
|
|
delete pZoomItem;
|
|
|
|
rReq.Ignore ();
|
|
|
|
return; // Abbruch
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
rReq.Ignore ();
|
|
|
|
/*
|
|
|
|
rReq.Done( *( pDlg->GetOutputItemSet() ) );
|
|
|
|
pArgs = rReq.GetArgs();*/
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2005-12-14 16:02:51 +00:00
|
|
|
const SfxItemSet aArgs (*(pDlg->GetOutputItemSet ()));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-12-14 16:02:51 +00:00
|
|
|
delete pDlg;
|
2004-02-04 09:11:21 +00:00
|
|
|
|
2005-12-14 16:02:51 +00:00
|
|
|
// SvxZoomType eZT = ((const SvxZoomItem &) aArgs.Get (RID_SVXDLG_ZOOM)).GetType ();
|
|
|
|
switch (((const SvxZoomItem &) aArgs.Get (RID_SVXDLG_ZOOM)).GetType ())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-12-14 16:02:51 +00:00
|
|
|
case SVX_ZOOM_PERCENT:
|
|
|
|
{
|
|
|
|
nValue = ((const SvxZoomItem &) aArgs.Get (RID_SVXDLG_ZOOM)).GetValue ();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-12-14 16:02:51 +00:00
|
|
|
pViewShell->SetZoom( nValue );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-12-14 16:02:51 +00:00
|
|
|
pViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom );
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-12-14 16:02:51 +00:00
|
|
|
case SVX_ZOOM_OPTIMAL:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-12-14 16:02:51 +00:00
|
|
|
if( pViewShell->ISA( DrawViewShell ) )
|
|
|
|
{
|
|
|
|
// Namensverwirrung: SID_SIZE_ALL -> Zoom auf alle Objekte
|
|
|
|
// --> Wird als Optimal im Programm angeboten
|
|
|
|
pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
|
|
|
}
|
|
|
|
else if( pViewShell->ISA( SlideViewShell ) )
|
|
|
|
pViewShell->SetZoom( 20 );
|
|
|
|
// Hier sollte sich noch etwas besseres ueberlegt werden !!!
|
|
|
|
// ???!!
|
|
|
|
/*
|
|
|
|
aNewAttr.Put( SvxZoomItem( SVX_ZOOM_PERCENT, 20 ) );
|
|
|
|
rReq.Done( aNewAttr );
|
|
|
|
pArgs = rReq.GetArgs();
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-12-14 16:02:51 +00:00
|
|
|
case SVX_ZOOM_PAGEWIDTH:
|
|
|
|
pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SVX_ZOOM_WHOLEPAGE:
|
|
|
|
pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2005-12-14 16:02:51 +00:00
|
|
|
|
|
|
|
delete pZoomItem;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2005-12-14 16:02:51 +00:00
|
|
|
else if(pViewShell && (pArgs->Count () == 1))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, FALSE);
|
|
|
|
pViewShell->SetZoom (pScale->GetValue ());
|
|
|
|
|
2000-09-21 15:12:50 +00:00
|
|
|
pViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-01-20 10:11:41 +00:00
|
|
|
} // end of namespace sd
|