xref: /trunk/main/sw/source/ui/inc/swuicnttab.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SWUI_CNTTAB_HXX
28 #define _SWUI_CNTTAB_HXX
29 
30 #include <svx/stddlg.hxx>
31 
32 #ifndef _BUTTON_HXX //autogen
33 #include <vcl/button.hxx>
34 #endif
35 
36 #ifndef _EDIT_HXX //autogen
37 #include <vcl/edit.hxx>
38 #endif
39 
40 #ifndef _FIXED_HXX //autogen
41 #include <vcl/fixed.hxx>
42 #endif
43 
44 #ifndef _FIELD_HXX //autogen
45 #include <vcl/field.hxx>
46 #endif
47 #include <vcl/lstbox.hxx>
48 #include <sfx2/tabdlg.hxx>
49 
50 #include "tox.hxx"
51 #include <tools/list.hxx>
52 #include <toxmgr.hxx>
53 #include <svx/checklbx.hxx>
54 #include <tools/resary.hxx>
55 #include <svtools/svtreebx.hxx>
56 #include <vcl/menubtn.hxx>
57 #include <svx/langbox.hxx>
58 #include <cnttab.hxx>
59 class SwWrtShell;
60 class SwTOXMgr;
61 namespace com{namespace sun{namespace star{
62     namespace text{
63         class XTextSection;
64         class XDocumentIndex;
65     }
66 }}}
67 
68 //-----------------------------------------------------------------------------
69 struct SwIndexSections_Impl
70 {
71     com::sun::star::uno::Reference< com::sun::star::text::XTextSection >    xContainerSection;
72     com::sun::star::uno::Reference< com::sun::star::text::XDocumentIndex >    xDocumentIndex;
73 };
74 
75 //-----------------------------------------------------------------------------
76 class SwOneExampleFrame;
77 struct SwIndexSections_Impl;
78 
79 class SwMultiTOXTabDialog : public SfxTabDialog
80 {
81     Window                  aExampleContainerWIN;
82     Window                  aExampleWIN;
83     CheckBox                aShowExampleCB;
84     SwTOXMgr*               pMgr;
85     SwWrtShell&             rSh;
86 
87     SwOneExampleFrame*      pExampleFrame;
88 
89     SwTOXDescription**      pDescArr; //
90     SwForm**                pFormArr; //
91     SwIndexSections_Impl**  pxIndexSectionsArr;
92 
93     SwTOXBase*              pParamTOXBase;
94 
95     CurTOXType              eCurrentTOXType;
96 
97     String                  sUserDefinedIndex;
98     sal_uInt16                  nTypeCount;
99     sal_uInt16                  nInitialTOXType;
100 
101     sal_Bool                    bEditTOX;
102     sal_Bool                    bExampleCreated;
103     sal_Bool                    bGlobalFlag;
104 
105     virtual short       Ok();
106     SwTOXDescription*   CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX);
107 
108     DECL_LINK(CreateExample_Hdl, void* );
109     DECL_LINK(ShowPreviewHdl, CheckBox*);
110 
111 public:
112     SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet,
113                         SwWrtShell &rShell,
114                         SwTOXBase* pCurTOX, sal_uInt16 nToxType = USHRT_MAX,
115                         sal_Bool bGlobal = sal_False);
116     ~SwMultiTOXTabDialog();
117 
118     virtual void        PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
119 
120     SwForm*             GetForm(CurTOXType eType);
121 
122     CurTOXType          GetCurrentTOXType() const { return eCurrentTOXType;}
123     void                SetCurrentTOXType(CurTOXType    eSet)
124                                 {
125                                     eCurrentTOXType = eSet;
126                                 }
127 
128     void                UpdateExample();
129     sal_Bool                IsTOXEditMode() const { return bEditTOX;}
130 
131     SwWrtShell&         GetWrtShell() {return rSh;}
132 
133     SwTOXDescription&   GetTOXDescription(CurTOXType eTOXTypes);
134     void                CreateOrUpdateExample(
135                             TOXTypes nTOXIndex, sal_uInt16 nPage = 0, sal_uInt16 nCurLevel = USHRT_MAX);
136 
137     static sal_Bool IsNoNum(SwWrtShell& rSh, const String& rName);
138 };
139 /* -----------------14.07.99 12:17-------------------
140 
141  --------------------------------------------------*/
142 class IndexEntryRessource;
143 class IndexEntrySupplierWrapper;
144 
145 class SwTOXSelectTabPage : public SfxTabPage
146 {
147     FixedLine       aTypeTitleFL;
148     FixedText       aTitleFT;
149     Edit            aTitleED;
150     FixedText       aTypeFT;
151     ListBox         aTypeLB;
152     CheckBox        aReadOnlyCB;
153 
154     FixedLine       aAreaFL;
155     FixedText       aAreaFT;
156     ListBox         aAreaLB;
157     FixedText       aLevelFT;   //content, user
158     NumericField    aLevelNF;   //content, user
159 
160     //content
161     FixedLine       aCreateFromFL;  // content, user, illustration
162     CheckBox        aFromHeadingsCB;
163 //  PushButton      aChapterDlgPB;  //#outline level,removed by zhaojianwei
164     CheckBox        aAddStylesCB;
165     PushButton      aAddStylesPB;
166     Point           aAddStylesPosDef;
167     Point           aAddStylesPosUser;
168     //user
169     CheckBox        aFromTablesCB;
170     CheckBox        aFromFramesCB;
171     CheckBox        aFromGraphicsCB;
172     CheckBox        aFromOLECB;
173     CheckBox        aLevelFromChapterCB;
174 
175     //illustration + table
176     RadioButton     aFromCaptionsRB;
177     RadioButton     aFromObjectNamesRB;
178 
179     //illustration and tables
180     FixedText       aCaptionSequenceFT;
181     ListBox         aCaptionSequenceLB;
182     FixedText       aDisplayTypeFT;
183     ListBox         aDisplayTypeLB;
184 
185     //all but illustration and table
186     CheckBox        aTOXMarksCB;
187 
188     //
189 
190     //index only
191     FixedLine       aIdxOptionsFL;
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 
201     // object only
202     SwOLENames      aFromNames;
203     SvxCheckListBox aFromObjCLB;
204     FixedLine       aFromObjFL;
205 
206     CheckBox        aSequenceCB;
207     FixedText       aBracketFT;
208     ListBox         aBracketLB;
209     FixedLine       aAuthorityFormatFL;
210 
211     //all
212     FixedLine       aSortOptionsFL;
213     FixedText       aLanguageFT;
214     SvxLanguageBox  aLanguageLB;
215     FixedText       aSortAlgorithmFT;
216     ListBox         aSortAlgorithmLB;
217 
218     IndexEntryRessource* pIndexRes;
219 
220     Point           aCBLeftPos1;
221     Point           aCBLeftPos2;
222     Point           aCBLeftPos3;
223 
224     String          aStyleArr[MAXLEVEL];
225     String          sAutoMarkURL;
226     String          sAutoMarkType;
227     String          sAddStyleUser;
228     String          sAddStyleContent;
229 
230     const IndexEntrySupplierWrapper* pIndexEntryWrapper;
231 
232     sal_Bool            bFirstCall;
233 
234     DECL_LINK(TOXTypeHdl,   ListBox* );
235     DECL_LINK(TOXAreaHdl,   ListBox* );
236 //  DECL_LINK(ChapterHdl,   PushButton* ); //#outline level,removed by zhaojianwei
237     DECL_LINK(AddStylesHdl, PushButton* );
238     DECL_LINK(MenuEnableHdl, Menu*);
239     DECL_LINK(MenuExecuteHdl, Menu*);
240     DECL_LINK(LanguageHdl, ListBox*);
241 
242     DECL_LINK(CheckBoxHdl,  CheckBox*   );
243     DECL_LINK(RadioButtonHdl, RadioButton* );
244     DECL_LINK(ModifyHdl, void*);
245 
246     void    ApplyTOXDescription();
247     void    FillTOXDescription();
248 
249     using SfxTabPage::ActivatePage;
250     using SfxTabPage::DeactivatePage;
251 
252 public:
253     SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet);
254     ~SwTOXSelectTabPage();
255 
256     virtual sal_Bool        FillItemSet( SfxItemSet& );
257     virtual void        Reset( const SfxItemSet& );
258 
259     virtual void        ActivatePage( const SfxItemSet& );
260     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
261 
262     static SfxTabPage*  Create( Window* pParent,
263                                 const SfxItemSet& rAttrSet);
264 
265     void                SelectType(TOXTypes eSet);  //preset TOXType, GlobalDoc
266     void                SetWrtShell(SwWrtShell& rSh);
267 };
268 /* -----------------16.06.99 08:33-------------------
269 
270  --------------------------------------------------*/
271 
272 DECLARE_LIST(TOXControlList, Control*)
273 
274 class SwTOXEdit;
275 class SwTOXButton;
276 class SwTOXEntryTabPage;
277 
278 class SwTokenWindow : public Window
279 {
280     ImageButton     aLeftScrollWin;
281     Window          aCtrlParentWin;
282     ImageButton     aRightScrollWin;
283     TOXControlList  aControlList;
284     SwForm*         pForm;
285     sal_uInt16          nLevel;
286     sal_Bool            bValid;
287     String          aButtonTexts[TOKEN_END]; // Text of the buttons
288     String          aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons
289     String          sCharStyle;
290     Link            aButtonSelectedHdl;
291     Control*        pActiveCtrl;
292     Link            aModifyHdl;
293 
294     SwTOXEntryTabPage*  m_pParent;
295 
296     DECL_LINK(EditResize, Edit*);
297     DECL_LINK(NextItemHdl, SwTOXEdit* );
298     DECL_LINK(TbxFocusHdl, SwTOXEdit* );
299     DECL_LINK(NextItemBtnHdl, SwTOXButton* );
300     DECL_LINK(TbxFocusBtnHdl, SwTOXButton* );
301     DECL_LINK(ScrollHdl, ImageButton* );
302 
303     void    SetActiveControl(Control* pSet);
304 
305     Control*    InsertItem(const String& rText, const SwFormToken& aToken);
306     void        AdjustPositions();
307     void        AdjustScrolling();
308     void        MoveControls(long nOffset);
309 
310 public:
311     SwTokenWindow(SwTOXEntryTabPage* pParent, const ResId& rResId);
312     ~SwTokenWindow();
313 
314     void        SetForm(SwForm& rForm, sal_uInt16 nLevel);
315     sal_uInt16      GetLastLevel()const {return nLevel;};
316 
317     sal_Bool        IsValid() const {return bValid;}
318 
319     void        SetInvalid() {bValid = sal_False;}
320 
321     String      GetPattern() const;
322 
323     void        SetButtonSelectedHdl(const Link& rLink)
324                 { aButtonSelectedHdl = rLink;}
325 
326     void        SetModifyHdl(const Link& rLink){aModifyHdl = rLink;}
327 
328     Control*    GetActiveControl()
329                     { return pActiveCtrl;}
330 
331     void        InsertAtSelection(const String& rText, const SwFormToken& aToken);
332     void        RemoveControl(SwTOXButton* pDel, sal_Bool bInternalCall = sal_False);
333 
334     sal_Bool        Contains(FormTokenType) const;
335 
336     sal_Bool        DetermineLinkStart();
337 
338     //helper for pattern buttons and edits
339     sal_Bool        CreateQuickHelp(Control* pCtrl,
340                     const SwFormToken& rToken, const HelpEvent& );
341 
342     virtual void        Resize();
343     virtual void        GetFocus();
344 };
345 /* -----------------------------23.12.99 14:16--------------------------------
346 
347  ---------------------------------------------------------------------------*/
348 class SwTOXEntryTabPage;
349 class SwIdxTreeListBox : public SvTreeListBox
350 {
351     SwTOXEntryTabPage* pParent;
352 
353     virtual void    RequestHelp( const HelpEvent& rHEvt );
354 public:
355     SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId);
356 };
357 
358 /* -----------------16.06.99 12:49-------------------
359 
360  --------------------------------------------------*/
361 class SwTOXEntryTabPage : public SfxTabPage
362 {
363     FixedText           aLevelFT;
364     SwIdxTreeListBox    aLevelLB;
365 
366     FixedLine       aEntryFL;
367     FixedText       aTokenFT;
368     SwTokenWindow   aTokenWIN;
369     PushButton      aAllLevelsPB;
370 
371     PushButton      aEntryNoPB;
372     PushButton      aEntryPB;
373     PushButton      aTabPB;
374     PushButton      aChapterInfoPB;
375     PushButton      aPageNoPB;
376     PushButton      aHyperLinkPB;
377 
378     ListBox         aAuthFieldsLB;
379     PushButton      aAuthInsertPB;
380     PushButton      aAuthRemovePB;
381 
382     FixedText       aCharStyleFT;
383     ListBox         aCharStyleLB;       // character style of the current token
384     PushButton      aEditStylePB;
385 
386     FixedText       aChapterEntryFT;
387     ListBox         aChapterEntryLB;    // type of chapter info
388 
389     FixedText       aNumberFormatFT;
390     ListBox         aNumberFormatLB;    //!< format for numbering (E#)
391 
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       aFormatFL;
400 
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 
407     RadioButton     aSortDocPosRB;
408     RadioButton     aSortContentRB;
409     FixedLine       aSortingFL;
410 
411     FixedText           aFirstKeyFT;
412     ListBox             aFirstKeyLB;
413     ImageRadioButton    aFirstSortUpRB;
414     ImageRadioButton    aFirstSortDownRB;
415 
416     FixedText           aSecondKeyFT;
417     ListBox             aSecondKeyLB;
418     ImageRadioButton    aSecondSortUpRB;
419     ImageRadioButton    aSecondSortDownRB;
420 
421     FixedText           aThirdKeyFT;
422     ListBox             aThirdKeyLB;
423     ImageRadioButton    aThirdSortUpRB;
424     ImageRadioButton    aThirdSortDownRB;
425 
426     FixedLine       aSortKeyFL;
427 
428     String          sDelimStr;
429     String          sLevelStr;
430     String          sAuthTypeStr;
431 
432     String          sNoCharStyle;
433     String          sNoCharSortKey;
434     Point           aButtonPositions[5];
435     SwForm*         m_pCurrentForm;
436 
437     Point           aRelToStylePos;
438     Point           aRelToStyleIdxPos;
439     Size            aLevelFLSize;
440 
441     CurTOXType      aLastTOXType;
442     sal_Bool            bInLevelHdl;
443 
444     Point           aChapterEntryFTPosition; //!< holds position of ChapterEntryFT control,
445                                              //to be used in moving the element among different tokens
446     Point           aEntryOutlineLevelFTPosition;//!< holds position ofrEntryOutlineLevelFT control
447     sal_Int32       nBiasToEntryPoint;
448 
449     DECL_LINK(StyleSelectHdl, ListBox*);
450     DECL_LINK(EditStyleHdl, PushButton*);
451     DECL_LINK(InsertTokenHdl, PushButton*);
452     DECL_LINK(LevelHdl, SvTreeListBox*);
453     DECL_LINK(AutoRightHdl, CheckBox*);
454     DECL_LINK(TokenSelectedHdl, SwFormToken*);
455     DECL_LINK(TabPosHdl, MetricField*);
456     DECL_LINK(FillCharHdl, ComboBox*);
457     DECL_LINK(RemoveInsertAuthHdl, PushButton*);
458     DECL_LINK(SortKeyHdl, RadioButton*);
459     DECL_LINK(ChapterInfoHdl, ListBox*);
460     DECL_LINK(ChapterInfoOutlineHdl, NumericField*);
461     DECL_LINK(NumberFormatHdl, ListBox*);
462 
463     DECL_LINK(AllLevelsHdl, PushButton*);
464 
465     void            EnableButtons();
466     void            WriteBackLevel();
467     void            UpdateDescriptor();
468     DECL_LINK(ModifyHdl, void*);
469 
470     using SfxTabPage::ActivatePage;
471     using SfxTabPage::DeactivatePage;
472 
473 public:
474     SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet);
475     ~SwTOXEntryTabPage();
476 
477     virtual sal_Bool        FillItemSet( SfxItemSet& );
478     virtual void        Reset( const SfxItemSet& );
479     virtual void        ActivatePage( const SfxItemSet& );
480     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
481 
482     static SfxTabPage*  Create( Window* pParent,
483                                 const SfxItemSet& rAttrSet);
484     void                SetWrtShell(SwWrtShell& rSh);
485 
486     String              GetLevelHelp(sal_uInt16 nLevel) const;
487 
488     void                PreTokenButtonRemoved(const SwFormToken& rToken);
489 };
490 /* -----------------05.07.99 13:00-------------------
491 
492  --------------------------------------------------*/
493 class SwTOXStylesTabPage : public SfxTabPage
494 {
495     FixedLine       aFormatFL;
496     FixedText       aLevelFT2;
497     ListBox         aLevelLB;
498     ImageButton     aAssignBT;
499     FixedText       aTemplateFT;
500     ListBox         aParaLayLB;
501     PushButton      aStdBT;
502     PushButton      aEditStyleBT;
503 
504     SwForm*         m_pCurrentForm;
505 //  void            UpdatePattern();
506 
507     DECL_LINK( EditStyleHdl, Button *);
508     DECL_LINK( StdHdl, Button * );
509     DECL_LINK( EnableSelectHdl, ListBox * );
510     DECL_LINK( DoubleClickHdl, Button * );
511     DECL_LINK( AssignHdl, Button * );
512     DECL_LINK( ModifyHdl, void*);
513 
514     SwForm&     GetForm()
515         {
516             SwMultiTOXTabDialog* pDlg = (SwMultiTOXTabDialog*)GetTabDialog();
517             return *pDlg->GetForm(pDlg->GetCurrentTOXType());
518         }
519 
520     using SfxTabPage::ActivatePage;
521     using SfxTabPage::DeactivatePage;
522 
523 public:
524     SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet);
525     ~SwTOXStylesTabPage();
526 
527     virtual sal_Bool        FillItemSet( SfxItemSet& );
528     virtual void        Reset( const SfxItemSet& );
529 
530     virtual void        ActivatePage( const SfxItemSet& );
531     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
532 
533     static SfxTabPage*  Create( Window* pParent,
534                                 const SfxItemSet& rAttrSet);
535 
536 };
537 
538 #endif // _SWUI_CNTTAB_HXX
539 
540