LCOV - code coverage report
Current view: top level - sw/source/core/doc - DocumentStateManager.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 36 49 73.5 %
Date: 2015-06-13 12:38:46 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        2958 : DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) :
      31             :     m_rDoc( i_rSwdoc ),
      32             :     mbModified(false),
      33             :     mbLoaded(false),
      34             :     mbUpdateExpField(false),
      35             :     mbNewDoc(false),
      36             :     mbPageNums(false),
      37        2958 :     mbInCallModified(false)
      38             : {
      39        2958 : }
      40             : 
      41     1001754 : void DocumentStateManager::SetModified()
      42             : {
      43     1001754 :     m_rDoc.GetDocumentLayoutManager().ClearSwLayouterEntries();
      44             :     // give the old and new modified state to the link
      45             :     //  Bit 0:  -> old state
      46             :     //  Bit 1:  -> new state
      47     1001754 :     sal_IntPtr nCall = mbModified ? 3 : 2;
      48     1001754 :     mbModified = true;
      49     1001754 :     m_rDoc.GetDocumentStatisticsManager().GetDocStat().bModified = true;
      50     1001754 :     if( m_rDoc.GetOle2Link().IsSet() )
      51             :     {
      52      850796 :         mbInCallModified = true;
      53      850796 :         m_rDoc.GetOle2Link().Call( reinterpret_cast<void*>(nCall) );
      54      850796 :         mbInCallModified = false;
      55             :     }
      56             : 
      57     1001754 :     if( m_rDoc.GetAutoCorrExceptWord() && !m_rDoc.GetAutoCorrExceptWord()->IsDeleted() )
      58           0 :         m_rDoc.DeleteAutoCorrExceptWord();
      59     1001754 : }
      60             : 
      61       38030 : 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       38030 :     sal_IntPtr nCall = mbModified ? 1 : 0;
      67       38030 :     mbModified = false;
      68       38030 :     m_rDoc.GetIDocumentUndoRedo().SetUndoNoModifiedPosition();
      69       38030 :     if( nCall && m_rDoc.GetOle2Link().IsSet() )
      70             :     {
      71       13710 :         mbInCallModified = true;
      72       13710 :         m_rDoc.GetOle2Link().Call( reinterpret_cast<void*>(nCall) );
      73       13710 :         mbInCallModified = false;
      74             :     }
      75       38030 : }
      76             : 
      77       59520 : bool DocumentStateManager::IsModified() const
      78             : {
      79       59520 :     return mbModified;
      80             : }
      81             : 
      82      117282 : bool DocumentStateManager::IsInCallModified() const
      83             : {
      84      117282 :     return mbInCallModified;
      85             : }
      86             : 
      87           0 : bool DocumentStateManager::IsLoaded() const
      88             : {
      89           0 :     return mbLoaded;
      90             : }
      91             : 
      92        3561 : bool DocumentStateManager::IsUpdateExpField() const
      93             : {
      94        3561 :     return mbUpdateExpField;
      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         223 : void DocumentStateManager::SetUpdateExpFieldStat(bool b)
     118             : {
     119         223 :     mbUpdateExpField = b;
     120         223 : }
     121             : 
     122         440 : void DocumentStateManager::SetLoaded(bool b)
     123             : {
     124         440 :     mbLoaded = b;
     125         440 : }
     126             : 
     127         177 : }
     128             : 
     129             : 
     130             : 
     131             : 
     132             : 
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11