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 _SWUI_CNTTAB_HXX
20 : #define _SWUI_CNTTAB_HXX
21 :
22 : #include <svx/stddlg.hxx>
23 :
24 : #include <vcl/button.hxx>
25 :
26 : #include <vcl/edit.hxx>
27 :
28 : #include <vcl/fixed.hxx>
29 :
30 : #include <vcl/field.hxx>
31 : #include <vcl/lstbox.hxx>
32 : #include <sfx2/tabdlg.hxx>
33 :
34 : #include "tox.hxx"
35 : #include <toxmgr.hxx>
36 : #include <svx/checklbx.hxx>
37 : #include <svtools/treelistbox.hxx>
38 : #include <vcl/menubtn.hxx>
39 : #include <svx/langbox.hxx>
40 : #include <cnttab.hxx>
41 : #include <vector>
42 :
43 : class SwWrtShell;
44 : class SwTOXMgr;
45 : namespace com{namespace sun{namespace star{
46 : namespace text{
47 : class XTextSection;
48 : class XDocumentIndex;
49 : }
50 : }}}
51 :
52 0 : struct SwIndexSections_Impl
53 : {
54 : com::sun::star::uno::Reference< com::sun::star::text::XTextSection > xContainerSection;
55 : com::sun::star::uno::Reference< com::sun::star::text::XDocumentIndex > xDocumentIndex;
56 : };
57 :
58 : class SwOneExampleFrame;
59 :
60 : struct SwIndexSections_Impl;
61 :
62 : class SwMultiTOXTabDialog : public SfxTabDialog
63 : {
64 : Window aExampleContainerWIN;
65 : CheckBox aShowExampleCB;
66 : SwTOXMgr* pMgr;
67 : SwWrtShell& rSh;
68 :
69 : SwOneExampleFrame* pExampleFrame;
70 :
71 : SwTOXDescription** pDescArr; //
72 : SwForm** pFormArr; //
73 : SwIndexSections_Impl** pxIndexSectionsArr;
74 :
75 : SwTOXBase* pParamTOXBase;
76 :
77 : CurTOXType eCurrentTOXType;
78 :
79 : String sUserDefinedIndex;
80 : sal_uInt16 nTypeCount;
81 : sal_uInt16 nInitialTOXType;
82 :
83 : sal_Bool bEditTOX;
84 : sal_Bool bExampleCreated;
85 : sal_Bool bGlobalFlag;
86 :
87 : virtual short Ok();
88 : SwTOXDescription* CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX);
89 :
90 : DECL_LINK(CreateExample_Hdl, void* );
91 : DECL_LINK(ShowPreviewHdl, CheckBox*);
92 :
93 : public:
94 : SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet,
95 : SwWrtShell &rShell,
96 : SwTOXBase* pCurTOX, sal_uInt16 nToxType = USHRT_MAX,
97 : sal_Bool bGlobal = sal_False);
98 : ~SwMultiTOXTabDialog();
99 :
100 : virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
101 :
102 : SwForm* GetForm(CurTOXType eType);
103 :
104 0 : CurTOXType GetCurrentTOXType() const { return eCurrentTOXType;}
105 0 : void SetCurrentTOXType(CurTOXType eSet)
106 : {
107 0 : eCurrentTOXType = eSet;
108 0 : }
109 :
110 : void UpdateExample();
111 0 : sal_Bool IsTOXEditMode() const { return bEditTOX;}
112 :
113 0 : SwWrtShell& GetWrtShell() {return rSh;}
114 :
115 : SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes);
116 : void CreateOrUpdateExample(
117 : TOXTypes nTOXIndex, sal_uInt16 nPage = 0, sal_uInt16 nCurLevel = USHRT_MAX);
118 :
119 : static sal_Bool IsNoNum(SwWrtShell& rSh, const String& rName);
120 : };
121 :
122 : class IndexEntryResource;
123 : class IndexEntrySupplierWrapper;
124 :
125 : class SwTOXSelectTabPage : public SfxTabPage
126 : {
127 : FixedLine aTypeTitleFL;
128 : FixedText aTitleFT;
129 : Edit aTitleED;
130 : FixedText aTypeFT;
131 : ListBox aTypeLB;
132 : CheckBox aReadOnlyCB;
133 :
134 : FixedLine aAreaFL;
135 : FixedText aAreaFT;
136 : ListBox aAreaLB;
137 : FixedText aLevelFT; //content, user
138 : NumericField aLevelNF; //content, user
139 :
140 : //content
141 : FixedLine aCreateFromFL; // content, user, illustration
142 : CheckBox aFromHeadingsCB;
143 : CheckBox aAddStylesCB;
144 : PushButton aAddStylesPB;
145 : Point aAddStylesPosDef;
146 : Point aAddStylesPosUser;
147 : //user
148 : CheckBox aFromTablesCB;
149 : CheckBox aFromFramesCB;
150 : CheckBox aFromGraphicsCB;
151 : CheckBox aFromOLECB;
152 : CheckBox aLevelFromChapterCB;
153 :
154 : //illustration + table
155 : RadioButton aFromCaptionsRB;
156 : RadioButton aFromObjectNamesRB;
157 :
158 : //illustration and tables
159 : FixedText aCaptionSequenceFT;
160 : ListBox aCaptionSequenceLB;
161 : FixedText aDisplayTypeFT;
162 : ListBox aDisplayTypeLB;
163 :
164 : //all but illustration and table
165 : CheckBox aTOXMarksCB;
166 :
167 : //
168 :
169 : //index only
170 : FixedLine aIdxOptionsFL;
171 : CheckBox aCollectSameCB;
172 : CheckBox aUseFFCB;
173 : CheckBox aUseDashCB;
174 : CheckBox aCaseSensitiveCB;
175 : CheckBox aInitialCapsCB;
176 : CheckBox aKeyAsEntryCB;
177 : CheckBox aFromFileCB;
178 : MenuButton aAutoMarkPB;
179 :
180 : // object only
181 : SwOLENames aFromNames;
182 : SvxCheckListBox aFromObjCLB;
183 : FixedLine aFromObjFL;
184 :
185 : CheckBox aSequenceCB;
186 : FixedText aBracketFT;
187 : ListBox aBracketLB;
188 : FixedLine aAuthorityFormatFL;
189 :
190 : //all
191 : FixedLine aSortOptionsFL;
192 : FixedText aLanguageFT;
193 : SvxLanguageBox aLanguageLB;
194 : FixedText aSortAlgorithmFT;
195 : ListBox aSortAlgorithmLB;
196 :
197 : IndexEntryResource* pIndexRes;
198 :
199 : Point aCBLeftPos1;
200 : Point aCBLeftPos2;
201 : Point aCBLeftPos3;
202 :
203 : String aStyleArr[MAXLEVEL];
204 : String sAutoMarkURL;
205 : String sAutoMarkType;
206 : String sAddStyleUser;
207 : String sAddStyleContent;
208 :
209 : const IndexEntrySupplierWrapper* pIndexEntryWrapper;
210 :
211 : sal_Bool bFirstCall;
212 :
213 : DECL_LINK(TOXTypeHdl, ListBox* );
214 : DECL_LINK(AddStylesHdl, PushButton* );
215 : DECL_LINK(MenuEnableHdl, Menu*);
216 : DECL_LINK(MenuExecuteHdl, Menu*);
217 : DECL_LINK(LanguageHdl, ListBox*);
218 :
219 : DECL_LINK(CheckBoxHdl, CheckBox* );
220 : DECL_LINK(RadioButtonHdl, void *);
221 : DECL_LINK(ModifyHdl, void*);
222 :
223 : void ApplyTOXDescription();
224 : void FillTOXDescription();
225 :
226 : using SfxTabPage::ActivatePage;
227 : using SfxTabPage::DeactivatePage;
228 :
229 : public:
230 : SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet);
231 : ~SwTOXSelectTabPage();
232 :
233 : virtual sal_Bool FillItemSet( SfxItemSet& );
234 : virtual void Reset( const SfxItemSet& );
235 :
236 : virtual void ActivatePage( const SfxItemSet& );
237 : virtual int DeactivatePage( SfxItemSet* pSet = 0 );
238 :
239 : static SfxTabPage* Create( Window* pParent,
240 : const SfxItemSet& rAttrSet);
241 :
242 : void SelectType(TOXTypes eSet); //preset TOXType, GlobalDoc
243 : void SetWrtShell(SwWrtShell& rSh);
244 : };
245 :
246 : class SwTOXEdit;
247 : class SwTOXButton;
248 : class SwTOXEntryTabPage;
249 :
250 : class SwTokenWindow : public Window
251 : {
252 : typedef std::vector<Control*>::iterator ctrl_iterator;
253 : typedef std::vector<Control*>::const_iterator ctrl_const_iterator;
254 : typedef std::vector<Control*>::reverse_iterator ctrl_reverse_iterator;
255 : typedef std::vector<Control*>::const_reverse_iterator ctrl_const_reverse_iterator;
256 :
257 : ImageButton aLeftScrollWin;
258 : Window aCtrlParentWin;
259 : ImageButton aRightScrollWin;
260 : std::vector<Control*> aControlList;
261 : SwForm* pForm;
262 : sal_uInt16 nLevel;
263 : sal_Bool bValid;
264 : String aButtonTexts[TOKEN_END]; // Text of the buttons
265 : String aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons
266 : String sCharStyle;
267 : Link aButtonSelectedHdl;
268 : Control* pActiveCtrl;
269 : Link aModifyHdl;
270 :
271 : SwTOXEntryTabPage* m_pParent;
272 :
273 : DECL_LINK(EditResize, Edit*);
274 : DECL_LINK(NextItemHdl, SwTOXEdit* );
275 : DECL_LINK(TbxFocusHdl, SwTOXEdit* );
276 : DECL_LINK(NextItemBtnHdl, SwTOXButton* );
277 : DECL_LINK(TbxFocusBtnHdl, SwTOXButton* );
278 : DECL_LINK(ScrollHdl, ImageButton* );
279 :
280 : void SetActiveControl(Control* pSet);
281 :
282 : Control* InsertItem(const String& rText, const SwFormToken& aToken);
283 : void AdjustPositions();
284 : void AdjustScrolling();
285 : void MoveControls(long nOffset);
286 :
287 : public:
288 : SwTokenWindow(SwTOXEntryTabPage* pParent, const ResId& rResId);
289 : ~SwTokenWindow();
290 :
291 : void SetForm(SwForm& rForm, sal_uInt16 nLevel);
292 0 : sal_uInt16 GetLastLevel()const {return nLevel;};
293 :
294 0 : sal_Bool IsValid() const {return bValid;}
295 :
296 0 : void SetInvalid() {bValid = sal_False;}
297 :
298 : String GetPattern() const;
299 :
300 0 : void SetButtonSelectedHdl(const Link& rLink)
301 0 : { aButtonSelectedHdl = rLink;}
302 :
303 0 : void SetModifyHdl(const Link& rLink){aModifyHdl = rLink;}
304 :
305 0 : Control* GetActiveControl()
306 0 : { return pActiveCtrl;}
307 :
308 : void InsertAtSelection(const String& rText, const SwFormToken& aToken);
309 : void RemoveControl(SwTOXButton* pDel, sal_Bool bInternalCall = sal_False);
310 :
311 : sal_Bool Contains(FormTokenType) const;
312 :
313 : sal_Bool DetermineLinkStart();
314 :
315 : //helper for pattern buttons and edits
316 : sal_Bool CreateQuickHelp(Control* pCtrl,
317 : const SwFormToken& rToken, const HelpEvent& );
318 :
319 : virtual void Resize();
320 : virtual void GetFocus();
321 : };
322 :
323 : class SwTOXEntryTabPage;
324 :
325 0 : class SwIdxTreeListBox : public SvTreeListBox
326 : {
327 : SwTOXEntryTabPage* pParent;
328 :
329 : virtual void RequestHelp( const HelpEvent& rHEvt );
330 : public:
331 : SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId);
332 : };
333 :
334 : class SwTOXEntryTabPage : public SfxTabPage
335 : {
336 : FixedText aLevelFT;
337 : SwIdxTreeListBox aLevelLB;
338 :
339 : FixedLine aEntryFL;
340 : FixedText aTokenFT;
341 : SwTokenWindow aTokenWIN;
342 : PushButton aAllLevelsPB;
343 :
344 : PushButton aEntryNoPB;
345 : PushButton aEntryPB;
346 : PushButton aTabPB;
347 : PushButton aChapterInfoPB;
348 : PushButton aPageNoPB;
349 : PushButton aHyperLinkPB;
350 :
351 : ListBox aAuthFieldsLB;
352 : PushButton aAuthInsertPB;
353 : PushButton aAuthRemovePB;
354 :
355 : FixedText aCharStyleFT;
356 : ListBox aCharStyleLB; // character style of the current token
357 : PushButton aEditStylePB;
358 :
359 : FixedText aChapterEntryFT;
360 : ListBox aChapterEntryLB; // type of chapter info
361 :
362 : FixedText aNumberFormatFT;
363 : ListBox aNumberFormatLB; //!< format for numbering (E#)
364 :
365 : FixedText aEntryOutlineLevelFT; //!< Fixed text, for i53420
366 : NumericField aEntryOutlineLevelNF; //!< level to evaluate outline level to, for i53420
367 : FixedText aFillCharFT;
368 : ComboBox aFillCharCB; // fill char for tab stop
369 : FixedText aTabPosFT;
370 : MetricField aTabPosMF; // tab stop position
371 : CheckBox aAutoRightCB;
372 : FixedLine aFormatFL;
373 :
374 : CheckBox aRelToStyleCB; // position relative to the right margin of the para style
375 : FixedText aMainEntryStyleFT;
376 : ListBox aMainEntryStyleLB; // character style of main entries in indexes
377 : CheckBox aAlphaDelimCB;
378 : CheckBox aCommaSeparatedCB;
379 :
380 : RadioButton aSortDocPosRB;
381 : RadioButton aSortContentRB;
382 : FixedLine aSortingFL;
383 :
384 : FixedText aFirstKeyFT;
385 : ListBox aFirstKeyLB;
386 : ImageRadioButton aFirstSortUpRB;
387 : ImageRadioButton aFirstSortDownRB;
388 :
389 : FixedText aSecondKeyFT;
390 : ListBox aSecondKeyLB;
391 : ImageRadioButton aSecondSortUpRB;
392 : ImageRadioButton aSecondSortDownRB;
393 :
394 : FixedText aThirdKeyFT;
395 : ListBox aThirdKeyLB;
396 : ImageRadioButton aThirdSortUpRB;
397 : ImageRadioButton aThirdSortDownRB;
398 :
399 : FixedLine aSortKeyFL;
400 :
401 : String sDelimStr;
402 : String sLevelStr;
403 : String sAuthTypeStr;
404 :
405 : String sNoCharStyle;
406 : String sNoCharSortKey;
407 : Point aButtonPositions[5];
408 : SwForm* m_pCurrentForm;
409 :
410 : Point aRelToStylePos;
411 : Point aRelToStyleIdxPos;
412 : Size aLevelFLSize;
413 :
414 : CurTOXType aLastTOXType;
415 : sal_Bool bInLevelHdl;
416 :
417 : Point aChapterEntryFTPosition; //!< holds position of ChapterEntryFT control,
418 : //to be used in moving the element among different tokens
419 : Point aEntryOutlineLevelFTPosition;//!< holds position ofrEntryOutlineLevelFT control
420 : sal_Int32 nBiasToEntryPoint;
421 :
422 : DECL_LINK(StyleSelectHdl, ListBox*);
423 : DECL_LINK(EditStyleHdl, PushButton*);
424 : DECL_LINK(InsertTokenHdl, PushButton*);
425 : DECL_LINK(LevelHdl, SvTreeListBox*);
426 : DECL_LINK(AutoRightHdl, CheckBox*);
427 : DECL_LINK(TokenSelectedHdl, SwFormToken*);
428 : DECL_LINK(TabPosHdl, MetricField*);
429 : DECL_LINK(FillCharHdl, ComboBox*);
430 : DECL_LINK(RemoveInsertAuthHdl, PushButton*);
431 : DECL_LINK(SortKeyHdl, RadioButton*);
432 : DECL_LINK(ChapterInfoHdl, ListBox*);
433 : DECL_LINK(ChapterInfoOutlineHdl, NumericField*);
434 : DECL_LINK(NumberFormatHdl, ListBox*);
435 :
436 : DECL_LINK(AllLevelsHdl, void *);
437 :
438 : void EnableButtons();
439 : void WriteBackLevel();
440 : void UpdateDescriptor();
441 : DECL_LINK(ModifyHdl, void*);
442 :
443 : using SfxTabPage::ActivatePage;
444 : using SfxTabPage::DeactivatePage;
445 :
446 : public:
447 : SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet);
448 : ~SwTOXEntryTabPage();
449 :
450 : virtual sal_Bool FillItemSet( SfxItemSet& );
451 : virtual void Reset( const SfxItemSet& );
452 : virtual void ActivatePage( const SfxItemSet& );
453 : virtual int DeactivatePage( SfxItemSet* pSet = 0 );
454 :
455 : static SfxTabPage* Create( Window* pParent,
456 : const SfxItemSet& rAttrSet);
457 : void SetWrtShell(SwWrtShell& rSh);
458 :
459 : String GetLevelHelp(sal_uInt16 nLevel) const;
460 :
461 : void PreTokenButtonRemoved(const SwFormToken& rToken);
462 : };
463 :
464 : class SwTOXStylesTabPage : public SfxTabPage
465 : {
466 : FixedLine aFormatFL;
467 : FixedText aLevelFT2;
468 : ListBox aLevelLB;
469 : ImageButton aAssignBT;
470 : FixedText aTemplateFT;
471 : ListBox aParaLayLB;
472 : PushButton aStdBT;
473 : PushButton aEditStyleBT;
474 :
475 : SwForm* m_pCurrentForm;
476 :
477 : DECL_LINK( EditStyleHdl, Button *);
478 : DECL_LINK(StdHdl, void *);
479 : DECL_LINK(EnableSelectHdl, void *);
480 : DECL_LINK(DoubleClickHdl, void *);
481 : DECL_LINK(AssignHdl, void *);
482 : void Modify();
483 :
484 0 : SwForm& GetForm()
485 : {
486 0 : SwMultiTOXTabDialog* pDlg = (SwMultiTOXTabDialog*)GetTabDialog();
487 0 : return *pDlg->GetForm(pDlg->GetCurrentTOXType());
488 : }
489 :
490 : using SfxTabPage::ActivatePage;
491 : using SfxTabPage::DeactivatePage;
492 :
493 : public:
494 : SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet);
495 : ~SwTOXStylesTabPage();
496 :
497 : virtual sal_Bool FillItemSet( SfxItemSet& );
498 : virtual void Reset( const SfxItemSet& );
499 :
500 : virtual void ActivatePage( const SfxItemSet& );
501 : virtual int DeactivatePage( SfxItemSet* pSet = 0 );
502 :
503 : static SfxTabPage* Create( Window* pParent,
504 : const SfxItemSet& rAttrSet);
505 :
506 : };
507 :
508 : #endif // _SWUI_CNTTAB_HXX
509 :
510 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|