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 31*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION 32*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <vcl/lstbox.hxx> 37*cdf0e10cSrcweir #include <svl/stritem.hxx> 38*cdf0e10cSrcweir #include <sfx2/request.hxx> 39*cdf0e10cSrcweir #include <svx/htmlmode.hxx> 40*cdf0e10cSrcweir #include <dbfld.hxx> 41*cdf0e10cSrcweir #include <flddat.hxx> 42*cdf0e10cSrcweir #include <fmtfld.hxx> 43*cdf0e10cSrcweir #include <viewopt.hxx> 44*cdf0e10cSrcweir #include <fldedt.hxx> 45*cdf0e10cSrcweir #include <docsh.hxx> 46*cdf0e10cSrcweir #include <swmodule.hxx> 47*cdf0e10cSrcweir #include <view.hxx> 48*cdf0e10cSrcweir #include <wrtsh.hxx> 49*cdf0e10cSrcweir #include <expfld.hxx> 50*cdf0e10cSrcweir #include <fldtdlg.hxx> 51*cdf0e10cSrcweir #include <fldpage.hxx> 52*cdf0e10cSrcweir #include <docufld.hxx> 53*cdf0e10cSrcweir #include <cmdid.h> 54*cdf0e10cSrcweir #include <globals.hrc> 55*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 56*cdf0e10cSrcweir #include <switerator.hxx> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir using namespace ::com::sun::star; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir /*-------------------------------------------------------------------- 61*cdf0e10cSrcweir Beschreibung: 62*cdf0e10cSrcweir --------------------------------------------------------------------*/ 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir SwFldPage::SwFldPage( Window *pParent, const ResId &rId, 65*cdf0e10cSrcweir const SfxItemSet &rAttrSet ) 66*cdf0e10cSrcweir :SfxTabPage (pParent, rId, rAttrSet), 67*cdf0e10cSrcweir m_pCurFld (0), 68*cdf0e10cSrcweir m_pWrtShell (0), 69*cdf0e10cSrcweir m_nPageId ( static_cast< sal_uInt16 >(rId.GetId()) ), 70*cdf0e10cSrcweir m_nTypeSel (LISTBOX_ENTRY_NOTFOUND), 71*cdf0e10cSrcweir m_nSelectionSel (LISTBOX_ENTRY_NOTFOUND), 72*cdf0e10cSrcweir m_bFldEdit (sal_False), 73*cdf0e10cSrcweir m_bInsert (sal_True), 74*cdf0e10cSrcweir m_bFldDlgHtmlMode (sal_False), 75*cdf0e10cSrcweir m_bRefresh (sal_False), 76*cdf0e10cSrcweir m_bFirstHTMLInit (sal_True) 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir // FreeResource(); 79*cdf0e10cSrcweir } 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir /*-------------------------------------------------------------------- 82*cdf0e10cSrcweir Beschreibung: 83*cdf0e10cSrcweir --------------------------------------------------------------------*/ 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir SwFldPage::~SwFldPage() 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir /*-------------------------------------------------------------------- 90*cdf0e10cSrcweir Beschreibung: TabPage initialisieren 91*cdf0e10cSrcweir --------------------------------------------------------------------*/ 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir void SwFldPage::Init() 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current(); 96*cdf0e10cSrcweir sal_Bool bNewMode = 0 != (::GetHtmlMode(pDocSh) & HTMLMODE_ON); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir m_bFldEdit = 0 == GetTabDialog(); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // FieldManager neu initialisieren wichtig fuer 101*cdf0e10cSrcweir // Dok-Wechsel (fldtdlg:ReInitTabPage) 102*cdf0e10cSrcweir m_pCurFld = m_aMgr.GetCurFld(); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir if( bNewMode != m_bFldDlgHtmlMode ) 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir m_bFldDlgHtmlMode = bNewMode; 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // Bereichslistbox initialisieren 109*cdf0e10cSrcweir if( m_bFldDlgHtmlMode && m_bFirstHTMLInit ) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir m_bFirstHTMLInit = sal_False; 112*cdf0e10cSrcweir SwWrtShell *pSh = m_pWrtShell; 113*cdf0e10cSrcweir if(! pSh) 114*cdf0e10cSrcweir pSh = ::GetActiveWrtShell(); 115*cdf0e10cSrcweir if(pSh) 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir SwDoc* pDoc = pSh->GetDoc(); 118*cdf0e10cSrcweir pSh->InsertFldType( SwSetExpFieldType( pDoc, 119*cdf0e10cSrcweir String::CreateFromAscii("HTML_ON"), 1)); 120*cdf0e10cSrcweir pSh->InsertFldType( SwSetExpFieldType(pDoc, 121*cdf0e10cSrcweir String::CreateFromAscii("HTML_OFF"), 1)); 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir /*-------------------------------------------------------------------- 128*cdf0e10cSrcweir Beschreibung: Seite neu initialisieren 129*cdf0e10cSrcweir --------------------------------------------------------------------*/ 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir void SwFldPage::ActivatePage() 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir EnableInsert(m_bInsert); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir /*-------------------------------------------------------------------- 137*cdf0e10cSrcweir Beschreibung: Kompletter Reset; neues Feld editieren 138*cdf0e10cSrcweir --------------------------------------------------------------------*/ 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir void SwFldPage::EditNewField( sal_Bool bOnlyActivate ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir if( !bOnlyActivate ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir m_nTypeSel = LISTBOX_ENTRY_NOTFOUND; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir m_nSelectionSel = LISTBOX_ENTRY_NOTFOUND; 147*cdf0e10cSrcweir m_bRefresh = sal_True; 148*cdf0e10cSrcweir Reset(*(SfxItemSet*)0); 149*cdf0e10cSrcweir m_bRefresh = sal_False; 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir /*-------------------------------------------------------------------- 153*cdf0e10cSrcweir Beschreibung: Feld einfuegen 154*cdf0e10cSrcweir --------------------------------------------------------------------*/ 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir sal_Bool SwFldPage::InsertFld(sal_uInt16 nTypeId, sal_uInt16 nSubType, const String& rPar1, 157*cdf0e10cSrcweir const String& rPar2, sal_uLong nFormatId, 158*cdf0e10cSrcweir sal_Unicode cSeparator, sal_Bool bIsAutomaticLanguage) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir sal_Bool bRet = sal_False; 161*cdf0e10cSrcweir SwView* pView = GetActiveView(); 162*cdf0e10cSrcweir SwWrtShell *pSh = m_pWrtShell ? m_pWrtShell : pView->GetWrtShellPtr(); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir if (!IsFldEdit()) // Neues Feld einfuegen 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir SwInsertFld_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, 0, cSeparator, bIsAutomaticLanguage ); 167*cdf0e10cSrcweir //#i26566# provide parent for SwWrtShell::StartInputFldDlg 168*cdf0e10cSrcweir aData.pParent = &GetTabDialog()->GetOKButton(); 169*cdf0e10cSrcweir bRet = m_aMgr.InsertFld( aData ); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 172*cdf0e10cSrcweir pView->GetViewFrame()->GetBindings().GetRecorder(); 173*cdf0e10cSrcweir if ( xRecorder.is() ) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir sal_Bool bRecordDB = TYP_DBFLD == nTypeId || 176*cdf0e10cSrcweir TYP_DBSETNUMBERFLD == nTypeId || 177*cdf0e10cSrcweir TYP_DBNUMSETFLD == nTypeId || 178*cdf0e10cSrcweir TYP_DBNEXTSETFLD == nTypeId || 179*cdf0e10cSrcweir TYP_DBNAMEFLD == nTypeId ; 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir SfxRequest aReq( pView->GetViewFrame(), 182*cdf0e10cSrcweir bRecordDB ? FN_INSERT_DBFIELD : FN_INSERT_FIELD ); 183*cdf0e10cSrcweir if(bRecordDB) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir aReq.AppendItem(SfxStringItem 186*cdf0e10cSrcweir (FN_INSERT_DBFIELD,rPar1.GetToken(0, DB_DELIM))); 187*cdf0e10cSrcweir aReq.AppendItem(SfxStringItem 188*cdf0e10cSrcweir (FN_PARAM_1,rPar1.GetToken(1, DB_DELIM))); 189*cdf0e10cSrcweir aReq.AppendItem(SfxInt32Item 190*cdf0e10cSrcweir (FN_PARAM_3,rPar1.GetToken(1, DB_DELIM).ToInt32())); 191*cdf0e10cSrcweir aReq.AppendItem(SfxStringItem 192*cdf0e10cSrcweir (FN_PARAM_2,rPar1.GetToken(3, DB_DELIM))); 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir else 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir aReq.AppendItem(SfxStringItem(FN_INSERT_FIELD, rPar1)); 197*cdf0e10cSrcweir aReq.AppendItem(SfxStringItem 198*cdf0e10cSrcweir (FN_PARAM_3,String(cSeparator))); 199*cdf0e10cSrcweir aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_SUBTYPE, nSubType)); 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_TYPE , nTypeId)); 202*cdf0e10cSrcweir aReq.AppendItem(SfxStringItem(FN_PARAM_FIELD_CONTENT, rPar2)); 203*cdf0e10cSrcweir aReq.AppendItem(SfxUInt32Item(FN_PARAM_FIELD_FORMAT , nFormatId)); 204*cdf0e10cSrcweir aReq.Done(); 205*cdf0e10cSrcweir } 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir else // Feld aendern 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir SwField *const pTmpFld = m_pCurFld->CopyField(); 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir String sPar1(rPar1); 213*cdf0e10cSrcweir String sPar2(rPar2); 214*cdf0e10cSrcweir sal_Bool bDBChanged = sal_False; 215*cdf0e10cSrcweir switch( nTypeId ) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir case TYP_DATEFLD: 218*cdf0e10cSrcweir case TYP_TIMEFLD: 219*cdf0e10cSrcweir nSubType = static_cast< sal_uInt16 >(((nTypeId == TYP_DATEFLD) ? DATEFLD : TIMEFLD) | 220*cdf0e10cSrcweir ((nSubType == DATE_VAR) ? 0 : FIXEDFLD)); 221*cdf0e10cSrcweir break; 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir case TYP_DBNAMEFLD: 224*cdf0e10cSrcweir case TYP_DBNEXTSETFLD: 225*cdf0e10cSrcweir case TYP_DBNUMSETFLD: 226*cdf0e10cSrcweir case TYP_DBSETNUMBERFLD: 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir xub_StrLen nPos = 0; 229*cdf0e10cSrcweir SwDBData aData; 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir aData.sDataSource = rPar1.GetToken(0, DB_DELIM, nPos); 232*cdf0e10cSrcweir aData.sCommand = rPar1.GetToken(0, DB_DELIM, nPos); 233*cdf0e10cSrcweir aData.nCommandType = rPar1.GetToken(0, DB_DELIM, nPos).ToInt32(); 234*cdf0e10cSrcweir sPar1 = rPar1.Copy(nPos); 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir ((SwDBNameInfField*)pTmpFld)->SetDBData(aData); 237*cdf0e10cSrcweir bDBChanged = sal_True; 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir break; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir case TYP_DBFLD: 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir SwDBData aData; 244*cdf0e10cSrcweir aData.sDataSource = rPar1.GetToken(0, DB_DELIM); 245*cdf0e10cSrcweir aData.sCommand = rPar1.GetToken(1, DB_DELIM); 246*cdf0e10cSrcweir aData.nCommandType = rPar1.GetToken(2, DB_DELIM).ToInt32(); 247*cdf0e10cSrcweir String sColumn = rPar1.GetToken(3, DB_DELIM); 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir SwDBFieldType* pOldTyp = (SwDBFieldType*)pTmpFld->GetTyp(); 250*cdf0e10cSrcweir SwDBFieldType* pTyp = (SwDBFieldType*)pSh->InsertFldType( 251*cdf0e10cSrcweir SwDBFieldType(pSh->GetDoc(), sColumn, aData)); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir SwIterator<SwFmtFld,SwFieldType> aIter( *pOldTyp ); 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir if( pFmtFld->GetFld() == m_pCurFld) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir pFmtFld->RegisterToFieldType(*pTyp); 260*cdf0e10cSrcweir pTmpFld->ChgTyp(pTyp); 261*cdf0e10cSrcweir break; 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir bDBChanged = sal_True; 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir break; 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir case TYP_SEQFLD: 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pTmpFld->GetTyp(); 271*cdf0e10cSrcweir pTyp->SetOutlineLvl( static_cast< sal_uInt8 >(nSubType & 0xff)); 272*cdf0e10cSrcweir pTyp->SetDelimiter(cSeparator); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir nSubType = nsSwGetSetExpType::GSE_SEQ; 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir break; 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir case TYP_INPUTFLD: 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir // User- oder SetField ? 281*cdf0e10cSrcweir if (m_aMgr.GetFldType(RES_USERFLD, sPar1) == 0 && 282*cdf0e10cSrcweir !(pTmpFld->GetSubType() & INP_TXT)) // SETEXPFLD 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir SwSetExpField* pFld = (SwSetExpField*)pTmpFld; 285*cdf0e10cSrcweir pFld->SetPromptText(sPar2); 286*cdf0e10cSrcweir sPar2 = pFld->GetPar2(); 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir break; 290*cdf0e10cSrcweir case TYP_DOCINFOFLD: 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir if( nSubType == nsSwDocInfoSubType::DI_CUSTOM ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir SwDocInfoField* pDocInfo = static_cast<SwDocInfoField*>( pTmpFld ); 295*cdf0e10cSrcweir pDocInfo->SetName( rPar1 ); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir break; 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir pSh->StartAllAction(); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir pTmpFld->SetSubType(nSubType); 304*cdf0e10cSrcweir pTmpFld->SetAutomaticLanguage(bIsAutomaticLanguage); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir m_aMgr.UpdateCurFld( nFormatId, sPar1, sPar2, pTmpFld ); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir m_pCurFld = m_aMgr.GetCurFld(); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir switch (nTypeId) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir case TYP_HIDDENTXTFLD: 313*cdf0e10cSrcweir case TYP_HIDDENPARAFLD: 314*cdf0e10cSrcweir m_aMgr.EvalExpFlds(pSh); 315*cdf0e10cSrcweir break; 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir pSh->SetUndoNoResetModified(); 319*cdf0e10cSrcweir pSh->EndAllAction(); 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir return bRet; 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir /*-------------------------------------------------------------------- 326*cdf0e10cSrcweir Beschreibung: 327*cdf0e10cSrcweir --------------------------------------------------------------------*/ 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir void SwFldPage::SavePos( const ListBox* pLst1, const ListBox* pLst2, 330*cdf0e10cSrcweir const ListBox* pLst3 ) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir const ListBox* aLBArr [ coLBCount ] = { pLst1, pLst2, pLst3 }; 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir const ListBox** ppLB = aLBArr; 335*cdf0e10cSrcweir for( int i = 0; i < coLBCount; ++i, ++ppLB ) 336*cdf0e10cSrcweir if( (*ppLB) && (*ppLB)->GetEntryCount() ) 337*cdf0e10cSrcweir m_aLstStrArr[ i ] = (*ppLB)->GetSelectEntry(); 338*cdf0e10cSrcweir else 339*cdf0e10cSrcweir m_aLstStrArr[ i ].Erase(); 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir /*-------------------------------------------------------------------- 343*cdf0e10cSrcweir Beschreibung: 344*cdf0e10cSrcweir --------------------------------------------------------------------*/ 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir void SwFldPage::RestorePos(ListBox* pLst1, ListBox* pLst2, ListBox* pLst3) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir sal_uInt16 nPos = 0; 349*cdf0e10cSrcweir ListBox* aLBArr [ coLBCount ] = { pLst1, pLst2, pLst3 }; 350*cdf0e10cSrcweir ListBox** ppLB = aLBArr; 351*cdf0e10cSrcweir for( int i = 0; i < coLBCount; ++i, ++ppLB ) 352*cdf0e10cSrcweir if( (*ppLB) && (*ppLB)->GetEntryCount() && m_aLstStrArr[ i ].Len() && 353*cdf0e10cSrcweir LISTBOX_ENTRY_NOTFOUND != 354*cdf0e10cSrcweir ( nPos = (*ppLB)->GetEntryPos(m_aLstStrArr[ i ] ) ) ) 355*cdf0e10cSrcweir (*ppLB)->SelectEntryPos( nPos ); 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir /*-------------------------------------------------------------------- 359*cdf0e10cSrcweir Beschreibung: Einfuegen von neuen Feldern 360*cdf0e10cSrcweir --------------------------------------------------------------------*/ 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir IMPL_LINK( SwFldPage, InsertHdl, Button *, pBtn ) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir SwFldDlg *pDlg = (SwFldDlg*)GetTabDialog(); 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir if (pDlg) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir pDlg->InsertHdl(); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir if (pBtn) 371*cdf0e10cSrcweir pBtn->GrabFocus(); // Wegen InputField-Dlg 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir else 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParent(); 376*cdf0e10cSrcweir pEditDlg->InsertHdl(); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir return 0; 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir /*-------------------------------------------------------------------- 383*cdf0e10cSrcweir Beschreibung: "Einfuegen"-Button Enablen/Disablen 384*cdf0e10cSrcweir --------------------------------------------------------------------*/ 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir void SwFldPage::EnableInsert(sal_Bool bEnable) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir SwFldDlg *pDlg = (SwFldDlg*)GetTabDialog(); 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir if (pDlg) 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir if (pDlg->GetCurPageId() == m_nPageId) 393*cdf0e10cSrcweir pDlg->EnableInsert(bEnable); 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir else 396*cdf0e10cSrcweir { 397*cdf0e10cSrcweir SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParent(); 398*cdf0e10cSrcweir pEditDlg->EnableInsert(bEnable); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir m_bInsert = bEnable; 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir /*-------------------------------------------------------------------- 405*cdf0e10cSrcweir Beschreibung: 406*cdf0e10cSrcweir --------------------------------------------------------------------*/ 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir IMPL_LINK( SwFldPage, NumFormatHdl, ListBox *, EMPTYARG ) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir InsertHdl(); 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir return 0; 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir void SwFldPage::SetWrtShell( SwWrtShell* pShell ) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir m_pWrtShell = pShell; 418*cdf0e10cSrcweir m_aMgr.SetWrtShell( pShell ); 419*cdf0e10cSrcweir } 420