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