1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #include <DocumentStateManager.hxx>
21 #include <DocumentStatisticsManager.hxx>
22 #include <IDocumentUndoRedo.hxx>
23 #include <DocumentLayoutManager.hxx>
24 #include <acorrect.hxx>
29 DocumentStateManager::DocumentStateManager( SwDoc
& i_rSwdoc
) :
31 mbEnableSetModified(true),
33 mbUpdateExpField(false),
35 mbInCallModified(false)
39 void DocumentStateManager::SetModified()
41 if (!IsEnableSetModified())
44 m_rDoc
.GetDocumentLayoutManager().ClearSwLayouterEntries();
46 m_rDoc
.GetDocumentStatisticsManager().SetDocStatModified( true );
47 if( m_rDoc
.GetOle2Link().IsSet() )
49 mbInCallModified
= true;
50 m_rDoc
.GetOle2Link().Call( true );
51 mbInCallModified
= false;
54 if( m_rDoc
.GetAutoCorrExceptWord() && !m_rDoc
.GetAutoCorrExceptWord()->IsDeleted() )
55 m_rDoc
.DeleteAutoCorrExceptWord();
58 void DocumentStateManager::ResetModified()
60 // give the old and new modified state to the link
61 // Bit 0: -> old state
62 // Bit 1: -> new state
63 bool bOldModified
= mbModified
;
65 m_rDoc
.GetDocumentStatisticsManager().SetDocStatModified( false );
66 m_rDoc
.GetIDocumentUndoRedo().SetUndoNoModifiedPosition();
67 if( bOldModified
&& m_rDoc
.GetOle2Link().IsSet() )
69 mbInCallModified
= true;
70 m_rDoc
.GetOle2Link().Call( false );
71 mbInCallModified
= false;
75 bool DocumentStateManager::IsModified() const
80 bool DocumentStateManager::IsEnableSetModified() const
82 return mbEnableSetModified
;
85 void DocumentStateManager::SetEnableSetModified(bool bEnableSetModified
)
87 mbEnableSetModified
= bEnableSetModified
;
90 bool DocumentStateManager::IsInCallModified() const
92 return mbInCallModified
;
95 bool DocumentStateManager::IsUpdateExpField() const
97 return mbUpdateExpField
;
100 bool DocumentStateManager::IsNewDoc() const
105 void DocumentStateManager::SetNewDoc(bool b
)
110 void DocumentStateManager::SetUpdateExpFieldStat(bool b
)
112 mbUpdateExpField
= b
;
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */