LCOV - code coverage report
Current view: top level - sw/source/uibase/docvw - edtwin3.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 46 71 64.8 %
Date: 2014-11-03 Functions: 9 13 69.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <hintids.hxx>
      21             : #include <vcl/settings.hxx>
      22             : #include <svx/ruler.hxx>
      23             : #include <viewopt.hxx>
      24             : #include "view.hxx"
      25             : #include "wrtsh.hxx"
      26             : #include "basesh.hxx"
      27             : #include "pview.hxx"
      28             : #include "mdiexp.hxx"
      29             : #include "edtwin.hxx"
      30             : #include "swmodule.hxx"
      31             : #include "modcfg.hxx"
      32             : #include "swtable.hxx"
      33             : #include "docsh.hxx"
      34             : #include "pagedesc.hxx"
      35             : #include <frmatr.hxx>
      36             : #include <editeng/frmdiritem.hxx>
      37             : 
      38             : // Core-Notify
      39        2026 : void ScrollMDI( SwViewShell* pVwSh, const SwRect &rRect,
      40             :                 sal_uInt16 nRangeX, sal_uInt16 nRangeY)
      41             : {
      42        2026 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      43        2026 :     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
      44        2026 :         ((SwView *)pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY );
      45        2026 : }
      46             : 
      47             : // Docmdi - movable
      48       59783 : bool IsScrollMDI( SwViewShell* pVwSh, const SwRect &rRect )
      49             : {
      50       59783 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      51       59783 :     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
      52       59783 :         return (((SwView *)pSfxVwSh)->IsScroll(rRect.SVRect()));
      53           0 :     return false;
      54             : }
      55             : 
      56             : // Notify for size change
      57       11954 : void SizeNotify(SwViewShell* pVwSh, const Size &rSize)
      58             : {
      59       11954 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      60       11954 :     if (pSfxVwSh)
      61             :     {
      62         854 :         if (pSfxVwSh->ISA(SwView))
      63         854 :             ((SwView *)pSfxVwSh)->DocSzChgd(rSize);
      64           0 :         else if (pSfxVwSh->ISA(SwPagePreview))
      65           0 :             ((SwPagePreview *)pSfxVwSh)->DocSzChgd( rSize );
      66             :     }
      67       11954 : }
      68             : 
      69             : // Notify for page number update
      70         836 : void PageNumNotify( SwViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum,
      71             :                                                     const OUString& rPgStr)
      72             : {
      73         836 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      74        1672 :     if ( pSfxVwSh && pSfxVwSh->ISA(SwView) &&
      75         836 :          ((SwView*)pSfxVwSh)->GetCurShell() )
      76         482 :             ((SwView *)pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr);
      77         836 : }
      78             : 
      79          14 : void FrameNotify( SwViewShell* pVwSh, FlyMode eMode )
      80             : {
      81          14 :     if ( pVwSh->ISA(SwCrsrShell) )
      82          14 :         SwBaseShell::SetFrmMode( eMode, (SwWrtShell*)pVwSh );
      83          14 : }
      84             : 
      85             : // Notify for page number update
      86           0 : bool SwEditWin::RulerColumnDrag( const MouseEvent& rMEvt, bool bVerticalMode)
      87             : {
      88           0 :     SvxRuler& rRuler = bVerticalMode ?  m_rView.GetVRuler() : m_rView.GetHRuler();
      89           0 :     return (!rRuler.StartDocDrag( rMEvt, RULER_TYPE_BORDER ) &&
      90           0 :             !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN1) &&
      91           0 :             !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN2));
      92             : }
      93             : 
      94             : // #i23726#
      95             : // #i42921# - add 3rd parameter <bVerticalMode> in order
      96             : // to consider vertical layout
      97           0 : bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt,
      98             :                                  const bool bVerticalMode )
      99             : {
     100           0 :     SvxRuler& rRuler = bVerticalMode ?  m_rView.GetVRuler() : m_rView.GetHRuler();
     101           0 :     return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT);
     102             : }
     103             : 
     104        1816 : TblChgMode GetTblChgDefaultMode()
     105             : {
     106        1816 :     SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig();
     107        1816 :     return pOpt ? pOpt->GetTblMode() : TBLVAR_CHGABS;
     108             : }
     109             : 
     110           0 : void RepaintPagePreview( SwViewShell* pVwSh, const SwRect& rRect )
     111             : {
     112           0 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
     113           0 :     if (pSfxVwSh && pSfxVwSh->ISA( SwPagePreview ))
     114           0 :         ((SwPagePreview *)pSfxVwSh)->RepaintCoreRect( rRect );
     115           0 : }
     116             : 
     117           0 : bool JumpToSwMark( SwViewShell* pVwSh, const OUString& rMark )
     118             : {
     119           0 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
     120           0 :     if( pSfxVwSh && pSfxVwSh->ISA( SwView ) )
     121           0 :         return ((SwView *)pSfxVwSh)->JumpToSwMark( rMark );
     122           0 :     return false;
     123             : }
     124             : 
     125          50 : void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt )
     126             : {
     127          50 :     Window::DataChanged( rDCEvt );
     128             : 
     129          50 :     SwWrtShell* pSh = GetView().GetWrtShellPtr();
     130             :     // DataChanged() is sometimes called prior to creating
     131             :     // the SwWrtShell
     132          50 :     if(!pSh)
     133          50 :         return;
     134          50 :     bool bViewWasLocked = pSh->IsViewLocked(), bUnlockPaint = false;
     135          50 :     pSh->LockView( true );
     136          50 :     switch( rDCEvt.GetType() )
     137             :     {
     138             :     case DATACHANGED_SETTINGS:
     139             :         // rearrange ScrollBars, respectively trigger resize, because
     140             :         // the ScrollBar size can have change. For that, in the reset
     141             :         // handler, the size of the ScrollBars also has to be queried
     142             :         // from the settings.
     143          50 :         if( rDCEvt.GetFlags() & SETTINGS_STYLE )
     144             :         {
     145          46 :             pSh->LockPaint();
     146          46 :             bUnlockPaint = true;
     147          46 :             SwViewShell::DeleteReplacementBitmaps();
     148          46 :             GetView().InvalidateBorder();               //Scrollbar work
     149             :         }
     150          50 :         break;
     151             : 
     152             :     case DATACHANGED_PRINTER:
     153             :     case DATACHANGED_DISPLAY:
     154             :     case DATACHANGED_FONTS:
     155             :     case DATACHANGED_FONTSUBSTITUTION:
     156           0 :         pSh->LockPaint();
     157           0 :         bUnlockPaint = true;
     158           0 :         GetView().GetDocShell()->UpdateFontList();  //e.g. printer change
     159           0 :         break;
     160             :     }
     161          50 :     pSh->LockView( bViewWasLocked );
     162          50 :     if( bUnlockPaint )
     163          46 :         pSh->UnlockPaint();
     164         270 : }
     165             : 
     166             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10