1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: textglos.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <sfx2/request.hxx>
36 #include <svtools/eitem.hxx>
37 #include <svtools/stritem.hxx>
45 #include "gloshdl.hxx"
46 #include "glosdoc.hxx"
47 #include "gloslst.hxx"
48 #include "swabstdlg.hxx"
51 // STATIC DATA -----------------------------------------------------------
53 void SwTextShell::ExecGlossary(SfxRequest
&rReq
)
55 USHORT nSlot
= rReq
.GetSlot();
56 ::GetGlossaries()->UpdateGlosPath(!rReq
.IsAPI() ||
57 FN_GLOSSARY_DLG
== nSlot
);
58 SwGlossaryHdl
* pGlosHdl
= GetView().GetGlosHdl();
59 // SwGlossaryList updaten?
60 BOOL bUpdateList
= FALSE
;
62 const SfxItemSet
*pArgs
= rReq
.GetArgs();
63 const SfxPoolItem
* pItem
= 0;
65 pArgs
->GetItemState(nSlot
, FALSE
, &pItem
);
70 pGlosHdl
->GlossaryDlg();
74 case FN_EXPAND_GLOSSARY
:
77 bReturn
= pGlosHdl
->ExpandGlossary();
78 rReq
.SetReturnValue( SfxBoolItem( nSlot
, bReturn
) );
83 if(pItem
&& pArgs
->Count() == 3 )
85 String aGroup
= (( const SfxStringItem
*)pItem
)->GetValue();
87 if(SFX_ITEM_SET
== pArgs
->GetItemState(FN_PARAM_1
, FALSE
, &pItem
))
88 aName
= (( const SfxStringItem
*)pItem
)->GetValue();
90 if(SFX_ITEM_SET
== pArgs
->GetItemState(FN_PARAM_2
, FALSE
, &pItem
))
91 aShortName
= (( const SfxStringItem
*)pItem
)->GetValue();
93 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
94 DBG_ASSERT(pFact
, "Dialogdiet fail!");
95 ::GlossarySetActGroup fnSetActGroup
= pFact
->SetGlossaryActGroupFunc( DLG_RENAME_GLOS
);
97 (*fnSetActGroup
)( aGroup
);
98 pGlosHdl
->SetCurGroup(aGroup
, TRUE
);
99 //eingestellte Gruppe muss in NewGlossary ggf. erzeugt werden!
100 pGlosHdl
->NewGlossary( aName
, aShortName
, TRUE
);
105 case FN_SET_ACT_GLOSSARY
:
108 String aGroup
= (( const SfxStringItem
*)pItem
)->GetValue();
109 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
110 DBG_ASSERT(pFact
, "Dialogdiet fail!");
111 ::GlossarySetActGroup fnSetActGroup
= pFact
->SetGlossaryActGroupFunc( DLG_RENAME_GLOS
);
113 (*fnSetActGroup
)( aGroup
);
117 case FN_INSERT_GLOSSARY
:
119 if(pItem
&& pArgs
->Count() > 1)
121 String aGroup
= (( const SfxStringItem
*)pItem
)->GetValue();
123 if(SFX_ITEM_SET
== pArgs
->GetItemState(FN_PARAM_1
, FALSE
, &pItem
))
124 aName
= (( const SfxStringItem
*)pItem
)->GetValue();
125 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
126 DBG_ASSERT(pFact
, "Dialogdiet fail!");
127 ::GlossarySetActGroup fnSetActGroup
= pFact
->SetGlossaryActGroupFunc( DLG_RENAME_GLOS
);
129 (*fnSetActGroup
)( aGroup
);
130 pGlosHdl
->SetCurGroup(aGroup
, TRUE
);
131 rReq
.SetReturnValue(SfxBoolItem(nSlot
, pGlosHdl
->InsertGlossary( aName
)));
137 ASSERT(FALSE
, falscher Dispatcher
);
142 SwGlossaryList
* pList
= ::GetGlossaryList();
143 if(pList
->IsActive())