Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/sw/inc/IDocumentState.hxx
Line
Count
Source
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
20
#pragma once
21
22
#include <config_collab.h>
23
24
#if ENABLE_YRS
25
#include <com/sun/star/uno/Any.h>
26
#include <editeng/yrstransactionsupplier.hxx>
27
#include <optional>
28
class SfxUndoAction;
29
struct SwPosition;
30
class SwPostItField;
31
#endif
32
33
/** Get information about the current document state
34
 */
35
class IDocumentState
36
{
37
public:
38
    /** Must be called manually at changes of format.
39
    */
40
    virtual void SetModified() = 0;
41
42
    virtual void ResetModified() = 0;
43
44
    /** Changes of document?
45
    */
46
    virtual bool IsModified() const = 0;
47
48
    virtual bool IsInCallModified() const = 0;
49
50
    virtual bool IsUpdateExpField() const = 0;
51
52
    virtual bool IsNewDoc() const = 0;
53
54
    virtual void SetNewDoc(bool b) = 0;
55
56
    virtual void SetUpdateExpFieldStat(bool b) = 0;
57
58
    virtual bool IsEnableSetModified() const = 0;
59
    virtual void SetEnableSetModified(bool bEnableSetModified) = 0;
60
61
#if ENABLE_YRS
62
    virtual void YrsInitAcceptor() = 0;
63
    virtual void YrsInitConnector(css::uno::Any const& raConnector) = 0;
64
    virtual IYrsTransactionSupplier::Mode SetYrsMode(IYrsTransactionSupplier::Mode mode) = 0;
65
    virtual void YrsCommitModified(bool isUnfinishedUndo) = 0;
66
67
    virtual void YrsNotifySetResolved(OString const& rCommentId, SwPostItField const& rField) = 0;
68
    virtual OString YrsGenNewCommentId() = 0;
69
    virtual void YrsAddCommentImpl(SwPosition const& rPos, OString const& rCommentId) = 0;
70
    virtual void YrsAddComment(SwPosition const& rPos, ::std::optional<SwPosition> oAnchorStart,
71
                               SwPostItField const& rField, bool isInsert)
72
        = 0;
73
    virtual void YrsRemoveCommentImpl(rtl::OString const& rCommentId) = 0;
74
    virtual void YrsRemoveComment(SwPosition const& rPos) = 0;
75
    virtual void YrsNotifyCursorUpdate() = 0;
76
    virtual void YrsEndUndo() = 0;
77
    virtual void YrsDoUndo(SfxUndoAction const* pUndo) = 0;
78
    virtual void YrsDoRedo(SfxUndoAction const* pUndo) = 0;
79
#endif
80
81
protected:
82
94.3k
    virtual ~IDocumentState(){};
83
};
84
85
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */