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

Generated by: LCOV version 1.10