summaryrefslogtreecommitdiff
path: root/sw/source/ui/inc/swuicnttab.hxx
blob: 3b1a0f25a4db2a23d76b64e3cf239af692266995 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef INCLUDED_SW_SOURCE_UI_INC_SWUICNTTAB_HXX
#define INCLUDED_SW_SOURCE_UI_INC_SWUICNTTAB_HXX

#include <svx/stddlg.hxx>

#include <vcl/button.hxx>

#include <vcl/edit.hxx>

#include <vcl/fixed.hxx>

#include <vcl/field.hxx>
#include <vcl/lstbox.hxx>
#include <sfx2/tabdlg.hxx>

#include "tox.hxx"
#include <toxmgr.hxx>
#include <svx/checklbx.hxx>
#include <svtools/treelistbox.hxx>
#include <vcl/menubtn.hxx>
#include <svx/langbox.hxx>
#include <cnttab.hxx>
#include <vector>

class SwWrtShell;
class SwTOXMgr;
namespace com{namespace sun{namespace star{
    namespace text{
        class XTextSection;
        class XDocumentIndex;
    }
}}}

struct SwIndexSections_Impl
{
    com::sun::star::uno::Reference< com::sun::star::text::XTextSection >    xContainerSection;
    com::sun::star::uno::Reference< com::sun::star::text::XDocumentIndex >    xDocumentIndex;
};

class SwOneExampleFrame;

struct SwIndexSections_Impl;

class SwMultiTOXTabDialog : public SfxTabDialog
{
    Window*                 m_pExampleContainerWIN;
    CheckBox*               m_pShowExampleCB;
    SwTOXMgr*               pMgr;
    SwWrtShell&             rSh;

    sal_uInt16              m_nSelectId;
    sal_uInt16              m_nStylesId;
    sal_uInt16              m_nColumnId;
    sal_uInt16              m_nBackGroundId;
    sal_uInt16              m_nEntriesId;

    SwOneExampleFrame*      pExampleFrame;

    SwTOXDescription**      pDescArr; //
    SwForm**                pFormArr; //
    SwIndexSections_Impl**  pxIndexSectionsArr;

    SwTOXBase*              pParamTOXBase;

    CurTOXType              eCurrentTOXType;

    OUString                sUserDefinedIndex;
    sal_uInt16              nTypeCount;
    sal_uInt16              nInitialTOXType;

    sal_Bool                bEditTOX;
    sal_Bool                bExampleCreated;
    sal_Bool                bGlobalFlag;

    virtual short       Ok();
    SwTOXDescription*   CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX);

    DECL_LINK(CreateExample_Hdl, void*);
    DECL_LINK(ShowPreviewHdl, void*);

public:
    SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet,
                        SwWrtShell &rShell,
                        SwTOXBase* pCurTOX, sal_uInt16 nToxType = USHRT_MAX,
                        sal_Bool bGlobal = sal_False);
    ~SwMultiTOXTabDialog();

    virtual void        PageCreated( sal_uInt16 nId, SfxTabPage &rPage );

    SwForm*             GetForm(CurTOXType eType);

    CurTOXType          GetCurrentTOXType() const { return eCurrentTOXType;}
    void                SetCurrentTOXType(CurTOXType    eSet)
                                {
                                    eCurrentTOXType = eSet;
                                }

    void                UpdateExample();
    sal_Bool                IsTOXEditMode() const { return bEditTOX;}

    SwWrtShell&         GetWrtShell() {return rSh;}

    SwTOXDescription&   GetTOXDescription(CurTOXType eTOXTypes);
    void                CreateOrUpdateExample(
                            TOXTypes nTOXIndex, sal_uInt16 nPage = 0, sal_uInt16 nCurLevel = USHRT_MAX);

    static sal_Bool IsNoNum(SwWrtShell& rSh, const OUString& rName);
};

class IndexEntryResource;
class IndexEntrySupplierWrapper;

class SwTOXSelectTabPage : public SfxTabPage
{
    Edit*           m_pTitleED;
    FixedText*      m_pTypeFT;
    ListBox*        m_pTypeLB;
    CheckBox*       m_pReadOnlyCB;

    VclContainer*   m_pAreaFrame;
    ListBox*        m_pAreaLB;
    FixedText*      m_pLevelFT;   //content, user
    NumericField*   m_pLevelNF;   //content, user

