1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION 31*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <hintids.hxx> 35*cdf0e10cSrcweir #include <regionsw.hxx> 36*cdf0e10cSrcweir #include <svl/urihelper.hxx> 37*cdf0e10cSrcweir #include <svl/PasswordHelper.hxx> 38*cdf0e10cSrcweir #include <vcl/svapp.hxx> 39*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 40*cdf0e10cSrcweir #include <svl/stritem.hxx> 41*cdf0e10cSrcweir #include <svl/eitem.hxx> 42*cdf0e10cSrcweir #include <sfx2/passwd.hxx> 43*cdf0e10cSrcweir #include <sfx2/docfilt.hxx> 44*cdf0e10cSrcweir #include <sfx2/request.hxx> 45*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 46*cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 47*cdf0e10cSrcweir #include <sfx2/docinsert.hxx> 48*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx> 49*cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 50*cdf0e10cSrcweir #include <svtools/htmlcfg.hxx> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #include <comphelper/storagehelper.hxx> 53*cdf0e10cSrcweir #include <uitool.hxx> 54*cdf0e10cSrcweir #include <IMark.hxx> 55*cdf0e10cSrcweir #include <section.hxx> 56*cdf0e10cSrcweir #include <docary.hxx> 57*cdf0e10cSrcweir #include <doc.hxx> // fuers SwSectionFmt-Array 58*cdf0e10cSrcweir #include <basesh.hxx> 59*cdf0e10cSrcweir #include <wdocsh.hxx> 60*cdf0e10cSrcweir #include <view.hxx> 61*cdf0e10cSrcweir #include <swmodule.hxx> 62*cdf0e10cSrcweir #include <wrtsh.hxx> 63*cdf0e10cSrcweir #include <swundo.hxx> // fuer Undo-Ids 64*cdf0e10cSrcweir #include <column.hxx> 65*cdf0e10cSrcweir #include <fmtfsize.hxx> 66*cdf0e10cSrcweir #include <swunodef.hxx> 67*cdf0e10cSrcweir #include <shellio.hxx> 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir #include <helpid.h> 70*cdf0e10cSrcweir #include <cmdid.h> 71*cdf0e10cSrcweir #include <regionsw.hrc> 72*cdf0e10cSrcweir #include <comcore.hrc> 73*cdf0e10cSrcweir #include <globals.hrc> 74*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 75*cdf0e10cSrcweir #include <svx/htmlmode.hxx> 76*cdf0e10cSrcweir #include <svx/dlgutil.hxx> 77*cdf0e10cSrcweir #include <svx/dialogs.hrc> 78*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 79*cdf0e10cSrcweir #include <svx/flagsdef.hxx> 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir using namespace ::com::sun::star; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir // sw/inc/docary.hxx 85*cdf0e10cSrcweir SV_IMPL_PTRARR( SwSectionFmts, SwSectionFmtPtr ) 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir #define FILE_NAME_LENGTH 17 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox ); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames, const SwSectionFmt* pNewFmt ) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir const SwSectionFmt* pFmt; 94*cdf0e10cSrcweir if( !pNewFmt ) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir sal_uInt16 nCount = rSh.GetSectionFmtCount(); 97*cdf0e10cSrcweir for(sal_uInt16 i=0;i<nCount;i++) 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir SectionType eTmpType; 100*cdf0e10cSrcweir if( !(pFmt = &rSh.GetSectionFmt(i))->GetParent() && 101*cdf0e10cSrcweir pFmt->IsInNodesArr() && 102*cdf0e10cSrcweir (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION 103*cdf0e10cSrcweir && TOX_HEADER_SECTION != eTmpType ) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir String* pString = 106*cdf0e10cSrcweir new String(pFmt->GetSection()->GetSectionName()); 107*cdf0e10cSrcweir if(pAvailNames) 108*cdf0e10cSrcweir pAvailNames->InsertEntry(*pString); 109*cdf0e10cSrcweir rSubRegions.InsertEntry(*pString); 110*cdf0e10cSrcweir lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt ); 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir else 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir SwSections aTmpArr; 117*cdf0e10cSrcweir sal_uInt16 nCnt = pNewFmt->GetChildSections(aTmpArr,SORTSECT_POS); 118*cdf0e10cSrcweir if( nCnt ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir SectionType eTmpType; 121*cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nCnt; ++n ) 122*cdf0e10cSrcweir if( (pFmt = aTmpArr[n]->GetFmt())->IsInNodesArr()&& 123*cdf0e10cSrcweir (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION 124*cdf0e10cSrcweir && TOX_HEADER_SECTION != eTmpType ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir String* pString = 127*cdf0e10cSrcweir new String(pFmt->GetSection()->GetSectionName()); 128*cdf0e10cSrcweir if(pAvailNames) 129*cdf0e10cSrcweir pAvailNames->InsertEntry(*pString); 130*cdf0e10cSrcweir rSubRegions.InsertEntry(*pString); 131*cdf0e10cSrcweir lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt ); 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir void lcl_FillSubRegionList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir lcl_FillList( rSh, rSubRegions, pAvailNames, 0 ); 140*cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); 141*cdf0e10cSrcweir for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); 142*cdf0e10cSrcweir ppMark != pMarkAccess->getMarksEnd(); 143*cdf0e10cSrcweir ppMark++) 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir const ::sw::mark::IMark* pBkmk = ppMark->get(); 146*cdf0e10cSrcweir if( pBkmk->IsExpanded() ) 147*cdf0e10cSrcweir rSubRegions.InsertEntry( pBkmk->GetName() ); 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir /* -----------------25.06.99 15:38------------------- 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir --------------------------------------------------*/ 154*cdf0e10cSrcweir class SwTestPasswdDlg : public SfxPasswordDialog 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir public: 157*cdf0e10cSrcweir SwTestPasswdDlg(Window* pParent) : 158*cdf0e10cSrcweir SfxPasswordDialog(pParent) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir SetHelpId(HID_DLG_PASSWD_SECTION); 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir }; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir /*---------------------------------------------------------------------------- 165*cdf0e10cSrcweir Beschreibung: User Data Klasse fuer Bereichsinformationen 166*cdf0e10cSrcweir ----------------------------------------------------------------------------*/ 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir class SectRepr 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir private: 171*cdf0e10cSrcweir SwSectionData m_SectionData; 172*cdf0e10cSrcweir SwFmtCol m_Col; 173*cdf0e10cSrcweir SvxBrushItem m_Brush; 174*cdf0e10cSrcweir SwFmtFtnAtTxtEnd m_FtnNtAtEnd; 175*cdf0e10cSrcweir SwFmtEndAtTxtEnd m_EndNtAtEnd; 176*cdf0e10cSrcweir SwFmtNoBalancedColumns m_Balance; 177*cdf0e10cSrcweir SvxFrameDirectionItem m_FrmDirItem; 178*cdf0e10cSrcweir SvxLRSpaceItem m_LRSpaceItem; 179*cdf0e10cSrcweir sal_uInt16 m_nArrPos; 180*cdf0e10cSrcweir // zeigt an, ob evtl. Textinhalt im Bereich ist 181*cdf0e10cSrcweir bool m_bContent : 1; 182*cdf0e10cSrcweir // fuer Multiselektion erst markieren, dann mit der TreeListBox arbeiten! 183*cdf0e10cSrcweir bool m_bSelected : 1; 184*cdf0e10cSrcweir uno::Sequence<sal_Int8> m_TempPasswd; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir public: 187*cdf0e10cSrcweir SectRepr(sal_uInt16 nPos, SwSection& rSect); 188*cdf0e10cSrcweir bool operator==(SectRepr& rSectRef) const 189*cdf0e10cSrcweir { return m_nArrPos == rSectRef.GetArrPos(); } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir bool operator< (SectRepr& rSectRef) const 192*cdf0e10cSrcweir { return m_nArrPos < rSectRef.GetArrPos(); } 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir SwSectionData & GetSectionData() { return m_SectionData; } 195*cdf0e10cSrcweir SwSectionData const&GetSectionData() const { return m_SectionData; } 196*cdf0e10cSrcweir SwFmtCol& GetCol() { return m_Col; } 197*cdf0e10cSrcweir SvxBrushItem& GetBackground() { return m_Brush; } 198*cdf0e10cSrcweir SwFmtFtnAtTxtEnd& GetFtnNtAtEnd() { return m_FtnNtAtEnd; } 199*cdf0e10cSrcweir SwFmtEndAtTxtEnd& GetEndNtAtEnd() { return m_EndNtAtEnd; } 200*cdf0e10cSrcweir SwFmtNoBalancedColumns& GetBalance() { return m_Balance; } 201*cdf0e10cSrcweir SvxFrameDirectionItem& GetFrmDir() { return m_FrmDirItem; } 202*cdf0e10cSrcweir SvxLRSpaceItem& GetLRSpace() { return m_LRSpaceItem; } 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir sal_uInt16 GetArrPos() const { return m_nArrPos; } 205*cdf0e10cSrcweir String GetFile() const; 206*cdf0e10cSrcweir String GetSubRegion() const; 207*cdf0e10cSrcweir void SetFile(String const& rFile); 208*cdf0e10cSrcweir void SetFilter(String const& rFilter); 209*cdf0e10cSrcweir void SetSubRegion(String const& rSubRegion); 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir bool IsContent() { return m_bContent; } 212*cdf0e10cSrcweir void SetContent(bool const bValue) { m_bContent = bValue; } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir void SetSelected() { m_bSelected = true; } 215*cdf0e10cSrcweir bool IsSelected() const { return m_bSelected; } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir uno::Sequence<sal_Int8> & GetTempPasswd() { return m_TempPasswd; } 218*cdf0e10cSrcweir void SetTempPasswd(const uno::Sequence<sal_Int8> & rPasswd) 219*cdf0e10cSrcweir { m_TempPasswd = rPasswd; } 220*cdf0e10cSrcweir }; 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir SV_IMPL_OP_PTRARR_SORT( SectReprArr, SectReprPtr ) 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir SectRepr::SectRepr( sal_uInt16 nPos, SwSection& rSect ) 226*cdf0e10cSrcweir : m_SectionData( rSect ) 227*cdf0e10cSrcweir , m_Brush( RES_BACKGROUND ) 228*cdf0e10cSrcweir , m_FrmDirItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ) 229*cdf0e10cSrcweir , m_LRSpaceItem( RES_LR_SPACE ) 230*cdf0e10cSrcweir , m_nArrPos(nPos) 231*cdf0e10cSrcweir , m_bContent(m_SectionData.GetLinkFileName().Len() == 0) 232*cdf0e10cSrcweir , m_bSelected(false) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir SwSectionFmt *pFmt = rSect.GetFmt(); 235*cdf0e10cSrcweir if( pFmt ) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir m_Col = pFmt->GetCol(); 238*cdf0e10cSrcweir m_Brush = pFmt->GetBackground(); 239*cdf0e10cSrcweir m_FtnNtAtEnd = pFmt->GetFtnAtTxtEnd(); 240*cdf0e10cSrcweir m_EndNtAtEnd = pFmt->GetEndAtTxtEnd(); 241*cdf0e10cSrcweir m_Balance.SetValue(pFmt->GetBalancedColumns().GetValue()); 242*cdf0e10cSrcweir m_FrmDirItem = pFmt->GetFrmDir(); 243*cdf0e10cSrcweir m_LRSpaceItem = pFmt->GetLRSpace(); 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir void SectRepr::SetFile( const String& rFile ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir String sNewFile( INetURLObject::decode( rFile, INET_HEX_ESCAPE, 250*cdf0e10cSrcweir INetURLObject::DECODE_UNAMBIGUOUS, 251*cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 )); 252*cdf0e10cSrcweir String sOldFileName( m_SectionData.GetLinkFileName() ); 253*cdf0e10cSrcweir String sSub( sOldFileName.GetToken( 2, sfx2::cTokenSeperator ) ); 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir if( rFile.Len() || sSub.Len() ) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir sNewFile += sfx2::cTokenSeperator; 258*cdf0e10cSrcweir if( rFile.Len() ) // Filter nur mit FileName 259*cdf0e10cSrcweir sNewFile += sOldFileName.GetToken( 1, sfx2::cTokenSeperator ); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir sNewFile += sfx2::cTokenSeperator; 262*cdf0e10cSrcweir sNewFile += sSub; 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir m_SectionData.SetLinkFileName( sNewFile ); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir if( rFile.Len() || sSub.Len() ) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir m_SectionData.SetType( FILE_LINK_SECTION ); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir else 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir m_SectionData.SetType( CONTENT_SECTION ); 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir void SectRepr::SetFilter( const String& rFilter ) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir String sNewFile; 281*cdf0e10cSrcweir String sOldFileName( m_SectionData.GetLinkFileName() ); 282*cdf0e10cSrcweir String sFile( sOldFileName.GetToken( 0, sfx2::cTokenSeperator ) ); 283*cdf0e10cSrcweir String sSub( sOldFileName.GetToken( 2, sfx2::cTokenSeperator ) ); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir if( sFile.Len() ) 286*cdf0e10cSrcweir (((( sNewFile = sFile ) += sfx2::cTokenSeperator ) += rFilter ) 287*cdf0e10cSrcweir += sfx2::cTokenSeperator ) += sSub; 288*cdf0e10cSrcweir else if( sSub.Len() ) 289*cdf0e10cSrcweir (( sNewFile = sfx2::cTokenSeperator ) += sfx2::cTokenSeperator ) += sSub; 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir m_SectionData.SetLinkFileName( sNewFile ); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir if( sNewFile.Len() ) 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir m_SectionData.SetType( FILE_LINK_SECTION ); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir void SectRepr::SetSubRegion(const String& rSubRegion) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir String sNewFile; 302*cdf0e10cSrcweir String sOldFileName( m_SectionData.GetLinkFileName() ); 303*cdf0e10cSrcweir String sFilter( sOldFileName.GetToken( 1, sfx2::cTokenSeperator ) ); 304*cdf0e10cSrcweir sOldFileName = sOldFileName.GetToken( 0, sfx2::cTokenSeperator ); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir if( rSubRegion.Len() || sOldFileName.Len() ) 307*cdf0e10cSrcweir (((( sNewFile = sOldFileName ) += sfx2::cTokenSeperator ) += sFilter ) 308*cdf0e10cSrcweir += sfx2::cTokenSeperator ) += rSubRegion; 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir m_SectionData.SetLinkFileName( sNewFile ); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir if( rSubRegion.Len() || sOldFileName.Len() ) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir m_SectionData.SetType( FILE_LINK_SECTION ); 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir else 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir m_SectionData.SetType( CONTENT_SECTION ); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir String SectRepr::GetFile() const 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir String sLinkFile( m_SectionData.GetLinkFileName() ); 326*cdf0e10cSrcweir if( sLinkFile.Len() ) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir if (DDE_LINK_SECTION == m_SectionData.GetType()) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir sal_uInt16 n = sLinkFile.SearchAndReplace( sfx2::cTokenSeperator, ' ' ); 331*cdf0e10cSrcweir sLinkFile.SearchAndReplace( sfx2::cTokenSeperator, ' ', n ); 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir else 334*cdf0e10cSrcweir sLinkFile = INetURLObject::decode( sLinkFile.GetToken( 0, 335*cdf0e10cSrcweir sfx2::cTokenSeperator ), 336*cdf0e10cSrcweir INET_HEX_ESCAPE, 337*cdf0e10cSrcweir INetURLObject::DECODE_UNAMBIGUOUS, 338*cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir return sLinkFile; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir String SectRepr::GetSubRegion() const 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir String sLinkFile( m_SectionData.GetLinkFileName() ); 347*cdf0e10cSrcweir if( sLinkFile.Len() ) 348*cdf0e10cSrcweir sLinkFile = sLinkFile.GetToken( 2, sfx2::cTokenSeperator ); 349*cdf0e10cSrcweir return sLinkFile; 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir /*---------------------------------------------------------------------------- 355*cdf0e10cSrcweir Beschreibung: Dialog Bearbeiten Bereiche 356*cdf0e10cSrcweir ----------------------------------------------------------------------------*/ 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir //--------------------------------------------------------------------- 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh ) 361*cdf0e10cSrcweir : SfxModalDialog( pParent, SW_RES(MD_EDIT_REGION) ), 362*cdf0e10cSrcweir aNameFL ( this, SW_RES( FL_NAME ) ), 363*cdf0e10cSrcweir aCurName ( this, SW_RES( ED_RANAME ) ), 364*cdf0e10cSrcweir aTree ( this, SW_RES( TLB_SECTION )), 365*cdf0e10cSrcweir aLinkFL ( this, SW_RES( FL_LINK ) ), 366*cdf0e10cSrcweir aFileCB ( this, SW_RES( CB_FILE ) ), 367*cdf0e10cSrcweir aDDECB ( this, SW_RES( CB_DDE ) ) , 368*cdf0e10cSrcweir aFileNameFT ( this, SW_RES( FT_FILE ) ) , 369*cdf0e10cSrcweir aDDECommandFT ( this, SW_RES( FT_DDE ) ) , 370*cdf0e10cSrcweir aFileNameED ( this, SW_RES( ED_FILE ) ), 371*cdf0e10cSrcweir aFilePB ( this, SW_RES( PB_FILE ) ), 372*cdf0e10cSrcweir aSubRegionFT ( this, SW_RES( FT_SUBREG ) ) , 373*cdf0e10cSrcweir aSubRegionED ( this, SW_RES( LB_SUBREG ) ) , 374*cdf0e10cSrcweir bSubRegionsFilled( false ), 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir aProtectFL ( this, SW_RES( FL_PROTECT ) ), 377*cdf0e10cSrcweir aProtectCB ( this, SW_RES( CB_PROTECT ) ), 378*cdf0e10cSrcweir aPasswdCB ( this, SW_RES( CB_PASSWD ) ), 379*cdf0e10cSrcweir aPasswdPB ( this, SW_RES( PB_PASSWD ) ), 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir aHideFL ( this, SW_RES( FL_HIDE ) ), 382*cdf0e10cSrcweir aHideCB ( this, SW_RES( CB_HIDE ) ), 383*cdf0e10cSrcweir aConditionFT ( this, SW_RES( FT_CONDITION ) ), 384*cdf0e10cSrcweir aConditionED ( this, SW_RES( ED_CONDITION ) ), 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 387*cdf0e10cSrcweir aPropertiesFL ( this, SW_RES( FL_PROPERTIES ) ), 388*cdf0e10cSrcweir aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY ) ), 389*cdf0e10cSrcweir // <-- 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir aOK ( this, SW_RES( PB_OK ) ), 392*cdf0e10cSrcweir aCancel ( this, SW_RES( PB_CANCEL ) ), 393*cdf0e10cSrcweir aOptionsPB ( this, SW_RES( PB_OPTIONS ) ), 394*cdf0e10cSrcweir aDismiss ( this, SW_RES( CB_DISMISS ) ), 395*cdf0e10cSrcweir aHelp ( this, SW_RES( PB_HELP ) ), 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir aImageIL ( SW_RES(IL_BITMAPS)), 398*cdf0e10cSrcweir aImageILH ( SW_RES(ILH_BITMAPS)), 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir rSh( rWrtSh ), 401*cdf0e10cSrcweir pAktEntry( 0 ), 402*cdf0e10cSrcweir m_pDocInserter ( NULL ), 403*cdf0e10cSrcweir m_pOldDefDlgParent ( NULL ), 404*cdf0e10cSrcweir bDontCheckPasswd ( sal_True) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir FreeResource(); 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir aTree.SetSelectHdl ( LINK( this, SwEditRegionDlg, GetFirstEntryHdl)); 411*cdf0e10cSrcweir aTree.SetDeselectHdl ( LINK( this, SwEditRegionDlg, DeselectHdl)); 412*cdf0e10cSrcweir aCurName.SetModifyHdl ( LINK( this, SwEditRegionDlg, NameEditHdl)); 413*cdf0e10cSrcweir aConditionED.SetModifyHdl( LINK( this, SwEditRegionDlg, ConditionEditHdl)); 414*cdf0e10cSrcweir aOK.SetClickHdl ( LINK( this, SwEditRegionDlg, OkHdl)); 415*cdf0e10cSrcweir aPasswdCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangePasswdHdl)); 416*cdf0e10cSrcweir aPasswdPB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangePasswdHdl)); 417*cdf0e10cSrcweir aHideCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeHideHdl)); 418*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 419*cdf0e10cSrcweir aEditInReadonlyCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeEditInReadonlyHdl)); 420*cdf0e10cSrcweir // <-- 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir aOptionsPB.Show(); 423*cdf0e10cSrcweir aOptionsPB.SetClickHdl ( LINK( this, SwEditRegionDlg, OptionsHdl)); 424*cdf0e10cSrcweir aProtectCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeProtectHdl)); 425*cdf0e10cSrcweir aDismiss.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeDismissHdl)); 426*cdf0e10cSrcweir aFileCB.SetClickHdl ( LINK( this, SwEditRegionDlg, UseFileHdl )); 427*cdf0e10cSrcweir aFilePB.SetClickHdl ( LINK( this, SwEditRegionDlg, FileSearchHdl )); 428*cdf0e10cSrcweir aFileNameED.SetModifyHdl( LINK( this, SwEditRegionDlg, FileNameHdl )); 429*cdf0e10cSrcweir aSubRegionED.SetModifyHdl( LINK( this, SwEditRegionDlg, FileNameHdl )); 430*cdf0e10cSrcweir aSubRegionED.AddEventListener( LINK( this, SwEditRegionDlg, SubRegionEventHdl )); 431*cdf0e10cSrcweir aSubRegionED.EnableAutocomplete( sal_True, sal_True ); 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir aTree.SetHelpId(HID_REGION_TREE); 434*cdf0e10cSrcweir aTree.SetSelectionMode( MULTIPLE_SELECTION ); 435*cdf0e10cSrcweir aTree.SetStyle(aTree.GetStyle()|WB_HASBUTTONSATROOT|WB_CLIPCHILDREN|WB_HSCROLL); 436*cdf0e10cSrcweir aTree.SetSpaceBetweenEntries(0); 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir if(bWeb) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir aConditionFT .Hide(); 441*cdf0e10cSrcweir aConditionED .Hide(); 442*cdf0e10cSrcweir aPasswdCB .Hide(); 443*cdf0e10cSrcweir aHideCB .Hide(); 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir aDDECB .Hide(); 446*cdf0e10cSrcweir aDDECommandFT .Hide(); 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir aDDECB.SetClickHdl ( LINK( this, SwEditRegionDlg, DDEHdl )); 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir //Ermitteln der vorhandenen Bereiche 452*cdf0e10cSrcweir pCurrSect = rSh.GetCurrSection(); 453*cdf0e10cSrcweir RecurseList( 0, 0 ); 454*cdf0e10cSrcweir //falls der Cursor nicht in einem Bereich steht, 455*cdf0e10cSrcweir //wird immer der erste selektiert 456*cdf0e10cSrcweir if( !aTree.FirstSelected() && aTree.First() ) 457*cdf0e10cSrcweir aTree.Select( aTree.First() ); 458*cdf0e10cSrcweir aTree.Show(); 459*cdf0e10cSrcweir bDontCheckPasswd = sal_False; 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir aPasswdPB.SetAccessibleRelationMemberOf(&aProtectFL); 462*cdf0e10cSrcweir aPasswdPB.SetAccessibleRelationLabeledBy(&aPasswdCB); 463*cdf0e10cSrcweir aSubRegionED.SetAccessibleName(aSubRegionFT.GetText()); 464*cdf0e10cSrcweir } 465*cdf0e10cSrcweir /* -----------------------------26.04.01 14:56-------------------------------- 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 468*cdf0e10cSrcweir sal_Bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox) 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir if(bDontCheckPasswd) 471*cdf0e10cSrcweir return sal_True; 472*cdf0e10cSrcweir sal_Bool bRet = sal_True; 473*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.FirstSelected(); 474*cdf0e10cSrcweir while( pEntry ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData(); 477*cdf0e10cSrcweir if (!pRepr->GetTempPasswd().getLength() 478*cdf0e10cSrcweir && pRepr->GetSectionData().GetPassword().getLength()) 479*cdf0e10cSrcweir { 480*cdf0e10cSrcweir SwTestPasswdDlg aPasswdDlg(this); 481*cdf0e10cSrcweir bRet = sal_False; 482*cdf0e10cSrcweir if (aPasswdDlg.Execute()) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir String sNewPasswd( aPasswdDlg.GetPassword() ); 485*cdf0e10cSrcweir UNO_NMSPC::Sequence <sal_Int8 > aNewPasswd; 486*cdf0e10cSrcweir SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); 487*cdf0e10cSrcweir if (SvPasswordHelper::CompareHashPassword( 488*cdf0e10cSrcweir pRepr->GetSectionData().GetPassword(), sNewPasswd)) 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir pRepr->SetTempPasswd(aNewPasswd); 491*cdf0e10cSrcweir bRet = sal_True; 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir else 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir InfoBox(this, SW_RES(REG_WRONG_PASSWORD)).Execute(); 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir pEntry = aTree.NextSelected(pEntry); 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir if(!bRet && pBox) 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir //reset old button state 504*cdf0e10cSrcweir if(pBox->IsTriStateEnabled()) 505*cdf0e10cSrcweir pBox->SetState(pBox->IsChecked() ? STATE_NOCHECK : STATE_DONTKNOW); 506*cdf0e10cSrcweir else 507*cdf0e10cSrcweir pBox->Check(!pBox->IsChecked()); 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir return bRet; 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir /*--------------------------------------------------------------------- 513*cdf0e10cSrcweir Beschreibung: Durchsuchen nach Child-Sections, rekursiv 514*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir void SwEditRegionDlg::RecurseList( const SwSectionFmt* pFmt, SvLBoxEntry* pEntry ) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir SwSection* pSect = 0; 519*cdf0e10cSrcweir SvLBoxEntry* pSelEntry = 0; 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir if (!pFmt) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir sal_uInt16 nCount=rSh.GetSectionFmtCount(); 524*cdf0e10cSrcweir for ( sal_uInt16 n=0; n < nCount; n++ ) 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir SectionType eTmpType; 527*cdf0e10cSrcweir if( !( pFmt = &rSh.GetSectionFmt(n))->GetParent() && 528*cdf0e10cSrcweir pFmt->IsInNodesArr() && 529*cdf0e10cSrcweir (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION 530*cdf0e10cSrcweir && TOX_HEADER_SECTION != eTmpType ) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir SectRepr* pSectRepr = new SectRepr( n, 533*cdf0e10cSrcweir *(pSect=pFmt->GetSection()) ); 534*cdf0e10cSrcweir Image aImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), sal_False); 535*cdf0e10cSrcweir pEntry = aTree.InsertEntry(pSect->GetSectionName(), aImg, aImg); 536*cdf0e10cSrcweir Image aHCImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), sal_True); 537*cdf0e10cSrcweir aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); 538*cdf0e10cSrcweir aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); 539*cdf0e10cSrcweir pEntry->SetUserData(pSectRepr); 540*cdf0e10cSrcweir RecurseList( pFmt, pEntry ); 541*cdf0e10cSrcweir if (pEntry->HasChilds()) 542*cdf0e10cSrcweir aTree.Expand(pEntry); 543*cdf0e10cSrcweir if (pCurrSect==pSect) 544*cdf0e10cSrcweir aTree.Select(pEntry); 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir else 549*cdf0e10cSrcweir { 550*cdf0e10cSrcweir SwSections aTmpArr; 551*cdf0e10cSrcweir SvLBoxEntry* pNEntry; 552*cdf0e10cSrcweir sal_uInt16 nCnt = pFmt->GetChildSections(aTmpArr,SORTSECT_POS); 553*cdf0e10cSrcweir if( nCnt ) 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nCnt; ++n ) 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir SectionType eTmpType; 558*cdf0e10cSrcweir pFmt = aTmpArr[n]->GetFmt(); 559*cdf0e10cSrcweir if( pFmt->IsInNodesArr() && 560*cdf0e10cSrcweir (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION 561*cdf0e10cSrcweir && TOX_HEADER_SECTION != eTmpType ) 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir pSect=aTmpArr[n]; 564*cdf0e10cSrcweir SectRepr* pSectRepr=new SectRepr( 565*cdf0e10cSrcweir FindArrPos( pSect->GetFmt() ), *pSect ); 566*cdf0e10cSrcweir Image aImage = BuildBitmap( pSect->IsProtect(), 567*cdf0e10cSrcweir pSect->IsHidden(), sal_False); 568*cdf0e10cSrcweir pNEntry = aTree.InsertEntry( 569*cdf0e10cSrcweir pSect->GetSectionName(), aImage, aImage, pEntry); 570*cdf0e10cSrcweir Image aHCImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), sal_True); 571*cdf0e10cSrcweir aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); 572*cdf0e10cSrcweir aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); 573*cdf0e10cSrcweir pNEntry->SetUserData(pSectRepr); 574*cdf0e10cSrcweir RecurseList( aTmpArr[n]->GetFmt(), pNEntry ); 575*cdf0e10cSrcweir if( pNEntry->HasChilds()) 576*cdf0e10cSrcweir aTree.Expand(pNEntry); 577*cdf0e10cSrcweir if (pCurrSect==pSect) 578*cdf0e10cSrcweir pSelEntry = pNEntry; 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir } 582*cdf0e10cSrcweir } 583*cdf0e10cSrcweir if(0 != pSelEntry) 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir aTree.MakeVisible(pSelEntry); 586*cdf0e10cSrcweir aTree.Select(pSelEntry); 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir /*--------------------------------------------------------------------- 590*cdf0e10cSrcweir 591*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 592*cdf0e10cSrcweir 593*cdf0e10cSrcweir sal_uInt16 SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt ) 594*cdf0e10cSrcweir { 595*cdf0e10cSrcweir sal_uInt16 nCount=rSh.GetSectionFmtCount(); 596*cdf0e10cSrcweir for (sal_uInt16 i=0;i<nCount;i++) 597*cdf0e10cSrcweir if (pFmt==&rSh.GetSectionFmt(i)) 598*cdf0e10cSrcweir return i; 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir DBG_ERROR( "SectionFormat nicht in der Liste" ); 601*cdf0e10cSrcweir return USHRT_MAX; 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir /*--------------------------------------------------------------------- 604*cdf0e10cSrcweir Beschreibung: 605*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir SwEditRegionDlg::~SwEditRegionDlg( ) 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.First(); 610*cdf0e10cSrcweir while( pEntry ) 611*cdf0e10cSrcweir { 612*cdf0e10cSrcweir delete (SectRepr*)pEntry->GetUserData(); 613*cdf0e10cSrcweir pEntry = aTree.Next( pEntry ); 614*cdf0e10cSrcweir } 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir aSectReprArr.DeleteAndDestroy( 0, aSectReprArr.Count() ); 617*cdf0e10cSrcweir delete m_pDocInserter; 618*cdf0e10cSrcweir } 619*cdf0e10cSrcweir /* -----------------------------09.10.2001 15:41------------------------------ 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 622*cdf0e10cSrcweir void SwEditRegionDlg::SelectSection(const String& rSectionName) 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.First(); 625*cdf0e10cSrcweir while(pEntry) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData(); 628*cdf0e10cSrcweir if (pRepr->GetSectionData().GetSectionName() == rSectionName) 629*cdf0e10cSrcweir break; 630*cdf0e10cSrcweir pEntry = aTree.Next(pEntry); 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir if(pEntry) 633*cdf0e10cSrcweir { 634*cdf0e10cSrcweir aTree.SelectAll( sal_False); 635*cdf0e10cSrcweir aTree.Select(pEntry); 636*cdf0e10cSrcweir aTree.MakeVisible(pEntry); 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir /*--------------------------------------------------------------------- 640*cdf0e10cSrcweir Beschreibung: Selektierte Eintrag in der TreeListBox wird im 641*cdf0e10cSrcweir Edit-Fenster angezeigt 642*cdf0e10cSrcweir Bei Multiselektion werden einige Controls disabled 643*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox ) 646*cdf0e10cSrcweir { 647*cdf0e10cSrcweir bDontCheckPasswd = sal_True; 648*cdf0e10cSrcweir SvLBoxEntry* pEntry=pBox->FirstSelected(); 649*cdf0e10cSrcweir aHideCB .Enable(sal_True); 650*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 651*cdf0e10cSrcweir aEditInReadonlyCB.Enable(sal_True); 652*cdf0e10cSrcweir // <-- 653*cdf0e10cSrcweir aProtectCB .Enable(sal_True); 654*cdf0e10cSrcweir aFileCB .Enable(sal_True); 655*cdf0e10cSrcweir UNO_NMSPC::Sequence <sal_Int8> aCurPasswd; 656*cdf0e10cSrcweir if( 1 < pBox->GetSelectionCount() ) 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir aHideCB.EnableTriState( sal_True ); 659*cdf0e10cSrcweir aProtectCB.EnableTriState( sal_True ); 660*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 661*cdf0e10cSrcweir aEditInReadonlyCB.EnableTriState ( sal_True ); 662*cdf0e10cSrcweir // <-- 663*cdf0e10cSrcweir aFileCB.EnableTriState( sal_True ); 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir bool bHiddenValid = true; 666*cdf0e10cSrcweir bool bProtectValid = true; 667*cdf0e10cSrcweir bool bConditionValid = true; 668*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 669*cdf0e10cSrcweir bool bEditInReadonlyValid = true; 670*cdf0e10cSrcweir bool bEditInReadonly = true; 671*cdf0e10cSrcweir // <-- 672*cdf0e10cSrcweir bool bHidden = true; 673*cdf0e10cSrcweir bool bProtect = true; 674*cdf0e10cSrcweir String sCondition; 675*cdf0e10cSrcweir sal_Bool bFirst = sal_True; 676*cdf0e10cSrcweir sal_Bool bFileValid = sal_True; 677*cdf0e10cSrcweir sal_Bool bFile = sal_True; 678*cdf0e10cSrcweir sal_Bool bPasswdValid = sal_True; 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir while( pEntry ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir SectRepr* pRepr=(SectRepr*) pEntry->GetUserData(); 683*cdf0e10cSrcweir SwSectionData const& rData( pRepr->GetSectionData() ); 684*cdf0e10cSrcweir if(bFirst) 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir sCondition = rData.GetCondition(); 687*cdf0e10cSrcweir bHidden = rData.IsHidden(); 688*cdf0e10cSrcweir bProtect = rData.IsProtectFlag(); 689*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 690*cdf0e10cSrcweir bEditInReadonly = rData.IsEditInReadonlyFlag(); 691*cdf0e10cSrcweir // <-- 692*cdf0e10cSrcweir bFile = (rData.GetType() != CONTENT_SECTION); 693*cdf0e10cSrcweir aCurPasswd = rData.GetPassword(); 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir else 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir String sTemp(rData.GetCondition()); 698*cdf0e10cSrcweir if(sCondition != sTemp) 699*cdf0e10cSrcweir bConditionValid = sal_False; 700*cdf0e10cSrcweir bHiddenValid = (bHidden == rData.IsHidden()); 701*cdf0e10cSrcweir bProtectValid = (bProtect == rData.IsProtectFlag()); 702*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 703*cdf0e10cSrcweir bEditInReadonlyValid = 704*cdf0e10cSrcweir (bEditInReadonly == rData.IsEditInReadonlyFlag()); 705*cdf0e10cSrcweir // <-- 706*cdf0e10cSrcweir bFileValid = (bFile == 707*cdf0e10cSrcweir (rData.GetType() != CONTENT_SECTION)); 708*cdf0e10cSrcweir bPasswdValid = (aCurPasswd == rData.GetPassword()); 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir pEntry = pBox->NextSelected(pEntry); 711*cdf0e10cSrcweir bFirst = sal_False; 712*cdf0e10cSrcweir } 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir aHideCB.SetState( !bHiddenValid ? STATE_DONTKNOW : 715*cdf0e10cSrcweir bHidden ? STATE_CHECK : STATE_NOCHECK); 716*cdf0e10cSrcweir aProtectCB.SetState( !bProtectValid ? STATE_DONTKNOW : 717*cdf0e10cSrcweir bProtect ? STATE_CHECK : STATE_NOCHECK); 718*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 719*cdf0e10cSrcweir aEditInReadonlyCB.SetState( !bEditInReadonlyValid ? STATE_DONTKNOW : 720*cdf0e10cSrcweir bEditInReadonly ? STATE_CHECK : STATE_NOCHECK); 721*cdf0e10cSrcweir // <-- 722*cdf0e10cSrcweir aFileCB.SetState(!bFileValid ? STATE_DONTKNOW : 723*cdf0e10cSrcweir bFile ? STATE_CHECK : STATE_NOCHECK); 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir if(bConditionValid) 726*cdf0e10cSrcweir aConditionED.SetText(sCondition); 727*cdf0e10cSrcweir else 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir // aConditionED.SetText(aEmptyStr); 730*cdf0e10cSrcweir aConditionFT.Enable(sal_False); 731*cdf0e10cSrcweir aConditionED.Enable(sal_False); 732*cdf0e10cSrcweir } 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir aFilePB.Enable(sal_False); 735*cdf0e10cSrcweir aFileNameFT .Enable(sal_False); 736*cdf0e10cSrcweir aFileNameED .Enable(sal_False); 737*cdf0e10cSrcweir aSubRegionFT.Enable(sal_False); 738*cdf0e10cSrcweir aSubRegionED.Enable(sal_False); 739*cdf0e10cSrcweir // aNameFT .Enable(sal_False); 740*cdf0e10cSrcweir aCurName .Enable(sal_False); 741*cdf0e10cSrcweir aOptionsPB .Enable(sal_False); 742*cdf0e10cSrcweir aDDECB .Enable(sal_False); 743*cdf0e10cSrcweir aDDECommandFT .Enable(sal_False); 744*cdf0e10cSrcweir sal_Bool bPasswdEnabled = aProtectCB.GetState() == STATE_CHECK; 745*cdf0e10cSrcweir aPasswdCB.Enable(bPasswdEnabled); 746*cdf0e10cSrcweir aPasswdPB.Enable(bPasswdEnabled); 747*cdf0e10cSrcweir if(!bPasswdValid) 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir pEntry = pBox->FirstSelected(); 750*cdf0e10cSrcweir pBox->SelectAll( sal_False ); 751*cdf0e10cSrcweir pBox->Select( pEntry ); 752*cdf0e10cSrcweir GetFirstEntryHdl(pBox); 753*cdf0e10cSrcweir return 0; 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir else 756*cdf0e10cSrcweir aPasswdCB.Check(aCurPasswd.getLength() > 0); 757*cdf0e10cSrcweir } 758*cdf0e10cSrcweir else if (pEntry ) 759*cdf0e10cSrcweir { 760*cdf0e10cSrcweir // aNameFT .Enable(sal_True); 761*cdf0e10cSrcweir aCurName .Enable(sal_True); 762*cdf0e10cSrcweir aOptionsPB .Enable(sal_True); 763*cdf0e10cSrcweir SectRepr* pRepr=(SectRepr*) pEntry->GetUserData(); 764*cdf0e10cSrcweir SwSectionData const& rData( pRepr->GetSectionData() ); 765*cdf0e10cSrcweir aConditionED.SetText(rData.GetCondition()); 766*cdf0e10cSrcweir aHideCB.Enable(); 767*cdf0e10cSrcweir aHideCB.SetState((rData.IsHidden()) ? STATE_CHECK : STATE_NOCHECK); 768*cdf0e10cSrcweir sal_Bool bHide = STATE_CHECK == aHideCB.GetState(); 769*cdf0e10cSrcweir aConditionED.Enable(bHide); 770*cdf0e10cSrcweir aConditionFT.Enable(bHide); 771*cdf0e10cSrcweir aPasswdCB.Check(rData.GetPassword().getLength() > 0); 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir aOK.Enable(); 774*cdf0e10cSrcweir aPasswdCB.Enable(); 775*cdf0e10cSrcweir aCurName.SetText(pBox->GetEntryText(pEntry)); 776*cdf0e10cSrcweir aCurName.Enable(); 777*cdf0e10cSrcweir aDismiss.Enable(); 778*cdf0e10cSrcweir String aFile = pRepr->GetFile(); 779*cdf0e10cSrcweir String sSub = pRepr->GetSubRegion(); 780*cdf0e10cSrcweir bSubRegionsFilled = false; 781*cdf0e10cSrcweir aSubRegionED.Clear(); 782*cdf0e10cSrcweir if(aFile.Len()||sSub.Len()) 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir aFileCB.Check(sal_True); 785*cdf0e10cSrcweir aFileNameED.SetText(aFile); 786*cdf0e10cSrcweir aSubRegionED.SetText(sSub); 787*cdf0e10cSrcweir aDDECB.Check(rData.GetType() == DDE_LINK_SECTION); 788*cdf0e10cSrcweir } 789*cdf0e10cSrcweir else 790*cdf0e10cSrcweir { 791*cdf0e10cSrcweir aFileCB.Check(sal_False); 792*cdf0e10cSrcweir aFileNameED.SetText(aFile); 793*cdf0e10cSrcweir aDDECB.Enable(sal_False); 794*cdf0e10cSrcweir aDDECB.Check(sal_False); 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir UseFileHdl(&aFileCB); 797*cdf0e10cSrcweir DDEHdl( &aDDECB ); 798*cdf0e10cSrcweir aProtectCB.SetState((rData.IsProtectFlag()) 799*cdf0e10cSrcweir ? STATE_CHECK : STATE_NOCHECK); 800*cdf0e10cSrcweir aProtectCB.Enable(); 801*cdf0e10cSrcweir 802*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 803*cdf0e10cSrcweir aEditInReadonlyCB.SetState((rData.IsEditInReadonlyFlag()) 804*cdf0e10cSrcweir ? STATE_CHECK : STATE_NOCHECK); 805*cdf0e10cSrcweir aEditInReadonlyCB.Enable(); 806*cdf0e10cSrcweir // <-- 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir sal_Bool bPasswdEnabled = aProtectCB.IsChecked(); 809*cdf0e10cSrcweir aPasswdCB.Enable(bPasswdEnabled); 810*cdf0e10cSrcweir aPasswdPB.Enable(bPasswdEnabled); 811*cdf0e10cSrcweir } 812*cdf0e10cSrcweir bDontCheckPasswd = sal_False; 813*cdf0e10cSrcweir return 0; 814*cdf0e10cSrcweir } 815*cdf0e10cSrcweir /*-----------------28.06.97 09:19------------------- 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir --------------------------------------------------*/ 818*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, DeselectHdl, SvTreeListBox *, pBox ) 819*cdf0e10cSrcweir { 820*cdf0e10cSrcweir if( !pBox->GetSelectionCount() ) 821*cdf0e10cSrcweir { 822*cdf0e10cSrcweir aHideCB .Enable(sal_False); 823*cdf0e10cSrcweir aProtectCB .Enable(sal_False); 824*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 825*cdf0e10cSrcweir aEditInReadonlyCB.Enable(sal_False); 826*cdf0e10cSrcweir // <-- 827*cdf0e10cSrcweir aPasswdCB .Enable(sal_False); 828*cdf0e10cSrcweir aPasswdCB .Enable(sal_False); 829*cdf0e10cSrcweir aConditionFT .Enable(sal_False); 830*cdf0e10cSrcweir aConditionED.Enable(sal_False); 831*cdf0e10cSrcweir aFileCB .Enable(sal_False); 832*cdf0e10cSrcweir aFilePB .Enable(sal_False); 833*cdf0e10cSrcweir aFileNameFT .Enable(sal_False); 834*cdf0e10cSrcweir aFileNameED .Enable(sal_False); 835*cdf0e10cSrcweir aSubRegionFT .Enable(sal_False); 836*cdf0e10cSrcweir aSubRegionED .Enable(sal_False); 837*cdf0e10cSrcweir // aNameFT .Enable(sal_False); 838*cdf0e10cSrcweir aCurName .Enable(sal_False); 839*cdf0e10cSrcweir aDDECB .Enable(sal_False); 840*cdf0e10cSrcweir aDDECommandFT .Enable(sal_False); 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir UseFileHdl(&aFileCB); 843*cdf0e10cSrcweir DDEHdl( &aDDECB ); 844*cdf0e10cSrcweir } 845*cdf0e10cSrcweir return 0; 846*cdf0e10cSrcweir } 847*cdf0e10cSrcweir 848*cdf0e10cSrcweir /*--------------------------------------------------------------------- 849*cdf0e10cSrcweir Beschreibung: Im OkHdl werden die veraenderten Einstellungen 850*cdf0e10cSrcweir uebernommen und aufgehobene Bereiche geloescht 851*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, OkHdl, CheckBox *, EMPTYARG ) 854*cdf0e10cSrcweir { 855*cdf0e10cSrcweir // JP 13.03.96: 856*cdf0e10cSrcweir // temp. Array weil sich waehrend des aendern eines Bereiches die 857*cdf0e10cSrcweir // Position innerhalb des "Core-Arrays" verschieben kann: 858*cdf0e10cSrcweir // - bei gelinkten Bereichen, wenn sie weitere SubBereiche haben oder 859*cdf0e10cSrcweir // neu erhalten. 860*cdf0e10cSrcweir // JP 30.05.97: StartUndo darf natuerlich auch erst nach dem Kopieren 861*cdf0e10cSrcweir // der Formate erfolgen (ClearRedo!) 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir const SwSectionFmts& rDocFmts = rSh.GetDoc()->GetSections(); 864*cdf0e10cSrcweir SwSectionFmts aOrigArray( 0, 5 ); 865*cdf0e10cSrcweir aOrigArray.Insert( &rDocFmts, 0 ); 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir rSh.StartAllAction(); 868*cdf0e10cSrcweir rSh.StartUndo(); 869*cdf0e10cSrcweir rSh.ResetSelect( 0,sal_False ); 870*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.First(); 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir while( pEntry ) 873*cdf0e10cSrcweir { 874*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); 875*cdf0e10cSrcweir SwSectionFmt* pFmt = aOrigArray[ pRepr->GetArrPos() ]; 876*cdf0e10cSrcweir if (!pRepr->GetSectionData().IsProtectFlag()) 877*cdf0e10cSrcweir { 878*cdf0e10cSrcweir pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >()); 879*cdf0e10cSrcweir } 880*cdf0e10cSrcweir sal_uInt16 nNewPos = rDocFmts.GetPos( pFmt ); 881*cdf0e10cSrcweir if( USHRT_MAX != nNewPos ) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir SfxItemSet* pSet = pFmt->GetAttrSet().Clone( sal_False ); 884*cdf0e10cSrcweir if( pFmt->GetCol() != pRepr->GetCol() ) 885*cdf0e10cSrcweir pSet->Put( pRepr->GetCol() ); 886*cdf0e10cSrcweir 887*cdf0e10cSrcweir if( pFmt->GetBackground(sal_False) != pRepr->GetBackground() ) 888*cdf0e10cSrcweir pSet->Put( pRepr->GetBackground() ); 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir if( pFmt->GetFtnAtTxtEnd(sal_False) != pRepr->GetFtnNtAtEnd() ) 891*cdf0e10cSrcweir pSet->Put( pRepr->GetFtnNtAtEnd() ); 892*cdf0e10cSrcweir 893*cdf0e10cSrcweir if( pFmt->GetEndAtTxtEnd(sal_False) != pRepr->GetEndNtAtEnd() ) 894*cdf0e10cSrcweir pSet->Put( pRepr->GetEndNtAtEnd() ); 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir if( pFmt->GetBalancedColumns() != pRepr->GetBalance() ) 897*cdf0e10cSrcweir pSet->Put( pRepr->GetBalance() ); 898*cdf0e10cSrcweir 899*cdf0e10cSrcweir if( pFmt->GetFrmDir() != pRepr->GetFrmDir() ) 900*cdf0e10cSrcweir pSet->Put( pRepr->GetFrmDir() ); 901*cdf0e10cSrcweir 902*cdf0e10cSrcweir if( pFmt->GetLRSpace() != pRepr->GetLRSpace()) 903*cdf0e10cSrcweir pSet->Put( pRepr->GetLRSpace()); 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir rSh.UpdateSection( nNewPos, pRepr->GetSectionData(), 906*cdf0e10cSrcweir pSet->Count() ? pSet : 0 ); 907*cdf0e10cSrcweir delete pSet; 908*cdf0e10cSrcweir } 909*cdf0e10cSrcweir pEntry = aTree.Next( pEntry ); 910*cdf0e10cSrcweir } 911*cdf0e10cSrcweir 912*cdf0e10cSrcweir for(sal_uInt16 i = aSectReprArr.Count(); i; ) 913*cdf0e10cSrcweir { 914*cdf0e10cSrcweir SwSectionFmt* pFmt = aOrigArray[ aSectReprArr[ --i ]->GetArrPos() ]; 915*cdf0e10cSrcweir sal_uInt16 nNewPos = rDocFmts.GetPos( pFmt ); 916*cdf0e10cSrcweir if( USHRT_MAX != nNewPos ) 917*cdf0e10cSrcweir rSh.DelSectionFmt( nNewPos ); 918*cdf0e10cSrcweir } 919*cdf0e10cSrcweir // rSh.ChgSectionPasswd(aNewPasswd); 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir aOrigArray.Remove( 0, aOrigArray.Count() ); 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir //JP 21.05.97: EndDialog muss vor Ende der EndAction gerufen werden, 924*cdf0e10cSrcweir // sonst kann es ScrollFehler geben. 925*cdf0e10cSrcweir EndDialog(RET_OK); 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir rSh.EndUndo(); 928*cdf0e10cSrcweir rSh.EndAllAction(); 929*cdf0e10cSrcweir 930*cdf0e10cSrcweir return 0; 931*cdf0e10cSrcweir } 932*cdf0e10cSrcweir /*--------------------------------------------------------------------- 933*cdf0e10cSrcweir Beschreibung: Toggle protect 934*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, ChangeProtectHdl, TriStateBox *, pBox ) 937*cdf0e10cSrcweir { 938*cdf0e10cSrcweir if(!CheckPasswd(pBox)) 939*cdf0e10cSrcweir return 0; 940*cdf0e10cSrcweir pBox->EnableTriState( sal_False ); 941*cdf0e10cSrcweir SvLBoxEntry* pEntry=aTree.FirstSelected(); 942*cdf0e10cSrcweir DBG_ASSERT(pEntry,"kein Entry gefunden"); 943*cdf0e10cSrcweir sal_Bool bCheck = STATE_CHECK == pBox->GetState(); 944*cdf0e10cSrcweir while( pEntry ) 945*cdf0e10cSrcweir { 946*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); 947*cdf0e10cSrcweir pRepr->GetSectionData().SetProtectFlag(bCheck); 948*cdf0e10cSrcweir Image aImage = BuildBitmap( bCheck, 949*cdf0e10cSrcweir STATE_CHECK == aHideCB.GetState(), sal_False); 950*cdf0e10cSrcweir aTree.SetExpandedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL); 951*cdf0e10cSrcweir aTree.SetCollapsedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL); 952*cdf0e10cSrcweir Image aHCImg = BuildBitmap( bCheck, STATE_CHECK == aHideCB.GetState(), sal_True); 953*cdf0e10cSrcweir aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); 954*cdf0e10cSrcweir aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); 955*cdf0e10cSrcweir pEntry = aTree.NextSelected(pEntry); 956*cdf0e10cSrcweir } 957*cdf0e10cSrcweir aPasswdCB.Enable(bCheck); 958*cdf0e10cSrcweir aPasswdPB.Enable(bCheck); 959*cdf0e10cSrcweir return 0; 960*cdf0e10cSrcweir } 961*cdf0e10cSrcweir /*--------------------------------------------------------------------- 962*cdf0e10cSrcweir Beschreibung: Toggle hide 963*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 964*cdf0e10cSrcweir 965*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, ChangeHideHdl, TriStateBox *, pBox ) 966*cdf0e10cSrcweir { 967*cdf0e10cSrcweir if(!CheckPasswd(pBox)) 968*cdf0e10cSrcweir return 0; 969*cdf0e10cSrcweir pBox->EnableTriState( sal_False ); 970*cdf0e10cSrcweir SvLBoxEntry* pEntry=aTree.FirstSelected(); 971*cdf0e10cSrcweir DBG_ASSERT(pEntry,"kein Entry gefunden"); 972*cdf0e10cSrcweir while( pEntry ) 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); 975*cdf0e10cSrcweir pRepr->GetSectionData().SetHidden(STATE_CHECK == pBox->GetState()); 976*cdf0e10cSrcweir Image aImage = BuildBitmap(STATE_CHECK == aProtectCB.GetState(), 977*cdf0e10cSrcweir STATE_CHECK == pBox->GetState(), sal_False); 978*cdf0e10cSrcweir aTree.SetExpandedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL); 979*cdf0e10cSrcweir aTree.SetCollapsedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL); 980*cdf0e10cSrcweir Image aHCImg = BuildBitmap( STATE_CHECK == aProtectCB.GetState(), 981*cdf0e10cSrcweir STATE_CHECK == pBox->GetState(), sal_True); 982*cdf0e10cSrcweir aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); 983*cdf0e10cSrcweir aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir pEntry = aTree.NextSelected(pEntry); 986*cdf0e10cSrcweir } 987*cdf0e10cSrcweir 988*cdf0e10cSrcweir sal_Bool bHide = STATE_CHECK == pBox->GetState(); 989*cdf0e10cSrcweir aConditionED.Enable(bHide); 990*cdf0e10cSrcweir aConditionFT.Enable(bHide); 991*cdf0e10cSrcweir return 0; 992*cdf0e10cSrcweir } 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir /*--------------------------------------------------------------------- 995*cdf0e10cSrcweir Beschreibung: Toggle edit in readonly 996*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 997*cdf0e10cSrcweir 998*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, ChangeEditInReadonlyHdl, TriStateBox *, pBox ) 999*cdf0e10cSrcweir { 1000*cdf0e10cSrcweir if(!CheckPasswd(pBox)) 1001*cdf0e10cSrcweir return 0; 1002*cdf0e10cSrcweir pBox->EnableTriState( sal_False ); 1003*cdf0e10cSrcweir SvLBoxEntry* pEntry=aTree.FirstSelected(); 1004*cdf0e10cSrcweir DBG_ASSERT(pEntry,"kein Entry gefunden"); 1005*cdf0e10cSrcweir while( pEntry ) 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); 1008*cdf0e10cSrcweir pRepr->GetSectionData().SetEditInReadonlyFlag( 1009*cdf0e10cSrcweir STATE_CHECK == pBox->GetState()); 1010*cdf0e10cSrcweir pEntry = aTree.NextSelected(pEntry); 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir return 0; 1014*cdf0e10cSrcweir } 1015*cdf0e10cSrcweir 1016*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1017*cdf0e10cSrcweir Beschreibung: selektierten Bereich aufheben 1018*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1019*cdf0e10cSrcweir 1020*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, ChangeDismissHdl, CheckBox *, EMPTYARG ) 1021*cdf0e10cSrcweir { 1022*cdf0e10cSrcweir if(!CheckPasswd()) 1023*cdf0e10cSrcweir return 0; 1024*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.FirstSelected(); 1025*cdf0e10cSrcweir SvLBoxEntry* pChild; 1026*cdf0e10cSrcweir SvLBoxEntry* pParent; 1027*cdf0e10cSrcweir //zuerst alle selektierten markieren 1028*cdf0e10cSrcweir while(pEntry) 1029*cdf0e10cSrcweir { 1030*cdf0e10cSrcweir const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); 1031*cdf0e10cSrcweir pSectRepr->SetSelected(); 1032*cdf0e10cSrcweir pEntry = aTree.NextSelected(pEntry); 1033*cdf0e10cSrcweir } 1034*cdf0e10cSrcweir pEntry = aTree.FirstSelected(); 1035*cdf0e10cSrcweir // dann loeschen 1036*cdf0e10cSrcweir while(pEntry) 1037*cdf0e10cSrcweir { 1038*cdf0e10cSrcweir const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); 1039*cdf0e10cSrcweir SvLBoxEntry* pRemove = 0; 1040*cdf0e10cSrcweir sal_Bool bRestart = sal_False; 1041*cdf0e10cSrcweir if(pSectRepr->IsSelected()) 1042*cdf0e10cSrcweir { 1043*cdf0e10cSrcweir aSectReprArr.Insert( pSectRepr ); 1044*cdf0e10cSrcweir while( (pChild = aTree.FirstChild(pEntry) )!= 0 ) 1045*cdf0e10cSrcweir { 1046*cdf0e10cSrcweir //durch das Umhaengen muss wieder am Anfang aufgesetzt werden 1047*cdf0e10cSrcweir bRestart = sal_True; 1048*cdf0e10cSrcweir pParent=aTree.GetParent(pEntry); 1049*cdf0e10cSrcweir aTree.GetModel()->Move(pChild, pParent, aTree.GetModel()->GetRelPos(pEntry)); 1050*cdf0e10cSrcweir } 1051*cdf0e10cSrcweir pRemove = pEntry; 1052*cdf0e10cSrcweir } 1053*cdf0e10cSrcweir if(bRestart) 1054*cdf0e10cSrcweir pEntry = aTree.First(); 1055*cdf0e10cSrcweir else 1056*cdf0e10cSrcweir pEntry = aTree.Next(pEntry); 1057*cdf0e10cSrcweir if(pRemove) 1058*cdf0e10cSrcweir aTree.GetModel()->Remove( pRemove ); 1059*cdf0e10cSrcweir } 1060*cdf0e10cSrcweir 1061*cdf0e10cSrcweir if ( (pEntry=aTree.FirstSelected()) == 0 ) 1062*cdf0e10cSrcweir { 1063*cdf0e10cSrcweir aConditionFT. Enable(sal_False); 1064*cdf0e10cSrcweir aConditionED. Enable(sal_False); 1065*cdf0e10cSrcweir aDismiss. Enable(sal_False); 1066*cdf0e10cSrcweir aCurName. Enable(sal_False); 1067*cdf0e10cSrcweir aProtectCB. Enable(sal_False); 1068*cdf0e10cSrcweir aPasswdCB. Enable(sal_False); 1069*cdf0e10cSrcweir aHideCB. Enable(sal_False); 1070*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 1071*cdf0e10cSrcweir aEditInReadonlyCB.Enable(sal_False); 1072*cdf0e10cSrcweir aEditInReadonlyCB.SetState(STATE_NOCHECK); 1073*cdf0e10cSrcweir // <-- 1074*cdf0e10cSrcweir aProtectCB. SetState(STATE_NOCHECK); 1075*cdf0e10cSrcweir aPasswdCB. Check(sal_False); 1076*cdf0e10cSrcweir aHideCB. SetState(STATE_NOCHECK); 1077*cdf0e10cSrcweir aFileCB. Check(sal_False); 1078*cdf0e10cSrcweir //sonst liegt der Focus auf dem HelpButton 1079*cdf0e10cSrcweir aOK.GrabFocus(); 1080*cdf0e10cSrcweir UseFileHdl(&aFileCB); 1081*cdf0e10cSrcweir } 1082*cdf0e10cSrcweir return 0; 1083*cdf0e10cSrcweir } 1084*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1085*cdf0e10cSrcweir Beschreibung: CheckBox mit Datei verknuepfen? 1086*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1087*cdf0e10cSrcweir 1088*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, UseFileHdl, CheckBox *, pBox ) 1089*cdf0e10cSrcweir { 1090*cdf0e10cSrcweir if(!CheckPasswd(pBox)) 1091*cdf0e10cSrcweir return 0; 1092*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.FirstSelected(); 1093*cdf0e10cSrcweir pBox->EnableTriState(sal_False); 1094*cdf0e10cSrcweir sal_Bool bMulti = 1 < aTree.GetSelectionCount(); 1095*cdf0e10cSrcweir sal_Bool bFile = pBox->IsChecked(); 1096*cdf0e10cSrcweir if(pEntry) 1097*cdf0e10cSrcweir { 1098*cdf0e10cSrcweir while(pEntry) 1099*cdf0e10cSrcweir { 1100*cdf0e10cSrcweir const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); 1101*cdf0e10cSrcweir sal_Bool bContent = pSectRepr->IsContent(); 1102*cdf0e10cSrcweir if( pBox->IsChecked() && bContent && rSh.HasSelection() ) 1103*cdf0e10cSrcweir { 1104*cdf0e10cSrcweir if( RET_NO == QueryBox( this, SW_RES(QB_CONNECT) ).Execute() ) 1105*cdf0e10cSrcweir pBox->Check( sal_False ); 1106*cdf0e10cSrcweir } 1107*cdf0e10cSrcweir if( bFile ) 1108*cdf0e10cSrcweir pSectRepr->SetContent(sal_False); 1109*cdf0e10cSrcweir else 1110*cdf0e10cSrcweir { 1111*cdf0e10cSrcweir pSectRepr->SetFile(aEmptyStr); 1112*cdf0e10cSrcweir pSectRepr->SetSubRegion(aEmptyStr); 1113*cdf0e10cSrcweir pSectRepr->GetSectionData().SetLinkFilePassword(aEmptyStr); 1114*cdf0e10cSrcweir } 1115*cdf0e10cSrcweir 1116*cdf0e10cSrcweir pEntry = aTree.NextSelected(pEntry); 1117*cdf0e10cSrcweir } 1118*cdf0e10cSrcweir aFileNameFT.Enable(bFile && ! bMulti); 1119*cdf0e10cSrcweir aFileNameED.Enable(bFile && ! bMulti); 1120*cdf0e10cSrcweir aFilePB.Enable(bFile && ! bMulti); 1121*cdf0e10cSrcweir aSubRegionED.Enable(bFile && ! bMulti); 1122*cdf0e10cSrcweir aSubRegionFT.Enable(bFile && ! bMulti); 1123*cdf0e10cSrcweir aDDECommandFT.Enable(bFile && ! bMulti); 1124*cdf0e10cSrcweir aDDECB.Enable(bFile && ! bMulti); 1125*cdf0e10cSrcweir if( bFile ) 1126*cdf0e10cSrcweir { 1127*cdf0e10cSrcweir aProtectCB.SetState(STATE_CHECK); 1128*cdf0e10cSrcweir aFileNameED.GrabFocus(); 1129*cdf0e10cSrcweir 1130*cdf0e10cSrcweir } 1131*cdf0e10cSrcweir else 1132*cdf0e10cSrcweir { 1133*cdf0e10cSrcweir aDDECB.Check(sal_False); 1134*cdf0e10cSrcweir DDEHdl(&aDDECB); 1135*cdf0e10cSrcweir // aFileNameED.SetText(aEmptyStr); 1136*cdf0e10cSrcweir aSubRegionED.SetText(aEmptyStr); 1137*cdf0e10cSrcweir } 1138*cdf0e10cSrcweir } 1139*cdf0e10cSrcweir else 1140*cdf0e10cSrcweir { 1141*cdf0e10cSrcweir pBox->Check(sal_False); 1142*cdf0e10cSrcweir pBox->Enable(sal_False); 1143*cdf0e10cSrcweir aFilePB.Enable(sal_False); 1144*cdf0e10cSrcweir aFileNameED.Enable(sal_False); 1145*cdf0e10cSrcweir aFileNameFT.Enable(sal_False); 1146*cdf0e10cSrcweir aSubRegionED.Enable(sal_False); 1147*cdf0e10cSrcweir aSubRegionFT.Enable(sal_False); 1148*cdf0e10cSrcweir aDDECB.Check(sal_False); 1149*cdf0e10cSrcweir aDDECB.Enable(sal_False); 1150*cdf0e10cSrcweir aDDECommandFT.Enable(sal_False); 1151*cdf0e10cSrcweir } 1152*cdf0e10cSrcweir return 0; 1153*cdf0e10cSrcweir } 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1156*cdf0e10cSrcweir Beschreibung: Dialog Datei einfuegen rufen 1157*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1158*cdf0e10cSrcweir 1159*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, FileSearchHdl, PushButton *, EMPTYARG ) 1160*cdf0e10cSrcweir { 1161*cdf0e10cSrcweir if(!CheckPasswd(0)) 1162*cdf0e10cSrcweir return 0; 1163*cdf0e10cSrcweir 1164*cdf0e10cSrcweir m_pOldDefDlgParent = Application::GetDefDialogParent(); 1165*cdf0e10cSrcweir Application::SetDefDialogParent( this ); 1166*cdf0e10cSrcweir if ( m_pDocInserter ) 1167*cdf0e10cSrcweir delete m_pDocInserter; 1168*cdf0e10cSrcweir m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") ); 1169*cdf0e10cSrcweir m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) ); 1170*cdf0e10cSrcweir return 0; 1171*cdf0e10cSrcweir } 1172*cdf0e10cSrcweir 1173*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1174*cdf0e10cSrcweir Beschreibung: 1175*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1176*cdf0e10cSrcweir 1177*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, OptionsHdl, PushButton *, EMPTYARG ) 1178*cdf0e10cSrcweir { 1179*cdf0e10cSrcweir if(!CheckPasswd()) 1180*cdf0e10cSrcweir return 0; 1181*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.FirstSelected(); 1182*cdf0e10cSrcweir 1183*cdf0e10cSrcweir if(pEntry) 1184*cdf0e10cSrcweir { 1185*cdf0e10cSrcweir SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); 1186*cdf0e10cSrcweir SfxItemSet aSet(rSh.GetView().GetPool(), 1187*cdf0e10cSrcweir RES_COL, RES_COL, 1188*cdf0e10cSrcweir RES_COLUMNBALANCE, RES_FRAMEDIR, 1189*cdf0e10cSrcweir RES_BACKGROUND, RES_BACKGROUND, 1190*cdf0e10cSrcweir RES_FRM_SIZE, RES_FRM_SIZE, 1191*cdf0e10cSrcweir SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, 1192*cdf0e10cSrcweir RES_LR_SPACE, RES_LR_SPACE, 1193*cdf0e10cSrcweir RES_FTN_AT_TXTEND, RES_END_AT_TXTEND, 1194*cdf0e10cSrcweir 0); 1195*cdf0e10cSrcweir 1196*cdf0e10cSrcweir aSet.Put( pSectRepr->GetCol() ); 1197*cdf0e10cSrcweir aSet.Put( pSectRepr->GetBackground() ); 1198*cdf0e10cSrcweir aSet.Put( pSectRepr->GetFtnNtAtEnd() ); 1199*cdf0e10cSrcweir aSet.Put( pSectRepr->GetEndNtAtEnd() ); 1200*cdf0e10cSrcweir aSet.Put( pSectRepr->GetBalance() ); 1201*cdf0e10cSrcweir aSet.Put( pSectRepr->GetFrmDir() ); 1202*cdf0e10cSrcweir aSet.Put( pSectRepr->GetLRSpace() ); 1203*cdf0e10cSrcweir 1204*cdf0e10cSrcweir const SwSectionFmts& rDocFmts = rSh.GetDoc()->GetSections(); 1205*cdf0e10cSrcweir SwSectionFmts aOrigArray( 0, 5 ); 1206*cdf0e10cSrcweir aOrigArray.Insert( &rDocFmts, 0 ); 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir SwSectionFmt* pFmt = aOrigArray[pSectRepr->GetArrPos()]; 1209*cdf0e10cSrcweir long nWidth = rSh.GetSectionWidth(*pFmt); 1210*cdf0e10cSrcweir aOrigArray.Remove( 0, aOrigArray.Count() ); 1211*cdf0e10cSrcweir if (!nWidth) 1212*cdf0e10cSrcweir nWidth = USHRT_MAX; 1213*cdf0e10cSrcweir 1214*cdf0e10cSrcweir aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth)); 1215*cdf0e10cSrcweir aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); 1216*cdf0e10cSrcweir 1217*cdf0e10cSrcweir SwSectionPropertyTabDialog aTabDlg(this, aSet, rSh); 1218*cdf0e10cSrcweir if(RET_OK == aTabDlg.Execute()) 1219*cdf0e10cSrcweir { 1220*cdf0e10cSrcweir const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet(); 1221*cdf0e10cSrcweir if( pOutSet && pOutSet->Count() ) 1222*cdf0e10cSrcweir { 1223*cdf0e10cSrcweir const SfxPoolItem *pColItem, *pBrushItem, 1224*cdf0e10cSrcweir *pFtnItem, *pEndItem, *pBalanceItem, 1225*cdf0e10cSrcweir *pFrmDirItem, *pLRSpaceItem; 1226*cdf0e10cSrcweir SfxItemState eColState = pOutSet->GetItemState( 1227*cdf0e10cSrcweir RES_COL, sal_False, &pColItem ); 1228*cdf0e10cSrcweir SfxItemState eBrushState = pOutSet->GetItemState( 1229*cdf0e10cSrcweir RES_BACKGROUND, sal_False, &pBrushItem ); 1230*cdf0e10cSrcweir SfxItemState eFtnState = pOutSet->GetItemState( 1231*cdf0e10cSrcweir RES_FTN_AT_TXTEND, sal_False, &pFtnItem ); 1232*cdf0e10cSrcweir SfxItemState eEndState = pOutSet->GetItemState( 1233*cdf0e10cSrcweir RES_END_AT_TXTEND, sal_False, &pEndItem ); 1234*cdf0e10cSrcweir SfxItemState eBalanceState = pOutSet->GetItemState( 1235*cdf0e10cSrcweir RES_COLUMNBALANCE, sal_False, &pBalanceItem ); 1236*cdf0e10cSrcweir SfxItemState eFrmDirState = pOutSet->GetItemState( 1237*cdf0e10cSrcweir RES_FRAMEDIR, sal_False, &pFrmDirItem ); 1238*cdf0e10cSrcweir SfxItemState eLRState = pOutSet->GetItemState( 1239*cdf0e10cSrcweir RES_LR_SPACE, sal_False, &pLRSpaceItem); 1240*cdf0e10cSrcweir 1241*cdf0e10cSrcweir if( SFX_ITEM_SET == eColState || 1242*cdf0e10cSrcweir SFX_ITEM_SET == eBrushState || 1243*cdf0e10cSrcweir SFX_ITEM_SET == eFtnState || 1244*cdf0e10cSrcweir SFX_ITEM_SET == eEndState || 1245*cdf0e10cSrcweir SFX_ITEM_SET == eBalanceState|| 1246*cdf0e10cSrcweir SFX_ITEM_SET == eFrmDirState|| 1247*cdf0e10cSrcweir SFX_ITEM_SET == eLRState) 1248*cdf0e10cSrcweir { 1249*cdf0e10cSrcweir SvLBoxEntry* pSelEntry = aTree.FirstSelected(); 1250*cdf0e10cSrcweir while( pSelEntry ) 1251*cdf0e10cSrcweir { 1252*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr)pSelEntry->GetUserData(); 1253*cdf0e10cSrcweir if( SFX_ITEM_SET == eColState ) 1254*cdf0e10cSrcweir pRepr->GetCol() = *(SwFmtCol*)pColItem; 1255*cdf0e10cSrcweir if( SFX_ITEM_SET == eBrushState ) 1256*cdf0e10cSrcweir pRepr->GetBackground() = *(SvxBrushItem*)pBrushItem; 1257*cdf0e10cSrcweir if( SFX_ITEM_SET == eFtnState ) 1258*cdf0e10cSrcweir pRepr->GetFtnNtAtEnd() = *(SwFmtFtnAtTxtEnd*)pFtnItem; 1259*cdf0e10cSrcweir if( SFX_ITEM_SET == eEndState ) 1260*cdf0e10cSrcweir pRepr->GetEndNtAtEnd() = *(SwFmtEndAtTxtEnd*)pEndItem; 1261*cdf0e10cSrcweir if( SFX_ITEM_SET == eBalanceState ) 1262*cdf0e10cSrcweir pRepr->GetBalance().SetValue(((SwFmtNoBalancedColumns*)pBalanceItem)->GetValue()); 1263*cdf0e10cSrcweir if( SFX_ITEM_SET == eFrmDirState ) 1264*cdf0e10cSrcweir pRepr->GetFrmDir().SetValue(((SvxFrameDirectionItem*)pFrmDirItem)->GetValue()); 1265*cdf0e10cSrcweir if( SFX_ITEM_SET == eLRState ) 1266*cdf0e10cSrcweir pRepr->GetLRSpace() = *(SvxLRSpaceItem*)pLRSpaceItem; 1267*cdf0e10cSrcweir 1268*cdf0e10cSrcweir pSelEntry = aTree.NextSelected(pSelEntry); 1269*cdf0e10cSrcweir } 1270*cdf0e10cSrcweir } 1271*cdf0e10cSrcweir } 1272*cdf0e10cSrcweir } 1273*cdf0e10cSrcweir } 1274*cdf0e10cSrcweir 1275*cdf0e10cSrcweir return 0; 1276*cdf0e10cSrcweir } 1277*cdf0e10cSrcweir 1278*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1279*cdf0e10cSrcweir Beschreibung: Uebernahme des Dateinamen oder 1280*cdf0e10cSrcweir des verknuepften Bereichs 1281*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1282*cdf0e10cSrcweir 1283*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, FileNameHdl, Edit *, pEdit ) 1284*cdf0e10cSrcweir { 1285*cdf0e10cSrcweir Selection aSelect = pEdit->GetSelection(); 1286*cdf0e10cSrcweir if(!CheckPasswd()) 1287*cdf0e10cSrcweir return 0; 1288*cdf0e10cSrcweir pEdit->SetSelection(aSelect); 1289*cdf0e10cSrcweir SvLBoxEntry* pEntry=aTree.FirstSelected(); 1290*cdf0e10cSrcweir DBG_ASSERT(pEntry,"kein Entry gefunden"); 1291*cdf0e10cSrcweir SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); 1292*cdf0e10cSrcweir if(pEdit == &aFileNameED) 1293*cdf0e10cSrcweir { 1294*cdf0e10cSrcweir bSubRegionsFilled = false; 1295*cdf0e10cSrcweir aSubRegionED.Clear(); 1296*cdf0e10cSrcweir if( aDDECB.IsChecked() ) 1297*cdf0e10cSrcweir { 1298*cdf0e10cSrcweir String sLink( pEdit->GetText() ); 1299*cdf0e10cSrcweir sal_uInt16 nPos = 0; 1300*cdf0e10cSrcweir while( STRING_NOTFOUND != (nPos = sLink.SearchAscii( " ", nPos )) ) 1301*cdf0e10cSrcweir sLink.Erase( nPos--, 1 ); 1302*cdf0e10cSrcweir 1303*cdf0e10cSrcweir nPos = sLink.SearchAndReplace( ' ', sfx2::cTokenSeperator ); 1304*cdf0e10cSrcweir sLink.SearchAndReplace( ' ', sfx2::cTokenSeperator, nPos ); 1305*cdf0e10cSrcweir 1306*cdf0e10cSrcweir pSectRepr->GetSectionData().SetLinkFileName( sLink ); 1307*cdf0e10cSrcweir pSectRepr->GetSectionData().SetType( DDE_LINK_SECTION ); 1308*cdf0e10cSrcweir } 1309*cdf0e10cSrcweir else 1310*cdf0e10cSrcweir { 1311*cdf0e10cSrcweir String sTmp(pEdit->GetText()); 1312*cdf0e10cSrcweir if(sTmp.Len()) 1313*cdf0e10cSrcweir { 1314*cdf0e10cSrcweir SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); 1315*cdf0e10cSrcweir INetURLObject aAbs; 1316*cdf0e10cSrcweir if( pMedium ) 1317*cdf0e10cSrcweir aAbs = pMedium->GetURLObject(); 1318*cdf0e10cSrcweir sTmp = URIHelper::SmartRel2Abs( 1319*cdf0e10cSrcweir aAbs, sTmp, URIHelper::GetMaybeFileHdl() ); 1320*cdf0e10cSrcweir } 1321*cdf0e10cSrcweir pSectRepr->SetFile( sTmp ); 1322*cdf0e10cSrcweir pSectRepr->GetSectionData().SetLinkFilePassword( aEmptyStr ); 1323*cdf0e10cSrcweir } 1324*cdf0e10cSrcweir } 1325*cdf0e10cSrcweir else 1326*cdf0e10cSrcweir { 1327*cdf0e10cSrcweir pSectRepr->SetSubRegion( pEdit->GetText() ); 1328*cdf0e10cSrcweir } 1329*cdf0e10cSrcweir return 0; 1330*cdf0e10cSrcweir } 1331*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1332*cdf0e10cSrcweir Beschreibung: 1333*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1334*cdf0e10cSrcweir 1335*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, DDEHdl, CheckBox*, pBox ) 1336*cdf0e10cSrcweir { 1337*cdf0e10cSrcweir if(!CheckPasswd(pBox)) 1338*cdf0e10cSrcweir return 0; 1339*cdf0e10cSrcweir SvLBoxEntry* pEntry=aTree.FirstSelected(); 1340*cdf0e10cSrcweir if(pEntry) 1341*cdf0e10cSrcweir { 1342*cdf0e10cSrcweir sal_Bool bFile = aFileCB.IsChecked(); 1343*cdf0e10cSrcweir SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); 1344*cdf0e10cSrcweir SwSectionData & rData( pSectRepr->GetSectionData() ); 1345*cdf0e10cSrcweir sal_Bool bDDE = pBox->IsChecked(); 1346*cdf0e10cSrcweir if(bDDE) 1347*cdf0e10cSrcweir { 1348*cdf0e10cSrcweir aFileNameFT.Hide(); 1349*cdf0e10cSrcweir aDDECommandFT.Enable(); 1350*cdf0e10cSrcweir aDDECommandFT.Show(); 1351*cdf0e10cSrcweir aSubRegionFT.Hide(); 1352*cdf0e10cSrcweir aSubRegionED.Hide(); 1353*cdf0e10cSrcweir if (FILE_LINK_SECTION == rData.GetType()) 1354*cdf0e10cSrcweir { 1355*cdf0e10cSrcweir pSectRepr->SetFile(aEmptyStr); 1356*cdf0e10cSrcweir aFileNameED.SetText(aEmptyStr); 1357*cdf0e10cSrcweir rData.SetLinkFilePassword( aEmptyStr ); 1358*cdf0e10cSrcweir } 1359*cdf0e10cSrcweir rData.SetType(DDE_LINK_SECTION); 1360*cdf0e10cSrcweir aFileNameED.SetAccessibleName(aDDECommandFT.GetText()); 1361*cdf0e10cSrcweir } 1362*cdf0e10cSrcweir else 1363*cdf0e10cSrcweir { 1364*cdf0e10cSrcweir aDDECommandFT.Hide(); 1365*cdf0e10cSrcweir aFileNameFT.Enable(bFile); 1366*cdf0e10cSrcweir aFileNameFT.Show(); 1367*cdf0e10cSrcweir aSubRegionED.Show(); 1368*cdf0e10cSrcweir aSubRegionFT.Show(); 1369*cdf0e10cSrcweir aSubRegionED.Enable(bFile); 1370*cdf0e10cSrcweir aSubRegionFT.Enable(bFile); 1371*cdf0e10cSrcweir aSubRegionED.Enable(bFile); 1372*cdf0e10cSrcweir if (DDE_LINK_SECTION == rData.GetType()) 1373*cdf0e10cSrcweir { 1374*cdf0e10cSrcweir rData.SetType(FILE_LINK_SECTION); 1375*cdf0e10cSrcweir pSectRepr->SetFile(aEmptyStr); 1376*cdf0e10cSrcweir rData.SetLinkFilePassword( aEmptyStr ); 1377*cdf0e10cSrcweir aFileNameED.SetText(aEmptyStr); 1378*cdf0e10cSrcweir } 1379*cdf0e10cSrcweir aFileNameED.SetAccessibleName(aFileNameFT.GetText()); 1380*cdf0e10cSrcweir } 1381*cdf0e10cSrcweir aFilePB.Enable(bFile && !bDDE); 1382*cdf0e10cSrcweir } 1383*cdf0e10cSrcweir return 0; 1384*cdf0e10cSrcweir } 1385*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1386*cdf0e10cSrcweir 1387*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1388*cdf0e10cSrcweir 1389*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox ) 1390*cdf0e10cSrcweir { 1391*cdf0e10cSrcweir sal_Bool bChange = pBox == &aPasswdPB; 1392*cdf0e10cSrcweir if(!CheckPasswd(0)) 1393*cdf0e10cSrcweir { 1394*cdf0e10cSrcweir if(!bChange) 1395*cdf0e10cSrcweir aPasswdCB.Check(!aPasswdCB.IsChecked()); 1396*cdf0e10cSrcweir return 0; 1397*cdf0e10cSrcweir } 1398*cdf0e10cSrcweir SvLBoxEntry* pEntry=aTree.FirstSelected(); 1399*cdf0e10cSrcweir sal_Bool bSet = bChange ? bChange : aPasswdCB.IsChecked(); 1400*cdf0e10cSrcweir DBG_ASSERT(pEntry,"kein Entry gefunden"); 1401*cdf0e10cSrcweir while( pEntry ) 1402*cdf0e10cSrcweir { 1403*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData(); 1404*cdf0e10cSrcweir if(bSet) 1405*cdf0e10cSrcweir { 1406*cdf0e10cSrcweir if(!pRepr->GetTempPasswd().getLength() || bChange) 1407*cdf0e10cSrcweir { 1408*cdf0e10cSrcweir SwTestPasswdDlg aPasswdDlg(this); 1409*cdf0e10cSrcweir aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); 1410*cdf0e10cSrcweir if(RET_OK == aPasswdDlg.Execute()) 1411*cdf0e10cSrcweir { 1412*cdf0e10cSrcweir String sNewPasswd( aPasswdDlg.GetPassword() ); 1413*cdf0e10cSrcweir if( aPasswdDlg.GetConfirm() == sNewPasswd ) 1414*cdf0e10cSrcweir { 1415*cdf0e10cSrcweir SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd ); 1416*cdf0e10cSrcweir } 1417*cdf0e10cSrcweir else 1418*cdf0e10cSrcweir { 1419*cdf0e10cSrcweir InfoBox(pBox, SW_RES(REG_WRONG_PASSWD_REPEAT)).Execute(); 1420*cdf0e10cSrcweir ChangePasswdHdl(pBox); 1421*cdf0e10cSrcweir break; 1422*cdf0e10cSrcweir } 1423*cdf0e10cSrcweir } 1424*cdf0e10cSrcweir else 1425*cdf0e10cSrcweir { 1426*cdf0e10cSrcweir if(!bChange) 1427*cdf0e10cSrcweir aPasswdCB.Check(sal_False); 1428*cdf0e10cSrcweir break; 1429*cdf0e10cSrcweir } 1430*cdf0e10cSrcweir } 1431*cdf0e10cSrcweir pRepr->GetSectionData().SetPassword(pRepr->GetTempPasswd()); 1432*cdf0e10cSrcweir } 1433*cdf0e10cSrcweir else 1434*cdf0e10cSrcweir { 1435*cdf0e10cSrcweir pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >()); 1436*cdf0e10cSrcweir } 1437*cdf0e10cSrcweir pEntry = aTree.NextSelected(pEntry); 1438*cdf0e10cSrcweir } 1439*cdf0e10cSrcweir return 0; 1440*cdf0e10cSrcweir } 1441*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1442*cdf0e10cSrcweir Beschreibung: Aktueller Bereichsname wird sofort beim editieren 1443*cdf0e10cSrcweir in die TreeListBox eingetragen, mit leerem String 1444*cdf0e10cSrcweir kein Ok() 1445*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1446*cdf0e10cSrcweir 1447*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, NameEditHdl, Edit *, EMPTYARG ) 1448*cdf0e10cSrcweir { 1449*cdf0e10cSrcweir if(!CheckPasswd(0)) 1450*cdf0e10cSrcweir return 0; 1451*cdf0e10cSrcweir SvLBoxEntry* pEntry=aTree.FirstSelected(); 1452*cdf0e10cSrcweir DBG_ASSERT(pEntry,"kein Entry gefunden"); 1453*cdf0e10cSrcweir if (pEntry) 1454*cdf0e10cSrcweir { 1455*cdf0e10cSrcweir String aName = aCurName.GetText(); 1456*cdf0e10cSrcweir aTree.SetEntryText(pEntry,aName); 1457*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); 1458*cdf0e10cSrcweir pRepr->GetSectionData().SetSectionName(aName); 1459*cdf0e10cSrcweir 1460*cdf0e10cSrcweir aOK.Enable(aName.Len() != 0); 1461*cdf0e10cSrcweir } 1462*cdf0e10cSrcweir return 0; 1463*cdf0e10cSrcweir } 1464*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1465*cdf0e10cSrcweir 1466*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1467*cdf0e10cSrcweir 1468*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, ConditionEditHdl, Edit *, pEdit ) 1469*cdf0e10cSrcweir { 1470*cdf0e10cSrcweir Selection aSelect = pEdit->GetSelection(); 1471*cdf0e10cSrcweir if(!CheckPasswd(0)) 1472*cdf0e10cSrcweir return 0; 1473*cdf0e10cSrcweir pEdit->SetSelection(aSelect); 1474*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.FirstSelected(); 1475*cdf0e10cSrcweir DBG_ASSERT(pEntry,"kein Entry gefunden"); 1476*cdf0e10cSrcweir while( pEntry ) 1477*cdf0e10cSrcweir { 1478*cdf0e10cSrcweir SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData(); 1479*cdf0e10cSrcweir pRepr->GetSectionData().SetCondition(pEdit->GetText()); 1480*cdf0e10cSrcweir pEntry = aTree.NextSelected(pEntry); 1481*cdf0e10cSrcweir } 1482*cdf0e10cSrcweir return 0; 1483*cdf0e10cSrcweir } 1484*cdf0e10cSrcweir 1485*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg ) 1486*cdf0e10cSrcweir { 1487*cdf0e10cSrcweir String sFileName, sFilterName, sPassword; 1488*cdf0e10cSrcweir if ( _pFileDlg->GetError() == ERRCODE_NONE ) 1489*cdf0e10cSrcweir { 1490*cdf0e10cSrcweir SfxMedium* pMedium = m_pDocInserter->CreateMedium(); 1491*cdf0e10cSrcweir if ( pMedium ) 1492*cdf0e10cSrcweir { 1493*cdf0e10cSrcweir sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); 1494*cdf0e10cSrcweir sFilterName = pMedium->GetFilter()->GetFilterName(); 1495*cdf0e10cSrcweir const SfxPoolItem* pItem; 1496*cdf0e10cSrcweir if ( SFX_ITEM_SET == pMedium->GetItemSet()->GetItemState( SID_PASSWORD, sal_False, &pItem ) ) 1497*cdf0e10cSrcweir sPassword = ( (SfxStringItem*)pItem )->GetValue(); 1498*cdf0e10cSrcweir ::lcl_ReadSections( *pMedium, aSubRegionED ); 1499*cdf0e10cSrcweir delete pMedium; 1500*cdf0e10cSrcweir } 1501*cdf0e10cSrcweir } 1502*cdf0e10cSrcweir 1503*cdf0e10cSrcweir SvLBoxEntry* pEntry = aTree.FirstSelected(); 1504*cdf0e10cSrcweir DBG_ASSERT( pEntry, "no entry found" ); 1505*cdf0e10cSrcweir if ( pEntry ) 1506*cdf0e10cSrcweir { 1507*cdf0e10cSrcweir SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); 1508*cdf0e10cSrcweir pSectRepr->SetFile( sFileName ); 1509*cdf0e10cSrcweir pSectRepr->SetFilter( sFilterName ); 1510*cdf0e10cSrcweir pSectRepr->GetSectionData().SetLinkFilePassword(sPassword); 1511*cdf0e10cSrcweir aFileNameED.SetText( pSectRepr->GetFile() ); 1512*cdf0e10cSrcweir } 1513*cdf0e10cSrcweir 1514*cdf0e10cSrcweir Application::SetDefDialogParent( m_pOldDefDlgParent ); 1515*cdf0e10cSrcweir return 0; 1516*cdf0e10cSrcweir } 1517*cdf0e10cSrcweir /*-- 03.09.2009 16:24:18--------------------------------------------------- 1518*cdf0e10cSrcweir 1519*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1520*cdf0e10cSrcweir IMPL_LINK( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent *, pEvent ) 1521*cdf0e10cSrcweir { 1522*cdf0e10cSrcweir if( !bSubRegionsFilled && pEvent && pEvent->GetId() == VCLEVENT_DROPDOWN_PRE_OPEN ) 1523*cdf0e10cSrcweir { 1524*cdf0e10cSrcweir //if necessary fill the names bookmarks/sections/tables now 1525*cdf0e10cSrcweir 1526*cdf0e10cSrcweir rtl::OUString sFileName = aFileNameED.GetText(); 1527*cdf0e10cSrcweir if(sFileName.getLength()) 1528*cdf0e10cSrcweir { 1529*cdf0e10cSrcweir SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); 1530*cdf0e10cSrcweir INetURLObject aAbs; 1531*cdf0e10cSrcweir if( pMedium ) 1532*cdf0e10cSrcweir aAbs = pMedium->GetURLObject(); 1533*cdf0e10cSrcweir sFileName = URIHelper::SmartRel2Abs( 1534*cdf0e10cSrcweir aAbs, sFileName, URIHelper::GetMaybeFileHdl() ); 1535*cdf0e10cSrcweir 1536*cdf0e10cSrcweir //load file and set the shell 1537*cdf0e10cSrcweir SfxMedium aMedium( sFileName, STREAM_STD_READ ); 1538*cdf0e10cSrcweir sFileName = aMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); 1539*cdf0e10cSrcweir ::lcl_ReadSections( aMedium, aSubRegionED ); 1540*cdf0e10cSrcweir } 1541*cdf0e10cSrcweir else 1542*cdf0e10cSrcweir lcl_FillSubRegionList( rSh, aSubRegionED, 0 ); 1543*cdf0e10cSrcweir bSubRegionsFilled = true; 1544*cdf0e10cSrcweir } 1545*cdf0e10cSrcweir return 0; 1546*cdf0e10cSrcweir } 1547*cdf0e10cSrcweir 1548*cdf0e10cSrcweir /* -----------------------------08.05.2002 15:00------------------------------ 1549*cdf0e10cSrcweir 1550*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1551*cdf0e10cSrcweir Image SwEditRegionDlg::BuildBitmap(sal_Bool bProtect,sal_Bool bHidden, sal_Bool bHighContrast) 1552*cdf0e10cSrcweir { 1553*cdf0e10cSrcweir ImageList& rImgLst = bHighContrast ? aImageILH : aImageIL; 1554*cdf0e10cSrcweir return rImgLst.GetImage((!bHidden+(bProtect<<1)) + 1); 1555*cdf0e10cSrcweir } 1556*cdf0e10cSrcweir 1557*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1558*cdf0e10cSrcweir Beschreibung: Hilfsfunktion - Bereichsnamen aus dem Medium lesen 1559*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1560*cdf0e10cSrcweir 1561*cdf0e10cSrcweir static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox ) 1562*cdf0e10cSrcweir { 1563*cdf0e10cSrcweir rBox.Clear(); 1564*cdf0e10cSrcweir uno::Reference < embed::XStorage > xStg; 1565*cdf0e10cSrcweir if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() ) 1566*cdf0e10cSrcweir { 1567*cdf0e10cSrcweir SvStrings aArr( 10, 10 ); 1568*cdf0e10cSrcweir sal_uInt32 nFormat = SotStorage::GetFormatID( xStg ); 1569*cdf0e10cSrcweir if ( nFormat == SOT_FORMATSTR_ID_STARWRITER_60 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_60 || 1570*cdf0e10cSrcweir nFormat == SOT_FORMATSTR_ID_STARWRITER_8 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_8) 1571*cdf0e10cSrcweir SwGetReaderXML()->GetSectionList( rMedium, aArr ); 1572*cdf0e10cSrcweir 1573*cdf0e10cSrcweir for( sal_uInt16 n = 0; n < aArr.Count(); ++n ) 1574*cdf0e10cSrcweir rBox.InsertEntry( *aArr[ n ] ); 1575*cdf0e10cSrcweir 1576*cdf0e10cSrcweir aArr.DeleteAndDestroy(0, aArr.Count()); 1577*cdf0e10cSrcweir } 1578*cdf0e10cSrcweir } 1579*cdf0e10cSrcweir /* -----------------21.05.99 10:16------------------- 1580*cdf0e10cSrcweir * 1581*cdf0e10cSrcweir * --------------------------------------------------*/ 1582*cdf0e10cSrcweir SwInsertSectionTabDialog::SwInsertSectionTabDialog( 1583*cdf0e10cSrcweir Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) : 1584*cdf0e10cSrcweir SfxTabDialog( pParent, SW_RES(DLG_INSERT_SECTION), &rSet ), 1585*cdf0e10cSrcweir rWrtSh(rSh) 1586*cdf0e10cSrcweir , m_pSectionData(0) 1587*cdf0e10cSrcweir { 1588*cdf0e10cSrcweir String sInsert(SW_RES(ST_INSERT)); 1589*cdf0e10cSrcweir GetOKButton().SetText(sInsert); 1590*cdf0e10cSrcweir FreeResource(); 1591*cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 1592*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 1593*cdf0e10cSrcweir AddTabPage(TP_INSERT_SECTION, SwInsertSectionTabPage::Create, 0); 1594*cdf0e10cSrcweir AddTabPage(TP_COLUMN, SwColumnPage::Create, 0); 1595*cdf0e10cSrcweir AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0); 1596*cdf0e10cSrcweir AddTabPage(TP_SECTION_FTNENDNOTES, SwSectionFtnEndTabPage::Create, 0); 1597*cdf0e10cSrcweir AddTabPage(TP_SECTION_INDENTS, SwSectionIndentTabPage::Create, 0); 1598*cdf0e10cSrcweir 1599*cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); 1600*cdf0e10cSrcweir long nHtmlMode = pHtmlOpt->GetExportMode(); 1601*cdf0e10cSrcweir 1602*cdf0e10cSrcweir sal_Bool bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); 1603*cdf0e10cSrcweir if(bWeb) 1604*cdf0e10cSrcweir { 1605*cdf0e10cSrcweir RemoveTabPage(TP_SECTION_FTNENDNOTES); 1606*cdf0e10cSrcweir RemoveTabPage(TP_SECTION_INDENTS); 1607*cdf0e10cSrcweir if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode) 1608*cdf0e10cSrcweir RemoveTabPage(TP_COLUMN); 1609*cdf0e10cSrcweir } 1610*cdf0e10cSrcweir SetCurPageId(TP_INSERT_SECTION); 1611*cdf0e10cSrcweir } 1612*cdf0e10cSrcweir /* -----------------21.05.99 10:17------------------- 1613*cdf0e10cSrcweir * 1614*cdf0e10cSrcweir * --------------------------------------------------*/ 1615*cdf0e10cSrcweir SwInsertSectionTabDialog::~SwInsertSectionTabDialog() 1616*cdf0e10cSrcweir { 1617*cdf0e10cSrcweir } 1618*cdf0e10cSrcweir /* -----------------21.05.99 10:23------------------- 1619*cdf0e10cSrcweir * 1620*cdf0e10cSrcweir * --------------------------------------------------*/ 1621*cdf0e10cSrcweir void SwInsertSectionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) 1622*cdf0e10cSrcweir { 1623*cdf0e10cSrcweir if(TP_INSERT_SECTION == nId) 1624*cdf0e10cSrcweir ((SwInsertSectionTabPage&)rPage).SetWrtShell(rWrtSh); 1625*cdf0e10cSrcweir else if( TP_BACKGROUND == nId ) 1626*cdf0e10cSrcweir { 1627*cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); 1628*cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); 1629*cdf0e10cSrcweir rPage.PageCreated(aSet); 1630*cdf0e10cSrcweir } 1631*cdf0e10cSrcweir else if( TP_COLUMN == nId ) 1632*cdf0e10cSrcweir { 1633*cdf0e10cSrcweir const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)GetInputSetImpl()->Get(RES_FRM_SIZE); 1634*cdf0e10cSrcweir ((SwColumnPage&)rPage).SetPageWidth(rSize.GetWidth()); 1635*cdf0e10cSrcweir ((SwColumnPage&)rPage).ShowBalance(sal_True); 1636*cdf0e10cSrcweir ((SwColumnPage&)rPage).SetInSection(sal_True); 1637*cdf0e10cSrcweir } 1638*cdf0e10cSrcweir else if(TP_SECTION_INDENTS == nId) 1639*cdf0e10cSrcweir ((SwSectionIndentTabPage&)rPage).SetWrtShell(rWrtSh); 1640*cdf0e10cSrcweir } 1641*cdf0e10cSrcweir /* -----------------21.05.99 13:08------------------- 1642*cdf0e10cSrcweir * 1643*cdf0e10cSrcweir * --------------------------------------------------*/ 1644*cdf0e10cSrcweir 1645*cdf0e10cSrcweir void SwInsertSectionTabDialog::SetSectionData(SwSectionData const& rSect) 1646*cdf0e10cSrcweir { 1647*cdf0e10cSrcweir m_pSectionData.reset( new SwSectionData(rSect) ); 1648*cdf0e10cSrcweir } 1649*cdf0e10cSrcweir /* -----------------21.05.99 13:10------------------- 1650*cdf0e10cSrcweir * 1651*cdf0e10cSrcweir * --------------------------------------------------*/ 1652*cdf0e10cSrcweir short SwInsertSectionTabDialog::Ok() 1653*cdf0e10cSrcweir { 1654*cdf0e10cSrcweir short nRet = SfxTabDialog::Ok(); 1655*cdf0e10cSrcweir DBG_ASSERT(m_pSectionData.get(), 1656*cdf0e10cSrcweir "SwInsertSectionTabDialog: no SectionData?"); 1657*cdf0e10cSrcweir const SfxItemSet* pOutputItemSet = GetOutputItemSet(); 1658*cdf0e10cSrcweir rWrtSh.InsertSection(*m_pSectionData, pOutputItemSet); 1659*cdf0e10cSrcweir SfxViewFrame* pViewFrm = rWrtSh.GetView().GetViewFrame(); 1660*cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 1661*cdf0e10cSrcweir pViewFrm->GetBindings().GetRecorder(); 1662*cdf0e10cSrcweir if ( xRecorder.is() ) 1663*cdf0e10cSrcweir { 1664*cdf0e10cSrcweir SfxRequest aRequest( pViewFrm, FN_INSERT_REGION); 1665*cdf0e10cSrcweir const SfxPoolItem* pCol; 1666*cdf0e10cSrcweir if(SFX_ITEM_SET == pOutputItemSet->GetItemState(RES_COL, sal_False, &pCol)) 1667*cdf0e10cSrcweir { 1668*cdf0e10cSrcweir aRequest.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS, 1669*cdf0e10cSrcweir ((const SwFmtCol*)pCol)->GetColumns().Count())); 1670*cdf0e10cSrcweir } 1671*cdf0e10cSrcweir aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_NAME, 1672*cdf0e10cSrcweir m_pSectionData->GetSectionName())); 1673*cdf0e10cSrcweir aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_CONDITION, 1674*cdf0e10cSrcweir m_pSectionData->GetCondition())); 1675*cdf0e10cSrcweir aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_HIDDEN, 1676*cdf0e10cSrcweir m_pSectionData->IsHidden())); 1677*cdf0e10cSrcweir aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_PROTECT, 1678*cdf0e10cSrcweir m_pSectionData->IsProtectFlag())); 1679*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 1680*cdf0e10cSrcweir aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_EDIT_IN_READONLY, 1681*cdf0e10cSrcweir m_pSectionData->IsEditInReadonlyFlag())); 1682*cdf0e10cSrcweir // <-- 1683*cdf0e10cSrcweir 1684*cdf0e10cSrcweir String sLinkFileName( m_pSectionData->GetLinkFileName() ); 1685*cdf0e10cSrcweir aRequest.AppendItem(SfxStringItem( FN_PARAM_1, sLinkFileName.GetToken( 0, sfx2::cTokenSeperator ))); 1686*cdf0e10cSrcweir aRequest.AppendItem(SfxStringItem( FN_PARAM_2, sLinkFileName.GetToken( 1, sfx2::cTokenSeperator ))); 1687*cdf0e10cSrcweir aRequest.AppendItem(SfxStringItem( FN_PARAM_3, sLinkFileName.GetToken( 2, sfx2::cTokenSeperator ))); 1688*cdf0e10cSrcweir aRequest.Done(); 1689*cdf0e10cSrcweir } 1690*cdf0e10cSrcweir return nRet; 1691*cdf0e10cSrcweir } 1692*cdf0e10cSrcweir 1693*cdf0e10cSrcweir /* -----------------21.05.99 10:31------------------- 1694*cdf0e10cSrcweir * 1695*cdf0e10cSrcweir * --------------------------------------------------*/ 1696*cdf0e10cSrcweir SwInsertSectionTabPage::SwInsertSectionTabPage( 1697*cdf0e10cSrcweir Window *pParent, const SfxItemSet &rAttrSet) : 1698*cdf0e10cSrcweir SfxTabPage( pParent, SW_RES(TP_INSERT_SECTION), rAttrSet ), 1699*cdf0e10cSrcweir aNameFL ( this, SW_RES( FL_NAME ) ), 1700*cdf0e10cSrcweir aCurName ( this, SW_RES( ED_RNAME ) ), 1701*cdf0e10cSrcweir aLinkFL ( this, SW_RES( FL_LINK ) ), 1702*cdf0e10cSrcweir aFileCB ( this, SW_RES( CB_FILE ) ), 1703*cdf0e10cSrcweir aDDECB ( this, SW_RES( CB_DDE ) ) , 1704*cdf0e10cSrcweir aDDECommandFT ( this, SW_RES( FT_DDE ) ) , 1705*cdf0e10cSrcweir aFileNameFT ( this, SW_RES( FT_FILE ) ) , 1706*cdf0e10cSrcweir aFileNameED ( this, SW_RES( ED_FILE ) ), 1707*cdf0e10cSrcweir aFilePB ( this, SW_RES( PB_FILE ) ), 1708*cdf0e10cSrcweir aSubRegionFT ( this, SW_RES( FT_SUBREG ) ) , 1709*cdf0e10cSrcweir aSubRegionED ( this, SW_RES( LB_SUBREG ) ) , 1710*cdf0e10cSrcweir 1711*cdf0e10cSrcweir aProtectFL ( this, SW_RES( FL_PROTECT ) ), 1712*cdf0e10cSrcweir aProtectCB ( this, SW_RES( CB_PROTECT ) ), 1713*cdf0e10cSrcweir aPasswdCB ( this, SW_RES( CB_PASSWD ) ), 1714*cdf0e10cSrcweir aPasswdPB ( this, SW_RES( PB_PASSWD ) ), 1715*cdf0e10cSrcweir 1716*cdf0e10cSrcweir aHideFL ( this, SW_RES( FL_HIDE ) ), 1717*cdf0e10cSrcweir aHideCB ( this, SW_RES( CB_HIDE ) ), 1718*cdf0e10cSrcweir aConditionFT ( this, SW_RES( FT_CONDITION ) ), 1719*cdf0e10cSrcweir aConditionED ( this, SW_RES( ED_CONDITION ) ), 1720*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 1721*cdf0e10cSrcweir aPropertiesFL ( this, SW_RES( FL_PROPERTIES ) ), 1722*cdf0e10cSrcweir aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY ) ), 1723*cdf0e10cSrcweir // <-- 1724*cdf0e10cSrcweir 1725*cdf0e10cSrcweir m_pWrtSh(0), 1726*cdf0e10cSrcweir m_pDocInserter(NULL), 1727*cdf0e10cSrcweir m_pOldDefDlgParent(NULL) 1728*cdf0e10cSrcweir { 1729*cdf0e10cSrcweir FreeResource(); 1730*cdf0e10cSrcweir 1731*cdf0e10cSrcweir aProtectCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeProtectHdl)); 1732*cdf0e10cSrcweir aPasswdCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl)); 1733*cdf0e10cSrcweir aPasswdPB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl)); 1734*cdf0e10cSrcweir aHideCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeHideHdl)); 1735*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 1736*cdf0e10cSrcweir aEditInReadonlyCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeEditInReadonlyHdl)); 1737*cdf0e10cSrcweir // <-- 1738*cdf0e10cSrcweir aFileCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, UseFileHdl )); 1739*cdf0e10cSrcweir aFilePB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, FileSearchHdl )); 1740*cdf0e10cSrcweir aCurName.SetModifyHdl ( LINK( this, SwInsertSectionTabPage, NameEditHdl)); 1741*cdf0e10cSrcweir aDDECB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, DDEHdl )); 1742*cdf0e10cSrcweir ChangeProtectHdl(&aProtectCB); 1743*cdf0e10cSrcweir aPasswdPB.SetAccessibleRelationMemberOf(&aProtectFL); 1744*cdf0e10cSrcweir aSubRegionED.EnableAutocomplete( sal_True, sal_True ); 1745*cdf0e10cSrcweir } 1746*cdf0e10cSrcweir /* -----------------21.05.99 10:31------------------- 1747*cdf0e10cSrcweir * 1748*cdf0e10cSrcweir * --------------------------------------------------*/ 1749*cdf0e10cSrcweir SwInsertSectionTabPage::~SwInsertSectionTabPage() 1750*cdf0e10cSrcweir { 1751*cdf0e10cSrcweir delete m_pDocInserter; 1752*cdf0e10cSrcweir } 1753*cdf0e10cSrcweir 1754*cdf0e10cSrcweir void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) 1755*cdf0e10cSrcweir { 1756*cdf0e10cSrcweir m_pWrtSh = &rSh; 1757*cdf0e10cSrcweir 1758*cdf0e10cSrcweir sal_Bool bWeb = 0 != PTR_CAST(SwWebDocShell, m_pWrtSh->GetView().GetDocShell()); 1759*cdf0e10cSrcweir if(bWeb) 1760*cdf0e10cSrcweir { 1761*cdf0e10cSrcweir aHideCB .Hide(); 1762*cdf0e10cSrcweir aConditionED .Hide(); 1763*cdf0e10cSrcweir aConditionFT .Hide(); 1764*cdf0e10cSrcweir aDDECB .Hide(); 1765*cdf0e10cSrcweir aDDECommandFT .Hide(); 1766*cdf0e10cSrcweir } 1767*cdf0e10cSrcweir 1768*cdf0e10cSrcweir lcl_FillSubRegionList( *m_pWrtSh, aSubRegionED, &aCurName ); 1769*cdf0e10cSrcweir 1770*cdf0e10cSrcweir SwSectionData *const pSectionData = 1771*cdf0e10cSrcweir static_cast<SwInsertSectionTabDialog*>(GetTabDialog()) 1772*cdf0e10cSrcweir ->GetSectionData(); 1773*cdf0e10cSrcweir if (pSectionData) // something set? 1774*cdf0e10cSrcweir { 1775*cdf0e10cSrcweir aCurName.SetText( 1776*cdf0e10cSrcweir rSh.GetUniqueSectionName(& pSectionData->GetSectionName())); 1777*cdf0e10cSrcweir aProtectCB.Check( 0 != pSectionData->IsProtectFlag() ); 1778*cdf0e10cSrcweir m_sFileName = pSectionData->GetLinkFileName(); 1779*cdf0e10cSrcweir m_sFilePasswd = pSectionData->GetLinkFilePassword(); 1780*cdf0e10cSrcweir aFileCB.Check( 0 != m_sFileName.Len() ); 1781*cdf0e10cSrcweir aFileNameED.SetText( m_sFileName ); 1782*cdf0e10cSrcweir UseFileHdl( &aFileCB ); 1783*cdf0e10cSrcweir } 1784*cdf0e10cSrcweir else 1785*cdf0e10cSrcweir { 1786*cdf0e10cSrcweir aCurName.SetText( rSh.GetUniqueSectionName() ); 1787*cdf0e10cSrcweir } 1788*cdf0e10cSrcweir } 1789*cdf0e10cSrcweir /* -----------------21.05.99 10:32------------------- 1790*cdf0e10cSrcweir * 1791*cdf0e10cSrcweir * --------------------------------------------------*/ 1792*cdf0e10cSrcweir sal_Bool SwInsertSectionTabPage::FillItemSet( SfxItemSet& ) 1793*cdf0e10cSrcweir { 1794*cdf0e10cSrcweir SwSectionData aSection(CONTENT_SECTION, aCurName.GetText()); 1795*cdf0e10cSrcweir aSection.SetCondition(aConditionED.GetText()); 1796*cdf0e10cSrcweir sal_Bool bProtected = aProtectCB.IsChecked(); 1797*cdf0e10cSrcweir aSection.SetProtectFlag(bProtected); 1798*cdf0e10cSrcweir aSection.SetHidden(aHideCB.IsChecked()); 1799*cdf0e10cSrcweir // --> FME 2004-06-22 #114856# edit in readonly sections 1800*cdf0e10cSrcweir aSection.SetEditInReadonlyFlag(aEditInReadonlyCB.IsChecked()); 1801*cdf0e10cSrcweir // <-- 1802*cdf0e10cSrcweir if(bProtected) 1803*cdf0e10cSrcweir { 1804*cdf0e10cSrcweir aSection.SetPassword(m_aNewPasswd); 1805*cdf0e10cSrcweir } 1806*cdf0e10cSrcweir String sFileName = aFileNameED.GetText(); 1807*cdf0e10cSrcweir String sSubRegion = aSubRegionED.GetText(); 1808*cdf0e10cSrcweir sal_Bool bDDe = aDDECB.IsChecked(); 1809*cdf0e10cSrcweir if(aFileCB.IsChecked() && (sFileName.Len() || sSubRegion.Len() || bDDe)) 1810*cdf0e10cSrcweir { 1811*cdf0e10cSrcweir String aLinkFile; 1812*cdf0e10cSrcweir if( bDDe ) 1813*cdf0e10cSrcweir { 1814*cdf0e10cSrcweir aLinkFile = sFileName; 1815*cdf0e10cSrcweir 1816*cdf0e10cSrcweir sal_uInt16 nPos = 0; 1817*cdf0e10cSrcweir while( STRING_NOTFOUND != (nPos = aLinkFile.SearchAscii( " ", nPos )) ) 1818*cdf0e10cSrcweir aLinkFile.Erase( nPos--, 1 ); 1819*cdf0e10cSrcweir 1820*cdf0e10cSrcweir nPos = aLinkFile.SearchAndReplace( ' ', sfx2::cTokenSeperator ); 1821*cdf0e10cSrcweir aLinkFile.SearchAndReplace( ' ', sfx2::cTokenSeperator, nPos ); 1822*cdf0e10cSrcweir } 1823*cdf0e10cSrcweir else 1824*cdf0e10cSrcweir { 1825*cdf0e10cSrcweir if(sFileName.Len()) 1826*cdf0e10cSrcweir { 1827*cdf0e10cSrcweir SfxMedium* pMedium = m_pWrtSh->GetView().GetDocShell()->GetMedium(); 1828*cdf0e10cSrcweir INetURLObject aAbs; 1829*cdf0e10cSrcweir if( pMedium ) 1830*cdf0e10cSrcweir aAbs = pMedium->GetURLObject(); 1831*cdf0e10cSrcweir aLinkFile = URIHelper::SmartRel2Abs( 1832*cdf0e10cSrcweir aAbs, sFileName, URIHelper::GetMaybeFileHdl() ); 1833*cdf0e10cSrcweir aSection.SetLinkFilePassword( m_sFilePasswd ); 1834*cdf0e10cSrcweir } 1835*cdf0e10cSrcweir 1836*cdf0e10cSrcweir aLinkFile += sfx2::cTokenSeperator; 1837*cdf0e10cSrcweir aLinkFile += m_sFilterName; 1838*cdf0e10cSrcweir aLinkFile += sfx2::cTokenSeperator; 1839*cdf0e10cSrcweir aLinkFile += sSubRegion; 1840*cdf0e10cSrcweir } 1841*cdf0e10cSrcweir 1842*cdf0e10cSrcweir aSection.SetLinkFileName(aLinkFile); 1843*cdf0e10cSrcweir if(aLinkFile.Len()) 1844*cdf0e10cSrcweir { 1845*cdf0e10cSrcweir aSection.SetType( aDDECB.IsChecked() ? 1846*cdf0e10cSrcweir DDE_LINK_SECTION : 1847*cdf0e10cSrcweir FILE_LINK_SECTION); 1848*cdf0e10cSrcweir } 1849*cdf0e10cSrcweir } 1850*cdf0e10cSrcweir ((SwInsertSectionTabDialog*)GetTabDialog())->SetSectionData(aSection); 1851*cdf0e10cSrcweir return sal_True; 1852*cdf0e10cSrcweir } 1853*cdf0e10cSrcweir /* -----------------21.05.99 10:32------------------- 1854*cdf0e10cSrcweir * 1855*cdf0e10cSrcweir * --------------------------------------------------*/ 1856*cdf0e10cSrcweir void SwInsertSectionTabPage::Reset( const SfxItemSet& ) 1857*cdf0e10cSrcweir { 1858*cdf0e10cSrcweir } 1859*cdf0e10cSrcweir /* -----------------21.05.99 11:22------------------- 1860*cdf0e10cSrcweir * 1861*cdf0e10cSrcweir * --------------------------------------------------*/ 1862*cdf0e10cSrcweir SfxTabPage* SwInsertSectionTabPage::Create( Window* pParent, 1863*cdf0e10cSrcweir const SfxItemSet& rAttrSet) 1864*cdf0e10cSrcweir { 1865*cdf0e10cSrcweir return new SwInsertSectionTabPage(pParent, rAttrSet); 1866*cdf0e10cSrcweir } 1867*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1868*cdf0e10cSrcweir 1869*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1870*cdf0e10cSrcweir 1871*cdf0e10cSrcweir IMPL_LINK( SwInsertSectionTabPage, ChangeHideHdl, CheckBox *, pBox ) 1872*cdf0e10cSrcweir { 1873*cdf0e10cSrcweir sal_Bool bHide = pBox->IsChecked(); 1874*cdf0e10cSrcweir aConditionED.Enable(bHide); 1875*cdf0e10cSrcweir aConditionFT.Enable(bHide); 1876*cdf0e10cSrcweir return 0; 1877*cdf0e10cSrcweir } 1878*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1879*cdf0e10cSrcweir 1880*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1881*cdf0e10cSrcweir 1882*cdf0e10cSrcweir IMPL_LINK( SwInsertSectionTabPage, ChangeEditInReadonlyHdl, CheckBox *, EMPTYARG ) 1883*cdf0e10cSrcweir { 1884*cdf0e10cSrcweir return 0; 1885*cdf0e10cSrcweir } 1886*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1887*cdf0e10cSrcweir 1888*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1889*cdf0e10cSrcweir 1890*cdf0e10cSrcweir IMPL_LINK( SwInsertSectionTabPage, ChangeProtectHdl, CheckBox *, pBox ) 1891*cdf0e10cSrcweir { 1892*cdf0e10cSrcweir sal_Bool bCheck = pBox->IsChecked(); 1893*cdf0e10cSrcweir aPasswdCB.Enable(bCheck); 1894*cdf0e10cSrcweir aPasswdPB.Enable(bCheck); 1895*cdf0e10cSrcweir return 0; 1896*cdf0e10cSrcweir } 1897*cdf0e10cSrcweir /* -----------------------------26.04.01 14:50-------------------------------- 1898*cdf0e10cSrcweir 1899*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1900*cdf0e10cSrcweir IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton ) 1901*cdf0e10cSrcweir { 1902*cdf0e10cSrcweir sal_Bool bChange = pButton == &aPasswdPB; 1903*cdf0e10cSrcweir sal_Bool bSet = bChange ? bChange : aPasswdCB.IsChecked(); 1904*cdf0e10cSrcweir if(bSet) 1905*cdf0e10cSrcweir { 1906*cdf0e10cSrcweir if(!m_aNewPasswd.getLength() || bChange) 1907*cdf0e10cSrcweir { 1908*cdf0e10cSrcweir SwTestPasswdDlg aPasswdDlg(this); 1909*cdf0e10cSrcweir aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); 1910*cdf0e10cSrcweir if(RET_OK == aPasswdDlg.Execute()) 1911*cdf0e10cSrcweir { 1912*cdf0e10cSrcweir String sNewPasswd( aPasswdDlg.GetPassword() ); 1913*cdf0e10cSrcweir if( aPasswdDlg.GetConfirm() == sNewPasswd ) 1914*cdf0e10cSrcweir { 1915*cdf0e10cSrcweir SvPasswordHelper::GetHashPassword( m_aNewPasswd, sNewPasswd ); 1916*cdf0e10cSrcweir } 1917*cdf0e10cSrcweir else 1918*cdf0e10cSrcweir { 1919*cdf0e10cSrcweir InfoBox(pButton, SW_RES(REG_WRONG_PASSWD_REPEAT)).Execute(); 1920*cdf0e10cSrcweir } 1921*cdf0e10cSrcweir } 1922*cdf0e10cSrcweir else if(!bChange) 1923*cdf0e10cSrcweir aPasswdCB.Check(sal_False); 1924*cdf0e10cSrcweir } 1925*cdf0e10cSrcweir } 1926*cdf0e10cSrcweir else 1927*cdf0e10cSrcweir m_aNewPasswd.realloc(0); 1928*cdf0e10cSrcweir return 0; 1929*cdf0e10cSrcweir } 1930*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1931*cdf0e10cSrcweir 1932*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1933*cdf0e10cSrcweir 1934*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwInsertSectionTabPage, NameEditHdl, Edit *, EMPTYARG ) 1935*cdf0e10cSrcweir { 1936*cdf0e10cSrcweir String aName=aCurName.GetText(); 1937*cdf0e10cSrcweir GetTabDialog()->GetOKButton().Enable(aName.Len() && aCurName.GetEntryPos( aName ) == USHRT_MAX); 1938*cdf0e10cSrcweir return 0; 1939*cdf0e10cSrcweir } 1940*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwInsertSectionTabPage, NameEditHdl, Edit *, EMPTYARG ) 1941*cdf0e10cSrcweir 1942*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1943*cdf0e10cSrcweir 1944*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1945*cdf0e10cSrcweir 1946*cdf0e10cSrcweir IMPL_LINK( SwInsertSectionTabPage, UseFileHdl, CheckBox *, pBox ) 1947*cdf0e10cSrcweir { 1948*cdf0e10cSrcweir if( pBox->IsChecked() ) 1949*cdf0e10cSrcweir { 1950*cdf0e10cSrcweir if( m_pWrtSh->HasSelection() && 1951*cdf0e10cSrcweir RET_NO == QueryBox( this, SW_RES(QB_CONNECT) ).Execute() ) 1952*cdf0e10cSrcweir pBox->Check( sal_False ); 1953*cdf0e10cSrcweir } 1954*cdf0e10cSrcweir 1955*cdf0e10cSrcweir sal_Bool bFile = pBox->IsChecked(); 1956*cdf0e10cSrcweir aFileNameFT.Enable(bFile); 1957*cdf0e10cSrcweir aFileNameED.Enable(bFile); 1958*cdf0e10cSrcweir aFilePB.Enable(bFile); 1959*cdf0e10cSrcweir aSubRegionFT.Enable(bFile); 1960*cdf0e10cSrcweir aSubRegionED.Enable(bFile); 1961*cdf0e10cSrcweir aDDECommandFT.Enable(bFile); 1962*cdf0e10cSrcweir aDDECB.Enable(bFile); 1963*cdf0e10cSrcweir if( bFile ) 1964*cdf0e10cSrcweir { 1965*cdf0e10cSrcweir // aFileNameED.SetText( aFileName ); 1966*cdf0e10cSrcweir aFileNameED.GrabFocus(); 1967*cdf0e10cSrcweir aProtectCB.Check( sal_True ); 1968*cdf0e10cSrcweir } 1969*cdf0e10cSrcweir else 1970*cdf0e10cSrcweir { 1971*cdf0e10cSrcweir aDDECB.Check(sal_False); 1972*cdf0e10cSrcweir DDEHdl(&aDDECB); 1973*cdf0e10cSrcweir // aFileNameED.SetText(aEmptyStr); 1974*cdf0e10cSrcweir } 1975*cdf0e10cSrcweir return 0; 1976*cdf0e10cSrcweir } 1977*cdf0e10cSrcweir 1978*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1979*cdf0e10cSrcweir 1980*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1981*cdf0e10cSrcweir 1982*cdf0e10cSrcweir IMPL_LINK( SwInsertSectionTabPage, FileSearchHdl, PushButton *, EMPTYARG ) 1983*cdf0e10cSrcweir { 1984*cdf0e10cSrcweir m_pOldDefDlgParent = Application::GetDefDialogParent(); 1985*cdf0e10cSrcweir Application::SetDefDialogParent( this ); 1986*cdf0e10cSrcweir if ( m_pDocInserter ) 1987*cdf0e10cSrcweir delete m_pDocInserter; 1988*cdf0e10cSrcweir m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") ); 1989*cdf0e10cSrcweir m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) ); 1990*cdf0e10cSrcweir return 0; 1991*cdf0e10cSrcweir } 1992*cdf0e10cSrcweir 1993*cdf0e10cSrcweir /*--------------------------------------------------------------------- 1994*cdf0e10cSrcweir 1995*cdf0e10cSrcweir ---------------------------------------------------------------------*/ 1996*cdf0e10cSrcweir 1997*cdf0e10cSrcweir IMPL_LINK( SwInsertSectionTabPage, DDEHdl, CheckBox*, pBox ) 1998*cdf0e10cSrcweir { 1999*cdf0e10cSrcweir sal_Bool bDDE = pBox->IsChecked(); 2000*cdf0e10cSrcweir sal_Bool bFile = aFileCB.IsChecked(); 2001*cdf0e10cSrcweir aFilePB.Enable(!bDDE && bFile); 2002*cdf0e10cSrcweir if(bDDE) 2003*cdf0e10cSrcweir { 2004*cdf0e10cSrcweir aFileNameFT.Hide(); 2005*cdf0e10cSrcweir aDDECommandFT.Enable(bDDE); 2006*cdf0e10cSrcweir aDDECommandFT.Show(); 2007*cdf0e10cSrcweir aSubRegionFT.Hide(); 2008*cdf0e10cSrcweir aSubRegionED.Hide(); 2009*cdf0e10cSrcweir aFileNameED.SetAccessibleName(aDDECommandFT.GetText()); 2010*cdf0e10cSrcweir } 2011*cdf0e10cSrcweir else 2012*cdf0e10cSrcweir { 2013*cdf0e10cSrcweir aDDECommandFT.Hide(); 2014*cdf0e10cSrcweir aFileNameFT.Enable(bFile); 2015*cdf0e10cSrcweir aFileNameFT.Show(); 2016*cdf0e10cSrcweir aSubRegionFT.Show(); 2017*cdf0e10cSrcweir aSubRegionED.Show(); 2018*cdf0e10cSrcweir aSubRegionED.Enable(bFile); 2019*cdf0e10cSrcweir aFileNameED.SetAccessibleName(aFileNameFT.GetText()); 2020*cdf0e10cSrcweir } 2021*cdf0e10cSrcweir return 0; 2022*cdf0e10cSrcweir } 2023*cdf0e10cSrcweir 2024*cdf0e10cSrcweir IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg ) 2025*cdf0e10cSrcweir { 2026*cdf0e10cSrcweir if ( _pFileDlg->GetError() == ERRCODE_NONE ) 2027*cdf0e10cSrcweir { 2028*cdf0e10cSrcweir SfxMedium* pMedium = m_pDocInserter->CreateMedium(); 2029*cdf0e10cSrcweir if ( pMedium ) 2030*cdf0e10cSrcweir { 2031*cdf0e10cSrcweir m_sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); 2032*cdf0e10cSrcweir m_sFilterName = pMedium->GetFilter()->GetFilterName(); 2033*cdf0e10cSrcweir const SfxPoolItem* pItem; 2034*cdf0e10cSrcweir if ( SFX_ITEM_SET == pMedium->GetItemSet()->GetItemState( SID_PASSWORD, sal_False, &pItem ) ) 2035*cdf0e10cSrcweir m_sFilePasswd = ( (SfxStringItem*)pItem )->GetValue(); 2036*cdf0e10cSrcweir aFileNameED.SetText( INetURLObject::decode( 2037*cdf0e10cSrcweir m_sFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_UTF8 ) ); 2038*cdf0e10cSrcweir ::lcl_ReadSections( *pMedium, aSubRegionED ); 2039*cdf0e10cSrcweir delete pMedium; 2040*cdf0e10cSrcweir } 2041*cdf0e10cSrcweir } 2042*cdf0e10cSrcweir else 2043*cdf0e10cSrcweir m_sFilterName = m_sFilePasswd = aEmptyStr; 2044*cdf0e10cSrcweir 2045*cdf0e10cSrcweir Application::SetDefDialogParent( m_pOldDefDlgParent ); 2046*cdf0e10cSrcweir return 0; 2047*cdf0e10cSrcweir } 2048*cdf0e10cSrcweir 2049*cdf0e10cSrcweir // -------------------------------------------------------------- 2050*cdf0e10cSrcweir 2051*cdf0e10cSrcweir // Numerierungsformat Umsetzung: 2052*cdf0e10cSrcweir // ListBox - Format - Enum-Wert 2053*cdf0e10cSrcweir // 0 - A, B, C, ... - 0 2054*cdf0e10cSrcweir // 1 - a, b, c, ... - 1 2055*cdf0e10cSrcweir // 2 - I, II, III, ... - 2 2056*cdf0e10cSrcweir // 3 - i, ii, iii, ... - 3 2057*cdf0e10cSrcweir // 4 - 1, 2, 3, ... - 4 2058*cdf0e10cSrcweir // 5 - A, .., AA, .., - 9 2059*cdf0e10cSrcweir // 6 - a, .., aa, .., - 10 2060*cdf0e10cSrcweir 2061*cdf0e10cSrcweir inline sal_uInt16 GetNumPos( sal_uInt16 n ) 2062*cdf0e10cSrcweir { 2063*cdf0e10cSrcweir return SVX_NUM_ARABIC < n ? n - 4 : n; 2064*cdf0e10cSrcweir } 2065*cdf0e10cSrcweir 2066*cdf0e10cSrcweir inline SvxExtNumType GetNumType( sal_uInt16 n ) 2067*cdf0e10cSrcweir { 2068*cdf0e10cSrcweir return (SvxExtNumType)(4 < n ? n + 4 : n ); 2069*cdf0e10cSrcweir } 2070*cdf0e10cSrcweir 2071*cdf0e10cSrcweir SwSectionFtnEndTabPage::SwSectionFtnEndTabPage( Window *pParent, 2072*cdf0e10cSrcweir const SfxItemSet &rAttrSet) 2073*cdf0e10cSrcweir : SfxTabPage( pParent, SW_RES( TP_SECTION_FTNENDNOTES ), rAttrSet ), 2074*cdf0e10cSrcweir aFtnFL ( this, SW_RES( FL_FTN ) ), 2075*cdf0e10cSrcweir aFtnNtAtTextEndCB ( this, SW_RES( CB_FTN_AT_TXTEND ) ), 2076*cdf0e10cSrcweir 2077*cdf0e10cSrcweir aFtnNtNumCB ( this, SW_RES( CB_FTN_NUM ) ), 2078*cdf0e10cSrcweir aFtnOffsetLbl ( this, SW_RES( FT_FTN_OFFSET )), 2079*cdf0e10cSrcweir aFtnOffsetFld ( this, SW_RES( FLD_FTN_OFFSET )), 2080*cdf0e10cSrcweir 2081*cdf0e10cSrcweir aFtnNtNumFmtCB ( this, SW_RES( CB_FTN_NUM_FMT ) ), 2082*cdf0e10cSrcweir aFtnPrefixFT ( this, SW_RES( FT_FTN_PREFIX )), 2083*cdf0e10cSrcweir aFtnPrefixED ( this, SW_RES( ED_FTN_PREFIX )), 2084*cdf0e10cSrcweir aFtnNumViewBox ( this, SW_RES( LB_FTN_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES), 2085*cdf0e10cSrcweir aFtnSuffixFT ( this, SW_RES( FT_FTN_SUFFIX )), 2086*cdf0e10cSrcweir aFtnSuffixED ( this, SW_RES( ED_FTN_SUFFIX )), 2087*cdf0e10cSrcweir 2088*cdf0e10cSrcweir aEndFL ( this, SW_RES( FL_END ) ), 2089*cdf0e10cSrcweir aEndNtAtTextEndCB ( this, SW_RES( CB_END_AT_TXTEND )), 2090*cdf0e10cSrcweir 2091*cdf0e10cSrcweir aEndNtNumCB ( this, SW_RES( CB_END_NUM )), 2092*cdf0e10cSrcweir aEndOffsetLbl ( this, SW_RES( FT_END_OFFSET )), 2093*cdf0e10cSrcweir aEndOffsetFld ( this, SW_RES( FLD_END_OFFSET )), 2094*cdf0e10cSrcweir 2095*cdf0e10cSrcweir aEndNtNumFmtCB ( this, SW_RES( CB_END_NUM_FMT ) ), 2096*cdf0e10cSrcweir aEndPrefixFT ( this, SW_RES( FT_END_PREFIX )), 2097*cdf0e10cSrcweir aEndPrefixED ( this, SW_RES( ED_END_PREFIX )), 2098*cdf0e10cSrcweir aEndNumViewBox ( this, SW_RES( LB_END_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES), 2099*cdf0e10cSrcweir aEndSuffixFT ( this, SW_RES( FT_END_SUFFIX )), 2100*cdf0e10cSrcweir aEndSuffixED ( this, SW_RES( ED_END_SUFFIX )) 2101*cdf0e10cSrcweir { 2102*cdf0e10cSrcweir FreeResource(); 2103*cdf0e10cSrcweir 2104*cdf0e10cSrcweir Link aLk( LINK( this, SwSectionFtnEndTabPage, FootEndHdl)); 2105*cdf0e10cSrcweir aFtnNtAtTextEndCB.SetClickHdl( aLk ); 2106*cdf0e10cSrcweir aFtnNtNumCB.SetClickHdl( aLk ); 2107*cdf0e10cSrcweir aEndNtAtTextEndCB.SetClickHdl( aLk ); 2108*cdf0e10cSrcweir aEndNtNumCB.SetClickHdl( aLk ); 2109*cdf0e10cSrcweir aFtnNtNumFmtCB.SetClickHdl( aLk ); 2110*cdf0e10cSrcweir aEndNtNumFmtCB.SetClickHdl( aLk ); 2111*cdf0e10cSrcweir } 2112*cdf0e10cSrcweir 2113*cdf0e10cSrcweir SwSectionFtnEndTabPage::~SwSectionFtnEndTabPage() 2114*cdf0e10cSrcweir { 2115*cdf0e10cSrcweir } 2116*cdf0e10cSrcweir 2117*cdf0e10cSrcweir sal_Bool SwSectionFtnEndTabPage::FillItemSet( SfxItemSet& rSet ) 2118*cdf0e10cSrcweir { 2119*cdf0e10cSrcweir SwFmtFtnAtTxtEnd aFtn( aFtnNtAtTextEndCB.IsChecked() 2120*cdf0e10cSrcweir ? ( aFtnNtNumCB.IsChecked() 2121*cdf0e10cSrcweir ? ( aFtnNtNumFmtCB.IsChecked() 2122*cdf0e10cSrcweir ? FTNEND_ATTXTEND_OWNNUMANDFMT 2123*cdf0e10cSrcweir : FTNEND_ATTXTEND_OWNNUMSEQ ) 2124*cdf0e10cSrcweir : FTNEND_ATTXTEND ) 2125*cdf0e10cSrcweir : FTNEND_ATPGORDOCEND ); 2126*cdf0e10cSrcweir 2127*cdf0e10cSrcweir switch( aFtn.GetValue() ) 2128*cdf0e10cSrcweir { 2129*cdf0e10cSrcweir case FTNEND_ATTXTEND_OWNNUMANDFMT: 2130*cdf0e10cSrcweir aFtn.SetNumType( aFtnNumViewBox.GetSelectedNumberingType() ); 2131*cdf0e10cSrcweir aFtn.SetPrefix( aFtnPrefixED.GetText() ); 2132*cdf0e10cSrcweir aFtn.SetSuffix( aFtnSuffixED.GetText() ); 2133*cdf0e10cSrcweir // no break; 2134*cdf0e10cSrcweir 2135*cdf0e10cSrcweir case FTNEND_ATTXTEND_OWNNUMSEQ: 2136*cdf0e10cSrcweir aFtn.SetOffset( static_cast< sal_uInt16 >( aFtnOffsetFld.GetValue()-1 ) ); 2137*cdf0e10cSrcweir // no break; 2138*cdf0e10cSrcweir } 2139*cdf0e10cSrcweir 2140*cdf0e10cSrcweir SwFmtEndAtTxtEnd aEnd( aEndNtAtTextEndCB.IsChecked() 2141*cdf0e10cSrcweir ? ( aEndNtNumCB.IsChecked() 2142*cdf0e10cSrcweir ? ( aEndNtNumFmtCB.IsChecked() 2143*cdf0e10cSrcweir ? FTNEND_ATTXTEND_OWNNUMANDFMT 2144*cdf0e10cSrcweir : FTNEND_ATTXTEND_OWNNUMSEQ ) 2145*cdf0e10cSrcweir : FTNEND_ATTXTEND ) 2146*cdf0e10cSrcweir : FTNEND_ATPGORDOCEND ); 2147*cdf0e10cSrcweir 2148*cdf0e10cSrcweir switch( aEnd.GetValue() ) 2149*cdf0e10cSrcweir { 2150*cdf0e10cSrcweir case FTNEND_ATTXTEND_OWNNUMANDFMT: 2151*cdf0e10cSrcweir aEnd.SetNumType( aEndNumViewBox.GetSelectedNumberingType() ); 2152*cdf0e10cSrcweir aEnd.SetPrefix( aEndPrefixED.GetText() ); 2153*cdf0e10cSrcweir aEnd.SetSuffix( aEndSuffixED.GetText() ); 2154*cdf0e10cSrcweir // no break; 2155*cdf0e10cSrcweir 2156*cdf0e10cSrcweir case FTNEND_ATTXTEND_OWNNUMSEQ: 2157*cdf0e10cSrcweir aEnd.SetOffset( static_cast< sal_uInt16 >( aEndOffsetFld.GetValue()-1 ) ); 2158*cdf0e10cSrcweir // no break; 2159*cdf0e10cSrcweir } 2160*cdf0e10cSrcweir 2161*cdf0e10cSrcweir rSet.Put( aFtn ); 2162*cdf0e10cSrcweir rSet.Put( aEnd ); 2163*cdf0e10cSrcweir 2164*cdf0e10cSrcweir return sal_True; 2165*cdf0e10cSrcweir } 2166*cdf0e10cSrcweir 2167*cdf0e10cSrcweir void SwSectionFtnEndTabPage::ResetState( sal_Bool bFtn, 2168*cdf0e10cSrcweir const SwFmtFtnEndAtTxtEnd& rAttr ) 2169*cdf0e10cSrcweir { 2170*cdf0e10cSrcweir CheckBox *pNtAtTextEndCB, *pNtNumCB, *pNtNumFmtCB; 2171*cdf0e10cSrcweir FixedText*pPrefixFT, *pSuffixFT; 2172*cdf0e10cSrcweir Edit *pPrefixED, *pSuffixED; 2173*cdf0e10cSrcweir SwNumberingTypeListBox *pNumViewBox; 2174*cdf0e10cSrcweir FixedText* pOffsetTxt; 2175*cdf0e10cSrcweir NumericField *pOffsetFld; 2176*cdf0e10cSrcweir 2177*cdf0e10cSrcweir if( bFtn ) 2178*cdf0e10cSrcweir { 2179*cdf0e10cSrcweir pNtAtTextEndCB = &aFtnNtAtTextEndCB; 2180*cdf0e10cSrcweir pNtNumCB = &aFtnNtNumCB; 2181*cdf0e10cSrcweir pNtNumFmtCB = &aFtnNtNumFmtCB; 2182*cdf0e10cSrcweir pPrefixFT = &aFtnPrefixFT; 2183*cdf0e10cSrcweir pPrefixED = &aFtnPrefixED; 2184*cdf0e10cSrcweir pSuffixFT = &aFtnSuffixFT; 2185*cdf0e10cSrcweir pSuffixED = &aFtnSuffixED; 2186*cdf0e10cSrcweir pNumViewBox = &aFtnNumViewBox; 2187*cdf0e10cSrcweir pOffsetTxt = &aFtnOffsetLbl; 2188*cdf0e10cSrcweir pOffsetFld = &aFtnOffsetFld; 2189*cdf0e10cSrcweir } 2190*cdf0e10cSrcweir else 2191*cdf0e10cSrcweir { 2192*cdf0e10cSrcweir pNtAtTextEndCB = &aEndNtAtTextEndCB; 2193*cdf0e10cSrcweir pNtNumCB = &aEndNtNumCB; 2194*cdf0e10cSrcweir pNtNumFmtCB = &aEndNtNumFmtCB; 2195*cdf0e10cSrcweir pPrefixFT = &aEndPrefixFT; 2196*cdf0e10cSrcweir pPrefixED = &aEndPrefixED; 2197*cdf0e10cSrcweir pSuffixFT = &aEndSuffixFT; 2198*cdf0e10cSrcweir pSuffixED = &aEndSuffixED; 2199*cdf0e10cSrcweir pNumViewBox = &aEndNumViewBox; 2200*cdf0e10cSrcweir pOffsetTxt = &aEndOffsetLbl; 2201*cdf0e10cSrcweir pOffsetFld = &aEndOffsetFld; 2202*cdf0e10cSrcweir } 2203*cdf0e10cSrcweir 2204*cdf0e10cSrcweir sal_uInt16 eState = rAttr.GetValue(); 2205*cdf0e10cSrcweir switch( eState ) 2206*cdf0e10cSrcweir { 2207*cdf0e10cSrcweir // case FTNEND_ATPGORDOCEND: 2208*cdf0e10cSrcweir case FTNEND_ATTXTEND_OWNNUMANDFMT: 2209*cdf0e10cSrcweir pNtNumFmtCB->SetState( STATE_CHECK ); 2210*cdf0e10cSrcweir // no break; 2211*cdf0e10cSrcweir 2212*cdf0e10cSrcweir case FTNEND_ATTXTEND_OWNNUMSEQ: 2213*cdf0e10cSrcweir pNtNumCB->SetState( STATE_CHECK ); 2214*cdf0e10cSrcweir // no break; 2215*cdf0e10cSrcweir 2216*cdf0e10cSrcweir case FTNEND_ATTXTEND: 2217*cdf0e10cSrcweir pNtAtTextEndCB->SetState( STATE_CHECK ); 2218*cdf0e10cSrcweir // no break; 2219*cdf0e10cSrcweir } 2220*cdf0e10cSrcweir 2221*cdf0e10cSrcweir pNumViewBox->SelectNumberingType( rAttr.GetNumType() ); 2222*cdf0e10cSrcweir pOffsetFld->SetValue( rAttr.GetOffset() + 1 ); 2223*cdf0e10cSrcweir pPrefixED->SetText( rAttr.GetPrefix() ); 2224*cdf0e10cSrcweir pSuffixED->SetText( rAttr.GetSuffix() ); 2225*cdf0e10cSrcweir 2226*cdf0e10cSrcweir switch( eState ) 2227*cdf0e10cSrcweir { 2228*cdf0e10cSrcweir case FTNEND_ATPGORDOCEND: 2229*cdf0e10cSrcweir pNtNumCB->Enable( sal_False ); 2230*cdf0e10cSrcweir // no break; 2231*cdf0e10cSrcweir 2232*cdf0e10cSrcweir case FTNEND_ATTXTEND: 2233*cdf0e10cSrcweir pNtNumFmtCB->Enable( sal_False ); 2234*cdf0e10cSrcweir pOffsetFld->Enable( sal_False ); 2235*cdf0e10cSrcweir pOffsetTxt->Enable( sal_False ); 2236*cdf0e10cSrcweir // no break; 2237*cdf0e10cSrcweir 2238*cdf0e10cSrcweir case FTNEND_ATTXTEND_OWNNUMSEQ: 2239*cdf0e10cSrcweir pNumViewBox->Enable( sal_False ); 2240*cdf0e10cSrcweir pPrefixFT->Enable( sal_False ); 2241*cdf0e10cSrcweir pPrefixED->Enable( sal_False ); 2242*cdf0e10cSrcweir pSuffixFT->Enable( sal_False ); 2243*cdf0e10cSrcweir pSuffixED->Enable( sal_False ); 2244*cdf0e10cSrcweir // no break; 2245*cdf0e10cSrcweir } 2246*cdf0e10cSrcweir } 2247*cdf0e10cSrcweir 2248*cdf0e10cSrcweir void SwSectionFtnEndTabPage::Reset( const SfxItemSet& rSet ) 2249*cdf0e10cSrcweir { 2250*cdf0e10cSrcweir ResetState( sal_True, (const SwFmtFtnAtTxtEnd&)rSet.Get( 2251*cdf0e10cSrcweir RES_FTN_AT_TXTEND, sal_False )); 2252*cdf0e10cSrcweir ResetState( sal_False, (const SwFmtEndAtTxtEnd&)rSet.Get( 2253*cdf0e10cSrcweir RES_END_AT_TXTEND, sal_False )); 2254*cdf0e10cSrcweir } 2255*cdf0e10cSrcweir 2256*cdf0e10cSrcweir SfxTabPage* SwSectionFtnEndTabPage::Create( Window* pParent, 2257*cdf0e10cSrcweir const SfxItemSet& rAttrSet) 2258*cdf0e10cSrcweir { 2259*cdf0e10cSrcweir return new SwSectionFtnEndTabPage(pParent, rAttrSet); 2260*cdf0e10cSrcweir } 2261*cdf0e10cSrcweir 2262*cdf0e10cSrcweir IMPL_LINK( SwSectionFtnEndTabPage, FootEndHdl, CheckBox *, pBox ) 2263*cdf0e10cSrcweir { 2264*cdf0e10cSrcweir // pBox->EnableTriState( sal_False ); 2265*cdf0e10cSrcweir sal_Bool bFoot = &aFtnNtAtTextEndCB == pBox || &aFtnNtNumCB == pBox || 2266*cdf0e10cSrcweir &aFtnNtNumFmtCB == pBox ; 2267*cdf0e10cSrcweir 2268*cdf0e10cSrcweir CheckBox *pNumBox, *pNumFmtBox, *pEndBox; 2269*cdf0e10cSrcweir SwNumberingTypeListBox* pNumViewBox; 2270*cdf0e10cSrcweir FixedText* pOffsetTxt; 2271*cdf0e10cSrcweir NumericField *pOffsetFld; 2272*cdf0e10cSrcweir FixedText*pPrefixFT, *pSuffixFT; 2273*cdf0e10cSrcweir Edit *pPrefixED, *pSuffixED; 2274*cdf0e10cSrcweir 2275*cdf0e10cSrcweir if( bFoot ) 2276*cdf0e10cSrcweir { 2277*cdf0e10cSrcweir pEndBox = &aFtnNtAtTextEndCB; 2278*cdf0e10cSrcweir pNumBox = &aFtnNtNumCB; 2279*cdf0e10cSrcweir pNumFmtBox = &aFtnNtNumFmtCB; 2280*cdf0e10cSrcweir pNumViewBox = &aFtnNumViewBox; 2281*cdf0e10cSrcweir pOffsetTxt = &aFtnOffsetLbl; 2282*cdf0e10cSrcweir pOffsetFld = &aFtnOffsetFld; 2283*cdf0e10cSrcweir pPrefixFT = &aFtnPrefixFT; 2284*cdf0e10cSrcweir pSuffixFT = &aFtnSuffixFT; 2285*cdf0e10cSrcweir pPrefixED = &aFtnPrefixED; 2286*cdf0e10cSrcweir pSuffixED = &aFtnSuffixED; 2287*cdf0e10cSrcweir } 2288*cdf0e10cSrcweir else 2289*cdf0e10cSrcweir { 2290*cdf0e10cSrcweir pEndBox = &aEndNtAtTextEndCB; 2291*cdf0e10cSrcweir pNumBox = &aEndNtNumCB; 2292*cdf0e10cSrcweir pNumFmtBox = &aEndNtNumFmtCB; 2293*cdf0e10cSrcweir pNumViewBox = &aEndNumViewBox; 2294*cdf0e10cSrcweir pOffsetTxt = &aEndOffsetLbl; 2295*cdf0e10cSrcweir pOffsetFld = &aEndOffsetFld; 2296*cdf0e10cSrcweir pPrefixFT = &aEndPrefixFT; 2297*cdf0e10cSrcweir pSuffixFT = &aEndSuffixFT; 2298*cdf0e10cSrcweir pPrefixED = &aEndPrefixED; 2299*cdf0e10cSrcweir pSuffixED = &aEndSuffixED; 2300*cdf0e10cSrcweir } 2301*cdf0e10cSrcweir 2302*cdf0e10cSrcweir sal_Bool bEnableAtEnd = STATE_CHECK == pEndBox->GetState(); 2303*cdf0e10cSrcweir sal_Bool bEnableNum = bEnableAtEnd && STATE_CHECK == pNumBox->GetState(); 2304*cdf0e10cSrcweir sal_Bool bEnableNumFmt = bEnableNum && STATE_CHECK == pNumFmtBox->GetState(); 2305*cdf0e10cSrcweir 2306*cdf0e10cSrcweir pNumBox->Enable( bEnableAtEnd ); 2307*cdf0e10cSrcweir pOffsetTxt->Enable( bEnableNum ); 2308*cdf0e10cSrcweir pOffsetFld->Enable( bEnableNum ); 2309*cdf0e10cSrcweir pNumFmtBox->Enable( bEnableNum ); 2310*cdf0e10cSrcweir pNumViewBox->Enable( bEnableNumFmt ); 2311*cdf0e10cSrcweir pPrefixED->Enable( bEnableNumFmt ); 2312*cdf0e10cSrcweir pSuffixED->Enable( bEnableNumFmt ); 2313*cdf0e10cSrcweir pPrefixFT->Enable( bEnableNumFmt ); 2314*cdf0e10cSrcweir pSuffixFT->Enable( bEnableNumFmt ); 2315*cdf0e10cSrcweir 2316*cdf0e10cSrcweir return 0; 2317*cdf0e10cSrcweir } 2318*cdf0e10cSrcweir 2319*cdf0e10cSrcweir /* -----------------21.05.99 13:59------------------- 2320*cdf0e10cSrcweir * 2321*cdf0e10cSrcweir * --------------------------------------------------*/ 2322*cdf0e10cSrcweir SwSectionPropertyTabDialog::SwSectionPropertyTabDialog( 2323*cdf0e10cSrcweir Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) : 2324*cdf0e10cSrcweir SfxTabDialog(pParent, SW_RES(DLG_SECTION_PROPERTIES), &rSet), 2325*cdf0e10cSrcweir rWrtSh(rSh) 2326*cdf0e10cSrcweir { 2327*cdf0e10cSrcweir FreeResource(); 2328*cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 2329*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 2330*cdf0e10cSrcweir AddTabPage(TP_COLUMN, SwColumnPage::Create, 0); 2331*cdf0e10cSrcweir AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); 2332*cdf0e10cSrcweir AddTabPage(TP_SECTION_FTNENDNOTES, SwSectionFtnEndTabPage::Create, 0); 2333*cdf0e10cSrcweir AddTabPage(TP_SECTION_INDENTS, SwSectionIndentTabPage::Create, 0); 2334*cdf0e10cSrcweir 2335*cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); 2336*cdf0e10cSrcweir long nHtmlMode = pHtmlOpt->GetExportMode(); 2337*cdf0e10cSrcweir sal_Bool bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); 2338*cdf0e10cSrcweir if(bWeb) 2339*cdf0e10cSrcweir { 2340*cdf0e10cSrcweir RemoveTabPage(TP_SECTION_FTNENDNOTES); 2341*cdf0e10cSrcweir RemoveTabPage(TP_SECTION_INDENTS); 2342*cdf0e10cSrcweir if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode) 2343*cdf0e10cSrcweir RemoveTabPage(TP_COLUMN); 2344*cdf0e10cSrcweir } 2345*cdf0e10cSrcweir } 2346*cdf0e10cSrcweir /* -----------------21.05.99 13:59------------------- 2347*cdf0e10cSrcweir * 2348*cdf0e10cSrcweir * --------------------------------------------------*/ 2349*cdf0e10cSrcweir SwSectionPropertyTabDialog::~SwSectionPropertyTabDialog() 2350*cdf0e10cSrcweir { 2351*cdf0e10cSrcweir } 2352*cdf0e10cSrcweir /* -----------------21.05.99 13:59------------------- 2353*cdf0e10cSrcweir * 2354*cdf0e10cSrcweir * --------------------------------------------------*/ 2355*cdf0e10cSrcweir void SwSectionPropertyTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) 2356*cdf0e10cSrcweir { 2357*cdf0e10cSrcweir if( TP_BACKGROUND == nId ) 2358*cdf0e10cSrcweir { 2359*cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); 2360*cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); 2361*cdf0e10cSrcweir rPage.PageCreated(aSet); 2362*cdf0e10cSrcweir } 2363*cdf0e10cSrcweir else if( TP_COLUMN == nId ) 2364*cdf0e10cSrcweir { 2365*cdf0e10cSrcweir ((SwColumnPage&)rPage).ShowBalance(sal_True); 2366*cdf0e10cSrcweir ((SwColumnPage&)rPage).SetInSection(sal_True); 2367*cdf0e10cSrcweir } 2368*cdf0e10cSrcweir else if(TP_SECTION_INDENTS == nId) 2369*cdf0e10cSrcweir ((SwSectionIndentTabPage&)rPage).SetWrtShell(rWrtSh); 2370*cdf0e10cSrcweir } 2371*cdf0e10cSrcweir /*-- 13.06.2003 09:59:08--------------------------------------------------- 2372*cdf0e10cSrcweir 2373*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2374*cdf0e10cSrcweir SwSectionIndentTabPage::SwSectionIndentTabPage( Window *pParent, const SfxItemSet &rAttrSet ) : 2375*cdf0e10cSrcweir SfxTabPage(pParent, SW_RES(TP_SECTION_INDENTS), rAttrSet), 2376*cdf0e10cSrcweir aIndentFL(this, SW_RES(FL_INDENT )), 2377*cdf0e10cSrcweir aBeforeFT(this, SW_RES(FT_BEFORE )), 2378*cdf0e10cSrcweir aBeforeMF(this, SW_RES(MF_BEFORE )), 2379*cdf0e10cSrcweir aAfterFT(this, SW_RES(FT_AFTER )), 2380*cdf0e10cSrcweir aAfterMF(this, SW_RES(MF_AFTER )), 2381*cdf0e10cSrcweir aPreviewWin(this, SW_RES(WIN_PREVIEW )) 2382*cdf0e10cSrcweir { 2383*cdf0e10cSrcweir FreeResource(); 2384*cdf0e10cSrcweir Link aLk = LINK(this, SwSectionIndentTabPage, IndentModifyHdl); 2385*cdf0e10cSrcweir aBeforeMF.SetModifyHdl(aLk); 2386*cdf0e10cSrcweir aAfterMF.SetModifyHdl(aLk); 2387*cdf0e10cSrcweir aPreviewWin.SetAccessibleName(aIndentFL.GetText()); 2388*cdf0e10cSrcweir } 2389*cdf0e10cSrcweir /*-- 13.06.2003 09:59:23--------------------------------------------------- 2390*cdf0e10cSrcweir 2391*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2392*cdf0e10cSrcweir SwSectionIndentTabPage::~SwSectionIndentTabPage() 2393*cdf0e10cSrcweir { 2394*cdf0e10cSrcweir } 2395*cdf0e10cSrcweir /*-- 13.06.2003 09:59:23--------------------------------------------------- 2396*cdf0e10cSrcweir 2397*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2398*cdf0e10cSrcweir sal_Bool SwSectionIndentTabPage::FillItemSet( SfxItemSet& rSet) 2399*cdf0e10cSrcweir { 2400*cdf0e10cSrcweir if(aBeforeMF.IsValueModified() || 2401*cdf0e10cSrcweir aAfterMF.IsValueModified()) 2402*cdf0e10cSrcweir { 2403*cdf0e10cSrcweir SvxLRSpaceItem aLRSpace( 2404*cdf0e10cSrcweir static_cast< long >(aBeforeMF.Denormalize(aBeforeMF.GetValue(FUNIT_TWIP))) , 2405*cdf0e10cSrcweir static_cast< long >(aAfterMF.Denormalize(aAfterMF.GetValue(FUNIT_TWIP))), 0, 0, RES_LR_SPACE); 2406*cdf0e10cSrcweir rSet.Put(aLRSpace); 2407*cdf0e10cSrcweir } 2408*cdf0e10cSrcweir return sal_True; 2409*cdf0e10cSrcweir } 2410*cdf0e10cSrcweir /*-- 13.06.2003 09:59:24--------------------------------------------------- 2411*cdf0e10cSrcweir 2412*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2413*cdf0e10cSrcweir void SwSectionIndentTabPage::Reset( const SfxItemSet& rSet) 2414*cdf0e10cSrcweir { 2415*cdf0e10cSrcweir //this page doesn't show up in HTML mode 2416*cdf0e10cSrcweir FieldUnit aMetric = ::GetDfltMetric(sal_False); 2417*cdf0e10cSrcweir SetMetric(aBeforeMF, aMetric); 2418*cdf0e10cSrcweir SetMetric(aAfterMF , aMetric); 2419*cdf0e10cSrcweir 2420*cdf0e10cSrcweir SfxItemState eItemState = rSet.GetItemState( RES_LR_SPACE ); 2421*cdf0e10cSrcweir if ( eItemState >= SFX_ITEM_AVAILABLE ) 2422*cdf0e10cSrcweir { 2423*cdf0e10cSrcweir const SvxLRSpaceItem& rSpace = 2424*cdf0e10cSrcweir (const SvxLRSpaceItem&)rSet.Get( RES_LR_SPACE ); 2425*cdf0e10cSrcweir 2426*cdf0e10cSrcweir aBeforeMF.SetValue( aBeforeMF.Normalize(rSpace.GetLeft()), FUNIT_TWIP ); 2427*cdf0e10cSrcweir aAfterMF.SetValue( aAfterMF.Normalize(rSpace.GetRight()), FUNIT_TWIP ); 2428*cdf0e10cSrcweir } 2429*cdf0e10cSrcweir else 2430*cdf0e10cSrcweir { 2431*cdf0e10cSrcweir aBeforeMF.SetEmptyFieldValue(); 2432*cdf0e10cSrcweir aAfterMF.SetEmptyFieldValue(); 2433*cdf0e10cSrcweir } 2434*cdf0e10cSrcweir aBeforeMF.SaveValue(); 2435*cdf0e10cSrcweir aAfterMF.SaveValue(); 2436*cdf0e10cSrcweir IndentModifyHdl(0); 2437*cdf0e10cSrcweir } 2438*cdf0e10cSrcweir /*-- 13.06.2003 09:59:24--------------------------------------------------- 2439*cdf0e10cSrcweir 2440*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2441*cdf0e10cSrcweir SfxTabPage* SwSectionIndentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet) 2442*cdf0e10cSrcweir { 2443*cdf0e10cSrcweir return new SwSectionIndentTabPage(pParent, rAttrSet); 2444*cdf0e10cSrcweir } 2445*cdf0e10cSrcweir /* -----------------13.06.2003 13:57----------------- 2446*cdf0e10cSrcweir 2447*cdf0e10cSrcweir --------------------------------------------------*/ 2448*cdf0e10cSrcweir void SwSectionIndentTabPage::SetWrtShell(SwWrtShell& rSh) 2449*cdf0e10cSrcweir { 2450*cdf0e10cSrcweir //set sensible values at the preview 2451*cdf0e10cSrcweir aPreviewWin.SetAdjust(SVX_ADJUST_BLOCK); 2452*cdf0e10cSrcweir aPreviewWin.SetLastLine(SVX_ADJUST_BLOCK); 2453*cdf0e10cSrcweir const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, 0 ); 2454*cdf0e10cSrcweir Size aPageSize(rPageRect.Width(), rPageRect.Height()); 2455*cdf0e10cSrcweir aPreviewWin.SetSize(aPageSize); 2456*cdf0e10cSrcweir } 2457*cdf0e10cSrcweir /* -----------------13.06.2003 14:02----------------- 2458*cdf0e10cSrcweir 2459*cdf0e10cSrcweir --------------------------------------------------*/ 2460*cdf0e10cSrcweir IMPL_LINK(SwSectionIndentTabPage, IndentModifyHdl, MetricField*, EMPTYARG) 2461*cdf0e10cSrcweir { 2462*cdf0e10cSrcweir aPreviewWin.SetLeftMargin( static_cast< long >(aBeforeMF.Denormalize(aBeforeMF.GetValue(FUNIT_TWIP))) ); 2463*cdf0e10cSrcweir aPreviewWin.SetRightMargin( static_cast< long >(aAfterMF.Denormalize(aAfterMF.GetValue(FUNIT_TWIP))) ); 2464*cdf0e10cSrcweir aPreviewWin.Draw(sal_True); 2465*cdf0e10cSrcweir return 0; 2466*cdf0e10cSrcweir } 2467*cdf0e10cSrcweir 2468