LCOV - code coverage report
Current view: top level - sw/source/core/doc - DocumentStateManager.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 36 49 73.5 %
Date: 2014-11-03 Functions: 10 15 66.7 %
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             : #include <DocumentStateManager.hxx>
      20             : #include <doc.hxx>
      21             : #include <DocumentStatisticsManager.hxx>
      22             : #include <IDocumentUndoRedo.hxx>
      23             : #include <DocumentLayoutManager.hxx>
      24             : #include <docstat.hxx>
      25             : #include <acorrect.hxx>
      26             : 
      27             : namespace sw
      28             : {
      29             : 
      30        5052 : DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) :
      31             :     m_rSwdoc( i_rSwdoc ),
      32             :     mbModified(false),
      33             :     mbLoaded(false),
      34             :     mbUpdateExpFld(false),
      35             :     mbNewDoc(false),
      36             :     mbPageNums(false),
      37        5052 :     mbInCallModified(false)
      38             : {
      39        5052 : }
      40             : 
      41     1662588 : void DocumentStateManager::SetModified()
      42             : {
      43     1662588 :     m_rSwdoc.GetDocumentLayoutManager().ClearSwLayouterEntries();
      44             :     // give the old and new modified state to the link
      45             :     //  Bit 0:  -> old state
      46             :     //  Bit 1:  -> new state
      47     1662588 :     sal_IntPtr nCall = mbModified ? 3 : 2;
      48     1662588 :     mbModified = true;
      49     1662588 :     m_rSwdoc.GetDocumentStatisticsManager().GetDocStat().bModified = true;
      50     1662588 :     if( m_rSwdoc.GetOle2Link().IsSet() )
      51             :     {
      52     1421210 :         mbInCallModified = true;
      53     1421210 :         m_rSwdoc.GetOle2Link().Call( (void*)nCall );
      54     1421210 :         mbInCallModified = false;
      55             :     }
      56             : 
      57     1662588 :     if( m_rSwdoc.GetAutoCorrExceptWord() && !m_rSwdoc.GetAutoCorrExceptWord()->IsDeleted() )
      58           0 :         m_rSwdoc.DeleteAutoCorrExceptWord();
      59     1662588 : }
      60             : 
      61       65720 : void DocumentStateManager::ResetModified()
      62             : {
      63             :     // give the old and new modified state to the link
      64             :     //  Bit 0:  -> old state
      65             :     //  Bit 1:  -> new state
      66       65720 :     sal_IntPtr nCall = mbModified ? 1 : 0;
      67       65720 :     mbModified = false;
      68       65720 :     m_rSwdoc.GetIDocumentUndoRedo().SetUndoNoModifiedPosition();
      69       65720 :     if( nCall && m_rSwdoc.GetOle2Link().IsSet() )
      70             :     {
      71       24036 :         mbInCallModified = true;
      72       24036 :         m_rSwdoc.GetOle2Link().Call( (void*)nCall );
      73       24036 :         mbInCallModified = false;
      74             :     }
      75       65720 : }
      76             : 
      77      102050 : bool DocumentStateManager::IsModified() const
      78             : {
      79      102050 :     return mbModified;
      80             : }
      81             : 
      82       99425 : bool DocumentStateManager::IsInCallModified() const
      83             : {
      84       99425 :     return mbInCallModified;
      85             : }
      86             : 
      87           0 : bool DocumentStateManager::IsLoaded() const
      88             : {
      89           0 :     return mbLoaded;
      90             : }
      91             : 
      92        6326 : bool DocumentStateManager::IsUpdateExpFld() const
      93             : {
      94        6326 :     return mbUpdateExpFld;
      95             : }
      96             : 
      97           0 : bool DocumentStateManager::IsNewDoc() const
      98             : {
      99           0 :     return mbNewDoc;
     100             : }
     101             : 
     102           0 : bool DocumentStateManager::IsPageNums() const
     103             : {
     104           0 :   return mbPageNums;
     105             : }
     106             : 
     107           0 : void DocumentStateManager::SetPageNums(bool b)
     108             : {
     109           0 :     mbPageNums = b;
     110           0 : }
     111             : 
     112           0 : void DocumentStateManager::SetNewDoc(bool b)
     113             : {
     114           0 :     mbNewDoc = b;
     115           0 : }
     116             : 
     117         318 : void DocumentStateManager::SetUpdateExpFldStat(bool b)
     118             : {
     119         318 :     mbUpdateExpFld = b;
     120         318 : }
     121             : 
     122         540 : void DocumentStateManager::SetLoaded(bool b)
     123             : {
     124         540 :     mbLoaded = b;
     125         540 : }
     126             : 
     127         270 : }
     128             : 
     129             : 
     130             : 
     131             : 
     132             : 
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10