    //content
    VclContainer*   m_pCreateFrame;  // content, user, illustration
    CheckBox*       m_pFromHeadingsCB;
    CheckBox*       m_pAddStylesCB;
    PushButton*     m_pAddStylesPB;
    //user
    CheckBox*       m_pFromTablesCB;
    CheckBox*       m_pFromFramesCB;
    CheckBox*       m_pFromGraphicsCB;
    CheckBox*       m_pFromOLECB;
    CheckBox*       m_pLevelFromChapterCB;

    //illustration + table
    RadioButton*    m_pFromCaptionsRB;
    RadioButton*    m_pFromObjectNamesRB;

    //illustration and tables
    FixedText*      m_pCaptionSequenceFT;
    ListBox*        m_pCaptionSequenceLB;
    FixedText*      m_pDisplayTypeFT;
    ListBox*        m_pDisplayTypeLB;

    //all but illustration and table
    CheckBox*       m_pTOXMarksCB;

    //index only
    VclContainer*   m_pIdxOptionsFrame;
    CheckBox*       m_pCollectSameCB;
    CheckBox*       m_pUseFFCB;
    CheckBox*       m_pUseDashCB;
    CheckBox*       m_pCaseSensitiveCB;
    CheckBox*       m_pInitialCapsCB;
    CheckBox*       m_pKeyAsEntryCB;
    CheckBox*       m_pFromFileCB;
    MenuButton*     m_pAutoMarkPB;

    // object only
    SwOLENames      aFromNames;
    SvxCheckListBox* m_pFromObjCLB;
    VclContainer*   m_pFromObjFrame;

    CheckBox*       m_pSequenceCB;
    ListBox*        m_pBracketLB;
    VclContainer*   m_pAuthorityFrame;

    //all
    VclContainer*   m_pSortFrame;
    SvxLanguageBox* m_pLanguageLB;
    ListBox*        m_pSortAlgorithmLB;

    IndexEntryResource* pIndexRes;

    OUString        aStyleArr[MAXLEVEL];
    OUString        sAutoMarkURL;
    OUString        sAutoMarkType;
    OUString        sAddStyleUser;
    OUString        sAddStyleContent;

    const IndexEntrySupplierWrapper* pIndexEntryWrapper;

    bool            m_bWaitingInitialSettings;

    DECL_LINK(TOXTypeHdl,   ListBox* );
    DECL_LINK(AddStylesHdl, PushButton* );
    DECL_LINK(MenuEnableHdl, Menu*);
    DECL_LINK(MenuExecuteHdl, Menu*);
    DECL_LINK(LanguageHdl, ListBox*);

    DECL_LINK(CheckBoxHdl,  CheckBox*   );
    DECL_LINK(RadioButtonHdl, void *);
    DECL_LINK(ModifyHdl, void*);

      void  ApplyTOXDescription();
    void    FillTOXDescription();

    using SfxTabPage::ActivatePage;
    using SfxTabPage::DeactivatePage;

public:
    SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet);
    ~SwTOXSelectTabPage();

    virtual sal_Bool        FillItemSet( SfxItemSet& );
    virtual void        Reset( const SfxItemSet& );

    virtual void        ActivatePage( const SfxItemSet& );
    virtual int         DeactivatePage( SfxItemSet* pSet = 0 );

    static SfxTabPage*  Create( Window* pParent,
                                const SfxItemSet& rAttrSet);

    void                SelectType(TOXTypes eSet);  //preset TOXType, GlobalDoc
    void                SetWrtShell(SwWrtShell& rSh);
};

class SwTOXEdit;
class SwTOXButton;
class SwTOXEntryTabPage;

class SwTokenWindow : public VclHBox, public VclBuilderContainer
{
    typedef std::vector<Control*>::iterator ctrl_iterator;
    typedef std::vector<Control*>::const_iterator ctrl_const_iterator;
    typedef std::vector<Control*>::reverse_iterator ctrl_reverse_iterator;
    typedef std::vector<Control*>::const_reverse_iterator ctrl_const_reverse_iterator;

    Button* m_pLeftScrollWin;
    Window* m_pCtrlParentWin;
    Button* m_pRightScrollWin;
    std::vector<Control*>   aControlList;
    SwForm*         pForm;
    sal_uInt16      nLevel;
    bool            bValid;
    OUString        aButtonTexts[TOKEN_END]; // Text of the buttons
    OUString        aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons
    OUString        sCharStyle;
    Link            aButtonSelectedHdl;
    Control*        pActiveCtrl;
    Link            aModifyHdl;
    OUString        accessibleName;
    OUString        sAdditionalAccnameString1;
    OUString        sAdditionalAccnameString2;
    OUString        sAdditionalAccnameString3;

