Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/source/uibase/inc/glosdoc.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_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX
20
#define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX
21
22
#include <rtl/ustring.hxx>
23
#include <unotools/weakref.hxx>
24
#include <com/sun/star/text/XAutoTextGroup.hpp>
25
26
class SwTextBlocks;
27
class SwDocShell;
28
29
#ifndef SW_DECL_SWDOCSHELL_DEFINED
30
#define SW_DECL_SWDOCSHELL_DEFINED
31
#include <rtl/ref.hxx>
32
typedef rtl::Reference<SwDocShell> SwDocShellRef;
33
#endif
34
#include <cppuhelper/weakref.hxx>
35
36
#include <vector>
37
#include <swdllapi.h>
38
39
class SwXAutoTextEntry;
40
class SwXAutoTextGroup;
41
42
typedef std::vector< unotools::WeakReference< SwXAutoTextGroup > > UnoAutoTextGroups;
43
typedef std::vector< unotools::WeakReference< SwXAutoTextEntry > > UnoAutoTextEntries;
44
45
0
#define GLOS_DELIM u'*'
46
47
class SW_DLLPUBLIC SwGlossaries
48
{
49
    UnoAutoTextGroups       m_aGlossaryGroups;
50
    UnoAutoTextEntries      m_aGlossaryEntries;
51
52
    OUString                m_aPath;
53
    std::vector<OUString>   m_aInvalidPaths;
54
    std::vector<OUString>   m_PathArr;
55
    std::vector<OUString>   m_GlosArr;
56
    bool                m_bError;
57
58
    SAL_DLLPRIVATE std::unique_ptr<SwTextBlocks> GetGlosDoc(const OUString &rName, bool bCreate = true) const;
59
    SAL_DLLPRIVATE std::vector<OUString> & GetNameList();
60
61
    // implementation in unoatxt.cxx
62
    SAL_DLLPRIVATE void RemoveFileFromList( const OUString& rGroup );
63
    SAL_DLLPRIVATE void InvalidateUNOOjects();
64
65
public:
66
    SwGlossaries();
67
    ~SwGlossaries();
68
69
    /** returns the cached AutoTextGroup (if any) for the given group name
70
        The group is created if it does not yet exist
71
72
        @precond
73
            If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
74
75
        @param _rGroupName
76
            the name of the glossaries group
77
    */
78
    css::uno::Reference< css::text::XAutoTextGroup >
79
                            GetAutoTextGroup(
80
                                std::u16string_view _rGroupName
81
                            );
82
83
    /** returns the cached AutoTextEntry (if any) for the given group/with the given name
84
        The entry is created if it does not yet exist
85
86
        @precond
87
            If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
88
89
        @param _rGroupAccessName
90
            the name to access the group
91
        @param _rGroupName
92
            the name of the glossaries group, as to be passed to the entry
93
        @param _rEntryName
94
            the name of the auto text entry
95
    */
96
    css::uno::Reference< css::text::XAutoTextEntry >
97
                            GetAutoTextEntry(
98
                                const OUString& _rCompleteGroupName,
99
                                const OUString& _rGroupName,
100
                                const OUString& _rEntryName
101
                            );
102
103
    size_t          GetGroupCnt();
104
    OUString const & GetGroupName(size_t);
105
    OUString        GetGroupTitle( const OUString& rGroupName );
106
107
    bool            FindGroupName(OUString& rGroup);
108
109
    std::unique_ptr<SwTextBlocks>
110
                    GetGroupDoc(const OUString &rName,
111
                                bool bCreate = false);
112
    static OUString GetDefName();
113
    static OUString GetExtension();
114
115
    OUString        GetCompleteGroupName( std::u16string_view GroupName );
116
117
    bool            NewGroupDoc(OUString &rGroupName, const OUString& rTitle);
118
    bool            RenameGroupDoc(const OUString& sOldGroup, OUString& sNewGroup, const OUString& rNewTitle);
119
    bool            DelGroupDoc(std::u16string_view);
120
    SwDocShellRef   EditGroupDoc(const OUString &rGrpName, const OUString& rShortName, bool bShow = true );
121
    void            UpdateGlosPath(bool bFull);
122
    void            ShowError();
123
0
    bool            IsGlosPathErr() const { return m_bError; }
124
0
    std::vector<OUString> const& GetPathArray() const { return m_PathArr; }
125
};
126
127
#endif // INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX
128
129
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */