LCOV - code coverage report
Current view: top level - sw/source/uibase/docvw - edtwin3.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 46 72 63.9 %
Date: 2015-06-13 12:38:46 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         932 : void ScrollMDI( SwViewShell* pVwSh, const SwRect &rRect,
      40             :                 sal_uInt16 nRangeX, sal_uInt16 nRangeY)
      41             : {
      42         932 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      43         932 :     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
      44         932 :         static_cast<SwView *>(pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY );
      45         932 : }
      46             : 
      47             : // Docmdi - movable
      48       34925 : bool IsScrollMDI( SwViewShell* pVwSh, const SwRect &rRect )
      49             : {
      50       34925 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      51       34925 :     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
      52       34925 :         return static_cast<SwView *>(pSfxVwSh)->IsScroll(rRect.SVRect());
      53           0 :     return false;
      54             : }
      55             : 
      56             : // Notify for size change
      57        7429 : void SizeNotify(SwViewShell* pVwSh, const Size &rSize)
      58             : {
      59        7429 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      60        7429 :     if (pSfxVwSh)
      61             :     {
      62         660 :         if (pSfxVwSh->ISA(SwView))
      63         660 :             static_cast<SwView *>(pSfxVwSh)->DocSzChgd(rSize);
      64           0 :         else if (pSfxVwSh->ISA(SwPagePreview))
      65           0 :             static_cast<SwPagePreview *>(pSfxVwSh)->DocSzChgd( rSize );
      66             :     }
      67        7429 : }
      68             : 
      69             : // Notify for page number update
      70         827 : void PageNumNotify( SwViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum,
      71             :                                                     const OUString& rPgStr)
      72             : {
      73         827 :     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
      74        1654 :     if ( pSfxVwSh && pSfxVwSh->ISA(SwView) &&
      75         827 :          static_cast<SwView*>(pSfxVwSh)->GetCurShell() )
      76         604 :             static_cast<SwView *>(pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr);
      77         827 : }
      78             : 
      79          17 : void FrameNotify( SwViewShell* pVwSh, FlyMode eMode )
      80             : {
      81          17 :     if ( pVwSh->ISA(SwCrsrShell) )
      82          17 :         SwBaseShell::SetFrmMode( eMode, static_cast<SwWrtShell*>(pVwSh) );
      83          17 : }
      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        1098 : TableChgMode GetTableChgDefaultMode()
     105             : {
     106        1098 :     SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig();
     107        1098 :     return pOpt ? pOpt->GetTableMode() : 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 :         static_cast<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 static_cast<SwView *>(pSfxVwSh)->JumpToSwMark( rMark );
     122           0 :     return false;
     123             : }
     124             : 
     125          31 : void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt )
     126             : {
     127          31 :     Window::DataChanged( rDCEvt );
     128             : 
     129          31 :     SwWrtShell* pSh = GetView().GetWrtShellPtr();
     130             :     // DataChanged() is sometimes called prior to creating
     131             :     // the SwWrtShell
     132          31 :     if(!pSh)
     133          31 :         return;
     134          31 :     bool bViewWasLocked = pSh->IsViewLocked(), bUnlockPaint = false;
     135          31 :     pSh->LockView( true );
     136          31 :     switch( rDCEvt.GetType() )
     137             :     {
     138             :     case DataChangedEventType::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          31 :         if( rDCEvt.GetFlags() & AllSettingsFlags::STYLE )
     144             :         {
     145          28 :             pSh->LockPaint();
     146          28 :             bUnlockPaint = true;
     147          28 :             SwViewShell::DeleteReplacementBitmaps();
     148          28 :             GetView().InvalidateBorder();               //Scrollbar work
     149             :         }
     150          31 :         break;
     151             : 
     152             :     case DataChangedEventType::PRINTER:
     153             :     case DataChangedEventType::DISPLAY:
     154             :     case DataChangedEventType::FONTS:
     155             :     case DataChangedEventType::FONTSUBSTITUTION:
     156           0 :         pSh->LockPaint();
     157           0 :         bUnlockPaint = true;
     158           0 :         GetView().GetDocShell()->UpdateFontList();  //e.g. printer change
     159           0 :         break;
     160           0 :     default: break;
     161             :     }
     162          31 :     pSh->LockView( bViewWasLocked );
     163          31 :     if( bUnlockPaint )
     164          28 :         pSh->UnlockPaint();
     165         177 : }
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11