    SwTOXEntryTabPage*  m_pParent;

    DECL_LINK(EditResize, Edit*);
    DECL_LINK(NextItemHdl, SwTOXEdit* );
    DECL_LINK(TbxFocusHdl, SwTOXEdit* );
    DECL_LINK(NextItemBtnHdl, SwTOXButton* );
    DECL_LINK(TbxFocusBtnHdl, SwTOXButton* );
    DECL_LINK(ScrollHdl, ImageButton* );

    void    SetActiveControl(Control* pSet);

    Control*    InsertItem(const OUString& rText, const SwFormToken& aToken);
    void        AdjustPositions();
    void        AdjustScrolling();
    void        MoveControls(long nOffset);

public:
    SwTokenWindow(Window* pParent);
    ~SwTokenWindow();

    void SetTabPage(SwTOXEntryTabPage *pParent) { m_pParent = pParent; }

    void        SetForm(SwForm& rForm, sal_uInt16 nLevel);
    sal_uInt16      GetLastLevel()const {return nLevel;};

    sal_Bool        IsValid() const {return bValid;}

    void        SetInvalid() {bValid = sal_False;}

    OUString    GetPattern() const;

    void        SetButtonSelectedHdl(const Link& rLink)
                { aButtonSelectedHdl = rLink;}

    void        SetModifyHdl(const Link& rLink){aModifyHdl = rLink;}

    Control*    GetActiveControl()
                    { return pActiveCtrl;}

    void        InsertAtSelection(const OUString& rText, const SwFormToken& aToken);
    void        RemoveControl(SwTOXButton* pDel, sal_Bool bInternalCall = sal_False);

    sal_Bool        Contains(FormTokenType) const;

    sal_Bool        DetermineLinkStart();

    //helper for pattern buttons and edits
    sal_Bool        CreateQuickHelp(Control* pCtrl,
                    const SwFormToken& rToken, const HelpEvent& );

    virtual void    GetFocus();
    virtual void    setAllocation(const Size &rAllocation);
    void SetFocus2theAllBtn();
private:
    sal_uInt32 GetControlIndex(FormTokenType eType) const;
};

class SwTOXEntryTabPage;

class SwIdxTreeListBox : public SvTreeListBox
{
    SwTOXEntryTabPage* pParent;

    virtual void    RequestHelp( const HelpEvent& rHEvt );
public:
    SwIdxTreeListBox(Window* pPar, WinBits nStyle);
    void SetTabPage(SwTOXEntryTabPage* pPar) { pParent = pPar; }
};

class SwTOXEntryTabPage : public SfxTabPage
{
    FixedText*          m_pLevelFT;
    SwIdxTreeListBox*   m_pLevelLB;

    SwTokenWindow*  m_pTokenWIN;

    PushButton*     m_pAllLevelsPB;

    PushButton*     m_pEntryNoPB;
    PushButton*     m_pEntryPB;
    PushButton*     m_pTabPB;
    PushButton*     m_pChapterInfoPB;
    PushButton*     m_pPageNoPB;
    PushButton*     m_pHyperLinkPB;

    ListBox*        m_pAuthFieldsLB;
    PushButton*     m_pAuthInsertPB;
    PushButton*     m_pAuthRemovePB;

    ListBox*        m_pCharStyleLB;       // character style of the current token
    PushButton*     m_pEditStylePB;

    FixedText*      m_pChapterEntryFT;
    ListBox*        m_pChapterEntryLB;    // type of chapter info

    FixedText*      m_pNumberFormatFT;
    ListBox*        m_pNumberFormatLB;    //!< format for numbering (E#)

    FixedText*      m_pEntryOutlineLevelFT;    //!< Fixed text, for i53420
    NumericField*   m_pEntryOutlineLevelNF;   //!< level to evaluate outline level to, for i53420

    FixedText*      m_pFillCharFT;
    ComboBox*       m_pFillCharCB;        // fill char for tab stop

    FixedText*      m_pTabPosFT;
    MetricField*    m_pTabPosMF;          // tab stop position
    CheckBox*       m_pAutoRightCB;

    VclContainer*   m_pFormatFrame;
    FixedText*      m_pMainEntryStyleFT;
    ListBox*        m_pMainEntryStyleLB;  // character style of main entries in indexes
    CheckBox*       m_pAlphaDelimCB;
    CheckBox*       m_pCommaSeparatedCB;
    CheckBox*       m_pRelToStyleCB;      // position relative to the right margin of the para style

