1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <vcl/edit.hxx>
23 #include <svtools/treelistbox.hxx>
24 #include <svx/stddlg.hxx>
26 #include <vcl/button.hxx>
27 #include <vcl/fixed.hxx>
29 #include <vcl/combobox.hxx>
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 #include <com/sun/star/text/XAutoTextContainer2.hpp>
41 #include <actctrl.hxx>
44 class SwNewGlosNameDlg
;
50 const short RET_EDIT
= 100;
52 //------------------------------------------------------------------
54 class SwGlTreeListBox
: public SvTreeListBox
56 const String sReadonly
;
58 SvTreeListEntry
* pDragEntry
;
60 virtual DragDropMode
NotifyStartDrag( TransferDataContainer
& rContainer
,
62 virtual sal_Bool
NotifyAcceptDrop( SvTreeListEntry
* );
64 virtual sal_Bool
NotifyMoving( SvTreeListEntry
* pTarget
,
65 SvTreeListEntry
* pEntry
,
66 SvTreeListEntry
*& rpNewParent
,
67 sal_uLong
& rNewChildPos
69 virtual sal_Bool
NotifyCopying( SvTreeListEntry
* pTarget
,
70 SvTreeListEntry
* pEntry
,
71 SvTreeListEntry
*& rpNewParent
,
72 sal_uLong
& rNewChildPos
);
74 SwGlTreeListBox(Window
* pParent
, WinBits nBits
);
76 virtual void RequestHelp( const HelpEvent
& rHEvt
);
77 virtual Size
GetOptimalSize() const;
81 //------------------------------------------------------------------
82 class SwOneExampleFrame
;
83 class SwGlossaryDlg
: public SvxStandardDialog
85 friend class SwNewGlosNameDlg
;
86 friend class SwGlTreeListBox
;
88 CheckBox
* m_pInsertTipCB
;
90 FixedText
* m_pShortNameLbl
;
91 NoSpaceEdit
* m_pShortNameEdit
;
92 SwGlTreeListBox
* m_pCategoryBox
;
93 CheckBox
* m_pFileRelCB
;
94 CheckBox
* m_pNetRelCB
;
95 Window
* m_pExampleWIN
;
96 PushButton
* m_pInsertBtn
;
97 CloseButton
* m_pCloseBtn
;
98 MenuButton
* m_pEditBtn
;
99 PushButton
* m_pBibBtn
;
100 PushButton
* m_pPathBtn
;
102 String sReadonlyPath
;
104 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XAutoTextContainer2
> m_xAutoText
;
105 SwOneExampleFrame
* pExampleFrame
;
107 SwGlossaryHdl
* pGlossaryHdl
;
110 String sResumeShortName
;
114 const sal_Bool bSelection
: 1;
115 sal_Bool bReadOnly
: 1;
117 sal_Bool bIsDocReadOnly
:1;
121 void EnableShortName(sal_Bool bOn
= sal_True
);
124 DECL_LINK( NameModify
, Edit
* );
125 DECL_LINK( NameDoubleClick
, SvTreeListBox
* );
126 DECL_LINK( GrpSelect
, SvTreeListBox
* );
127 DECL_LINK( MenuHdl
, Menu
* );
128 DECL_LINK( EnableHdl
, Menu
* );
129 DECL_LINK(BibHdl
, void *);
130 DECL_LINK(EditHdl
, void *);
131 DECL_LINK(InsertHdl
, void *);
132 DECL_LINK( PathHdl
, Button
* );
133 DECL_LINK( CheckBoxHdl
, CheckBox
* );
134 DECL_LINK( PreviewLoadedHdl
, void * );
137 virtual void Apply();
139 SvTreeListEntry
* DoesBlockExist(const String
& sBlock
, const String
& rShort
);
140 void ShowAutoText(const String
& rGroup
, const String
& rShortName
);
141 void ResumeShowAutoText();
143 sal_Bool
GetResumeData(String
& rGroup
, String
& rShortName
)
144 {rGroup
= sResumeGroup
; rShortName
= sResumeShortName
; return bResume
;}
145 void SetResumeData(const String
& rGroup
, const String
& rShortName
)
146 {sResumeGroup
= rGroup
; sResumeShortName
= rShortName
; bResume
= sal_True
;}
147 void ResetResumeData() {bResume
= sal_False
;}
149 SwGlossaryDlg(SfxViewFrame
* pViewFrame
, SwGlossaryHdl
* pGlosHdl
, SwWrtShell
*pWrtShell
);
151 String
GetCurrGrpName() const;
152 String
GetCurrLongName() const
154 return m_pNameED
->GetText();
156 String
GetCurrShortName() const
158 return m_pShortNameEdit
->GetText();
160 static String
GetCurrGroup();
161 static void SetActGroup(const String
& rNewGroup
);
162 static String
GetExtension();
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */