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