1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION 31*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <rsc/rscsfx.hxx> 36*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 37*cdf0e10cSrcweir #include <vcl/help.hxx> 38*cdf0e10cSrcweir #include <svl/stritem.hxx> 39*cdf0e10cSrcweir #include <svl/urihelper.hxx> 40*cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 41*cdf0e10cSrcweir #include <sfx2/request.hxx> 42*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 43*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 44*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 45*cdf0e10cSrcweir #include <svx/dialogs.hrc> 46*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 47*cdf0e10cSrcweir #include <svx/flagsdef.hxx> 48*cdf0e10cSrcweir #include <svx/simptabl.hxx> 49*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterManager.hpp> 52*cdf0e10cSrcweir #include <svtools/indexentryres.hxx> 53*cdf0e10cSrcweir #include <editeng/unolingu.hxx> 54*cdf0e10cSrcweir #include <column.hxx> 55*cdf0e10cSrcweir #include <fmtfsize.hxx> 56*cdf0e10cSrcweir #include <shellio.hxx> 57*cdf0e10cSrcweir #include <authfld.hxx> 58*cdf0e10cSrcweir #include <swtypes.hxx> 59*cdf0e10cSrcweir #include <wrtsh.hxx> 60*cdf0e10cSrcweir #ifndef _VIEW_HXX 61*cdf0e10cSrcweir #include <view.hxx> 62*cdf0e10cSrcweir #endif 63*cdf0e10cSrcweir #ifndef _BASESH_HXX 64*cdf0e10cSrcweir #include <basesh.hxx> 65*cdf0e10cSrcweir #endif 66*cdf0e10cSrcweir #include <outline.hxx> 67*cdf0e10cSrcweir #include <cnttab.hxx> 68*cdf0e10cSrcweir #include <swuicnttab.hxx> 69*cdf0e10cSrcweir #include <formedt.hxx> 70*cdf0e10cSrcweir #include <poolfmt.hxx> 71*cdf0e10cSrcweir #ifndef _POOLFMT_HRC 72*cdf0e10cSrcweir #include <poolfmt.hrc> 73*cdf0e10cSrcweir #endif 74*cdf0e10cSrcweir #include <uitool.hxx> 75*cdf0e10cSrcweir #include <fmtcol.hxx> 76*cdf0e10cSrcweir #include <fldbas.hxx> 77*cdf0e10cSrcweir #include <expfld.hxx> 78*cdf0e10cSrcweir #include <unotools.hxx> 79*cdf0e10cSrcweir #include <unotxdoc.hxx> 80*cdf0e10cSrcweir #include <docsh.hxx> 81*cdf0e10cSrcweir #include <swmodule.hxx> 82*cdf0e10cSrcweir #include <modcfg.hxx> 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir #ifndef _CMDID_H 85*cdf0e10cSrcweir #include <cmdid.h> 86*cdf0e10cSrcweir #endif 87*cdf0e10cSrcweir #ifndef _HELPID_H 88*cdf0e10cSrcweir #include <helpid.h> 89*cdf0e10cSrcweir #endif 90*cdf0e10cSrcweir #ifndef _UTLUI_HRC 91*cdf0e10cSrcweir #include <utlui.hrc> 92*cdf0e10cSrcweir #endif 93*cdf0e10cSrcweir #ifndef _INDEX_HRC 94*cdf0e10cSrcweir #include <index.hrc> 95*cdf0e10cSrcweir #endif 96*cdf0e10cSrcweir #ifndef _CNTTAB_HRC 97*cdf0e10cSrcweir #include <cnttab.hrc> 98*cdf0e10cSrcweir #endif 99*cdf0e10cSrcweir #ifndef _GLOBALS_HRC 100*cdf0e10cSrcweir #include <globals.hrc> 101*cdf0e10cSrcweir #endif 102*cdf0e10cSrcweir #include <SwStyleNameMapper.hxx> 103*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx> 104*cdf0e10cSrcweir #ifndef _TOXHLP_HXX 105*cdf0e10cSrcweir #include <toxwrap.hxx> 106*cdf0e10cSrcweir #endif 107*cdf0e10cSrcweir #include <chpfld.hxx> 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir #ifndef _UTLUI_HRC 110*cdf0e10cSrcweir #include "utlui.hrc" 111*cdf0e10cSrcweir #endif 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir #include <sfx2/app.hxx> 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir #include <unomid.h> 116*cdf0e10cSrcweir using namespace ::com::sun::star; 117*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 118*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 119*cdf0e10cSrcweir using namespace com::sun::star::ui::dialogs; 120*cdf0e10cSrcweir using ::rtl::OUString; 121*cdf0e10cSrcweir using namespace ::sfx2; 122*cdf0e10cSrcweir #include <svtools/editbrowsebox.hxx> 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir static const sal_Unicode aDeliStart = '['; //fuer die form 125*cdf0e10cSrcweir static const sal_Unicode aDeliEnd = ']'; //fuer die form 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir #define POS_GRF 0 128*cdf0e10cSrcweir #define POS_OLE 1 129*cdf0e10cSrcweir #define POS_TABLE 2 130*cdf0e10cSrcweir #define POS_FRAME 3 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir #define IDX_FILE_EXTENSION String::CreateFromAscii( \ 133*cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM( "*.sdi" )) 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir /* -----------------14.06.99 13:10------------------- 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir --------------------------------------------------*/ 139*cdf0e10cSrcweir String lcl_CreateAutoMarkFileDlg( const String& rURL, 140*cdf0e10cSrcweir const String& rFileString, sal_Bool bOpen ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir String sRet; 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir FileDialogHelper aDlgHelper( bOpen ? 145*cdf0e10cSrcweir TemplateDescription::FILEOPEN_SIMPLE : TemplateDescription::FILESAVE_AUTOEXTENSION, 0 ); 146*cdf0e10cSrcweir uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); 149*cdf0e10cSrcweir String sCurFltr( IDX_FILE_EXTENSION ); 150*cdf0e10cSrcweir xFltMgr->appendFilter( rFileString, sCurFltr ); 151*cdf0e10cSrcweir xFltMgr->setCurrentFilter( rFileString ) ; 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir String& rLastSaveDir = (String&)SFX_APP()->GetLastSaveDirectory(); 154*cdf0e10cSrcweir String sSaveDir = rLastSaveDir; 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir if( rURL.Len() ) 157*cdf0e10cSrcweir xFP->setDisplayDirectory( rURL ); 158*cdf0e10cSrcweir else 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir SvtPathOptions aPathOpt; 161*cdf0e10cSrcweir xFP->setDisplayDirectory( aPathOpt.GetUserConfigPath() ); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir if( aDlgHelper.Execute() == ERRCODE_NONE ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir sRet = xFP->getFiles().getConstArray()[0]; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir rLastSaveDir = sSaveDir; 169*cdf0e10cSrcweir return sRet; 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir /* -----------------------------19.01.00 11:09-------------------------------- 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 174*cdf0e10cSrcweir struct AutoMarkEntry 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir String sSearch; 177*cdf0e10cSrcweir String sAlternative; 178*cdf0e10cSrcweir String sPrimKey; 179*cdf0e10cSrcweir String sSecKey; 180*cdf0e10cSrcweir String sComment; 181*cdf0e10cSrcweir sal_Bool bCase; 182*cdf0e10cSrcweir sal_Bool bWord; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir AutoMarkEntry() : 185*cdf0e10cSrcweir bCase(sal_False), 186*cdf0e10cSrcweir bWord(sal_False){} 187*cdf0e10cSrcweir }; 188*cdf0e10cSrcweir typedef AutoMarkEntry* AutoMarkEntryPtr; 189*cdf0e10cSrcweir SV_DECL_PTRARR_DEL(AutoMarkEntryArr, AutoMarkEntryPtr, 0, 4) 190*cdf0e10cSrcweir SV_IMPL_PTRARR(AutoMarkEntryArr, AutoMarkEntryPtr); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base; 193*cdf0e10cSrcweir class SwEntryBrowseBox : public SwEntryBrowseBox_Base 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir Edit aCellEdit; 196*cdf0e10cSrcweir ::svt::CheckBoxControl aCellCheckBox; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir String sSearch; 199*cdf0e10cSrcweir String sAlternative; 200*cdf0e10cSrcweir String sPrimKey; 201*cdf0e10cSrcweir String sSecKey; 202*cdf0e10cSrcweir String sComment; 203*cdf0e10cSrcweir String sCaseSensitive; 204*cdf0e10cSrcweir String sWordOnly; 205*cdf0e10cSrcweir String sYes; 206*cdf0e10cSrcweir String sNo; 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir AutoMarkEntryArr aEntryArr; 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir ::svt::CellControllerRef xController; 211*cdf0e10cSrcweir ::svt::CellControllerRef xCheckController; 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir long nCurrentRow; 214*cdf0e10cSrcweir sal_Bool bModified; 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir void SetModified() {bModified = sal_True;} 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir protected: 220*cdf0e10cSrcweir virtual sal_Bool SeekRow( long nRow ); 221*cdf0e10cSrcweir // virtual void PaintField( OutputDevice& rDev, const awt::Rectangle& rRect, 222*cdf0e10cSrcweir // sal_uInt16 nColumnId ) const; 223*cdf0e10cSrcweir virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId) const; 224*cdf0e10cSrcweir virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol); 225*cdf0e10cSrcweir virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol); 226*cdf0e10cSrcweir virtual sal_Bool SaveModified(); 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir public: 229*cdf0e10cSrcweir SwEntryBrowseBox(Window* pParent, const ResId& rId, 230*cdf0e10cSrcweir BrowserMode nMode = 0 ); 231*cdf0e10cSrcweir void ReadEntries(SvStream& rInStr); 232*cdf0e10cSrcweir void WriteEntries(SvStream& rOutStr); 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir sal_Bool IsModified()const; 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir virtual String GetCellText( long nRow, sal_uInt16 nColumn ) const; 237*cdf0e10cSrcweir }; 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir class SwAutoMarkDlg_Impl : public ModalDialog 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir OKButton aOKPB; 242*cdf0e10cSrcweir CancelButton aCancelPB; 243*cdf0e10cSrcweir HelpButton aHelpPB; 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir SwEntryBrowseBox aEntriesBB; 246*cdf0e10cSrcweir FixedLine aEntriesFL; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir String sAutoMarkURL; 249*cdf0e10cSrcweir const String sAutoMarkType; 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir sal_Bool bCreateMode; 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir DECL_LINK(OkHdl, OKButton*); 254*cdf0e10cSrcweir public: 255*cdf0e10cSrcweir SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkURL, 256*cdf0e10cSrcweir const String& rAutoMarkType, sal_Bool bCreate); 257*cdf0e10cSrcweir ~SwAutoMarkDlg_Impl(); 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir }; 260*cdf0e10cSrcweir /* -----------------04.11.99 11:02------------------- 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir --------------------------------------------------*/ 263*cdf0e10cSrcweir sal_uInt16 CurTOXType::GetFlatIndex() const 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir sal_uInt16 nRet = static_cast< sal_uInt16 >(eType); 266*cdf0e10cSrcweir if(eType == TOX_USER && nIndex) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir nRet = static_cast< sal_uInt16 >(TOX_AUTHORITIES + nIndex); 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir return nRet; 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir /************************************************************************* 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir *************************************************************************/ 275*cdf0e10cSrcweir #define EDIT_MINWIDTH 15 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir /* -----------------14.06.99 12:12------------------- 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir --------------------------------------------------*/ 280*cdf0e10cSrcweir SwMultiTOXTabDialog::SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet, 281*cdf0e10cSrcweir SwWrtShell &rShell, 282*cdf0e10cSrcweir SwTOXBase* pCurTOX, 283*cdf0e10cSrcweir sal_uInt16 nToxType, sal_Bool bGlobal) : 284*cdf0e10cSrcweir SfxTabDialog( pParent, SW_RES(DLG_MULTI_TOX), &rSet), 285*cdf0e10cSrcweir aExampleContainerWIN(this, SW_RES(WIN_EXAMPLE)), 286*cdf0e10cSrcweir aExampleWIN( &aExampleContainerWIN, 0 ), 287*cdf0e10cSrcweir aShowExampleCB( this, SW_RES(CB_SHOWEXAMPLE)), 288*cdf0e10cSrcweir pMgr( new SwTOXMgr( &rShell ) ), 289*cdf0e10cSrcweir rSh(rShell), 290*cdf0e10cSrcweir pExampleFrame(0), 291*cdf0e10cSrcweir pParamTOXBase(pCurTOX), 292*cdf0e10cSrcweir sUserDefinedIndex(SW_RES(ST_USERDEFINEDINDEX)), 293*cdf0e10cSrcweir nInitialTOXType(nToxType), 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir bEditTOX(sal_False), 296*cdf0e10cSrcweir bExampleCreated(sal_False), 297*cdf0e10cSrcweir bGlobalFlag(bGlobal) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir FreeResource(); 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir aExampleWIN.SetPosSizePixel(aExampleContainerWIN.GetPosPixel(), 302*cdf0e10cSrcweir aExampleContainerWIN.GetSizePixel()); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir eCurrentTOXType.eType = TOX_CONTENT; 305*cdf0e10cSrcweir eCurrentTOXType.nIndex = 0; 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER); 308*cdf0e10cSrcweir nTypeCount = nUserTypeCount + 6; 309*cdf0e10cSrcweir pFormArr = new SwForm*[nTypeCount]; 310*cdf0e10cSrcweir pDescArr = new SwTOXDescription*[nTypeCount]; 311*cdf0e10cSrcweir pxIndexSectionsArr = new SwIndexSections_Impl*[nTypeCount]; 312*cdf0e10cSrcweir //the standard user index is on position TOX_USER 313*cdf0e10cSrcweir //all user user indexes follow after position TOX_AUTHORITIES 314*cdf0e10cSrcweir if(pCurTOX) 315*cdf0e10cSrcweir { 316*cdf0e10cSrcweir bEditTOX = sal_True; 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir for(int i = nTypeCount - 1; i > -1; i--) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir pFormArr[i] = 0; 321*cdf0e10cSrcweir pDescArr[i] = 0; 322*cdf0e10cSrcweir pxIndexSectionsArr[i] = new SwIndexSections_Impl; 323*cdf0e10cSrcweir if(pCurTOX) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir eCurrentTOXType.eType = pCurTOX->GetType(); 326*cdf0e10cSrcweir sal_uInt16 nArrayIndex = static_cast< sal_uInt16 >(eCurrentTOXType.eType); 327*cdf0e10cSrcweir if(eCurrentTOXType.eType == TOX_USER) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir //which user type is it? 330*cdf0e10cSrcweir for(sal_uInt16 nUser = 0; nUser < nUserTypeCount; nUser++) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir const SwTOXType* pTemp = rSh.GetTOXType(TOX_USER, nUser); 333*cdf0e10cSrcweir if(pCurTOX->GetTOXType() == pTemp) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir eCurrentTOXType.nIndex = nUser; 336*cdf0e10cSrcweir nArrayIndex = static_cast< sal_uInt16 >(nUser > 0 ? TOX_AUTHORITIES + nUser : TOX_USER); 337*cdf0e10cSrcweir break; 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir pFormArr[nArrayIndex] = new SwForm(pCurTOX->GetTOXForm()); 342*cdf0e10cSrcweir pDescArr[nArrayIndex] = CreateTOXDescFromTOXBase(pCurTOX); 343*cdf0e10cSrcweir if(TOX_AUTHORITIES == eCurrentTOXType.eType) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*) 346*cdf0e10cSrcweir rSh.GetFldType(RES_AUTHORITY, aEmptyStr); 347*cdf0e10cSrcweir if(pFType) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir String sBrackets; 350*cdf0e10cSrcweir if(pFType->GetPrefix()) 351*cdf0e10cSrcweir sBrackets += pFType->GetPrefix(); 352*cdf0e10cSrcweir if(pFType->GetSuffix()) 353*cdf0e10cSrcweir sBrackets += pFType->GetSuffix(); 354*cdf0e10cSrcweir pDescArr[nArrayIndex]->SetAuthBrackets(sBrackets); 355*cdf0e10cSrcweir pDescArr[nArrayIndex]->SetAuthSequence(pFType->IsSequence()); 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir else 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir pDescArr[nArrayIndex]->SetAuthBrackets(C2S("[]")); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 365*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 366*cdf0e10cSrcweir AddTabPage(TP_TOX_SELECT, SwTOXSelectTabPage::Create, 0); 367*cdf0e10cSrcweir AddTabPage(TP_TOX_STYLES, SwTOXStylesTabPage::Create, 0); 368*cdf0e10cSrcweir AddTabPage(TP_COLUMN, SwColumnPage::Create, 0); 369*cdf0e10cSrcweir AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); 370*cdf0e10cSrcweir AddTabPage(TP_TOX_ENTRY, SwTOXEntryTabPage::Create, 0); 371*cdf0e10cSrcweir if(!pCurTOX) 372*cdf0e10cSrcweir SetCurPageId(TP_TOX_SELECT); 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir aShowExampleCB.SetClickHdl(LINK(this, SwMultiTOXTabDialog, ShowPreviewHdl)); 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir aShowExampleCB.Check( SW_MOD()->GetModuleConfig()->IsShowIndexPreview()); 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir aExampleContainerWIN.SetAccessibleName(aShowExampleCB.GetText()); 379*cdf0e10cSrcweir SetViewAlign( WINDOWALIGN_LEFT ); 380*cdf0e10cSrcweir // SetViewWindow does not work if the dialog is visible! 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir if(!aShowExampleCB.IsChecked()) 383*cdf0e10cSrcweir SetViewWindow( &aExampleContainerWIN ); 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir Point aOldPos = GetPosPixel(); 386*cdf0e10cSrcweir ShowPreviewHdl(0); 387*cdf0e10cSrcweir Point aNewPos = GetPosPixel(); 388*cdf0e10cSrcweir //72040: initial position may be left of the view - that has to be corrected 389*cdf0e10cSrcweir if(aNewPos.X() < 0) 390*cdf0e10cSrcweir SetPosPixel(aOldPos); 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir /*-- 14.06.99 13:11:40--------------------------------------------------- 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 395*cdf0e10cSrcweir SwMultiTOXTabDialog::~SwMultiTOXTabDialog() 396*cdf0e10cSrcweir { 397*cdf0e10cSrcweir SW_MOD()->GetModuleConfig()->SetShowIndexPreview(aShowExampleCB.IsChecked()); 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nTypeCount; i++) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir delete pFormArr[i]; 402*cdf0e10cSrcweir delete pDescArr[i]; 403*cdf0e10cSrcweir delete pxIndexSectionsArr[i]; 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir delete[] pxIndexSectionsArr; 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir delete[] pFormArr; 408*cdf0e10cSrcweir delete[] pDescArr; 409*cdf0e10cSrcweir delete pMgr; 410*cdf0e10cSrcweir delete pExampleFrame; 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir /*-- 14.06.99 13:11:40--------------------------------------------------- 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 415*cdf0e10cSrcweir void SwMultiTOXTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir if( TP_BACKGROUND == nId ) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); 420*cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); 421*cdf0e10cSrcweir rPage.PageCreated(aSet); 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir else if(TP_COLUMN == nId ) 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)GetInputSetImpl()->Get(RES_FRM_SIZE); 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir ((SwColumnPage&)rPage).SetPageWidth(rSize.GetWidth()); 428*cdf0e10cSrcweir } 429*cdf0e10cSrcweir else if(TP_TOX_ENTRY == nId) 430*cdf0e10cSrcweir ((SwTOXEntryTabPage&)rPage).SetWrtShell(rSh); 431*cdf0e10cSrcweir if(TP_TOX_SELECT == nId) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir ((SwTOXSelectTabPage&)rPage).SetWrtShell(rSh); 434*cdf0e10cSrcweir if(USHRT_MAX != nInitialTOXType) 435*cdf0e10cSrcweir ((SwTOXSelectTabPage&)rPage).SelectType((TOXTypes)nInitialTOXType); 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir /*-- 14.06.99 13:11:40--------------------------------------------------- 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 441*cdf0e10cSrcweir short SwMultiTOXTabDialog::Ok() 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir short nRet = SfxTabDialog::Ok(); 444*cdf0e10cSrcweir SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType); 445*cdf0e10cSrcweir SwTOXBase aNewDef(*rSh.GetDefaultTOXBase( eCurrentTOXType.eType, sal_True )); 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir sal_uInt16 nIndex = static_cast< sal_uInt16 >(eCurrentTOXType.eType); 448*cdf0e10cSrcweir if(eCurrentTOXType.eType == TOX_USER && eCurrentTOXType.nIndex) 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir nIndex = static_cast< sal_uInt16 >(TOX_AUTHORITIES + eCurrentTOXType.nIndex); 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir if(pFormArr[nIndex]) 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir rDesc.SetForm(*pFormArr[nIndex]); 456*cdf0e10cSrcweir aNewDef.SetTOXForm(*pFormArr[nIndex]); 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir rDesc.ApplyTo(aNewDef); 459*cdf0e10cSrcweir if(!bGlobalFlag) 460*cdf0e10cSrcweir pMgr->UpdateOrInsertTOX( 461*cdf0e10cSrcweir rDesc, 0, GetOutputItemSet()); 462*cdf0e10cSrcweir else if(bEditTOX) 463*cdf0e10cSrcweir pMgr->UpdateOrInsertTOX( 464*cdf0e10cSrcweir rDesc, &pParamTOXBase, GetOutputItemSet()); 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir if(!eCurrentTOXType.nIndex) 467*cdf0e10cSrcweir rSh.SetDefaultTOXBase(aNewDef); 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir return nRet; 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir /* -----------------16.06.99 11:59------------------- 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir --------------------------------------------------*/ 474*cdf0e10cSrcweir SwForm* SwMultiTOXTabDialog::GetForm(CurTOXType eType) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir sal_uInt16 nIndex = eType.GetFlatIndex(); 477*cdf0e10cSrcweir if(!pFormArr[nIndex]) 478*cdf0e10cSrcweir pFormArr[nIndex] = new SwForm(eType.eType); 479*cdf0e10cSrcweir return pFormArr[nIndex]; 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir /* -----------------09.09.99 11:29------------------- 482*cdf0e10cSrcweir 483*cdf0e10cSrcweir --------------------------------------------------*/ 484*cdf0e10cSrcweir SwTOXDescription& SwMultiTOXTabDialog::GetTOXDescription(CurTOXType eType) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir sal_uInt16 nIndex = eType.GetFlatIndex(); 487*cdf0e10cSrcweir if(!pDescArr[nIndex]) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir const SwTOXBase* pDef = rSh.GetDefaultTOXBase( eType.eType ); 490*cdf0e10cSrcweir if(pDef) 491*cdf0e10cSrcweir pDescArr[nIndex] = CreateTOXDescFromTOXBase(pDef); 492*cdf0e10cSrcweir else 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir pDescArr[nIndex] = new SwTOXDescription(eType.eType); 495*cdf0e10cSrcweir if(eType.eType == TOX_USER) 496*cdf0e10cSrcweir pDescArr[nIndex]->SetTitle(sUserDefinedIndex); 497*cdf0e10cSrcweir else 498*cdf0e10cSrcweir pDescArr[nIndex]->SetTitle( 499*cdf0e10cSrcweir rSh.GetTOXType(eType.eType, 0)->GetTypeName()); 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir if(TOX_AUTHORITIES == eType.eType) 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*) 504*cdf0e10cSrcweir rSh.GetFldType(RES_AUTHORITY, aEmptyStr); 505*cdf0e10cSrcweir if(pFType) 506*cdf0e10cSrcweir { 507*cdf0e10cSrcweir String sBrackets(pFType->GetPrefix()); 508*cdf0e10cSrcweir sBrackets += pFType->GetSuffix(); 509*cdf0e10cSrcweir pDescArr[nIndex]->SetAuthBrackets(sBrackets); 510*cdf0e10cSrcweir pDescArr[nIndex]->SetAuthSequence(pFType->IsSequence()); 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir else 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir pDescArr[nIndex]->SetAuthBrackets(C2S("[]")); 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir else if(TOX_INDEX == eType.eType) 518*cdf0e10cSrcweir pDescArr[nIndex]->SetMainEntryCharStyle(SW_RESSTR(STR_POOLCHR_IDX_MAIN_ENTRY)); 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir return *pDescArr[nIndex]; 522*cdf0e10cSrcweir } 523*cdf0e10cSrcweir /* -----------------09.09.99 11:36------------------- 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir --------------------------------------------------*/ 526*cdf0e10cSrcweir SwTOXDescription* SwMultiTOXTabDialog::CreateTOXDescFromTOXBase( 527*cdf0e10cSrcweir const SwTOXBase*pCurTOX) 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir SwTOXDescription * pDesc = new SwTOXDescription(pCurTOX->GetType()); 530*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < MAXLEVEL; i++) 531*cdf0e10cSrcweir pDesc->SetStyleNames(pCurTOX->GetStyleNames(i), i); 532*cdf0e10cSrcweir pDesc->SetAutoMarkURL(rSh.GetTOIAutoMarkURL()); 533*cdf0e10cSrcweir pDesc->SetTitle(pCurTOX->GetTitle()); 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir pDesc->SetContentOptions(pCurTOX->GetCreateType()); 537*cdf0e10cSrcweir if(pDesc->GetTOXType() == TOX_INDEX) 538*cdf0e10cSrcweir pDesc->SetIndexOptions(pCurTOX->GetOptions()); 539*cdf0e10cSrcweir pDesc->SetMainEntryCharStyle(pCurTOX->GetMainEntryCharStyle()); 540*cdf0e10cSrcweir if(pDesc->GetTOXType() != TOX_INDEX) 541*cdf0e10cSrcweir pDesc->SetLevel((sal_uInt8)pCurTOX->GetLevel()); 542*cdf0e10cSrcweir pDesc->SetCreateFromObjectNames(pCurTOX->IsFromObjectNames()); 543*cdf0e10cSrcweir pDesc->SetSequenceName(pCurTOX->GetSequenceName()); 544*cdf0e10cSrcweir pDesc->SetCaptionDisplay(pCurTOX->GetCaptionDisplay()); 545*cdf0e10cSrcweir pDesc->SetFromChapter(pCurTOX->IsFromChapter()); 546*cdf0e10cSrcweir pDesc->SetReadonly(pCurTOX->IsProtected()); 547*cdf0e10cSrcweir pDesc->SetOLEOptions(pCurTOX->GetOLEOptions()); 548*cdf0e10cSrcweir pDesc->SetLevelFromChapter(pCurTOX->IsLevelFromChapter()); 549*cdf0e10cSrcweir pDesc->SetLanguage(pCurTOX->GetLanguage()); 550*cdf0e10cSrcweir pDesc->SetSortAlgorithm(pCurTOX->GetSortAlgorithm()); 551*cdf0e10cSrcweir return pDesc; 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir /* -----------------------------29.12.99 09:53-------------------------------- 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir IMPL_LINK( SwMultiTOXTabDialog, ShowPreviewHdl, CheckBox *, pBox ) 559*cdf0e10cSrcweir { 560*cdf0e10cSrcweir if(aShowExampleCB.IsChecked()) 561*cdf0e10cSrcweir { 562*cdf0e10cSrcweir if(!pExampleFrame && !bExampleCreated) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir bExampleCreated = sal_True; 565*cdf0e10cSrcweir String sTemplate( String::CreateFromAscii( 566*cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("internal")) ); 567*cdf0e10cSrcweir sTemplate += INET_PATH_TOKEN; 568*cdf0e10cSrcweir sTemplate.AppendAscii( RTL_CONSTASCII_STRINGPARAM("idxexample") ); 569*cdf0e10cSrcweir String sTemplateWithoutExt( sTemplate ); 570*cdf0e10cSrcweir #ifndef MAC_WITHOUT_EXT 571*cdf0e10cSrcweir sTemplate.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".odt") ); 572*cdf0e10cSrcweir #endif 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir SvtPathOptions aOpt; 575*cdf0e10cSrcweir // 6.0 (extension .sxw) 576*cdf0e10cSrcweir sal_Bool bExist = aOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE ); 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir #ifndef MAC_WITHOUT_EXT 579*cdf0e10cSrcweir if( !bExist ) 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir // 6.0 (extension .sxw) 582*cdf0e10cSrcweir sTemplate = sTemplateWithoutExt; 583*cdf0e10cSrcweir sTemplate.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".sxw") ); 584*cdf0e10cSrcweir bExist = aOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE ); 585*cdf0e10cSrcweir } 586*cdf0e10cSrcweir if( !bExist ) 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir // 5.0 (extension .vor) 589*cdf0e10cSrcweir sTemplate = sTemplateWithoutExt; 590*cdf0e10cSrcweir sTemplate.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".sdw") ); 591*cdf0e10cSrcweir bExist = aOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE ); 592*cdf0e10cSrcweir } 593*cdf0e10cSrcweir #endif 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir if(!bExist) 596*cdf0e10cSrcweir { 597*cdf0e10cSrcweir String sInfo(SW_RES(STR_FILE_NOT_FOUND)); 598*cdf0e10cSrcweir sInfo.SearchAndReplaceAscii( "%1", sTemplate ); 599*cdf0e10cSrcweir sInfo.SearchAndReplaceAscii( "%2", aOpt.GetTemplatePath() ); 600*cdf0e10cSrcweir InfoBox aInfo(GetParent(), sInfo); 601*cdf0e10cSrcweir aInfo.Execute(); 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir else 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir Link aLink(LINK(this, SwMultiTOXTabDialog, CreateExample_Hdl)); 606*cdf0e10cSrcweir pExampleFrame = new SwOneExampleFrame( 607*cdf0e10cSrcweir aExampleWIN, EX_SHOW_ONLINE_LAYOUT, &aLink, &sTemplate); 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir if(!pExampleFrame->IsServiceAvailable()) 610*cdf0e10cSrcweir { 611*cdf0e10cSrcweir pExampleFrame->CreateErrorMessage(0); 612*cdf0e10cSrcweir } 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir aShowExampleCB.Show(pExampleFrame && pExampleFrame->IsServiceAvailable()); 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir sal_Bool bSetViewWindow = aShowExampleCB.IsChecked() 618*cdf0e10cSrcweir && pExampleFrame && pExampleFrame->IsServiceAvailable(); 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir aExampleContainerWIN.Show( bSetViewWindow ); 621*cdf0e10cSrcweir SetViewWindow( bSetViewWindow ? &aExampleContainerWIN : 0 ); 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir Window *pTopmostParent = this; 624*cdf0e10cSrcweir while(pTopmostParent->GetParent()) 625*cdf0e10cSrcweir pTopmostParent = pTopmostParent->GetParent(); 626*cdf0e10cSrcweir ::Rectangle aRect(GetClientWindowExtentsRelative(pTopmostParent)); 627*cdf0e10cSrcweir ::Point aPos = aRect.TopLeft(); 628*cdf0e10cSrcweir Size aSize = GetSizePixel(); 629*cdf0e10cSrcweir if(pBox) 630*cdf0e10cSrcweir AdjustLayout(); 631*cdf0e10cSrcweir long nDiffWidth = GetSizePixel().Width() - aSize.Width(); 632*cdf0e10cSrcweir aPos.X() -= nDiffWidth; 633*cdf0e10cSrcweir SetPosPixel(aPos); 634*cdf0e10cSrcweir 635*cdf0e10cSrcweir return 0; 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir /* -----------------05.07.99 09:49------------------- 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir --------------------------------------------------*/ 642*cdf0e10cSrcweir sal_Bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, const String& rName) 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir SwTxtFmtColl* pColl = rSh.GetParaStyle(rName); 645*cdf0e10cSrcweir //if(pColl && pColl->GetOutlineLevel() == NO_NUMBERING) //#outline level,zhaojianwei 646*cdf0e10cSrcweir if(pColl && ! pColl->IsAssignedToListLevelOfOutlineStyle()) //<-end,zhaojianwei 647*cdf0e10cSrcweir return sal_True; 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL); 650*cdf0e10cSrcweir if(nId != USHRT_MAX && 651*cdf0e10cSrcweir //rSh.GetTxtCollFromPool(nId)->GetOutlineLevel() == NO_NUMBERING) //#outline level,zhaojianwei 652*cdf0e10cSrcweir ! rSh.GetTxtCollFromPool(nId)->IsAssignedToListLevelOfOutlineStyle()) //<-end,zhaojianwei 653*cdf0e10cSrcweir return sal_True; 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir return sal_False; 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir /* -----------------14.07.99 16:01------------------- 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir --------------------------------------------------*/ 660*cdf0e10cSrcweir class SwIndexTreeLB : public SvTreeListBox 661*cdf0e10cSrcweir { 662*cdf0e10cSrcweir const HeaderBar* pHeaderBar; 663*cdf0e10cSrcweir public: 664*cdf0e10cSrcweir SwIndexTreeLB(Window* pWin, const ResId& rResId) : 665*cdf0e10cSrcweir SvTreeListBox(pWin, rResId), pHeaderBar(0){} 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvt ); 668*cdf0e10cSrcweir virtual long GetTabPos( SvLBoxEntry*, SvLBoxTab* ); 669*cdf0e10cSrcweir void SetHeaderBar(const HeaderBar* pHB) {pHeaderBar = pHB;} 670*cdf0e10cSrcweir }; 671*cdf0e10cSrcweir /* -----------------14.07.99 16:03------------------- 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir --------------------------------------------------*/ 674*cdf0e10cSrcweir long SwIndexTreeLB::GetTabPos( SvLBoxEntry* pEntry, SvLBoxTab* pTab) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir long nData = (long)pEntry->GetUserData(); 677*cdf0e10cSrcweir if(nData != USHRT_MAX) 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir long nPos = pHeaderBar->GetItemRect( static_cast< sal_uInt16 >(101 + nData) ).TopLeft().X(); 680*cdf0e10cSrcweir nData = nPos; 681*cdf0e10cSrcweir } 682*cdf0e10cSrcweir else 683*cdf0e10cSrcweir nData = 0; 684*cdf0e10cSrcweir nData += pTab->GetPos(); 685*cdf0e10cSrcweir return nData; 686*cdf0e10cSrcweir } 687*cdf0e10cSrcweir /* -----------------25.08.99 11:14------------------- 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir --------------------------------------------------*/ 690*cdf0e10cSrcweir void SwIndexTreeLB::KeyInput( const KeyEvent& rKEvt ) 691*cdf0e10cSrcweir { 692*cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstSelected(); 693*cdf0e10cSrcweir KeyCode aCode = rKEvt.GetKeyCode(); 694*cdf0e10cSrcweir sal_Bool bChanged = sal_False; 695*cdf0e10cSrcweir if(pEntry) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir long nLevel = (long)pEntry->GetUserData(); 698*cdf0e10cSrcweir if(aCode.GetCode() == KEY_ADD ) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir if(nLevel < MAXLEVEL - 1) 701*cdf0e10cSrcweir nLevel++; 702*cdf0e10cSrcweir else if(nLevel == USHRT_MAX) 703*cdf0e10cSrcweir nLevel = 0; 704*cdf0e10cSrcweir bChanged = sal_True; 705*cdf0e10cSrcweir } 706*cdf0e10cSrcweir else if(aCode.GetCode() == KEY_SUBTRACT) 707*cdf0e10cSrcweir { 708*cdf0e10cSrcweir if(!nLevel) 709*cdf0e10cSrcweir nLevel = USHRT_MAX; 710*cdf0e10cSrcweir else if(nLevel != USHRT_MAX) 711*cdf0e10cSrcweir nLevel--; 712*cdf0e10cSrcweir bChanged = sal_True; 713*cdf0e10cSrcweir } 714*cdf0e10cSrcweir if(bChanged) 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir pEntry->SetUserData((void*)nLevel); 717*cdf0e10cSrcweir Invalidate(); 718*cdf0e10cSrcweir } 719*cdf0e10cSrcweir } 720*cdf0e10cSrcweir if(!bChanged) 721*cdf0e10cSrcweir SvTreeListBox::KeyInput(rKEvt); 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir /* -----------------16.07.99 10:01------------------- 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir --------------------------------------------------*/ 727*cdf0e10cSrcweir class SwHeaderTree : public Control 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir HeaderBar aStylesHB; 730*cdf0e10cSrcweir SwIndexTreeLB aStylesTLB; 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir public: 733*cdf0e10cSrcweir SwHeaderTree(Window* pParent, const ResId rResId); 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir HeaderBar& GetHeaderBar() {return aStylesHB;} 736*cdf0e10cSrcweir SwIndexTreeLB& GetTreeListBox() { return aStylesTLB;} 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir virtual void GetFocus(); 739*cdf0e10cSrcweir }; 740*cdf0e10cSrcweir /* -----------------16.07.99 10:11------------------- 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir --------------------------------------------------*/ 743*cdf0e10cSrcweir SwHeaderTree::SwHeaderTree(Window* pParent, const ResId rResId) : 744*cdf0e10cSrcweir Control(pParent, rResId), 745*cdf0e10cSrcweir aStylesHB( this, ResId(HB_STYLES, *rResId.GetResMgr())), 746*cdf0e10cSrcweir aStylesTLB( this, ResId(TLB_STYLES, *rResId.GetResMgr())) 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir FreeResource(); 749*cdf0e10cSrcweir aStylesHB.SetStyle(aStylesHB.GetStyle()|WB_BUTTONSTYLE|WB_TABSTOP|WB_BORDER); 750*cdf0e10cSrcweir Size aHBSize(aStylesHB.GetSizePixel()); 751*cdf0e10cSrcweir aHBSize.Height() = aStylesHB.CalcWindowSizePixel().Height(); 752*cdf0e10cSrcweir aStylesHB.SetSizePixel(aHBSize); 753*cdf0e10cSrcweir aStylesTLB.SetPosPixel(Point(0, aHBSize.Height())); 754*cdf0e10cSrcweir Size aTLBSize(aStylesHB.GetSizePixel()); 755*cdf0e10cSrcweir aTLBSize.Height() = GetOutputSizePixel().Height() - aHBSize.Height(); 756*cdf0e10cSrcweir aStylesTLB.SetSizePixel(aTLBSize); 757*cdf0e10cSrcweir aStylesTLB.SetHeaderBar(&aStylesHB); 758*cdf0e10cSrcweir } 759*cdf0e10cSrcweir /* -----------------25.08.99 10:38------------------- 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir --------------------------------------------------*/ 762*cdf0e10cSrcweir void SwHeaderTree::GetFocus() 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir Control::GetFocus(); 765*cdf0e10cSrcweir aStylesTLB.GrabFocus(); 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir /* -----------------13.07.99 15:29------------------- 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir --------------------------------------------------*/ 770*cdf0e10cSrcweir class SwAddStylesDlg_Impl : public SfxModalDialog 771*cdf0e10cSrcweir { 772*cdf0e10cSrcweir OKButton aOk; 773*cdf0e10cSrcweir CancelButton aCancel; 774*cdf0e10cSrcweir HelpButton aHelp; 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir FixedLine aStylesFL; 777*cdf0e10cSrcweir SwHeaderTree aHeaderTree; 778*cdf0e10cSrcweir ImageButton aLeftPB; 779*cdf0e10cSrcweir ImageButton aRightPB; 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir String sHBFirst; 782*cdf0e10cSrcweir String* pStyleArr; 783*cdf0e10cSrcweir 784*cdf0e10cSrcweir DECL_LINK(OkHdl, OKButton*); 785*cdf0e10cSrcweir DECL_LINK(LeftRightHdl, PushButton*); 786*cdf0e10cSrcweir DECL_LINK(HeaderDragHdl, HeaderBar*); 787*cdf0e10cSrcweir 788*cdf0e10cSrcweir public: 789*cdf0e10cSrcweir SwAddStylesDlg_Impl(Window* pParent, SwWrtShell& rWrtSh, String rStringArr[]); 790*cdf0e10cSrcweir ~SwAddStylesDlg_Impl(); 791*cdf0e10cSrcweir }; 792*cdf0e10cSrcweir /* -----------------13.07.99 15:39------------------- 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir --------------------------------------------------*/ 795*cdf0e10cSrcweir SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent, 796*cdf0e10cSrcweir SwWrtShell& rWrtSh, String rStringArr[]) : 797*cdf0e10cSrcweir SfxModalDialog(pParent, SW_RES(DLG_ADD_IDX_STYLES)), 798*cdf0e10cSrcweir aOk( this, SW_RES(PB_OK )), 799*cdf0e10cSrcweir aCancel( this, SW_RES(PB_CANCEL )), 800*cdf0e10cSrcweir aHelp( this, SW_RES(PB_HELP )), 801*cdf0e10cSrcweir 802*cdf0e10cSrcweir aStylesFL( this, SW_RES(FL_STYLES )), 803*cdf0e10cSrcweir aHeaderTree(this, SW_RES(TR_HEADER )), 804*cdf0e10cSrcweir aLeftPB( this, SW_RES(PB_LEFT )), 805*cdf0e10cSrcweir aRightPB( this, SW_RES(PB_RIGHT )), 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir sHBFirst( SW_RES(ST_HB_FIRST)), 808*cdf0e10cSrcweir pStyleArr(rStringArr) 809*cdf0e10cSrcweir { 810*cdf0e10cSrcweir FreeResource(); 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir aHeaderTree.SetAccessibleRelationMemberOf(&aStylesFL); 813*cdf0e10cSrcweir aLeftPB.SetAccessibleRelationMemberOf(&aStylesFL); 814*cdf0e10cSrcweir aRightPB.SetAccessibleRelationMemberOf(&aStylesFL); 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir aLeftPB.SetModeImage( Image( SW_RES( IMG_ALL_LEFT_HC ) ), BMP_COLOR_HIGHCONTRAST ); 817*cdf0e10cSrcweir aRightPB.SetModeImage( Image( SW_RES( IMG_ALL_RIGHT_HC ) ), BMP_COLOR_HIGHCONTRAST ); 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir aOk.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl)); 820*cdf0e10cSrcweir aLeftPB.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl)); 821*cdf0e10cSrcweir aRightPB.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl)); 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir HeaderBar& rHB = aHeaderTree.GetHeaderBar(); 824*cdf0e10cSrcweir rHB.SetEndDragHdl(LINK(this, SwAddStylesDlg_Impl, HeaderDragHdl)); 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir long nWidth = rHB.GetSizePixel().Width(); 827*cdf0e10cSrcweir sal_uInt16 i; 828*cdf0e10cSrcweir 829*cdf0e10cSrcweir nWidth /= 14; 830*cdf0e10cSrcweir nWidth--; 831*cdf0e10cSrcweir rHB.InsertItem( 100, sHBFirst, 4 * nWidth ); 832*cdf0e10cSrcweir for( i = 1; i <= MAXLEVEL; i++) 833*cdf0e10cSrcweir rHB.InsertItem( 100 + i, String::CreateFromInt32(i), nWidth ); 834*cdf0e10cSrcweir rHB.Show(); 835*cdf0e10cSrcweir 836*cdf0e10cSrcweir SwIndexTreeLB& rTLB = aHeaderTree.GetTreeListBox(); 837*cdf0e10cSrcweir rTLB.SetStyle(rTLB.GetStyle()|WB_CLIPCHILDREN|WB_SORT); 838*cdf0e10cSrcweir //aStylesTLB.SetSelectHdl(LINK(this, SwAddStylesDlg_Impl, SelectHdl)); 839*cdf0e10cSrcweir rTLB.GetModel()->SetSortMode(SortAscending); 840*cdf0e10cSrcweir for(i = 0; i < MAXLEVEL; ++i) 841*cdf0e10cSrcweir { 842*cdf0e10cSrcweir String sStyles(rStringArr[i]); 843*cdf0e10cSrcweir for(sal_uInt16 nToken = 0; nToken < sStyles.GetTokenCount(TOX_STYLE_DELIMITER); nToken++) 844*cdf0e10cSrcweir { 845*cdf0e10cSrcweir String sTmp(sStyles.GetToken(nToken, TOX_STYLE_DELIMITER)); 846*cdf0e10cSrcweir SvLBoxEntry* pEntry = rTLB.InsertEntry(sTmp); 847*cdf0e10cSrcweir pEntry->SetUserData(reinterpret_cast<void*>(i)); 848*cdf0e10cSrcweir } 849*cdf0e10cSrcweir } 850*cdf0e10cSrcweir // now the other styles 851*cdf0e10cSrcweir // 852*cdf0e10cSrcweir const SwTxtFmtColl *pColl = 0; 853*cdf0e10cSrcweir const sal_uInt16 nSz = rWrtSh.GetTxtFmtCollCount(); 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir for ( sal_uInt16 j = 0;j < nSz; ++j ) 856*cdf0e10cSrcweir { 857*cdf0e10cSrcweir pColl = &rWrtSh.GetTxtFmtColl(j); 858*cdf0e10cSrcweir if(pColl->IsDefault()) 859*cdf0e10cSrcweir continue; 860*cdf0e10cSrcweir 861*cdf0e10cSrcweir const String& rName = pColl->GetName(); 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir if(rName.Len() > 0) 864*cdf0e10cSrcweir { 865*cdf0e10cSrcweir SvLBoxEntry* pEntry = rTLB.First(); 866*cdf0e10cSrcweir sal_Bool bFound = sal_False; 867*cdf0e10cSrcweir while(pEntry && !bFound) 868*cdf0e10cSrcweir { 869*cdf0e10cSrcweir if(rTLB.GetEntryText(pEntry) == rName) 870*cdf0e10cSrcweir bFound = sal_True; 871*cdf0e10cSrcweir pEntry = rTLB.Next(pEntry); 872*cdf0e10cSrcweir } 873*cdf0e10cSrcweir if(!bFound) 874*cdf0e10cSrcweir { 875*cdf0e10cSrcweir rTLB.InsertEntry(rName)->SetUserData((void*)USHRT_MAX); 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir } 878*cdf0e10cSrcweir } 879*cdf0e10cSrcweir rTLB.GetModel()->Resort(); 880*cdf0e10cSrcweir } 881*cdf0e10cSrcweir 882*cdf0e10cSrcweir /* -----------------13.07.99 15:39------------------- 883*cdf0e10cSrcweir 884*cdf0e10cSrcweir --------------------------------------------------*/ 885*cdf0e10cSrcweir SwAddStylesDlg_Impl::~SwAddStylesDlg_Impl() 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir } 888*cdf0e10cSrcweir /* -----------------13.07.99 15:39------------------- 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir --------------------------------------------------*/ 891*cdf0e10cSrcweir IMPL_LINK(SwAddStylesDlg_Impl, OkHdl, OKButton*, EMPTYARG) 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < MAXLEVEL; i++) 894*cdf0e10cSrcweir pStyleArr[i].Erase(); 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir SwIndexTreeLB& rTLB = aHeaderTree.GetTreeListBox(); 897*cdf0e10cSrcweir SvLBoxEntry* pEntry = rTLB.First(); 898*cdf0e10cSrcweir while(pEntry) 899*cdf0e10cSrcweir { 900*cdf0e10cSrcweir long nLevel = (long)pEntry->GetUserData(); 901*cdf0e10cSrcweir if(nLevel != USHRT_MAX) 902*cdf0e10cSrcweir { 903*cdf0e10cSrcweir String sName(rTLB.GetEntryText(pEntry)); 904*cdf0e10cSrcweir if(pStyleArr[nLevel].Len()) 905*cdf0e10cSrcweir pStyleArr[nLevel] += TOX_STYLE_DELIMITER; 906*cdf0e10cSrcweir pStyleArr[nLevel] += sName; 907*cdf0e10cSrcweir } 908*cdf0e10cSrcweir pEntry = rTLB.Next(pEntry); 909*cdf0e10cSrcweir } 910*cdf0e10cSrcweir 911*cdf0e10cSrcweir //TODO write back style names 912*cdf0e10cSrcweir EndDialog(RET_OK); 913*cdf0e10cSrcweir return 0; 914*cdf0e10cSrcweir } 915*cdf0e10cSrcweir /* -----------------16.07.99 09:27------------------- 916*cdf0e10cSrcweir 917*cdf0e10cSrcweir --------------------------------------------------*/ 918*cdf0e10cSrcweir IMPL_LINK(SwAddStylesDlg_Impl, HeaderDragHdl, HeaderBar*, EMPTYARG) 919*cdf0e10cSrcweir { 920*cdf0e10cSrcweir aHeaderTree.GetTreeListBox().Invalidate(); 921*cdf0e10cSrcweir return 0; 922*cdf0e10cSrcweir } 923*cdf0e10cSrcweir /* -----------------13.07.99 15:39------------------- 924*cdf0e10cSrcweir 925*cdf0e10cSrcweir --------------------------------------------------*/ 926*cdf0e10cSrcweir IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, PushButton*, pBtn) 927*cdf0e10cSrcweir { 928*cdf0e10cSrcweir sal_Bool bLeft = pBtn == &aLeftPB; 929*cdf0e10cSrcweir SvLBoxEntry* pEntry = aHeaderTree.GetTreeListBox().FirstSelected(); 930*cdf0e10cSrcweir if(pEntry) 931*cdf0e10cSrcweir { 932*cdf0e10cSrcweir long nLevel = (long)pEntry->GetUserData(); 933*cdf0e10cSrcweir if(bLeft) 934*cdf0e10cSrcweir { 935*cdf0e10cSrcweir if(!nLevel) 936*cdf0e10cSrcweir nLevel = USHRT_MAX; 937*cdf0e10cSrcweir else if(nLevel != USHRT_MAX) 938*cdf0e10cSrcweir nLevel--; 939*cdf0e10cSrcweir } 940*cdf0e10cSrcweir else 941*cdf0e10cSrcweir { 942*cdf0e10cSrcweir if(nLevel < MAXLEVEL - 1) 943*cdf0e10cSrcweir nLevel++; 944*cdf0e10cSrcweir else if(nLevel == USHRT_MAX) 945*cdf0e10cSrcweir nLevel = 0; 946*cdf0e10cSrcweir } 947*cdf0e10cSrcweir pEntry->SetUserData((void*)nLevel); 948*cdf0e10cSrcweir aHeaderTree.GetTreeListBox().Invalidate(); 949*cdf0e10cSrcweir } 950*cdf0e10cSrcweir return 0; 951*cdf0e10cSrcweir } 952*cdf0e10cSrcweir 953*cdf0e10cSrcweir /*-- 14.06.99 13:11:40--------------------------------------------------- 954*cdf0e10cSrcweir 955*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 956*cdf0e10cSrcweir SwTOXSelectTabPage::SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet) : 957*cdf0e10cSrcweir SfxTabPage(pParent, SW_RES(TP_TOX_SELECT), rAttrSet), 958*cdf0e10cSrcweir 959*cdf0e10cSrcweir aTypeTitleFL( this, SW_RES(FL_TYPETITLE )), 960*cdf0e10cSrcweir aTitleFT( this, SW_RES(FT_TITLE )), 961*cdf0e10cSrcweir aTitleED( this, SW_RES(ED_TITLE )), 962*cdf0e10cSrcweir aTypeFT( this, SW_RES(FT_TYPE )), 963*cdf0e10cSrcweir aTypeLB( this, SW_RES(LB_TYPE )), 964*cdf0e10cSrcweir aReadOnlyCB( this, SW_RES(CB_READONLY )), 965*cdf0e10cSrcweir 966*cdf0e10cSrcweir aAreaFL( this, SW_RES(FL_AREA )), 967*cdf0e10cSrcweir aAreaFT( this, SW_RES(FT_AREA )), 968*cdf0e10cSrcweir aAreaLB( this, SW_RES(LB_AREA )), 969*cdf0e10cSrcweir aLevelFT( this, SW_RES(FT_LEVEL )), 970*cdf0e10cSrcweir aLevelNF( this, SW_RES(NF_LEVEL )), 971*cdf0e10cSrcweir 972*cdf0e10cSrcweir aCreateFromFL( this, SW_RES(FL_CREATEFROM )), 973*cdf0e10cSrcweir aFromHeadingsCB( this, SW_RES(CB_FROMHEADINGS )), 974*cdf0e10cSrcweir // aChapterDlgPB( this, SW_RES(PB_CHAPTERDLG )),//#outline level,removed by zhaojianwei 975*cdf0e10cSrcweir aAddStylesCB( this, SW_RES(CB_ADDSTYLES )), 976*cdf0e10cSrcweir aAddStylesPB( this, SW_RES(PB_ADDSTYLES )), 977*cdf0e10cSrcweir 978*cdf0e10cSrcweir aFromTablesCB( this, SW_RES(CB_FROMTABLES )), 979*cdf0e10cSrcweir aFromFramesCB( this, SW_RES(CB_FROMFRAMES )), 980*cdf0e10cSrcweir aFromGraphicsCB( this, SW_RES(CB_FROMGRAPHICS )), 981*cdf0e10cSrcweir aFromOLECB( this, SW_RES(CB_FROMOLE )), 982*cdf0e10cSrcweir aLevelFromChapterCB(this, SW_RES(CB_LEVELFROMCHAPTER )), 983*cdf0e10cSrcweir 984*cdf0e10cSrcweir aFromCaptionsRB( this, SW_RES(RB_FROMCAPTIONS )), 985*cdf0e10cSrcweir aFromObjectNamesRB( this, SW_RES(RB_FROMOBJECTNAMES )), 986*cdf0e10cSrcweir 987*cdf0e10cSrcweir aCaptionSequenceFT( this, SW_RES(FT_CAPTIONSEQUENCE )), 988*cdf0e10cSrcweir aCaptionSequenceLB( this, SW_RES(LB_CAPTIONSEQUENCE )), 989*cdf0e10cSrcweir aDisplayTypeFT( this, SW_RES(FT_DISPLAYTYPE )), 990*cdf0e10cSrcweir aDisplayTypeLB( this, SW_RES(LB_DISPLAYTYPE )), 991*cdf0e10cSrcweir 992*cdf0e10cSrcweir aTOXMarksCB( this, SW_RES(CB_TOXMARKS )), 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir aIdxOptionsFL( this, SW_RES(FL_IDXOPTIONS )), 995*cdf0e10cSrcweir aCollectSameCB( this, SW_RES(CB_COLLECTSAME )), 996*cdf0e10cSrcweir aUseFFCB( this, SW_RES(CB_USEFF )), 997*cdf0e10cSrcweir aUseDashCB( this, SW_RES(CB_USE_DASH )), 998*cdf0e10cSrcweir aCaseSensitiveCB( this, SW_RES(CB_CASESENSITIVE )), 999*cdf0e10cSrcweir aInitialCapsCB( this, SW_RES(CB_INITIALCAPS )), 1000*cdf0e10cSrcweir aKeyAsEntryCB( this, SW_RES(CB_KEYASENTRY )), 1001*cdf0e10cSrcweir aFromFileCB( this, SW_RES(CB_FROMFILE )), 1002*cdf0e10cSrcweir aAutoMarkPB( this, SW_RES(MB_AUTOMARK )), 1003*cdf0e10cSrcweir 1004*cdf0e10cSrcweir aFromNames( SW_RES(RES_SRCTYPES )), 1005*cdf0e10cSrcweir aFromObjCLB( this, SW_RES(CLB_FROMOBJ )), 1006*cdf0e10cSrcweir aFromObjFL( this, SW_RES(FL_FROMOBJ )), 1007*cdf0e10cSrcweir 1008*cdf0e10cSrcweir aSequenceCB( this, SW_RES(CB_SEQUENCE )), 1009*cdf0e10cSrcweir aBracketFT( this, SW_RES(FT_BRACKET )), 1010*cdf0e10cSrcweir aBracketLB( this, SW_RES(LB_BRACKET )), 1011*cdf0e10cSrcweir aAuthorityFormatFL( this, SW_RES(FL_AUTHORITY )), 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir aSortOptionsFL( this, SW_RES(FL_SORTOPTIONS )), 1014*cdf0e10cSrcweir aLanguageFT( this, SW_RES(FT_LANGUAGE )), 1015*cdf0e10cSrcweir aLanguageLB( this, SW_RES(LB_LANGUAGE )), 1016*cdf0e10cSrcweir aSortAlgorithmFT( this, SW_RES(FT_SORTALG )), 1017*cdf0e10cSrcweir aSortAlgorithmLB( this, SW_RES(LB_SORTALG )), 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir pIndexRes(0), 1020*cdf0e10cSrcweir 1021*cdf0e10cSrcweir sAutoMarkType(SW_RES(ST_AUTOMARK_TYPE)), 1022*cdf0e10cSrcweir sAddStyleUser(SW_RES(ST_USER_ADDSTYLE)), 1023*cdf0e10cSrcweir bFirstCall(sal_True) 1024*cdf0e10cSrcweir { 1025*cdf0e10cSrcweir aBracketLB.InsertEntry(String(SW_RES(ST_NO_BRACKET)), 0); 1026*cdf0e10cSrcweir 1027*cdf0e10cSrcweir aAddStylesPB.SetAccessibleRelationMemberOf(&aCreateFromFL); 1028*cdf0e10cSrcweir aAddStylesPB.SetAccessibleRelationLabeledBy(&aAddStylesCB); 1029*cdf0e10cSrcweir aAddStylesPB.SetAccessibleName(aAddStylesCB.GetText()); 1030*cdf0e10cSrcweir 1031*cdf0e10cSrcweir FreeResource(); 1032*cdf0e10cSrcweir 1033*cdf0e10cSrcweir pIndexEntryWrapper = new IndexEntrySupplierWrapper(); 1034*cdf0e10cSrcweir 1035*cdf0e10cSrcweir aLanguageLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, 1036*cdf0e10cSrcweir sal_False, sal_False, sal_False ); 1037*cdf0e10cSrcweir 1038*cdf0e10cSrcweir sAddStyleContent = aAddStylesCB.GetText(); 1039*cdf0e10cSrcweir 1040*cdf0e10cSrcweir aCBLeftPos1 = aFromHeadingsCB.GetPosPixel(); 1041*cdf0e10cSrcweir aCBLeftPos2 = aAddStylesCB.GetPosPixel(); 1042*cdf0e10cSrcweir aCBLeftPos3 = aTOXMarksCB.GetPosPixel(); 1043*cdf0e10cSrcweir 1044*cdf0e10cSrcweir ResStringArray& rNames = aFromNames.GetNames(); 1045*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < rNames.Count(); i++) 1046*cdf0e10cSrcweir { 1047*cdf0e10cSrcweir aFromObjCLB.InsertEntry(rNames.GetString(i)); 1048*cdf0e10cSrcweir aFromObjCLB.SetEntryData( i, (void*)rNames.GetValue(i) ); 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir aFromObjCLB.SetHelpId(HID_OLE_CHECKLB); 1051*cdf0e10cSrcweir 1052*cdf0e10cSrcweir SetExchangeSupport(); 1053*cdf0e10cSrcweir aTypeLB.SetSelectHdl(LINK(this, SwTOXSelectTabPage, TOXTypeHdl)); 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir aAddStylesPB.SetClickHdl(LINK(this, SwTOXSelectTabPage, AddStylesHdl)); 1056*cdf0e10cSrcweir //aChapterDlgPB.SetClickHdl(LINK(this, SwTOXSelectTabPage, ChapterHdl));//#outline level,removed by zhaojianwei 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir PopupMenu* pMenu = aAutoMarkPB.GetPopupMenu(); 1059*cdf0e10cSrcweir pMenu->SetActivateHdl(LINK(this, SwTOXSelectTabPage, MenuEnableHdl)); 1060*cdf0e10cSrcweir pMenu->SetSelectHdl(LINK(this, SwTOXSelectTabPage, MenuExecuteHdl)); 1061*cdf0e10cSrcweir 1062*cdf0e10cSrcweir Link aLk = LINK(this, SwTOXSelectTabPage, CheckBoxHdl); 1063*cdf0e10cSrcweir aAddStylesCB .SetClickHdl(aLk); 1064*cdf0e10cSrcweir aFromHeadingsCB .SetClickHdl(aLk); 1065*cdf0e10cSrcweir aTOXMarksCB .SetClickHdl(aLk); 1066*cdf0e10cSrcweir aFromFileCB .SetClickHdl(aLk); 1067*cdf0e10cSrcweir aCollectSameCB .SetClickHdl(aLk); 1068*cdf0e10cSrcweir aUseFFCB .SetClickHdl(aLk); 1069*cdf0e10cSrcweir aUseDashCB .SetClickHdl(aLk); 1070*cdf0e10cSrcweir aInitialCapsCB .SetClickHdl(aLk); 1071*cdf0e10cSrcweir aKeyAsEntryCB .SetClickHdl(aLk); 1072*cdf0e10cSrcweir 1073*cdf0e10cSrcweir Link aModifyLk = LINK(this, SwTOXSelectTabPage, ModifyHdl); 1074*cdf0e10cSrcweir aTitleED.SetModifyHdl(aModifyLk); 1075*cdf0e10cSrcweir aLevelNF.SetModifyHdl(aModifyLk); 1076*cdf0e10cSrcweir aSortAlgorithmLB.SetSelectHdl(aModifyLk); 1077*cdf0e10cSrcweir 1078*cdf0e10cSrcweir aLk = LINK(this, SwTOXSelectTabPage, RadioButtonHdl); 1079*cdf0e10cSrcweir aFromCaptionsRB.SetClickHdl(aLk); 1080*cdf0e10cSrcweir aFromObjectNamesRB.SetClickHdl(aLk); 1081*cdf0e10cSrcweir RadioButtonHdl(&aFromCaptionsRB); 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir aLanguageLB.SetSelectHdl(LINK(this, SwTOXSelectTabPage, LanguageHdl)); 1084*cdf0e10cSrcweir aTypeLB.SelectEntryPos(0); 1085*cdf0e10cSrcweir aTitleED.SaveValue(); 1086*cdf0e10cSrcweir } 1087*cdf0e10cSrcweir /*-- 14.06.99 13:11:41--------------------------------------------------- 1088*cdf0e10cSrcweir 1089*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1090*cdf0e10cSrcweir SwTOXSelectTabPage::~SwTOXSelectTabPage() 1091*cdf0e10cSrcweir { 1092*cdf0e10cSrcweir delete pIndexRes; 1093*cdf0e10cSrcweir delete pIndexEntryWrapper; 1094*cdf0e10cSrcweir } 1095*cdf0e10cSrcweir /* -----------------21.10.99 17:03------------------- 1096*cdf0e10cSrcweir 1097*cdf0e10cSrcweir --------------------------------------------------*/ 1098*cdf0e10cSrcweir void SwTOXSelectTabPage::SetWrtShell(SwWrtShell& rSh) 1099*cdf0e10cSrcweir { 1100*cdf0e10cSrcweir sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER); 1101*cdf0e10cSrcweir if(nUserTypeCount > 1) 1102*cdf0e10cSrcweir { 1103*cdf0e10cSrcweir //insert all new user indexes names after the standard user index 1104*cdf0e10cSrcweir sal_uInt16 nPos = aTypeLB.GetEntryPos((void*)(sal_uInt32)TO_USER); 1105*cdf0e10cSrcweir nPos++; 1106*cdf0e10cSrcweir for(sal_uInt16 nUser = 1; nUser < nUserTypeCount; nUser++) 1107*cdf0e10cSrcweir { 1108*cdf0e10cSrcweir nPos = aTypeLB.InsertEntry(rSh.GetTOXType(TOX_USER, nUser)->GetTypeName(), nPos); 1109*cdf0e10cSrcweir sal_uInt32 nEntryData = nUser << 8; 1110*cdf0e10cSrcweir nEntryData |= TO_USER; 1111*cdf0e10cSrcweir aTypeLB.SetEntryData(nPos, (void*)nEntryData); 1112*cdf0e10cSrcweir } 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir } 1115*cdf0e10cSrcweir /* -----------------14.06.99 13:10------------------- 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir --------------------------------------------------*/ 1118*cdf0e10cSrcweir sal_Bool SwTOXSelectTabPage::FillItemSet( SfxItemSet& ) 1119*cdf0e10cSrcweir { 1120*cdf0e10cSrcweir return sal_True; 1121*cdf0e10cSrcweir } 1122*cdf0e10cSrcweir /* -----------------25.08.99 14:31------------------- 1123*cdf0e10cSrcweir 1124*cdf0e10cSrcweir --------------------------------------------------*/ 1125*cdf0e10cSrcweir long lcl_TOXTypesToUserData(CurTOXType eType) 1126*cdf0e10cSrcweir { 1127*cdf0e10cSrcweir sal_uInt16 nRet = TOX_INDEX; 1128*cdf0e10cSrcweir switch(eType.eType) 1129*cdf0e10cSrcweir { 1130*cdf0e10cSrcweir case TOX_INDEX : nRet = TO_INDEX; break; 1131*cdf0e10cSrcweir case TOX_USER : 1132*cdf0e10cSrcweir { 1133*cdf0e10cSrcweir nRet = eType.nIndex << 8; 1134*cdf0e10cSrcweir nRet |= TO_USER; 1135*cdf0e10cSrcweir } 1136*cdf0e10cSrcweir break; 1137*cdf0e10cSrcweir case TOX_CONTENT : nRet = TO_CONTENT; break; 1138*cdf0e10cSrcweir case TOX_ILLUSTRATIONS:nRet = TO_ILLUSTRATION; break; 1139*cdf0e10cSrcweir case TOX_OBJECTS : nRet = TO_OBJECT; break; 1140*cdf0e10cSrcweir case TOX_TABLES : nRet = TO_TABLE; break; 1141*cdf0e10cSrcweir case TOX_AUTHORITIES : nRet = TO_AUTHORITIES; break; 1142*cdf0e10cSrcweir } 1143*cdf0e10cSrcweir return nRet; 1144*cdf0e10cSrcweir } 1145*cdf0e10cSrcweir //----------------------------------------------------------------- 1146*cdf0e10cSrcweir void SwTOXSelectTabPage::SelectType(TOXTypes eSet) 1147*cdf0e10cSrcweir { 1148*cdf0e10cSrcweir CurTOXType eCurType (eSet, 0); 1149*cdf0e10cSrcweir 1150*cdf0e10cSrcweir long nData = lcl_TOXTypesToUserData(eCurType); 1151*cdf0e10cSrcweir aTypeLB.SelectEntryPos(aTypeLB.GetEntryPos((void*)nData)); 1152*cdf0e10cSrcweir aTypeFT.Enable(sal_False); 1153*cdf0e10cSrcweir aTypeLB.Enable(sal_False); 1154*cdf0e10cSrcweir TOXTypeHdl(&aTypeLB); 1155*cdf0e10cSrcweir } 1156*cdf0e10cSrcweir 1157*cdf0e10cSrcweir /*-- 14.06.99 13:10:45--------------------------------------------------- 1158*cdf0e10cSrcweir 1159*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1160*cdf0e10cSrcweir //----------------------------------------------------------------- 1161*cdf0e10cSrcweir CurTOXType lcl_UserData2TOXTypes(sal_uInt16 nData) 1162*cdf0e10cSrcweir { 1163*cdf0e10cSrcweir CurTOXType eRet; 1164*cdf0e10cSrcweir 1165*cdf0e10cSrcweir switch(nData&0xff) 1166*cdf0e10cSrcweir { 1167*cdf0e10cSrcweir case TO_INDEX : eRet.eType = TOX_INDEX; break; 1168*cdf0e10cSrcweir case TO_USER : 1169*cdf0e10cSrcweir { 1170*cdf0e10cSrcweir eRet.eType = TOX_USER; 1171*cdf0e10cSrcweir eRet.nIndex = (nData&0xff00) >> 8; 1172*cdf0e10cSrcweir } 1173*cdf0e10cSrcweir break; 1174*cdf0e10cSrcweir case TO_CONTENT : eRet.eType = TOX_CONTENT; break; 1175*cdf0e10cSrcweir case TO_ILLUSTRATION: eRet.eType = TOX_ILLUSTRATIONS; break; 1176*cdf0e10cSrcweir case TO_OBJECT : eRet.eType = TOX_OBJECTS; break; 1177*cdf0e10cSrcweir case TO_TABLE : eRet.eType = TOX_TABLES; break; 1178*cdf0e10cSrcweir case TO_AUTHORITIES : eRet.eType = TOX_AUTHORITIES; break; 1179*cdf0e10cSrcweir default: DBG_ERROR("what a type?"); 1180*cdf0e10cSrcweir } 1181*cdf0e10cSrcweir return eRet; 1182*cdf0e10cSrcweir } 1183*cdf0e10cSrcweir /* -----------------02.09.99 08:16------------------- 1184*cdf0e10cSrcweir 1185*cdf0e10cSrcweir --------------------------------------------------*/ 1186*cdf0e10cSrcweir void SwTOXSelectTabPage::ApplyTOXDescription() 1187*cdf0e10cSrcweir { 1188*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 1189*cdf0e10cSrcweir const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); 1190*cdf0e10cSrcweir SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType); 1191*cdf0e10cSrcweir aReadOnlyCB.Check(rDesc.IsReadonly()); 1192*cdf0e10cSrcweir if(aTitleED.GetText() == aTitleED.GetSavedValue()) 1193*cdf0e10cSrcweir { 1194*cdf0e10cSrcweir if(rDesc.GetTitle()) 1195*cdf0e10cSrcweir aTitleED.SetText(*rDesc.GetTitle()); 1196*cdf0e10cSrcweir else 1197*cdf0e10cSrcweir aTitleED.SetText(aEmptyStr); 1198*cdf0e10cSrcweir aTitleED.SaveValue(); 1199*cdf0e10cSrcweir } 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir aAreaLB.SelectEntryPos(rDesc.IsFromChapter() ? 1 : 0); 1202*cdf0e10cSrcweir 1203*cdf0e10cSrcweir if(aCurType.eType != TOX_INDEX) 1204*cdf0e10cSrcweir aLevelNF.SetValue(rDesc.GetLevel()); //content, user 1205*cdf0e10cSrcweir 1206*cdf0e10cSrcweir sal_uInt16 nCreateType = rDesc.GetContentOptions(); 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir //user + content 1209*cdf0e10cSrcweir sal_Bool bHasStyleNames = sal_False; 1210*cdf0e10cSrcweir sal_uInt16 i; 1211*cdf0e10cSrcweir 1212*cdf0e10cSrcweir for( i = 0; i < MAXLEVEL; i++) 1213*cdf0e10cSrcweir if(rDesc.GetStyleNames(i).Len()) 1214*cdf0e10cSrcweir { 1215*cdf0e10cSrcweir bHasStyleNames = sal_True; 1216*cdf0e10cSrcweir break; 1217*cdf0e10cSrcweir } 1218*cdf0e10cSrcweir aAddStylesCB.Check(bHasStyleNames && (nCreateType & nsSwTOXElement::TOX_TEMPLATE)); 1219*cdf0e10cSrcweir 1220*cdf0e10cSrcweir aFromOLECB. Check( 0 != (nCreateType & nsSwTOXElement::TOX_OLE) ); 1221*cdf0e10cSrcweir aFromTablesCB. Check( 0 != (nCreateType & nsSwTOXElement::TOX_TABLE) ); 1222*cdf0e10cSrcweir aFromGraphicsCB.Check( 0 != (nCreateType & nsSwTOXElement::TOX_GRAPHIC) ); 1223*cdf0e10cSrcweir aFromFramesCB. Check( 0 != (nCreateType & nsSwTOXElement::TOX_FRAME) ); 1224*cdf0e10cSrcweir 1225*cdf0e10cSrcweir aLevelFromChapterCB.Check(rDesc.IsLevelFromChapter()); 1226*cdf0e10cSrcweir 1227*cdf0e10cSrcweir //all but illustration and table 1228*cdf0e10cSrcweir aTOXMarksCB.Check( 0 != (nCreateType & nsSwTOXElement::TOX_MARK) ); 1229*cdf0e10cSrcweir 1230*cdf0e10cSrcweir //content 1231*cdf0e10cSrcweir if(TOX_CONTENT == aCurType.eType) 1232*cdf0e10cSrcweir { 1233*cdf0e10cSrcweir aFromHeadingsCB.Check( 0 != (nCreateType & nsSwTOXElement::TOX_OUTLINELEVEL) ); 1234*cdf0e10cSrcweir //aChapterDlgPB.Enable(aFromHeadingsCB.IsChecked());//#outline level,removed by zhaojianwei 1235*cdf0e10cSrcweir aAddStylesCB.SetText(sAddStyleContent); 1236*cdf0e10cSrcweir aAddStylesPB.Enable(aAddStylesCB.IsChecked()); 1237*cdf0e10cSrcweir } 1238*cdf0e10cSrcweir //index only 1239*cdf0e10cSrcweir else if(TOX_INDEX == aCurType.eType) 1240*cdf0e10cSrcweir { 1241*cdf0e10cSrcweir sal_uInt16 nIndexOptions = rDesc.GetIndexOptions(); 1242*cdf0e10cSrcweir aCollectSameCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_SAME_ENTRY) ); 1243*cdf0e10cSrcweir aUseFFCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_FF) ); 1244*cdf0e10cSrcweir aUseDashCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_DASH) ); 1245*cdf0e10cSrcweir if(aUseFFCB.IsChecked()) 1246*cdf0e10cSrcweir aUseDashCB.Enable(sal_False); 1247*cdf0e10cSrcweir else if(aUseDashCB.IsChecked()) 1248*cdf0e10cSrcweir aUseFFCB.Enable(sal_False); 1249*cdf0e10cSrcweir 1250*cdf0e10cSrcweir aCaseSensitiveCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_CASE_SENSITIVE) ); 1251*cdf0e10cSrcweir aInitialCapsCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_INITIAL_CAPS) ); 1252*cdf0e10cSrcweir aKeyAsEntryCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_KEY_AS_ENTRY) ); 1253*cdf0e10cSrcweir } 1254*cdf0e10cSrcweir else if(TOX_ILLUSTRATIONS == aCurType.eType || 1255*cdf0e10cSrcweir TOX_TABLES == aCurType.eType) 1256*cdf0e10cSrcweir { 1257*cdf0e10cSrcweir aFromObjectNamesRB.Check(rDesc.IsCreateFromObjectNames()); 1258*cdf0e10cSrcweir aFromCaptionsRB.Check(!rDesc.IsCreateFromObjectNames()); 1259*cdf0e10cSrcweir aCaptionSequenceLB.SelectEntry(rDesc.GetSequenceName()); 1260*cdf0e10cSrcweir aDisplayTypeLB.SelectEntryPos( static_cast< sal_uInt16 >(rDesc.GetCaptionDisplay()) ); 1261*cdf0e10cSrcweir RadioButtonHdl(&aFromCaptionsRB); 1262*cdf0e10cSrcweir 1263*cdf0e10cSrcweir } 1264*cdf0e10cSrcweir else if(TOX_OBJECTS == aCurType.eType) 1265*cdf0e10cSrcweir { 1266*cdf0e10cSrcweir long nOLEData = rDesc.GetOLEOptions(); 1267*cdf0e10cSrcweir for(sal_uInt16 nFromObj = 0; nFromObj < aFromObjCLB.GetEntryCount(); nFromObj++) 1268*cdf0e10cSrcweir { 1269*cdf0e10cSrcweir long nData = (long)aFromObjCLB.GetEntryData(nFromObj); 1270*cdf0e10cSrcweir aFromObjCLB.CheckEntryPos(nFromObj, 0 != (nData & nOLEData)); 1271*cdf0e10cSrcweir } 1272*cdf0e10cSrcweir } 1273*cdf0e10cSrcweir else if(TOX_AUTHORITIES == aCurType.eType) 1274*cdf0e10cSrcweir { 1275*cdf0e10cSrcweir String sBrackets(rDesc.GetAuthBrackets()); 1276*cdf0e10cSrcweir if(!sBrackets.Len() || sBrackets.EqualsAscii(" ")) 1277*cdf0e10cSrcweir aBracketLB.SelectEntryPos(0); 1278*cdf0e10cSrcweir else 1279*cdf0e10cSrcweir aBracketLB.SelectEntry(sBrackets); 1280*cdf0e10cSrcweir aSequenceCB.Check(rDesc.IsAuthSequence()); 1281*cdf0e10cSrcweir } 1282*cdf0e10cSrcweir aAutoMarkPB.Enable(aFromFileCB.IsChecked()); 1283*cdf0e10cSrcweir 1284*cdf0e10cSrcweir for(i = 0; i < MAXLEVEL; i++) 1285*cdf0e10cSrcweir aStyleArr[i] = rDesc.GetStyleNames(i); 1286*cdf0e10cSrcweir 1287*cdf0e10cSrcweir aLanguageLB.SelectLanguage(rDesc.GetLanguage()); 1288*cdf0e10cSrcweir LanguageHdl(0); 1289*cdf0e10cSrcweir for( long nCnt = 0; nCnt < aSortAlgorithmLB.GetEntryCount(); ++nCnt ) 1290*cdf0e10cSrcweir { 1291*cdf0e10cSrcweir const String* pEntryData = (const String*)aSortAlgorithmLB.GetEntryData( (sal_uInt16)nCnt ); 1292*cdf0e10cSrcweir DBG_ASSERT(pEntryData, "no entry data available"); 1293*cdf0e10cSrcweir if( pEntryData && *pEntryData == rDesc.GetSortAlgorithm()) 1294*cdf0e10cSrcweir { 1295*cdf0e10cSrcweir aSortAlgorithmLB.SelectEntryPos( (sal_uInt16)nCnt ); 1296*cdf0e10cSrcweir break; 1297*cdf0e10cSrcweir } 1298*cdf0e10cSrcweir } 1299*cdf0e10cSrcweir } 1300*cdf0e10cSrcweir /* -----------------09.09.99 11:57------------------- 1301*cdf0e10cSrcweir 1302*cdf0e10cSrcweir --------------------------------------------------*/ 1303*cdf0e10cSrcweir void SwTOXSelectTabPage::FillTOXDescription() 1304*cdf0e10cSrcweir { 1305*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 1306*cdf0e10cSrcweir CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); 1307*cdf0e10cSrcweir SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType); 1308*cdf0e10cSrcweir rDesc.SetTitle(aTitleED.GetText()); 1309*cdf0e10cSrcweir rDesc.SetFromChapter(1 == aAreaLB.GetSelectEntryPos()); 1310*cdf0e10cSrcweir sal_uInt16 nContentOptions = 0; 1311*cdf0e10cSrcweir if(aTOXMarksCB.IsVisible() && aTOXMarksCB.IsChecked()) 1312*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_MARK; 1313*cdf0e10cSrcweir 1314*cdf0e10cSrcweir sal_uInt16 nIndexOptions = rDesc.GetIndexOptions()&nsSwTOIOptions::TOI_ALPHA_DELIMITTER; 1315*cdf0e10cSrcweir switch(rDesc.GetTOXType()) 1316*cdf0e10cSrcweir { 1317*cdf0e10cSrcweir case TOX_CONTENT: 1318*cdf0e10cSrcweir if(aFromHeadingsCB.IsChecked()) 1319*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_OUTLINELEVEL; 1320*cdf0e10cSrcweir break; 1321*cdf0e10cSrcweir case TOX_USER: 1322*cdf0e10cSrcweir { 1323*cdf0e10cSrcweir rDesc.SetTOUName(aTypeLB.GetSelectEntry()); 1324*cdf0e10cSrcweir 1325*cdf0e10cSrcweir if(aFromOLECB.IsChecked()) 1326*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_OLE; 1327*cdf0e10cSrcweir if(aFromTablesCB.IsChecked()) 1328*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_TABLE; 1329*cdf0e10cSrcweir if(aFromFramesCB.IsChecked()) 1330*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_FRAME; 1331*cdf0e10cSrcweir if(aFromGraphicsCB.IsChecked()) 1332*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_GRAPHIC; 1333*cdf0e10cSrcweir } 1334*cdf0e10cSrcweir break; 1335*cdf0e10cSrcweir case TOX_INDEX: 1336*cdf0e10cSrcweir { 1337*cdf0e10cSrcweir nContentOptions = nsSwTOXElement::TOX_MARK; 1338*cdf0e10cSrcweir 1339*cdf0e10cSrcweir if(aCollectSameCB.IsChecked()) 1340*cdf0e10cSrcweir nIndexOptions |= nsSwTOIOptions::TOI_SAME_ENTRY; 1341*cdf0e10cSrcweir if(aUseFFCB.IsChecked()) 1342*cdf0e10cSrcweir nIndexOptions |= nsSwTOIOptions::TOI_FF; 1343*cdf0e10cSrcweir if(aUseDashCB.IsChecked()) 1344*cdf0e10cSrcweir nIndexOptions |= nsSwTOIOptions::TOI_DASH; 1345*cdf0e10cSrcweir if(aCaseSensitiveCB.IsChecked()) 1346*cdf0e10cSrcweir nIndexOptions |= nsSwTOIOptions::TOI_CASE_SENSITIVE; 1347*cdf0e10cSrcweir if(aInitialCapsCB.IsChecked()) 1348*cdf0e10cSrcweir nIndexOptions |= nsSwTOIOptions::TOI_INITIAL_CAPS; 1349*cdf0e10cSrcweir if(aKeyAsEntryCB.IsChecked()) 1350*cdf0e10cSrcweir nIndexOptions |= nsSwTOIOptions::TOI_KEY_AS_ENTRY; 1351*cdf0e10cSrcweir if(aFromFileCB.IsChecked()) 1352*cdf0e10cSrcweir rDesc.SetAutoMarkURL(sAutoMarkURL); 1353*cdf0e10cSrcweir else 1354*cdf0e10cSrcweir rDesc.SetAutoMarkURL(aEmptyStr); 1355*cdf0e10cSrcweir } 1356*cdf0e10cSrcweir break; 1357*cdf0e10cSrcweir case TOX_ILLUSTRATIONS: 1358*cdf0e10cSrcweir case TOX_TABLES : 1359*cdf0e10cSrcweir rDesc.SetCreateFromObjectNames(aFromObjectNamesRB.IsChecked()); 1360*cdf0e10cSrcweir rDesc.SetSequenceName(aCaptionSequenceLB.GetSelectEntry()); 1361*cdf0e10cSrcweir rDesc.SetCaptionDisplay((SwCaptionDisplay)aDisplayTypeLB.GetSelectEntryPos()); 1362*cdf0e10cSrcweir break; 1363*cdf0e10cSrcweir case TOX_OBJECTS: 1364*cdf0e10cSrcweir { 1365*cdf0e10cSrcweir long nOLEData = 0; 1366*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aFromObjCLB.GetEntryCount(); i++) 1367*cdf0e10cSrcweir { 1368*cdf0e10cSrcweir if(aFromObjCLB.IsChecked(i)) 1369*cdf0e10cSrcweir { 1370*cdf0e10cSrcweir long nData = (long)aFromObjCLB.GetEntryData(i); 1371*cdf0e10cSrcweir nOLEData |= nData; 1372*cdf0e10cSrcweir } 1373*cdf0e10cSrcweir } 1374*cdf0e10cSrcweir rDesc.SetOLEOptions((sal_uInt16)nOLEData); 1375*cdf0e10cSrcweir } 1376*cdf0e10cSrcweir break; 1377*cdf0e10cSrcweir case TOX_AUTHORITIES: 1378*cdf0e10cSrcweir { 1379*cdf0e10cSrcweir if(aBracketLB.GetSelectEntryPos()) 1380*cdf0e10cSrcweir rDesc.SetAuthBrackets(aBracketLB.GetSelectEntry()); 1381*cdf0e10cSrcweir else 1382*cdf0e10cSrcweir rDesc.SetAuthBrackets(aEmptyStr); 1383*cdf0e10cSrcweir rDesc.SetAuthSequence(aSequenceCB.IsChecked()); 1384*cdf0e10cSrcweir } 1385*cdf0e10cSrcweir break; 1386*cdf0e10cSrcweir } 1387*cdf0e10cSrcweir 1388*cdf0e10cSrcweir rDesc.SetLevelFromChapter( aLevelFromChapterCB.IsVisible() && 1389*cdf0e10cSrcweir aLevelFromChapterCB.IsChecked()); 1390*cdf0e10cSrcweir if(aTOXMarksCB.IsChecked() && aTOXMarksCB.IsVisible()) 1391*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_MARK; 1392*cdf0e10cSrcweir if(aFromHeadingsCB.IsChecked() && aFromHeadingsCB.IsVisible()) 1393*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_OUTLINELEVEL; 1394*cdf0e10cSrcweir if(aAddStylesCB.IsChecked() && aAddStylesCB.IsVisible()) 1395*cdf0e10cSrcweir nContentOptions |= nsSwTOXElement::TOX_TEMPLATE; 1396*cdf0e10cSrcweir 1397*cdf0e10cSrcweir rDesc.SetContentOptions(nContentOptions); 1398*cdf0e10cSrcweir rDesc.SetIndexOptions(nIndexOptions); 1399*cdf0e10cSrcweir rDesc.SetLevel( static_cast< sal_uInt8 >(aLevelNF.GetValue()) ); 1400*cdf0e10cSrcweir 1401*cdf0e10cSrcweir rDesc.SetReadonly(aReadOnlyCB.IsChecked()); 1402*cdf0e10cSrcweir 1403*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < MAXLEVEL; i++) 1404*cdf0e10cSrcweir rDesc.SetStyleNames(aStyleArr[i], i); 1405*cdf0e10cSrcweir 1406*cdf0e10cSrcweir rDesc.SetLanguage(aLanguageLB.GetSelectLanguage()); 1407*cdf0e10cSrcweir const String* pEntryData = (const String*)aSortAlgorithmLB.GetEntryData( 1408*cdf0e10cSrcweir aSortAlgorithmLB.GetSelectEntryPos() ); 1409*cdf0e10cSrcweir DBG_ASSERT(pEntryData, "no entry data available"); 1410*cdf0e10cSrcweir if(pEntryData) 1411*cdf0e10cSrcweir rDesc.SetSortAlgorithm(*pEntryData); 1412*cdf0e10cSrcweir } 1413*cdf0e10cSrcweir /* -----------------05.07.99 15:09------------------- 1414*cdf0e10cSrcweir 1415*cdf0e10cSrcweir --------------------------------------------------*/ 1416*cdf0e10cSrcweir void SwTOXSelectTabPage::Reset( const SfxItemSet& ) 1417*cdf0e10cSrcweir { 1418*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 1419*cdf0e10cSrcweir SwWrtShell& rSh = pTOXDlg->GetWrtShell(); 1420*cdf0e10cSrcweir const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); 1421*cdf0e10cSrcweir long nData = lcl_TOXTypesToUserData(aCurType); 1422*cdf0e10cSrcweir aTypeLB.SelectEntryPos(aTypeLB.GetEntryPos((void*)nData)); 1423*cdf0e10cSrcweir 1424*cdf0e10cSrcweir sAutoMarkURL = INetURLObject::decode( rSh.GetTOIAutoMarkURL(), 1425*cdf0e10cSrcweir INET_HEX_ESCAPE, 1426*cdf0e10cSrcweir INetURLObject::DECODE_UNAMBIGUOUS, 1427*cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 ); 1428*cdf0e10cSrcweir aFromFileCB.Check( 0 != sAutoMarkURL.Len() ); 1429*cdf0e10cSrcweir 1430*cdf0e10cSrcweir aCaptionSequenceLB.Clear(); 1431*cdf0e10cSrcweir sal_uInt16 i, nCount = rSh.GetFldTypeCount(RES_SETEXPFLD); 1432*cdf0e10cSrcweir for (i = 0; i < nCount; i++) 1433*cdf0e10cSrcweir { 1434*cdf0e10cSrcweir SwFieldType *pType = rSh.GetFldType( i, RES_SETEXPFLD ); 1435*cdf0e10cSrcweir if( pType->Which() == RES_SETEXPFLD && 1436*cdf0e10cSrcweir ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) 1437*cdf0e10cSrcweir aCaptionSequenceLB.InsertEntry(pType->GetName()); 1438*cdf0e10cSrcweir } 1439*cdf0e10cSrcweir 1440*cdf0e10cSrcweir if(pTOXDlg->IsTOXEditMode()) 1441*cdf0e10cSrcweir { 1442*cdf0e10cSrcweir aTypeFT.Enable(sal_False); 1443*cdf0e10cSrcweir aTypeLB.Enable(sal_False); 1444*cdf0e10cSrcweir } 1445*cdf0e10cSrcweir TOXTypeHdl(&aTypeLB); 1446*cdf0e10cSrcweir CheckBoxHdl(&aAddStylesCB); 1447*cdf0e10cSrcweir } 1448*cdf0e10cSrcweir /*-- 14.06.99 13:10:52--------------------------------------------------- 1449*cdf0e10cSrcweir 1450*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1451*cdf0e10cSrcweir void SwTOXSelectTabPage::ActivatePage( const SfxItemSet& ) 1452*cdf0e10cSrcweir { 1453*cdf0e10cSrcweir //nothing to do 1454*cdf0e10cSrcweir } 1455*cdf0e10cSrcweir /*-- 14.06.99 13:11:00--------------------------------------------------- 1456*cdf0e10cSrcweir 1457*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1458*cdf0e10cSrcweir int SwTOXSelectTabPage::DeactivatePage( SfxItemSet* _pSet ) 1459*cdf0e10cSrcweir { 1460*cdf0e10cSrcweir if(_pSet) 1461*cdf0e10cSrcweir _pSet->Put(SfxUInt16Item(FN_PARAM_TOX_TYPE, 1462*cdf0e10cSrcweir (sal_uInt16)(long)aTypeLB.GetEntryData( aTypeLB.GetSelectEntryPos() ))); 1463*cdf0e10cSrcweir FillTOXDescription(); 1464*cdf0e10cSrcweir return LEAVE_PAGE; 1465*cdf0e10cSrcweir } 1466*cdf0e10cSrcweir /* -----------------14.06.99 13:10------------------- 1467*cdf0e10cSrcweir 1468*cdf0e10cSrcweir --------------------------------------------------*/ 1469*cdf0e10cSrcweir SfxTabPage* SwTOXSelectTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet) 1470*cdf0e10cSrcweir { 1471*cdf0e10cSrcweir return new SwTOXSelectTabPage(pParent, rAttrSet); 1472*cdf0e10cSrcweir } 1473*cdf0e10cSrcweir /* -----------------14.06.99 13:10------------------- 1474*cdf0e10cSrcweir 1475*cdf0e10cSrcweir --------------------------------------------------*/ 1476*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, TOXTypeHdl, ListBox*, pBox) 1477*cdf0e10cSrcweir { 1478*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 1479*cdf0e10cSrcweir if(!bFirstCall) 1480*cdf0e10cSrcweir { 1481*cdf0e10cSrcweir // save current values into the proper TOXDescription 1482*cdf0e10cSrcweir FillTOXDescription(); 1483*cdf0e10cSrcweir } 1484*cdf0e10cSrcweir bFirstCall = sal_False; 1485*cdf0e10cSrcweir const sal_uInt16 nType = sal::static_int_cast< sal_uInt16 >(reinterpret_cast< sal_uIntPtr >( 1486*cdf0e10cSrcweir pBox->GetEntryData( pBox->GetSelectEntryPos() ))); 1487*cdf0e10cSrcweir CurTOXType eCurType = lcl_UserData2TOXTypes(nType); 1488*cdf0e10cSrcweir pTOXDlg->SetCurrentTOXType(eCurType); 1489*cdf0e10cSrcweir 1490*cdf0e10cSrcweir aAreaLB.Show( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_INDEX|TO_TABLE|TO_OBJECT)) ); 1491*cdf0e10cSrcweir aLevelFT.Show( 0 != (nType & (TO_CONTENT)) ); 1492*cdf0e10cSrcweir aLevelNF.Show( 0 != (nType & (TO_CONTENT)) ); 1493*cdf0e10cSrcweir aLevelFromChapterCB.Show( 0 != (nType & (TO_USER)) ); 1494*cdf0e10cSrcweir aAreaFT.Show( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_INDEX|TO_TABLE|TO_OBJECT)) ); 1495*cdf0e10cSrcweir aAreaFL.Show( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_INDEX|TO_TABLE|TO_OBJECT)) ); 1496*cdf0e10cSrcweir 1497*cdf0e10cSrcweir aFromHeadingsCB.Show( 0 != (nType & (TO_CONTENT)) ); 1498*cdf0e10cSrcweir // aChapterDlgPB.Show( 0 != (nType & (TO_CONTENT)) );//#outline level,removed by zhaojianwei 1499*cdf0e10cSrcweir aAddStylesCB.Show( 0 != (nType & (TO_CONTENT|TO_USER)) ); 1500*cdf0e10cSrcweir aAddStylesPB.Show( 0 != (nType & (TO_CONTENT|TO_USER)) ); 1501*cdf0e10cSrcweir 1502*cdf0e10cSrcweir aFromTablesCB.Show( 0 != (nType & (TO_USER)) ); 1503*cdf0e10cSrcweir aFromFramesCB.Show( 0 != (nType & (TO_USER)) ); 1504*cdf0e10cSrcweir aFromGraphicsCB.Show( 0 != (nType & (TO_USER)) ); 1505*cdf0e10cSrcweir aFromOLECB.Show( 0 != (nType & (TO_USER)) ); 1506*cdf0e10cSrcweir 1507*cdf0e10cSrcweir aFromCaptionsRB.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) ); 1508*cdf0e10cSrcweir aFromObjectNamesRB.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) ); 1509*cdf0e10cSrcweir 1510*cdf0e10cSrcweir aTOXMarksCB.Show( 0 != (nType & (TO_CONTENT|TO_USER)) ); 1511*cdf0e10cSrcweir 1512*cdf0e10cSrcweir aCreateFromFL.Show( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_TABLE)) ); 1513*cdf0e10cSrcweir aCaptionSequenceFT.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) ); 1514*cdf0e10cSrcweir aCaptionSequenceLB.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) ); 1515*cdf0e10cSrcweir aDisplayTypeFT.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) ); 1516*cdf0e10cSrcweir aDisplayTypeLB.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) ); 1517*cdf0e10cSrcweir 1518*cdf0e10cSrcweir aSequenceCB.Show( 0 != (nType & TO_AUTHORITIES) ); 1519*cdf0e10cSrcweir aBracketFT.Show( 0 != (nType & TO_AUTHORITIES) ); 1520*cdf0e10cSrcweir aBracketLB.Show( 0 != (nType & TO_AUTHORITIES) ); 1521*cdf0e10cSrcweir aAuthorityFormatFL.Show( 0 != (nType & TO_AUTHORITIES) ); 1522*cdf0e10cSrcweir 1523*cdf0e10cSrcweir sal_Bool bEnableSortLanguage = 0 != (nType & (TO_INDEX|TO_AUTHORITIES)); 1524*cdf0e10cSrcweir aSortOptionsFL.Show(bEnableSortLanguage); 1525*cdf0e10cSrcweir aLanguageFT.Show(bEnableSortLanguage); 1526*cdf0e10cSrcweir aLanguageLB.Show(bEnableSortLanguage); 1527*cdf0e10cSrcweir aSortAlgorithmFT.Show(bEnableSortLanguage); 1528*cdf0e10cSrcweir aSortAlgorithmLB.Show(bEnableSortLanguage); 1529*cdf0e10cSrcweir 1530*cdf0e10cSrcweir //if(nType & TO_CONTENT) //#outline level,removed by zhaojianwei 1531*cdf0e10cSrcweir //{ 1532*cdf0e10cSrcweir //Point aPos(aAddStylesPB.GetPosPixel()); 1533*cdf0e10cSrcweir //aPos.X() = aChapterDlgPB.GetPosPixel().X(); 1534*cdf0e10cSrcweir //aAddStylesPB.SetPosPixel(aPos); 1535*cdf0e10cSrcweir //} 1536*cdf0e10cSrcweir //else if( nType & TO_ILLUSTRATION )//<-removed end. 1537*cdf0e10cSrcweir // initialize button positions 1538*cdf0e10cSrcweir 1539*cdf0e10cSrcweir //#i111993# add styles button has two different positions 1540*cdf0e10cSrcweir if( !aAddStylesPosDef.X() ) 1541*cdf0e10cSrcweir { 1542*cdf0e10cSrcweir aAddStylesPosDef = ( aAddStylesPB.GetPosPixel() ); 1543*cdf0e10cSrcweir // move left! 1544*cdf0e10cSrcweir Point aPos(aAddStylesPosDef); 1545*cdf0e10cSrcweir aPos.X() -= 2 * aAddStylesPB.GetSizePixel().Width(); 1546*cdf0e10cSrcweir aAddStylesPosUser = aPos; 1547*cdf0e10cSrcweir } 1548*cdf0e10cSrcweir 1549*cdf0e10cSrcweir if( nType & TO_ILLUSTRATION ) //add by zhaojianwei 1550*cdf0e10cSrcweir aCaptionSequenceLB.SelectEntry( SwStyleNameMapper::GetUIName( 1551*cdf0e10cSrcweir RES_POOLCOLL_LABEL_ABB, aEmptyStr )); 1552*cdf0e10cSrcweir else if( nType & TO_TABLE ) 1553*cdf0e10cSrcweir aCaptionSequenceLB.SelectEntry( SwStyleNameMapper::GetUIName( 1554*cdf0e10cSrcweir RES_POOLCOLL_LABEL_TABLE, aEmptyStr )); 1555*cdf0e10cSrcweir else if( nType & TO_USER ) 1556*cdf0e10cSrcweir { 1557*cdf0e10cSrcweir aAddStylesCB.SetText(sAddStyleUser); 1558*cdf0e10cSrcweir aAddStylesPB.SetPosPixel(aAddStylesPosUser); 1559*cdf0e10cSrcweir } 1560*cdf0e10cSrcweir else if( nType & TO_CONTENT ) 1561*cdf0e10cSrcweir { 1562*cdf0e10cSrcweir aAddStylesPB.SetPosPixel(aAddStylesPosDef); 1563*cdf0e10cSrcweir } 1564*cdf0e10cSrcweir 1565*cdf0e10cSrcweir aCollectSameCB.Show( 0 != (nType & TO_INDEX) ); 1566*cdf0e10cSrcweir aUseFFCB.Show( 0 != (nType & TO_INDEX) ); 1567*cdf0e10cSrcweir aUseDashCB.Show( 0 != (nType & TO_INDEX) ); 1568*cdf0e10cSrcweir aCaseSensitiveCB.Show( 0 != (nType & TO_INDEX) ); 1569*cdf0e10cSrcweir aInitialCapsCB.Show( 0 != (nType & TO_INDEX) ); 1570*cdf0e10cSrcweir aKeyAsEntryCB.Show( 0 != (nType & TO_INDEX) ); 1571*cdf0e10cSrcweir aFromFileCB.Show( 0 != (nType & TO_INDEX) ); 1572*cdf0e10cSrcweir aAutoMarkPB.Show( 0 != (nType & TO_INDEX) ); 1573*cdf0e10cSrcweir // aCreateAutoMarkPB.Show(nType &TO_INDEX); 1574*cdf0e10cSrcweir // aEditAutoMarkPB.Show(nType & TO_INDEX); 1575*cdf0e10cSrcweir 1576*cdf0e10cSrcweir aIdxOptionsFL.Show( 0 != (nType & TO_INDEX) ); 1577*cdf0e10cSrcweir 1578*cdf0e10cSrcweir //object index 1579*cdf0e10cSrcweir aFromObjCLB.Show( 0 != (nType & TO_OBJECT) ); 1580*cdf0e10cSrcweir aFromObjFL.Show( 0 != (nType & TO_OBJECT) ); 1581*cdf0e10cSrcweir 1582*cdf0e10cSrcweir //move controls 1583*cdf0e10cSrcweir aAddStylesCB.SetPosPixel(nType & TO_USER ? aCBLeftPos1 : aCBLeftPos2); 1584*cdf0e10cSrcweir Point aPBPos(aAddStylesPB.GetPosPixel()); 1585*cdf0e10cSrcweir aPBPos.Y() = nType & TO_USER ? aCBLeftPos1.Y() : aCBLeftPos2.Y(); 1586*cdf0e10cSrcweir aAddStylesPB.SetPosPixel(aPBPos); 1587*cdf0e10cSrcweir aTOXMarksCB.SetPosPixel(nType & TO_USER ? aCBLeftPos2 : aCBLeftPos3); 1588*cdf0e10cSrcweir //set control values from the proper TOXDescription 1589*cdf0e10cSrcweir { 1590*cdf0e10cSrcweir ApplyTOXDescription(); 1591*cdf0e10cSrcweir } 1592*cdf0e10cSrcweir ModifyHdl(0); 1593*cdf0e10cSrcweir return 0; 1594*cdf0e10cSrcweir } 1595*cdf0e10cSrcweir /* -----------------30.11.99 12:48------------------- 1596*cdf0e10cSrcweir 1597*cdf0e10cSrcweir --------------------------------------------------*/ 1598*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, ModifyHdl, void*, EMPTYARG) 1599*cdf0e10cSrcweir { 1600*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 1601*cdf0e10cSrcweir if(pTOXDlg) 1602*cdf0e10cSrcweir { 1603*cdf0e10cSrcweir FillTOXDescription(); 1604*cdf0e10cSrcweir pTOXDlg->CreateOrUpdateExample(pTOXDlg->GetCurrentTOXType().eType, TOX_PAGE_SELECT); 1605*cdf0e10cSrcweir } 1606*cdf0e10cSrcweir return 0; 1607*cdf0e10cSrcweir } 1608*cdf0e10cSrcweir /* -----------------05.07.99 10:13------------------- 1609*cdf0e10cSrcweir 1610*cdf0e10cSrcweir --------------------------------------------------*/ 1611*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, CheckBoxHdl, CheckBox*, pBox ) 1612*cdf0e10cSrcweir { 1613*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 1614*cdf0e10cSrcweir const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); 1615*cdf0e10cSrcweir if(TOX_CONTENT == aCurType.eType) 1616*cdf0e10cSrcweir { 1617*cdf0e10cSrcweir //at least one of the three CheckBoxes must be checked 1618*cdf0e10cSrcweir if(!aAddStylesCB.IsChecked() && !aFromHeadingsCB.IsChecked() && !aTOXMarksCB.IsChecked()) 1619*cdf0e10cSrcweir { 1620*cdf0e10cSrcweir //TODO: InfoBox? 1621*cdf0e10cSrcweir pBox->Check(sal_True); 1622*cdf0e10cSrcweir } 1623*cdf0e10cSrcweir aAddStylesPB.Enable(aAddStylesCB.IsChecked()); 1624*cdf0e10cSrcweir //aChapterDlgPB.Enable(aFromHeadingsCB.IsChecked());//#outline level,removed by zhaojianwei 1625*cdf0e10cSrcweir } 1626*cdf0e10cSrcweir if(TOX_USER == aCurType.eType) 1627*cdf0e10cSrcweir { 1628*cdf0e10cSrcweir aAddStylesPB.Enable(aAddStylesCB.IsChecked()); 1629*cdf0e10cSrcweir } 1630*cdf0e10cSrcweir else if(TOX_INDEX == aCurType.eType) 1631*cdf0e10cSrcweir { 1632*cdf0e10cSrcweir aAutoMarkPB.Enable(aFromFileCB.IsChecked()); 1633*cdf0e10cSrcweir aUseFFCB.Enable(aCollectSameCB.IsChecked() && !aUseDashCB.IsChecked()); 1634*cdf0e10cSrcweir aUseDashCB.Enable(aCollectSameCB.IsChecked() && !aUseFFCB.IsChecked()); 1635*cdf0e10cSrcweir aCaseSensitiveCB.Enable(aCollectSameCB.IsChecked()); 1636*cdf0e10cSrcweir } 1637*cdf0e10cSrcweir ModifyHdl(0); 1638*cdf0e10cSrcweir return 0; 1639*cdf0e10cSrcweir }; 1640*cdf0e10cSrcweir /* -----------------14.07.99 14:21------------------- 1641*cdf0e10cSrcweir 1642*cdf0e10cSrcweir --------------------------------------------------*/ 1643*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, RadioButtonHdl, RadioButton*, EMPTYARG ) 1644*cdf0e10cSrcweir { 1645*cdf0e10cSrcweir sal_Bool bEnable = aFromCaptionsRB.IsChecked(); 1646*cdf0e10cSrcweir aCaptionSequenceFT.Enable(bEnable); 1647*cdf0e10cSrcweir aCaptionSequenceLB.Enable(bEnable); 1648*cdf0e10cSrcweir aDisplayTypeFT.Enable(bEnable); 1649*cdf0e10cSrcweir aDisplayTypeLB.Enable(bEnable); 1650*cdf0e10cSrcweir ModifyHdl(0); 1651*cdf0e10cSrcweir return 0; 1652*cdf0e10cSrcweir } 1653*cdf0e10cSrcweir /* -----------------------------06.06.01 09:33-------------------------------- 1654*cdf0e10cSrcweir 1655*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1656*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, LanguageHdl, ListBox*, pBox) 1657*cdf0e10cSrcweir { 1658*cdf0e10cSrcweir Locale aLcl( SvxCreateLocale( aLanguageLB.GetSelectLanguage() ) ); 1659*cdf0e10cSrcweir Sequence< OUString > aSeq = pIndexEntryWrapper->GetAlgorithmList( aLcl ); 1660*cdf0e10cSrcweir 1661*cdf0e10cSrcweir if( !pIndexRes ) 1662*cdf0e10cSrcweir pIndexRes = new IndexEntryRessource(); 1663*cdf0e10cSrcweir 1664*cdf0e10cSrcweir String sOldString; 1665*cdf0e10cSrcweir void* pUserData; 1666*cdf0e10cSrcweir if( 0 != (pUserData = aSortAlgorithmLB.GetEntryData( aSortAlgorithmLB.GetSelectEntryPos())) ) 1667*cdf0e10cSrcweir sOldString = *(String*)pUserData; 1668*cdf0e10cSrcweir void* pDel; 1669*cdf0e10cSrcweir sal_uInt16 nEnd = aSortAlgorithmLB.GetEntryCount(); 1670*cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nEnd; ++n ) 1671*cdf0e10cSrcweir if( 0 != ( pDel = aSortAlgorithmLB.GetEntryData( n )) ) 1672*cdf0e10cSrcweir delete (String*)pDel; 1673*cdf0e10cSrcweir aSortAlgorithmLB.Clear(); 1674*cdf0e10cSrcweir 1675*cdf0e10cSrcweir sal_uInt16 nInsPos; 1676*cdf0e10cSrcweir String sAlg, sUINm; 1677*cdf0e10cSrcweir nEnd = static_cast< sal_uInt16 >(aSeq.getLength()); 1678*cdf0e10cSrcweir for( sal_uInt16 nCnt = 0; nCnt < nEnd; ++nCnt ) 1679*cdf0e10cSrcweir { 1680*cdf0e10cSrcweir sUINm = pIndexRes->GetTranslation( sAlg = aSeq[ nCnt ] ); 1681*cdf0e10cSrcweir nInsPos = aSortAlgorithmLB.InsertEntry( sUINm ); 1682*cdf0e10cSrcweir aSortAlgorithmLB.SetEntryData( nInsPos, new String( sAlg )); 1683*cdf0e10cSrcweir if( sAlg == sOldString ) 1684*cdf0e10cSrcweir aSortAlgorithmLB.SelectEntryPos( nInsPos ); 1685*cdf0e10cSrcweir } 1686*cdf0e10cSrcweir 1687*cdf0e10cSrcweir if( LISTBOX_ENTRY_NOTFOUND == aSortAlgorithmLB.GetSelectEntryPos() ) 1688*cdf0e10cSrcweir aSortAlgorithmLB.SelectEntryPos( 0 ); 1689*cdf0e10cSrcweir 1690*cdf0e10cSrcweir if(pBox) 1691*cdf0e10cSrcweir ModifyHdl(0); 1692*cdf0e10cSrcweir return 0; 1693*cdf0e10cSrcweir }; 1694*cdf0e10cSrcweir /* -----------------14.06.99 13:10------------------- 1695*cdf0e10cSrcweir 1696*cdf0e10cSrcweir --------------------------------------------------*/ 1697*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, TOXAreaHdl, ListBox*, pBox) 1698*cdf0e10cSrcweir { 1699*cdf0e10cSrcweir DBG_WARNING("not implemented"); 1700*cdf0e10cSrcweir switch((long)pBox->GetEntryData( pBox->GetSelectEntryPos() )) 1701*cdf0e10cSrcweir { 1702*cdf0e10cSrcweir case AREA_DOCUMENT : break; 1703*cdf0e10cSrcweir case AREA_CHAPTER : break; 1704*cdf0e10cSrcweir } 1705*cdf0e10cSrcweir return 0; 1706*cdf0e10cSrcweir } 1707*cdf0e10cSrcweir 1708*cdf0e10cSrcweir //#outline level, removed by zhaojianwei 1709*cdf0e10cSrcweir //It is no longer used! 1710*cdf0e10cSrcweir ///* -----------------14.06.99 13:10------------------- 1711*cdf0e10cSrcweir // 1712*cdf0e10cSrcweir // --------------------------------------------------*/ 1713*cdf0e10cSrcweir //IMPL_LINK(SwTOXSelectTabPage, ChapterHdl, PushButton*, pButton) 1714*cdf0e10cSrcweir //{ 1715*cdf0e10cSrcweir // SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 1716*cdf0e10cSrcweir // SwWrtShell& rSh = pTOXDlg->GetWrtShell(); 1717*cdf0e10cSrcweir // 1718*cdf0e10cSrcweir // SfxItemSet aTmp(rSh.GetView().GetPool(), FN_PARAM_1, FN_PARAM_1); 1719*cdf0e10cSrcweir // SwOutlineTabDialog* pDlg = new SwOutlineTabDialog(pButton, &aTmp, rSh); 1720*cdf0e10cSrcweir // 1721*cdf0e10cSrcweir // if(RET_OK == pDlg->Execute()) 1722*cdf0e10cSrcweir // { 1723*cdf0e10cSrcweir // CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); 1724*cdf0e10cSrcweir // SwForm* pForm = ((SwMultiTOXTabDialog*)GetTabDialog())->GetForm(aCurType); 1725*cdf0e10cSrcweir // // jetzt muss ueberprueft werden, ob dem sdbcx::Index Ueberschriftenvorlagen 1726*cdf0e10cSrcweir // // zugewiesen wurden 1727*cdf0e10cSrcweir // String sStr; 1728*cdf0e10cSrcweir // for(sal_uInt16 i = 0; i < MAXLEVEL; i++) 1729*cdf0e10cSrcweir // { 1730*cdf0e10cSrcweir // sal_Bool bNum = !SwMultiTOXTabDialog::IsNoNum(rSh, pForm->GetTemplate( i + 1 )); 1731*cdf0e10cSrcweir // if(bNum) 1732*cdf0e10cSrcweir // { 1733*cdf0e10cSrcweir // //es gibt getrennte Resourcebereiche fuer die Inhaltsverzeichnisse 1734*cdf0e10cSrcweir // if(i < 5) 1735*cdf0e10cSrcweir // SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_TOX_CNTNT1 + i), sStr ); 1736*cdf0e10cSrcweir // else 1737*cdf0e10cSrcweir // SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_TOX_CNTNT6 + i - 5), sStr ); 1738*cdf0e10cSrcweir // pForm->SetTemplate( i + 1, sStr ); 1739*cdf0e10cSrcweir // } 1740*cdf0e10cSrcweir // } 1741*cdf0e10cSrcweir // 1742*cdf0e10cSrcweir // } 1743*cdf0e10cSrcweir // delete pDlg; 1744*cdf0e10cSrcweir // return 0; 1745*cdf0e10cSrcweir //} 1746*cdf0e10cSrcweir /* -----------------14.06.99 13:10------------------- 1747*cdf0e10cSrcweir 1748*cdf0e10cSrcweir --------------------------------------------------*/ 1749*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, AddStylesHdl, PushButton*, pButton) 1750*cdf0e10cSrcweir { 1751*cdf0e10cSrcweir SwAddStylesDlg_Impl* pDlg = new SwAddStylesDlg_Impl(pButton, 1752*cdf0e10cSrcweir ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell(), 1753*cdf0e10cSrcweir aStyleArr); 1754*cdf0e10cSrcweir pDlg->Execute(); 1755*cdf0e10cSrcweir delete pDlg; 1756*cdf0e10cSrcweir ModifyHdl(0); 1757*cdf0e10cSrcweir return 0; 1758*cdf0e10cSrcweir } 1759*cdf0e10cSrcweir /* -----------------------------19.01.00 10:59-------------------------------- 1760*cdf0e10cSrcweir 1761*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1762*cdf0e10cSrcweir 1763*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, MenuEnableHdl, Menu*, pMenu) 1764*cdf0e10cSrcweir { 1765*cdf0e10cSrcweir pMenu->EnableItem(MN_AUTOMARK_EDIT, sAutoMarkURL.Len() > 0); 1766*cdf0e10cSrcweir return 0; 1767*cdf0e10cSrcweir } 1768*cdf0e10cSrcweir 1769*cdf0e10cSrcweir IMPL_LINK(SwTOXSelectTabPage, MenuExecuteHdl, Menu*, pMenu) 1770*cdf0e10cSrcweir { 1771*cdf0e10cSrcweir const String sSaveAutoMarkURL = sAutoMarkURL; 1772*cdf0e10cSrcweir switch(pMenu->GetCurItemId()) 1773*cdf0e10cSrcweir { 1774*cdf0e10cSrcweir case MN_AUTOMARK_OPEN: 1775*cdf0e10cSrcweir sAutoMarkURL = lcl_CreateAutoMarkFileDlg( 1776*cdf0e10cSrcweir sAutoMarkURL, sAutoMarkType, sal_True); 1777*cdf0e10cSrcweir break; 1778*cdf0e10cSrcweir case MN_AUTOMARK_NEW : 1779*cdf0e10cSrcweir sAutoMarkURL = lcl_CreateAutoMarkFileDlg( 1780*cdf0e10cSrcweir sAutoMarkURL, sAutoMarkType, sal_False); 1781*cdf0e10cSrcweir if( !sAutoMarkURL.Len() ) 1782*cdf0e10cSrcweir break; 1783*cdf0e10cSrcweir //no break 1784*cdf0e10cSrcweir case MN_AUTOMARK_EDIT: 1785*cdf0e10cSrcweir { 1786*cdf0e10cSrcweir sal_Bool bNew = pMenu->GetCurItemId()== MN_AUTOMARK_NEW; 1787*cdf0e10cSrcweir SwAutoMarkDlg_Impl* pAutoMarkDlg = new SwAutoMarkDlg_Impl( 1788*cdf0e10cSrcweir &aAutoMarkPB, sAutoMarkURL, sAutoMarkType, bNew ); 1789*cdf0e10cSrcweir 1790*cdf0e10cSrcweir if( RET_OK != pAutoMarkDlg->Execute() && bNew ) 1791*cdf0e10cSrcweir sAutoMarkURL = sSaveAutoMarkURL; 1792*cdf0e10cSrcweir delete pAutoMarkDlg; 1793*cdf0e10cSrcweir 1794*cdf0e10cSrcweir } 1795*cdf0e10cSrcweir break; 1796*cdf0e10cSrcweir } 1797*cdf0e10cSrcweir return 0; 1798*cdf0e10cSrcweir } 1799*cdf0e10cSrcweir 1800*cdf0e10cSrcweir /* -----------------16.06.99 10:46------------------- 1801*cdf0e10cSrcweir 1802*cdf0e10cSrcweir --------------------------------------------------*/ 1803*cdf0e10cSrcweir class SwTOXEdit : public Edit 1804*cdf0e10cSrcweir { 1805*cdf0e10cSrcweir SwFormToken aFormToken; 1806*cdf0e10cSrcweir Link aPrevNextControlLink; 1807*cdf0e10cSrcweir sal_Bool bNextControl; 1808*cdf0e10cSrcweir SwTokenWindow* m_pParent; 1809*cdf0e10cSrcweir public: 1810*cdf0e10cSrcweir SwTOXEdit( Window* pParent, SwTokenWindow* pTokenWin, 1811*cdf0e10cSrcweir const SwFormToken& aToken) 1812*cdf0e10cSrcweir : Edit( pParent, WB_BORDER|WB_TABSTOP|WB_CENTER), 1813*cdf0e10cSrcweir aFormToken(aToken), 1814*cdf0e10cSrcweir bNextControl(sal_False), 1815*cdf0e10cSrcweir m_pParent( pTokenWin ) 1816*cdf0e10cSrcweir { 1817*cdf0e10cSrcweir SetHelpId( HID_TOX_ENTRY_EDIT ); 1818*cdf0e10cSrcweir } 1819*cdf0e10cSrcweir 1820*cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvt ); 1821*cdf0e10cSrcweir virtual void RequestHelp( const HelpEvent& rHEvt ); 1822*cdf0e10cSrcweir 1823*cdf0e10cSrcweir sal_Bool IsNextControl() const {return bNextControl;} 1824*cdf0e10cSrcweir void SetPrevNextLink( const Link& rLink ) {aPrevNextControlLink = rLink;} 1825*cdf0e10cSrcweir 1826*cdf0e10cSrcweir const SwFormToken& GetFormToken() 1827*cdf0e10cSrcweir { 1828*cdf0e10cSrcweir aFormToken.sText = GetText(); 1829*cdf0e10cSrcweir return aFormToken; 1830*cdf0e10cSrcweir } 1831*cdf0e10cSrcweir 1832*cdf0e10cSrcweir void SetCharStyleName(const String& rSet, sal_uInt16 nPoolId) 1833*cdf0e10cSrcweir { 1834*cdf0e10cSrcweir aFormToken.sCharStyleName = rSet; 1835*cdf0e10cSrcweir aFormToken.nPoolId = nPoolId; 1836*cdf0e10cSrcweir } 1837*cdf0e10cSrcweir 1838*cdf0e10cSrcweir void AdjustSize(); 1839*cdf0e10cSrcweir }; 1840*cdf0e10cSrcweir 1841*cdf0e10cSrcweir //--------------------------------------------------- 1842*cdf0e10cSrcweir void SwTOXEdit::RequestHelp( const HelpEvent& rHEvt ) 1843*cdf0e10cSrcweir { 1844*cdf0e10cSrcweir if(!m_pParent->CreateQuickHelp(this, aFormToken, rHEvt)) 1845*cdf0e10cSrcweir Edit::RequestHelp(rHEvt); 1846*cdf0e10cSrcweir } 1847*cdf0e10cSrcweir //--------------------------------------------------- 1848*cdf0e10cSrcweir void SwTOXEdit::KeyInput( const KeyEvent& rKEvt ) 1849*cdf0e10cSrcweir { 1850*cdf0e10cSrcweir const Selection& rSel = GetSelection(); 1851*cdf0e10cSrcweir sal_uInt16 nTextLen = GetText().Len(); 1852*cdf0e10cSrcweir if( (rSel.A() == rSel.B() && 1853*cdf0e10cSrcweir !rSel.A() ) || rSel.A() == nTextLen ) 1854*cdf0e10cSrcweir { 1855*cdf0e10cSrcweir sal_Bool bCall = sal_False; 1856*cdf0e10cSrcweir KeyCode aCode = rKEvt.GetKeyCode(); 1857*cdf0e10cSrcweir if(aCode.GetCode() == KEY_RIGHT && rSel.A() == nTextLen) 1858*cdf0e10cSrcweir { 1859*cdf0e10cSrcweir bNextControl = sal_True; 1860*cdf0e10cSrcweir bCall = sal_True; 1861*cdf0e10cSrcweir } 1862*cdf0e10cSrcweir else if(aCode.GetCode() == KEY_LEFT && !rSel.A() ) 1863*cdf0e10cSrcweir { 1864*cdf0e10cSrcweir bNextControl = sal_False; 1865*cdf0e10cSrcweir bCall = sal_True; 1866*cdf0e10cSrcweir } 1867*cdf0e10cSrcweir 1868*cdf0e10cSrcweir if(bCall && aPrevNextControlLink.IsSet()) 1869*cdf0e10cSrcweir aPrevNextControlLink.Call(this); 1870*cdf0e10cSrcweir 1871*cdf0e10cSrcweir } 1872*cdf0e10cSrcweir Edit::KeyInput(rKEvt); 1873*cdf0e10cSrcweir } 1874*cdf0e10cSrcweir /* -----------------16.07.99 12:41------------------- 1875*cdf0e10cSrcweir 1876*cdf0e10cSrcweir --------------------------------------------------*/ 1877*cdf0e10cSrcweir void SwTOXEdit::AdjustSize() 1878*cdf0e10cSrcweir { 1879*cdf0e10cSrcweir Size aSize(GetSizePixel()); 1880*cdf0e10cSrcweir Size aTextSize(GetTextWidth(GetText()), GetTextHeight()); 1881*cdf0e10cSrcweir aTextSize = LogicToPixel(aTextSize); 1882*cdf0e10cSrcweir aSize.Width() = aTextSize.Width() + EDIT_MINWIDTH; 1883*cdf0e10cSrcweir SetSizePixel(aSize); 1884*cdf0e10cSrcweir } 1885*cdf0e10cSrcweir 1886*cdf0e10cSrcweir //--------------------------------------------------- 1887*cdf0e10cSrcweir //--------------------------------------------------- 1888*cdf0e10cSrcweir class SwTOXButton : public PushButton 1889*cdf0e10cSrcweir { 1890*cdf0e10cSrcweir SwFormToken aFormToken; 1891*cdf0e10cSrcweir Link aPrevNextControlLink; 1892*cdf0e10cSrcweir sal_Bool bNextControl; 1893*cdf0e10cSrcweir SwTokenWindow* m_pParent; 1894*cdf0e10cSrcweir public: 1895*cdf0e10cSrcweir SwTOXButton( Window* pParent, SwTokenWindow* pTokenWin, 1896*cdf0e10cSrcweir const SwFormToken& rToken) 1897*cdf0e10cSrcweir : PushButton(pParent, WB_BORDER|WB_TABSTOP), 1898*cdf0e10cSrcweir aFormToken(rToken), 1899*cdf0e10cSrcweir bNextControl(sal_False), 1900*cdf0e10cSrcweir m_pParent(pTokenWin) 1901*cdf0e10cSrcweir { 1902*cdf0e10cSrcweir SetHelpId(HID_TOX_ENTRY_BUTTON); 1903*cdf0e10cSrcweir } 1904*cdf0e10cSrcweir 1905*cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvt ); 1906*cdf0e10cSrcweir virtual void RequestHelp( const HelpEvent& rHEvt ); 1907*cdf0e10cSrcweir 1908*cdf0e10cSrcweir sal_Bool IsNextControl() const {return bNextControl;} 1909*cdf0e10cSrcweir void SetPrevNextLink(const Link& rLink) {aPrevNextControlLink = rLink;} 1910*cdf0e10cSrcweir const SwFormToken& GetFormToken() const {return aFormToken;} 1911*cdf0e10cSrcweir 1912*cdf0e10cSrcweir void SetCharStyleName(const String& rSet, sal_uInt16 nPoolId) 1913*cdf0e10cSrcweir { 1914*cdf0e10cSrcweir aFormToken.sCharStyleName = rSet; 1915*cdf0e10cSrcweir aFormToken.nPoolId = nPoolId; 1916*cdf0e10cSrcweir } 1917*cdf0e10cSrcweir 1918*cdf0e10cSrcweir void SetTabPosition(SwTwips nSet) 1919*cdf0e10cSrcweir { aFormToken.nTabStopPosition = nSet; } 1920*cdf0e10cSrcweir 1921*cdf0e10cSrcweir void SetFillChar( sal_Unicode cSet ) 1922*cdf0e10cSrcweir { aFormToken.cTabFillChar = cSet; } 1923*cdf0e10cSrcweir 1924*cdf0e10cSrcweir void SetTabAlign(SvxTabAdjust eAlign) 1925*cdf0e10cSrcweir { aFormToken.eTabAlign = eAlign;} 1926*cdf0e10cSrcweir 1927*cdf0e10cSrcweir //---> i89791 1928*cdf0e10cSrcweir //used for entry number format, in TOC only 1929*cdf0e10cSrcweir //needed for different UI dialog position 1930*cdf0e10cSrcweir void SetEntryNumberFormat(sal_uInt16 nSet) { 1931*cdf0e10cSrcweir switch(nSet) 1932*cdf0e10cSrcweir { 1933*cdf0e10cSrcweir default: 1934*cdf0e10cSrcweir case 0: 1935*cdf0e10cSrcweir aFormToken.nChapterFormat = CF_NUMBER; 1936*cdf0e10cSrcweir break; 1937*cdf0e10cSrcweir case 1: 1938*cdf0e10cSrcweir aFormToken.nChapterFormat = CF_NUM_NOPREPST_TITLE; 1939*cdf0e10cSrcweir break; 1940*cdf0e10cSrcweir } 1941*cdf0e10cSrcweir } 1942*cdf0e10cSrcweir 1943*cdf0e10cSrcweir void SetChapterInfo(sal_uInt16 nSet) { 1944*cdf0e10cSrcweir switch(nSet) 1945*cdf0e10cSrcweir { 1946*cdf0e10cSrcweir default: 1947*cdf0e10cSrcweir case 0: 1948*cdf0e10cSrcweir aFormToken.nChapterFormat = CF_NUM_NOPREPST_TITLE; 1949*cdf0e10cSrcweir break; 1950*cdf0e10cSrcweir case 1: 1951*cdf0e10cSrcweir aFormToken.nChapterFormat = CF_TITLE; 1952*cdf0e10cSrcweir break; 1953*cdf0e10cSrcweir case 2: 1954*cdf0e10cSrcweir aFormToken.nChapterFormat = CF_NUMBER_NOPREPST; 1955*cdf0e10cSrcweir break; 1956*cdf0e10cSrcweir } 1957*cdf0e10cSrcweir } 1958*cdf0e10cSrcweir //<--- 1959*cdf0e10cSrcweir sal_uInt16 GetChapterInfo() const{ return aFormToken.nChapterFormat;} 1960*cdf0e10cSrcweir 1961*cdf0e10cSrcweir void SetOutlineLevel( sal_uInt16 nSet ) { aFormToken.nOutlineLevel = nSet;}//i53420 1962*cdf0e10cSrcweir sal_uInt16 GetOutlineLevel() const{ return aFormToken.nOutlineLevel;} 1963*cdf0e10cSrcweir 1964*cdf0e10cSrcweir void SetLinkEnd() 1965*cdf0e10cSrcweir { 1966*cdf0e10cSrcweir DBG_ASSERT(TOKEN_LINK_START == aFormToken.eTokenType, 1967*cdf0e10cSrcweir "call SetLinkEnd for link start only!"); 1968*cdf0e10cSrcweir aFormToken.eTokenType = TOKEN_LINK_END; 1969*cdf0e10cSrcweir aFormToken.sText.AssignAscii(SwForm::aFormLinkEnd); 1970*cdf0e10cSrcweir SetText(aFormToken.sText); 1971*cdf0e10cSrcweir } 1972*cdf0e10cSrcweir void SetLinkStart() 1973*cdf0e10cSrcweir { 1974*cdf0e10cSrcweir DBG_ASSERT(TOKEN_LINK_END == aFormToken.eTokenType, 1975*cdf0e10cSrcweir "call SetLinkStart for link start only!"); 1976*cdf0e10cSrcweir aFormToken.eTokenType = TOKEN_LINK_START; 1977*cdf0e10cSrcweir aFormToken.sText.AssignAscii(SwForm::aFormLinkStt); 1978*cdf0e10cSrcweir SetText(aFormToken.sText); 1979*cdf0e10cSrcweir } 1980*cdf0e10cSrcweir }; 1981*cdf0e10cSrcweir 1982*cdf0e10cSrcweir //--------------------------------------------------- 1983*cdf0e10cSrcweir void SwTOXButton::KeyInput( const KeyEvent& rKEvt ) 1984*cdf0e10cSrcweir { 1985*cdf0e10cSrcweir sal_Bool bCall = sal_False; 1986*cdf0e10cSrcweir KeyCode aCode = rKEvt.GetKeyCode(); 1987*cdf0e10cSrcweir if(aCode.GetCode() == KEY_RIGHT) 1988*cdf0e10cSrcweir { 1989*cdf0e10cSrcweir bNextControl = sal_True; 1990*cdf0e10cSrcweir bCall = sal_True; 1991*cdf0e10cSrcweir } 1992*cdf0e10cSrcweir else if(aCode.GetCode() == KEY_LEFT ) 1993*cdf0e10cSrcweir { 1994*cdf0e10cSrcweir bNextControl = sal_False; 1995*cdf0e10cSrcweir bCall = sal_True; 1996*cdf0e10cSrcweir } 1997*cdf0e10cSrcweir else if(aCode.GetCode() == KEY_DELETE) 1998*cdf0e10cSrcweir { 1999*cdf0e10cSrcweir m_pParent->RemoveControl(this, sal_True); 2000*cdf0e10cSrcweir //this is invalid here 2001*cdf0e10cSrcweir return; 2002*cdf0e10cSrcweir } 2003*cdf0e10cSrcweir if(bCall && aPrevNextControlLink.IsSet()) 2004*cdf0e10cSrcweir aPrevNextControlLink.Call(this); 2005*cdf0e10cSrcweir else 2006*cdf0e10cSrcweir PushButton::KeyInput(rKEvt); 2007*cdf0e10cSrcweir } 2008*cdf0e10cSrcweir //--------------------------------------------------- 2009*cdf0e10cSrcweir void SwTOXButton::RequestHelp( const HelpEvent& rHEvt ) 2010*cdf0e10cSrcweir { 2011*cdf0e10cSrcweir if(!m_pParent->CreateQuickHelp(this, aFormToken, rHEvt)) 2012*cdf0e10cSrcweir Button::RequestHelp(rHEvt); 2013*cdf0e10cSrcweir } 2014*cdf0e10cSrcweir /* -----------------------------23.12.99 14:28-------------------------------- 2015*cdf0e10cSrcweir 2016*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2017*cdf0e10cSrcweir SwIdxTreeListBox::SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId) : 2018*cdf0e10cSrcweir SvTreeListBox(pPar, rResId), 2019*cdf0e10cSrcweir pParent(pPar) 2020*cdf0e10cSrcweir { 2021*cdf0e10cSrcweir } 2022*cdf0e10cSrcweir /* -----------------------------23.12.99 14:19-------------------------------- 2023*cdf0e10cSrcweir 2024*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2025*cdf0e10cSrcweir void SwIdxTreeListBox::RequestHelp( const HelpEvent& rHEvt ) 2026*cdf0e10cSrcweir { 2027*cdf0e10cSrcweir if( rHEvt.GetMode() & HELPMODE_QUICK ) 2028*cdf0e10cSrcweir { 2029*cdf0e10cSrcweir Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() )); 2030*cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry( aPos ); 2031*cdf0e10cSrcweir if( pEntry ) 2032*cdf0e10cSrcweir { 2033*cdf0e10cSrcweir sal_uInt16 nLevel = static_cast< sal_uInt16 >(GetModel()->GetAbsPos(pEntry)); 2034*cdf0e10cSrcweir String sEntry = pParent->GetLevelHelp(++nLevel); 2035*cdf0e10cSrcweir if('*' == sEntry) 2036*cdf0e10cSrcweir sEntry = GetEntryText(pEntry); 2037*cdf0e10cSrcweir if(sEntry.Len()) 2038*cdf0e10cSrcweir { 2039*cdf0e10cSrcweir SvLBoxTab* pTab; 2040*cdf0e10cSrcweir SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab ); 2041*cdf0e10cSrcweir if( pItem && SV_ITEM_ID_LBOXSTRING == pItem->IsA()) 2042*cdf0e10cSrcweir { 2043*cdf0e10cSrcweir aPos = GetEntryPosition( pEntry ); 2044*cdf0e10cSrcweir 2045*cdf0e10cSrcweir aPos.X() = GetTabPos( pEntry, pTab ); 2046*cdf0e10cSrcweir Size aSize( pItem->GetSize( this, pEntry ) ); 2047*cdf0e10cSrcweir 2048*cdf0e10cSrcweir if((aPos.X() + aSize.Width()) > GetSizePixel().Width()) 2049*cdf0e10cSrcweir aSize.Width() = GetSizePixel().Width() - aPos.X(); 2050*cdf0e10cSrcweir 2051*cdf0e10cSrcweir aPos = OutputToScreenPixel(aPos); 2052*cdf0e10cSrcweir Rectangle aItemRect( aPos, aSize ); 2053*cdf0e10cSrcweir Help::ShowQuickHelp( this, aItemRect, sEntry, 2054*cdf0e10cSrcweir QUICKHELP_LEFT|QUICKHELP_VCENTER ); 2055*cdf0e10cSrcweir } 2056*cdf0e10cSrcweir } 2057*cdf0e10cSrcweir } 2058*cdf0e10cSrcweir } 2059*cdf0e10cSrcweir else 2060*cdf0e10cSrcweir SvTreeListBox::RequestHelp(rHEvt); 2061*cdf0e10cSrcweir } 2062*cdf0e10cSrcweir //--------------------------------------------------- 2063*cdf0e10cSrcweir SwTOXEntryTabPage::SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet) : 2064*cdf0e10cSrcweir SfxTabPage(pParent, SW_RES(TP_TOX_ENTRY), rAttrSet), 2065*cdf0e10cSrcweir aLevelFT(this, SW_RES(FT_LEVEL )), 2066*cdf0e10cSrcweir aLevelLB(this, SW_RES(LB_LEVEL )), 2067*cdf0e10cSrcweir aEntryFL(this, SW_RES(FL_ENTRY )), 2068*cdf0e10cSrcweir 2069*cdf0e10cSrcweir aTokenFT(this, SW_RES(FT_TOKEN )), 2070*cdf0e10cSrcweir aTokenWIN(this, SW_RES(WIN_TOKEN )), 2071*cdf0e10cSrcweir aAllLevelsPB(this, SW_RES(PB_ALL_LEVELS )), 2072*cdf0e10cSrcweir 2073*cdf0e10cSrcweir aEntryNoPB(this, SW_RES(PB_ENTRYNO )), 2074*cdf0e10cSrcweir aEntryPB(this, SW_RES(PB_ENTRY )), 2075*cdf0e10cSrcweir aTabPB(this, SW_RES(PB_TAB )), 2076*cdf0e10cSrcweir aChapterInfoPB(this, SW_RES(PB_CHAPTERINFO )), 2077*cdf0e10cSrcweir aPageNoPB(this, SW_RES(PB_PAGENO )), 2078*cdf0e10cSrcweir aHyperLinkPB(this, SW_RES(PB_HYPERLINK )), 2079*cdf0e10cSrcweir 2080*cdf0e10cSrcweir aAuthFieldsLB(this, SW_RES(LB_AUTHFIELD )), 2081*cdf0e10cSrcweir aAuthInsertPB(this, SW_RES(PB_AUTHINSERT )), 2082*cdf0e10cSrcweir aAuthRemovePB(this, SW_RES(PB_AUTHREMOVE )), 2083*cdf0e10cSrcweir 2084*cdf0e10cSrcweir aCharStyleFT(this, SW_RES(FT_CHARSTYLE )), 2085*cdf0e10cSrcweir aCharStyleLB(this, SW_RES(LB_CHARSTYLE )), 2086*cdf0e10cSrcweir aEditStylePB(this, SW_RES(PB_EDITSTYLE )), 2087*cdf0e10cSrcweir 2088*cdf0e10cSrcweir aChapterEntryFT(this, SW_RES(FT_CHAPTERENTRY )), 2089*cdf0e10cSrcweir aChapterEntryLB(this, SW_RES(LB_CHAPTERENTRY )), 2090*cdf0e10cSrcweir 2091*cdf0e10cSrcweir aNumberFormatFT(this, SW_RES(FT_ENTRY_NO )),//i53420 2092*cdf0e10cSrcweir aNumberFormatLB(this, SW_RES(LB_ENTRY_NO )), 2093*cdf0e10cSrcweir aEntryOutlineLevelFT(this, SW_RES(FT_LEVEL_OL )),//i53420 2094*cdf0e10cSrcweir aEntryOutlineLevelNF(this, SW_RES(NF_LEVEL_OL )), 2095*cdf0e10cSrcweir 2096*cdf0e10cSrcweir aFillCharFT(this, SW_RES(FT_FILLCHAR )), 2097*cdf0e10cSrcweir aFillCharCB(this, SW_RES(CB_FILLCHAR )), 2098*cdf0e10cSrcweir aTabPosFT(this, SW_RES(FT_TABPOS )), 2099*cdf0e10cSrcweir aTabPosMF(this, SW_RES(MF_TABPOS )), 2100*cdf0e10cSrcweir aAutoRightCB(this, SW_RES(CB_AUTORIGHT )), 2101*cdf0e10cSrcweir aFormatFL(this, SW_RES(FL_FORMAT )), 2102*cdf0e10cSrcweir 2103*cdf0e10cSrcweir 2104*cdf0e10cSrcweir aRelToStyleCB(this, SW_RES(CB_RELTOSTYLE )), 2105*cdf0e10cSrcweir aMainEntryStyleFT(this, SW_RES(FT_MAIN_ENTRY_STYLE)), 2106*cdf0e10cSrcweir aMainEntryStyleLB(this, SW_RES(LB_MAIN_ENTRY_STYLE)), 2107*cdf0e10cSrcweir aAlphaDelimCB(this, SW_RES(CB_ALPHADELIM )), 2108*cdf0e10cSrcweir aCommaSeparatedCB(this, SW_RES(CB_COMMASEPARATED )), 2109*cdf0e10cSrcweir 2110*cdf0e10cSrcweir aSortDocPosRB(this, SW_RES(RB_DOCPOS )), 2111*cdf0e10cSrcweir aSortContentRB(this, SW_RES(RB_SORTCONTENT )), 2112*cdf0e10cSrcweir aSortingFL(this, SW_RES(FL_SORTING )), 2113*cdf0e10cSrcweir 2114*cdf0e10cSrcweir aFirstKeyFT(this, SW_RES(FT_FIRSTKEY )), 2115*cdf0e10cSrcweir aFirstKeyLB(this, SW_RES(LB_FIRSTKEY )), 2116*cdf0e10cSrcweir aFirstSortUpRB(this, SW_RES(RB_SORTUP1 )), 2117*cdf0e10cSrcweir aFirstSortDownRB(this, SW_RES(RB_SORTDOWN1 )), 2118*cdf0e10cSrcweir 2119*cdf0e10cSrcweir aSecondKeyFT(this, SW_RES(FT_SECONDKEY )), 2120*cdf0e10cSrcweir aSecondKeyLB(this, SW_RES(LB_SECONDKEY )), 2121*cdf0e10cSrcweir aSecondSortUpRB(this, SW_RES(RB_SORTUP2 )), 2122*cdf0e10cSrcweir aSecondSortDownRB(this, SW_RES(RB_SORTDOWN2 )), 2123*cdf0e10cSrcweir 2124*cdf0e10cSrcweir aThirdKeyFT(this, SW_RES(FT_THIRDDKEY )), 2125*cdf0e10cSrcweir aThirdKeyLB(this, SW_RES(LB_THIRDKEY )), 2126*cdf0e10cSrcweir aThirdSortUpRB(this, SW_RES(RB_SORTUP3 )), 2127*cdf0e10cSrcweir aThirdSortDownRB(this, SW_RES(RB_SORTDOWN3 )), 2128*cdf0e10cSrcweir 2129*cdf0e10cSrcweir aSortKeyFL(this, SW_RES(FL_SORTKEY )), 2130*cdf0e10cSrcweir 2131*cdf0e10cSrcweir sDelimStr( SW_RES(STR_DELIM)), 2132*cdf0e10cSrcweir sAuthTypeStr( SW_RES(ST_AUTHTYPE)), 2133*cdf0e10cSrcweir 2134*cdf0e10cSrcweir sNoCharStyle( SW_RES(STR_NO_CHAR_STYLE)), 2135*cdf0e10cSrcweir sNoCharSortKey( SW_RES(STR_NOSORTKEY )), 2136*cdf0e10cSrcweir m_pCurrentForm(0), 2137*cdf0e10cSrcweir bInLevelHdl(sal_False) 2138*cdf0e10cSrcweir { 2139*cdf0e10cSrcweir aEditStylePB.SetAccessibleRelationMemberOf(&aEntryFL); 2140*cdf0e10cSrcweir aHyperLinkPB.SetAccessibleRelationMemberOf(&aEntryFL); 2141*cdf0e10cSrcweir aPageNoPB.SetAccessibleRelationMemberOf(&aEntryFL); 2142*cdf0e10cSrcweir aTabPB.SetAccessibleRelationMemberOf(&aEntryFL); 2143*cdf0e10cSrcweir aEntryPB.SetAccessibleRelationMemberOf(&aEntryFL); 2144*cdf0e10cSrcweir aEntryNoPB.SetAccessibleRelationMemberOf(&aEntryFL); 2145*cdf0e10cSrcweir aAllLevelsPB.SetAccessibleRelationMemberOf(&aEntryFL); 2146*cdf0e10cSrcweir aTokenWIN.SetAccessibleRelationMemberOf(&aEntryFL); 2147*cdf0e10cSrcweir aTokenWIN.SetAccessibleRelationLabeledBy(&aTokenFT); 2148*cdf0e10cSrcweir 2149*cdf0e10cSrcweir Image aSortUpHC(SW_RES(IMG_SORTUP_HC )); 2150*cdf0e10cSrcweir aFirstSortUpRB.SetModeRadioImage(aSortUpHC,BMP_COLOR_HIGHCONTRAST); 2151*cdf0e10cSrcweir aSecondSortUpRB.SetModeRadioImage(aSortUpHC,BMP_COLOR_HIGHCONTRAST); 2152*cdf0e10cSrcweir aThirdSortUpRB.SetModeRadioImage(aSortUpHC,BMP_COLOR_HIGHCONTRAST); 2153*cdf0e10cSrcweir 2154*cdf0e10cSrcweir Image aSortDownHC(SW_RES(IMG_SORTDOWN_HC )); 2155*cdf0e10cSrcweir aFirstSortDownRB.SetModeRadioImage(aSortDownHC,BMP_COLOR_HIGHCONTRAST); 2156*cdf0e10cSrcweir aSecondSortDownRB.SetModeRadioImage(aSortDownHC,BMP_COLOR_HIGHCONTRAST); 2157*cdf0e10cSrcweir aThirdSortDownRB.SetModeRadioImage(aSortDownHC,BMP_COLOR_HIGHCONTRAST); 2158*cdf0e10cSrcweir FreeResource(); 2159*cdf0e10cSrcweir 2160*cdf0e10cSrcweir sLevelStr = aLevelFT.GetText(); 2161*cdf0e10cSrcweir aLevelLB.SetStyle( aLevelLB.GetStyle() | WB_HSCROLL ); 2162*cdf0e10cSrcweir aLevelLB.SetSpaceBetweenEntries(0); 2163*cdf0e10cSrcweir aLevelLB.SetSelectionMode( SINGLE_SELECTION ); 2164*cdf0e10cSrcweir aLevelLB.SetHighlightRange(); // select full width 2165*cdf0e10cSrcweir aLevelLB.SetHelpId(HID_INSERT_INDEX_ENTRY_LEVEL_LB); 2166*cdf0e10cSrcweir aLevelLB.Show(); 2167*cdf0e10cSrcweir 2168*cdf0e10cSrcweir aLastTOXType.eType = (TOXTypes)USHRT_MAX; 2169*cdf0e10cSrcweir aLastTOXType.nIndex = 0; 2170*cdf0e10cSrcweir //aLevelGBSize = aLevelGB.GetSizePixel(); 2171*cdf0e10cSrcweir aLevelFLSize = aLevelFT.GetSizePixel(); 2172*cdf0e10cSrcweir 2173*cdf0e10cSrcweir SetExchangeSupport(); 2174*cdf0e10cSrcweir aEntryNoPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl)); 2175*cdf0e10cSrcweir aEntryPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl)); 2176*cdf0e10cSrcweir aChapterInfoPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl)); 2177*cdf0e10cSrcweir aPageNoPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl)); 2178*cdf0e10cSrcweir aTabPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl)); 2179*cdf0e10cSrcweir aHyperLinkPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl)); 2180*cdf0e10cSrcweir aEditStylePB.SetClickHdl(LINK(this, SwTOXEntryTabPage, EditStyleHdl)); 2181*cdf0e10cSrcweir aLevelLB.SetSelectHdl(LINK(this, SwTOXEntryTabPage, LevelHdl)); 2182*cdf0e10cSrcweir aTokenWIN.SetButtonSelectedHdl(LINK(this, SwTOXEntryTabPage, TokenSelectedHdl)); 2183*cdf0e10cSrcweir aTokenWIN.SetModifyHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl)); 2184*cdf0e10cSrcweir aCharStyleLB.SetSelectHdl(LINK(this, SwTOXEntryTabPage, StyleSelectHdl)); 2185*cdf0e10cSrcweir aCharStyleLB.InsertEntry(sNoCharStyle); 2186*cdf0e10cSrcweir aChapterEntryLB.SetSelectHdl(LINK(this, SwTOXEntryTabPage, ChapterInfoHdl)); 2187*cdf0e10cSrcweir aEntryOutlineLevelNF.SetModifyHdl(LINK(this, SwTOXEntryTabPage, ChapterInfoOutlineHdl)); 2188*cdf0e10cSrcweir aNumberFormatLB.SetSelectHdl(LINK(this, SwTOXEntryTabPage, NumberFormatHdl)); 2189*cdf0e10cSrcweir 2190*cdf0e10cSrcweir aTabPosMF.SetModifyHdl(LINK(this, SwTOXEntryTabPage, TabPosHdl)); 2191*cdf0e10cSrcweir aFillCharCB.SetModifyHdl(LINK(this, SwTOXEntryTabPage, FillCharHdl)); 2192*cdf0e10cSrcweir aAutoRightCB.SetClickHdl(LINK(this, SwTOXEntryTabPage, AutoRightHdl)); 2193*cdf0e10cSrcweir aAuthInsertPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, RemoveInsertAuthHdl)); 2194*cdf0e10cSrcweir aAuthRemovePB.SetClickHdl(LINK(this, SwTOXEntryTabPage, RemoveInsertAuthHdl)); 2195*cdf0e10cSrcweir aSortDocPosRB.SetClickHdl(LINK(this, SwTOXEntryTabPage, SortKeyHdl)); 2196*cdf0e10cSrcweir aSortContentRB.SetClickHdl(LINK(this, SwTOXEntryTabPage, SortKeyHdl)); 2197*cdf0e10cSrcweir aAllLevelsPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, AllLevelsHdl)); 2198*cdf0e10cSrcweir 2199*cdf0e10cSrcweir aAlphaDelimCB.SetClickHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl)); 2200*cdf0e10cSrcweir aCommaSeparatedCB.SetClickHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl)); 2201*cdf0e10cSrcweir aRelToStyleCB.SetClickHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl)); 2202*cdf0e10cSrcweir 2203*cdf0e10cSrcweir FieldUnit aMetric = ::GetDfltMetric(sal_False); 2204*cdf0e10cSrcweir SetMetric(aTabPosMF, aMetric); 2205*cdf0e10cSrcweir 2206*cdf0e10cSrcweir aSortDocPosRB.Check(); 2207*cdf0e10cSrcweir 2208*cdf0e10cSrcweir aFillCharCB.SetMaxTextLen(1); 2209*cdf0e10cSrcweir aFillCharCB.InsertEntry(' '); 2210*cdf0e10cSrcweir aFillCharCB.InsertEntry('.'); 2211*cdf0e10cSrcweir aFillCharCB.InsertEntry('-'); 2212*cdf0e10cSrcweir aFillCharCB.InsertEntry('_'); 2213*cdf0e10cSrcweir 2214*cdf0e10cSrcweir aButtonPositions[0] = aEntryNoPB.GetPosPixel(); 2215*cdf0e10cSrcweir aButtonPositions[1] = aEntryPB.GetPosPixel(); 2216*cdf0e10cSrcweir aButtonPositions[2] = aChapterInfoPB.GetPosPixel(); 2217*cdf0e10cSrcweir aButtonPositions[3] = aPageNoPB.GetPosPixel(); 2218*cdf0e10cSrcweir aButtonPositions[4] = aTabPB.GetPosPixel(); 2219*cdf0e10cSrcweir 2220*cdf0e10cSrcweir aRelToStylePos = aRelToStyleCB.GetPosPixel(); 2221*cdf0e10cSrcweir aRelToStyleIdxPos = aCommaSeparatedCB.GetPosPixel(); 2222*cdf0e10cSrcweir aRelToStyleIdxPos.Y() += 2223*cdf0e10cSrcweir (aRelToStyleIdxPos.Y() - aAlphaDelimCB.GetPosPixel().Y()); 2224*cdf0e10cSrcweir aEditStylePB.Enable(sal_False); 2225*cdf0e10cSrcweir 2226*cdf0e10cSrcweir //get position for Numbering and other stuff 2227*cdf0e10cSrcweir aChapterEntryFTPosition = aChapterEntryFT.GetPosPixel(); 2228*cdf0e10cSrcweir aEntryOutlineLevelFTPosition = aEntryOutlineLevelFT.GetPosPixel(); 2229*cdf0e10cSrcweir nBiasToEntryPoint = aEntryOutlineLevelNF.GetPosPixel().X() - 2230*cdf0e10cSrcweir aEntryOutlineLevelFT.GetPosPixel().X(); 2231*cdf0e10cSrcweir 2232*cdf0e10cSrcweir //fill the types in 2233*cdf0e10cSrcweir sal_uInt16 i; 2234*cdf0e10cSrcweir for( i = 0; i < AUTH_FIELD_END; i++) 2235*cdf0e10cSrcweir { 2236*cdf0e10cSrcweir String sTmp(SW_RES(STR_AUTH_FIELD_START + i)); 2237*cdf0e10cSrcweir sal_uInt16 nPos = aAuthFieldsLB.InsertEntry(sTmp); 2238*cdf0e10cSrcweir aAuthFieldsLB.SetEntryData(nPos, reinterpret_cast< void * >(sal::static_int_cast< sal_uIntPtr >(i))); 2239*cdf0e10cSrcweir } 2240*cdf0e10cSrcweir sal_uInt16 nPos = aFirstKeyLB.InsertEntry(sNoCharSortKey); 2241*cdf0e10cSrcweir aFirstKeyLB.SetEntryData(nPos, reinterpret_cast< void * >(sal::static_int_cast< sal_uIntPtr >(USHRT_MAX))); 2242*cdf0e10cSrcweir nPos = aSecondKeyLB.InsertEntry(sNoCharSortKey); 2243*cdf0e10cSrcweir aSecondKeyLB.SetEntryData(nPos, reinterpret_cast< void * >(sal::static_int_cast< sal_uIntPtr >(USHRT_MAX))); 2244*cdf0e10cSrcweir nPos = aThirdKeyLB.InsertEntry(sNoCharSortKey); 2245*cdf0e10cSrcweir aThirdKeyLB.SetEntryData(nPos, reinterpret_cast< void * >(sal::static_int_cast< sal_uIntPtr >(USHRT_MAX))); 2246*cdf0e10cSrcweir 2247*cdf0e10cSrcweir for( i = 0; i < AUTH_FIELD_END; i++) 2248*cdf0e10cSrcweir { 2249*cdf0e10cSrcweir String sTmp(aAuthFieldsLB.GetEntry(i)); 2250*cdf0e10cSrcweir void* pEntryData = aAuthFieldsLB.GetEntryData(i); 2251*cdf0e10cSrcweir nPos = aFirstKeyLB.InsertEntry(sTmp); 2252*cdf0e10cSrcweir aFirstKeyLB.SetEntryData(nPos, pEntryData); 2253*cdf0e10cSrcweir nPos = aSecondKeyLB.InsertEntry(sTmp); 2254*cdf0e10cSrcweir aSecondKeyLB.SetEntryData(nPos, pEntryData); 2255*cdf0e10cSrcweir nPos = aThirdKeyLB.InsertEntry(sTmp); 2256*cdf0e10cSrcweir aThirdKeyLB.SetEntryData(nPos, pEntryData); 2257*cdf0e10cSrcweir } 2258*cdf0e10cSrcweir aFirstKeyLB.SelectEntryPos(0); 2259*cdf0e10cSrcweir aSecondKeyLB.SelectEntryPos(0); 2260*cdf0e10cSrcweir aThirdKeyLB.SelectEntryPos(0); 2261*cdf0e10cSrcweir } 2262*cdf0e10cSrcweir /* -----------------30.11.99 13:37------------------- 2263*cdf0e10cSrcweir pVoid is used as signal to change all levels of the example 2264*cdf0e10cSrcweir --------------------------------------------------*/ 2265*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, ModifyHdl, void*, pVoid) 2266*cdf0e10cSrcweir { 2267*cdf0e10cSrcweir UpdateDescriptor(); 2268*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 2269*cdf0e10cSrcweir 2270*cdf0e10cSrcweir if(pTOXDlg) 2271*cdf0e10cSrcweir { 2272*cdf0e10cSrcweir sal_uInt16 nCurLevel = static_cast< sal_uInt16 >(aLevelLB.GetModel()->GetAbsPos(aLevelLB.FirstSelected()) + 1); 2273*cdf0e10cSrcweir if(aLastTOXType.eType == TOX_CONTENT && pVoid) 2274*cdf0e10cSrcweir nCurLevel = USHRT_MAX; 2275*cdf0e10cSrcweir pTOXDlg->CreateOrUpdateExample( 2276*cdf0e10cSrcweir pTOXDlg->GetCurrentTOXType().eType, TOX_PAGE_ENTRY, nCurLevel); 2277*cdf0e10cSrcweir } 2278*cdf0e10cSrcweir return 0; 2279*cdf0e10cSrcweir } 2280*cdf0e10cSrcweir 2281*cdf0e10cSrcweir /*-- 16.06.99 10:47:33--------------------------------------------------- 2282*cdf0e10cSrcweir 2283*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2284*cdf0e10cSrcweir SwTOXEntryTabPage::~SwTOXEntryTabPage() 2285*cdf0e10cSrcweir { 2286*cdf0e10cSrcweir } 2287*cdf0e10cSrcweir /*-- 16.06.99 10:47:33--------------------------------------------------- 2288*cdf0e10cSrcweir 2289*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2290*cdf0e10cSrcweir sal_Bool SwTOXEntryTabPage::FillItemSet( SfxItemSet& ) 2291*cdf0e10cSrcweir { 2292*cdf0e10cSrcweir // nothing to do 2293*cdf0e10cSrcweir return sal_True; 2294*cdf0e10cSrcweir } 2295*cdf0e10cSrcweir /*-- 16.06.99 10:47:34--------------------------------------------------- 2296*cdf0e10cSrcweir 2297*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2298*cdf0e10cSrcweir void SwTOXEntryTabPage::Reset( const SfxItemSet& ) 2299*cdf0e10cSrcweir { 2300*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 2301*cdf0e10cSrcweir const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); 2302*cdf0e10cSrcweir m_pCurrentForm = pTOXDlg->GetForm(aCurType); 2303*cdf0e10cSrcweir if(TOX_INDEX == aCurType.eType) 2304*cdf0e10cSrcweir { 2305*cdf0e10cSrcweir SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType); 2306*cdf0e10cSrcweir String sMainEntryCharStyle = rDesc.GetMainEntryCharStyle(); 2307*cdf0e10cSrcweir if(sMainEntryCharStyle.Len()) 2308*cdf0e10cSrcweir { 2309*cdf0e10cSrcweir if( LISTBOX_ENTRY_NOTFOUND == 2310*cdf0e10cSrcweir aMainEntryStyleLB.GetEntryPos(sMainEntryCharStyle)) 2311*cdf0e10cSrcweir aMainEntryStyleLB.InsertEntry( 2312*cdf0e10cSrcweir sMainEntryCharStyle); 2313*cdf0e10cSrcweir aMainEntryStyleLB.SelectEntry(sMainEntryCharStyle); 2314*cdf0e10cSrcweir } 2315*cdf0e10cSrcweir else 2316*cdf0e10cSrcweir aMainEntryStyleLB.SelectEntry(sNoCharStyle); 2317*cdf0e10cSrcweir aAlphaDelimCB.Check( 0 != (rDesc.GetIndexOptions() & nsSwTOIOptions::TOI_ALPHA_DELIMITTER) ); 2318*cdf0e10cSrcweir } 2319*cdf0e10cSrcweir aRelToStyleCB.Check(m_pCurrentForm->IsRelTabPos()); 2320*cdf0e10cSrcweir aCommaSeparatedCB.Check(m_pCurrentForm->IsCommaSeparated()); 2321*cdf0e10cSrcweir } 2322*cdf0e10cSrcweir /*-- 16.06.99 10:47:34--------------------------------------------------- 2323*cdf0e10cSrcweir 2324*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2325*cdf0e10cSrcweir void lcl_ChgWidth(Window& rWin, long nDiff) 2326*cdf0e10cSrcweir { 2327*cdf0e10cSrcweir Size aTempSz(rWin.GetSizePixel()); 2328*cdf0e10cSrcweir aTempSz.Width() += nDiff; 2329*cdf0e10cSrcweir rWin.SetSizePixel(aTempSz); 2330*cdf0e10cSrcweir } 2331*cdf0e10cSrcweir /* ---------------------------------------------------------------------- 2332*cdf0e10cSrcweir 2333*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2334*cdf0e10cSrcweir void lcl_ChgXPos(Window& rWin, long nDiff) 2335*cdf0e10cSrcweir { 2336*cdf0e10cSrcweir Point aTempPos(rWin.GetPosPixel()); 2337*cdf0e10cSrcweir aTempPos.X() += nDiff; 2338*cdf0e10cSrcweir rWin.SetPosPixel(aTempPos); 2339*cdf0e10cSrcweir } 2340*cdf0e10cSrcweir /* ---------------------------------------------------------------------- 2341*cdf0e10cSrcweir 2342*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2343*cdf0e10cSrcweir void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) 2344*cdf0e10cSrcweir { 2345*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 2346*cdf0e10cSrcweir const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); 2347*cdf0e10cSrcweir 2348*cdf0e10cSrcweir m_pCurrentForm = pTOXDlg->GetForm(aCurType); 2349*cdf0e10cSrcweir if( !( aLastTOXType == aCurType )) 2350*cdf0e10cSrcweir { 2351*cdf0e10cSrcweir sal_Bool bToxIsAuthorities = TOX_AUTHORITIES == aCurType.eType; 2352*cdf0e10cSrcweir sal_Bool bToxIsIndex = TOX_INDEX == aCurType.eType; 2353*cdf0e10cSrcweir sal_Bool bToxIsContent = TOX_CONTENT == aCurType.eType; 2354*cdf0e10cSrcweir 2355*cdf0e10cSrcweir aLevelLB.Clear(); 2356*cdf0e10cSrcweir for(sal_uInt16 i = 1; i < m_pCurrentForm->GetFormMax(); i++) 2357*cdf0e10cSrcweir { 2358*cdf0e10cSrcweir if(bToxIsAuthorities) 2359*cdf0e10cSrcweir aLevelLB.InsertEntry( SwAuthorityFieldType::GetAuthTypeName( 2360*cdf0e10cSrcweir (ToxAuthorityType) (i - 1)) ); 2361*cdf0e10cSrcweir else if( bToxIsIndex ) 2362*cdf0e10cSrcweir { 2363*cdf0e10cSrcweir if(i == 1) 2364*cdf0e10cSrcweir aLevelLB.InsertEntry( sDelimStr ); 2365*cdf0e10cSrcweir else 2366*cdf0e10cSrcweir aLevelLB.InsertEntry( String::CreateFromInt32(i - 1) ); 2367*cdf0e10cSrcweir } 2368*cdf0e10cSrcweir else 2369*cdf0e10cSrcweir aLevelLB.InsertEntry(String::CreateFromInt32(i)); 2370*cdf0e10cSrcweir } 2371*cdf0e10cSrcweir if(bToxIsAuthorities) 2372*cdf0e10cSrcweir { 2373*cdf0e10cSrcweir // 2374*cdf0e10cSrcweir SwWrtShell& rSh = pTOXDlg->GetWrtShell(); 2375*cdf0e10cSrcweir const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*) 2376*cdf0e10cSrcweir rSh.GetFldType(RES_AUTHORITY, aEmptyStr); 2377*cdf0e10cSrcweir if(pFType) 2378*cdf0e10cSrcweir { 2379*cdf0e10cSrcweir if(pFType->IsSortByDocument()) 2380*cdf0e10cSrcweir aSortDocPosRB.Check(); 2381*cdf0e10cSrcweir else 2382*cdf0e10cSrcweir { 2383*cdf0e10cSrcweir aSortContentRB.Check(); 2384*cdf0e10cSrcweir sal_uInt16 nKeyCount = pFType->GetSortKeyCount(); 2385*cdf0e10cSrcweir if(0 < nKeyCount) 2386*cdf0e10cSrcweir { 2387*cdf0e10cSrcweir const SwTOXSortKey* pKey = pFType->GetSortKey(0); 2388*cdf0e10cSrcweir aFirstKeyLB.SelectEntryPos( 2389*cdf0e10cSrcweir aFirstKeyLB.GetEntryPos((void*)(sal_uInt32)pKey->eField)); 2390*cdf0e10cSrcweir aFirstSortUpRB.Check(pKey->bSortAscending); 2391*cdf0e10cSrcweir aFirstSortDownRB.Check(!pKey->bSortAscending); 2392*cdf0e10cSrcweir } 2393*cdf0e10cSrcweir if(1 < nKeyCount) 2394*cdf0e10cSrcweir { 2395*cdf0e10cSrcweir const SwTOXSortKey* pKey = pFType->GetSortKey(1); 2396*cdf0e10cSrcweir aSecondKeyLB.SelectEntryPos( 2397*cdf0e10cSrcweir aSecondKeyLB.GetEntryPos((void*)(sal_uInt32)pKey->eField)); 2398*cdf0e10cSrcweir aSecondSortUpRB.Check(pKey->bSortAscending); 2399*cdf0e10cSrcweir aSecondSortDownRB.Check(!pKey->bSortAscending); 2400*cdf0e10cSrcweir } 2401*cdf0e10cSrcweir if(2 < nKeyCount) 2402*cdf0e10cSrcweir { 2403*cdf0e10cSrcweir const SwTOXSortKey* pKey = pFType->GetSortKey(2); 2404*cdf0e10cSrcweir aThirdKeyLB.SelectEntryPos( 2405*cdf0e10cSrcweir aThirdKeyLB.GetEntryPos((void*)(sal_uInt32)pKey->eField)); 2406*cdf0e10cSrcweir aThirdSortUpRB.Check(pKey->bSortAscending); 2407*cdf0e10cSrcweir aThirdSortDownRB.Check(!pKey->bSortAscending); 2408*cdf0e10cSrcweir } 2409*cdf0e10cSrcweir } 2410*cdf0e10cSrcweir } 2411*cdf0e10cSrcweir SortKeyHdl(aSortDocPosRB.IsChecked() ? &aSortDocPosRB : &aSortContentRB); 2412*cdf0e10cSrcweir aLevelFT.SetText(sAuthTypeStr); 2413*cdf0e10cSrcweir } 2414*cdf0e10cSrcweir else 2415*cdf0e10cSrcweir aLevelFT.SetText(sLevelStr); 2416*cdf0e10cSrcweir 2417*cdf0e10cSrcweir long nDiff = 0; 2418*cdf0e10cSrcweir if( bToxIsAuthorities ? aLevelFT.GetSizePixel() == aLevelFLSize 2419*cdf0e10cSrcweir : aLevelFT.GetSizePixel() != aLevelFLSize ) 2420*cdf0e10cSrcweir { 2421*cdf0e10cSrcweir nDiff = aLevelFLSize.Width(); 2422*cdf0e10cSrcweir if( !bToxIsAuthorities ) 2423*cdf0e10cSrcweir nDiff *= -1; 2424*cdf0e10cSrcweir } 2425*cdf0e10cSrcweir 2426*cdf0e10cSrcweir if(nDiff) 2427*cdf0e10cSrcweir { 2428*cdf0e10cSrcweir // lcl_ChgWidth(aLevelFL, nDiff); 2429*cdf0e10cSrcweir lcl_ChgWidth(aLevelFT, nDiff); 2430*cdf0e10cSrcweir lcl_ChgWidth(aLevelLB, nDiff); 2431*cdf0e10cSrcweir lcl_ChgXPos(aCharStyleFT, nDiff); 2432*cdf0e10cSrcweir lcl_ChgXPos(aCharStyleLB, nDiff); 2433*cdf0e10cSrcweir lcl_ChgWidth(aCharStyleLB, -nDiff); 2434*cdf0e10cSrcweir // lcl_ChgXPos(aEditStylePB, -nDiff); 2435*cdf0e10cSrcweir lcl_ChgXPos(aFillCharFT, nDiff); 2436*cdf0e10cSrcweir lcl_ChgXPos(aFillCharCB, nDiff); 2437*cdf0e10cSrcweir lcl_ChgXPos(aTabPosFT, nDiff); 2438*cdf0e10cSrcweir lcl_ChgXPos(aTabPosMF, nDiff); 2439*cdf0e10cSrcweir lcl_ChgXPos(aAutoRightCB, nDiff); 2440*cdf0e10cSrcweir lcl_ChgXPos(aAuthFieldsLB, nDiff); 2441*cdf0e10cSrcweir lcl_ChgXPos(aAuthInsertPB, nDiff); 2442*cdf0e10cSrcweir lcl_ChgXPos(aAuthRemovePB, nDiff); 2443*cdf0e10cSrcweir lcl_ChgXPos(aTokenFT, nDiff); 2444*cdf0e10cSrcweir lcl_ChgXPos(aTokenWIN, nDiff); 2445*cdf0e10cSrcweir lcl_ChgWidth(aTokenWIN, -nDiff); 2446*cdf0e10cSrcweir lcl_ChgXPos(aSortDocPosRB, nDiff); 2447*cdf0e10cSrcweir lcl_ChgXPos(aSortContentRB, nDiff); 2448*cdf0e10cSrcweir lcl_ChgXPos(aFormatFL, nDiff); 2449*cdf0e10cSrcweir lcl_ChgWidth(aFormatFL, -nDiff); 2450*cdf0e10cSrcweir lcl_ChgXPos(aSortingFL, nDiff); 2451*cdf0e10cSrcweir lcl_ChgWidth(aSortingFL, -nDiff); 2452*cdf0e10cSrcweir lcl_ChgXPos(aEntryFL, nDiff); 2453*cdf0e10cSrcweir lcl_ChgWidth(aEntryFL, -nDiff); 2454*cdf0e10cSrcweir 2455*cdf0e10cSrcweir lcl_ChgXPos(aFirstKeyFT, nDiff); 2456*cdf0e10cSrcweir lcl_ChgXPos(aFirstKeyLB, nDiff); 2457*cdf0e10cSrcweir lcl_ChgXPos(aSecondKeyFT, nDiff); 2458*cdf0e10cSrcweir lcl_ChgXPos(aSecondKeyLB, nDiff); 2459*cdf0e10cSrcweir lcl_ChgXPos(aThirdKeyFT, nDiff); 2460*cdf0e10cSrcweir lcl_ChgXPos(aThirdKeyLB, nDiff); 2461*cdf0e10cSrcweir lcl_ChgXPos(aSortKeyFL, nDiff); 2462*cdf0e10cSrcweir 2463*cdf0e10cSrcweir lcl_ChgWidth(aFirstKeyLB, -nDiff); 2464*cdf0e10cSrcweir lcl_ChgWidth(aSecondKeyLB, -nDiff); 2465*cdf0e10cSrcweir lcl_ChgWidth(aThirdKeyLB, -nDiff); 2466*cdf0e10cSrcweir lcl_ChgWidth(aSortKeyFL, -nDiff); 2467*cdf0e10cSrcweir } 2468*cdf0e10cSrcweir Link aLink = aLevelLB.GetSelectHdl(); 2469*cdf0e10cSrcweir aLevelLB.SetSelectHdl(Link()); 2470*cdf0e10cSrcweir aLevelLB.Select( aLevelLB.GetEntry( bToxIsIndex ? 1 : 0 ) ); 2471*cdf0e10cSrcweir aLevelLB.SetSelectHdl(aLink); 2472*cdf0e10cSrcweir 2473*cdf0e10cSrcweir // sort token buttons 2474*cdf0e10cSrcweir aEntryNoPB.SetPosPixel(aButtonPositions[0]); 2475*cdf0e10cSrcweir aEntryPB.SetPosPixel(aButtonPositions[ bToxIsContent ? 1 : 0]); 2476*cdf0e10cSrcweir aChapterInfoPB.SetPosPixel(aButtonPositions[2]); 2477*cdf0e10cSrcweir aPageNoPB.SetPosPixel(aButtonPositions[3]); 2478*cdf0e10cSrcweir sal_uInt16 nBtPos = 1; 2479*cdf0e10cSrcweir if( bToxIsContent ) 2480*cdf0e10cSrcweir nBtPos = 2; 2481*cdf0e10cSrcweir else if( bToxIsAuthorities ) 2482*cdf0e10cSrcweir nBtPos = 4; 2483*cdf0e10cSrcweir aTabPB.SetPosPixel(aButtonPositions[nBtPos]); 2484*cdf0e10cSrcweir aHyperLinkPB.SetPosPixel(aButtonPositions[4]); 2485*cdf0e10cSrcweir 2486*cdf0e10cSrcweir //show or hide controls 2487*cdf0e10cSrcweir aEntryNoPB.Show( bToxIsContent ); 2488*cdf0e10cSrcweir aHyperLinkPB.Show( bToxIsContent ); 2489*cdf0e10cSrcweir aRelToStyleCB.Show( !bToxIsAuthorities ); 2490*cdf0e10cSrcweir aChapterInfoPB.Show( !bToxIsContent && !bToxIsAuthorities); 2491*cdf0e10cSrcweir aEntryPB.Show( !bToxIsAuthorities ); 2492*cdf0e10cSrcweir aPageNoPB.Show( !bToxIsAuthorities ); 2493*cdf0e10cSrcweir aAuthFieldsLB.Show( bToxIsAuthorities ); 2494*cdf0e10cSrcweir aAuthInsertPB.Show( bToxIsAuthorities ); 2495*cdf0e10cSrcweir aAuthRemovePB.Show( bToxIsAuthorities ); 2496*cdf0e10cSrcweir aFormatFL.Show( !bToxIsAuthorities ); 2497*cdf0e10cSrcweir aSortDocPosRB.Show( bToxIsAuthorities ); 2498*cdf0e10cSrcweir aSortContentRB.Show( bToxIsAuthorities ); 2499*cdf0e10cSrcweir aSortingFL.Show( bToxIsAuthorities ); 2500*cdf0e10cSrcweir aFirstKeyFT.Show( bToxIsAuthorities ); 2501*cdf0e10cSrcweir aFirstKeyLB.Show( bToxIsAuthorities ); 2502*cdf0e10cSrcweir aSecondKeyFT.Show( bToxIsAuthorities ); 2503*cdf0e10cSrcweir aSecondKeyLB.Show( bToxIsAuthorities ); 2504*cdf0e10cSrcweir aThirdKeyFT.Show( bToxIsAuthorities ); 2505*cdf0e10cSrcweir aThirdKeyLB.Show( bToxIsAuthorities ); 2506*cdf0e10cSrcweir aSortKeyFL.Show( bToxIsAuthorities ); 2507*cdf0e10cSrcweir aFirstSortUpRB.Show( bToxIsAuthorities ); 2508*cdf0e10cSrcweir aFirstSortDownRB.Show( bToxIsAuthorities ); 2509*cdf0e10cSrcweir aSecondSortUpRB.Show( bToxIsAuthorities ); 2510*cdf0e10cSrcweir aSecondSortDownRB.Show( bToxIsAuthorities ); 2511*cdf0e10cSrcweir aThirdSortUpRB.Show( bToxIsAuthorities ); 2512*cdf0e10cSrcweir aThirdSortDownRB.Show( bToxIsAuthorities ); 2513*cdf0e10cSrcweir 2514*cdf0e10cSrcweir aRelToStyleCB.SetPosPixel( bToxIsIndex ? aRelToStyleIdxPos 2515*cdf0e10cSrcweir : aRelToStylePos ); 2516*cdf0e10cSrcweir 2517*cdf0e10cSrcweir // aRecalcTabCB.Show( aCurType.eType == TOX_CONTENT); 2518*cdf0e10cSrcweir 2519*cdf0e10cSrcweir aMainEntryStyleFT.Show( bToxIsIndex ); 2520*cdf0e10cSrcweir aMainEntryStyleLB.Show( bToxIsIndex ); 2521*cdf0e10cSrcweir aAlphaDelimCB.Show( bToxIsIndex ); 2522*cdf0e10cSrcweir aCommaSeparatedCB.Show( bToxIsIndex ); 2523*cdf0e10cSrcweir } 2524*cdf0e10cSrcweir aLastTOXType = aCurType; 2525*cdf0e10cSrcweir 2526*cdf0e10cSrcweir //invalidate PatternWindow 2527*cdf0e10cSrcweir aTokenWIN.SetInvalid(); 2528*cdf0e10cSrcweir LevelHdl(&aLevelLB); 2529*cdf0e10cSrcweir } 2530*cdf0e10cSrcweir /* -----------------30.11.99 15:04------------------- 2531*cdf0e10cSrcweir 2532*cdf0e10cSrcweir --------------------------------------------------*/ 2533*cdf0e10cSrcweir void SwTOXEntryTabPage::UpdateDescriptor() 2534*cdf0e10cSrcweir { 2535*cdf0e10cSrcweir WriteBackLevel(); 2536*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 2537*cdf0e10cSrcweir SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aLastTOXType); 2538*cdf0e10cSrcweir if(TOX_INDEX == aLastTOXType.eType) 2539*cdf0e10cSrcweir { 2540*cdf0e10cSrcweir String sTemp(aMainEntryStyleLB.GetSelectEntry()); 2541*cdf0e10cSrcweir rDesc.SetMainEntryCharStyle(sNoCharStyle == sTemp ? aEmptyStr : sTemp); 2542*cdf0e10cSrcweir sal_uInt16 nIdxOptions = rDesc.GetIndexOptions() & ~nsSwTOIOptions::TOI_ALPHA_DELIMITTER; 2543*cdf0e10cSrcweir if(aAlphaDelimCB.IsChecked()) 2544*cdf0e10cSrcweir nIdxOptions |= nsSwTOIOptions::TOI_ALPHA_DELIMITTER; 2545*cdf0e10cSrcweir rDesc.SetIndexOptions(nIdxOptions); 2546*cdf0e10cSrcweir } 2547*cdf0e10cSrcweir else if(TOX_AUTHORITIES == aLastTOXType.eType) 2548*cdf0e10cSrcweir { 2549*cdf0e10cSrcweir rDesc.SetSortByDocument(aSortDocPosRB.IsChecked()); 2550*cdf0e10cSrcweir SwTOXSortKey aKey1, aKey2, aKey3; 2551*cdf0e10cSrcweir aKey1.eField = (ToxAuthorityField)(sal_uIntPtr)aFirstKeyLB.GetEntryData( 2552*cdf0e10cSrcweir aFirstKeyLB.GetSelectEntryPos()); 2553*cdf0e10cSrcweir aKey1.bSortAscending = aFirstSortUpRB.IsChecked(); 2554*cdf0e10cSrcweir aKey2.eField = (ToxAuthorityField)(sal_uIntPtr)aSecondKeyLB.GetEntryData( 2555*cdf0e10cSrcweir aSecondKeyLB.GetSelectEntryPos()); 2556*cdf0e10cSrcweir aKey2.bSortAscending = aSecondSortUpRB.IsChecked(); 2557*cdf0e10cSrcweir aKey3.eField = (ToxAuthorityField)(sal_uIntPtr)aThirdKeyLB.GetEntryData( 2558*cdf0e10cSrcweir aThirdKeyLB.GetSelectEntryPos()); 2559*cdf0e10cSrcweir aKey3.bSortAscending = aThirdSortUpRB.IsChecked(); 2560*cdf0e10cSrcweir 2561*cdf0e10cSrcweir 2562*cdf0e10cSrcweir rDesc.SetSortKeys(aKey1, aKey2, aKey3); 2563*cdf0e10cSrcweir } 2564*cdf0e10cSrcweir SwForm* pCurrentForm = pTOXDlg->GetForm(aLastTOXType); 2565*cdf0e10cSrcweir if(aRelToStyleCB.IsVisible()) 2566*cdf0e10cSrcweir { 2567*cdf0e10cSrcweir pCurrentForm->SetRelTabPos(aRelToStyleCB.IsChecked()); 2568*cdf0e10cSrcweir } 2569*cdf0e10cSrcweir if(aCommaSeparatedCB.IsVisible()) 2570*cdf0e10cSrcweir pCurrentForm->SetCommaSeparated(aCommaSeparatedCB.IsChecked()); 2571*cdf0e10cSrcweir } 2572*cdf0e10cSrcweir /*-- 16.06.99 10:47:34--------------------------------------------------- 2573*cdf0e10cSrcweir 2574*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2575*cdf0e10cSrcweir int SwTOXEntryTabPage::DeactivatePage( SfxItemSet* /*pSet*/) 2576*cdf0e10cSrcweir { 2577*cdf0e10cSrcweir UpdateDescriptor(); 2578*cdf0e10cSrcweir return LEAVE_PAGE; 2579*cdf0e10cSrcweir } 2580*cdf0e10cSrcweir /*-- 16.06.99 10:47:34--------------------------------------------------- 2581*cdf0e10cSrcweir 2582*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2583*cdf0e10cSrcweir SfxTabPage* SwTOXEntryTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet) 2584*cdf0e10cSrcweir { 2585*cdf0e10cSrcweir return new SwTOXEntryTabPage(pParent, rAttrSet); 2586*cdf0e10cSrcweir } 2587*cdf0e10cSrcweir /*-- 16.06.99 10:47:35--------------------------------------------------- 2588*cdf0e10cSrcweir 2589*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2590*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, EditStyleHdl, PushButton*, pBtn) 2591*cdf0e10cSrcweir { 2592*cdf0e10cSrcweir if( LISTBOX_ENTRY_NOTFOUND != aCharStyleLB.GetSelectEntryPos()) 2593*cdf0e10cSrcweir { 2594*cdf0e10cSrcweir SfxStringItem aStyle(SID_STYLE_EDIT, aCharStyleLB.GetSelectEntry()); 2595*cdf0e10cSrcweir SfxUInt16Item aFamily(SID_STYLE_FAMILY, SFX_STYLE_FAMILY_CHAR); 2596*cdf0e10cSrcweir // TODO: WrtShell? 2597*cdf0e10cSrcweir // SwPtrItem aShell(FN_PARAM_WRTSHELL, pWrtShell); 2598*cdf0e10cSrcweir Window* pDefDlgParent = Application::GetDefDialogParent(); 2599*cdf0e10cSrcweir Application::SetDefDialogParent( pBtn ); 2600*cdf0e10cSrcweir ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell(). 2601*cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute( 2602*cdf0e10cSrcweir SID_STYLE_EDIT, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_MODAL, 2603*cdf0e10cSrcweir &aStyle, &aFamily/*, &aShell*/, 0L); 2604*cdf0e10cSrcweir Application::SetDefDialogParent( pDefDlgParent ); 2605*cdf0e10cSrcweir } 2606*cdf0e10cSrcweir return 0; 2607*cdf0e10cSrcweir } 2608*cdf0e10cSrcweir /* -----------------04.10.99 11:34------------------- 2609*cdf0e10cSrcweir 2610*cdf0e10cSrcweir --------------------------------------------------*/ 2611*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, RemoveInsertAuthHdl, PushButton*, pButton) 2612*cdf0e10cSrcweir { 2613*cdf0e10cSrcweir sal_Bool bInsert = pButton == &aAuthInsertPB; 2614*cdf0e10cSrcweir if(bInsert) 2615*cdf0e10cSrcweir { 2616*cdf0e10cSrcweir sal_uInt16 nSelPos = aAuthFieldsLB.GetSelectEntryPos(); 2617*cdf0e10cSrcweir String sToInsert(aAuthFieldsLB.GetSelectEntry()); 2618*cdf0e10cSrcweir SwFormToken aInsert(TOKEN_AUTHORITY); 2619*cdf0e10cSrcweir aInsert.nAuthorityField = (sal_uInt16)(sal_uIntPtr)aAuthFieldsLB.GetEntryData(nSelPos); 2620*cdf0e10cSrcweir aTokenWIN.InsertAtSelection(String::CreateFromAscii( 2621*cdf0e10cSrcweir SwForm::aFormAuth), aInsert); 2622*cdf0e10cSrcweir aAuthFieldsLB.RemoveEntry(sToInsert); 2623*cdf0e10cSrcweir aAuthFieldsLB.SelectEntryPos( nSelPos ? nSelPos - 1 : 0); 2624*cdf0e10cSrcweir } 2625*cdf0e10cSrcweir else 2626*cdf0e10cSrcweir { 2627*cdf0e10cSrcweir Control* pCtrl = aTokenWIN.GetActiveControl(); 2628*cdf0e10cSrcweir DBG_ASSERT(WINDOW_EDIT != pCtrl->GetType(), "Remove should be disabled"); 2629*cdf0e10cSrcweir if( WINDOW_EDIT != pCtrl->GetType() ) 2630*cdf0e10cSrcweir { 2631*cdf0e10cSrcweir //fill it into the ListBox 2632*cdf0e10cSrcweir const SwFormToken& rToken = ((SwTOXButton*)pCtrl)->GetFormToken(); 2633*cdf0e10cSrcweir PreTokenButtonRemoved(rToken); 2634*cdf0e10cSrcweir aTokenWIN.RemoveControl((SwTOXButton*)pCtrl); 2635*cdf0e10cSrcweir } 2636*cdf0e10cSrcweir } 2637*cdf0e10cSrcweir ModifyHdl(0); 2638*cdf0e10cSrcweir return 0; 2639*cdf0e10cSrcweir } 2640*cdf0e10cSrcweir /* -----------------------------17.01.00 13:44-------------------------------- 2641*cdf0e10cSrcweir 2642*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2643*cdf0e10cSrcweir void SwTOXEntryTabPage::PreTokenButtonRemoved(const SwFormToken& rToken) 2644*cdf0e10cSrcweir { 2645*cdf0e10cSrcweir //fill it into the ListBox 2646*cdf0e10cSrcweir sal_uInt32 nData = rToken.nAuthorityField; 2647*cdf0e10cSrcweir String sTemp(SW_RES(STR_AUTH_FIELD_START + nData)); 2648*cdf0e10cSrcweir sal_uInt16 nPos = aAuthFieldsLB.InsertEntry(sTemp); 2649*cdf0e10cSrcweir aAuthFieldsLB.SetEntryData(nPos, (void*)(nData)); 2650*cdf0e10cSrcweir } 2651*cdf0e10cSrcweir /*-- 16.06.99 10:47:35--------------------------------------------------- 2652*cdf0e10cSrcweir 2653*cdf0e10cSrcweir This function inizializes the default value in the Token 2654*cdf0e10cSrcweir put here the UI dependent initializations 2655*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2656*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, InsertTokenHdl, PushButton*, pBtn) 2657*cdf0e10cSrcweir { 2658*cdf0e10cSrcweir String sText; 2659*cdf0e10cSrcweir FormTokenType eTokenType = TOKEN_ENTRY_NO; 2660*cdf0e10cSrcweir String sCharStyle; 2661*cdf0e10cSrcweir sal_uInt16 nChapterFormat = CF_NUMBER; // i89791 2662*cdf0e10cSrcweir if(pBtn == &aEntryNoPB) 2663*cdf0e10cSrcweir { 2664*cdf0e10cSrcweir sText.AssignAscii(SwForm::aFormEntryNum); 2665*cdf0e10cSrcweir eTokenType = TOKEN_ENTRY_NO; 2666*cdf0e10cSrcweir } 2667*cdf0e10cSrcweir else if(pBtn == &aEntryPB) 2668*cdf0e10cSrcweir { 2669*cdf0e10cSrcweir if( TOX_CONTENT == m_pCurrentForm->GetTOXType() ) 2670*cdf0e10cSrcweir { 2671*cdf0e10cSrcweir sText.AssignAscii( SwForm::aFormEntryTxt ); 2672*cdf0e10cSrcweir eTokenType = TOKEN_ENTRY_TEXT; 2673*cdf0e10cSrcweir } 2674*cdf0e10cSrcweir else 2675*cdf0e10cSrcweir { 2676*cdf0e10cSrcweir sText.AssignAscii( SwForm::aFormEntry); 2677*cdf0e10cSrcweir eTokenType = TOKEN_ENTRY; 2678*cdf0e10cSrcweir } 2679*cdf0e10cSrcweir } 2680*cdf0e10cSrcweir else if(pBtn == &aChapterInfoPB) 2681*cdf0e10cSrcweir { 2682*cdf0e10cSrcweir sText.AssignAscii( SwForm::aFormChapterMark); 2683*cdf0e10cSrcweir eTokenType = TOKEN_CHAPTER_INFO; 2684*cdf0e10cSrcweir nChapterFormat = CF_NUM_NOPREPST_TITLE; // i89791 2685*cdf0e10cSrcweir } 2686*cdf0e10cSrcweir else if(pBtn == &aPageNoPB) 2687*cdf0e10cSrcweir { 2688*cdf0e10cSrcweir sText.AssignAscii(SwForm::aFormPageNums); 2689*cdf0e10cSrcweir eTokenType = TOKEN_PAGE_NUMS; 2690*cdf0e10cSrcweir } 2691*cdf0e10cSrcweir else if(pBtn == &aHyperLinkPB) 2692*cdf0e10cSrcweir { 2693*cdf0e10cSrcweir sText.AssignAscii(SwForm::aFormLinkStt); 2694*cdf0e10cSrcweir eTokenType = TOKEN_LINK_START; 2695*cdf0e10cSrcweir sCharStyle = String(SW_RES(STR_POOLCHR_INET_NORMAL)); 2696*cdf0e10cSrcweir } 2697*cdf0e10cSrcweir else if(pBtn == &aTabPB) 2698*cdf0e10cSrcweir { 2699*cdf0e10cSrcweir sText.AssignAscii(SwForm::aFormTab); 2700*cdf0e10cSrcweir eTokenType = TOKEN_TAB_STOP; 2701*cdf0e10cSrcweir } 2702*cdf0e10cSrcweir SwFormToken aInsert(eTokenType); 2703*cdf0e10cSrcweir aInsert.sCharStyleName = sCharStyle; 2704*cdf0e10cSrcweir aInsert.nTabStopPosition = 0; 2705*cdf0e10cSrcweir aInsert.nChapterFormat = nChapterFormat; // i89791 2706*cdf0e10cSrcweir aTokenWIN.InsertAtSelection(sText, aInsert); 2707*cdf0e10cSrcweir ModifyHdl(0); 2708*cdf0e10cSrcweir return 0; 2709*cdf0e10cSrcweir } 2710*cdf0e10cSrcweir /* -----------------------------14.01.00 11:53-------------------------------- 2711*cdf0e10cSrcweir 2712*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2713*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, AllLevelsHdl, PushButton*, EMPTYARG) 2714*cdf0e10cSrcweir { 2715*cdf0e10cSrcweir //get current level 2716*cdf0e10cSrcweir //write it into all levels 2717*cdf0e10cSrcweir if(aTokenWIN.IsValid()) 2718*cdf0e10cSrcweir { 2719*cdf0e10cSrcweir String sNewToken = aTokenWIN.GetPattern(); 2720*cdf0e10cSrcweir for(sal_uInt16 i = 1; i < m_pCurrentForm->GetFormMax(); i++) 2721*cdf0e10cSrcweir m_pCurrentForm->SetPattern(i, sNewToken); 2722*cdf0e10cSrcweir // 2723*cdf0e10cSrcweir ModifyHdl(this); 2724*cdf0e10cSrcweir } 2725*cdf0e10cSrcweir return 0; 2726*cdf0e10cSrcweir } 2727*cdf0e10cSrcweir 2728*cdf0e10cSrcweir /* -----------------02.12.99 12:40------------------- 2729*cdf0e10cSrcweir 2730*cdf0e10cSrcweir --------------------------------------------------*/ 2731*cdf0e10cSrcweir void SwTOXEntryTabPage::WriteBackLevel() 2732*cdf0e10cSrcweir { 2733*cdf0e10cSrcweir if(aTokenWIN.IsValid()) 2734*cdf0e10cSrcweir { 2735*cdf0e10cSrcweir String sNewToken = aTokenWIN.GetPattern(); 2736*cdf0e10cSrcweir sal_uInt16 nLastLevel = aTokenWIN.GetLastLevel(); 2737*cdf0e10cSrcweir if(nLastLevel != USHRT_MAX) 2738*cdf0e10cSrcweir m_pCurrentForm->SetPattern(nLastLevel + 1, sNewToken ); 2739*cdf0e10cSrcweir } 2740*cdf0e10cSrcweir } 2741*cdf0e10cSrcweir /*-- 16.06.99 10:47:35--------------------------------------------------- 2742*cdf0e10cSrcweir 2743*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2744*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, LevelHdl, SvTreeListBox*, pBox) 2745*cdf0e10cSrcweir { 2746*cdf0e10cSrcweir if(bInLevelHdl) 2747*cdf0e10cSrcweir return 0; 2748*cdf0e10cSrcweir bInLevelHdl = sal_True; 2749*cdf0e10cSrcweir WriteBackLevel(); 2750*cdf0e10cSrcweir 2751*cdf0e10cSrcweir sal_uInt16 nLevel = static_cast< sal_uInt16 >(pBox->GetModel()->GetAbsPos(pBox->FirstSelected())); 2752*cdf0e10cSrcweir aTokenWIN.SetForm(*m_pCurrentForm, nLevel); 2753*cdf0e10cSrcweir if(TOX_AUTHORITIES == m_pCurrentForm->GetTOXType()) 2754*cdf0e10cSrcweir { 2755*cdf0e10cSrcweir //fill the types in 2756*cdf0e10cSrcweir aAuthFieldsLB.Clear(); 2757*cdf0e10cSrcweir for( sal_uInt32 i = 0; i < AUTH_FIELD_END; i++) 2758*cdf0e10cSrcweir { 2759*cdf0e10cSrcweir String sTmp(SW_RES(STR_AUTH_FIELD_START + i)); 2760*cdf0e10cSrcweir sal_uInt16 nPos = aAuthFieldsLB.InsertEntry(sTmp); 2761*cdf0e10cSrcweir aAuthFieldsLB.SetEntryData(nPos, (void*)(i)); 2762*cdf0e10cSrcweir } 2763*cdf0e10cSrcweir 2764*cdf0e10cSrcweir // #i21237# 2765*cdf0e10cSrcweir SwFormTokens aPattern = m_pCurrentForm->GetPattern(nLevel + 1); 2766*cdf0e10cSrcweir SwFormTokens::iterator aIt = aPattern.begin();; 2767*cdf0e10cSrcweir 2768*cdf0e10cSrcweir while(aIt != aPattern.end()) 2769*cdf0e10cSrcweir { 2770*cdf0e10cSrcweir SwFormToken aToken = *aIt; // #i21237# 2771*cdf0e10cSrcweir if(TOKEN_AUTHORITY == aToken.eTokenType) 2772*cdf0e10cSrcweir { 2773*cdf0e10cSrcweir sal_uInt32 nSearch = aToken.nAuthorityField; 2774*cdf0e10cSrcweir sal_uInt16 nLstBoxPos = aAuthFieldsLB.GetEntryPos( (void*) nSearch ); 2775*cdf0e10cSrcweir DBG_ASSERT(LISTBOX_ENTRY_NOTFOUND != nLstBoxPos, "Entry not found?"); 2776*cdf0e10cSrcweir aAuthFieldsLB.RemoveEntry(nLstBoxPos); 2777*cdf0e10cSrcweir } 2778*cdf0e10cSrcweir 2779*cdf0e10cSrcweir aIt++; // #i21237# 2780*cdf0e10cSrcweir } 2781*cdf0e10cSrcweir aAuthFieldsLB.SelectEntryPos(0); 2782*cdf0e10cSrcweir } 2783*cdf0e10cSrcweir bInLevelHdl = sal_False; 2784*cdf0e10cSrcweir pBox->GrabFocus(); 2785*cdf0e10cSrcweir return 0; 2786*cdf0e10cSrcweir } 2787*cdf0e10cSrcweir /* -----------------20.10.99 13:16------------------- 2788*cdf0e10cSrcweir 2789*cdf0e10cSrcweir --------------------------------------------------*/ 2790*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, SortKeyHdl, RadioButton*, pButton) 2791*cdf0e10cSrcweir { 2792*cdf0e10cSrcweir sal_Bool bEnable = &aSortContentRB == pButton; 2793*cdf0e10cSrcweir aFirstKeyFT.Enable(bEnable); 2794*cdf0e10cSrcweir aFirstKeyLB.Enable(bEnable); 2795*cdf0e10cSrcweir aSecondKeyFT.Enable(bEnable); 2796*cdf0e10cSrcweir aSecondKeyLB.Enable(bEnable); 2797*cdf0e10cSrcweir aThirdKeyFT.Enable(bEnable); 2798*cdf0e10cSrcweir aThirdKeyLB.Enable(bEnable); 2799*cdf0e10cSrcweir aSortKeyFL.Enable(bEnable); 2800*cdf0e10cSrcweir aFirstSortUpRB.Enable(bEnable); 2801*cdf0e10cSrcweir aFirstSortDownRB.Enable(bEnable); 2802*cdf0e10cSrcweir aSecondSortUpRB.Enable(bEnable); 2803*cdf0e10cSrcweir aSecondSortDownRB.Enable(bEnable); 2804*cdf0e10cSrcweir aThirdSortUpRB.Enable(bEnable); 2805*cdf0e10cSrcweir aThirdSortDownRB.Enable(bEnable); 2806*cdf0e10cSrcweir return 0; 2807*cdf0e10cSrcweir } 2808*cdf0e10cSrcweir /* -----------------01.07.99 12:21------------------- 2809*cdf0e10cSrcweir 2810*cdf0e10cSrcweir --------------------------------------------------*/ 2811*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, TokenSelectedHdl, SwFormToken*, pToken) 2812*cdf0e10cSrcweir { 2813*cdf0e10cSrcweir if(pToken->sCharStyleName.Len()) 2814*cdf0e10cSrcweir aCharStyleLB.SelectEntry(pToken->sCharStyleName); 2815*cdf0e10cSrcweir else 2816*cdf0e10cSrcweir aCharStyleLB.SelectEntry(sNoCharStyle); 2817*cdf0e10cSrcweir //StyleSelectHdl(&aCharStyleLB); 2818*cdf0e10cSrcweir 2819*cdf0e10cSrcweir String sEntry = aCharStyleLB.GetSelectEntry(); 2820*cdf0e10cSrcweir aEditStylePB.Enable(sEntry != sNoCharStyle); 2821*cdf0e10cSrcweir 2822*cdf0e10cSrcweir if(pToken->eTokenType == TOKEN_CHAPTER_INFO) 2823*cdf0e10cSrcweir { 2824*cdf0e10cSrcweir //---> i89791 2825*cdf0e10cSrcweir switch(pToken->nChapterFormat) 2826*cdf0e10cSrcweir { 2827*cdf0e10cSrcweir default: 2828*cdf0e10cSrcweir aChapterEntryLB.SetNoSelection();//to alert the user 2829*cdf0e10cSrcweir break; 2830*cdf0e10cSrcweir case CF_NUM_NOPREPST_TITLE: 2831*cdf0e10cSrcweir aChapterEntryLB.SelectEntryPos(0); 2832*cdf0e10cSrcweir break; 2833*cdf0e10cSrcweir case CF_TITLE: 2834*cdf0e10cSrcweir aChapterEntryLB.SelectEntryPos(1); 2835*cdf0e10cSrcweir break; 2836*cdf0e10cSrcweir case CF_NUMBER_NOPREPST: 2837*cdf0e10cSrcweir aChapterEntryLB.SelectEntryPos(2); 2838*cdf0e10cSrcweir break; 2839*cdf0e10cSrcweir } 2840*cdf0e10cSrcweir //<--- 2841*cdf0e10cSrcweir //i53420 2842*cdf0e10cSrcweir //move into position the fixed text 2843*cdf0e10cSrcweir // aEntryOutlineLevelFT.SetPosPixel( aEntryOutlineLevelFTPosition ); 2844*cdf0e10cSrcweir // // then the entry 2845*cdf0e10cSrcweir // Point aPoint; 2846*cdf0e10cSrcweir // aPoint.Y() = aEntryOutlineLevelFTPosition.Y(); 2847*cdf0e10cSrcweir // aPoint.X() = aEntryOutlineLevelFTPosition.X() + nBiasToEntryPoint; 2848*cdf0e10cSrcweir // aEntryOutlineLevelNF.SetPosPixel( aPoint ); 2849*cdf0e10cSrcweir 2850*cdf0e10cSrcweir aEntryOutlineLevelNF.SetValue(pToken->nOutlineLevel); 2851*cdf0e10cSrcweir } 2852*cdf0e10cSrcweir 2853*cdf0e10cSrcweir //i53420 2854*cdf0e10cSrcweir if(pToken->eTokenType == TOKEN_ENTRY_NO) 2855*cdf0e10cSrcweir { 2856*cdf0e10cSrcweir //move into position the fixed text 2857*cdf0e10cSrcweir // aEntryOutlineLevelFT.SetPosPixel( aChapterEntryFTPosition ); 2858*cdf0e10cSrcweir // // then the entry 2859*cdf0e10cSrcweir // Point aPoint; 2860*cdf0e10cSrcweir // aPoint.Y() = aChapterEntryFTPosition.Y(); 2861*cdf0e10cSrcweir // aPoint.X() = aChapterEntryFTPosition.X() + nBiasToEntryPoint; 2862*cdf0e10cSrcweir // aEntryOutlineLevelNF.SetPosPixel( aPoint ); 2863*cdf0e10cSrcweir 2864*cdf0e10cSrcweir aEntryOutlineLevelNF.SetValue(pToken->nOutlineLevel); 2865*cdf0e10cSrcweir sal_uInt16 nFormat = 0; 2866*cdf0e10cSrcweir if( pToken->nChapterFormat == CF_NUM_NOPREPST_TITLE ) 2867*cdf0e10cSrcweir nFormat = 1; 2868*cdf0e10cSrcweir aNumberFormatLB.SelectEntryPos(nFormat); 2869*cdf0e10cSrcweir } 2870*cdf0e10cSrcweir 2871*cdf0e10cSrcweir sal_Bool bTabStop = TOKEN_TAB_STOP == pToken->eTokenType; 2872*cdf0e10cSrcweir aFillCharFT.Show(bTabStop); 2873*cdf0e10cSrcweir aFillCharCB.Show(bTabStop); 2874*cdf0e10cSrcweir aTabPosFT.Show(bTabStop); 2875*cdf0e10cSrcweir aTabPosMF.Show(bTabStop); 2876*cdf0e10cSrcweir aAutoRightCB.Show(bTabStop); 2877*cdf0e10cSrcweir aAutoRightCB.Enable(bTabStop); 2878*cdf0e10cSrcweir if(bTabStop) 2879*cdf0e10cSrcweir { 2880*cdf0e10cSrcweir aTabPosMF.SetValue(aTabPosMF.Normalize(pToken->nTabStopPosition), FUNIT_TWIP); 2881*cdf0e10cSrcweir aAutoRightCB.Check(SVX_TAB_ADJUST_END == pToken->eTabAlign); 2882*cdf0e10cSrcweir aFillCharCB.SetText(pToken->cTabFillChar); 2883*cdf0e10cSrcweir aTabPosFT.Enable(!aAutoRightCB.IsChecked()); 2884*cdf0e10cSrcweir aTabPosMF.Enable(!aAutoRightCB.IsChecked()); 2885*cdf0e10cSrcweir } 2886*cdf0e10cSrcweir else 2887*cdf0e10cSrcweir { 2888*cdf0e10cSrcweir aTabPosMF.Enable(sal_False); 2889*cdf0e10cSrcweir } 2890*cdf0e10cSrcweir 2891*cdf0e10cSrcweir sal_Bool bIsChapterInfo = pToken->eTokenType == TOKEN_CHAPTER_INFO; 2892*cdf0e10cSrcweir sal_Bool bIsEntryNumber = pToken->eTokenType == TOKEN_ENTRY_NO; 2893*cdf0e10cSrcweir aChapterEntryFT.Show( bIsChapterInfo ); 2894*cdf0e10cSrcweir aChapterEntryLB.Show( bIsChapterInfo ); 2895*cdf0e10cSrcweir aEntryOutlineLevelFT.Show( bIsChapterInfo || bIsEntryNumber ); 2896*cdf0e10cSrcweir aEntryOutlineLevelNF.Show( bIsChapterInfo || bIsEntryNumber ); 2897*cdf0e10cSrcweir aNumberFormatFT.Show( bIsEntryNumber ); 2898*cdf0e10cSrcweir aNumberFormatLB.Show( bIsEntryNumber ); 2899*cdf0e10cSrcweir 2900*cdf0e10cSrcweir 2901*cdf0e10cSrcweir //now enable the visible buttons 2902*cdf0e10cSrcweir //- inserting the same type of control is not allowed 2903*cdf0e10cSrcweir //- some types of controls can only appear once (EntryText EntryNumber) 2904*cdf0e10cSrcweir 2905*cdf0e10cSrcweir if(aEntryNoPB.IsVisible()) 2906*cdf0e10cSrcweir { 2907*cdf0e10cSrcweir aEntryNoPB.Enable(TOKEN_ENTRY_NO != pToken->eTokenType ); 2908*cdf0e10cSrcweir } 2909*cdf0e10cSrcweir if(aEntryPB.IsVisible()) 2910*cdf0e10cSrcweir { 2911*cdf0e10cSrcweir aEntryPB.Enable(TOKEN_ENTRY_TEXT != pToken->eTokenType && 2912*cdf0e10cSrcweir !aTokenWIN.Contains(TOKEN_ENTRY_TEXT) 2913*cdf0e10cSrcweir && !aTokenWIN.Contains(TOKEN_ENTRY)); 2914*cdf0e10cSrcweir } 2915*cdf0e10cSrcweir 2916*cdf0e10cSrcweir if(aChapterInfoPB.IsVisible()) 2917*cdf0e10cSrcweir { 2918*cdf0e10cSrcweir aChapterInfoPB.Enable(TOKEN_CHAPTER_INFO != pToken->eTokenType); 2919*cdf0e10cSrcweir } 2920*cdf0e10cSrcweir if(aPageNoPB.IsVisible()) 2921*cdf0e10cSrcweir { 2922*cdf0e10cSrcweir aPageNoPB.Enable(TOKEN_PAGE_NUMS != pToken->eTokenType && 2923*cdf0e10cSrcweir !aTokenWIN.Contains(TOKEN_PAGE_NUMS)); 2924*cdf0e10cSrcweir } 2925*cdf0e10cSrcweir if(aTabPB.IsVisible()) 2926*cdf0e10cSrcweir { 2927*cdf0e10cSrcweir aTabPB.Enable(!bTabStop); 2928*cdf0e10cSrcweir } 2929*cdf0e10cSrcweir if(aHyperLinkPB.IsVisible()) 2930*cdf0e10cSrcweir { 2931*cdf0e10cSrcweir aHyperLinkPB.Enable(TOKEN_LINK_START != pToken->eTokenType && 2932*cdf0e10cSrcweir TOKEN_LINK_END != pToken->eTokenType); 2933*cdf0e10cSrcweir } 2934*cdf0e10cSrcweir //table of authorities 2935*cdf0e10cSrcweir if(aAuthInsertPB.IsVisible()) 2936*cdf0e10cSrcweir { 2937*cdf0e10cSrcweir sal_Bool bText = TOKEN_TEXT == pToken->eTokenType; 2938*cdf0e10cSrcweir aAuthInsertPB.Enable(bText && aAuthFieldsLB.GetSelectEntry().Len()); 2939*cdf0e10cSrcweir aAuthRemovePB.Enable(!bText); 2940*cdf0e10cSrcweir } 2941*cdf0e10cSrcweir 2942*cdf0e10cSrcweir return 0; 2943*cdf0e10cSrcweir } 2944*cdf0e10cSrcweir /* -----------------01.07.99 12:36------------------- 2945*cdf0e10cSrcweir 2946*cdf0e10cSrcweir --------------------------------------------------*/ 2947*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, StyleSelectHdl, ListBox*, pBox) 2948*cdf0e10cSrcweir { 2949*cdf0e10cSrcweir String sEntry = pBox->GetSelectEntry(); 2950*cdf0e10cSrcweir sal_uInt16 nId = (sal_uInt16)(long)pBox->GetEntryData(pBox->GetSelectEntryPos()); 2951*cdf0e10cSrcweir aEditStylePB.Enable(sEntry != sNoCharStyle); 2952*cdf0e10cSrcweir if(sEntry == sNoCharStyle) 2953*cdf0e10cSrcweir sEntry.Erase(); 2954*cdf0e10cSrcweir Control* pCtrl = aTokenWIN.GetActiveControl(); 2955*cdf0e10cSrcweir DBG_ASSERT(pCtrl, "no active control?"); 2956*cdf0e10cSrcweir if(pCtrl) 2957*cdf0e10cSrcweir { 2958*cdf0e10cSrcweir if(WINDOW_EDIT == pCtrl->GetType()) 2959*cdf0e10cSrcweir ((SwTOXEdit*)pCtrl)->SetCharStyleName(sEntry, nId); 2960*cdf0e10cSrcweir else 2961*cdf0e10cSrcweir ((SwTOXButton*)pCtrl)->SetCharStyleName(sEntry, nId); 2962*cdf0e10cSrcweir 2963*cdf0e10cSrcweir } 2964*cdf0e10cSrcweir ModifyHdl(0); 2965*cdf0e10cSrcweir return 0; 2966*cdf0e10cSrcweir } 2967*cdf0e10cSrcweir /* -----------------------------11.01.00 12:54-------------------------------- 2968*cdf0e10cSrcweir 2969*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2970*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, ChapterInfoHdl, ListBox*, pBox) 2971*cdf0e10cSrcweir { 2972*cdf0e10cSrcweir sal_uInt16 nPos = pBox->GetSelectEntryPos(); 2973*cdf0e10cSrcweir if(LISTBOX_ENTRY_NOTFOUND != nPos) 2974*cdf0e10cSrcweir { 2975*cdf0e10cSrcweir Control* pCtrl = aTokenWIN.GetActiveControl(); 2976*cdf0e10cSrcweir DBG_ASSERT(pCtrl, "no active control?"); 2977*cdf0e10cSrcweir if(pCtrl && WINDOW_EDIT != pCtrl->GetType()) 2978*cdf0e10cSrcweir ((SwTOXButton*)pCtrl)->SetChapterInfo(nPos); 2979*cdf0e10cSrcweir 2980*cdf0e10cSrcweir ModifyHdl(0); 2981*cdf0e10cSrcweir } 2982*cdf0e10cSrcweir return 0; 2983*cdf0e10cSrcweir } 2984*cdf0e10cSrcweir 2985*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, ChapterInfoOutlineHdl, NumericField*, pField) 2986*cdf0e10cSrcweir { 2987*cdf0e10cSrcweir const sal_uInt16 nLevel = static_cast<sal_uInt8>(pField->GetValue()); 2988*cdf0e10cSrcweir 2989*cdf0e10cSrcweir Control* pCtrl = aTokenWIN.GetActiveControl(); 2990*cdf0e10cSrcweir DBG_ASSERT(pCtrl, "no active control?"); 2991*cdf0e10cSrcweir if(pCtrl && WINDOW_EDIT != pCtrl->GetType()) 2992*cdf0e10cSrcweir ((SwTOXButton*)pCtrl)->SetOutlineLevel(nLevel); 2993*cdf0e10cSrcweir 2994*cdf0e10cSrcweir ModifyHdl(0); 2995*cdf0e10cSrcweir return 0; 2996*cdf0e10cSrcweir } 2997*cdf0e10cSrcweir 2998*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, NumberFormatHdl, ListBox*, pBox) 2999*cdf0e10cSrcweir { 3000*cdf0e10cSrcweir const sal_uInt16 nPos = pBox->GetSelectEntryPos(); 3001*cdf0e10cSrcweir 3002*cdf0e10cSrcweir if(LISTBOX_ENTRY_NOTFOUND != nPos) 3003*cdf0e10cSrcweir { 3004*cdf0e10cSrcweir Control* pCtrl = aTokenWIN.GetActiveControl(); 3005*cdf0e10cSrcweir DBG_ASSERT(pCtrl, "no active control?"); 3006*cdf0e10cSrcweir if(pCtrl && WINDOW_EDIT != pCtrl->GetType()) 3007*cdf0e10cSrcweir { 3008*cdf0e10cSrcweir ((SwTOXButton*)pCtrl)->SetEntryNumberFormat(nPos);//i89791 3009*cdf0e10cSrcweir } 3010*cdf0e10cSrcweir ModifyHdl(0); 3011*cdf0e10cSrcweir } 3012*cdf0e10cSrcweir return 0; 3013*cdf0e10cSrcweir } 3014*cdf0e10cSrcweir 3015*cdf0e10cSrcweir /* -----------------19.08.99 15:37------------------- 3016*cdf0e10cSrcweir 3017*cdf0e10cSrcweir --------------------------------------------------*/ 3018*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, TabPosHdl, MetricField*, pField) 3019*cdf0e10cSrcweir { 3020*cdf0e10cSrcweir Control* pCtrl = aTokenWIN.GetActiveControl(); 3021*cdf0e10cSrcweir DBG_ASSERT(pCtrl && WINDOW_EDIT != pCtrl->GetType() && 3022*cdf0e10cSrcweir TOKEN_TAB_STOP == ((SwTOXButton*)pCtrl)->GetFormToken().eTokenType, 3023*cdf0e10cSrcweir "no active style::TabStop control?"); 3024*cdf0e10cSrcweir if( pCtrl && WINDOW_EDIT != pCtrl->GetType() ) 3025*cdf0e10cSrcweir { 3026*cdf0e10cSrcweir ((SwTOXButton*)pCtrl)->SetTabPosition( static_cast< SwTwips >( 3027*cdf0e10cSrcweir pField->Denormalize( pField->GetValue( FUNIT_TWIP )))); 3028*cdf0e10cSrcweir } 3029*cdf0e10cSrcweir ModifyHdl(0); 3030*cdf0e10cSrcweir return 0; 3031*cdf0e10cSrcweir } 3032*cdf0e10cSrcweir /* -----------------09.09.99 15:37------------------- 3033*cdf0e10cSrcweir 3034*cdf0e10cSrcweir --------------------------------------------------*/ 3035*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, FillCharHdl, ComboBox*, pBox) 3036*cdf0e10cSrcweir { 3037*cdf0e10cSrcweir Control* pCtrl = aTokenWIN.GetActiveControl(); 3038*cdf0e10cSrcweir DBG_ASSERT(pCtrl && WINDOW_EDIT != pCtrl->GetType() && 3039*cdf0e10cSrcweir TOKEN_TAB_STOP == ((SwTOXButton*)pCtrl)->GetFormToken().eTokenType, 3040*cdf0e10cSrcweir "no active style::TabStop control?"); 3041*cdf0e10cSrcweir if(pCtrl && WINDOW_EDIT != pCtrl->GetType()) 3042*cdf0e10cSrcweir { 3043*cdf0e10cSrcweir sal_Unicode cSet; 3044*cdf0e10cSrcweir if( pBox->GetText().Len() ) 3045*cdf0e10cSrcweir cSet = pBox->GetText().GetChar(0); 3046*cdf0e10cSrcweir else 3047*cdf0e10cSrcweir cSet = ' '; 3048*cdf0e10cSrcweir ((SwTOXButton*)pCtrl)->SetFillChar( cSet ); 3049*cdf0e10cSrcweir } 3050*cdf0e10cSrcweir ModifyHdl(0); 3051*cdf0e10cSrcweir return 0; 3052*cdf0e10cSrcweir } 3053*cdf0e10cSrcweir 3054*cdf0e10cSrcweir /*-- 16.06.99 10:47:36--------------------------------------------------- 3055*cdf0e10cSrcweir 3056*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3057*cdf0e10cSrcweir IMPL_LINK(SwTOXEntryTabPage, AutoRightHdl, CheckBox*, pBox) 3058*cdf0e10cSrcweir { 3059*cdf0e10cSrcweir //the most right style::TabStop is usually right aligned 3060*cdf0e10cSrcweir Control* pCurCtrl = aTokenWIN.GetActiveControl(); 3061*cdf0e10cSrcweir DBG_ASSERT(WINDOW_EDIT != pCurCtrl->GetType() && 3062*cdf0e10cSrcweir ((SwTOXButton*)pCurCtrl)->GetFormToken().eTokenType == TOKEN_TAB_STOP, 3063*cdf0e10cSrcweir "no style::TabStop selected!"); 3064*cdf0e10cSrcweir 3065*cdf0e10cSrcweir const SwFormToken& rToken = ((SwTOXButton*)pCurCtrl)->GetFormToken(); 3066*cdf0e10cSrcweir sal_Bool bChecked = pBox->IsChecked(); 3067*cdf0e10cSrcweir if(rToken.eTokenType == TOKEN_TAB_STOP) 3068*cdf0e10cSrcweir ((SwTOXButton*)pCurCtrl)->SetTabAlign( 3069*cdf0e10cSrcweir bChecked ? SVX_TAB_ADJUST_END : SVX_TAB_ADJUST_LEFT); 3070*cdf0e10cSrcweir aTabPosFT.Enable(!bChecked); 3071*cdf0e10cSrcweir aTabPosMF.Enable(!bChecked); 3072*cdf0e10cSrcweir ModifyHdl(0); 3073*cdf0e10cSrcweir return 0; 3074*cdf0e10cSrcweir } 3075*cdf0e10cSrcweir /* -----------------16.06.99 11:00------------------- 3076*cdf0e10cSrcweir 3077*cdf0e10cSrcweir --------------------------------------------------*/ 3078*cdf0e10cSrcweir void SwTOXEntryTabPage::SetWrtShell(SwWrtShell& rSh) 3079*cdf0e10cSrcweir { 3080*cdf0e10cSrcweir SwDocShell* pDocSh = rSh.GetView().GetDocShell(); 3081*cdf0e10cSrcweir ::FillCharStyleListBox(aCharStyleLB, pDocSh, sal_True, sal_True); 3082*cdf0e10cSrcweir const String sDefault(SW_RES(STR_POOLCOLL_STANDARD)); 3083*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aCharStyleLB.GetEntryCount(); i++) 3084*cdf0e10cSrcweir { 3085*cdf0e10cSrcweir String sEntry = aCharStyleLB.GetEntry(i); 3086*cdf0e10cSrcweir if(sDefault != sEntry) 3087*cdf0e10cSrcweir { 3088*cdf0e10cSrcweir aMainEntryStyleLB.InsertEntry( sEntry ); 3089*cdf0e10cSrcweir aMainEntryStyleLB.SetEntryData(i, aCharStyleLB.GetEntryData(i)); 3090*cdf0e10cSrcweir } 3091*cdf0e10cSrcweir } 3092*cdf0e10cSrcweir aMainEntryStyleLB.SelectEntry( SwStyleNameMapper::GetUIName( 3093*cdf0e10cSrcweir RES_POOLCHR_IDX_MAIN_ENTRY, aEmptyStr )); 3094*cdf0e10cSrcweir } 3095*cdf0e10cSrcweir /* -----------------------------23.12.99 14:23-------------------------------- 3096*cdf0e10cSrcweir 3097*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3098*cdf0e10cSrcweir String SwTOXEntryTabPage::GetLevelHelp(sal_uInt16 nLevel) const 3099*cdf0e10cSrcweir { 3100*cdf0e10cSrcweir String sRet; 3101*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 3102*cdf0e10cSrcweir const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); 3103*cdf0e10cSrcweir if( TOX_INDEX == aCurType.eType ) 3104*cdf0e10cSrcweir SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(1 == nLevel ? RES_POOLCOLL_TOX_IDXBREAK 3105*cdf0e10cSrcweir : RES_POOLCOLL_TOX_IDX1 + nLevel-2), sRet ); 3106*cdf0e10cSrcweir 3107*cdf0e10cSrcweir else if( TOX_AUTHORITIES == aCurType.eType ) 3108*cdf0e10cSrcweir { 3109*cdf0e10cSrcweir //wildcard -> show entry text 3110*cdf0e10cSrcweir sRet = '*'; 3111*cdf0e10cSrcweir } 3112*cdf0e10cSrcweir return sRet; 3113*cdf0e10cSrcweir } 3114*cdf0e10cSrcweir /* -----------------16.06.99 15:18------------------- 3115*cdf0e10cSrcweir 3116*cdf0e10cSrcweir --------------------------------------------------*/ 3117*cdf0e10cSrcweir 3118*cdf0e10cSrcweir SwTokenWindow::SwTokenWindow(SwTOXEntryTabPage* pParent, const ResId& rResId) : 3119*cdf0e10cSrcweir Window( pParent, rResId ), 3120*cdf0e10cSrcweir aLeftScrollWin(this, ResId(WIN_LEFT_SCROLL, *rResId.GetResMgr() )), 3121*cdf0e10cSrcweir aCtrlParentWin(this, ResId(WIN_CTRL_PARENT, *rResId.GetResMgr() )), 3122*cdf0e10cSrcweir aRightScrollWin(this, ResId(WIN_RIGHT_SCROLL, *rResId.GetResMgr() )), 3123*cdf0e10cSrcweir pForm(0), 3124*cdf0e10cSrcweir nLevel(0), 3125*cdf0e10cSrcweir bValid(sal_False), 3126*cdf0e10cSrcweir sCharStyle(ResId(STR_CHARSTYLE, *rResId.GetResMgr())), 3127*cdf0e10cSrcweir pActiveCtrl(0), 3128*cdf0e10cSrcweir m_pParent(pParent) 3129*cdf0e10cSrcweir { 3130*cdf0e10cSrcweir SetStyle(GetStyle()|WB_TABSTOP|WB_DIALOGCONTROL); 3131*cdf0e10cSrcweir SetHelpId(HID_TOKEN_WINDOW); 3132*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < TOKEN_END; i++) 3133*cdf0e10cSrcweir { 3134*cdf0e10cSrcweir sal_uInt16 nTextId = STR_BUTTON_TEXT_START + i; 3135*cdf0e10cSrcweir if( STR_TOKEN_ENTRY_TEXT == nTextId ) 3136*cdf0e10cSrcweir nTextId = STR_TOKEN_ENTRY; 3137*cdf0e10cSrcweir aButtonTexts[i] = String(ResId(nTextId, *rResId.GetResMgr())); 3138*cdf0e10cSrcweir 3139*cdf0e10cSrcweir sal_uInt16 nHelpId = STR_BUTTON_HELP_TEXT_START + i; 3140*cdf0e10cSrcweir if(STR_TOKEN_HELP_ENTRY_TEXT == nHelpId) 3141*cdf0e10cSrcweir nHelpId = STR_TOKEN_HELP_ENTRY; 3142*cdf0e10cSrcweir aButtonHelpTexts[i] = String(ResId(nHelpId, *rResId.GetResMgr())); 3143*cdf0e10cSrcweir } 3144*cdf0e10cSrcweir 3145*cdf0e10cSrcweir FreeResource(); 3146*cdf0e10cSrcweir 3147*cdf0e10cSrcweir Link aLink(LINK(this, SwTokenWindow, ScrollHdl)); 3148*cdf0e10cSrcweir aLeftScrollWin.SetClickHdl(aLink); 3149*cdf0e10cSrcweir aRightScrollWin.SetClickHdl(aLink); 3150*cdf0e10cSrcweir } 3151*cdf0e10cSrcweir /* -----------------01.07.99 12:17------------------- 3152*cdf0e10cSrcweir 3153*cdf0e10cSrcweir --------------------------------------------------*/ 3154*cdf0e10cSrcweir SwTokenWindow::~SwTokenWindow() 3155*cdf0e10cSrcweir { 3156*cdf0e10cSrcweir // for(sal_uInt16 i = GetItemCount(); i ; i--) 3157*cdf0e10cSrcweir // RemoveItem(i - 1); 3158*cdf0e10cSrcweir 3159*cdf0e10cSrcweir for( sal_uInt32 n = 0; n < aControlList.Count(); ++n ) 3160*cdf0e10cSrcweir { 3161*cdf0e10cSrcweir Control* pControl = aControlList.GetObject( n ); 3162*cdf0e10cSrcweir pControl->SetGetFocusHdl( Link() ); 3163*cdf0e10cSrcweir pControl->SetLoseFocusHdl( Link() ); 3164*cdf0e10cSrcweir } 3165*cdf0e10cSrcweir 3166*cdf0e10cSrcweir for( sal_uLong i = aControlList.Count(); i; ) 3167*cdf0e10cSrcweir { 3168*cdf0e10cSrcweir Control* pControl = aControlList.Remove( --i ); 3169*cdf0e10cSrcweir delete pControl; 3170*cdf0e10cSrcweir } 3171*cdf0e10cSrcweir } 3172*cdf0e10cSrcweir /* -----------------16.06.99 13:56------------------- 3173*cdf0e10cSrcweir 3174*cdf0e10cSrcweir --------------------------------------------------*/ 3175*cdf0e10cSrcweir void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL) 3176*cdf0e10cSrcweir { 3177*cdf0e10cSrcweir SetActiveControl(0); 3178*cdf0e10cSrcweir bValid = sal_True; 3179*cdf0e10cSrcweir if(pForm) 3180*cdf0e10cSrcweir { 3181*cdf0e10cSrcweir //apply current level settings to the form 3182*cdf0e10cSrcweir for( sal_uLong i = aControlList.Count(); i; ) 3183*cdf0e10cSrcweir { 3184*cdf0e10cSrcweir Control* pControl = aControlList.Remove( --i ); 3185*cdf0e10cSrcweir delete pControl; 3186*cdf0e10cSrcweir } 3187*cdf0e10cSrcweir } 3188*cdf0e10cSrcweir nLevel = nL; 3189*cdf0e10cSrcweir pForm = &rForm; 3190*cdf0e10cSrcweir //now the display 3191*cdf0e10cSrcweir if(nLevel < MAXLEVEL || rForm.GetTOXType() == TOX_AUTHORITIES) 3192*cdf0e10cSrcweir { 3193*cdf0e10cSrcweir Size aToolBoxSize = GetSizePixel(); 3194*cdf0e10cSrcweir 3195*cdf0e10cSrcweir // #i21237# 3196*cdf0e10cSrcweir SwFormTokens aPattern = pForm->GetPattern(nLevel + 1); 3197*cdf0e10cSrcweir SwFormTokens::iterator aIt = aPattern.begin(); 3198*cdf0e10cSrcweir sal_Bool bLastWasText = sal_False; //assure alternating text - code - text 3199*cdf0e10cSrcweir 3200*cdf0e10cSrcweir Control* pSetActiveControl = 0; 3201*cdf0e10cSrcweir while(aIt != aPattern.end()) // #i21237# 3202*cdf0e10cSrcweir { 3203*cdf0e10cSrcweir SwFormToken aToken(*aIt); // #i21237# 3204*cdf0e10cSrcweir 3205*cdf0e10cSrcweir if(TOKEN_TEXT == aToken.eTokenType) 3206*cdf0e10cSrcweir { 3207*cdf0e10cSrcweir DBG_ASSERT(!bLastWasText, "text following text is invalid"); 3208*cdf0e10cSrcweir Control* pCtrl = InsertItem(aToken.sText, aToken); 3209*cdf0e10cSrcweir bLastWasText = sal_True; 3210*cdf0e10cSrcweir if(!GetActiveControl()) 3211*cdf0e10cSrcweir SetActiveControl(pCtrl); 3212*cdf0e10cSrcweir } 3213*cdf0e10cSrcweir else 3214*cdf0e10cSrcweir { 3215*cdf0e10cSrcweir if( !bLastWasText ) 3216*cdf0e10cSrcweir { 3217*cdf0e10cSrcweir bLastWasText = sal_True; 3218*cdf0e10cSrcweir SwFormToken aTemp(TOKEN_TEXT); 3219*cdf0e10cSrcweir Control* pCtrl = InsertItem(aEmptyStr, aTemp); 3220*cdf0e10cSrcweir if(!pSetActiveControl) 3221*cdf0e10cSrcweir pSetActiveControl = pCtrl; 3222*cdf0e10cSrcweir } 3223*cdf0e10cSrcweir const sal_Char* pTmp = 0; 3224*cdf0e10cSrcweir switch( aToken.eTokenType ) 3225*cdf0e10cSrcweir { 3226*cdf0e10cSrcweir case TOKEN_ENTRY_NO: pTmp = SwForm::aFormEntryNum; break; 3227*cdf0e10cSrcweir case TOKEN_ENTRY_TEXT: pTmp = SwForm::aFormEntryTxt; break; 3228*cdf0e10cSrcweir case TOKEN_ENTRY: pTmp = SwForm::aFormEntry; break; 3229*cdf0e10cSrcweir case TOKEN_TAB_STOP: pTmp = SwForm::aFormTab; break; 3230*cdf0e10cSrcweir case TOKEN_PAGE_NUMS: pTmp = SwForm::aFormPageNums; break; 3231*cdf0e10cSrcweir case TOKEN_CHAPTER_INFO:pTmp = SwForm::aFormChapterMark; break; 3232*cdf0e10cSrcweir case TOKEN_LINK_START: pTmp = SwForm::aFormLinkStt; break; 3233*cdf0e10cSrcweir case TOKEN_LINK_END: pTmp = SwForm::aFormLinkEnd; break; 3234*cdf0e10cSrcweir case TOKEN_AUTHORITY: pTmp = SwForm::aFormAuth; break; 3235*cdf0e10cSrcweir default:; //prevent warning 3236*cdf0e10cSrcweir } 3237*cdf0e10cSrcweir 3238*cdf0e10cSrcweir InsertItem( pTmp ? String::CreateFromAscii(pTmp) 3239*cdf0e10cSrcweir : aEmptyStr, aToken ); 3240*cdf0e10cSrcweir bLastWasText = sal_False; 3241*cdf0e10cSrcweir } 3242*cdf0e10cSrcweir 3243*cdf0e10cSrcweir aIt++; // #i21237# 3244*cdf0e10cSrcweir } 3245*cdf0e10cSrcweir if(!bLastWasText) 3246*cdf0e10cSrcweir { 3247*cdf0e10cSrcweir bLastWasText = sal_True; 3248*cdf0e10cSrcweir SwFormToken aTemp(TOKEN_TEXT); 3249*cdf0e10cSrcweir Control* pCtrl = InsertItem(aEmptyStr, aTemp); 3250*cdf0e10cSrcweir if(!pSetActiveControl) 3251*cdf0e10cSrcweir pSetActiveControl = pCtrl; 3252*cdf0e10cSrcweir } 3253*cdf0e10cSrcweir SetActiveControl(pSetActiveControl); 3254*cdf0e10cSrcweir } 3255*cdf0e10cSrcweir AdjustScrolling(); 3256*cdf0e10cSrcweir } 3257*cdf0e10cSrcweir /* -----------------19.08.99 13:00------------------- 3258*cdf0e10cSrcweir 3259*cdf0e10cSrcweir --------------------------------------------------*/ 3260*cdf0e10cSrcweir void SwTokenWindow::SetActiveControl(Control* pSet) 3261*cdf0e10cSrcweir { 3262*cdf0e10cSrcweir if( pSet != pActiveCtrl ) 3263*cdf0e10cSrcweir { 3264*cdf0e10cSrcweir pActiveCtrl = pSet; 3265*cdf0e10cSrcweir if( pActiveCtrl ) 3266*cdf0e10cSrcweir { 3267*cdf0e10cSrcweir pActiveCtrl->GrabFocus(); 3268*cdf0e10cSrcweir //it must be a SwTOXEdit 3269*cdf0e10cSrcweir const SwFormToken* pFToken; 3270*cdf0e10cSrcweir if( WINDOW_EDIT == pActiveCtrl->GetType() ) 3271*cdf0e10cSrcweir pFToken = &((SwTOXEdit*)pActiveCtrl)->GetFormToken(); 3272*cdf0e10cSrcweir else 3273*cdf0e10cSrcweir pFToken = &((SwTOXButton*)pActiveCtrl)->GetFormToken(); 3274*cdf0e10cSrcweir 3275*cdf0e10cSrcweir SwFormToken aTemp( *pFToken ); 3276*cdf0e10cSrcweir aButtonSelectedHdl.Call( &aTemp ); 3277*cdf0e10cSrcweir } 3278*cdf0e10cSrcweir } 3279*cdf0e10cSrcweir } 3280*cdf0e10cSrcweir 3281*cdf0e10cSrcweir /* -----------------17.06.99 09:53------------------- 3282*cdf0e10cSrcweir 3283*cdf0e10cSrcweir --------------------------------------------------*/ 3284*cdf0e10cSrcweir Control* SwTokenWindow::InsertItem(const String& rText, const SwFormToken& rToken) 3285*cdf0e10cSrcweir { 3286*cdf0e10cSrcweir Control* pRet = 0; 3287*cdf0e10cSrcweir Control* pLast = aControlList.Last(); 3288*cdf0e10cSrcweir Size aControlSize(GetOutputSizePixel()); 3289*cdf0e10cSrcweir Point aControlPos; 3290*cdf0e10cSrcweir if( pLast ) 3291*cdf0e10cSrcweir { 3292*cdf0e10cSrcweir aControlSize = pLast->GetSizePixel(); 3293*cdf0e10cSrcweir aControlPos = pLast->GetPosPixel(); 3294*cdf0e10cSrcweir aControlPos.X() += aControlSize.Width(); 3295*cdf0e10cSrcweir } 3296*cdf0e10cSrcweir if(TOKEN_TEXT == rToken.eTokenType) 3297*cdf0e10cSrcweir { 3298*cdf0e10cSrcweir SwTOXEdit* pEdit = new SwTOXEdit(&aCtrlParentWin, this, rToken); 3299*cdf0e10cSrcweir pEdit->SetPosPixel(aControlPos); 3300*cdf0e10cSrcweir aControlList.Insert(pEdit, aControlList.Count()); 3301*cdf0e10cSrcweir pEdit->SetText(rText); 3302*cdf0e10cSrcweir Size aEditSize(aControlSize); 3303*cdf0e10cSrcweir aEditSize.Width() = pEdit->GetTextWidth(rText) + EDIT_MINWIDTH; 3304*cdf0e10cSrcweir pEdit->SetSizePixel(aEditSize); 3305*cdf0e10cSrcweir pEdit->SetModifyHdl(LINK(this, SwTokenWindow, EditResize )); 3306*cdf0e10cSrcweir pEdit->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemHdl)); 3307*cdf0e10cSrcweir pEdit->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusHdl)); 3308*cdf0e10cSrcweir pEdit->Show(); 3309*cdf0e10cSrcweir pRet = pEdit; 3310*cdf0e10cSrcweir } 3311*cdf0e10cSrcweir else 3312*cdf0e10cSrcweir { 3313*cdf0e10cSrcweir SwTOXButton* pButton = new SwTOXButton(&aCtrlParentWin, this, rToken); 3314*cdf0e10cSrcweir pButton->SetPosPixel(aControlPos); 3315*cdf0e10cSrcweir aControlList.Insert(pButton, aControlList.Count()); 3316*cdf0e10cSrcweir Size aEditSize(aControlSize); 3317*cdf0e10cSrcweir aEditSize.Width() = pButton->GetTextWidth(rText) + 5; 3318*cdf0e10cSrcweir // pButton->SetControlBackground(aCtrlColor); 3319*cdf0e10cSrcweir // pButton->SetControlForeground(aTextColor); 3320*cdf0e10cSrcweir pButton->SetSizePixel(aEditSize); 3321*cdf0e10cSrcweir pButton->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemBtnHdl)); 3322*cdf0e10cSrcweir pButton->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusBtnHdl)); 3323*cdf0e10cSrcweir if(TOKEN_AUTHORITY != rToken.eTokenType) 3324*cdf0e10cSrcweir pButton->SetText(aButtonTexts[rToken.eTokenType]); 3325*cdf0e10cSrcweir else 3326*cdf0e10cSrcweir { 3327*cdf0e10cSrcweir //use the first two chars as symbol 3328*cdf0e10cSrcweir String sTmp(SwAuthorityFieldType::GetAuthFieldName( 3329*cdf0e10cSrcweir (ToxAuthorityField)rToken.nAuthorityField)); 3330*cdf0e10cSrcweir pButton->SetText(sTmp.Copy(0, 2)); 3331*cdf0e10cSrcweir } 3332*cdf0e10cSrcweir pButton->Show(); 3333*cdf0e10cSrcweir pRet = pButton; 3334*cdf0e10cSrcweir } 3335*cdf0e10cSrcweir return pRet; 3336*cdf0e10cSrcweir } 3337*cdf0e10cSrcweir /* -----------------16.07.99 11:50------------------- 3338*cdf0e10cSrcweir 3339*cdf0e10cSrcweir --------------------------------------------------*/ 3340*cdf0e10cSrcweir void SwTokenWindow::InsertAtSelection( 3341*cdf0e10cSrcweir const String& rText, 3342*cdf0e10cSrcweir const SwFormToken& rToken) 3343*cdf0e10cSrcweir { 3344*cdf0e10cSrcweir DBG_ASSERT(pActiveCtrl, "no active control!"); 3345*cdf0e10cSrcweir if(!pActiveCtrl) 3346*cdf0e10cSrcweir return; 3347*cdf0e10cSrcweir SwFormToken aToInsertToken(rToken); 3348*cdf0e10cSrcweir if(TOKEN_LINK_START == aToInsertToken.eTokenType) 3349*cdf0e10cSrcweir { 3350*cdf0e10cSrcweir //determine if start or end of hyperlink is appropriate 3351*cdf0e10cSrcweir //eventually change a following link start into a link end 3352*cdf0e10cSrcweir // groups of LS LE should be ignored 3353*cdf0e10cSrcweir // <insert> 3354*cdf0e10cSrcweir //LS <insert> 3355*cdf0e10cSrcweir //LE <insert> 3356*cdf0e10cSrcweir //<insert> LS 3357*cdf0e10cSrcweir //<insert> LE 3358*cdf0e10cSrcweir //<insert> 3359*cdf0e10cSrcweir sal_Bool bPreStartLinkFound = sal_False; // 3360*cdf0e10cSrcweir sal_Bool bPreEndLinkFound = sal_False; 3361*cdf0e10cSrcweir 3362*cdf0e10cSrcweir const Control* pControl = aControlList.First(); 3363*cdf0e10cSrcweir const Control* pExchange = 0; 3364*cdf0e10cSrcweir while( pControl && pActiveCtrl != pControl ) 3365*cdf0e10cSrcweir { 3366*cdf0e10cSrcweir if( WINDOW_EDIT != pControl->GetType()) 3367*cdf0e10cSrcweir { 3368*cdf0e10cSrcweir const SwFormToken& rNewToken = 3369*cdf0e10cSrcweir ((SwTOXButton*)pControl)->GetFormToken(); 3370*cdf0e10cSrcweir if( TOKEN_LINK_START == rNewToken.eTokenType ) 3371*cdf0e10cSrcweir { 3372*cdf0e10cSrcweir bPreStartLinkFound = sal_True; 3373*cdf0e10cSrcweir pExchange = 0; 3374*cdf0e10cSrcweir } 3375*cdf0e10cSrcweir else if(TOKEN_LINK_END == rNewToken.eTokenType) 3376*cdf0e10cSrcweir { 3377*cdf0e10cSrcweir if( bPreStartLinkFound ) 3378*cdf0e10cSrcweir bPreStartLinkFound = sal_False; 3379*cdf0e10cSrcweir else 3380*cdf0e10cSrcweir { 3381*cdf0e10cSrcweir bPreEndLinkFound = sal_False; 3382*cdf0e10cSrcweir pExchange = pControl; 3383*cdf0e10cSrcweir } 3384*cdf0e10cSrcweir } 3385*cdf0e10cSrcweir } 3386*cdf0e10cSrcweir pControl = aControlList.Next(); 3387*cdf0e10cSrcweir } 3388*cdf0e10cSrcweir 3389*cdf0e10cSrcweir sal_Bool bPostLinkEndFound = sal_False; 3390*cdf0e10cSrcweir sal_Bool bPostLinkStartFound = sal_False; 3391*cdf0e10cSrcweir if(!bPreStartLinkFound && !bPreEndLinkFound) 3392*cdf0e10cSrcweir while(pControl) 3393*cdf0e10cSrcweir { 3394*cdf0e10cSrcweir if( pControl != pActiveCtrl && 3395*cdf0e10cSrcweir WINDOW_EDIT != pControl->GetType()) 3396*cdf0e10cSrcweir { 3397*cdf0e10cSrcweir const SwFormToken& rNewToken = 3398*cdf0e10cSrcweir ((SwTOXButton*)pControl)->GetFormToken(); 3399*cdf0e10cSrcweir if( TOKEN_LINK_START == rNewToken.eTokenType ) 3400*cdf0e10cSrcweir { 3401*cdf0e10cSrcweir if(bPostLinkStartFound) 3402*cdf0e10cSrcweir break; 3403*cdf0e10cSrcweir bPostLinkStartFound = sal_True; 3404*cdf0e10cSrcweir pExchange = pControl; 3405*cdf0e10cSrcweir } 3406*cdf0e10cSrcweir else if(TOKEN_LINK_END == rNewToken.eTokenType ) 3407*cdf0e10cSrcweir { 3408*cdf0e10cSrcweir if(bPostLinkStartFound) 3409*cdf0e10cSrcweir { 3410*cdf0e10cSrcweir bPostLinkStartFound = sal_False; 3411*cdf0e10cSrcweir pExchange = 0; 3412*cdf0e10cSrcweir } 3413*cdf0e10cSrcweir else 3414*cdf0e10cSrcweir { 3415*cdf0e10cSrcweir bPostLinkEndFound = sal_True; 3416*cdf0e10cSrcweir } 3417*cdf0e10cSrcweir break; 3418*cdf0e10cSrcweir } 3419*cdf0e10cSrcweir } 3420*cdf0e10cSrcweir pControl = aControlList.Next(); 3421*cdf0e10cSrcweir } 3422*cdf0e10cSrcweir 3423*cdf0e10cSrcweir if(bPreStartLinkFound) 3424*cdf0e10cSrcweir { 3425*cdf0e10cSrcweir aToInsertToken.eTokenType = TOKEN_LINK_END; 3426*cdf0e10cSrcweir aToInsertToken.sText = aButtonTexts[TOKEN_LINK_END]; 3427*cdf0e10cSrcweir } 3428*cdf0e10cSrcweir 3429*cdf0e10cSrcweir if(bPostLinkStartFound) 3430*cdf0e10cSrcweir { 3431*cdf0e10cSrcweir DBG_ASSERT(pExchange, "no control to exchange?"); 3432*cdf0e10cSrcweir if(pExchange) 3433*cdf0e10cSrcweir { 3434*cdf0e10cSrcweir ((SwTOXButton*)pExchange)->SetLinkEnd(); 3435*cdf0e10cSrcweir ((SwTOXButton*)pExchange)->SetText(aButtonTexts[TOKEN_LINK_END]); 3436*cdf0e10cSrcweir } 3437*cdf0e10cSrcweir } 3438*cdf0e10cSrcweir 3439*cdf0e10cSrcweir if(bPreEndLinkFound) 3440*cdf0e10cSrcweir { 3441*cdf0e10cSrcweir DBG_ASSERT(pExchange, "no control to exchange?"); 3442*cdf0e10cSrcweir if(pExchange) 3443*cdf0e10cSrcweir { 3444*cdf0e10cSrcweir ((SwTOXButton*)pExchange)->SetLinkStart(); 3445*cdf0e10cSrcweir ((SwTOXButton*)pExchange)->SetText(aButtonTexts[TOKEN_LINK_START]); 3446*cdf0e10cSrcweir } 3447*cdf0e10cSrcweir } 3448*cdf0e10cSrcweir } 3449*cdf0e10cSrcweir 3450*cdf0e10cSrcweir //if the active control is text then insert a new button at the selection 3451*cdf0e10cSrcweir //else replace the button 3452*cdf0e10cSrcweir sal_uInt32 nActivePos = aControlList.GetPos(pActiveCtrl); 3453*cdf0e10cSrcweir sal_uInt32 nInsertPos = nActivePos; 3454*cdf0e10cSrcweir 3455*cdf0e10cSrcweir Size aControlSize(GetOutputSizePixel()); 3456*cdf0e10cSrcweir if( WINDOW_EDIT == pActiveCtrl->GetType()) 3457*cdf0e10cSrcweir { 3458*cdf0e10cSrcweir nInsertPos++; 3459*cdf0e10cSrcweir Selection aSel = ((SwTOXEdit*)pActiveCtrl)->GetSelection(); 3460*cdf0e10cSrcweir aSel.Justify(); 3461*cdf0e10cSrcweir String sEditText = ((SwTOXEdit*)pActiveCtrl)->GetText(); 3462*cdf0e10cSrcweir String sLeft = sEditText.Copy( 0, static_cast< sal_uInt16 >(aSel.A()) ); 3463*cdf0e10cSrcweir String sRight = sEditText.Copy( static_cast< sal_uInt16 >(aSel.B()), 3464*cdf0e10cSrcweir static_cast< sal_uInt16 >(sEditText.Len() - aSel.B())); 3465*cdf0e10cSrcweir 3466*cdf0e10cSrcweir ((SwTOXEdit*)pActiveCtrl)->SetText(sLeft); 3467*cdf0e10cSrcweir ((SwTOXEdit*)pActiveCtrl)->AdjustSize(); 3468*cdf0e10cSrcweir 3469*cdf0e10cSrcweir SwFormToken aTmpToken(TOKEN_TEXT); 3470*cdf0e10cSrcweir SwTOXEdit* pEdit = new SwTOXEdit(&aCtrlParentWin, this, aTmpToken); 3471*cdf0e10cSrcweir aControlList.Insert(pEdit, nActivePos + 1); 3472*cdf0e10cSrcweir pEdit->SetText(sRight); 3473*cdf0e10cSrcweir pEdit->SetSizePixel(aControlSize); 3474*cdf0e10cSrcweir pEdit->AdjustSize(); 3475*cdf0e10cSrcweir pEdit->SetModifyHdl(LINK(this, SwTokenWindow, EditResize )); 3476*cdf0e10cSrcweir pEdit->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemHdl)); 3477*cdf0e10cSrcweir pEdit->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusHdl)); 3478*cdf0e10cSrcweir pEdit->Show(); 3479*cdf0e10cSrcweir } 3480*cdf0e10cSrcweir else 3481*cdf0e10cSrcweir { 3482*cdf0e10cSrcweir aControlList.Remove(pActiveCtrl); 3483*cdf0e10cSrcweir pActiveCtrl->Hide(); 3484*cdf0e10cSrcweir delete pActiveCtrl; 3485*cdf0e10cSrcweir } 3486*cdf0e10cSrcweir 3487*cdf0e10cSrcweir //now the new button 3488*cdf0e10cSrcweir SwTOXButton* pButton = new SwTOXButton(&aCtrlParentWin, this, aToInsertToken); 3489*cdf0e10cSrcweir aControlList.Insert(pButton, nInsertPos); 3490*cdf0e10cSrcweir pButton->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemBtnHdl)); 3491*cdf0e10cSrcweir pButton->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusBtnHdl)); 3492*cdf0e10cSrcweir if(TOKEN_AUTHORITY != aToInsertToken.eTokenType) 3493*cdf0e10cSrcweir pButton->SetText(aButtonTexts[aToInsertToken.eTokenType]); 3494*cdf0e10cSrcweir else 3495*cdf0e10cSrcweir { 3496*cdf0e10cSrcweir //use the first two chars as symbol 3497*cdf0e10cSrcweir String sTmp(SwAuthorityFieldType::GetAuthFieldName( 3498*cdf0e10cSrcweir (ToxAuthorityField)aToInsertToken.nAuthorityField)); 3499*cdf0e10cSrcweir pButton->SetText(sTmp.Copy(0, 2)); 3500*cdf0e10cSrcweir } 3501*cdf0e10cSrcweir 3502*cdf0e10cSrcweir Size aEditSize(GetOutputSizePixel()); 3503*cdf0e10cSrcweir aEditSize.Width() = pButton->GetTextWidth(rText) + 5; 3504*cdf0e10cSrcweir pButton->SetSizePixel(aEditSize); 3505*cdf0e10cSrcweir pButton->Check(sal_True); 3506*cdf0e10cSrcweir pButton->Show(); 3507*cdf0e10cSrcweir SetActiveControl(pButton); 3508*cdf0e10cSrcweir 3509*cdf0e10cSrcweir AdjustPositions(); 3510*cdf0e10cSrcweir } 3511*cdf0e10cSrcweir /* -----------------19.08.99 12:42------------------- 3512*cdf0e10cSrcweir 3513*cdf0e10cSrcweir --------------------------------------------------*/ 3514*cdf0e10cSrcweir void SwTokenWindow::RemoveControl(SwTOXButton* pDel, sal_Bool bInternalCall ) 3515*cdf0e10cSrcweir { 3516*cdf0e10cSrcweir if(bInternalCall && TOX_AUTHORITIES == pForm->GetTOXType()) 3517*cdf0e10cSrcweir m_pParent->PreTokenButtonRemoved(pDel->GetFormToken()); 3518*cdf0e10cSrcweir 3519*cdf0e10cSrcweir sal_uInt32 nActivePos = aControlList.GetPos(pDel); 3520*cdf0e10cSrcweir DBG_ASSERT(nActivePos != 0xffffffff, "Control does not exist!"); 3521*cdf0e10cSrcweir // the two neighbours of the box must be merged 3522*cdf0e10cSrcweir // the properties of the right one will be lost 3523*cdf0e10cSrcweir DBG_ASSERT(nActivePos && nActivePos < aControlList.Count() - 1, 3524*cdf0e10cSrcweir "Button at first or last position?"); 3525*cdf0e10cSrcweir aControlList.Seek(nActivePos - 1); 3526*cdf0e10cSrcweir Control* pLeftEdit = aControlList.GetCurObject(); 3527*cdf0e10cSrcweir aControlList.Seek(nActivePos + 1); 3528*cdf0e10cSrcweir Control* pRightEdit = aControlList.GetCurObject(); 3529*cdf0e10cSrcweir String sTemp(((SwTOXEdit*)pLeftEdit)->GetText()); 3530*cdf0e10cSrcweir sTemp += ((SwTOXEdit*)pRightEdit)->GetText(); 3531*cdf0e10cSrcweir ((SwTOXEdit*)pLeftEdit)->SetText(sTemp); 3532*cdf0e10cSrcweir ((SwTOXEdit*)pLeftEdit)->AdjustSize(); 3533*cdf0e10cSrcweir 3534*cdf0e10cSrcweir aControlList.Remove(pRightEdit); 3535*cdf0e10cSrcweir delete pRightEdit; 3536*cdf0e10cSrcweir 3537*cdf0e10cSrcweir aControlList.Remove(pDel); 3538*cdf0e10cSrcweir pActiveCtrl->Hide(); 3539*cdf0e10cSrcweir delete pActiveCtrl; 3540*cdf0e10cSrcweir SetActiveControl(pLeftEdit); 3541*cdf0e10cSrcweir AdjustPositions(); 3542*cdf0e10cSrcweir if(aModifyHdl.IsSet()) 3543*cdf0e10cSrcweir aModifyHdl.Call(0); 3544*cdf0e10cSrcweir } 3545*cdf0e10cSrcweir 3546*cdf0e10cSrcweir /* -----------------16.07.99 12:39------------------- 3547*cdf0e10cSrcweir 3548*cdf0e10cSrcweir --------------------------------------------------*/ 3549*cdf0e10cSrcweir void SwTokenWindow::AdjustPositions() 3550*cdf0e10cSrcweir { 3551*cdf0e10cSrcweir if(aControlList.Count() > 1) 3552*cdf0e10cSrcweir { 3553*cdf0e10cSrcweir Control* pCtrl = aControlList.First(); 3554*cdf0e10cSrcweir Point aNextPos = pCtrl->GetPosPixel(); 3555*cdf0e10cSrcweir aNextPos.X() += pCtrl->GetSizePixel().Width(); 3556*cdf0e10cSrcweir while(0 != (pCtrl = aControlList.Next())) 3557*cdf0e10cSrcweir { 3558*cdf0e10cSrcweir pCtrl->SetPosPixel(aNextPos); 3559*cdf0e10cSrcweir aNextPos.X() += pCtrl->GetSizePixel().Width(); 3560*cdf0e10cSrcweir } 3561*cdf0e10cSrcweir AdjustScrolling(); 3562*cdf0e10cSrcweir } 3563*cdf0e10cSrcweir }; 3564*cdf0e10cSrcweir /* -----------------------------16.08.00 13:22-------------------------------- 3565*cdf0e10cSrcweir 3566*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3567*cdf0e10cSrcweir void SwTokenWindow::MoveControls(long nOffset) 3568*cdf0e10cSrcweir { 3569*cdf0e10cSrcweir // move the complete list 3570*cdf0e10cSrcweir Control* pCtrl = aControlList.First(); 3571*cdf0e10cSrcweir do 3572*cdf0e10cSrcweir { 3573*cdf0e10cSrcweir Point aPos = pCtrl->GetPosPixel(); 3574*cdf0e10cSrcweir aPos.X() += nOffset; 3575*cdf0e10cSrcweir pCtrl->SetPosPixel(aPos); 3576*cdf0e10cSrcweir }while(0 != (pCtrl = aControlList.Next())); 3577*cdf0e10cSrcweir } 3578*cdf0e10cSrcweir /* -----------------------------14.01.00 13:03-------------------------------- 3579*cdf0e10cSrcweir 3580*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3581*cdf0e10cSrcweir void SwTokenWindow::AdjustScrolling() 3582*cdf0e10cSrcweir { 3583*cdf0e10cSrcweir if(aControlList.Count() > 1) 3584*cdf0e10cSrcweir { 3585*cdf0e10cSrcweir //validate scroll buttons 3586*cdf0e10cSrcweir Control* pLastCtrl = aControlList.Last(); 3587*cdf0e10cSrcweir Control* pFirstCtrl = aControlList.First(); 3588*cdf0e10cSrcweir long nSpace = aCtrlParentWin.GetSizePixel().Width(); 3589*cdf0e10cSrcweir long nWidth = pLastCtrl->GetPosPixel().X() - pFirstCtrl->GetPosPixel().X() 3590*cdf0e10cSrcweir + pLastCtrl->GetSizePixel().Width(); 3591*cdf0e10cSrcweir sal_Bool bEnable = nWidth > nSpace; 3592*cdf0e10cSrcweir //the active control must be visible 3593*cdf0e10cSrcweir if(bEnable && pActiveCtrl) 3594*cdf0e10cSrcweir { 3595*cdf0e10cSrcweir Point aActivePos(pActiveCtrl->GetPosPixel()); 3596*cdf0e10cSrcweir long nMove = 0; 3597*cdf0e10cSrcweir if(aActivePos.X() < 0) 3598*cdf0e10cSrcweir nMove = -aActivePos.X(); 3599*cdf0e10cSrcweir else if((aActivePos.X() + pActiveCtrl->GetSizePixel().Width()) > nSpace) 3600*cdf0e10cSrcweir nMove = -(aActivePos.X() + pActiveCtrl->GetSizePixel().Width() - nSpace); 3601*cdf0e10cSrcweir if(nMove) 3602*cdf0e10cSrcweir MoveControls(nMove); 3603*cdf0e10cSrcweir aLeftScrollWin.Enable(aControlList.First()->GetPosPixel().X() < 0); 3604*cdf0e10cSrcweir Control* pCtrl = aControlList.Last(); 3605*cdf0e10cSrcweir aRightScrollWin.Enable((pCtrl->GetPosPixel().X() + pCtrl->GetSizePixel().Width()) > nSpace); 3606*cdf0e10cSrcweir } 3607*cdf0e10cSrcweir else 3608*cdf0e10cSrcweir { 3609*cdf0e10cSrcweir if(pFirstCtrl) 3610*cdf0e10cSrcweir { 3611*cdf0e10cSrcweir //if the control fits into the space then the first control must be at postion 0 3612*cdf0e10cSrcweir long nFirstPos = pFirstCtrl->GetPosPixel().X(); 3613*cdf0e10cSrcweir if(nFirstPos != 0) 3614*cdf0e10cSrcweir MoveControls(-nFirstPos); 3615*cdf0e10cSrcweir } 3616*cdf0e10cSrcweir aRightScrollWin.Enable(sal_False); 3617*cdf0e10cSrcweir aLeftScrollWin.Enable(sal_False); 3618*cdf0e10cSrcweir } 3619*cdf0e10cSrcweir } 3620*cdf0e10cSrcweir } 3621*cdf0e10cSrcweir /* -----------------------------14.01.00 13:57-------------------------------- 3622*cdf0e10cSrcweir 3623*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3624*cdf0e10cSrcweir IMPL_LINK(SwTokenWindow, ScrollHdl, ImageButton*, pBtn ) 3625*cdf0e10cSrcweir { 3626*cdf0e10cSrcweir if(aControlList.Count()) 3627*cdf0e10cSrcweir { 3628*cdf0e10cSrcweir const long nSpace = aCtrlParentWin.GetSizePixel().Width(); 3629*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 3630*cdf0e10cSrcweir //find all start/end positions and print it 3631*cdf0e10cSrcweir String sMessage(String::CreateFromAscii("Space: ")); 3632*cdf0e10cSrcweir sMessage += String::CreateFromInt32(nSpace); 3633*cdf0e10cSrcweir sMessage += String::CreateFromAscii(" | "); 3634*cdf0e10cSrcweir Control* pDebugCtrl = aControlList.First(); 3635*cdf0e10cSrcweir do 3636*cdf0e10cSrcweir { 3637*cdf0e10cSrcweir long nDebugXPos = pDebugCtrl->GetPosPixel().X(); 3638*cdf0e10cSrcweir long nDebugWidth = pDebugCtrl->GetSizePixel().Width(); 3639*cdf0e10cSrcweir sMessage += String::CreateFromInt32( nDebugXPos ); 3640*cdf0e10cSrcweir sMessage += String::CreateFromAscii(" "); 3641*cdf0e10cSrcweir sMessage += String::CreateFromInt32(nDebugXPos + nDebugWidth); 3642*cdf0e10cSrcweir sMessage += String::CreateFromAscii(" | "); 3643*cdf0e10cSrcweir 3644*cdf0e10cSrcweir }while(0 != (pDebugCtrl = aControlList.Next())); 3645*cdf0e10cSrcweir 3646*cdf0e10cSrcweir #endif 3647*cdf0e10cSrcweir 3648*cdf0e10cSrcweir long nMove = 0; 3649*cdf0e10cSrcweir if(pBtn == &aLeftScrollWin) 3650*cdf0e10cSrcweir { 3651*cdf0e10cSrcweir //find the first completely visible control (left edge visible) 3652*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aControlList.Count(); i++ ) 3653*cdf0e10cSrcweir { 3654*cdf0e10cSrcweir Control* pCtrl = aControlList.GetObject(i); 3655*cdf0e10cSrcweir long nXPos = pCtrl->GetPosPixel().X(); 3656*cdf0e10cSrcweir if(nXPos >= 0) 3657*cdf0e10cSrcweir { 3658*cdf0e10cSrcweir if(!i) 3659*cdf0e10cSrcweir //move the current control to the left edge 3660*cdf0e10cSrcweir nMove = -nXPos; 3661*cdf0e10cSrcweir else 3662*cdf0e10cSrcweir //move the left neighbor to the start position 3663*cdf0e10cSrcweir nMove = -aControlList.GetObject(i - 1)->GetPosPixel().X(); 3664*cdf0e10cSrcweir break; 3665*cdf0e10cSrcweir } 3666*cdf0e10cSrcweir } 3667*cdf0e10cSrcweir } 3668*cdf0e10cSrcweir else 3669*cdf0e10cSrcweir { 3670*cdf0e10cSrcweir //find the first completely visible control (left edge visible) 3671*cdf0e10cSrcweir for(sal_uLong i = aControlList.Count(); i; i-- ) 3672*cdf0e10cSrcweir { 3673*cdf0e10cSrcweir Control* pCtrl = aControlList.GetObject(i - 1); 3674*cdf0e10cSrcweir long nCtrlWidth = pCtrl->GetSizePixel().Width(); 3675*cdf0e10cSrcweir long nXPos = pCtrl->GetPosPixel().X() + nCtrlWidth; 3676*cdf0e10cSrcweir if(nXPos <= nSpace) 3677*cdf0e10cSrcweir { 3678*cdf0e10cSrcweir if( i < aControlList.Count()) 3679*cdf0e10cSrcweir { 3680*cdf0e10cSrcweir //move the right neighbor to the right edge right aligned 3681*cdf0e10cSrcweir Control* pRight = aControlList.GetObject(i); 3682*cdf0e10cSrcweir nMove = nSpace - pRight->GetPosPixel().X() - pRight->GetSizePixel().Width(); 3683*cdf0e10cSrcweir } 3684*cdf0e10cSrcweir break; 3685*cdf0e10cSrcweir } 3686*cdf0e10cSrcweir } 3687*cdf0e10cSrcweir 3688*cdf0e10cSrcweir //move it left until it's completely visible 3689*cdf0e10cSrcweir } 3690*cdf0e10cSrcweir if(nMove) 3691*cdf0e10cSrcweir { 3692*cdf0e10cSrcweir // move the complete list 3693*cdf0e10cSrcweir Control* pCtrl = aControlList.First(); 3694*cdf0e10cSrcweir do 3695*cdf0e10cSrcweir { 3696*cdf0e10cSrcweir Point aPos = pCtrl->GetPosPixel(); 3697*cdf0e10cSrcweir aPos.X() += nMove; 3698*cdf0e10cSrcweir pCtrl->SetPosPixel(aPos); 3699*cdf0e10cSrcweir }while(0 != (pCtrl = aControlList.Next())); 3700*cdf0e10cSrcweir aLeftScrollWin.Enable(aControlList.First()->GetPosPixel().X() < 0); 3701*cdf0e10cSrcweir pCtrl = aControlList.Last(); 3702*cdf0e10cSrcweir aRightScrollWin.Enable((pCtrl->GetPosPixel().X() + pCtrl->GetSizePixel().Width()) > nSpace); 3703*cdf0e10cSrcweir 3704*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 3705*cdf0e10cSrcweir sMessage.AppendAscii("Move: "); 3706*cdf0e10cSrcweir sMessage += String::CreateFromInt32(nMove); 3707*cdf0e10cSrcweir GetParent()->GetParent()->GetParent()->SetText(sMessage); 3708*cdf0e10cSrcweir #endif 3709*cdf0e10cSrcweir } 3710*cdf0e10cSrcweir } 3711*cdf0e10cSrcweir return 0; 3712*cdf0e10cSrcweir } 3713*cdf0e10cSrcweir /* -----------------17.06.99 11:59------------------- 3714*cdf0e10cSrcweir 3715*cdf0e10cSrcweir --------------------------------------------------*/ 3716*cdf0e10cSrcweir String SwTokenWindow::GetPattern() const 3717*cdf0e10cSrcweir { 3718*cdf0e10cSrcweir String sRet; 3719*cdf0e10cSrcweir const Control* pControl = ((SwTokenWindow*)this)->aControlList.First(); 3720*cdf0e10cSrcweir while(pControl) 3721*cdf0e10cSrcweir { 3722*cdf0e10cSrcweir const SwFormToken& rNewToken = WINDOW_EDIT == pControl->GetType() 3723*cdf0e10cSrcweir ? ((SwTOXEdit*)pControl)->GetFormToken() 3724*cdf0e10cSrcweir : ((SwTOXButton*)pControl)->GetFormToken(); 3725*cdf0e10cSrcweir 3726*cdf0e10cSrcweir //TODO: prevent input of TOX_STYLE_DELIMITER in KeyInput 3727*cdf0e10cSrcweir sRet += rNewToken.GetString(); 3728*cdf0e10cSrcweir 3729*cdf0e10cSrcweir pControl = ((SwTokenWindow*)this)->aControlList.Next(); 3730*cdf0e10cSrcweir } 3731*cdf0e10cSrcweir return sRet; 3732*cdf0e10cSrcweir } 3733*cdf0e10cSrcweir /* -----------------19.08.99 11:27------------------- 3734*cdf0e10cSrcweir Description: Check if a control of the specified 3735*cdf0e10cSrcweir TokenType is already contained in the list 3736*cdf0e10cSrcweir --------------------------------------------------*/ 3737*cdf0e10cSrcweir sal_Bool SwTokenWindow::Contains(FormTokenType eSearchFor) const 3738*cdf0e10cSrcweir { 3739*cdf0e10cSrcweir sal_Bool bRet = sal_False; 3740*cdf0e10cSrcweir const Control* pControl = ((SwTokenWindow*)this)->aControlList.First(); 3741*cdf0e10cSrcweir while(pControl) 3742*cdf0e10cSrcweir { 3743*cdf0e10cSrcweir const SwFormToken& rNewToken = WINDOW_EDIT == pControl->GetType() 3744*cdf0e10cSrcweir ? ((SwTOXEdit*)pControl)->GetFormToken() 3745*cdf0e10cSrcweir : ((SwTOXButton*)pControl)->GetFormToken(); 3746*cdf0e10cSrcweir 3747*cdf0e10cSrcweir if(eSearchFor == rNewToken.eTokenType) 3748*cdf0e10cSrcweir { 3749*cdf0e10cSrcweir bRet = sal_True; 3750*cdf0e10cSrcweir break; 3751*cdf0e10cSrcweir } 3752*cdf0e10cSrcweir pControl = ((SwTokenWindow*)this)->aControlList.Next(); 3753*cdf0e10cSrcweir } 3754*cdf0e10cSrcweir return bRet; 3755*cdf0e10cSrcweir } 3756*cdf0e10cSrcweir //--------------------------------------------------- 3757*cdf0e10cSrcweir sal_Bool SwTokenWindow::CreateQuickHelp(Control* pCtrl, 3758*cdf0e10cSrcweir const SwFormToken& rToken, 3759*cdf0e10cSrcweir const HelpEvent& rHEvt) 3760*cdf0e10cSrcweir { 3761*cdf0e10cSrcweir sal_Bool bRet = sal_False; 3762*cdf0e10cSrcweir if( rHEvt.GetMode() & HELPMODE_QUICK ) 3763*cdf0e10cSrcweir { 3764*cdf0e10cSrcweir sal_Bool bBalloon = Help::IsBalloonHelpEnabled(); 3765*cdf0e10cSrcweir String sEntry; 3766*cdf0e10cSrcweir if(bBalloon || rToken.eTokenType != TOKEN_AUTHORITY) 3767*cdf0e10cSrcweir sEntry = (aButtonHelpTexts[rToken.eTokenType]); 3768*cdf0e10cSrcweir if(rToken.eTokenType == TOKEN_AUTHORITY ) 3769*cdf0e10cSrcweir { 3770*cdf0e10cSrcweir sEntry += SwAuthorityFieldType::GetAuthFieldName( 3771*cdf0e10cSrcweir (ToxAuthorityField) rToken.nAuthorityField); 3772*cdf0e10cSrcweir } 3773*cdf0e10cSrcweir 3774*cdf0e10cSrcweir Point aPos = OutputToScreenPixel(pCtrl->GetPosPixel()); 3775*cdf0e10cSrcweir Rectangle aItemRect( aPos, pCtrl->GetSizePixel() ); 3776*cdf0e10cSrcweir if(rToken.eTokenType == TOKEN_TAB_STOP ) 3777*cdf0e10cSrcweir { 3778*cdf0e10cSrcweir // sEntry += '\n'; 3779*cdf0e10cSrcweir // sEntry += rToken.nTabStopPosition; 3780*cdf0e10cSrcweir } 3781*cdf0e10cSrcweir else 3782*cdf0e10cSrcweir { 3783*cdf0e10cSrcweir if(rToken.sCharStyleName.Len()) 3784*cdf0e10cSrcweir { 3785*cdf0e10cSrcweir if(bBalloon) 3786*cdf0e10cSrcweir sEntry += '\n'; 3787*cdf0e10cSrcweir else 3788*cdf0e10cSrcweir sEntry += ' '; 3789*cdf0e10cSrcweir sEntry += sCharStyle; 3790*cdf0e10cSrcweir sEntry += rToken.sCharStyleName; 3791*cdf0e10cSrcweir } 3792*cdf0e10cSrcweir } 3793*cdf0e10cSrcweir if(bBalloon) 3794*cdf0e10cSrcweir { 3795*cdf0e10cSrcweir Help::ShowBalloon( this, aPos, aItemRect, sEntry ); 3796*cdf0e10cSrcweir } 3797*cdf0e10cSrcweir else 3798*cdf0e10cSrcweir Help::ShowQuickHelp( this, aItemRect, sEntry, 3799*cdf0e10cSrcweir QUICKHELP_LEFT|QUICKHELP_VCENTER ); 3800*cdf0e10cSrcweir bRet = sal_True; 3801*cdf0e10cSrcweir } 3802*cdf0e10cSrcweir return bRet; 3803*cdf0e10cSrcweir } 3804*cdf0e10cSrcweir /* -----------------------------14.01.00 12:22-------------------------------- 3805*cdf0e10cSrcweir 3806*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3807*cdf0e10cSrcweir void SwTokenWindow::Resize() 3808*cdf0e10cSrcweir { 3809*cdf0e10cSrcweir Size aCompleteSize(GetOutputSizePixel()); 3810*cdf0e10cSrcweir 3811*cdf0e10cSrcweir Point aRightPos(aRightScrollWin.GetPosPixel()); 3812*cdf0e10cSrcweir Size aRightSize(aRightScrollWin.GetSizePixel()); 3813*cdf0e10cSrcweir 3814*cdf0e10cSrcweir Size aMiddleSize(aCtrlParentWin.GetSizePixel()); 3815*cdf0e10cSrcweir 3816*cdf0e10cSrcweir long nMove = aCompleteSize.Width() - aRightSize.Width() - aRightPos.X(); 3817*cdf0e10cSrcweir 3818*cdf0e10cSrcweir aRightPos.X() += nMove; 3819*cdf0e10cSrcweir aRightScrollWin.SetPosPixel(aRightPos); 3820*cdf0e10cSrcweir aMiddleSize.Width() += nMove; 3821*cdf0e10cSrcweir aCtrlParentWin.SetSizePixel(aMiddleSize); 3822*cdf0e10cSrcweir } 3823*cdf0e10cSrcweir 3824*cdf0e10cSrcweir /* -----------------16.06.99 15:23------------------- 3825*cdf0e10cSrcweir 3826*cdf0e10cSrcweir --------------------------------------------------*/ 3827*cdf0e10cSrcweir IMPL_LINK(SwTokenWindow, EditResize, Edit*, pEdit) 3828*cdf0e10cSrcweir { 3829*cdf0e10cSrcweir ((SwTOXEdit*)pEdit)->AdjustSize(); 3830*cdf0e10cSrcweir AdjustPositions(); 3831*cdf0e10cSrcweir if(aModifyHdl.IsSet()) 3832*cdf0e10cSrcweir aModifyHdl.Call(0); 3833*cdf0e10cSrcweir return 0; 3834*cdf0e10cSrcweir } 3835*cdf0e10cSrcweir /* -----------------16.06.99 15:56------------------- 3836*cdf0e10cSrcweir 3837*cdf0e10cSrcweir --------------------------------------------------*/ 3838*cdf0e10cSrcweir IMPL_LINK(SwTokenWindow, NextItemHdl, SwTOXEdit*, pEdit) 3839*cdf0e10cSrcweir { 3840*cdf0e10cSrcweir sal_uInt16 nPos = (sal_uInt16)aControlList.GetPos(pEdit); 3841*cdf0e10cSrcweir if( (nPos && !pEdit->IsNextControl()) || 3842*cdf0e10cSrcweir (nPos < aControlList.Count() - 1 && pEdit->IsNextControl())) 3843*cdf0e10cSrcweir { 3844*cdf0e10cSrcweir aControlList.Seek(nPos); 3845*cdf0e10cSrcweir Control* pNextPrev = pEdit->IsNextControl() ? aControlList.Next() : aControlList.Prev(); 3846*cdf0e10cSrcweir nPos += pEdit->IsNextControl() ? 1 : -1; 3847*cdf0e10cSrcweir pNextPrev->GrabFocus(); 3848*cdf0e10cSrcweir ((SwTOXButton*)pNextPrev)->Check(); 3849*cdf0e10cSrcweir AdjustScrolling(); 3850*cdf0e10cSrcweir } 3851*cdf0e10cSrcweir return 0; 3852*cdf0e10cSrcweir } 3853*cdf0e10cSrcweir /* -----------------17.06.99 08:58------------------- 3854*cdf0e10cSrcweir 3855*cdf0e10cSrcweir --------------------------------------------------*/ 3856*cdf0e10cSrcweir IMPL_LINK(SwTokenWindow, TbxFocusHdl, SwTOXEdit*, pEdit) 3857*cdf0e10cSrcweir { 3858*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aControlList.Count(); i++) 3859*cdf0e10cSrcweir { 3860*cdf0e10cSrcweir Control* pControl = aControlList.First(); 3861*cdf0e10cSrcweir while(pControl) 3862*cdf0e10cSrcweir { 3863*cdf0e10cSrcweir if(WINDOW_EDIT != pControl->GetType() ) 3864*cdf0e10cSrcweir ((SwTOXButton*)pControl)->Check(sal_False); 3865*cdf0e10cSrcweir pControl = aControlList.Next(); 3866*cdf0e10cSrcweir } 3867*cdf0e10cSrcweir } 3868*cdf0e10cSrcweir SetActiveControl(pEdit); 3869*cdf0e10cSrcweir return 0; 3870*cdf0e10cSrcweir } 3871*cdf0e10cSrcweir /* -----------------17.06.99 10:05------------------- 3872*cdf0e10cSrcweir 3873*cdf0e10cSrcweir --------------------------------------------------*/ 3874*cdf0e10cSrcweir IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton*, pBtn ) 3875*cdf0e10cSrcweir { 3876*cdf0e10cSrcweir sal_uInt16 nPos = (sal_uInt16)aControlList.GetPos(pBtn); 3877*cdf0e10cSrcweir if( (nPos && !pBtn->IsNextControl()) || 3878*cdf0e10cSrcweir (nPos < aControlList.Count() - 1 && pBtn->IsNextControl())) 3879*cdf0e10cSrcweir { 3880*cdf0e10cSrcweir aControlList.Seek(nPos); 3881*cdf0e10cSrcweir sal_Bool bNext = pBtn->IsNextControl(); 3882*cdf0e10cSrcweir Control* pNextPrev = bNext ? aControlList.Next() : aControlList.Prev(); 3883*cdf0e10cSrcweir pNextPrev->GrabFocus(); 3884*cdf0e10cSrcweir Selection aSel(0, 0); 3885*cdf0e10cSrcweir if(!bNext) 3886*cdf0e10cSrcweir { 3887*cdf0e10cSrcweir sal_uInt16 nLen = ((SwTOXEdit*)pNextPrev)->GetText().Len(); 3888*cdf0e10cSrcweir aSel.A() = nLen; 3889*cdf0e10cSrcweir aSel.B() = nLen; 3890*cdf0e10cSrcweir } 3891*cdf0e10cSrcweir ((SwTOXEdit*)pNextPrev)->SetSelection(aSel); 3892*cdf0e10cSrcweir pBtn->Check(sal_False); 3893*cdf0e10cSrcweir AdjustScrolling(); 3894*cdf0e10cSrcweir } 3895*cdf0e10cSrcweir return 0; 3896*cdf0e10cSrcweir } 3897*cdf0e10cSrcweir 3898*cdf0e10cSrcweir /* -----------------17.06.99 10:04------------------- 3899*cdf0e10cSrcweir 3900*cdf0e10cSrcweir --------------------------------------------------*/ 3901*cdf0e10cSrcweir IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, SwTOXButton*, pBtn ) 3902*cdf0e10cSrcweir { 3903*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aControlList.Count(); i++) 3904*cdf0e10cSrcweir { 3905*cdf0e10cSrcweir Control* pControl = aControlList.First(); 3906*cdf0e10cSrcweir while(pControl) 3907*cdf0e10cSrcweir { 3908*cdf0e10cSrcweir if(WINDOW_EDIT != pControl->GetType() ) 3909*cdf0e10cSrcweir ((SwTOXButton*)pControl)->Check(pBtn == pControl); 3910*cdf0e10cSrcweir pControl = aControlList.Next(); 3911*cdf0e10cSrcweir } 3912*cdf0e10cSrcweir } 3913*cdf0e10cSrcweir SetActiveControl(pBtn); 3914*cdf0e10cSrcweir return 0; 3915*cdf0e10cSrcweir } 3916*cdf0e10cSrcweir /* -----------------------------28.01.2002 12:22------------------------------ 3917*cdf0e10cSrcweir 3918*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3919*cdf0e10cSrcweir void SwTokenWindow::GetFocus() 3920*cdf0e10cSrcweir { 3921*cdf0e10cSrcweir if(GETFOCUS_TAB & GetGetFocusFlags()) 3922*cdf0e10cSrcweir { 3923*cdf0e10cSrcweir Control* pFirst = aControlList.First(); 3924*cdf0e10cSrcweir if(pFirst) 3925*cdf0e10cSrcweir { 3926*cdf0e10cSrcweir pFirst->GrabFocus(); 3927*cdf0e10cSrcweir SetActiveControl(pFirst); 3928*cdf0e10cSrcweir AdjustScrolling(); 3929*cdf0e10cSrcweir } 3930*cdf0e10cSrcweir } 3931*cdf0e10cSrcweir } 3932*cdf0e10cSrcweir /* -----------------25.03.99 15:17------------------- 3933*cdf0e10cSrcweir * 3934*cdf0e10cSrcweir * --------------------------------------------------*/ 3935*cdf0e10cSrcweir SwTOXStylesTabPage::SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet ) : 3936*cdf0e10cSrcweir SfxTabPage(pParent, SW_RES(TP_TOX_STYLES), rAttrSet), 3937*cdf0e10cSrcweir aFormatFL(this, SW_RES(FL_FORMAT )), 3938*cdf0e10cSrcweir aLevelFT2(this, SW_RES(FT_LEVEL )), 3939*cdf0e10cSrcweir aLevelLB(this, SW_RES(LB_LEVEL )), 3940*cdf0e10cSrcweir aAssignBT(this, SW_RES(BT_ASSIGN )), 3941*cdf0e10cSrcweir aTemplateFT(this, SW_RES(FT_TEMPLATE)), 3942*cdf0e10cSrcweir aParaLayLB(this, SW_RES(LB_PARALAY )), 3943*cdf0e10cSrcweir aStdBT(this, SW_RES(BT_STD )), 3944*cdf0e10cSrcweir aEditStyleBT(this, SW_RES(BT_EDIT_STYLE )), 3945*cdf0e10cSrcweir m_pCurrentForm(0) 3946*cdf0e10cSrcweir { 3947*cdf0e10cSrcweir FreeResource(); 3948*cdf0e10cSrcweir 3949*cdf0e10cSrcweir SetExchangeSupport( sal_True ); 3950*cdf0e10cSrcweir 3951*cdf0e10cSrcweir aAssignBT.SetModeImage( Image( SW_RES( IMG_ONE_LEFT_HC ) ), BMP_COLOR_HIGHCONTRAST ); 3952*cdf0e10cSrcweir 3953*cdf0e10cSrcweir aEditStyleBT.SetClickHdl (LINK( this, SwTOXStylesTabPage, EditStyleHdl)); 3954*cdf0e10cSrcweir aAssignBT.SetClickHdl (LINK( this, SwTOXStylesTabPage, AssignHdl)); 3955*cdf0e10cSrcweir aStdBT.SetClickHdl (LINK( this, SwTOXStylesTabPage, StdHdl)); 3956*cdf0e10cSrcweir aParaLayLB.SetSelectHdl (LINK( this, SwTOXStylesTabPage, EnableSelectHdl)); 3957*cdf0e10cSrcweir aLevelLB.SetSelectHdl (LINK( this, SwTOXStylesTabPage, EnableSelectHdl)); 3958*cdf0e10cSrcweir aParaLayLB.SetDoubleClickHdl(LINK( this, SwTOXStylesTabPage, DoubleClickHdl)); 3959*cdf0e10cSrcweir 3960*cdf0e10cSrcweir aStdBT.SetAccessibleRelationMemberOf(&aFormatFL); 3961*cdf0e10cSrcweir aAssignBT.SetAccessibleRelationMemberOf(&aFormatFL); 3962*cdf0e10cSrcweir aEditStyleBT.SetAccessibleRelationMemberOf(&aFormatFL); 3963*cdf0e10cSrcweir 3964*cdf0e10cSrcweir } 3965*cdf0e10cSrcweir /* -----------------25.03.99 15:17------------------- 3966*cdf0e10cSrcweir * 3967*cdf0e10cSrcweir * --------------------------------------------------*/ 3968*cdf0e10cSrcweir SwTOXStylesTabPage::~SwTOXStylesTabPage() 3969*cdf0e10cSrcweir { 3970*cdf0e10cSrcweir delete m_pCurrentForm; 3971*cdf0e10cSrcweir } 3972*cdf0e10cSrcweir /* -----------------25.03.99 15:17------------------- 3973*cdf0e10cSrcweir * 3974*cdf0e10cSrcweir * --------------------------------------------------*/ 3975*cdf0e10cSrcweir sal_Bool SwTOXStylesTabPage::FillItemSet( SfxItemSet& ) 3976*cdf0e10cSrcweir { 3977*cdf0e10cSrcweir return sal_True; 3978*cdf0e10cSrcweir } 3979*cdf0e10cSrcweir /* -----------------25.03.99 15:17------------------- 3980*cdf0e10cSrcweir * 3981*cdf0e10cSrcweir * --------------------------------------------------*/ 3982*cdf0e10cSrcweir void SwTOXStylesTabPage::Reset( const SfxItemSet& rSet ) 3983*cdf0e10cSrcweir { 3984*cdf0e10cSrcweir ActivatePage(rSet); 3985*cdf0e10cSrcweir } 3986*cdf0e10cSrcweir /* -----------------25.03.99 15:17------------------- 3987*cdf0e10cSrcweir * 3988*cdf0e10cSrcweir * --------------------------------------------------*/ 3989*cdf0e10cSrcweir void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& ) 3990*cdf0e10cSrcweir { 3991*cdf0e10cSrcweir m_pCurrentForm = new SwForm(GetForm()); 3992*cdf0e10cSrcweir aParaLayLB.Clear(); 3993*cdf0e10cSrcweir aLevelLB.Clear(); 3994*cdf0e10cSrcweir 3995*cdf0e10cSrcweir // kein Hyperlink fuer Benutzerverzeichnisse 3996*cdf0e10cSrcweir 3997*cdf0e10cSrcweir sal_uInt16 i, nSize = m_pCurrentForm->GetFormMax(); 3998*cdf0e10cSrcweir 3999*cdf0e10cSrcweir // form-Pattern anzeigen ohne Titel 4000*cdf0e10cSrcweir 4001*cdf0e10cSrcweir //1. TemplateEntry anzeigen 4002*cdf0e10cSrcweir String aStr( SW_RES( STR_TITLE )); 4003*cdf0e10cSrcweir if( m_pCurrentForm->GetTemplate( 0 ).Len() ) 4004*cdf0e10cSrcweir { 4005*cdf0e10cSrcweir aStr += ' '; 4006*cdf0e10cSrcweir aStr += aDeliStart; 4007*cdf0e10cSrcweir aStr += m_pCurrentForm->GetTemplate( 0 ); 4008*cdf0e10cSrcweir aStr += aDeliEnd; 4009*cdf0e10cSrcweir } 4010*cdf0e10cSrcweir aLevelLB.InsertEntry(aStr); 4011*cdf0e10cSrcweir 4012*cdf0e10cSrcweir for( i=1; i < nSize; ++i ) 4013*cdf0e10cSrcweir { 4014*cdf0e10cSrcweir if( TOX_INDEX == m_pCurrentForm->GetTOXType() && 4015*cdf0e10cSrcweir FORM_ALPHA_DELIMITTER == i ) 4016*cdf0e10cSrcweir aStr = SW_RESSTR(STR_ALPHA); 4017*cdf0e10cSrcweir else 4018*cdf0e10cSrcweir { 4019*cdf0e10cSrcweir aStr = SW_RESSTR(STR_LEVEL); 4020*cdf0e10cSrcweir aStr += String::CreateFromInt32( 4021*cdf0e10cSrcweir TOX_INDEX == m_pCurrentForm->GetTOXType() ? i - 1 : i ); 4022*cdf0e10cSrcweir } 4023*cdf0e10cSrcweir String aCpy( aStr ); 4024*cdf0e10cSrcweir 4025*cdf0e10cSrcweir if( m_pCurrentForm->GetTemplate( i ).Len() ) 4026*cdf0e10cSrcweir { 4027*cdf0e10cSrcweir aCpy += ' '; 4028*cdf0e10cSrcweir aCpy += aDeliStart; 4029*cdf0e10cSrcweir aCpy += m_pCurrentForm->GetTemplate( i ); 4030*cdf0e10cSrcweir aCpy += aDeliEnd; 4031*cdf0e10cSrcweir } 4032*cdf0e10cSrcweir aLevelLB.InsertEntry( aCpy ); 4033*cdf0e10cSrcweir } 4034*cdf0e10cSrcweir 4035*cdf0e10cSrcweir // Templates initialisieren 4036*cdf0e10cSrcweir const SwTxtFmtColl *pColl; 4037*cdf0e10cSrcweir SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell(); 4038*cdf0e10cSrcweir const sal_uInt16 nSz = rSh.GetTxtFmtCollCount(); 4039*cdf0e10cSrcweir 4040*cdf0e10cSrcweir for( i = 0; i < nSz; ++i ) 4041*cdf0e10cSrcweir if( !(pColl = &rSh.GetTxtFmtColl( i ))->IsDefault() ) 4042*cdf0e10cSrcweir aParaLayLB.InsertEntry( pColl->GetName() ); 4043*cdf0e10cSrcweir 4044*cdf0e10cSrcweir // Pool-Collections abfragen und fuer das Verzeichnis setzen 4045*cdf0e10cSrcweir for( i = 0; i < m_pCurrentForm->GetFormMax(); ++i ) 4046*cdf0e10cSrcweir { 4047*cdf0e10cSrcweir aStr = m_pCurrentForm->GetTemplate( i ); 4048*cdf0e10cSrcweir if( aStr.Len() && 4049*cdf0e10cSrcweir LISTBOX_ENTRY_NOTFOUND == aParaLayLB.GetEntryPos( aStr )) 4050*cdf0e10cSrcweir aParaLayLB.InsertEntry( aStr ); 4051*cdf0e10cSrcweir } 4052*cdf0e10cSrcweir 4053*cdf0e10cSrcweir EnableSelectHdl(&aParaLayLB); 4054*cdf0e10cSrcweir } 4055*cdf0e10cSrcweir /* -----------------25.03.99 15:17------------------- 4056*cdf0e10cSrcweir * 4057*cdf0e10cSrcweir * --------------------------------------------------*/ 4058*cdf0e10cSrcweir int SwTOXStylesTabPage::DeactivatePage( SfxItemSet* /*pSet*/ ) 4059*cdf0e10cSrcweir { 4060*cdf0e10cSrcweir GetForm() = *m_pCurrentForm; 4061*cdf0e10cSrcweir return LEAVE_PAGE; 4062*cdf0e10cSrcweir } 4063*cdf0e10cSrcweir 4064*cdf0e10cSrcweir /* -----------------25.03.99 15:17------------------- 4065*cdf0e10cSrcweir * 4066*cdf0e10cSrcweir * --------------------------------------------------*/ 4067*cdf0e10cSrcweir SfxTabPage* SwTOXStylesTabPage::Create( Window* pParent, 4068*cdf0e10cSrcweir const SfxItemSet& rAttrSet) 4069*cdf0e10cSrcweir { 4070*cdf0e10cSrcweir return new SwTOXStylesTabPage(pParent, rAttrSet); 4071*cdf0e10cSrcweir } 4072*cdf0e10cSrcweir /* -----------------26.03.99 12:47------------------- 4073*cdf0e10cSrcweir * 4074*cdf0e10cSrcweir * --------------------------------------------------*/ 4075*cdf0e10cSrcweir IMPL_LINK( SwTOXStylesTabPage, EditStyleHdl, Button *, pBtn ) 4076*cdf0e10cSrcweir { 4077*cdf0e10cSrcweir if( LISTBOX_ENTRY_NOTFOUND != aParaLayLB.GetSelectEntryPos()) 4078*cdf0e10cSrcweir { 4079*cdf0e10cSrcweir SfxStringItem aStyle(SID_STYLE_EDIT, aParaLayLB.GetSelectEntry()); 4080*cdf0e10cSrcweir SfxUInt16Item aFamily(SID_STYLE_FAMILY, SFX_STYLE_FAMILY_PARA); 4081*cdf0e10cSrcweir // SwPtrItem aShell(FN_PARAM_WRTSHELL, pWrtShell); 4082*cdf0e10cSrcweir Window* pDefDlgParent = Application::GetDefDialogParent(); 4083*cdf0e10cSrcweir Application::SetDefDialogParent( pBtn ); 4084*cdf0e10cSrcweir SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell(); 4085*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( 4086*cdf0e10cSrcweir SID_STYLE_EDIT, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_MODAL, 4087*cdf0e10cSrcweir &aStyle, &aFamily/*, &aShell*/, 0L); 4088*cdf0e10cSrcweir Application::SetDefDialogParent( pDefDlgParent ); 4089*cdf0e10cSrcweir } 4090*cdf0e10cSrcweir return 0; 4091*cdf0e10cSrcweir } 4092*cdf0e10cSrcweir /*-------------------------------------------------------------------- 4093*cdf0e10cSrcweir Beschreibung: Vorlagen zuweisen 4094*cdf0e10cSrcweir --------------------------------------------------------------------*/ 4095*cdf0e10cSrcweir IMPL_LINK( SwTOXStylesTabPage, AssignHdl, Button *, EMPTYARG ) 4096*cdf0e10cSrcweir { 4097*cdf0e10cSrcweir sal_uInt16 nLevPos = aLevelLB.GetSelectEntryPos(); 4098*cdf0e10cSrcweir sal_uInt16 nTemplPos = aParaLayLB.GetSelectEntryPos(); 4099*cdf0e10cSrcweir if(nLevPos != LISTBOX_ENTRY_NOTFOUND && 4100*cdf0e10cSrcweir nTemplPos != LISTBOX_ENTRY_NOTFOUND) 4101*cdf0e10cSrcweir { 4102*cdf0e10cSrcweir String aStr(aLevelLB.GetEntry(nLevPos)); 4103*cdf0e10cSrcweir sal_uInt16 nDelPos = aStr.Search(aDeliStart); 4104*cdf0e10cSrcweir if(nDelPos != STRING_NOTFOUND) 4105*cdf0e10cSrcweir aStr.Erase(nDelPos-1); 4106*cdf0e10cSrcweir aStr += ' '; 4107*cdf0e10cSrcweir aStr += aDeliStart; 4108*cdf0e10cSrcweir aStr += aParaLayLB.GetSelectEntry(); 4109*cdf0e10cSrcweir 4110*cdf0e10cSrcweir m_pCurrentForm->SetTemplate(nLevPos, aParaLayLB.GetSelectEntry()); 4111*cdf0e10cSrcweir 4112*cdf0e10cSrcweir aStr += aDeliEnd; 4113*cdf0e10cSrcweir 4114*cdf0e10cSrcweir aLevelLB.RemoveEntry(nLevPos); 4115*cdf0e10cSrcweir aLevelLB.InsertEntry(aStr, nLevPos); 4116*cdf0e10cSrcweir aLevelLB.SelectEntry(aStr); 4117*cdf0e10cSrcweir ModifyHdl(0); 4118*cdf0e10cSrcweir } 4119*cdf0e10cSrcweir return 0; 4120*cdf0e10cSrcweir } 4121*cdf0e10cSrcweir /* -----------------26.03.99 09:10------------------- 4122*cdf0e10cSrcweir * 4123*cdf0e10cSrcweir * --------------------------------------------------*/ 4124*cdf0e10cSrcweir IMPL_LINK( SwTOXStylesTabPage, StdHdl, Button *, EMPTYARG ) 4125*cdf0e10cSrcweir { 4126*cdf0e10cSrcweir sal_uInt16 nPos = aLevelLB.GetSelectEntryPos(); 4127*cdf0e10cSrcweir if(nPos != LISTBOX_ENTRY_NOTFOUND) 4128*cdf0e10cSrcweir { String aStr(aLevelLB.GetEntry(nPos)); 4129*cdf0e10cSrcweir sal_uInt16 nDelPos = aStr.Search(aDeliStart); 4130*cdf0e10cSrcweir if(nDelPos != STRING_NOTFOUND) 4131*cdf0e10cSrcweir aStr.Erase(nDelPos-1); 4132*cdf0e10cSrcweir aLevelLB.RemoveEntry(nPos); 4133*cdf0e10cSrcweir aLevelLB.InsertEntry(aStr, nPos); 4134*cdf0e10cSrcweir aLevelLB.SelectEntry(aStr); 4135*cdf0e10cSrcweir m_pCurrentForm->SetTemplate(nPos, aEmptyStr); 4136*cdf0e10cSrcweir ModifyHdl(0); 4137*cdf0e10cSrcweir } 4138*cdf0e10cSrcweir return 0; 4139*cdf0e10cSrcweir } 4140*cdf0e10cSrcweir /* -----------------26.03.99 09:11------------------- 4141*cdf0e10cSrcweir * 4142*cdf0e10cSrcweir * --------------------------------------------------*/ 4143*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwTOXStylesTabPage, DoubleClickHdl, Button *, EMPTYARG ) 4144*cdf0e10cSrcweir { 4145*cdf0e10cSrcweir String aTmpName( aParaLayLB.GetSelectEntry() ); 4146*cdf0e10cSrcweir SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell(); 4147*cdf0e10cSrcweir 4148*cdf0e10cSrcweir if(aParaLayLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND && 4149*cdf0e10cSrcweir (aLevelLB.GetSelectEntryPos() == 0 || SwMultiTOXTabDialog::IsNoNum(rSh, aTmpName))) 4150*cdf0e10cSrcweir AssignHdl(&aAssignBT); 4151*cdf0e10cSrcweir return 0; 4152*cdf0e10cSrcweir } 4153*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwTOXStylesTabPage, DoubleClickHdl, Button *, EMPTYARG ) 4154*cdf0e10cSrcweir /*-------------------------------------------------------------------- 4155*cdf0e10cSrcweir Beschreibung: nur wenn selektiert enable 4156*cdf0e10cSrcweir --------------------------------------------------------------------*/ 4157*cdf0e10cSrcweir IMPL_LINK( SwTOXStylesTabPage, EnableSelectHdl, ListBox *, EMPTYARG ) 4158*cdf0e10cSrcweir { 4159*cdf0e10cSrcweir //UpdatePattern(); 4160*cdf0e10cSrcweir aStdBT.Enable(aLevelLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND); 4161*cdf0e10cSrcweir 4162*cdf0e10cSrcweir SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell(); 4163*cdf0e10cSrcweir String aTmpName(aParaLayLB.GetSelectEntry()); 4164*cdf0e10cSrcweir aAssignBT.Enable(aParaLayLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND && 4165*cdf0e10cSrcweir LISTBOX_ENTRY_NOTFOUND != aLevelLB.GetSelectEntryPos() && 4166*cdf0e10cSrcweir (aLevelLB.GetSelectEntryPos() == 0 || SwMultiTOXTabDialog::IsNoNum(rSh, aTmpName))); 4167*cdf0e10cSrcweir aEditStyleBT.Enable(aParaLayLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); 4168*cdf0e10cSrcweir return 0; 4169*cdf0e10cSrcweir } 4170*cdf0e10cSrcweir /* -----------------------------18.01.00 16:54-------------------------------- 4171*cdf0e10cSrcweir 4172*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4173*cdf0e10cSrcweir IMPL_LINK(SwTOXStylesTabPage, ModifyHdl, void*, EMPTYARG) 4174*cdf0e10cSrcweir { 4175*cdf0e10cSrcweir SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog(); 4176*cdf0e10cSrcweir if(pTOXDlg) 4177*cdf0e10cSrcweir { 4178*cdf0e10cSrcweir GetForm() = *m_pCurrentForm; 4179*cdf0e10cSrcweir pTOXDlg->CreateOrUpdateExample(pTOXDlg->GetCurrentTOXType().eType, TOX_PAGE_STYLES); 4180*cdf0e10cSrcweir } 4181*cdf0e10cSrcweir return 0; 4182*cdf0e10cSrcweir } 4183*cdf0e10cSrcweir /****************************************************************************** 4184*cdf0e10cSrcweir 4185*cdf0e10cSrcweir ******************************************************************************/ 4186*cdf0e10cSrcweir #define ITEM_SEARCH 1 4187*cdf0e10cSrcweir #define ITEM_ALTERNATIVE 2 4188*cdf0e10cSrcweir #define ITEM_PRIM_KEY 3 4189*cdf0e10cSrcweir #define ITEM_SEC_KEY 4 4190*cdf0e10cSrcweir #define ITEM_COMMENT 5 4191*cdf0e10cSrcweir #define ITEM_CASE 6 4192*cdf0e10cSrcweir #define ITEM_WORDONLY 7 4193*cdf0e10cSrcweir 4194*cdf0e10cSrcweir 4195*cdf0e10cSrcweir SwEntryBrowseBox::SwEntryBrowseBox(Window* pParent, const ResId& rId, 4196*cdf0e10cSrcweir BrowserMode nMode ) : 4197*cdf0e10cSrcweir SwEntryBrowseBox_Base( pParent, rId, nMode, 4198*cdf0e10cSrcweir BROWSER_KEEPSELECTION | 4199*cdf0e10cSrcweir BROWSER_COLUMNSELECTION | 4200*cdf0e10cSrcweir BROWSER_MULTISELECTION | 4201*cdf0e10cSrcweir BROWSER_TRACKING_TIPS | 4202*cdf0e10cSrcweir BROWSER_HLINESFULL | 4203*cdf0e10cSrcweir BROWSER_VLINESFULL | 4204*cdf0e10cSrcweir BROWSER_AUTO_VSCROLL| 4205*cdf0e10cSrcweir BROWSER_HIDECURSOR ), 4206*cdf0e10cSrcweir aCellEdit(&GetDataWindow(), 0), 4207*cdf0e10cSrcweir aCellCheckBox(&GetDataWindow()), 4208*cdf0e10cSrcweir 4209*cdf0e10cSrcweir sSearch( ResId(ST_SEARCH, *rId.GetResMgr() )), 4210*cdf0e10cSrcweir sAlternative( ResId(ST_ALTERNATIVE, *rId.GetResMgr() )), 4211*cdf0e10cSrcweir sPrimKey( ResId(ST_PRIMKEY, *rId.GetResMgr() )), 4212*cdf0e10cSrcweir sSecKey( ResId(ST_SECKEY, *rId.GetResMgr() )), 4213*cdf0e10cSrcweir sComment( ResId(ST_COMMENT, *rId.GetResMgr() )), 4214*cdf0e10cSrcweir sCaseSensitive( ResId(ST_CASESENSITIVE, *rId.GetResMgr() )), 4215*cdf0e10cSrcweir sWordOnly( ResId(ST_WORDONLY, *rId.GetResMgr() )), 4216*cdf0e10cSrcweir sYes( ResId(ST_TRUE, *rId.GetResMgr() )), 4217*cdf0e10cSrcweir sNo( ResId(ST_FALSE, *rId.GetResMgr() )), 4218*cdf0e10cSrcweir bModified(sal_False) 4219*cdf0e10cSrcweir { 4220*cdf0e10cSrcweir FreeResource(); 4221*cdf0e10cSrcweir aCellCheckBox.GetBox().EnableTriState(sal_False); 4222*cdf0e10cSrcweir xController = new ::svt::EditCellController(&aCellEdit); 4223*cdf0e10cSrcweir xCheckController = new ::svt::CheckBoxCellController(&aCellCheckBox); 4224*cdf0e10cSrcweir 4225*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 4226*cdf0e10cSrcweir // HACK: BrowseBox invalidiert nicht ihre Childs, wie es eigentlich sein sollte. 4227*cdf0e10cSrcweir // Deshalb wird WB_CLIPCHILDREN zurueckgesetzt, wodurch das Invalidieren 4228*cdf0e10cSrcweir // der Childs erzwungen wird. 4229*cdf0e10cSrcweir WinBits aStyle = GetStyle(); 4230*cdf0e10cSrcweir if( aStyle & WB_CLIPCHILDREN ) 4231*cdf0e10cSrcweir { 4232*cdf0e10cSrcweir aStyle &= ~WB_CLIPCHILDREN; 4233*cdf0e10cSrcweir SetStyle( aStyle ); 4234*cdf0e10cSrcweir } 4235*cdf0e10cSrcweir const String* aTitles[7] = 4236*cdf0e10cSrcweir { 4237*cdf0e10cSrcweir &sSearch, 4238*cdf0e10cSrcweir &sAlternative, 4239*cdf0e10cSrcweir &sPrimKey, 4240*cdf0e10cSrcweir &sSecKey, 4241*cdf0e10cSrcweir &sComment, 4242*cdf0e10cSrcweir &sCaseSensitive, 4243*cdf0e10cSrcweir &sWordOnly 4244*cdf0e10cSrcweir }; 4245*cdf0e10cSrcweir 4246*cdf0e10cSrcweir long nWidth = GetSizePixel().Width(); 4247*cdf0e10cSrcweir nWidth /=7; 4248*cdf0e10cSrcweir --nWidth; 4249*cdf0e10cSrcweir for(sal_uInt16 i = 1; i < 8; i++) 4250*cdf0e10cSrcweir InsertDataColumn( i, *aTitles[i - 1], nWidth, 4251*cdf0e10cSrcweir HIB_STDSTYLE, HEADERBAR_APPEND ); 4252*cdf0e10cSrcweir 4253*cdf0e10cSrcweir } 4254*cdf0e10cSrcweir /* -----------------------------19.01.00 11:29-------------------------------- 4255*cdf0e10cSrcweir 4256*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4257*cdf0e10cSrcweir sal_Bool SwEntryBrowseBox::SeekRow( long nRow ) 4258*cdf0e10cSrcweir { 4259*cdf0e10cSrcweir nCurrentRow = nRow; 4260*cdf0e10cSrcweir return sal_True; 4261*cdf0e10cSrcweir } 4262*cdf0e10cSrcweir /* -----------------------------19.01.00 15:32-------------------------------- 4263*cdf0e10cSrcweir 4264*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4265*cdf0e10cSrcweir String SwEntryBrowseBox::GetCellText(long nRow, sal_uInt16 nColumn) const 4266*cdf0e10cSrcweir { 4267*cdf0e10cSrcweir const String* pRet = &aEmptyStr; 4268*cdf0e10cSrcweir if(aEntryArr.Count() > nRow) 4269*cdf0e10cSrcweir { 4270*cdf0e10cSrcweir AutoMarkEntry* pEntry = aEntryArr[ static_cast< sal_uInt16 >(nRow) ]; 4271*cdf0e10cSrcweir switch(nColumn) 4272*cdf0e10cSrcweir { 4273*cdf0e10cSrcweir case ITEM_SEARCH :pRet = &pEntry->sSearch; break; 4274*cdf0e10cSrcweir case ITEM_ALTERNATIVE :pRet = &pEntry->sAlternative; break; 4275*cdf0e10cSrcweir case ITEM_PRIM_KEY :pRet = &pEntry->sPrimKey ; break; 4276*cdf0e10cSrcweir case ITEM_SEC_KEY :pRet = &pEntry->sSecKey ; break; 4277*cdf0e10cSrcweir case ITEM_COMMENT :pRet = &pEntry->sComment ; break; 4278*cdf0e10cSrcweir case ITEM_CASE :pRet = pEntry->bCase ? &sYes : &sNo; break; 4279*cdf0e10cSrcweir case ITEM_WORDONLY :pRet = pEntry->bWord ? &sYes : &sNo; break; 4280*cdf0e10cSrcweir } 4281*cdf0e10cSrcweir } 4282*cdf0e10cSrcweir return *pRet; 4283*cdf0e10cSrcweir } 4284*cdf0e10cSrcweir 4285*cdf0e10cSrcweir /* -----------------------------19.01.00 11:29-------------------------------- 4286*cdf0e10cSrcweir 4287*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4288*cdf0e10cSrcweir void SwEntryBrowseBox::PaintCell(OutputDevice& rDev, 4289*cdf0e10cSrcweir const Rectangle& rRect, sal_uInt16 nColumnId) const 4290*cdf0e10cSrcweir { 4291*cdf0e10cSrcweir String sPaint = GetCellText( nCurrentRow, nColumnId ); 4292*cdf0e10cSrcweir sal_uInt16 nStyle = TEXT_DRAW_CLIP | TEXT_DRAW_CENTER; 4293*cdf0e10cSrcweir rDev.DrawText( rRect, sPaint, nStyle ); 4294*cdf0e10cSrcweir } 4295*cdf0e10cSrcweir /* -----------------------------19.01.00 14:51-------------------------------- 4296*cdf0e10cSrcweir 4297*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4298*cdf0e10cSrcweir ::svt::CellController* SwEntryBrowseBox::GetController(long /*nRow*/, sal_uInt16 nCol) 4299*cdf0e10cSrcweir { 4300*cdf0e10cSrcweir return nCol < ITEM_CASE ? xController : xCheckController; 4301*cdf0e10cSrcweir } 4302*cdf0e10cSrcweir /* -----------------------------19.01.00 15:36-------------------------------- 4303*cdf0e10cSrcweir 4304*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4305*cdf0e10cSrcweir sal_Bool SwEntryBrowseBox::SaveModified() 4306*cdf0e10cSrcweir { 4307*cdf0e10cSrcweir SetModified(); 4308*cdf0e10cSrcweir sal_uInt16 nRow = static_cast< sal_uInt16 >(GetCurRow()); 4309*cdf0e10cSrcweir sal_uInt16 nCol = GetCurColumnId(); 4310*cdf0e10cSrcweir 4311*cdf0e10cSrcweir String sNew; 4312*cdf0e10cSrcweir sal_Bool bVal = sal_False; 4313*cdf0e10cSrcweir ::svt::CellController* pController = 0; 4314*cdf0e10cSrcweir if(nCol < ITEM_CASE) 4315*cdf0e10cSrcweir { 4316*cdf0e10cSrcweir pController = xController; 4317*cdf0e10cSrcweir sNew = ((::svt::EditCellController*)pController)->GetEditImplementation()->GetText( LINEEND_LF ); 4318*cdf0e10cSrcweir } 4319*cdf0e10cSrcweir else 4320*cdf0e10cSrcweir { 4321*cdf0e10cSrcweir pController = xCheckController; 4322*cdf0e10cSrcweir bVal = ((::svt::CheckBoxCellController*)pController)->GetCheckBox().IsChecked(); 4323*cdf0e10cSrcweir } 4324*cdf0e10cSrcweir AutoMarkEntry* pEntry = nRow >= aEntryArr.Count() ? new AutoMarkEntry 4325*cdf0e10cSrcweir : aEntryArr[nRow]; 4326*cdf0e10cSrcweir switch(nCol) 4327*cdf0e10cSrcweir { 4328*cdf0e10cSrcweir case ITEM_SEARCH : pEntry->sSearch = sNew; break; 4329*cdf0e10cSrcweir case ITEM_ALTERNATIVE : pEntry->sAlternative = sNew; break; 4330*cdf0e10cSrcweir case ITEM_PRIM_KEY : pEntry->sPrimKey = sNew; break; 4331*cdf0e10cSrcweir case ITEM_SEC_KEY : pEntry->sSecKey = sNew; break; 4332*cdf0e10cSrcweir case ITEM_COMMENT : pEntry->sComment = sNew; break; 4333*cdf0e10cSrcweir case ITEM_CASE : pEntry->bCase = bVal; break; 4334*cdf0e10cSrcweir case ITEM_WORDONLY : pEntry->bWord = bVal; break; 4335*cdf0e10cSrcweir } 4336*cdf0e10cSrcweir if(nRow >= aEntryArr.Count()) 4337*cdf0e10cSrcweir { 4338*cdf0e10cSrcweir aEntryArr.Insert( pEntry, aEntryArr.Count() ); 4339*cdf0e10cSrcweir RowInserted(nRow, 1, sal_True, sal_True); 4340*cdf0e10cSrcweir if(nCol < ITEM_WORDONLY) 4341*cdf0e10cSrcweir { 4342*cdf0e10cSrcweir pController->ClearModified(); 4343*cdf0e10cSrcweir GoToRow( nRow ); 4344*cdf0e10cSrcweir } 4345*cdf0e10cSrcweir } 4346*cdf0e10cSrcweir return sal_True; 4347*cdf0e10cSrcweir } 4348*cdf0e10cSrcweir /* -----------------------------19.01.00 14:32-------------------------------- 4349*cdf0e10cSrcweir 4350*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4351*cdf0e10cSrcweir void SwEntryBrowseBox::InitController( 4352*cdf0e10cSrcweir ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol) 4353*cdf0e10cSrcweir { 4354*cdf0e10cSrcweir String rTxt = GetCellText( nRow, nCol ); 4355*cdf0e10cSrcweir if(nCol < ITEM_CASE) 4356*cdf0e10cSrcweir { 4357*cdf0e10cSrcweir rController = xController; 4358*cdf0e10cSrcweir ::svt::CellController* pController = xController; 4359*cdf0e10cSrcweir ((::svt::EditCellController*)pController)->GetEditImplementation()->SetText( rTxt ); 4360*cdf0e10cSrcweir } 4361*cdf0e10cSrcweir else 4362*cdf0e10cSrcweir { 4363*cdf0e10cSrcweir rController = xCheckController; 4364*cdf0e10cSrcweir ::svt::CellController* pController = xCheckController; 4365*cdf0e10cSrcweir ((::svt::CheckBoxCellController*)pController)->GetCheckBox().Check( 4366*cdf0e10cSrcweir rTxt == sYes ); 4367*cdf0e10cSrcweir } 4368*cdf0e10cSrcweir } 4369*cdf0e10cSrcweir /* -----------------------------19.01.00 12:19-------------------------------- 4370*cdf0e10cSrcweir 4371*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4372*cdf0e10cSrcweir void SwEntryBrowseBox::ReadEntries(SvStream& rInStr) 4373*cdf0e10cSrcweir { 4374*cdf0e10cSrcweir AutoMarkEntry* pToInsert = 0; 4375*cdf0e10cSrcweir const String sZero('0'); 4376*cdf0e10cSrcweir rtl_TextEncoding eTEnc = gsl_getSystemTextEncoding(); 4377*cdf0e10cSrcweir while( !rInStr.GetError() && !rInStr.IsEof() ) 4378*cdf0e10cSrcweir { 4379*cdf0e10cSrcweir String sLine; 4380*cdf0e10cSrcweir rInStr.ReadByteStringLine( sLine, eTEnc ); 4381*cdf0e10cSrcweir 4382*cdf0e10cSrcweir // # -> comment 4383*cdf0e10cSrcweir // ; -> delimiter between entries -> 4384*cdf0e10cSrcweir // Format: TextToSearchFor;AlternativeString;PrimaryKey;SecondaryKey 4385*cdf0e10cSrcweir // Leading and trailing blanks are ignored 4386*cdf0e10cSrcweir if( sLine.Len() ) 4387*cdf0e10cSrcweir { 4388*cdf0e10cSrcweir //comments are contained in separate lines but are put into the struct of the following data 4389*cdf0e10cSrcweir //line (if available) 4390*cdf0e10cSrcweir if( '#' != sLine.GetChar(0) ) 4391*cdf0e10cSrcweir { 4392*cdf0e10cSrcweir if( !pToInsert ) 4393*cdf0e10cSrcweir pToInsert = new AutoMarkEntry; 4394*cdf0e10cSrcweir 4395*cdf0e10cSrcweir sal_uInt16 nSttPos = 0; 4396*cdf0e10cSrcweir pToInsert->sSearch = sLine.GetToken(0, ';', nSttPos ); 4397*cdf0e10cSrcweir pToInsert->sAlternative = sLine.GetToken(0, ';', nSttPos ); 4398*cdf0e10cSrcweir pToInsert->sPrimKey = sLine.GetToken(0, ';', nSttPos ); 4399*cdf0e10cSrcweir pToInsert->sSecKey = sLine.GetToken(0, ';', nSttPos ); 4400*cdf0e10cSrcweir 4401*cdf0e10cSrcweir String sStr = sLine.GetToken(0, ';', nSttPos ); 4402*cdf0e10cSrcweir pToInsert->bCase = sStr.Len() && sStr != sZero; 4403*cdf0e10cSrcweir 4404*cdf0e10cSrcweir sStr = sLine.GetToken(0, ';', nSttPos ); 4405*cdf0e10cSrcweir pToInsert->bWord = sStr.Len() && sStr != sZero; 4406*cdf0e10cSrcweir 4407*cdf0e10cSrcweir aEntryArr.Insert( pToInsert, aEntryArr.Count() ); 4408*cdf0e10cSrcweir pToInsert = 0; 4409*cdf0e10cSrcweir } 4410*cdf0e10cSrcweir else 4411*cdf0e10cSrcweir { 4412*cdf0e10cSrcweir if(pToInsert) 4413*cdf0e10cSrcweir aEntryArr.Insert(pToInsert, aEntryArr.Count()); 4414*cdf0e10cSrcweir pToInsert = new AutoMarkEntry; 4415*cdf0e10cSrcweir pToInsert->sComment = sLine; 4416*cdf0e10cSrcweir pToInsert->sComment.Erase(0, 1); 4417*cdf0e10cSrcweir } 4418*cdf0e10cSrcweir } 4419*cdf0e10cSrcweir } 4420*cdf0e10cSrcweir if( pToInsert ) 4421*cdf0e10cSrcweir aEntryArr.Insert(pToInsert, aEntryArr.Count()); 4422*cdf0e10cSrcweir RowInserted(0, aEntryArr.Count() + 1, sal_True); 4423*cdf0e10cSrcweir } 4424*cdf0e10cSrcweir /* -----------------------------19.01.00 12:19-------------------------------- 4425*cdf0e10cSrcweir 4426*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4427*cdf0e10cSrcweir void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr) 4428*cdf0e10cSrcweir { 4429*cdf0e10cSrcweir //check if the current controller is modified 4430*cdf0e10cSrcweir sal_uInt16 nCol = GetCurColumnId(); 4431*cdf0e10cSrcweir ::svt::CellController* pController; 4432*cdf0e10cSrcweir if(nCol < ITEM_CASE) 4433*cdf0e10cSrcweir pController = xController; 4434*cdf0e10cSrcweir else 4435*cdf0e10cSrcweir pController = xCheckController; 4436*cdf0e10cSrcweir if(pController ->IsModified()) 4437*cdf0e10cSrcweir GoToColumnId(nCol < ITEM_CASE ? ++nCol : --nCol ); 4438*cdf0e10cSrcweir 4439*cdf0e10cSrcweir rtl_TextEncoding eTEnc = gsl_getSystemTextEncoding(); 4440*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aEntryArr.Count();i++) 4441*cdf0e10cSrcweir { 4442*cdf0e10cSrcweir AutoMarkEntry* pEntry = aEntryArr[i]; 4443*cdf0e10cSrcweir if(pEntry->sComment.Len()) 4444*cdf0e10cSrcweir { 4445*cdf0e10cSrcweir String sWrite('#'); 4446*cdf0e10cSrcweir sWrite += pEntry->sComment; 4447*cdf0e10cSrcweir rOutStr.WriteByteStringLine( sWrite, eTEnc ); 4448*cdf0e10cSrcweir } 4449*cdf0e10cSrcweir 4450*cdf0e10cSrcweir String sWrite( pEntry->sSearch ); 4451*cdf0e10cSrcweir sWrite += ';'; 4452*cdf0e10cSrcweir sWrite += pEntry->sAlternative; 4453*cdf0e10cSrcweir sWrite += ';'; 4454*cdf0e10cSrcweir sWrite += pEntry->sPrimKey; 4455*cdf0e10cSrcweir sWrite += ';'; 4456*cdf0e10cSrcweir sWrite += pEntry->sSecKey; 4457*cdf0e10cSrcweir sWrite += ';'; 4458*cdf0e10cSrcweir sWrite += pEntry->bCase ? '1' : '0'; 4459*cdf0e10cSrcweir sWrite += ';'; 4460*cdf0e10cSrcweir sWrite += pEntry->bWord ? '1' : '0'; 4461*cdf0e10cSrcweir 4462*cdf0e10cSrcweir if( sWrite.Len() > 5 ) 4463*cdf0e10cSrcweir rOutStr.WriteByteStringLine( sWrite, eTEnc ); 4464*cdf0e10cSrcweir } 4465*cdf0e10cSrcweir } 4466*cdf0e10cSrcweir /* -----------------------------21.01.00 11:49-------------------------------- 4467*cdf0e10cSrcweir 4468*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4469*cdf0e10cSrcweir sal_Bool SwEntryBrowseBox::IsModified()const 4470*cdf0e10cSrcweir { 4471*cdf0e10cSrcweir if(bModified) 4472*cdf0e10cSrcweir return sal_True; 4473*cdf0e10cSrcweir 4474*cdf0e10cSrcweir 4475*cdf0e10cSrcweir //check if the current controller is modified 4476*cdf0e10cSrcweir sal_uInt16 nCol = GetCurColumnId(); 4477*cdf0e10cSrcweir ::svt::CellController* pController; 4478*cdf0e10cSrcweir if(nCol < ITEM_CASE) 4479*cdf0e10cSrcweir pController = xController; 4480*cdf0e10cSrcweir else 4481*cdf0e10cSrcweir pController = xCheckController; 4482*cdf0e10cSrcweir return pController ->IsModified(); 4483*cdf0e10cSrcweir } 4484*cdf0e10cSrcweir /* -----------------------------19.01.00 11:29-------------------------------- 4485*cdf0e10cSrcweir 4486*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4487*cdf0e10cSrcweir SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkURL, 4488*cdf0e10cSrcweir const String& rAutoMarkType, sal_Bool bCreate) : 4489*cdf0e10cSrcweir ModalDialog(pParent, SW_RES(DLG_CREATE_AUTOMARK)), 4490*cdf0e10cSrcweir aOKPB( this, SW_RES(PB_OK )), 4491*cdf0e10cSrcweir aCancelPB( this, SW_RES(PB_CANCEL )), 4492*cdf0e10cSrcweir aHelpPB( this, SW_RES(PB_HELP )), 4493*cdf0e10cSrcweir aEntriesBB( this, SW_RES(BB_ENTRIES )), 4494*cdf0e10cSrcweir aEntriesFL( this, SW_RES(FL_ENTRIES )), 4495*cdf0e10cSrcweir sAutoMarkURL(rAutoMarkURL), 4496*cdf0e10cSrcweir sAutoMarkType(rAutoMarkType), 4497*cdf0e10cSrcweir bCreateMode(bCreate) 4498*cdf0e10cSrcweir { 4499*cdf0e10cSrcweir FreeResource(); 4500*cdf0e10cSrcweir aOKPB.SetClickHdl(LINK(this, SwAutoMarkDlg_Impl, OkHdl)); 4501*cdf0e10cSrcweir 4502*cdf0e10cSrcweir String sTitle = GetText(); 4503*cdf0e10cSrcweir sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": ")); 4504*cdf0e10cSrcweir sTitle += sAutoMarkURL; 4505*cdf0e10cSrcweir SetText(sTitle); 4506*cdf0e10cSrcweir sal_Bool bError = sal_False; 4507*cdf0e10cSrcweir if( bCreateMode ) 4508*cdf0e10cSrcweir aEntriesBB.RowInserted(0, 1, sal_True); 4509*cdf0e10cSrcweir else 4510*cdf0e10cSrcweir { 4511*cdf0e10cSrcweir SfxMedium aMed( sAutoMarkURL, STREAM_STD_READ, sal_False ); 4512*cdf0e10cSrcweir if( aMed.GetInStream() && !aMed.GetInStream()->GetError() ) 4513*cdf0e10cSrcweir aEntriesBB.ReadEntries( *aMed.GetInStream() ); 4514*cdf0e10cSrcweir else 4515*cdf0e10cSrcweir bError = sal_True; 4516*cdf0e10cSrcweir } 4517*cdf0e10cSrcweir 4518*cdf0e10cSrcweir if(bError) 4519*cdf0e10cSrcweir EndDialog(RET_CANCEL); 4520*cdf0e10cSrcweir } 4521*cdf0e10cSrcweir /* -----------------------------19.01.00 11:12-------------------------------- 4522*cdf0e10cSrcweir 4523*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4524*cdf0e10cSrcweir SwAutoMarkDlg_Impl::~SwAutoMarkDlg_Impl() 4525*cdf0e10cSrcweir { 4526*cdf0e10cSrcweir } 4527*cdf0e10cSrcweir /* -----------------------------19.01.00 16:43-------------------------------- 4528*cdf0e10cSrcweir 4529*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4530*cdf0e10cSrcweir IMPL_LINK(SwAutoMarkDlg_Impl, OkHdl, OKButton*, EMPTYARG) 4531*cdf0e10cSrcweir { 4532*cdf0e10cSrcweir sal_Bool bError = sal_False; 4533*cdf0e10cSrcweir if(aEntriesBB.IsModified() || bCreateMode) 4534*cdf0e10cSrcweir { 4535*cdf0e10cSrcweir SfxMedium aMed( sAutoMarkURL, 4536*cdf0e10cSrcweir bCreateMode ? STREAM_WRITE 4537*cdf0e10cSrcweir : STREAM_WRITE| STREAM_TRUNC, 4538*cdf0e10cSrcweir sal_False ); 4539*cdf0e10cSrcweir SvStream* pStrm = aMed.GetOutStream(); 4540*cdf0e10cSrcweir pStrm->SetStreamCharSet( RTL_TEXTENCODING_MS_1253 ); 4541*cdf0e10cSrcweir if( !pStrm->GetError() ) 4542*cdf0e10cSrcweir { 4543*cdf0e10cSrcweir aEntriesBB.WriteEntries( *pStrm ); 4544*cdf0e10cSrcweir aMed.Commit(); 4545*cdf0e10cSrcweir } 4546*cdf0e10cSrcweir else 4547*cdf0e10cSrcweir bError = sal_True; 4548*cdf0e10cSrcweir } 4549*cdf0e10cSrcweir if( !bError ) 4550*cdf0e10cSrcweir EndDialog(RET_OK); 4551*cdf0e10cSrcweir return 0; 4552*cdf0e10cSrcweir } 4553*cdf0e10cSrcweir 4554