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 #ifndef _EDIT_HXX //autogen
37 #include <vcl/edit.hxx>
39 #ifndef _BUTTON_HXX //autogen
40 #include <vcl/button.hxx>
42 #ifndef _FIXED_HXX //autogen
43 #include <vcl/fixed.hxx>
45 #ifndef _COMBOBOX_HXX //autogen
46 #include <vcl/combobox.hxx>
48 #ifndef _GROUP_HXX //autogen
49 #include <vcl/group.hxx>
51 #include <svtools/svtreebx.hxx>
52 #include <sfx2/basedlgs.hxx>
53 #include <sfx2/tabdlg.hxx>
54 #include <svx/brshitem.hxx>
57 #include <condedit.hxx>
59 #include <section.hxx>
60 #include <fmtclds.hxx>
61 #include <fmtftntx.hxx>
62 #include <fmtclbl.hxx>
63 #include <numberingtypelistbox.hxx>
64 #include "svx/frmdiritem.hxx"
65 #include <vcl/image.hxx>
66 #include <svx/paraprev.hxx>
67 #include <svx/lrspitem.hxx>
75 class DocumentInserter
;
76 class FileDialogHelper
;
79 /*--------------------------------------------------------------------
81 --------------------------------------------------------------------*/
88 SwFmtFtnAtTxtEnd aFtnNtAtEnd
;
89 SwFmtEndAtTxtEnd aEndNtAtEnd
;
90 SwFmtNoBalancedColumns aBalance
;
91 SvxFrameDirectionItem aFrmDirItem
;
92 SvxLRSpaceItem aLRSpaceItem
;
95 BOOL bContent
: 1; //zeigt an, ob evtl. Textinhalt im Bereich ist
96 BOOL bSelected
: 1; //fuer Multiselektion erst markieren, dann mit der TreeListBox arbeiten!
97 ::com::sun::star::uno::Sequence
<sal_Int8
> aTempPasswd
;
99 SectRepr(USHORT nPos
, SwSection
& rSect
);
100 BOOL
operator ==(SectRepr
& rSectRef
) const
101 {return nArrPos
==rSectRef
.GetArrPos();}
103 BOOL
operator <(SectRepr
& rSectRef
) const
104 {return nArrPos
<rSectRef
.GetArrPos();}
106 SwSection
& GetSection() { return aSection
; }
107 SwFmtCol
& GetCol() { return aCol
; }
108 SvxBrushItem
& GetBackground() { return aBrush
; }
109 SwFmtFtnAtTxtEnd
& GetFtnNtAtEnd() { return aFtnNtAtEnd
; }
110 SwFmtEndAtTxtEnd
& GetEndNtAtEnd() { return aEndNtAtEnd
; }
111 SwFmtNoBalancedColumns
& GetBalance() { return aBalance
; }
112 SvxFrameDirectionItem
& GetFrmDir() { return aFrmDirItem
; }
113 SvxLRSpaceItem
& GetLRSpace() { return aLRSpaceItem
; }
115 USHORT
GetArrPos() const {return nArrPos
;}
116 const String
& GetCondition() const {return aSection
.GetCondition();}
117 const String
& GetName() const { return aSection
.GetName(); }
118 String
GetFile() const;
119 String
GetSubRegion() const;
120 void SetFile( const String
& rFile
);
121 void SetFilter( const String
& rFilter
);
122 void SetSubRegion( const String
& rSubRegion
);
124 void SetFilePasswd( const String
& rPasswd
)
125 { aSection
.SetLinkFilePassWd( rPasswd
); }
126 void SetCondition( const String
& rString
)
127 {aSection
.SetCondition( rString
);}
128 BOOL
IsCondHidden()const
129 {return aSection
.IsCondHidden();}
131 {return aSection
.IsHidden();}
132 BOOL
IsProtect()const
133 {return aSection
.IsProtect();}
134 // --> FME 2004-06-22 #114856# edit in readonly sections
135 BOOL
IsEditInReadonly()const
136 {return aSection
.IsEditInReadonly();}
137 void SetEditInReadonly(BOOL bFlag
= TRUE
)
138 {aSection
.SetEditInReadonly(bFlag
);}
140 void SetHidden(BOOL bFlag
= TRUE
)
141 {aSection
.SetHidden(bFlag
);}
142 void SetCondHidden(BOOL bFlag
= TRUE
)
143 {aSection
.SetCondHidden(bFlag
);}
144 void SetProtect(BOOL bFlag
= TRUE
)
145 {aSection
.SetProtect(bFlag
);}
146 BOOL
IsContent(){return bContent
;}
147 void SetContent(BOOL bValue
){bContent
= bValue
;}
148 void SetSectionType(SectionType eSectionType
) {aSection
.SetType(eSectionType
);}
149 SectionType
GetSectionType(){return aSection
.GetType();}
151 void SetSelected(){bSelected
= TRUE
;}
152 BOOL
IsSelected() const {return bSelected
;}
155 const ::com::sun::star::uno::Sequence
<sal_Int8
>& GetPasswd() const {return aSection
.GetPasswd();}
156 ::com::sun::star::uno::Sequence
<sal_Int8
>& GetTempPasswd() {return aTempPasswd
;}
157 void SetTempPasswd(const ::com::sun::star::uno::Sequence
<sal_Int8
>& aPasswd
) {aTempPasswd
= aPasswd
;}
160 /*************************************************************************
161 Dialog "Bereiche bearbeiten"
162 *************************************************************************/
164 typedef SectRepr
* SectReprPtr
;
165 SV_DECL_PTRARR_SORT( SectReprArr
, SectReprPtr
, 0, 4 )
167 class SwEditRegionDlg
: public SfxModalDialog
176 FixedText aFileNameFT
;
177 FixedText aDDECommandFT
;
180 FixedText aSubRegionFT
;
181 ComboBox aSubRegionED
;
183 FixedLine aProtectFL
;
184 TriStateBox aProtectCB
;
186 PushButton aPasswdPB
;
190 FixedText aConditionFT
;
191 ConditionEdit aConditionED
;
193 // --> FME 2004-06-22 #114856# edit in readonly sections
194 FixedLine aPropertiesFL
;
195 TriStateBox aEditInReadonlyCB
;
199 CancelButton aCancel
;
200 PushButton aOptionsPB
;
207 SectReprArr aSectReprArr
;
208 SvLBoxEntry
* pAktEntry
;
209 const SwSection
* pCurrSect
;
210 sfx2::DocumentInserter
* m_pDocInserter
;
211 Window
* m_pOldDefDlgParent
;
213 BOOL bDontCheckPasswd
:1;
217 Image
BuildBitmap(BOOL bProtect
,BOOL bHidden
,BOOL bHighContrast
);
219 void RecurseList( const SwSectionFmt
* pFmt
, SvLBoxEntry
* pEntry
);
220 USHORT
FindArrPos(const SwSectionFmt
* pFmt
);
222 DECL_LINK( GetFirstEntryHdl
, SvTreeListBox
* );
223 DECL_LINK( DeselectHdl
, SvTreeListBox
* );
225 DECL_LINK( OkHdl
, CheckBox
* );
226 DECL_LINK( NameEditHdl
, Edit
* );
227 DECL_LINK( ConditionEditHdl
, Edit
* );
229 DECL_LINK( ChangePasswdHdl
, Button
* );
230 DECL_LINK( ChangeProtectHdl
, TriStateBox
* );
231 DECL_LINK( ChangeHideHdl
, TriStateBox
* );
232 // --> FME 2004-06-22 #114856# edit in readonly sections
233 DECL_LINK( ChangeEditInReadonlyHdl
, TriStateBox
* );
235 DECL_LINK( ChangeDismissHdl
, CheckBox
* );
236 DECL_LINK( UseFileHdl
, CheckBox
* );
237 DECL_LINK( FileSearchHdl
, PushButton
* );
238 DECL_LINK( OptionsHdl
, PushButton
* );
239 DECL_LINK( FileNameHdl
, Edit
* );
240 DECL_LINK( DDEHdl
, CheckBox
* );
241 DECL_LINK( DlgClosedHdl
, sfx2::FileDialogHelper
* );
243 BOOL
CheckPasswd(CheckBox
* pBox
= 0);
246 SwEditRegionDlg( Window
* pParent
, SwWrtShell
& rWrtSh
);
247 virtual ~SwEditRegionDlg();
249 void SelectSection(const String
& rSectionName
);
252 /*************************************************************************
253 Dialog "Bereich einfuegen"
254 *************************************************************************/
256 /* -----------------21.05.99 11:05-------------------
258 * --------------------------------------------------*/
259 class SwInsertSectionTabPage
: public SfxTabPage
267 FixedText aDDECommandFT
;
268 FixedText aFileNameFT
;
271 FixedText aSubRegionFT
;
272 ComboBox aSubRegionED
;
274 FixedLine aProtectFL
;
277 PushButton aPasswdPB
;
281 FixedText aConditionFT
;
282 ConditionEdit aConditionED
;
284 // --> FME 2004-06-22 #114856# edit in readonly sections
285 FixedLine aPropertiesFL
;
286 CheckBox aEditInReadonlyCB
;
290 String m_sFilterName
;
291 String m_sFilePasswd
;
294 ::com::sun::star::uno::Sequence
<sal_Int8
> m_aNewPasswd
;
295 SwWrtShell
* m_pWrtSh
;
296 sfx2::DocumentInserter
* m_pDocInserter
;
297 Window
* m_pOldDefDlgParent
;
299 DECL_LINK( ChangeHideHdl
, CheckBox
* );
300 // --> FME 2004-06-22 #114856# edit in readonly sections
301 DECL_LINK( ChangeEditInReadonlyHdl
, CheckBox
* );
303 DECL_LINK( ChangeProtectHdl
, CheckBox
* );
304 DECL_LINK( ChangePasswdHdl
, Button
* );
305 DECL_LINK( NameEditHdl
, Edit
* );
306 DECL_LINK( UseFileHdl
, CheckBox
* );
307 DECL_LINK( FileSearchHdl
, PushButton
* );
308 DECL_LINK( DDEHdl
, CheckBox
* );
309 DECL_LINK( DlgClosedHdl
, sfx2::FileDialogHelper
* );
311 void FillList( const SwSectionFmt
* pFmt
= 0 );
314 SwInsertSectionTabPage(Window
*pParent
, const SfxItemSet
&rAttrSet
);
315 virtual ~SwInsertSectionTabPage();
317 void SetWrtShell(SwWrtShell
& rSh
);
319 virtual BOOL
FillItemSet( SfxItemSet
& );
320 virtual void Reset( const SfxItemSet
& );
322 static SfxTabPage
* Create( Window
* pParent
,
323 const SfxItemSet
& rAttrSet
);
326 class SwSectionFtnEndTabPage
: public SfxTabPage
329 CheckBox aFtnNtAtTextEndCB
;
331 CheckBox aFtnNtNumCB
;
332 FixedText aFtnOffsetLbl
;
333 NumericField aFtnOffsetFld
;
335 CheckBox aFtnNtNumFmtCB
;
336 FixedText aFtnPrefixFT
;
338 SwNumberingTypeListBox aFtnNumViewBox
;
339 FixedText aFtnSuffixFT
;
343 CheckBox aEndNtAtTextEndCB
;
345 CheckBox aEndNtNumCB
;
346 FixedText aEndOffsetLbl
;
347 NumericField aEndOffsetFld
;
349 CheckBox aEndNtNumFmtCB
;
350 FixedText aEndPrefixFT
;
352 SwNumberingTypeListBox aEndNumViewBox
;
353 FixedText aEndSuffixFT
;
357 DECL_LINK( FootEndHdl
, CheckBox
* );
358 void ResetState( BOOL bFtn
, const SwFmtFtnEndAtTxtEnd
& );
361 SwSectionFtnEndTabPage( Window
*pParent
, const SfxItemSet
&rAttrSet
);
362 virtual ~SwSectionFtnEndTabPage();
364 virtual BOOL
FillItemSet( SfxItemSet
& );
365 virtual void Reset( const SfxItemSet
& );
367 static SfxTabPage
* Create( Window
* pParent
,
368 const SfxItemSet
& rAttrSet
);
370 /* -----------------13.06.2003 09:51-----------------
372 --------------------------------------------------*/
373 class SwSectionIndentTabPage
: public SfxTabPage
377 MetricField aBeforeMF
;
379 MetricField aAfterMF
;
381 SvxParaPrevWindow aPreviewWin
;
383 DECL_LINK(IndentModifyHdl
, MetricField
*);
385 SwSectionIndentTabPage( Window
*pParent
, const SfxItemSet
&rAttrSet
);
386 virtual ~SwSectionIndentTabPage();
388 virtual BOOL
FillItemSet( SfxItemSet
& );
389 virtual void Reset( const SfxItemSet
& );
391 static SfxTabPage
* Create( Window
* pParent
,
392 const SfxItemSet
& rAttrSet
);
394 void SetWrtShell(SwWrtShell
& rSh
);
397 /* -----------------21.05.99 13:07-------------------
399 * --------------------------------------------------*/
400 class SwInsertSectionTabDialog
: public SfxTabDialog
403 SwSection
* pToInsertSection
;
405 virtual void PageCreated( USHORT nId
, SfxTabPage
&rPage
);
408 SwInsertSectionTabDialog(Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
);
409 virtual ~SwInsertSectionTabDialog();
411 void SetSection(const SwSection
& rSect
);
412 SwSection
* GetSection() { return pToInsertSection
;}
415 /* -----------------21.05.99 13:07-------------------
417 * --------------------------------------------------*/
418 class SwSectionPropertyTabDialog
: public SfxTabDialog
422 virtual void PageCreated( USHORT nId
, SfxTabPage
&rPage
);
424 SwSectionPropertyTabDialog(Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
);
425 virtual ~SwSectionPropertyTabDialog();