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

Generated by: LCOV version 1.10