1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10f6e50924SAndrew Rist * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12f6e50924SAndrew Rist * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19f6e50924SAndrew Rist * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir #include <svx/dialmgr.hxx> 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <svx/dialogs.hrc> 29cdf0e10cSrcweir #include "docrecovery.hxx" 30cdf0e10cSrcweir #include "docrecovery.hrc" 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 33cdf0e10cSrcweir #include <comphelper/sequenceashashmap.hxx> 34cdf0e10cSrcweir #include <comphelper/configurationhelper.hxx> 35cdf0e10cSrcweir #include <svtools/imagemgr.hxx> 36cdf0e10cSrcweir #include <svtools/xtextedt.hxx> 37cdf0e10cSrcweir #include <tools/urlobj.hxx> 38cdf0e10cSrcweir #include <vcl/msgbox.hxx> 39cdf0e10cSrcweir #include <vcl/svapp.hxx> 40cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 41cdf0e10cSrcweir #include <vcl/scrbar.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 44cdf0e10cSrcweir #include <toolkit/unohlp.hxx> 45cdf0e10cSrcweir #endif 46cdf0e10cSrcweir 47cdf0e10cSrcweir //#include "com/sun/star/lang/XMultiServiceFactory.hpp" 48cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicatorFactory.hpp> 49cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 50cdf0e10cSrcweir //#include <com/sun/star/beans/PropertyValue.hpp> 51cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp> 52cdf0e10cSrcweir #include <com/sun/star/util/URL.hpp> 53cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp> 54cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 55cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 56cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> 57cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> 58cdf0e10cSrcweir #include <osl/file.hxx> 59cdf0e10cSrcweir #include <osl/security.hxx> 60cdf0e10cSrcweir #include <rtl/bootstrap.hxx> 61cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 62cdf0e10cSrcweir #include <unotools/localfilehelper.hxx> 63cdf0e10cSrcweir 64cdf0e10cSrcweir #define RET_BACK 100 65cdf0e10cSrcweir 66cdf0e10cSrcweir //=============================================== 67cdf0e10cSrcweir // namespace 68cdf0e10cSrcweir namespace svx{ 69cdf0e10cSrcweir namespace DocRecovery{ 70cdf0e10cSrcweir 71cdf0e10cSrcweir namespace css = ::com::sun::star; 72cdf0e10cSrcweir 73cdf0e10cSrcweir using namespace ::rtl; 74cdf0e10cSrcweir using namespace ::osl; 75cdf0e10cSrcweir 76cdf0e10cSrcweir //=============================================== 77cdf0e10cSrcweir TabDialog4Recovery::TabDialog4Recovery(Window* pParent) 78cdf0e10cSrcweir : TabDialog (pParent, SVX_RES( RID_SVX_TABDLG_DOCRECOVERY )) 79cdf0e10cSrcweir , m_pActualPage(m_lTabPages.begin() ) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir //=============================================== 84cdf0e10cSrcweir TabDialog4Recovery::~TabDialog4Recovery() 85cdf0e10cSrcweir { 86cdf0e10cSrcweir m_lTabPages.clear(); 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir //=============================================== 90cdf0e10cSrcweir void TabDialog4Recovery::addTabPage(IExtendedTabPage* pPage) 91cdf0e10cSrcweir { 92cdf0e10cSrcweir if (pPage) 93cdf0e10cSrcweir m_lTabPages.push_back(pPage); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir 96cdf0e10cSrcweir //=============================================== 97cdf0e10cSrcweir short TabDialog4Recovery::Execute() 98cdf0e10cSrcweir { 99cdf0e10cSrcweir ::vos::OGuard aLock(Application::GetSolarMutex()); 100cdf0e10cSrcweir 101cdf0e10cSrcweir Show(); 102cdf0e10cSrcweir m_pActualPage = m_lTabPages.begin(); 103cdf0e10cSrcweir while(sal_True) 104cdf0e10cSrcweir { 105cdf0e10cSrcweir IExtendedTabPage* pPage = *m_pActualPage; 106cdf0e10cSrcweir SetViewWindow(pPage); 107cdf0e10cSrcweir pPage->Show(); 108cdf0e10cSrcweir pPage->setDefButton(); 109cdf0e10cSrcweir short nRet = pPage->execute(); 110cdf0e10cSrcweir pPage->Hide(); 111cdf0e10cSrcweir 112cdf0e10cSrcweir switch(nRet) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir case DLG_RET_OK : 115cdf0e10cSrcweir { 116cdf0e10cSrcweir ++m_pActualPage; 117cdf0e10cSrcweir if (m_pActualPage == m_lTabPages.end()) 118cdf0e10cSrcweir return nRet; 119cdf0e10cSrcweir } 120cdf0e10cSrcweir break; 121cdf0e10cSrcweir 122cdf0e10cSrcweir case DLG_RET_BACK : 123cdf0e10cSrcweir { 124cdf0e10cSrcweir if (m_pActualPage != m_lTabPages.begin()) 125cdf0e10cSrcweir --m_pActualPage; 126cdf0e10cSrcweir } 127cdf0e10cSrcweir break; 128cdf0e10cSrcweir 129cdf0e10cSrcweir case DLG_RET_UNKNOWN : 130cdf0e10cSrcweir case DLG_RET_CANCEL : 131cdf0e10cSrcweir case DLG_RET_OK_AUTOLUNCH : 132cdf0e10cSrcweir return nRet; 133cdf0e10cSrcweir } 134cdf0e10cSrcweir } 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir //=============================================== 138cdf0e10cSrcweir RecoveryCore::RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , 139cdf0e10cSrcweir sal_Bool bUsedForSaving) 140cdf0e10cSrcweir : m_xSMGR ( xSMGR ) 141cdf0e10cSrcweir , m_pListener ( 0 ) 142cdf0e10cSrcweir , m_bListenForSaving(bUsedForSaving) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir impl_startListening(); 145cdf0e10cSrcweir } 146cdf0e10cSrcweir 147cdf0e10cSrcweir //=============================================== 148cdf0e10cSrcweir RecoveryCore::~RecoveryCore() 149cdf0e10cSrcweir { 150cdf0e10cSrcweir impl_stopListening(); 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir //=============================================== 154cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > RecoveryCore::getSMGR() 155cdf0e10cSrcweir { 156cdf0e10cSrcweir return m_xSMGR; 157cdf0e10cSrcweir } 158cdf0e10cSrcweir 159cdf0e10cSrcweir //=============================================== 160cdf0e10cSrcweir TURLList* RecoveryCore::getURLListAccess() 161cdf0e10cSrcweir { 162cdf0e10cSrcweir return &m_lURLs; 163cdf0e10cSrcweir } 164cdf0e10cSrcweir 165cdf0e10cSrcweir //=============================================== 166cdf0e10cSrcweir sal_Bool RecoveryCore::existsBrokenTempEntries() 167cdf0e10cSrcweir { 168cdf0e10cSrcweir TURLList::const_iterator pIt; 169cdf0e10cSrcweir for ( pIt = m_lURLs.begin(); 170cdf0e10cSrcweir pIt != m_lURLs.end() ; 171cdf0e10cSrcweir ++pIt ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 174cdf0e10cSrcweir if (RecoveryCore::isBrokenTempEntry(rInfo)) 175cdf0e10cSrcweir return sal_True; 176cdf0e10cSrcweir } 177cdf0e10cSrcweir 178cdf0e10cSrcweir return sal_False; 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir //=============================================== 182cdf0e10cSrcweir sal_Bool RecoveryCore::existsNonRecoveredEntries() 183cdf0e10cSrcweir { 184cdf0e10cSrcweir TURLList::const_iterator pIt; 185cdf0e10cSrcweir for ( pIt = m_lURLs.begin(); 186cdf0e10cSrcweir pIt != m_lURLs.end() ; 187cdf0e10cSrcweir ++pIt ) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 190cdf0e10cSrcweir if (rInfo.RecoveryState == E_NOT_RECOVERED_YET) 191cdf0e10cSrcweir return sal_True; 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir return sal_False; 195cdf0e10cSrcweir } 196cdf0e10cSrcweir 197cdf0e10cSrcweir //=============================================== 198cdf0e10cSrcweir sal_Bool RecoveryCore::isBrokenTempEntry(const TURLInfo& rInfo) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir if (!rInfo.TempURL.getLength()) 201cdf0e10cSrcweir return sal_False; 202cdf0e10cSrcweir 203cdf0e10cSrcweir // Note: If the original files was recovery ... but a temp file 204cdf0e10cSrcweir // exists ... an error inside the temp file exists! 205cdf0e10cSrcweir if ( 206cdf0e10cSrcweir !(rInfo.RecoveryState == E_RECOVERY_FAILED ) && 207cdf0e10cSrcweir !(rInfo.RecoveryState == E_ORIGINAL_DOCUMENT_RECOVERED) 208cdf0e10cSrcweir ) 209cdf0e10cSrcweir return sal_False; 210cdf0e10cSrcweir 211cdf0e10cSrcweir return sal_True; 212cdf0e10cSrcweir } 213cdf0e10cSrcweir 214cdf0e10cSrcweir //=============================================== 215cdf0e10cSrcweir void RecoveryCore::saveBrokenTempEntries(const ::rtl::OUString& sPath) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir if (!sPath.getLength()) 218cdf0e10cSrcweir return; 219cdf0e10cSrcweir 220cdf0e10cSrcweir if (!m_xRealCore.is()) 221cdf0e10cSrcweir return; 222cdf0e10cSrcweir 223cdf0e10cSrcweir // prepare all needed parameters for the following dispatch() request. 224cdf0e10cSrcweir css::util::URL aCopyURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_BACKUP); 225cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lCopyArgs(3); 226cdf0e10cSrcweir lCopyArgs[0].Name = PROP_DISPATCHASYNCHRON; 227cdf0e10cSrcweir lCopyArgs[0].Value <<= sal_False; 228cdf0e10cSrcweir lCopyArgs[1].Name = PROP_SAVEPATH; 229cdf0e10cSrcweir lCopyArgs[1].Value <<= sPath; 230cdf0e10cSrcweir lCopyArgs[2].Name = PROP_ENTRYID; 231cdf0e10cSrcweir // lCopyArgs[2].Value will be changed during next loop ... 232cdf0e10cSrcweir 233cdf0e10cSrcweir // work on a copied list only ... 234cdf0e10cSrcweir // Reason: We will get notifications from the core for every 235cdf0e10cSrcweir // changed or removed element. And that will change our m_lURLs list. 236cdf0e10cSrcweir // That's not a good idea, if we use a stl iterator inbetween .-) 237cdf0e10cSrcweir TURLList lURLs = m_lURLs; 238cdf0e10cSrcweir TURLList::const_iterator pIt; 239cdf0e10cSrcweir for ( pIt = lURLs.begin(); 240cdf0e10cSrcweir pIt != lURLs.end() ; 241cdf0e10cSrcweir ++pIt ) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 244cdf0e10cSrcweir if (!RecoveryCore::isBrokenTempEntry(rInfo)) 245cdf0e10cSrcweir continue; 246cdf0e10cSrcweir 247cdf0e10cSrcweir lCopyArgs[2].Value <<= rInfo.ID; 248cdf0e10cSrcweir m_xRealCore->dispatch(aCopyURL, lCopyArgs); 249cdf0e10cSrcweir } 250cdf0e10cSrcweir } 251cdf0e10cSrcweir 252cdf0e10cSrcweir //=============================================== 253cdf0e10cSrcweir void RecoveryCore::saveAllTempEntries(const ::rtl::OUString& sPath) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir if (!sPath.getLength()) 256cdf0e10cSrcweir return; 257cdf0e10cSrcweir 258cdf0e10cSrcweir if (!m_xRealCore.is()) 259cdf0e10cSrcweir return; 260cdf0e10cSrcweir 261cdf0e10cSrcweir // prepare all needed parameters for the following dispatch() request. 262cdf0e10cSrcweir css::util::URL aCopyURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_BACKUP); 263cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lCopyArgs(3); 264cdf0e10cSrcweir lCopyArgs[0].Name = PROP_DISPATCHASYNCHRON; 265cdf0e10cSrcweir lCopyArgs[0].Value <<= sal_False; 266cdf0e10cSrcweir lCopyArgs[1].Name = PROP_SAVEPATH; 267cdf0e10cSrcweir lCopyArgs[1].Value <<= sPath; 268cdf0e10cSrcweir lCopyArgs[2].Name = PROP_ENTRYID; 269cdf0e10cSrcweir // lCopyArgs[2].Value will be changed during next loop ... 270cdf0e10cSrcweir 271cdf0e10cSrcweir // work on a copied list only ... 272cdf0e10cSrcweir // Reason: We will get notifications from the core for every 273cdf0e10cSrcweir // changed or removed element. And that will change our m_lURLs list. 274cdf0e10cSrcweir // That's not a good idea, if we use a stl iterator inbetween .-) 275cdf0e10cSrcweir TURLList lURLs = m_lURLs; 276cdf0e10cSrcweir TURLList::const_iterator pIt; 277cdf0e10cSrcweir for ( pIt = lURLs.begin(); 278cdf0e10cSrcweir pIt != lURLs.end() ; 279cdf0e10cSrcweir ++pIt ) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 282cdf0e10cSrcweir if (!rInfo.TempURL.getLength()) 283cdf0e10cSrcweir continue; 284cdf0e10cSrcweir 285cdf0e10cSrcweir lCopyArgs[2].Value <<= rInfo.ID; 286cdf0e10cSrcweir m_xRealCore->dispatch(aCopyURL, lCopyArgs); 287cdf0e10cSrcweir } 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir //=============================================== 291cdf0e10cSrcweir void RecoveryCore::forgetBrokenTempEntries() 292cdf0e10cSrcweir { 293cdf0e10cSrcweir if (!m_xRealCore.is()) 294cdf0e10cSrcweir return; 295cdf0e10cSrcweir 296cdf0e10cSrcweir css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP); 297cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2); 298cdf0e10cSrcweir lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; 299cdf0e10cSrcweir lRemoveArgs[0].Value <<= sal_False; 300cdf0e10cSrcweir lRemoveArgs[1].Name = PROP_ENTRYID; 301cdf0e10cSrcweir // lRemoveArgs[1].Value will be changed during next loop ... 302cdf0e10cSrcweir 303cdf0e10cSrcweir // work on a copied list only ... 304cdf0e10cSrcweir // Reason: We will get notifications from the core for every 305cdf0e10cSrcweir // changed or removed element. And that will change our m_lURLs list. 306cdf0e10cSrcweir // That's not a good idea, if we use a stl iterator inbetween .-) 307cdf0e10cSrcweir TURLList lURLs = m_lURLs; 308cdf0e10cSrcweir TURLList::const_iterator pIt; 309cdf0e10cSrcweir for ( pIt = lURLs.begin(); 310cdf0e10cSrcweir pIt != lURLs.end() ; 311cdf0e10cSrcweir ++pIt ) 312cdf0e10cSrcweir { 313cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 314cdf0e10cSrcweir if (!RecoveryCore::isBrokenTempEntry(rInfo)) 315cdf0e10cSrcweir continue; 316cdf0e10cSrcweir 317cdf0e10cSrcweir lRemoveArgs[1].Value <<= rInfo.ID; 318cdf0e10cSrcweir m_xRealCore->dispatch(aRemoveURL, lRemoveArgs); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir } 321cdf0e10cSrcweir 322cdf0e10cSrcweir //=============================================== 323cdf0e10cSrcweir void RecoveryCore::forgetAllRecoveryEntries() 324cdf0e10cSrcweir { 325cdf0e10cSrcweir if (!m_xRealCore.is()) 326cdf0e10cSrcweir return; 327cdf0e10cSrcweir 328cdf0e10cSrcweir css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP); 329cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2); 330cdf0e10cSrcweir lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; 331cdf0e10cSrcweir lRemoveArgs[0].Value <<= sal_False; 332cdf0e10cSrcweir lRemoveArgs[1].Name = PROP_ENTRYID; 333cdf0e10cSrcweir // lRemoveArgs[1].Value will be changed during next loop ... 334cdf0e10cSrcweir 335cdf0e10cSrcweir // work on a copied list only ... 336cdf0e10cSrcweir // Reason: We will get notifications from the core for every 337cdf0e10cSrcweir // changed or removed element. And that will change our m_lURLs list. 338cdf0e10cSrcweir // That's not a good idea, if we use a stl iterator inbetween .-) 339cdf0e10cSrcweir TURLList lURLs = m_lURLs; 340cdf0e10cSrcweir TURLList::const_iterator pIt; 341cdf0e10cSrcweir for ( pIt = lURLs.begin(); 342cdf0e10cSrcweir pIt != lURLs.end() ; 343cdf0e10cSrcweir ++pIt ) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 346cdf0e10cSrcweir lRemoveArgs[1].Value <<= rInfo.ID; 347cdf0e10cSrcweir m_xRealCore->dispatch(aRemoveURL, lRemoveArgs); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir } 350cdf0e10cSrcweir 351cdf0e10cSrcweir //=============================================== 352cdf0e10cSrcweir void RecoveryCore::forgetBrokenRecoveryEntries() 353cdf0e10cSrcweir { 354cdf0e10cSrcweir if (!m_xRealCore.is()) 355cdf0e10cSrcweir return; 356cdf0e10cSrcweir 357cdf0e10cSrcweir css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP); 358cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2); 359cdf0e10cSrcweir lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; 360cdf0e10cSrcweir lRemoveArgs[0].Value <<= sal_False; 361cdf0e10cSrcweir lRemoveArgs[1].Name = PROP_ENTRYID; 362cdf0e10cSrcweir // lRemoveArgs[1].Value will be changed during next loop ... 363cdf0e10cSrcweir 364cdf0e10cSrcweir // work on a copied list only ... 365cdf0e10cSrcweir // Reason: We will get notifications from the core for every 366cdf0e10cSrcweir // changed or removed element. And that will change our m_lURLs list. 367cdf0e10cSrcweir // That's not a good idea, if we use a stl iterator inbetween .-) 368cdf0e10cSrcweir TURLList lURLs = m_lURLs; 369cdf0e10cSrcweir TURLList::const_iterator pIt; 370cdf0e10cSrcweir for ( pIt = lURLs.begin(); 371cdf0e10cSrcweir pIt != lURLs.end() ; 372cdf0e10cSrcweir ++pIt ) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 375cdf0e10cSrcweir if (!RecoveryCore::isBrokenTempEntry(rInfo)) 376cdf0e10cSrcweir continue; 377cdf0e10cSrcweir 378cdf0e10cSrcweir lRemoveArgs[1].Value <<= rInfo.ID; 379cdf0e10cSrcweir m_xRealCore->dispatch(aRemoveURL, lRemoveArgs); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383cdf0e10cSrcweir //=============================================== 384cdf0e10cSrcweir void RecoveryCore::setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator >& xProgress) 385cdf0e10cSrcweir { 386cdf0e10cSrcweir m_xProgress = xProgress; 387cdf0e10cSrcweir } 388cdf0e10cSrcweir 389cdf0e10cSrcweir //=============================================== 390cdf0e10cSrcweir void RecoveryCore::setUpdateListener(IRecoveryUpdateListener* pListener) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir m_pListener = pListener; 393cdf0e10cSrcweir } 394cdf0e10cSrcweir 395cdf0e10cSrcweir //=============================================== 396cdf0e10cSrcweir void RecoveryCore::doEmergencySavePrepare() 397cdf0e10cSrcweir { 398cdf0e10cSrcweir if (!m_xRealCore.is()) 399cdf0e10cSrcweir return; 400cdf0e10cSrcweir 401cdf0e10cSrcweir css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE); 402cdf0e10cSrcweir 403cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lArgs(1); 404cdf0e10cSrcweir lArgs[0].Name = PROP_DISPATCHASYNCHRON; 405cdf0e10cSrcweir lArgs[0].Value <<= sal_False; 406cdf0e10cSrcweir 407cdf0e10cSrcweir m_xRealCore->dispatch(aURL, lArgs); 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir //=============================================== 411cdf0e10cSrcweir void RecoveryCore::doEmergencySave() 412cdf0e10cSrcweir { 413cdf0e10cSrcweir if (!m_xRealCore.is()) 414cdf0e10cSrcweir return; 415cdf0e10cSrcweir 416cdf0e10cSrcweir css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_EMERGENCY_SAVE); 417cdf0e10cSrcweir 418cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lArgs(2); 419cdf0e10cSrcweir lArgs[0].Name = PROP_STATUSINDICATOR; 420cdf0e10cSrcweir lArgs[0].Value <<= m_xProgress; 421cdf0e10cSrcweir lArgs[1].Name = PROP_DISPATCHASYNCHRON; 422cdf0e10cSrcweir lArgs[1].Value <<= sal_True; 423cdf0e10cSrcweir 424cdf0e10cSrcweir m_xRealCore->dispatch(aURL, lArgs); 425cdf0e10cSrcweir } 426cdf0e10cSrcweir 427cdf0e10cSrcweir //=============================================== 428cdf0e10cSrcweir void RecoveryCore::doRecovery() 429cdf0e10cSrcweir { 430cdf0e10cSrcweir if (!m_xRealCore.is()) 431cdf0e10cSrcweir return; 432cdf0e10cSrcweir 433cdf0e10cSrcweir css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_RECOVERY); 434cdf0e10cSrcweir 435cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lArgs(2); 436cdf0e10cSrcweir lArgs[0].Name = PROP_STATUSINDICATOR; 437cdf0e10cSrcweir lArgs[0].Value <<= m_xProgress; 438cdf0e10cSrcweir lArgs[1].Name = PROP_DISPATCHASYNCHRON; 439cdf0e10cSrcweir lArgs[1].Value <<= sal_True; 440cdf0e10cSrcweir 441cdf0e10cSrcweir m_xRealCore->dispatch(aURL, lArgs); 442cdf0e10cSrcweir } 443cdf0e10cSrcweir 444cdf0e10cSrcweir //=============================================== 445cdf0e10cSrcweir ERecoveryState RecoveryCore::mapDocState2RecoverState(sal_Int32 eDocState) 446cdf0e10cSrcweir { 447cdf0e10cSrcweir // ??? 448cdf0e10cSrcweir ERecoveryState eRecState = E_NOT_RECOVERED_YET; 449cdf0e10cSrcweir 450cdf0e10cSrcweir /* Attention: 451*86e1cf34SPedro Giffuni Some of the following states can occur at the 452cdf0e10cSrcweir same time. So we have to check for the "worst case" first! 453cdf0e10cSrcweir 454cdf0e10cSrcweir DAMAGED -> INCOMPLETE -> HANDLED 455cdf0e10cSrcweir */ 456cdf0e10cSrcweir 457cdf0e10cSrcweir // running ... 458cdf0e10cSrcweir if ( 459cdf0e10cSrcweir ((eDocState & E_TRY_LOAD_BACKUP ) == E_TRY_LOAD_BACKUP ) || 460cdf0e10cSrcweir ((eDocState & E_TRY_LOAD_ORIGINAL) == E_TRY_LOAD_ORIGINAL) 461cdf0e10cSrcweir ) 462cdf0e10cSrcweir eRecState = E_RECOVERY_IS_IN_PROGRESS; 463cdf0e10cSrcweir // red 464cdf0e10cSrcweir else 465cdf0e10cSrcweir if ((eDocState & E_DAMAGED) == E_DAMAGED) 466cdf0e10cSrcweir eRecState = E_RECOVERY_FAILED; 467cdf0e10cSrcweir // yellow 468cdf0e10cSrcweir else 469cdf0e10cSrcweir if ((eDocState & E_INCOMPLETE) == E_INCOMPLETE) 470cdf0e10cSrcweir eRecState = E_ORIGINAL_DOCUMENT_RECOVERED; 471cdf0e10cSrcweir // green 472cdf0e10cSrcweir else 473cdf0e10cSrcweir if ((eDocState & E_SUCCEDED) == E_SUCCEDED) 474cdf0e10cSrcweir eRecState = E_SUCCESSFULLY_RECOVERED; 475cdf0e10cSrcweir 476cdf0e10cSrcweir return eRecState; 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir //=============================================== 480cdf0e10cSrcweir void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& aEvent) 481cdf0e10cSrcweir throw(css::uno::RuntimeException) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir // a) special notification about start/stop async dispatch! 484cdf0e10cSrcweir // FeatureDescriptor = "start" || "stop" 485cdf0e10cSrcweir if (aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_START)) 486cdf0e10cSrcweir { 487cdf0e10cSrcweir if (m_pListener) 488cdf0e10cSrcweir m_pListener->start(); 489cdf0e10cSrcweir return; 490cdf0e10cSrcweir } 491cdf0e10cSrcweir 492cdf0e10cSrcweir if (aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_STOP)) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir if (m_pListener) 495cdf0e10cSrcweir m_pListener->end(); 496cdf0e10cSrcweir return; 497cdf0e10cSrcweir } 498cdf0e10cSrcweir 499cdf0e10cSrcweir // b) normal notification about changed items 500cdf0e10cSrcweir // FeatureDescriptor = "Update" 501cdf0e10cSrcweir // State = Lits of informations [seq< NamedValue >] 502cdf0e10cSrcweir if (! aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_UPDATE)) 503cdf0e10cSrcweir return; 504cdf0e10cSrcweir 505cdf0e10cSrcweir ::comphelper::SequenceAsHashMap lInfo(aEvent.State); 506cdf0e10cSrcweir TURLInfo aNew; 507cdf0e10cSrcweir 508cdf0e10cSrcweir aNew.ID = lInfo.getUnpackedValueOrDefault(STATEPROP_ID , (sal_Int32)0 ); 509cdf0e10cSrcweir aNew.DocState = lInfo.getUnpackedValueOrDefault(STATEPROP_STATE , (sal_Int32)0 ); 510cdf0e10cSrcweir aNew.OrgURL = lInfo.getUnpackedValueOrDefault(STATEPROP_ORGURL , ::rtl::OUString()); 511cdf0e10cSrcweir aNew.TempURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPURL , ::rtl::OUString()); 512cdf0e10cSrcweir aNew.FactoryURL = lInfo.getUnpackedValueOrDefault(STATEPROP_FACTORYURL , ::rtl::OUString()); 513cdf0e10cSrcweir aNew.TemplateURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPLATEURL, ::rtl::OUString()); 514cdf0e10cSrcweir aNew.DisplayName = lInfo.getUnpackedValueOrDefault(STATEPROP_TITLE , ::rtl::OUString()); 515cdf0e10cSrcweir aNew.Module = lInfo.getUnpackedValueOrDefault(STATEPROP_MODULE , ::rtl::OUString()); 516cdf0e10cSrcweir 517cdf0e10cSrcweir // search for already existing items and update her nState value ... 518cdf0e10cSrcweir TURLList::iterator pIt; 519cdf0e10cSrcweir for ( pIt = m_lURLs.begin(); 520cdf0e10cSrcweir pIt != m_lURLs.end() ; 521cdf0e10cSrcweir ++pIt ) 522cdf0e10cSrcweir { 523cdf0e10cSrcweir TURLInfo& aOld = *pIt; 524cdf0e10cSrcweir if (aOld.ID == aNew.ID) 525cdf0e10cSrcweir { 526cdf0e10cSrcweir // change existing 527cdf0e10cSrcweir aOld.DocState = aNew.DocState; 528cdf0e10cSrcweir aOld.RecoveryState = RecoveryCore::mapDocState2RecoverState(aOld.DocState); 529cdf0e10cSrcweir if (m_pListener) 530cdf0e10cSrcweir { 531cdf0e10cSrcweir m_pListener->updateItems(); 532cdf0e10cSrcweir m_pListener->stepNext(&aOld); 533cdf0e10cSrcweir } 534cdf0e10cSrcweir return; 535cdf0e10cSrcweir } 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir // append as new one 539cdf0e10cSrcweir // TODO think about mmatching Module name to a corresponding icon 540cdf0e10cSrcweir String sURL = aNew.OrgURL; 541cdf0e10cSrcweir if (!sURL.Len()) 542cdf0e10cSrcweir sURL = aNew.FactoryURL; 543cdf0e10cSrcweir if (!sURL.Len()) 544cdf0e10cSrcweir sURL = aNew.TempURL; 545cdf0e10cSrcweir if (!sURL.Len()) 546cdf0e10cSrcweir sURL = aNew.TemplateURL; 547cdf0e10cSrcweir INetURLObject aURL(sURL); 548cdf0e10cSrcweir aNew.StandardImage = SvFileInformationManager::GetFileImage(aURL, false, false); 549cdf0e10cSrcweir aNew.HCImage = SvFileInformationManager::GetFileImage(aURL, false, true ); 550cdf0e10cSrcweir 551cdf0e10cSrcweir /* set the right UI state for this item to NOT_RECOVERED_YET ... because nDocState shows the state of 552cdf0e10cSrcweir the last emergency save operation before and is interessting for the used recovery core service only ... 553cdf0e10cSrcweir for now! But if there is a further notification for this item (see lines above!) we must 554cdf0e10cSrcweir map the doc state to an UI state. */ 555cdf0e10cSrcweir aNew.RecoveryState = E_NOT_RECOVERED_YET; 556cdf0e10cSrcweir 557cdf0e10cSrcweir // patch DisplayName! Because the document title contain more then the file name ... 558cdf0e10cSrcweir sal_Int32 i = aNew.DisplayName.indexOf(::rtl::OUString::createFromAscii(" - ")); 559cdf0e10cSrcweir if (i > 0) 560cdf0e10cSrcweir aNew.DisplayName = aNew.DisplayName.copy(0, i); 561cdf0e10cSrcweir 562cdf0e10cSrcweir m_lURLs.push_back(aNew); 563cdf0e10cSrcweir 564cdf0e10cSrcweir if (m_pListener) 565cdf0e10cSrcweir m_pListener->updateItems(); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir 568cdf0e10cSrcweir //=============================================== 569cdf0e10cSrcweir void SAL_CALL RecoveryCore::disposing(const css::lang::EventObject& /*aEvent*/) 570cdf0e10cSrcweir throw(css::uno::RuntimeException) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir m_xRealCore.clear(); 573cdf0e10cSrcweir } 574cdf0e10cSrcweir 575cdf0e10cSrcweir //=============================================== 576cdf0e10cSrcweir void RecoveryCore::impl_startListening() 577cdf0e10cSrcweir { 578cdf0e10cSrcweir // listening already initialized ? 579cdf0e10cSrcweir if (m_xRealCore.is()) 580cdf0e10cSrcweir return; 581cdf0e10cSrcweir m_xRealCore = css::uno::Reference< css::frame::XDispatch >(m_xSMGR->createInstance(SERVICENAME_RECOVERYCORE), css::uno::UNO_QUERY_THROW); 582cdf0e10cSrcweir 583cdf0e10cSrcweir css::util::URL aURL; 584cdf0e10cSrcweir if (m_bListenForSaving) 585cdf0e10cSrcweir aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE; 586cdf0e10cSrcweir else 587cdf0e10cSrcweir aURL.Complete = RECOVERY_CMD_DO_RECOVERY; 588cdf0e10cSrcweir css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); 589cdf0e10cSrcweir xParser->parseStrict(aURL); 590cdf0e10cSrcweir 591cdf0e10cSrcweir /* Note: addStatusListener() call us synchronous back ... so we 592cdf0e10cSrcweir will get the complete list of currently open documents! */ 593cdf0e10cSrcweir m_xRealCore->addStatusListener(static_cast< css::frame::XStatusListener* >(this), aURL); 594cdf0e10cSrcweir } 595cdf0e10cSrcweir 596cdf0e10cSrcweir //=============================================== 597cdf0e10cSrcweir void RecoveryCore::impl_stopListening() 598cdf0e10cSrcweir { 599*86e1cf34SPedro Giffuni // Ignore it, if this instance doesn't listen currently 600cdf0e10cSrcweir if (!m_xRealCore.is()) 601cdf0e10cSrcweir return; 602cdf0e10cSrcweir 603cdf0e10cSrcweir css::util::URL aURL; 604cdf0e10cSrcweir if (m_bListenForSaving) 605cdf0e10cSrcweir aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE; 606cdf0e10cSrcweir else 607cdf0e10cSrcweir aURL.Complete = RECOVERY_CMD_DO_RECOVERY; 608cdf0e10cSrcweir css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); 609cdf0e10cSrcweir xParser->parseStrict(aURL); 610cdf0e10cSrcweir 611cdf0e10cSrcweir m_xRealCore->removeStatusListener(static_cast< css::frame::XStatusListener* >(this), aURL); 612cdf0e10cSrcweir m_xRealCore.clear(); 613cdf0e10cSrcweir } 614cdf0e10cSrcweir 615cdf0e10cSrcweir //=============================================== 616cdf0e10cSrcweir css::util::URL RecoveryCore::impl_getParsedURL(const ::rtl::OUString& sURL) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir css::util::URL aURL; 619cdf0e10cSrcweir aURL.Complete = sURL; 620cdf0e10cSrcweir 621cdf0e10cSrcweir css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); 622cdf0e10cSrcweir xParser->parseStrict(aURL); 623cdf0e10cSrcweir 624cdf0e10cSrcweir return aURL; 625cdf0e10cSrcweir } 626cdf0e10cSrcweir 627cdf0e10cSrcweir //=============================================== 628cdf0e10cSrcweir PluginProgressWindow::PluginProgressWindow( Window* pParent , 629cdf0e10cSrcweir const css::uno::Reference< css::lang::XComponent >& xProgress) 630cdf0e10cSrcweir : Window (pParent ) 631cdf0e10cSrcweir , m_xProgress(xProgress) 632cdf0e10cSrcweir { 633cdf0e10cSrcweir Show(); 634cdf0e10cSrcweir Size aParentSize = pParent->GetSizePixel(); 635cdf0e10cSrcweir // align the progressbar to its parent 636cdf0e10cSrcweir SetPosSizePixel( -9, 0, aParentSize.Width() + 15, aParentSize.Height() - 4 ); 637cdf0e10cSrcweir } 638cdf0e10cSrcweir 639cdf0e10cSrcweir //=============================================== 640cdf0e10cSrcweir PluginProgressWindow::~PluginProgressWindow() 641cdf0e10cSrcweir { 642cdf0e10cSrcweir if (m_xProgress.is()) 643cdf0e10cSrcweir m_xProgress->dispose(); 644cdf0e10cSrcweir } 645cdf0e10cSrcweir 646cdf0e10cSrcweir //=============================================== 647cdf0e10cSrcweir PluginProgress::PluginProgress( Window* pParent, 648cdf0e10cSrcweir const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir m_pPlugProgressWindow = new PluginProgressWindow(pParent, static_cast< css::lang::XComponent* >(this)); 651cdf0e10cSrcweir css::uno::Reference< css::awt::XWindow > xProgressWindow = VCLUnoHelper::GetInterface(m_pPlugProgressWindow); 652cdf0e10cSrcweir m_xProgressFactory = css::uno::Reference< css::task::XStatusIndicatorFactory >(xSMGR->createInstance(SERVICENAME_PROGRESSFACTORY), css::uno::UNO_QUERY_THROW); 653cdf0e10cSrcweir css::uno::Reference< css::lang::XInitialization > xInit(m_xProgressFactory, css::uno::UNO_QUERY_THROW); 654cdf0e10cSrcweir 655cdf0e10cSrcweir css::uno::Sequence< css::uno::Any > lArgs(2); 656cdf0e10cSrcweir css::beans::NamedValue aProp; 657cdf0e10cSrcweir aProp.Name = PROP_PARENTWINDOW; 658cdf0e10cSrcweir aProp.Value <<= xProgressWindow; 659cdf0e10cSrcweir lArgs[0] <<= aProp; 660cdf0e10cSrcweir aProp.Name = PROP_ALLOWPARENTSHOW; 661cdf0e10cSrcweir aProp.Value <<= sal_True; 662cdf0e10cSrcweir lArgs[1] <<= aProp; 663cdf0e10cSrcweir 664cdf0e10cSrcweir xInit->initialize(lArgs); 665cdf0e10cSrcweir 666cdf0e10cSrcweir m_xProgress = m_xProgressFactory->createStatusIndicator(); 667cdf0e10cSrcweir } 668cdf0e10cSrcweir 669cdf0e10cSrcweir //=============================================== 670cdf0e10cSrcweir PluginProgress::~PluginProgress() 671cdf0e10cSrcweir { 672cdf0e10cSrcweir } 673cdf0e10cSrcweir 674cdf0e10cSrcweir //=============================================== 675cdf0e10cSrcweir Window* PluginProgress::getPlugWindow() 676cdf0e10cSrcweir { 677cdf0e10cSrcweir return m_pPlugProgressWindow; 678cdf0e10cSrcweir } 679cdf0e10cSrcweir 680cdf0e10cSrcweir //=============================================== 681cdf0e10cSrcweir void SAL_CALL PluginProgress::dispose() 682cdf0e10cSrcweir throw(css::uno::RuntimeException) 683cdf0e10cSrcweir { 684cdf0e10cSrcweir // m_pPluginProgressWindow was deleted ... 685cdf0e10cSrcweir // So the internal pointer of this progress 686cdf0e10cSrcweir // weill be dead! 687cdf0e10cSrcweir m_xProgress.clear(); 688cdf0e10cSrcweir } 689cdf0e10cSrcweir 690cdf0e10cSrcweir //=============================================== 691cdf0e10cSrcweir void SAL_CALL PluginProgress::addEventListener(const css::uno::Reference< css::lang::XEventListener >& ) 692cdf0e10cSrcweir throw(css::uno::RuntimeException) 693cdf0e10cSrcweir { 694cdf0e10cSrcweir } 695cdf0e10cSrcweir 696cdf0e10cSrcweir //=============================================== 697cdf0e10cSrcweir void SAL_CALL PluginProgress::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& ) 698cdf0e10cSrcweir throw(css::uno::RuntimeException) 699cdf0e10cSrcweir { 700cdf0e10cSrcweir } 701cdf0e10cSrcweir 702cdf0e10cSrcweir //=============================================== 703cdf0e10cSrcweir void SAL_CALL PluginProgress::start(const ::rtl::OUString&, 704cdf0e10cSrcweir sal_Int32 nRange) 705cdf0e10cSrcweir throw(css::uno::RuntimeException) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir if (m_xProgress.is()) 708cdf0e10cSrcweir m_xProgress->start(::rtl::OUString(), nRange); 709cdf0e10cSrcweir } 710cdf0e10cSrcweir 711cdf0e10cSrcweir //=============================================== 712cdf0e10cSrcweir void SAL_CALL PluginProgress::end() 713cdf0e10cSrcweir throw(css::uno::RuntimeException) 714cdf0e10cSrcweir { 715cdf0e10cSrcweir if (m_xProgress.is()) 716cdf0e10cSrcweir m_xProgress->end(); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir //=============================================== 720cdf0e10cSrcweir void SAL_CALL PluginProgress::setText(const ::rtl::OUString& sText) 721cdf0e10cSrcweir throw(css::uno::RuntimeException) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir if (m_xProgress.is()) 724cdf0e10cSrcweir m_xProgress->setText(sText); 725cdf0e10cSrcweir } 726cdf0e10cSrcweir 727cdf0e10cSrcweir //=============================================== 728cdf0e10cSrcweir void SAL_CALL PluginProgress::setValue(sal_Int32 nValue) 729cdf0e10cSrcweir throw(css::uno::RuntimeException) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir if (m_xProgress.is()) 732cdf0e10cSrcweir m_xProgress->setValue(nValue); 733cdf0e10cSrcweir } 734cdf0e10cSrcweir 735cdf0e10cSrcweir //=============================================== 736cdf0e10cSrcweir void SAL_CALL PluginProgress::reset() 737cdf0e10cSrcweir throw(css::uno::RuntimeException) 738cdf0e10cSrcweir { 739cdf0e10cSrcweir if (m_xProgress.is()) 740cdf0e10cSrcweir m_xProgress->reset(); 741cdf0e10cSrcweir } 742cdf0e10cSrcweir 743cdf0e10cSrcweir //=============================================== 744cdf0e10cSrcweir SaveDialog::SaveDialog(Window* pParent, 745cdf0e10cSrcweir RecoveryCore* pCore ) 746cdf0e10cSrcweir : IExtendedTabPage( pParent, SVX_RES( RID_SVXPAGE_DOCRECOVERY_SAVE ) ) 747cdf0e10cSrcweir , m_aTitleWin ( this , SVX_RES ( WIN_SAVE_TITLE ) ) 748cdf0e10cSrcweir , m_aTitleFT ( this , SVX_RES ( FT_SAVE_TITLE ) ) 749cdf0e10cSrcweir , m_aTitleFL ( this , SVX_RES ( FL_SAVE_TITLE ) ) 750cdf0e10cSrcweir , m_aDescrFT ( this , SVX_RES ( FT_SAVE_DESCR ) ) 751cdf0e10cSrcweir , m_aFileListFT ( this , SVX_RES ( FT_SAVE_FILELIST ) ) 752cdf0e10cSrcweir , m_aFileListLB ( this , SVX_RES ( LB_SAVE_FILELIST ) ) 753cdf0e10cSrcweir , m_aBottomFL ( this , SVX_RES ( FL_SAVE_BOTTOM ) ) 754cdf0e10cSrcweir , m_aOkBtn ( this , SVX_RES ( BT_SAVE_OK ) ) 755cdf0e10cSrcweir , m_pCore ( pCore ) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir FreeResource(); 758cdf0e10cSrcweir 759cdf0e10cSrcweir // Prepare the office for the following crash save step. 760*86e1cf34SPedro Giffuni // E.g. hide all open widows so the user can't influence our 761cdf0e10cSrcweir // operation .-) 762cdf0e10cSrcweir m_pCore->doEmergencySavePrepare(); 763cdf0e10cSrcweir 764cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 765cdf0e10cSrcweir Wallpaper aBackground(rStyleSettings.GetWindowColor()); 766cdf0e10cSrcweir m_aTitleWin.SetBackground(aBackground); 767cdf0e10cSrcweir m_aTitleFT.SetBackground (aBackground); 768cdf0e10cSrcweir 769cdf0e10cSrcweir Font aFont(m_aTitleFT.GetFont()); 770cdf0e10cSrcweir aFont.SetWeight(WEIGHT_BOLD); 771cdf0e10cSrcweir m_aTitleFT.SetFont(aFont); 772cdf0e10cSrcweir 773cdf0e10cSrcweir m_aOkBtn.SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) ); 774cdf0e10cSrcweir // m_aFileListLB.EnableInput( sal_False ); 775cdf0e10cSrcweir m_aFileListLB.SetControlBackground( rStyleSettings.GetDialogColor() ); 776cdf0e10cSrcweir 777cdf0e10cSrcweir // fill listbox with current open documents 778cdf0e10cSrcweir m_aFileListLB.Clear(); 779cdf0e10cSrcweir 780cdf0e10cSrcweir TURLList* pURLs = m_pCore->getURLListAccess(); 781cdf0e10cSrcweir TURLList::const_iterator pIt; 782cdf0e10cSrcweir 783cdf0e10cSrcweir for ( pIt = pURLs->begin(); 784cdf0e10cSrcweir pIt != pURLs->end() ; 785cdf0e10cSrcweir ++pIt ) 786cdf0e10cSrcweir { 787cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 788cdf0e10cSrcweir m_aFileListLB.InsertEntry( rInfo.DisplayName, rInfo.StandardImage ); 789cdf0e10cSrcweir } 790cdf0e10cSrcweir } 791cdf0e10cSrcweir 792cdf0e10cSrcweir //=============================================== 793cdf0e10cSrcweir SaveDialog::~SaveDialog() 794cdf0e10cSrcweir { 795cdf0e10cSrcweir } 796cdf0e10cSrcweir 797cdf0e10cSrcweir //=============================================== 798cdf0e10cSrcweir IMPL_LINK( SaveDialog, OKButtonHdl, void*, EMPTYARG ) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir m_nResult = DLG_RET_OK; 801cdf0e10cSrcweir return 0; 802cdf0e10cSrcweir } 803cdf0e10cSrcweir 804cdf0e10cSrcweir //=============================================== 805cdf0e10cSrcweir short SaveDialog::execute() 806cdf0e10cSrcweir { 807cdf0e10cSrcweir ::vos::OGuard aLock(Application::GetSolarMutex()); 808cdf0e10cSrcweir 809cdf0e10cSrcweir // wait for user input "OK" 810cdf0e10cSrcweir m_nResult = DLG_RET_UNKNOWN; 811cdf0e10cSrcweir while(m_nResult == DLG_RET_UNKNOWN) 812cdf0e10cSrcweir Application::Yield(); 813cdf0e10cSrcweir 814cdf0e10cSrcweir // start crash-save with progress 815cdf0e10cSrcweir if (m_nResult == DLG_RET_OK) 816cdf0e10cSrcweir { 817cdf0e10cSrcweir SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore); 818cdf0e10cSrcweir m_nResult = pProgress->Execute(); 819cdf0e10cSrcweir delete pProgress; 820cdf0e10cSrcweir } 821cdf0e10cSrcweir // if "CANCEL" => return "CANCEL" 822cdf0e10cSrcweir // if "OK" => "AUTOLUNCH" always ! 823cdf0e10cSrcweir if (m_nResult == DLG_RET_OK) 824cdf0e10cSrcweir m_nResult = DLG_RET_OK_AUTOLUNCH; 825cdf0e10cSrcweir 826cdf0e10cSrcweir return m_nResult; 827cdf0e10cSrcweir } 828cdf0e10cSrcweir 829cdf0e10cSrcweir //=============================================== 830cdf0e10cSrcweir void SaveDialog::setDefButton() 831cdf0e10cSrcweir { 832cdf0e10cSrcweir m_aOkBtn.GrabFocus(); 833cdf0e10cSrcweir } 834cdf0e10cSrcweir 835cdf0e10cSrcweir //=============================================== 836cdf0e10cSrcweir SaveProgressDialog::SaveProgressDialog(Window* pParent, 837cdf0e10cSrcweir RecoveryCore* pCore ) 838cdf0e10cSrcweir : ModalDialog ( pParent , SVX_RES( RID_SVX_MDLG_DOCRECOVERY_PROGR ) ) 839cdf0e10cSrcweir , m_aHintFT ( this , SVX_RES ( FT_SAVEPROGR_HINT ) ) 840cdf0e10cSrcweir , m_aProgrFT ( this , SVX_RES ( FT_SAVEPROGR_PROGR ) ) 841cdf0e10cSrcweir , m_aProgrParent( this , SVX_RES ( WIN_SAVEPROGR_PROGR ) ) 842cdf0e10cSrcweir , m_pCore ( pCore ) 843cdf0e10cSrcweir { 844cdf0e10cSrcweir FreeResource(); 845cdf0e10cSrcweir PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getSMGR() ); 846cdf0e10cSrcweir m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW); 847cdf0e10cSrcweir // m_aProgrBaseTxt = m_aProgrFT.GetText(); 848cdf0e10cSrcweir } 849cdf0e10cSrcweir 850cdf0e10cSrcweir //=============================================== 851cdf0e10cSrcweir SaveProgressDialog::~SaveProgressDialog() 852cdf0e10cSrcweir { 853cdf0e10cSrcweir } 854cdf0e10cSrcweir 855cdf0e10cSrcweir //=============================================== 856cdf0e10cSrcweir short SaveProgressDialog::Execute() 857cdf0e10cSrcweir { 858cdf0e10cSrcweir ::vos::OGuard aLock(Application::GetSolarMutex()); 859cdf0e10cSrcweir 860cdf0e10cSrcweir m_pCore->setProgressHandler(m_xProgress); 861cdf0e10cSrcweir m_pCore->setUpdateListener(this); 862cdf0e10cSrcweir m_pCore->doEmergencySave(); 863cdf0e10cSrcweir short nRet = ModalDialog::Execute(); 864cdf0e10cSrcweir m_pCore->setUpdateListener(0); 865cdf0e10cSrcweir return nRet; 866cdf0e10cSrcweir } 867cdf0e10cSrcweir 868cdf0e10cSrcweir //=============================================== 869cdf0e10cSrcweir void SaveProgressDialog::updateItems() 870cdf0e10cSrcweir { 871cdf0e10cSrcweir } 872cdf0e10cSrcweir 873cdf0e10cSrcweir //=============================================== 874cdf0e10cSrcweir void SaveProgressDialog::stepNext(TURLInfo* ) 875cdf0e10cSrcweir { 876cdf0e10cSrcweir /* TODO 877cdf0e10cSrcweir 878cdf0e10cSrcweir wenn die m_pCore noch ein Member m_nCurrentItem haette 879cdf0e10cSrcweir koennte man dort erkennen, wer gerade drann war, wer demnaechst 880cdf0e10cSrcweir dran ist ... Diese Info kann man dann in unserem Progress FixText anzeigen ... 881cdf0e10cSrcweir */ 882cdf0e10cSrcweir } 883cdf0e10cSrcweir 884cdf0e10cSrcweir //=============================================== 885cdf0e10cSrcweir void SaveProgressDialog::start() 886cdf0e10cSrcweir { 887cdf0e10cSrcweir } 888cdf0e10cSrcweir 889cdf0e10cSrcweir //=============================================== 890cdf0e10cSrcweir void SaveProgressDialog::end() 891cdf0e10cSrcweir { 892cdf0e10cSrcweir EndDialog(DLG_RET_OK); 893cdf0e10cSrcweir } 894cdf0e10cSrcweir 895cdf0e10cSrcweir //=============================================== 896cdf0e10cSrcweir RecovDocListEntry::RecovDocListEntry( SvLBoxEntry* pEntry, 897cdf0e10cSrcweir sal_uInt16 nFlags, 898cdf0e10cSrcweir const String& sText ) 899cdf0e10cSrcweir : SvLBoxString( pEntry, nFlags, sText ) 900cdf0e10cSrcweir { 901cdf0e10cSrcweir } 902cdf0e10cSrcweir 903cdf0e10cSrcweir //=============================================== 904cdf0e10cSrcweir void RecovDocListEntry::Paint(const Point& aPos , 905cdf0e10cSrcweir SvLBox& aDevice, 906cdf0e10cSrcweir sal_uInt16 /*nFlags */, 907cdf0e10cSrcweir SvLBoxEntry* pEntry ) 908cdf0e10cSrcweir { 909cdf0e10cSrcweir const Image* pImg = 0; 910cdf0e10cSrcweir const String* pTxt = 0; 911cdf0e10cSrcweir RecovDocList* pList = static_cast< RecovDocList* >(&aDevice); 912cdf0e10cSrcweir 913cdf0e10cSrcweir sal_Bool bHC = aDevice.GetSettings().GetStyleSettings().GetHighContrastMode(); 914cdf0e10cSrcweir 915cdf0e10cSrcweir TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData(); 916cdf0e10cSrcweir switch(pInfo->RecoveryState) 917cdf0e10cSrcweir { 918cdf0e10cSrcweir case E_SUCCESSFULLY_RECOVERED : 919cdf0e10cSrcweir { 920cdf0e10cSrcweir pImg = &pList->m_aGreenCheckImg; 921cdf0e10cSrcweir if (bHC) 922cdf0e10cSrcweir pImg = &pList->m_aGreenCheckImgHC; 923cdf0e10cSrcweir pTxt = &pList->m_aSuccessRecovStr; 924cdf0e10cSrcweir } 925cdf0e10cSrcweir break; 926cdf0e10cSrcweir 927cdf0e10cSrcweir case E_ORIGINAL_DOCUMENT_RECOVERED : // TODO must be renamed into ORIGINAL DOCUMENT recovered! Because its marked as yellow 928cdf0e10cSrcweir { 929cdf0e10cSrcweir pImg = &pList->m_aYellowCheckImg; 930cdf0e10cSrcweir if (bHC) 931cdf0e10cSrcweir pImg = &pList->m_aYellowCheckImgHC; 932cdf0e10cSrcweir pTxt = &pList->m_aOrigDocRecovStr; 933cdf0e10cSrcweir } 934cdf0e10cSrcweir break; 935cdf0e10cSrcweir 936cdf0e10cSrcweir case E_RECOVERY_FAILED : 937cdf0e10cSrcweir { 938cdf0e10cSrcweir pImg = &pList->m_aRedCrossImg; 939cdf0e10cSrcweir if (bHC) 940cdf0e10cSrcweir pImg = &pList->m_aRedCrossImgHC; 941cdf0e10cSrcweir pTxt = &pList->m_aRecovFailedStr; 942cdf0e10cSrcweir } 943cdf0e10cSrcweir break; 944cdf0e10cSrcweir 945cdf0e10cSrcweir case E_RECOVERY_IS_IN_PROGRESS : 946cdf0e10cSrcweir { 947cdf0e10cSrcweir pImg = 0; 948cdf0e10cSrcweir pTxt = &pList->m_aRecovInProgrStr; 949cdf0e10cSrcweir } 950cdf0e10cSrcweir break; 951cdf0e10cSrcweir 952cdf0e10cSrcweir case E_NOT_RECOVERED_YET : 953cdf0e10cSrcweir { 954cdf0e10cSrcweir pImg = 0; 955cdf0e10cSrcweir pTxt = &pList->m_aNotRecovYetStr; 956cdf0e10cSrcweir } 957cdf0e10cSrcweir break; 958cdf0e10cSrcweir } 959cdf0e10cSrcweir 960cdf0e10cSrcweir if (pImg) 961cdf0e10cSrcweir aDevice.DrawImage(aPos, *pImg); 962cdf0e10cSrcweir 963cdf0e10cSrcweir if (pTxt) 964cdf0e10cSrcweir { 965cdf0e10cSrcweir ::rtl::OUString sT1(*pTxt); 966cdf0e10cSrcweir 967cdf0e10cSrcweir Point aPnt(aPos); 968cdf0e10cSrcweir aPnt.X() += pList->m_aGreenCheckImg.GetSizePixel().Width(); 969cdf0e10cSrcweir aPnt.X() += 10; 970cdf0e10cSrcweir aDevice.DrawText(aPnt, *pTxt); 971cdf0e10cSrcweir } 972cdf0e10cSrcweir } 973cdf0e10cSrcweir //=============================================== 974cdf0e10cSrcweir RecovDocList::RecovDocList( Window* pParent, 975cdf0e10cSrcweir const ResId& rResId ) 976cdf0e10cSrcweir : SvxSimpleTable ( pParent, rResId ) 977cdf0e10cSrcweir , m_aGreenCheckImg ( ResId(IMG_GREENCHECK,*rResId.GetResMgr() ) ) 978cdf0e10cSrcweir , m_aYellowCheckImg ( ResId(IMG_YELLOWCHECK,*rResId.GetResMgr() ) ) 979cdf0e10cSrcweir , m_aRedCrossImg ( ResId(IMG_REDCROSS,*rResId.GetResMgr() ) ) 980cdf0e10cSrcweir , m_aGreenCheckImgHC ( ResId(IMG_GREENCHECK_HC,*rResId.GetResMgr() ) ) 981cdf0e10cSrcweir , m_aYellowCheckImgHC ( ResId(IMG_YELLOWCHECK_HC,*rResId.GetResMgr() ) ) 982cdf0e10cSrcweir , m_aRedCrossImgHC ( ResId(IMG_REDCROSS_HC,*rResId.GetResMgr() ) ) 983cdf0e10cSrcweir , m_aSuccessRecovStr ( ResId(STR_SUCCESSRECOV,*rResId.GetResMgr() ) ) 984cdf0e10cSrcweir , m_aOrigDocRecovStr ( ResId(STR_ORIGDOCRECOV,*rResId.GetResMgr() ) ) 985cdf0e10cSrcweir , m_aRecovFailedStr ( ResId(STR_RECOVFAILED,*rResId.GetResMgr() ) ) 986cdf0e10cSrcweir , m_aRecovInProgrStr ( ResId(STR_RECOVINPROGR,*rResId.GetResMgr() ) ) 987cdf0e10cSrcweir , m_aNotRecovYetStr ( ResId(STR_NOTRECOVYET,*rResId.GetResMgr() ) ) 988cdf0e10cSrcweir { 989cdf0e10cSrcweir //SetEntryHeight( short( maGreenCheckImg.GetSizePixel().Height() ) ); 990cdf0e10cSrcweir } 991cdf0e10cSrcweir 992cdf0e10cSrcweir //=============================================== 993cdf0e10cSrcweir RecovDocList::~RecovDocList() 994cdf0e10cSrcweir { 995cdf0e10cSrcweir } 996cdf0e10cSrcweir 997cdf0e10cSrcweir //=============================================== 998cdf0e10cSrcweir void RecovDocList::InitEntry( SvLBoxEntry* pEntry , 999cdf0e10cSrcweir const XubString& sText , 1000cdf0e10cSrcweir const Image& aImage1, 1001cdf0e10cSrcweir const Image& aImage2, 1002cdf0e10cSrcweir SvLBoxButtonKind eButtonKind) 1003cdf0e10cSrcweir { 1004cdf0e10cSrcweir SvTabListBox::InitEntry(pEntry, sText, aImage1, aImage2, eButtonKind); 1005cdf0e10cSrcweir DBG_ASSERT( TabCount() == 2, "*RecovDocList::InitEntry(): structure missmatch" ); 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem(2); 1008cdf0e10cSrcweir RecovDocListEntry* p = new RecovDocListEntry(pEntry, 0, pCol->GetText()); 1009cdf0e10cSrcweir pEntry->ReplaceItem(p, 2); 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir 1012cdf0e10cSrcweir //=============================================== 1013cdf0e10cSrcweir short impl_askUserForWizardCancel(Window* pParent, sal_Int16 nRes) 1014cdf0e10cSrcweir { 1015cdf0e10cSrcweir QueryBox aQuery(pParent, SVX_RES(nRes)); 1016cdf0e10cSrcweir if (aQuery.Execute() == RET_YES) 1017cdf0e10cSrcweir return DLG_RET_OK; 1018cdf0e10cSrcweir else 1019cdf0e10cSrcweir return DLG_RET_CANCEL; 1020cdf0e10cSrcweir } 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir //=============================================== 1023cdf0e10cSrcweir RecoveryDialog::RecoveryDialog(Window* pParent, 1024cdf0e10cSrcweir RecoveryCore* pCore ) 1025cdf0e10cSrcweir : IExtendedTabPage( pParent , SVX_RES( RID_SVXPAGE_DOCRECOVERY_RECOVER ) ) 1026cdf0e10cSrcweir , m_aTitleWin ( this , SVX_RES ( WIN_RECOV_TITLE ) ) 1027cdf0e10cSrcweir , m_aTitleFT ( this , SVX_RES ( FT_RECOV_TITLE ) ) 1028cdf0e10cSrcweir , m_aTitleFL ( this , SVX_RES ( FL_RECOV_TITLE ) ) 1029cdf0e10cSrcweir , m_aDescrFT ( this , SVX_RES ( FT_RECOV_DESCR ) ) 1030cdf0e10cSrcweir , m_aProgressFT ( this , SVX_RES ( FT_RECOV_PROGR ) ) 1031cdf0e10cSrcweir , m_aProgrParent ( this , SVX_RES ( WIN_RECOV_PROGR ) ) 1032cdf0e10cSrcweir , m_aFileListFT ( this , SVX_RES ( FT_RECOV_FILELIST ) ) 1033cdf0e10cSrcweir , m_aFileListLB ( this , SVX_RES ( LB_RECOV_FILELIST ) ) 1034cdf0e10cSrcweir , m_aBottomFL ( this , SVX_RES ( FL_RECOV_BOTTOM ) ) 1035cdf0e10cSrcweir , m_aNextBtn ( this , SVX_RES ( BTN_RECOV_NEXT ) ) 1036cdf0e10cSrcweir , m_aCancelBtn ( this , SVX_RES ( BTN_RECOV_CANCEL ) ) 1037cdf0e10cSrcweir , m_aNextStr ( SVX_RES ( STR_RECOVERY_NEXT ) ) 1038cdf0e10cSrcweir , m_aTitleRecoveryInProgress( SVX_RES ( STR_RECOVERY_INPROGRESS ) ) 1039cdf0e10cSrcweir , m_aTitleRecoveryReport( SVX_RES ( STR_RECOVERY_REPORT ) ) 1040cdf0e10cSrcweir , m_aRecoveryOnlyFinish ( SVX_RES ( STR_RECOVERYONLY_FINISH ) ) 1041cdf0e10cSrcweir , m_aRecoveryOnlyFinishDescr( SVX_RES ( STR_RECOVERYONLY_FINISH_DESCR ) ) 1042cdf0e10cSrcweir , m_pDefButton ( NULL ) 1043cdf0e10cSrcweir , m_pCore ( pCore ) 1044cdf0e10cSrcweir , m_eRecoveryState (RecoveryDialog::E_RECOVERY_PREPARED) 1045cdf0e10cSrcweir , m_bWaitForUser (sal_False) 1046cdf0e10cSrcweir , m_bWaitForCore (sal_False) 1047cdf0e10cSrcweir , m_bUserDecideNext (sal_False) 1048cdf0e10cSrcweir , m_bWasRecoveryStarted (sal_False) 1049cdf0e10cSrcweir , m_bRecoveryOnly (sal_False) 1050cdf0e10cSrcweir { 1051cdf0e10cSrcweir static long nTabs[] = { 2, 0, 40*RECOV_CONTROLWIDTH/100 }; 1052cdf0e10cSrcweir m_aFileListLB.SetTabs( &nTabs[0] ); 1053cdf0e10cSrcweir m_aFileListLB.InsertHeaderEntry( String( SVX_RES( STR_HEADERBAR ) ) ); 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir FreeResource(); 1056cdf0e10cSrcweir 1057cdf0e10cSrcweir ::rtl::OUString CFG_PACKAGE_RECOVERY( RTL_CONSTASCII_USTRINGPARAM ( "org.openoffice.Office.Recovery/" )); 1058cdf0e10cSrcweir ::rtl::OUString CFG_PATH_CRASHREPORTER( RTL_CONSTASCII_USTRINGPARAM( "CrashReporter" )); 1059cdf0e10cSrcweir ::rtl::OUString CFG_ENTRY_ENABLED( RTL_CONSTASCII_USTRINGPARAM ( "Enabled" )); 1060cdf0e10cSrcweir 1061cdf0e10cSrcweir sal_Bool bCrashRepEnabled( sal_True ); 1062cdf0e10cSrcweir css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( 1063cdf0e10cSrcweir pCore->getSMGR(), 1064cdf0e10cSrcweir CFG_PACKAGE_RECOVERY, 1065cdf0e10cSrcweir CFG_PATH_CRASHREPORTER, 1066cdf0e10cSrcweir CFG_ENTRY_ENABLED, 1067cdf0e10cSrcweir ::comphelper::ConfigurationHelper::E_READONLY); 1068cdf0e10cSrcweir aVal >>= bCrashRepEnabled; 1069cdf0e10cSrcweir m_bRecoveryOnly = !bCrashRepEnabled; 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getSMGR() ); 1072cdf0e10cSrcweir m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW); 1073cdf0e10cSrcweir 1074cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 1075cdf0e10cSrcweir Wallpaper aBackground( rStyleSettings.GetWindowColor() ); 1076cdf0e10cSrcweir m_aTitleWin.SetBackground(aBackground); 1077cdf0e10cSrcweir m_aTitleFT.SetBackground (aBackground); 1078cdf0e10cSrcweir 1079cdf0e10cSrcweir Font aFont(m_aTitleFT.GetFont()); 1080cdf0e10cSrcweir aFont.SetWeight(WEIGHT_BOLD); 1081cdf0e10cSrcweir m_aTitleFT.SetFont(aFont); 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir m_aFileListLB.SetBackground( rStyleSettings.GetDialogColor() ); 1084cdf0e10cSrcweir 1085cdf0e10cSrcweir m_aNextBtn.Enable(sal_True); 1086cdf0e10cSrcweir m_aNextBtn.SetClickHdl( LINK( this, RecoveryDialog, NextButtonHdl ) ); 1087cdf0e10cSrcweir m_aCancelBtn.SetClickHdl( LINK( this, RecoveryDialog, CancelButtonHdl ) ); 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir // fill list box first time 1090cdf0e10cSrcweir TURLList* pURLList = m_pCore->getURLListAccess(); 1091cdf0e10cSrcweir TURLList::const_iterator pIt; 1092cdf0e10cSrcweir for ( pIt = pURLList->begin(); 1093cdf0e10cSrcweir pIt != pURLList->end() ; 1094cdf0e10cSrcweir ++pIt ) 1095cdf0e10cSrcweir { 1096cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 1097cdf0e10cSrcweir 1098cdf0e10cSrcweir String sName( rInfo.DisplayName ); 1099cdf0e10cSrcweir sName += '\t'; 1100cdf0e10cSrcweir sName += impl_getStatusString( rInfo ); 1101cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aFileListLB.InsertEntry(sName, rInfo.StandardImage, rInfo.StandardImage); 1102cdf0e10cSrcweir pEntry->SetUserData((void*)&rInfo); 1103cdf0e10cSrcweir m_aFileListLB.SetExpandedEntryBmp (pEntry, rInfo.HCImage, BMP_COLOR_HIGHCONTRAST); 1104cdf0e10cSrcweir m_aFileListLB.SetCollapsedEntryBmp(pEntry, rInfo.HCImage, BMP_COLOR_HIGHCONTRAST); 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir 1107cdf0e10cSrcweir // mark first item 1108cdf0e10cSrcweir SvLBoxEntry* pFirst = m_aFileListLB.First(); 1109cdf0e10cSrcweir if (pFirst) 1110cdf0e10cSrcweir m_aFileListLB.SetCursor(pFirst, sal_True); 1111cdf0e10cSrcweir } 1112cdf0e10cSrcweir 1113cdf0e10cSrcweir //=============================================== 1114cdf0e10cSrcweir RecoveryDialog::~RecoveryDialog() 1115cdf0e10cSrcweir { 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir 1118cdf0e10cSrcweir //=============================================== 1119cdf0e10cSrcweir short RecoveryDialog::execute() 1120cdf0e10cSrcweir { 1121cdf0e10cSrcweir ::vos::OGuard aSolarLock(Application::GetSolarMutex()); 1122cdf0e10cSrcweir 1123cdf0e10cSrcweir switch(m_eRecoveryState) 1124cdf0e10cSrcweir { 1125cdf0e10cSrcweir case RecoveryDialog::E_RECOVERY_PREPARED : 1126cdf0e10cSrcweir { 1127cdf0e10cSrcweir // Dialog was started first time ... 1128cdf0e10cSrcweir // wait for user decision ("start" or "cancel" recovery) 1129cdf0e10cSrcweir // This decision will be made inside the NextBtn handler. 1130cdf0e10cSrcweir m_aNextBtn.Enable(sal_True); 1131cdf0e10cSrcweir m_aCancelBtn.Enable(sal_True); 1132cdf0e10cSrcweir m_bWaitForUser = sal_True; 1133cdf0e10cSrcweir while(m_bWaitForUser) 1134cdf0e10cSrcweir Application::Yield(); 1135cdf0e10cSrcweir if (m_bUserDecideNext) 1136cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_IN_PROGRESS; 1137cdf0e10cSrcweir else 1138cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED; 1139cdf0e10cSrcweir return execute(); 1140cdf0e10cSrcweir } 1141cdf0e10cSrcweir 1142cdf0e10cSrcweir case RecoveryDialog::E_RECOVERY_IN_PROGRESS : 1143cdf0e10cSrcweir { 1144cdf0e10cSrcweir // user decided to start recovery ... 1145cdf0e10cSrcweir m_bWasRecoveryStarted = sal_True; 1146cdf0e10cSrcweir // do it asynchronous (to allow repaints) 1147cdf0e10cSrcweir // and wait for this asynchronous operation. 1148cdf0e10cSrcweir m_aDescrFT.SetText( m_aTitleRecoveryInProgress ); 1149cdf0e10cSrcweir m_aNextBtn.Enable(sal_False); 1150cdf0e10cSrcweir m_aCancelBtn.Enable(sal_False); 1151cdf0e10cSrcweir m_pCore->setProgressHandler(m_xProgress); 1152cdf0e10cSrcweir m_pCore->setUpdateListener(this); 1153cdf0e10cSrcweir m_pCore->doRecovery(); 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir m_bWaitForCore = sal_True; 1156cdf0e10cSrcweir while(m_bWaitForCore) 1157cdf0e10cSrcweir Application::Yield(); 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir m_pCore->setUpdateListener(0); 1160cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_CORE_DONE; 1161cdf0e10cSrcweir return execute(); 1162cdf0e10cSrcweir } 1163cdf0e10cSrcweir 1164cdf0e10cSrcweir case RecoveryDialog::E_RECOVERY_CORE_DONE : 1165cdf0e10cSrcweir { 1166cdf0e10cSrcweir // the core finished it's task. 1167cdf0e10cSrcweir // let the user decide the next step. 1168cdf0e10cSrcweir if ( m_bRecoveryOnly ) 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir m_aDescrFT.SetText(m_aRecoveryOnlyFinishDescr); 1171cdf0e10cSrcweir m_aNextBtn.SetText(m_aRecoveryOnlyFinish); 1172cdf0e10cSrcweir m_aNextBtn.Enable(sal_True); 1173cdf0e10cSrcweir m_aCancelBtn.Enable(sal_False); 1174cdf0e10cSrcweir } 1175cdf0e10cSrcweir else 1176cdf0e10cSrcweir { 1177cdf0e10cSrcweir m_aDescrFT.SetText(m_aTitleRecoveryReport); 1178cdf0e10cSrcweir m_aNextBtn.SetText(m_aNextStr); 1179cdf0e10cSrcweir m_aNextBtn.Enable(sal_True); 1180cdf0e10cSrcweir m_aCancelBtn.Enable(sal_True); 1181cdf0e10cSrcweir } 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir m_bWaitForUser = sal_True; 1184cdf0e10cSrcweir while(m_bWaitForUser) 1185cdf0e10cSrcweir Application::Yield(); 1186cdf0e10cSrcweir 1187cdf0e10cSrcweir if (m_bUserDecideNext) 1188cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_DONE; 1189cdf0e10cSrcweir else 1190cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED; 1191cdf0e10cSrcweir return execute(); 1192cdf0e10cSrcweir } 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir case RecoveryDialog::E_RECOVERY_DONE : 1195cdf0e10cSrcweir { 1196cdf0e10cSrcweir // All documents was reovered. 1197cdf0e10cSrcweir // User decided to step to the "next" wizard page. 1198cdf0e10cSrcweir // Do it ... but check first, if there exist some 1199cdf0e10cSrcweir // failed recovery documents. They must be saved to 1200cdf0e10cSrcweir // a user selected directrory. 1201cdf0e10cSrcweir short nRet = DLG_RET_UNKNOWN; 1202cdf0e10cSrcweir BrokenRecoveryDialog* pBrokenRecoveryDialog = new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted); 1203cdf0e10cSrcweir String sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default dir 1204cdf0e10cSrcweir if (pBrokenRecoveryDialog->isExecutionNeeded()) 1205cdf0e10cSrcweir { 1206cdf0e10cSrcweir nRet = pBrokenRecoveryDialog->Execute(); 1207cdf0e10cSrcweir sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); 1208cdf0e10cSrcweir } 1209cdf0e10cSrcweir delete pBrokenRecoveryDialog; 1210cdf0e10cSrcweir 1211cdf0e10cSrcweir switch(nRet) 1212cdf0e10cSrcweir { 1213cdf0e10cSrcweir // no broken temp files exists 1214cdf0e10cSrcweir // step to the next wizard page 1215cdf0e10cSrcweir case DLG_RET_UNKNOWN : 1216cdf0e10cSrcweir { 1217cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED; 1218cdf0e10cSrcweir return DLG_RET_OK; 1219cdf0e10cSrcweir } 1220cdf0e10cSrcweir 1221cdf0e10cSrcweir // user decided to save the broken temp files 1222cdf0e10cSrcweir // do and forget it 1223cdf0e10cSrcweir // step to the next wizard page 1224cdf0e10cSrcweir case DLG_RET_OK : 1225cdf0e10cSrcweir { 1226cdf0e10cSrcweir m_pCore->saveBrokenTempEntries(sSaveDir); 1227cdf0e10cSrcweir m_pCore->forgetBrokenTempEntries(); 1228cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED; 1229cdf0e10cSrcweir return DLG_RET_OK; 1230cdf0e10cSrcweir } 1231cdf0e10cSrcweir 1232cdf0e10cSrcweir // user decided to ignore broken temp files. 1233cdf0e10cSrcweir // Ask it again ... may be this decision was wrong. 1234cdf0e10cSrcweir // Results: 1235cdf0e10cSrcweir // IGNORE => remove broken temp files 1236cdf0e10cSrcweir // => step to the next wizard page 1237cdf0e10cSrcweir // CANCEL => step back to the recovery page 1238cdf0e10cSrcweir case DLG_RET_CANCEL : 1239cdf0e10cSrcweir { 1240cdf0e10cSrcweir // TODO ask user ... 1241cdf0e10cSrcweir m_pCore->forgetBrokenTempEntries(); 1242cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED; 1243cdf0e10cSrcweir return DLG_RET_OK; 1244cdf0e10cSrcweir } 1245cdf0e10cSrcweir } 1246cdf0e10cSrcweir 1247cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED; 1248cdf0e10cSrcweir return DLG_RET_OK; 1249cdf0e10cSrcweir } 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir case RecoveryDialog::E_RECOVERY_CANCELED : 1252cdf0e10cSrcweir { 1253cdf0e10cSrcweir // "YES" => break recovery 1254cdf0e10cSrcweir // But there exist different states, where "cancel" can be called. 1255cdf0e10cSrcweir // Handle it different. 1256cdf0e10cSrcweir if (m_bWasRecoveryStarted) 1257cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED_AFTERWARDS; 1258cdf0e10cSrcweir else 1259cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED_BEFORE; 1260cdf0e10cSrcweir return execute(); 1261cdf0e10cSrcweir } 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir case RecoveryDialog::E_RECOVERY_CANCELED_BEFORE : 1264cdf0e10cSrcweir case RecoveryDialog::E_RECOVERY_CANCELED_AFTERWARDS : 1265cdf0e10cSrcweir { 1266cdf0e10cSrcweir // We have to check if there exists some temp. files. 1267cdf0e10cSrcweir // They should be saved to a user defined location. 1268cdf0e10cSrcweir // If no temp files exists or user decided to ignore it ... 1269cdf0e10cSrcweir // we have to remove all recovery/session data anyway! 1270cdf0e10cSrcweir short nRet = DLG_RET_UNKNOWN; 1271cdf0e10cSrcweir BrokenRecoveryDialog* pBrokenRecoveryDialog = new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted); 1272cdf0e10cSrcweir String sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default save location 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir // dialog itself checks if there is a need to copy files for this mode. 1275cdf0e10cSrcweir // It uses the information m_bWasRecoveryStarted doing so. 1276cdf0e10cSrcweir if (pBrokenRecoveryDialog->isExecutionNeeded()) 1277cdf0e10cSrcweir { 1278cdf0e10cSrcweir nRet = pBrokenRecoveryDialog->Execute(); 1279cdf0e10cSrcweir sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); 1280cdf0e10cSrcweir } 1281cdf0e10cSrcweir delete pBrokenRecoveryDialog; 1282cdf0e10cSrcweir 1283cdf0e10cSrcweir // Possible states: 1284cdf0e10cSrcweir // a) nRet == DLG_RET_UNKNOWN 1285cdf0e10cSrcweir // dialog was not shown ... 1286cdf0e10cSrcweir // because there exists no temp file for copy. 1287cdf0e10cSrcweir // => remove all recovery data 1288cdf0e10cSrcweir // b) nRet == DLG_RET_OK 1289cdf0e10cSrcweir // dialog was shown ... 1290cdf0e10cSrcweir // user decided to save temp files 1291cdf0e10cSrcweir // => save all OR broken temp files (depends from the time, where cancel was called) 1292cdf0e10cSrcweir // => remove all recovery data 1293cdf0e10cSrcweir // c) nRet == DLG_RET_CANCEL 1294cdf0e10cSrcweir // dialog was shown ... 1295cdf0e10cSrcweir // user decided to ignore temp files 1296cdf0e10cSrcweir // => remove all recovery data 1297cdf0e10cSrcweir // => a)/c) are the same ... b) has one additional operation 1298cdf0e10cSrcweir 1299cdf0e10cSrcweir // b) 1300cdf0e10cSrcweir if (nRet == DLG_RET_OK) 1301cdf0e10cSrcweir { 1302cdf0e10cSrcweir if (m_bWasRecoveryStarted) 1303cdf0e10cSrcweir m_pCore->saveBrokenTempEntries(sSaveDir); 1304cdf0e10cSrcweir else 1305cdf0e10cSrcweir m_pCore->saveAllTempEntries(sSaveDir); 1306cdf0e10cSrcweir } 1307cdf0e10cSrcweir 1308cdf0e10cSrcweir // a,b,c) 1309cdf0e10cSrcweir if (m_bWasRecoveryStarted) 1310cdf0e10cSrcweir m_pCore->forgetBrokenRecoveryEntries(); 1311cdf0e10cSrcweir else 1312cdf0e10cSrcweir m_pCore->forgetAllRecoveryEntries(); 1313cdf0e10cSrcweir m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED; 1314cdf0e10cSrcweir 1315cdf0e10cSrcweir // THERE IS NO WAY BACK. see impl_askUserForWizardCancel()! 1316cdf0e10cSrcweir return DLG_RET_CANCEL; 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir 1319cdf0e10cSrcweir case RecoveryDialog::E_RECOVERY_HANDLED : 1320cdf0e10cSrcweir { 1321cdf0e10cSrcweir m_bWaitForUser = sal_True; 1322cdf0e10cSrcweir while(m_bWaitForUser) 1323cdf0e10cSrcweir Application::Yield(); 1324cdf0e10cSrcweir 1325cdf0e10cSrcweir // TODO: show BrokenRecoveryDialog again, ift he user 1326*86e1cf34SPedro Giffuni // doesn't accepted it last time. 1327cdf0e10cSrcweir 1328cdf0e10cSrcweir if (m_bUserDecideNext) 1329cdf0e10cSrcweir return DLG_RET_OK; 1330cdf0e10cSrcweir else 1331cdf0e10cSrcweir return DLG_RET_CANCEL; 1332cdf0e10cSrcweir } 1333cdf0e10cSrcweir } 1334cdf0e10cSrcweir 1335cdf0e10cSrcweir // should never be reached .-) 1336cdf0e10cSrcweir DBG_ERROR("Should never be reached!"); 1337cdf0e10cSrcweir return DLG_RET_OK; 1338cdf0e10cSrcweir } 1339cdf0e10cSrcweir 1340cdf0e10cSrcweir //=============================================== 1341cdf0e10cSrcweir void RecoveryDialog::setDefButton() 1342cdf0e10cSrcweir { 1343cdf0e10cSrcweir if ( m_aNextBtn.IsEnabled() ) 1344cdf0e10cSrcweir m_aNextBtn.GrabFocus(); 1345cdf0e10cSrcweir else 1346cdf0e10cSrcweir m_pDefButton = &m_aNextBtn; 1347cdf0e10cSrcweir } 1348cdf0e10cSrcweir 1349cdf0e10cSrcweir //=============================================== 1350cdf0e10cSrcweir void RecoveryDialog::start() 1351cdf0e10cSrcweir { 1352cdf0e10cSrcweir } 1353cdf0e10cSrcweir 1354cdf0e10cSrcweir //=============================================== 1355cdf0e10cSrcweir void RecoveryDialog::updateItems() 1356cdf0e10cSrcweir { 1357cdf0e10cSrcweir sal_uIntPtr c = m_aFileListLB.GetEntryCount(); 1358cdf0e10cSrcweir sal_uIntPtr i = 0; 1359cdf0e10cSrcweir for ( i=0; i<c; ++i ) 1360cdf0e10cSrcweir { 1361cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aFileListLB.GetEntry(i); 1362cdf0e10cSrcweir if ( !pEntry ) 1363cdf0e10cSrcweir continue; 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData(); 1366cdf0e10cSrcweir if ( !pInfo ) 1367cdf0e10cSrcweir continue; 1368cdf0e10cSrcweir 1369cdf0e10cSrcweir String sStatus = impl_getStatusString( *pInfo ); 1370cdf0e10cSrcweir if ( sStatus.Len() > 0 ) 1371cdf0e10cSrcweir m_aFileListLB.SetEntryText( sStatus, pEntry, 1 ); 1372cdf0e10cSrcweir } 1373cdf0e10cSrcweir 1374cdf0e10cSrcweir m_aFileListLB.Invalidate(); 1375cdf0e10cSrcweir m_aFileListLB.Update(); 1376cdf0e10cSrcweir } 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir //=============================================== 1379cdf0e10cSrcweir void RecoveryDialog::stepNext(TURLInfo* pItem) 1380cdf0e10cSrcweir { 1381cdf0e10cSrcweir sal_uIntPtr c = m_aFileListLB.GetEntryCount(); 1382cdf0e10cSrcweir sal_uIntPtr i = 0; 1383cdf0e10cSrcweir for (i=0; i<c; ++i) 1384cdf0e10cSrcweir { 1385cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aFileListLB.GetEntry(i); 1386cdf0e10cSrcweir if (!pEntry) 1387cdf0e10cSrcweir continue; 1388cdf0e10cSrcweir 1389cdf0e10cSrcweir TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData(); 1390cdf0e10cSrcweir if (pInfo->ID != pItem->ID) 1391cdf0e10cSrcweir continue; 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir m_aFileListLB.SetCursor(pEntry, sal_True); 1394cdf0e10cSrcweir m_aFileListLB.MakeVisible(pEntry); 1395cdf0e10cSrcweir m_aFileListLB.Invalidate(); 1396cdf0e10cSrcweir m_aFileListLB.Update(); 1397cdf0e10cSrcweir break; 1398cdf0e10cSrcweir } 1399cdf0e10cSrcweir } 1400cdf0e10cSrcweir 1401cdf0e10cSrcweir //=============================================== 1402cdf0e10cSrcweir void RecoveryDialog::end() 1403cdf0e10cSrcweir { 1404cdf0e10cSrcweir if ( m_pDefButton ) 1405cdf0e10cSrcweir { 1406cdf0e10cSrcweir m_pDefButton->GrabFocus(); 1407cdf0e10cSrcweir m_pDefButton = NULL; 1408cdf0e10cSrcweir } 1409cdf0e10cSrcweir m_bWaitForCore = sal_False; 1410cdf0e10cSrcweir } 1411cdf0e10cSrcweir 1412cdf0e10cSrcweir //=============================================== 1413cdf0e10cSrcweir IMPL_LINK( RecoveryDialog, NextButtonHdl, void*, EMPTYARG ) 1414cdf0e10cSrcweir { 1415cdf0e10cSrcweir m_bUserDecideNext = sal_True; 1416cdf0e10cSrcweir m_bWaitForUser = sal_False; 1417cdf0e10cSrcweir return 0; 1418cdf0e10cSrcweir } 1419cdf0e10cSrcweir 1420cdf0e10cSrcweir //=============================================== 1421cdf0e10cSrcweir IMPL_LINK( RecoveryDialog, CancelButtonHdl, void*, EMPTYARG ) 1422cdf0e10cSrcweir { 1423cdf0e10cSrcweir if (m_eRecoveryState == RecoveryDialog::E_RECOVERY_PREPARED) 1424cdf0e10cSrcweir { 1425cdf0e10cSrcweir if (impl_askUserForWizardCancel(this, RID_SVXQB_EXIT_RECOVERY) == DLG_RET_CANCEL) 1426cdf0e10cSrcweir return 0; 1427cdf0e10cSrcweir } 1428cdf0e10cSrcweir m_bUserDecideNext = sal_False; 1429cdf0e10cSrcweir m_bWaitForUser = sal_False; 1430cdf0e10cSrcweir return 0; 1431cdf0e10cSrcweir } 1432cdf0e10cSrcweir 1433cdf0e10cSrcweir //=============================================== 1434cdf0e10cSrcweir void RecoveryDialog::impl_refreshDocList() 1435cdf0e10cSrcweir { 1436cdf0e10cSrcweir } 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir //=============================================== 1439cdf0e10cSrcweir String RecoveryDialog::impl_getStatusString( const TURLInfo& rInfo ) const 1440cdf0e10cSrcweir { 1441cdf0e10cSrcweir String sStatus; 1442cdf0e10cSrcweir switch ( rInfo.RecoveryState ) 1443cdf0e10cSrcweir { 1444cdf0e10cSrcweir case E_SUCCESSFULLY_RECOVERED : 1445cdf0e10cSrcweir sStatus = m_aFileListLB.m_aSuccessRecovStr; 1446cdf0e10cSrcweir break; 1447cdf0e10cSrcweir case E_ORIGINAL_DOCUMENT_RECOVERED : 1448cdf0e10cSrcweir sStatus = m_aFileListLB.m_aOrigDocRecovStr; 1449cdf0e10cSrcweir break; 1450cdf0e10cSrcweir case E_RECOVERY_FAILED : 1451cdf0e10cSrcweir sStatus = m_aFileListLB.m_aRecovFailedStr; 1452cdf0e10cSrcweir break; 1453cdf0e10cSrcweir case E_RECOVERY_IS_IN_PROGRESS : 1454cdf0e10cSrcweir sStatus = m_aFileListLB.m_aRecovInProgrStr; 1455cdf0e10cSrcweir break; 1456cdf0e10cSrcweir case E_NOT_RECOVERED_YET : 1457cdf0e10cSrcweir sStatus = m_aFileListLB.m_aNotRecovYetStr; 1458cdf0e10cSrcweir break; 1459cdf0e10cSrcweir default: 1460cdf0e10cSrcweir break; 1461cdf0e10cSrcweir } 1462cdf0e10cSrcweir return sStatus; 1463cdf0e10cSrcweir } 1464cdf0e10cSrcweir 1465cdf0e10cSrcweir //=============================================== 1466cdf0e10cSrcweir BrokenRecoveryDialog::BrokenRecoveryDialog(Window* pParent , 1467cdf0e10cSrcweir RecoveryCore* pCore , 1468cdf0e10cSrcweir sal_Bool bBeforeRecovery) 1469cdf0e10cSrcweir : ModalDialog ( pParent, SVX_RES( RID_SVX_MDLG_DOCRECOVERY_BROKEN ) ) 1470cdf0e10cSrcweir , m_aDescrFT ( this , SVX_RES( FT_BROKEN_DESCR ) ) 1471cdf0e10cSrcweir , m_aFileListFT ( this , SVX_RES( FT_BROKEN_FILELIST ) ) 1472cdf0e10cSrcweir , m_aFileListLB ( this , SVX_RES( LB_BROKEN_FILELIST ) ) 1473cdf0e10cSrcweir , m_aSaveDirFT ( this , SVX_RES( FT_BROKEN_SAVEDIR ) ) 1474cdf0e10cSrcweir , m_aSaveDirED ( this , SVX_RES( ED_BROKEN_SAVEDIR ) ) 1475cdf0e10cSrcweir , m_aSaveDirBtn ( this , SVX_RES( BTN_BROKEN_SAVEDIR ) ) 1476cdf0e10cSrcweir , m_aBottomFL ( this , SVX_RES( FL_BROKEN_BOTTOM ) ) 1477cdf0e10cSrcweir , m_aOkBtn ( this , SVX_RES( BTN_BROKEN_OK ) ) 1478cdf0e10cSrcweir , m_aCancelBtn ( this , SVX_RES( BTN_BROKEN_CANCEL ) ) 1479cdf0e10cSrcweir , m_pCore ( pCore ) 1480cdf0e10cSrcweir , m_bBeforeRecovery (bBeforeRecovery) 1481cdf0e10cSrcweir , m_bExecutionNeeded(sal_False) 1482cdf0e10cSrcweir { 1483cdf0e10cSrcweir FreeResource(); 1484cdf0e10cSrcweir 1485cdf0e10cSrcweir m_aSaveDirBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, SaveButtonHdl ) ); 1486cdf0e10cSrcweir m_aOkBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, OkButtonHdl ) ); 1487cdf0e10cSrcweir m_aCancelBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, CancelButtonHdl ) ); 1488cdf0e10cSrcweir 1489cdf0e10cSrcweir m_sSavePath = SvtPathOptions().GetWorkPath(); 1490cdf0e10cSrcweir INetURLObject aObj( m_sSavePath ); 1491cdf0e10cSrcweir String sPath; 1492cdf0e10cSrcweir ::utl::LocalFileHelper::ConvertURLToSystemPath( aObj.GetMainURL( INetURLObject::NO_DECODE ), sPath ); 1493cdf0e10cSrcweir m_aSaveDirED.SetText( sPath ); 1494cdf0e10cSrcweir 1495cdf0e10cSrcweir impl_refresh(); 1496cdf0e10cSrcweir } 1497cdf0e10cSrcweir 1498cdf0e10cSrcweir //=============================================== 1499cdf0e10cSrcweir BrokenRecoveryDialog::~BrokenRecoveryDialog() 1500cdf0e10cSrcweir { 1501cdf0e10cSrcweir } 1502cdf0e10cSrcweir 1503cdf0e10cSrcweir //=============================================== 1504cdf0e10cSrcweir void BrokenRecoveryDialog::impl_refresh() 1505cdf0e10cSrcweir { 1506cdf0e10cSrcweir m_bExecutionNeeded = sal_False; 1507cdf0e10cSrcweir TURLList* pURLList = m_pCore->getURLListAccess(); 1508cdf0e10cSrcweir TURLList::const_iterator pIt; 1509cdf0e10cSrcweir for ( pIt = pURLList->begin(); 1510cdf0e10cSrcweir pIt != pURLList->end() ; 1511cdf0e10cSrcweir ++pIt ) 1512cdf0e10cSrcweir { 1513cdf0e10cSrcweir const TURLInfo& rInfo = *pIt; 1514cdf0e10cSrcweir 1515cdf0e10cSrcweir if (m_bBeforeRecovery) 1516cdf0e10cSrcweir { 1517cdf0e10cSrcweir // "Cancel" before recovery -> 1518cdf0e10cSrcweir // search for any temp files! 1519cdf0e10cSrcweir if (!rInfo.TempURL.getLength()) 1520cdf0e10cSrcweir continue; 1521cdf0e10cSrcweir } 1522cdf0e10cSrcweir else 1523cdf0e10cSrcweir { 1524cdf0e10cSrcweir // "Cancel" after recovery -> 1525cdf0e10cSrcweir // search for broken temp files 1526cdf0e10cSrcweir if (!RecoveryCore::isBrokenTempEntry(rInfo)) 1527cdf0e10cSrcweir continue; 1528cdf0e10cSrcweir } 1529cdf0e10cSrcweir 1530cdf0e10cSrcweir m_bExecutionNeeded = sal_True; 1531cdf0e10cSrcweir 1532cdf0e10cSrcweir sal_uInt16 nPos = m_aFileListLB.InsertEntry(rInfo.DisplayName, rInfo.StandardImage ); 1533cdf0e10cSrcweir m_aFileListLB.SetEntryData( nPos, (void*)&rInfo ); 1534cdf0e10cSrcweir } 1535cdf0e10cSrcweir m_sSavePath = ::rtl::OUString(); 1536cdf0e10cSrcweir m_aOkBtn.GrabFocus(); 1537cdf0e10cSrcweir } 1538cdf0e10cSrcweir 1539cdf0e10cSrcweir //=============================================== 1540cdf0e10cSrcweir sal_Bool BrokenRecoveryDialog::isExecutionNeeded() 1541cdf0e10cSrcweir { 1542cdf0e10cSrcweir return m_bExecutionNeeded; 1543cdf0e10cSrcweir } 1544cdf0e10cSrcweir 1545cdf0e10cSrcweir //=============================================== 1546cdf0e10cSrcweir ::rtl::OUString BrokenRecoveryDialog::getSaveDirURL() 1547cdf0e10cSrcweir { 1548cdf0e10cSrcweir return m_sSavePath; 1549cdf0e10cSrcweir } 1550cdf0e10cSrcweir 1551cdf0e10cSrcweir //=============================================== 1552cdf0e10cSrcweir IMPL_LINK( BrokenRecoveryDialog, OkButtonHdl, void*, EMPTYARG ) 1553cdf0e10cSrcweir { 1554cdf0e10cSrcweir String sPhysicalPath = m_aSaveDirED.GetText().EraseLeadingChars().EraseTrailingChars(); 1555cdf0e10cSrcweir String sURL; 1556cdf0e10cSrcweir ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPhysicalPath, sURL ); 1557cdf0e10cSrcweir m_sSavePath = sURL; 1558cdf0e10cSrcweir while (!m_sSavePath.getLength()) 1559cdf0e10cSrcweir impl_askForSavePath(); 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir EndDialog(DLG_RET_OK); 1562cdf0e10cSrcweir return 0; 1563cdf0e10cSrcweir } 1564cdf0e10cSrcweir 1565cdf0e10cSrcweir //=============================================== 1566cdf0e10cSrcweir IMPL_LINK( BrokenRecoveryDialog, CancelButtonHdl, void*, EMPTYARG ) 1567cdf0e10cSrcweir { 1568cdf0e10cSrcweir EndDialog(DLG_RET_CANCEL); 1569cdf0e10cSrcweir return 0; 1570cdf0e10cSrcweir } 1571cdf0e10cSrcweir 1572cdf0e10cSrcweir //=============================================== 1573cdf0e10cSrcweir IMPL_LINK( BrokenRecoveryDialog, SaveButtonHdl, void*, EMPTYARG ) 1574cdf0e10cSrcweir { 1575cdf0e10cSrcweir impl_askForSavePath(); 1576cdf0e10cSrcweir return 0; 1577cdf0e10cSrcweir } 1578cdf0e10cSrcweir 1579cdf0e10cSrcweir //=============================================== 1580cdf0e10cSrcweir void BrokenRecoveryDialog::impl_askForSavePath() 1581cdf0e10cSrcweir { 1582cdf0e10cSrcweir css::uno::Reference< css::ui::dialogs::XFolderPicker > xFolderPicker( 1583cdf0e10cSrcweir m_pCore->getSMGR()->createInstance(SERVICENAME_FOLDERPICKER), css::uno::UNO_QUERY_THROW); 1584cdf0e10cSrcweir 1585cdf0e10cSrcweir INetURLObject aURL(m_sSavePath, INET_PROT_FILE); 1586cdf0e10cSrcweir xFolderPicker->setDisplayDirectory(aURL.GetMainURL(INetURLObject::NO_DECODE)); 1587cdf0e10cSrcweir short nRet = xFolderPicker->execute(); 1588cdf0e10cSrcweir if (nRet == css::ui::dialogs::ExecutableDialogResults::OK) 1589cdf0e10cSrcweir { 1590cdf0e10cSrcweir m_sSavePath = xFolderPicker->getDirectory(); 1591cdf0e10cSrcweir String sPath; 1592cdf0e10cSrcweir ::utl::LocalFileHelper::ConvertURLToSystemPath( m_sSavePath, sPath ); 1593cdf0e10cSrcweir m_aSaveDirED.SetText( sPath ); 1594cdf0e10cSrcweir } 1595cdf0e10cSrcweir } 1596cdf0e10cSrcweir 1597cdf0e10cSrcweir //=============================================== 1598cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1599cdf0e10cSrcweir // Error Report Welcome Dialog 1600cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1601cdf0e10cSrcweir 1602cdf0e10cSrcweir ErrorRepWelcomeDialog::ErrorRepWelcomeDialog( Window* _pParent, sal_Bool _bAllowBack ) 1603cdf0e10cSrcweir :IExtendedTabPage ( _pParent, SVX_RES( RID_SVXPAGE_ERR_REP_WELCOME ) ) 1604cdf0e10cSrcweir ,maTitleWin ( this, SVX_RES( WIN_RECOV_TITLE ) ) 1605cdf0e10cSrcweir ,maTitleFT ( this, SVX_RES( FT_RECOV_TITLE ) ) 1606cdf0e10cSrcweir ,maTitleFL ( this, SVX_RES( FL_RECOV_TITLE ) ) 1607cdf0e10cSrcweir ,maDescrFT ( this, SVX_RES( FT_RECOV_DESCR ) ) 1608cdf0e10cSrcweir ,maBottomFL ( this, SVX_RES( FL_RECOV_BOTTOM ) ) 1609cdf0e10cSrcweir ,maPrevBtn ( this, SVX_RES( BTN_RECOV_PREV ) ) 1610cdf0e10cSrcweir ,maNextBtn ( this, SVX_RES( BTN_RECOV_NEXT ) ) 1611cdf0e10cSrcweir ,maCancelBtn ( this, SVX_RES( BTN_RECOV_CANCEL ) ) 1612cdf0e10cSrcweir { 1613cdf0e10cSrcweir FreeResource(); 1614cdf0e10cSrcweir 1615cdf0e10cSrcweir Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() ); 1616cdf0e10cSrcweir maTitleWin.SetBackground( aBack ); 1617cdf0e10cSrcweir maTitleFT.SetBackground( aBack ); 1618cdf0e10cSrcweir 1619cdf0e10cSrcweir Font aFnt( maTitleFT.GetFont() ); 1620cdf0e10cSrcweir aFnt.SetWeight( WEIGHT_BOLD ); 1621cdf0e10cSrcweir maTitleFT.SetFont( aFnt ); 1622cdf0e10cSrcweir 1623cdf0e10cSrcweir maPrevBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, PrevBtnHdl ) ); 1624cdf0e10cSrcweir maPrevBtn.Enable( _bAllowBack ); 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir maNextBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, NextBtnHdl ) ); 1627cdf0e10cSrcweir maNextBtn.Enable( sal_True ); 1628cdf0e10cSrcweir 1629cdf0e10cSrcweir maCancelBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, CancelBtnHdl ) ); 1630cdf0e10cSrcweir maCancelBtn.Enable( sal_True ); 1631cdf0e10cSrcweir } 1632cdf0e10cSrcweir 1633cdf0e10cSrcweir ErrorRepWelcomeDialog::~ErrorRepWelcomeDialog() 1634cdf0e10cSrcweir { 1635cdf0e10cSrcweir } 1636cdf0e10cSrcweir 1637cdf0e10cSrcweir IMPL_LINK( ErrorRepWelcomeDialog, PrevBtnHdl, void*, EMPTYARG ) 1638cdf0e10cSrcweir { 1639cdf0e10cSrcweir m_nResult = DLG_RET_BACK; 1640cdf0e10cSrcweir return 0; 1641cdf0e10cSrcweir } 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir IMPL_LINK( ErrorRepWelcomeDialog, NextBtnHdl, void*, EMPTYARG ) 1644cdf0e10cSrcweir { 1645cdf0e10cSrcweir m_nResult = DLG_RET_OK; 1646cdf0e10cSrcweir return 0; 1647cdf0e10cSrcweir } 1648cdf0e10cSrcweir 1649cdf0e10cSrcweir IMPL_LINK( ErrorRepWelcomeDialog, CancelBtnHdl, void*, EMPTYARG ) 1650cdf0e10cSrcweir { 1651cdf0e10cSrcweir m_nResult = DLG_RET_CANCEL; 1652cdf0e10cSrcweir return 0; 1653cdf0e10cSrcweir } 1654cdf0e10cSrcweir 1655cdf0e10cSrcweir short ErrorRepWelcomeDialog::execute() 1656cdf0e10cSrcweir { 1657cdf0e10cSrcweir ::vos::OGuard aLock(Application::GetSolarMutex()); 1658cdf0e10cSrcweir Show(); 1659cdf0e10cSrcweir m_nResult = DLG_RET_UNKNOWN; 1660cdf0e10cSrcweir while(m_nResult == DLG_RET_UNKNOWN) 1661cdf0e10cSrcweir Application::Yield(); 1662cdf0e10cSrcweir return m_nResult; 1663cdf0e10cSrcweir } 1664cdf0e10cSrcweir 1665cdf0e10cSrcweir void ErrorRepWelcomeDialog::setDefButton() 1666cdf0e10cSrcweir { 1667cdf0e10cSrcweir maNextBtn.GrabFocus(); 1668cdf0e10cSrcweir } 1669cdf0e10cSrcweir 1670cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1671cdf0e10cSrcweir // Error Report Send Dialog and its MultiLineEdit 1672cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1673cdf0e10cSrcweir 1674cdf0e10cSrcweir ErrorDescriptionEdit::ErrorDescriptionEdit( Window* pParent, const ResId& rResId ) : 1675cdf0e10cSrcweir 1676cdf0e10cSrcweir MultiLineEdit( pParent, rResId ) 1677cdf0e10cSrcweir 1678cdf0e10cSrcweir { 1679cdf0e10cSrcweir SetModifyHdl( LINK( this, ErrorDescriptionEdit, ModifyHdl ) ); 1680cdf0e10cSrcweir if ( GetVScrollBar() ) 1681cdf0e10cSrcweir GetVScrollBar()->Hide(); 1682cdf0e10cSrcweir } 1683cdf0e10cSrcweir 1684cdf0e10cSrcweir ErrorDescriptionEdit::~ErrorDescriptionEdit() 1685cdf0e10cSrcweir { 1686cdf0e10cSrcweir } 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir IMPL_LINK( ErrorDescriptionEdit, ModifyHdl, void*, EMPTYARG ) 1689cdf0e10cSrcweir { 1690cdf0e10cSrcweir if ( !GetVScrollBar() ) 1691cdf0e10cSrcweir return 0; 1692cdf0e10cSrcweir 1693cdf0e10cSrcweir ExtTextEngine* pTextEngine = GetTextEngine(); 1694cdf0e10cSrcweir DBG_ASSERT( pTextEngine, "no text engine" ); 1695cdf0e10cSrcweir 1696cdf0e10cSrcweir sal_uIntPtr i, nParaCount = pTextEngine->GetParagraphCount(); 1697cdf0e10cSrcweir sal_uInt16 nLineCount = 0; 1698cdf0e10cSrcweir 1699cdf0e10cSrcweir for ( i = 0; i < nParaCount; ++i ) 1700cdf0e10cSrcweir nLineCount = nLineCount + pTextEngine->GetLineCount(i); 1701cdf0e10cSrcweir 1702cdf0e10cSrcweir sal_uInt16 nVisCols = 0, nVisLines = 0; 1703cdf0e10cSrcweir GetMaxVisColumnsAndLines( nVisCols, nVisLines ); 1704cdf0e10cSrcweir GetVScrollBar()->Show( nLineCount > nVisLines ); 1705cdf0e10cSrcweir 1706cdf0e10cSrcweir return 0; 1707cdf0e10cSrcweir } 1708cdf0e10cSrcweir 1709cdf0e10cSrcweir ErrorRepSendDialog::ErrorRepSendDialog( Window* _pParent ) 1710cdf0e10cSrcweir :IExtendedTabPage ( _pParent, SVX_RES( RID_SVXPAGE_ERR_REP_SEND ) ) 1711cdf0e10cSrcweir ,maTitleWin ( this, SVX_RES( WIN_RECOV_TITLE ) ) 1712cdf0e10cSrcweir ,maTitleFT ( this, SVX_RES( FT_RECOV_TITLE ) ) 1713cdf0e10cSrcweir ,maTitleFL ( this, SVX_RES( FL_RECOV_TITLE ) ) 1714cdf0e10cSrcweir ,maDescrFT ( this, SVX_RES( FT_RECOV_DESCR ) ) 1715cdf0e10cSrcweir 1716cdf0e10cSrcweir ,maDocTypeFT ( this, SVX_RES( FT_ERRSEND_DOCTYPE ) ) 1717cdf0e10cSrcweir ,maDocTypeED ( this, SVX_RES( ED_ERRSEND_DOCTYPE ) ) 1718cdf0e10cSrcweir ,maUsingFT ( this, SVX_RES( FT_ERRSEND_USING ) ) 1719cdf0e10cSrcweir ,maUsingML ( this, SVX_RES( ML_ERRSEND_USING ) ) 1720cdf0e10cSrcweir ,maShowRepBtn ( this, SVX_RES( BTN_ERRSEND_SHOWREP ) ) 1721cdf0e10cSrcweir ,maOptBtn ( this, SVX_RES( BTN_ERRSEND_OPT ) ) 1722cdf0e10cSrcweir ,maContactCB ( this, SVX_RES( CB_ERRSEND_CONTACT ) ) 1723cdf0e10cSrcweir ,maEMailAddrFT ( this, SVX_RES( FT_ERRSEND_EMAILADDR ) ) 1724cdf0e10cSrcweir ,maEMailAddrED ( this, SVX_RES( ED_ERRSEND_EMAILADDR ) ) 1725cdf0e10cSrcweir 1726cdf0e10cSrcweir ,maBottomFL ( this, SVX_RES( FL_RECOV_BOTTOM ) ) 1727cdf0e10cSrcweir ,maPrevBtn ( this, SVX_RES( BTN_RECOV_PREV ) ) 1728cdf0e10cSrcweir ,maNextBtn ( this, SVX_RES( BTN_RECOV_NEXT ) ) 1729cdf0e10cSrcweir ,maCancelBtn ( this, SVX_RES( BTN_RECOV_CANCEL ) ) 1730cdf0e10cSrcweir { 1731cdf0e10cSrcweir FreeResource(); 1732cdf0e10cSrcweir 1733cdf0e10cSrcweir initControls(); 1734cdf0e10cSrcweir 1735cdf0e10cSrcweir Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() ); 1736cdf0e10cSrcweir maTitleWin.SetBackground( aBack ); 1737cdf0e10cSrcweir maTitleFT.SetBackground( aBack ); 1738cdf0e10cSrcweir 1739cdf0e10cSrcweir Font aFnt( maTitleFT.GetFont() ); 1740cdf0e10cSrcweir aFnt.SetWeight( WEIGHT_BOLD ); 1741cdf0e10cSrcweir maTitleFT.SetFont( aFnt ); 1742cdf0e10cSrcweir 1743cdf0e10cSrcweir maShowRepBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, ShowRepBtnHdl ) ); 1744cdf0e10cSrcweir maOptBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, OptBtnHdl ) ); 1745cdf0e10cSrcweir maContactCB.SetClickHdl( LINK( this, ErrorRepSendDialog, ContactCBHdl ) ); 1746cdf0e10cSrcweir maPrevBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, PrevBtnHdl ) ); 1747cdf0e10cSrcweir maNextBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, SendBtnHdl ) ); 1748cdf0e10cSrcweir maCancelBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, CancelBtnHdl ) ); 1749cdf0e10cSrcweir 1750cdf0e10cSrcweir ReadParams(); 1751cdf0e10cSrcweir 1752cdf0e10cSrcweir /* 1753cdf0e10cSrcweir maDocTypeED.SetText( maParams.maSubject ); 1754cdf0e10cSrcweir maUsingML.SetText( maParams.maBody ); 1755cdf0e10cSrcweir maContactCB.Check( maParams.mbAllowContact ); 1756cdf0e10cSrcweir maEMailAddrED.SetText( maParams.maReturnAddress ); 1757cdf0e10cSrcweir */ 1758cdf0e10cSrcweir ContactCBHdl( 0 ); 1759cdf0e10cSrcweir } 1760cdf0e10cSrcweir 1761cdf0e10cSrcweir ErrorRepSendDialog::~ErrorRepSendDialog() 1762cdf0e10cSrcweir { 1763cdf0e10cSrcweir } 1764cdf0e10cSrcweir 1765cdf0e10cSrcweir short ErrorRepSendDialog::execute() 1766cdf0e10cSrcweir { 1767cdf0e10cSrcweir ::vos::OGuard aLock(Application::GetSolarMutex()); 1768cdf0e10cSrcweir Show(); 1769cdf0e10cSrcweir m_nResult = DLG_RET_UNKNOWN; 1770cdf0e10cSrcweir while(m_nResult == DLG_RET_UNKNOWN) 1771cdf0e10cSrcweir Application::Yield(); 1772cdf0e10cSrcweir return m_nResult; 1773cdf0e10cSrcweir } 1774cdf0e10cSrcweir 1775cdf0e10cSrcweir void ErrorRepSendDialog::setDefButton() 1776cdf0e10cSrcweir { 1777cdf0e10cSrcweir // set first focus 1778cdf0e10cSrcweir maDocTypeED.GrabFocus(); 1779cdf0e10cSrcweir } 1780cdf0e10cSrcweir 1781cdf0e10cSrcweir IMPL_LINK( ErrorRepSendDialog, PrevBtnHdl, void*, EMPTYARG ) 1782cdf0e10cSrcweir { 1783cdf0e10cSrcweir m_nResult = DLG_RET_BACK; 1784cdf0e10cSrcweir return 0; 1785cdf0e10cSrcweir } 1786cdf0e10cSrcweir 1787cdf0e10cSrcweir IMPL_LINK( ErrorRepSendDialog, CancelBtnHdl, void*, EMPTYARG ) 1788cdf0e10cSrcweir { 1789cdf0e10cSrcweir m_nResult = DLG_RET_CANCEL; 1790cdf0e10cSrcweir return 0; 1791cdf0e10cSrcweir } 1792cdf0e10cSrcweir 1793cdf0e10cSrcweir IMPL_LINK( ErrorRepSendDialog, SendBtnHdl, void*, EMPTYARG ) 1794cdf0e10cSrcweir { 1795cdf0e10cSrcweir 1796cdf0e10cSrcweir SaveParams(); 1797cdf0e10cSrcweir SendReport(); 1798cdf0e10cSrcweir 1799cdf0e10cSrcweir m_nResult = DLG_RET_OK; 1800cdf0e10cSrcweir return 0; 1801cdf0e10cSrcweir } 1802cdf0e10cSrcweir 1803cdf0e10cSrcweir IMPL_LINK( ErrorRepSendDialog, ShowRepBtnHdl, void*, EMPTYARG ) 1804cdf0e10cSrcweir { 1805cdf0e10cSrcweir ErrorRepPreviewDialog aDlg( this ); 1806cdf0e10cSrcweir aDlg.Execute(); 1807cdf0e10cSrcweir return 0; 1808cdf0e10cSrcweir } 1809cdf0e10cSrcweir 1810cdf0e10cSrcweir IMPL_LINK( ErrorRepSendDialog, OptBtnHdl, void*, EMPTYARG ) 1811cdf0e10cSrcweir { 1812cdf0e10cSrcweir ErrorRepOptionsDialog aDlg( this, maParams ); 1813cdf0e10cSrcweir aDlg.Execute(); 1814cdf0e10cSrcweir return 0; 1815cdf0e10cSrcweir } 1816cdf0e10cSrcweir 1817cdf0e10cSrcweir IMPL_LINK( ErrorRepSendDialog, ContactCBHdl, void*, EMPTYARG ) 1818cdf0e10cSrcweir { 1819cdf0e10cSrcweir bool bCheck = maContactCB.IsChecked(); 1820cdf0e10cSrcweir maEMailAddrFT.Enable( bCheck ); 1821cdf0e10cSrcweir maEMailAddrED.Enable( bCheck ); 1822cdf0e10cSrcweir return 0; 1823cdf0e10cSrcweir } 1824cdf0e10cSrcweir 1825cdf0e10cSrcweir void ErrorRepSendDialog::initControls() 1826cdf0e10cSrcweir { 1827cdf0e10cSrcweir // if the text is too short for two lines, insert a newline 1828cdf0e10cSrcweir String sText = maDocTypeFT.GetText(); 1829cdf0e10cSrcweir if ( maDocTypeFT.GetCtrlTextWidth( sText ) <= maDocTypeFT.GetSizePixel().Width() ) 1830cdf0e10cSrcweir { 1831cdf0e10cSrcweir sText.Insert( '\n', 0 ); 1832cdf0e10cSrcweir maDocTypeFT.SetText( sText ); 1833cdf0e10cSrcweir } 1834cdf0e10cSrcweir 1835cdf0e10cSrcweir // if the button text is too wide, then broaden the button 1836cdf0e10cSrcweir sText = maShowRepBtn.GetText(); 1837cdf0e10cSrcweir long nTxtW = maShowRepBtn.GetCtrlTextWidth( sText ); 1838cdf0e10cSrcweir long nBtnW = maShowRepBtn.GetSizePixel().Width(); 1839cdf0e10cSrcweir if ( nTxtW >= nBtnW ) 1840cdf0e10cSrcweir { 1841cdf0e10cSrcweir const long nMinDelta = 10; 1842cdf0e10cSrcweir long nDelta = Max( nTxtW - nBtnW, nMinDelta ); 1843cdf0e10cSrcweir sal_uInt32 i = 0; 1844cdf0e10cSrcweir Window* pWins[] = 1845cdf0e10cSrcweir { 1846cdf0e10cSrcweir &maShowRepBtn, &maOptBtn, 1847cdf0e10cSrcweir &maDescrFT, &maDocTypeFT, &maDocTypeED, &maUsingFT, 1848cdf0e10cSrcweir &maUsingML, &maContactCB, &maEMailAddrFT, &maEMailAddrED 1849cdf0e10cSrcweir }; 1850cdf0e10cSrcweir // the first two buttons need a new size (wider) and position (more left) 1851cdf0e10cSrcweir Window** pCurrent = pWins; 1852cdf0e10cSrcweir const sal_uInt32 nBtnCount = 2; 1853cdf0e10cSrcweir for ( ; i < nBtnCount; ++i, ++pCurrent ) 1854cdf0e10cSrcweir { 1855cdf0e10cSrcweir Size aNewSize = (*pCurrent)->GetSizePixel(); 1856cdf0e10cSrcweir aNewSize.Width() += nDelta; 1857cdf0e10cSrcweir (*pCurrent)->SetSizePixel( aNewSize ); 1858cdf0e10cSrcweir Point aNewPos = (*pCurrent)->GetPosPixel(); 1859cdf0e10cSrcweir aNewPos.X() -= nDelta; 1860cdf0e10cSrcweir (*pCurrent)->SetPosPixel( aNewPos ); 1861cdf0e10cSrcweir } 1862cdf0e10cSrcweir 1863cdf0e10cSrcweir // loop through all the other windows and adjust their size 1864cdf0e10cSrcweir for ( ; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) 1865cdf0e10cSrcweir { 1866cdf0e10cSrcweir Size aSize = (*pCurrent)->GetSizePixel(); 1867cdf0e10cSrcweir aSize.Width() -= nDelta; 1868cdf0e10cSrcweir (*pCurrent)->SetSizePixel( aSize ); 1869cdf0e10cSrcweir } 1870cdf0e10cSrcweir } 1871cdf0e10cSrcweir } 1872cdf0e10cSrcweir 1873cdf0e10cSrcweir String ErrorRepSendDialog::GetDocType( void ) const 1874cdf0e10cSrcweir { 1875cdf0e10cSrcweir return maDocTypeED.GetText(); 1876cdf0e10cSrcweir } 1877cdf0e10cSrcweir 1878cdf0e10cSrcweir String ErrorRepSendDialog::GetUsing( void ) const 1879cdf0e10cSrcweir { 1880cdf0e10cSrcweir return maUsingML.GetText(); 1881cdf0e10cSrcweir } 1882cdf0e10cSrcweir 1883cdf0e10cSrcweir bool ErrorRepSendDialog::IsContactAllowed( void ) const 1884cdf0e10cSrcweir { 1885cdf0e10cSrcweir return maContactCB.IsChecked(); 1886cdf0e10cSrcweir } 1887cdf0e10cSrcweir 1888cdf0e10cSrcweir String ErrorRepSendDialog::GetEMailAddress( void ) const 1889cdf0e10cSrcweir { 1890cdf0e10cSrcweir return maEMailAddrED.GetText(); 1891cdf0e10cSrcweir } 1892cdf0e10cSrcweir 1893cdf0e10cSrcweir 1894cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1895cdf0e10cSrcweir // Error Report Options Dialog 1896cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1897cdf0e10cSrcweir 1898cdf0e10cSrcweir ErrorRepOptionsDialog::ErrorRepOptionsDialog( Window* _pParent, ErrorRepParams& _rParams ) 1899cdf0e10cSrcweir :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_ERR_REP_OPTIONS ) ) 1900cdf0e10cSrcweir ,maProxyFL( this, SVX_RES( FL_ERROPT_PROXY ) ) 1901cdf0e10cSrcweir ,maSystemBtn( this, SVX_RES( BTN_ERROPT_SYSTEM ) ) 1902cdf0e10cSrcweir ,maDirectBtn( this, SVX_RES( BTN_ERROPT_DIRECT ) ) 1903cdf0e10cSrcweir ,maManualBtn( this, SVX_RES( BTN_ERROPT_MANUAL ) ) 1904cdf0e10cSrcweir ,maProxyServerFT( this, SVX_RES( FT_ERROPT_PROXYSERVER ) ) 1905cdf0e10cSrcweir ,maProxyServerEd( this, SVX_RES( ED_ERROPT_PROXYSERVER ) ) 1906cdf0e10cSrcweir ,maProxyPortFT( this, SVX_RES( FT_ERROPT_PROXYPORT ) ) 1907cdf0e10cSrcweir ,maProxyPortEd( this, SVX_RES( ED_ERROPT_PROXYPORT ) ) 1908cdf0e10cSrcweir ,maDescriptionFT( this, SVX_RES( FT_ERROPT_DESCRIPTION ) ) 1909cdf0e10cSrcweir ,maButtonsFL( this, SVX_RES( FL_ERROPT_BUTTONS ) ) 1910cdf0e10cSrcweir ,maOKBtn( this, SVX_RES( BTN_ERROPT_OK ) ) 1911cdf0e10cSrcweir ,maCancelBtn( this, SVX_RES( BTN_ERROPT_CANCEL ) ) 1912cdf0e10cSrcweir ,mrParams( _rParams ) 1913cdf0e10cSrcweir { 1914cdf0e10cSrcweir FreeResource(); 1915cdf0e10cSrcweir 1916cdf0e10cSrcweir maManualBtn.SetToggleHdl( LINK( this, ErrorRepOptionsDialog, ManualBtnHdl ) ); 1917cdf0e10cSrcweir maCancelBtn.SetClickHdl( LINK( this, ErrorRepOptionsDialog, CancelBtnHdl ) ); 1918cdf0e10cSrcweir maOKBtn.SetClickHdl( LINK( this, ErrorRepOptionsDialog, OKBtnHdl ) ); 1919cdf0e10cSrcweir 1920cdf0e10cSrcweir maProxyServerEd.SetText( mrParams.maHTTPProxyServer ); 1921cdf0e10cSrcweir maProxyPortEd.SetText( mrParams.maHTTPProxyPort ); 1922cdf0e10cSrcweir 1923cdf0e10cSrcweir #ifndef WNT 1924cdf0e10cSrcweir // no "Use system settings" button on non windows systems 1925cdf0e10cSrcweir // so hide this button 1926cdf0e10cSrcweir maSystemBtn.Hide(); 1927cdf0e10cSrcweir long nDelta = maDirectBtn.GetPosPixel().Y() - maSystemBtn.GetPosPixel().Y(); 1928cdf0e10cSrcweir // and loop through all these controls and adjust their position 1929cdf0e10cSrcweir Window* pWins[] = 1930cdf0e10cSrcweir { 1931cdf0e10cSrcweir &maDirectBtn, &maManualBtn, &maProxyServerFT, 1932cdf0e10cSrcweir &maProxyServerEd, &maProxyPortFT, &maProxyPortEd, &maDescriptionFT 1933cdf0e10cSrcweir }; 1934cdf0e10cSrcweir Window** pCurrent = pWins; 1935cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) 1936cdf0e10cSrcweir { 1937cdf0e10cSrcweir Point aPos = (*pCurrent)->GetPosPixel(); 1938cdf0e10cSrcweir aPos.Y() -= nDelta; 1939cdf0e10cSrcweir (*pCurrent)->SetPosPixel( aPos ); 1940cdf0e10cSrcweir } 1941cdf0e10cSrcweir #endif 1942cdf0e10cSrcweir 1943cdf0e10cSrcweir 1944cdf0e10cSrcweir switch ( mrParams.miHTTPConnectionType ) 1945cdf0e10cSrcweir { 1946cdf0e10cSrcweir default: 1947cdf0e10cSrcweir #ifdef WNT 1948cdf0e10cSrcweir case 0: 1949cdf0e10cSrcweir maSystemBtn.Check( sal_True ); 1950cdf0e10cSrcweir break; 1951cdf0e10cSrcweir #endif 1952cdf0e10cSrcweir case 1: 1953cdf0e10cSrcweir maDirectBtn.Check( sal_True ); 1954cdf0e10cSrcweir break; 1955cdf0e10cSrcweir case 2: 1956cdf0e10cSrcweir maManualBtn.Check( sal_True ); 1957cdf0e10cSrcweir break; 1958cdf0e10cSrcweir } 1959cdf0e10cSrcweir 1960cdf0e10cSrcweir ManualBtnHdl( 0 ); 1961cdf0e10cSrcweir } 1962cdf0e10cSrcweir 1963cdf0e10cSrcweir ErrorRepOptionsDialog::~ErrorRepOptionsDialog() 1964cdf0e10cSrcweir { 1965cdf0e10cSrcweir } 1966cdf0e10cSrcweir 1967cdf0e10cSrcweir IMPL_LINK( ErrorRepOptionsDialog, ManualBtnHdl, void*, EMPTYARG ) 1968cdf0e10cSrcweir { 1969cdf0e10cSrcweir bool bCheck = maManualBtn.IsChecked(); 1970cdf0e10cSrcweir maProxyServerFT.Enable( bCheck ); 1971cdf0e10cSrcweir maProxyServerEd.Enable( bCheck ); 1972cdf0e10cSrcweir maProxyPortFT.Enable( bCheck ); 1973cdf0e10cSrcweir maProxyPortEd.Enable( bCheck ); 1974cdf0e10cSrcweir return 0; 1975cdf0e10cSrcweir } 1976cdf0e10cSrcweir 1977cdf0e10cSrcweir IMPL_LINK( ErrorRepOptionsDialog, OKBtnHdl, void*, EMPTYARG ) 1978cdf0e10cSrcweir { 1979cdf0e10cSrcweir if ( maManualBtn.IsChecked() ) 1980cdf0e10cSrcweir mrParams.miHTTPConnectionType = 2; 1981cdf0e10cSrcweir else if ( maDirectBtn.IsChecked() ) 1982cdf0e10cSrcweir mrParams.miHTTPConnectionType = 1; 1983cdf0e10cSrcweir else if ( maSystemBtn.IsChecked() ) 1984cdf0e10cSrcweir mrParams.miHTTPConnectionType = 0; 1985cdf0e10cSrcweir 1986cdf0e10cSrcweir mrParams.maHTTPProxyServer = maProxyServerEd.GetText(); 1987cdf0e10cSrcweir mrParams.maHTTPProxyPort = maProxyPortEd.GetText(); 1988cdf0e10cSrcweir 1989cdf0e10cSrcweir EndDialog(DLG_RET_OK); 1990cdf0e10cSrcweir return 0; 1991cdf0e10cSrcweir } 1992cdf0e10cSrcweir 1993cdf0e10cSrcweir IMPL_LINK( ErrorRepOptionsDialog, CancelBtnHdl, void*, EMPTYARG ) 1994cdf0e10cSrcweir { 1995cdf0e10cSrcweir EndDialog(DLG_RET_CANCEL); 1996cdf0e10cSrcweir return 0; 1997cdf0e10cSrcweir } 1998cdf0e10cSrcweir 1999cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 2000cdf0e10cSrcweir // Error Report Edit (MultiLineEdit with fixed font) 2001cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 2002cdf0e10cSrcweir 2003cdf0e10cSrcweir ErrorRepEdit::ErrorRepEdit( Window* pParent, const ResId& rResId ) : 2004cdf0e10cSrcweir ExtMultiLineEdit( pParent, rResId ) 2005cdf0e10cSrcweir { 2006cdf0e10cSrcweir // fixed font for error report 2007cdf0e10cSrcweir Color aColor = GetTextColor(); 2008cdf0e10cSrcweir 2009cdf0e10cSrcweir Font aFont = OutputDevice::GetDefaultFont( 2010cdf0e10cSrcweir DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE ); 2011cdf0e10cSrcweir 2012cdf0e10cSrcweir // Set font color because the default font color is transparent !!! 2013cdf0e10cSrcweir aFont.SetColor( aColor ); 2014cdf0e10cSrcweir 2015cdf0e10cSrcweir GetTextEngine()->SetFont( aFont ); 2016cdf0e10cSrcweir 2017cdf0e10cSrcweir // no blinking cursor and a little left margin 2018cdf0e10cSrcweir EnableCursor( sal_False ); 2019cdf0e10cSrcweir SetLeftMargin( 4 ); 2020cdf0e10cSrcweir } 2021cdf0e10cSrcweir 2022cdf0e10cSrcweir ErrorRepEdit::~ErrorRepEdit() 2023cdf0e10cSrcweir { 2024cdf0e10cSrcweir } 2025cdf0e10cSrcweir 2026cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 2027cdf0e10cSrcweir // Error Report Preview Dialog 2028cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 2029cdf0e10cSrcweir 2030cdf0e10cSrcweir 2031cdf0e10cSrcweir static ::rtl::OUString GetCrashConfigDir() 2032cdf0e10cSrcweir { 2033cdf0e10cSrcweir 2034cdf0e10cSrcweir #if defined(WNT) || defined(OS2) 2035910823aeSJürgen Schmidt OUString ustrValue = OUString::createFromAscii("${$OOO_BASE_DIR/program/bootstrap.ini:UserInstallation}"); 2036cdf0e10cSrcweir #elif defined( MACOSX ) 2037cdf0e10cSrcweir OUString ustrValue = OUString::createFromAscii("~"); 2038cdf0e10cSrcweir #else 2039cdf0e10cSrcweir OUString ustrValue = OUString::createFromAscii("$SYSUSERCONFIG"); 2040cdf0e10cSrcweir #endif 2041cdf0e10cSrcweir Bootstrap::expandMacros( ustrValue ); 2042cdf0e10cSrcweir 2043cdf0e10cSrcweir #if defined(WNT) || defined(OS2) 2044cdf0e10cSrcweir ustrValue += OUString::createFromAscii("/user/crashdata"); 2045cdf0e10cSrcweir #endif 2046cdf0e10cSrcweir return ustrValue; 2047cdf0e10cSrcweir } 2048cdf0e10cSrcweir 2049cdf0e10cSrcweir #if defined(WNT) || defined(OS2) 2050cdf0e10cSrcweir #define CHKFILE "crashdat.chk" 2051cdf0e10cSrcweir #define STKFILE "crashdat.stk" 2052cdf0e10cSrcweir #define PRVFILE "crashdat.prv" 2053cdf0e10cSrcweir #else 2054cdf0e10cSrcweir #define CHKFILE ".crash_report_checksum" 2055cdf0e10cSrcweir #define STKFILE ".crash_report_frames" 2056cdf0e10cSrcweir #define PRVFILE ".crash_report_preview" 2057cdf0e10cSrcweir #endif 2058cdf0e10cSrcweir 2059cdf0e10cSrcweir // static ::rtl::OUString GetChecksumURL() 2060cdf0e10cSrcweir // { 2061cdf0e10cSrcweir // ::rtl::OUString aURL = GetCrashConfigDir(); 2062cdf0e10cSrcweir 2063cdf0e10cSrcweir // aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ); 2064cdf0e10cSrcweir // aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHKFILE ) ); 2065cdf0e10cSrcweir 2066cdf0e10cSrcweir // return aURL; 2067cdf0e10cSrcweir // } 2068cdf0e10cSrcweir 2069cdf0e10cSrcweir // static ::rtl::OUString GetStackURL() 2070cdf0e10cSrcweir // { 2071cdf0e10cSrcweir // ::rtl::OUString aURL = GetCrashConfigDir(); 2072cdf0e10cSrcweir 2073cdf0e10cSrcweir // aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ); 2074cdf0e10cSrcweir // aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STKFILE ) ); 2075cdf0e10cSrcweir 2076cdf0e10cSrcweir // return aURL; 2077cdf0e10cSrcweir // } 2078cdf0e10cSrcweir 2079cdf0e10cSrcweir static ::rtl::OUString GetPreviewURL() 2080cdf0e10cSrcweir { 2081cdf0e10cSrcweir ::rtl::OUString aURL = GetCrashConfigDir(); 2082cdf0e10cSrcweir 2083cdf0e10cSrcweir aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ); 2084cdf0e10cSrcweir aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRVFILE ) ); 2085cdf0e10cSrcweir 2086cdf0e10cSrcweir return aURL; 2087cdf0e10cSrcweir } 2088cdf0e10cSrcweir 2089cdf0e10cSrcweir static String LoadCrashFile( const ::rtl::OUString &rURL ) 2090cdf0e10cSrcweir { 2091cdf0e10cSrcweir String aFileContent; 2092cdf0e10cSrcweir ::osl::File aFile( rURL ); 2093cdf0e10cSrcweir 2094cdf0e10cSrcweir printf( "Loading %s:", OString( rURL.getStr(), rURL.getLength(), osl_getThreadTextEncoding() ).getStr() ); 2095cdf0e10cSrcweir if ( ::osl::FileBase::E_None == aFile.open( OpenFlag_Read ) ) 2096cdf0e10cSrcweir { 2097cdf0e10cSrcweir ::rtl::OString aContent; 2098cdf0e10cSrcweir ::osl::FileBase::RC result; 2099cdf0e10cSrcweir sal_uInt64 aBytesRead; 2100cdf0e10cSrcweir 2101cdf0e10cSrcweir do 2102cdf0e10cSrcweir { 2103cdf0e10cSrcweir sal_Char aBuffer[256]; 2104cdf0e10cSrcweir 2105cdf0e10cSrcweir result = aFile.read( aBuffer, sizeof(aBuffer), aBytesRead ); 2106cdf0e10cSrcweir 2107cdf0e10cSrcweir if ( ::osl::FileBase::E_None == result ) 2108cdf0e10cSrcweir { 2109cdf0e10cSrcweir ::rtl::OString aTemp( aBuffer, static_cast< xub_StrLen >( aBytesRead ) ); 2110cdf0e10cSrcweir aContent += aTemp; 2111cdf0e10cSrcweir } 2112cdf0e10cSrcweir } while ( ::osl::FileBase::E_None == result && aBytesRead ); 2113cdf0e10cSrcweir 2114cdf0e10cSrcweir ::rtl::OUString ustrContent( aContent.getStr(), aContent.getLength(), RTL_TEXTENCODING_UTF8 ); 2115cdf0e10cSrcweir aFileContent = ustrContent; 2116cdf0e10cSrcweir 2117cdf0e10cSrcweir aFile.close(); 2118cdf0e10cSrcweir 2119cdf0e10cSrcweir printf( "SUCCEEDED\n" ); 2120cdf0e10cSrcweir } 2121cdf0e10cSrcweir else 2122cdf0e10cSrcweir printf( "FAILED\n" ); 2123cdf0e10cSrcweir 2124cdf0e10cSrcweir return aFileContent; 2125cdf0e10cSrcweir } 2126cdf0e10cSrcweir 2127cdf0e10cSrcweir 2128cdf0e10cSrcweir 2129cdf0e10cSrcweir ErrorRepPreviewDialog::ErrorRepPreviewDialog( Window* _pParent ) 2130cdf0e10cSrcweir :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_ERR_REP_PREVIEW ) ) 2131cdf0e10cSrcweir ,maContentML( this, SVX_RES( ML_ERRPREVIEW_CONTENT ) ) 2132cdf0e10cSrcweir ,maOKBtn( this, SVX_RES( BTN_ERRPREVIEW_OK ) ) 2133cdf0e10cSrcweir 2134cdf0e10cSrcweir { 2135cdf0e10cSrcweir FreeResource(); 2136cdf0e10cSrcweir 2137cdf0e10cSrcweir mnMinHeight = ( maContentML.GetSizePixel().Height() / 2 ); 2138cdf0e10cSrcweir 2139cdf0e10cSrcweir String aPreview = LoadCrashFile( GetPreviewURL() ); 2140cdf0e10cSrcweir ErrorRepSendDialog *pMainDlg = (ErrorRepSendDialog *)_pParent; 2141cdf0e10cSrcweir 2142cdf0e10cSrcweir String aSeperator = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\r\n\r\n================\r\n\r\n" ) ); 2143cdf0e10cSrcweir 2144cdf0e10cSrcweir String aContent = pMainDlg->GetDocType(); 2145cdf0e10cSrcweir if ( aContent.Len() > 0 ) 2146cdf0e10cSrcweir aContent += aSeperator; 2147cdf0e10cSrcweir aContent += pMainDlg->GetUsing(); 2148cdf0e10cSrcweir if ( aContent.Len() > 0 ) 2149cdf0e10cSrcweir aContent += aSeperator; 2150cdf0e10cSrcweir aContent += aPreview; 2151cdf0e10cSrcweir 2152cdf0e10cSrcweir maContentML.SetText( aContent ); 2153cdf0e10cSrcweir } 2154cdf0e10cSrcweir 2155cdf0e10cSrcweir ErrorRepPreviewDialog::~ErrorRepPreviewDialog() 2156cdf0e10cSrcweir { 2157cdf0e10cSrcweir } 2158cdf0e10cSrcweir 2159cdf0e10cSrcweir void ErrorRepPreviewDialog::Resize() 2160cdf0e10cSrcweir { 2161cdf0e10cSrcweir Size a3Sz = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ); 2162cdf0e10cSrcweir Size aWinSz = GetSizePixel(); 2163cdf0e10cSrcweir Size aBtnSz = maOKBtn.GetSizePixel(); 2164cdf0e10cSrcweir Point aEditPnt = maContentML.GetPosPixel(); 2165cdf0e10cSrcweir 2166cdf0e10cSrcweir long nNewHeight = Max( aWinSz.Height() - aEditPnt.Y() - 3 * a3Sz.Height() - aBtnSz.Height(), mnMinHeight ); 2167cdf0e10cSrcweir long nNewWidth = aWinSz.Width() - 4 * a3Sz.Width(); 2168cdf0e10cSrcweir 2169cdf0e10cSrcweir Size aNewSize( nNewWidth, nNewHeight ); 2170cdf0e10cSrcweir maContentML.SetSizePixel( aNewSize ); 2171cdf0e10cSrcweir Point aNewPoint( Max( aEditPnt.X() + aNewSize.Width() - aBtnSz.Width(), aEditPnt.X() ), 2172cdf0e10cSrcweir aEditPnt.Y() + aNewSize.Height() + a3Sz.Height() ); 2173cdf0e10cSrcweir maOKBtn.SetPosPixel( aNewPoint ); 2174cdf0e10cSrcweir } 2175cdf0e10cSrcweir } // namespace DocRecovery 2176cdf0e10cSrcweir } // namespace svx 2177cdf0e10cSrcweir 2178