1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: glosdoc.hxx,v $
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 ************************************************************************/
33 #include <tools/string.hxx>
34 #include <svtools/svarray.hxx>
35 #include <com/sun/star/text/XAutoTextGroup.hpp>
41 #ifndef SW_DECL_SWDOCSHELL_DEFINED
42 #define SW_DECL_SWDOCSHELL_DEFINED
43 #include <tools/ref.hxx>
44 SV_DECL_REF( SwDocShell
)
46 #include <cppuhelper/weakref.hxx>
48 #ifndef INCLUDED_VECTOR
50 #define INCLUDED_VECTOR
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
;
71 SvStrings
*m_pPathArr
;
72 SvStrings
*m_pGlosArr
;
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();
86 /** returns the cached AutoTextGroup (if any) for the given group name
89 If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
92 the name of the glossaries group
94 if <TRUE/>, the group is created if it does not yet exist
96 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XAutoTextGroup
>
98 const ::rtl::OUString
& _rGroupName
,
102 /** returns the cached AutoTextEntry (if any) for the given group/with the given name
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
110 the name of the glossaries group, as to be passed to the entry
112 the name of the auto text entry
114 if <TRUE/>, the entry is created if it does not yet exist
116 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XAutoTextEntry
>
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
);
146 inline ULONG
IsGlosPathErr() { return m_bError
; }
147 const SvStrings
* GetPathArray() const {return m_pPathArr
;}
151 #endif // _GLOSDOC_HXX