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 <acorrect.hxx>
25 
26 namespace sw
27 {
28 
30  m_rDoc( i_rSwdoc ),
31  mbEnableSetModified(true),
32  mbModified(false),
33  mbUpdateExpField(false),
34  mbNewDoc(false),
35  mbInCallModified(false)
36 {
37 }
38 
40 {
41  if (!IsEnableSetModified())
42  return;
43 
45  mbModified = true;
47  if( m_rDoc.GetOle2Link().IsSet() )
48  {
49  mbInCallModified = true;
50  m_rDoc.GetOle2Link().Call( true );
51  mbInCallModified = false;
52  }
53 
56 }
57 
59 {
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;
64  mbModified = false;
67  if( bOldModified && m_rDoc.GetOle2Link().IsSet() )
68  {
69  mbInCallModified = true;
70  m_rDoc.GetOle2Link().Call( false );
71  mbInCallModified = false;
72  }
73 }
74 
76 {
77  return mbModified;
78 }
79 
81 {
82  return mbEnableSetModified;
83 }
84 
85 void DocumentStateManager::SetEnableSetModified(bool bEnableSetModified)
86 {
87  mbEnableSetModified = bEnableSetModified;
88 }
89 
91 {
92  return mbInCallModified;
93 }
94 
96 {
97  return mbUpdateExpField;
98 }
99 
101 {
102  return mbNewDoc;
103 }
104 
106 {
107  mbNewDoc = b;
108 }
109 
111 {
112  mbUpdateExpField = b;
113 }
114 
115 }
116 
117 
118 /* 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:1382
void SetNewDoc(bool b) override
Definition: doc.hxx:185
::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const
Definition: doc.cxx:414
Dialog to specify the properties of date form field.
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
void SetUpdateExpFieldStat(bool b) override
const Link< bool, void > & GetOle2Link() const
Definition: doc.hxx:1319
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:859
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:382
void SetEnableSetModified(bool bEnableSetModified) override
bool IsDeleted() const
Definition: acorrect.hxx:111