update dev300-m58
[ooovba.git] / sw / source / ui / inc / glosdoc.hxx
blob355078b6d735261aab2050ef90b5df2546b7c1d9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: glosdoc.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _GLOSDOC_HXX
31 #define _GLOSDOC_HXX
33 #include <tools/string.hxx>
34 #include <svtools/svarray.hxx>
35 #include <com/sun/star/text/XAutoTextGroup.hpp>
37 class SwTextBlocks;
38 class SvStrings;
39 class SwDocShell;
41 #ifndef SW_DECL_SWDOCSHELL_DEFINED
42 #define SW_DECL_SWDOCSHELL_DEFINED
43 #include <tools/ref.hxx>
44 SV_DECL_REF( SwDocShell )
45 #endif
46 #include <cppuhelper/weakref.hxx>
48 #ifndef INCLUDED_VECTOR
49 #include <vector>
50 #define INCLUDED_VECTOR
51 #endif
52 #include "swdllapi.h"
54 typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef;
55 typedef ::std::vector< AutoTextGroupRef > UnoAutoTextGroups;
57 typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextEntry > AutoTextEntryRef;
58 typedef ::std::vector< AutoTextEntryRef > UnoAutoTextEntries;
60 #define GLOS_DELIM (sal_Unicode)'*'
62 // CLASS -----------------------------------------------------------------
63 class SW_DLLPUBLIC SwGlossaries
65 UnoAutoTextGroups m_aGlossaryGroups;
66 UnoAutoTextEntries m_aGlossaryEntries;
68 String m_aPath;
69 String m_sOldErrPath;
70 String m_sErrPath;
71 SvStrings *m_pPathArr;
72 SvStrings *m_pGlosArr;
73 BOOL m_bError;
75 SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, BOOL bCreate = TRUE) const;
76 SW_DLLPRIVATE SvStrings *GetNameList();
78 // implementation in unoatxt.cxx
79 SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup );
80 SW_DLLPRIVATE void InvalidateUNOOjects();
82 public:
83 SwGlossaries();
84 ~SwGlossaries();
86 /** returns the cached AutoTextGroup (if any) for the given group name
88 @precond
89 If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
91 @param _rGroupName
92 the name of the glossaries group
93 @param _bCreate
94 if <TRUE/>, the group is created if it does not yet exist
96 ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextGroup >
97 GetAutoTextGroup(
98 const ::rtl::OUString& _rGroupName,
99 bool _bCreate = false
102 /** returns the cached AutoTextEntry (if any) for the given group/with the given name
104 @precond
105 If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
107 @param _rGroupAccessName
108 the name to access the group
109 @param _rGroupName
110 the name of the glossaries group, as to be passed to the entry
111 @param _rEntryName
112 the name of the auto text entry
113 @param _bCreate
114 if <TRUE/>, the entry is created if it does not yet exist
116 ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry >
117 GetAutoTextEntry(
118 const String& _rCompleteGroupName,
119 const ::rtl::OUString& _rGroupName,
120 const ::rtl::OUString& _rEntryName,
121 bool _bCreate = false
124 USHORT GetGroupCnt();
125 String GetGroupName(USHORT );
126 String GetGroupTitle( const String& rGroupName );
128 BOOL FindGroupName(String & rGroup);
130 SwTextBlocks* GetGroupDoc(const String &rName,
131 BOOL bCreate = FALSE) const;
132 SwTextBlocks* GetDefGroupDoc() const {return GetGroupDoc(GetDefName());}
133 void PutGroupDoc(SwTextBlocks *pBlock);
134 static String GetDefName();
135 static String GetExtension();
137 String GetCompleteGroupName( const ::rtl::OUString& GroupName );
139 BOOL NewGroupDoc(String &rGroupName, const String& rTitle);
140 BOOL RenameGroupDoc(const String& sOldGroup, String& sNewGroup, const String& rNewTitle);
141 BOOL DelGroupDoc(const String &);
142 SwDocShellRef EditGroupDoc(const String &rGrpName, const String& rShortName, BOOL bShow = TRUE );
143 void SaveGroupDoc(const String &rGrpName, const String& rLongName );
144 void UpdateGlosPath(BOOL bFull);
145 void ShowError();
146 inline ULONG IsGlosPathErr() { return m_bError; }
147 const SvStrings* GetPathArray() const {return m_pPathArr;}
151 #endif // _GLOSDOC_HXX