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