merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / inc / glossary.hxx
blob484a5d470d0f8b5e3d4c10e71cde705f8805c40d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: glossary.hxx,v $
10 * $Revision: 1.12 $
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 ************************************************************************/
30 #ifndef _GLOSSARY_HXX
31 #define _GLOSSARY_HXX
33 #ifndef _EDIT_HXX //autogen
34 #include <vcl/edit.hxx>
35 #endif
36 #include <svtools/svtreebx.hxx>
37 #include <svx/stddlg.hxx>
39 #ifndef _BUTTON_HXX //autogen
40 #include <vcl/button.hxx>
41 #endif
42 #include <vcl/fixed.hxx>
44 #ifndef _BUTTON_HXX //autogen
45 #include <vcl/button.hxx>
46 #endif
48 #ifndef _FIXED_HXX //autogen
49 #include <vcl/fixed.hxx>
50 #endif
52 #ifndef _COMBOBOX_HXX //autogen
53 #include <vcl/combobox.hxx>
54 #endif
56 #ifndef _MENUBTN_HXX //autogen
57 #include <vcl/menubtn.hxx>
58 #endif
59 #include <com/sun/star/container/XEnumerationAccess.hpp>
60 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
61 #include <com/sun/star/container/XNameAccess.hpp>
62 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
63 #include <com/sun/star/container/XEnumeration.hpp>
64 #include <com/sun/star/container/XElementAccess.hpp>
65 #include <com/sun/star/container/XIndexAccess.hpp>
67 #include <actctrl.hxx>
69 class SwGlossaryHdl;
70 class SwNewGlosNameDlg;
71 class SwWrtShell;
72 class SfxViewFrame;
73 class PopupMenu;
74 class Menu;
76 const short RET_EDIT = 100;
78 //------------------------------------------------------------------
80 class SwGlTreeListBox : public SvTreeListBox
82 const String sReadonly;
84 SvLBoxEntry* pDragEntry;
86 virtual DragDropMode NotifyStartDrag( TransferDataContainer& rContainer,
87 SvLBoxEntry* );
88 virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* );
90 virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget,
91 SvLBoxEntry* pEntry,
92 SvLBoxEntry*& rpNewParent,
93 ULONG& rNewChildPos
95 virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget,
96 SvLBoxEntry* pEntry,
97 SvLBoxEntry*& rpNewParent,
98 ULONG& rNewChildPos);
99 public:
100 SwGlTreeListBox(Window* pParent, const ResId& rResId);
102 virtual void RequestHelp( const HelpEvent& rHEvt );
103 void Clear();
106 //------------------------------------------------------------------
107 class SwOneExampleFrame;
108 class SwGlossaryDlg : public SvxStandardDialog
110 friend class SwNewGlosNameDlg;
111 friend class SwGlTreeListBox;
113 CheckBox aInsertTipCB;
114 FixedText aNameLbl;
115 Edit aNameED;
116 FixedText aShortNameLbl;
117 NoSpaceEdit aShortNameEdit;
118 SwGlTreeListBox aCategoryBox;
119 FixedLine aRelativeFL;
120 CheckBox aFileRelCB;
121 CheckBox aNetRelCB;
122 Window aExampleWIN;
123 Window aExampleDummyWIN;
124 CheckBox aShowExampleCB;
125 OKButton aInsertBtn;
126 CancelButton aCloseBtn;
127 HelpButton aHelpBtn;
128 MenuButton aEditBtn;
129 PushButton aBibBtn;
130 PushButton aPathBtn;
132 String sReadonlyPath;
134 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > _xAutoText;
135 SwOneExampleFrame* pExampleFrame;
137 PopupMenu* pMenu;
138 SwGlossaryHdl* pGlossaryHdl;
140 String sResumeGroup;
141 String sResumeShortName;
142 BOOL bResume;
145 const sal_Bool bSelection : 1;
146 sal_Bool bReadOnly : 1;
147 sal_Bool bIsOld : 1;
148 sal_Bool bIsDocReadOnly:1;
150 SwWrtShell* pSh;
152 void EnableShortName(sal_Bool bOn = sal_True);
154 DECL_LINK( NameModify, Edit * );
155 DECL_LINK( NameDoubleClick, SvTreeListBox * );
156 DECL_LINK( GrpSelect, SvTreeListBox * );
157 DECL_LINK( MenuHdl, Menu * );
158 DECL_LINK( EnableHdl, Menu * );
159 DECL_LINK( BibHdl, Button * );
160 DECL_LINK( EditHdl, Button * );
161 DECL_LINK( PathHdl, Button * );
162 DECL_LINK( CheckBoxHdl, CheckBox * );
163 DECL_LINK( ShowPreviewHdl, CheckBox * );
164 DECL_LINK( PreviewLoadedHdl, void * );
167 virtual void Apply();
168 void Init();
169 SvLBoxEntry* DoesBlockExist(const String& sBlock, const String& rShort);
170 void ShowAutoText(const String& rGroup, const String& rShortName);
171 void ResumeShowAutoText();
173 BOOL GetResumeData(String& rGroup, String& rShortName)
174 {rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;}
175 void SetResumeData(const String& rGroup, const String& rShortName)
176 {sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = TRUE;}
177 void ResetResumeData() {bResume = FALSE;}
178 public:
179 SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
180 ~SwGlossaryDlg();
181 String GetCurrGrpName() const;
182 inline String GetCurrLongName() const;
183 inline String GetCurrShortName() const;
184 static String GetCurrGroup();
185 static void SetActGroup(const String& rNewGroup);
186 static String GetExtension();
189 inline String SwGlossaryDlg::GetCurrLongName() const
191 return aNameED.GetText();
193 inline String SwGlossaryDlg::GetCurrShortName() const
195 return aShortNameEdit.GetText();
199 #endif