update dev300-m58
[ooovba.git] / sw / source / ui / inc / swuicnttab.hxx
blob1cc3886d7ceb6664d4eb86a02b01414dd0deaabb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swuicnttab.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SWUI_CNTTAB_HXX
31 #define _SWUI_CNTTAB_HXX
33 #include <svx/stddlg.hxx>
35 #ifndef _BUTTON_HXX //autogen
36 #include <vcl/button.hxx>
37 #endif
39 #ifndef _EDIT_HXX //autogen
40 #include <vcl/edit.hxx>
41 #endif
43 #ifndef _FIXED_HXX //autogen
44 #include <vcl/fixed.hxx>
45 #endif
47 #ifndef _FIELD_HXX //autogen
48 #include <vcl/field.hxx>
49 #endif
50 #include <vcl/lstbox.hxx>
51 #include <sfx2/tabdlg.hxx>
53 #include "tox.hxx"
54 #include <tools/list.hxx>
55 #include <toxmgr.hxx>
56 #include <svx/checklbx.hxx>
57 #include <tools/resary.hxx>
58 #include <svtools/svtreebx.hxx>
59 #include <vcl/menubtn.hxx>
60 #include <svx/langbox.hxx>
61 #include <cnttab.hxx>
62 class SwWrtShell;
63 class SwTOXMgr;
64 namespace com{namespace sun{namespace star{
65 namespace text{
66 class XTextSection;
67 class XDocumentIndex;
69 }}}
71 //-----------------------------------------------------------------------------
72 struct SwIndexSections_Impl
74 com::sun::star::uno::Reference< com::sun::star::text::XTextSection > xContainerSection;
75 com::sun::star::uno::Reference< com::sun::star::text::XDocumentIndex > xDocumentIndex;
78 //-----------------------------------------------------------------------------
79 class SwOneExampleFrame;
80 struct SwIndexSections_Impl;
82 class SwMultiTOXTabDialog : public SfxTabDialog
84 Window aExampleContainerWIN;
85 Window aExampleWIN;
86 CheckBox aShowExampleCB;
87 SwTOXMgr* pMgr;
88 SwWrtShell& rSh;
90 SwOneExampleFrame* pExampleFrame;
92 SwTOXDescription** pDescArr; //
93 SwForm** pFormArr; //
94 SwIndexSections_Impl** pxIndexSectionsArr;
96 SwTOXBase* pParamTOXBase;
98 CurTOXType eCurrentTOXType;
100 String sUserDefinedIndex;
101 USHORT nTypeCount;
102 USHORT nInitialTOXType;
104 BOOL bEditTOX;
105 BOOL bExampleCreated;
106 BOOL bGlobalFlag;
108 virtual short Ok();
109 SwTOXDescription* CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX);
111 DECL_LINK(CreateExample_Hdl, void* );
112 DECL_LINK(ShowPreviewHdl, CheckBox*);
114 public:
115 SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet,
116 SwWrtShell &rShell,
117 SwTOXBase* pCurTOX, USHORT nToxType = USHRT_MAX,
118 BOOL bGlobal = FALSE);
119 ~SwMultiTOXTabDialog();
121 virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
123 SwForm* GetForm(CurTOXType eType);
125 CurTOXType GetCurrentTOXType() const { return eCurrentTOXType;}
126 void SetCurrentTOXType(CurTOXType eSet)
128 eCurrentTOXType = eSet;
131 void UpdateExample();
132 BOOL IsTOXEditMode() const { return bEditTOX;}
134 SwWrtShell& GetWrtShell() {return rSh;}
136 SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes);
137 void CreateOrUpdateExample(
138 TOXTypes nTOXIndex, USHORT nPage = 0, USHORT nCurLevel = USHRT_MAX);
140 static BOOL IsNoNum(SwWrtShell& rSh, const String& rName);
142 /* -----------------14.07.99 12:17-------------------
144 --------------------------------------------------*/
145 class IndexEntryRessource;
146 class IndexEntrySupplierWrapper;
148 class SwTOXSelectTabPage : public SfxTabPage
150 FixedLine aTypeTitleFL;
151 FixedText aTitleFT;
152 Edit aTitleED;
153 FixedText aTypeFT;
154 ListBox aTypeLB;
155 CheckBox aReadOnlyCB;
157 FixedLine aAreaFL;
158 FixedText aAreaFT;
159 ListBox aAreaLB;
160 FixedText aLevelFT; //content, user
161 NumericField aLevelNF; //content, user
163 //content
164 FixedLine aCreateFromFL; // content, user, illustration
165 CheckBox aFromHeadingsCB;
166 // PushButton aChapterDlgPB; //#outline level,removed by zhaojianwei
167 CheckBox aAddStylesCB;
168 PushButton aAddStylesPB;
169 //user
170 CheckBox aFromTablesCB;
171 CheckBox aFromFramesCB;
172 CheckBox aFromGraphicsCB;
173 CheckBox aFromOLECB;
174 CheckBox aLevelFromChapterCB;
176 //illustration + table
177 RadioButton aFromCaptionsRB;
178 RadioButton aFromObjectNamesRB;
180 //illustration and tables
181 FixedText aCaptionSequenceFT;
182 ListBox aCaptionSequenceLB;
183 FixedText aDisplayTypeFT;
184 ListBox aDisplayTypeLB;
186 //all but illustration and table
187 CheckBox aTOXMarksCB;
191 //index only
192 CheckBox aCollectSameCB;
193 CheckBox aUseFFCB;
194 CheckBox aUseDashCB;
195 CheckBox aCaseSensitiveCB;
196 CheckBox aInitialCapsCB;
197 CheckBox aKeyAsEntryCB;
198 CheckBox aFromFileCB;
199 MenuButton aAutoMarkPB;
200 FixedLine aIdxOptionsFL; // index only
202 // object only
203 SwOLENames aFromNames;
204 SvxCheckListBox aFromObjCLB;
205 FixedLine aFromObjFL;
207 CheckBox aSequenceCB;
208 FixedText aBracketFT;
209 ListBox aBracketLB;
210 FixedLine aAuthorityFormatFL;
212 //all
213 FixedLine aSortOptionsFL;
214 FixedText aLanguageFT;
215 SvxLanguageBox aLanguageLB;
216 FixedText aSortAlgorithmFT;
217 ListBox aSortAlgorithmLB;
219 IndexEntryRessource* pIndexRes;
221 Point aCBLeftPos1;
222 Point aCBLeftPos2;
223 Point aCBLeftPos3;
225 String aStyleArr[MAXLEVEL];
226 String sAutoMarkURL;
227 String sAutoMarkType;
228 String sAddStyleUser;
229 String sAddStyleContent;
231 const IndexEntrySupplierWrapper* pIndexEntryWrapper;
233 BOOL bFirstCall;
235 DECL_LINK(TOXTypeHdl, ListBox* );
236 DECL_LINK(TOXAreaHdl, ListBox* );
237 // DECL_LINK(ChapterHdl, PushButton* ); //#outline level,removed by zhaojianwei
238 DECL_LINK(AddStylesHdl, PushButton* );
239 DECL_LINK(MenuEnableHdl, Menu*);
240 DECL_LINK(MenuExecuteHdl, Menu*);
241 DECL_LINK(LanguageHdl, ListBox*);
243 DECL_LINK(CheckBoxHdl, CheckBox* );
244 DECL_LINK(RadioButtonHdl, RadioButton* );
245 DECL_LINK(ModifyHdl, void*);
247 void ApplyTOXDescription();
248 void FillTOXDescription();
250 using SfxTabPage::ActivatePage;
251 using SfxTabPage::DeactivatePage;
253 public:
254 SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet);
255 ~SwTOXSelectTabPage();
257 virtual BOOL FillItemSet( SfxItemSet& );
258 virtual void Reset( const SfxItemSet& );
260 virtual void ActivatePage( const SfxItemSet& );
261 virtual int DeactivatePage( SfxItemSet* pSet = 0 );
263 static SfxTabPage* Create( Window* pParent,
264 const SfxItemSet& rAttrSet);
266 void SelectType(TOXTypes eSet); //preset TOXType, GlobalDoc
267 void SetWrtShell(SwWrtShell& rSh);
269 /* -----------------16.06.99 08:33-------------------
271 --------------------------------------------------*/
273 DECLARE_LIST(TOXControlList, Control*)
275 class SwTOXEdit;
276 class SwTOXButton;
277 class SwTOXEntryTabPage;
279 class SwTokenWindow : public Window
281 ImageButton aLeftScrollWin;
282 Window aCtrlParentWin;
283 ImageButton aRightScrollWin;
284 TOXControlList aControlList;
285 SwForm* pForm;
286 USHORT nLevel;
287 BOOL bValid;
288 String aButtonTexts[TOKEN_END]; // Text of the buttons
289 String aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons
290 String sCharStyle;
291 Link aButtonSelectedHdl;
292 Control* pActiveCtrl;
293 Link aModifyHdl;
295 SwTOXEntryTabPage* m_pParent;
297 DECL_LINK(EditResize, Edit*);
298 DECL_LINK(NextItemHdl, SwTOXEdit* );
299 DECL_LINK(TbxFocusHdl, SwTOXEdit* );
300 DECL_LINK(NextItemBtnHdl, SwTOXButton* );
301 DECL_LINK(TbxFocusBtnHdl, SwTOXButton* );
302 DECL_LINK(ScrollHdl, ImageButton* );
304 void SetActiveControl(Control* pSet);
306 Control* InsertItem(const String& rText, const SwFormToken& aToken);
307 void AdjustPositions();
308 void AdjustScrolling();
309 void MoveControls(long nOffset);
311 public:
312 SwTokenWindow(SwTOXEntryTabPage* pParent, const ResId& rResId);
313 ~SwTokenWindow();
315 void SetForm(SwForm& rForm, USHORT nLevel);
316 USHORT GetLastLevel()const {return nLevel;};
318 BOOL IsValid() const {return bValid;}
320 void SetInvalid() {bValid = FALSE;}
322 String GetPattern() const;
324 void SetButtonSelectedHdl(const Link& rLink)
325 { aButtonSelectedHdl = rLink;}
327 void SetModifyHdl(const Link& rLink){aModifyHdl = rLink;}
329 Control* GetActiveControl()
330 { return pActiveCtrl;}
332 void InsertAtSelection(const String& rText, const SwFormToken& aToken);
333 void RemoveControl(SwTOXButton* pDel, BOOL bInternalCall = FALSE);
335 BOOL Contains(FormTokenType) const;
337 BOOL DetermineLinkStart();
339 //helper for pattern buttons and edits
340 BOOL CreateQuickHelp(Control* pCtrl,
341 const SwFormToken& rToken, const HelpEvent& );
343 virtual void Resize();
344 virtual void GetFocus();
346 /* -----------------------------23.12.99 14:16--------------------------------
348 ---------------------------------------------------------------------------*/
349 class SwTOXEntryTabPage;
350 class SwIdxTreeListBox : public SvTreeListBox
352 SwTOXEntryTabPage* pParent;
354 virtual void RequestHelp( const HelpEvent& rHEvt );
355 public:
356 SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId);
359 /* -----------------16.06.99 12:49-------------------
361 --------------------------------------------------*/
362 class SwTOXEntryTabPage : public SfxTabPage
364 FixedText aLevelFT;
365 SwIdxTreeListBox aLevelLB;
367 FixedText aTokenFT;
368 SwTokenWindow aTokenWIN;
369 PushButton aAllLevelsPB;
371 PushButton aEntryNoPB;
372 PushButton aEntryPB;
373 PushButton aTabPB;
374 PushButton aChapterInfoPB;
375 PushButton aPageNoPB;
376 PushButton aHyperLinkPB;
378 ListBox aAuthFieldsLB;
379 PushButton aAuthInsertPB;
380 PushButton aAuthRemovePB;
382 FixedText aCharStyleFT;
383 ListBox aCharStyleLB; // character style of the current token
384 PushButton aEditStylePB;
386 FixedText aChapterEntryFT;
387 ListBox aChapterEntryLB; // type of chapter info
389 FixedText aNumberFormatFT;
390 ListBox aNumberFormatLB; //!< format for numbering (E#)
392 FixedText aEntryOutlineLevelFT; //!< Fixed text, for i53420
393 NumericField aEntryOutlineLevelNF; //!< level to evaluate outline level to, for i53420
394 FixedText aFillCharFT;
395 ComboBox aFillCharCB; // fill char for tab stop
396 FixedText aTabPosFT;
397 MetricField aTabPosMF; // tab stop position
398 CheckBox aAutoRightCB;
399 FixedLine aEntryFL;
401 CheckBox aRelToStyleCB; // position relative to the right margin of the para style
402 FixedText aMainEntryStyleFT;
403 ListBox aMainEntryStyleLB; // character style of main entries in indexes
404 CheckBox aAlphaDelimCB;
405 CheckBox aCommaSeparatedCB;
406 FixedLine aFormatFL;
408 RadioButton aSortDocPosRB;
409 RadioButton aSortContentRB;
410 FixedLine aSortingFL;
412 FixedText aFirstKeyFT;
413 ListBox aFirstKeyLB;
414 ImageRadioButton aFirstSortUpRB;
415 ImageRadioButton aFirstSortDownRB;
417 FixedText aSecondKeyFT;
418 ListBox aSecondKeyLB;
419 ImageRadioButton aSecondSortUpRB;
420 ImageRadioButton aSecondSortDownRB;
422 FixedText aThirdKeyFT;
423 ListBox aThirdKeyLB;
424 ImageRadioButton aThirdSortUpRB;
425 ImageRadioButton aThirdSortDownRB;
427 FixedLine aSortKeyFL;
429 String sDelimStr;
430 String sLevelStr;
431 String sAuthTypeStr;
433 String sNoCharStyle;
434 String sNoCharSortKey;
435 Point aButtonPositions[5];
436 SwForm* m_pCurrentForm;
438 Point aRelToStylePos;
439 Point aRelToStyleIdxPos;
440 Size aLevelFLSize;
442 CurTOXType aLastTOXType;
443 BOOL bInLevelHdl;
445 Point aChapterEntryFTPosition; //!< holds position of ChapterEntryFT control,
446 //to be used in moving the element among different tokens
447 Point aEntryOutlineLevelFTPosition;//!< holds position ofrEntryOutlineLevelFT control
448 sal_Int32 nBiasToEntryPoint;
450 DECL_LINK(StyleSelectHdl, ListBox*);
451 DECL_LINK(EditStyleHdl, PushButton*);
452 DECL_LINK(InsertTokenHdl, PushButton*);
453 DECL_LINK(LevelHdl, SvTreeListBox*);
454 DECL_LINK(AutoRightHdl, CheckBox*);
455 DECL_LINK(TokenSelectedHdl, SwFormToken*);
456 DECL_LINK(TabPosHdl, MetricField*);
457 DECL_LINK(FillCharHdl, ComboBox*);
458 DECL_LINK(RemoveInsertAuthHdl, PushButton*);
459 DECL_LINK(SortKeyHdl, RadioButton*);
460 DECL_LINK(ChapterInfoHdl, ListBox*);
461 DECL_LINK(ChapterInfoOutlineHdl, NumericField*);
462 DECL_LINK(NumberFormatHdl, ListBox*);
464 DECL_LINK(AllLevelsHdl, PushButton*);
466 void EnableButtons();
467 void WriteBackLevel();
468 void UpdateDescriptor();
469 DECL_LINK(ModifyHdl, void*);
471 using SfxTabPage::ActivatePage;
472 using SfxTabPage::DeactivatePage;
474 public:
475 SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet);
476 ~SwTOXEntryTabPage();
478 virtual BOOL FillItemSet( SfxItemSet& );
479 virtual void Reset( const SfxItemSet& );
480 virtual void ActivatePage( const SfxItemSet& );
481 virtual int DeactivatePage( SfxItemSet* pSet = 0 );
483 static SfxTabPage* Create( Window* pParent,
484 const SfxItemSet& rAttrSet);
485 void SetWrtShell(SwWrtShell& rSh);
487 String GetLevelHelp(USHORT nLevel) const;
489 void PreTokenButtonRemoved(const SwFormToken& rToken);
491 /* -----------------05.07.99 13:00-------------------
493 --------------------------------------------------*/
494 class SwTOXStylesTabPage : public SfxTabPage
496 FixedText aLevelFT2;
497 ListBox aLevelLB;
498 FixedText aTemplateFT;
499 ListBox aParaLayLB;
500 PushButton aStdBT;
501 ImageButton aAssignBT;
502 PushButton aEditStyleBT;
503 FixedLine aFormatFL;
505 SwForm* m_pCurrentForm;
506 // void UpdatePattern();
508 DECL_LINK( EditStyleHdl, Button *);
509 DECL_LINK( StdHdl, Button * );
510 DECL_LINK( EnableSelectHdl, ListBox * );
511 DECL_LINK( DoubleClickHdl, Button * );
512 DECL_LINK( AssignHdl, Button * );
513 DECL_LINK( ModifyHdl, void*);
515 SwForm& GetForm()
517 SwMultiTOXTabDialog* pDlg = (SwMultiTOXTabDialog*)GetTabDialog();
518 return *pDlg->GetForm(pDlg->GetCurrentTOXType());
521 using SfxTabPage::ActivatePage;
522 using SfxTabPage::DeactivatePage;
524 public:
525 SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet);
526 ~SwTOXStylesTabPage();
528 virtual BOOL FillItemSet( SfxItemSet& );
529 virtual void Reset( const SfxItemSet& );
531 virtual void ActivatePage( const SfxItemSet& );
532 virtual int DeactivatePage( SfxItemSet* pSet = 0 );
534 static SfxTabPage* Create( Window* pParent,
535 const SfxItemSet& rAttrSet);
539 #endif // _SWUI_CNTTAB_HXX