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 #include <vcl/msgbox.hxx>
43 #include <svtools/stritem.hxx>
44 #include <svtools/eitem.hxx>
45 #include <sfx2/passwd.hxx>
46 #include <sfx2/docfilt.hxx>
47 #include <sfx2/request.hxx>
48 #include <sfx2/docfile.hxx>
49 #include <sfx2/linkmgr.hxx>
50 #include <sfx2/docinsert.hxx>
51 #include <sfx2/filedlghelper.hxx>
52 #include <svx/sizeitem.hxx>
53 #include <svx/htmlcfg.hxx>
55 #include <comphelper/storagehelper.hxx>
58 #include <section.hxx>
60 #include <doc.hxx> // fuers SwSectionFmt-Array
64 #include <swmodule.hxx>
66 #include <swundo.hxx> // fuer Undo-Ids
68 #include <fmtfsize.hxx>
69 #include <swunodef.hxx>
70 #include <shellio.hxx>
74 #include <regionsw.hrc>
75 #include <comcore.hrc>
76 #include <globals.hrc>
77 #include <sfx2/bindings.hxx>
78 #include <svx/htmlmode.hxx>
79 #include <svx/dlgutil.hxx>
80 #include <svx/dialogs.hrc>
81 #include <svx/svxdlg.hxx>
82 #include <svx/flagsdef.hxx>
84 using namespace ::com::sun::star
;
87 SV_IMPL_PTRARR( SwSectionFmts
, SwSectionFmtPtr
)
89 #define FILE_NAME_LENGTH 17
91 SV_IMPL_OP_PTRARR_SORT( SectReprArr
, SectReprPtr
)
93 static void lcl_ReadSections( SfxMedium
& rMedium
, ComboBox
& rBox
);
95 void lcl_FillList( SwWrtShell
& rSh
, ComboBox
& rSubRegions
, ComboBox
* pAvailNames
, const SwSectionFmt
* pNewFmt
)
97 const SwSectionFmt
* pFmt
;
100 USHORT nCount
= rSh
.GetSectionFmtCount();
101 for(USHORT i
=0;i
<nCount
;i
++)
103 SectionType eTmpType
;
104 if( !(pFmt
= &rSh
.GetSectionFmt(i
))->GetParent() &&
105 pFmt
->IsInNodesArr() &&
106 (eTmpType
= pFmt
->GetSection()->GetType()) != TOX_CONTENT_SECTION
107 && TOX_HEADER_SECTION
!= eTmpType
)
109 String
* pString
= new String(pFmt
->GetSection()->GetName());
111 pAvailNames
->InsertEntry(*pString
);
112 rSubRegions
.InsertEntry(*pString
);
113 lcl_FillList( rSh
, rSubRegions
, pAvailNames
, pFmt
);
120 USHORT nCnt
= pNewFmt
->GetChildSections(aTmpArr
,SORTSECT_POS
);
123 SectionType eTmpType
;
124 for( USHORT n
= 0; n
< nCnt
; ++n
)
125 if( (pFmt
= aTmpArr
[n
]->GetFmt())->IsInNodesArr()&&
126 (eTmpType
= pFmt
->GetSection()->GetType()) != TOX_CONTENT_SECTION
127 && TOX_HEADER_SECTION
!= eTmpType
)
129 String
* pString
= new String(pFmt
->GetSection()->GetName());
131 pAvailNames
->InsertEntry(*pString
);
132 rSubRegions
.InsertEntry(*pString
);
133 lcl_FillList( rSh
, rSubRegions
, pAvailNames
, pFmt
);
139 void lcl_FillSubRegionList( SwWrtShell
& rSh
, ComboBox
& rSubRegions
, ComboBox
* pAvailNames
)
141 lcl_FillList( rSh
, rSubRegions
, pAvailNames
, 0 );
142 IDocumentMarkAccess
* const pMarkAccess
= rSh
.getIDocumentMarkAccess();
143 for( IDocumentMarkAccess::const_iterator_t ppMark
= pMarkAccess
->getMarksBegin();
144 ppMark
!= pMarkAccess
->getMarksEnd();
147 const ::sw::mark::IMark
* pBkmk
= ppMark
->get();
148 if( pBkmk
->IsExpanded() )
149 rSubRegions
.InsertEntry( pBkmk
->GetName() );
153 /* -----------------25.06.99 15:38-------------------
155 --------------------------------------------------*/
156 class SwTestPasswdDlg
: public SfxPasswordDialog
159 SwTestPasswdDlg(Window
* pParent
) :
160 SfxPasswordDialog(pParent
)
162 SetHelpId(HID_DLG_PASSWD_SECTION
);
166 /*----------------------------------------------------------------------------
167 Beschreibung: User Data Klasse fuer Bereichsinformationen
168 ----------------------------------------------------------------------------*/
170 SectRepr::SectRepr( USHORT nPos
, SwSection
& rSect
) :
171 aSection( CONTENT_SECTION
, aEmptyStr
),
172 aBrush( RES_BACKGROUND
),
173 aFrmDirItem( FRMDIR_ENVIRONMENT
, RES_FRAMEDIR
),
174 aLRSpaceItem( RES_LR_SPACE
),
178 bContent
= aSection
.GetLinkFileName().Len() == 0;
180 SwSectionFmt
*pFmt
= rSect
.GetFmt();
183 aCol
= pFmt
->GetCol();
184 aBrush
= pFmt
->GetBackground();
185 aFtnNtAtEnd
= pFmt
->GetFtnAtTxtEnd();
186 aEndNtAtEnd
= pFmt
->GetEndAtTxtEnd();
187 aBalance
.SetValue(pFmt
->GetBalancedColumns().GetValue());
188 aFrmDirItem
= pFmt
->GetFrmDir();
189 aLRSpaceItem
= pFmt
->GetLRSpace();
193 void SectRepr::SetFile( const String
& rFile
)
195 String
sNewFile( INetURLObject::decode( rFile
, INET_HEX_ESCAPE
,
196 INetURLObject::DECODE_UNAMBIGUOUS
,
197 RTL_TEXTENCODING_UTF8
));
198 String
sOldFileName( aSection
.GetLinkFileName() );
199 String
sSub( sOldFileName
.GetToken( 2, sfx2::cTokenSeperator
) );
201 if( rFile
.Len() || sSub
.Len() )
203 sNewFile
+= sfx2::cTokenSeperator
;
204 if( rFile
.Len() ) // Filter nur mit FileName
205 sNewFile
+= sOldFileName
.GetToken( 1, sfx2::cTokenSeperator
);
207 sNewFile
+= sfx2::cTokenSeperator
;
211 aSection
.SetLinkFileName( sNewFile
);
213 if( rFile
.Len() || sSub
.Len() )
214 aSection
.SetType( FILE_LINK_SECTION
);
216 aSection
.SetType( CONTENT_SECTION
);
220 void SectRepr::SetFilter( const String
& rFilter
)
223 String
sOldFileName( aSection
.GetLinkFileName() );
224 String
sFile( sOldFileName
.GetToken( 0, sfx2::cTokenSeperator
) );
225 String
sSub( sOldFileName
.GetToken( 2, sfx2::cTokenSeperator
) );
228 (((( sNewFile
= sFile
) += sfx2::cTokenSeperator
) += rFilter
)
229 += sfx2::cTokenSeperator
) += sSub
;
230 else if( sSub
.Len() )
231 (( sNewFile
= sfx2::cTokenSeperator
) += sfx2::cTokenSeperator
) += sSub
;
233 aSection
.SetLinkFileName( sNewFile
);
236 aSection
.SetType( FILE_LINK_SECTION
);
239 void SectRepr::SetSubRegion(const String
& rSubRegion
)
242 String
sOldFileName( aSection
.GetLinkFileName() );
243 String
sFilter( sOldFileName
.GetToken( 1, sfx2::cTokenSeperator
) );
244 sOldFileName
= sOldFileName
.GetToken( 0, sfx2::cTokenSeperator
);
246 if( rSubRegion
.Len() || sOldFileName
.Len() )
247 (((( sNewFile
= sOldFileName
) += sfx2::cTokenSeperator
) += sFilter
)
248 += sfx2::cTokenSeperator
) += rSubRegion
;
250 aSection
.SetLinkFileName( sNewFile
);
252 if( rSubRegion
.Len() || sOldFileName
.Len() )
253 aSection
.SetType( FILE_LINK_SECTION
);
255 aSection
.SetType( CONTENT_SECTION
);
259 String
SectRepr::GetFile() const
261 String
sLinkFile( aSection
.GetLinkFileName() );
262 if( sLinkFile
.Len() )
264 if( DDE_LINK_SECTION
== aSection
.GetType() )
266 USHORT n
= sLinkFile
.SearchAndReplace( sfx2::cTokenSeperator
, ' ' );
267 sLinkFile
.SearchAndReplace( sfx2::cTokenSeperator
, ' ', n
);
270 sLinkFile
= INetURLObject::decode( sLinkFile
.GetToken( 0,
271 sfx2::cTokenSeperator
),
273 INetURLObject::DECODE_UNAMBIGUOUS
,
274 RTL_TEXTENCODING_UTF8
);
280 String
SectRepr::GetSubRegion() const
282 String
sLinkFile( aSection
.GetLinkFileName() );
283 if( sLinkFile
.Len() )
284 sLinkFile
= sLinkFile
.GetToken( 2, sfx2::cTokenSeperator
);
291 /*----------------------------------------------------------------------------
292 Beschreibung: Dialog Bearbeiten Bereiche
293 ----------------------------------------------------------------------------*/
295 //---------------------------------------------------------------------
297 SwEditRegionDlg::SwEditRegionDlg( Window
* pParent
, SwWrtShell
& rWrtSh
)
298 : SfxModalDialog( pParent
, SW_RES(MD_EDIT_REGION
) ),
299 aNameFL ( this, SW_RES( FL_NAME
) ),
300 aCurName ( this, SW_RES( ED_RANAME
) ),
301 aTree ( this, SW_RES( TLB_SECTION
)),
302 aLinkFL ( this, SW_RES( FL_LINK
) ),
303 aFileCB ( this, SW_RES( CB_FILE
) ),
304 aDDECB ( this, SW_RES( CB_DDE
) ) ,
305 aFileNameFT ( this, SW_RES( FT_FILE
) ) ,
306 aDDECommandFT ( this, SW_RES( FT_DDE
) ) ,
307 aFileNameED ( this, SW_RES( ED_FILE
) ),
308 aFilePB ( this, SW_RES( PB_FILE
) ),
309 aSubRegionFT ( this, SW_RES( FT_SUBREG
) ) ,
310 aSubRegionED ( this, SW_RES( LB_SUBREG
) ) ,
311 bSubRegionsFilled( false ),
313 aProtectFL ( this, SW_RES( FL_PROTECT
) ),
314 aProtectCB ( this, SW_RES( CB_PROTECT
) ),
315 aPasswdCB ( this, SW_RES( CB_PASSWD
) ),
316 aPasswdPB ( this, SW_RES( PB_PASSWD
) ),
318 aHideFL ( this, SW_RES( FL_HIDE
) ),
319 aHideCB ( this, SW_RES( CB_HIDE
) ),
320 aConditionFT ( this, SW_RES( FT_CONDITION
) ),
321 aConditionED ( this, SW_RES( ED_CONDITION
) ),
323 // --> FME 2004-06-22 #114856# edit in readonly sections
324 aPropertiesFL ( this, SW_RES( FL_PROPERTIES
) ),
325 aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY
) ),
328 aOK ( this, SW_RES( PB_OK
) ),
329 aCancel ( this, SW_RES( PB_CANCEL
) ),
330 aOptionsPB ( this, SW_RES( PB_OPTIONS
) ),
331 aDismiss ( this, SW_RES( CB_DISMISS
) ),
332 aHelp ( this, SW_RES( PB_HELP
) ),
334 aImageIL ( SW_RES(IL_BITMAPS
)),
335 aImageILH ( SW_RES(ILH_BITMAPS
)),
339 m_pDocInserter ( NULL
),
340 m_pOldDefDlgParent ( NULL
),
341 bDontCheckPasswd ( sal_True
)
345 bWeb
= 0 != PTR_CAST( SwWebDocShell
, rSh
.GetView().GetDocShell() );
347 aTree
.SetSelectHdl ( LINK( this, SwEditRegionDlg
, GetFirstEntryHdl
));
348 aTree
.SetDeselectHdl ( LINK( this, SwEditRegionDlg
, DeselectHdl
));
349 aCurName
.SetModifyHdl ( LINK( this, SwEditRegionDlg
, NameEditHdl
));
350 aConditionED
.SetModifyHdl( LINK( this, SwEditRegionDlg
, ConditionEditHdl
));
351 aOK
.SetClickHdl ( LINK( this, SwEditRegionDlg
, OkHdl
));
352 aPasswdCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangePasswdHdl
));
353 aPasswdPB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangePasswdHdl
));
354 aHideCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangeHideHdl
));
355 // --> FME 2004-06-22 #114856# edit in readonly sections
356 aEditInReadonlyCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangeEditInReadonlyHdl
));
360 aOptionsPB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, OptionsHdl
));
361 aProtectCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangeProtectHdl
));
362 aDismiss
.SetClickHdl ( LINK( this, SwEditRegionDlg
, ChangeDismissHdl
));
363 aFileCB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, UseFileHdl
));
364 aFilePB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, FileSearchHdl
));
365 aFileNameED
.SetModifyHdl( LINK( this, SwEditRegionDlg
, FileNameHdl
));
366 aSubRegionED
.SetModifyHdl( LINK( this, SwEditRegionDlg
, FileNameHdl
));
367 aSubRegionED
.AddEventListener( LINK( this, SwEditRegionDlg
, SubRegionEventHdl
));
368 aSubRegionED
.EnableAutocomplete( sal_True
, sal_True
);
370 aTree
.SetHelpId(HID_REGION_TREE
);
371 aTree
.SetSelectionMode( MULTIPLE_SELECTION
);
372 aTree
.SetWindowBits(WB_HASBUTTONSATROOT
|WB_CLIPCHILDREN
|WB_HSCROLL
);
373 aTree
.SetSpaceBetweenEntries(0);
377 aConditionFT
.Hide();
378 aConditionED
.Hide();
383 aDDECommandFT
.Hide();
386 aDDECB
.SetClickHdl ( LINK( this, SwEditRegionDlg
, DDEHdl
));
388 //Ermitteln der vorhandenen Bereiche
389 pCurrSect
= rSh
.GetCurrSection();
391 //falls der Cursor nicht in einem Bereich steht,
392 //wird immer der erste selektiert
393 if( !aTree
.FirstSelected() && aTree
.First() )
394 aTree
.Select( aTree
.First() );
396 bDontCheckPasswd
= sal_False
;
398 /* -----------------------------26.04.01 14:56--------------------------------
400 ---------------------------------------------------------------------------*/
401 BOOL
SwEditRegionDlg::CheckPasswd(CheckBox
* pBox
)
405 sal_Bool bRet
= TRUE
;
406 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
409 SectReprPtr pRepr
= (SectReprPtr
)pEntry
->GetUserData();
410 if(!pRepr
->GetTempPasswd().getLength() && pRepr
->GetPasswd().getLength())
412 SwTestPasswdDlg
aPasswdDlg(this);
414 if (aPasswdDlg
.Execute())
416 String
sNewPasswd( aPasswdDlg
.GetPassword() );
417 UNO_NMSPC::Sequence
<sal_Int8
> aNewPasswd
;
418 SvPasswordHelper::GetHashPassword( aNewPasswd
, sNewPasswd
);
419 if(SvPasswordHelper::CompareHashPassword(pRepr
->GetPasswd(), sNewPasswd
))
421 pRepr
->SetTempPasswd(aNewPasswd
);
426 InfoBox(this, SW_RES(REG_WRONG_PASSWORD
)).Execute();
430 pEntry
= aTree
.NextSelected(pEntry
);
434 //reset old button state
435 if(pBox
->IsTriStateEnabled())
436 pBox
->SetState(pBox
->IsChecked() ? STATE_NOCHECK
: STATE_DONTKNOW
);
438 pBox
->Check(!pBox
->IsChecked());
443 /*---------------------------------------------------------------------
444 Beschreibung: Durchsuchen nach Child-Sections, rekursiv
445 ---------------------------------------------------------------------*/
447 void SwEditRegionDlg::RecurseList( const SwSectionFmt
* pFmt
, SvLBoxEntry
* pEntry
)
449 SwSection
* pSect
= 0;
450 SvLBoxEntry
* pSelEntry
= 0;
454 USHORT nCount
=rSh
.GetSectionFmtCount();
455 for ( USHORT n
=0; n
< nCount
; n
++ )
457 SectionType eTmpType
;
458 if( !( pFmt
= &rSh
.GetSectionFmt(n
))->GetParent() &&
459 pFmt
->IsInNodesArr() &&
460 (eTmpType
= pFmt
->GetSection()->GetType()) != TOX_CONTENT_SECTION
461 && TOX_HEADER_SECTION
!= eTmpType
)
463 SectRepr
* pSectRepr
= new SectRepr( n
,
464 *(pSect
=pFmt
->GetSection()) );
465 Image aImg
= BuildBitmap( pSect
->IsProtect(),pSect
->IsHidden(), FALSE
);
466 pEntry
= aTree
.InsertEntry( pSect
->GetName(), aImg
, aImg
);
467 Image aHCImg
= BuildBitmap( pSect
->IsProtect(),pSect
->IsHidden(), TRUE
);
468 aTree
.SetExpandedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
469 aTree
.SetCollapsedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
470 pEntry
->SetUserData(pSectRepr
);
471 RecurseList( pFmt
, pEntry
);
472 if (pEntry
->HasChilds())
473 aTree
.Expand(pEntry
);
474 if (pCurrSect
==pSect
)
475 aTree
.Select(pEntry
);
482 SvLBoxEntry
* pNEntry
;
483 USHORT nCnt
= pFmt
->GetChildSections(aTmpArr
,SORTSECT_POS
);
486 for( USHORT n
= 0; n
< nCnt
; ++n
)
488 SectionType eTmpType
;
489 pFmt
= aTmpArr
[n
]->GetFmt();
490 if( pFmt
->IsInNodesArr() &&
491 (eTmpType
= pFmt
->GetSection()->GetType()) != TOX_CONTENT_SECTION
492 && TOX_HEADER_SECTION
!= eTmpType
)
495 SectRepr
* pSectRepr
=new SectRepr(
496 FindArrPos( pSect
->GetFmt() ), *pSect
);
497 Image aImage
= BuildBitmap( pSect
->IsProtect(),
498 pSect
->IsHidden(), FALSE
);
499 pNEntry
=aTree
.InsertEntry( pSect
->GetName(), aImage
, aImage
, pEntry
);
500 Image aHCImg
= BuildBitmap( pSect
->IsProtect(),pSect
->IsHidden(), TRUE
);
501 aTree
.SetExpandedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
502 aTree
.SetCollapsedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
503 pNEntry
->SetUserData(pSectRepr
);
504 RecurseList( aTmpArr
[n
]->GetFmt(), pNEntry
);
505 if( pNEntry
->HasChilds())
506 aTree
.Expand(pNEntry
);
507 if (pCurrSect
==pSect
)
515 aTree
.MakeVisible(pSelEntry
);
516 aTree
.Select(pSelEntry
);
519 /*---------------------------------------------------------------------
521 ---------------------------------------------------------------------*/
523 USHORT
SwEditRegionDlg::FindArrPos(const SwSectionFmt
* pFmt
)
525 USHORT nCount
=rSh
.GetSectionFmtCount();
526 for (USHORT i
=0;i
<nCount
;i
++)
527 if (pFmt
==&rSh
.GetSectionFmt(i
))
530 DBG_ERROR( "SectionFormat nicht in der Liste" );
533 /*---------------------------------------------------------------------
535 ---------------------------------------------------------------------*/
537 SwEditRegionDlg::~SwEditRegionDlg( )
539 SvLBoxEntry
* pEntry
= aTree
.First();
542 delete (SectRepr
*)pEntry
->GetUserData();
543 pEntry
= aTree
.Next( pEntry
);
546 aSectReprArr
.DeleteAndDestroy( 0, aSectReprArr
.Count() );
547 delete m_pDocInserter
;
549 /* -----------------------------09.10.2001 15:41------------------------------
551 ---------------------------------------------------------------------------*/
552 void SwEditRegionDlg::SelectSection(const String
& rSectionName
)
554 SvLBoxEntry
* pEntry
= aTree
.First();
557 SectReprPtr pRepr
= (SectReprPtr
)pEntry
->GetUserData();
558 if(pRepr
->GetSection().GetName() == rSectionName
)
560 pEntry
= aTree
.Next(pEntry
);
564 aTree
.SelectAll( FALSE
);
565 aTree
.Select(pEntry
);
566 aTree
.MakeVisible(pEntry
);
569 /*---------------------------------------------------------------------
570 Beschreibung: Selektierte Eintrag in der TreeListBox wird im
571 Edit-Fenster angezeigt
572 Bei Multiselektion werden einige Controls disabled
573 ---------------------------------------------------------------------*/
575 IMPL_LINK( SwEditRegionDlg
, GetFirstEntryHdl
, SvTreeListBox
*, pBox
)
577 bDontCheckPasswd
= sal_True
;
578 SvLBoxEntry
* pEntry
=pBox
->FirstSelected();
579 aHideCB
.Enable(TRUE
);
580 // --> FME 2004-06-22 #114856# edit in readonly sections
581 aEditInReadonlyCB
.Enable(TRUE
);
583 aProtectCB
.Enable(TRUE
);
584 aFileCB
.Enable(TRUE
);
585 UNO_NMSPC::Sequence
<sal_Int8
> aCurPasswd
;
586 if( 1 < pBox
->GetSelectionCount() )
588 aHideCB
.EnableTriState( TRUE
);
589 aProtectCB
.EnableTriState( TRUE
);
590 // --> FME 2004-06-22 #114856# edit in readonly sections
591 aEditInReadonlyCB
.EnableTriState ( TRUE
);
593 aFileCB
.EnableTriState( TRUE
);
595 BOOL bHiddenValid
= TRUE
;
596 BOOL bProtectValid
= TRUE
;
597 BOOL bConditionValid
= TRUE
;
598 // --> FME 2004-06-22 #114856# edit in readonly sections
599 BOOL bEditInReadonlyValid
= TRUE
;
600 BOOL bEditInReadonly
= TRUE
;
603 BOOL bProtect
= TRUE
;
606 BOOL bFileValid
= TRUE
;
608 BOOL bPasswdValid
= TRUE
;
612 SectRepr
* pRepr
=(SectRepr
*) pEntry
->GetUserData();
615 sCondition
= pRepr
->GetCondition();
616 bHidden
= pRepr
->IsHidden();
617 bProtect
= pRepr
->IsProtect();
618 // --> FME 2004-06-22 #114856# edit in readonly sections
619 bEditInReadonly
= pRepr
->IsEditInReadonly();
621 bFile
= pRepr
->GetSectionType() != CONTENT_SECTION
;
622 aCurPasswd
= pRepr
->GetPasswd();
626 String
sTemp(pRepr
->GetCondition());
627 if(sCondition
!= sTemp
)
628 bConditionValid
= FALSE
;
629 bHiddenValid
= bHidden
== pRepr
->IsHidden();
630 bProtectValid
= bProtect
== pRepr
->IsProtect();
631 // --> FME 2004-06-22 #114856# edit in readonly sections
632 bEditInReadonlyValid
= bEditInReadonly
== pRepr
->IsEditInReadonly();
634 bFileValid
= (pRepr
->GetSectionType() != CONTENT_SECTION
) == bFile
;
635 bPasswdValid
= aCurPasswd
== pRepr
->GetPasswd();
637 pEntry
= pBox
->NextSelected(pEntry
);
641 aHideCB
.SetState( !bHiddenValid
? STATE_DONTKNOW
:
642 bHidden
? STATE_CHECK
: STATE_NOCHECK
);
643 aProtectCB
.SetState( !bProtectValid
? STATE_DONTKNOW
:
644 bProtect
? STATE_CHECK
: STATE_NOCHECK
);
645 // --> FME 2004-06-22 #114856# edit in readonly sections
646 aEditInReadonlyCB
.SetState( !bEditInReadonlyValid
? STATE_DONTKNOW
:
647 bEditInReadonly
? STATE_CHECK
: STATE_NOCHECK
);
649 aFileCB
.SetState(!bFileValid
? STATE_DONTKNOW
:
650 bFile
? STATE_CHECK
: STATE_NOCHECK
);
653 aConditionED
.SetText(sCondition
);
656 // aConditionED.SetText(aEmptyStr);
657 aConditionFT
.Enable(FALSE
);
658 aConditionED
.Enable(FALSE
);
661 aFilePB
.Enable(FALSE
);
662 aFileNameFT
.Enable(FALSE
);
663 aFileNameED
.Enable(FALSE
);
664 aSubRegionFT
.Enable(FALSE
);
665 aSubRegionED
.Enable(FALSE
);
666 // aNameFT .Enable(FALSE);
667 aCurName
.Enable(FALSE
);
668 aOptionsPB
.Enable(FALSE
);
669 aDDECB
.Enable(FALSE
);
670 aDDECommandFT
.Enable(FALSE
);
671 BOOL bPasswdEnabled
= aProtectCB
.GetState() == STATE_CHECK
;
672 aPasswdCB
.Enable(bPasswdEnabled
);
673 aPasswdPB
.Enable(bPasswdEnabled
);
676 pEntry
= pBox
->FirstSelected();
677 pBox
->SelectAll( FALSE
);
678 pBox
->Select( pEntry
);
679 GetFirstEntryHdl(pBox
);
683 aPasswdCB
.Check(aCurPasswd
.getLength() > 0);
687 // aNameFT .Enable(TRUE);
688 aCurName
.Enable(TRUE
);
689 aOptionsPB
.Enable(TRUE
);
690 SectRepr
* pRepr
=(SectRepr
*) pEntry
->GetUserData();
691 aConditionED
.SetText(pRepr
->GetCondition());
693 aHideCB
.SetState(pRepr
->IsHidden() ? STATE_CHECK
: STATE_NOCHECK
);
694 BOOL bHide
= STATE_CHECK
== aHideCB
.GetState();
695 aConditionED
.Enable(bHide
);
696 aConditionFT
.Enable(bHide
);
697 aPasswdCB
.Check(pRepr
->GetPasswd().getLength() > 0);
701 aCurName
.SetText(pBox
->GetEntryText(pEntry
));
704 String aFile
= pRepr
->GetFile();
705 String sSub
= pRepr
->GetSubRegion();
706 bSubRegionsFilled
= false;
707 aSubRegionED
.Clear();
708 if(aFile
.Len()||sSub
.Len())
711 aFileNameED
.SetText(aFile
);
712 aSubRegionED
.SetText(sSub
);
713 aDDECB
.Check(pRepr
->GetSectionType() == DDE_LINK_SECTION
);
717 aFileCB
.Check(FALSE
);
718 aFileNameED
.SetText(aFile
);
719 aDDECB
.Enable(FALSE
);
722 UseFileHdl(&aFileCB
);
724 aProtectCB
.SetState(pRepr
->IsProtect() ? STATE_CHECK
: STATE_NOCHECK
);
727 // --> FME 2004-06-22 #114856# edit in readonly sections
728 aEditInReadonlyCB
.SetState( pRepr
->IsEditInReadonly() ? STATE_CHECK
: STATE_NOCHECK
);
729 aEditInReadonlyCB
.Enable();
732 BOOL bPasswdEnabled
= aProtectCB
.IsChecked();
733 aPasswdCB
.Enable(bPasswdEnabled
);
734 aPasswdPB
.Enable(bPasswdEnabled
);
736 bDontCheckPasswd
= sal_False
;
739 /*-----------------28.06.97 09:19-------------------
741 --------------------------------------------------*/
742 IMPL_LINK( SwEditRegionDlg
, DeselectHdl
, SvTreeListBox
*, pBox
)
744 if( !pBox
->GetSelectionCount() )
746 aHideCB
.Enable(FALSE
);
747 aProtectCB
.Enable(FALSE
);
748 // --> FME 2004-06-22 #114856# edit in readonly sections
749 aEditInReadonlyCB
.Enable(FALSE
);
751 aPasswdCB
.Enable(FALSE
);
752 aPasswdCB
.Enable(FALSE
);
753 aConditionFT
.Enable(FALSE
);
754 aConditionED
.Enable(FALSE
);
755 aFileCB
.Enable(FALSE
);
756 aFilePB
.Enable(FALSE
);
757 aFileNameFT
.Enable(FALSE
);
758 aFileNameED
.Enable(FALSE
);
759 aSubRegionFT
.Enable(FALSE
);
760 aSubRegionED
.Enable(FALSE
);
761 // aNameFT .Enable(FALSE);
762 aCurName
.Enable(FALSE
);
763 aDDECB
.Enable(FALSE
);
764 aDDECommandFT
.Enable(FALSE
);
766 UseFileHdl(&aFileCB
);
772 /*---------------------------------------------------------------------
773 Beschreibung: Im OkHdl werden die veraenderten Einstellungen
774 uebernommen und aufgehobene Bereiche geloescht
775 ---------------------------------------------------------------------*/
777 IMPL_LINK( SwEditRegionDlg
, OkHdl
, CheckBox
*, EMPTYARG
)
780 // temp. Array weil sich waehrend des aendern eines Bereiches die
781 // Position innerhalb des "Core-Arrays" verschieben kann:
782 // - bei gelinkten Bereichen, wenn sie weitere SubBereiche haben oder
784 // JP 30.05.97: StartUndo darf natuerlich auch erst nach dem Kopieren
785 // der Formate erfolgen (ClearRedo!)
787 const SwSectionFmts
& rDocFmts
= rSh
.GetDoc()->GetSections();
788 SwSectionFmts
aOrigArray( 0, 5 );
789 aOrigArray
.Insert( &rDocFmts
, 0 );
791 rSh
.StartAllAction();
793 rSh
.ResetSelect( 0,FALSE
);
794 SvLBoxEntry
* pEntry
= aTree
.First();
798 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
799 SwSectionFmt
* pFmt
= aOrigArray
[ pRepr
->GetArrPos() ];
800 if( !pRepr
->GetSection().IsProtectFlag())
801 pRepr
->GetSection().SetPasswd(UNO_NMSPC::Sequence
<sal_Int8
>());
802 USHORT nNewPos
= rDocFmts
.GetPos( pFmt
);
803 if( USHRT_MAX
!= nNewPos
)
805 SfxItemSet
* pSet
= pFmt
->GetAttrSet().Clone( FALSE
);
806 if( pFmt
->GetCol() != pRepr
->GetCol() )
807 pSet
->Put( pRepr
->GetCol() );
809 if( pFmt
->GetBackground(FALSE
) != pRepr
->GetBackground() )
810 pSet
->Put( pRepr
->GetBackground() );
812 if( pFmt
->GetFtnAtTxtEnd(FALSE
) != pRepr
->GetFtnNtAtEnd() )
813 pSet
->Put( pRepr
->GetFtnNtAtEnd() );
815 if( pFmt
->GetEndAtTxtEnd(FALSE
) != pRepr
->GetEndNtAtEnd() )
816 pSet
->Put( pRepr
->GetEndNtAtEnd() );
818 if( pFmt
->GetBalancedColumns() != pRepr
->GetBalance() )
819 pSet
->Put( pRepr
->GetBalance() );
821 if( pFmt
->GetFrmDir() != pRepr
->GetFrmDir() )
822 pSet
->Put( pRepr
->GetFrmDir() );
824 if( pFmt
->GetLRSpace() != pRepr
->GetLRSpace())
825 pSet
->Put( pRepr
->GetLRSpace());
827 rSh
.ChgSection( nNewPos
, pRepr
->GetSection(),
828 pSet
->Count() ? pSet
: 0 );
831 pEntry
= aTree
.Next( pEntry
);
834 for(USHORT i
= aSectReprArr
.Count(); i
; )
836 SwSectionFmt
* pFmt
= aOrigArray
[ aSectReprArr
[ --i
]->GetArrPos() ];
837 USHORT nNewPos
= rDocFmts
.GetPos( pFmt
);
838 if( USHRT_MAX
!= nNewPos
)
839 rSh
.DelSectionFmt( nNewPos
);
841 // rSh.ChgSectionPasswd(aNewPasswd);
843 aOrigArray
.Remove( 0, aOrigArray
.Count() );
845 //JP 21.05.97: EndDialog muss vor Ende der EndAction gerufen werden,
846 // sonst kann es ScrollFehler geben.
854 /*---------------------------------------------------------------------
855 Beschreibung: Toggle protect
856 ---------------------------------------------------------------------*/
858 IMPL_LINK( SwEditRegionDlg
, ChangeProtectHdl
, TriStateBox
*, pBox
)
860 if(!CheckPasswd(pBox
))
862 pBox
->EnableTriState( FALSE
);
863 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
864 DBG_ASSERT(pEntry
,"kein Entry gefunden");
865 BOOL bCheck
= STATE_CHECK
== pBox
->GetState();
868 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
869 pRepr
->SetProtect(bCheck
);
870 Image aImage
= BuildBitmap( bCheck
,
871 STATE_CHECK
== aHideCB
.GetState(), FALSE
);
872 aTree
.SetExpandedEntryBmp(pEntry
, aImage
, BMP_COLOR_NORMAL
);
873 aTree
.SetCollapsedEntryBmp(pEntry
, aImage
, BMP_COLOR_NORMAL
);
874 Image aHCImg
= BuildBitmap( bCheck
, STATE_CHECK
== aHideCB
.GetState(), TRUE
);
875 aTree
.SetExpandedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
876 aTree
.SetCollapsedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
877 pEntry
= aTree
.NextSelected(pEntry
);
879 aPasswdCB
.Enable(bCheck
);
880 aPasswdPB
.Enable(bCheck
);
883 /*---------------------------------------------------------------------
884 Beschreibung: Toggle hide
885 ---------------------------------------------------------------------*/
887 IMPL_LINK( SwEditRegionDlg
, ChangeHideHdl
, TriStateBox
*, pBox
)
889 if(!CheckPasswd(pBox
))
891 pBox
->EnableTriState( FALSE
);
892 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
893 DBG_ASSERT(pEntry
,"kein Entry gefunden");
896 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
897 pRepr
->SetHidden(STATE_CHECK
== pBox
->GetState());
898 Image aImage
= BuildBitmap(STATE_CHECK
== aProtectCB
.GetState(),
899 STATE_CHECK
== pBox
->GetState(), FALSE
);
900 aTree
.SetExpandedEntryBmp(pEntry
, aImage
, BMP_COLOR_NORMAL
);
901 aTree
.SetCollapsedEntryBmp(pEntry
, aImage
, BMP_COLOR_NORMAL
);
902 Image aHCImg
= BuildBitmap( STATE_CHECK
== aProtectCB
.GetState(),
903 STATE_CHECK
== pBox
->GetState(), TRUE
);
904 aTree
.SetExpandedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
905 aTree
.SetCollapsedEntryBmp(pEntry
, aHCImg
, BMP_COLOR_HIGHCONTRAST
);
907 pEntry
= aTree
.NextSelected(pEntry
);
910 BOOL bHide
= STATE_CHECK
== pBox
->GetState();
911 aConditionED
.Enable(bHide
);
912 aConditionFT
.Enable(bHide
);
916 /*---------------------------------------------------------------------
917 Beschreibung: Toggle edit in readonly
918 ---------------------------------------------------------------------*/
920 IMPL_LINK( SwEditRegionDlg
, ChangeEditInReadonlyHdl
, TriStateBox
*, pBox
)
922 if(!CheckPasswd(pBox
))
924 pBox
->EnableTriState( FALSE
);
925 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
926 DBG_ASSERT(pEntry
,"kein Entry gefunden");
929 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
930 pRepr
->SetEditInReadonly(STATE_CHECK
== pBox
->GetState());
931 pEntry
= aTree
.NextSelected(pEntry
);
937 /*---------------------------------------------------------------------
938 Beschreibung: selektierten Bereich aufheben
939 ---------------------------------------------------------------------*/
941 IMPL_LINK( SwEditRegionDlg
, ChangeDismissHdl
, CheckBox
*, EMPTYARG
)
945 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
947 SvLBoxEntry
* pParent
;
948 //zuerst alle selektierten markieren
951 const SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
952 pSectRepr
->SetSelected();
953 pEntry
= aTree
.NextSelected(pEntry
);
955 pEntry
= aTree
.FirstSelected();
959 const SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
960 SvLBoxEntry
* pRemove
= 0;
961 BOOL bRestart
= FALSE
;
962 if(pSectRepr
->IsSelected())
964 aSectReprArr
.Insert( pSectRepr
);
965 while( (pChild
= aTree
.FirstChild(pEntry
) )!= 0 )
967 //durch das Umhaengen muss wieder am Anfang aufgesetzt werden
969 pParent
=aTree
.GetParent(pEntry
);
970 aTree
.GetModel()->Move(pChild
, pParent
, aTree
.GetModel()->GetRelPos(pEntry
));
975 pEntry
= aTree
.First();
977 pEntry
= aTree
.Next(pEntry
);
979 aTree
.GetModel()->Remove( pRemove
);
982 if ( (pEntry
=aTree
.FirstSelected()) == 0 )
984 aConditionFT
. Enable(FALSE
);
985 aConditionED
. Enable(FALSE
);
986 aDismiss
. Enable(FALSE
);
987 aCurName
. Enable(FALSE
);
988 aProtectCB
. Enable(FALSE
);
989 aPasswdCB
. Enable(FALSE
);
990 aHideCB
. Enable(FALSE
);
991 // --> FME 2004-06-22 #114856# edit in readonly sections
992 aEditInReadonlyCB
.Enable(FALSE
);
993 aEditInReadonlyCB
.SetState(STATE_NOCHECK
);
995 aProtectCB
. SetState(STATE_NOCHECK
);
996 aPasswdCB
. Check(FALSE
);
997 aHideCB
. SetState(STATE_NOCHECK
);
998 aFileCB
. Check(FALSE
);
999 //sonst liegt der Focus auf dem HelpButton
1001 UseFileHdl(&aFileCB
);
1005 /*---------------------------------------------------------------------
1006 Beschreibung: CheckBox mit Datei verknuepfen?
1007 ---------------------------------------------------------------------*/
1009 IMPL_LINK( SwEditRegionDlg
, UseFileHdl
, CheckBox
*, pBox
)
1011 if(!CheckPasswd(pBox
))
1013 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
1014 pBox
->EnableTriState(FALSE
);
1015 BOOL bMulti
= 1 < aTree
.GetSelectionCount();
1016 BOOL bFile
= pBox
->IsChecked();
1021 const SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1022 BOOL bContent
= pSectRepr
->IsContent();
1023 if( pBox
->IsChecked() && bContent
&& rSh
.HasSelection() )
1025 if( RET_NO
== QueryBox( this, SW_RES(QB_CONNECT
) ).Execute() )
1026 pBox
->Check( FALSE
);
1029 pSectRepr
->SetContent(FALSE
);
1032 pSectRepr
->SetFile(aEmptyStr
);
1033 pSectRepr
->SetSubRegion(aEmptyStr
);
1034 pSectRepr
->SetFilePasswd(aEmptyStr
);
1037 pEntry
= aTree
.NextSelected(pEntry
);
1039 aFileNameFT
.Enable(bFile
&& ! bMulti
);
1040 aFileNameED
.Enable(bFile
&& ! bMulti
);
1041 aFilePB
.Enable(bFile
&& ! bMulti
);
1042 aSubRegionED
.Enable(bFile
&& ! bMulti
);
1043 aSubRegionFT
.Enable(bFile
&& ! bMulti
);
1044 aDDECommandFT
.Enable(bFile
&& ! bMulti
);
1045 aDDECB
.Enable(bFile
&& ! bMulti
);
1048 aProtectCB
.SetState(STATE_CHECK
);
1049 aFileNameED
.GrabFocus();
1054 aDDECB
.Check(FALSE
);
1056 // aFileNameED.SetText(aEmptyStr);
1057 aSubRegionED
.SetText(aEmptyStr
);
1063 pBox
->Enable(FALSE
);
1064 aFilePB
.Enable(FALSE
);
1065 aFileNameED
.Enable(FALSE
);
1066 aFileNameFT
.Enable(FALSE
);
1067 aSubRegionED
.Enable(FALSE
);
1068 aSubRegionFT
.Enable(FALSE
);
1069 aDDECB
.Check(FALSE
);
1070 aDDECB
.Enable(FALSE
);
1071 aDDECommandFT
.Enable(FALSE
);
1076 /*---------------------------------------------------------------------
1077 Beschreibung: Dialog Datei einfuegen rufen
1078 ---------------------------------------------------------------------*/
1080 IMPL_LINK( SwEditRegionDlg
, FileSearchHdl
, PushButton
*, EMPTYARG
)
1085 m_pOldDefDlgParent
= Application::GetDefDialogParent();
1086 Application::SetDefDialogParent( this );
1087 if ( m_pDocInserter
)
1088 delete m_pDocInserter
;
1089 m_pDocInserter
= new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") );
1090 m_pDocInserter
->StartExecuteModal( LINK( this, SwEditRegionDlg
, DlgClosedHdl
) );
1094 /*---------------------------------------------------------------------
1096 ---------------------------------------------------------------------*/
1098 IMPL_LINK( SwEditRegionDlg
, OptionsHdl
, PushButton
*, EMPTYARG
)
1102 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
1106 SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1107 SfxItemSet
aSet(rSh
.GetView().GetPool(),
1109 RES_COLUMNBALANCE
, RES_FRAMEDIR
,
1110 RES_BACKGROUND
, RES_BACKGROUND
,
1111 RES_FRM_SIZE
, RES_FRM_SIZE
,
1112 SID_ATTR_PAGE_SIZE
, SID_ATTR_PAGE_SIZE
,
1113 RES_LR_SPACE
, RES_LR_SPACE
,
1114 RES_FTN_AT_TXTEND
, RES_END_AT_TXTEND
,
1117 aSet
.Put( pSectRepr
->GetCol() );
1118 aSet
.Put( pSectRepr
->GetBackground() );
1119 aSet
.Put( pSectRepr
->GetFtnNtAtEnd() );
1120 aSet
.Put( pSectRepr
->GetEndNtAtEnd() );
1121 aSet
.Put( pSectRepr
->GetBalance() );
1122 aSet
.Put( pSectRepr
->GetFrmDir() );
1123 aSet
.Put( pSectRepr
->GetLRSpace() );
1125 const SwSectionFmts
& rDocFmts
= rSh
.GetDoc()->GetSections();
1126 SwSectionFmts
aOrigArray( 0, 5 );
1127 aOrigArray
.Insert( &rDocFmts
, 0 );
1129 SwSectionFmt
* pFmt
= aOrigArray
[pSectRepr
->GetArrPos()];
1130 long nWidth
= rSh
.GetSectionWidth(*pFmt
);
1131 aOrigArray
.Remove( 0, aOrigArray
.Count() );
1135 aSet
.Put(SwFmtFrmSize(ATT_VAR_SIZE
, nWidth
));
1136 aSet
.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE
, Size(nWidth
, nWidth
)));
1138 SwSectionPropertyTabDialog
aTabDlg(this, aSet
, rSh
);
1139 if(RET_OK
== aTabDlg
.Execute())
1141 const SfxItemSet
* pOutSet
= aTabDlg
.GetOutputItemSet();
1142 if( pOutSet
&& pOutSet
->Count() )
1144 const SfxPoolItem
*pColItem
, *pBrushItem
,
1145 *pFtnItem
, *pEndItem
, *pBalanceItem
,
1146 *pFrmDirItem
, *pLRSpaceItem
;
1147 SfxItemState eColState
= pOutSet
->GetItemState(
1148 RES_COL
, FALSE
, &pColItem
);
1149 SfxItemState eBrushState
= pOutSet
->GetItemState(
1150 RES_BACKGROUND
, FALSE
, &pBrushItem
);
1151 SfxItemState eFtnState
= pOutSet
->GetItemState(
1152 RES_FTN_AT_TXTEND
, FALSE
, &pFtnItem
);
1153 SfxItemState eEndState
= pOutSet
->GetItemState(
1154 RES_END_AT_TXTEND
, FALSE
, &pEndItem
);
1155 SfxItemState eBalanceState
= pOutSet
->GetItemState(
1156 RES_COLUMNBALANCE
, FALSE
, &pBalanceItem
);
1157 SfxItemState eFrmDirState
= pOutSet
->GetItemState(
1158 RES_FRAMEDIR
, FALSE
, &pFrmDirItem
);
1159 SfxItemState eLRState
= pOutSet
->GetItemState(
1160 RES_LR_SPACE
, FALSE
, &pLRSpaceItem
);
1162 if( SFX_ITEM_SET
== eColState
||
1163 SFX_ITEM_SET
== eBrushState
||
1164 SFX_ITEM_SET
== eFtnState
||
1165 SFX_ITEM_SET
== eEndState
||
1166 SFX_ITEM_SET
== eBalanceState
||
1167 SFX_ITEM_SET
== eFrmDirState
||
1168 SFX_ITEM_SET
== eLRState
)
1170 SvLBoxEntry
* pSelEntry
= aTree
.FirstSelected();
1173 SectReprPtr pRepr
= (SectReprPtr
)pSelEntry
->GetUserData();
1174 if( SFX_ITEM_SET
== eColState
)
1175 pRepr
->GetCol() = *(SwFmtCol
*)pColItem
;
1176 if( SFX_ITEM_SET
== eBrushState
)
1177 pRepr
->GetBackground() = *(SvxBrushItem
*)pBrushItem
;
1178 if( SFX_ITEM_SET
== eFtnState
)
1179 pRepr
->GetFtnNtAtEnd() = *(SwFmtFtnAtTxtEnd
*)pFtnItem
;
1180 if( SFX_ITEM_SET
== eEndState
)
1181 pRepr
->GetEndNtAtEnd() = *(SwFmtEndAtTxtEnd
*)pEndItem
;
1182 if( SFX_ITEM_SET
== eBalanceState
)
1183 pRepr
->GetBalance().SetValue(((SwFmtNoBalancedColumns
*)pBalanceItem
)->GetValue());
1184 if( SFX_ITEM_SET
== eFrmDirState
)
1185 pRepr
->GetFrmDir().SetValue(((SvxFrameDirectionItem
*)pFrmDirItem
)->GetValue());
1186 if( SFX_ITEM_SET
== eLRState
)
1187 pRepr
->GetLRSpace() = *(SvxLRSpaceItem
*)pLRSpaceItem
;
1189 pSelEntry
= aTree
.NextSelected(pSelEntry
);
1199 /*---------------------------------------------------------------------
1200 Beschreibung: Uebernahme des Dateinamen oder
1201 des verknuepften Bereichs
1202 ---------------------------------------------------------------------*/
1204 IMPL_LINK( SwEditRegionDlg
, FileNameHdl
, Edit
*, pEdit
)
1206 Selection aSelect
= pEdit
->GetSelection();
1209 pEdit
->SetSelection(aSelect
);
1210 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
1211 DBG_ASSERT(pEntry
,"kein Entry gefunden");
1212 SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1213 if(pEdit
== &aFileNameED
)
1215 bSubRegionsFilled
= false;
1216 aSubRegionED
.Clear();
1217 if( aDDECB
.IsChecked() )
1219 String
sLink( pEdit
->GetText() );
1221 while( STRING_NOTFOUND
!= (nPos
= sLink
.SearchAscii( " ", nPos
)) )
1222 sLink
.Erase( nPos
--, 1 );
1224 nPos
= sLink
.SearchAndReplace( ' ', sfx2::cTokenSeperator
);
1225 sLink
.SearchAndReplace( ' ', sfx2::cTokenSeperator
, nPos
);
1227 pSectRepr
->GetSection().SetLinkFileName( sLink
);
1228 pSectRepr
->GetSection().SetType( DDE_LINK_SECTION
);
1232 String
sTmp(pEdit
->GetText());
1235 SfxMedium
* pMedium
= rSh
.GetView().GetDocShell()->GetMedium();
1238 aAbs
= pMedium
->GetURLObject();
1239 sTmp
= URIHelper::SmartRel2Abs(
1240 aAbs
, sTmp
, URIHelper::GetMaybeFileHdl() );
1242 pSectRepr
->SetFile( sTmp
);
1243 pSectRepr
->SetFilePasswd( aEmptyStr
);
1248 pSectRepr
->SetSubRegion( pEdit
->GetText() );
1252 /*---------------------------------------------------------------------
1254 ---------------------------------------------------------------------*/
1256 IMPL_LINK( SwEditRegionDlg
, DDEHdl
, CheckBox
*, pBox
)
1258 if(!CheckPasswd(pBox
))
1260 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
1263 BOOL bFile
= aFileCB
.IsChecked();
1264 SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1265 BOOL bDDE
= pBox
->IsChecked();
1269 aDDECommandFT
.Enable();
1270 aDDECommandFT
.Show();
1271 aSubRegionFT
.Hide();
1272 aSubRegionED
.Hide();
1273 if(FILE_LINK_SECTION
== pSectRepr
->GetSectionType() )
1275 pSectRepr
->SetFile(aEmptyStr
);
1276 aFileNameED
.SetText(aEmptyStr
);
1277 pSectRepr
->SetFilePasswd( aEmptyStr
);
1279 pSectRepr
->SetSectionType( DDE_LINK_SECTION
);
1283 aDDECommandFT
.Hide();
1284 aFileNameFT
.Enable(bFile
);
1286 aSubRegionED
.Show();
1287 aSubRegionFT
.Show();
1288 aSubRegionED
.Enable(bFile
);
1289 aSubRegionFT
.Enable(bFile
);
1290 aSubRegionED
.Enable(bFile
);
1291 if(DDE_LINK_SECTION
== pSectRepr
->GetSectionType() )
1293 pSectRepr
->SetSectionType( FILE_LINK_SECTION
);
1294 pSectRepr
->SetFile(aEmptyStr
);
1295 pSectRepr
->SetFilePasswd( aEmptyStr
);
1296 aFileNameED
.SetText(aEmptyStr
);
1299 aFilePB
.Enable(bFile
&& !bDDE
);
1303 /*---------------------------------------------------------------------
1305 ---------------------------------------------------------------------*/
1307 IMPL_LINK( SwEditRegionDlg
, ChangePasswdHdl
, Button
*, pBox
)
1309 sal_Bool bChange
= pBox
== &aPasswdPB
;
1313 aPasswdCB
.Check(!aPasswdCB
.IsChecked());
1316 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
1317 sal_Bool bSet
= bChange
? bChange
: aPasswdCB
.IsChecked();
1318 DBG_ASSERT(pEntry
,"kein Entry gefunden");
1321 SectReprPtr pRepr
= (SectReprPtr
)pEntry
->GetUserData();
1324 if(!pRepr
->GetTempPasswd().getLength() || bChange
)
1326 SwTestPasswdDlg
aPasswdDlg(this);
1327 aPasswdDlg
.ShowExtras(SHOWEXTRAS_CONFIRM
);
1328 if(RET_OK
== aPasswdDlg
.Execute())
1330 String
sNewPasswd( aPasswdDlg
.GetPassword() );
1331 if( aPasswdDlg
.GetConfirm() == sNewPasswd
)
1333 SvPasswordHelper::GetHashPassword( pRepr
->GetTempPasswd(), sNewPasswd
);
1337 InfoBox(pBox
, SW_RES(REG_WRONG_PASSWD_REPEAT
)).Execute();
1338 ChangePasswdHdl(pBox
);
1345 aPasswdCB
.Check(FALSE
);
1349 pRepr
->GetSection().SetPasswd(pRepr
->GetTempPasswd());
1352 pRepr
->GetSection().SetPasswd(UNO_NMSPC::Sequence
<sal_Int8
>());
1353 pEntry
= aTree
.NextSelected(pEntry
);
1357 /*---------------------------------------------------------------------
1358 Beschreibung: Aktueller Bereichsname wird sofort beim editieren
1359 in die TreeListBox eingetragen, mit leerem String
1361 ---------------------------------------------------------------------*/
1363 IMPL_LINK( SwEditRegionDlg
, NameEditHdl
, Edit
*, EMPTYARG
)
1367 SvLBoxEntry
* pEntry
=aTree
.FirstSelected();
1368 DBG_ASSERT(pEntry
,"kein Entry gefunden");
1371 String aName
= aCurName
.GetText();
1372 aTree
.SetEntryText(pEntry
,aName
);
1373 SectReprPtr pRepr
= (SectReprPtr
) pEntry
->GetUserData();
1374 pRepr
->GetSection().SetName(aName
);
1376 aOK
.Enable(aName
.Len() != 0);
1380 /*---------------------------------------------------------------------
1382 ---------------------------------------------------------------------*/
1384 IMPL_LINK( SwEditRegionDlg
, ConditionEditHdl
, Edit
*, pEdit
)
1386 Selection aSelect
= pEdit
->GetSelection();
1389 pEdit
->SetSelection(aSelect
);
1390 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
1391 DBG_ASSERT(pEntry
,"kein Entry gefunden");
1394 SectReprPtr pRepr
= (SectReprPtr
)pEntry
->GetUserData();
1395 pRepr
->SetCondition (pEdit
->GetText());
1396 pEntry
= aTree
.NextSelected(pEntry
);
1401 IMPL_LINK( SwEditRegionDlg
, DlgClosedHdl
, sfx2::FileDialogHelper
*, _pFileDlg
)
1403 String sFileName
, sFilterName
, sPassword
;
1404 if ( _pFileDlg
->GetError() == ERRCODE_NONE
)
1406 SfxMedium
* pMedium
= m_pDocInserter
->CreateMedium();
1409 sFileName
= pMedium
->GetURLObject().GetMainURL( INetURLObject::NO_DECODE
);
1410 sFilterName
= pMedium
->GetFilter()->GetFilterName();
1411 const SfxPoolItem
* pItem
;
1412 if ( SFX_ITEM_SET
== pMedium
->GetItemSet()->GetItemState( SID_PASSWORD
, FALSE
, &pItem
) )
1413 sPassword
= ( (SfxStringItem
*)pItem
)->GetValue();
1414 ::lcl_ReadSections( *pMedium
, aSubRegionED
);
1419 SvLBoxEntry
* pEntry
= aTree
.FirstSelected();
1420 DBG_ASSERT( pEntry
, "no entry found" );
1423 SectReprPtr pSectRepr
= (SectRepr
*)pEntry
->GetUserData();
1424 pSectRepr
->SetFile( sFileName
);
1425 pSectRepr
->SetFilter( sFilterName
);
1426 pSectRepr
->SetFilePasswd( sPassword
);
1427 aFileNameED
.SetText( pSectRepr
->GetFile() );
1430 Application::SetDefDialogParent( m_pOldDefDlgParent
);
1433 /*-- 03.09.2009 16:24:18---------------------------------------------------
1435 -----------------------------------------------------------------------*/
1436 IMPL_LINK( SwEditRegionDlg
, SubRegionEventHdl
, VclWindowEvent
*, pEvent
)
1438 if( !bSubRegionsFilled
&& pEvent
&& pEvent
->GetId() == VCLEVENT_DROPDOWN_PRE_OPEN
)
1440 //if necessary fill the names bookmarks/sections/tables now
1442 rtl::OUString sFileName
= aFileNameED
.GetText();
1443 if(sFileName
.getLength())
1445 SfxMedium
* pMedium
= rSh
.GetView().GetDocShell()->GetMedium();
1448 aAbs
= pMedium
->GetURLObject();
1449 sFileName
= URIHelper::SmartRel2Abs(
1450 aAbs
, sFileName
, URIHelper::GetMaybeFileHdl() );
1452 //load file and set the shell
1453 SfxMedium
aMedium( sFileName
, STREAM_STD_READ
);
1454 sFileName
= aMedium
.GetURLObject().GetMainURL( INetURLObject::NO_DECODE
);
1455 ::lcl_ReadSections( aMedium
, aSubRegionED
);
1458 lcl_FillSubRegionList( rSh
, aSubRegionED
, 0 );
1459 bSubRegionsFilled
= true;
1464 /* -----------------------------08.05.2002 15:00------------------------------
1466 ---------------------------------------------------------------------------*/
1467 Image
SwEditRegionDlg::BuildBitmap(BOOL bProtect
,BOOL bHidden
, BOOL bHighContrast
)
1469 ImageList
& rImgLst
= bHighContrast
? aImageILH
: aImageIL
;
1470 return rImgLst
.GetImage((!bHidden
+(bProtect
<<1)) + 1);
1473 /*--------------------------------------------------------------------
1474 Beschreibung: Hilfsfunktion - Bereichsnamen aus dem Medium lesen
1475 --------------------------------------------------------------------*/
1477 static void lcl_ReadSections( SfxMedium
& rMedium
, ComboBox
& rBox
)
1480 uno::Reference
< embed::XStorage
> xStg
;
1481 if( rMedium
.IsStorage() && (xStg
= rMedium
.GetStorage()).is() )
1483 SvStringsDtor
aArr( 10, 10 );
1484 sal_uInt32 nFormat
= SotStorage::GetFormatID( xStg
);
1485 if ( nFormat
== SOT_FORMATSTR_ID_STARWRITER_60
|| nFormat
== SOT_FORMATSTR_ID_STARWRITERGLOB_60
||
1486 nFormat
== SOT_FORMATSTR_ID_STARWRITER_8
|| nFormat
== SOT_FORMATSTR_ID_STARWRITERGLOB_8
)
1487 SwGetReaderXML()->GetSectionList( rMedium
, (SvStrings
&) aArr
);
1489 for( USHORT n
= 0; n
< aArr
.Count(); ++n
)
1490 rBox
.InsertEntry( *aArr
[ n
] );
1493 /* -----------------21.05.99 10:16-------------------
1495 * --------------------------------------------------*/
1496 SwInsertSectionTabDialog::SwInsertSectionTabDialog(
1497 Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
) :
1498 SfxTabDialog( pParent
, SW_RES(DLG_INSERT_SECTION
), &rSet
),
1502 String
sInsert(SW_RES(ST_INSERT
));
1503 GetOKButton().SetText(sInsert
);
1505 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
1506 DBG_ASSERT(pFact
, "Dialogdiet fail!");
1507 AddTabPage(TP_INSERT_SECTION
, SwInsertSectionTabPage::Create
, 0);
1508 AddTabPage(TP_COLUMN
, SwColumnPage::Create
, 0);
1509 AddTabPage(TP_BACKGROUND
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), 0);
1510 AddTabPage(TP_SECTION_FTNENDNOTES
, SwSectionFtnEndTabPage::Create
, 0);
1511 AddTabPage(TP_SECTION_INDENTS
, SwSectionIndentTabPage::Create
, 0);
1513 SvxHtmlOptions
* pHtmlOpt
= SvxHtmlOptions::Get();
1514 long nHtmlMode
= pHtmlOpt
->GetExportMode();
1516 BOOL bWeb
= 0 != PTR_CAST( SwWebDocShell
, rSh
.GetView().GetDocShell() );
1519 RemoveTabPage(TP_SECTION_FTNENDNOTES
);
1520 RemoveTabPage(TP_SECTION_INDENTS
);
1521 if( HTML_CFG_NS40
!= nHtmlMode
&& HTML_CFG_WRITER
!= nHtmlMode
)
1522 RemoveTabPage(TP_COLUMN
);
1524 SetCurPageId(TP_INSERT_SECTION
);
1526 /* -----------------21.05.99 10:17-------------------
1528 * --------------------------------------------------*/
1529 SwInsertSectionTabDialog::~SwInsertSectionTabDialog()
1531 delete pToInsertSection
;
1533 /* -----------------21.05.99 10:23-------------------
1535 * --------------------------------------------------*/
1536 void SwInsertSectionTabDialog::PageCreated( USHORT nId
, SfxTabPage
&rPage
)
1538 if(TP_INSERT_SECTION
== nId
)
1539 ((SwInsertSectionTabPage
&)rPage
).SetWrtShell(rWrtSh
);
1540 else if( TP_BACKGROUND
== nId
)
1542 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
1543 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
, SVX_SHOW_SELECTOR
));
1544 rPage
.PageCreated(aSet
);
1546 else if( TP_COLUMN
== nId
)
1548 const SwFmtFrmSize
& rSize
= (const SwFmtFrmSize
&)GetInputSetImpl()->Get(RES_FRM_SIZE
);
1549 ((SwColumnPage
&)rPage
).SetPageWidth(rSize
.GetWidth());
1550 ((SwColumnPage
&)rPage
).ShowBalance(TRUE
);
1551 ((SwColumnPage
&)rPage
).SetInSection(TRUE
);
1553 else if(TP_SECTION_INDENTS
== nId
)
1554 ((SwSectionIndentTabPage
&)rPage
).SetWrtShell(rWrtSh
);
1556 /* -----------------21.05.99 13:08-------------------
1558 * --------------------------------------------------*/
1560 void SwInsertSectionTabDialog::SetSection(const SwSection
& rSect
)
1562 pToInsertSection
= new SwSection(CONTENT_SECTION
, aEmptyStr
);
1563 *pToInsertSection
= rSect
;
1565 /* -----------------21.05.99 13:10-------------------
1567 * --------------------------------------------------*/
1568 short SwInsertSectionTabDialog::Ok()
1570 short nRet
= SfxTabDialog::Ok();
1571 DBG_ASSERT(pToInsertSection
, "keiner Section?");
1572 const SfxItemSet
* pOutputItemSet
= GetOutputItemSet();
1573 rWrtSh
.InsertSection(*pToInsertSection
, pOutputItemSet
);
1574 SfxViewFrame
* pViewFrm
= rWrtSh
.GetView().GetViewFrame();
1575 uno::Reference
< frame::XDispatchRecorder
> xRecorder
=
1576 pViewFrm
->GetBindings().GetRecorder();
1577 if ( xRecorder
.is() )
1579 SfxRequest
aRequest( pViewFrm
, FN_INSERT_REGION
);
1580 const SfxPoolItem
* pCol
;
1581 if(SFX_ITEM_SET
== pOutputItemSet
->GetItemState(RES_COL
, FALSE
, &pCol
))
1583 aRequest
.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS
,
1584 ((const SwFmtCol
*)pCol
)->GetColumns().Count()));
1586 aRequest
.AppendItem(SfxStringItem( FN_PARAM_REGION_NAME
, pToInsertSection
->GetName()));
1587 aRequest
.AppendItem(SfxStringItem( FN_PARAM_REGION_CONDITION
, pToInsertSection
->GetCondition()));
1588 aRequest
.AppendItem(SfxBoolItem( FN_PARAM_REGION_HIDDEN
, pToInsertSection
->IsHidden()));
1589 aRequest
.AppendItem(SfxBoolItem(FN_PARAM_REGION_PROTECT
, pToInsertSection
->IsProtect()));
1590 // --> FME 2004-06-22 #114856# edit in readonly sections
1591 aRequest
.AppendItem(SfxBoolItem(FN_PARAM_REGION_EDIT_IN_READONLY
, pToInsertSection
->IsEditInReadonly()));
1594 String
sLinkFileName( pToInsertSection
->GetLinkFileName() );
1595 aRequest
.AppendItem(SfxStringItem( FN_PARAM_1
, sLinkFileName
.GetToken( 0, sfx2::cTokenSeperator
)));
1596 aRequest
.AppendItem(SfxStringItem( FN_PARAM_2
, sLinkFileName
.GetToken( 1, sfx2::cTokenSeperator
)));
1597 aRequest
.AppendItem(SfxStringItem( FN_PARAM_3
, sLinkFileName
.GetToken( 2, sfx2::cTokenSeperator
)));
1603 /* -----------------21.05.99 10:31-------------------
1605 * --------------------------------------------------*/
1606 SwInsertSectionTabPage::SwInsertSectionTabPage(
1607 Window
*pParent
, const SfxItemSet
&rAttrSet
) :
1608 SfxTabPage( pParent
, SW_RES(TP_INSERT_SECTION
), rAttrSet
),
1609 aNameFL ( this, SW_RES( FL_NAME
) ),
1610 aCurName ( this, SW_RES( ED_RNAME
) ),
1611 aLinkFL ( this, SW_RES( FL_LINK
) ),
1612 aFileCB ( this, SW_RES( CB_FILE
) ),
1613 aDDECB ( this, SW_RES( CB_DDE
) ) ,
1614 aDDECommandFT ( this, SW_RES( FT_DDE
) ) ,
1615 aFileNameFT ( this, SW_RES( FT_FILE
) ) ,
1616 aFileNameED ( this, SW_RES( ED_FILE
) ),
1617 aFilePB ( this, SW_RES( PB_FILE
) ),
1618 aSubRegionFT ( this, SW_RES( FT_SUBREG
) ) ,
1619 aSubRegionED ( this, SW_RES( LB_SUBREG
) ) ,
1621 aProtectFL ( this, SW_RES( FL_PROTECT
) ),
1622 aProtectCB ( this, SW_RES( CB_PROTECT
) ),
1623 aPasswdCB ( this, SW_RES( CB_PASSWD
) ),
1624 aPasswdPB ( this, SW_RES( PB_PASSWD
) ),
1626 aHideFL ( this, SW_RES( FL_HIDE
) ),
1627 aHideCB ( this, SW_RES( CB_HIDE
) ),
1628 aConditionFT ( this, SW_RES( FT_CONDITION
) ),
1629 aConditionED ( this, SW_RES( ED_CONDITION
) ),
1630 // --> FME 2004-06-22 #114856# edit in readonly sections
1631 aPropertiesFL ( this, SW_RES( FL_PROPERTIES
) ),
1632 aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY
) ),
1636 m_pDocInserter(NULL
),
1637 m_pOldDefDlgParent(NULL
)
1641 aProtectCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangeProtectHdl
));
1642 aPasswdCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangePasswdHdl
));
1643 aPasswdPB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangePasswdHdl
));
1644 aHideCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangeHideHdl
));
1645 // --> FME 2004-06-22 #114856# edit in readonly sections
1646 aEditInReadonlyCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, ChangeEditInReadonlyHdl
));
1648 aFileCB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, UseFileHdl
));
1649 aFilePB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, FileSearchHdl
));
1650 aCurName
.SetModifyHdl ( LINK( this, SwInsertSectionTabPage
, NameEditHdl
));
1651 aDDECB
.SetClickHdl ( LINK( this, SwInsertSectionTabPage
, DDEHdl
));
1652 ChangeProtectHdl(&aProtectCB
);
1653 aSubRegionED
.EnableAutocomplete( sal_True
, sal_True
);
1655 /* -----------------21.05.99 10:31-------------------
1657 * --------------------------------------------------*/
1658 SwInsertSectionTabPage::~SwInsertSectionTabPage()
1660 delete m_pDocInserter
;
1663 void SwInsertSectionTabPage::SetWrtShell(SwWrtShell
& rSh
)
1667 BOOL bWeb
= 0 != PTR_CAST(SwWebDocShell
, m_pWrtSh
->GetView().GetDocShell());
1671 aConditionED
.Hide();
1672 aConditionFT
.Hide();
1674 aDDECommandFT
.Hide();
1677 lcl_FillSubRegionList( *m_pWrtSh
, aSubRegionED
, &aCurName
);
1679 SwSection
* pSect
= ((SwInsertSectionTabDialog
*)GetTabDialog())->GetSection();
1680 if( pSect
) // etwas vorgegeben ?
1682 aCurName
.SetText( rSh
.GetUniqueSectionName( &pSect
->GetName() ));
1683 aProtectCB
.Check( 0 != pSect
->IsProtect() );
1684 m_sFileName
= pSect
->GetLinkFileName();
1685 m_sFilePasswd
= pSect
->GetLinkFilePassWd();
1686 aFileCB
.Check( 0 != m_sFileName
.Len() );
1687 aFileNameED
.SetText( m_sFileName
);
1688 UseFileHdl( &aFileCB
);
1692 aCurName
.SetText( rSh
.GetUniqueSectionName() );
1695 /* -----------------21.05.99 10:32-------------------
1697 * --------------------------------------------------*/
1698 BOOL
SwInsertSectionTabPage::FillItemSet( SfxItemSet
& )
1700 SwSection
aSection(CONTENT_SECTION
, aCurName
.GetText());
1701 aSection
.SetCondition(aConditionED
.GetText());
1702 BOOL bProtected
= aProtectCB
.IsChecked();
1703 aSection
.SetProtect(bProtected
);
1704 aSection
.SetHidden(aHideCB
.IsChecked());
1705 // --> FME 2004-06-22 #114856# edit in readonly sections
1706 aSection
.SetEditInReadonly(aEditInReadonlyCB
.IsChecked());
1709 aSection
.SetPasswd(m_aNewPasswd
);
1710 String sFileName
= aFileNameED
.GetText();
1711 String sSubRegion
= aSubRegionED
.GetText();
1712 BOOL bDDe
= aDDECB
.IsChecked();
1713 if(aFileCB
.IsChecked() && (sFileName
.Len() || sSubRegion
.Len() || bDDe
))
1718 aLinkFile
= sFileName
;
1721 while( STRING_NOTFOUND
!= (nPos
= aLinkFile
.SearchAscii( " ", nPos
)) )
1722 aLinkFile
.Erase( nPos
--, 1 );
1724 nPos
= aLinkFile
.SearchAndReplace( ' ', sfx2::cTokenSeperator
);
1725 aLinkFile
.SearchAndReplace( ' ', sfx2::cTokenSeperator
, nPos
);
1731 SfxMedium
* pMedium
= m_pWrtSh
->GetView().GetDocShell()->GetMedium();
1734 aAbs
= pMedium
->GetURLObject();
1735 aLinkFile
= URIHelper::SmartRel2Abs(
1736 aAbs
, sFileName
, URIHelper::GetMaybeFileHdl() );
1737 aSection
.SetLinkFilePassWd( m_sFilePasswd
);
1740 aLinkFile
+= sfx2::cTokenSeperator
;
1741 aLinkFile
+= m_sFilterName
;
1742 aLinkFile
+= sfx2::cTokenSeperator
;
1743 aLinkFile
+= sSubRegion
;
1746 aSection
.SetLinkFileName(aLinkFile
);
1749 aSection
.SetType( aDDECB
.IsChecked() ?
1754 ((SwInsertSectionTabDialog
*)GetTabDialog())->SetSection(aSection
);
1757 /* -----------------21.05.99 10:32-------------------
1759 * --------------------------------------------------*/
1760 void SwInsertSectionTabPage::Reset( const SfxItemSet
& )
1763 /* -----------------21.05.99 11:22-------------------
1765 * --------------------------------------------------*/
1766 SfxTabPage
* SwInsertSectionTabPage::Create( Window
* pParent
,
1767 const SfxItemSet
& rAttrSet
)
1769 return new SwInsertSectionTabPage(pParent
, rAttrSet
);
1771 /*---------------------------------------------------------------------
1773 ---------------------------------------------------------------------*/
1775 IMPL_LINK( SwInsertSectionTabPage
, ChangeHideHdl
, CheckBox
*, pBox
)
1777 BOOL bHide
= pBox
->IsChecked();
1778 aConditionED
.Enable(bHide
);
1779 aConditionFT
.Enable(bHide
);
1782 /*---------------------------------------------------------------------
1784 ---------------------------------------------------------------------*/
1786 IMPL_LINK( SwInsertSectionTabPage
, ChangeEditInReadonlyHdl
, CheckBox
*, EMPTYARG
)
1790 /*---------------------------------------------------------------------
1792 ---------------------------------------------------------------------*/
1794 IMPL_LINK( SwInsertSectionTabPage
, ChangeProtectHdl
, CheckBox
*, pBox
)
1796 sal_Bool bCheck
= pBox
->IsChecked();
1797 aPasswdCB
.Enable(bCheck
);
1798 aPasswdPB
.Enable(bCheck
);
1801 /* -----------------------------26.04.01 14:50--------------------------------
1803 ---------------------------------------------------------------------------*/
1804 IMPL_LINK( SwInsertSectionTabPage
, ChangePasswdHdl
, Button
*, pButton
)
1806 sal_Bool bChange
= pButton
== &aPasswdPB
;
1807 sal_Bool bSet
= bChange
? bChange
: aPasswdCB
.IsChecked();
1810 if(!m_aNewPasswd
.getLength() || bChange
)
1812 SwTestPasswdDlg
aPasswdDlg(this);
1813 aPasswdDlg
.ShowExtras(SHOWEXTRAS_CONFIRM
);
1814 if(RET_OK
== aPasswdDlg
.Execute())
1816 String
sNewPasswd( aPasswdDlg
.GetPassword() );
1817 if( aPasswdDlg
.GetConfirm() == sNewPasswd
)
1819 SvPasswordHelper::GetHashPassword( m_aNewPasswd
, sNewPasswd
);
1823 InfoBox(pButton
, SW_RES(REG_WRONG_PASSWD_REPEAT
)).Execute();
1827 aPasswdCB
.Check(FALSE
);
1831 m_aNewPasswd
.realloc(0);
1834 /*---------------------------------------------------------------------
1836 ---------------------------------------------------------------------*/
1838 IMPL_LINK_INLINE_START( SwInsertSectionTabPage
, NameEditHdl
, Edit
*, EMPTYARG
)
1840 String aName
=aCurName
.GetText();
1841 GetTabDialog()->GetOKButton().Enable(aName
.Len() && aCurName
.GetEntryPos( aName
) == USHRT_MAX
);
1844 IMPL_LINK_INLINE_END( SwInsertSectionTabPage
, NameEditHdl
, Edit
*, EMPTYARG
)
1846 /*---------------------------------------------------------------------
1848 ---------------------------------------------------------------------*/
1850 IMPL_LINK( SwInsertSectionTabPage
, UseFileHdl
, CheckBox
*, pBox
)
1852 if( pBox
->IsChecked() )
1854 if( m_pWrtSh
->HasSelection() &&
1855 RET_NO
== QueryBox( this, SW_RES(QB_CONNECT
) ).Execute() )
1856 pBox
->Check( FALSE
);
1859 BOOL bFile
= pBox
->IsChecked();
1860 aFileNameFT
.Enable(bFile
);
1861 aFileNameED
.Enable(bFile
);
1862 aFilePB
.Enable(bFile
);
1863 aSubRegionFT
.Enable(bFile
);
1864 aSubRegionED
.Enable(bFile
);
1865 aDDECommandFT
.Enable(bFile
);
1866 aDDECB
.Enable(bFile
);
1869 // aFileNameED.SetText( aFileName );
1870 aFileNameED
.GrabFocus();
1871 aProtectCB
.Check( TRUE
);
1875 aDDECB
.Check(FALSE
);
1877 // aFileNameED.SetText(aEmptyStr);
1882 /*---------------------------------------------------------------------
1884 ---------------------------------------------------------------------*/
1886 IMPL_LINK( SwInsertSectionTabPage
, FileSearchHdl
, PushButton
*, EMPTYARG
)
1888 m_pOldDefDlgParent
= Application::GetDefDialogParent();
1889 Application::SetDefDialogParent( this );
1890 if ( m_pDocInserter
)
1891 delete m_pDocInserter
;
1892 m_pDocInserter
= new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") );
1893 m_pDocInserter
->StartExecuteModal( LINK( this, SwInsertSectionTabPage
, DlgClosedHdl
) );
1897 /*---------------------------------------------------------------------
1899 ---------------------------------------------------------------------*/
1901 IMPL_LINK( SwInsertSectionTabPage
, DDEHdl
, CheckBox
*, pBox
)
1903 BOOL bDDE
= pBox
->IsChecked();
1904 BOOL bFile
= aFileCB
.IsChecked();
1905 aFilePB
.Enable(!bDDE
&& bFile
);
1909 aDDECommandFT
.Enable(bDDE
);
1910 aDDECommandFT
.Show();
1911 aSubRegionFT
.Hide();
1912 aSubRegionED
.Hide();
1916 aDDECommandFT
.Hide();
1917 aFileNameFT
.Enable(bFile
);
1919 aSubRegionFT
.Show();
1920 aSubRegionED
.Show();
1921 aSubRegionED
.Enable(bFile
);
1926 IMPL_LINK( SwInsertSectionTabPage
, DlgClosedHdl
, sfx2::FileDialogHelper
*, _pFileDlg
)
1928 if ( _pFileDlg
->GetError() == ERRCODE_NONE
)
1930 SfxMedium
* pMedium
= m_pDocInserter
->CreateMedium();
1933 m_sFileName
= pMedium
->GetURLObject().GetMainURL( INetURLObject::NO_DECODE
);
1934 m_sFilterName
= pMedium
->GetFilter()->GetFilterName();
1935 const SfxPoolItem
* pItem
;
1936 if ( SFX_ITEM_SET
== pMedium
->GetItemSet()->GetItemState( SID_PASSWORD
, FALSE
, &pItem
) )
1937 m_sFilePasswd
= ( (SfxStringItem
*)pItem
)->GetValue();
1938 aFileNameED
.SetText( INetURLObject::decode(
1939 m_sFileName
, INET_HEX_ESCAPE
, INetURLObject::DECODE_UNAMBIGUOUS
, RTL_TEXTENCODING_UTF8
) );
1940 ::lcl_ReadSections( *pMedium
, aSubRegionED
);
1945 m_sFilterName
= m_sFilePasswd
= aEmptyStr
;
1947 Application::SetDefDialogParent( m_pOldDefDlgParent
);
1951 // --------------------------------------------------------------
1953 // Numerierungsformat Umsetzung:
1954 // ListBox - Format - Enum-Wert
1955 // 0 - A, B, C, ... - 0
1956 // 1 - a, b, c, ... - 1
1957 // 2 - I, II, III, ... - 2
1958 // 3 - i, ii, iii, ... - 3
1959 // 4 - 1, 2, 3, ... - 4
1960 // 5 - A, .., AA, .., - 9
1961 // 6 - a, .., aa, .., - 10
1963 inline USHORT
GetNumPos( USHORT n
)
1965 return SVX_NUM_ARABIC
< n
? n
- 4 : n
;
1968 inline SvxExtNumType
GetNumType( USHORT n
)
1970 return (SvxExtNumType
)(4 < n
? n
+ 4 : n
);
1973 SwSectionFtnEndTabPage::SwSectionFtnEndTabPage( Window
*pParent
,
1974 const SfxItemSet
&rAttrSet
)
1975 : SfxTabPage( pParent
, SW_RES( TP_SECTION_FTNENDNOTES
), rAttrSet
),
1976 aFtnFL ( this, SW_RES( FL_FTN
) ),
1977 aFtnNtAtTextEndCB ( this, SW_RES( CB_FTN_AT_TXTEND
) ),
1979 aFtnNtNumCB ( this, SW_RES( CB_FTN_NUM
) ),
1980 aFtnOffsetLbl ( this, SW_RES( FT_FTN_OFFSET
)),
1981 aFtnOffsetFld ( this, SW_RES( FLD_FTN_OFFSET
)),
1983 aFtnNtNumFmtCB ( this, SW_RES( CB_FTN_NUM_FMT
) ),
1984 aFtnPrefixFT ( this, SW_RES( FT_FTN_PREFIX
)),
1985 aFtnPrefixED ( this, SW_RES( ED_FTN_PREFIX
)),
1986 aFtnNumViewBox ( this, SW_RES( LB_FTN_NUMVIEW
), INSERT_NUM_EXTENDED_TYPES
),
1987 aFtnSuffixFT ( this, SW_RES( FT_FTN_SUFFIX
)),
1988 aFtnSuffixED ( this, SW_RES( ED_FTN_SUFFIX
)),
1990 aEndFL ( this, SW_RES( FL_END
) ),
1991 aEndNtAtTextEndCB ( this, SW_RES( CB_END_AT_TXTEND
)),
1993 aEndNtNumCB ( this, SW_RES( CB_END_NUM
)),
1994 aEndOffsetLbl ( this, SW_RES( FT_END_OFFSET
)),
1995 aEndOffsetFld ( this, SW_RES( FLD_END_OFFSET
)),
1997 aEndNtNumFmtCB ( this, SW_RES( CB_END_NUM_FMT
) ),
1998 aEndPrefixFT ( this, SW_RES( FT_END_PREFIX
)),
1999 aEndPrefixED ( this, SW_RES( ED_END_PREFIX
)),
2000 aEndNumViewBox ( this, SW_RES( LB_END_NUMVIEW
), INSERT_NUM_EXTENDED_TYPES
),
2001 aEndSuffixFT ( this, SW_RES( FT_END_SUFFIX
)),
2002 aEndSuffixED ( this, SW_RES( ED_END_SUFFIX
))
2006 Link
aLk( LINK( this, SwSectionFtnEndTabPage
, FootEndHdl
));
2007 aFtnNtAtTextEndCB
.SetClickHdl( aLk
);
2008 aFtnNtNumCB
.SetClickHdl( aLk
);
2009 aEndNtAtTextEndCB
.SetClickHdl( aLk
);
2010 aEndNtNumCB
.SetClickHdl( aLk
);
2011 aFtnNtNumFmtCB
.SetClickHdl( aLk
);
2012 aEndNtNumFmtCB
.SetClickHdl( aLk
);
2015 SwSectionFtnEndTabPage::~SwSectionFtnEndTabPage()
2019 BOOL
SwSectionFtnEndTabPage::FillItemSet( SfxItemSet
& rSet
)
2021 SwFmtFtnAtTxtEnd
aFtn( aFtnNtAtTextEndCB
.IsChecked()
2022 ? ( aFtnNtNumCB
.IsChecked()
2023 ? ( aFtnNtNumFmtCB
.IsChecked()
2024 ? FTNEND_ATTXTEND_OWNNUMANDFMT
2025 : FTNEND_ATTXTEND_OWNNUMSEQ
)
2027 : FTNEND_ATPGORDOCEND
);
2029 switch( aFtn
.GetValue() )
2031 case FTNEND_ATTXTEND_OWNNUMANDFMT
:
2032 aFtn
.SetNumType( aFtnNumViewBox
.GetSelectedNumberingType() );
2033 aFtn
.SetPrefix( aFtnPrefixED
.GetText() );
2034 aFtn
.SetSuffix( aFtnSuffixED
.GetText() );
2037 case FTNEND_ATTXTEND_OWNNUMSEQ
:
2038 aFtn
.SetOffset( static_cast< USHORT
>( aFtnOffsetFld
.GetValue()-1 ) );
2042 SwFmtEndAtTxtEnd
aEnd( aEndNtAtTextEndCB
.IsChecked()
2043 ? ( aEndNtNumCB
.IsChecked()
2044 ? ( aEndNtNumFmtCB
.IsChecked()
2045 ? FTNEND_ATTXTEND_OWNNUMANDFMT
2046 : FTNEND_ATTXTEND_OWNNUMSEQ
)
2048 : FTNEND_ATPGORDOCEND
);
2050 switch( aEnd
.GetValue() )
2052 case FTNEND_ATTXTEND_OWNNUMANDFMT
:
2053 aEnd
.SetNumType( aEndNumViewBox
.GetSelectedNumberingType() );
2054 aEnd
.SetPrefix( aEndPrefixED
.GetText() );
2055 aEnd
.SetSuffix( aEndSuffixED
.GetText() );
2058 case FTNEND_ATTXTEND_OWNNUMSEQ
:
2059 aEnd
.SetOffset( static_cast< USHORT
>( aEndOffsetFld
.GetValue()-1 ) );
2069 void SwSectionFtnEndTabPage::ResetState( BOOL bFtn
,
2070 const SwFmtFtnEndAtTxtEnd
& rAttr
)
2072 CheckBox
*pNtAtTextEndCB
, *pNtNumCB
, *pNtNumFmtCB
;
2073 FixedText
*pPrefixFT
, *pSuffixFT
;
2074 Edit
*pPrefixED
, *pSuffixED
;
2075 SwNumberingTypeListBox
*pNumViewBox
;
2076 FixedText
* pOffsetTxt
;
2077 NumericField
*pOffsetFld
;
2081 pNtAtTextEndCB
= &aFtnNtAtTextEndCB
;
2082 pNtNumCB
= &aFtnNtNumCB
;
2083 pNtNumFmtCB
= &aFtnNtNumFmtCB
;
2084 pPrefixFT
= &aFtnPrefixFT
;
2085 pPrefixED
= &aFtnPrefixED
;
2086 pSuffixFT
= &aFtnSuffixFT
;
2087 pSuffixED
= &aFtnSuffixED
;
2088 pNumViewBox
= &aFtnNumViewBox
;
2089 pOffsetTxt
= &aFtnOffsetLbl
;
2090 pOffsetFld
= &aFtnOffsetFld
;
2094 pNtAtTextEndCB
= &aEndNtAtTextEndCB
;
2095 pNtNumCB
= &aEndNtNumCB
;
2096 pNtNumFmtCB
= &aEndNtNumFmtCB
;
2097 pPrefixFT
= &aEndPrefixFT
;
2098 pPrefixED
= &aEndPrefixED
;
2099 pSuffixFT
= &aEndSuffixFT
;
2100 pSuffixED
= &aEndSuffixED
;
2101 pNumViewBox
= &aEndNumViewBox
;
2102 pOffsetTxt
= &aEndOffsetLbl
;
2103 pOffsetFld
= &aEndOffsetFld
;
2106 USHORT eState
= rAttr
.GetValue();
2109 // case FTNEND_ATPGORDOCEND:
2110 case FTNEND_ATTXTEND_OWNNUMANDFMT
:
2111 pNtNumFmtCB
->SetState( STATE_CHECK
);
2114 case FTNEND_ATTXTEND_OWNNUMSEQ
:
2115 pNtNumCB
->SetState( STATE_CHECK
);
2118 case FTNEND_ATTXTEND
:
2119 pNtAtTextEndCB
->SetState( STATE_CHECK
);
2123 pNumViewBox
->SelectNumberingType( rAttr
.GetNumType() );
2124 pOffsetFld
->SetValue( rAttr
.GetOffset() + 1 );
2125 pPrefixED
->SetText( rAttr
.GetPrefix() );
2126 pSuffixED
->SetText( rAttr
.GetSuffix() );
2130 case FTNEND_ATPGORDOCEND
:
2131 pNtNumCB
->Enable( FALSE
);
2134 case FTNEND_ATTXTEND
:
2135 pNtNumFmtCB
->Enable( FALSE
);
2136 pOffsetFld
->Enable( FALSE
);
2137 pOffsetTxt
->Enable( FALSE
);
2140 case FTNEND_ATTXTEND_OWNNUMSEQ
:
2141 pNumViewBox
->Enable( FALSE
);
2142 pPrefixFT
->Enable( FALSE
);
2143 pPrefixED
->Enable( FALSE
);
2144 pSuffixFT
->Enable( FALSE
);
2145 pSuffixED
->Enable( FALSE
);
2150 void SwSectionFtnEndTabPage::Reset( const SfxItemSet
& rSet
)
2152 ResetState( TRUE
, (const SwFmtFtnAtTxtEnd
&)rSet
.Get(
2153 RES_FTN_AT_TXTEND
, FALSE
));
2154 ResetState( FALSE
, (const SwFmtEndAtTxtEnd
&)rSet
.Get(
2155 RES_END_AT_TXTEND
, FALSE
));
2158 SfxTabPage
* SwSectionFtnEndTabPage::Create( Window
* pParent
,
2159 const SfxItemSet
& rAttrSet
)
2161 return new SwSectionFtnEndTabPage(pParent
, rAttrSet
);
2164 IMPL_LINK( SwSectionFtnEndTabPage
, FootEndHdl
, CheckBox
*, pBox
)
2166 // pBox->EnableTriState( FALSE );
2167 BOOL bFoot
= &aFtnNtAtTextEndCB
== pBox
|| &aFtnNtNumCB
== pBox
||
2168 &aFtnNtNumFmtCB
== pBox
;
2170 CheckBox
*pNumBox
, *pNumFmtBox
, *pEndBox
;
2171 SwNumberingTypeListBox
* pNumViewBox
;
2172 FixedText
* pOffsetTxt
;
2173 NumericField
*pOffsetFld
;
2174 FixedText
*pPrefixFT
, *pSuffixFT
;
2175 Edit
*pPrefixED
, *pSuffixED
;
2179 pEndBox
= &aFtnNtAtTextEndCB
;
2180 pNumBox
= &aFtnNtNumCB
;
2181 pNumFmtBox
= &aFtnNtNumFmtCB
;
2182 pNumViewBox
= &aFtnNumViewBox
;
2183 pOffsetTxt
= &aFtnOffsetLbl
;
2184 pOffsetFld
= &aFtnOffsetFld
;
2185 pPrefixFT
= &aFtnPrefixFT
;
2186 pSuffixFT
= &aFtnSuffixFT
;
2187 pPrefixED
= &aFtnPrefixED
;
2188 pSuffixED
= &aFtnSuffixED
;
2192 pEndBox
= &aEndNtAtTextEndCB
;
2193 pNumBox
= &aEndNtNumCB
;
2194 pNumFmtBox
= &aEndNtNumFmtCB
;
2195 pNumViewBox
= &aEndNumViewBox
;
2196 pOffsetTxt
= &aEndOffsetLbl
;
2197 pOffsetFld
= &aEndOffsetFld
;
2198 pPrefixFT
= &aEndPrefixFT
;
2199 pSuffixFT
= &aEndSuffixFT
;
2200 pPrefixED
= &aEndPrefixED
;
2201 pSuffixED
= &aEndSuffixED
;
2204 BOOL bEnableAtEnd
= STATE_CHECK
== pEndBox
->GetState();
2205 BOOL bEnableNum
= bEnableAtEnd
&& STATE_CHECK
== pNumBox
->GetState();
2206 BOOL bEnableNumFmt
= bEnableNum
&& STATE_CHECK
== pNumFmtBox
->GetState();
2208 pNumBox
->Enable( bEnableAtEnd
);
2209 pOffsetTxt
->Enable( bEnableNum
);
2210 pOffsetFld
->Enable( bEnableNum
);
2211 pNumFmtBox
->Enable( bEnableNum
);
2212 pNumViewBox
->Enable( bEnableNumFmt
);
2213 pPrefixED
->Enable( bEnableNumFmt
);
2214 pSuffixED
->Enable( bEnableNumFmt
);
2215 pPrefixFT
->Enable( bEnableNumFmt
);
2216 pSuffixFT
->Enable( bEnableNumFmt
);
2221 /* -----------------21.05.99 13:59-------------------
2223 * --------------------------------------------------*/
2224 SwSectionPropertyTabDialog::SwSectionPropertyTabDialog(
2225 Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
) :
2226 SfxTabDialog(pParent
, SW_RES(DLG_SECTION_PROPERTIES
), &rSet
),
2230 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
2231 DBG_ASSERT(pFact
, "Dialogdiet fail!");
2232 AddTabPage(TP_COLUMN
, SwColumnPage::Create
, 0);
2233 AddTabPage(TP_BACKGROUND
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), 0 );
2234 AddTabPage(TP_SECTION_FTNENDNOTES
, SwSectionFtnEndTabPage::Create
, 0);
2235 AddTabPage(TP_SECTION_INDENTS
, SwSectionIndentTabPage::Create
, 0);
2237 SvxHtmlOptions
* pHtmlOpt
= SvxHtmlOptions::Get();
2238 long nHtmlMode
= pHtmlOpt
->GetExportMode();
2239 BOOL bWeb
= 0 != PTR_CAST( SwWebDocShell
, rSh
.GetView().GetDocShell() );
2242 RemoveTabPage(TP_SECTION_FTNENDNOTES
);
2243 RemoveTabPage(TP_SECTION_INDENTS
);
2244 if( HTML_CFG_NS40
!= nHtmlMode
&& HTML_CFG_WRITER
!= nHtmlMode
)
2245 RemoveTabPage(TP_COLUMN
);
2248 /* -----------------21.05.99 13:59-------------------
2250 * --------------------------------------------------*/
2251 SwSectionPropertyTabDialog::~SwSectionPropertyTabDialog()
2254 /* -----------------21.05.99 13:59-------------------
2256 * --------------------------------------------------*/
2257 void SwSectionPropertyTabDialog::PageCreated( USHORT nId
, SfxTabPage
&rPage
)
2259 if( TP_BACKGROUND
== nId
)
2261 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
2262 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
, SVX_SHOW_SELECTOR
));
2263 rPage
.PageCreated(aSet
);
2265 else if( TP_COLUMN
== nId
)
2267 ((SwColumnPage
&)rPage
).ShowBalance(TRUE
);
2268 ((SwColumnPage
&)rPage
).SetInSection(TRUE
);
2270 else if(TP_SECTION_INDENTS
== nId
)
2271 ((SwSectionIndentTabPage
&)rPage
).SetWrtShell(rWrtSh
);
2273 /*-- 13.06.2003 09:59:08---------------------------------------------------
2275 -----------------------------------------------------------------------*/
2276 SwSectionIndentTabPage::SwSectionIndentTabPage( Window
*pParent
, const SfxItemSet
&rAttrSet
) :
2277 SfxTabPage(pParent
, SW_RES(TP_SECTION_INDENTS
), rAttrSet
),
2278 aIndentFL(this, SW_RES(FL_INDENT
)),
2279 aBeforeFT(this, SW_RES(FT_BEFORE
)),
2280 aBeforeMF(this, SW_RES(MF_BEFORE
)),
2281 aAfterFT(this, SW_RES(FT_AFTER
)),
2282 aAfterMF(this, SW_RES(MF_AFTER
)),
2283 aPreviewWin(this, SW_RES(WIN_PREVIEW
))
2286 Link aLk
= LINK(this, SwSectionIndentTabPage
, IndentModifyHdl
);
2287 aBeforeMF
.SetModifyHdl(aLk
);
2288 aAfterMF
.SetModifyHdl(aLk
);
2290 /*-- 13.06.2003 09:59:23---------------------------------------------------
2292 -----------------------------------------------------------------------*/
2293 SwSectionIndentTabPage::~SwSectionIndentTabPage()
2296 /*-- 13.06.2003 09:59:23---------------------------------------------------
2298 -----------------------------------------------------------------------*/
2299 BOOL
SwSectionIndentTabPage::FillItemSet( SfxItemSet
& rSet
)
2301 if(aBeforeMF
.IsValueModified() ||
2302 aAfterMF
.IsValueModified())
2304 SvxLRSpaceItem
aLRSpace(
2305 static_cast< long >(aBeforeMF
.Denormalize(aBeforeMF
.GetValue(FUNIT_TWIP
))) ,
2306 static_cast< long >(aAfterMF
.Denormalize(aAfterMF
.GetValue(FUNIT_TWIP
))), 0, 0, RES_LR_SPACE
);
2311 /*-- 13.06.2003 09:59:24---------------------------------------------------
2313 -----------------------------------------------------------------------*/
2314 void SwSectionIndentTabPage::Reset( const SfxItemSet
& rSet
)
2316 //this page doesn't show up in HTML mode
2317 FieldUnit aMetric
= ::GetDfltMetric(FALSE
);
2318 SetMetric(aBeforeMF
, aMetric
);
2319 SetMetric(aAfterMF
, aMetric
);
2321 SfxItemState eItemState
= rSet
.GetItemState( RES_LR_SPACE
);
2322 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
2324 const SvxLRSpaceItem
& rSpace
=
2325 (const SvxLRSpaceItem
&)rSet
.Get( RES_LR_SPACE
);
2327 aBeforeMF
.SetValue( aBeforeMF
.Normalize(rSpace
.GetLeft()), FUNIT_TWIP
);
2328 aAfterMF
.SetValue( aAfterMF
.Normalize(rSpace
.GetRight()), FUNIT_TWIP
);
2332 aBeforeMF
.SetEmptyFieldValue();
2333 aAfterMF
.SetEmptyFieldValue();
2335 aBeforeMF
.SaveValue();
2336 aAfterMF
.SaveValue();
2339 /*-- 13.06.2003 09:59:24---------------------------------------------------
2341 -----------------------------------------------------------------------*/
2342 SfxTabPage
* SwSectionIndentTabPage::Create( Window
* pParent
, const SfxItemSet
& rAttrSet
)
2344 return new SwSectionIndentTabPage(pParent
, rAttrSet
);
2346 /* -----------------13.06.2003 13:57-----------------
2348 --------------------------------------------------*/
2349 void SwSectionIndentTabPage::SetWrtShell(SwWrtShell
& rSh
)
2351 //set sensible values at the preview
2352 aPreviewWin
.SetAdjust(SVX_ADJUST_BLOCK
);
2353 aPreviewWin
.SetLastLine(SVX_ADJUST_BLOCK
);
2354 const SwRect
& rPageRect
= rSh
.GetAnyCurRect( RECT_PAGE
, 0 );
2355 Size
aPageSize(rPageRect
.Width(), rPageRect
.Height());
2356 aPreviewWin
.SetSize(aPageSize
);
2358 /* -----------------13.06.2003 14:02-----------------
2360 --------------------------------------------------*/
2361 IMPL_LINK(SwSectionIndentTabPage
, IndentModifyHdl
, MetricField
*, EMPTYARG
)
2363 aPreviewWin
.SetLeftMargin( static_cast< long >(aBeforeMF
.Denormalize(aBeforeMF
.GetValue(FUNIT_TWIP
))) );
2364 aPreviewWin
.SetRightMargin( static_cast< long >(aAfterMF
.Denormalize(aAfterMF
.GetValue(FUNIT_TWIP
))) );
2365 aPreviewWin
.Draw(TRUE
);