Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/editeng/acorrcfg.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
#ifndef INCLUDED_EDITENG_ACORRCFG_HXX
20
#define INCLUDED_EDITENG_ACORRCFG_HXX
21
22
#include <editeng/editengdllapi.h>
23
#include <unotools/configitem.hxx>
24
#include <memory>
25
26
class SvxAutoCorrect;
27
class SvxAutoCorrCfg;
28
29
class SvxBaseAutoCorrCfg final : public utl::ConfigItem
30
{
31
private:
32
    SvxAutoCorrCfg& rParent;
33
    static css::uno::Sequence<OUString>    GetPropertyNames();
34
35
    virtual void            ImplCommit() override;
36
37
public:
38
    SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rParent);
39
    virtual ~SvxBaseAutoCorrCfg() override;
40
41
    void                    Load(bool bInit);
42
    virtual void            Notify( const css::uno::Sequence<OUString>& aPropertyNames) override;
43
    using ConfigItem::SetModified;
44
};
45
46
class SvxSwAutoCorrCfg final : public utl::ConfigItem
47
{
48
private:
49
    SvxAutoCorrCfg& rParent;
50
    static css::uno::Sequence<OUString>    GetPropertyNames();
51
52
    virtual void            ImplCommit() override;
53
54
public:
55
    SvxSwAutoCorrCfg(SvxAutoCorrCfg& rParent);
56
    virtual ~SvxSwAutoCorrCfg() override;
57
58
    void                    Load(bool bInit);
59
    virtual void            Notify( const css::uno::Sequence<OUString>& aPropertyNames) override;
60
    using ConfigItem::SetModified;
61
};
62
/*--------------------------------------------------------------------
63
    Description:   Configuration for Auto Correction
64
 --------------------------------------------------------------------*/
65
class EDITENG_DLLPUBLIC SvxAutoCorrCfg final
66
{
67
    friend class SvxBaseAutoCorrCfg;
68
    friend class SvxSwAutoCorrCfg;
69
70
    std::unique_ptr<SvxAutoCorrect> pAutoCorrect;
71
72
    SvxBaseAutoCorrCfg      aBaseConfig;
73
    SvxSwAutoCorrCfg        aSwConfig;
74
75
    // Flags for Autotext:
76
    bool    bFileRel;
77
    bool    bNetRel;
78
    // Help tip for Autotext as you type
79
    bool    bAutoTextTip;
80
    bool    bAutoTextPreview;
81
    bool    bAutoFmtByInput;
82
    bool    bSearchInAllCategories;
83
84
public:
85
    void        SetModified()
86
0
                {
87
0
                    aBaseConfig.SetModified();
88
0
                    aSwConfig.SetModified();
89
0
                }
90
    void        Commit()
91
0
                {
92
0
                    aBaseConfig.Commit();
93
0
                    aSwConfig.Commit();
94
0
                }
95
96
0
          SvxAutoCorrect* GetAutoCorrect()          { return pAutoCorrect.get(); }
97
0
    const SvxAutoCorrect* GetAutoCorrect() const    { return pAutoCorrect.get(); }
98
    // the pointer is transferred to the possession of the ConfigItems!
99
    void SetAutoCorrect( SvxAutoCorrect* );
100
101
0
    bool IsAutoFormatByInput() const       { return bAutoFmtByInput; }
102
0
    void SetAutoFormatByInput( bool bSet ) { bAutoFmtByInput = bSet;aSwConfig.SetModified();}
103
104
0
    bool IsSaveRelFile() const          { return bFileRel; }
105
0
    void SetSaveRelFile( bool bSet )    { bFileRel = bSet; aSwConfig.SetModified(); }
106
107
0
    bool IsSaveRelNet() const           { return bNetRel; }
108
0
    void SetSaveRelNet( bool bSet )     { bNetRel = bSet; aSwConfig.SetModified();}
109
110
0
    bool IsAutoTextTip() const          { return bAutoTextTip; }
111
0
    void SetAutoTextTip(bool bSet )     { bAutoTextTip = bSet;aSwConfig.SetModified();}
112
113
0
    bool IsSearchInAllCategories() const        { return bSearchInAllCategories;}
114
115
    SvxAutoCorrCfg();
116
    ~SvxAutoCorrCfg();
117
    static SvxAutoCorrCfg& Get();
118
};
119
120
121
#endif
122
123
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */