Coverage Report

Created: 2026-10-14 09:33

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