1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <sfx2/objface.hxx> 32*cdf0e10cSrcweir #include <vcl/timer.hxx> 33*cdf0e10cSrcweir #include <vcl/field.hxx> 34*cdf0e10cSrcweir #include <vcl/fixed.hxx> 35*cdf0e10cSrcweir #include <vcl/help.hxx> 36*cdf0e10cSrcweir #include <vcl/cmdevt.hxx> 37*cdf0e10cSrcweir #include <vcl/button.hxx> 38*cdf0e10cSrcweir #include <svl/whiter.hxx> 39*cdf0e10cSrcweir #include <svl/stritem.hxx> 40*cdf0e10cSrcweir #include <svl/eitem.hxx> 41*cdf0e10cSrcweir #include <sfx2/printer.hxx> 42*cdf0e10cSrcweir #include <sfx2/progress.hxx> 43*cdf0e10cSrcweir #include <sfx2/app.hxx> 44*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 45*cdf0e10cSrcweir #include <sfx2/request.hxx> 46*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 47*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 48*cdf0e10cSrcweir #include <svx/stddlg.hxx> 49*cdf0e10cSrcweir #include <editeng/paperinf.hxx> 50*cdf0e10cSrcweir #include <svl/srchitem.hxx> 51*cdf0e10cSrcweir #include <svx/svdview.hxx> 52*cdf0e10cSrcweir #include <svx/dlgutil.hxx> 53*cdf0e10cSrcweir #include <svx/zoomslideritem.hxx> 54*cdf0e10cSrcweir #include <svx/svxids.hrc> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir #include <swwait.hxx> 57*cdf0e10cSrcweir #include <globdoc.hxx> 58*cdf0e10cSrcweir #include <wdocsh.hxx> 59*cdf0e10cSrcweir #include <pvprtdat.hxx> 60*cdf0e10cSrcweir #include <swmodule.hxx> 61*cdf0e10cSrcweir #include <modcfg.hxx> 62*cdf0e10cSrcweir #include <wrtsh.hxx> 63*cdf0e10cSrcweir #include <docsh.hxx> 64*cdf0e10cSrcweir #include <viewopt.hxx> 65*cdf0e10cSrcweir #include <doc.hxx> 66*cdf0e10cSrcweir #include <pview.hxx> 67*cdf0e10cSrcweir #include <view.hxx> 68*cdf0e10cSrcweir #include <textsh.hxx> 69*cdf0e10cSrcweir #include <scroll.hxx> 70*cdf0e10cSrcweir #include <prtopt.hxx> 71*cdf0e10cSrcweir #include <docstat.hxx> 72*cdf0e10cSrcweir #include <usrpref.hxx> 73*cdf0e10cSrcweir #include <viewfunc.hxx> 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir #include <helpid.h> 76*cdf0e10cSrcweir #include <cmdid.h> 77*cdf0e10cSrcweir #include <globals.hrc> 78*cdf0e10cSrcweir #include <popup.hrc> 79*cdf0e10cSrcweir #include <pview.hrc> 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir #define SwPagePreView 82*cdf0e10cSrcweir #include <sfx2/msg.hxx> 83*cdf0e10cSrcweir #include <swslots.hxx> 84*cdf0e10cSrcweir // OD 12.12.2002 #103492# 85*cdf0e10cSrcweir #include <pagepreviewlayout.hxx> 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 88*cdf0e10cSrcweir #include <svx/dialogs.hrc> 89*cdf0e10cSrcweir #include <vos/mutex.hxx> 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir using namespace ::com::sun::star; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir SFX_IMPL_NAMED_VIEWFACTORY(SwPagePreView, "PrintPreview") 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir SFX_VIEW_REGISTRATION(SwDocShell); 97*cdf0e10cSrcweir SFX_VIEW_REGISTRATION(SwWebDocShell); 98*cdf0e10cSrcweir SFX_VIEW_REGISTRATION(SwGlobalDocShell); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwPagePreView, SfxViewShell, SW_RES(RID_PVIEW_TOOLBOX)) 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir SFX_POPUPMENU_REGISTRATION(SW_RES(MN_PPREVIEW_POPUPMENU)); 104*cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT|SFX_VISIBILITY_STANDARD| 105*cdf0e10cSrcweir SFX_VISIBILITY_CLIENT|SFX_VISIBILITY_FULLSCREEN| 106*cdf0e10cSrcweir SFX_VISIBILITY_READONLYDOC, 107*cdf0e10cSrcweir SW_RES(RID_PVIEW_TOOLBOX)); 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir TYPEINIT1(SwPagePreView,SfxViewShell) 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir #define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS ) 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir #define MIN_PREVIEW_ZOOM 25 116*cdf0e10cSrcweir #define MAX_PREVIEW_ZOOM 600 117*cdf0e10cSrcweir /* */ 118*cdf0e10cSrcweir /* -----------------26.11.2002 10:41----------------- 119*cdf0e10cSrcweir * 120*cdf0e10cSrcweir * --------------------------------------------------*/ 121*cdf0e10cSrcweir sal_uInt16 lcl_GetNextZoomStep(sal_uInt16 nCurrentZoom, sal_Bool bZoomIn) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir static sal_uInt16 aZoomArr[] = 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir 25, 50, 75, 100, 150, 200, 400, 600 126*cdf0e10cSrcweir }; 127*cdf0e10cSrcweir const sal_uInt16 nZoomArrSize = sizeof(aZoomArr)/sizeof(sal_uInt16); 128*cdf0e10cSrcweir if(bZoomIn) 129*cdf0e10cSrcweir for(int i = nZoomArrSize - 1; i >= 0; --i) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir if(nCurrentZoom > aZoomArr[i] || !i) 132*cdf0e10cSrcweir return aZoomArr[i]; 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir else 135*cdf0e10cSrcweir for(int i = 0; i < nZoomArrSize; ++i) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir if(nCurrentZoom < aZoomArr[i]) 138*cdf0e10cSrcweir return aZoomArr[i]; 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir return bZoomIn ? MAX_PREVIEW_ZOOM : MIN_PREVIEW_ZOOM; 141*cdf0e10cSrcweir }; 142*cdf0e10cSrcweir /* -----------------02.12.2002 09:11----------------- 143*cdf0e10cSrcweir * 144*cdf0e10cSrcweir * --------------------------------------------------*/ 145*cdf0e10cSrcweir void lcl_InvalidateZoomSlots(SfxBindings& rBindings) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir SID_ATTR_ZOOM, SID_ZOOM_OUT, SID_ZOOM_IN, SID_ATTR_ZOOMSLIDER, FN_PREVIEW_ZOOM, FN_STAT_ZOOM, 150*cdf0e10cSrcweir 0 151*cdf0e10cSrcweir }; 152*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir /*-------------------------------------------------------------------- 155*cdf0e10cSrcweir Beschreibung: 156*cdf0e10cSrcweir --------------------------------------------------------------------*/ 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir // erstmal der Zoom-Dialog 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir class SwPreViewZoomDlg : public SvxStandardDialog 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir FixedText aRowLbl; 163*cdf0e10cSrcweir NumericField aRowEdit; 164*cdf0e10cSrcweir FixedText aColLbl; 165*cdf0e10cSrcweir NumericField aColEdit; 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir OKButton aOkBtn; 168*cdf0e10cSrcweir CancelButton aCancelBtn; 169*cdf0e10cSrcweir HelpButton aHelpBtn; 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir virtual void Apply(); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir public: 174*cdf0e10cSrcweir SwPreViewZoomDlg( SwPagePreViewWin& rParent ); 175*cdf0e10cSrcweir ~SwPreViewZoomDlg(); 176*cdf0e10cSrcweir }; 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir /*-------------------------------------------------------------------- 179*cdf0e10cSrcweir Beschreibung: 180*cdf0e10cSrcweir --------------------------------------------------------------------*/ 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir SwPreViewZoomDlg::SwPreViewZoomDlg( SwPagePreViewWin& rParent ) : 184*cdf0e10cSrcweir SvxStandardDialog( &rParent, SW_RES(DLG_PAGEPREVIEW_ZOOM) ), 185*cdf0e10cSrcweir aRowLbl(this,SW_RES(FT_ROW)), 186*cdf0e10cSrcweir aRowEdit(this,SW_RES(ED_ROW)), 187*cdf0e10cSrcweir aColLbl(this,SW_RES(FT_COL)), 188*cdf0e10cSrcweir aColEdit(this,SW_RES(ED_COL)), 189*cdf0e10cSrcweir aOkBtn(this,SW_RES(BT_OK)), 190*cdf0e10cSrcweir aCancelBtn(this,SW_RES(BT_CANCEL)), 191*cdf0e10cSrcweir aHelpBtn(this,SW_RES(BT_HELP)) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir FreeResource(); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir aRowEdit.SetValue( rParent.GetRow() ); 196*cdf0e10cSrcweir aColEdit.SetValue( rParent.GetCol() ); 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir /*-------------------------------------------------------------------- 200*cdf0e10cSrcweir Beschreibung: 201*cdf0e10cSrcweir --------------------------------------------------------------------*/ 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir SwPreViewZoomDlg::~SwPreViewZoomDlg() {} 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir void SwPreViewZoomDlg::Apply() 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir ((SwPagePreViewWin*)GetParent())->CalcWish( 209*cdf0e10cSrcweir sal_uInt8(aRowEdit.GetValue()), 210*cdf0e10cSrcweir sal_uInt8(aColEdit.GetValue()) ); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir /*-------------------------------------------------------------------- 214*cdf0e10cSrcweir Beschreibung: 215*cdf0e10cSrcweir --------------------------------------------------------------------*/ 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir // alles fuers SwPagePreViewWin 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir SwPagePreViewWin::SwPagePreViewWin( Window *pParent, SwPagePreView& rPView ) 221*cdf0e10cSrcweir : Window( pParent, WinBits( WB_CLIPCHILDREN) ), 222*cdf0e10cSrcweir mpViewShell( 0 ), 223*cdf0e10cSrcweir mrView( rPView ), 224*cdf0e10cSrcweir mbCalcScaleForPreviewLayout( true ), 225*cdf0e10cSrcweir maPaintedPreviewDocRect( Rectangle(0,0,0,0) ) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir SetOutDevViewType( OUTDEV_VIEWTYPE_PRINTPREVIEW ); //#106611# 228*cdf0e10cSrcweir SetHelpId(HID_PAGEPREVIEW); 229*cdf0e10cSrcweir SetFillColor( GetBackground().GetColor() ); 230*cdf0e10cSrcweir SetLineColor( GetBackground().GetColor()); 231*cdf0e10cSrcweir SetMapMode( MapMode(MAP_TWIP) ); 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(sal_False); 234*cdf0e10cSrcweir mnRow = pUsrPref->GetPagePrevRow(); // 1 Zeile 235*cdf0e10cSrcweir mnCol = pUsrPref->GetPagePrevCol(); // 1 Spalte 236*cdf0e10cSrcweir // OD 24.03.2003 #108282# - member <mnVirtPage> no longer exists. 237*cdf0e10cSrcweir mnSttPage = USHRT_MAX; 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir /*-------------------------------------------------------------------- 241*cdf0e10cSrcweir Beschreibung: 242*cdf0e10cSrcweir --------------------------------------------------------------------*/ 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir SwPagePreViewWin::~SwPagePreViewWin() 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir if( mpViewShell ) 248*cdf0e10cSrcweir delete mpViewShell; 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir /*-------------------------------------------------------------------- 252*cdf0e10cSrcweir Beschreibung: 253*cdf0e10cSrcweir --------------------------------------------------------------------*/ 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir void SwPagePreViewWin::Paint( const Rectangle& rRect ) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir if( !mpViewShell || !mpViewShell->GetLayout() ) 259*cdf0e10cSrcweir return; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir if( USHRT_MAX == mnSttPage ) // wurde noch nie berechnet ? (Init-Phase!) 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir // das ist die Size, auf die ich mich immer beziehe 264*cdf0e10cSrcweir if( !maPxWinSize.Height() || !maPxWinSize.Width() ) 265*cdf0e10cSrcweir maPxWinSize = GetOutputSizePixel(); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir Rectangle aRect( LogicToPixel( rRect )); 268*cdf0e10cSrcweir mpPgPrevwLayout->Prepare( 1, Point(0,0), maPxWinSize, 269*cdf0e10cSrcweir mnSttPage, maPaintedPreviewDocRect ); 270*cdf0e10cSrcweir SetSelectedPage( 1 ); 271*cdf0e10cSrcweir mpPgPrevwLayout->Paint( PixelToLogic( aRect ) ); 272*cdf0e10cSrcweir SetPagePreview(mnRow, mnCol); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir else 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir MapMode aMM( GetMapMode() ); 277*cdf0e10cSrcweir aMM.SetScaleX( maScale ); 278*cdf0e10cSrcweir aMM.SetScaleY( maScale ); 279*cdf0e10cSrcweir SetMapMode( aMM ); 280*cdf0e10cSrcweir mpPgPrevwLayout->Paint( rRect ); 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir /*-------------------------------------------------------------------- 285*cdf0e10cSrcweir Beschreibung: 286*cdf0e10cSrcweir --------------------------------------------------------------------*/ 287*cdf0e10cSrcweir void SwPagePreViewWin::CalcWish( sal_uInt8 nNewRow, sal_uInt8 nNewCol ) 288*cdf0e10cSrcweir { 289*cdf0e10cSrcweir if( !mpViewShell || !mpViewShell->GetLayout() ) 290*cdf0e10cSrcweir return; 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir sal_uInt16 nOldCol = mnCol; 293*cdf0e10cSrcweir // OD 02.12.2002 #103492# - update <mnRow> and <mnCol>. 294*cdf0e10cSrcweir mnRow = nNewRow; 295*cdf0e10cSrcweir mnCol = nNewCol; 296*cdf0e10cSrcweir sal_uInt16 nPages = mnRow * mnCol, 297*cdf0e10cSrcweir nLastSttPg = mrView.GetPageCount()+1 > nPages 298*cdf0e10cSrcweir ? mrView.GetPageCount()+1 - nPages : 0; 299*cdf0e10cSrcweir if( mnSttPage > nLastSttPg ) 300*cdf0e10cSrcweir mnSttPage = nLastSttPg; 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir mpPgPrevwLayout->Init( mnCol, mnRow, maPxWinSize, true ); 303*cdf0e10cSrcweir mpPgPrevwLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize, 304*cdf0e10cSrcweir mnSttPage, maPaintedPreviewDocRect ); 305*cdf0e10cSrcweir SetSelectedPage( mnSttPage ); 306*cdf0e10cSrcweir SetPagePreview(mnRow, mnCol); 307*cdf0e10cSrcweir maScale = GetMapMode().GetScaleX(); 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir // falls an der Spaltigkeit gedreht wurde, so muss der Sonderfall 310*cdf0e10cSrcweir // Einspaltig beachtet und ggfs. der Scrollbar korrigiert werden 311*cdf0e10cSrcweir if( (1 == nOldCol) ^ (1 == mnCol) ) 312*cdf0e10cSrcweir mrView.ScrollDocSzChg(); 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir // Sortierung muss eingehalten werden!! 315*cdf0e10cSrcweir // OD 24.03.2003 #108282# - additional invalidate page status. 316*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir SID_ATTR_ZOOM, SID_ZOOM_OUT, SID_ZOOM_IN, 319*cdf0e10cSrcweir FN_PREVIEW_ZOOM, 320*cdf0e10cSrcweir FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN, 321*cdf0e10cSrcweir FN_STAT_PAGE, FN_STAT_ZOOM, 322*cdf0e10cSrcweir FN_SHOW_TWO_PAGES, FN_SHOW_MULTIPLE_PAGES, 323*cdf0e10cSrcweir 0 324*cdf0e10cSrcweir }; 325*cdf0e10cSrcweir SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings(); 326*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 327*cdf0e10cSrcweir rBindings.Update( FN_SHOW_TWO_PAGES ); 328*cdf0e10cSrcweir rBindings.Update( FN_SHOW_MULTIPLE_PAGES ); 329*cdf0e10cSrcweir // OD 18.12.2002 #103492# - adjust scrollbars 330*cdf0e10cSrcweir mrView.ScrollViewSzChg(); 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir /*-------------------------------------------------------------------- 333*cdf0e10cSrcweir Beschreibung:, mnSttPage is Absolute 334*cdf0e10cSrcweir --------------------------------------------------------------------*/ 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir int SwPagePreViewWin::MovePage( int eMoveMode ) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir // soviele Seiten hoch 340*cdf0e10cSrcweir sal_uInt16 nPages = mnRow * mnCol; 341*cdf0e10cSrcweir sal_uInt16 nNewSttPage = mnSttPage; 342*cdf0e10cSrcweir // OD 04.12.2002 #103492# 343*cdf0e10cSrcweir sal_uInt16 nPageCount = mrView.GetPageCount(); 344*cdf0e10cSrcweir sal_uInt16 nDefSttPg = GetDefSttPage(); 345*cdf0e10cSrcweir // OD 06.12.2002 #103492# 346*cdf0e10cSrcweir bool bPaintPageAtFirstCol = true; 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir switch( eMoveMode ) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir case MV_PAGE_UP: 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir const sal_uInt16 nRelSttPage = mpPgPrevwLayout->ConvertAbsoluteToRelativePageNum( mnSttPage ); 353*cdf0e10cSrcweir const sal_uInt16 nNewAbsSttPage = nRelSttPage - nPages > 0 ? 354*cdf0e10cSrcweir mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nRelSttPage - nPages ) : 355*cdf0e10cSrcweir nDefSttPg; 356*cdf0e10cSrcweir nNewSttPage = nNewAbsSttPage; 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir const sal_uInt16 nRelSelPage = mpPgPrevwLayout->ConvertAbsoluteToRelativePageNum( SelectedPage() ); 359*cdf0e10cSrcweir const sal_uInt16 nNewRelSelPage = nRelSelPage - nPages > 0 ? 360*cdf0e10cSrcweir nRelSelPage - nPages : 361*cdf0e10cSrcweir 1; 362*cdf0e10cSrcweir SetSelectedPage( mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nNewRelSelPage ) ); 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir break; 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir case MV_PAGE_DOWN: 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir const sal_uInt16 nRelSttPage = mpPgPrevwLayout->ConvertAbsoluteToRelativePageNum( mnSttPage ); 369*cdf0e10cSrcweir const sal_uInt16 nNewAbsSttPage = mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nRelSttPage + nPages ); 370*cdf0e10cSrcweir nNewSttPage = nNewAbsSttPage < nPageCount ? nNewAbsSttPage : nPageCount; 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir const sal_uInt16 nRelSelPage = mpPgPrevwLayout->ConvertAbsoluteToRelativePageNum( SelectedPage() ); 373*cdf0e10cSrcweir const sal_uInt16 nNewAbsSelPage = mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nRelSelPage + nPages ); 374*cdf0e10cSrcweir SetSelectedPage( nNewAbsSelPage < nPageCount ? nNewAbsSelPage : nPageCount ); 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir break; 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir case MV_DOC_STT: 379*cdf0e10cSrcweir nNewSttPage = nDefSttPg; 380*cdf0e10cSrcweir SetSelectedPage( mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nNewSttPage ? nNewSttPage : 1 ) ); 381*cdf0e10cSrcweir break; 382*cdf0e10cSrcweir case MV_DOC_END: 383*cdf0e10cSrcweir // OD 03.12.2002 #103492# - correct calculation of new start page. 384*cdf0e10cSrcweir nNewSttPage = nPageCount; 385*cdf0e10cSrcweir SetSelectedPage( nPageCount ); 386*cdf0e10cSrcweir break; 387*cdf0e10cSrcweir // OD 12.12.2002 #103492# - add new move mode 388*cdf0e10cSrcweir case MV_SELPAGE: 389*cdf0e10cSrcweir // <nNewSttPage> and <SelectedPage()> are already set. 390*cdf0e10cSrcweir // OD 20.02.2003 #107369# - not start at first column, only if the 391*cdf0e10cSrcweir // complete preview layout columns doesn't fit into window. 392*cdf0e10cSrcweir if ( !mpPgPrevwLayout->DoesPreviewLayoutColsFitIntoWindow() ) 393*cdf0e10cSrcweir bPaintPageAtFirstCol = false; 394*cdf0e10cSrcweir break; 395*cdf0e10cSrcweir case MV_SCROLL: 396*cdf0e10cSrcweir // OD 17.01.2003 #103492# - check, if paint page at first column 397*cdf0e10cSrcweir // has to be avoided 398*cdf0e10cSrcweir if ( !mpPgPrevwLayout->DoesPreviewLayoutRowsFitIntoWindow() || 399*cdf0e10cSrcweir !mpPgPrevwLayout->DoesPreviewLayoutColsFitIntoWindow() ) 400*cdf0e10cSrcweir bPaintPageAtFirstCol = false; 401*cdf0e10cSrcweir break; 402*cdf0e10cSrcweir case MV_NEWWINSIZE: 403*cdf0e10cSrcweir // OD 18.12.2002 #103492# - nothing special to do. 404*cdf0e10cSrcweir break; 405*cdf0e10cSrcweir case MV_CALC: 406*cdf0e10cSrcweir // OD 18.12.2002 #103492# - re-init page preview layout. 407*cdf0e10cSrcweir mpPgPrevwLayout->ReInit(); 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir // OD 03.12.2002 #103492# - correct calculation of new start page. 410*cdf0e10cSrcweir if( nNewSttPage > nPageCount ) 411*cdf0e10cSrcweir nNewSttPage = nPageCount; 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir // OD 18.12.2002 #103492# - correct selected page number 414*cdf0e10cSrcweir if( SelectedPage() > nPageCount ) 415*cdf0e10cSrcweir SetSelectedPage( nNewSttPage ? nNewSttPage : 1 ); 416*cdf0e10cSrcweir } 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir mpPgPrevwLayout->Prepare( nNewSttPage, Point(0,0), maPxWinSize, 419*cdf0e10cSrcweir nNewSttPage, 420*cdf0e10cSrcweir maPaintedPreviewDocRect, bPaintPageAtFirstCol ); 421*cdf0e10cSrcweir if( nNewSttPage == mnSttPage && 422*cdf0e10cSrcweir eMoveMode != MV_SELPAGE ) 423*cdf0e10cSrcweir return sal_False; 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir SetPagePreview(mnRow, mnCol); 426*cdf0e10cSrcweir mnSttPage = nNewSttPage; 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir // OD 24.03.2003 #108282# - additional invalidate page status. 429*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN, 432*cdf0e10cSrcweir FN_STAT_PAGE, 0 433*cdf0e10cSrcweir }; 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings(); 436*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir return sal_True; 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir /*-------------------------------------------------------------------- 442*cdf0e10cSrcweir Beschreibung: 443*cdf0e10cSrcweir --------------------------------------------------------------------*/ 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir void SwPagePreViewWin::SetWinSize( const Size& rNewSize ) 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir // die Size wollen wir aber immer in Pixel-Einheiten haben 449*cdf0e10cSrcweir maPxWinSize = LogicToPixel( rNewSize ); 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir if( USHRT_MAX == mnSttPage ) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir mnSttPage = GetDefSttPage(); 454*cdf0e10cSrcweir SetSelectedPage( GetDefSttPage() ); 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir if ( mbCalcScaleForPreviewLayout ) 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir mpPgPrevwLayout->Init( mnCol, mnRow, maPxWinSize, true ); 460*cdf0e10cSrcweir maScale = GetMapMode().GetScaleX(); 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir mpPgPrevwLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize, 463*cdf0e10cSrcweir mnSttPage, maPaintedPreviewDocRect ); 464*cdf0e10cSrcweir if ( mbCalcScaleForPreviewLayout ) 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir SetSelectedPage( mnSttPage ); 467*cdf0e10cSrcweir mbCalcScaleForPreviewLayout = false; 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir SetPagePreview(mnRow, mnCol); 470*cdf0e10cSrcweir maScale = GetMapMode().GetScaleX(); 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir /*-------------------------------------------------------------------- 475*cdf0e10cSrcweir Beschreibung: 476*cdf0e10cSrcweir --------------------------------------------------------------------*/ 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir void SwPagePreViewWin::GetStatusStr( String& rStr, sal_uInt16 nPageCnt ) const 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir // OD 24.03.2003 #108282# - show physical and virtual page number of 482*cdf0e10cSrcweir // selected page, if it's visible. 483*cdf0e10cSrcweir sal_uInt16 nPageNum; 484*cdf0e10cSrcweir if ( mpPgPrevwLayout->IsPageVisible( mpPgPrevwLayout->SelectedPage() ) ) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir nPageNum = mpPgPrevwLayout->SelectedPage(); 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir else 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir nPageNum = mnSttPage > 1 ? mnSttPage : 1; 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir sal_uInt16 nVirtPageNum = mpPgPrevwLayout->GetVirtPageNumByPageNum( nPageNum ); 493*cdf0e10cSrcweir if( nVirtPageNum && nVirtPageNum != nPageNum ) 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir rStr += String::CreateFromInt32( nVirtPageNum ); 496*cdf0e10cSrcweir rStr += ' '; 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir rStr += String::CreateFromInt32( nPageNum ); 499*cdf0e10cSrcweir rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" / ")); 500*cdf0e10cSrcweir rStr += String::CreateFromInt32( nPageCnt ); 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir /*-------------------------------------------------------------------- 504*cdf0e10cSrcweir Beschreibung: 505*cdf0e10cSrcweir --------------------------------------------------------------------*/ 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir void SwPagePreViewWin::KeyInput( const KeyEvent &rKEvt ) 509*cdf0e10cSrcweir { 510*cdf0e10cSrcweir const KeyCode& rKeyCode = rKEvt.GetKeyCode(); 511*cdf0e10cSrcweir sal_uInt16 nKey = rKeyCode.GetCode(); 512*cdf0e10cSrcweir sal_Bool bHandled = sal_False; 513*cdf0e10cSrcweir if(!rKeyCode.GetModifier()) 514*cdf0e10cSrcweir { 515*cdf0e10cSrcweir sal_uInt16 nSlot = 0; 516*cdf0e10cSrcweir switch(nKey) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir case KEY_ADD : nSlot = SID_ZOOM_OUT; break; 519*cdf0e10cSrcweir case KEY_ESCAPE: nSlot = FN_CLOSE_PAGEPREVIEW; break; 520*cdf0e10cSrcweir case KEY_SUBTRACT : nSlot = SID_ZOOM_IN; break; 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir if(nSlot) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir bHandled = sal_True; 525*cdf0e10cSrcweir mrView.GetViewFrame()->GetDispatcher()->Execute( 526*cdf0e10cSrcweir nSlot, SFX_CALLMODE_ASYNCHRON ); 527*cdf0e10cSrcweir } 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir if( !bHandled && !mrView.KeyInput( rKEvt ) ) 530*cdf0e10cSrcweir Window::KeyInput( rKEvt ); 531*cdf0e10cSrcweir } 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir /****************************************************************************** 534*cdf0e10cSrcweir * Beschreibung: 535*cdf0e10cSrcweir ******************************************************************************/ 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir void SwPagePreViewWin::Command( const CommandEvent& rCEvt ) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir sal_Bool bCallBase = sal_True; 540*cdf0e10cSrcweir switch( rCEvt.GetCommand() ) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir case COMMAND_CONTEXTMENU: 543*cdf0e10cSrcweir mrView.GetViewFrame()->GetDispatcher()->ExecutePopup(); 544*cdf0e10cSrcweir bCallBase = sal_False; 545*cdf0e10cSrcweir break; 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir case COMMAND_WHEEL: 548*cdf0e10cSrcweir case COMMAND_STARTAUTOSCROLL: 549*cdf0e10cSrcweir case COMMAND_AUTOSCROLL: 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir const CommandWheelData* pData = rCEvt.GetWheelData(); 552*cdf0e10cSrcweir if( pData ) 553*cdf0e10cSrcweir { 554*cdf0e10cSrcweir const CommandWheelData aDataNew(pData->GetDelta(),pData->GetNotchDelta(),COMMAND_WHEEL_PAGESCROLL, 555*cdf0e10cSrcweir pData->GetMode(),pData->GetModifier(),pData->IsHorz(), pData->IsDeltaPixel()); 556*cdf0e10cSrcweir const CommandEvent aEvent( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(),rCEvt.IsMouseEvent(),&aDataNew); 557*cdf0e10cSrcweir bCallBase = !mrView.HandleWheelCommands( aEvent ); 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir else 560*cdf0e10cSrcweir bCallBase = !mrView.HandleWheelCommands( rCEvt ); 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir break; 563*cdf0e10cSrcweir default: 564*cdf0e10cSrcweir // OD 17.12.2002 #103492# - delete assertion 565*cdf0e10cSrcweir ; 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir if( bCallBase ) 569*cdf0e10cSrcweir Window::Command( rCEvt ); 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir void SwPagePreViewWin::MouseButtonDown( const MouseEvent& rMEvt ) 573*cdf0e10cSrcweir { 574*cdf0e10cSrcweir // OD 17.12.2002 #103492# - consider single-click to set selected page 575*cdf0e10cSrcweir if( MOUSE_LEFT == ( rMEvt.GetModifier() + rMEvt.GetButtons() ) ) 576*cdf0e10cSrcweir { 577*cdf0e10cSrcweir Point aPrevwPos( PixelToLogic( rMEvt.GetPosPixel() ) ); 578*cdf0e10cSrcweir Point aDocPos; 579*cdf0e10cSrcweir bool bPosInEmptyPage; 580*cdf0e10cSrcweir sal_uInt16 nNewSelectedPage; 581*cdf0e10cSrcweir bool bIsDocPos = 582*cdf0e10cSrcweir mpPgPrevwLayout->IsPrevwPosInDocPrevwPage( aPrevwPos, 583*cdf0e10cSrcweir aDocPos, bPosInEmptyPage, nNewSelectedPage ); 584*cdf0e10cSrcweir if ( bIsDocPos && rMEvt.GetClicks() == 2 ) 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir // close page preview, set new cursor position and switch to 587*cdf0e10cSrcweir // normal view. 588*cdf0e10cSrcweir String sNewCrsrPos( String::CreateFromInt32( aDocPos.X() )); 589*cdf0e10cSrcweir ((( sNewCrsrPos += ';' ) 590*cdf0e10cSrcweir += String::CreateFromInt32( aDocPos.Y() )) ) 591*cdf0e10cSrcweir += ';'; 592*cdf0e10cSrcweir mrView.SetNewCrsrPos( sNewCrsrPos ); 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir SfxViewFrame *pTmpFrm = mrView.GetViewFrame(); 595*cdf0e10cSrcweir pTmpFrm->GetBindings().Execute( SID_VIEWSHELL0, NULL, 0, 596*cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON ); 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir else if ( bIsDocPos || bPosInEmptyPage ) 599*cdf0e10cSrcweir // OD 2004-03-04 #i20684# - add missing parenthesis 600*cdf0e10cSrcweir { 601*cdf0e10cSrcweir // show clicked page as the selected one 602*cdf0e10cSrcweir mpPgPrevwLayout->MarkNewSelectedPage( nNewSelectedPage ); 603*cdf0e10cSrcweir GetViewShell()->ShowPreViewSelection( nNewSelectedPage ); 604*cdf0e10cSrcweir // OD 19.02.2003 #107369# - adjust position at vertical scrollbar. 605*cdf0e10cSrcweir if ( mpPgPrevwLayout->DoesPreviewLayoutRowsFitIntoWindow() ) 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir mrView.SetVScrollbarThumbPos( nNewSelectedPage ); 608*cdf0e10cSrcweir } 609*cdf0e10cSrcweir // OD 24.03.2003 #108282# - invalidate page status. 610*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 611*cdf0e10cSrcweir { 612*cdf0e10cSrcweir FN_STAT_PAGE, 0 613*cdf0e10cSrcweir }; 614*cdf0e10cSrcweir SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings(); 615*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir } 618*cdf0e10cSrcweir } 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir /****************************************************************************** 621*cdf0e10cSrcweir * Beschreibung: Userprefs bzw Viewoptions setzen 622*cdf0e10cSrcweir ******************************************************************************/ 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir void SwPagePreViewWin::SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol ) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir SwMasterUsrPref *pOpt = (SwMasterUsrPref *)SW_MOD()->GetUsrPref(sal_False); 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir if (nRow != pOpt->GetPagePrevRow() || nCol != pOpt->GetPagePrevCol()) 630*cdf0e10cSrcweir { 631*cdf0e10cSrcweir pOpt->SetPagePrevRow( nRow ); 632*cdf0e10cSrcweir pOpt->SetPagePrevCol( nCol ); 633*cdf0e10cSrcweir pOpt->SetModified(); 634*cdf0e10cSrcweir 635*cdf0e10cSrcweir //Scrollbar updaten! 636*cdf0e10cSrcweir mrView.ScrollViewSzChg(); 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir /** get selected page in document preview 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir OD 13.12.2002 #103492# 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir @author OD 645*cdf0e10cSrcweir */ 646*cdf0e10cSrcweir sal_uInt16 SwPagePreViewWin::SelectedPage() const 647*cdf0e10cSrcweir { 648*cdf0e10cSrcweir return mpPgPrevwLayout->SelectedPage(); 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir /** set selected page number in document preview 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir OD 13.12.2002 #103492# 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir @author OD 656*cdf0e10cSrcweir */ 657*cdf0e10cSrcweir void SwPagePreViewWin::SetSelectedPage( sal_uInt16 _nSelectedPageNum ) 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir mpPgPrevwLayout->SetSelectedPage( _nSelectedPageNum ); 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir /** method to enable/disable book preview 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir OD 2004-03-05 #i18143# 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir @author OD 667*cdf0e10cSrcweir */ 668*cdf0e10cSrcweir bool SwPagePreViewWin::SetBookPreviewMode( const bool _bBookPreview ) 669*cdf0e10cSrcweir { 670*cdf0e10cSrcweir return mpPgPrevwLayout->SetBookPreviewMode( _bBookPreview, 671*cdf0e10cSrcweir mnSttPage, 672*cdf0e10cSrcweir maPaintedPreviewDocRect ); 673*cdf0e10cSrcweir } 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir void SwPagePreViewWin::DataChanged( const DataChangedEvent& rDCEvt ) 676*cdf0e10cSrcweir { 677*cdf0e10cSrcweir Window::DataChanged( rDCEvt ); 678*cdf0e10cSrcweir 679*cdf0e10cSrcweir switch( rDCEvt.GetType() ) 680*cdf0e10cSrcweir { 681*cdf0e10cSrcweir case DATACHANGED_SETTINGS: 682*cdf0e10cSrcweir // ScrollBars neu anordnen bzw. Resize ausloesen, da sich 683*cdf0e10cSrcweir // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im 684*cdf0e10cSrcweir // Resize-Handler aber auch die Groesse der ScrollBars aus 685*cdf0e10cSrcweir // den Settings abgefragt werden. 686*cdf0e10cSrcweir if( rDCEvt.GetFlags() & SETTINGS_STYLE ) 687*cdf0e10cSrcweir mrView.InvalidateBorder(); //Scrollbarbreiten 688*cdf0e10cSrcweir //#106746# zoom has to be disabled if Accessibility support is switched on 689*cdf0e10cSrcweir lcl_InvalidateZoomSlots(mrView.GetViewFrame()->GetBindings()); 690*cdf0e10cSrcweir break; 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir case DATACHANGED_PRINTER: 693*cdf0e10cSrcweir case DATACHANGED_DISPLAY: 694*cdf0e10cSrcweir case DATACHANGED_FONTS: 695*cdf0e10cSrcweir case DATACHANGED_FONTSUBSTITUTION: 696*cdf0e10cSrcweir mrView.GetDocShell()->UpdateFontList(); //Fontwechsel 697*cdf0e10cSrcweir if ( mpViewShell->GetWin() ) 698*cdf0e10cSrcweir mpViewShell->GetWin()->Invalidate(); 699*cdf0e10cSrcweir break; 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir /** help method to execute SfxRequest FN_PAGEUP and FN_PAGEDOWN 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir OD 04.03.2003 #107369# 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir @author OD 708*cdf0e10cSrcweir */ 709*cdf0e10cSrcweir void SwPagePreView::_ExecPgUpAndPgDown( const bool _bPgUp, 710*cdf0e10cSrcweir SfxRequest* _pReq ) 711*cdf0e10cSrcweir { 712*cdf0e10cSrcweir SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout(); 713*cdf0e10cSrcweir // check, if top/bottom of preview is *not* already visible. 714*cdf0e10cSrcweir if( pPagePrevwLay->GetWinPagesScrollAmount( _bPgUp ? -1 : 1 ) != 0 ) 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir if ( pPagePrevwLay->DoesPreviewLayoutRowsFitIntoWindow() && 717*cdf0e10cSrcweir pPagePrevwLay->DoesPreviewLayoutColsFitIntoWindow() ) 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir const int eMvMode = _bPgUp ? 720*cdf0e10cSrcweir SwPagePreViewWin::MV_PAGE_UP : 721*cdf0e10cSrcweir SwPagePreViewWin::MV_PAGE_DOWN; 722*cdf0e10cSrcweir if ( ChgPage( eMvMode, sal_True ) ) 723*cdf0e10cSrcweir aViewWin.Invalidate(); 724*cdf0e10cSrcweir } 725*cdf0e10cSrcweir else 726*cdf0e10cSrcweir { 727*cdf0e10cSrcweir SwTwips nScrollAmount; 728*cdf0e10cSrcweir sal_uInt16 nNewSelectedPageNum = 0; 729*cdf0e10cSrcweir const sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol(); 730*cdf0e10cSrcweir if( _bPgUp ) 731*cdf0e10cSrcweir { 732*cdf0e10cSrcweir if ( pPagePrevwLay->DoesPreviewLayoutRowsFitIntoWindow() ) 733*cdf0e10cSrcweir { 734*cdf0e10cSrcweir nScrollAmount = pPagePrevwLay->GetWinPagesScrollAmount( -1 ); 735*cdf0e10cSrcweir if ( (aViewWin.SelectedPage() - nVisPages) > 0 ) 736*cdf0e10cSrcweir nNewSelectedPageNum = aViewWin.SelectedPage() - nVisPages; 737*cdf0e10cSrcweir else 738*cdf0e10cSrcweir nNewSelectedPageNum = 1; 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir else 741*cdf0e10cSrcweir nScrollAmount = - Min( aViewWin.GetOutputSize().Height(), 742*cdf0e10cSrcweir aViewWin.GetPaintedPreviewDocRect().Top() ); 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir else 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir if ( pPagePrevwLay->DoesPreviewLayoutRowsFitIntoWindow() ) 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir nScrollAmount = pPagePrevwLay->GetWinPagesScrollAmount( 1 ); 749*cdf0e10cSrcweir if ( (aViewWin.SelectedPage() + nVisPages) <= mnPageCount ) 750*cdf0e10cSrcweir nNewSelectedPageNum = aViewWin.SelectedPage() + nVisPages; 751*cdf0e10cSrcweir else 752*cdf0e10cSrcweir nNewSelectedPageNum = mnPageCount; 753*cdf0e10cSrcweir } 754*cdf0e10cSrcweir else 755*cdf0e10cSrcweir nScrollAmount = Min( aViewWin.GetOutputSize().Height(), 756*cdf0e10cSrcweir ( pPagePrevwLay->GetPrevwDocSize().Height() - 757*cdf0e10cSrcweir aViewWin.GetPaintedPreviewDocRect().Bottom() ) ); 758*cdf0e10cSrcweir } 759*cdf0e10cSrcweir aViewWin.Scroll( 0, nScrollAmount ); 760*cdf0e10cSrcweir if ( nNewSelectedPageNum != 0 ) 761*cdf0e10cSrcweir { 762*cdf0e10cSrcweir aViewWin.SetSelectedPage( nNewSelectedPageNum ); 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir ScrollViewSzChg(); 765*cdf0e10cSrcweir // OD 24.03.2003 #108282# - additional invalidate page status. 766*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 767*cdf0e10cSrcweir { 768*cdf0e10cSrcweir FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN, 769*cdf0e10cSrcweir FN_STAT_PAGE, 0 770*cdf0e10cSrcweir }; 771*cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 772*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 773*cdf0e10cSrcweir aViewWin.Invalidate(); 774*cdf0e10cSrcweir } 775*cdf0e10cSrcweir } 776*cdf0e10cSrcweir 777*cdf0e10cSrcweir if ( _pReq ) 778*cdf0e10cSrcweir _pReq->Done(); 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir /*-------------------------------------------------------------------- 782*cdf0e10cSrcweir Beschreibung: 783*cdf0e10cSrcweir --------------------------------------------------------------------*/ 784*cdf0e10cSrcweir // dann mal alles fuer die SwPagePreView 785*cdf0e10cSrcweir void SwPagePreView::Execute( SfxRequest &rReq ) 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir int eMvMode; 788*cdf0e10cSrcweir sal_uInt8 nRow = 1; 789*cdf0e10cSrcweir sal_Bool bRetVal = sal_False; 790*cdf0e10cSrcweir bool bRefresh = true; 791*cdf0e10cSrcweir 792*cdf0e10cSrcweir switch(rReq.GetSlot()) 793*cdf0e10cSrcweir { 794*cdf0e10cSrcweir case FN_REFRESH_VIEW: 795*cdf0e10cSrcweir case FN_STAT_PAGE: 796*cdf0e10cSrcweir case FN_STAT_ZOOM: 797*cdf0e10cSrcweir break; 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir case FN_SHOW_MULTIPLE_PAGES: 800*cdf0e10cSrcweir { 801*cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 802*cdf0e10cSrcweir if( pArgs && pArgs->Count() >= 2 ) 803*cdf0e10cSrcweir { 804*cdf0e10cSrcweir sal_uInt8 nCols = (sal_uInt8)((SfxUInt16Item &)pArgs->Get( 805*cdf0e10cSrcweir SID_ATTR_TABLE_COLUMN)).GetValue(); 806*cdf0e10cSrcweir sal_uInt8 nRows = (sal_uInt8)((SfxUInt16Item &)pArgs->Get( 807*cdf0e10cSrcweir SID_ATTR_TABLE_ROW)).GetValue(); 808*cdf0e10cSrcweir aViewWin.CalcWish( nRows, nCols ); 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir } 811*cdf0e10cSrcweir else 812*cdf0e10cSrcweir SwPreViewZoomDlg( aViewWin ).Execute(); 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir } 815*cdf0e10cSrcweir break; 816*cdf0e10cSrcweir case FN_SHOW_BOOKVIEW: 817*cdf0e10cSrcweir { 818*cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 819*cdf0e10cSrcweir const SfxPoolItem* pItem; 820*cdf0e10cSrcweir bool bBookPreview = GetViewShell()->GetViewOptions()->IsPagePrevBookview(); 821*cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_SHOW_BOOKVIEW, sal_False, &pItem ) ) 822*cdf0e10cSrcweir { 823*cdf0e10cSrcweir bBookPreview = static_cast< const SfxBoolItem* >( pItem )->GetValue(); 824*cdf0e10cSrcweir ( ( SwViewOption* ) GetViewShell()->GetViewOptions() )->SetPagePrevBookview( bBookPreview ); 825*cdf0e10cSrcweir // cast is not gentleman like, but it's common use in writer and in this case 826*cdf0e10cSrcweir } 827*cdf0e10cSrcweir if ( aViewWin.SetBookPreviewMode( bBookPreview ) ) 828*cdf0e10cSrcweir { 829*cdf0e10cSrcweir // book preview mode changed. Thus, adjust scrollbars and 830*cdf0e10cSrcweir // invalidate corresponding states. 831*cdf0e10cSrcweir ScrollViewSzChg(); 832*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 833*cdf0e10cSrcweir { 834*cdf0e10cSrcweir FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN, 835*cdf0e10cSrcweir FN_STAT_PAGE, FN_SHOW_BOOKVIEW, 0 836*cdf0e10cSrcweir }; 837*cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 838*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 839*cdf0e10cSrcweir aViewWin.Invalidate(); 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir } 843*cdf0e10cSrcweir break; 844*cdf0e10cSrcweir case FN_SHOW_TWO_PAGES: 845*cdf0e10cSrcweir aViewWin.CalcWish( nRow, 2 ); 846*cdf0e10cSrcweir break; 847*cdf0e10cSrcweir 848*cdf0e10cSrcweir case FN_PREVIEW_ZOOM: 849*cdf0e10cSrcweir case SID_ATTR_ZOOM: 850*cdf0e10cSrcweir { 851*cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 852*cdf0e10cSrcweir const SfxPoolItem* pItem; 853*cdf0e10cSrcweir AbstractSvxZoomDialog *pDlg = 0; 854*cdf0e10cSrcweir if(!pArgs) 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir SfxItemSet aCoreSet(GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM); 857*cdf0e10cSrcweir const SwViewOption* pVOpt = GetViewShell()->GetViewOptions(); 858*cdf0e10cSrcweir SvxZoomItem aZoom( (SvxZoomType)pVOpt->GetZoomType(), 859*cdf0e10cSrcweir pVOpt->GetZoom() ); 860*cdf0e10cSrcweir aZoom.SetValueSet( 861*cdf0e10cSrcweir SVX_ZOOM_ENABLE_50| 862*cdf0e10cSrcweir SVX_ZOOM_ENABLE_75| 863*cdf0e10cSrcweir SVX_ZOOM_ENABLE_100| 864*cdf0e10cSrcweir SVX_ZOOM_ENABLE_150| 865*cdf0e10cSrcweir SVX_ZOOM_ENABLE_200| 866*cdf0e10cSrcweir SVX_ZOOM_ENABLE_WHOLEPAGE); 867*cdf0e10cSrcweir aCoreSet.Put( aZoom ); 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 870*cdf0e10cSrcweir if(pFact) 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet); 873*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 874*cdf0e10cSrcweir } 875*cdf0e10cSrcweir 876*cdf0e10cSrcweir pDlg->SetLimits( MINZOOM, MAXZOOM ); 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir if( pDlg->Execute() != RET_CANCEL ) 879*cdf0e10cSrcweir pArgs = pDlg->GetOutputItemSet(); 880*cdf0e10cSrcweir } 881*cdf0e10cSrcweir if( pArgs ) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir enum SvxZoomType eType = SVX_ZOOM_PERCENT; 884*cdf0e10cSrcweir sal_uInt16 nZoomFactor = USHRT_MAX; 885*cdf0e10cSrcweir if(SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOM, sal_True, &pItem)) 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir eType = ((const SvxZoomItem *)pItem)->GetType(); 888*cdf0e10cSrcweir nZoomFactor = ((const SvxZoomItem *)pItem)->GetValue(); 889*cdf0e10cSrcweir } 890*cdf0e10cSrcweir else if(SFX_ITEM_SET == pArgs->GetItemState(FN_PREVIEW_ZOOM, sal_True, &pItem)) 891*cdf0e10cSrcweir nZoomFactor = ((const SfxUInt16Item *)pItem)->GetValue(); 892*cdf0e10cSrcweir if(USHRT_MAX != nZoomFactor) 893*cdf0e10cSrcweir SetZoom(eType, nZoomFactor); 894*cdf0e10cSrcweir } 895*cdf0e10cSrcweir delete pDlg; 896*cdf0e10cSrcweir } 897*cdf0e10cSrcweir break; 898*cdf0e10cSrcweir case SID_ATTR_ZOOMSLIDER : 899*cdf0e10cSrcweir { 900*cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 901*cdf0e10cSrcweir const SfxPoolItem* pItem; 902*cdf0e10cSrcweir 903*cdf0e10cSrcweir if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, sal_True, &pItem ) ) 904*cdf0e10cSrcweir { 905*cdf0e10cSrcweir const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue(); 906*cdf0e10cSrcweir SetZoom( SVX_ZOOM_PERCENT, nCurrentZoom ); 907*cdf0e10cSrcweir } 908*cdf0e10cSrcweir } 909*cdf0e10cSrcweir break; 910*cdf0e10cSrcweir case SID_ZOOM_IN: 911*cdf0e10cSrcweir case SID_ZOOM_OUT: 912*cdf0e10cSrcweir { 913*cdf0e10cSrcweir enum SvxZoomType eType = SVX_ZOOM_PERCENT; 914*cdf0e10cSrcweir const SwViewOption* pVOpt = GetViewShell()->GetViewOptions(); 915*cdf0e10cSrcweir SetZoom(eType, 916*cdf0e10cSrcweir lcl_GetNextZoomStep(pVOpt->GetZoom(), SID_ZOOM_IN == rReq.GetSlot())); 917*cdf0e10cSrcweir } 918*cdf0e10cSrcweir break; 919*cdf0e10cSrcweir case FN_CHAR_LEFT: 920*cdf0e10cSrcweir case FN_CHAR_RIGHT: 921*cdf0e10cSrcweir case FN_LINE_UP: 922*cdf0e10cSrcweir case FN_LINE_DOWN: 923*cdf0e10cSrcweir { 924*cdf0e10cSrcweir SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout(); 925*cdf0e10cSrcweir sal_uInt16 nNewSelectedPage; 926*cdf0e10cSrcweir sal_uInt16 nNewStartPage; 927*cdf0e10cSrcweir Point aNewStartPos; 928*cdf0e10cSrcweir sal_Int16 nHoriMove = 0; 929*cdf0e10cSrcweir sal_Int16 nVertMove = 0; 930*cdf0e10cSrcweir switch(rReq.GetSlot()) 931*cdf0e10cSrcweir { 932*cdf0e10cSrcweir case FN_CHAR_LEFT: nHoriMove = -1; break; 933*cdf0e10cSrcweir case FN_CHAR_RIGHT: nHoriMove = 1; break; 934*cdf0e10cSrcweir case FN_LINE_UP: nVertMove = -1; break; 935*cdf0e10cSrcweir case FN_LINE_DOWN: nVertMove = 1; break; 936*cdf0e10cSrcweir } 937*cdf0e10cSrcweir pPagePrevwLay->CalcStartValuesForSelectedPageMove( nHoriMove, nVertMove, 938*cdf0e10cSrcweir nNewSelectedPage, nNewStartPage, aNewStartPos ); 939*cdf0e10cSrcweir if ( aViewWin.SelectedPage() != nNewSelectedPage ) 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir if ( pPagePrevwLay->IsPageVisible( nNewSelectedPage ) ) 942*cdf0e10cSrcweir { 943*cdf0e10cSrcweir pPagePrevwLay->MarkNewSelectedPage( nNewSelectedPage ); 944*cdf0e10cSrcweir // OD 19.02.2003 #107369# - adjust position at vertical scrollbar. 945*cdf0e10cSrcweir SetVScrollbarThumbPos( nNewSelectedPage ); 946*cdf0e10cSrcweir bRefresh = false; 947*cdf0e10cSrcweir } 948*cdf0e10cSrcweir else 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir aViewWin.SetSelectedPage( nNewSelectedPage ); 951*cdf0e10cSrcweir aViewWin.SetSttPage( nNewStartPage ); 952*cdf0e10cSrcweir int nRet = ChgPage( SwPagePreViewWin::MV_SELPAGE, sal_True ); 953*cdf0e10cSrcweir bRefresh = 0 != nRet; 954*cdf0e10cSrcweir } 955*cdf0e10cSrcweir GetViewShell()->ShowPreViewSelection( nNewSelectedPage ); 956*cdf0e10cSrcweir // OD 24.03.2003 #108282# - invalidate page status. 957*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 958*cdf0e10cSrcweir { 959*cdf0e10cSrcweir FN_STAT_PAGE, 0 960*cdf0e10cSrcweir }; 961*cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 962*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 963*cdf0e10cSrcweir rReq.Done(); 964*cdf0e10cSrcweir } 965*cdf0e10cSrcweir else 966*cdf0e10cSrcweir { 967*cdf0e10cSrcweir bRefresh = false; 968*cdf0e10cSrcweir } 969*cdf0e10cSrcweir break; 970*cdf0e10cSrcweir } 971*cdf0e10cSrcweir case FN_PAGEUP: 972*cdf0e10cSrcweir case FN_PAGEDOWN: 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir _ExecPgUpAndPgDown( rReq.GetSlot() == FN_PAGEUP, &rReq ); 975*cdf0e10cSrcweir break; 976*cdf0e10cSrcweir } 977*cdf0e10cSrcweir case FN_START_OF_LINE: 978*cdf0e10cSrcweir case FN_START_OF_DOCUMENT: 979*cdf0e10cSrcweir aViewWin.SetSelectedPage( 1 ); 980*cdf0e10cSrcweir eMvMode = SwPagePreViewWin::MV_DOC_STT; bRetVal = sal_True; goto MOVEPAGE; 981*cdf0e10cSrcweir case FN_END_OF_LINE: 982*cdf0e10cSrcweir case FN_END_OF_DOCUMENT: 983*cdf0e10cSrcweir aViewWin.SetSelectedPage( mnPageCount ); 984*cdf0e10cSrcweir eMvMode = SwPagePreViewWin::MV_DOC_END; bRetVal = sal_True; goto MOVEPAGE; 985*cdf0e10cSrcweir MOVEPAGE: 986*cdf0e10cSrcweir { 987*cdf0e10cSrcweir int nRet = ChgPage( eMvMode, sal_True ); 988*cdf0e10cSrcweir // return value fuer Basic 989*cdf0e10cSrcweir if(bRetVal) 990*cdf0e10cSrcweir rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), nRet == 0)); 991*cdf0e10cSrcweir 992*cdf0e10cSrcweir bRefresh = 0 != nRet; 993*cdf0e10cSrcweir rReq.Done(); 994*cdf0e10cSrcweir } 995*cdf0e10cSrcweir break; 996*cdf0e10cSrcweir 997*cdf0e10cSrcweir case FN_PRINT_PAGEPREVIEW: 998*cdf0e10cSrcweir { 999*cdf0e10cSrcweir const SwPagePreViewPrtData* pPPVPD = aViewWin.GetViewShell()->GetDoc()->GetPreViewPrtData(); 1000*cdf0e10cSrcweir // die Sache mit der Orientation 1001*cdf0e10cSrcweir if(pPPVPD) 1002*cdf0e10cSrcweir { 1003*cdf0e10cSrcweir SfxPrinter* pPrinter = GetPrinter( sal_True ); 1004*cdf0e10cSrcweir if((pPrinter->GetOrientation() == ORIENTATION_LANDSCAPE) 1005*cdf0e10cSrcweir != pPPVPD->GetLandscape()) 1006*cdf0e10cSrcweir pPrinter->SetOrientation(pPPVPD->GetLandscape() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT); 1007*cdf0e10cSrcweir } 1008*cdf0e10cSrcweir ::SetAppPrintOptions( aViewWin.GetViewShell(), sal_False ); 1009*cdf0e10cSrcweir bNormalPrint = sal_False; 1010*cdf0e10cSrcweir sal_uInt16 nPrtSlot = SID_PRINTDOC; 1011*cdf0e10cSrcweir rReq.SetSlot( nPrtSlot ); 1012*cdf0e10cSrcweir SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() ); 1013*cdf0e10cSrcweir rReq.SetSlot( FN_PRINT_PAGEPREVIEW ); 1014*cdf0e10cSrcweir return; 1015*cdf0e10cSrcweir } 1016*cdf0e10cSrcweir case SID_PRINTDOCDIRECT: 1017*cdf0e10cSrcweir case SID_PRINTDOC: 1018*cdf0e10cSrcweir ::SetAppPrintOptions( aViewWin.GetViewShell(), sal_False ); 1019*cdf0e10cSrcweir bNormalPrint = sal_True; 1020*cdf0e10cSrcweir SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() ); 1021*cdf0e10cSrcweir return; 1022*cdf0e10cSrcweir case FN_CLOSE_PAGEPREVIEW: 1023*cdf0e10cSrcweir case SID_PRINTPREVIEW: 1024*cdf0e10cSrcweir // print preview is now always in the same frame as the tab view 1025*cdf0e10cSrcweir // -> always switch this frame back to normal view 1026*cdf0e10cSrcweir // (ScTabViewShell ctor reads stored view data) 1027*cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( SID_VIEWSHELL0, 0, 0, SFX_CALLMODE_ASYNCHRON ); 1028*cdf0e10cSrcweir break; 1029*cdf0e10cSrcweir case FN_INSERT_BREAK: 1030*cdf0e10cSrcweir { 1031*cdf0e10cSrcweir sal_uInt16 nSelPage = aViewWin.SelectedPage(); 1032*cdf0e10cSrcweir //if a dummy page is selected (e.g. a non-existing right/left page) 1033*cdf0e10cSrcweir //the direct neighbor is used 1034*cdf0e10cSrcweir if(GetViewShell()->IsDummyPage( nSelPage ) && GetViewShell()->IsDummyPage( --nSelPage )) 1035*cdf0e10cSrcweir nSelPage +=2; 1036*cdf0e10cSrcweir SetNewPage( nSelPage ); 1037*cdf0e10cSrcweir SfxViewFrame *pTmpFrm = GetViewFrame(); 1038*cdf0e10cSrcweir pTmpFrm->GetBindings().Execute( SID_VIEWSHELL0, NULL, 0, 1039*cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON ); 1040*cdf0e10cSrcweir } 1041*cdf0e10cSrcweir break; 1042*cdf0e10cSrcweir default: 1043*cdf0e10cSrcweir ASSERT(!this, falscher Dispatcher); 1044*cdf0e10cSrcweir return; 1045*cdf0e10cSrcweir } 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir if( bRefresh ) 1048*cdf0e10cSrcweir aViewWin.Invalidate(); 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1052*cdf0e10cSrcweir Beschreibung: 1053*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir void SwPagePreView::GetState( SfxItemSet& rSet ) 1057*cdf0e10cSrcweir { 1058*cdf0e10cSrcweir SfxWhichIter aIter(rSet); 1059*cdf0e10cSrcweir sal_uInt8 nRow = 1; 1060*cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1061*cdf0e10cSrcweir ASSERT(nWhich, leeres Set); 1062*cdf0e10cSrcweir SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout(); 1063*cdf0e10cSrcweir //#106746# zoom has to be disabled if Accessibility support is switched on 1064*cdf0e10cSrcweir // MT 2010/01, see #110498# 1065*cdf0e10cSrcweir sal_Bool bZoomEnabled = sal_True; // !Application::GetSettings().GetMiscSettings().GetEnableATToolSupport(); 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir while(nWhich) 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir switch(nWhich) 1070*cdf0e10cSrcweir { 1071*cdf0e10cSrcweir case SID_BROWSER_MODE: 1072*cdf0e10cSrcweir case FN_PRINT_LAYOUT: 1073*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1074*cdf0e10cSrcweir break; 1075*cdf0e10cSrcweir case FN_START_OF_DOCUMENT: 1076*cdf0e10cSrcweir { 1077*cdf0e10cSrcweir if ( pPagePrevwLay->IsPageVisible( 1 ) ) 1078*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1079*cdf0e10cSrcweir break; 1080*cdf0e10cSrcweir } 1081*cdf0e10cSrcweir case FN_END_OF_DOCUMENT: 1082*cdf0e10cSrcweir { 1083*cdf0e10cSrcweir if ( pPagePrevwLay->IsPageVisible( mnPageCount ) ) 1084*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1085*cdf0e10cSrcweir break; 1086*cdf0e10cSrcweir } 1087*cdf0e10cSrcweir case FN_PAGEUP: 1088*cdf0e10cSrcweir { 1089*cdf0e10cSrcweir if( pPagePrevwLay->GetWinPagesScrollAmount( -1 ) == 0 ) 1090*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1091*cdf0e10cSrcweir break; 1092*cdf0e10cSrcweir } 1093*cdf0e10cSrcweir case FN_PAGEDOWN: 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir if( pPagePrevwLay->GetWinPagesScrollAmount( 1 ) == 0 ) 1096*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1097*cdf0e10cSrcweir break; 1098*cdf0e10cSrcweir } 1099*cdf0e10cSrcweir 1100*cdf0e10cSrcweir case FN_STAT_PAGE: 1101*cdf0e10cSrcweir { 1102*cdf0e10cSrcweir String aStr( sPageStr ); 1103*cdf0e10cSrcweir aViewWin.GetStatusStr( aStr, mnPageCount ); 1104*cdf0e10cSrcweir rSet.Put( SfxStringItem( nWhich, aStr) ); 1105*cdf0e10cSrcweir } 1106*cdf0e10cSrcweir break; 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir case SID_ATTR_ZOOM: 1109*cdf0e10cSrcweir case FN_STAT_ZOOM: 1110*cdf0e10cSrcweir { 1111*cdf0e10cSrcweir if(bZoomEnabled) 1112*cdf0e10cSrcweir { 1113*cdf0e10cSrcweir const SwViewOption* pVOpt = GetViewShell()->GetViewOptions(); 1114*cdf0e10cSrcweir SvxZoomItem aZoom((SvxZoomType)pVOpt->GetZoomType(), 1115*cdf0e10cSrcweir pVOpt->GetZoom()); 1116*cdf0e10cSrcweir aZoom.SetValueSet( 1117*cdf0e10cSrcweir SVX_ZOOM_ENABLE_50| 1118*cdf0e10cSrcweir SVX_ZOOM_ENABLE_75| 1119*cdf0e10cSrcweir SVX_ZOOM_ENABLE_100| 1120*cdf0e10cSrcweir SVX_ZOOM_ENABLE_150| 1121*cdf0e10cSrcweir SVX_ZOOM_ENABLE_200); 1122*cdf0e10cSrcweir rSet.Put( aZoom ); 1123*cdf0e10cSrcweir } 1124*cdf0e10cSrcweir else 1125*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1126*cdf0e10cSrcweir } 1127*cdf0e10cSrcweir break; 1128*cdf0e10cSrcweir case SID_ATTR_ZOOMSLIDER : 1129*cdf0e10cSrcweir { 1130*cdf0e10cSrcweir if(bZoomEnabled) 1131*cdf0e10cSrcweir { 1132*cdf0e10cSrcweir const SwViewOption* pVOpt = GetViewShell()->GetViewOptions(); 1133*cdf0e10cSrcweir const sal_uInt16 nCurrentZoom = pVOpt->GetZoom(); 1134*cdf0e10cSrcweir SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM ); 1135*cdf0e10cSrcweir aZoomSliderItem.AddSnappingPoint( 100 ); 1136*cdf0e10cSrcweir rSet.Put( aZoomSliderItem ); 1137*cdf0e10cSrcweir } 1138*cdf0e10cSrcweir else 1139*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1140*cdf0e10cSrcweir } 1141*cdf0e10cSrcweir break; 1142*cdf0e10cSrcweir case FN_PREVIEW_ZOOM: 1143*cdf0e10cSrcweir { 1144*cdf0e10cSrcweir if(bZoomEnabled) 1145*cdf0e10cSrcweir { 1146*cdf0e10cSrcweir const SwViewOption* pVOpt = GetViewShell()->GetViewOptions(); 1147*cdf0e10cSrcweir rSet.Put(SfxUInt16Item(nWhich, pVOpt->GetZoom())); 1148*cdf0e10cSrcweir } 1149*cdf0e10cSrcweir else 1150*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1151*cdf0e10cSrcweir } 1152*cdf0e10cSrcweir break; 1153*cdf0e10cSrcweir case SID_ZOOM_IN: 1154*cdf0e10cSrcweir case SID_ZOOM_OUT: 1155*cdf0e10cSrcweir { 1156*cdf0e10cSrcweir const SwViewOption* pVOpt = GetViewShell()->GetViewOptions(); 1157*cdf0e10cSrcweir if(!bZoomEnabled || (SID_ZOOM_OUT == nWhich && pVOpt->GetZoom() >= MAX_PREVIEW_ZOOM)|| 1158*cdf0e10cSrcweir (SID_ZOOM_IN == nWhich && pVOpt->GetZoom() <= MIN_PREVIEW_ZOOM)) 1159*cdf0e10cSrcweir { 1160*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1161*cdf0e10cSrcweir } 1162*cdf0e10cSrcweir } 1163*cdf0e10cSrcweir break; 1164*cdf0e10cSrcweir case FN_SHOW_MULTIPLE_PAGES: 1165*cdf0e10cSrcweir //should never be disabled 1166*cdf0e10cSrcweir break; 1167*cdf0e10cSrcweir case FN_SHOW_BOOKVIEW: 1168*cdf0e10cSrcweir { 1169*cdf0e10cSrcweir sal_Bool b = GetViewShell()->GetViewOptions()->IsPagePrevBookview(); 1170*cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, b)); 1171*cdf0e10cSrcweir } 1172*cdf0e10cSrcweir break; 1173*cdf0e10cSrcweir 1174*cdf0e10cSrcweir case FN_SHOW_TWO_PAGES: 1175*cdf0e10cSrcweir if( 2 == aViewWin.GetCol() && nRow == aViewWin.GetRow() ) 1176*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1177*cdf0e10cSrcweir break; 1178*cdf0e10cSrcweir 1179*cdf0e10cSrcweir case FN_PRINT_PAGEPREVIEW: 1180*cdf0e10cSrcweir // hat den gleichen Status wie das normale Drucken 1181*cdf0e10cSrcweir { 1182*cdf0e10cSrcweir const SfxPoolItem* pItem; 1183*cdf0e10cSrcweir SfxItemSet aSet( *rSet.GetPool(), SID_PRINTDOC, SID_PRINTDOC ); 1184*cdf0e10cSrcweir GetSlotState( SID_PRINTDOC, SfxViewShell::GetInterface(), &aSet ); 1185*cdf0e10cSrcweir if( SFX_ITEM_DISABLED == aSet.GetItemState( SID_PRINTDOC, 1186*cdf0e10cSrcweir sal_False, &pItem )) 1187*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1188*cdf0e10cSrcweir else if( SFX_ITEM_SET == aSet.GetItemState( SID_PRINTDOC, 1189*cdf0e10cSrcweir sal_False, &pItem )) 1190*cdf0e10cSrcweir { 1191*cdf0e10cSrcweir ((SfxPoolItem*)pItem)->SetWhich( FN_PRINT_PAGEPREVIEW ); 1192*cdf0e10cSrcweir rSet.Put( *pItem ); 1193*cdf0e10cSrcweir } 1194*cdf0e10cSrcweir } 1195*cdf0e10cSrcweir break; 1196*cdf0e10cSrcweir 1197*cdf0e10cSrcweir case SID_PRINTPREVIEW: 1198*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, sal_True ) ); 1199*cdf0e10cSrcweir break; 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir case SID_PRINTDOC: 1202*cdf0e10cSrcweir case SID_PRINTDOCDIRECT: 1203*cdf0e10cSrcweir GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet ); 1204*cdf0e10cSrcweir break; 1205*cdf0e10cSrcweir } 1206*cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1207*cdf0e10cSrcweir } 1208*cdf0e10cSrcweir } 1209*cdf0e10cSrcweir 1210*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1211*cdf0e10cSrcweir Beschreibung: 1212*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1213*cdf0e10cSrcweir 1214*cdf0e10cSrcweir 1215*cdf0e10cSrcweir void SwPagePreView::StateUndo(SfxItemSet& rSet) 1216*cdf0e10cSrcweir { 1217*cdf0e10cSrcweir SfxWhichIter aIter(rSet); 1218*cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1219*cdf0e10cSrcweir 1220*cdf0e10cSrcweir while (nWhich) 1221*cdf0e10cSrcweir { 1222*cdf0e10cSrcweir rSet.DisableItem(nWhich); 1223*cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1224*cdf0e10cSrcweir } 1225*cdf0e10cSrcweir } 1226*cdf0e10cSrcweir 1227*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1228*cdf0e10cSrcweir Beschreibung: 1229*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1230*cdf0e10cSrcweir 1231*cdf0e10cSrcweir 1232*cdf0e10cSrcweir void SwPagePreView::Init(const SwViewOption * pPrefs) 1233*cdf0e10cSrcweir { 1234*cdf0e10cSrcweir if ( GetViewShell()->HasDrawView() ) 1235*cdf0e10cSrcweir GetViewShell()->GetDrawView()->SetAnimationEnabled( sal_False ); 1236*cdf0e10cSrcweir 1237*cdf0e10cSrcweir bNormalPrint = sal_True; 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir // Die DocSize erfragen und verarbeiten. Ueber die Handler konnte 1240*cdf0e10cSrcweir // die Shell nicht gefunden werden, weil die Shell innerhalb CTOR-Phase 1241*cdf0e10cSrcweir // nicht in der SFX-Verwaltung bekannt ist. 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir if( !pPrefs ) 1244*cdf0e10cSrcweir pPrefs = SW_MOD()->GetUsrPref(sal_False); 1245*cdf0e10cSrcweir 1246*cdf0e10cSrcweir // die Felder aktualisieren 1247*cdf0e10cSrcweir // ACHTUNG: hochcasten auf die EditShell, um die SS zu nutzen. 1248*cdf0e10cSrcweir // In den Methoden wird auf die akt. Shell abgefragt! 1249*cdf0e10cSrcweir SwEditShell* pESh = (SwEditShell*)GetViewShell(); 1250*cdf0e10cSrcweir sal_Bool bIsModified = pESh->IsModified(); 1251*cdf0e10cSrcweir 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir SwViewOption aOpt( *pPrefs ); 1254*cdf0e10cSrcweir aOpt.SetPagePreview(sal_True); 1255*cdf0e10cSrcweir aOpt.SetTab( sal_False ); 1256*cdf0e10cSrcweir aOpt.SetBlank( sal_False ); 1257*cdf0e10cSrcweir aOpt.SetHardBlank( sal_False ); 1258*cdf0e10cSrcweir aOpt.SetParagraph( sal_False ); 1259*cdf0e10cSrcweir aOpt.SetLineBreak( sal_False ); 1260*cdf0e10cSrcweir aOpt.SetPageBreak( sal_False ); 1261*cdf0e10cSrcweir aOpt.SetColumnBreak( sal_False ); 1262*cdf0e10cSrcweir aOpt.SetSoftHyph( sal_False ); 1263*cdf0e10cSrcweir aOpt.SetFldName( sal_False ); 1264*cdf0e10cSrcweir aOpt.SetPostIts( sal_False ); 1265*cdf0e10cSrcweir aOpt.SetShowHiddenChar( sal_False ); 1266*cdf0e10cSrcweir aOpt.SetShowHiddenField( sal_False ); 1267*cdf0e10cSrcweir aOpt.SetShowHiddenPara( sal_False ); 1268*cdf0e10cSrcweir aOpt.SetViewHRuler( sal_False ); 1269*cdf0e10cSrcweir aOpt.SetViewVRuler( sal_False ); 1270*cdf0e10cSrcweir aOpt.SetGraphic( sal_True ); 1271*cdf0e10cSrcweir aOpt.SetTable( sal_True ); 1272*cdf0e10cSrcweir aOpt.SetSnap( sal_False ); 1273*cdf0e10cSrcweir aOpt.SetGridVisible( sal_False ); 1274*cdf0e10cSrcweir 1275*cdf0e10cSrcweir GetViewShell()->ApplyViewOptions( aOpt ); 1276*cdf0e10cSrcweir GetViewShell()->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions()); 1277*cdf0e10cSrcweir 1278*cdf0e10cSrcweir // OD 09.01.2003 #i6467# - adjust view shell option to the same as for print 1279*cdf0e10cSrcweir SwPrintData const aPrintOptions = *SW_MOD()->GetPrtOptions(false); 1280*cdf0e10cSrcweir GetViewShell()->AdjustOptionsForPagePreview( aPrintOptions ); 1281*cdf0e10cSrcweir 1282*cdf0e10cSrcweir GetViewShell()->CalcLayout(); 1283*cdf0e10cSrcweir DocSzChgd( GetViewShell()->GetDocSize() ); 1284*cdf0e10cSrcweir 1285*cdf0e10cSrcweir if( !bIsModified ) 1286*cdf0e10cSrcweir pESh->ResetModified(); 1287*cdf0e10cSrcweir 1288*cdf0e10cSrcweir pVScrollbar->ExtendedShow(pPrefs->IsViewVScrollBar()); 1289*cdf0e10cSrcweir pHScrollbar->ExtendedShow(pPrefs->IsViewHScrollBar()); 1290*cdf0e10cSrcweir pScrollFill->Show(pPrefs->IsViewVScrollBar() && pPrefs->IsViewHScrollBar()); 1291*cdf0e10cSrcweir } 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir 1294*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1295*cdf0e10cSrcweir Beschreibung: 1296*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1297*cdf0e10cSrcweir 1298*cdf0e10cSrcweir 1299*cdf0e10cSrcweir SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): 1300*cdf0e10cSrcweir SfxViewShell( pViewFrame, SWVIEWFLAGS ), 1301*cdf0e10cSrcweir aViewWin( &pViewFrame->GetWindow(), *this ), 1302*cdf0e10cSrcweir nNewPage(USHRT_MAX), 1303*cdf0e10cSrcweir pHScrollbar(0), 1304*cdf0e10cSrcweir pVScrollbar(0), 1305*cdf0e10cSrcweir pPageUpBtn(0), 1306*cdf0e10cSrcweir pPageDownBtn(0), 1307*cdf0e10cSrcweir pScrollFill(new ScrollBarBox( &pViewFrame->GetWindow(), 1308*cdf0e10cSrcweir pViewFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), 1309*cdf0e10cSrcweir mnPageCount( 0 ), 1310*cdf0e10cSrcweir // OD 09.01.2003 #106334# 1311*cdf0e10cSrcweir mbResetFormDesignMode( false ), 1312*cdf0e10cSrcweir mbFormDesignModeToReset( false ) 1313*cdf0e10cSrcweir { 1314*cdf0e10cSrcweir SetName(String::CreateFromAscii("PageView" )); 1315*cdf0e10cSrcweir SetWindow( &aViewWin ); 1316*cdf0e10cSrcweir SetHelpId(SW_PAGEPREVIEW); 1317*cdf0e10cSrcweir _CreateScrollbar( sal_True ); 1318*cdf0e10cSrcweir _CreateScrollbar( sal_False ); 1319*cdf0e10cSrcweir 1320*cdf0e10cSrcweir SfxObjectShell* pObjShell = pViewFrame->GetObjectShell(); 1321*cdf0e10cSrcweir if ( !pOldSh ) 1322*cdf0e10cSrcweir { 1323*cdf0e10cSrcweir //Gibt es schon eine Sicht auf das Dokument? 1324*cdf0e10cSrcweir SfxViewFrame *pF = SfxViewFrame::GetFirst( pObjShell ); 1325*cdf0e10cSrcweir if ( pF == pViewFrame ) 1326*cdf0e10cSrcweir pF = SfxViewFrame::GetNext( *pF, pObjShell ); 1327*cdf0e10cSrcweir if ( pF ) 1328*cdf0e10cSrcweir pOldSh = pF->GetViewShell(); 1329*cdf0e10cSrcweir } 1330*cdf0e10cSrcweir 1331*cdf0e10cSrcweir ViewShell *pVS, *pNew; 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweir if( pOldSh && pOldSh->IsA( TYPE( SwPagePreView ) ) ) 1334*cdf0e10cSrcweir pVS = ((SwPagePreView*)pOldSh)->GetViewShell(); 1335*cdf0e10cSrcweir else 1336*cdf0e10cSrcweir { 1337*cdf0e10cSrcweir if( pOldSh && pOldSh->IsA( TYPE( SwView ) ) ) 1338*cdf0e10cSrcweir { 1339*cdf0e10cSrcweir pVS = ((SwView*)pOldSh)->GetWrtShellPtr(); 1340*cdf0e10cSrcweir // save the current ViewData of the previous SwView 1341*cdf0e10cSrcweir pOldSh->WriteUserData( sSwViewData, sal_False ); 1342*cdf0e10cSrcweir } 1343*cdf0e10cSrcweir else 1344*cdf0e10cSrcweir pVS = GetDocShell()->GetWrtShell(); 1345*cdf0e10cSrcweir if( pVS ) 1346*cdf0e10cSrcweir { 1347*cdf0e10cSrcweir // setze die akt. Seite als die erste 1348*cdf0e10cSrcweir sal_uInt16 nPhysPg, nVirtPg; 1349*cdf0e10cSrcweir ((SwCrsrShell*)pVS)->GetPageNum( nPhysPg, nVirtPg, /*sal_False*/sal_True, sal_False ); 1350*cdf0e10cSrcweir if( 1 != aViewWin.GetCol() && 1 == nPhysPg ) 1351*cdf0e10cSrcweir --nPhysPg; 1352*cdf0e10cSrcweir aViewWin.SetSttPage( nPhysPg ); 1353*cdf0e10cSrcweir } 1354*cdf0e10cSrcweir } 1355*cdf0e10cSrcweir 1356*cdf0e10cSrcweir // OD 09.01.2003 #106334# - for form shell remember design mode of draw view 1357*cdf0e10cSrcweir // of previous view shell 1358*cdf0e10cSrcweir if ( pVS && pVS->HasDrawView() ) 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir mbResetFormDesignMode = true; 1361*cdf0e10cSrcweir mbFormDesignModeToReset = pVS->GetDrawView()->IsDesignMode(); 1362*cdf0e10cSrcweir } 1363*cdf0e10cSrcweir 1364*cdf0e10cSrcweir if( pVS ) 1365*cdf0e10cSrcweir pNew = new ViewShell( *pVS, &aViewWin, 0, VSHELLFLAG_ISPREVIEW ); 1366*cdf0e10cSrcweir else 1367*cdf0e10cSrcweir pNew = new ViewShell( 1368*cdf0e10cSrcweir *((SwDocShell*)pViewFrame->GetObjectShell())->GetDoc(), 1369*cdf0e10cSrcweir &aViewWin, 0, 0, VSHELLFLAG_ISPREVIEW ); 1370*cdf0e10cSrcweir 1371*cdf0e10cSrcweir aViewWin.SetViewShell( pNew ); 1372*cdf0e10cSrcweir pNew->SetSfxViewShell( this ); 1373*cdf0e10cSrcweir Init(); 1374*cdf0e10cSrcweir } 1375*cdf0e10cSrcweir 1376*cdf0e10cSrcweir 1377*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1378*cdf0e10cSrcweir Beschreibung: 1379*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1380*cdf0e10cSrcweir 1381*cdf0e10cSrcweir 1382*cdf0e10cSrcweir SwPagePreView::~SwPagePreView() 1383*cdf0e10cSrcweir { 1384*cdf0e10cSrcweir SetWindow( 0 ); 1385*cdf0e10cSrcweir 1386*cdf0e10cSrcweir delete pScrollFill; 1387*cdf0e10cSrcweir delete pHScrollbar; 1388*cdf0e10cSrcweir delete pVScrollbar; 1389*cdf0e10cSrcweir delete pPageUpBtn; 1390*cdf0e10cSrcweir delete pPageDownBtn; 1391*cdf0e10cSrcweir 1392*cdf0e10cSrcweir /* SfxObjectShell* pDocSh = GetDocShell(); 1393*cdf0e10cSrcweir for( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocSh ); 1394*cdf0e10cSrcweir pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) 1395*cdf0e10cSrcweir if( pFrame != GetViewFrame() ) 1396*cdf0e10cSrcweir { 1397*cdf0e10cSrcweir // es gibt noch eine weitere Sicht auf unser Dokument, also 1398*cdf0e10cSrcweir // aktiviere dieses 1399*cdf0e10cSrcweir pFrame->GetFrame().Appear(); 1400*cdf0e10cSrcweir break; 1401*cdf0e10cSrcweir } 1402*cdf0e10cSrcweir */} 1403*cdf0e10cSrcweir 1404*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1405*cdf0e10cSrcweir Beschreibung: 1406*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1407*cdf0e10cSrcweir 1408*cdf0e10cSrcweir 1409*cdf0e10cSrcweir SwDocShell* SwPagePreView::GetDocShell() 1410*cdf0e10cSrcweir { 1411*cdf0e10cSrcweir return PTR_CAST(SwDocShell, GetViewFrame()->GetObjectShell()); 1412*cdf0e10cSrcweir } 1413*cdf0e10cSrcweir 1414*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1415*cdf0e10cSrcweir Beschreibung: 1416*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1417*cdf0e10cSrcweir 1418*cdf0e10cSrcweir 1419*cdf0e10cSrcweir int SwPagePreView::_CreateScrollbar( sal_Bool bHori ) 1420*cdf0e10cSrcweir { 1421*cdf0e10cSrcweir Window *pMDI = &GetViewFrame()->GetWindow(); 1422*cdf0e10cSrcweir SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar; 1423*cdf0e10cSrcweir 1424*cdf0e10cSrcweir ASSERT( !*ppScrollbar, "vorher abpruefen!" ) 1425*cdf0e10cSrcweir 1426*cdf0e10cSrcweir if( !bHori ) 1427*cdf0e10cSrcweir { 1428*cdf0e10cSrcweir 1429*cdf0e10cSrcweir pPageUpBtn = new ImageButton(pMDI, SW_RES( BTN_PAGEUP ) ); 1430*cdf0e10cSrcweir pPageUpBtn->SetHelpId(GetStaticInterface()->GetSlot(FN_PAGEUP)->GetCommand()); 1431*cdf0e10cSrcweir pPageDownBtn = new ImageButton(pMDI, SW_RES( BTN_PAGEDOWN ) ); 1432*cdf0e10cSrcweir pPageDownBtn->SetHelpId(GetStaticInterface()->GetSlot(FN_PAGEDOWN)->GetCommand()); 1433*cdf0e10cSrcweir Link aLk( LINK( this, SwPagePreView, BtnPage ) ); 1434*cdf0e10cSrcweir pPageUpBtn->SetClickHdl( aLk ); 1435*cdf0e10cSrcweir pPageDownBtn->SetClickHdl( aLk ); 1436*cdf0e10cSrcweir pPageUpBtn->Show(); 1437*cdf0e10cSrcweir pPageDownBtn->Show(); 1438*cdf0e10cSrcweir } 1439*cdf0e10cSrcweir 1440*cdf0e10cSrcweir *ppScrollbar = new SwScrollbar( pMDI, bHori ); 1441*cdf0e10cSrcweir 1442*cdf0e10cSrcweir ScrollDocSzChg(); 1443*cdf0e10cSrcweir (*ppScrollbar)->EnableDrag( sal_True ); 1444*cdf0e10cSrcweir (*ppScrollbar)->SetEndScrollHdl( LINK( this, SwPagePreView, EndScrollHdl )); 1445*cdf0e10cSrcweir 1446*cdf0e10cSrcweir 1447*cdf0e10cSrcweir (*ppScrollbar)->SetScrollHdl( LINK( this, SwPagePreView, ScrollHdl )); 1448*cdf0e10cSrcweir 1449*cdf0e10cSrcweir InvalidateBorder(); 1450*cdf0e10cSrcweir (*ppScrollbar)->ExtendedShow(); 1451*cdf0e10cSrcweir return 1; 1452*cdf0e10cSrcweir } 1453*cdf0e10cSrcweir 1454*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1455*cdf0e10cSrcweir Beschreibung: 1456*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1457*cdf0e10cSrcweir 1458*cdf0e10cSrcweir 1459*cdf0e10cSrcweir 1460*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1461*cdf0e10cSrcweir Beschreibung: 1462*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1463*cdf0e10cSrcweir 1464*cdf0e10cSrcweir /* 1465*cdf0e10cSrcweir * Button-Handler 1466*cdf0e10cSrcweir */ 1467*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwPagePreView, BtnPage, Button *, pButton ) 1468*cdf0e10cSrcweir { 1469*cdf0e10cSrcweir // OD 04.03.2003 #107369# - use new helper method to perform page up 1470*cdf0e10cSrcweir // respectively page down. 1471*cdf0e10cSrcweir _ExecPgUpAndPgDown( pButton == pPageUpBtn ); 1472*cdf0e10cSrcweir return 0; 1473*cdf0e10cSrcweir } 1474*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwPagePreView, BtnPage, Button *, pButton ) 1475*cdf0e10cSrcweir 1476*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1477*cdf0e10cSrcweir Beschreibung: 1478*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1479*cdf0e10cSrcweir 1480*cdf0e10cSrcweir 1481*cdf0e10cSrcweir int SwPagePreView::ChgPage( int eMvMode, int bUpdateScrollbar ) 1482*cdf0e10cSrcweir { 1483*cdf0e10cSrcweir Rectangle aPixVisArea( aViewWin.LogicToPixel( aVisArea ) ); 1484*cdf0e10cSrcweir int bChg = aViewWin.MovePage( eMvMode ) || 1485*cdf0e10cSrcweir eMvMode == SwPagePreViewWin::MV_CALC || 1486*cdf0e10cSrcweir eMvMode == SwPagePreViewWin::MV_NEWWINSIZE; 1487*cdf0e10cSrcweir aVisArea = aViewWin.PixelToLogic( aPixVisArea ); 1488*cdf0e10cSrcweir 1489*cdf0e10cSrcweir if( bChg ) 1490*cdf0e10cSrcweir { 1491*cdf0e10cSrcweir // Statusleiste updaten 1492*cdf0e10cSrcweir String aStr( sPageStr ); 1493*cdf0e10cSrcweir aViewWin.GetStatusStr( aStr, mnPageCount ); 1494*cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 1495*cdf0e10cSrcweir 1496*cdf0e10cSrcweir if( bUpdateScrollbar ) 1497*cdf0e10cSrcweir { 1498*cdf0e10cSrcweir ScrollViewSzChg(); 1499*cdf0e10cSrcweir 1500*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 1501*cdf0e10cSrcweir { 1502*cdf0e10cSrcweir FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, 1503*cdf0e10cSrcweir FN_PAGEUP, FN_PAGEDOWN, 0 1504*cdf0e10cSrcweir }; 1505*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 1506*cdf0e10cSrcweir } 1507*cdf0e10cSrcweir rBindings.SetState( SfxStringItem( FN_STAT_PAGE, aStr ) ); 1508*cdf0e10cSrcweir } 1509*cdf0e10cSrcweir return bChg; 1510*cdf0e10cSrcweir } 1511*cdf0e10cSrcweir 1512*cdf0e10cSrcweir 1513*cdf0e10cSrcweir /* */ 1514*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1515*cdf0e10cSrcweir Beschreibung: 1516*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1517*cdf0e10cSrcweir 1518*cdf0e10cSrcweir 1519*cdf0e10cSrcweir // ab hier alles aus der SwView uebernommen 1520*cdf0e10cSrcweir 1521*cdf0e10cSrcweir 1522*cdf0e10cSrcweir void SwPagePreView::CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool /*bInner*/ ) 1523*cdf0e10cSrcweir { 1524*cdf0e10cSrcweir // const long nAdd = bInner ? 0 : ScrollBar::GetWindowOverlapPixel(); 1525*cdf0e10cSrcweir const StyleSettings &rSet = aViewWin.GetSettings().GetStyleSettings(); 1526*cdf0e10cSrcweir const long nTmp = rSet.GetScrollBarSize();// - nAdd; 1527*cdf0e10cSrcweir if ( pVScrollbar->IsVisible( sal_False )) 1528*cdf0e10cSrcweir rToFill.Right() = nTmp; 1529*cdf0e10cSrcweir if ( pHScrollbar->IsVisible( sal_False ) ) 1530*cdf0e10cSrcweir rToFill.Bottom() = nTmp; 1531*cdf0e10cSrcweir SetBorderPixel( rToFill ); 1532*cdf0e10cSrcweir } 1533*cdf0e10cSrcweir 1534*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1535*cdf0e10cSrcweir Beschreibung: 1536*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1537*cdf0e10cSrcweir 1538*cdf0e10cSrcweir 1539*cdf0e10cSrcweir void SwPagePreView::InnerResizePixel( const Point &rOfst, const Size &rSize ) 1540*cdf0e10cSrcweir { 1541*cdf0e10cSrcweir SvBorder aBorder; 1542*cdf0e10cSrcweir CalcAndSetBorderPixel( aBorder, sal_True ); 1543*cdf0e10cSrcweir Rectangle aRect( rOfst, rSize ); 1544*cdf0e10cSrcweir aRect += aBorder; 1545*cdf0e10cSrcweir ViewResizePixel( aViewWin, aRect.TopLeft(), aRect.GetSize(), 1546*cdf0e10cSrcweir aViewWin.GetOutputSizePixel(), 1547*cdf0e10cSrcweir sal_True, 1548*cdf0e10cSrcweir *pVScrollbar, *pHScrollbar, pPageUpBtn, pPageDownBtn, 0, 1549*cdf0e10cSrcweir *pScrollFill ); 1550*cdf0e10cSrcweir 1551*cdf0e10cSrcweir //EditWin niemals einstellen! 1552*cdf0e10cSrcweir //VisArea niemals einstellen! 1553*cdf0e10cSrcweir } 1554*cdf0e10cSrcweir 1555*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1556*cdf0e10cSrcweir Beschreibung: 1557*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1558*cdf0e10cSrcweir 1559*cdf0e10cSrcweir 1560*cdf0e10cSrcweir void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize ) 1561*cdf0e10cSrcweir { 1562*cdf0e10cSrcweir SvBorder aBorder; 1563*cdf0e10cSrcweir CalcAndSetBorderPixel( aBorder, sal_False ); 1564*cdf0e10cSrcweir ViewResizePixel( aViewWin, rOfst, rSize, aViewWin.GetOutputSizePixel(), 1565*cdf0e10cSrcweir sal_False, *pVScrollbar, 1566*cdf0e10cSrcweir *pHScrollbar, pPageUpBtn, pPageDownBtn, 0, *pScrollFill ); 1567*cdf0e10cSrcweir 1568*cdf0e10cSrcweir //EditWin niemals einstellen! 1569*cdf0e10cSrcweir 1570*cdf0e10cSrcweir Size aTmpSize( aViewWin.GetOutputSizePixel() ); 1571*cdf0e10cSrcweir Point aBottomRight( aViewWin.PixelToLogic( Point( aTmpSize.Width(), aTmpSize.Height() ) ) ); 1572*cdf0e10cSrcweir SetVisArea( Rectangle( Point(), aBottomRight ) ); 1573*cdf0e10cSrcweir 1574*cdf0e10cSrcweir //Aufruf der DocSzChgd-Methode der Scrollbars ist noetig, da vom maximalen 1575*cdf0e10cSrcweir //Scrollrange immer die halbe Hoehe der VisArea abgezogen wird. 1576*cdf0e10cSrcweir if ( pVScrollbar && 1577*cdf0e10cSrcweir aTmpSize.Width() > 0 && aTmpSize.Height() > 0 ) 1578*cdf0e10cSrcweir { 1579*cdf0e10cSrcweir ScrollDocSzChg(); 1580*cdf0e10cSrcweir } 1581*cdf0e10cSrcweir } 1582*cdf0e10cSrcweir 1583*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1584*cdf0e10cSrcweir Beschreibung: 1585*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1586*cdf0e10cSrcweir 1587*cdf0e10cSrcweir 1588*cdf0e10cSrcweir void SwPagePreView::SetVisArea( const Rectangle &rRect, sal_Bool bUpdateScrollbar ) 1589*cdf0e10cSrcweir { 1590*cdf0e10cSrcweir const Point aTopLeft(AlignToPixel(rRect.TopLeft())); 1591*cdf0e10cSrcweir const Point aBottomRight(AlignToPixel(rRect.BottomRight())); 1592*cdf0e10cSrcweir Rectangle aLR(aTopLeft,aBottomRight); 1593*cdf0e10cSrcweir 1594*cdf0e10cSrcweir if(aLR == aVisArea) 1595*cdf0e10cSrcweir return; 1596*cdf0e10cSrcweir // keine negative Position, keine neg. Groesse 1597*cdf0e10cSrcweir 1598*cdf0e10cSrcweir if(aLR.Top() < 0) 1599*cdf0e10cSrcweir { 1600*cdf0e10cSrcweir aLR.Bottom() += Abs(aLR.Top()); 1601*cdf0e10cSrcweir aLR.Top() = 0; 1602*cdf0e10cSrcweir } 1603*cdf0e10cSrcweir 1604*cdf0e10cSrcweir if(aLR.Left() < 0) 1605*cdf0e10cSrcweir { 1606*cdf0e10cSrcweir aLR.Right() += Abs(aLR.Left()); 1607*cdf0e10cSrcweir aLR.Left() = 0; 1608*cdf0e10cSrcweir } 1609*cdf0e10cSrcweir if(aLR.Right() < 0) aLR.Right() = 0; 1610*cdf0e10cSrcweir if(aLR.Bottom() < 0) aLR.Bottom() = 0; 1611*cdf0e10cSrcweir if(aLR == aVisArea || 1612*cdf0e10cSrcweir // JP 29.10.97: Bug 45173 - Leeres Rechteck nicht beachten 1613*cdf0e10cSrcweir ( 0 == aLR.Bottom() - aLR.Top() && 0 == aLR.Right() - aLR.Left() ) ) 1614*cdf0e10cSrcweir return; 1615*cdf0e10cSrcweir 1616*cdf0e10cSrcweir if( aLR.Left() > aLR.Right() || aLR.Top() > aLR.Bottom() ) 1617*cdf0e10cSrcweir return; 1618*cdf0e10cSrcweir 1619*cdf0e10cSrcweir //Bevor die Daten veraendert werden ggf. ein Update rufen. Dadurch wird 1620*cdf0e10cSrcweir //sichergestellt, da? anliegende Paints korrekt in Dokumentkoordinaten 1621*cdf0e10cSrcweir //umgerechnet werden. 1622*cdf0e10cSrcweir //Vorsichtshalber tun wir das nur wenn an der Shell eine Action laeuft, 1623*cdf0e10cSrcweir //denn dann wir nicht wirklich gepaintet sondern die Rechtecke werden 1624*cdf0e10cSrcweir //lediglich (in Dokumentkoordinaten) vorgemerkt. 1625*cdf0e10cSrcweir if( GetViewShell()->ActionPend() ) 1626*cdf0e10cSrcweir aViewWin.Update(); 1627*cdf0e10cSrcweir 1628*cdf0e10cSrcweir // setze am View-Win die aktuelle Size 1629*cdf0e10cSrcweir aVisArea = aLR; 1630*cdf0e10cSrcweir aViewWin.SetWinSize( aLR.GetSize() ); 1631*cdf0e10cSrcweir // OD 18.12.2002 #103492# - use new mode 1632*cdf0e10cSrcweir ChgPage( SwPagePreViewWin::MV_NEWWINSIZE, bUpdateScrollbar ); 1633*cdf0e10cSrcweir 1634*cdf0e10cSrcweir aViewWin.Invalidate(); 1635*cdf0e10cSrcweir } 1636*cdf0e10cSrcweir 1637*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1638*cdf0e10cSrcweir Beschreibung: 1639*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1640*cdf0e10cSrcweir 1641*cdf0e10cSrcweir 1642*cdf0e10cSrcweir IMPL_LINK( SwPagePreView, ScrollHdl, SwScrollbar *, pScrollbar ) 1643*cdf0e10cSrcweir { 1644*cdf0e10cSrcweir if(!GetViewShell()) 1645*cdf0e10cSrcweir return 0; 1646*cdf0e10cSrcweir if( !pScrollbar->IsHoriScroll() && 1647*cdf0e10cSrcweir pScrollbar->GetType() == SCROLL_DRAG && 1648*cdf0e10cSrcweir Help::IsQuickHelpEnabled() && 1649*cdf0e10cSrcweir GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow()) 1650*cdf0e10cSrcweir { 1651*cdf0e10cSrcweir // wieviele Seiten scrollen ?? 1652*cdf0e10cSrcweir String sStateStr(sPageStr); 1653*cdf0e10cSrcweir sal_uInt16 nThmbPos = (sal_uInt16)pScrollbar->GetThumbPos(); 1654*cdf0e10cSrcweir if( 1 == aViewWin.GetCol() || !nThmbPos ) 1655*cdf0e10cSrcweir ++nThmbPos; 1656*cdf0e10cSrcweir sStateStr += String::CreateFromInt32( nThmbPos ); 1657*cdf0e10cSrcweir Point aPos = pScrollbar->GetParent()->OutputToScreenPixel( 1658*cdf0e10cSrcweir pScrollbar->GetPosPixel()); 1659*cdf0e10cSrcweir aPos.Y() = pScrollbar->OutputToScreenPixel(pScrollbar->GetPointerPosPixel()).Y(); 1660*cdf0e10cSrcweir Size aSize = pScrollbar->GetSizePixel(); 1661*cdf0e10cSrcweir Rectangle aRect; 1662*cdf0e10cSrcweir aRect.Left() = aPos.X() -8; 1663*cdf0e10cSrcweir aRect.Right() = aRect.Left(); 1664*cdf0e10cSrcweir aRect.Top() = aPos.Y(); 1665*cdf0e10cSrcweir aRect.Bottom() = aRect.Top(); 1666*cdf0e10cSrcweir 1667*cdf0e10cSrcweir Help::ShowQuickHelp(pScrollbar, aRect, sStateStr, 1668*cdf0e10cSrcweir QUICKHELP_RIGHT|QUICKHELP_VCENTER); 1669*cdf0e10cSrcweir 1670*cdf0e10cSrcweir } 1671*cdf0e10cSrcweir else 1672*cdf0e10cSrcweir EndScrollHdl( pScrollbar ); 1673*cdf0e10cSrcweir return 0; 1674*cdf0e10cSrcweir } 1675*cdf0e10cSrcweir 1676*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1677*cdf0e10cSrcweir Beschreibung: 1678*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1679*cdf0e10cSrcweir 1680*cdf0e10cSrcweir 1681*cdf0e10cSrcweir IMPL_LINK( SwPagePreView, EndScrollHdl, SwScrollbar *, pScrollbar ) 1682*cdf0e10cSrcweir { 1683*cdf0e10cSrcweir if(!GetViewShell()) 1684*cdf0e10cSrcweir return 0; 1685*cdf0e10cSrcweir 1686*cdf0e10cSrcweir // OD 04.03.2003 #107369# - boolean to avoid unnecessary invalidation of the window. 1687*cdf0e10cSrcweir bool bInvalidateWin = true; 1688*cdf0e10cSrcweir 1689*cdf0e10cSrcweir if( !pScrollbar->IsHoriScroll() ) // scroll vertically 1690*cdf0e10cSrcweir { 1691*cdf0e10cSrcweir if ( Help::IsQuickHelpEnabled() ) 1692*cdf0e10cSrcweir Help::ShowQuickHelp(pScrollbar, Rectangle(), aEmptyStr, 0); 1693*cdf0e10cSrcweir if ( GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow() ) 1694*cdf0e10cSrcweir { 1695*cdf0e10cSrcweir // wieviele Seiten scrollen ?? 1696*cdf0e10cSrcweir sal_uInt16 nThmbPos = (sal_uInt16)pScrollbar->GetThumbPos(); 1697*cdf0e10cSrcweir // OD 05.12.2002 #103492# - adjust to new preview functionality 1698*cdf0e10cSrcweir if( nThmbPos != aViewWin.SelectedPage() ) 1699*cdf0e10cSrcweir { 1700*cdf0e10cSrcweir // OD 17.01.2003 #103492# - consider case that page <nThmbPos> 1701*cdf0e10cSrcweir // is already visible 1702*cdf0e10cSrcweir SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout(); 1703*cdf0e10cSrcweir if ( pPagePrevwLay->IsPageVisible( nThmbPos ) ) 1704*cdf0e10cSrcweir { 1705*cdf0e10cSrcweir pPagePrevwLay->MarkNewSelectedPage( nThmbPos ); 1706*cdf0e10cSrcweir // OD 04.03.2003 #107369# - invalidation of window is unnecessary 1707*cdf0e10cSrcweir bInvalidateWin = false; 1708*cdf0e10cSrcweir } 1709*cdf0e10cSrcweir else 1710*cdf0e10cSrcweir { 1711*cdf0e10cSrcweir // OD 17.01.2003 #103492# - consider whether layout columns 1712*cdf0e10cSrcweir // fit or not. 1713*cdf0e10cSrcweir if ( !pPagePrevwLay->DoesPreviewLayoutColsFitIntoWindow() ) 1714*cdf0e10cSrcweir { 1715*cdf0e10cSrcweir aViewWin.SetSttPage( nThmbPos ); 1716*cdf0e10cSrcweir aViewWin.SetSelectedPage( nThmbPos ); 1717*cdf0e10cSrcweir ChgPage( SwPagePreViewWin::MV_SCROLL, sal_False ); 1718*cdf0e10cSrcweir // OD 20.01.2003 #103492# - update scrollbars 1719*cdf0e10cSrcweir ScrollViewSzChg(); 1720*cdf0e10cSrcweir } 1721*cdf0e10cSrcweir else 1722*cdf0e10cSrcweir { 1723*cdf0e10cSrcweir // OD 04.03.2003 #107369# - correct scroll amount 1724*cdf0e10cSrcweir const sal_Int16 nPageDiff = nThmbPos - aViewWin.SelectedPage(); 1725*cdf0e10cSrcweir const sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol(); 1726*cdf0e10cSrcweir sal_Int16 nWinPagesToScroll = nPageDiff / nVisPages; 1727*cdf0e10cSrcweir if ( nPageDiff % nVisPages ) 1728*cdf0e10cSrcweir { 1729*cdf0e10cSrcweir // decrease/increase number of preview pages to scroll 1730*cdf0e10cSrcweir nPageDiff < 0 ? --nWinPagesToScroll : ++nWinPagesToScroll; 1731*cdf0e10cSrcweir } 1732*cdf0e10cSrcweir aViewWin.SetSelectedPage( nThmbPos ); 1733*cdf0e10cSrcweir aViewWin.Scroll( 0, pPagePrevwLay->GetWinPagesScrollAmount( nWinPagesToScroll ) ); 1734*cdf0e10cSrcweir } 1735*cdf0e10cSrcweir } 1736*cdf0e10cSrcweir // OD 17.01.2003 #103492# - update accessibility 1737*cdf0e10cSrcweir GetViewShell()->ShowPreViewSelection( nThmbPos ); 1738*cdf0e10cSrcweir } 1739*cdf0e10cSrcweir else 1740*cdf0e10cSrcweir { 1741*cdf0e10cSrcweir // OD 04.03.2003 #107369# - invalidation of window is unnecessary 1742*cdf0e10cSrcweir bInvalidateWin = false; 1743*cdf0e10cSrcweir } 1744*cdf0e10cSrcweir } 1745*cdf0e10cSrcweir else 1746*cdf0e10cSrcweir { 1747*cdf0e10cSrcweir long nThmbPos = pScrollbar->GetThumbPos(); 1748*cdf0e10cSrcweir aViewWin.Scroll(0, nThmbPos - aViewWin.GetPaintedPreviewDocRect().Top()); 1749*cdf0e10cSrcweir } 1750*cdf0e10cSrcweir } 1751*cdf0e10cSrcweir else 1752*cdf0e10cSrcweir { 1753*cdf0e10cSrcweir long nThmbPos = pScrollbar->GetThumbPos(); 1754*cdf0e10cSrcweir aViewWin.Scroll(nThmbPos - aViewWin.GetPaintedPreviewDocRect().Left(), 0); 1755*cdf0e10cSrcweir } 1756*cdf0e10cSrcweir // OD 24.03.2003 #108282# - additional invalidate page status. 1757*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 1758*cdf0e10cSrcweir { 1759*cdf0e10cSrcweir FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN, 1760*cdf0e10cSrcweir FN_STAT_PAGE, 0 1761*cdf0e10cSrcweir }; 1762*cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 1763*cdf0e10cSrcweir rBindings.Invalidate( aInval ); 1764*cdf0e10cSrcweir // OD 04.03.2003 #107369# - control invalidation of window 1765*cdf0e10cSrcweir if ( bInvalidateWin ) 1766*cdf0e10cSrcweir { 1767*cdf0e10cSrcweir aViewWin.Invalidate(); 1768*cdf0e10cSrcweir } 1769*cdf0e10cSrcweir return 0; 1770*cdf0e10cSrcweir } 1771*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1772*cdf0e10cSrcweir Beschreibung: 1773*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1774*cdf0e10cSrcweir 1775*cdf0e10cSrcweir 1776*cdf0e10cSrcweir Point SwPagePreView::AlignToPixel(const Point &rPt) const 1777*cdf0e10cSrcweir { 1778*cdf0e10cSrcweir return aViewWin.PixelToLogic( aViewWin.LogicToPixel( rPt ) ); 1779*cdf0e10cSrcweir } 1780*cdf0e10cSrcweir 1781*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1782*cdf0e10cSrcweir Beschreibung: 1783*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1784*cdf0e10cSrcweir 1785*cdf0e10cSrcweir 1786*cdf0e10cSrcweir void SwPagePreView::DocSzChgd( const Size &rSz ) 1787*cdf0e10cSrcweir { 1788*cdf0e10cSrcweir if( aDocSz == rSz ) 1789*cdf0e10cSrcweir return; 1790*cdf0e10cSrcweir 1791*cdf0e10cSrcweir aDocSz = rSz; 1792*cdf0e10cSrcweir 1793*cdf0e10cSrcweir // --> OD 2009-08-20 #i96726# 1794*cdf0e10cSrcweir // Due to the multiple page layout it is needed to trigger recalculation 1795*cdf0e10cSrcweir // of the page preview layout, even if the count of pages is not changing. 1796*cdf0e10cSrcweir mnPageCount = GetViewShell()->GetNumPages(); 1797*cdf0e10cSrcweir 1798*cdf0e10cSrcweir if( aVisArea.GetWidth() ) 1799*cdf0e10cSrcweir { 1800*cdf0e10cSrcweir ChgPage( SwPagePreViewWin::MV_CALC, sal_True ); 1801*cdf0e10cSrcweir ScrollDocSzChg(); 1802*cdf0e10cSrcweir 1803*cdf0e10cSrcweir aViewWin.Invalidate(); 1804*cdf0e10cSrcweir } 1805*cdf0e10cSrcweir // <-- 1806*cdf0e10cSrcweir } 1807*cdf0e10cSrcweir 1808*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1809*cdf0e10cSrcweir Beschreibung: 1810*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1811*cdf0e10cSrcweir 1812*cdf0e10cSrcweir 1813*cdf0e10cSrcweir void SwPagePreView::ScrollViewSzChg() 1814*cdf0e10cSrcweir { 1815*cdf0e10cSrcweir if(!GetViewShell()) 1816*cdf0e10cSrcweir return ; 1817*cdf0e10cSrcweir if(pVScrollbar) 1818*cdf0e10cSrcweir { 1819*cdf0e10cSrcweir if(GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow()) 1820*cdf0e10cSrcweir { 1821*cdf0e10cSrcweir //vertical scrolling by row 1822*cdf0e10cSrcweir // OD 04.12.2002 #103492# - adjust to new preview functionality 1823*cdf0e10cSrcweir sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol(); 1824*cdf0e10cSrcweir pVScrollbar->SetVisibleSize( nVisPages ); 1825*cdf0e10cSrcweir // OD 19.02.2003 #107369# - set selected page as scroll bar position, 1826*cdf0e10cSrcweir // if it is visible. 1827*cdf0e10cSrcweir SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout(); 1828*cdf0e10cSrcweir if ( pPagePrevwLay->IsPageVisible( aViewWin.SelectedPage() ) ) 1829*cdf0e10cSrcweir { 1830*cdf0e10cSrcweir pVScrollbar->SetThumbPos( aViewWin.SelectedPage() ); 1831*cdf0e10cSrcweir } 1832*cdf0e10cSrcweir else 1833*cdf0e10cSrcweir { 1834*cdf0e10cSrcweir pVScrollbar->SetThumbPos( aViewWin.GetSttPage() ); 1835*cdf0e10cSrcweir } 1836*cdf0e10cSrcweir pVScrollbar->SetLineSize( aViewWin.GetCol() ); 1837*cdf0e10cSrcweir pVScrollbar->SetPageSize( nVisPages ); 1838*cdf0e10cSrcweir // calculate and set scrollbar range 1839*cdf0e10cSrcweir Range aScrollbarRange( 1, mnPageCount ); 1840*cdf0e10cSrcweir // increase range by one, because left-top-corner is left blank. 1841*cdf0e10cSrcweir ++aScrollbarRange.Max(); 1842*cdf0e10cSrcweir // OD 17.01.2003 #103492# - increase range in order to access all pages 1843*cdf0e10cSrcweir aScrollbarRange.Max() += ( nVisPages - 1 ); 1844*cdf0e10cSrcweir pVScrollbar->SetRange( aScrollbarRange ); 1845*cdf0e10cSrcweir } 1846*cdf0e10cSrcweir else //vertical scrolling by pixel 1847*cdf0e10cSrcweir { 1848*cdf0e10cSrcweir const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect(); 1849*cdf0e10cSrcweir const Size& rPreviewSize = 1850*cdf0e10cSrcweir GetViewShell()->PagePreviewLayout()->GetPrevwDocSize(); 1851*cdf0e10cSrcweir pVScrollbar->SetRangeMax(rPreviewSize.Height()) ; 1852*cdf0e10cSrcweir long nVisHeight = rDocRect.GetHeight(); 1853*cdf0e10cSrcweir pVScrollbar->SetVisibleSize( nVisHeight ); 1854*cdf0e10cSrcweir pVScrollbar->SetThumbPos( rDocRect.Top() ); 1855*cdf0e10cSrcweir pVScrollbar->SetLineSize( nVisHeight / 10 ); 1856*cdf0e10cSrcweir pVScrollbar->SetPageSize( nVisHeight / 2 ); 1857*cdf0e10cSrcweir } 1858*cdf0e10cSrcweir } 1859*cdf0e10cSrcweir if(pHScrollbar) 1860*cdf0e10cSrcweir { 1861*cdf0e10cSrcweir const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect(); 1862*cdf0e10cSrcweir const Size& rPreviewSize = 1863*cdf0e10cSrcweir GetViewShell()->PagePreviewLayout()->GetPrevwDocSize(); 1864*cdf0e10cSrcweir long nVisWidth = 0; 1865*cdf0e10cSrcweir long nThumb = 0; 1866*cdf0e10cSrcweir Range aRange(0,0); 1867*cdf0e10cSrcweir 1868*cdf0e10cSrcweir if(rDocRect.GetWidth() < rPreviewSize.Width()) 1869*cdf0e10cSrcweir { 1870*cdf0e10cSrcweir nVisWidth = rDocRect.GetWidth(); 1871*cdf0e10cSrcweir nThumb = rDocRect.Left(); 1872*cdf0e10cSrcweir aRange = Range(0, rPreviewSize.Width()); 1873*cdf0e10cSrcweir } 1874*cdf0e10cSrcweir pHScrollbar->SetRange( aRange ); 1875*cdf0e10cSrcweir pHScrollbar->SetVisibleSize( nVisWidth ); 1876*cdf0e10cSrcweir pHScrollbar->SetThumbPos( nThumb ); 1877*cdf0e10cSrcweir pHScrollbar->SetLineSize( nVisWidth / 10 ); 1878*cdf0e10cSrcweir pHScrollbar->SetPageSize( nVisWidth / 2 ); 1879*cdf0e10cSrcweir } 1880*cdf0e10cSrcweir } 1881*cdf0e10cSrcweir 1882*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1883*cdf0e10cSrcweir Beschreibung: 1884*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1885*cdf0e10cSrcweir 1886*cdf0e10cSrcweir 1887*cdf0e10cSrcweir void SwPagePreView::ScrollDocSzChg() 1888*cdf0e10cSrcweir { 1889*cdf0e10cSrcweir ScrollViewSzChg(); 1890*cdf0e10cSrcweir } 1891*cdf0e10cSrcweir 1892*cdf0e10cSrcweir 1893*cdf0e10cSrcweir /* */ 1894*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1895*cdf0e10cSrcweir Beschreibung: 1896*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1897*cdf0e10cSrcweir 1898*cdf0e10cSrcweir 1899*cdf0e10cSrcweir // alles zum Thema Drucken 1900*cdf0e10cSrcweir 1901*cdf0e10cSrcweir SfxPrinter* SwPagePreView::GetPrinter( sal_Bool bCreate ) 1902*cdf0e10cSrcweir { 1903*cdf0e10cSrcweir return aViewWin.GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate ); 1904*cdf0e10cSrcweir } 1905*cdf0e10cSrcweir 1906*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1907*cdf0e10cSrcweir Beschreibung: 1908*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1909*cdf0e10cSrcweir 1910*cdf0e10cSrcweir 1911*cdf0e10cSrcweir sal_uInt16 SwPagePreView::SetPrinter( SfxPrinter *pNew, sal_uInt16 nDiffFlags, bool ) 1912*cdf0e10cSrcweir { 1913*cdf0e10cSrcweir ViewShell &rSh = *GetViewShell(); 1914*cdf0e10cSrcweir SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false ); 1915*cdf0e10cSrcweir if ( pOld && pOld->IsPrinting() ) 1916*cdf0e10cSrcweir return SFX_PRINTERROR_BUSY; 1917*cdf0e10cSrcweir 1918*cdf0e10cSrcweir SwEditShell &rESh = (SwEditShell&)rSh; //Buh... 1919*cdf0e10cSrcweir if( ( SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP ) & nDiffFlags ) 1920*cdf0e10cSrcweir { 1921*cdf0e10cSrcweir rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true ); 1922*cdf0e10cSrcweir if( nDiffFlags & SFX_PRINTER_PRINTER ) 1923*cdf0e10cSrcweir rESh.SetModified(); 1924*cdf0e10cSrcweir } 1925*cdf0e10cSrcweir if ( ( nDiffFlags & SFX_PRINTER_OPTIONS ) == SFX_PRINTER_OPTIONS ) 1926*cdf0e10cSrcweir ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, sal_False ); 1927*cdf0e10cSrcweir 1928*cdf0e10cSrcweir const sal_Bool bChgOri = nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ? sal_True : sal_False; 1929*cdf0e10cSrcweir const sal_Bool bChgSize= nDiffFlags & SFX_PRINTER_CHG_SIZE ? sal_True : sal_False; 1930*cdf0e10cSrcweir if ( bChgOri || bChgSize ) 1931*cdf0e10cSrcweir { 1932*cdf0e10cSrcweir rESh.StartAllAction(); 1933*cdf0e10cSrcweir if ( bChgOri ) 1934*cdf0e10cSrcweir rSh.ChgAllPageOrientation( sal_uInt16(pNew->GetOrientation()) ); 1935*cdf0e10cSrcweir if ( bChgSize ) 1936*cdf0e10cSrcweir { 1937*cdf0e10cSrcweir Size aSz( SvxPaperInfo::GetPaperSize( pNew ) ); 1938*cdf0e10cSrcweir rSh.ChgAllPageSize( aSz ); 1939*cdf0e10cSrcweir } 1940*cdf0e10cSrcweir if( !bNormalPrint ) 1941*cdf0e10cSrcweir aViewWin.CalcWish( aViewWin.GetRow(), aViewWin.GetCol() ); 1942*cdf0e10cSrcweir rESh.SetModified(); 1943*cdf0e10cSrcweir rESh.EndAllAction(); 1944*cdf0e10cSrcweir 1945*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 1946*cdf0e10cSrcweir { 1947*cdf0e10cSrcweir SID_ATTR_LONG_ULSPACE, SID_ATTR_LONG_LRSPACE, 1948*cdf0e10cSrcweir SID_RULER_BORDERS, SID_RULER_PAGE_POS, 0 1949*cdf0e10cSrcweir }; 1950*cdf0e10cSrcweir #ifdef DBG_UTIL 1951*cdf0e10cSrcweir { 1952*cdf0e10cSrcweir const sal_uInt16* pPtr = aInval + 1; 1953*cdf0e10cSrcweir do { 1954*cdf0e10cSrcweir ASSERT( *(pPtr - 1) < *pPtr, "falsche Sortierung!" ); 1955*cdf0e10cSrcweir } while( *++pPtr ); 1956*cdf0e10cSrcweir } 1957*cdf0e10cSrcweir #endif 1958*cdf0e10cSrcweir 1959*cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(aInval); 1960*cdf0e10cSrcweir } 1961*cdf0e10cSrcweir 1962*cdf0e10cSrcweir return 0; 1963*cdf0e10cSrcweir } 1964*cdf0e10cSrcweir 1965*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1966*cdf0e10cSrcweir Beschreibung: 1967*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1968*cdf0e10cSrcweir 1969*cdf0e10cSrcweir 1970*cdf0e10cSrcweir SfxTabPage* SwPagePreView::CreatePrintOptionsPage( Window *pParent, 1971*cdf0e10cSrcweir const SfxItemSet &rOptions ) 1972*cdf0e10cSrcweir { 1973*cdf0e10cSrcweir return ::CreatePrintOptionsPage( pParent, rOptions, !bNormalPrint ); 1974*cdf0e10cSrcweir } 1975*cdf0e10cSrcweir 1976*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1977*cdf0e10cSrcweir Beschreibung: 1978*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1979*cdf0e10cSrcweir 1980*cdf0e10cSrcweir 1981*cdf0e10cSrcweir // OD 18.12.2002 #103492# - no longer needed ?? 1982*cdf0e10cSrcweir Size SwPagePreView::GetOptimalSizePixel() const 1983*cdf0e10cSrcweir { 1984*cdf0e10cSrcweir ASSERT( false, "overloaded virtual method <SwPagePreView::GetOptimalSizePixel()> needed ??" ) 1985*cdf0e10cSrcweir return Size( -1, -1 ); 1986*cdf0e10cSrcweir /* 1987*cdf0e10cSrcweir //JP 09.06.99: was wird hier errechnet ????? 1988*cdf0e10cSrcweir // ALT: 1989*cdf0e10cSrcweir // SfxApplicationWindow* pWin = SFX_APPWINDOW ; 1990*cdf0e10cSrcweir // Rectangle aRect = pWin->GetClientAreaPixel(); 1991*cdf0e10cSrcweir 1992*cdf0e10cSrcweir Window& rWin = GetViewFrame()->GetWindow(); 1993*cdf0e10cSrcweir Rectangle aRect( Point(0, 0), rWin.GetOutputSizePixel() ); 1994*cdf0e10cSrcweir Size aMaxSize( aRect.GetWidth(), aRect.GetHeight() ); 1995*cdf0e10cSrcweir Size aInSize = rWin.GetOutputSizePixel(); 1996*cdf0e10cSrcweir Size aOutSize = rWin.GetSizePixel(); 1997*cdf0e10cSrcweir sal_uInt16 nXBorder = sal_uInt16(aOutSize.Width() - aInSize.Width()); 1998*cdf0e10cSrcweir sal_uInt16 nYBorder = sal_uInt16(aOutSize.Height() - aInSize.Height()); 1999*cdf0e10cSrcweir aMaxSize.Width() -= nXBorder; 2000*cdf0e10cSrcweir //'auf Verdacht' etwas vom Border abziehen (Menue) 2001*cdf0e10cSrcweir nYBorder -= (nYBorder - nXBorder) / 2; 2002*cdf0e10cSrcweir aMaxSize.Height() -= nYBorder; 2003*cdf0e10cSrcweir //mit der max. moeglichen Outputsize guenstigstes Verhaeltnis ausrechnen 2004*cdf0e10cSrcweir aViewWin.GetOptimalSize(aMaxSize); 2005*cdf0e10cSrcweir // Border wieder dazuzaehlen 2006*cdf0e10cSrcweir aMaxSize.Height() += nYBorder; 2007*cdf0e10cSrcweir aMaxSize.Width() += nXBorder; 2008*cdf0e10cSrcweir return aMaxSize; 2009*cdf0e10cSrcweir */ 2010*cdf0e10cSrcweir } 2011*cdf0e10cSrcweir 2012*cdf0e10cSrcweir /*-------------------------------------------------------------------- 2013*cdf0e10cSrcweir Beschreibung: 2014*cdf0e10cSrcweir --------------------------------------------------------------------*/ 2015*cdf0e10cSrcweir 2016*cdf0e10cSrcweir // OD 12.12.2002 #103492# 2017*cdf0e10cSrcweir void SwPagePreViewWin::SetViewShell( ViewShell* pShell ) 2018*cdf0e10cSrcweir { 2019*cdf0e10cSrcweir mpViewShell = pShell; 2020*cdf0e10cSrcweir if ( mpViewShell && mpViewShell->IsPreView() ) 2021*cdf0e10cSrcweir { 2022*cdf0e10cSrcweir mpPgPrevwLayout = mpViewShell->PagePreviewLayout(); 2023*cdf0e10cSrcweir } 2024*cdf0e10cSrcweir } 2025*cdf0e10cSrcweir 2026*cdf0e10cSrcweir void SwPagePreViewWin::RepaintCoreRect( const SwRect& rRect ) 2027*cdf0e10cSrcweir { 2028*cdf0e10cSrcweir // OD 2004-03-04 #i24183# 2029*cdf0e10cSrcweir if ( mpPgPrevwLayout->PreviewLayoutValid() ) 2030*cdf0e10cSrcweir { 2031*cdf0e10cSrcweir mpPgPrevwLayout->Repaint( Rectangle( rRect.Pos(), rRect.SSize() ) ); 2032*cdf0e10cSrcweir } 2033*cdf0e10cSrcweir } 2034*cdf0e10cSrcweir 2035*cdf0e10cSrcweir /** method to adjust preview to a new zoom factor 2036*cdf0e10cSrcweir 2037*cdf0e10cSrcweir OD 02.12.2002 #103492# 2038*cdf0e10cSrcweir OD 24.09.2003 #i19975# - also consider zoom type - adding parameter <_eZoomType> 2039*cdf0e10cSrcweir */ 2040*cdf0e10cSrcweir void SwPagePreViewWin::AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor, 2041*cdf0e10cSrcweir const SvxZoomType _eZoomType ) 2042*cdf0e10cSrcweir { 2043*cdf0e10cSrcweir // OD 24.09.2003 #i19975# - consider zoom type 2044*cdf0e10cSrcweir if ( _eZoomType == SVX_ZOOM_WHOLEPAGE ) 2045*cdf0e10cSrcweir { 2046*cdf0e10cSrcweir mnRow = 1; 2047*cdf0e10cSrcweir mnCol = 1; 2048*cdf0e10cSrcweir mpPgPrevwLayout->Init( mnCol, mnRow, maPxWinSize, true ); 2049*cdf0e10cSrcweir mpPgPrevwLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize, 2050*cdf0e10cSrcweir mnSttPage, maPaintedPreviewDocRect ); 2051*cdf0e10cSrcweir SetSelectedPage( mnSttPage ); 2052*cdf0e10cSrcweir SetPagePreview(mnRow, mnCol); 2053*cdf0e10cSrcweir maScale = GetMapMode().GetScaleX(); 2054*cdf0e10cSrcweir } 2055*cdf0e10cSrcweir else if ( _nZoomFactor != 0 ) 2056*cdf0e10cSrcweir { 2057*cdf0e10cSrcweir // calculate new scaling and set mapping mode appropriately. 2058*cdf0e10cSrcweir Fraction aNewScale( _nZoomFactor, 100 ); 2059*cdf0e10cSrcweir MapMode aNewMapMode = GetMapMode(); 2060*cdf0e10cSrcweir aNewMapMode.SetScaleX( aNewScale ); 2061*cdf0e10cSrcweir aNewMapMode.SetScaleY( aNewScale ); 2062*cdf0e10cSrcweir SetMapMode( aNewMapMode ); 2063*cdf0e10cSrcweir 2064*cdf0e10cSrcweir // calculate new start position for preview paint 2065*cdf0e10cSrcweir Size aNewWinSize = PixelToLogic( maPxWinSize ); 2066*cdf0e10cSrcweir Point aNewPaintStartPos = 2067*cdf0e10cSrcweir mpPgPrevwLayout->GetPreviewStartPosForNewScale( aNewScale, maScale, aNewWinSize ); 2068*cdf0e10cSrcweir 2069*cdf0e10cSrcweir // remember new scaling and prepare preview paint 2070*cdf0e10cSrcweir // Note: paint of preview will be performed by a corresponding invalidate 2071*cdf0e10cSrcweir // due to property changes. 2072*cdf0e10cSrcweir maScale = aNewScale; 2073*cdf0e10cSrcweir mpPgPrevwLayout->Prepare( 0, aNewPaintStartPos, maPxWinSize, 2074*cdf0e10cSrcweir mnSttPage, maPaintedPreviewDocRect ); 2075*cdf0e10cSrcweir } 2076*cdf0e10cSrcweir 2077*cdf0e10cSrcweir } 2078*cdf0e10cSrcweir /* -----------------04.12.2002 10:46----------------- 2079*cdf0e10cSrcweir * pixel scrolling - horizontally always or vertically 2080*cdf0e10cSrcweir * when less than the desired number of rows fits into 2081*cdf0e10cSrcweir * the view 2082*cdf0e10cSrcweir * --------------------------------------------------*/ 2083*cdf0e10cSrcweir void SwPagePreViewWin::Scroll(long nXMove, long nYMove, sal_uInt16 /*nFlags*/) 2084*cdf0e10cSrcweir { 2085*cdf0e10cSrcweir maPaintedPreviewDocRect.Move(nXMove, nYMove); 2086*cdf0e10cSrcweir mpPgPrevwLayout->Prepare( 0, maPaintedPreviewDocRect.TopLeft(), 2087*cdf0e10cSrcweir maPxWinSize, mnSttPage, 2088*cdf0e10cSrcweir maPaintedPreviewDocRect ); 2089*cdf0e10cSrcweir 2090*cdf0e10cSrcweir } 2091*cdf0e10cSrcweir 2092*cdf0e10cSrcweir sal_Bool SwPagePreView::HandleWheelCommands( const CommandEvent& rCEvt ) 2093*cdf0e10cSrcweir { 2094*cdf0e10cSrcweir sal_Bool bOk = sal_False; 2095*cdf0e10cSrcweir const CommandWheelData* pWData = rCEvt.GetWheelData(); 2096*cdf0e10cSrcweir if( pWData && COMMAND_WHEEL_ZOOM == pWData->GetMode() ) 2097*cdf0e10cSrcweir { 2098*cdf0e10cSrcweir if(!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport()) 2099*cdf0e10cSrcweir { 2100*cdf0e10cSrcweir sal_uInt16 nFactor = GetViewShell()->GetViewOptions()->GetZoom(); 2101*cdf0e10cSrcweir const sal_uInt16 nOffset = 10; 2102*cdf0e10cSrcweir if( 0L > pWData->GetDelta() ) 2103*cdf0e10cSrcweir { 2104*cdf0e10cSrcweir nFactor -= nOffset; 2105*cdf0e10cSrcweir if(nFactor < MIN_PREVIEW_ZOOM) 2106*cdf0e10cSrcweir nFactor = MIN_PREVIEW_ZOOM; 2107*cdf0e10cSrcweir } 2108*cdf0e10cSrcweir else 2109*cdf0e10cSrcweir { 2110*cdf0e10cSrcweir nFactor += nOffset; 2111*cdf0e10cSrcweir if(nFactor > MAX_PREVIEW_ZOOM) 2112*cdf0e10cSrcweir nFactor = MAX_PREVIEW_ZOOM; 2113*cdf0e10cSrcweir } 2114*cdf0e10cSrcweir SetZoom(SVX_ZOOM_PERCENT, nFactor); 2115*cdf0e10cSrcweir } 2116*cdf0e10cSrcweir bOk = sal_True; 2117*cdf0e10cSrcweir } 2118*cdf0e10cSrcweir else 2119*cdf0e10cSrcweir bOk = aViewWin.HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar ); 2120*cdf0e10cSrcweir return bOk; 2121*cdf0e10cSrcweir } 2122*cdf0e10cSrcweir 2123*cdf0e10cSrcweir 2124*cdf0e10cSrcweir uno::Reference< ::com::sun::star::accessibility::XAccessible > 2125*cdf0e10cSrcweir SwPagePreViewWin::CreateAccessible() 2126*cdf0e10cSrcweir { 2127*cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex()); // this should have 2128*cdf0e10cSrcweir // happend already!!! 2129*cdf0e10cSrcweir 2130*cdf0e10cSrcweir DBG_ASSERT( GetViewShell() != NULL, "We need a view shell" ); 2131*cdf0e10cSrcweir return GetViewShell()->CreateAccessiblePreview(); 2132*cdf0e10cSrcweir } 2133*cdf0e10cSrcweir 2134*cdf0e10cSrcweir /* -----------------------------06.05.2002 13:18------------------------------ 2135*cdf0e10cSrcweir 2136*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2137*cdf0e10cSrcweir void SwPagePreView::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions) 2138*cdf0e10cSrcweir { 2139*cdf0e10cSrcweir GetViewShell()->ApplyAccessiblityOptions(rAccessibilityOptions); 2140*cdf0e10cSrcweir } 2141*cdf0e10cSrcweir /* -----------------------------2002/06/26 14:30------------------------------ 2142*cdf0e10cSrcweir 2143*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2144*cdf0e10cSrcweir void SwPagePreView::ShowHScrollbar(sal_Bool bShow) 2145*cdf0e10cSrcweir { 2146*cdf0e10cSrcweir pHScrollbar->Show(bShow); 2147*cdf0e10cSrcweir InvalidateBorder(); 2148*cdf0e10cSrcweir } 2149*cdf0e10cSrcweir 2150*cdf0e10cSrcweir /* -----------------------------2002/06/26 14:30------------------------------ 2151*cdf0e10cSrcweir 2152*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2153*cdf0e10cSrcweir void SwPagePreView::ShowVScrollbar(sal_Bool bShow) 2154*cdf0e10cSrcweir { 2155*cdf0e10cSrcweir pVScrollbar->Show(bShow); 2156*cdf0e10cSrcweir InvalidateBorder(); 2157*cdf0e10cSrcweir } 2158*cdf0e10cSrcweir 2159*cdf0e10cSrcweir /* -----------------25.11.2002 16:36----------------- 2160*cdf0e10cSrcweir * 2161*cdf0e10cSrcweir * --------------------------------------------------*/ 2162*cdf0e10cSrcweir void SwPagePreView::SetZoom(SvxZoomType eType, sal_uInt16 nFactor) 2163*cdf0e10cSrcweir { 2164*cdf0e10cSrcweir ViewShell& rSh = *GetViewShell(); 2165*cdf0e10cSrcweir SwViewOption aOpt(*rSh.GetViewOptions()); 2166*cdf0e10cSrcweir // OD 16.12.2002 #103492# - perform action only on changes of zoom or zoom type. 2167*cdf0e10cSrcweir if ( aOpt.GetZoom() != nFactor || 2168*cdf0e10cSrcweir aOpt.GetZoomType() != eType ) 2169*cdf0e10cSrcweir { 2170*cdf0e10cSrcweir aOpt.SetZoom(nFactor); 2171*cdf0e10cSrcweir aOpt.SetZoomType(eType); 2172*cdf0e10cSrcweir rSh.ApplyViewOptions( aOpt ); 2173*cdf0e10cSrcweir lcl_InvalidateZoomSlots(GetViewFrame()->GetBindings()); 2174*cdf0e10cSrcweir // OD 02.12.2002 #103492# 2175*cdf0e10cSrcweir // OD 24.09.2003 #i19975# - also consider zoom type 2176*cdf0e10cSrcweir aViewWin.AdjustPreviewToNewZoom( nFactor, eType ); 2177*cdf0e10cSrcweir ScrollViewSzChg(); 2178*cdf0e10cSrcweir } 2179*cdf0e10cSrcweir } 2180*cdf0e10cSrcweir 2181*cdf0e10cSrcweir /** adjust position of vertical scrollbar 2182*cdf0e10cSrcweir 2183*cdf0e10cSrcweir OD 19.02.2003 #107369 2184*cdf0e10cSrcweir 2185*cdf0e10cSrcweir @author OD 2186*cdf0e10cSrcweir */ 2187*cdf0e10cSrcweir void SwPagePreView::SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos ) 2188*cdf0e10cSrcweir { 2189*cdf0e10cSrcweir if ( pVScrollbar ) 2190*cdf0e10cSrcweir { 2191*cdf0e10cSrcweir pVScrollbar->SetThumbPos( _nNewThumbPos ); 2192*cdf0e10cSrcweir } 2193*cdf0e10cSrcweir } 2194