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: uiregionsw.cxx,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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
37 #include "hintids.hxx"
38 #include "regionsw.hxx"
39 #include <svtools/urihelper.hxx>
40 #include <svtools/PasswordHelper.hxx>
41 #include <vcl/svapp.hxx>
42 #ifndef _MSGBOX_HXX //autogen
43 #include <vcl/msgbox.hxx>
45 #include <svtools/stritem.hxx>
46 #include <svtools/eitem.hxx>
47 #ifndef _PASSWD_HXX //autogen
48 #include <sfx2/passwd.hxx>
50 #include <sfx2/docfilt.hxx>
51 #include <sfx2/request.hxx>
52 #include <sfx2/docfile.hxx>
53 #include <sfx2/linkmgr.hxx>
54 #include <sfx2/docinsert.hxx>
55 #include <sfx2/filedlghelper.hxx>
56 #ifndef _SVX_SIZEITEM_HXX //autogen
58 #include <svx/sizeitem.hxx>
60 #include <svx/htmlcfg.hxx>
62 #include <comphelper/storagehelper.hxx>
65 #include <section.hxx>
67 #include <doc.hxx> // fuers SwSectionFmt-Array
77 #include <swmodule.hxx>
79 #include <swundo.hxx> // fuer Undo-Ids
81 #include <fmtfsize.hxx>
82 #include <swunodef.hxx>
83 #include <shellio.hxx>
92 #include <regionsw.hrc>
95 #include <comcore.hrc>
98 #include <globals.hrc>
100 #include <sfx2/bindings.hxx>
101 #include <svx/htmlmode.hxx>
102 #include <svx/dlgutil.hxx>
103 #ifndef _SVX_DIALOGS_HRC
104 #include <svx/dialogs.hrc>
106 #include <svx/svxdlg.hxx>
107 #include <svx/flagsdef.hxx>
109 using namespace ::com::sun::star
;
112 SV_IMPL_PTRARR( SwSectionFmts
, SwSectionFmtPtr
)
114 #define FILE_NAME_LENGTH 17
116 SV_IMPL_OP_PTRARR_SORT( SectReprArr
, SectReprPtr
)
118 static void lcl_ReadSections( SwWrtShell
& rSh
, SfxMedium
& rMedium
, ComboBox
& rBox
);
120 /* -----------------25.06.99 15:38-------------------
122 --------------------------------------------------*/
123 class SwTestPasswdDlg
: public SfxPasswordDialog
126 SwTestPasswdDlg(Window
* pParent
) :
127 SfxPasswordDialog(pParent
)
129 SetHelpId(HID_DLG_PASSWD_SECTION
);
133 /*----------------------------------------------------------------------------
134 Beschreibung: User Data Klasse fuer Bereichsinformationen
135 ----------------------------------------------------------------------------*/
137 SectRepr::SectRepr( USHORT nPos
, SwSection
& rSect
) :
138 aSection( CONTENT_SECTION
, aEmptyStr
),
139 aBrush( RES_BACKGROUND
),
140 aFrmDirItem( FRMDIR_ENVIRONMENT
, RES_FRAMEDIR
),
141 aLRSpaceItem( RES_LR_SPACE
),
145 bContent
= aSection
.GetLinkFileName().Len() == 0;
147 SwSectionFmt
*pFmt
= rSect
.GetFmt();
150 aCol
= pFmt
->GetCol();
151 aBrush
= pFmt
->GetBackground();
152 aFtnNtAtEnd
= pFmt
->GetFtnAtTxtEnd();
153 aEndNtAtEnd
= pFmt
->GetEndAtTxtEnd();
154 aBalance
.SetValue(pFmt
->GetBalancedColumns().GetValue());
155 aFrmDirItem
= pFmt
->GetFrmDir();
156 aLRSpaceItem
= pFmt
->GetLRSpace();
160 void SectRepr::SetFile( const String
& rFile
)
162 String
sNewFile( INetURLObject::decode( rFile
, INET_HEX_ESCAPE
,
163 INetURLObject::DECODE_UNAMBIGUOUS
,
164 RTL_TEXTENCODING_UTF8
));
165 String
sOldFileName( aSection
.GetLinkFileName() );
166 String
sSub( sOldFileName
.GetToken( 2, sfx2::cTokenSeperator
) );
168 if( rFile
.Len() || sSub
.Len() )
170 sNewFile
+= sfx2::cTokenSeperator
;
171 if( rFile
.Len() ) // Filter nur mit FileName
172 sNewFile
+= sOldFileName
.GetToken( 1, sfx2::cTokenSeperator
);
174 sNewFile
+= sfx2::cTokenSeperator
;
178 aSection
.SetLinkFileName( sNewFile
);
180 if( rFile
.Len() || sSub
.Len() )
181 aSection
.SetType( FILE_LINK_SECTION
);
183 aSection
.SetType( CONTENT_SECTION
);
187 void SectRepr::SetFilter( const String
& rFilter
)
190 String
sOldFileName( aSection
.GetLinkFileName() );
191 String
sFile( sOldFileName
.GetToken( 0, sfx2::cTokenSeperator
) );
192 String
sSub( sOldFileName
.GetToken( 2, sfx2::cTokenSeperator
) );
195 (((( sNewFile
= sFile
) += sfx2::cTokenSeperator
) += rFilter
)
196 += sfx2::cTokenSeperator
) += sSub
;
197 else if( sSub
.Len() )
198 (( sNewFile
= sfx2::cTokenSeperator
) += sfx2::cTokenSeperator
) += sSub
;
200 aSection
.SetLinkFileName( sNewFile
);
203 aSection
.SetType( FILE_LINK_SECTION
);
206 void SectRepr::SetSubRegion(const String
& rSubRegion
)
209 String
sOldFileName( aSection
.GetLinkFileName() );
210 String
sFilter( sOldFileName
.GetToken( 1, sfx2::cTokenSeperator
) );
211 sOldFileName
= sOldFileName
.GetToken( 0, sfx2::cTokenSeperator
);
213 if( rSubRegion
.Len() || sOldFileName
.Len() )
214 (((( sNewFile
= sOldFileName
) += sfx2::cTokenSeperator
) += sFilter
)
215 += sfx2::cTokenSeperator
) += rSubRegion
;
217 aSection
.SetLinkFileName( sNewFile
);
219 if( rSubRegion
.Len() || sOldFileName
.Len() )
220 aSection
.SetType( FILE_LINK_SECTION
);
222 aSection
.SetType( CONTENT_SECTION
);
226 String
SectRepr::GetFile() const
228 String
sLinkFile( aSection
.GetLinkFileName() );
229 if( sLinkFile
.Len() )
231 if( DDE_LINK_SECTION
== aSection
.GetType() )
233 USHORT n
= sLinkFile
.SearchAndReplace( sfx2::cTokenSeperator
, ' ' );
234 sLinkFile
.SearchAndReplace( sfx2::cTokenSeperator
, ' ', n
);
237 sLinkFile
= INetURLObject::decode( sLinkFile
.GetToken( 0,
238 sfx2::cTokenSeperator
),
240 INetURLObject::DECODE_UNAMBIGUOUS
,
241 RTL_TEXTENCODING_UTF8
);
247 String
SectRepr::GetSubRegion() const
249 String
sLinkFile( aSection
.GetLinkFileName() );
250 if( sLinkFile
.Len() )
251 sLinkFile
= sLinkFile
.GetToken( 2, sfx2::cTokenSeperator
);
258 /*----------------------------------------------------------------------------
259 Beschreibung: Dialog Bearbeiten Bereiche
260 ----------------------------------------------------------------------------*/
262 //---------------------------------------------------------------------
264 SwEditRegionDlg::SwEditRegionDlg( Window
* pParent
, SwWrtShell
& rWrtSh
)
265 : SfxModalDialog( pParent
, SW_RES(MD_EDIT_REGION
) ),
266 aNameFL ( this, SW_RES( FL_NAME
) ),
267 aCurName ( this, SW_RES( ED_RANAME
) ),
268 aTree ( this, SW_RES( TLB_SECTION
)),
269 aLinkFL ( this, SW_RES( FL_LINK
) ),
270 aFileCB ( this, SW_RES( CB_FILE
) ),
271 aDDECB ( this, SW_RES( CB_DDE
) ) ,
272 aFileNameFT ( this, SW_RES( FT_FILE
) ) ,
273 aDDECommandFT ( this, SW_RES( FT_DDE
) ) ,
274 aFileNameED ( this, SW_RES( ED_FILE
) ),
275 aFilePB ( this, SW_RES( PB_FILE
) ),
276 aSubRegionFT ( this, SW_RES( FT_SUBREG
) ) ,
277 aSubRegionED ( this, SW_RES( LB_SUBREG
) ) ,
279 aProtectFL ( this, SW_RES( FL_PROTECT
) ),
280 aProtectCB ( this, SW_RES( CB_PROTECT
) ),
281 aPasswdCB ( this, SW_RES( CB_PASSWD
) ),
282 aPasswdPB ( this, SW_RES( PB_PASSWD
) ),
284 aHideFL ( this, SW_RES( FL_HIDE
) ),
285 aHideCB ( this, SW_RES( CB_HIDE
) ),
286 aConditionFT ( this, SW_RES( FT_CONDITION
) ),
287 aConditionED ( this, SW_RES( ED_CONDITION
) ),
289 // --> FME 2004-06-22 #114856# edit in readonly sections
290 aPropertiesFL ( this, SW_RES( FL_PROPERTIES
) ),
291 aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY
) ),
294 aOK ( this, SW_RES( PB_OK
) ),
295 aCancel ( this, SW_RES( PB_CANCEL
) ),
296 aOptionsPB ( this, SW_RES( PB_OPTIONS
) ),
297 aDismiss ( this, SW_RES( CB_DISMISS
) ),
298 aHelp ( this, SW_RES( PB_HELP
) ),
300 aImageIL ( SW_RES(IL_BITMAPS
)),
301 aImageILH ( SW_RES(ILH_BITMAPS
)),
305 m_pDocInserter ( NULL
),
306 m_pOldDefDlgParent ( NULL
),
307 bDontCheckPasswd ( sal_True
)
311 bWeb
= 0 != PTR_CAST( SwWebDocShell
, rSh
.GetView().GetDocShell() );
313 aTree
.SetSelectHdl ( LINK( this, SwEditRegionDlg
, GetFirstEntryHdl
));
314 aTree
.SetDeselectHdl ( LINK( this, SwEditRegionDlg
, DeselectHdl
));
315 aCurName
.SetModifyHdl ( LINK( this, SwEditRegionDlg
, NameEditHdl
));
316 aConditionED
.SetModifyHdl( LINK( this, SwEditRegionDlg
, ConditionEditHdl
));
317 aOK
.SetClickHdl ( LINK( this, SwEditRegionDlg
, OkHdl
));
318 aPasswdCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangePasswdHdl
));
319 aPasswdPB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangePasswdHdl
));
320 aHideCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangeHideHdl
));
321 // --> FME 2004-06-22 #114856# edit in readonly sections
322 aEditInReadonlyCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangeEditInReadonlyHdl
));
326 aOptionsPB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, OptionsHdl
));
327 aProtectCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangeProtectHdl
));
328 aDismiss
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangeDismissHdl
));
329 aFileCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, UseFileHdl
));
330 aFilePB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, FileSearchHdl
));
331 aFileNameED
.SetModifyHdl( LINK( this, SwEditRegionDlg
, FileNameHdl
));
332 aSubRegionED
.SetModifyHdl( LINK( this, SwEditRegionDlg
, FileNameHdl
));
334 aTree
.SetHelpId(HID_REGION_TREE
);
335 aTree
.SetSelectionMode( MULTIPLE_SELECTION
);
336 aTree
.SetWindowBits(WB_HASBUTTONSATROOT
|WB_CLIPCHILDREN
|WB_HSCROLL
);
337 aTree
.SetSpaceBetweenEntries(0);
341 aConditionFT
.Hide();
342 aConditionED
.Hide();
347 aDDECommandFT
.Hide();
350 aDDECB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, DDEHdl
));
352 //Ermitteln der vorhandenen Bereiche
353 pCurrSect
= rSh
.GetCurrSection();
355 //falls der Cursor nicht in einem Bereich steht,
356 //wird immer der erste selektiert
357 if( !aTree
.FirstSelected() && aTree
.First() )
358 aTree
.Select( aTree
.First() );
360 bDontCheckPasswd
= sal_False
;
362 /* -----------------------------26.04.01 14:56--------------------------------
364 ---------------------------------------------------------------------------*/
365 BOOL
SwEditRegionDlg::CheckPasswd(CheckBox
* pBox
)
369 sal_Bool bRet
= TRUE
;
370 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
373 SectReprPtr pRepr
= (SectReprPtr
)pEntry
->GetUserData();
374 if(!pRepr
->GetTempPasswd().getLength() && pRepr
->GetPasswd().getLength())
376 SwTestPasswdDlg
aPasswdDlg(this);
378 if (aPasswdDlg
.Execute())
380 String
sNewPasswd( aPasswdDlg
.GetPassword() );
381 UNO_NMSPC::Sequence
<sal_Int8
> aNewPasswd
;
382 SvPasswordHelper::GetHashPassword( aNewPasswd
, sNewPasswd
);
383 if(SvPasswordHelper::CompareHashPassword(pRepr
->GetPasswd(), sNewPasswd
))
385 pRepr
->SetTempPasswd(aNewPasswd
);
390 InfoBox(this, SW_RES(REG_WRONG_PASSWORD
)).Execute();
394 pEntry
= aTree
.NextSelected(pEntry
);
398 //reset old button state
399 if(pBox
->IsTriStateEnabled())
400 pBox
->SetState(pBox
->IsChecked() ? STATE_NOCHECK
: STATE_DONTKNOW
);
402 pBox
->Check(!pBox
->IsChecked());
407 /*---------------------------------------------------------------------
408 Beschreibung: Durchsuchen nach Child-Sections, rekursiv
409 ---------------------------------------------------------------------*/
411 void SwEditRegionDlg::RecurseList( const SwSectionFmt
* pFmt
, SvLBoxEntry
* pEntry
)
413 SwSection
* pSect
= 0;
414 SvLBoxEntry
* pSelEntry
= 0;
418 USHORT nCount
=rSh
.GetSectionFmtCount();
419 for ( USHORT n
=0; n
< nCount
; n
++ )
421 SectionType eTmpType
;
422 if( !( pFmt
= &rSh
.GetSectionFmt(n
))->GetParent() &&
423 pFmt
->IsInNodesArr() &&
424 (eTmpType
= pFmt
->GetSection()->GetType()) != TOX_CONTENT_SECTION
425 && TOX_HEADER_SECTION
!= eTmpType
)
427 SectRepr
* pSectRepr
= new SectRepr( n
,
428 *(pSect
=pFmt
->GetSection()) );
429 Image aImg
= BuildBitmap( pSect
->IsProtect(),pSect
->IsHidden(), FALSE
);
430 pEntry
= aTree
.InsertEntry( pSect
->GetName(), aImg
, aImg
);
431 Image aHCImg
= BuildBitmap( pSect
->IsProtect(),pSect
->IsHidden(), TRUE
);
432 aTree
.SetExpandedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
433 aTree
.SetCollapsedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
434 pEntry
->SetUserData(pSectRepr
);
435 RecurseList( pFmt
, pEntry
);
436 if (pEntry
->HasChilds())
437 aTree
.Expand(pEntry
);
438 if (pCurrSect
==pSect
)
439 aTree
.Select(pEntry
);
446 SvLBoxEntry
* pNEntry
;
447 USHORT nCnt
= pFmt
->GetChildSections(aTmpArr
,SORTSECT_POS
);
450 for( USHORT n
= 0; n
< nCnt
; ++n
)
452 SectionType eTmpType
;
453 pFmt
= aTmpArr
[n
]->GetFmt();
454 if( pFmt
->IsInNodesArr() &&
455 (eTmpType
= pFmt
->GetSection()->GetType()) != TOX_CONTENT_SECTION
456 && TOX_HEADER_SECTION
!= eTmpType
)
459 SectRepr
* pSectRepr
=new SectRepr(
460 FindArrPos( pSect
->GetFmt() ), *pSect
);
461 Image aImage
= BuildBitmap( pSect
->IsProtect(),
462 pSect
->IsHidden(), FALSE
);
463 pNEntry
=aTree
.InsertEntry( pSect
->GetName(), aImage
, aImage
, pEntry
);
464 Image aHCImg
= BuildBitmap( pSect
->IsProtect(),pSect
->IsHidden(), TRUE
);
465 aTree
.SetExpandedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
466 aTree
.SetCollapsedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
467 pNEntry
->SetUserData(pSectRepr
);
468 RecurseList( aTmpArr
[n
]->GetFmt(), pNEntry
);
469 if( pNEntry
->HasChilds())
470 aTree
.Expand(pNEntry
);
471 if (pCurrSect
==pSect
)
479 aTree
.MakeVisible(pSelEntry
);
480 aTree
.Select(pSelEntry
);
483 /*---------------------------------------------------------------------
485 ---------------------------------------------------------------------*/
487 USHORT
SwEditRegionDlg::FindArrPos(const SwSectionFmt
* pFmt
)
489 USHORT nCount
=rSh
.GetSectionFmtCount();
490 for (USHORT i
=0;i
<nCount
;i
++)
491 if (pFmt
==&rSh
.GetSectionFmt(i
))
494 DBG_ERROR( "SectionFormat nicht in der Liste" );
497 /*---------------------------------------------------------------------
499 ---------------------------------------------------------------------*/
501 SwEditRegionDlg::~SwEditRegionDlg( )
503 SvLBoxEntry
* pEntry
= aTree
.First();
506 delete (SectRepr
*)pEntry
->GetUserData();
507 pEntry
= aTree
.Next( pEntry
);
510 aSectReprArr
.DeleteAndDestroy( 0, aSectReprArr
.Count() );
511 delete m_pDocInserter
;
513 /* -----------------------------09.10.2001 15:41------------------------------
515 ---------------------------------------------------------------------------*/
516 void SwEditRegionDlg::SelectSection(const String
& rSectionName
)
518 SvLBoxEntry
* pEntry
= aTree
.First();
521 SectReprPtr pRepr
= (SectReprPtr
)pEntry
->GetUserData();
522 if(pRepr
->GetSection().GetName() == rSectionName
)
524 pEntry
= aTree
.Next(pEntry
);
528 aTree
.SelectAll( FALSE
);
529 aTree
.Select(pEntry
);
530 aTree
.MakeVisible(pEntry
);
533 /*---------------------------------------------------------------------
534 Beschreibung: Selektierte Eintrag in der TreeListBox wird im
535 Edit-Fenster angezeigt
536 Bei Multiselektion werden einige Controls disabled
537 ---------------------------------------------------------------------*/
539 IMPL_LINK( SwEditRegionDlg
, GetFirstEntryHdl
, SvTreeListBox
*, pBox
)
541 bDontCheckPasswd
= sal_True
;
542 SvLBoxEntry
* pEntry
=pBox
->FirstSelected();
543 aHideCB
.Enable(TRUE
);
544 // --> FME 2004-06-22 #114856# edit in readonly sections
545 aEditInReadonlyCB
.Enable(TRUE
);
547 aProtectCB
.Enable(TRUE
);
548 aFileCB
.Enable(TRUE
);
549 UNO_NMSPC::Sequence
<sal_Int8
> aCurPasswd
;
550 if( 1 < pBox
->GetSelectionCount() )
552 aHideCB
.EnableTriState( TRUE
);
553 aProtectCB
.EnableTriState( TRUE
);
554 // --> FME 2004-06-22 #114856# edit in readonly sections
555 aEditInReadonlyCB
.EnableTriState ( TRUE
);
557 aFileCB
.EnableTriState( TRUE
);
559 BOOL bHiddenValid
= TRUE
;
560 BOOL bProtectValid
= TRUE
;
561 BOOL bConditionValid
= TRUE
;
562 // --> FME 2004-06-22 #114856# edit in readonly sections
563 BOOL bEditInReadonlyValid
= TRUE
;
564 BOOL bEditInReadonly
= TRUE
;
567 BOOL bProtect
= TRUE
;
570 BOOL bFileValid
= TRUE
;
572 BOOL bPasswdValid
= TRUE
;
576 SectRepr
* pRepr
=(SectRepr
*) pEntry
->GetUserData();
579 sCondition
= pRepr
->GetCondition();
580 bHidden
= pRepr
->IsHidden();
581 bProtect
= pRepr
->IsProtect();
582 // --> FME 2004-06-22 #114856# edit in readonly sections
583 bEditInReadonly
= pRepr
->IsEditInReadonly();
585 bFile
= pRepr
->GetSectionType() != CONTENT_SECTION
;
586 aCurPasswd
= pRepr
->GetPasswd();
590 String
sTemp(pRepr
->GetCondition());
591 if(sCondition
!= sTemp
)
592 bConditionValid
= FALSE
;
593 bHiddenValid
= bHidden
== pRepr
->IsHidden();
594 bProtectValid
= bProtect
== pRepr
->IsProtect();
595 // --> FME 2004-06-22 #114856# edit in readonly sections
596 bEditInReadonlyValid
= bEditInReadonly
== pRepr
->IsEditInReadonly();
598 bFileValid
= (pRepr
->GetSectionType() != CONTENT_SECTION
) == bFile
;
599 bPasswdValid
= aCurPasswd
== pRepr
->GetPasswd();
601 pEntry
= pBox
->NextSelected(pEntry
);
605 aHideCB
.SetState( !bHiddenValid
? STATE_DONTKNOW
:
606 bHidden
? STATE_CHECK
: STATE_NOCHECK
);
607 aProtectCB
.SetState( !bProtectValid
? STATE_DONTKNOW
:
608 bProtect
? STATE_CHECK
: STATE_NOCHECK
);
609 // --> FME 2004-06-22 #114856# edit in readonly sections
610 aEditInReadonlyCB
.SetState( !bEditInReadonlyValid
? STATE_DONTKNOW
:
611 bEditInReadonly
? STATE_CHECK
: STATE_NOCHECK
);
613 aFileCB
.SetState(!bFileValid
? STATE_DONTKNOW
:
614 bFile
? STATE_CHECK
: STATE_NOCHECK
);
617 aConditionED
.SetText(sCondition
);
620 // aConditionED.SetText(aEmptyStr);
621 aConditionFT
.Enable(FALSE
);
622 aConditionED
.Enable(FALSE
);
625 aFilePB
.Enable(FALSE
);
626 aFileNameFT
.Enable(FALSE
);
627 aFileNameED
.Enable(FALSE
);
628 aSubRegionFT
.Enable(FALSE
);
629 aSubRegionED
.Enable(FALSE
);
630 // aNameFT .Enable(FALSE);
631 aCurName
.Enable(FALSE
);
632 aOptionsPB
.Enable(FALSE
);
633 aDDECB
.Enable(FALSE
);
634 aDDECommandFT
.Enable(FALSE
);
635 BOOL bPasswdEnabled
= aProtectCB
.GetState() == STATE_CHECK
;
636 aPasswdCB
.Enable(bPasswdEnabled
);
637 aPasswdPB
.Enable(bPasswdEnabled
);
640 pEntry
= pBox
->FirstSelected();
641 pBox
->SelectAll( FALSE
);
642 pBox
->Select( pEntry
);
643 GetFirstEntryHdl(pBox
);
647 aPasswdCB
.Check(aCurPasswd
.getLength() > 0);
651 // aNameFT .Enable(TRUE);
652 aCurName
.Enable(TRUE
);
653 aOptionsPB
.Enable(TRUE
);
654 SectRepr
* pRepr
=(SectRepr
*) pEntry
->GetUserData();
655 aConditionED
.SetText(pRepr
->GetCondition());
657 aHideCB
.SetState(pRepr
->IsHidden() ? STATE_CHECK
: STATE_NOCHECK
);
658 BOOL bHide
= STATE_CHECK
== aHideCB
.GetState();
659 aConditionED
.Enable(bHide
);
660 aConditionFT
.Enable(bHide
);
661 aPasswdCB
.Check(pRepr
->GetPasswd().getLength() > 0);
665 aCurName
.SetText(pBox
->GetEntryText(pEntry
));
668 String aFile
= pRepr
->GetFile();
669 String sSub
= pRepr
->GetSubRegion();
670 if(aFile
.Len()||sSub
.Len())
673 aFileNameED
.SetText(aFile
);
674 aSubRegionED
.SetText(sSub
);
675 aDDECB
.Check(pRepr
->GetSectionType() == DDE_LINK_SECTION
);
679 aFileCB
.Check(FALSE
);
680 aFileNameED
.SetText(aFile
);
681 aDDECB
.Enable(FALSE
);
684 UseFileHdl(&aFileCB
);
686 aProtectCB
.SetState(pRepr
->IsProtect() ? STATE_CHECK
: STATE_NOCHECK
);
689 // --> FME 2004-06-22 #114856# edit in readonly sections
690 aEditInReadonlyCB
.SetState( pRepr
->IsEditInReadonly() ? STATE_CHECK
: STATE_NOCHECK
);
691 aEditInReadonlyCB
.Enable();
694 BOOL bPasswdEnabled
= aProtectCB
.IsChecked();
695 aPasswdCB
.Enable(bPasswdEnabled
);
696 aPasswdPB
.Enable(bPasswdEnabled
);
698 bDontCheckPasswd
= sal_False
;
701 /*-----------------28.06.97 09:19-------------------
703 --------------------------------------------------*/
704 IMPL_LINK( SwEditRegionDlg
, DeselectHdl
, SvTreeListBox
*, pBox
)
706 if( !pBox
->GetSelectionCount() )
708 aHideCB
.Enable(FALSE
);
709 aProtectCB
.Enable(FALSE
);
710 // --> FME 2004-06-22 #114856# edit in readonly sections
711 aEditInReadonlyCB
.Enable(FALSE
);
713 aPasswdCB
.Enable(FALSE
);
714 aPasswdCB
.Enable(FALSE
);
715 aConditionFT
.Enable(FALSE
);
716 aConditionED
.Enable(FALSE
);
717 aFileCB
.Enable(FALSE
);
718 aFilePB
.Enable(FALSE
);
719 aFileNameFT
.Enable(FALSE
);
720 aFileNameED
.Enable(FALSE
);
721 aSubRegionFT
.Enable(FALSE
);
722 aSubRegionED
.Enable(FALSE
);
723 // aNameFT .Enable(FALSE);
724 aCurName
.Enable(FALSE
);
725 aDDECB
.Enable(FALSE
);
726 aDDECommandFT
.Enable(FALSE
);
728 UseFileHdl(&aFileCB
);
734 /*---------------------------------------------------------------------
735 Beschreibung: Im OkHdl werden die veraenderten Einstellungen
736 uebernommen und aufgehobene Bereiche geloescht
737 ---------------------------------------------------------------------*/
739 IMPL_LINK( SwEditRegionDlg
, OkHdl
, CheckBox
*, EMPTYARG
)
742 // temp. Array weil sich waehrend des aendern eines Bereiches die
743 // Position innerhalb des "Core-Arrays" verschieben kann:
744 // - bei gelinkten Bereichen, wenn sie weitere SubBereiche haben oder
746 // JP 30.05.97: StartUndo darf natuerlich auch erst nach dem Kopieren
747 // der Formate erfolgen (ClearRedo!)
749 const SwSectionFmts
& rDocFmts
= rSh
.GetDoc()->GetSections();
750 SwSectionFmts
aOrigArray( 0, 5 );
751 aOrigArray
.Insert( &rDocFmts
, 0 );
753 rSh
.StartAllAction();
755 rSh
.ResetSelect( 0,FALSE
);
756 SvLBoxEntry
* pEntry
= aTree
.First();
760 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
761 SwSectionFmt
* pFmt
= aOrigArray
[ pRepr
->GetArrPos() ];
762 if( !pRepr
->GetSection().IsProtectFlag())
763 pRepr
->GetSection().SetPasswd(UNO_NMSPC::Sequence
<sal_Int8
>());
764 USHORT nNewPos
= rDocFmts
.GetPos( pFmt
);
765 if( USHRT_MAX
!= nNewPos
)
767 SfxItemSet
* pSet
= pFmt
->GetAttrSet().Clone( FALSE
);
768 if( pFmt
->GetCol() != pRepr
->GetCol() )
769 pSet
->Put( pRepr
->GetCol() );
771 if( pFmt
->GetBackground(FALSE
) != pRepr
->GetBackground() )
772 pSet
->Put( pRepr
->GetBackground() );
774 if( pFmt
->GetFtnAtTxtEnd(FALSE
) != pRepr
->GetFtnNtAtEnd() )
775 pSet
->Put( pRepr
->GetFtnNtAtEnd() );
777 if( pFmt
->GetEndAtTxtEnd(FALSE
) != pRepr
->GetEndNtAtEnd() )
778 pSet
->Put( pRepr
->GetEndNtAtEnd() );
780 if( pFmt
->GetBalancedColumns() != pRepr
->GetBalance() )
781 pSet
->Put( pRepr
->GetBalance() );
783 if( pFmt
->GetFrmDir() != pRepr
->GetFrmDir() )
784 pSet
->Put( pRepr
->GetFrmDir() );
786 if( pFmt
->GetLRSpace() != pRepr
->GetLRSpace())
787 pSet
->Put( pRepr
->GetLRSpace());
789 rSh
.ChgSection( nNewPos
, pRepr
->GetSection(),
790 pSet
->Count() ? pSet
: 0 );
793 pEntry
= aTree
.Next( pEntry
);
796 for(USHORT i
= aSectReprArr
.Count(); i
; )
798 SwSectionFmt
* pFmt
= aOrigArray
[ aSectReprArr
[ --i
]->GetArrPos() ];
799 USHORT nNewPos
= rDocFmts
.GetPos( pFmt
);
800 if( USHRT_MAX
!= nNewPos
)
801 rSh
.DelSectionFmt( nNewPos
);
803 // rSh.ChgSectionPasswd(aNewPasswd);
805 aOrigArray
.Remove( 0, aOrigArray
.Count() );
807 //JP 21.05.97: EndDialog muss vor Ende der EndAction gerufen werden,
808 // sonst kann es ScrollFehler geben.
816 /*---------------------------------------------------------------------
817 Beschreibung: Toggle protect
818 ---------------------------------------------------------------------*/
820 IMPL_LINK( SwEditRegionDlg
, ChangeProtectHdl
, TriStateBox
*, pBox
)
822 if(!CheckPasswd(pBox
))
824 pBox
->EnableTriState( FALSE
);
825 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
826 DBG_ASSERT(pEntry
,"kein Entry gefunden");
827 BOOL bCheck
= STATE_CHECK
== pBox
->GetState();
830 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
831 pRepr
->SetProtect(bCheck
);
832 Image aImage
= BuildBitmap( bCheck
,
833 STATE_CHECK
== aHideCB
.GetState(), FALSE
);
834 aTree
.SetExpandedEntryBmp(pEntry
, aImage
, BMP_COLOR_NORMAL
);
835 aTree
.SetCollapsedEntryBmp(pEntry
, aImage
, BMP_COLOR_NORMAL
);
836 Image aHCImg
= BuildBitmap( bCheck
, STATE_CHECK
== aHideCB
.GetState(), TRUE
);
837 aTree
.SetExpandedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
838 aTree
.SetCollapsedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
839 pEntry
= aTree
.NextSelected(pEntry
);
841 aPasswdCB
.Enable(bCheck
);
842 aPasswdPB
.Enable(bCheck
);
845 /*---------------------------------------------------------------------
846 Beschreibung: Toggle hide
847 ---------------------------------------------------------------------*/
849 IMPL_LINK( SwEditRegionDlg
, ChangeHideHdl
, TriStateBox
*, pBox
)
851 if(!CheckPasswd(pBox
))
853 pBox
->EnableTriState( FALSE
);
854 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
855 DBG_ASSERT(pEntry
,"kein Entry gefunden");
858 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
859 pRepr
->SetHidden(STATE_CHECK
== pBox
->GetState());
860 Image aImage
= BuildBitmap(STATE_CHECK
== aProtectCB
.GetState(),
861 STATE_CHECK
== pBox
->GetState(), FALSE
);
862 aTree
.SetExpandedEntryBmp(pEntry
, aImage
, BMP_COLOR_NORMAL
);
863 aTree
.SetCollapsedEntryBmp(pEntry
, aImage
, BMP_COLOR_NORMAL
);
864 Image aHCImg
= BuildBitmap( STATE_CHECK
== aProtectCB
.GetState(),
865 STATE_CHECK
== pBox
->GetState(), TRUE
);
866 aTree
.SetExpandedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
867 aTree
.SetCollapsedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
869 pEntry
= aTree
.NextSelected(pEntry
);
872 BOOL bHide
= STATE_CHECK
== pBox
->GetState();
873 aConditionED
.Enable(bHide
);
874 aConditionFT
.Enable(bHide
);
878 /*---------------------------------------------------------------------
879 Beschreibung: Toggle edit in readonly
880 ---------------------------------------------------------------------*/
882 IMPL_LINK( SwEditRegionDlg
, ChangeEditInReadonlyHdl
, TriStateBox
*, pBox
)
884 if(!CheckPasswd(pBox
))
886 pBox
->EnableTriState( FALSE
);
887 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
888 DBG_ASSERT(pEntry
,"kein Entry gefunden");
891 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
892 pRepr
->SetEditInReadonly(STATE_CHECK
== pBox
->GetState());
893 pEntry
= aTree
.NextSelected(pEntry
);
899 /*---------------------------------------------------------------------
900 Beschreibung: selektierten Bereich aufheben
901 ---------------------------------------------------------------------*/
903 IMPL_LINK( SwEditRegionDlg
, ChangeDismissHdl
, CheckBox
*, EMPTYARG
)
907 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
909 SvLBoxEntry
* pParent
;
910 //zuerst alle selektierten markieren
913 const SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
914 pSectRepr
->SetSelected();
915 pEntry
= aTree
.NextSelected(pEntry
);
917 pEntry
= aTree
.FirstSelected();
921 const SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
922 SvLBoxEntry
* pRemove
= 0;
923 BOOL bRestart
= FALSE
;
924 if(pSectRepr
->IsSelected())
926 aSectReprArr
.Insert( pSectRepr
);
927 while( (pChild
= aTree
.FirstChild(pEntry
) )!= 0 )
929 //durch das Umhaengen muss wieder am Anfang aufgesetzt werden
931 pParent
=aTree
.GetParent(pEntry
);
932 aTree
.GetModel()->Move(pChild
, pParent
, aTree
.GetModel()->GetRelPos(pEntry
));
937 pEntry
= aTree
.First();
939 pEntry
= aTree
.Next(pEntry
);
941 aTree
.GetModel()->Remove( pRemove
);
944 if ( (pEntry
=aTree
.FirstSelected()) == 0 )
946 aConditionFT
. Enable(FALSE
);
947 aConditionED
. Enable(FALSE
);
948 aDismiss
. Enable(FALSE
);
949 aCurName
. Enable(FALSE
);
950 aProtectCB
. Enable(FALSE
);
951 aPasswdCB
. Enable(FALSE
);
952 aHideCB
. Enable(FALSE
);
953 // --> FME 2004-06-22 #114856# edit in readonly sections
954 aEditInReadonlyCB
.Enable(FALSE
);
955 aEditInReadonlyCB
.SetState(STATE_NOCHECK
);
957 aProtectCB
. SetState(STATE_NOCHECK
);
958 aPasswdCB
. Check(FALSE
);
959 aHideCB
. SetState(STATE_NOCHECK
);
960 aFileCB
. Check(FALSE
);
961 //sonst liegt der Focus auf dem HelpButton
963 UseFileHdl(&aFileCB
);
967 /*---------------------------------------------------------------------
968 Beschreibung: CheckBox mit Datei verknuepfen?
969 ---------------------------------------------------------------------*/
971 IMPL_LINK( SwEditRegionDlg
, UseFileHdl
, CheckBox
*, pBox
)
973 if(!CheckPasswd(pBox
))
975 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
976 pBox
->EnableTriState(FALSE
);
977 BOOL bMulti
= 1 < aTree
.GetSelectionCount();
978 BOOL bFile
= pBox
->IsChecked();
983 const SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
984 BOOL bContent
= pSectRepr
->IsContent();
985 if( pBox
->IsChecked() && bContent
&& rSh
.HasSelection() )
987 if( RET_NO
== QueryBox( this, SW_RES(QB_CONNECT
) ).Execute() )
988 pBox
->Check( FALSE
);
991 pSectRepr
->SetContent(FALSE
);
994 pSectRepr
->SetFile(aEmptyStr
);
995 pSectRepr
->SetSubRegion(aEmptyStr
);
996 pSectRepr
->SetFilePasswd(aEmptyStr
);
999 pEntry
= aTree
.NextSelected(pEntry
);
1001 aFileNameFT
.Enable(bFile
&& ! bMulti
);
1002 aFileNameED
.Enable(bFile
&& ! bMulti
);
1003 aFilePB
.Enable(bFile
&& ! bMulti
);
1004 aSubRegionED
.Enable(bFile
&& ! bMulti
);
1005 aSubRegionFT
.Enable(bFile
&& ! bMulti
);
1006 aDDECommandFT
.Enable(bFile
&& ! bMulti
);
1007 aDDECB
.Enable(bFile
&& ! bMulti
);
1010 aProtectCB
.SetState(STATE_CHECK
);
1011 aFileNameED
.GrabFocus();
1016 aDDECB
.Check(FALSE
);
1018 // aFileNameED.SetText(aEmptyStr);
1019 aSubRegionED
.SetText(aEmptyStr
);
1025 pBox
->Enable(FALSE
);
1026 aFilePB
.Enable(FALSE
);
1027 aFileNameED
.Enable(FALSE
);
1028 aFileNameFT
.Enable(FALSE
);
1029 aSubRegionED
.Enable(FALSE
);
1030 aSubRegionFT
.Enable(FALSE
);
1031 aDDECB
.Check(FALSE
);
1032 aDDECB
.Enable(FALSE
);
1033 aDDECommandFT
.Enable(FALSE
);
1038 /*---------------------------------------------------------------------
1039 Beschreibung: Dialog Datei einfuegen rufen
1040 ---------------------------------------------------------------------*/
1042 IMPL_LINK( SwEditRegionDlg
, FileSearchHdl
, PushButton
*, EMPTYARG
)
1047 m_pOldDefDlgParent
= Application::GetDefDialogParent();
1048 Application::SetDefDialogParent( this );
1049 if ( m_pDocInserter
)
1050 delete m_pDocInserter
;
1051 m_pDocInserter
= new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") );
1052 m_pDocInserter
->StartExecuteModal( LINK( this, SwEditRegionDlg
, DlgClosedHdl
) );
1056 /*---------------------------------------------------------------------
1058 ---------------------------------------------------------------------*/
1060 IMPL_LINK( SwEditRegionDlg
, OptionsHdl
, PushButton
*, EMPTYARG
)
1064 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
1068 SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1069 SfxItemSet
aSet(rSh
.GetView().GetPool(),
1071 RES_COLUMNBALANCE
, RES_FRAMEDIR
,
1072 RES_BACKGROUND
, RES_BACKGROUND
,
1073 RES_FRM_SIZE
, RES_FRM_SIZE
,
1074 SID_ATTR_PAGE_SIZE
, SID_ATTR_PAGE_SIZE
,
1075 RES_LR_SPACE
, RES_LR_SPACE
,
1076 RES_FTN_AT_TXTEND
, RES_END_AT_TXTEND
,
1079 aSet
.Put( pSectRepr
->GetCol() );
1080 aSet
.Put( pSectRepr
->GetBackground() );
1081 aSet
.Put( pSectRepr
->GetFtnNtAtEnd() );
1082 aSet
.Put( pSectRepr
->GetEndNtAtEnd() );
1083 aSet
.Put( pSectRepr
->GetBalance() );
1084 aSet
.Put( pSectRepr
->GetFrmDir() );
1085 aSet
.Put( pSectRepr
->GetLRSpace() );
1087 const SwSectionFmts
& rDocFmts
= rSh
.GetDoc()->GetSections();
1088 SwSectionFmts
aOrigArray( 0, 5 );
1089 aOrigArray
.Insert( &rDocFmts
, 0 );
1091 SwSectionFmt
* pFmt
= aOrigArray
[pSectRepr
->GetArrPos()];
1092 long nWidth
= rSh
.GetSectionWidth(*pFmt
);
1093 aOrigArray
.Remove( 0, aOrigArray
.Count() );
1097 aSet
.Put(SwFmtFrmSize(ATT_VAR_SIZE
, nWidth
));
1098 aSet
.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE
, Size(nWidth
, nWidth
)));
1100 SwSectionPropertyTabDialog
aTabDlg(this, aSet
, rSh
);
1101 if(RET_OK
== aTabDlg
.Execute())
1103 const SfxItemSet
* pOutSet
= aTabDlg
.GetOutputItemSet();
1104 if( pOutSet
&& pOutSet
->Count() )
1106 const SfxPoolItem
*pColItem
, *pBrushItem
,
1107 *pFtnItem
, *pEndItem
, *pBalanceItem
,
1108 *pFrmDirItem
, *pLRSpaceItem
;
1109 SfxItemState eColState
= pOutSet
->GetItemState(
1110 RES_COL
, FALSE
, &pColItem
);
1111 SfxItemState eBrushState
= pOutSet
->GetItemState(
1112 RES_BACKGROUND
, FALSE
, &pBrushItem
);
1113 SfxItemState eFtnState
= pOutSet
->GetItemState(
1114 RES_FTN_AT_TXTEND
, FALSE
, &pFtnItem
);
1115 SfxItemState eEndState
= pOutSet
->GetItemState(
1116 RES_END_AT_TXTEND
, FALSE
, &pEndItem
);
1117 SfxItemState eBalanceState
= pOutSet
->GetItemState(
1118 RES_COLUMNBALANCE
, FALSE
, &pBalanceItem
);
1119 SfxItemState eFrmDirState
= pOutSet
->GetItemState(
1120 RES_FRAMEDIR
, FALSE
, &pFrmDirItem
);
1121 SfxItemState eLRState
= pOutSet
->GetItemState(
1122 RES_LR_SPACE
, FALSE
, &pLRSpaceItem
);
1124 if( SFX_ITEM_SET
== eColState
||
1125 SFX_ITEM_SET
== eBrushState
||
1126 SFX_ITEM_SET
== eFtnState
||
1127 SFX_ITEM_SET
== eEndState
||
1128 SFX_ITEM_SET
== eBalanceState
||
1129 SFX_ITEM_SET
== eFrmDirState
||
1130 SFX_ITEM_SET
== eLRState
)
1132 SvLBoxEntry
* pSelEntry
= aTree
.FirstSelected();
1135 SectReprPtr pRepr
= (SectReprPtr
)pSelEntry
->GetUserData();
1136 if( SFX_ITEM_SET
== eColState
)
1137 pRepr
->GetCol() = *(SwFmtCol
*)pColItem
;
1138 if( SFX_ITEM_SET
== eBrushState
)
1139 pRepr
->GetBackground() = *(SvxBrushItem
*)pBrushItem
;
1140 if( SFX_ITEM_SET
== eFtnState
)
1141 pRepr
->GetFtnNtAtEnd() = *(SwFmtFtnAtTxtEnd
*)pFtnItem
;
1142 if( SFX_ITEM_SET
== eEndState
)
1143 pRepr
->GetEndNtAtEnd() = *(SwFmtEndAtTxtEnd
*)pEndItem
;
1144 if( SFX_ITEM_SET
== eBalanceState
)
1145 pRepr
->GetBalance().SetValue(((SwFmtNoBalancedColumns
*)pBalanceItem
)->GetValue());
1146 if( SFX_ITEM_SET
== eFrmDirState
)
1147 pRepr
->GetFrmDir().SetValue(((SvxFrameDirectionItem
*)pFrmDirItem
)->GetValue());
1148 if( SFX_ITEM_SET
== eLRState
)
1149 pRepr
->GetLRSpace() = *(SvxLRSpaceItem
*)pLRSpaceItem
;
1151 pSelEntry
= aTree
.NextSelected(pSelEntry
);
1161 /*---------------------------------------------------------------------
1162 Beschreibung: Uebernahme des Dateinamen oder
1163 des verknuepften Bereichs
1164 ---------------------------------------------------------------------*/
1166 IMPL_LINK( SwEditRegionDlg
, FileNameHdl
, Edit
*, pEdit
)
1168 Selection aSelect
= pEdit
->GetSelection();
1171 pEdit
->SetSelection(aSelect
);
1172 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
1173 DBG_ASSERT(pEntry
,"kein Entry gefunden");
1174 SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1175 if(pEdit
== &aFileNameED
)
1177 if( aDDECB
.IsChecked() )
1179 String
sLink( pEdit
->GetText() );
1181 while( STRING_NOTFOUND
!= (nPos
= sLink
.SearchAscii( " ", nPos
)) )
1182 sLink
.Erase( nPos
--, 1 );
1184 nPos
= sLink
.SearchAndReplace( ' ', sfx2::cTokenSeperator
);
1185 sLink
.SearchAndReplace( ' ', sfx2::cTokenSeperator
, nPos
);
1187 pSectRepr
->GetSection().SetLinkFileName( sLink
);
1188 pSectRepr
->GetSection().SetType( DDE_LINK_SECTION
);
1192 String
sTmp(pEdit
->GetText());
1195 SfxMedium
* pMedium
= rSh
.GetView().GetDocShell()->GetMedium();
1198 aAbs
= pMedium
->GetURLObject();
1199 sTmp
= URIHelper::SmartRel2Abs(
1200 aAbs
, sTmp
, URIHelper::GetMaybeFileHdl() );
1202 pSectRepr
->SetFile( sTmp
);
1203 pSectRepr
->SetFilePasswd( aEmptyStr
);
1208 pSectRepr
->SetSubRegion( pEdit
->GetText() );
1212 /*---------------------------------------------------------------------
1214 ---------------------------------------------------------------------*/
1216 IMPL_LINK( SwEditRegionDlg
, DDEHdl
, CheckBox
*, pBox
)
1218 if(!CheckPasswd(pBox
))
1220 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
1223 BOOL bFile
= aFileCB
.IsChecked();
1224 SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1225 BOOL bDDE
= pBox
->IsChecked();
1229 aDDECommandFT
.Enable();
1230 aDDECommandFT
.Show();
1231 aSubRegionFT
.Hide();
1232 aSubRegionED
.Hide();
1233 if(FILE_LINK_SECTION
== pSectRepr
->GetSectionType() )
1235 pSectRepr
->SetFile(aEmptyStr
);
1236 aFileNameED
.SetText(aEmptyStr
);
1237 pSectRepr
->SetFilePasswd( aEmptyStr
);
1239 pSectRepr
->SetSectionType( DDE_LINK_SECTION
);
1243 aDDECommandFT
.Hide();
1244 aFileNameFT
.Enable(bFile
);
1246 aSubRegionED
.Show();
1247 aSubRegionFT
.Show();
1248 aSubRegionED
.Enable(bFile
);
1249 aSubRegionFT
.Enable(bFile
);
1250 aSubRegionED
.Enable(bFile
);
1251 if(DDE_LINK_SECTION
== pSectRepr
->GetSectionType() )
1253 pSectRepr
->SetSectionType( FILE_LINK_SECTION
);
1254 pSectRepr
->SetFile(aEmptyStr
);
1255 pSectRepr
->SetFilePasswd( aEmptyStr
);
1256 aFileNameED
.SetText(aEmptyStr
);
1259 aFilePB
.Enable(bFile
&& !bDDE
);
1263 /*---------------------------------------------------------------------
1265 ---------------------------------------------------------------------*/
1267 IMPL_LINK( SwEditRegionDlg
, ChangePasswdHdl
, Button
*, pBox
)
1269 sal_Bool bChange
= pBox
== &aPasswdPB
;
1273 aPasswdCB
.Check(!aPasswdCB
.IsChecked());
1276 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
1277 sal_Bool bSet
= bChange
? bChange
: aPasswdCB
.IsChecked();
1278 DBG_ASSERT(pEntry
,"kein Entry gefunden");
1281 SectReprPtr pRepr
= (SectReprPtr
)pEntry
->GetUserData();
1284 if(!pRepr
->GetTempPasswd().getLength() || bChange
)
1286 SwTestPasswdDlg
aPasswdDlg(this);
1287 aPasswdDlg
.ShowExtras(SHOWEXTRAS_CONFIRM
);
1288 if(RET_OK
== aPasswdDlg
.Execute())
1290 String
sNewPasswd( aPasswdDlg
.GetPassword() );
1291 if( aPasswdDlg
.GetConfirm() == sNewPasswd
)
1293 SvPasswordHelper::GetHashPassword( pRepr
->GetTempPasswd(), sNewPasswd
);
1297 InfoBox(pBox
, SW_RES(REG_WRONG_PASSWD_REPEAT
)).Execute();
1298 ChangePasswdHdl(pBox
);
1305 aPasswdCB
.Check(FALSE
);
1309 pRepr
->GetSection().SetPasswd(pRepr
->GetTempPasswd());
1312 pRepr
->GetSection().SetPasswd(UNO_NMSPC::Sequence
<sal_Int8
>());
1313 pEntry
= aTree
.NextSelected(pEntry
);
1317 /*---------------------------------------------------------------------
1318 Beschreibung: Aktueller Bereichsname wird sofort beim editieren
1319 in die TreeListBox eingetragen, mit leerem String
1321 ---------------------------------------------------------------------*/
1323 IMPL_LINK( SwEditRegionDlg
, NameEditHdl
, Edit
*, EMPTYARG
)
1327 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
1328 DBG_ASSERT(pEntry
,"kein Entry gefunden");
1331 String aName
= aCurName
.GetText();
1332 aTree
.SetEntryText(pEntry
,aName
);
1333 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
1334 pRepr
->GetSection().SetName(aName
);
1336 aOK
.Enable(aName
.Len() != 0);
1340 /*---------------------------------------------------------------------
1342 ---------------------------------------------------------------------*/
1344 IMPL_LINK( SwEditRegionDlg
, ConditionEditHdl
, Edit
*, pEdit
)
1346 Selection aSelect
= pEdit
->GetSelection();
1349 pEdit
->SetSelection(aSelect
);
1350 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
1351 DBG_ASSERT(pEntry
,"kein Entry gefunden");
1354 SectReprPtr pRepr
= (SectReprPtr
)pEntry
->GetUserData();
1355 pRepr
->SetCondition (pEdit
->GetText());
1356 pEntry
= aTree
.NextSelected(pEntry
);
1361 IMPL_LINK( SwEditRegionDlg
, DlgClosedHdl
, sfx2::FileDialogHelper
*, _pFileDlg
)
1363 String sFileName
, sFilterName
, sPassword
;
1364 if ( _pFileDlg
->GetError() == ERRCODE_NONE
)
1366 SfxMedium
* pMedium
= m_pDocInserter
->CreateMedium();
1369 sFileName
= pMedium
->GetURLObject().GetMainURL( INetURLObject::NO_DECODE
);
1370 sFilterName
= pMedium
->GetFilter()->GetFilterName();
1371 const SfxPoolItem
* pItem
;
1372 if ( SFX_ITEM_SET
== pMedium
->GetItemSet()->GetItemState( SID_PASSWORD
, FALSE
, &pItem
) )
1373 sPassword
= ( (SfxStringItem
*)pItem
)->GetValue();
1374 ::lcl_ReadSections( rSh
, *pMedium
, aSubRegionED
);
1379 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
1380 DBG_ASSERT( pEntry
, "no entry found" );
1383 SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1384 pSectRepr
->SetFile( sFileName
);
1385 pSectRepr
->SetFilter( sFilterName
);
1386 pSectRepr
->SetFilePasswd( sPassword
);
1387 aFileNameED
.SetText( pSectRepr
->GetFile() );
1390 Application::SetDefDialogParent( m_pOldDefDlgParent
);
1394 /* -----------------------------08.05.2002 15:00------------------------------
1396 ---------------------------------------------------------------------------*/
1397 Image
SwEditRegionDlg::BuildBitmap(BOOL bProtect
,BOOL bHidden
, BOOL bHighContrast
)
1399 ImageList
& rImgLst
= bHighContrast
? aImageILH
: aImageIL
;
1400 return rImgLst
.GetImage((!bHidden
+(bProtect
<<1)) + 1);
1403 /*--------------------------------------------------------------------
1404 Beschreibung: Hilfsfunktion - Bereichsnamen aus dem Medium lesen
1405 --------------------------------------------------------------------*/
1407 static void lcl_ReadSections( SwWrtShell
& /*rSh*/, SfxMedium
& rMedium
, ComboBox
& rBox
)
1410 uno::Reference
< embed::XStorage
> xStg
;
1411 if( rMedium
.IsStorage() && (xStg
= rMedium
.GetStorage()).is() )
1413 SvStringsDtor
aArr( 10, 10 );
1414 sal_uInt32 nFormat
= SotStorage::GetFormatID( xStg
);
1415 if ( nFormat
== SOT_FORMATSTR_ID_STARWRITER_60
|| nFormat
== SOT_FORMATSTR_ID_STARWRITERGLOB_60
||
1416 nFormat
== SOT_FORMATSTR_ID_STARWRITER_8
|| nFormat
== SOT_FORMATSTR_ID_STARWRITERGLOB_8
)
1417 SwGetReaderXML()->GetSectionList( rMedium
, (SvStrings
&) aArr
);
1419 for( USHORT n
= 0; n
< aArr
.Count(); ++n
)
1420 rBox
.InsertEntry( *aArr
[ n
] );
1423 /* -----------------21.05.99 10:16-------------------
1425 * --------------------------------------------------*/
1426 SwInsertSectionTabDialog::SwInsertSectionTabDialog(
1427 Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
) :
1428 SfxTabDialog( pParent
, SW_RES(DLG_INSERT_SECTION
), &rSet
),
1432 String
sInsert(SW_RES(ST_INSERT
));
1433 GetOKButton().SetText(sInsert
);
1435 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
1436 DBG_ASSERT(pFact
, "Dialogdiet fail!");
1437 AddTabPage(TP_INSERT_SECTION
, SwInsertSectionTabPage::Create
, 0);
1438 AddTabPage(TP_COLUMN
, SwColumnPage::Create
, 0);
1439 AddTabPage(TP_BACKGROUND
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), 0);
1440 AddTabPage(TP_SECTION_FTNENDNOTES
, SwSectionFtnEndTabPage::Create
, 0);
1441 AddTabPage(TP_SECTION_INDENTS
, SwSectionIndentTabPage::Create
, 0);
1443 SvxHtmlOptions
* pHtmlOpt
= SvxHtmlOptions::Get();
1444 long nHtmlMode
= pHtmlOpt
->GetExportMode();
1446 BOOL bWeb
= 0 != PTR_CAST( SwWebDocShell
, rSh
.GetView().GetDocShell() );
1449 RemoveTabPage(TP_SECTION_FTNENDNOTES
);
1450 RemoveTabPage(TP_SECTION_INDENTS
);
1451 if( HTML_CFG_NS40
!= nHtmlMode
&& HTML_CFG_WRITER
!= nHtmlMode
)
1452 RemoveTabPage(TP_COLUMN
);
1454 SetCurPageId(TP_INSERT_SECTION
);
1456 /* -----------------21.05.99 10:17-------------------
1458 * --------------------------------------------------*/
1459 SwInsertSectionTabDialog::~SwInsertSectionTabDialog()
1461 delete pToInsertSection
;
1463 /* -----------------21.05.99 10:23-------------------
1465 * --------------------------------------------------*/
1466 void SwInsertSectionTabDialog::PageCreated( USHORT nId
, SfxTabPage
&rPage
)
1468 if(TP_INSERT_SECTION
== nId
)
1469 ((SwInsertSectionTabPage
&)rPage
).SetWrtShell(rWrtSh
);
1470 else if( TP_BACKGROUND
== nId
)
1472 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
1473 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
, SVX_SHOW_SELECTOR
));
1474 rPage
.PageCreated(aSet
);
1476 else if( TP_COLUMN
== nId
)
1478 const SwFmtFrmSize
& rSize
= (const SwFmtFrmSize
&)GetInputSetImpl()->Get(RES_FRM_SIZE
);
1479 ((SwColumnPage
&)rPage
).SetPageWidth(rSize
.GetWidth());
1480 ((SwColumnPage
&)rPage
).ShowBalance(TRUE
);
1481 ((SwColumnPage
&)rPage
).SetInSection(TRUE
);
1483 else if(TP_SECTION_INDENTS
== nId
)
1484 ((SwSectionIndentTabPage
&)rPage
).SetWrtShell(rWrtSh
);
1486 /* -----------------21.05.99 13:08-------------------
1488 * --------------------------------------------------*/
1490 void SwInsertSectionTabDialog::SetSection(const SwSection
& rSect
)
1492 pToInsertSection
= new SwSection(CONTENT_SECTION
, aEmptyStr
);
1493 *pToInsertSection
= rSect
;
1495 /* -----------------21.05.99 13:10-------------------
1497 * --------------------------------------------------*/
1498 short SwInsertSectionTabDialog::Ok()
1500 short nRet
= SfxTabDialog::Ok();
1501 DBG_ASSERT(pToInsertSection
, "keiner Section?");
1502 const SfxItemSet
* pOutputItemSet
= GetOutputItemSet();
1503 rWrtSh
.InsertSection(*pToInsertSection
, pOutputItemSet
);
1504 SfxViewFrame
* pViewFrm
= rWrtSh
.GetView().GetViewFrame();
1505 uno::Reference
< frame::XDispatchRecorder
> xRecorder
=
1506 pViewFrm
->GetBindings().GetRecorder();
1507 if ( xRecorder
.is() )
1509 SfxRequest
aRequest( pViewFrm
, FN_INSERT_REGION
);
1510 const SfxPoolItem
* pCol
;
1511 if(SFX_ITEM_SET
== pOutputItemSet
->GetItemState(RES_COL
, FALSE
, &pCol
))
1513 aRequest
.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS
,
1514 ((const SwFmtCol
*)pCol
)->GetColumns().Count()));
1516 aRequest
.AppendItem(SfxStringItem( FN_PARAM_REGION_NAME
, pToInsertSection
->GetName()));
1517 aRequest
.AppendItem(SfxStringItem( FN_PARAM_REGION_CONDITION
, pToInsertSection
->GetCondition()));
1518 aRequest
.AppendItem(SfxBoolItem( FN_PARAM_REGION_HIDDEN
, pToInsertSection
->IsHidden()));
1519 aRequest
.AppendItem(SfxBoolItem(FN_PARAM_REGION_PROTECT
, pToInsertSection
->IsProtect()));
1520 // --> FME 2004-06-22 #114856# edit in readonly sections
1521 aRequest
.AppendItem(SfxBoolItem(FN_PARAM_REGION_EDIT_IN_READONLY
, pToInsertSection
->IsEditInReadonly()));
1524 String
sLinkFileName( pToInsertSection
->GetLinkFileName() );
1525 aRequest
.AppendItem(SfxStringItem( FN_PARAM_1
, sLinkFileName
.GetToken( 0, sfx2::cTokenSeperator
)));
1526 aRequest
.AppendItem(SfxStringItem( FN_PARAM_2
, sLinkFileName
.GetToken( 1, sfx2::cTokenSeperator
)));
1527 aRequest
.AppendItem(SfxStringItem( FN_PARAM_3
, sLinkFileName
.GetToken( 2, sfx2::cTokenSeperator
)));
1533 /* -----------------21.05.99 10:31-------------------
1535 * --------------------------------------------------*/
1536 SwInsertSectionTabPage::SwInsertSectionTabPage(
1537 Window
*pParent
, const SfxItemSet
&rAttrSet
) :
1538 SfxTabPage( pParent
, SW_RES(TP_INSERT_SECTION
), rAttrSet
),
1539 aNameFL ( this, SW_RES( FL_NAME
) ),
1540 aCurName ( this, SW_RES( ED_RNAME
) ),
1541 aLinkFL ( this, SW_RES( FL_LINK
) ),
1542 aFileCB ( this, SW_RES( CB_FILE
) ),
1543 aDDECB ( this, SW_RES( CB_DDE
) ) ,
1544 aDDECommandFT ( this, SW_RES( FT_DDE
) ) ,
1545 aFileNameFT ( this, SW_RES( FT_FILE
) ) ,
1546 aFileNameED ( this, SW_RES( ED_FILE
) ),
1547 aFilePB ( this, SW_RES( PB_FILE
) ),
1548 aSubRegionFT ( this, SW_RES( FT_SUBREG
) ) ,
1549 aSubRegionED ( this, SW_RES( LB_SUBREG
) ) ,
1551 aProtectFL ( this, SW_RES( FL_PROTECT
) ),
1552 aProtectCB ( this, SW_RES( CB_PROTECT
) ),
1553 aPasswdCB ( this, SW_RES( CB_PASSWD
) ),
1554 aPasswdPB ( this, SW_RES( PB_PASSWD
) ),
1556 aHideFL ( this, SW_RES( FL_HIDE
) ),
1557 aHideCB ( this, SW_RES( CB_HIDE
) ),
1558 aConditionFT ( this, SW_RES( FT_CONDITION
) ),
1559 aConditionED ( this, SW_RES( ED_CONDITION
) ),
1560 // --> FME 2004-06-22 #114856# edit in readonly sections
1561 aPropertiesFL ( this, SW_RES( FL_PROPERTIES
) ),
1562 aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY
) ),
1566 m_pDocInserter(NULL
),
1567 m_pOldDefDlgParent(NULL
)
1571 aProtectCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangeProtectHdl
));
1572 aPasswdCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangePasswdHdl
));
1573 aPasswdPB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangePasswdHdl
));
1574 aHideCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangeHideHdl
));
1575 // --> FME 2004-06-22 #114856# edit in readonly sections
1576 aEditInReadonlyCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangeEditInReadonlyHdl
));
1578 aFileCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, UseFileHdl
));
1579 aFilePB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, FileSearchHdl
));
1580 aCurName
.SetModifyHdl ( LINK( this, SwInsertSectionTabPage
, NameEditHdl
));
1581 aDDECB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, DDEHdl
));
1582 ChangeProtectHdl(&aProtectCB
);
1583 aSubRegionED
.EnableAutocomplete( sal_True
, sal_True
);
1585 /* -----------------21.05.99 10:31-------------------
1587 * --------------------------------------------------*/
1588 SwInsertSectionTabPage::~SwInsertSectionTabPage()
1590 delete m_pDocInserter
;
1593 void SwInsertSectionTabPage::SetWrtShell(SwWrtShell
& rSh
)
1597 BOOL bWeb
= 0 != PTR_CAST(SwWebDocShell
, m_pWrtSh
->GetView().GetDocShell());
1601 aConditionED
.Hide();
1602 aConditionFT
.Hide();
1604 aDDECommandFT
.Hide();
1608 IDocumentMarkAccess
* const pMarkAccess
= m_pWrtSh
->getIDocumentMarkAccess();
1609 for( IDocumentMarkAccess::const_iterator_t ppMark
= pMarkAccess
->getMarksBegin();
1610 ppMark
!= pMarkAccess
->getMarksEnd();
1613 const ::sw::mark::IMark
* pBkmk
= ppMark
->get();
1614 if( pBkmk
->IsExpanded() )
1615 aSubRegionED
.InsertEntry( pBkmk
->GetName() );
1618 SwSection
* pSect
= ((SwInsertSectionTabDialog
*)GetTabDialog())->GetSection();
1619 if( pSect
) // etwas vorgegeben ?
1621 aCurName
.SetText( rSh
.GetUniqueSectionName( &pSect
->GetName() ));
1622 aProtectCB
.Check( 0 != pSect
->IsProtect() );
1623 m_sFileName
= pSect
->GetLinkFileName();
1624 m_sFilePasswd
= pSect
->GetLinkFilePassWd();
1625 aFileCB
.Check( 0 != m_sFileName
.Len() );
1626 aFileNameED
.SetText( m_sFileName
);
1627 UseFileHdl( &aFileCB
);
1631 aCurName
.SetText( rSh
.GetUniqueSectionName() );
1634 /* -----------------21.05.99 10:32-------------------
1636 * --------------------------------------------------*/
1637 BOOL
SwInsertSectionTabPage::FillItemSet( SfxItemSet
& )
1639 SwSection
aSection(CONTENT_SECTION
, aCurName
.GetText());
1640 aSection
.SetCondition(aConditionED
.GetText());
1641 BOOL bProtected
= aProtectCB
.IsChecked();
1642 aSection
.SetProtect(bProtected
);
1643 aSection
.SetHidden(aHideCB
.IsChecked());
1644 // --> FME 2004-06-22 #114856# edit in readonly sections
1645 aSection
.SetEditInReadonly(aEditInReadonlyCB
.IsChecked());
1648 aSection
.SetPasswd(m_aNewPasswd
);
1649 String sFileName
= aFileNameED
.GetText();
1650 String sSubRegion
= aSubRegionED
.GetText();
1651 BOOL bDDe
= aDDECB
.IsChecked();
1652 if(aFileCB
.IsChecked() && (sFileName
.Len() || sSubRegion
.Len() || bDDe
))
1657 aLinkFile
= sFileName
;
1660 while( STRING_NOTFOUND
!= (nPos
= aLinkFile
.SearchAscii( " ", nPos
)) )
1661 aLinkFile
.Erase( nPos
--, 1 );
1663 nPos
= aLinkFile
.SearchAndReplace( ' ', sfx2::cTokenSeperator
);
1664 aLinkFile
.SearchAndReplace( ' ', sfx2::cTokenSeperator
, nPos
);
1670 SfxMedium
* pMedium
= m_pWrtSh
->GetView().GetDocShell()->GetMedium();
1673 aAbs
= pMedium
->GetURLObject();
1674 aLinkFile
= URIHelper::SmartRel2Abs(
1675 aAbs
, sFileName
, URIHelper::GetMaybeFileHdl() );
1676 aSection
.SetLinkFilePassWd( m_sFilePasswd
);
1679 aLinkFile
+= sfx2::cTokenSeperator
;
1680 aLinkFile
+= m_sFilterName
;
1681 aLinkFile
+= sfx2::cTokenSeperator
;
1682 aLinkFile
+= sSubRegion
;
1685 aSection
.SetLinkFileName(aLinkFile
);
1688 aSection
.SetType( aDDECB
.IsChecked() ?
1693 ((SwInsertSectionTabDialog
*)GetTabDialog())->SetSection(aSection
);
1696 /* -----------------21.05.99 10:32-------------------
1698 * --------------------------------------------------*/
1699 void SwInsertSectionTabPage::Reset( const SfxItemSet
& )
1702 /* -----------------21.05.99 11:22-------------------
1704 * --------------------------------------------------*/
1705 SfxTabPage
* SwInsertSectionTabPage::Create( Window
* pParent
,
1706 const SfxItemSet
& rAttrSet
)
1708 return new SwInsertSectionTabPage(pParent
, rAttrSet
);
1710 /*---------------------------------------------------------------------
1712 ---------------------------------------------------------------------*/
1714 IMPL_LINK( SwInsertSectionTabPage
, ChangeHideHdl
, CheckBox
*, pBox
)
1716 BOOL bHide
= pBox
->IsChecked();
1717 aConditionED
.Enable(bHide
);
1718 aConditionFT
.Enable(bHide
);
1721 /*---------------------------------------------------------------------
1723 ---------------------------------------------------------------------*/
1725 IMPL_LINK( SwInsertSectionTabPage
, ChangeEditInReadonlyHdl
, CheckBox
*, EMPTYARG
)
1729 /*---------------------------------------------------------------------
1731 ---------------------------------------------------------------------*/
1733 IMPL_LINK( SwInsertSectionTabPage
, ChangeProtectHdl
, CheckBox
*, pBox
)
1735 sal_Bool bCheck
= pBox
->IsChecked();
1736 aPasswdCB
.Enable(bCheck
);
1737 aPasswdPB
.Enable(bCheck
);
1740 /* -----------------------------26.04.01 14:50--------------------------------
1742 ---------------------------------------------------------------------------*/
1743 IMPL_LINK( SwInsertSectionTabPage
, ChangePasswdHdl
, Button
*, pButton
)
1745 sal_Bool bChange
= pButton
== &aPasswdPB
;
1746 sal_Bool bSet
= bChange
? bChange
: aPasswdCB
.IsChecked();
1749 if(!m_aNewPasswd
.getLength() || bChange
)
1751 SwTestPasswdDlg
aPasswdDlg(this);
1752 aPasswdDlg
.ShowExtras(SHOWEXTRAS_CONFIRM
);
1753 if(RET_OK
== aPasswdDlg
.Execute())
1755 String
sNewPasswd( aPasswdDlg
.GetPassword() );
1756 if( aPasswdDlg
.GetConfirm() == sNewPasswd
)
1758 SvPasswordHelper::GetHashPassword( m_aNewPasswd
, sNewPasswd
);
1762 InfoBox(pButton
, SW_RES(REG_WRONG_PASSWD_REPEAT
)).Execute();
1766 aPasswdCB
.Check(FALSE
);
1770 m_aNewPasswd
.realloc(0);
1773 /*---------------------------------------------------------------------
1775 ---------------------------------------------------------------------*/
1777 IMPL_LINK_INLINE_START( SwInsertSectionTabPage
, NameEditHdl
, Edit
*, EMPTYARG
)
1779 String aName
=aCurName
.GetText();
1780 GetTabDialog()->GetOKButton().Enable(aName
.Len() && aCurName
.GetEntryPos( aName
) == USHRT_MAX
);
1783 IMPL_LINK_INLINE_END( SwInsertSectionTabPage
, NameEditHdl
, Edit
*, EMPTYARG
)
1785 /*---------------------------------------------------------------------
1787 ---------------------------------------------------------------------*/
1789 IMPL_LINK( SwInsertSectionTabPage
, UseFileHdl
, CheckBox
*, pBox
)
1791 if( pBox
->IsChecked() )
1793 if( m_pWrtSh
->HasSelection() &&
1794 RET_NO
== QueryBox( this, SW_RES(QB_CONNECT
) ).Execute() )
1795 pBox
->Check( FALSE
);
1798 BOOL bFile
= pBox
->IsChecked();
1799 aFileNameFT
.Enable(bFile
);
1800 aFileNameED
.Enable(bFile
);
1801 aFilePB
.Enable(bFile
);
1802 aSubRegionFT
.Enable(bFile
);
1803 aSubRegionED
.Enable(bFile
);
1804 aDDECommandFT
.Enable(bFile
);
1805 aDDECB
.Enable(bFile
);
1808 // aFileNameED.SetText( aFileName );
1809 aFileNameED
.GrabFocus();
1810 aProtectCB
.Check( TRUE
);
1814 aDDECB
.Check(FALSE
);
1816 // aFileNameED.SetText(aEmptyStr);
1821 /*---------------------------------------------------------------------
1823 ---------------------------------------------------------------------*/
1825 IMPL_LINK( SwInsertSectionTabPage
, FileSearchHdl
, PushButton
*, EMPTYARG
)
1827 m_pOldDefDlgParent
= Application::GetDefDialogParent();
1828 Application::SetDefDialogParent( this );
1829 if ( m_pDocInserter
)
1830 delete m_pDocInserter
;
1831 m_pDocInserter
= new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") );
1832 m_pDocInserter
->StartExecuteModal( LINK( this, SwInsertSectionTabPage
, DlgClosedHdl
) );
1836 /*---------------------------------------------------------------------
1838 ---------------------------------------------------------------------*/
1840 IMPL_LINK( SwInsertSectionTabPage
, DDEHdl
, CheckBox
*, pBox
)
1842 BOOL bDDE
= pBox
->IsChecked();
1843 BOOL bFile
= aFileCB
.IsChecked();
1844 aFilePB
.Enable(!bDDE
&& bFile
);
1848 aDDECommandFT
.Enable(bDDE
);
1849 aDDECommandFT
.Show();
1850 aSubRegionFT
.Hide();
1851 aSubRegionED
.Hide();
1855 aDDECommandFT
.Hide();
1856 aFileNameFT
.Enable(bFile
);
1858 aSubRegionFT
.Show();
1859 aSubRegionED
.Show();
1860 aSubRegionED
.Enable(bFile
);
1865 IMPL_LINK( SwInsertSectionTabPage
, DlgClosedHdl
, sfx2::FileDialogHelper
*, _pFileDlg
)
1867 if ( _pFileDlg
->GetError() == ERRCODE_NONE
)
1869 SfxMedium
* pMedium
= m_pDocInserter
->CreateMedium();
1872 m_sFileName
= pMedium
->GetURLObject().GetMainURL( INetURLObject::NO_DECODE
);
1873 m_sFilterName
= pMedium
->GetFilter()->GetFilterName();
1874 const SfxPoolItem
* pItem
;
1875 if ( SFX_ITEM_SET
== pMedium
->GetItemSet()->GetItemState( SID_PASSWORD
, FALSE
, &pItem
) )
1876 m_sFilePasswd
= ( (SfxStringItem
*)pItem
)->GetValue();
1877 aFileNameED
.SetText( INetURLObject::decode(
1878 m_sFileName
, INET_HEX_ESCAPE
, INetURLObject::DECODE_UNAMBIGUOUS
, RTL_TEXTENCODING_UTF8
) );
1879 ::lcl_ReadSections( *m_pWrtSh
, *pMedium
, aSubRegionED
);
1884 m_sFilterName
= m_sFilePasswd
= aEmptyStr
;
1886 Application::SetDefDialogParent( m_pOldDefDlgParent
);
1890 /*--------------------------------------------------------------------
1891 Beschreibung: Liste der verwendeten Namen fuellen
1892 --------------------------------------------------------------------*/
1894 void SwInsertSectionTabPage::FillList( const SwSectionFmt
* pNewFmt
)
1896 const SwSectionFmt
* pFmt
;
1899 USHORT nCount
= m_pWrtSh
->GetSectionFmtCount();
1900 for(USHORT i
=0;i
<nCount
;i
++)
1902 SectionType eTmpType
;
1903 if( !(pFmt
= &m_pWrtSh
->GetSectionFmt(i
))->GetParent() &&
1904 pFmt
->IsInNodesArr() &&
1905 (eTmpType
= pFmt
->GetSection()->GetType()) != TOX_CONTENT_SECTION
1906 && TOX_HEADER_SECTION
!= eTmpType
)
1908 String
* pString
= new String(pFmt
->GetSection()->GetName());
1909 aCurName
.InsertEntry(*pString
);
1910 aSubRegionED
.InsertEntry(*pString
);
1918 USHORT nCnt
= pNewFmt
->GetChildSections(aTmpArr
,SORTSECT_POS
);
1921 SectionType eTmpType
;
1922 for( USHORT n
= 0; n
< nCnt
; ++n
)
1923 if( (pFmt
= aTmpArr
[n
]->GetFmt())->IsInNodesArr()&&
1924 (eTmpType
= pFmt
->GetSection()->GetType()) != TOX_CONTENT_SECTION
1925 && TOX_HEADER_SECTION
!= eTmpType
)
1927 String
* pString
= new String(pFmt
->GetSection()->GetName());
1928 aCurName
.InsertEntry(*pString
);
1929 aSubRegionED
.InsertEntry(*pString
);
1936 // --------------------------------------------------------------
1938 // Numerierungsformat Umsetzung:
1939 // ListBox - Format - Enum-Wert
1940 // 0 - A, B, C, ... - 0
1941 // 1 - a, b, c, ... - 1
1942 // 2 - I, II, III, ... - 2
1943 // 3 - i, ii, iii, ... - 3
1944 // 4 - 1, 2, 3, ... - 4
1945 // 5 - A, .., AA, .., - 9
1946 // 6 - a, .., aa, .., - 10
1948 inline USHORT
GetNumPos( USHORT n
)
1950 return SVX_NUM_ARABIC
< n
? n
- 4 : n
;
1953 inline SvxExtNumType
GetNumType( USHORT n
)
1955 return (SvxExtNumType
)(4 < n
? n
+ 4 : n
);
1958 SwSectionFtnEndTabPage::SwSectionFtnEndTabPage( Window
*pParent
,
1959 const SfxItemSet
&rAttrSet
)
1960 : SfxTabPage( pParent
, SW_RES( TP_SECTION_FTNENDNOTES
), rAttrSet
),
1961 aFtnFL ( this, SW_RES( FL_FTN
) ),
1962 aFtnNtAtTextEndCB ( this, SW_RES( CB_FTN_AT_TXTEND
) ),
1964 aFtnNtNumCB ( this, SW_RES( CB_FTN_NUM
) ),
1965 aFtnOffsetLbl ( this, SW_RES( FT_FTN_OFFSET
)),
1966 aFtnOffsetFld ( this, SW_RES( FLD_FTN_OFFSET
)),
1968 aFtnNtNumFmtCB ( this, SW_RES( CB_FTN_NUM_FMT
) ),
1969 aFtnPrefixFT ( this, SW_RES( FT_FTN_PREFIX
)),
1970 aFtnPrefixED ( this, SW_RES( ED_FTN_PREFIX
)),
1971 aFtnNumViewBox ( this, SW_RES( LB_FTN_NUMVIEW
), INSERT_NUM_EXTENDED_TYPES
),
1972 aFtnSuffixFT ( this, SW_RES( FT_FTN_SUFFIX
)),
1973 aFtnSuffixED ( this, SW_RES( ED_FTN_SUFFIX
)),
1975 aEndFL ( this, SW_RES( FL_END
) ),
1976 aEndNtAtTextEndCB ( this, SW_RES( CB_END_AT_TXTEND
)),
1978 aEndNtNumCB ( this, SW_RES( CB_END_NUM
)),
1979 aEndOffsetLbl ( this, SW_RES( FT_END_OFFSET
)),
1980 aEndOffsetFld ( this, SW_RES( FLD_END_OFFSET
)),
1982 aEndNtNumFmtCB ( this, SW_RES( CB_END_NUM_FMT
) ),
1983 aEndPrefixFT ( this, SW_RES( FT_END_PREFIX
)),
1984 aEndPrefixED ( this, SW_RES( ED_END_PREFIX
)),
1985 aEndNumViewBox ( this, SW_RES( LB_END_NUMVIEW
), INSERT_NUM_EXTENDED_TYPES
),
1986 aEndSuffixFT ( this, SW_RES( FT_END_SUFFIX
)),
1987 aEndSuffixED ( this, SW_RES( ED_END_SUFFIX
))
1991 Link
aLk( LINK( this, SwSectionFtnEndTabPage
, FootEndHdl
));
1992 aFtnNtAtTextEndCB
.SetClickHdl( aLk
);
1993 aFtnNtNumCB
.SetClickHdl( aLk
);
1994 aEndNtAtTextEndCB
.SetClickHdl( aLk
);
1995 aEndNtNumCB
.SetClickHdl( aLk
);
1996 aFtnNtNumFmtCB
.SetClickHdl( aLk
);
1997 aEndNtNumFmtCB
.SetClickHdl( aLk
);
2000 SwSectionFtnEndTabPage::~SwSectionFtnEndTabPage()
2004 BOOL
SwSectionFtnEndTabPage::FillItemSet( SfxItemSet
& rSet
)
2006 SwFmtFtnAtTxtEnd
aFtn( aFtnNtAtTextEndCB
.IsChecked()
2007 ? ( aFtnNtNumCB
.IsChecked()
2008 ? ( aFtnNtNumFmtCB
.IsChecked()
2009 ? FTNEND_ATTXTEND_OWNNUMANDFMT
2010 : FTNEND_ATTXTEND_OWNNUMSEQ
)
2012 : FTNEND_ATPGORDOCEND
);
2014 switch( aFtn
.GetValue() )
2016 case FTNEND_ATTXTEND_OWNNUMANDFMT
:
2017 aFtn
.SetNumType( aFtnNumViewBox
.GetSelectedNumberingType() );
2018 aFtn
.SetPrefix( aFtnPrefixED
.GetText() );
2019 aFtn
.SetSuffix( aFtnSuffixED
.GetText() );
2022 case FTNEND_ATTXTEND_OWNNUMSEQ
:
2023 aFtn
.SetOffset( static_cast< USHORT
>( aFtnOffsetFld
.GetValue()-1 ) );
2027 SwFmtEndAtTxtEnd
aEnd( aEndNtAtTextEndCB
.IsChecked()
2028 ? ( aEndNtNumCB
.IsChecked()
2029 ? ( aEndNtNumFmtCB
.IsChecked()
2030 ? FTNEND_ATTXTEND_OWNNUMANDFMT
2031 : FTNEND_ATTXTEND_OWNNUMSEQ
)
2033 : FTNEND_ATPGORDOCEND
);
2035 switch( aEnd
.GetValue() )
2037 case FTNEND_ATTXTEND_OWNNUMANDFMT
:
2038 aEnd
.SetNumType( aEndNumViewBox
.GetSelectedNumberingType() );
2039 aEnd
.SetPrefix( aEndPrefixED
.GetText() );
2040 aEnd
.SetSuffix( aEndSuffixED
.GetText() );
2043 case FTNEND_ATTXTEND_OWNNUMSEQ
:
2044 aEnd
.SetOffset( static_cast< USHORT
>( aEndOffsetFld
.GetValue()-1 ) );
2054 void SwSectionFtnEndTabPage::ResetState( BOOL bFtn
,
2055 const SwFmtFtnEndAtTxtEnd
& rAttr
)
2057 CheckBox
*pNtAtTextEndCB
, *pNtNumCB
, *pNtNumFmtCB
;
2058 FixedText
*pPrefixFT
, *pSuffixFT
;
2059 Edit
*pPrefixED
, *pSuffixED
;
2060 SwNumberingTypeListBox
*pNumViewBox
;
2061 FixedText
* pOffsetTxt
;
2062 NumericField
*pOffsetFld
;
2066 pNtAtTextEndCB
= &aFtnNtAtTextEndCB
;
2067 pNtNumCB
= &aFtnNtNumCB
;
2068 pNtNumFmtCB
= &aFtnNtNumFmtCB
;
2069 pPrefixFT
= &aFtnPrefixFT
;
2070 pPrefixED
= &aFtnPrefixED
;
2071 pSuffixFT
= &aFtnSuffixFT
;
2072 pSuffixED
= &aFtnSuffixED
;
2073 pNumViewBox
= &aFtnNumViewBox
;
2074 pOffsetTxt
= &aFtnOffsetLbl
;
2075 pOffsetFld
= &aFtnOffsetFld
;
2079 pNtAtTextEndCB
= &aEndNtAtTextEndCB
;
2080 pNtNumCB
= &aEndNtNumCB
;
2081 pNtNumFmtCB
= &aEndNtNumFmtCB
;
2082 pPrefixFT
= &aEndPrefixFT
;
2083 pPrefixED
= &aEndPrefixED
;
2084 pSuffixFT
= &aEndSuffixFT
;
2085 pSuffixED
= &aEndSuffixED
;
2086 pNumViewBox
= &aEndNumViewBox
;
2087 pOffsetTxt
= &aEndOffsetLbl
;
2088 pOffsetFld
= &aEndOffsetFld
;
2091 USHORT eState
= rAttr
.GetValue();
2094 // case FTNEND_ATPGORDOCEND:
2095 case FTNEND_ATTXTEND_OWNNUMANDFMT
:
2096 pNtNumFmtCB
->SetState( STATE_CHECK
);
2099 case FTNEND_ATTXTEND_OWNNUMSEQ
:
2100 pNtNumCB
->SetState( STATE_CHECK
);
2103 case FTNEND_ATTXTEND
:
2104 pNtAtTextEndCB
->SetState( STATE_CHECK
);
2108 pNumViewBox
->SelectNumberingType( rAttr
.GetNumType() );
2109 pOffsetFld
->SetValue( rAttr
.GetOffset() + 1 );
2110 pPrefixED
->SetText( rAttr
.GetPrefix() );
2111 pSuffixED
->SetText( rAttr
.GetSuffix() );
2115 case FTNEND_ATPGORDOCEND
:
2116 pNtNumCB
->Enable( FALSE
);
2119 case FTNEND_ATTXTEND
:
2120 pNtNumFmtCB
->Enable( FALSE
);
2121 pOffsetFld
->Enable( FALSE
);
2122 pOffsetTxt
->Enable( FALSE
);
2125 case FTNEND_ATTXTEND_OWNNUMSEQ
:
2126 pNumViewBox
->Enable( FALSE
);
2127 pPrefixFT
->Enable( FALSE
);
2128 pPrefixED
->Enable( FALSE
);
2129 pSuffixFT
->Enable( FALSE
);
2130 pSuffixED
->Enable( FALSE
);
2135 void SwSectionFtnEndTabPage::Reset( const SfxItemSet
& rSet
)
2137 ResetState( TRUE
, (const SwFmtFtnAtTxtEnd
&)rSet
.Get(
2138 RES_FTN_AT_TXTEND
, FALSE
));
2139 ResetState( FALSE
, (const SwFmtEndAtTxtEnd
&)rSet
.Get(
2140 RES_END_AT_TXTEND
, FALSE
));
2143 SfxTabPage
* SwSectionFtnEndTabPage::Create( Window
* pParent
,
2144 const SfxItemSet
& rAttrSet
)
2146 return new SwSectionFtnEndTabPage(pParent
, rAttrSet
);
2149 IMPL_LINK( SwSectionFtnEndTabPage
, FootEndHdl
, CheckBox
*, pBox
)
2151 // pBox->EnableTriState( FALSE );
2152 BOOL bFoot
= &aFtnNtAtTextEndCB
== pBox
|| &aFtnNtNumCB
== pBox
||
2153 &aFtnNtNumFmtCB
== pBox
;
2155 CheckBox
*pNumBox
, *pNumFmtBox
, *pEndBox
;
2156 SwNumberingTypeListBox
* pNumViewBox
;
2157 FixedText
* pOffsetTxt
;
2158 NumericField
*pOffsetFld
;
2159 FixedText
*pPrefixFT
, *pSuffixFT
;
2160 Edit
*pPrefixED
, *pSuffixED
;
2164 pEndBox
= &aFtnNtAtTextEndCB
;
2165 pNumBox
= &aFtnNtNumCB
;
2166 pNumFmtBox
= &aFtnNtNumFmtCB
;
2167 pNumViewBox
= &aFtnNumViewBox
;
2168 pOffsetTxt
= &aFtnOffsetLbl
;
2169 pOffsetFld
= &aFtnOffsetFld
;
2170 pPrefixFT
= &aFtnPrefixFT
;
2171 pSuffixFT
= &aFtnSuffixFT
;
2172 pPrefixED
= &aFtnPrefixED
;
2173 pSuffixED
= &aFtnSuffixED
;
2177 pEndBox
= &aEndNtAtTextEndCB
;
2178 pNumBox
= &aEndNtNumCB
;
2179 pNumFmtBox
= &aEndNtNumFmtCB
;
2180 pNumViewBox
= &aEndNumViewBox
;
2181 pOffsetTxt
= &aEndOffsetLbl
;
2182 pOffsetFld
= &aEndOffsetFld
;
2183 pPrefixFT
= &aEndPrefixFT
;
2184 pSuffixFT
= &aEndSuffixFT
;
2185 pPrefixED
= &aEndPrefixED
;
2186 pSuffixED
= &aEndSuffixED
;
2189 BOOL bEnableAtEnd
= STATE_CHECK
== pEndBox
->GetState();
2190 BOOL bEnableNum
= bEnableAtEnd
&& STATE_CHECK
== pNumBox
->GetState();
2191 BOOL bEnableNumFmt
= bEnableNum
&& STATE_CHECK
== pNumFmtBox
->GetState();
2193 pNumBox
->Enable( bEnableAtEnd
);
2194 pOffsetTxt
->Enable( bEnableNum
);
2195 pOffsetFld
->Enable( bEnableNum
);
2196 pNumFmtBox
->Enable( bEnableNum
);
2197 pNumViewBox
->Enable( bEnableNumFmt
);
2198 pPrefixED
->Enable( bEnableNumFmt
);
2199 pSuffixED
->Enable( bEnableNumFmt
);
2200 pPrefixFT
->Enable( bEnableNumFmt
);
2201 pSuffixFT
->Enable( bEnableNumFmt
);
2206 /* -----------------21.05.99 13:59-------------------
2208 * --------------------------------------------------*/
2209 SwSectionPropertyTabDialog::SwSectionPropertyTabDialog(
2210 Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
) :
2211 SfxTabDialog(pParent
, SW_RES(DLG_SECTION_PROPERTIES
), &rSet
),
2215 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
2216 DBG_ASSERT(pFact
, "Dialogdiet fail!");
2217 AddTabPage(TP_COLUMN
, SwColumnPage::Create
, 0);
2218 AddTabPage(TP_BACKGROUND
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), 0 );
2219 AddTabPage(TP_SECTION_FTNENDNOTES
, SwSectionFtnEndTabPage::Create
, 0);
2220 AddTabPage(TP_SECTION_INDENTS
, SwSectionIndentTabPage::Create
, 0);
2222 SvxHtmlOptions
* pHtmlOpt
= SvxHtmlOptions::Get();
2223 long nHtmlMode
= pHtmlOpt
->GetExportMode();
2224 BOOL bWeb
= 0 != PTR_CAST( SwWebDocShell
, rSh
.GetView().GetDocShell() );
2227 RemoveTabPage(TP_SECTION_FTNENDNOTES
);
2228 RemoveTabPage(TP_SECTION_INDENTS
);
2229 if( HTML_CFG_NS40
!= nHtmlMode
&& HTML_CFG_WRITER
!= nHtmlMode
)
2230 RemoveTabPage(TP_COLUMN
);
2233 /* -----------------21.05.99 13:59-------------------
2235 * --------------------------------------------------*/
2236 SwSectionPropertyTabDialog::~SwSectionPropertyTabDialog()
2239 /* -----------------21.05.99 13:59-------------------
2241 * --------------------------------------------------*/
2242 void SwSectionPropertyTabDialog::PageCreated( USHORT nId
, SfxTabPage
&rPage
)
2244 if( TP_BACKGROUND
== nId
)
2246 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
2247 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
, SVX_SHOW_SELECTOR
));
2248 rPage
.PageCreated(aSet
);
2250 else if( TP_COLUMN
== nId
)
2252 ((SwColumnPage
&)rPage
).ShowBalance(TRUE
);
2253 ((SwColumnPage
&)rPage
).SetInSection(TRUE
);
2255 else if(TP_SECTION_INDENTS
== nId
)
2256 ((SwSectionIndentTabPage
&)rPage
).SetWrtShell(rWrtSh
);
2258 /*-- 13.06.2003 09:59:08---------------------------------------------------
2260 -----------------------------------------------------------------------*/
2261 SwSectionIndentTabPage::SwSectionIndentTabPage( Window
*pParent
, const SfxItemSet
&rAttrSet
) :
2262 SfxTabPage(pParent
, SW_RES(TP_SECTION_INDENTS
), rAttrSet
),
2263 aIndentFL(this, SW_RES(FL_INDENT
)),
2264 aBeforeFT(this, SW_RES(FT_BEFORE
)),
2265 aBeforeMF(this, SW_RES(MF_BEFORE
)),
2266 aAfterFT(this, SW_RES(FT_AFTER
)),
2267 aAfterMF(this, SW_RES(MF_AFTER
)),
2268 aPreviewWin(this, SW_RES(WIN_PREVIEW
))
2271 Link aLk
= LINK(this, SwSectionIndentTabPage
, IndentModifyHdl
);
2272 aBeforeMF
.SetModifyHdl(aLk
);
2273 aAfterMF
.SetModifyHdl(aLk
);
2275 /*-- 13.06.2003 09:59:23---------------------------------------------------
2277 -----------------------------------------------------------------------*/
2278 SwSectionIndentTabPage::~SwSectionIndentTabPage()
2281 /*-- 13.06.2003 09:59:23---------------------------------------------------
2283 -----------------------------------------------------------------------*/
2284 BOOL
SwSectionIndentTabPage::FillItemSet( SfxItemSet
& rSet
)
2286 if(aBeforeMF
.IsValueModified() ||
2287 aAfterMF
.IsValueModified())
2289 SvxLRSpaceItem
aLRSpace(
2290 static_cast< long >(aBeforeMF
.Denormalize(aBeforeMF
.GetValue(FUNIT_TWIP
))) ,
2291 static_cast< long >(aAfterMF
.Denormalize(aAfterMF
.GetValue(FUNIT_TWIP
))), 0, 0, RES_LR_SPACE
);
2296 /*-- 13.06.2003 09:59:24---------------------------------------------------
2298 -----------------------------------------------------------------------*/
2299 void SwSectionIndentTabPage::Reset( const SfxItemSet
& rSet
)
2301 //this page doesn't show up in HTML mode
2302 FieldUnit aMetric
= ::GetDfltMetric(FALSE
);
2303 SetMetric(aBeforeMF
, aMetric
);
2304 SetMetric(aAfterMF
, aMetric
);
2306 SfxItemState eItemState
= rSet
.GetItemState( RES_LR_SPACE
);
2307 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
2309 const SvxLRSpaceItem
& rSpace
=
2310 (const SvxLRSpaceItem
&)rSet
.Get( RES_LR_SPACE
);
2312 aBeforeMF
.SetValue( aBeforeMF
.Normalize(rSpace
.GetLeft()), FUNIT_TWIP
);
2313 aAfterMF
.SetValue( aAfterMF
.Normalize(rSpace
.GetRight()), FUNIT_TWIP
);
2317 aBeforeMF
.SetEmptyFieldValue();
2318 aAfterMF
.SetEmptyFieldValue();
2320 aBeforeMF
.SaveValue();
2321 aAfterMF
.SaveValue();
2324 /*-- 13.06.2003 09:59:24---------------------------------------------------
2326 -----------------------------------------------------------------------*/
2327 SfxTabPage
* SwSectionIndentTabPage::Create( Window
* pParent
, const SfxItemSet
& rAttrSet
)
2329 return new SwSectionIndentTabPage(pParent
, rAttrSet
);
2331 /* -----------------13.06.2003 13:57-----------------
2333 --------------------------------------------------*/
2334 void SwSectionIndentTabPage::SetWrtShell(SwWrtShell
& rSh
)
2336 //set sensible values at the preview
2337 aPreviewWin
.SetAdjust(SVX_ADJUST_BLOCK
);
2338 aPreviewWin
.SetLastLine(SVX_ADJUST_BLOCK
);
2339 const SwRect
& rPageRect
= rSh
.GetAnyCurRect( RECT_PAGE
, 0 );
2340 Size
aPageSize(rPageRect
.Width(), rPageRect
.Height());
2341 aPreviewWin
.SetSize(aPageSize
);
2343 /* -----------------13.06.2003 14:02-----------------
2345 --------------------------------------------------*/
2346 IMPL_LINK(SwSectionIndentTabPage
, IndentModifyHdl
, MetricField
*, EMPTYARG
)
2348 aPreviewWin
.SetLeftMargin( static_cast< long >(aBeforeMF
.Denormalize(aBeforeMF
.GetValue(FUNIT_TWIP
))) );
2349 aPreviewWin
.SetRightMargin( static_cast< long >(aAfterMF
.Denormalize(aAfterMF
.GetValue(FUNIT_TWIP
))) );
2350 aPreviewWin
.Draw(TRUE
);