xref: /trunk/main/sw/source/ui/inc/swuicnttab.hxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
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 
118     CurTOXType          GetCurrentTOXType() const { return eCurrentTOXType;}
119     void                SetCurrentTOXType(CurTOXType    eSet)
120                                 {
121                                     eCurrentTOXType = eSet;
122                                 }
123 
124     void                UpdateExample();
125     sal_Bool                IsTOXEditMode() const { return bEditTOX;}
126 
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 //IAccessibility2 Impplementaton 2009-----
290     String      accessibleName;
291     String      sAdditionalAccnameString1;
292     String      sAdditionalAccnameString2;
293     String      sAdditionalAccnameString3;
294 //-----IAccessibility2 Impplementaton 2009
295 
296     SwTOXEntryTabPage*  m_pParent;
297 
298     DECL_LINK(EditResize, Edit*);
299     DECL_LINK(NextItemHdl, SwTOXEdit* );
300     DECL_LINK(TbxFocusHdl, SwTOXEdit* );
301     DECL_LINK(NextItemBtnHdl, SwTOXButton* );
302     DECL_LINK(TbxFocusBtnHdl, SwTOXButton* );
303     DECL_LINK(ScrollHdl, ImageButton* );
304 
305     void    SetActiveControl(Control* pSet);
306 
307     Control*    InsertItem(const String& rText, const SwFormToken& aToken);
308     void        AdjustPositions();
309     void        AdjustScrolling();
310     void        MoveControls(long nOffset);
311 
312 public:
313     SwTokenWindow(SwTOXEntryTabPage* pParent, const ResId& rResId);
314     ~SwTokenWindow();
315 
316     void        SetForm(SwForm& rForm, sal_uInt16 nLevel);
317     sal_uInt16      GetLastLevel()const {return nLevel;};
318 
319     sal_Bool        IsValid() const {return bValid;}
320 
321     void        SetInvalid() {bValid = sal_False;}
322 
323     String      GetPattern() const;
324 
325     void        SetButtonSelectedHdl(const Link& rLink)
326                 { aButtonSelectedHdl = rLink;}
327 
328     void        SetModifyHdl(const Link& rLink){aModifyHdl = rLink;}
329 
330     Control*    GetActiveControl()
331                     { return pActiveCtrl;}
332 
333     void        InsertAtSelection(const String& rText, const SwFormToken& aToken);
334     void        RemoveControl(SwTOXButton* pDel, sal_Bool bInternalCall = sal_False);
335 
336     sal_Bool        Contains(FormTokenType) const;
337 
338     sal_Bool        DetermineLinkStart();
339 
340     //helper for pattern buttons and edits
341     sal_Bool        CreateQuickHelp(Control* pCtrl,
342                     const SwFormToken& rToken, const HelpEvent& );
343 
344     virtual void        Resize();
345     virtual void        GetFocus();
346 //IAccessibility2 Impplementaton 2009-----
347     void SetFocus2theAllBtn();
348 private:
349     sal_uInt32 GetControlIndex(FormTokenType eType, const Control* pCurControl) const;
350 //-----IAccessibility2 Impplementaton 2009
351 };
352 /* -----------------------------23.12.99 14:16--------------------------------
353 
354  ---------------------------------------------------------------------------*/
355 class SwTOXEntryTabPage;
356 class SwIdxTreeListBox : public SvTreeListBox
357 {
358     SwTOXEntryTabPage* pParent;
359 
360     virtual void    RequestHelp( const HelpEvent& rHEvt );
361 public:
362     SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId);
363 };
364 
365 /* -----------------16.06.99 12:49-------------------
366 
367  --------------------------------------------------*/
368 class SwTOXEntryTabPage : public SfxTabPage
369 {
370     FixedText           aLevelFT;
371     SwIdxTreeListBox    aLevelLB;
372 
373     FixedLine       aEntryFL;
374     FixedText       aTokenFT;
375     SwTokenWindow   aTokenWIN;
376     PushButton      aAllLevelsPB;
377 
378     PushButton      aEntryNoPB;
379     PushButton      aEntryPB;
380     PushButton      aTabPB;
381     PushButton      aChapterInfoPB;
382     PushButton      aPageNoPB;
383     PushButton      aHyperLinkPB;
384 
385     ListBox         aAuthFieldsLB;
386     PushButton      aAuthInsertPB;
387     PushButton      aAuthRemovePB;
388 
389     FixedText       aCharStyleFT;
390     ListBox         aCharStyleLB;       // character style of the current token
391     PushButton      aEditStylePB;
392 
393     FixedText       aChapterEntryFT;
394     ListBox         aChapterEntryLB;    // type of chapter info
395 
396     FixedText       aNumberFormatFT;
397     ListBox         aNumberFormatLB;    //!< format for numbering (E#)
398 
399     FixedText       aEntryOutlineLevelFT;    //!< Fixed text, for i53420
400     NumericField    aEntryOutlineLevelNF;   //!< level to evaluate outline level to, for i53420
401     FixedText       aFillCharFT;
402     ComboBox        aFillCharCB;        // fill char for tab stop
403     FixedText       aTabPosFT;
404     MetricField     aTabPosMF;          // tab stop position
405     CheckBox        aAutoRightCB;
406     FixedLine       aFormatFL;
407 
408     CheckBox        aRelToStyleCB;      // position relative to the right margin of the para style
409     FixedText       aMainEntryStyleFT;
410     ListBox         aMainEntryStyleLB;  // character style of main entries in indexes
411     CheckBox        aAlphaDelimCB;
412     CheckBox        aCommaSeparatedCB;
413 
414     RadioButton     aSortDocPosRB;
415     RadioButton     aSortContentRB;
416     FixedLine       aSortingFL;
417 
418     FixedText           aFirstKeyFT;
419     ListBox             aFirstKeyLB;
420     ImageRadioButton    aFirstSortUpRB;
421     ImageRadioButton    aFirstSortDownRB;
422 
423     FixedText           aSecondKeyFT;
424     ListBox             aSecondKeyLB;
425     ImageRadioButton    aSecondSortUpRB;
426     ImageRadioButton    aSecondSortDownRB;
427 
428     FixedText           aThirdKeyFT;
429     ListBox             aThirdKeyLB;
430     ImageRadioButton    aThirdSortUpRB;
431     ImageRadioButton    aThirdSortDownRB;
432 
433     FixedLine       aSortKeyFL;
434 
435     String          sDelimStr;
436     String          sLevelStr;
437     String          sAuthTypeStr;
438 
439     String          sNoCharStyle;
440     String          sNoCharSortKey;
441     Point           aButtonPositions[5];
442     SwForm*         m_pCurrentForm;
443 
444     Point           aRelToStylePos;
445     Point           aRelToStyleIdxPos;
446     Size            aLevelFLSize;
447 
448     CurTOXType      aLastTOXType;
449     sal_Bool            bInLevelHdl;
450 
451     Point           aChapterEntryFTPosition; //!< holds position of ChapterEntryFT control,
452                                              //to be used in moving the element among different tokens
453     Point           aEntryOutlineLevelFTPosition;//!< holds position ofrEntryOutlineLevelFT control
454     sal_Int32       nBiasToEntryPoint;
455 
456     DECL_LINK(StyleSelectHdl, ListBox*);
457     DECL_LINK(EditStyleHdl, PushButton*);
458     DECL_LINK(InsertTokenHdl, PushButton*);
459     DECL_LINK(LevelHdl, SvTreeListBox*);
460     DECL_LINK(AutoRightHdl, CheckBox*);
461     DECL_LINK(TokenSelectedHdl, SwFormToken*);
462     DECL_LINK(TabPosHdl, MetricField*);
463     DECL_LINK(FillCharHdl, ComboBox*);
464     DECL_LINK(RemoveInsertAuthHdl, PushButton*);
465     DECL_LINK(SortKeyHdl, RadioButton*);
466     DECL_LINK(ChapterInfoHdl, ListBox*);
467     DECL_LINK(ChapterInfoOutlineHdl, NumericField*);
468     DECL_LINK(NumberFormatHdl, ListBox*);
469 
470     DECL_LINK(AllLevelsHdl, PushButton*);
471 
472     void            EnableButtons();
473     void            WriteBackLevel();
474     void            UpdateDescriptor();
475     DECL_LINK(ModifyHdl, void*);
476 
477     using SfxTabPage::ActivatePage;
478     using SfxTabPage::DeactivatePage;
479 
480 public:
481     SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet);
482     ~SwTOXEntryTabPage();
483 
484     virtual sal_Bool        FillItemSet( SfxItemSet& );
485     virtual void        Reset( const SfxItemSet& );
486     virtual void        ActivatePage( const SfxItemSet& );
487     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
488 
489     static SfxTabPage*  Create( Window* pParent,
490                                 const SfxItemSet& rAttrSet);
491     void                SetWrtShell(SwWrtShell& rSh);
492 
493     String              GetLevelHelp(sal_uInt16 nLevel) const;
494 
495     void                PreTokenButtonRemoved(const SwFormToken& rToken);
496 //IAccessibility2 Impplementaton 2009-----
497     void SetFocus2theAllBtn();
498     virtual long Notify( NotifyEvent& rNEvt );
499 //-----IAccessibility2 Impplementaton 2009
500 };
501 /* -----------------05.07.99 13:00-------------------
502 
503  --------------------------------------------------*/
504 class SwTOXStylesTabPage : public SfxTabPage
505 {
506     FixedLine       aFormatFL;
507     FixedText       aLevelFT2;
508     ListBox         aLevelLB;
509     ImageButton     aAssignBT;
510     FixedText       aTemplateFT;
511     ListBox         aParaLayLB;
512     PushButton      aStdBT;
513     PushButton      aEditStyleBT;
514 
515     SwForm*         m_pCurrentForm;
516 //  void            UpdatePattern();
517 
518     DECL_LINK( EditStyleHdl, Button *);
519     DECL_LINK( StdHdl, Button * );
520     DECL_LINK( EnableSelectHdl, ListBox * );
521     DECL_LINK( DoubleClickHdl, Button * );
522     DECL_LINK( AssignHdl, Button * );
523     DECL_LINK( ModifyHdl, void*);
524 
525     SwForm&     GetForm()
526         {
527             SwMultiTOXTabDialog* pDlg = (SwMultiTOXTabDialog*)GetTabDialog();
528             return *pDlg->GetForm(pDlg->GetCurrentTOXType());
529         }
530 
531     using SfxTabPage::ActivatePage;
532     using SfxTabPage::DeactivatePage;
533 
534 public:
535     SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet);
536     ~SwTOXStylesTabPage();
537 
538     virtual sal_Bool        FillItemSet( SfxItemSet& );
539     virtual void        Reset( const SfxItemSet& );
540 
541     virtual void        ActivatePage( const SfxItemSet& );
542     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
543 
544     static SfxTabPage*  Create( Window* pParent,
545                                 const SfxItemSet& rAttrSet);
546 
547 };
548 
549 #endif // _SWUI_CNTTAB_HXX
550 
551