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 10cdf0e10cSrcweir * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 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 #ifdef SW_DLLIMPLEMENTATION 27cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include "dbmgr.hxx" 33cdf0e10cSrcweir #include <sfx2/app.hxx> 34cdf0e10cSrcweir #include <vcl/msgbox.hxx> 35cdf0e10cSrcweir #include <swwait.hxx> 36cdf0e10cSrcweir #include <viewopt.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include "wrtsh.hxx" 39cdf0e10cSrcweir #include "errhdl.hxx" 40cdf0e10cSrcweir #include "cmdid.h" 41cdf0e10cSrcweir #include "helpid.h" 42cdf0e10cSrcweir #include "envfmt.hxx" 43cdf0e10cSrcweir #include "envlop.hxx" 44cdf0e10cSrcweir #include "envprt.hxx" 45cdf0e10cSrcweir #include "fmtcol.hxx" 46cdf0e10cSrcweir #include "poolfmt.hxx" 47cdf0e10cSrcweir #include "view.hxx" 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include "envlop.hrc" 50cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 51cdf0e10cSrcweir 52cdf0e10cSrcweir #include <unomid.h> 53cdf0e10cSrcweir 54cdf0e10cSrcweir using namespace ::com::sun::star::lang; 55cdf0e10cSrcweir using namespace ::com::sun::star::container; 56cdf0e10cSrcweir using namespace ::com::sun::star::uno; 57cdf0e10cSrcweir using namespace ::com::sun::star; 58cdf0e10cSrcweir using namespace ::rtl; 59cdf0e10cSrcweir 60cdf0e10cSrcweir 61cdf0e10cSrcweir //impl in envimg.cxx 62cdf0e10cSrcweir extern SW_DLLPUBLIC String MakeSender(); 63cdf0e10cSrcweir 64cdf0e10cSrcweir // -------------------------------------------------------------------------- 65cdf0e10cSrcweir 66cdf0e10cSrcweir SwEnvPreview::SwEnvPreview(SfxTabPage* pParent, const ResId& rResID) : 67cdf0e10cSrcweir 68cdf0e10cSrcweir Window(pParent, rResID) 69cdf0e10cSrcweir 70cdf0e10cSrcweir { 71cdf0e10cSrcweir SetMapMode(MapMode(MAP_PIXEL)); 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir // -------------------------------------------------------------------------- 75cdf0e10cSrcweir 76cdf0e10cSrcweir 77cdf0e10cSrcweir 78cdf0e10cSrcweir SwEnvPreview::~SwEnvPreview() 79cdf0e10cSrcweir { 80cdf0e10cSrcweir } 81cdf0e10cSrcweir 82cdf0e10cSrcweir // ---------------------------------------------------------------------------- 83cdf0e10cSrcweir void SwEnvPreview::DataChanged( const DataChangedEvent& rDCEvt ) 84cdf0e10cSrcweir { 85cdf0e10cSrcweir Window::DataChanged( rDCEvt ); 86cdf0e10cSrcweir if ( DATACHANGED_SETTINGS == rDCEvt.GetType() ) 87cdf0e10cSrcweir SetBackground( GetSettings().GetStyleSettings().GetDialogColor() ); 88cdf0e10cSrcweir } 89cdf0e10cSrcweir 90cdf0e10cSrcweir // ---------------------------------------------------------------------------- 91cdf0e10cSrcweir 92cdf0e10cSrcweir void SwEnvPreview::Paint(const Rectangle &) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir const StyleSettings& rSettings = GetSettings().GetStyleSettings(); 95cdf0e10cSrcweir 96cdf0e10cSrcweir const SwEnvItem& rItem = 97cdf0e10cSrcweir ((SwEnvDlg*) GetParent()->GetParent()->GetParent())->aEnvItem; 98cdf0e10cSrcweir 99cdf0e10cSrcweir sal_uInt16 nPageW = (sal_uInt16) Max(rItem.lWidth, rItem.lHeight), 100cdf0e10cSrcweir nPageH = (sal_uInt16) Min(rItem.lWidth, rItem.lHeight); 101cdf0e10cSrcweir 102cdf0e10cSrcweir float fx = (float)GetOutputSizePixel().Width () / (float)nPageW, 103cdf0e10cSrcweir fy = (float)GetOutputSizePixel().Height() / (float)nPageH, 104cdf0e10cSrcweir f = 0.8f * ( fx < fy ? fx : fy ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir Color aBack = rSettings.GetWindowColor( ); 107cdf0e10cSrcweir Color aFront = SwViewOption::GetFontColor(); 108cdf0e10cSrcweir Color aMedium = Color( ( aBack.GetRed() + aFront.GetRed() ) / 2, 109cdf0e10cSrcweir ( aBack.GetGreen() + aFront.GetGreen() ) / 2, 110cdf0e10cSrcweir ( aBack.GetBlue() + aFront.GetBlue() ) / 2 111cdf0e10cSrcweir ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir SetLineColor( aFront ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir // Umschlag 116cdf0e10cSrcweir long nW = (sal_uInt16) (f * nPageW), 117cdf0e10cSrcweir nH = (sal_uInt16) (f * nPageH), 118cdf0e10cSrcweir nX = (GetOutputSizePixel().Width () - nW) / 2, 119cdf0e10cSrcweir nY = (GetOutputSizePixel().Height() - nH) / 2; 120cdf0e10cSrcweir SetFillColor( aBack ); 121cdf0e10cSrcweir DrawRect(Rectangle(Point(nX, nY), Size(nW, nH))); 122cdf0e10cSrcweir 123cdf0e10cSrcweir // Absender 124cdf0e10cSrcweir if (rItem.bSend) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir long nSendX = nX + (sal_uInt16) (f * rItem.lSendFromLeft), 127cdf0e10cSrcweir nSendY = nY + (sal_uInt16) (f * rItem.lSendFromTop ), 128cdf0e10cSrcweir nSendW = (sal_uInt16) (f * (rItem.lAddrFromLeft - rItem.lSendFromLeft)), 129cdf0e10cSrcweir nSendH = (sal_uInt16) (f * (rItem.lAddrFromTop - rItem.lSendFromTop - 566)); 130cdf0e10cSrcweir SetFillColor( aMedium ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir DrawRect(Rectangle(Point(nSendX, nSendY), Size(nSendW, nSendH))); 133cdf0e10cSrcweir } 134cdf0e10cSrcweir 135cdf0e10cSrcweir // Empfaenger 136cdf0e10cSrcweir long nAddrX = nX + (sal_uInt16) (f * rItem.lAddrFromLeft), 137cdf0e10cSrcweir nAddrY = nY + (sal_uInt16) (f * rItem.lAddrFromTop ), 138cdf0e10cSrcweir nAddrW = (sal_uInt16) (f * (nPageW - rItem.lAddrFromLeft - 566)), 139cdf0e10cSrcweir nAddrH = (sal_uInt16) (f * (nPageH - rItem.lAddrFromTop - 566)); 140cdf0e10cSrcweir SetFillColor( aMedium ); 141cdf0e10cSrcweir DrawRect(Rectangle(Point(nAddrX, nAddrY), Size(nAddrW, nAddrH))); 142cdf0e10cSrcweir 143cdf0e10cSrcweir // Briefmarke 144cdf0e10cSrcweir long nStmpW = (sal_uInt16) (f * 1417 /* 2,5 cm */), 145cdf0e10cSrcweir nStmpH = (sal_uInt16) (f * 1701 /* 3,0 cm */), 146cdf0e10cSrcweir nStmpX = nX + nW - (sal_uInt16) (f * 566) - nStmpW, 147cdf0e10cSrcweir nStmpY = nY + (sal_uInt16) (f * 566); 148cdf0e10cSrcweir 149cdf0e10cSrcweir SetFillColor( aBack ); 150cdf0e10cSrcweir DrawRect(Rectangle(Point(nStmpX, nStmpY), Size(nStmpW, nStmpH))); 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir // -------------------------------------------------------------------------- 154cdf0e10cSrcweir 155cdf0e10cSrcweir 156cdf0e10cSrcweir 157cdf0e10cSrcweir SwEnvDlg::SwEnvDlg(Window* pParent, const SfxItemSet& rSet, 158cdf0e10cSrcweir SwWrtShell* pWrtSh, Printer* pPrt, sal_Bool bInsert) : 159cdf0e10cSrcweir 160cdf0e10cSrcweir SfxTabDialog(pParent, SW_RES(DLG_ENV), &rSet, sal_False, &aEmptyStr), 161cdf0e10cSrcweir sInsert(SW_RES(ST_INSERT)), 162cdf0e10cSrcweir sChange(SW_RES(ST_CHANGE)), 163cdf0e10cSrcweir aEnvItem((const SwEnvItem&) rSet.Get(FN_ENVELOP)), 164cdf0e10cSrcweir pSh(pWrtSh), 165cdf0e10cSrcweir pPrinter(pPrt), 166cdf0e10cSrcweir pAddresseeSet(0), 167cdf0e10cSrcweir pSenderSet(0) 168cdf0e10cSrcweir { 169cdf0e10cSrcweir FreeResource(); 170cdf0e10cSrcweir 171cdf0e10cSrcweir GetOKButton().SetText(String(SW_RES(STR_BTN_NEWDOC))); 172cdf0e10cSrcweir GetOKButton().SetHelpId(HID_ENVELOP_PRINT); 173cdf0e10cSrcweir GetOKButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird 174cdf0e10cSrcweir if (GetUserButton()) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir GetUserButton()->SetText(bInsert ? sInsert : sChange); 177cdf0e10cSrcweir GetUserButton()->SetHelpId(HID_ENVELOP_INSERT); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir 180cdf0e10cSrcweir AddTabPage(TP_ENV_ENV, SwEnvPage ::Create, 0); 181cdf0e10cSrcweir AddTabPage(TP_ENV_FMT, SwEnvFmtPage::Create, 0); 182cdf0e10cSrcweir AddTabPage(TP_ENV_PRT, SwEnvPrtPage::Create, 0); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir // -------------------------------------------------------------------------- 186cdf0e10cSrcweir 187cdf0e10cSrcweir 188cdf0e10cSrcweir 189cdf0e10cSrcweir SwEnvDlg::~SwEnvDlg() 190cdf0e10cSrcweir { 191cdf0e10cSrcweir delete pAddresseeSet; 192cdf0e10cSrcweir delete pSenderSet; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir // -------------------------------------------------------------------------- 196cdf0e10cSrcweir 197cdf0e10cSrcweir 198cdf0e10cSrcweir 199cdf0e10cSrcweir void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir if (nId == TP_ENV_PRT) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir ((SwEnvPrtPage*)&rPage)->SetPrt(pPrinter); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir } 206cdf0e10cSrcweir 207cdf0e10cSrcweir // -------------------------------------------------------------------------- 208cdf0e10cSrcweir 209cdf0e10cSrcweir short SwEnvDlg::Ok() 210cdf0e10cSrcweir { 211cdf0e10cSrcweir short nRet = SfxTabDialog::Ok(); 212cdf0e10cSrcweir 213cdf0e10cSrcweir if (nRet == RET_OK || nRet == RET_USER) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir if (pAddresseeSet) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir SwTxtFmtColl* pColl = pSh->GetTxtCollFromPool(RES_POOLCOLL_JAKETADRESS); 218cdf0e10cSrcweir pColl->SetFmtAttr(*pAddresseeSet); 219cdf0e10cSrcweir } 220cdf0e10cSrcweir if (pSenderSet) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir SwTxtFmtColl* pColl = pSh->GetTxtCollFromPool(RES_POOLCOLL_SENDADRESS); 223cdf0e10cSrcweir pColl->SetFmtAttr(*pSenderSet); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir } 226cdf0e10cSrcweir 227cdf0e10cSrcweir return nRet; 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir // -------------------------------------------------------------------------- 231cdf0e10cSrcweir 232cdf0e10cSrcweir 233cdf0e10cSrcweir 234cdf0e10cSrcweir SwEnvPage::SwEnvPage(Window* pParent, const SfxItemSet& rSet) : 235cdf0e10cSrcweir 236cdf0e10cSrcweir SfxTabPage(pParent, SW_RES(TP_ENV_ENV), rSet), 237cdf0e10cSrcweir 238cdf0e10cSrcweir aAddrText (this, SW_RES(TXT_ADDR )), 239cdf0e10cSrcweir aAddrEdit (this, SW_RES(EDT_ADDR )), 240cdf0e10cSrcweir aDatabaseFT (this, SW_RES(FT_DATABASE)), 241cdf0e10cSrcweir aDatabaseLB (this, SW_RES(LB_DATABASE)), 242cdf0e10cSrcweir aTableFT (this, SW_RES(FT_TABLE )), 243cdf0e10cSrcweir aTableLB (this, SW_RES(LB_TABLE )), 244cdf0e10cSrcweir aInsertBT (this, SW_RES(BTN_INSERT )), 245cdf0e10cSrcweir aDBFieldFT (this, SW_RES(FT_DBFIELD )), 246cdf0e10cSrcweir aDBFieldLB (this, SW_RES(LB_DBFIELD )), 247cdf0e10cSrcweir aSenderBox (this, SW_RES(BOX_SEND )), 248cdf0e10cSrcweir aSenderEdit (this, SW_RES(EDT_SEND )), 249cdf0e10cSrcweir aPreview (this, SW_RES(WIN_PREVIEW)) 250cdf0e10cSrcweir 251cdf0e10cSrcweir { 252cdf0e10cSrcweir FreeResource(); 253cdf0e10cSrcweir SetExchangeSupport(); 254cdf0e10cSrcweir pSh = GetParent()->pSh; 255cdf0e10cSrcweir 256cdf0e10cSrcweir // Handler installieren 257cdf0e10cSrcweir aDatabaseLB .SetSelectHdl(LINK(this, SwEnvPage, DatabaseHdl )); 258cdf0e10cSrcweir aTableLB .SetSelectHdl(LINK(this, SwEnvPage, DatabaseHdl )); 259cdf0e10cSrcweir aInsertBT .SetClickHdl (LINK(this, SwEnvPage, FieldHdl )); 260cdf0e10cSrcweir aSenderBox .SetClickHdl (LINK(this, SwEnvPage, SenderHdl )); 261cdf0e10cSrcweir aPreview.SetBorderStyle( WINDOW_BORDER_MONO ); 262cdf0e10cSrcweir 263cdf0e10cSrcweir SwDBData aData = pSh->GetDBData(); 264cdf0e10cSrcweir sActDBName = aData.sDataSource; 265cdf0e10cSrcweir sActDBName += DB_DELIM; 266cdf0e10cSrcweir sActDBName += (String)aData.sCommand; 267cdf0e10cSrcweir InitDatabaseBox(); 268cdf0e10cSrcweir } 269cdf0e10cSrcweir 270cdf0e10cSrcweir // -------------------------------------------------------------------------- 271cdf0e10cSrcweir 272cdf0e10cSrcweir 273cdf0e10cSrcweir 274cdf0e10cSrcweir SwEnvPage::~SwEnvPage() 275cdf0e10cSrcweir { 276cdf0e10cSrcweir } 277cdf0e10cSrcweir 278cdf0e10cSrcweir // -------------------------------------------------------------------------- 279cdf0e10cSrcweir 280cdf0e10cSrcweir 281cdf0e10cSrcweir 282cdf0e10cSrcweir IMPL_LINK( SwEnvPage, DatabaseHdl, ListBox *, pListBox ) 283cdf0e10cSrcweir { 284cdf0e10cSrcweir SwWait aWait( *pSh->GetView().GetDocShell(), sal_True ); 285cdf0e10cSrcweir 286cdf0e10cSrcweir if (pListBox == &aDatabaseLB) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir sActDBName = pListBox->GetSelectEntry(); 289cdf0e10cSrcweir pSh->GetNewDBMgr()->GetTableNames(&aTableLB, sActDBName); 290cdf0e10cSrcweir sActDBName += DB_DELIM; 291cdf0e10cSrcweir } 292cdf0e10cSrcweir else 293cdf0e10cSrcweir sActDBName.SetToken(1, DB_DELIM, aTableLB.GetSelectEntry()); 294cdf0e10cSrcweir pSh->GetNewDBMgr()->GetColumnNames( 295cdf0e10cSrcweir &aDBFieldLB, aDatabaseLB.GetSelectEntry(), aTableLB.GetSelectEntry()); 296cdf0e10cSrcweir return 0; 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir // -------------------------------------------------------------------------- 300cdf0e10cSrcweir 301cdf0e10cSrcweir 302cdf0e10cSrcweir 303cdf0e10cSrcweir IMPL_LINK( SwEnvPage, FieldHdl, Button *, EMPTYARG ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir String aStr ( '<' ); 306cdf0e10cSrcweir aStr += aDatabaseLB.GetSelectEntry(); 307cdf0e10cSrcweir aStr += '.'; 308cdf0e10cSrcweir // aStr += DB_DELIM; 309cdf0e10cSrcweir aStr += aTableLB.GetSelectEntry(); 310cdf0e10cSrcweir aStr += '.'; 311cdf0e10cSrcweir aStr += aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1'; 312cdf0e10cSrcweir aStr += '.'; 313cdf0e10cSrcweir // aStr += DB_DELIM; 314cdf0e10cSrcweir aStr += aDBFieldLB.GetSelectEntry(); 315cdf0e10cSrcweir aStr += '>'; 316cdf0e10cSrcweir aAddrEdit.ReplaceSelected(aStr); 317cdf0e10cSrcweir Selection aSel = aAddrEdit.GetSelection(); 318cdf0e10cSrcweir aAddrEdit.GrabFocus(); 319cdf0e10cSrcweir aAddrEdit.SetSelection(aSel); 320cdf0e10cSrcweir return 0; 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir // -------------------------------------------------------------------------- 324cdf0e10cSrcweir 325cdf0e10cSrcweir 326cdf0e10cSrcweir 327cdf0e10cSrcweir IMPL_LINK( SwEnvPage, SenderHdl, Button *, EMPTYARG ) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir const sal_Bool bEnable = aSenderBox.IsChecked(); 330cdf0e10cSrcweir GetParent()->aEnvItem.bSend = bEnable; 331cdf0e10cSrcweir aSenderEdit.Enable(bEnable); 332cdf0e10cSrcweir if ( bEnable ) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir aSenderEdit.GrabFocus(); 335cdf0e10cSrcweir if(!aSenderEdit.GetText().Len()) 336cdf0e10cSrcweir aSenderEdit.SetText(MakeSender()); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir aPreview.Invalidate(); 339cdf0e10cSrcweir return 0; 340cdf0e10cSrcweir } 341cdf0e10cSrcweir 342cdf0e10cSrcweir // -------------------------------------------------------------------------- 343cdf0e10cSrcweir 344cdf0e10cSrcweir 345cdf0e10cSrcweir 346cdf0e10cSrcweir void SwEnvPage::InitDatabaseBox() 347cdf0e10cSrcweir { 348cdf0e10cSrcweir if (pSh->GetNewDBMgr()) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir aDatabaseLB.Clear(); 351cdf0e10cSrcweir Sequence<OUString> aDataNames = SwNewDBMgr::GetExistingDatabaseNames(); 352cdf0e10cSrcweir const OUString* pDataNames = aDataNames.getConstArray(); 353cdf0e10cSrcweir for (long i = 0; i < aDataNames.getLength(); i++) 354cdf0e10cSrcweir aDatabaseLB.InsertEntry(pDataNames[i]); 355cdf0e10cSrcweir 356cdf0e10cSrcweir String sDBName = sActDBName.GetToken( 0, DB_DELIM ); 357cdf0e10cSrcweir String sTableName = sActDBName.GetToken( 1, DB_DELIM ); 358cdf0e10cSrcweir aDatabaseLB.SelectEntry(sDBName); 359cdf0e10cSrcweir if (pSh->GetNewDBMgr()->GetTableNames(&aTableLB, sDBName)) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir aTableLB.SelectEntry(sTableName); 362cdf0e10cSrcweir pSh->GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sDBName, sTableName); 363cdf0e10cSrcweir } 364cdf0e10cSrcweir else 365cdf0e10cSrcweir aDBFieldLB.Clear(); 366cdf0e10cSrcweir 367cdf0e10cSrcweir } 368cdf0e10cSrcweir } 369cdf0e10cSrcweir 370cdf0e10cSrcweir // -------------------------------------------------------------------------- 371cdf0e10cSrcweir 372cdf0e10cSrcweir 373cdf0e10cSrcweir 374cdf0e10cSrcweir SfxTabPage* SwEnvPage::Create(Window* pParent, const SfxItemSet& rSet) 375cdf0e10cSrcweir { 376cdf0e10cSrcweir return new SwEnvPage(pParent, rSet); 377cdf0e10cSrcweir } 378cdf0e10cSrcweir 379cdf0e10cSrcweir // -------------------------------------------------------------------------- 380cdf0e10cSrcweir 381cdf0e10cSrcweir 382cdf0e10cSrcweir 383cdf0e10cSrcweir void SwEnvPage::ActivatePage(const SfxItemSet& rSet) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir SfxItemSet aSet(rSet); 386cdf0e10cSrcweir aSet.Put(GetParent()->aEnvItem); 387cdf0e10cSrcweir Reset(aSet); 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir // -------------------------------------------------------------------------- 391cdf0e10cSrcweir 392cdf0e10cSrcweir 393cdf0e10cSrcweir 394cdf0e10cSrcweir int SwEnvPage::DeactivatePage(SfxItemSet* _pSet) 395cdf0e10cSrcweir { 396cdf0e10cSrcweir FillItem(GetParent()->aEnvItem); 397cdf0e10cSrcweir if( _pSet ) 398cdf0e10cSrcweir FillItemSet(*_pSet); 399cdf0e10cSrcweir return SfxTabPage::LEAVE_PAGE; 400cdf0e10cSrcweir } 401cdf0e10cSrcweir 402cdf0e10cSrcweir // -------------------------------------------------------------------------- 403cdf0e10cSrcweir 404cdf0e10cSrcweir 405cdf0e10cSrcweir 406cdf0e10cSrcweir void SwEnvPage::FillItem(SwEnvItem& rItem) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir rItem.aAddrText = aAddrEdit .GetText(); 409cdf0e10cSrcweir rItem.bSend = aSenderBox .IsChecked(); 410cdf0e10cSrcweir rItem.aSendText = aSenderEdit.GetText(); 411cdf0e10cSrcweir } 412cdf0e10cSrcweir 413cdf0e10cSrcweir // -------------------------------------------------------------------------- 414cdf0e10cSrcweir 415cdf0e10cSrcweir 416cdf0e10cSrcweir 417cdf0e10cSrcweir sal_Bool SwEnvPage::FillItemSet(SfxItemSet& rSet) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir FillItem(GetParent()->aEnvItem); 420cdf0e10cSrcweir rSet.Put(GetParent()->aEnvItem); 421cdf0e10cSrcweir return sal_True; 422cdf0e10cSrcweir } 423cdf0e10cSrcweir 424cdf0e10cSrcweir // ---------------------------------------------------------------------------- 425cdf0e10cSrcweir 426cdf0e10cSrcweir 427cdf0e10cSrcweir 428cdf0e10cSrcweir void SwEnvPage::Reset(const SfxItemSet& rSet) 429cdf0e10cSrcweir { 430cdf0e10cSrcweir SwEnvItem aItem = (const SwEnvItem&) rSet.Get(FN_ENVELOP); 431cdf0e10cSrcweir aAddrEdit .SetText(String(aItem.aAddrText).ConvertLineEnd()); 432cdf0e10cSrcweir aSenderEdit.SetText(String(aItem.aSendText).ConvertLineEnd()); 433cdf0e10cSrcweir aSenderBox .Check (aItem.bSend); 434cdf0e10cSrcweir aSenderBox.GetClickHdl().Call(&aSenderBox); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir 437cdf0e10cSrcweir 438