xref: /aoo41x/main/sw/source/ui/inc/glossary.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 _GLOSSARY_HXX
28 #define _GLOSSARY_HXX
29 
30 #ifndef _EDIT_HXX //autogen
31 #include <vcl/edit.hxx>
32 #endif
33 #include <svtools/svtreebx.hxx>
34 #include <svx/stddlg.hxx>
35 
36 #ifndef _BUTTON_HXX //autogen
37 #include <vcl/button.hxx>
38 #endif
39 #include <vcl/fixed.hxx>
40 
41 #ifndef _BUTTON_HXX //autogen
42 #include <vcl/button.hxx>
43 #endif
44 
45 #ifndef _FIXED_HXX //autogen
46 #include <vcl/fixed.hxx>
47 #endif
48 
49 #ifndef _COMBOBOX_HXX //autogen
50 #include <vcl/combobox.hxx>
51 #endif
52 
53 #ifndef _MENUBTN_HXX //autogen
54 #include <vcl/menubtn.hxx>
55 #endif
56 #include <com/sun/star/container/XEnumerationAccess.hpp>
57 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
58 #include <com/sun/star/container/XNameAccess.hpp>
59 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
60 #include <com/sun/star/container/XEnumeration.hpp>
61 #include <com/sun/star/container/XElementAccess.hpp>
62 #include <com/sun/star/container/XIndexAccess.hpp>
63 
64 #include <actctrl.hxx>
65 
66 class SwGlossaryHdl;
67 class SwNewGlosNameDlg;
68 class SwWrtShell;
69 class SfxViewFrame;
70 class PopupMenu;
71 class Menu;
72 
73 const short RET_EDIT = 100;
74 
75 //------------------------------------------------------------------
76 
77 class SwGlTreeListBox : public SvTreeListBox
78 {
79 	const String 	sReadonly;
80 
81 	SvLBoxEntry*  pDragEntry;
82 
83 	virtual DragDropMode NotifyStartDrag( TransferDataContainer& rContainer,
84 											SvLBoxEntry* );
85 	virtual sal_Bool    NotifyAcceptDrop( SvLBoxEntry* );
86 
87 	virtual sal_Bool    NotifyMoving(   SvLBoxEntry*  pTarget,
88 									SvLBoxEntry*  pEntry,
89 									SvLBoxEntry*& rpNewParent,
90 									sal_uLong&        rNewChildPos
91 								);
92 	virtual sal_Bool	NotifyCopying(	SvLBoxEntry*  pTarget,
93 									SvLBoxEntry*  pEntry,
94 									SvLBoxEntry*& rpNewParent,
95 									sal_uLong&		  rNewChildPos);
96 public:
97 	SwGlTreeListBox(Window* pParent, const ResId& rResId);
98 
99 	virtual void 	RequestHelp( const HelpEvent& rHEvt );
100 	void			Clear();
101 };
102 
103 //------------------------------------------------------------------
104 class SwOneExampleFrame;
105 class SwGlossaryDlg : public SvxStandardDialog
106 {
107 	friend class SwNewGlosNameDlg;
108 	friend class SwGlTreeListBox;
109 
110 	CheckBox		aInsertTipCB;
111 	FixedText		aNameLbl;
112 	Edit			aNameED;
113 	FixedText		aShortNameLbl;
114 	NoSpaceEdit 	aShortNameEdit;
115 	SwGlTreeListBox	aCategoryBox;
116     FixedLine       aRelativeFL;
117 	CheckBox		aFileRelCB;
118 	CheckBox		aNetRelCB;
119     Window          aExampleWIN;
120     Window          aExampleDummyWIN;
121     CheckBox        aShowExampleCB;
122 	OKButton		aInsertBtn;
123 	CancelButton	aCloseBtn;
124 	HelpButton		aHelpBtn;
125 	MenuButton		aEditBtn;
126 	PushButton		aBibBtn;
127 	PushButton		aPathBtn;
128 
129 	String 			sReadonlyPath;
130 
131 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >  		_xAutoText;
132 	SwOneExampleFrame*	pExampleFrame;
133 
134 	PopupMenu*		pMenu;
135 	SwGlossaryHdl*	pGlossaryHdl;
136 
137 	String 			sResumeGroup;
138 	String			sResumeShortName;
139 	sal_Bool			bResume;
140 
141 
142 	const sal_Bool		bSelection : 1;
143 	sal_Bool 			bReadOnly : 1;
144 	sal_Bool 			bIsOld : 1;
145 	sal_Bool			bIsDocReadOnly:1;
146 
147 	SwWrtShell*		pSh;
148 
149 	void EnableShortName(sal_Bool bOn = sal_True);
150 
151 	DECL_LINK( NameModify, Edit * );
152 	DECL_LINK( NameDoubleClick, SvTreeListBox * );
153 	DECL_LINK( GrpSelect, SvTreeListBox * );
154 	DECL_LINK( MenuHdl, Menu * );
155 	DECL_LINK( EnableHdl, Menu * );
156 	DECL_LINK( BibHdl, Button * );
157 	DECL_LINK( EditHdl, Button * );
158 	DECL_LINK( PathHdl, Button * );
159 	DECL_LINK( CheckBoxHdl, CheckBox * );
160 	DECL_LINK( ShowPreviewHdl, CheckBox * );
161 	DECL_LINK( PreviewLoadedHdl, void * );
162 
163 
164 	virtual void 	Apply();
165 	void 			Init();
166 	SvLBoxEntry* 	DoesBlockExist(const String& sBlock, const String& rShort);
167 	void 			ShowAutoText(const String& rGroup, const String& rShortName);
168 	void			ResumeShowAutoText();
169 
170 	sal_Bool			GetResumeData(String& rGroup, String& rShortName)
171 						{rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;}
172 	void			SetResumeData(const String& rGroup, const String& rShortName)
173 						{sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = sal_True;}
174 	void			ResetResumeData() {bResume = sal_False;}
175 public:
176 	SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
177 	~SwGlossaryDlg();
178 	String			GetCurrGrpName() const;
179 	inline String	GetCurrLongName() const;
180 	inline String	GetCurrShortName() const;
181 	static String   GetCurrGroup();
182 	static void   	SetActGroup(const String& rNewGroup);
183 	static String	GetExtension();
184 };
185 
186 inline String SwGlossaryDlg::GetCurrLongName() const
187 {
188 	return aNameED.GetText();
189 }
190 inline String SwGlossaryDlg::GetCurrShortName() const
191 {
192 	return aShortNameEdit.GetText();
193 }
194 
195 
196 #endif
197 
198