    VclContainer*   m_pSortingFrame;
    RadioButton*    m_pSortDocPosRB;
    RadioButton*    m_pSortContentRB;

    VclContainer*   m_pSortKeyFrame;
    ListBox*        m_pFirstKeyLB;
    RadioButton*    m_pFirstSortUpRB;
    RadioButton*    m_pFirstSortDownRB;

    ListBox*        m_pSecondKeyLB;
    RadioButton*    m_pSecondSortUpRB;
    RadioButton*    m_pSecondSortDownRB;

    ListBox*        m_pThirdKeyLB;
    RadioButton*    m_pThirdSortUpRB;
    RadioButton*    m_pThirdSortDownRB;

    OUString        sDelimStr;
    OUString        sLevelStr;
    OUString        sAuthTypeStr;

    OUString        sNoCharStyle;
    OUString        sNoCharSortKey;
    SwForm*         m_pCurrentForm;

    CurTOXType      aLastTOXType;
    bool            bInLevelHdl;

    DECL_LINK(StyleSelectHdl, ListBox*);
    DECL_LINK(EditStyleHdl, PushButton*);
    DECL_LINK(InsertTokenHdl, PushButton*);
    DECL_LINK(LevelHdl, SvTreeListBox*);
    DECL_LINK(AutoRightHdl, CheckBox*);
    DECL_LINK(TokenSelectedHdl, SwFormToken*);
    DECL_LINK(TabPosHdl, MetricField*);
    DECL_LINK(FillCharHdl, ComboBox*);
    DECL_LINK(RemoveInsertAuthHdl, PushButton*);
    DECL_LINK(SortKeyHdl, RadioButton*);
    DECL_LINK(ChapterInfoHdl, ListBox*);
    DECL_LINK(ChapterInfoOutlineHdl, NumericField*);
    DECL_LINK(NumberFormatHdl, ListBox*);

    DECL_LINK(AllLevelsHdl, void *);

    void            EnableButtons();
    void            WriteBackLevel();
    void            UpdateDescriptor();
    DECL_LINK(ModifyHdl, void*);

    using SfxTabPage::ActivatePage;
    using SfxTabPage::DeactivatePage;

public:
    SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet);
    ~SwTOXEntryTabPage();

    virtual sal_Bool        FillItemSet( SfxItemSet& );
    virtual void        Reset( const SfxItemSet& );
    virtual void        ActivatePage( const SfxItemSet& );
    virtual int         DeactivatePage( SfxItemSet* pSet = 0 );

    static SfxTabPage*  Create( Window* pParent,
                                const SfxItemSet& rAttrSet);
    void                SetWrtShell(SwWrtShell& rSh);

    OUString            GetLevelHelp(sal_uInt16 nLevel) const;

    void                PreTokenButtonRemoved(const SwFormToken& rToken);
    void SetFocus2theAllBtn();
    virtual long Notify( NotifyEvent& rNEvt );
};

class SwTOXStylesTabPage : public SfxTabPage
{
    ListBox*        m_pLevelLB;
    PushButton*     m_pAssignBT;
    ListBox*        m_pParaLayLB;
    PushButton*     m_pStdBT;
    PushButton*     m_pEditStyleBT;

    SwForm*         m_pCurrentForm;

    DECL_LINK( EditStyleHdl, Button *);
    DECL_LINK(StdHdl, void *);
    DECL_LINK(EnableSelectHdl, void *);
    DECL_LINK(DoubleClickHdl, void *);
    DECL_LINK(AssignHdl, void *);
    void Modify();

    SwForm&     GetForm()
        {
            SwMultiTOXTabDialog* pDlg = (SwMultiTOXTabDialog*)GetTabDialog();
            return *pDlg->GetForm(pDlg->GetCurrentTOXType());
        }

    using SfxTabPage::ActivatePage;
    using SfxTabPage::DeactivatePage;

public:
    SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet);
    ~SwTOXStylesTabPage();

    virtual sal_Bool        FillItemSet( SfxItemSet& );
    virtual void        Reset( const SfxItemSet& );

    virtual void        ActivatePage( const SfxItemSet& );
    virtual int         DeactivatePage( SfxItemSet* pSet = 0 );

    static SfxTabPage*  Create( Window* pParent,
                                const SfxItemSet& rAttrSet);

};

#endif // INCLUDED_SW_SOURCE_UI_INC_SWUICNTTAB_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */