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 INCLUDED_SW_SOURCE_UI_INC_GLOSSARY_HXX
20 : #define INCLUDED_SW_SOURCE_UI_INC_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 : #include <com/sun/star/text/XAutoTextContainer2.hpp>
40 :
41 : #include "rtl/ustring.hxx"
42 :
43 : #include <actctrl.hxx>
44 :
45 : class SwGlossaryHdl;
46 : class SwNewGlosNameDlg;
47 : class SwWrtShell;
48 : class SfxViewFrame;
49 : class PopupMenu;
50 : class Menu;
51 :
52 : const short RET_EDIT = 100;
53 :
54 0 : class SwGlTreeListBox : public SvTreeListBox
55 : {
56 : const OUString sReadonly;
57 :
58 : SvTreeListEntry* pDragEntry;
59 :
60 : virtual DragDropMode NotifyStartDrag( TransferDataContainer& rContainer,
61 : SvTreeListEntry* ) SAL_OVERRIDE;
62 : virtual bool NotifyAcceptDrop( SvTreeListEntry* ) SAL_OVERRIDE;
63 :
64 : virtual TriState NotifyMoving( SvTreeListEntry* pTarget,
65 : SvTreeListEntry* pEntry,
66 : SvTreeListEntry*& rpNewParent,
67 : sal_uLong& rNewChildPos
68 : ) SAL_OVERRIDE;
69 : virtual TriState NotifyCopying( SvTreeListEntry* pTarget,
70 : SvTreeListEntry* pEntry,
71 : SvTreeListEntry*& rpNewParent,
72 : sal_uLong& rNewChildPos) SAL_OVERRIDE;
73 :
74 : TriState NotifyCopyingOrMoving( SvTreeListEntry* pTarget,
75 : SvTreeListEntry* pEntry,
76 : bool bIsMove);
77 : public:
78 : SwGlTreeListBox(Window* pParent, WinBits nBits);
79 :
80 : virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
81 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
82 : void Clear();
83 : };
84 :
85 : class SwOneExampleFrame;
86 : class SwGlossaryDlg : public SvxStandardDialog
87 : {
88 : friend class SwNewGlosNameDlg;
89 : friend class SwGlTreeListBox;
90 :
91 : CheckBox* m_pInsertTipCB;
92 : Edit* m_pNameED;
93 : FixedText* m_pShortNameLbl;
94 : NoSpaceEdit* m_pShortNameEdit;
95 : SwGlTreeListBox* m_pCategoryBox;
96 : CheckBox* m_pFileRelCB;
97 : CheckBox* m_pNetRelCB;
98 : Window* m_pExampleWIN;
99 : PushButton* m_pInsertBtn;
100 : CloseButton* m_pCloseBtn;
101 : MenuButton* m_pEditBtn;
102 : PushButton* m_pBibBtn;
103 : PushButton* m_pPathBtn;
104 :
105 : OUString sReadonlyPath;
106 :
107 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextContainer2 > m_xAutoText;
108 : SwOneExampleFrame* pExampleFrame;
109 :
110 : SwGlossaryHdl* pGlossaryHdl;
111 :
112 : OUString sResumeGroup;
113 : OUString sResumeShortName;
114 : sal_Bool bResume;
115 :
116 : const sal_Bool bSelection : 1;
117 : sal_Bool bReadOnly : 1;
118 : sal_Bool bIsOld : 1;
119 : sal_Bool bIsDocReadOnly:1;
120 :
121 : SwWrtShell* pSh;
122 :
123 : void EnableShortName(sal_Bool bOn = sal_True);
124 : void ShowPreview();
125 :
126 : DECL_LINK( NameModify, Edit * );
127 : DECL_LINK( NameDoubleClick, SvTreeListBox * );
128 : DECL_LINK( GrpSelect, SvTreeListBox * );
129 : DECL_LINK( MenuHdl, Menu * );
130 : DECL_LINK( EnableHdl, Menu * );
131 : DECL_LINK(BibHdl, void *);
132 : DECL_LINK(EditHdl, void *);
133 : DECL_LINK(InsertHdl, void *);
134 : DECL_LINK( PathHdl, Button * );
135 : DECL_LINK( CheckBoxHdl, CheckBox * );
136 : DECL_LINK( PreviewLoadedHdl, void * );
137 :
138 : virtual void Apply() SAL_OVERRIDE;
139 : void Init();
140 : SvTreeListEntry* DoesBlockExist(const OUString& sBlock, const OUString& rShort);
141 : void ShowAutoText(const OUString& rGroup, const OUString& rShortName);
142 : void ResumeShowAutoText();
143 :
144 0 : sal_Bool GetResumeData(OUString& rGroup, OUString& rShortName)
145 0 : {rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;}
146 0 : void SetResumeData(const OUString& rGroup, const OUString& rShortName)
147 0 : {sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = sal_True;}
148 0 : void ResetResumeData() {bResume = sal_False;}
149 : public:
150 : SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
151 : virtual ~SwGlossaryDlg();
152 : OUString GetCurrGrpName() const;
153 : OUString GetCurrLongName() const
154 : {
155 : return m_pNameED->GetText();
156 : }
157 0 : OUString GetCurrShortName() const
158 : {
159 0 : return m_pShortNameEdit->GetText();
160 : }
161 : static OUString GetCurrGroup();
162 : static void SetActGroup(const OUString& rNewGroup);
163 : static OUString GetExtension();
164 : };
165 :
166 : #endif
167 :
168 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|