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 _GLOSDOC_HXX
20 : #define _GLOSDOC_HXX
21 :
22 : #include <tools/string.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 0 : SV_DECL_REF( SwDocShell )
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 -----------------------------------------------------------------
47 : class SW_DLLPUBLIC SwGlossaries
48 : {
49 : UnoAutoTextGroups m_aGlossaryGroups;
50 : UnoAutoTextEntries m_aGlossaryEntries;
51 :
52 : String m_aPath;
53 : String m_sOldErrPath;
54 : String m_sErrPath;
55 : std::vector<String> m_PathArr;
56 : std::vector<String> m_GlosArr;
57 : sal_Bool m_bError;
58 :
59 : SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, sal_Bool bCreate = sal_True) const;
60 : SW_DLLPRIVATE std::vector<String> & GetNameList();
61 :
62 : // implementation in unoatxt.cxx
63 : SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup );
64 : SW_DLLPRIVATE void InvalidateUNOOjects();
65 :
66 : public:
67 : SwGlossaries();
68 : ~SwGlossaries();
69 :
70 : /** returns the cached AutoTextGroup (if any) for the given group name
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 : @param _bCreate
78 : if <TRUE/>, the group is created if it does not yet exist
79 : */
80 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextGroup >
81 : GetAutoTextGroup(
82 : const ::rtl::OUString& _rGroupName,
83 : bool _bCreate = false
84 : );
85 :
86 : /** returns the cached AutoTextEntry (if any) for the given group/with the given name
87 :
88 : @precond
89 : If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
90 :
91 : @param _rGroupAccessName
92 : the name to access the group
93 : @param _rGroupName
94 : the name of the glossaries group, as to be passed to the entry
95 : @param _rEntryName
96 : the name of the auto text entry
97 : @param _bCreate
98 : if <TRUE/>, the entry is created if it does not yet exist
99 : */
100 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry >
101 : GetAutoTextEntry(
102 : const String& _rCompleteGroupName,
103 : const ::rtl::OUString& _rGroupName,
104 : const ::rtl::OUString& _rEntryName,
105 : bool _bCreate = false
106 : );
107 :
108 : sal_uInt16 GetGroupCnt();
109 : String GetGroupName(sal_uInt16 );
110 : String GetGroupTitle( const String& rGroupName );
111 :
112 : sal_Bool FindGroupName(String & rGroup);
113 :
114 : SwTextBlocks* GetGroupDoc(const String &rName,
115 : sal_Bool bCreate = sal_False);
116 : SwTextBlocks* GetDefGroupDoc() { return GetGroupDoc(GetDefName()); }
117 : void PutGroupDoc(SwTextBlocks *pBlock);
118 : static String GetDefName();
119 : static String GetExtension();
120 :
121 : String GetCompleteGroupName( const ::rtl::OUString& GroupName );
122 :
123 : sal_Bool NewGroupDoc(String &rGroupName, const String& rTitle);
124 : sal_Bool RenameGroupDoc(const String& sOldGroup, String& sNewGroup, const String& rNewTitle);
125 : sal_Bool DelGroupDoc(const String &);
126 : SwDocShellRef EditGroupDoc(const String &rGrpName, const String& rShortName, sal_Bool bShow = sal_True );
127 : void SaveGroupDoc(const String &rGrpName, const String& rLongName );
128 : void UpdateGlosPath(sal_Bool bFull);
129 : void ShowError();
130 0 : inline sal_uLong IsGlosPathErr() { return m_bError; }
131 0 : std::vector<String> const& GetPathArray() const { return m_PathArr; }
132 : };
133 :
134 :
135 : #endif // _GLOSDOC_HXX
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|