LCOV - code coverage report
Current view: top level - sw/source/ui/docvw - edtwin3.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 37 72 51.4 %
Date: 2012-08-25 Functions: 6 12 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 23 69 33.3 %

           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                 :            : #include <hintids.hxx>
      30                 :            : #include <vcl/settings.hxx>
      31                 :            : #include <svx/ruler.hxx>
      32                 :            : #include <viewopt.hxx>
      33                 :            : #include "view.hxx"
      34                 :            : #include "wrtsh.hxx"
      35                 :            : #include "basesh.hxx"
      36                 :            : #include "pview.hxx"
      37                 :            : #include "mdiexp.hxx"
      38                 :            : #include "edtwin.hxx"
      39                 :            : #include "swmodule.hxx"
      40                 :            : #include "modcfg.hxx"
      41                 :            : #include "swtable.hxx"
      42                 :            : #include "docsh.hxx"
      43                 :            : #include "pagedesc.hxx"     // Aktuelles Seitenformat
      44                 :            : #include <frmatr.hxx>
      45                 :            : #include <editeng/frmdiritem.hxx>
      46                 :            : 
      47                 :            : 
      48                 :            : /*--------------------------------------------------------------------
      49                 :            :     Description:    Core-Notify
      50                 :            :  --------------------------------------------------------------------*/
      51                 :            : 
      52                 :            : 
      53                 :            : 
      54                 :        763 : void ScrollMDI( ViewShell* pVwSh, const SwRect &rRect,
      55                 :            :                 sal_uInt16 nRangeX, sal_uInt16 nRangeY)
      56                 :            : {
      57                 :        763 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      58 [ +  - ][ +  - ]:        763 :     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
                 [ +  - ]
      59         [ +  - ]:        763 :         ((SwView *)pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY );
      60                 :        763 : }
      61                 :            : 
      62                 :            : /*--------------------------------------------------------------------
      63                 :            :     Description:    Docmdi - movable
      64                 :            :  --------------------------------------------------------------------*/
      65                 :            : 
      66                 :            : 
      67                 :            : 
      68                 :      29277 : sal_Bool IsScrollMDI( ViewShell* pVwSh, const SwRect &rRect )
      69                 :            : {
      70                 :      29277 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      71 [ +  - ][ +  - ]:      29277 :     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
                 [ +  - ]
      72         [ +  - ]:      29277 :         return (((SwView *)pSfxVwSh)->IsScroll(rRect.SVRect()));
      73                 :      29277 :     return sal_False;
      74                 :            : }
      75                 :            : 
      76                 :            : /*--------------------------------------------------------------------
      77                 :            :     Description:    Notify for size change
      78                 :            :  --------------------------------------------------------------------*/
      79                 :            : 
      80                 :            : 
      81                 :            : 
      82                 :       2850 : void SizeNotify(ViewShell* pVwSh, const Size &rSize)
      83                 :            : {
      84                 :       2850 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      85         [ +  + ]:       2850 :     if (pSfxVwSh)
      86                 :            :     {
      87         [ +  - ]:        150 :         if (pSfxVwSh->ISA(SwView))
      88                 :        150 :             ((SwView *)pSfxVwSh)->DocSzChgd(rSize);
      89         [ #  # ]:          0 :         else if (pSfxVwSh->ISA(SwPagePreView))
      90                 :          0 :             ((SwPagePreView *)pSfxVwSh)->DocSzChgd( rSize );
      91                 :            :     }
      92                 :       2850 : }
      93                 :            : 
      94                 :            : /*--------------------------------------------------------------------
      95                 :            :     Description:    Notify for page number update
      96                 :            :  --------------------------------------------------------------------*/
      97                 :            : 
      98                 :        156 : void PageNumNotify( ViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum,
      99                 :            :                                                     const rtl::OUString& rPgStr)
     100                 :            : {
     101                 :        156 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
     102   [ +  -  +  + ]:        312 :     if ( pSfxVwSh && pSfxVwSh->ISA(SwView) &&
         [ +  + ][ +  - ]
     103                 :        156 :          ((SwView*)pSfxVwSh)->GetCurShell() )
     104         [ +  - ]:        135 :             ((SwView *)pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr);
     105                 :        156 : }
     106                 :            : 
     107                 :            : /******************************************************************************
     108                 :            :  *  Method      :   void FrameNotify( DocMDIBase *pWin, FlyMode eMode )
     109                 :            :  *  Description:
     110                 :            :  ******************************************************************************/
     111                 :            : 
     112                 :            : 
     113                 :            : 
     114                 :          0 : void FrameNotify( ViewShell* pVwSh, FlyMode eMode )
     115                 :            : {
     116         [ #  # ]:          0 :     if ( pVwSh->ISA(SwCrsrShell) )
     117                 :          0 :         SwBaseShell::SetFrmMode( eMode, (SwWrtShell*)pVwSh );
     118                 :          0 : }
     119                 :            : 
     120                 :            : /*--------------------------------------------------------------------
     121                 :            :     Description:    Notify for page number update
     122                 :            :  --------------------------------------------------------------------*/
     123                 :          0 : sal_Bool SwEditWin::RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode)
     124                 :            : {
     125         [ #  # ]:          0 :     SvxRuler& rRuler = bVerticalMode ?  rView.GetVLineal() : rView.GetHLineal();
     126                 :          0 :     return (!rRuler.StartDocDrag( rMEvt, RULER_TYPE_BORDER ) &&
     127                 :          0 :             !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN1) &&
     128         [ #  # ]:          0 :             !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN2));
           [ #  #  #  # ]
     129                 :            : }
     130                 :            : 
     131                 :            : // #i23726#
     132                 :            : // #i42921# - add 3rd parameter <bVerticalMode> in order
     133                 :            : // to consider vertical layout
     134                 :          0 : sal_Bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt,
     135                 :            :                                  const bool bVerticalMode )
     136                 :            : {
     137         [ #  # ]:          0 :     SvxRuler& rRuler = bVerticalMode ?  rView.GetVLineal() : rView.GetHLineal();
     138                 :          0 :     return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT);
     139                 :            : }
     140                 :            : 
     141                 :          0 : Dialog* GetSearchDialog()
     142                 :            : {
     143                 :          0 :     return SwView::GetSearchDialog();
     144                 :            : }
     145                 :            : 
     146                 :        232 : TblChgMode GetTblChgDefaultMode()
     147                 :            : {
     148                 :        232 :     SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig();
     149         [ +  - ]:        232 :     return pOpt ? pOpt->GetTblMode() : TBLVAR_CHGABS;
     150                 :            : }
     151                 :            : 
     152                 :          0 : void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect )
     153                 :            : {
     154                 :          0 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
     155 [ #  # ][ #  # ]:          0 :     if (pSfxVwSh && pSfxVwSh->ISA( SwPagePreView ))
                 [ #  # ]
     156                 :          0 :         ((SwPagePreView *)pSfxVwSh)->RepaintCoreRect( rRect );
     157                 :          0 : }
     158                 :            : 
     159                 :          0 : sal_Bool JumpToSwMark( ViewShell* pVwSh, const rtl::OUString& rMark )
     160                 :            : {
     161                 :          0 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
     162 [ #  # ][ #  # ]:          0 :     if( pSfxVwSh && pSfxVwSh->ISA( SwView ) )
                 [ #  # ]
     163         [ #  # ]:          0 :         return ((SwView *)pSfxVwSh)->JumpToSwMark( rMark );
     164                 :          0 :     return sal_False;
     165                 :            : }
     166                 :            : 
     167                 :         48 : void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt )
     168                 :            : {
     169                 :         48 :     Window::DataChanged( rDCEvt );
     170                 :            : 
     171                 :         48 :     SwWrtShell* pSh = GetView().GetWrtShellPtr();
     172                 :            :     // DataChanged() is sometimes called prior to creating
     173                 :            :     // the SwWrtShell
     174         [ -  + ]:         48 :     if(!pSh)
     175                 :         48 :         return;
     176                 :         48 :     sal_Bool bViewWasLocked = pSh->IsViewLocked(), bUnlockPaint = sal_False;
     177                 :         48 :     pSh->LockView( sal_True );
     178      [ +  -  - ]:         48 :     switch( rDCEvt.GetType() )
     179                 :            :     {
     180                 :            :     case DATACHANGED_SETTINGS:
     181                 :            :         // rearrange ScrollBars, respectively trigger resize, because
     182                 :            :         // the ScrollBar size can have change. For that, in the reset
     183                 :            :         // handler, the size of the ScrollBars also has to be queried
     184                 :            :         // from the settings.
     185         [ -  + ]:         48 :         if( rDCEvt.GetFlags() & SETTINGS_STYLE )
     186                 :            :         {
     187                 :          0 :             pSh->LockPaint();
     188                 :          0 :             bUnlockPaint = sal_True;
     189                 :          0 :             ViewShell::DeleteReplacementBitmaps();
     190                 :          0 :             GetView().InvalidateBorder();               //Scrollbar work
     191                 :            :         }
     192                 :         48 :         break;
     193                 :            : 
     194                 :            :     case DATACHANGED_PRINTER:
     195                 :            :     case DATACHANGED_DISPLAY:
     196                 :            :     case DATACHANGED_FONTS:
     197                 :            :     case DATACHANGED_FONTSUBSTITUTION:
     198                 :          0 :         pSh->LockPaint();
     199                 :          0 :         bUnlockPaint = sal_True;
     200                 :          0 :         GetView().GetDocShell()->UpdateFontList();  //e.g. printer change
     201                 :          0 :         break;
     202                 :            :     }
     203                 :         48 :     pSh->LockView( bViewWasLocked );
     204         [ -  + ]:         48 :     if( bUnlockPaint )
     205                 :          0 :         pSh->UnlockPaint();
     206                 :            : }
     207                 :            : 
     208                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10