xref: /trunk/main/sw/source/ui/inc/gloshdl.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _GLOSHDL_HXX
28 #define _GLOSHDL_HXX
29 
30 #include <tools/string.hxx>
31 #include "swdllapi.h"
32 
33 class SwWrtShell;
34 class SwTextBlocks;
35 class SvxMacro;
36 class SwGlossaries;
37 class SfxViewFrame;
38 
39 // CLASS -----------------------------------------------------------------
40 class SW_DLLPUBLIC SwGlossaryHdl
41 {
42 
43 	SwGlossaries&	rStatGlossaries;
44 	String			aCurGrp;
45 	SfxViewFrame*	pViewFrame;
46 	SwWrtShell* 	pWrtShell;
47 	SwTextBlocks*	pCurGrp;
48 
49 	SW_DLLPRIVATE void	_SetMacros(const String &rName,
50 					   const SvxMacro *pStart,
51 					   const SvxMacro *pEnd);
52 
53 	SW_DLLPRIVATE sal_Bool 	Expand( const String& rShortName,
54 					SwGlossaries* pGlossaries,
55                     SwTextBlocks *pGlossary );
56 
57 public:
58     sal_Bool    ConvertToNew(SwTextBlocks& rOld);
59 	void	GlossaryDlg();
60 
61 	sal_uInt16	GetGroupCnt() const;
62 	String	GetGroupName( sal_uInt16, String* pTitle = 0 );
63 	sal_Bool	NewGroup(String & rGroupName, const String& rTitle);
64 	sal_Bool	DelGroup(const String &);
65 	sal_Bool	RenameGroup(const String & rOld, String& rNew, const String& rNewTitle);
66 	void	SetCurGroup(const String &aGrp, sal_Bool bApi = sal_False, sal_Bool bAlwaysCreateNew = sal_False);
67 
68 	const String &GetCurGroup() const { return aCurGrp; }
69 
70 	sal_uInt16	GetGlossaryCnt();
71 	String	GetGlossaryName(sal_uInt16);
72 	String	GetGlossaryShortName(const String &rName);
73 	String	GetGlossaryShortName(sal_uInt16);
74 
75 	sal_Bool    Rename( const String& rOldShortName,  const String& rNewShortName,
76 						const String& rNewName);
77 	sal_Bool    CopyOrMove( const String& rSourceGroupName,  String& rSourceShortName,
78 						const String& rDestGroupName, const String& rLongName, sal_Bool bMove );
79 	sal_Bool	HasShortName(const String &rShortName) const;
80 	//wird NewGlossary vom Basic gerufen, dann soll dir zuvor eingestellte
81 	//Gruppe ggf. neu erstellt werden
82 	sal_Bool	NewGlossary(const String &rName, const String &rShortName,
83 				sal_Bool bApiCall = sal_False, sal_Bool bNoAttr = sal_False );
84 	sal_Bool	DelGlossary(const String&);
85 	sal_Bool 	CopyToClipboard(SwWrtShell& rSh, const String& rShortName);
86 
87     sal_Bool    ExpandGlossary();
88 	sal_Bool	InsertGlossary(const String &rName);
89 
90 	void	SetMacros(const String& rName,
91 					  const SvxMacro* pStart,
92 					  const SvxMacro* pEnd,
93 					  SwTextBlocks *pGlossary = 0 );
94 	void 	GetMacros(const String& rShortName,
95 					  SvxMacro& rStart,
96 					  SvxMacro& rEnd,
97 					  SwTextBlocks* pGlossary = 0 );
98 
99 	sal_Bool	IsReadOnly( const String* = 0 ) const;
100 	sal_Bool	IsOld() const;
101 
102 	sal_Bool 	FindGroupName(String & rGroup); // Gruppe ohne Pfadindex finden
103 
104 	sal_Bool 	ImportGlossaries( const String& rName );
105 
106             SwGlossaryHdl(SfxViewFrame* pViewFrame, SwWrtShell *);
107 			~SwGlossaryHdl();
108 };
109 
110 #endif // _GLOSHDL_HXX
111