Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _GLOSSARY_HXX
20 : #define _GLOSSARY_HXX
21 :
22 : #include <vcl/edit.hxx>
23 : #include <svtools/treelistbox.hxx>
24 : #include <svx/stddlg.hxx>
25 :
26 : #include <vcl/button.hxx>
27 : #include <vcl/fixed.hxx>
28 :
29 : #include <vcl/combobox.hxx>
30 :
31 : #include <vcl/menubtn.hxx>
32 : #include <com/sun/star/container/XEnumerationAccess.hpp>
33 : #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
34 : #include <com/sun/star/container/XNameAccess.hpp>
35 : #include <com/sun/star/container/XContentEnumerationAccess.hpp>
36 : #include <com/sun/star/container/XEnumeration.hpp>
37 : #include <com/sun/star/container/XElementAccess.hpp>
38 : #include <com/sun/star/container/XIndexAccess.hpp>
39 :
40 : #include <actctrl.hxx>
41 :
42 : class SwGlossaryHdl;
43 : class SwNewGlosNameDlg;
44 : class SwWrtShell;
45 : class SfxViewFrame;
46 : class PopupMenu;
47 : class Menu;
48 :
49 : const short RET_EDIT = 100;
50 :
51 : //------------------------------------------------------------------
52 :
53 0 : class SwGlTreeListBox : public SvTreeListBox
54 : {
55 : const String sReadonly;
56 :
57 : SvTreeListEntry* pDragEntry;
58 :
59 : virtual DragDropMode NotifyStartDrag( TransferDataContainer& rContainer,
60 : SvTreeListEntry* );
61 : virtual sal_Bool NotifyAcceptDrop( SvTreeListEntry* );
62 :
63 : virtual sal_Bool NotifyMoving( SvTreeListEntry* pTarget,
64 : SvTreeListEntry* pEntry,
65 : SvTreeListEntry*& rpNewParent,
66 : sal_uLong& rNewChildPos
67 : );
68 : virtual sal_Bool NotifyCopying( SvTreeListEntry* pTarget,
69 : SvTreeListEntry* pEntry,
70 : SvTreeListEntry*& rpNewParent,
71 : sal_uLong& rNewChildPos);
72 : public:
73 : SwGlTreeListBox(Window* pParent, const ResId& rResId);
74 :
75 : virtual void RequestHelp( const HelpEvent& rHEvt );
76 : void Clear();
77 : };
78 :
79 : //------------------------------------------------------------------
80 : class SwOneExampleFrame;
81 : class SwGlossaryDlg : public SvxStandardDialog
82 : {
83 : friend class SwNewGlosNameDlg;
84 : friend class SwGlTreeListBox;
85 :
86 : CheckBox aInsertTipCB;
87 : FixedText aNameLbl;
88 : Edit aNameED;
89 : FixedText aShortNameLbl;
90 : NoSpaceEdit aShortNameEdit;
91 : SwGlTreeListBox aCategoryBox;
92 : FixedLine aRelativeFL;
93 : CheckBox aFileRelCB;
94 : CheckBox aNetRelCB;
95 : Window aExampleWIN;
96 : Window aExampleDummyWIN;
97 : CheckBox aShowExampleCB;
98 : OKButton aInsertBtn;
99 : CancelButton aCloseBtn;
100 : HelpButton aHelpBtn;
101 : MenuButton aEditBtn;
102 : PushButton aBibBtn;
103 : PushButton aPathBtn;
104 :
105 : String sReadonlyPath;
106 :
107 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > _xAutoText;
108 : SwOneExampleFrame* pExampleFrame;
109 :
110 : PopupMenu* pMenu;
111 : SwGlossaryHdl* pGlossaryHdl;
112 :
113 : String sResumeGroup;
114 : String sResumeShortName;
115 : sal_Bool bResume;
116 :
117 :
118 : const sal_Bool bSelection : 1;
119 : sal_Bool bReadOnly : 1;
120 : sal_Bool bIsOld : 1;
121 : sal_Bool bIsDocReadOnly:1;
122 :
123 : SwWrtShell* pSh;
124 :
125 : void EnableShortName(sal_Bool bOn = sal_True);
126 :
127 : DECL_LINK( NameModify, Edit * );
128 : DECL_LINK( NameDoubleClick, SvTreeListBox * );
129 : DECL_LINK( GrpSelect, SvTreeListBox * );
130 : DECL_LINK( MenuHdl, Menu * );
131 : DECL_LINK( EnableHdl, Menu * );
132 : DECL_LINK(BibHdl, void *);
133 : DECL_LINK(EditHdl, void *);
134 : DECL_LINK( PathHdl, Button * );
135 : DECL_LINK( CheckBoxHdl, CheckBox * );
136 : DECL_LINK( ShowPreviewHdl, CheckBox * );
137 : DECL_LINK( PreviewLoadedHdl, void * );
138 :
139 :
140 : virtual void Apply();
141 : void Init();
142 : SvTreeListEntry* DoesBlockExist(const String& sBlock, const String& rShort);
143 : void ShowAutoText(const String& rGroup, const String& rShortName);
144 : void ResumeShowAutoText();
145 :
146 0 : sal_Bool GetResumeData(String& rGroup, String& rShortName)
147 0 : {rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;}
148 0 : void SetResumeData(const String& rGroup, const String& rShortName)
149 0 : {sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = sal_True;}
150 0 : void ResetResumeData() {bResume = sal_False;}
151 : public:
152 : SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
153 : ~SwGlossaryDlg();
154 : String GetCurrGrpName() const;
155 : inline String GetCurrLongName() const;
156 : inline String GetCurrShortName() const;
157 : static String GetCurrGroup();
158 : static void SetActGroup(const String& rNewGroup);
159 : static String GetExtension();
160 : };
161 :
162 : inline String SwGlossaryDlg::GetCurrLongName() const
163 : {
164 : return aNameED.GetText();
165 : }
166 0 : inline String SwGlossaryDlg::GetCurrShortName() const
167 : {
168 0 : return aShortNameEdit.GetText();
169 : }
170 :
171 :
172 : #endif
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|