1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX
22 #include <rtl/ustring.hxx>
23 #include <unotools/weakref.hxx>
24 #include <com/sun/star/text/XAutoTextGroup.hpp>
29 #ifndef SW_DECL_SWDOCSHELL_DEFINED
30 #define SW_DECL_SWDOCSHELL_DEFINED
31 #include <tools/ref.hxx>
32 typedef tools::SvRef
<SwDocShell
> SwDocShellRef
;
34 #include <cppuhelper/weakref.hxx>
39 class SwXAutoTextEntry
;
40 class SwXAutoTextGroup
;
42 typedef std::vector
< unotools::WeakReference
< SwXAutoTextGroup
> > UnoAutoTextGroups
;
43 typedef std::vector
< unotools::WeakReference
< SwXAutoTextEntry
> > UnoAutoTextEntries
;
45 #define GLOS_DELIM u'*'
47 class SW_DLLPUBLIC SwGlossaries
49 UnoAutoTextGroups m_aGlossaryGroups
;
50 UnoAutoTextEntries m_aGlossaryEntries
;
53 std::vector
<OUString
> m_aInvalidPaths
;
54 std::vector
<OUString
> m_PathArr
;
55 std::vector
<OUString
> m_GlosArr
;
58 SAL_DLLPRIVATE
std::unique_ptr
<SwTextBlocks
> GetGlosDoc(const OUString
&rName
, bool bCreate
= true) const;
59 SAL_DLLPRIVATE
std::vector
<OUString
> & GetNameList();
61 // implementation in unoatxt.cxx
62 SAL_DLLPRIVATE
void RemoveFileFromList( const OUString
& rGroup
);
63 SAL_DLLPRIVATE
void InvalidateUNOOjects();
69 /** returns the cached AutoTextGroup (if any) for the given group name
70 The group is created if it does not yet exist
73 If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
76 the name of the glossaries group
78 css::uno::Reference
< css::text::XAutoTextGroup
>
80 std::u16string_view _rGroupName
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
87 If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
89 @param _rGroupAccessName
90 the name to access the group
92 the name of the glossaries group, as to be passed to the entry
94 the name of the auto text entry
96 css::uno::Reference
< css::text::XAutoTextEntry
>
98 const OUString
& _rCompleteGroupName
,
99 const OUString
& _rGroupName
,
100 const OUString
& _rEntryName
103 size_t GetGroupCnt();
104 OUString
const & GetGroupName(size_t);
105 OUString
GetGroupTitle( const OUString
& rGroupName
);
107 bool FindGroupName(OUString
& rGroup
);
109 std::unique_ptr
<SwTextBlocks
>
110 GetGroupDoc(const OUString
&rName
,
111 bool bCreate
= false);
112 static OUString
GetDefName();
113 static OUString
GetExtension();
115 OUString
GetCompleteGroupName( std::u16string_view GroupName
);
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
);
123 bool IsGlosPathErr() const { return m_bError
; }
124 std::vector
<OUString
> const& GetPathArray() const { return m_PathArr
; }
127 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */