xref: /aoo42x/main/sw/source/ui/inc/glosdoc.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _GLOSDOC_HXX
24cdf0e10cSrcweir #define _GLOSDOC_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <tools/string.hxx>
27cdf0e10cSrcweir #include <svl/svarray.hxx>
28cdf0e10cSrcweir #include <com/sun/star/text/XAutoTextGroup.hpp>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class SwTextBlocks;
31cdf0e10cSrcweir class SvStrings;
32cdf0e10cSrcweir class SwDocShell;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #ifndef SW_DECL_SWDOCSHELL_DEFINED
35cdf0e10cSrcweir #define SW_DECL_SWDOCSHELL_DEFINED
36cdf0e10cSrcweir #include <tools/ref.hxx>
37cdf0e10cSrcweir SV_DECL_REF( SwDocShell )
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #ifndef INCLUDED_VECTOR
42cdf0e10cSrcweir #include <vector>
43cdf0e10cSrcweir #define INCLUDED_VECTOR
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #include "swdllapi.h"
46cdf0e10cSrcweir 
47cdf0e10cSrcweir typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef;
48cdf0e10cSrcweir typedef ::std::vector< AutoTextGroupRef > UnoAutoTextGroups;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextEntry > AutoTextEntryRef;
51cdf0e10cSrcweir typedef ::std::vector< AutoTextEntryRef > UnoAutoTextEntries;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #define GLOS_DELIM (sal_Unicode)'*'
54cdf0e10cSrcweir 
55cdf0e10cSrcweir // CLASS -----------------------------------------------------------------
56cdf0e10cSrcweir class SW_DLLPUBLIC SwGlossaries
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 	UnoAutoTextGroups       m_aGlossaryGroups;
59cdf0e10cSrcweir 	UnoAutoTextEntries      m_aGlossaryEntries;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     String                  m_aPath;
62cdf0e10cSrcweir     String                  m_sOldErrPath;
63cdf0e10cSrcweir     String                  m_sErrPath;
64cdf0e10cSrcweir     SvStrings               *m_pPathArr;
65cdf0e10cSrcweir     SvStrings               *m_pGlosArr;
66cdf0e10cSrcweir     sal_Bool                    m_bError;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	SW_DLLPRIVATE SwTextBlocks*	GetGlosDoc(const String &rName, sal_Bool bCreate = sal_True) const;
69cdf0e10cSrcweir 	SW_DLLPRIVATE SvStrings	    *GetNameList();
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 	// implementation in unoatxt.cxx
72cdf0e10cSrcweir 	SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup );
73cdf0e10cSrcweir 	SW_DLLPRIVATE void InvalidateUNOOjects();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir public:
76cdf0e10cSrcweir 	SwGlossaries();
77cdf0e10cSrcweir 	~SwGlossaries();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	/** returns the cached AutoTextGroup (if any) for the given group name
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 		@precond
82cdf0e10cSrcweir 			If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 		@param _rGroupName
85cdf0e10cSrcweir 			the name of the glossaries group
86cdf0e10cSrcweir 		@param _bCreate
87cdf0e10cSrcweir 			if <TRUE/>, the group is created if it does not yet exist
88cdf0e10cSrcweir 	*/
89cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextGroup >
90cdf0e10cSrcweir 							GetAutoTextGroup(
91cdf0e10cSrcweir 								const ::rtl::OUString& _rGroupName,
92cdf0e10cSrcweir 								bool _bCreate = false
93cdf0e10cSrcweir 							);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	/** returns the cached AutoTextEntry (if any) for the given group/with the given name
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 		@precond
98cdf0e10cSrcweir 			If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 		@param _rGroupAccessName
101cdf0e10cSrcweir 			the name to access the group
102cdf0e10cSrcweir 		@param _rGroupName
103cdf0e10cSrcweir 			the name of the glossaries group, as to be passed to the entry
104cdf0e10cSrcweir 		@param _rEntryName
105cdf0e10cSrcweir 			the name of the auto text entry
106cdf0e10cSrcweir 		@param _bCreate
107cdf0e10cSrcweir 			if <TRUE/>, the entry is created if it does not yet exist
108cdf0e10cSrcweir 	*/
109cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry >
110cdf0e10cSrcweir 							GetAutoTextEntry(
111cdf0e10cSrcweir 								const String& _rCompleteGroupName,
112cdf0e10cSrcweir 								const ::rtl::OUString& _rGroupName,
113cdf0e10cSrcweir 								const ::rtl::OUString& _rEntryName,
114cdf0e10cSrcweir 								bool _bCreate = false
115cdf0e10cSrcweir 							);
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	sal_uInt16					GetGroupCnt();
118cdf0e10cSrcweir 	String					GetGroupName(sal_uInt16	);
119cdf0e10cSrcweir 	String					GetGroupTitle( const String& rGroupName );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 	sal_Bool 			FindGroupName(String & rGroup);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	SwTextBlocks*	GetGroupDoc(const String &rName,
124cdf0e10cSrcweir 								sal_Bool bCreate = sal_False) const;
GetDefGroupDoc() const125cdf0e10cSrcweir 	SwTextBlocks*	GetDefGroupDoc() const {return GetGroupDoc(GetDefName());}
126cdf0e10cSrcweir 	void			PutGroupDoc(SwTextBlocks *pBlock);
127cdf0e10cSrcweir 	static String 	GetDefName();
128cdf0e10cSrcweir 	static String	GetExtension();
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 	String 			GetCompleteGroupName( const ::rtl::OUString& GroupName );
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	sal_Bool			NewGroupDoc(String &rGroupName, const String& rTitle);
133cdf0e10cSrcweir 	sal_Bool			RenameGroupDoc(const String& sOldGroup, String& sNewGroup, const String& rNewTitle);
134cdf0e10cSrcweir 	sal_Bool			DelGroupDoc(const String &);
135cdf0e10cSrcweir 	SwDocShellRef	EditGroupDoc(const String &rGrpName, const String& rShortName, sal_Bool bShow = sal_True );
136cdf0e10cSrcweir 	void 			SaveGroupDoc(const String &rGrpName, const String& rLongName );
137cdf0e10cSrcweir 	void			UpdateGlosPath(sal_Bool bFull);
138cdf0e10cSrcweir 	void			ShowError();
IsGlosPathErr()139cdf0e10cSrcweir     inline sal_uLong    IsGlosPathErr() { return m_bError; }
GetPathArray() const140cdf0e10cSrcweir     const SvStrings*    GetPathArray() const {return m_pPathArr;}
141cdf0e10cSrcweir };
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 
144cdf0e10cSrcweir #endif // _GLOSDOC_HXX
145