LCOV - code coverage report
Current view: top level - sw/source/ui/uiview - pview.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 908 1.2 %
Date: 2012-08-25 Functions: 6 74 8.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 10 1223 0.8 %

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

Generated by: LCOV version 1.10