xref: /aoo41x/main/sw/source/ui/inc/gloshdl.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _GLOSHDL_HXX
24 #define _GLOSHDL_HXX
25 
26 #include <tools/string.hxx>
27 #include "swdllapi.h"
28 
29 class SwWrtShell;
30 class SwTextBlocks;
31 class SvxMacro;
32 class SwGlossaries;
33 class SfxViewFrame;
34 
35 // CLASS -----------------------------------------------------------------
36 class SW_DLLPUBLIC SwGlossaryHdl
37 {
38 
39 	SwGlossaries&	rStatGlossaries;
40 	String			aCurGrp;
41 	SfxViewFrame*	pViewFrame;
42 	SwWrtShell* 	pWrtShell;
43 	SwTextBlocks*	pCurGrp;
44 
45 	SW_DLLPRIVATE void	_SetMacros(const String &rName,
46 					   const SvxMacro *pStart,
47 					   const SvxMacro *pEnd);
48 
49 	SW_DLLPRIVATE sal_Bool 	Expand( const String& rShortName,
50 					SwGlossaries* pGlossaries,
51                     SwTextBlocks *pGlossary );
52 
53 public:
54     sal_Bool    ConvertToNew(SwTextBlocks& rOld);
55 	void	GlossaryDlg();
56 
57 	sal_uInt16	GetGroupCnt() const;
58 	String	GetGroupName( sal_uInt16, String* pTitle = 0 );
59 	sal_Bool	NewGroup(String & rGroupName, const String& rTitle);
60 	sal_Bool	DelGroup(const String &);
61 	sal_Bool	RenameGroup(const String & rOld, String& rNew, const String& rNewTitle);
62 	void	SetCurGroup(const String &aGrp, sal_Bool bApi = sal_False, sal_Bool bAlwaysCreateNew = sal_False);
63 
GetCurGroup() const64 	const String &GetCurGroup() const { return aCurGrp; }
65 
66 	sal_uInt16	GetGlossaryCnt();
67 	String	GetGlossaryName(sal_uInt16);
68 	String	GetGlossaryShortName(const String &rName);
69 	String	GetGlossaryShortName(sal_uInt16);
70 
71 	sal_Bool    Rename( const String& rOldShortName,  const String& rNewShortName,
72 						const String& rNewName);
73 	sal_Bool    CopyOrMove( const String& rSourceGroupName,  String& rSourceShortName,
74 						const String& rDestGroupName, const String& rLongName, sal_Bool bMove );
75 	sal_Bool	HasShortName(const String &rShortName) const;
76 	//wird NewGlossary vom Basic gerufen, dann soll dir zuvor eingestellte
77 	//Gruppe ggf. neu erstellt werden
78 	sal_Bool	NewGlossary(const String &rName, const String &rShortName,
79 				sal_Bool bApiCall = sal_False, sal_Bool bNoAttr = sal_False );
80 	sal_Bool	DelGlossary(const String&);
81 	sal_Bool 	CopyToClipboard(SwWrtShell& rSh, const String& rShortName);
82 
83     sal_Bool    ExpandGlossary();
84 	sal_Bool	InsertGlossary(const String &rName);
85 
86 	void	SetMacros(const String& rName,
87 					  const SvxMacro* pStart,
88 					  const SvxMacro* pEnd,
89 					  SwTextBlocks *pGlossary = 0 );
90 	void 	GetMacros(const String& rShortName,
91 					  SvxMacro& rStart,
92 					  SvxMacro& rEnd,
93 					  SwTextBlocks* pGlossary = 0 );
94 
95 	sal_Bool	IsReadOnly( const String* = 0 ) const;
96 	sal_Bool	IsOld() const;
97 
98 	sal_Bool 	FindGroupName(String & rGroup); // Gruppe ohne Pfadindex finden
99 
100 	sal_Bool 	ImportGlossaries( const String& rName );
101 
102             SwGlossaryHdl(SfxViewFrame* pViewFrame, SwWrtShell *);
103 			~SwGlossaryHdl();
104 };
105 
106 #endif // _GLOSHDL_HXX
107