Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _GLOSDOC_HXX
29 : : #define _GLOSDOC_HXX
30 : :
31 : : #include <tools/string.hxx>
32 : : #include <com/sun/star/text/XAutoTextGroup.hpp>
33 : :
34 : : class SwTextBlocks;
35 : : class SwDocShell;
36 : :
37 : : #ifndef SW_DECL_SWDOCSHELL_DEFINED
38 : : #define SW_DECL_SWDOCSHELL_DEFINED
39 : : #include <tools/ref.hxx>
40 : 118 : SV_DECL_REF( SwDocShell )
41 : : #endif
42 : : #include <cppuhelper/weakref.hxx>
43 : :
44 : : #include <vector>
45 : : #include "swdllapi.h"
46 : :
47 : : typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef;
48 : : typedef ::std::vector< AutoTextGroupRef > UnoAutoTextGroups;
49 : :
50 : : typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextEntry > AutoTextEntryRef;
51 : : typedef ::std::vector< AutoTextEntryRef > UnoAutoTextEntries;
52 : :
53 : : #define GLOS_DELIM (sal_Unicode)'*'
54 : :
55 : : // CLASS -----------------------------------------------------------------
56 : : class SW_DLLPUBLIC SwGlossaries
57 : : {
58 : : UnoAutoTextGroups m_aGlossaryGroups;
59 : : UnoAutoTextEntries m_aGlossaryEntries;
60 : :
61 : : String m_aPath;
62 : : String m_sOldErrPath;
63 : : String m_sErrPath;
64 : : std::vector<String> m_PathArr;
65 : : std::vector<String> m_GlosArr;
66 : : sal_Bool m_bError;
67 : :
68 : : SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, sal_Bool bCreate = sal_True) const;
69 : : SW_DLLPRIVATE std::vector<String> & GetNameList();
70 : :
71 : : // implementation in unoatxt.cxx
72 : : SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup );
73 : : SW_DLLPRIVATE void InvalidateUNOOjects();
74 : :
75 : : public:
76 : : SwGlossaries();
77 : : ~SwGlossaries();
78 : :
79 : : /** returns the cached AutoTextGroup (if any) for the given group name
80 : :
81 : : @precond
82 : : If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
83 : :
84 : : @param _rGroupName
85 : : the name of the glossaries group
86 : : @param _bCreate
87 : : if <TRUE/>, the group is created if it does not yet exist
88 : : */
89 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextGroup >
90 : : GetAutoTextGroup(
91 : : const ::rtl::OUString& _rGroupName,
92 : : bool _bCreate = false
93 : : );
94 : :
95 : : /** returns the cached AutoTextEntry (if any) for the given group/with the given name
96 : :
97 : : @precond
98 : : If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
99 : :
100 : : @param _rGroupAccessName
101 : : the name to access the group
102 : : @param _rGroupName
103 : : the name of the glossaries group, as to be passed to the entry
104 : : @param _rEntryName
105 : : the name of the auto text entry
106 : : @param _bCreate
107 : : if <TRUE/>, the entry is created if it does not yet exist
108 : : */
109 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry >
110 : : GetAutoTextEntry(
111 : : const String& _rCompleteGroupName,
112 : : const ::rtl::OUString& _rGroupName,
113 : : const ::rtl::OUString& _rEntryName,
114 : : bool _bCreate = false
115 : : );
116 : :
117 : : sal_uInt16 GetGroupCnt();
118 : : String GetGroupName(sal_uInt16 );
119 : : String GetGroupTitle( const String& rGroupName );
120 : :
121 : : sal_Bool FindGroupName(String & rGroup);
122 : :
123 : : SwTextBlocks* GetGroupDoc(const String &rName,
124 : : sal_Bool bCreate = sal_False);
125 : : SwTextBlocks* GetDefGroupDoc() { return GetGroupDoc(GetDefName()); }
126 : : void PutGroupDoc(SwTextBlocks *pBlock);
127 : : static String GetDefName();
128 : : static String GetExtension();
129 : :
130 : : String GetCompleteGroupName( const ::rtl::OUString& GroupName );
131 : :
132 : : sal_Bool NewGroupDoc(String &rGroupName, const String& rTitle);
133 : : sal_Bool RenameGroupDoc(const String& sOldGroup, String& sNewGroup, const String& rNewTitle);
134 : : sal_Bool DelGroupDoc(const String &);
135 : : SwDocShellRef EditGroupDoc(const String &rGrpName, const String& rShortName, sal_Bool bShow = sal_True );
136 : : void SaveGroupDoc(const String &rGrpName, const String& rLongName );
137 : : void UpdateGlosPath(sal_Bool bFull);
138 : : void ShowError();
139 : 0 : inline sal_uLong IsGlosPathErr() { return m_bError; }
140 : 0 : std::vector<String> const& GetPathArray() const { return m_PathArr; }
141 : : };
142 : :
143 : :
144 : : #endif // _GLOSDOC_HXX
145 : :
146 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|