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_extensions.hxx" 30*cdf0e10cSrcweir #include "oemwiz.hxx" 31*cdf0e10cSrcweir #include "componentmodule.hxx" 32*cdf0e10cSrcweir #include <tools/debug.hxx> 33*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 34*cdf0e10cSrcweir #include <svl/itemset.hxx> 35*cdf0e10cSrcweir #include <svl/itempool.hxx> 36*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 37*cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 38*cdf0e10cSrcweir #ifndef _EXTENSIONS_PRELOAD_PRELOAD_HRC_ 39*cdf0e10cSrcweir #include "preload.hrc" 40*cdf0e10cSrcweir #endif 41*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC 42*cdf0e10cSrcweir #include <svx/svxids.hrc> 43*cdf0e10cSrcweir #endif 44*cdf0e10cSrcweir #include <sfx2/app.hxx> 45*cdf0e10cSrcweir #include <svtools/xtextedt.hxx> 46*cdf0e10cSrcweir #include "osl/diagnose.h" 47*cdf0e10cSrcweir #include "tools/urlobj.hxx" 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx> 50*cdf0e10cSrcweir #include <sfx2/tabdlg.hxx> 51*cdf0e10cSrcweir #include <svx/dialogs.hrc> 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir //......................................................................... 54*cdf0e10cSrcweir namespace preload 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir //......................................................................... 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 59*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 60*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 61*cdf0e10cSrcweir //......................................................................... 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir struct OEMPreloadDialog_Impl 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir SfxItemSet* pSet; 66*cdf0e10cSrcweir TabPage* pWelcomePage; 67*cdf0e10cSrcweir TabPage* pLicensePage; 68*cdf0e10cSrcweir TabPage* pUserDataPage; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir OEMPreloadDialog_Impl(OEMPreloadDialog* pDialog); 71*cdf0e10cSrcweir ~OEMPreloadDialog_Impl() 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir delete pWelcomePage; 74*cdf0e10cSrcweir delete pLicensePage; 75*cdf0e10cSrcweir delete pUserDataPage; 76*cdf0e10cSrcweir delete pSet; 77*cdf0e10cSrcweir } 78*cdf0e10cSrcweir void WriteUserData(); 79*cdf0e10cSrcweir }; 80*cdf0e10cSrcweir /* -----------------------------14.11.2001 11:33------------------------------ 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 83*cdf0e10cSrcweir OEMPreloadDialog_Impl::OEMPreloadDialog_Impl(OEMPreloadDialog* pDialog) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir SfxItemPool& rPool = SFX_APP()->GetPool(); 86*cdf0e10cSrcweir pSet = new SfxItemSet(rPool, SID_FIELD_GRABFOCUS, SID_FIELD_GRABFOCUS); 87*cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 88*cdf0e10cSrcweir if ( pFact ) 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir CreateTabPage pFunc = pFact->GetTabPageCreatorFunc(RID_SFXPAGE_GENERAL); 91*cdf0e10cSrcweir pUserDataPage = (*pFunc)(pDialog, *pSet); 92*cdf0e10cSrcweir ((SfxTabPage*)pUserDataPage)->Reset(*pSet); 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir else 95*cdf0e10cSrcweir pUserDataPage = NULL; 96*cdf0e10cSrcweir pWelcomePage = new OEMWelcomeTabPage(pDialog); 97*cdf0e10cSrcweir pLicensePage = new OEMLicenseTabPage(pDialog); 98*cdf0e10cSrcweir } 99*cdf0e10cSrcweir /* -----------------------------14.11.2001 11:33------------------------------ 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 102*cdf0e10cSrcweir void OEMPreloadDialog_Impl::WriteUserData() 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir if ( pUserDataPage ) 105*cdf0e10cSrcweir ((SfxTabPage*)pUserDataPage)->FillItemSet(*pSet); 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir /* -----------------------------14.11.2001 11:33------------------------------ 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 111*cdf0e10cSrcweir //===================================================================== 112*cdf0e10cSrcweir //= OEMPreloadDialog 113*cdf0e10cSrcweir //===================================================================== 114*cdf0e10cSrcweir //--------------------------------------------------------------------- 115*cdf0e10cSrcweir OEMPreloadDialog::OEMPreloadDialog( Window* _pParent, 116*cdf0e10cSrcweir const Reference< XPropertySet >& /*_rxObjectModel*/, const Reference< XMultiServiceFactory >& /*_rxORB*/ ) 117*cdf0e10cSrcweir :WizardDialog(_pParent, ModuleRes(RID_DLG_OEMWIZARD)/*, _rxObjectModel, _rxORB*/) 118*cdf0e10cSrcweir ,aPrevPB(this, ModuleRes(PB_PREV )) 119*cdf0e10cSrcweir ,aNextPB(this, ModuleRes(PB_NEXT )) 120*cdf0e10cSrcweir ,aCancelPB(this, ModuleRes(PB_CANCEL )) 121*cdf0e10cSrcweir ,aAcceptST(ModuleRes(ST_ACCEPT)) 122*cdf0e10cSrcweir ,aFinishST(ModuleRes(ST_FINISH)) 123*cdf0e10cSrcweir ,aLicense(ModuleRes(ST_LICENSE_AGREEMENT)) 124*cdf0e10cSrcweir ,aUserData(ModuleRes(ST_INSERT_USER_DATA)) 125*cdf0e10cSrcweir ,pImpl(new OEMPreloadDialog_Impl(this)) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir FreeResource(); 128*cdf0e10cSrcweir aDlgTitle = GetText(); 129*cdf0e10cSrcweir aPrevPB.Enable(sal_False); 130*cdf0e10cSrcweir aNextST = aNextPB.GetText(); 131*cdf0e10cSrcweir aPrevPB.SetClickHdl(LINK(this, OEMPreloadDialog, NextPrevPageHdl)); 132*cdf0e10cSrcweir aNextPB.SetClickHdl(LINK(this, OEMPreloadDialog, NextPrevPageHdl)); 133*cdf0e10cSrcweir AddButton( &aPrevPB, WIZARDDIALOG_BUTTON_STDOFFSET_X ); 134*cdf0e10cSrcweir AddButton( &aNextPB, WIZARDDIALOG_BUTTON_STDOFFSET_X ); 135*cdf0e10cSrcweir AddButton( &aCancelPB, WIZARDDIALOG_BUTTON_STDOFFSET_X ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir SetPrevButton(&aPrevPB); 138*cdf0e10cSrcweir SetNextButton(&aNextPB); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir AddPage( pImpl->pWelcomePage ); 141*cdf0e10cSrcweir AddPage( pImpl->pLicensePage ); 142*cdf0e10cSrcweir if ( pImpl->pUserDataPage ) 143*cdf0e10cSrcweir AddPage( pImpl->pUserDataPage ); 144*cdf0e10cSrcweir SetPage( OEM_WELCOME, pImpl->pWelcomePage ); 145*cdf0e10cSrcweir SetPage( OEM_LICENSE, pImpl->pLicensePage ); 146*cdf0e10cSrcweir if ( pImpl->pUserDataPage ) 147*cdf0e10cSrcweir SetPage( OEM_USERDATA, pImpl->pUserDataPage ); 148*cdf0e10cSrcweir ShowPage( OEM_WELCOME ); 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir /* -----------------------------14.11.2001 11:33------------------------------ 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 153*cdf0e10cSrcweir OEMPreloadDialog::~OEMPreloadDialog( ) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir delete pImpl; 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir /* -----------------------------14.11.2001 11:33------------------------------ 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 160*cdf0e10cSrcweir IMPL_LINK(OEMPreloadDialog, NextPrevPageHdl, PushButton*, pButton) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir if(pButton == &aPrevPB) 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir if(GetCurLevel()) 165*cdf0e10cSrcweir ShowPage(GetCurLevel() - 1); 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir else if(OEM_USERDATA > GetCurLevel()) 168*cdf0e10cSrcweir ShowPage(GetCurLevel() + 1); 169*cdf0e10cSrcweir else 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir pImpl->WriteUserData(); 172*cdf0e10cSrcweir Finnish(RET_OK); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir String sTitle(aDlgTitle); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir switch(GetCurLevel()) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir case OEM_WELCOME: 180*cdf0e10cSrcweir aNextPB.SetText(aNextST); 181*cdf0e10cSrcweir aNextPB.Enable(sal_True); 182*cdf0e10cSrcweir break; 183*cdf0e10cSrcweir case OEM_LICENSE: 184*cdf0e10cSrcweir sTitle += aLicense; 185*cdf0e10cSrcweir aNextPB.SetText(aNextST); 186*cdf0e10cSrcweir aCancelPB.GrabFocus(); 187*cdf0e10cSrcweir break; 188*cdf0e10cSrcweir case OEM_USERDATA: 189*cdf0e10cSrcweir sTitle += aUserData; 190*cdf0e10cSrcweir aNextPB.SetText(aFinishST); 191*cdf0e10cSrcweir break; 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir SetText(sTitle); 194*cdf0e10cSrcweir aPrevPB.Enable(GetCurLevel() != OEM_WELCOME); 195*cdf0e10cSrcweir return 0; 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir /* -----------------------------14.11.2001 11:33------------------------------ 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 200*cdf0e10cSrcweir sal_Bool OEMPreloadDialog::LoadFromLocalFile(const String& rFileName, String& rContent) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir SvtPathOptions aPathOpt; 203*cdf0e10cSrcweir String sFileName = aPathOpt.GetUserConfigPath();//GetModulePath(); 204*cdf0e10cSrcweir INetURLObject aURLObject(sFileName); 205*cdf0e10cSrcweir OSL_ASSERT(aURLObject.getSegmentCount() >= 2); 206*cdf0e10cSrcweir aURLObject.removeSegment(); //remove '/config' 207*cdf0e10cSrcweir aURLObject.removeSegment(); //remove '/user' 208*cdf0e10cSrcweir sFileName = aURLObject.GetMainURL(INetURLObject::DECODE_TO_IURI); 209*cdf0e10cSrcweir sFileName += rFileName; 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir SfxMedium aMedium( sFileName,STREAM_READ, sal_True ); 212*cdf0e10cSrcweir SvStream* pInStream = aMedium.GetInStream(); 213*cdf0e10cSrcweir if( !pInStream ) 214*cdf0e10cSrcweir return sal_False; 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir pInStream->ReadCString( rContent, RTL_TEXTENCODING_UTF8 ); 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir xub_StrLen nPos; 219*cdf0e10cSrcweir while ( ( nPos = rContent.Search( 12 )) != STRING_NOTFOUND ) 220*cdf0e10cSrcweir rContent.Erase( nPos, 1 ); 221*cdf0e10cSrcweir return sal_True; 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir void OEMPreloadDialog::SetCancelString( const String& rText ) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir aCancelPB.SetText(rText); 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir /* -----------------------------13.11.2001 12:29------------------------------ 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 233*cdf0e10cSrcweir OEMWelcomeTabPage::OEMWelcomeTabPage(Window* pParent) : 234*cdf0e10cSrcweir TabPage(pParent, ModuleRes(RID_TP_WELCOME)), 235*cdf0e10cSrcweir aInfoFT(this, ModuleRes(FT_INFO)) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir FreeResource(); 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir /* -----------------------------13.11.2001 12:30------------------------------ 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 242*cdf0e10cSrcweir OEMWelcomeTabPage::~OEMWelcomeTabPage() 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir /* -----------------------------13.11.2001 12:29------------------------------ 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 248*cdf0e10cSrcweir OEMLicenseTabPage::OEMLicenseTabPage(OEMPreloadDialog* pParent) : 249*cdf0e10cSrcweir TabPage(pParent, ModuleRes(RID_TP_LICENSE)), 250*cdf0e10cSrcweir aLicenseML(this, ModuleRes(ML_LICENSE)), 251*cdf0e10cSrcweir aInfo1FT(this, ModuleRes(FT_INFO1)), 252*cdf0e10cSrcweir aInfo2FT(this, ModuleRes(FT_INFO2)), 253*cdf0e10cSrcweir aInfo3FT(this, ModuleRes(FT_INFO3)), 254*cdf0e10cSrcweir aInfo2_1FT(this, ModuleRes(FT_INFO2_1)), 255*cdf0e10cSrcweir aInfo3_1FT(this, ModuleRes(FT_INFO3_1)), 256*cdf0e10cSrcweir aCBAccept(this, ModuleRes(CB_ACCEPT)), 257*cdf0e10cSrcweir aPBPageDown(this, ModuleRes(PB_PAGEDOWN)), 258*cdf0e10cSrcweir aArrow(this, ModuleRes(IMG_ARROW)), 259*cdf0e10cSrcweir aStrAccept( ModuleRes(LICENCE_ACCEPT) ), 260*cdf0e10cSrcweir aStrNotAccept( ModuleRes(LICENCE_NOTACCEPT) ), 261*cdf0e10cSrcweir bEndReached(sal_False), 262*cdf0e10cSrcweir pPreloadDialog(pParent) 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir FreeResource(); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir aLicenseML.SetEndReachedHdl( LINK(this, OEMLicenseTabPage, EndReachedHdl) ); 267*cdf0e10cSrcweir aLicenseML.SetScrolledHdl( LINK(this, OEMLicenseTabPage, ScrolledHdl) ); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir aPBPageDown.SetClickHdl( LINK(this, OEMLicenseTabPage, PageDownHdl) ); 270*cdf0e10cSrcweir aCBAccept.SetClickHdl( LINK(this, OEMLicenseTabPage, AcceptHdl) ); 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir // We want a automatic repeating page down button 273*cdf0e10cSrcweir WinBits aStyle = aPBPageDown.GetStyle(); 274*cdf0e10cSrcweir aStyle |= WB_REPEAT; 275*cdf0e10cSrcweir aPBPageDown.SetStyle( aStyle ); 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir aOldCancelText = pPreloadDialog->GetCancelString(); 278*cdf0e10cSrcweir pPreloadDialog->SetCancelString( aStrNotAccept ); 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir String aText = aInfo2FT.GetText(); 281*cdf0e10cSrcweir aText.SearchAndReplaceAll( UniString::CreateFromAscii("%PAGEDOWN"), aPBPageDown.GetText() ); 282*cdf0e10cSrcweir aInfo2FT.SetText( aText ); 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir /* -----------------------------13.11.2001 12:30------------------------------ 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 287*cdf0e10cSrcweir OEMLicenseTabPage::~OEMLicenseTabPage() 288*cdf0e10cSrcweir { 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir /* ---------------------------14.11.2001 11:24---------------------------- 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 293*cdf0e10cSrcweir void OEMLicenseTabPage::ActivatePage() 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir if(!aLicenseML.GetText().Len()) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir aLicenseML.SetLeftMargin( 5 ); 298*cdf0e10cSrcweir String sLicense; 299*cdf0e10cSrcweir #ifdef UNX 300*cdf0e10cSrcweir OEMPreloadDialog::LoadFromLocalFile(String::CreateFromAscii("LICENSE"), sLicense); 301*cdf0e10cSrcweir #else 302*cdf0e10cSrcweir OEMPreloadDialog::LoadFromLocalFile(String::CreateFromAscii("license.txt"), sLicense); 303*cdf0e10cSrcweir #endif 304*cdf0e10cSrcweir aLicenseML.SetText( sLicense ); 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir EnableControls(); 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir //------------------------------------------------------------------------ 311*cdf0e10cSrcweir IMPL_LINK( OEMLicenseTabPage, AcceptHdl, CheckBox *, EMPTYARG ) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir EnableControls(); 314*cdf0e10cSrcweir return 0; 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir //------------------------------------------------------------------------ 318*cdf0e10cSrcweir IMPL_LINK( OEMLicenseTabPage, PageDownHdl, PushButton *, EMPTYARG ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir aLicenseML.ScrollDown( SCROLL_PAGEDOWN ); 321*cdf0e10cSrcweir return 0; 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir //------------------------------------------------------------------------ 325*cdf0e10cSrcweir IMPL_LINK( OEMLicenseTabPage, EndReachedHdl, LicenceView *, EMPTYARG ) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir bEndReached = sal_True; 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir EnableControls(); 330*cdf0e10cSrcweir aCBAccept.GrabFocus(); 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir return 0; 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir //------------------------------------------------------------------------ 336*cdf0e10cSrcweir IMPL_LINK( OEMLicenseTabPage, ScrolledHdl, LicenceView *, EMPTYARG ) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir EnableControls(); 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir return 0; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir //------------------------------------------------------------------------ 344*cdf0e10cSrcweir void OEMLicenseTabPage::EnableControls() 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir if( !bEndReached && 347*cdf0e10cSrcweir ( aLicenseML.IsEndReached() || !aLicenseML.GetText().Len() ) ) 348*cdf0e10cSrcweir bEndReached = sal_True; 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir if ( bEndReached ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir Point aPos( 0, aInfo3_1FT.GetPosPixel().Y() ); 353*cdf0e10cSrcweir aArrow.SetPosPixel( aPos ); 354*cdf0e10cSrcweir aCBAccept.Enable(); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir else 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir Point aPos( 0, aInfo2_1FT.GetPosPixel().Y() ); 359*cdf0e10cSrcweir aArrow.SetPosPixel( aPos ); 360*cdf0e10cSrcweir aCBAccept.Disable(); 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir if ( aLicenseML.IsEndReached() ) 364*cdf0e10cSrcweir aPBPageDown.Disable(); 365*cdf0e10cSrcweir else 366*cdf0e10cSrcweir aPBPageDown.Enable(); 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir if ( aCBAccept.IsChecked() ) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir PushButton *pNext = pPreloadDialog->GetNextButton(); 371*cdf0e10cSrcweir if ( ! pNext->IsEnabled() ) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir pPreloadDialog->SetCancelString( aOldCancelText ); 374*cdf0e10cSrcweir pNext->Enable(sal_True); 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir else 378*cdf0e10cSrcweir { 379*cdf0e10cSrcweir PushButton *pNext = pPreloadDialog->GetNextButton(); 380*cdf0e10cSrcweir if ( pNext->IsEnabled() ) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir pPreloadDialog->SetCancelString( aStrNotAccept ); 383*cdf0e10cSrcweir pNext->Enable(sal_False); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir //------------------------------------------------------------------------ 389*cdf0e10cSrcweir //------------------------------------------------------------------------ 390*cdf0e10cSrcweir //------------------------------------------------------------------------ 391*cdf0e10cSrcweir LicenceView::LicenceView( Window* pParent, const ResId& rResId ) 392*cdf0e10cSrcweir : MultiLineEdit( pParent, rResId ) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir SetLeftMargin( 5 ); 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir mbEndReached = IsEndReached(); 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir StartListening( *GetTextEngine() ); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir //------------------------------------------------------------------------ 402*cdf0e10cSrcweir LicenceView::~LicenceView() 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir maEndReachedHdl = Link(); 405*cdf0e10cSrcweir maScrolledHdl = Link(); 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir EndListeningAll(); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir //------------------------------------------------------------------------ 411*cdf0e10cSrcweir void LicenceView::ScrollDown( ScrollType eScroll ) 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir ScrollBar* pScroll = GetVScrollBar(); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir if ( pScroll ) 416*cdf0e10cSrcweir pScroll->DoScrollAction( eScroll ); 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir //------------------------------------------------------------------------ 420*cdf0e10cSrcweir sal_Bool LicenceView::IsEndReached() const 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir sal_Bool bEndReached; 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir ExtTextView* pView = GetTextView(); 425*cdf0e10cSrcweir ExtTextEngine* pEdit = GetTextEngine(); 426*cdf0e10cSrcweir sal_uLong nHeight = pEdit->GetTextHeight(); 427*cdf0e10cSrcweir Size aOutSize = pView->GetWindow()->GetOutputSizePixel(); 428*cdf0e10cSrcweir Point aBottom( 0, aOutSize.Height() ); 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir if ( (sal_uLong) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 ) 431*cdf0e10cSrcweir bEndReached = sal_True; 432*cdf0e10cSrcweir else 433*cdf0e10cSrcweir bEndReached = sal_False; 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir return bEndReached; 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir //------------------------------------------------------------------------ 439*cdf0e10cSrcweir void LicenceView::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir if ( rHint.IsA( TYPE(TextHint) ) ) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir sal_Bool bLastVal = EndReached(); 444*cdf0e10cSrcweir sal_uLong nId = ((const TextHint&)rHint).GetId(); 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir if ( nId == TEXT_HINT_PARAINSERTED ) 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir if ( bLastVal ) 449*cdf0e10cSrcweir mbEndReached = IsEndReached(); 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir else if ( nId == TEXT_HINT_VIEWSCROLLED ) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir if ( ! mbEndReached ) 454*cdf0e10cSrcweir mbEndReached = IsEndReached(); 455*cdf0e10cSrcweir maScrolledHdl.Call( this ); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir if ( EndReached() && !bLastVal ) 459*cdf0e10cSrcweir { 460*cdf0e10cSrcweir maEndReachedHdl.Call( this ); 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir } 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir //------------------------------------------------------------------------ 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir //......................................................................... 468*cdf0e10cSrcweir } // namespace preload 469*cdf0e10cSrcweir //......................................................................... 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir 472