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_UIBASE_INC_GLOSSARY_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_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(vcl::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 : VclPtr<CheckBox> m_pInsertTipCB;
92 : VclPtr<Edit> m_pNameED;
93 : VclPtr<FixedText> m_pShortNameLbl;
94 : TextFilter m_aNoSpaceFilter;
95 : VclPtr<Edit> m_pShortNameEdit;
96 : VclPtr<SwGlTreeListBox> m_pCategoryBox;
97 : VclPtr<CheckBox> m_pFileRelCB;
98 : VclPtr<CheckBox> m_pNetRelCB;
99 : VclPtr<vcl::Window> m_pExampleWIN;
100 : VclPtr<PushButton> m_pInsertBtn;
101 : VclPtr<MenuButton> m_pEditBtn;
102 : VclPtr<PushButton> m_pBibBtn;
103 : VclPtr<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 : bool bResume;
115 :
116 : const bool bSelection : 1;
117 : bool bReadOnly : 1;
118 : bool bIsOld : 1;
119 : bool bIsDocReadOnly:1;
120 :
121 : SwWrtShell* pSh;
122 :
123 : void EnableShortName(bool bOn = 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_TYPED( EnableHdl, Menu *, bool );
131 : DECL_LINK(BibHdl, void *);
132 : DECL_LINK_TYPED(EditHdl, MenuButton *, 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 : 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 = true;}
148 0 : void ResetResumeData() {bResume = false;}
149 : public:
150 : SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
151 : virtual ~SwGlossaryDlg();
152 : virtual void dispose() SAL_OVERRIDE;
153 : OUString GetCurrGrpName() const;
154 : OUString GetCurrLongName() const
155 : {
156 : return m_pNameED->GetText();
157 : }
158 0 : OUString GetCurrShortName() const
159 : {
160 0 : return m_pShortNameEdit->GetText();
161 : }
162 : static OUString GetCurrGroup();
163 : static void SetActGroup(const OUString& rNewGroup);
164 : static OUString GetExtension();
165 : };
166 :
167 : #endif
168 :
169 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|