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