1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swuicnttab.hxx,v $
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>
39 #ifndef _EDIT_HXX //autogen
40 #include <vcl/edit.hxx>
43 #ifndef _FIXED_HXX //autogen
44 #include <vcl/fixed.hxx>
47 #ifndef _FIELD_HXX //autogen
48 #include <vcl/field.hxx>
50 #include <vcl/lstbox.hxx>
51 #include <sfx2/tabdlg.hxx>
54 #include <tools/list.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>
64 namespace com
{namespace sun
{namespace star
{
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
;
86 CheckBox aShowExampleCB
;
90 SwOneExampleFrame
* pExampleFrame
;
92 SwTOXDescription
** pDescArr
; //
94 SwIndexSections_Impl
** pxIndexSectionsArr
;
96 SwTOXBase
* pParamTOXBase
;
98 CurTOXType eCurrentTOXType
;
100 String sUserDefinedIndex
;
102 USHORT nInitialTOXType
;
105 BOOL bExampleCreated
;
109 SwTOXDescription
* CreateTOXDescFromTOXBase(const SwTOXBase
*pCurTOX
);
111 DECL_LINK(CreateExample_Hdl
, void* );
112 DECL_LINK(ShowPreviewHdl
, CheckBox
*);
115 SwMultiTOXTabDialog(Window
* pParent
, const SfxItemSet
& rSet
,
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
;
155 CheckBox aReadOnlyCB
;
160 FixedText aLevelFT
; //content, user
161 NumericField aLevelNF
; //content, user
164 FixedLine aCreateFromFL
; // content, user, illustration
165 CheckBox aFromHeadingsCB
;
166 // PushButton aChapterDlgPB; //#outline level,removed by zhaojianwei
167 CheckBox aAddStylesCB
;
168 PushButton aAddStylesPB
;
170 CheckBox aFromTablesCB
;
171 CheckBox aFromFramesCB
;
172 CheckBox aFromGraphicsCB
;
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
;
192 CheckBox aCollectSameCB
;
195 CheckBox aCaseSensitiveCB
;
196 CheckBox aInitialCapsCB
;
197 CheckBox aKeyAsEntryCB
;
198 CheckBox aFromFileCB
;
199 MenuButton aAutoMarkPB
;
200 FixedLine aIdxOptionsFL
; // index only
203 SwOLENames aFromNames
;
204 SvxCheckListBox aFromObjCLB
;
205 FixedLine aFromObjFL
;
207 CheckBox aSequenceCB
;
208 FixedText aBracketFT
;
210 FixedLine aAuthorityFormatFL
;
213 FixedLine aSortOptionsFL
;
214 FixedText aLanguageFT
;
215 SvxLanguageBox aLanguageLB
;
216 FixedText aSortAlgorithmFT
;
217 ListBox aSortAlgorithmLB
;
219 IndexEntryRessource
* pIndexRes
;
225 String aStyleArr
[MAXLEVEL
];
227 String sAutoMarkType
;
228 String sAddStyleUser
;
229 String sAddStyleContent
;
231 const IndexEntrySupplierWrapper
* pIndexEntryWrapper
;
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
;
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
*)
277 class SwTOXEntryTabPage
;
279 class SwTokenWindow
: public Window
281 ImageButton aLeftScrollWin
;
282 Window aCtrlParentWin
;
283 ImageButton aRightScrollWin
;
284 TOXControlList aControlList
;
288 String aButtonTexts
[TOKEN_END
]; // Text of the buttons
289 String aButtonHelpTexts
[TOKEN_END
]; // QuickHelpText of the buttons
291 Link aButtonSelectedHdl
;
292 Control
* pActiveCtrl
;
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
);
312 SwTokenWindow(SwTOXEntryTabPage
* pParent
, const ResId
& rResId
);
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
);
356 SwIdxTreeListBox(SwTOXEntryTabPage
* pPar
, const ResId
& rResId
);
359 /* -----------------16.06.99 12:49-------------------
361 --------------------------------------------------*/
362 class SwTOXEntryTabPage
: public SfxTabPage
365 SwIdxTreeListBox aLevelLB
;
368 SwTokenWindow aTokenWIN
;
369 PushButton aAllLevelsPB
;
371 PushButton aEntryNoPB
;
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
397 MetricField aTabPosMF
; // tab stop position
398 CheckBox aAutoRightCB
;
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
;
408 RadioButton aSortDocPosRB
;
409 RadioButton aSortContentRB
;
410 FixedLine aSortingFL
;
412 FixedText aFirstKeyFT
;
414 ImageRadioButton aFirstSortUpRB
;
415 ImageRadioButton aFirstSortDownRB
;
417 FixedText aSecondKeyFT
;
418 ListBox aSecondKeyLB
;
419 ImageRadioButton aSecondSortUpRB
;
420 ImageRadioButton aSecondSortDownRB
;
422 FixedText aThirdKeyFT
;
424 ImageRadioButton aThirdSortUpRB
;
425 ImageRadioButton aThirdSortDownRB
;
427 FixedLine aSortKeyFL
;
434 String sNoCharSortKey
;
435 Point aButtonPositions
[5];
436 SwForm
* m_pCurrentForm
;
438 Point aRelToStylePos
;
439 Point aRelToStyleIdxPos
;
442 CurTOXType aLastTOXType
;
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
;
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
498 FixedText aTemplateFT
;
501 ImageButton aAssignBT
;
502 PushButton aEditStyleBT
;
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*);
517 SwMultiTOXTabDialog
* pDlg
= (SwMultiTOXTabDialog
*)GetTabDialog();
518 return *pDlg
->GetForm(pDlg
->GetCurrentTOXType());
521 using SfxTabPage::ActivatePage
;
522 using SfxTabPage::DeactivatePage
;
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