xref: /trunk/main/sw/source/ui/misc/glossary.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
32*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR
36*cdf0e10cSrcweir #define _SVSTDARR_STRINGS
37*cdf0e10cSrcweir #include <hintids.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <vcl/menu.hxx>
40*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
41*cdf0e10cSrcweir #include <vcl/help.hxx>
42*cdf0e10cSrcweir #ifndef _SVSTDARR_HXX
43*cdf0e10cSrcweir #include <svl/svstdarr.hxx>
44*cdf0e10cSrcweir #endif
45*cdf0e10cSrcweir #include <svl/stritem.hxx>
46*cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
47*cdf0e10cSrcweir #include <unotools/lingucfg.hxx>
48*cdf0e10cSrcweir #include <sfx2/request.hxx>
49*cdf0e10cSrcweir #include <sfx2/fcontnr.hxx>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir #include <svx/svxdlg.hxx>
52*cdf0e10cSrcweir #include <svx/dialogs.hrc>
53*cdf0e10cSrcweir #include <editeng/acorrcfg.hxx>
54*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
55*cdf0e10cSrcweir #include <unocrsr.hxx>
56*cdf0e10cSrcweir #include <unotools.hxx>
57*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
58*cdf0e10cSrcweir #include <ucbhelper/content.hxx>
59*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
60*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
61*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
62*cdf0e10cSrcweir #include <svl/urihelper.hxx>
63*cdf0e10cSrcweir #include <unotools/charclass.hxx>
64*cdf0e10cSrcweir #include <swwait.hxx>
65*cdf0e10cSrcweir #include <swtypes.hxx>
66*cdf0e10cSrcweir #include <wrtsh.hxx>
67*cdf0e10cSrcweir #include <view.hxx>
68*cdf0e10cSrcweir #include <basesh.hxx>
69*cdf0e10cSrcweir #include <glossary.hxx>
70*cdf0e10cSrcweir #include <gloshdl.hxx>
71*cdf0e10cSrcweir #include <glosbib.hxx>
72*cdf0e10cSrcweir #include <initui.hxx>                   // fuer ::GetGlossaries()
73*cdf0e10cSrcweir #include <glosdoc.hxx>
74*cdf0e10cSrcweir #include <macassgn.hxx>
75*cdf0e10cSrcweir #include <swevent.hxx>
76*cdf0e10cSrcweir #include <docsh.hxx>
77*cdf0e10cSrcweir #include <shellio.hxx>
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir #include <cmdid.h>
80*cdf0e10cSrcweir #include <helpid.h>
81*cdf0e10cSrcweir #include <swerror.h>
82*cdf0e10cSrcweir #ifndef _GLOBALS_HRC
83*cdf0e10cSrcweir #include <globals.hrc>
84*cdf0e10cSrcweir #endif
85*cdf0e10cSrcweir #ifndef _MISC_HRC
86*cdf0e10cSrcweir #include <misc.hrc>
87*cdf0e10cSrcweir #endif
88*cdf0e10cSrcweir #ifndef _GLOSSARY_HRC
89*cdf0e10cSrcweir #include <glossary.hrc>
90*cdf0e10cSrcweir #endif
91*cdf0e10cSrcweir #include <swmodule.hxx>
92*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx>
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir #include "access.hrc"
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir #define LONG_LENGTH 60
97*cdf0e10cSrcweir #define SHORT_LENGTH 30
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir using namespace ::com::sun::star;
101*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
102*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
103*cdf0e10cSrcweir using namespace ::com::sun::star::text;
104*cdf0e10cSrcweir using namespace ::com::sun::star::ucb;
105*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs;
106*cdf0e10cSrcweir using namespace ::comphelper;
107*cdf0e10cSrcweir using namespace ::ucbhelper;
108*cdf0e10cSrcweir using ::rtl::OUString;
109*cdf0e10cSrcweir using namespace ::sfx2;
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir String lcl_GetValidShortCut( const String& rName )
112*cdf0e10cSrcweir {
113*cdf0e10cSrcweir     const sal_uInt16 nSz = rName.Len();
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     if ( 0 == nSz )
116*cdf0e10cSrcweir         return rName;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     sal_uInt16 nStart = 1;
119*cdf0e10cSrcweir     while( rName.GetChar( nStart-1 ) == ' ' && nStart < nSz )
120*cdf0e10cSrcweir         nStart++;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     String aBuf( rName.GetChar( nStart-1 ));
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     for( ; nStart < nSz; ++nStart )
125*cdf0e10cSrcweir     {
126*cdf0e10cSrcweir         if( rName.GetChar( nStart-1 ) == ' ' && rName.GetChar( nStart ) != ' ')
127*cdf0e10cSrcweir             aBuf += rName.GetChar( nStart );
128*cdf0e10cSrcweir     }
129*cdf0e10cSrcweir     return aBuf;
130*cdf0e10cSrcweir }
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir /* -----------------------------08.02.00 10:28--------------------------------
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
135*cdf0e10cSrcweir struct GroupUserData
136*cdf0e10cSrcweir {
137*cdf0e10cSrcweir     String      sGroupName;
138*cdf0e10cSrcweir     sal_uInt16  nPathIdx;
139*cdf0e10cSrcweir     sal_Bool        bReadonly;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir     GroupUserData()
142*cdf0e10cSrcweir         : nPathIdx(0),
143*cdf0e10cSrcweir           bReadonly(sal_False)  {}
144*cdf0e10cSrcweir };
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir /*------------------------------------------------------------------------
147*cdf0e10cSrcweir  Beschreibung:  Dialog fuer neuen Bausteinnamen
148*cdf0e10cSrcweir ------------------------------------------------------------------------*/
149*cdf0e10cSrcweir class SwNewGlosNameDlg : public ModalDialog
150*cdf0e10cSrcweir {
151*cdf0e10cSrcweir     FixedText       aNNFT;
152*cdf0e10cSrcweir     Edit            aNewName;
153*cdf0e10cSrcweir     FixedText       aNSFT;
154*cdf0e10cSrcweir     NoSpaceEdit     aNewShort;
155*cdf0e10cSrcweir     OKButton        aOk;
156*cdf0e10cSrcweir     CancelButton    aCancel;
157*cdf0e10cSrcweir     FixedText       aONFT;
158*cdf0e10cSrcweir     Edit            aOldName;
159*cdf0e10cSrcweir     FixedText       aOSFT;
160*cdf0e10cSrcweir     Edit            aOldShort;
161*cdf0e10cSrcweir     FixedLine       aFL;
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir protected:
164*cdf0e10cSrcweir     DECL_LINK( Modify, Edit * );
165*cdf0e10cSrcweir     DECL_LINK( Rename, Button * );
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir public:
168*cdf0e10cSrcweir     SwNewGlosNameDlg( Window* pParent,
169*cdf0e10cSrcweir                       const String& rOldName,
170*cdf0e10cSrcweir                       const String& rOldShort );
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     String GetNewName()  const { return aNewName.GetText(); }
173*cdf0e10cSrcweir     String GetNewShort() const { return aNewShort.GetText(); }
174*cdf0e10cSrcweir };
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir SwNewGlosNameDlg::SwNewGlosNameDlg(Window* pParent,
177*cdf0e10cSrcweir                             const String& rOldName,
178*cdf0e10cSrcweir                             const String& rOldShort ) :
179*cdf0e10cSrcweir     ModalDialog( pParent, SW_RES( DLG_RENAME_GLOS ) ),
180*cdf0e10cSrcweir     aNNFT   (this, SW_RES( FT_NN    )),
181*cdf0e10cSrcweir     aNewName(this, SW_RES( ED_NN    )),
182*cdf0e10cSrcweir     aNSFT   (this, SW_RES( FT_NS    )),
183*cdf0e10cSrcweir     aNewShort(this,SW_RES( ED_NS    )),
184*cdf0e10cSrcweir     aOk     (this, SW_RES( BT_OKNEW)),
185*cdf0e10cSrcweir     aCancel (this, SW_RES( BT_CANCEL)),
186*cdf0e10cSrcweir     aONFT   (this, SW_RES( FT_ON    )),
187*cdf0e10cSrcweir     aOldName(this, SW_RES( ED_ON    )),
188*cdf0e10cSrcweir     aOSFT   (this, SW_RES( FT_OS    )),
189*cdf0e10cSrcweir     aOldShort(this,SW_RES( ED_OS    )),
190*cdf0e10cSrcweir     aFL    (this, SW_RES( FL_NN    ))
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir {
193*cdf0e10cSrcweir     FreeResource();
194*cdf0e10cSrcweir     aOldName.SetText( rOldName );
195*cdf0e10cSrcweir     aOldShort.SetText( rOldShort );
196*cdf0e10cSrcweir     aNewShort.SetMaxTextLen(SHORT_LENGTH);
197*cdf0e10cSrcweir     aNewName.SetMaxTextLen(LONG_LENGTH);
198*cdf0e10cSrcweir     aNewName.SetModifyHdl(LINK(this, SwNewGlosNameDlg, Modify ));
199*cdf0e10cSrcweir     aNewShort.SetModifyHdl(LINK(this, SwNewGlosNameDlg, Modify ));
200*cdf0e10cSrcweir     aOk.SetClickHdl(LINK(this, SwNewGlosNameDlg, Rename ));
201*cdf0e10cSrcweir     aNewName.GrabFocus();
202*cdf0e10cSrcweir }
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir /*------------------------------------------------------------------------
205*cdf0e10cSrcweir  Beschreibung:  aktuell eingestellte Gruppe erfragen / setzen
206*cdf0e10cSrcweir ------------------------------------------------------------------------*/
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir String SwGlossaryDlg::GetCurrGroup()
209*cdf0e10cSrcweir {
210*cdf0e10cSrcweir     if( ::GetCurrGlosGroup() && ::GetCurrGlosGroup()->Len() )
211*cdf0e10cSrcweir         return *(::GetCurrGlosGroup());
212*cdf0e10cSrcweir     return SwGlossaries::GetDefName();
213*cdf0e10cSrcweir }
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir void SwGlossaryDlg::SetActGroup(const String &rGrp)
218*cdf0e10cSrcweir {
219*cdf0e10cSrcweir     if( !::GetCurrGlosGroup() )
220*cdf0e10cSrcweir         ::SetCurrGlosGroup( new String );
221*cdf0e10cSrcweir     *(::GetCurrGlosGroup()) = rGrp;
222*cdf0e10cSrcweir }
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame,
227*cdf0e10cSrcweir                             SwGlossaryHdl * pGlosHdl, SwWrtShell *pWrtShell) :
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir     SvxStandardDialog(&pViewFrame->GetWindow(), SW_RES(DLG_GLOSSARY)),
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir     aInsertTipCB  (this, SW_RES(CB_INSERT_TIP)),
232*cdf0e10cSrcweir     aNameLbl      (this, SW_RES(FT_NAME)),
233*cdf0e10cSrcweir     aNameED       (this, SW_RES(ED_NAME)),
234*cdf0e10cSrcweir     aShortNameLbl (this, SW_RES(FT_SHORTNAME)),
235*cdf0e10cSrcweir     aShortNameEdit(this, SW_RES(ED_SHORTNAME)),
236*cdf0e10cSrcweir     aCategoryBox  (this, SW_RES(LB_BIB)),
237*cdf0e10cSrcweir     aRelativeFL   (this, SW_RES(FL_RELATIVE)),
238*cdf0e10cSrcweir     aFileRelCB    (this, SW_RES(CB_FILE_REL)),
239*cdf0e10cSrcweir     aNetRelCB     (this, SW_RES(CB_NET_REL)),
240*cdf0e10cSrcweir     aExampleWIN   (this, SW_RES(WIN_EXAMPLE )),
241*cdf0e10cSrcweir     aExampleDummyWIN(this, SW_RES(WIN_EXAMPLE_DUMMY )),
242*cdf0e10cSrcweir     aShowExampleCB(this, SW_RES(CB_SHOW_EXAMPLE )),
243*cdf0e10cSrcweir     aInsertBtn    (this, SW_RES(PB_INSERT)),
244*cdf0e10cSrcweir     aCloseBtn     (this, SW_RES(PB_CLOSE)),
245*cdf0e10cSrcweir     aHelpBtn      (this, SW_RES(PB_HELP)),
246*cdf0e10cSrcweir     aEditBtn      (this, SW_RES(PB_EDIT)),
247*cdf0e10cSrcweir     aBibBtn       (this, SW_RES(PB_BIB)),
248*cdf0e10cSrcweir     aPathBtn      (this, SW_RES(PB_PATH)),
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir     sReadonlyPath (SW_RES(ST_READONLY_PATH)),
251*cdf0e10cSrcweir     pExampleFrame(0),
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir     pMenu         (new PopupMenu(SW_RES(MNU_EDIT))),
254*cdf0e10cSrcweir     pGlossaryHdl  (pGlosHdl),
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     bResume(sal_False),
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir     bSelection( pWrtShell->IsSelection() ),
259*cdf0e10cSrcweir     bReadOnly( sal_False ),
260*cdf0e10cSrcweir     bIsOld( sal_False ),
261*cdf0e10cSrcweir     bIsDocReadOnly(sal_False),
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir     pSh           (pWrtShell)
264*cdf0e10cSrcweir {
265*cdf0e10cSrcweir     SvtLinguConfig aLocalLinguConfig;
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir     // Static-Pointer initialisieren
268*cdf0e10cSrcweir     if( !::GetCurrGlosGroup() )
269*cdf0e10cSrcweir         ::SetCurrGlosGroup(new String);//(SwGlossaries::GetDefName());
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir     pMenu->SetActivateHdl(LINK(this,SwGlossaryDlg,EnableHdl));
272*cdf0e10cSrcweir     pMenu->SetSelectHdl(LINK(this,SwGlossaryDlg,MenuHdl));
273*cdf0e10cSrcweir     aEditBtn.SetPopupMenu(pMenu);
274*cdf0e10cSrcweir     aEditBtn.SetSelectHdl(LINK(this,SwGlossaryDlg,EditHdl));
275*cdf0e10cSrcweir     aPathBtn.SetClickHdl(LINK(this, SwGlossaryDlg, PathHdl));
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir     aNameED.SetModifyHdl(LINK(this,SwGlossaryDlg,NameModify));
278*cdf0e10cSrcweir     aShortNameEdit.SetModifyHdl(LINK(this,SwGlossaryDlg,NameModify));
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir     aCategoryBox.SetDoubleClickHdl(LINK(this,SwGlossaryDlg, NameDoubleClick));
281*cdf0e10cSrcweir     aCategoryBox.SetSelectHdl(LINK(this,SwGlossaryDlg,GrpSelect));
282*cdf0e10cSrcweir     aBibBtn.SetClickHdl(LINK(this,SwGlossaryDlg,BibHdl));
283*cdf0e10cSrcweir     aShowExampleCB.SetClickHdl(LINK(this, SwGlossaryDlg, ShowPreviewHdl));
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir     aShortNameEdit.SetMaxTextLen(SHORT_LENGTH);
286*cdf0e10cSrcweir     aNameED.SetMaxTextLen(LONG_LENGTH);
287*cdf0e10cSrcweir     FreeResource();
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir     const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir     aShowExampleCB.Check( pCfg->IsAutoTextPreview());
292*cdf0e10cSrcweir     ShowPreviewHdl(&aShowExampleCB);
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir     bIsDocReadOnly = pSh->GetView().GetDocShell()->IsReadOnly() ||
295*cdf0e10cSrcweir                       pSh->HasReadonlySel();
296*cdf0e10cSrcweir     if( bIsDocReadOnly )
297*cdf0e10cSrcweir         aInsertBtn.Enable(sal_False);
298*cdf0e10cSrcweir     aNameED.GrabFocus();
299*cdf0e10cSrcweir     aCategoryBox.SetHelpId(HID_MD_GLOS_CATEGORY);
300*cdf0e10cSrcweir     aCategoryBox.SetStyle(aCategoryBox.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL|WB_VSCROLL|WB_CLIPCHILDREN|WB_SORT);
301*cdf0e10cSrcweir     aCategoryBox.GetModel()->SetSortMode(SortAscending);
302*cdf0e10cSrcweir     aCategoryBox.SetHighlightRange();   // ueber volle Breite selektieren
303*cdf0e10cSrcweir     aCategoryBox.SetNodeDefaultImages( );
304*cdf0e10cSrcweir     aCategoryBox.SetAccessibleName(SW_RES(STR_ACCESS_SW_CATEGORY));
305*cdf0e10cSrcweir     aCategoryBox.SetAccessibleRelationLabeledBy(&aInsertTipCB);
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir     Init();
308*cdf0e10cSrcweir }
309*cdf0e10cSrcweir /*--------------------------------------------------------------------
310*cdf0e10cSrcweir      Beschreibung:
311*cdf0e10cSrcweir  --------------------------------------------------------------------*/
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir SwGlossaryDlg::~SwGlossaryDlg()
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir     SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
317*cdf0e10cSrcweir     pCfg->SetAutoTextPreview(aShowExampleCB.IsChecked()) ;
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir     aCategoryBox.Clear();
320*cdf0e10cSrcweir     aEditBtn.SetPopupMenu(0);
321*cdf0e10cSrcweir     delete pMenu;
322*cdf0e10cSrcweir     delete pExampleFrame;
323*cdf0e10cSrcweir }
324*cdf0e10cSrcweir /*------------------------------------------------------------------------
325*cdf0e10cSrcweir  Beschreibung:  Auswahl neue Gruppe
326*cdf0e10cSrcweir ------------------------------------------------------------------------*/
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox )
330*cdf0e10cSrcweir {
331*cdf0e10cSrcweir     SvLBoxEntry* pEntry = pBox->FirstSelected();
332*cdf0e10cSrcweir     if(!pEntry)
333*cdf0e10cSrcweir         return 0;
334*cdf0e10cSrcweir     SvLBoxEntry* pParent = pBox->GetParent(pEntry) ? pBox->GetParent(pEntry) : pEntry;
335*cdf0e10cSrcweir     GroupUserData* pGroupData = (GroupUserData*)pParent->GetUserData();
336*cdf0e10cSrcweir     String *pGlosGroup = ::GetCurrGlosGroup();
337*cdf0e10cSrcweir     (*pGlosGroup) = pGroupData->sGroupName;
338*cdf0e10cSrcweir     (*pGlosGroup) += GLOS_DELIM;
339*cdf0e10cSrcweir     (*pGlosGroup) += String::CreateFromInt32(pGroupData->nPathIdx);
340*cdf0e10cSrcweir     pGlossaryHdl->SetCurGroup(*pGlosGroup);
341*cdf0e10cSrcweir     // Aktuellen Textbaustein setzen
342*cdf0e10cSrcweir     bReadOnly = pGlossaryHdl->IsReadOnly();
343*cdf0e10cSrcweir     EnableShortName( !bReadOnly );
344*cdf0e10cSrcweir     aEditBtn.Enable(!bReadOnly);
345*cdf0e10cSrcweir     bIsOld = pGlossaryHdl->IsOld();
346*cdf0e10cSrcweir     if( pParent != pEntry)
347*cdf0e10cSrcweir     {
348*cdf0e10cSrcweir         String aName(pBox->GetEntryText(pEntry));
349*cdf0e10cSrcweir         aNameED.SetText(aName);
350*cdf0e10cSrcweir         aShortNameEdit.SetText(*(String*)pEntry->GetUserData());
351*cdf0e10cSrcweir         pEntry = pBox->GetParent(pEntry);
352*cdf0e10cSrcweir         aInsertBtn.Enable( !bIsDocReadOnly);
353*cdf0e10cSrcweir         ShowAutoText(*::GetCurrGlosGroup(), aShortNameEdit.GetText());
354*cdf0e10cSrcweir     }
355*cdf0e10cSrcweir     else
356*cdf0e10cSrcweir         ShowAutoText(aEmptyStr, aEmptyStr);
357*cdf0e10cSrcweir     //Controls aktualisieren
358*cdf0e10cSrcweir     NameModify(&aShortNameEdit);
359*cdf0e10cSrcweir     if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
360*cdf0e10cSrcweir     {
361*cdf0e10cSrcweir         SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_SET_ACT_GLOSSARY );
362*cdf0e10cSrcweir         String sTemp(*::GetCurrGlosGroup());
363*cdf0e10cSrcweir         // der nullte Pfad wird nicht aufgezeichnet!
364*cdf0e10cSrcweir         if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0))
365*cdf0e10cSrcweir             sTemp = sTemp.GetToken(0, GLOS_DELIM);
366*cdf0e10cSrcweir         aReq.AppendItem(SfxStringItem(FN_SET_ACT_GLOSSARY, sTemp));
367*cdf0e10cSrcweir         aReq.Done();
368*cdf0e10cSrcweir     }
369*cdf0e10cSrcweir     return 0;
370*cdf0e10cSrcweir }
371*cdf0e10cSrcweir /*--------------------------------------------------------------------
372*cdf0e10cSrcweir      Beschreibung:
373*cdf0e10cSrcweir  --------------------------------------------------------------------*/
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir void SwGlossaryDlg::Apply()
377*cdf0e10cSrcweir {
378*cdf0e10cSrcweir     const String aGlosName(aShortNameEdit.GetText());
379*cdf0e10cSrcweir     if(aGlosName.Len()) pGlossaryHdl->InsertGlossary(aGlosName);
380*cdf0e10cSrcweir     if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
381*cdf0e10cSrcweir     {
382*cdf0e10cSrcweir         SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_INSERT_GLOSSARY );
383*cdf0e10cSrcweir         String sTemp(*::GetCurrGlosGroup());
384*cdf0e10cSrcweir         // der nullte Pfad wird nicht aufgezeichnet!
385*cdf0e10cSrcweir         if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0))
386*cdf0e10cSrcweir             sTemp = sTemp.GetToken(0, GLOS_DELIM);
387*cdf0e10cSrcweir         aReq.AppendItem(SfxStringItem(FN_INSERT_GLOSSARY, sTemp));
388*cdf0e10cSrcweir         aReq.AppendItem(SfxStringItem(FN_PARAM_1, aGlosName));
389*cdf0e10cSrcweir         aReq.Done();
390*cdf0e10cSrcweir     }
391*cdf0e10cSrcweir }
392*cdf0e10cSrcweir /*--------------------------------------------------------------------
393*cdf0e10cSrcweir      Beschreibung:
394*cdf0e10cSrcweir  --------------------------------------------------------------------*/
395*cdf0e10cSrcweir /* inline */ void SwGlossaryDlg::EnableShortName(sal_Bool bOn)
396*cdf0e10cSrcweir {
397*cdf0e10cSrcweir     aShortNameLbl.Enable(bOn);
398*cdf0e10cSrcweir     aShortNameEdit.Enable(bOn);
399*cdf0e10cSrcweir }
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir /* -----------------26.11.98 16:15-------------------
402*cdf0e10cSrcweir  * existiert der Titel in der ausgewaehlten Gruppe?
403*cdf0e10cSrcweir  * --------------------------------------------------*/
404*cdf0e10cSrcweir SvLBoxEntry* SwGlossaryDlg::DoesBlockExist(const String& rBlock,
405*cdf0e10cSrcweir                 const String& rShort)
406*cdf0e10cSrcweir {
407*cdf0e10cSrcweir     //evtl. vorhandenen Eintrag in der TreeListBox suchen
408*cdf0e10cSrcweir     SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
409*cdf0e10cSrcweir     if(pEntry)
410*cdf0e10cSrcweir     {
411*cdf0e10cSrcweir         if(aCategoryBox.GetParent(pEntry))
412*cdf0e10cSrcweir             pEntry = aCategoryBox.GetParent(pEntry);
413*cdf0e10cSrcweir         sal_uInt32 nChildCount = aCategoryBox.GetChildCount( pEntry );
414*cdf0e10cSrcweir         for(sal_uInt32 i = 0; i < nChildCount; i++)
415*cdf0e10cSrcweir         {
416*cdf0e10cSrcweir             SvLBoxEntry* pChild = aCategoryBox.GetEntry( pEntry, i );
417*cdf0e10cSrcweir             if(rBlock == aCategoryBox.GetEntryText(pChild) &&
418*cdf0e10cSrcweir                 (!rShort.Len() || rShort == *(String*)pChild->GetUserData()))
419*cdf0e10cSrcweir             {
420*cdf0e10cSrcweir                 return pChild;
421*cdf0e10cSrcweir             }
422*cdf0e10cSrcweir         }
423*cdf0e10cSrcweir     }
424*cdf0e10cSrcweir     return 0;
425*cdf0e10cSrcweir }
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir /*--------------------------------------------------------------------
428*cdf0e10cSrcweir      Beschreibung:
429*cdf0e10cSrcweir  --------------------------------------------------------------------*/
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, NameModify, Edit *, pEdit )
433*cdf0e10cSrcweir {
434*cdf0e10cSrcweir     String aName(aNameED.GetText());
435*cdf0e10cSrcweir     sal_Bool bNameED = pEdit == &aNameED;
436*cdf0e10cSrcweir     if( !aName.Len() )
437*cdf0e10cSrcweir     {
438*cdf0e10cSrcweir         if(bNameED)
439*cdf0e10cSrcweir             aShortNameEdit.SetText(aName);
440*cdf0e10cSrcweir         aInsertBtn.Enable(sal_False);
441*cdf0e10cSrcweir         return 0;
442*cdf0e10cSrcweir     }
443*cdf0e10cSrcweir     String sShortSearch;
444*cdf0e10cSrcweir     if(!bNameED)
445*cdf0e10cSrcweir         sShortSearch = pEdit->GetText();
446*cdf0e10cSrcweir     sal_Bool bNotFound = !DoesBlockExist(aName, sShortSearch);
447*cdf0e10cSrcweir     if(bNameED)
448*cdf0e10cSrcweir     {
449*cdf0e10cSrcweir             // ist der Text durch einen Klick in die Listbox in das
450*cdf0e10cSrcweir             // Edit gekommem?
451*cdf0e10cSrcweir         if(bNotFound)
452*cdf0e10cSrcweir         {
453*cdf0e10cSrcweir             aShortNameEdit.SetText( lcl_GetValidShortCut( aName ) );
454*cdf0e10cSrcweir             EnableShortName();
455*cdf0e10cSrcweir         }
456*cdf0e10cSrcweir         else
457*cdf0e10cSrcweir         {
458*cdf0e10cSrcweir             aShortNameEdit.SetText(pGlossaryHdl->GetGlossaryShortName(aName));
459*cdf0e10cSrcweir             EnableShortName(!bReadOnly);
460*cdf0e10cSrcweir         }
461*cdf0e10cSrcweir         aInsertBtn.Enable(!bNotFound && !bIsDocReadOnly);
462*cdf0e10cSrcweir     }
463*cdf0e10cSrcweir     else
464*cdf0e10cSrcweir     {
465*cdf0e10cSrcweir         //ShortNameEdit
466*cdf0e10cSrcweir         if(!bNotFound)
467*cdf0e10cSrcweir         {
468*cdf0e10cSrcweir             sal_Bool bEnable = !bNotFound;
469*cdf0e10cSrcweir             bEnable &= !bIsDocReadOnly;
470*cdf0e10cSrcweir             aInsertBtn.Enable(bEnable);
471*cdf0e10cSrcweir         }
472*cdf0e10cSrcweir     }
473*cdf0e10cSrcweir     return 0;
474*cdf0e10cSrcweir }
475*cdf0e10cSrcweir /*--------------------------------------------------------------------
476*cdf0e10cSrcweir      Beschreibung:
477*cdf0e10cSrcweir  --------------------------------------------------------------------*/
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwGlossaryDlg, NameDoubleClick, SvTreeListBox*, pBox )
481*cdf0e10cSrcweir {
482*cdf0e10cSrcweir     SvLBoxEntry* pEntry = pBox->FirstSelected();
483*cdf0e10cSrcweir     if(pBox->GetParent(pEntry) && !bIsDocReadOnly)
484*cdf0e10cSrcweir         EndDialog( RET_OK );
485*cdf0e10cSrcweir     return 0;
486*cdf0e10cSrcweir }
487*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwGlossaryDlg, NameDoubleClick, SvTreeListBox*, EMPTYARG )
488*cdf0e10cSrcweir /*--------------------------------------------------------------------
489*cdf0e10cSrcweir      Beschreibung:
490*cdf0e10cSrcweir  --------------------------------------------------------------------*/
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, EnableHdl, Menu *, pMn )
494*cdf0e10cSrcweir {
495*cdf0e10cSrcweir     const String aEditText(aNameED.GetText());
496*cdf0e10cSrcweir     const sal_Bool bHasEntry = aEditText.Len() && aShortNameEdit.GetText().Len();
497*cdf0e10cSrcweir     const sal_Bool bExists = 0 != DoesBlockExist(aEditText, aShortNameEdit.GetText());
498*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_DEFINE, bSelection && bHasEntry && !bExists);
499*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_DEFINE_TEXT, bSelection && bHasEntry && !bExists);
500*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_COPY_TO_CLIPBOARD, bExists);
501*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_REPLACE, bSelection && bExists && !bIsOld );
502*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_REPLACE_TEXT, bSelection && bExists && !bIsOld );
503*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_EDIT, bExists );
504*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_RENAME, bExists  );
505*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_DELETE, bExists  );
506*cdf0e10cSrcweir     pMn->EnableItem(FN_GL_MACRO, bExists && !bIsOld  &&
507*cdf0e10cSrcweir                                     !pGlossaryHdl->IsReadOnly() );
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir     SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
510*cdf0e10cSrcweir     sal_Bool bEnable = sal_False;
511*cdf0e10cSrcweir     if ( pEntry )
512*cdf0e10cSrcweir         bEnable = !aCategoryBox.GetParent( pEntry ) && !bIsOld && !pGlossaryHdl->IsReadOnly();
513*cdf0e10cSrcweir     pMn->EnableItem( FN_GL_IMPORT, bEnable );
514*cdf0e10cSrcweir     return 1;
515*cdf0e10cSrcweir }
516*cdf0e10cSrcweir /*--------------------------------------------------------------------
517*cdf0e10cSrcweir      Beschreibung:
518*cdf0e10cSrcweir  --------------------------------------------------------------------*/
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
522*cdf0e10cSrcweir {
523*cdf0e10cSrcweir     sal_Bool bNoAttr = sal_False;
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir     switch(pMn->GetCurItemId())
526*cdf0e10cSrcweir     {
527*cdf0e10cSrcweir         case FN_GL_REPLACE:
528*cdf0e10cSrcweir         case FN_GL_REPLACE_TEXT:
529*cdf0e10cSrcweir             pGlossaryHdl->NewGlossary(  aNameED.GetText(),
530*cdf0e10cSrcweir                                         aShortNameEdit.GetText(),
531*cdf0e10cSrcweir                                         sal_False,
532*cdf0e10cSrcweir                                         pMn->GetCurItemId() == FN_GL_REPLACE_TEXT);
533*cdf0e10cSrcweir         break;
534*cdf0e10cSrcweir         case FN_GL_DEFINE_TEXT:
535*cdf0e10cSrcweir             bNoAttr = sal_True;
536*cdf0e10cSrcweir             // Kein break!!!
537*cdf0e10cSrcweir         case FN_GL_DEFINE:
538*cdf0e10cSrcweir         {
539*cdf0e10cSrcweir             const String aStr(aNameED.GetText());
540*cdf0e10cSrcweir             const String aShortName(aShortNameEdit.GetText());
541*cdf0e10cSrcweir             if(pGlossaryHdl->HasShortName(aShortName))
542*cdf0e10cSrcweir             {
543*cdf0e10cSrcweir                 InfoBox(this, SW_RES(MSG_DOUBLE_SHORTNAME)).Execute();
544*cdf0e10cSrcweir                 aShortNameEdit.SetSelection(Selection(0, SELECTION_MAX));
545*cdf0e10cSrcweir                 aShortNameEdit.GrabFocus();
546*cdf0e10cSrcweir                 break;
547*cdf0e10cSrcweir             }
548*cdf0e10cSrcweir             if(pGlossaryHdl->NewGlossary(aStr, aShortName, sal_False, bNoAttr ))
549*cdf0e10cSrcweir             {
550*cdf0e10cSrcweir                 SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
551*cdf0e10cSrcweir                 if(aCategoryBox.GetParent(pEntry))
552*cdf0e10cSrcweir                     pEntry = aCategoryBox.GetParent(pEntry);
553*cdf0e10cSrcweir 
554*cdf0e10cSrcweir                 SvLBoxEntry* pChild = aCategoryBox.InsertEntry(aStr, pEntry);
555*cdf0e10cSrcweir                 pChild->SetUserData(new String(aShortName));
556*cdf0e10cSrcweir                 aNameED.SetText(aStr);
557*cdf0e10cSrcweir                 aShortNameEdit.SetText(aShortName);
558*cdf0e10cSrcweir                 NameModify(&aNameED);       // fuer Schalten der Buttons
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir                 if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
561*cdf0e10cSrcweir                 {
562*cdf0e10cSrcweir                     SfxRequest aReq(pSh->GetView().GetViewFrame(), FN_NEW_GLOSSARY);
563*cdf0e10cSrcweir                     String sTemp(*::GetCurrGlosGroup());
564*cdf0e10cSrcweir                     // der nullte Pfad wird nicht aufgezeichnet!
565*cdf0e10cSrcweir                     if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0))
566*cdf0e10cSrcweir                         sTemp = sTemp.GetToken(0, GLOS_DELIM);
567*cdf0e10cSrcweir                     aReq.AppendItem(SfxStringItem(FN_NEW_GLOSSARY, sTemp));
568*cdf0e10cSrcweir                     aReq.AppendItem(SfxStringItem(FN_PARAM_1, aShortName));
569*cdf0e10cSrcweir                     aReq.AppendItem(SfxStringItem(FN_PARAM_2, aStr));
570*cdf0e10cSrcweir                     aReq.Done();
571*cdf0e10cSrcweir                 }
572*cdf0e10cSrcweir             }
573*cdf0e10cSrcweir         }
574*cdf0e10cSrcweir         break;
575*cdf0e10cSrcweir         case FN_GL_COPY_TO_CLIPBOARD :
576*cdf0e10cSrcweir         {
577*cdf0e10cSrcweir             pGlossaryHdl->CopyToClipboard(*pSh, aShortNameEdit.GetText());
578*cdf0e10cSrcweir         }
579*cdf0e10cSrcweir         break;
580*cdf0e10cSrcweir         case FN_GL_EDIT:
581*cdf0e10cSrcweir         break;
582*cdf0e10cSrcweir         case FN_GL_RENAME:
583*cdf0e10cSrcweir         {
584*cdf0e10cSrcweir             aShortNameEdit.SetText(pGlossaryHdl->GetGlossaryShortName(aNameED.GetText()));
585*cdf0e10cSrcweir             SwNewGlosNameDlg* pNewNameDlg = new SwNewGlosNameDlg(this, aNameED.GetText(),
586*cdf0e10cSrcweir                                             aShortNameEdit.GetText() );
587*cdf0e10cSrcweir             if( RET_OK == pNewNameDlg->Execute() &&
588*cdf0e10cSrcweir                 pGlossaryHdl->Rename( aShortNameEdit.GetText(),
589*cdf0e10cSrcweir                                         pNewNameDlg->GetNewShort(),
590*cdf0e10cSrcweir                                         pNewNameDlg->GetNewName()))
591*cdf0e10cSrcweir             {
592*cdf0e10cSrcweir                 SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
593*cdf0e10cSrcweir                 SvLBoxEntry* pNewEntry = aCategoryBox.InsertEntry(
594*cdf0e10cSrcweir                         pNewNameDlg->GetNewName(), aCategoryBox.GetParent(pEntry));
595*cdf0e10cSrcweir                 pNewEntry->SetUserData(new String(pNewNameDlg->GetNewShort()));
596*cdf0e10cSrcweir                 delete (String*)pEntry->GetUserData();
597*cdf0e10cSrcweir                 aCategoryBox.GetModel()->Remove(pEntry);
598*cdf0e10cSrcweir                 aCategoryBox.Select(pNewEntry);
599*cdf0e10cSrcweir                 aCategoryBox.MakeVisible(pNewEntry);
600*cdf0e10cSrcweir             }
601*cdf0e10cSrcweir             GrpSelect( &aCategoryBox );
602*cdf0e10cSrcweir             delete pNewNameDlg;
603*cdf0e10cSrcweir         }
604*cdf0e10cSrcweir         break;
605*cdf0e10cSrcweir         case FN_GL_DELETE:
606*cdf0e10cSrcweir         {
607*cdf0e10cSrcweir             QueryBox aQuery(this, SW_RES(MSG_QUERY_DELETE));
608*cdf0e10cSrcweir             if(RET_YES == aQuery.Execute())
609*cdf0e10cSrcweir             {
610*cdf0e10cSrcweir                 const String aShortName(aShortNameEdit.GetText());
611*cdf0e10cSrcweir                 const String aTitle(aNameED.GetText());
612*cdf0e10cSrcweir                 if(aTitle.Len() && pGlossaryHdl->DelGlossary(aShortName))
613*cdf0e10cSrcweir                 {
614*cdf0e10cSrcweir                     SvLBoxEntry* pChild = DoesBlockExist(aTitle, aShortName);
615*cdf0e10cSrcweir                     DBG_ASSERT(pChild, "Eintrag nicht gefunden!");
616*cdf0e10cSrcweir                     SvLBoxEntry* pParent = aCategoryBox.GetParent(pChild);
617*cdf0e10cSrcweir                     aCategoryBox.Select(pParent);
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir                     aCategoryBox.GetModel()->Remove(pChild);
620*cdf0e10cSrcweir                     aNameED.SetText( aEmptyStr );
621*cdf0e10cSrcweir                     NameModify(&aNameED);
622*cdf0e10cSrcweir                 }
623*cdf0e10cSrcweir             }
624*cdf0e10cSrcweir         }
625*cdf0e10cSrcweir         break;
626*cdf0e10cSrcweir         case FN_GL_MACRO:
627*cdf0e10cSrcweir         {
628*cdf0e10cSrcweir             SfxItemSet aSet( pSh->GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
629*cdf0e10cSrcweir 
630*cdf0e10cSrcweir             SvxMacro aStart(aEmptyStr, aEmptyStr, STARBASIC);
631*cdf0e10cSrcweir             SvxMacro aEnd(aEmptyStr, aEmptyStr, STARBASIC);
632*cdf0e10cSrcweir             pGlossaryHdl->GetMacros(aShortNameEdit.GetText(), aStart, aEnd );
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir             SvxMacroItem aItem(RES_FRMMACRO);
635*cdf0e10cSrcweir             if( aStart.GetMacName().Len() )
636*cdf0e10cSrcweir                 aItem.SetMacro( SW_EVENT_START_INS_GLOSSARY, aStart );
637*cdf0e10cSrcweir             if( aEnd.GetMacName().Len() )
638*cdf0e10cSrcweir                 aItem.SetMacro( SW_EVENT_END_INS_GLOSSARY, aEnd );
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir             aSet.Put( aItem );
641*cdf0e10cSrcweir             aSet.Put( SwMacroAssignDlg::AddEvents( MACASSGN_TEXTBAUST ) );
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir             const SfxPoolItem* pItem;
644*cdf0e10cSrcweir             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
645*cdf0e10cSrcweir             SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet,
646*cdf0e10cSrcweir                 pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(), SID_EVENTCONFIG );
647*cdf0e10cSrcweir             if ( pMacroDlg && pMacroDlg->Execute() == RET_OK &&
648*cdf0e10cSrcweir                 SFX_ITEM_SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, sal_False, &pItem ) )
649*cdf0e10cSrcweir             {
650*cdf0e10cSrcweir                 const SvxMacroTableDtor& rTbl = ((SvxMacroItem*)pItem)->GetMacroTable();
651*cdf0e10cSrcweir                 pGlossaryHdl->SetMacros( aShortNameEdit.GetText(),
652*cdf0e10cSrcweir                                             rTbl.Get( SW_EVENT_START_INS_GLOSSARY ),
653*cdf0e10cSrcweir                                             rTbl.Get( SW_EVENT_END_INS_GLOSSARY ) );
654*cdf0e10cSrcweir             }
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir             delete pMacroDlg;
657*cdf0e10cSrcweir         }
658*cdf0e10cSrcweir         break;
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir         case FN_GL_IMPORT:
661*cdf0e10cSrcweir         {
662*cdf0e10cSrcweir             // call the FileOpenDialog do find WinWord - Files with templates
663*cdf0e10cSrcweir             FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
664*cdf0e10cSrcweir             uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir             SvtPathOptions aPathOpt;
667*cdf0e10cSrcweir             xFP->setDisplayDirectory(aPathOpt.GetWorkPath() );
668*cdf0e10cSrcweir             String sWW8( C2S( FILTER_WW8 ) );
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir             uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
671*cdf0e10cSrcweir             SfxFilterMatcher aMatcher( String::CreateFromAscii(SwDocShell::Factory().GetShortName()) );
672*cdf0e10cSrcweir             SfxFilterMatcherIter aIter( &aMatcher );
673*cdf0e10cSrcweir             const SfxFilter* pFilter = aIter.First();
674*cdf0e10cSrcweir             while ( pFilter )
675*cdf0e10cSrcweir             {
676*cdf0e10cSrcweir                 if( pFilter->GetUserData() == sWW8 )
677*cdf0e10cSrcweir                 {
678*cdf0e10cSrcweir                     xFltMgr->appendFilter( pFilter->GetUIName(),
679*cdf0e10cSrcweir                                 ((WildCard&)pFilter->GetWildcard()).GetWildCard() );
680*cdf0e10cSrcweir                     xFltMgr->setCurrentFilter( pFilter->GetUIName() ) ;
681*cdf0e10cSrcweir                 }
682*cdf0e10cSrcweir 
683*cdf0e10cSrcweir                 pFilter = aIter.Next();
684*cdf0e10cSrcweir             }
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir             if( aDlgHelper.Execute() == ERRCODE_NONE )
687*cdf0e10cSrcweir             {
688*cdf0e10cSrcweir                 if( pGlossaryHdl->ImportGlossaries( xFP->getFiles().getConstArray()[0] ))
689*cdf0e10cSrcweir                     Init();
690*cdf0e10cSrcweir                 else
691*cdf0e10cSrcweir                 {
692*cdf0e10cSrcweir                     InfoBox(this, SW_RES( MSG_NO_GLOSSARIES )).Execute();
693*cdf0e10cSrcweir                 }
694*cdf0e10cSrcweir             }
695*cdf0e10cSrcweir         }
696*cdf0e10cSrcweir         break;
697*cdf0e10cSrcweir 
698*cdf0e10cSrcweir         default:
699*cdf0e10cSrcweir             return 0;
700*cdf0e10cSrcweir     }
701*cdf0e10cSrcweir     return 1;
702*cdf0e10cSrcweir }
703*cdf0e10cSrcweir /*--------------------------------------------------------------------
704*cdf0e10cSrcweir      Beschreibung:  Dialog Verwaltung Bereiche
705*cdf0e10cSrcweir  --------------------------------------------------------------------*/
706*cdf0e10cSrcweir 
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, BibHdl, Button *, EMPTYARG )
709*cdf0e10cSrcweir {
710*cdf0e10cSrcweir     SwGlossaries* pGloss = ::GetGlossaries();
711*cdf0e10cSrcweir     if( pGloss->IsGlosPathErr() )
712*cdf0e10cSrcweir         pGloss->ShowError();
713*cdf0e10cSrcweir     else
714*cdf0e10cSrcweir     {
715*cdf0e10cSrcweir         //check if at least one glossary path is write enabled
716*cdf0e10cSrcweir         SvtPathOptions aPathOpt;
717*cdf0e10cSrcweir         String sGlosPath( aPathOpt.GetAutoTextPath() );
718*cdf0e10cSrcweir         sal_uInt16 nPaths = sGlosPath.GetTokenCount(';');
719*cdf0e10cSrcweir         sal_Bool bIsWritable = sal_False;
720*cdf0e10cSrcweir         for(sal_uInt16 nPath = 0; nPath < nPaths; nPath++)
721*cdf0e10cSrcweir         {
722*cdf0e10cSrcweir             String sPath = URIHelper::SmartRel2Abs(
723*cdf0e10cSrcweir                 INetURLObject(), sGlosPath.GetToken(nPath, ';'),
724*cdf0e10cSrcweir                 URIHelper::GetMaybeFileHdl());
725*cdf0e10cSrcweir             try
726*cdf0e10cSrcweir             {
727*cdf0e10cSrcweir                 Content aTestContent( sPath,
728*cdf0e10cSrcweir                             uno::Reference< XCommandEnvironment >());
729*cdf0e10cSrcweir                 Any aAny = aTestContent.getPropertyValue( C2U("IsReadOnly") );
730*cdf0e10cSrcweir                 if(aAny.hasValue())
731*cdf0e10cSrcweir                 {
732*cdf0e10cSrcweir                     bIsWritable = !*(sal_Bool*)aAny.getValue();
733*cdf0e10cSrcweir                 }
734*cdf0e10cSrcweir             }
735*cdf0e10cSrcweir             catch(Exception&)
736*cdf0e10cSrcweir             {}
737*cdf0e10cSrcweir             if(bIsWritable)
738*cdf0e10cSrcweir                 break;
739*cdf0e10cSrcweir         }
740*cdf0e10cSrcweir         if(bIsWritable)
741*cdf0e10cSrcweir         {
742*cdf0e10cSrcweir 
743*cdf0e10cSrcweir             SwGlossaryGroupDlg *pDlg = new SwGlossaryGroupDlg( this, pGloss->GetPathArray(), pGlossaryHdl );
744*cdf0e10cSrcweir             if ( RET_OK == pDlg->Execute() )
745*cdf0e10cSrcweir             {
746*cdf0e10cSrcweir                 Init();
747*cdf0e10cSrcweir                 //if new groups were created - select one of them
748*cdf0e10cSrcweir                 String sNewGroup = pDlg->GetCreatedGroupName();
749*cdf0e10cSrcweir                 SvLBoxEntry* pEntry = aCategoryBox.First();
750*cdf0e10cSrcweir                 while(sNewGroup.Len() && pEntry)
751*cdf0e10cSrcweir                 {
752*cdf0e10cSrcweir                     if(!aCategoryBox.GetParent(pEntry))
753*cdf0e10cSrcweir                     {
754*cdf0e10cSrcweir                         GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData();
755*cdf0e10cSrcweir                         String sGroup = pGroupData->sGroupName;
756*cdf0e10cSrcweir                         sGroup += GLOS_DELIM;
757*cdf0e10cSrcweir                         sGroup += String::CreateFromInt32(pGroupData->nPathIdx);
758*cdf0e10cSrcweir                         if(sGroup == sNewGroup)
759*cdf0e10cSrcweir                         {
760*cdf0e10cSrcweir                             aCategoryBox.Select(pEntry);
761*cdf0e10cSrcweir                             aCategoryBox.MakeVisible(pEntry);
762*cdf0e10cSrcweir                             GrpSelect(&aCategoryBox);
763*cdf0e10cSrcweir                             break;
764*cdf0e10cSrcweir                         }
765*cdf0e10cSrcweir                     }
766*cdf0e10cSrcweir                     pEntry = aCategoryBox.Next(pEntry);
767*cdf0e10cSrcweir                 }
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir             }
770*cdf0e10cSrcweir             delete pDlg;
771*cdf0e10cSrcweir         }
772*cdf0e10cSrcweir         else
773*cdf0e10cSrcweir         {
774*cdf0e10cSrcweir             QueryBox aBox(this, WB_YES_NO, sReadonlyPath);
775*cdf0e10cSrcweir             if(RET_YES == aBox.Execute())
776*cdf0e10cSrcweir                 PathHdl(&aPathBtn);
777*cdf0e10cSrcweir         }
778*cdf0e10cSrcweir     }
779*cdf0e10cSrcweir     return 0;
780*cdf0e10cSrcweir }
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir /*------------------------------------------------------------------------
783*cdf0e10cSrcweir  Beschreibung:  Initialisierung; aus Ctor und nach Bearbeiten Bereiche
784*cdf0e10cSrcweir ------------------------------------------------------------------------*/
785*cdf0e10cSrcweir 
786*cdf0e10cSrcweir 
787*cdf0e10cSrcweir void SwGlossaryDlg::Init()
788*cdf0e10cSrcweir {
789*cdf0e10cSrcweir     aCategoryBox.SetUpdateMode( sal_False );
790*cdf0e10cSrcweir     aCategoryBox.Clear();
791*cdf0e10cSrcweir     // Textbausteinbereiche anzeigen
792*cdf0e10cSrcweir     const sal_uInt16 nCnt = pGlossaryHdl->GetGroupCnt();
793*cdf0e10cSrcweir     SvLBoxEntry* pSelEntry = 0;
794*cdf0e10cSrcweir     const String sSelStr(::GetCurrGlosGroup()->GetToken(0, GLOS_DELIM));
795*cdf0e10cSrcweir     const sal_uInt16 nSelPath = static_cast< sal_uInt16 >(::GetCurrGlosGroup()->GetToken(1, GLOS_DELIM).ToInt32());
796*cdf0e10cSrcweir     for(sal_uInt16 nId = 0; nId < nCnt; ++nId )
797*cdf0e10cSrcweir     {
798*cdf0e10cSrcweir         String sTitle;
799*cdf0e10cSrcweir         String sGroupName(pGlossaryHdl->GetGroupName(nId, &sTitle));
800*cdf0e10cSrcweir         if(!sGroupName.Len())
801*cdf0e10cSrcweir             continue;
802*cdf0e10cSrcweir         if(!sTitle.Len())
803*cdf0e10cSrcweir             sTitle = sGroupName.GetToken( 0, GLOS_DELIM );
804*cdf0e10cSrcweir         SvLBoxEntry* pEntry = aCategoryBox.InsertEntry( sTitle );
805*cdf0e10cSrcweir         sal_uInt16 nPath = static_cast< sal_uInt16 >(sGroupName.GetToken( 1, GLOS_DELIM ).ToInt32());
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir         GroupUserData* pData = new GroupUserData;
808*cdf0e10cSrcweir         pData->sGroupName = sGroupName.GetToken(0, GLOS_DELIM);
809*cdf0e10cSrcweir         pData->nPathIdx = nPath;
810*cdf0e10cSrcweir         pData->bReadonly = pGlossaryHdl->IsReadOnly(&sGroupName);
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir         pEntry->SetUserData(pData);
813*cdf0e10cSrcweir         if(sSelStr == pData->sGroupName && nSelPath == nPath)
814*cdf0e10cSrcweir             pSelEntry = pEntry;
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir         //Eintraege fuer die Gruppen auffuellen
817*cdf0e10cSrcweir         {
818*cdf0e10cSrcweir             pGlossaryHdl->SetCurGroup(sGroupName, sal_False, sal_True);
819*cdf0e10cSrcweir             const sal_uInt16 nCount = pGlossaryHdl->GetGlossaryCnt();
820*cdf0e10cSrcweir             for(sal_uInt16 i = 0; i < nCount; ++i)
821*cdf0e10cSrcweir             {
822*cdf0e10cSrcweir                 String sGroupTitle(pGlossaryHdl->GetGlossaryName(i));
823*cdf0e10cSrcweir                 SvLBoxEntry* pChild = aCategoryBox.InsertEntry(
824*cdf0e10cSrcweir                                     sGroupTitle, pEntry);
825*cdf0e10cSrcweir                 pChild->SetUserData(new String(pGlossaryHdl->GetGlossaryShortName(i)));
826*cdf0e10cSrcweir             }
827*cdf0e10cSrcweir         }
828*cdf0e10cSrcweir     }
829*cdf0e10cSrcweir         // Aktuelle Gruppe setzen und Textbausteine anzeigen
830*cdf0e10cSrcweir     if(!pSelEntry)
831*cdf0e10cSrcweir     {
832*cdf0e10cSrcweir         //find a non-readonly group
833*cdf0e10cSrcweir         SvLBoxEntry* pSearch = aCategoryBox.First();
834*cdf0e10cSrcweir         while(pSearch)
835*cdf0e10cSrcweir         {
836*cdf0e10cSrcweir             if(!aCategoryBox.GetParent(pSearch))
837*cdf0e10cSrcweir             {
838*cdf0e10cSrcweir                 GroupUserData* pData = (GroupUserData*)pSearch->GetUserData();
839*cdf0e10cSrcweir                 if(!pData->bReadonly)
840*cdf0e10cSrcweir                 {
841*cdf0e10cSrcweir                     pSelEntry = pSearch;
842*cdf0e10cSrcweir                     break;
843*cdf0e10cSrcweir                 }
844*cdf0e10cSrcweir             }
845*cdf0e10cSrcweir             pSearch = aCategoryBox.Next(pSearch);
846*cdf0e10cSrcweir         }
847*cdf0e10cSrcweir         if(!pSelEntry)
848*cdf0e10cSrcweir             pSelEntry = aCategoryBox.GetEntry(0);
849*cdf0e10cSrcweir     }
850*cdf0e10cSrcweir     if(pSelEntry)
851*cdf0e10cSrcweir     {
852*cdf0e10cSrcweir         aCategoryBox.Expand(pSelEntry);
853*cdf0e10cSrcweir         aCategoryBox.Select(pSelEntry);
854*cdf0e10cSrcweir         aCategoryBox.MakeVisible(pSelEntry);
855*cdf0e10cSrcweir         GrpSelect(&aCategoryBox);
856*cdf0e10cSrcweir     }
857*cdf0e10cSrcweir     //JP 16.11.99: the SvxTreeListBox has a Bug. The Box dont recalc the
858*cdf0e10cSrcweir     //      outputsize, when all entries are insertet. The result is, that
859*cdf0e10cSrcweir     //      the Focus/Highlight rectangle is to large and paintet over the
860*cdf0e10cSrcweir     //      HScrollbar. -> Fix: call the resize
861*cdf0e10cSrcweir     aCategoryBox.Resize();
862*cdf0e10cSrcweir 
863*cdf0e10cSrcweir     aCategoryBox.GetModel()->Resort();
864*cdf0e10cSrcweir     aCategoryBox.SetUpdateMode( sal_True );
865*cdf0e10cSrcweir     aCategoryBox.Update();
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir     const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
868*cdf0e10cSrcweir     aFileRelCB.Check( pCfg->IsSaveRelFile() );
869*cdf0e10cSrcweir     aFileRelCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl));
870*cdf0e10cSrcweir     aNetRelCB.Check( pCfg->IsSaveRelNet() );
871*cdf0e10cSrcweir     aNetRelCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl));
872*cdf0e10cSrcweir     aInsertTipCB.Check( pCfg->IsAutoTextTip() );
873*cdf0e10cSrcweir     aInsertTipCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl));
874*cdf0e10cSrcweir }
875*cdf0e10cSrcweir /*------------------------------------------------------------------------
876*cdf0e10cSrcweir  Beschreibung:
877*cdf0e10cSrcweir ------------------------------------------------------------------------*/
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwGlossaryDlg, EditHdl, Button *, EMPTYARG )
881*cdf0e10cSrcweir {
882*cdf0e10cSrcweir //EndDialog darf nicht im MenuHdl aufgerufen werden
883*cdf0e10cSrcweir     if(aEditBtn.GetCurItemId() == FN_GL_EDIT )
884*cdf0e10cSrcweir     {
885*cdf0e10cSrcweir         SwTextBlocks *pGroup = ::GetGlossaries()->GetGroupDoc (  GetCurrGrpName () );
886*cdf0e10cSrcweir         sal_Bool bRet = pGlossaryHdl->ConvertToNew ( *pGroup );
887*cdf0e10cSrcweir         delete pGroup;
888*cdf0e10cSrcweir         if ( bRet )
889*cdf0e10cSrcweir             EndDialog(RET_EDIT);
890*cdf0e10cSrcweir     }
891*cdf0e10cSrcweir     return 0;
892*cdf0e10cSrcweir }
893*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwGlossaryDlg, EditHdl, Button *, EMPTYARG )
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir /*------------------------------------------------------------------------
896*cdf0e10cSrcweir  Beschreibung:  KeyInput fuer ShortName - Edits ohne Spaces
897*cdf0e10cSrcweir ------------------------------------------------------------------------*/
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir IMPL_LINK( SwNewGlosNameDlg, Modify, Edit *, pBox )
900*cdf0e10cSrcweir {
901*cdf0e10cSrcweir     String aName(aNewName.GetText());
902*cdf0e10cSrcweir     SwGlossaryDlg* pDlg = (SwGlossaryDlg*)GetParent();
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir     if( pBox == &aNewName )
905*cdf0e10cSrcweir         aNewShort.SetText( lcl_GetValidShortCut( aName ) );
906*cdf0e10cSrcweir 
907*cdf0e10cSrcweir     sal_Bool bEnable = aName.Len() && aNewShort.GetText().Len() &&
908*cdf0e10cSrcweir         (!pDlg->DoesBlockExist(aName, aNewShort.GetText())
909*cdf0e10cSrcweir             || aName == aOldName.GetText());
910*cdf0e10cSrcweir     aOk.Enable(bEnable);
911*cdf0e10cSrcweir     return 0;
912*cdf0e10cSrcweir }
913*cdf0e10cSrcweir /*------------------------------------------------------------------------
914*cdf0e10cSrcweir  Beschreibung:
915*cdf0e10cSrcweir ------------------------------------------------------------------------*/
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir IMPL_LINK( SwNewGlosNameDlg, Rename, Button *, EMPTYARG )
918*cdf0e10cSrcweir {
919*cdf0e10cSrcweir     SwGlossaryDlg* pDlg = (SwGlossaryDlg*)GetParent();
920*cdf0e10cSrcweir     String sNew = aNewShort.GetText();
921*cdf0e10cSrcweir     GetAppCharClass().toUpper(sNew);
922*cdf0e10cSrcweir     if( pDlg->pGlossaryHdl->HasShortName(aNewShort.GetText())
923*cdf0e10cSrcweir         && sNew != aOldShort.GetText() )
924*cdf0e10cSrcweir     {
925*cdf0e10cSrcweir         InfoBox(this, SW_RES(MSG_DOUBLE_SHORTNAME)).Execute();
926*cdf0e10cSrcweir         aNewShort.GrabFocus();
927*cdf0e10cSrcweir     }
928*cdf0e10cSrcweir     else
929*cdf0e10cSrcweir         EndDialog(sal_True);
930*cdf0e10cSrcweir     return 0;
931*cdf0e10cSrcweir }
932*cdf0e10cSrcweir 
933*cdf0e10cSrcweir /*------------------------------------------------------------------------
934*cdf0e10cSrcweir  Beschreibung:
935*cdf0e10cSrcweir ------------------------------------------------------------------------*/
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, CheckBoxHdl, CheckBox *, pBox )
938*cdf0e10cSrcweir {
939*cdf0e10cSrcweir     SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
940*cdf0e10cSrcweir     sal_Bool bCheck = pBox->IsChecked();
941*cdf0e10cSrcweir     if( pBox == &aInsertTipCB )
942*cdf0e10cSrcweir         pCfg->SetAutoTextTip(bCheck);
943*cdf0e10cSrcweir     else if(pBox == &aFileRelCB)
944*cdf0e10cSrcweir         pCfg->SetSaveRelFile(bCheck);
945*cdf0e10cSrcweir     else
946*cdf0e10cSrcweir         pCfg->SetSaveRelNet(bCheck);
947*cdf0e10cSrcweir     return 0;
948*cdf0e10cSrcweir }
949*cdf0e10cSrcweir 
950*cdf0e10cSrcweir /* -----------------26.11.98 15:18-------------------
951*cdf0e10cSrcweir  * TreeListBox fuer Gruppen und Bausteine
952*cdf0e10cSrcweir  * --------------------------------------------------*/
953*cdf0e10cSrcweir SwGlTreeListBox::SwGlTreeListBox(Window* pParent, const ResId& rResId) :
954*cdf0e10cSrcweir     SvTreeListBox(pParent, rResId),
955*cdf0e10cSrcweir     sReadonly     (SW_RES(ST_READONLY)),
956*cdf0e10cSrcweir     pDragEntry(0)
957*cdf0e10cSrcweir {
958*cdf0e10cSrcweir     FreeResource();
959*cdf0e10cSrcweir     SetDragDropMode( SV_DRAGDROP_CTRL_MOVE|SV_DRAGDROP_CTRL_COPY );
960*cdf0e10cSrcweir }
961*cdf0e10cSrcweir /* -----------------30.11.98 10:49-------------------
962*cdf0e10cSrcweir  *
963*cdf0e10cSrcweir  * --------------------------------------------------*/
964*cdf0e10cSrcweir void SwGlTreeListBox::Clear()
965*cdf0e10cSrcweir {
966*cdf0e10cSrcweir     SvLBoxEntry* pEntry = First();
967*cdf0e10cSrcweir     while(pEntry)
968*cdf0e10cSrcweir     {
969*cdf0e10cSrcweir         if(GetParent(pEntry))
970*cdf0e10cSrcweir             delete (String*)pEntry->GetUserData();
971*cdf0e10cSrcweir         else
972*cdf0e10cSrcweir             delete (GroupUserData*)pEntry->GetUserData();
973*cdf0e10cSrcweir         pEntry = Next(pEntry);
974*cdf0e10cSrcweir     }
975*cdf0e10cSrcweir     SvTreeListBox::Clear();
976*cdf0e10cSrcweir }
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir /*-----------------10.06.97 14.52-------------------
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir --------------------------------------------------*/
981*cdf0e10cSrcweir void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt )
982*cdf0e10cSrcweir {
983*cdf0e10cSrcweir     Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
984*cdf0e10cSrcweir     SvLBoxEntry* pEntry = GetEntry( aPos );
985*cdf0e10cSrcweir     // Hilfe gibt es nur fuer die Gruppennamen
986*cdf0e10cSrcweir     if(pEntry)
987*cdf0e10cSrcweir     {
988*cdf0e10cSrcweir         SvLBoxTab* pTab;
989*cdf0e10cSrcweir         SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
990*cdf0e10cSrcweir         if(pItem)
991*cdf0e10cSrcweir         {
992*cdf0e10cSrcweir             aPos = GetEntryPosition( pEntry );
993*cdf0e10cSrcweir             Size aSize(pItem->GetSize( this, pEntry ));
994*cdf0e10cSrcweir             aPos.X() = GetTabPos( pEntry, pTab );
995*cdf0e10cSrcweir 
996*cdf0e10cSrcweir             if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
997*cdf0e10cSrcweir                 aSize.Width() = GetSizePixel().Width() - aPos.X();
998*cdf0e10cSrcweir             aPos = OutputToScreenPixel(aPos);
999*cdf0e10cSrcweir             Rectangle aItemRect( aPos, aSize );
1000*cdf0e10cSrcweir             String sMsg;
1001*cdf0e10cSrcweir             if(!GetParent(pEntry))
1002*cdf0e10cSrcweir             {
1003*cdf0e10cSrcweir                 GroupUserData* pData = (GroupUserData*)pEntry->GetUserData();
1004*cdf0e10cSrcweir                 const SvStrings* pPathArr = ::GetGlossaries()->GetPathArray();
1005*cdf0e10cSrcweir                 if(pPathArr->Count())
1006*cdf0e10cSrcweir                 {
1007*cdf0e10cSrcweir                     sMsg = (*(*pPathArr)[pData->nPathIdx]);
1008*cdf0e10cSrcweir                     sMsg += INET_PATH_TOKEN;
1009*cdf0e10cSrcweir                     sMsg += pData->sGroupName;
1010*cdf0e10cSrcweir                     sMsg += SwGlossaries::GetExtension();
1011*cdf0e10cSrcweir                     INetURLObject aTmp(sMsg);
1012*cdf0e10cSrcweir                     sMsg = aTmp.GetPath();
1013*cdf0e10cSrcweir 
1014*cdf0e10cSrcweir                     if(pData->bReadonly)
1015*cdf0e10cSrcweir                     {
1016*cdf0e10cSrcweir                         sMsg += ' ';
1017*cdf0e10cSrcweir                         sMsg += '(';
1018*cdf0e10cSrcweir                         sMsg += sReadonly;
1019*cdf0e10cSrcweir                         sMsg += ')';
1020*cdf0e10cSrcweir                     }
1021*cdf0e10cSrcweir 
1022*cdf0e10cSrcweir 
1023*cdf0e10cSrcweir                 }
1024*cdf0e10cSrcweir             }
1025*cdf0e10cSrcweir             else
1026*cdf0e10cSrcweir                 sMsg = *(String*)pEntry->GetUserData();
1027*cdf0e10cSrcweir             Help::ShowQuickHelp( this, aItemRect, sMsg,
1028*cdf0e10cSrcweir                         QUICKHELP_LEFT|QUICKHELP_VCENTER );
1029*cdf0e10cSrcweir         }
1030*cdf0e10cSrcweir     }
1031*cdf0e10cSrcweir }
1032*cdf0e10cSrcweir /* -----------------26.11.98 14:42-------------------
1033*cdf0e10cSrcweir  *
1034*cdf0e10cSrcweir  * --------------------------------------------------*/
1035*cdf0e10cSrcweir DragDropMode SwGlTreeListBox::NotifyStartDrag(
1036*cdf0e10cSrcweir                     TransferDataContainer& /*rContainer*/,
1037*cdf0e10cSrcweir                     SvLBoxEntry* pEntry )
1038*cdf0e10cSrcweir {
1039*cdf0e10cSrcweir     DragDropMode  eRet;
1040*cdf0e10cSrcweir     pDragEntry = pEntry;
1041*cdf0e10cSrcweir     if(!GetParent(pEntry))
1042*cdf0e10cSrcweir         eRet = SV_DRAGDROP_NONE;
1043*cdf0e10cSrcweir     else
1044*cdf0e10cSrcweir     {
1045*cdf0e10cSrcweir         SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent();
1046*cdf0e10cSrcweir         SvLBoxEntry* pParent = GetParent(pEntry);
1047*cdf0e10cSrcweir 
1048*cdf0e10cSrcweir         GroupUserData* pGroupData = (GroupUserData*)pParent->GetUserData();
1049*cdf0e10cSrcweir         String sEntry(pGroupData->sGroupName);
1050*cdf0e10cSrcweir         sEntry += GLOS_DELIM;
1051*cdf0e10cSrcweir         sEntry += String::CreateFromInt32(pGroupData->nPathIdx);
1052*cdf0e10cSrcweir         sal_Int8 nDragOption = DND_ACTION_COPY;
1053*cdf0e10cSrcweir         eRet = SV_DRAGDROP_CTRL_COPY;
1054*cdf0e10cSrcweir         if(!pDlg->pGlossaryHdl->IsReadOnly(&sEntry))
1055*cdf0e10cSrcweir         {
1056*cdf0e10cSrcweir             eRet |= SV_DRAGDROP_CTRL_MOVE;
1057*cdf0e10cSrcweir             nDragOption |= DND_ACTION_MOVE;
1058*cdf0e10cSrcweir         }
1059*cdf0e10cSrcweir         SetDragOptions( nDragOption );
1060*cdf0e10cSrcweir     }
1061*cdf0e10cSrcweir     return eRet;
1062*cdf0e10cSrcweir }
1063*cdf0e10cSrcweir /* -----------------27.11.98 09:35-------------------
1064*cdf0e10cSrcweir  *
1065*cdf0e10cSrcweir  * --------------------------------------------------*/
1066*cdf0e10cSrcweir sal_Bool    SwGlTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry)
1067*cdf0e10cSrcweir {
1068*cdf0e10cSrcweir     // TODO: Readonly - Ueberpruefung fehlt noch!
1069*cdf0e10cSrcweir     SvLBoxEntry* pSrcParent = GetParent(pEntry) ? GetParent(pEntry) : pEntry;
1070*cdf0e10cSrcweir     SvLBoxEntry* pDestParent =
1071*cdf0e10cSrcweir         GetParent(pDragEntry ) ? GetParent(pDragEntry ) : pDragEntry ;
1072*cdf0e10cSrcweir     return pDestParent != pSrcParent;
1073*cdf0e10cSrcweir 
1074*cdf0e10cSrcweir }
1075*cdf0e10cSrcweir /* -----------------26.11.98 14:42-------------------
1076*cdf0e10cSrcweir  *
1077*cdf0e10cSrcweir  * --------------------------------------------------*/
1078*cdf0e10cSrcweir sal_Bool  SwGlTreeListBox::NotifyMoving(   SvLBoxEntry*  pTarget,
1079*cdf0e10cSrcweir                                     SvLBoxEntry*  pEntry,
1080*cdf0e10cSrcweir                                     SvLBoxEntry*& /*rpNewParent*/,
1081*cdf0e10cSrcweir                                     sal_uLong&        /*rNewChildPos*/
1082*cdf0e10cSrcweir                                 )
1083*cdf0e10cSrcweir {
1084*cdf0e10cSrcweir     pDragEntry = 0;
1085*cdf0e10cSrcweir     if(!pTarget) //An den Anfang verschieben
1086*cdf0e10cSrcweir     {
1087*cdf0e10cSrcweir         pTarget = GetEntry(0);
1088*cdf0e10cSrcweir     }
1089*cdf0e10cSrcweir     // 1. wird in verschiedene Gruppen verschoben?
1090*cdf0e10cSrcweir     // 2. darf in beiden Gruppen geschrieben werden?
1091*cdf0e10cSrcweir     SvLBoxEntry* pSrcParent = GetParent(pEntry);
1092*cdf0e10cSrcweir     SvLBoxEntry* pDestParent =
1093*cdf0e10cSrcweir         GetParent(pTarget) ? GetParent(pTarget) : pTarget;
1094*cdf0e10cSrcweir     sal_Bool bRet = sal_False;
1095*cdf0e10cSrcweir     if(pDestParent != pSrcParent)
1096*cdf0e10cSrcweir     {
1097*cdf0e10cSrcweir         SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent();
1098*cdf0e10cSrcweir         SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True );
1099*cdf0e10cSrcweir 
1100*cdf0e10cSrcweir         GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData();
1101*cdf0e10cSrcweir         String sSourceGroup(pGroupData->sGroupName);
1102*cdf0e10cSrcweir         sSourceGroup += GLOS_DELIM;
1103*cdf0e10cSrcweir         sSourceGroup += String::CreateFromInt32(pGroupData->nPathIdx);
1104*cdf0e10cSrcweir         pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup);
1105*cdf0e10cSrcweir         String sTitle(GetEntryText(pEntry));
1106*cdf0e10cSrcweir         String sShortName(*(String*)pEntry->GetUserData());
1107*cdf0e10cSrcweir 
1108*cdf0e10cSrcweir         GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData();
1109*cdf0e10cSrcweir         String sDestName = pDestData->sGroupName;
1110*cdf0e10cSrcweir         sDestName += GLOS_DELIM;
1111*cdf0e10cSrcweir         sDestName += String::CreateFromInt32(pDestData->nPathIdx);
1112*cdf0e10cSrcweir         bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup,  sShortName,
1113*cdf0e10cSrcweir                         sDestName, sTitle, sal_True );
1114*cdf0e10cSrcweir         if(bRet)
1115*cdf0e10cSrcweir         {
1116*cdf0e10cSrcweir             SvLBoxEntry* pChild = InsertEntry(sTitle, pDestParent);
1117*cdf0e10cSrcweir             pChild->SetUserData(new String(sShortName));
1118*cdf0e10cSrcweir             GetModel()->Remove(pEntry);
1119*cdf0e10cSrcweir         }
1120*cdf0e10cSrcweir     }
1121*cdf0e10cSrcweir     return sal_False; //sonst wird der Eintrag automatisch vorgenommen
1122*cdf0e10cSrcweir }
1123*cdf0e10cSrcweir /* -----------------26.11.98 14:42-------------------
1124*cdf0e10cSrcweir  *
1125*cdf0e10cSrcweir  * --------------------------------------------------*/
1126*cdf0e10cSrcweir sal_Bool  SwGlTreeListBox::NotifyCopying(   SvLBoxEntry*  pTarget,
1127*cdf0e10cSrcweir                                     SvLBoxEntry*  pEntry,
1128*cdf0e10cSrcweir                                     SvLBoxEntry*& /*rpNewParent*/,
1129*cdf0e10cSrcweir                                     sal_uLong&        /*rNewChildPos*/
1130*cdf0e10cSrcweir                                 )
1131*cdf0e10cSrcweir {
1132*cdf0e10cSrcweir     pDragEntry = 0;
1133*cdf0e10cSrcweir     // 1. wird in verschiedene Gruppen verschoben?
1134*cdf0e10cSrcweir     // 2. darf in beiden Gruppen geschrieben werden?
1135*cdf0e10cSrcweir     if(!pTarget) //An den Anfang verschieben
1136*cdf0e10cSrcweir     {
1137*cdf0e10cSrcweir         pTarget = GetEntry(0);
1138*cdf0e10cSrcweir     }
1139*cdf0e10cSrcweir     SvLBoxEntry* pSrcParent = GetParent(pEntry);
1140*cdf0e10cSrcweir     SvLBoxEntry* pDestParent =
1141*cdf0e10cSrcweir         GetParent(pTarget) ? GetParent(pTarget) : pTarget;
1142*cdf0e10cSrcweir     sal_Bool bRet = sal_False;
1143*cdf0e10cSrcweir     if(pDestParent != pSrcParent)
1144*cdf0e10cSrcweir     {
1145*cdf0e10cSrcweir         SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent();
1146*cdf0e10cSrcweir         SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True );
1147*cdf0e10cSrcweir 
1148*cdf0e10cSrcweir         GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData();
1149*cdf0e10cSrcweir         String sSourceGroup(pGroupData->sGroupName);
1150*cdf0e10cSrcweir         sSourceGroup += GLOS_DELIM;
1151*cdf0e10cSrcweir         sSourceGroup += String::CreateFromInt32(pGroupData->nPathIdx);
1152*cdf0e10cSrcweir 
1153*cdf0e10cSrcweir         pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup);
1154*cdf0e10cSrcweir         String sTitle(GetEntryText(pEntry));
1155*cdf0e10cSrcweir         String sShortName(*(String*)pEntry->GetUserData());
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir         GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData();
1158*cdf0e10cSrcweir         String sDestName = pDestData->sGroupName;
1159*cdf0e10cSrcweir         sDestName += GLOS_DELIM;
1160*cdf0e10cSrcweir         sDestName += String::CreateFromInt32(pDestData->nPathIdx);
1161*cdf0e10cSrcweir 
1162*cdf0e10cSrcweir         bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup,  sShortName,
1163*cdf0e10cSrcweir                         sDestName, sTitle, sal_False );
1164*cdf0e10cSrcweir         if(bRet)
1165*cdf0e10cSrcweir         {
1166*cdf0e10cSrcweir             SvLBoxEntry* pChild = InsertEntry(sTitle, pDestParent);
1167*cdf0e10cSrcweir             pChild->SetUserData(new String(sShortName));
1168*cdf0e10cSrcweir         }
1169*cdf0e10cSrcweir     }
1170*cdf0e10cSrcweir     return sal_False; //sonst wird der Eintrag automatisch vorgenommen
1171*cdf0e10cSrcweir }
1172*cdf0e10cSrcweir 
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir /*-----------------10.06.97 15.18-------------------
1175*cdf0e10cSrcweir 
1176*cdf0e10cSrcweir --------------------------------------------------*/
1177*cdf0e10cSrcweir String SwGlossaryDlg::GetCurrGrpName() const
1178*cdf0e10cSrcweir {
1179*cdf0e10cSrcweir     SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
1180*cdf0e10cSrcweir     String sRet;
1181*cdf0e10cSrcweir     if(pEntry)
1182*cdf0e10cSrcweir     {
1183*cdf0e10cSrcweir         pEntry =
1184*cdf0e10cSrcweir             aCategoryBox.GetParent(pEntry) ? aCategoryBox.GetParent(pEntry) : pEntry;
1185*cdf0e10cSrcweir         GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData();
1186*cdf0e10cSrcweir         sRet = pGroupData->sGroupName;
1187*cdf0e10cSrcweir         sRet += GLOS_DELIM;
1188*cdf0e10cSrcweir         sRet += String::CreateFromInt32(pGroupData->nPathIdx);
1189*cdf0e10cSrcweir     }
1190*cdf0e10cSrcweir     return sRet;
1191*cdf0e10cSrcweir }
1192*cdf0e10cSrcweir 
1193*cdf0e10cSrcweir /*-----------------11.06.97 08.17-------------------
1194*cdf0e10cSrcweir 
1195*cdf0e10cSrcweir --------------------------------------------------*/
1196*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, PathHdl, Button *, pBtn )
1197*cdf0e10cSrcweir {
1198*cdf0e10cSrcweir     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
1199*cdf0e10cSrcweir     if(pFact)
1200*cdf0e10cSrcweir     {
1201*cdf0e10cSrcweir         AbstractSvxMultiPathDialog* pDlg = pFact->CreateSvxMultiPathDialog( pBtn );
1202*cdf0e10cSrcweir         DBG_ASSERT(pDlg, "Dialogdiet fail!");
1203*cdf0e10cSrcweir         SvtPathOptions aPathOpt;
1204*cdf0e10cSrcweir         String sGlosPath( aPathOpt.GetAutoTextPath() );
1205*cdf0e10cSrcweir         pDlg->SetPath(sGlosPath);
1206*cdf0e10cSrcweir         if(RET_OK == pDlg->Execute())
1207*cdf0e10cSrcweir         {
1208*cdf0e10cSrcweir             String sTmp(pDlg->GetPath());
1209*cdf0e10cSrcweir             if(sTmp != sGlosPath)
1210*cdf0e10cSrcweir             {
1211*cdf0e10cSrcweir                 aPathOpt.SetAutoTextPath( sTmp );
1212*cdf0e10cSrcweir                 ::GetGlossaries()->UpdateGlosPath( sal_True );
1213*cdf0e10cSrcweir                 Init();
1214*cdf0e10cSrcweir             }
1215*cdf0e10cSrcweir         }
1216*cdf0e10cSrcweir         delete pDlg;
1217*cdf0e10cSrcweir     }
1218*cdf0e10cSrcweir     return 0;
1219*cdf0e10cSrcweir }
1220*cdf0e10cSrcweir /* -----------------28.07.99 13:48-------------------
1221*cdf0e10cSrcweir 
1222*cdf0e10cSrcweir  --------------------------------------------------*/
1223*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, ShowPreviewHdl, CheckBox *, pBox )
1224*cdf0e10cSrcweir {
1225*cdf0e10cSrcweir     sal_Bool bCreated = sal_False;
1226*cdf0e10cSrcweir     if(pBox->IsChecked())
1227*cdf0e10cSrcweir     {
1228*cdf0e10cSrcweir         //create example
1229*cdf0e10cSrcweir         if(!pExampleFrame)
1230*cdf0e10cSrcweir         {
1231*cdf0e10cSrcweir             Link aLink(LINK(this, SwGlossaryDlg, PreviewLoadedHdl));
1232*cdf0e10cSrcweir             pExampleFrame = new SwOneExampleFrame( aExampleWIN,
1233*cdf0e10cSrcweir                             EX_SHOW_ONLINE_LAYOUT, &aLink );
1234*cdf0e10cSrcweir             bCreated = sal_True;
1235*cdf0e10cSrcweir         }
1236*cdf0e10cSrcweir     }
1237*cdf0e10cSrcweir 
1238*cdf0e10cSrcweir     sal_Bool bShow = pBox->IsChecked() && !bCreated;
1239*cdf0e10cSrcweir     aExampleWIN.Show( bShow );
1240*cdf0e10cSrcweir     aExampleDummyWIN.Show(!bShow);
1241*cdf0e10cSrcweir     if( ::GetCurrGlosGroup() )
1242*cdf0e10cSrcweir         ShowAutoText(*::GetCurrGlosGroup(), aShortNameEdit.GetText());
1243*cdf0e10cSrcweir 
1244*cdf0e10cSrcweir     return 0;
1245*cdf0e10cSrcweir };
1246*cdf0e10cSrcweir /* -----------------18.11.99 17:09-------------------
1247*cdf0e10cSrcweir 
1248*cdf0e10cSrcweir  --------------------------------------------------*/
1249*cdf0e10cSrcweir IMPL_LINK( SwGlossaryDlg, PreviewLoadedHdl,  void *, EMPTYARG )
1250*cdf0e10cSrcweir {
1251*cdf0e10cSrcweir     sal_Bool bShow = aShowExampleCB.IsChecked();
1252*cdf0e10cSrcweir     aExampleWIN.Show( bShow );
1253*cdf0e10cSrcweir     aExampleDummyWIN.Show(!bShow);
1254*cdf0e10cSrcweir     ResumeShowAutoText();
1255*cdf0e10cSrcweir     return 0;
1256*cdf0e10cSrcweir }
1257*cdf0e10cSrcweir 
1258*cdf0e10cSrcweir /* -----------------28.07.99 16:28-------------------
1259*cdf0e10cSrcweir 
1260*cdf0e10cSrcweir  --------------------------------------------------*/
1261*cdf0e10cSrcweir void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName)
1262*cdf0e10cSrcweir {
1263*cdf0e10cSrcweir     if(aExampleWIN.IsVisible())
1264*cdf0e10cSrcweir     {
1265*cdf0e10cSrcweir         SetResumeData(rGroup, rShortName);
1266*cdf0e10cSrcweir         //try to make an Undo()
1267*cdf0e10cSrcweir         pExampleFrame->ClearDocument( sal_True );
1268*cdf0e10cSrcweir     }
1269*cdf0e10cSrcweir }
1270*cdf0e10cSrcweir /* -----------------------------21.12.00 11:33--------------------------------
1271*cdf0e10cSrcweir 
1272*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1273*cdf0e10cSrcweir void    SwGlossaryDlg::ResumeShowAutoText()
1274*cdf0e10cSrcweir {
1275*cdf0e10cSrcweir     String sGroup, sShortName;
1276*cdf0e10cSrcweir     if(GetResumeData(sGroup, sShortName) && aExampleWIN.IsVisible())
1277*cdf0e10cSrcweir     {
1278*cdf0e10cSrcweir         if(!_xAutoText.is())
1279*cdf0e10cSrcweir         {
1280*cdf0e10cSrcweir             uno::Reference< lang::XMultiServiceFactory >
1281*cdf0e10cSrcweir                                     xMgr = getProcessServiceFactory();
1282*cdf0e10cSrcweir             //now the AutoText ListBoxes have to be filled
1283*cdf0e10cSrcweir 
1284*cdf0e10cSrcweir             uno::Reference< uno::XInterface >  xAText = xMgr->createInstance( C2U("com.sun.star.text.AutoTextContainer") );
1285*cdf0e10cSrcweir             _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY);
1286*cdf0e10cSrcweir         }
1287*cdf0e10cSrcweir 
1288*cdf0e10cSrcweir         uno::Reference< XTextCursor > & xCrsr = pExampleFrame->GetTextCursor();
1289*cdf0e10cSrcweir         if(xCrsr.is())
1290*cdf0e10cSrcweir         {
1291*cdf0e10cSrcweir             if(sShortName.Len())
1292*cdf0e10cSrcweir             {
1293*cdf0e10cSrcweir                 uno::Any aGroup = _xAutoText->getByName(sGroup);
1294*cdf0e10cSrcweir                 uno::Reference< XAutoTextGroup >  xGroup;
1295*cdf0e10cSrcweir                 OUString uShortName(sShortName);
1296*cdf0e10cSrcweir                 if((aGroup >>= xGroup) && xGroup->hasByName(uShortName))
1297*cdf0e10cSrcweir                 {
1298*cdf0e10cSrcweir                     uno::Any aEntry(xGroup->getByName(uShortName));
1299*cdf0e10cSrcweir                     uno::Reference< XAutoTextEntry >  xEntry;
1300*cdf0e10cSrcweir                     aEntry >>= xEntry;
1301*cdf0e10cSrcweir                     uno::Reference< XTextRange >  xRange(xCrsr, uno::UNO_QUERY);
1302*cdf0e10cSrcweir                     xEntry->applyTo(xRange);
1303*cdf0e10cSrcweir                 }
1304*cdf0e10cSrcweir             }
1305*cdf0e10cSrcweir         }
1306*cdf0e10cSrcweir     }
1307*cdf0e10cSrcweir     ResetResumeData();
1308*cdf0e10cSrcweir }
1309*cdf0e10cSrcweir 
1310*cdf0e10cSrcweir 
1311