LCOV - code coverage report
Current view: top level - sw/source/ui/uiview - view1.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 47 77 61.0 %
Date: 2012-08-25 Functions: 3 5 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 17 54 31.5 %

           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 <svx/svdpagv.hxx>
      31                 :            : #include <svx/svdview.hxx>
      32                 :            : #include <svx/ruler.hxx>
      33                 :            : #include <idxmrk.hxx>
      34                 :            : #include <view.hxx>
      35                 :            : #include <wrtsh.hxx>
      36                 :            : #include <swmodule.hxx>
      37                 :            : #include <viewopt.hxx>
      38                 :            : #include <docsh.hxx>
      39                 :            : #include <globdoc.hxx>
      40                 :            : #include <navipi.hxx>
      41                 :            : #include <fldwrap.hxx>
      42                 :            : #include <redlndlg.hxx>
      43                 :            : #include <dpage.hxx>
      44                 :            : #include <edtwin.hxx>
      45                 :            : #include "formatclipboard.hxx"
      46                 :            : #include <cmdid.h>
      47                 :            : // header for class SfxRequest
      48                 :            : #include <sfx2/request.hxx>
      49                 :            : 
      50                 :            : #include <sfx2/viewfrm.hxx>
      51                 :            : 
      52                 :            : extern int bDocSzUpdated;
      53                 :            : 
      54                 :       1302 : void SwView::Activate(sal_Bool bMDIActivate)
      55                 :            : {
      56                 :            :     // fdo#40438 Update the layout to make sure everything is correct before showing the content
      57                 :       1302 :     pWrtShell->StartAction();
      58                 :       1302 :     pWrtShell->EndAction( sal_True );
      59                 :            : 
      60                 :            :     // aktuelle View anmelden an der DocShell
      61                 :            :     // die View bleibt solange an der DocShell
      62                 :            :     // aktiv bis Sie zerstoert wird oder durch Activate eine
      63                 :            :     // neue gesetzt wird
      64                 :       1302 :     SwDocShell* pDocSh = GetDocShell();
      65         [ +  - ]:       1302 :     if(pDocSh)
      66                 :       1302 :         pDocSh->SetView(this);
      67                 :       1302 :     SwModule* pSwMod = SW_MOD();
      68                 :       1302 :     pSwMod->SetView(this);
      69                 :            : 
      70                 :            :     // Dokumentgroesse hat sich geaendert
      71         [ +  - ]:       1302 :     if(!bDocSzUpdated)
      72                 :       1302 :         DocSzChgd(aDocSz);
      73                 :            : 
      74                 :            :     // make selection visible
      75         [ -  + ]:       1302 :     if(bMakeSelectionVisible)
      76                 :            :     {
      77                 :          0 :         pWrtShell->MakeSelVisible();
      78                 :          0 :         bMakeSelectionVisible = sal_False;
      79                 :            :     }
      80                 :       1302 :     pHRuler->SetActive( sal_True );
      81                 :       1302 :     pVRuler->SetActive( sal_True );
      82                 :            : 
      83         [ +  - ]:       1302 :     if ( bMDIActivate )
      84                 :            :     {
      85                 :       1302 :         pWrtShell->ShGetFcs(sal_False);     // Selektionen sichtbar
      86                 :            : 
      87         [ -  + ]:       1302 :         if( sSwViewData.Len() )
      88                 :            :         {
      89                 :          0 :             ReadUserData( sSwViewData, sal_False );
      90                 :          0 :             sSwViewData.Erase();
      91                 :            :         }
      92                 :            : 
      93                 :       1302 :         AttrChangedNotify(pWrtShell);
      94                 :            : 
      95                 :            :         // Flddlg ggf neu initialisieren (z.B. fuer TYP_SETVAR)
      96                 :       1302 :         sal_uInt16 nId = SwFldDlgWrapper::GetChildWindowId();
      97                 :       1302 :         SfxViewFrame* pVFrame = GetViewFrame();
      98                 :       1302 :         SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->GetChildWindow(nId);
      99         [ -  + ]:       1302 :         if (pWrp)
     100                 :          0 :             pWrp->ReInitDlg(GetDocShell());
     101                 :            : 
     102                 :            :         // RedlineDlg ggf neu initialisieren
     103                 :       1302 :         nId = SwRedlineAcceptChild::GetChildWindowId();
     104                 :       1302 :         SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*)pVFrame->GetChildWindow(nId);
     105         [ -  + ]:       1302 :         if (pRed)
     106                 :          0 :             pRed->ReInitDlg(GetDocShell());
     107                 :            : 
     108                 :            :         // reinit IdxMarkDlg
     109                 :       1302 :         nId = SwInsertIdxMarkWrapper::GetChildWindowId();
     110                 :       1302 :         SwInsertIdxMarkWrapper *pIdxMrk = (SwInsertIdxMarkWrapper*)pVFrame->GetChildWindow(nId);
     111         [ -  + ]:       1302 :         if (pIdxMrk)
     112                 :          0 :             pIdxMrk->ReInitDlg(*pWrtShell);
     113                 :            : 
     114                 :            :         // reinit AuthMarkDlg
     115                 :       1302 :         nId = SwInsertAuthMarkWrapper::GetChildWindowId();
     116                 :            :         SwInsertAuthMarkWrapper *pAuthMrk = (SwInsertAuthMarkWrapper*)pVFrame->
     117                 :       1302 :                                                                 GetChildWindow(nId);
     118         [ -  + ]:       1302 :         if (pAuthMrk)
     119                 :          0 :             pAuthMrk->ReInitDlg(*pWrtShell);
     120                 :            :     }
     121                 :            :     else
     122                 :            :         //Wenigstens das Notify rufen (vorsichtshalber wegen der SlotFilter
     123                 :          0 :         AttrChangedNotify(pWrtShell);
     124                 :            : 
     125                 :       1302 :     SfxViewShell::Activate(bMDIActivate);
     126                 :       1302 : }
     127                 :            : 
     128                 :       1302 : void SwView::Deactivate(sal_Bool bMDIActivate)
     129                 :            : {
     130                 :            :     extern sal_Bool bFlushCharBuffer ;
     131                 :            :         // Befinden sich noch Zeichen im Input Buffer?
     132         [ -  + ]:       1302 :     if( bFlushCharBuffer )
     133                 :          0 :         GetEditWin().FlushInBuffer();
     134                 :            : 
     135         [ +  - ]:       1302 :     if( bMDIActivate )
     136                 :            :     {
     137                 :       1302 :         pWrtShell->ShLooseFcs();    // Selektionen unsichtbar
     138                 :            : 
     139                 :       1302 :         pHRuler->SetActive( sal_False );
     140                 :       1302 :         pVRuler->SetActive( sal_False );
     141                 :            :     }
     142                 :       1302 :     SfxViewShell::Deactivate(bMDIActivate);
     143                 :       1302 : }
     144                 :            : 
     145                 :          0 : void SwView::MarginChanged()
     146                 :            : {
     147                 :          0 :     GetWrtShell().SetBrowseBorder( GetMargin() );
     148                 :          0 : }
     149                 :            : 
     150                 :          0 : void SwView::ExecFormatPaintbrush(SfxRequest& rReq)
     151                 :            : {
     152         [ #  # ]:          0 :     if(!pFormatClipboard)
     153                 :          0 :         return;
     154                 :            : 
     155         [ #  # ]:          0 :     if( pFormatClipboard->HasContent() )
     156                 :            :     {
     157         [ #  # ]:          0 :         pFormatClipboard->Erase();
     158                 :            : 
     159                 :          0 :         SwApplyTemplate aTemplate;
     160         [ #  # ]:          0 :         GetEditWin().SetApplyTemplate(aTemplate);
     161                 :            :     }
     162                 :            :     else
     163                 :            :     {
     164                 :          0 :         bool bPersistentCopy = false;
     165                 :          0 :         const SfxItemSet *pArgs = rReq.GetArgs();
     166 [ #  # ][ #  # ]:          0 :         if( pArgs && pArgs->Count() >= 1 )
                 [ #  # ]
     167                 :            :         {
     168                 :            :             bPersistentCopy = static_cast<bool>(((SfxBoolItem &)pArgs->Get(
     169         [ #  # ]:          0 :                                     SID_FORMATPAINTBRUSH)).GetValue());
     170                 :            :         }
     171                 :            : 
     172         [ #  # ]:          0 :         pFormatClipboard->Copy( GetWrtShell(), GetPool(), bPersistentCopy );
     173                 :            : 
     174                 :          0 :         SwApplyTemplate aTemplate;
     175                 :          0 :         aTemplate.pFormatClipboard = pFormatClipboard;
     176         [ #  # ]:          0 :         GetEditWin().SetApplyTemplate(aTemplate);
     177                 :            :     }
     178                 :          0 :     GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
     179                 :            : }
     180                 :            : 
     181                 :       1343 : void SwView::StateFormatPaintbrush(SfxItemSet &rSet)
     182                 :            : {
     183         [ -  + ]:       1343 :     if(!pFormatClipboard)
     184                 :       1343 :         return;
     185                 :            : 
     186 [ +  - ][ -  + ]:       1343 :     bool bHasContent = pFormatClipboard && pFormatClipboard->HasContent();
     187         [ +  - ]:       1343 :     rSet.Put(SfxBoolItem(SID_FORMATPAINTBRUSH, bHasContent));
     188         [ +  - ]:       1343 :     if(!bHasContent)
     189                 :            :     {
     190         [ -  + ]:       1343 :         if( !pFormatClipboard->CanCopyThisType( GetWrtShell().GetSelectionType() ) )
     191                 :          0 :             rSet.DisableItem( SID_FORMATPAINTBRUSH );
     192                 :            :     }
     193                 :            : }
     194                 :            : 
     195                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10