1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: regionsw.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <hintids.hxx>
34 #include <vcl/field.hxx>
35 #include <vcl/lstbox.hxx>
36 #include <vcl/edit.hxx>
37 #include <vcl/button.hxx>
38 #include <vcl/fixed.hxx>
39 #include <vcl/combobox.hxx>
40 #include <vcl/group.hxx>
41 #include <svtools/svtreebx.hxx>
42 #include <sfx2/basedlgs.hxx>
43 #include <sfx2/tabdlg.hxx>
44 #include <svx/brshitem.hxx>
46 #include <condedit.hxx>
47 #include <section.hxx>
48 #include <fmtclds.hxx>
49 #include <fmtftntx.hxx>
50 #include <fmtclbl.hxx>
51 #include <numberingtypelistbox.hxx>
52 #include <svx/frmdiritem.hxx>
53 #include <vcl/image.hxx>
54 #include <svx/paraprev.hxx>
55 #include <svx/lrspitem.hxx>
63 class DocumentInserter
;
64 class FileDialogHelper
;
67 /*--------------------------------------------------------------------
69 --------------------------------------------------------------------*/
76 SwFmtFtnAtTxtEnd aFtnNtAtEnd
;
77 SwFmtEndAtTxtEnd aEndNtAtEnd
;
78 SwFmtNoBalancedColumns aBalance
;
79 SvxFrameDirectionItem aFrmDirItem
;
80 SvxLRSpaceItem aLRSpaceItem
;
83 BOOL bContent
: 1; //zeigt an, ob evtl. Textinhalt im Bereich ist
84 BOOL bSelected
: 1; //fuer Multiselektion erst markieren, dann mit der TreeListBox arbeiten!
85 ::com::sun::star::uno::Sequence
<sal_Int8
> aTempPasswd
;
87 SectRepr(USHORT nPos
, SwSection
& rSect
);
88 BOOL
operator ==(SectRepr
& rSectRef
) const
89 {return nArrPos
==rSectRef
.GetArrPos();}
91 BOOL
operator <(SectRepr
& rSectRef
) const
92 {return nArrPos
<rSectRef
.GetArrPos();}
94 SwSection
& GetSection() { return aSection
; }
95 SwFmtCol
& GetCol() { return aCol
; }
96 SvxBrushItem
& GetBackground() { return aBrush
; }
97 SwFmtFtnAtTxtEnd
& GetFtnNtAtEnd() { return aFtnNtAtEnd
; }
98 SwFmtEndAtTxtEnd
& GetEndNtAtEnd() { return aEndNtAtEnd
; }
99 SwFmtNoBalancedColumns
& GetBalance() { return aBalance
; }
100 SvxFrameDirectionItem
& GetFrmDir() { return aFrmDirItem
; }
101 SvxLRSpaceItem
& GetLRSpace() { return aLRSpaceItem
; }
103 USHORT
GetArrPos() const {return nArrPos
;}
104 const String
& GetCondition() const {return aSection
.GetCondition();}
105 const String
& GetName() const { return aSection
.GetName(); }
106 String
GetFile() const;
107 String
GetSubRegion() const;
108 void SetFile( const String
& rFile
);
109 void SetFilter( const String
& rFilter
);
110 void SetSubRegion( const String
& rSubRegion
);
112 void SetFilePasswd( const String
& rPasswd
)
113 { aSection
.SetLinkFilePassWd( rPasswd
); }
114 void SetCondition( const String
& rString
)
115 {aSection
.SetCondition( rString
);}
116 BOOL
IsCondHidden()const
117 {return aSection
.IsCondHidden();}
119 {return aSection
.IsHidden();}
120 BOOL
IsProtect()const
121 {return aSection
.IsProtect();}
122 // --> FME 2004-06-22 #114856# edit in readonly sections
123 BOOL
IsEditInReadonly()const
124 {return aSection
.IsEditInReadonly();}
125 void SetEditInReadonly(BOOL bFlag
= TRUE
)
126 {aSection
.SetEditInReadonly(bFlag
);}
128 void SetHidden(BOOL bFlag
= TRUE
)
129 {aSection
.SetHidden(bFlag
);}
130 void SetCondHidden(BOOL bFlag
= TRUE
)
131 {aSection
.SetCondHidden(bFlag
);}
132 void SetProtect(BOOL bFlag
= TRUE
)
133 {aSection
.SetProtect(bFlag
);}
134 BOOL
IsContent(){return bContent
;}
135 void SetContent(BOOL bValue
){bContent
= bValue
;}
136 void SetSectionType(SectionType eSectionType
) {aSection
.SetType(eSectionType
);}
137 SectionType
GetSectionType(){return aSection
.GetType();}
139 void SetSelected(){bSelected
= TRUE
;}
140 BOOL
IsSelected() const {return bSelected
;}
143 const ::com::sun::star::uno::Sequence
<sal_Int8
>& GetPasswd() const {return aSection
.GetPasswd();}
144 ::com::sun::star::uno::Sequence
<sal_Int8
>& GetTempPasswd() {return aTempPasswd
;}
145 void SetTempPasswd(const ::com::sun::star::uno::Sequence
<sal_Int8
>& aPasswd
) {aTempPasswd
= aPasswd
;}
148 /*************************************************************************
149 Dialog "Bereiche bearbeiten"
150 *************************************************************************/
152 typedef SectRepr
* SectReprPtr
;
153 SV_DECL_PTRARR_SORT( SectReprArr
, SectReprPtr
, 0, 4 )
155 class SwEditRegionDlg
: public SfxModalDialog
164 FixedText aFileNameFT
;
165 FixedText aDDECommandFT
;
168 FixedText aSubRegionFT
;
169 ComboBox aSubRegionED
;
170 bool bSubRegionsFilled
;
172 FixedLine aProtectFL
;
173 TriStateBox aProtectCB
;
175 PushButton aPasswdPB
;
179 FixedText aConditionFT
;
180 ConditionEdit aConditionED
;
182 // --> FME 2004-06-22 #114856# edit in readonly sections
183 FixedLine aPropertiesFL
;
184 TriStateBox aEditInReadonlyCB
;
188 CancelButton aCancel
;
189 PushButton aOptionsPB
;
196 SectReprArr aSectReprArr
;
197 SvLBoxEntry
* pAktEntry
;
198 const SwSection
* pCurrSect
;
199 sfx2::DocumentInserter
* m_pDocInserter
;
200 Window
* m_pOldDefDlgParent
;
202 BOOL bDontCheckPasswd
:1;
206 Image
BuildBitmap(BOOL bProtect
,BOOL bHidden
,BOOL bHighContrast
);
208 void RecurseList( const SwSectionFmt
* pFmt
, SvLBoxEntry
* pEntry
);
209 USHORT
FindArrPos(const SwSectionFmt
* pFmt
);
211 DECL_LINK( GetFirstEntryHdl
, SvTreeListBox
* );
212 DECL_LINK( DeselectHdl
, SvTreeListBox
* );
214 DECL_LINK( OkHdl
, CheckBox
* );
215 DECL_LINK( NameEditHdl
, Edit
* );
216 DECL_LINK( ConditionEditHdl
, Edit
* );
218 DECL_LINK( ChangePasswdHdl
, Button
* );
219 DECL_LINK( ChangeProtectHdl
, TriStateBox
* );
220 DECL_LINK( ChangeHideHdl
, TriStateBox
* );
221 // --> FME 2004-06-22 #114856# edit in readonly sections
222 DECL_LINK( ChangeEditInReadonlyHdl
, TriStateBox
* );
224 DECL_LINK( ChangeDismissHdl
, CheckBox
* );
225 DECL_LINK( UseFileHdl
, CheckBox
* );
226 DECL_LINK( FileSearchHdl
, PushButton
* );
227 DECL_LINK( OptionsHdl
, PushButton
* );
228 DECL_LINK( FileNameHdl
, Edit
* );
229 DECL_LINK( DDEHdl
, CheckBox
* );
230 DECL_LINK( DlgClosedHdl
, sfx2::FileDialogHelper
* );
231 DECL_LINK( SubRegionEventHdl
, VclWindowEvent
* );
233 BOOL
CheckPasswd(CheckBox
* pBox
= 0);
236 SwEditRegionDlg( Window
* pParent
, SwWrtShell
& rWrtSh
);
237 virtual ~SwEditRegionDlg();
239 void SelectSection(const String
& rSectionName
);
242 /*************************************************************************
243 Dialog "Bereich einfuegen"
244 *************************************************************************/
246 /* -----------------21.05.99 11:05-------------------
248 * --------------------------------------------------*/
249 class SwInsertSectionTabPage
: public SfxTabPage
257 FixedText aDDECommandFT
;
258 FixedText aFileNameFT
;
261 FixedText aSubRegionFT
;
262 ComboBox aSubRegionED
;
264 FixedLine aProtectFL
;
267 PushButton aPasswdPB
;
271 FixedText aConditionFT
;
272 ConditionEdit aConditionED
;
274 // --> FME 2004-06-22 #114856# edit in readonly sections
275 FixedLine aPropertiesFL
;
276 CheckBox aEditInReadonlyCB
;
280 String m_sFilterName
;
281 String m_sFilePasswd
;
284 ::com::sun::star::uno::Sequence
<sal_Int8
> m_aNewPasswd
;
285 SwWrtShell
* m_pWrtSh
;
286 sfx2::DocumentInserter
* m_pDocInserter
;
287 Window
* m_pOldDefDlgParent
;
289 DECL_LINK( ChangeHideHdl
, CheckBox
* );
290 // --> FME 2004-06-22 #114856# edit in readonly sections
291 DECL_LINK( ChangeEditInReadonlyHdl
, CheckBox
* );
293 DECL_LINK( ChangeProtectHdl
, CheckBox
* );
294 DECL_LINK( ChangePasswdHdl
, Button
* );
295 DECL_LINK( NameEditHdl
, Edit
* );
296 DECL_LINK( UseFileHdl
, CheckBox
* );
297 DECL_LINK( FileSearchHdl
, PushButton
* );
298 DECL_LINK( DDEHdl
, CheckBox
* );
299 DECL_LINK( DlgClosedHdl
, sfx2::FileDialogHelper
* );
302 SwInsertSectionTabPage(Window
*pParent
, const SfxItemSet
&rAttrSet
);
303 virtual ~SwInsertSectionTabPage();
305 void SetWrtShell(SwWrtShell
& rSh
);
307 virtual BOOL
FillItemSet( SfxItemSet
& );
308 virtual void Reset( const SfxItemSet
& );
310 static SfxTabPage
* Create( Window
* pParent
,
311 const SfxItemSet
& rAttrSet
);
314 class SwSectionFtnEndTabPage
: public SfxTabPage
317 CheckBox aFtnNtAtTextEndCB
;
319 CheckBox aFtnNtNumCB
;
320 FixedText aFtnOffsetLbl
;
321 NumericField aFtnOffsetFld
;
323 CheckBox aFtnNtNumFmtCB
;
324 FixedText aFtnPrefixFT
;
326 SwNumberingTypeListBox aFtnNumViewBox
;
327 FixedText aFtnSuffixFT
;
331 CheckBox aEndNtAtTextEndCB
;
333 CheckBox aEndNtNumCB
;
334 FixedText aEndOffsetLbl
;
335 NumericField aEndOffsetFld
;
337 CheckBox aEndNtNumFmtCB
;
338 FixedText aEndPrefixFT
;
340 SwNumberingTypeListBox aEndNumViewBox
;
341 FixedText aEndSuffixFT
;
345 DECL_LINK( FootEndHdl
, CheckBox
* );
346 void ResetState( BOOL bFtn
, const SwFmtFtnEndAtTxtEnd
& );
349 SwSectionFtnEndTabPage( Window
*pParent
, const SfxItemSet
&rAttrSet
);
350 virtual ~SwSectionFtnEndTabPage();
352 virtual BOOL
FillItemSet( SfxItemSet
& );
353 virtual void Reset( const SfxItemSet
& );
355 static SfxTabPage
* Create( Window
* pParent
,
356 const SfxItemSet
& rAttrSet
);
358 /* -----------------13.06.2003 09:51-----------------
360 --------------------------------------------------*/
361 class SwSectionIndentTabPage
: public SfxTabPage
365 MetricField aBeforeMF
;
367 MetricField aAfterMF
;
369 SvxParaPrevWindow aPreviewWin
;
371 DECL_LINK(IndentModifyHdl
, MetricField
*);
373 SwSectionIndentTabPage( Window
*pParent
, const SfxItemSet
&rAttrSet
);
374 virtual ~SwSectionIndentTabPage();
376 virtual BOOL
FillItemSet( SfxItemSet
& );
377 virtual void Reset( const SfxItemSet
& );
379 static SfxTabPage
* Create( Window
* pParent
,
380 const SfxItemSet
& rAttrSet
);
382 void SetWrtShell(SwWrtShell
& rSh
);
385 /* -----------------21.05.99 13:07-------------------
387 * --------------------------------------------------*/
388 class SwInsertSectionTabDialog
: public SfxTabDialog
391 SwSection
* pToInsertSection
;
393 virtual void PageCreated( USHORT nId
, SfxTabPage
&rPage
);
396 SwInsertSectionTabDialog(Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
);
397 virtual ~SwInsertSectionTabDialog();
399 void SetSection(const SwSection
& rSect
);
400 SwSection
* GetSection() { return pToInsertSection
;}
403 /* -----------------21.05.99 13:07-------------------
405 * --------------------------------------------------*/
406 class SwSectionPropertyTabDialog
: public SfxTabDialog
410 virtual void PageCreated( USHORT nId
, SfxTabPage
&rPage
);
412 SwSectionPropertyTabDialog(Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
);
413 virtual ~SwSectionPropertyTabDialog();