xref: /AOO41X/main/sw/source/ui/inc/swuicnttab.hxx (revision 4d7c9de063a797b8b4f3d45e3561e82ad1f8ef1f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SWUI_CNTTAB_HXX
24 #define _SWUI_CNTTAB_HXX
25 
26 #include <svx/stddlg.hxx>
27 
28 #ifndef _BUTTON_HXX //autogen
29 #include <vcl/button.hxx>
30 #endif
31 
32 #ifndef _EDIT_HXX //autogen
33 #include <vcl/edit.hxx>
34 #endif
35 
36 #ifndef _FIXED_HXX //autogen
37 #include <vcl/fixed.hxx>
38 #endif
39 
40 #ifndef _FIELD_HXX //autogen
41 #include <vcl/field.hxx>
42 #endif
43 #include <vcl/lstbox.hxx>
44 #include <sfx2/tabdlg.hxx>
45 
46 #include "tox.hxx"
47 #include <tools/list.hxx>
48 #include <toxmgr.hxx>
49 #include <svx/checklbx.hxx>
50 #include <tools/resary.hxx>
51 #include <svtools/svtreebx.hxx>
52 #include <vcl/menubtn.hxx>
53 #include <svx/langbox.hxx>
54 #include <cnttab.hxx>
55 class SwWrtShell;
56 class SwTOXMgr;
57 namespace com{namespace sun{namespace star{
58     namespace text{
59         class XTextSection;
60         class XDocumentIndex;
61     }
62 }}}
63 
64 //-----------------------------------------------------------------------------
65 struct SwIndexSections_Impl
66 {
67     com::sun::star::uno::Reference< com::sun::star::text::XTextSection >    xContainerSection;
68     com::sun::star::uno::Reference< com::sun::star::text::XDocumentIndex >    xDocumentIndex;
69 };
70 
71 //-----------------------------------------------------------------------------
72 class SwOneExampleFrame;
73 struct SwIndexSections_Impl;
74 
75 class SwMultiTOXTabDialog : public SfxTabDialog
76 {
77     Window                  aExampleContainerWIN;
78     Window                  aExampleWIN;
79     CheckBox                aShowExampleCB;
80     SwTOXMgr*               pMgr;
81     SwWrtShell&             rSh;
82 
83     SwOneExampleFrame*      pExampleFrame;
84 
85     SwTOXDescription**      pDescArr; //
86     SwForm**                pFormArr; //
87     SwIndexSections_Impl**  pxIndexSectionsArr;
88 
89     SwTOXBase*              pParamTOXBase;
90 
91     CurTOXType              eCurrentTOXType;
92 
93     String                  sUserDefinedIndex;
94     sal_uInt16                  nTypeCount;
95     sal_uInt16                  nInitialTOXType;
96 
97     sal_Bool                    bEditTOX;
98     sal_Bool                    bExampleCreated;
99     sal_Bool                    bGlobalFlag;
100 
101     virtual short       Ok();
102     SwTOXDescription*   CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX);
103 
104     DECL_LINK(CreateExample_Hdl, void* );
105     DECL_LINK(ShowPreviewHdl, CheckBox*);
106 
107 public:
108     SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet,
109                         SwWrtShell &rShell,
110                         SwTOXBase* pCurTOX, sal_uInt16 nToxType = USHRT_MAX,
111                         sal_Bool bGlobal = sal_False);
112     ~SwMultiTOXTabDialog();
113 
114     virtual void        PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
115 
116     SwForm*             GetForm(CurTOXType eType);
117 
GetCurrentTOXType() const118     CurTOXType          GetCurrentTOXType() const { return eCurrentTOXType;}
SetCurrentTOXType(CurTOXType eSet)119     void                SetCurrentTOXType(CurTOXType    eSet)
120                                 {
121                                     eCurrentTOXType = eSet;
122                                 }
123 
124     void                UpdateExample();
IsTOXEditMode() const125     sal_Bool                IsTOXEditMode() const { return bEditTOX;}
126 
GetWrtShell()127     SwWrtShell&         GetWrtShell() {return rSh;}
128 
129     SwTOXDescription&   GetTOXDescription(CurTOXType eTOXTypes);
130     void                CreateOrUpdateExample(
131                             TOXTypes nTOXIndex, sal_uInt16 nPage = 0, sal_uInt16 nCurLevel = USHRT_MAX);
132 
133     static sal_Bool IsNoNum(SwWrtShell& rSh, const String& rName);
134 };
135 /* -----------------14.07.99 12:17-------------------
136 
137  --------------------------------------------------*/
138 class IndexEntryRessource;
139 class IndexEntrySupplierWrapper;
140 
141 class SwTOXSelectTabPage : public SfxTabPage
142 {
143     FixedLine       aTypeTitleFL;
144     FixedText       aTitleFT;
145     Edit            aTitleED;
146     FixedText       aTypeFT;
147     ListBox         aTypeLB;
148     CheckBox        aReadOnlyCB;
149 
150     FixedLine       aAreaFL;
151     FixedText       aAreaFT;
152     ListBox         aAreaLB;
153     FixedText       aLevelFT;   //content, user
154     NumericField    aLevelNF;   //content, user
155 
156     //content
157     FixedLine       aCreateFromFL;  // content, user, illustration
158     CheckBox        aFromHeadingsCB;
159 //  PushButton      aChapterDlgPB;  //#outline level,removed by zhaojianwei
160     CheckBox        aAddStylesCB;
161     PushButton      aAddStylesPB;
162     Point           aAddStylesPosDef;
163     Point           aAddStylesPosUser;
164     //user
165     CheckBox        aFromTablesCB;
166     CheckBox        aFromFramesCB;
167     CheckBox        aFromGraphicsCB;
168     CheckBox        aFromOLECB;
169     CheckBox        aLevelFromChapterCB;
170 
171     //illustration + table
172     RadioButton     aFromCaptionsRB;
173     RadioButton     aFromObjectNamesRB;
174 
175     //illustration and tables
176     FixedText       aCaptionSequenceFT;
177     ListBox         aCaptionSequenceLB;
178     FixedText       aDisplayTypeFT;
179     ListBox         aDisplayTypeLB;
180 
181     //all but illustration and table
182     CheckBox        aTOXMarksCB;
183 
184     //
185 
186     //index only
187     FixedLine       aIdxOptionsFL;
188     CheckBox        aCollectSameCB;
189     CheckBox        aUseFFCB;
190     CheckBox        aUseDashCB;
191     CheckBox        aCaseSensitiveCB;
192     CheckBox        aInitialCapsCB;
193     CheckBox        aKeyAsEntryCB;
194     CheckBox        aFromFileCB;
195     MenuButton      aAutoMarkPB;
196 
197     // object only
198     SwOLENames      aFromNames;
199     SvxCheckListBox aFromObjCLB;
200     FixedLine       aFromObjFL;
201 
202     CheckBox        aSequenceCB;
203     FixedText       aBracketFT;
204     ListBox         aBracketLB;
205     FixedLine       aAuthorityFormatFL;
206 
207     //all
208     FixedLine       aSortOptionsFL;
209     FixedText       aLanguageFT;
210     SvxLanguageBox  aLanguageLB;
211     FixedText       aSortAlgorithmFT;
212     ListBox         aSortAlgorithmLB;
213 
214     IndexEntryRessource* pIndexRes;
215 
216     Point           aCBLeftPos1;
217     Point           aCBLeftPos2;
218     Point           aCBLeftPos3;
219 
220     String          aStyleArr[MAXLEVEL];
221     String          sAutoMarkURL;
222     String          sAutoMarkType;
223     String          sAddStyleUser;
224     String          sAddStyleContent;
225 
226     const IndexEntrySupplierWrapper* pIndexEntryWrapper;
227 
228     sal_Bool            bFirstCall;
229 
230     DECL_LINK(TOXTypeHdl,   ListBox* );
231     DECL_LINK(TOXAreaHdl,   ListBox* );
232 //  DECL_LINK(ChapterHdl,   PushButton* ); //#outline level,removed by zhaojianwei
233     DECL_LINK(AddStylesHdl, PushButton* );
234     DECL_LINK(MenuEnableHdl, Menu*);
235     DECL_LINK(MenuExecuteHdl, Menu*);
236     DECL_LINK(LanguageHdl, ListBox*);
237 
238     DECL_LINK(CheckBoxHdl,  CheckBox*   );
239     DECL_LINK(RadioButtonHdl, RadioButton* );
240     DECL_LINK(ModifyHdl, void*);
241 
242     void    ApplyTOXDescription();
243     void    FillTOXDescription();
244 
245     using SfxTabPage::ActivatePage;
246     using SfxTabPage::DeactivatePage;
247 
248 public:
249     SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet);
250     ~SwTOXSelectTabPage();
251 
252     virtual sal_Bool        FillItemSet( SfxItemSet& );
253     virtual void        Reset( const SfxItemSet& );
254 
255     virtual void        ActivatePage( const SfxItemSet& );
256     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
257 
258     static SfxTabPage*  Create( Window* pParent,
259                                 const SfxItemSet& rAttrSet);
260 
261     void                SelectType(TOXTypes eSet);  //preset TOXType, GlobalDoc
262     void                SetWrtShell(SwWrtShell& rSh);
263 };
264 /* -----------------16.06.99 08:33-------------------
265 
266  --------------------------------------------------*/
267 
268 DECLARE_LIST(TOXControlList, Control*)
269 
270 class SwTOXEdit;
271 class SwTOXButton;
272 class SwTOXEntryTabPage;
273 
274 class SwTokenWindow : public Window
275 {
276     ImageButton     aLeftScrollWin;
277     Window          aCtrlParentWin;
278     ImageButton     aRightScrollWin;
279     TOXControlList  aControlList;
280     SwForm*         pForm;
281     sal_uInt16          nLevel;
282     sal_Bool            bValid;
283     String          aButtonTexts[TOKEN_END]; // Text of the buttons
284     String          aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons
285     String          sCharStyle;
286     Link            aButtonSelectedHdl;
287     Control*        pActiveCtrl;
288     Link            aModifyHdl;
289     String      accessibleName;
290     String      sAdditionalAccnameString1;
291     String      sAdditionalAccnameString2;
292     String      sAdditionalAccnameString3;
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);
GetLastLevel() const315     sal_uInt16      GetLastLevel()const {return nLevel;};
316 
IsValid() const317     sal_Bool        IsValid() const {return bValid;}
318 
SetInvalid()319     void        SetInvalid() {bValid = sal_False;}
320 
321     String      GetPattern() const;
322 
SetButtonSelectedHdl(const Link & rLink)323     void        SetButtonSelectedHdl(const Link& rLink)
324                 { aButtonSelectedHdl = rLink;}
325 
SetModifyHdl(const Link & rLink)326     void        SetModifyHdl(const Link& rLink){aModifyHdl = rLink;}
327 
GetActiveControl()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     void SetFocus2theAllBtn();
345 private:
346     sal_uInt32 GetControlIndex(FormTokenType eType, const Control* pCurControl) const;
347 };
348 /* -----------------------------23.12.99 14:16--------------------------------
349 
350  ---------------------------------------------------------------------------*/
351 class SwTOXEntryTabPage;
352 class SwIdxTreeListBox : public SvTreeListBox
353 {
354     SwTOXEntryTabPage* pParent;
355 
356     virtual void    RequestHelp( const HelpEvent& rHEvt );
357 public:
358     SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId);
359 };
360 
361 /* -----------------16.06.99 12:49-------------------
362 
363  --------------------------------------------------*/
364 class SwTOXEntryTabPage : public SfxTabPage
365 {
366     FixedText           aLevelFT;
367     SwIdxTreeListBox    aLevelLB;
368 
369     FixedLine       aEntryFL;
370     FixedText       aTokenFT;
371     SwTokenWindow   aTokenWIN;
372     PushButton      aAllLevelsPB;
373 
374     PushButton      aEntryNoPB;
375     PushButton      aEntryPB;
376     PushButton      aTabPB;
377     PushButton      aChapterInfoPB;
378     PushButton      aPageNoPB;
379     PushButton      aHyperLinkPB;
380 
381     ListBox         aAuthFieldsLB;
382     PushButton      aAuthInsertPB;
383     PushButton      aAuthRemovePB;
384 
385     FixedText       aCharStyleFT;
386     ListBox         aCharStyleLB;       // character style of the current token
387     PushButton      aEditStylePB;
388 
389     FixedText       aChapterEntryFT;
390     ListBox         aChapterEntryLB;    // type of chapter info
391 
392     FixedText       aNumberFormatFT;
393     ListBox         aNumberFormatLB;    //!< format for numbering (E#)
394 
395     FixedText       aEntryOutlineLevelFT;    //!< Fixed text, for i53420
396     NumericField    aEntryOutlineLevelNF;   //!< level to evaluate outline level to, for i53420
397     FixedText       aFillCharFT;
398     ComboBox        aFillCharCB;        // fill char for tab stop
399     FixedText       aTabPosFT;
400     MetricField     aTabPosMF;          // tab stop position
401     CheckBox        aAutoRightCB;
402     FixedLine       aFormatFL;
403 
404     CheckBox        aRelToStyleCB;      // position relative to the right margin of the para style
405     FixedText       aMainEntryStyleFT;
406     ListBox         aMainEntryStyleLB;  // character style of main entries in indexes
407     CheckBox        aAlphaDelimCB;
408     CheckBox        aCommaSeparatedCB;
409 
410     RadioButton     aSortDocPosRB;
411     RadioButton     aSortContentRB;
412     FixedLine       aSortingFL;
413 
414     FixedText           aFirstKeyFT;
415     ListBox             aFirstKeyLB;
416     ImageRadioButton    aFirstSortUpRB;
417     ImageRadioButton    aFirstSortDownRB;
418 
419     FixedText           aSecondKeyFT;
420     ListBox             aSecondKeyLB;
421     ImageRadioButton    aSecondSortUpRB;
422     ImageRadioButton    aSecondSortDownRB;
423 
424     FixedText           aThirdKeyFT;
425     ListBox             aThirdKeyLB;
426     ImageRadioButton    aThirdSortUpRB;
427     ImageRadioButton    aThirdSortDownRB;
428 
429     FixedLine       aSortKeyFL;
430 
431     String          sDelimStr;
432     String          sLevelStr;
433     String          sAuthTypeStr;
434 
435     String          sNoCharStyle;
436     String          sNoCharSortKey;
437     Point           aButtonPositions[5];
438     SwForm*         m_pCurrentForm;
439 
440     Point           aRelToStylePos;
441     Point           aRelToStyleIdxPos;
442     Size            aLevelFLSize;
443 
444     CurTOXType      aLastTOXType;
445     sal_Bool            bInLevelHdl;
446 
447     Point           aChapterEntryFTPosition; //!< holds position of ChapterEntryFT control,
448                                              //to be used in moving the element among different tokens
449     Point           aEntryOutlineLevelFTPosition;//!< holds position ofrEntryOutlineLevelFT control
450     sal_Int32       nBiasToEntryPoint;
451 
452     DECL_LINK(StyleSelectHdl, ListBox*);
453     DECL_LINK(EditStyleHdl, PushButton*);
454     DECL_LINK(InsertTokenHdl, PushButton*);
455     DECL_LINK(LevelHdl, SvTreeListBox*);
456     DECL_LINK(AutoRightHdl, CheckBox*);
457     DECL_LINK(TokenSelectedHdl, SwFormToken*);
458     DECL_LINK(TabPosHdl, MetricField*);
459     DECL_LINK(FillCharHdl, ComboBox*);
460     DECL_LINK(RemoveInsertAuthHdl, PushButton*);
461     DECL_LINK(SortKeyHdl, RadioButton*);
462     DECL_LINK(ChapterInfoHdl, ListBox*);
463     DECL_LINK(ChapterInfoOutlineHdl, NumericField*);
464     DECL_LINK(NumberFormatHdl, ListBox*);
465 
466     DECL_LINK(AllLevelsHdl, PushButton*);
467 
468     void            EnableButtons();
469     void            WriteBackLevel();
470     void            UpdateDescriptor();
471     DECL_LINK(ModifyHdl, void*);
472 
473     using SfxTabPage::ActivatePage;
474     using SfxTabPage::DeactivatePage;
475 
476 public:
477     SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet);
478     ~SwTOXEntryTabPage();
479 
480     virtual sal_Bool        FillItemSet( SfxItemSet& );
481     virtual void        Reset( const SfxItemSet& );
482     virtual void        ActivatePage( const SfxItemSet& );
483     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
484 
485     static SfxTabPage*  Create( Window* pParent,
486                                 const SfxItemSet& rAttrSet);
487     void                SetWrtShell(SwWrtShell& rSh);
488 
489     String              GetLevelHelp(sal_uInt16 nLevel) const;
490 
491     void                PreTokenButtonRemoved(const SwFormToken& rToken);
492     void SetFocus2theAllBtn();
493     virtual long Notify( NotifyEvent& rNEvt );
494 };
495 /* -----------------05.07.99 13:00-------------------
496 
497  --------------------------------------------------*/
498 class SwTOXStylesTabPage : public SfxTabPage
499 {
500     FixedLine       aFormatFL;
501     FixedText       aLevelFT2;
502     ListBox         aLevelLB;
503     ImageButton     aAssignBT;
504     FixedText       aTemplateFT;
505     ListBox         aParaLayLB;
506     PushButton      aStdBT;
507     PushButton      aEditStyleBT;
508 
509     SwForm*         m_pCurrentForm;
510 //  void            UpdatePattern();
511 
512     DECL_LINK( EditStyleHdl, Button *);
513     DECL_LINK( StdHdl, Button * );
514     DECL_LINK( EnableSelectHdl, ListBox * );
515     DECL_LINK( DoubleClickHdl, Button * );
516     DECL_LINK( AssignHdl, Button * );
517     DECL_LINK( ModifyHdl, void*);
518 
GetForm()519     SwForm&     GetForm()
520         {
521             SwMultiTOXTabDialog* pDlg = (SwMultiTOXTabDialog*)GetTabDialog();
522             return *pDlg->GetForm(pDlg->GetCurrentTOXType());
523         }
524 
525     using SfxTabPage::ActivatePage;
526     using SfxTabPage::DeactivatePage;
527 
528 public:
529     SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet);
530     ~SwTOXStylesTabPage();
531 
532     virtual sal_Bool        FillItemSet( SfxItemSet& );
533     virtual void        Reset( const SfxItemSet& );
534 
535     virtual void        ActivatePage( const SfxItemSet& );
536     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
537 
538     static SfxTabPage*  Create( Window* pParent,
539                                 const SfxItemSet& rAttrSet);
540 
541 };
542 
543 #endif // _SWUI_CNTTAB_HXX
544 
545