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 : #include <com/sun/star/text/XAutoTextContainer2.hpp>
40 :
41 : #include <actctrl.hxx>
42 :
43 : class SwGlossaryHdl;
44 : class SwNewGlosNameDlg;
45 : class SwWrtShell;
46 : class SfxViewFrame;
47 : class PopupMenu;
48 : class Menu;
49 :
50 : const short RET_EDIT = 100;
51 :
52 : //------------------------------------------------------------------
53 :
54 0 : class SwGlTreeListBox : public SvTreeListBox
55 : {
56 : const String sReadonly;
57 :
58 : SvTreeListEntry* pDragEntry;
59 :
60 : virtual DragDropMode NotifyStartDrag( TransferDataContainer& rContainer,
61 : SvTreeListEntry* );
62 : virtual sal_Bool NotifyAcceptDrop( SvTreeListEntry* );
63 :
64 : virtual sal_Bool NotifyMoving( SvTreeListEntry* pTarget,
65 : SvTreeListEntry* pEntry,
66 : SvTreeListEntry*& rpNewParent,
67 : sal_uLong& rNewChildPos
68 : );
69 : virtual sal_Bool NotifyCopying( SvTreeListEntry* pTarget,
70 : SvTreeListEntry* pEntry,
71 : SvTreeListEntry*& rpNewParent,
72 : sal_uLong& rNewChildPos);
73 : public:
74 : SwGlTreeListBox(Window* pParent, WinBits nBits);
75 :
76 : virtual void RequestHelp( const HelpEvent& rHEvt );
77 : virtual Size GetOptimalSize() const;
78 : void Clear();
79 : };
80 :
81 : //------------------------------------------------------------------
82 : class SwOneExampleFrame;
83 : class SwGlossaryDlg : public SvxStandardDialog
84 : {
85 : friend class SwNewGlosNameDlg;
86 : friend class SwGlTreeListBox;
87 :
88 : CheckBox* m_pInsertTipCB;
89 : Edit* m_pNameED;
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;
101 :
102 : String sReadonlyPath;
103 :
104 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextContainer2 > m_xAutoText;
105 : SwOneExampleFrame* pExampleFrame;
106 :
107 : SwGlossaryHdl* pGlossaryHdl;
108 :
109 : String sResumeGroup;
110 : String sResumeShortName;
111 : sal_Bool bResume;
112 :
113 :
114 : const sal_Bool bSelection : 1;
115 : sal_Bool bReadOnly : 1;
116 : sal_Bool bIsOld : 1;
117 : sal_Bool bIsDocReadOnly:1;
118 :
119 : SwWrtShell* pSh;
120 :
121 : void EnableShortName(sal_Bool bOn = sal_True);
122 : void ShowPreview();
123 :
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 * );
135 :
136 :
137 : virtual void Apply();
138 : void Init();
139 : SvTreeListEntry* DoesBlockExist(const String& sBlock, const String& rShort);
140 : void ShowAutoText(const String& rGroup, const String& rShortName);
141 : void ResumeShowAutoText();
142 :
143 0 : sal_Bool GetResumeData(String& rGroup, String& rShortName)
144 0 : {rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;}
145 0 : void SetResumeData(const String& rGroup, const String& rShortName)
146 0 : {sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = sal_True;}
147 0 : void ResetResumeData() {bResume = sal_False;}
148 : public:
149 : SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
150 : ~SwGlossaryDlg();
151 : String GetCurrGrpName() const;
152 : String GetCurrLongName() const
153 : {
154 : return m_pNameED->GetText();
155 : }
156 0 : String GetCurrShortName() const
157 : {
158 0 : return m_pShortNameEdit->GetText();
159 : }
160 : static String GetCurrGroup();
161 : static void SetActGroup(const String& rNewGroup);
162 : static String GetExtension();
163 : };
164 :
165 : #endif
166 :
167 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|