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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_GLOSSARY_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSSARY_HXX
22 #include <vcl/customweld.hxx>
23 #include <vcl/textfilter.hxx>
24 #include <vcl/weld.hxx>
26 #include <com/sun/star/text/XAutoTextContainer2.hpp>
28 #include <rtl/ustring.hxx>
29 #include <sfx2/basedlgs.hxx>
33 class SwNewGlosNameDlg
;
38 class SwOneExampleFrame
;
40 const short RET_EDIT
= 100;
42 class SwGlossaryDropTarget
;
44 class SwGlossaryDlg final
: public SfxDialogController
46 friend class SwNewGlosNameDlg
;
48 OUString
const m_sReadonlyPath
;
50 css::uno::Reference
< css::text::XAutoTextContainer2
> m_xAutoText
;
52 SwGlossaryHdl
* m_pGlossaryHdl
;
54 OUString m_sResumeGroup
;
55 OUString m_sResumeShortName
;
58 const bool m_bSelection
: 1;
61 bool m_bIsDocReadOnly
:1;
65 std::vector
<std::unique_ptr
<GroupUserData
>> m_xGroupData
;
67 std::unique_ptr
<weld::CheckButton
> m_xInsertTipCB
;
68 std::unique_ptr
<weld::Entry
> m_xNameED
;
69 std::unique_ptr
<weld::Label
> m_xShortNameLbl
;
70 TextFilter m_aNoSpaceFilter
;
71 std::unique_ptr
<weld::Entry
> m_xShortNameEdit
;
72 std::unique_ptr
<weld::TreeView
> m_xCategoryBox
;
73 std::unique_ptr
<weld::CheckButton
> m_xFileRelCB
;
74 std::unique_ptr
<weld::CheckButton
> m_xNetRelCB
;
75 std::unique_ptr
<weld::Button
> m_xInsertBtn
;
76 std::unique_ptr
<weld::MenuButton
> m_xEditBtn
;
77 std::unique_ptr
<weld::Button
> m_xBibBtn
;
78 std::unique_ptr
<weld::Button
> m_xPathBtn
;
79 std::unique_ptr
<SwOneExampleFrame
> m_xExampleFrame
;
80 std::unique_ptr
<weld::CustomWeld
> m_xExampleFrameWin
;
81 std::unique_ptr
<SwGlossaryDropTarget
> m_xDropTarget
;
83 void EnableShortName(bool bOn
= true);
86 DECL_LINK( NameModify
, weld::Entry
&, void );
87 DECL_LINK( NameDoubleClick
, weld::TreeView
&, bool );
88 DECL_LINK( GrpSelect
, weld::TreeView
&, void );
89 DECL_LINK( MenuHdl
, const OUString
&, void );
90 DECL_LINK( EnableHdl
, weld::Toggleable
&, void );
91 DECL_LINK( BibHdl
, weld::Button
&, void );
92 DECL_LINK( InsertHdl
, weld::Button
&, void );
93 DECL_LINK( PathHdl
, weld::Button
&, void );
94 DECL_LINK( CheckBoxHdl
, weld::Toggleable
&, void );
95 DECL_LINK( PreviewLoadedHdl
, SwOneExampleFrame
&, void );
96 DECL_LINK( KeyInputHdl
, const KeyEvent
&, bool );
97 DECL_LINK( TextFilterHdl
, OUString
&, bool );
101 std::unique_ptr
<weld::TreeIter
> DoesBlockExist(std::u16string_view sBlock
, std::u16string_view rShort
);
102 void ShowAutoText(const OUString
& rGroup
, const OUString
& rShortName
);
103 void ResumeShowAutoText();
105 bool GetResumeData(OUString
& rGroup
, OUString
& rShortName
)
106 {rGroup
= m_sResumeGroup
; rShortName
= m_sResumeShortName
; return m_bResume
;}
107 void SetResumeData(const OUString
& rGroup
, const OUString
& rShortName
)
108 {m_sResumeGroup
= rGroup
; m_sResumeShortName
= rShortName
; m_bResume
= true;}
112 SwGlossaryDlg(const SfxViewFrame
& rViewFrame
, SwGlossaryHdl
* pGlosHdl
, SwWrtShell
*pWrtShell
);
113 virtual short run() override
;
114 virtual ~SwGlossaryDlg() override
;
115 OUString
GetCurrGrpName() const;
116 OUString
GetCurrShortName() const
118 return m_xShortNameEdit
->get_text();
120 static OUString
GetCurrGroup();
121 static void SetActGroup(const OUString
& rNewGroup
);
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */