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

Generated by: LCOV version 1.10