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