LibreOffice Module sw (master)  1
DocumentStateManager.cxx
Go to the documentation of this file.
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>
22 #include <IDocumentUndoRedo.hxx>
24 #include <docstat.hxx>
25 #include <acorrect.hxx>
26 
27 namespace sw
28 {
29 
31  m_rDoc( i_rSwdoc ),
32  mbEnableSetModified(true),
33  mbModified(false),
34  mbUpdateExpField(false),
35  mbNewDoc(false),
36  mbInCallModified(false)
37 {
38 }
39 
41 {
42  if (!IsEnableSetModified())
43  return;
44 
46  mbModified = true;
48  if( m_rDoc.GetOle2Link().IsSet() )
49  {
50  mbInCallModified = true;
51  m_rDoc.GetOle2Link().Call( true );
52  mbInCallModified = false;
53  }
54 
57 }
58 
60 {
61  // give the old and new modified state to the link
62  // Bit 0: -> old state
63  // Bit 1: -> new state
64  bool bOldModified = mbModified;
65  mbModified = false;
68  if( bOldModified && m_rDoc.GetOle2Link().IsSet() )
69  {
70  mbInCallModified = true;
71  m_rDoc.GetOle2Link().Call( false );
72  mbInCallModified = false;
73  }
74 }
75 
77 {
78  return mbModified;
79 }
80 
82 {
83  return mbEnableSetModified;
84 }
85 
86 void DocumentStateManager::SetEnableSetModified(bool bEnableSetModified)
87 {
88  mbEnableSetModified = bEnableSetModified;
89 }
90 
92 {
93  return mbInCallModified;
94 }
95 
97 {
98  return mbUpdateExpField;
99 }
100 
102 {
103  return mbNewDoc;
104 }
105 
107 {
108  mbNewDoc = b;
109 }
110 
112 {
113  mbUpdateExpField = b;
114 }
115 
117 {
118 }
119 
120 }
121 
122 
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsInCallModified() const override
void SetModified() override
Must be called manually at changes of format.
SwAutoCorrExceptWord * GetAutoCorrExceptWord()
Definition: doc.hxx:1381
void SetNewDoc(bool b) override
Definition: doc.hxx:185
::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const
Definition: doc.cxx:447
Dialog to specify the properties of date form field.
Definition: accfrmobj.cxx:38
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:176
void SetUpdateExpFieldStat(bool b) override
const Link< bool, void > & GetOle2Link() const
Definition: doc.hxx:1318
DocumentStateManager(SwDoc &i_rSwdoc)
bool IsUpdateExpField() const override
bool IsModified() const override
Changes of document?
bool IsEnableSetModified() const override
bool IsNewDoc() const override
void DeleteAutoCorrExceptWord()
Definition: docedt.cxx:867
virtual void SetUndoNoModifiedPosition()=0
Set the position at which the document is in the "unmodified" state to the current position in the Un...
::sw::DocumentStatisticsManager const & GetDocumentStatisticsManager() const
Definition: doc.cxx:415
void SetEnableSetModified(bool bEnableSetModified) override
bool IsDeleted() const
Definition: acorrect.hxx:111