LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/ui/uiview - view1.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 48 78 61.5 %
Date: 2013-07-09 Functions: 5 7 71.4 %
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             : 
      21             : #include <svx/svdpagv.hxx>
      22             : #include <svx/svdview.hxx>
      23             : #include <svx/ruler.hxx>
      24             : #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
      25             : #include <idxmrk.hxx>
      26             : #include <view.hxx>
      27             : #include <wrtsh.hxx>
      28             : #include <swmodule.hxx>
      29             : #include <viewopt.hxx>
      30             : #include <docsh.hxx>
      31             : #include <globdoc.hxx>
      32             : #include <navipi.hxx>
      33             : #include <fldwrap.hxx>
      34             : #include <redlndlg.hxx>
      35             : #include <dpage.hxx>
      36             : #include <edtwin.hxx>
      37             : #include "formatclipboard.hxx"
      38             : #include <cmdid.h>
      39             : // header for class SfxRequest
      40             : #include <sfx2/request.hxx>
      41             : 
      42             : #include <sfx2/viewfrm.hxx>
      43             : 
      44             : extern int bDocSzUpdated;
      45             : 
      46         780 : void SwView::Activate(sal_Bool bMDIActivate)
      47             : {
      48             :     // fdo#40438 Update the layout to make sure everything is correct before showing the content
      49         780 :     m_pWrtShell->StartAction();
      50         780 :     m_pWrtShell->EndAction( sal_True );
      51             : 
      52             :     // Register the current View at the DocShell.
      53             :     // The view remains active at the DocShell until it will
      54             :     // be destroyed or by Activate a new one will be set.
      55         780 :     SwDocShell* pDocSh = GetDocShell();
      56         780 :     if(pDocSh)
      57         780 :         pDocSh->SetView(this);
      58         780 :     SwModule* pSwMod = SW_MOD();
      59         780 :     pSwMod->SetView(this);
      60             : 
      61             :     // Document size has changed.
      62         780 :     if(!bDocSzUpdated)
      63         780 :         DocSzChgd(m_aDocSz);
      64             : 
      65             :     // make selection visible
      66         780 :     if(m_bMakeSelectionVisible)
      67             :     {
      68           0 :         m_pWrtShell->MakeSelVisible();
      69           0 :         m_bMakeSelectionVisible = sal_False;
      70             :     }
      71         780 :     m_pHRuler->SetActive( sal_True );
      72         780 :     m_pVRuler->SetActive( sal_True );
      73             : 
      74         780 :     if ( bMDIActivate )
      75             :     {
      76         780 :         m_pWrtShell->ShGetFcs(sal_False);     // Selections visible
      77             : 
      78         780 :         if( m_sSwViewData.Len() )
      79             :         {
      80           0 :             ReadUserData( m_sSwViewData, sal_False );
      81           0 :             m_sSwViewData.Erase();
      82             :         }
      83             : 
      84         780 :         AttrChangedNotify(m_pWrtShell);
      85             : 
      86             :         // Initialize Flddlg newly if necessary (e.g. for TYP_SETVAR)
      87         780 :         sal_uInt16 nId = SwFldDlgWrapper::GetChildWindowId();
      88         780 :         SfxViewFrame* pVFrame = GetViewFrame();
      89         780 :         SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->GetChildWindow(nId);
      90         780 :         if (pWrp)
      91           0 :             pWrp->ReInitDlg(GetDocShell());
      92             : 
      93             :         // Initialize RedlineDlg newly if necessary
      94         780 :         nId = SwRedlineAcceptChild::GetChildWindowId();
      95         780 :         SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*)pVFrame->GetChildWindow(nId);
      96         780 :         if (pRed)
      97           0 :             pRed->ReInitDlg(GetDocShell());
      98             : 
      99             :         // reinit IdxMarkDlg
     100         780 :         nId = SwInsertIdxMarkWrapper::GetChildWindowId();
     101         780 :         SwInsertIdxMarkWrapper *pIdxMrk = (SwInsertIdxMarkWrapper*)pVFrame->GetChildWindow(nId);
     102         780 :         if (pIdxMrk)
     103           0 :             pIdxMrk->ReInitDlg(*m_pWrtShell);
     104             : 
     105             :         // reinit AuthMarkDlg
     106         780 :         nId = SwInsertAuthMarkWrapper::GetChildWindowId();
     107             :         SwInsertAuthMarkWrapper *pAuthMrk = (SwInsertAuthMarkWrapper*)pVFrame->
     108         780 :                                                                 GetChildWindow(nId);
     109         780 :         if (pAuthMrk)
     110           0 :             pAuthMrk->ReInitDlg(*m_pWrtShell);
     111             :     }
     112             :     else
     113             :         // At least call the Notify (as a precaution because of the SlotFilter).
     114           0 :         AttrChangedNotify(m_pWrtShell);
     115             : 
     116         780 :     SfxViewShell::Activate(bMDIActivate);
     117         780 : }
     118             : 
     119         780 : void SwView::Deactivate(sal_Bool bMDIActivate)
     120             : {
     121             :     extern bool bFlushCharBuffer ;
     122             :         // Are Characters still in the input buffer?
     123         780 :     if( bFlushCharBuffer )
     124           0 :         GetEditWin().FlushInBuffer();
     125             : 
     126         780 :     if( bMDIActivate )
     127             :     {
     128         780 :         m_pWrtShell->ShLooseFcs();    // Selections invisible
     129             : 
     130         780 :         m_pHRuler->SetActive( sal_False );
     131         780 :         m_pVRuler->SetActive( sal_False );
     132             :     }
     133         780 :     SfxViewShell::Deactivate(bMDIActivate);
     134         780 : }
     135             : 
     136           0 : void SwView::MarginChanged()
     137             : {
     138           0 :     GetWrtShell().SetBrowseBorder( GetMargin() );
     139           0 : }
     140             : 
     141           0 : void SwView::ExecFormatPaintbrush(SfxRequest& rReq)
     142             : {
     143           0 :     if(!m_pFormatClipboard)
     144           0 :         return;
     145             : 
     146           0 :     if( m_pFormatClipboard->HasContent() )
     147             :     {
     148           0 :         m_pFormatClipboard->Erase();
     149             : 
     150           0 :         SwApplyTemplate aTemplate;
     151           0 :         GetEditWin().SetApplyTemplate(aTemplate);
     152             :     }
     153             :     else
     154             :     {
     155           0 :         bool bPersistentCopy = false;
     156           0 :         const SfxItemSet *pArgs = rReq.GetArgs();
     157           0 :         if( pArgs && pArgs->Count() >= 1 )
     158             :         {
     159             :             bPersistentCopy = static_cast<bool>(((SfxBoolItem &)pArgs->Get(
     160           0 :                                     SID_FORMATPAINTBRUSH)).GetValue());
     161             :         }
     162             : 
     163           0 :         m_pFormatClipboard->Copy( GetWrtShell(), GetPool(), bPersistentCopy );
     164             : 
     165           0 :         SwApplyTemplate aTemplate;
     166           0 :         aTemplate.m_pFormatClipboard = m_pFormatClipboard;
     167           0 :         GetEditWin().SetApplyTemplate(aTemplate);
     168             :     }
     169           0 :     GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
     170             : }
     171             : 
     172         630 : void SwView::StateFormatPaintbrush(SfxItemSet &rSet)
     173             : {
     174         630 :     if(!m_pFormatClipboard)
     175         630 :         return;
     176             : 
     177         630 :     bool bHasContent = m_pFormatClipboard && m_pFormatClipboard->HasContent();
     178         630 :     rSet.Put(SfxBoolItem(SID_FORMATPAINTBRUSH, bHasContent));
     179         630 :     if(!bHasContent)
     180             :     {
     181         630 :         if( !m_pFormatClipboard->CanCopyThisType( GetWrtShell().GetSelectionType() ) )
     182           0 :             rSet.DisableItem( SID_FORMATPAINTBRUSH );
     183             :     }
     184          99 : }
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10