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