xref: /trunk/main/sw/source/ui/inc/glossary.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _GLOSSARY_HXX
24cdf0e10cSrcweir #define _GLOSSARY_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef _EDIT_HXX //autogen
27cdf0e10cSrcweir #include <vcl/edit.hxx>
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
30cdf0e10cSrcweir #include <svx/stddlg.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #ifndef _BUTTON_HXX //autogen
33cdf0e10cSrcweir #include <vcl/button.hxx>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #include <vcl/fixed.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #ifndef _BUTTON_HXX //autogen
38cdf0e10cSrcweir #include <vcl/button.hxx>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #ifndef _FIXED_HXX //autogen
42cdf0e10cSrcweir #include <vcl/fixed.hxx>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #ifndef _COMBOBOX_HXX //autogen
46cdf0e10cSrcweir #include <vcl/combobox.hxx>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #ifndef _MENUBTN_HXX //autogen
50cdf0e10cSrcweir #include <vcl/menubtn.hxx>
51cdf0e10cSrcweir #endif
52cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
53cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
54cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
55cdf0e10cSrcweir #include <com/sun/star/container/XContentEnumerationAccess.hpp>
56cdf0e10cSrcweir #include <com/sun/star/container/XEnumeration.hpp>
57cdf0e10cSrcweir #include <com/sun/star/container/XElementAccess.hpp>
58cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir #include <actctrl.hxx>
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class SwGlossaryHdl;
63cdf0e10cSrcweir class SwNewGlosNameDlg;
64cdf0e10cSrcweir class SwWrtShell;
65cdf0e10cSrcweir class SfxViewFrame;
66cdf0e10cSrcweir class PopupMenu;
67cdf0e10cSrcweir class Menu;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir const short RET_EDIT = 100;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir //------------------------------------------------------------------
72cdf0e10cSrcweir 
73cdf0e10cSrcweir class SwGlTreeListBox : public SvTreeListBox
74cdf0e10cSrcweir {
75cdf0e10cSrcweir     const String    sReadonly;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     SvLBoxEntry*  pDragEntry;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     virtual DragDropMode NotifyStartDrag( TransferDataContainer& rContainer,
80cdf0e10cSrcweir                                             SvLBoxEntry* );
81cdf0e10cSrcweir     virtual sal_Bool    NotifyAcceptDrop( SvLBoxEntry* );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     virtual sal_Bool    NotifyMoving(   SvLBoxEntry*  pTarget,
84cdf0e10cSrcweir                                     SvLBoxEntry*  pEntry,
85cdf0e10cSrcweir                                     SvLBoxEntry*& rpNewParent,
86cdf0e10cSrcweir                                     sal_uLong&        rNewChildPos
87cdf0e10cSrcweir                                 );
88cdf0e10cSrcweir     virtual sal_Bool    NotifyCopying(  SvLBoxEntry*  pTarget,
89cdf0e10cSrcweir                                     SvLBoxEntry*  pEntry,
90cdf0e10cSrcweir                                     SvLBoxEntry*& rpNewParent,
91cdf0e10cSrcweir                                     sal_uLong&        rNewChildPos);
92cdf0e10cSrcweir public:
93cdf0e10cSrcweir     SwGlTreeListBox(Window* pParent, const ResId& rResId);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     virtual void    RequestHelp( const HelpEvent& rHEvt );
96cdf0e10cSrcweir     void            Clear();
97cdf0e10cSrcweir };
98cdf0e10cSrcweir 
99cdf0e10cSrcweir //------------------------------------------------------------------
100cdf0e10cSrcweir class SwOneExampleFrame;
101cdf0e10cSrcweir class SwGlossaryDlg : public SvxStandardDialog
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     friend class SwNewGlosNameDlg;
104cdf0e10cSrcweir     friend class SwGlTreeListBox;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     CheckBox        aInsertTipCB;
107cdf0e10cSrcweir     FixedText       aNameLbl;
108cdf0e10cSrcweir     Edit            aNameED;
109cdf0e10cSrcweir     FixedText       aShortNameLbl;
110cdf0e10cSrcweir     NoSpaceEdit     aShortNameEdit;
111cdf0e10cSrcweir     SwGlTreeListBox aCategoryBox;
112cdf0e10cSrcweir     FixedLine       aRelativeFL;
113cdf0e10cSrcweir     CheckBox        aFileRelCB;
114cdf0e10cSrcweir     CheckBox        aNetRelCB;
115cdf0e10cSrcweir     Window          aExampleWIN;
116cdf0e10cSrcweir     Window          aExampleDummyWIN;
117cdf0e10cSrcweir     CheckBox        aShowExampleCB;
118cdf0e10cSrcweir     OKButton        aInsertBtn;
119cdf0e10cSrcweir     CancelButton    aCloseBtn;
120cdf0e10cSrcweir     HelpButton      aHelpBtn;
121cdf0e10cSrcweir     MenuButton      aEditBtn;
122cdf0e10cSrcweir     PushButton      aBibBtn;
123cdf0e10cSrcweir     PushButton      aPathBtn;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     String          sReadonlyPath;
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >        _xAutoText;
128cdf0e10cSrcweir     SwOneExampleFrame*  pExampleFrame;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     PopupMenu*      pMenu;
131cdf0e10cSrcweir     SwGlossaryHdl*  pGlossaryHdl;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     String          sResumeGroup;
134cdf0e10cSrcweir     String          sResumeShortName;
135cdf0e10cSrcweir     sal_Bool            bResume;
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     const sal_Bool      bSelection : 1;
139cdf0e10cSrcweir     sal_Bool            bReadOnly : 1;
140cdf0e10cSrcweir     sal_Bool            bIsOld : 1;
141cdf0e10cSrcweir     sal_Bool            bIsDocReadOnly:1;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     SwWrtShell*     pSh;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     void EnableShortName(sal_Bool bOn = sal_True);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     DECL_LINK( NameModify, Edit * );
148cdf0e10cSrcweir     DECL_LINK( NameDoubleClick, SvTreeListBox * );
149cdf0e10cSrcweir     DECL_LINK( GrpSelect, SvTreeListBox * );
150cdf0e10cSrcweir     DECL_LINK( MenuHdl, Menu * );
151cdf0e10cSrcweir     DECL_LINK( EnableHdl, Menu * );
152cdf0e10cSrcweir     DECL_LINK( BibHdl, Button * );
153cdf0e10cSrcweir     DECL_LINK( EditHdl, Button * );
154cdf0e10cSrcweir     DECL_LINK( PathHdl, Button * );
155cdf0e10cSrcweir     DECL_LINK( CheckBoxHdl, CheckBox * );
156cdf0e10cSrcweir     DECL_LINK( ShowPreviewHdl, CheckBox * );
157cdf0e10cSrcweir     DECL_LINK( PreviewLoadedHdl, void * );
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     virtual void    Apply();
161cdf0e10cSrcweir     void            Init();
162cdf0e10cSrcweir     SvLBoxEntry*    DoesBlockExist(const String& sBlock, const String& rShort);
163cdf0e10cSrcweir     void            ShowAutoText(const String& rGroup, const String& rShortName);
164cdf0e10cSrcweir     void            ResumeShowAutoText();
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     sal_Bool            GetResumeData(String& rGroup, String& rShortName)
167cdf0e10cSrcweir                         {rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;}
168cdf0e10cSrcweir     void            SetResumeData(const String& rGroup, const String& rShortName)
169cdf0e10cSrcweir                         {sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = sal_True;}
170cdf0e10cSrcweir     void            ResetResumeData() {bResume = sal_False;}
171cdf0e10cSrcweir public:
172cdf0e10cSrcweir     SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
173cdf0e10cSrcweir     ~SwGlossaryDlg();
174cdf0e10cSrcweir     String          GetCurrGrpName() const;
175cdf0e10cSrcweir     inline String   GetCurrLongName() const;
176cdf0e10cSrcweir     inline String   GetCurrShortName() const;
177cdf0e10cSrcweir     static String   GetCurrGroup();
178cdf0e10cSrcweir     static void     SetActGroup(const String& rNewGroup);
179cdf0e10cSrcweir     static String   GetExtension();
180cdf0e10cSrcweir };
181cdf0e10cSrcweir 
182cdf0e10cSrcweir inline String SwGlossaryDlg::GetCurrLongName() const
183cdf0e10cSrcweir {
184cdf0e10cSrcweir     return aNameED.GetText();
185cdf0e10cSrcweir }
186cdf0e10cSrcweir inline String SwGlossaryDlg::GetCurrShortName() const
187cdf0e10cSrcweir {
188cdf0e10cSrcweir     return aShortNameEdit.GetText();
189cdf0e10cSrcweir }
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 
192cdf0e10cSrcweir #endif
193cdf0e10cSrcweir 
194