bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / inc / swuicnttab.hxx
blob27a5a8fcb55096eb39cbea0a1681c4685df380c4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _SWUI_CNTTAB_HXX
20 #define _SWUI_CNTTAB_HXX
22 #include <svx/stddlg.hxx>
24 #include <vcl/button.hxx>
26 #include <vcl/edit.hxx>
28 #include <vcl/fixed.hxx>
30 #include <vcl/field.hxx>
31 #include <vcl/lstbox.hxx>
32 #include <sfx2/tabdlg.hxx>
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>
43 class SwWrtShell;
44 class SwTOXMgr;
45 namespace com{namespace sun{namespace star{
46 namespace text{
47 class XTextSection;
48 class XDocumentIndex;
50 }}}
52 struct SwIndexSections_Impl
54 com::sun::star::uno::Reference< com::sun::star::text::XTextSection > xContainerSection;
55 com::sun::star::uno::Reference< com::sun::star::text::XDocumentIndex > xDocumentIndex;
58 class SwOneExampleFrame;
60 struct SwIndexSections_Impl;
62 class SwMultiTOXTabDialog : public SfxTabDialog
64 Window aExampleContainerWIN;
65 CheckBox aShowExampleCB;
66 SwTOXMgr* pMgr;
67 SwWrtShell& rSh;
69 SwOneExampleFrame* pExampleFrame;
71 SwTOXDescription** pDescArr; //
72 SwForm** pFormArr; //
73 SwIndexSections_Impl** pxIndexSectionsArr;
75 SwTOXBase* pParamTOXBase;
77 CurTOXType eCurrentTOXType;
79 String sUserDefinedIndex;
80 sal_uInt16 nTypeCount;
81 sal_uInt16 nInitialTOXType;
83 sal_Bool bEditTOX;
84 sal_Bool bExampleCreated;
85 sal_Bool bGlobalFlag;
87 virtual short Ok();
88 SwTOXDescription* CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX);
90 DECL_LINK(CreateExample_Hdl, void* );
91 DECL_LINK(ShowPreviewHdl, CheckBox*);
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();
100 virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
102 SwForm* GetForm(CurTOXType eType);
104 CurTOXType GetCurrentTOXType() const { return eCurrentTOXType;}
105 void SetCurrentTOXType(CurTOXType eSet)
107 eCurrentTOXType = eSet;
110 void UpdateExample();
111 sal_Bool IsTOXEditMode() const { return bEditTOX;}
113 SwWrtShell& GetWrtShell() {return rSh;}
115 SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes);
116 void CreateOrUpdateExample(
117 TOXTypes nTOXIndex, sal_uInt16 nPage = 0, sal_uInt16 nCurLevel = USHRT_MAX);
119 static sal_Bool IsNoNum(SwWrtShell& rSh, const String& rName);
122 class IndexEntryResource;
123 class IndexEntrySupplierWrapper;
125 class SwTOXSelectTabPage : public SfxTabPage
127 FixedLine aTypeTitleFL;
128 FixedText aTitleFT;
129 Edit aTitleED;
130 FixedText aTypeFT;
131 ListBox aTypeLB;
132 CheckBox aReadOnlyCB;
134 FixedLine aAreaFL;
135 FixedText aAreaFT;
136 ListBox aAreaLB;
137 FixedText aLevelFT; //content, user
138 NumericField aLevelNF; //content, user
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;
154 //illustration + table
155 RadioButton aFromCaptionsRB;
156 RadioButton aFromObjectNamesRB;
158 //illustration and tables
159 FixedText aCaptionSequenceFT;
160 ListBox aCaptionSequenceLB;
161 FixedText aDisplayTypeFT;
162 ListBox aDisplayTypeLB;
164 //all but illustration and table
165 CheckBox aTOXMarksCB;
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;
180 // object only
181 SwOLENames aFromNames;
182 SvxCheckListBox aFromObjCLB;
183 FixedLine aFromObjFL;
185 CheckBox aSequenceCB;
186 FixedText aBracketFT;
187 ListBox aBracketLB;
188 FixedLine aAuthorityFormatFL;
190 //all
191 FixedLine aSortOptionsFL;
192 FixedText aLanguageFT;
193 SvxLanguageBox aLanguageLB;
194 FixedText aSortAlgorithmFT;
195 ListBox aSortAlgorithmLB;
197 IndexEntryResource* pIndexRes;
199 Point aCBLeftPos1;
200 Point aCBLeftPos2;
201 Point aCBLeftPos3;
203 String aStyleArr[MAXLEVEL];
204 String sAutoMarkURL;
205 String sAutoMarkType;
206 String sAddStyleUser;
207 String sAddStyleContent;
209 const IndexEntrySupplierWrapper* pIndexEntryWrapper;
211 sal_Bool bFirstCall;
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*);
219 DECL_LINK(CheckBoxHdl, CheckBox* );
220 DECL_LINK(RadioButtonHdl, void *);
221 DECL_LINK(ModifyHdl, void*);
223 void ApplyTOXDescription();
224 void FillTOXDescription();
226 using SfxTabPage::ActivatePage;
227 using SfxTabPage::DeactivatePage;
229 public:
230 SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet);
231 ~SwTOXSelectTabPage();
233 virtual sal_Bool FillItemSet( SfxItemSet& );
234 virtual void Reset( const SfxItemSet& );
236 virtual void ActivatePage( const SfxItemSet& );
237 virtual int DeactivatePage( SfxItemSet* pSet = 0 );
239 static SfxTabPage* Create( Window* pParent,
240 const SfxItemSet& rAttrSet);
242 void SelectType(TOXTypes eSet); //preset TOXType, GlobalDoc
243 void SetWrtShell(SwWrtShell& rSh);
246 class SwTOXEdit;
247 class SwTOXButton;
248 class SwTOXEntryTabPage;
250 class SwTokenWindow : public Window
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;
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;
271 SwTOXEntryTabPage* m_pParent;
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* );
280 void SetActiveControl(Control* pSet);
282 Control* InsertItem(const String& rText, const SwFormToken& aToken);
283 void AdjustPositions();
284 void AdjustScrolling();
285 void MoveControls(long nOffset);
287 public:
288 SwTokenWindow(SwTOXEntryTabPage* pParent, const ResId& rResId);
289 ~SwTokenWindow();
291 void SetForm(SwForm& rForm, sal_uInt16 nLevel);
292 sal_uInt16 GetLastLevel()const {return nLevel;};
294 sal_Bool IsValid() const {return bValid;}
296 void SetInvalid() {bValid = sal_False;}
298 String GetPattern() const;
300 void SetButtonSelectedHdl(const Link& rLink)
301 { aButtonSelectedHdl = rLink;}
303 void SetModifyHdl(const Link& rLink){aModifyHdl = rLink;}
305 Control* GetActiveControl()
306 { return pActiveCtrl;}
308 void InsertAtSelection(const String& rText, const SwFormToken& aToken);
309 void RemoveControl(SwTOXButton* pDel, sal_Bool bInternalCall = sal_False);
311 sal_Bool Contains(FormTokenType) const;
313 sal_Bool DetermineLinkStart();
315 //helper for pattern buttons and edits
316 sal_Bool CreateQuickHelp(Control* pCtrl,
317 const SwFormToken& rToken, const HelpEvent& );
319 virtual void Resize();
320 virtual void GetFocus();
323 class SwTOXEntryTabPage;
325 class SwIdxTreeListBox : public SvTreeListBox
327 SwTOXEntryTabPage* pParent;
329 virtual void RequestHelp( const HelpEvent& rHEvt );
330 public:
331 SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId);
334 class SwTOXEntryTabPage : public SfxTabPage
336 FixedText aLevelFT;
337 SwIdxTreeListBox aLevelLB;
339 FixedLine aEntryFL;
340 FixedText aTokenFT;
341 SwTokenWindow aTokenWIN;
342 PushButton aAllLevelsPB;
344 PushButton aEntryNoPB;
345 PushButton aEntryPB;
346 PushButton aTabPB;
347 PushButton aChapterInfoPB;
348 PushButton aPageNoPB;
349 PushButton aHyperLinkPB;
351 ListBox aAuthFieldsLB;
352 PushButton aAuthInsertPB;
353 PushButton aAuthRemovePB;
355 FixedText aCharStyleFT;
356 ListBox aCharStyleLB; // character style of the current token
357 PushButton aEditStylePB;
359 FixedText aChapterEntryFT;
360 ListBox aChapterEntryLB; // type of chapter info
362 FixedText aNumberFormatFT;
363 ListBox aNumberFormatLB; //!< format for numbering (E#)
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;
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;
380 RadioButton aSortDocPosRB;
381 RadioButton aSortContentRB;
382 FixedLine aSortingFL;
384 FixedText aFirstKeyFT;
385 ListBox aFirstKeyLB;
386 ImageRadioButton aFirstSortUpRB;
387 ImageRadioButton aFirstSortDownRB;
389 FixedText aSecondKeyFT;
390 ListBox aSecondKeyLB;
391 ImageRadioButton aSecondSortUpRB;
392 ImageRadioButton aSecondSortDownRB;
394 FixedText aThirdKeyFT;
395 ListBox aThirdKeyLB;
396 ImageRadioButton aThirdSortUpRB;
397 ImageRadioButton aThirdSortDownRB;
399 FixedLine aSortKeyFL;
401 String sDelimStr;
402 String sLevelStr;
403 String sAuthTypeStr;
405 String sNoCharStyle;
406 String sNoCharSortKey;
407 Point aButtonPositions[5];
408 SwForm* m_pCurrentForm;
410 Point aRelToStylePos;
411 Point aRelToStyleIdxPos;
412 Size aLevelFLSize;
414 CurTOXType aLastTOXType;
415 sal_Bool bInLevelHdl;
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;
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*);
436 DECL_LINK(AllLevelsHdl, void *);
438 void EnableButtons();
439 void WriteBackLevel();
440 void UpdateDescriptor();
441 DECL_LINK(ModifyHdl, void*);
443 using SfxTabPage::ActivatePage;
444 using SfxTabPage::DeactivatePage;
446 public:
447 SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet);
448 ~SwTOXEntryTabPage();
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 );
455 static SfxTabPage* Create( Window* pParent,
456 const SfxItemSet& rAttrSet);
457 void SetWrtShell(SwWrtShell& rSh);
459 String GetLevelHelp(sal_uInt16 nLevel) const;
461 void PreTokenButtonRemoved(const SwFormToken& rToken);
464 class SwTOXStylesTabPage : public SfxTabPage
466 FixedLine aFormatFL;
467 FixedText aLevelFT2;
468 ListBox aLevelLB;
469 ImageButton aAssignBT;
470 FixedText aTemplateFT;
471 ListBox aParaLayLB;
472 PushButton aStdBT;
473 PushButton aEditStyleBT;
475 SwForm* m_pCurrentForm;
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();
484 SwForm& GetForm()
486 SwMultiTOXTabDialog* pDlg = (SwMultiTOXTabDialog*)GetTabDialog();
487 return *pDlg->GetForm(pDlg->GetCurrentTOXType());
490 using SfxTabPage::ActivatePage;
491 using SfxTabPage::DeactivatePage;
493 public:
494 SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet);
495 ~SwTOXStylesTabPage();
497 virtual sal_Bool FillItemSet( SfxItemSet& );
498 virtual void Reset( const SfxItemSet& );
500 virtual void ActivatePage( const SfxItemSet& );
501 virtual int DeactivatePage( SfxItemSet* pSet = 0 );
503 static SfxTabPage* Create( Window* pParent,
504 const SfxItemSet& rAttrSet);
508 #endif // _SWUI_CNTTAB_HXX
510 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */