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