LCOV - code coverage report
Current view: top level - svx/source/inc - docrecovery.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 16 0.0 %
Date: 2012-08-25 Functions: 0 12 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 26 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SVX_DOCRECOVERY_HXX
      30                 :            : #define _SVX_DOCRECOVERY_HXX
      31                 :            : 
      32                 :            : #include <vcl/tabpage.hxx>
      33                 :            : #include <vcl/tabdlg.hxx>
      34                 :            : #include <vcl/dialog.hxx>
      35                 :            : #include <vcl/button.hxx>
      36                 :            : #include <vcl/fixed.hxx>
      37                 :            : #include <svtools/svmedit2.hxx>
      38                 :            : #include <svtools/svtreebx.hxx>
      39                 :            : #include <svx/simptabl.hxx>
      40                 :            : 
      41                 :            : #include <cppuhelper/implbase1.hxx>
      42                 :            : #include <cppuhelper/implbase2.hxx>
      43                 :            : #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
      44                 :            : #include <com/sun/star/frame/XStatusListener.hpp>
      45                 :            : #include <com/sun/star/frame/XDispatch.hpp>
      46                 :            : #include <com/sun/star/lang/XComponent.hpp>
      47                 :            : 
      48                 :            : 
      49                 :            : #define RECOVERY_CMDPART_PROTOCOL                   rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:"))
      50                 :            : 
      51                 :            : #define RECOVERY_CMDPART_DO_EMERGENCY_SAVE          rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/doEmergencySave"         ))
      52                 :            : #define RECOVERY_CMDPART_DO_RECOVERY                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/doAutoRecovery"          ))
      53                 :            : #define RECOVERY_CMDPART_DO_CRASHREPORT             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/doCrashReport"           ))
      54                 :            : 
      55                 :            : #define RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE      rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doPrepareEmergencySave"))
      56                 :            : #define RECOVERY_CMD_DO_EMERGENCY_SAVE              rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doEmergencySave"       ))
      57                 :            : #define RECOVERY_CMD_DO_RECOVERY                    rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doAutoRecovery"        ))
      58                 :            : #define RECOVERY_CMD_DO_ENTRY_BACKUP                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doEntryBackup"         ))
      59                 :            : #define RECOVERY_CMD_DO_ENTRY_CLEANUP               rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doEntryCleanUp"        ))
      60                 :            : 
      61                 :            : #define SERVICENAME_PROGRESSFACTORY                 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.StatusIndicatorFactory"))
      62                 :            : #define SERVICENAME_RECOVERYCORE                    rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.AutoRecovery"         ))
      63                 :            : #define SERVICENAME_FOLDERPICKER                    rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker"    ))
      64                 :            : #define SERVICENAME_DESKTOP                         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop"              ))
      65                 :            : 
      66                 :            : #define PROP_PARENTWINDOW                           rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Window"           ))
      67                 :            : #define PROP_STATUSINDICATOR                        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator"  ))
      68                 :            : #define PROP_DISPATCHASYNCHRON                      rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DispatchAsynchron"))
      69                 :            : #define PROP_SAVEPATH                               rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SavePath"         ))
      70                 :            : #define PROP_ENTRYID                                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "EntryID"          ))
      71                 :            : #define PROP_ALLOWPARENTSHOW                        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AllowParentShow"  ))
      72                 :            : 
      73                 :            : #define STATEPROP_ID                                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ID"           ))
      74                 :            : #define STATEPROP_STATE                             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentState"))
      75                 :            : #define STATEPROP_ORGURL                            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OriginalURL"  ))
      76                 :            : #define STATEPROP_TEMPURL                           rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "TempURL"      ))
      77                 :            : #define STATEPROP_FACTORYURL                        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FactoryURL"   ))
      78                 :            : #define STATEPROP_TEMPLATEURL                       rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "TemplateURL"  ))
      79                 :            : #define STATEPROP_TITLE                             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title"        ))
      80                 :            : #define STATEPROP_MODULE                            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Module"       ))
      81                 :            : 
      82                 :            : #define RECOVERY_OPERATIONSTATE_START               rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "start" ))
      83                 :            : #define RECOVERY_OPERATIONSTATE_STOP                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "stop"  ))
      84                 :            : #define RECOVERY_OPERATIONSTATE_UPDATE              rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "update"))
      85                 :            : 
      86                 :            : #define DLG_RET_UNKNOWN                                  -1
      87                 :            : #define DLG_RET_OK                                        1
      88                 :            : #define DLG_RET_CANCEL                                    0
      89                 :            : #define DLG_RET_BACK                                    100
      90                 :            : #define DLG_RET_OK_AUTOLUNCH                            101
      91                 :            : 
      92                 :            : 
      93                 :            : namespace css = ::com::sun::star;
      94                 :            : 
      95                 :            : namespace svx{
      96                 :            :     namespace DocRecovery{
      97                 :            : 
      98                 :            : //===============================================
      99                 :            : enum EDocStates
     100                 :            : {
     101                 :            :     /* TEMP STATES */
     102                 :            : 
     103                 :            :     /// default state, if a document was new created or loaded
     104                 :            :     E_UNKNOWN = 0,
     105                 :            :     /// modified against the original file
     106                 :            :     E_MODIFIED = 1,
     107                 :            :     /// an active document can be postponed to be saved later.
     108                 :            :     E_POSTPONED = 2,
     109                 :            :     /// was already handled during one AutoSave/Recovery session.
     110                 :            :     E_HANDLED = 4,
     111                 :            :     /** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */
     112                 :            :     E_TRY_SAVE = 8,
     113                 :            :     E_TRY_LOAD_BACKUP = 16,
     114                 :            :     E_TRY_LOAD_ORIGINAL = 32,
     115                 :            : 
     116                 :            :     /* FINAL STATES */
     117                 :            : 
     118                 :            :     /// the Auto/Emergency saved document isnt useable any longer
     119                 :            :     E_DAMAGED = 64,
     120                 :            :     /// the Auto/Emergency saved document isnt realy up-to-date (some changes can be missing)
     121                 :            :     E_INCOMPLETE = 128,
     122                 :            :     /// the Auto/Emergency saved document was processed successfully
     123                 :            :     E_SUCCEDED = 512
     124                 :            : };
     125                 :            : 
     126                 :            : //===============================================
     127                 :            : enum ERecoveryState
     128                 :            : {
     129                 :            :     E_SUCCESSFULLY_RECOVERED,
     130                 :            :     E_ORIGINAL_DOCUMENT_RECOVERED,
     131                 :            :     E_RECOVERY_FAILED,
     132                 :            :     E_RECOVERY_IS_IN_PROGRESS,
     133                 :            :     E_NOT_RECOVERED_YET
     134                 :            : };
     135                 :            : 
     136                 :            : //===============================================
     137 [ #  # ][ #  # ]:          0 : struct TURLInfo
     138                 :            : {
     139                 :            :     public:
     140                 :            : 
     141                 :            :     /// unique ID, which is specified by the underlying autorecovery core!
     142                 :            :     sal_Int32 ID;
     143                 :            : 
     144                 :            :     /// the full qualified document URL
     145                 :            :     ::rtl::OUString OrgURL;
     146                 :            : 
     147                 :            :     /// the full qualified URL of the temp. file (if it's exists)
     148                 :            :     ::rtl::OUString TempURL;
     149                 :            : 
     150                 :            :     /// a may be existing factory URL (e.g. for untitled documents)
     151                 :            :     ::rtl::OUString FactoryURL;
     152                 :            : 
     153                 :            :     /// may be the document base on a template file !?
     154                 :            :     ::rtl::OUString TemplateURL;
     155                 :            : 
     156                 :            :     /// the pure file name, without path, disc etcpp.
     157                 :            :     ::rtl::OUString DisplayName;
     158                 :            : 
     159                 :            :     /// the application module, where this document was loaded
     160                 :            :     ::rtl::OUString Module;
     161                 :            : 
     162                 :            :     /// state info as e.g. VALID, CORRUPTED, NON EXISTING ...
     163                 :            :     sal_Int32 DocState;
     164                 :            : 
     165                 :            :     /// ui representation for DocState!
     166                 :            :     ERecoveryState RecoveryState;
     167                 :            : 
     168                 :            :     /// standard icon
     169                 :            :     Image StandardImage;
     170                 :            : 
     171                 :            :     public:
     172                 :            : 
     173                 :          0 :     TURLInfo()
     174                 :            :         : ID           (-1                 )
     175                 :            :         , DocState     (E_UNKNOWN          )
     176         [ #  # ]:          0 :         , RecoveryState(E_NOT_RECOVERED_YET)
     177                 :          0 :     {}
     178                 :            : };
     179                 :            : 
     180                 :            : //===============================================
     181                 :            : typedef ::std::vector< TURLInfo > TURLList;
     182                 :            : 
     183                 :            : //===============================================
     184                 :          0 : class IRecoveryUpdateListener
     185                 :            : {
     186                 :            :     public:
     187                 :            : 
     188                 :            :         // inform listener about changed items, which should be refreshed
     189                 :            :         virtual void updateItems() = 0;
     190                 :            : 
     191                 :            :         // inform listener about starting of the asynchronous recovery operation
     192                 :            :         virtual void start() = 0;
     193                 :            : 
     194                 :            :         // inform listener about ending of the asynchronous recovery operation
     195                 :            :         virtual void end() = 0;
     196                 :            : 
     197                 :            :         // TODO
     198                 :            :         virtual void stepNext(TURLInfo* pItem) = 0;
     199                 :            : 
     200                 :            :     protected:
     201                 :          0 :         ~IRecoveryUpdateListener() {}
     202                 :            : };
     203                 :            : 
     204                 :            : //===============================================
     205                 :            : class RecoveryCore : public ::cppu::WeakImplHelper1< css::frame::XStatusListener >
     206                 :            : {
     207                 :            :     //-------------------------------------------
     208                 :            :     // types, const
     209                 :            :     public:
     210                 :            : 
     211                 :            :     //-------------------------------------------
     212                 :            :     // member
     213                 :            :     private:
     214                 :            : 
     215                 :            :         /// TODO
     216                 :            :         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
     217                 :            : 
     218                 :            :         /// TODO
     219                 :            :         css::uno::Reference< css::frame::XDispatch > m_xRealCore;
     220                 :            : 
     221                 :            :         /// TODO
     222                 :            :         css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
     223                 :            : 
     224                 :            :         /// TODO
     225                 :            :         TURLList m_lURLs;
     226                 :            : 
     227                 :            :         /// TODO
     228                 :            :         IRecoveryUpdateListener* m_pListener;
     229                 :            : 
     230                 :            :         /** @short  knows the reason, why we listen on our internal m_xRealCore
     231                 :            :                     member.
     232                 :            : 
     233                 :            :             @descr  Because we listen for different operations
     234                 :            :                     on the core dispatch implementation, we must know,
     235                 :            :                     which URL we have to use for deregistration!
     236                 :            :          */
     237                 :            :         sal_Bool m_bListenForSaving;
     238                 :            : 
     239                 :            :     //-------------------------------------------
     240                 :            :     // native interface
     241                 :            :     public:
     242                 :            : 
     243                 :            :         //---------------------------------------
     244                 :            :         /** @short  TODO */
     245                 :            :         RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR         ,
     246                 :            :                            sal_Bool                                                bUsedForSaving);
     247                 :            : 
     248                 :            :         //---------------------------------------
     249                 :            :         /** @short  TODO */
     250                 :            :         virtual ~RecoveryCore();
     251                 :            : 
     252                 :            :         //---------------------------------------
     253                 :            :         /** @short  TODO */
     254                 :            :         virtual css::uno::Reference< css::lang::XMultiServiceFactory > getSMGR();
     255                 :            : 
     256                 :            :         //---------------------------------------
     257                 :            :         /** @short  TODO */
     258                 :            :         virtual TURLList* getURLListAccess();
     259                 :            : 
     260                 :            :         //---------------------------------------
     261                 :            :         /** @short  TODO */
     262                 :            :         virtual sal_Bool existsBrokenTempEntries();
     263                 :            :         virtual sal_Bool existsNonRecoveredEntries();
     264                 :            :         static sal_Bool isBrokenTempEntry(const TURLInfo& rInfo);
     265                 :            :         virtual void saveBrokenTempEntries(const ::rtl::OUString& sSaveDir);
     266                 :            :         virtual void saveAllTempEntries(const ::rtl::OUString& sSaveDir);
     267                 :            :         virtual void forgetBrokenTempEntries();
     268                 :            :         virtual void forgetAllRecoveryEntries();
     269                 :            :         void forgetBrokenRecoveryEntries();
     270                 :            : 
     271                 :            :         //---------------------------------------
     272                 :            :         /** @short  TODO */
     273                 :            :         virtual void setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator >& xProgress);
     274                 :            : 
     275                 :            :         //---------------------------------------
     276                 :            :         /** @short  TODO */
     277                 :            :         virtual void setUpdateListener(IRecoveryUpdateListener* pListener);
     278                 :            : 
     279                 :            :         //---------------------------------------
     280                 :            :         /** @short  TODO */
     281                 :            :         virtual void doEmergencySavePrepare();
     282                 :            :         virtual void doEmergencySave();
     283                 :            :         virtual void doRecovery();
     284                 :            : 
     285                 :            :         //---------------------------------------
     286                 :            :         /** @short  TODO */
     287                 :            :         static ERecoveryState mapDocState2RecoverState(sal_Int32 eDocState);
     288                 :            : 
     289                 :            :     //-------------------------------------------
     290                 :            :     // uno interface
     291                 :            :     public:
     292                 :            : 
     293                 :            :         // css.frame.XStatusListener
     294                 :            :         virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& aEvent)
     295                 :            :             throw(css::uno::RuntimeException);
     296                 :            : 
     297                 :            :         // css.lang.XEventListener
     298                 :            :         virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
     299                 :            :             throw(css::uno::RuntimeException);
     300                 :            : 
     301                 :            :     //-------------------------------------------
     302                 :            :     // helper
     303                 :            :     private:
     304                 :            : 
     305                 :            :         //---------------------------------------
     306                 :            :         /** @short  starts listening on the internal EmergencySave/AutoRecovery core.
     307                 :            :          */
     308                 :            :         void impl_startListening();
     309                 :            : 
     310                 :            :         //---------------------------------------
     311                 :            :         /** @short  stop listening on the internal EmergencySave/AutoRecovery core.
     312                 :            :          */
     313                 :            :         void impl_stopListening();
     314                 :            : 
     315                 :            :         //---------------------------------------
     316                 :            :         /** @short  TODO */
     317                 :            :         css::util::URL impl_getParsedURL(const ::rtl::OUString& sURL);
     318                 :            : };
     319                 :            : 
     320                 :            : //===============================================
     321                 :            : class PluginProgressWindow : public Window
     322                 :            : {
     323                 :            :     private:
     324                 :            : 
     325                 :            :         css::uno::Reference< css::lang::XComponent > m_xProgress;
     326                 :            : 
     327                 :            :     public:
     328                 :            : 
     329                 :            :         PluginProgressWindow(      Window*                                       pParent  ,
     330                 :            :                              const css::uno::Reference< css::lang::XComponent >& xProgress);
     331                 :            :         ~PluginProgressWindow();
     332                 :            : };
     333                 :            : 
     334                 :            : class PluginProgress : public ::cppu::WeakImplHelper2< css::task::XStatusIndicator ,
     335                 :            :                                                        css::lang::XComponent       >
     336                 :            : {
     337                 :            : 
     338                 :            :     //-------------------------------------------
     339                 :            :     // member
     340                 :            :     private:
     341                 :            : 
     342                 :            :         /** @short  TODO */
     343                 :            :         css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory;
     344                 :            : 
     345                 :            :         css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
     346                 :            : 
     347                 :            :         PluginProgressWindow* m_pPlugProgressWindow;
     348                 :            : 
     349                 :            :     //-------------------------------------------
     350                 :            :     // native interface
     351                 :            :     public:
     352                 :            : 
     353                 :            :         //---------------------------------------
     354                 :            :         /** @short  TODO */
     355                 :            :         PluginProgress(      Window*                                                 pParent,
     356                 :            :                        const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR  );
     357                 :            : 
     358                 :            :         //---------------------------------------
     359                 :            :         /** @short  TODO */
     360                 :            :         virtual ~PluginProgress();
     361                 :            : 
     362                 :            :     //-------------------------------------------
     363                 :            :     // uno interface
     364                 :            :     public:
     365                 :            : 
     366                 :            :         //---------------------------------------
     367                 :            :         // XStatusIndicator
     368                 :            :         virtual void SAL_CALL start(const ::rtl::OUString& sText ,
     369                 :            :                                           sal_Int32        nRange)
     370                 :            :             throw(css::uno::RuntimeException);
     371                 :            : 
     372                 :            :         virtual void SAL_CALL end()
     373                 :            :             throw(css::uno::RuntimeException);
     374                 :            : 
     375                 :            :         virtual void SAL_CALL setText(const ::rtl::OUString& sText)
     376                 :            :             throw(css::uno::RuntimeException);
     377                 :            : 
     378                 :            :         virtual void SAL_CALL setValue(sal_Int32 nValue)
     379                 :            :             throw(css::uno::RuntimeException);
     380                 :            : 
     381                 :            :         virtual void SAL_CALL reset()
     382                 :            :             throw(css::uno::RuntimeException);
     383                 :            : 
     384                 :            :         //---------------------------------------
     385                 :            :         // XComponent
     386                 :            :         virtual void SAL_CALL dispose()
     387                 :            :             throw(css::uno::RuntimeException);
     388                 :            : 
     389                 :            :         virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& xListener)
     390                 :            :             throw(css::uno::RuntimeException);
     391                 :            : 
     392                 :            :         virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener)
     393                 :            :             throw(css::uno::RuntimeException);
     394                 :            : };
     395                 :            : 
     396                 :            : //===============================================
     397                 :            : class IExtendedTabPage : public TabPage
     398                 :            : {
     399                 :            :     //-------------------------------------------
     400                 :            :     // member
     401                 :            :     protected:
     402                 :            : 
     403                 :            :         short m_nResult;
     404                 :            : 
     405                 :            :     //-------------------------------------------
     406                 :            :     // interface
     407                 :            :     public:
     408                 :            : 
     409                 :            :         IExtendedTabPage( Window* pParent, WinBits nStyle = 0 )
     410                 :            :             : TabPage( pParent, nStyle )
     411                 :            :             , m_nResult(DLG_RET_UNKNOWN)
     412                 :            :         {}
     413                 :            : 
     414                 :          0 :         IExtendedTabPage( Window* pParent, const ResId& rResId )
     415                 :            :             : TabPage( pParent, rResId )
     416                 :          0 :             , m_nResult(DLG_RET_UNKNOWN)
     417                 :          0 :         {}
     418                 :            : 
     419                 :          0 :         virtual ~IExtendedTabPage()
     420         [ #  # ]:          0 :         {}
     421                 :            : 
     422                 :            :         virtual short   execute() = 0;
     423                 :            :         virtual void    setDefButton() = 0;
     424                 :            : };
     425                 :            : 
     426                 :            : typedef ::std::vector< IExtendedTabPage* > TTabPageList;
     427                 :            : 
     428                 :            : //===============================================
     429                 :            : class TabDialog4Recovery : public TabDialog
     430                 :            : {
     431                 :            :     //-------------------------------------------
     432                 :            :     // member
     433                 :            :     private:
     434                 :            : 
     435                 :            :         TTabPageList m_lTabPages;
     436                 :            :         TTabPageList::iterator m_pActualPage;
     437                 :            : 
     438                 :            :     //-------------------------------------------
     439                 :            :     // interface
     440                 :            :     public:
     441                 :            : 
     442                 :            :         TabDialog4Recovery(Window* pParent);
     443                 :            :         virtual ~TabDialog4Recovery();
     444                 :            : 
     445                 :            :         virtual void addTabPage(IExtendedTabPage* pPage);
     446                 :            :         virtual short Execute();
     447                 :            : };
     448                 :            : 
     449                 :            : //===============================================
     450                 :            : class SaveDialog : public IExtendedTabPage
     451                 :            : {
     452                 :            :     //-------------------------------------------
     453                 :            :     // member
     454                 :            :     private:
     455                 :            : 
     456                 :            :         Window          m_aTitleWin;
     457                 :            :         FixedText       m_aTitleFT;
     458                 :            :         FixedLine       m_aTitleFL;
     459                 :            :         FixedText       m_aDescrFT;
     460                 :            :         FixedText       m_aFileListFT;
     461                 :            :         ListBox         m_aFileListLB;
     462                 :            :         FixedLine       m_aBottomFL;
     463                 :            :         OKButton        m_aOkBtn;
     464                 :            : 
     465                 :            :         RecoveryCore*   m_pCore;
     466                 :            : 
     467                 :            :     //-------------------------------------------
     468                 :            :     // interface
     469                 :            :     public:
     470                 :            : 
     471                 :            :         //---------------------------------------
     472                 :            :         /** @short  create all child controls of this dialog.
     473                 :            : 
     474                 :            :             @descr  The dialog isnt shown nor it starts any
     475                 :            :                     action by itself!
     476                 :            : 
     477                 :            :             @param  pParent
     478                 :            :                     can point to a parent window.
     479                 :            :                     If its set to 0, the defmodal-dialog-parent
     480                 :            :                     is used automaticly.
     481                 :            : 
     482                 :            :             @param  pCore
     483                 :            :                     provides access to the recovery core service
     484                 :            :                     and the current list of open documents,
     485                 :            :                     which should be shown inside this dialog.
     486                 :            :          */
     487                 :            :         SaveDialog(Window*       pParent,
     488                 :            :                    RecoveryCore* pCore  );
     489                 :            : 
     490                 :            :         //---------------------------------------
     491                 :            :         /** @short  free all controls and used memory. */
     492                 :            :         virtual ~SaveDialog();
     493                 :            : 
     494                 :            :         //---------------------------------------
     495                 :            :         /** @short  TODO*/
     496                 :            :         virtual short   execute();
     497                 :            : 
     498                 :            :         //---------------------------------------
     499                 :            :         /** @short  TODO*/
     500                 :            :         virtual void    setDefButton();
     501                 :            : 
     502                 :            :         DECL_LINK(OKButtonHdl, void*);
     503                 :            : };
     504                 :            : 
     505                 :            : //===============================================
     506                 :            : class SaveProgressDialog : public ModalDialog
     507                 :            :                          , public IRecoveryUpdateListener
     508                 :            : {
     509                 :            :     //-------------------------------------------
     510                 :            :     // member
     511                 :            :     private:
     512                 :            : 
     513                 :            :         FixedText       m_aHintFT;
     514                 :            :         FixedText       m_aProgrFT;
     515                 :            :         String          m_aProgrBaseTxt;
     516                 :            :         Window          m_aProgrParent;
     517                 :            : 
     518                 :            :         // @short   TODO
     519                 :            :         RecoveryCore* m_pCore;
     520                 :            : 
     521                 :            :         // @short   TODO
     522                 :            :         css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
     523                 :            : 
     524                 :            :     //-------------------------------------------
     525                 :            :     // interface
     526                 :            :     public:
     527                 :            : 
     528                 :            :         //---------------------------------------
     529                 :            :         /** @short  create all child controls of this dialog.
     530                 :            : 
     531                 :            :             @descr  The dialog isnt shown nor it starts any
     532                 :            :                     action by itself!
     533                 :            : 
     534                 :            :             @param  pParent
     535                 :            :                     can point to a parent window.
     536                 :            :                     If its set to 0, the defmodal-dialog-parent
     537                 :            :                     is used automaticly.
     538                 :            : 
     539                 :            :             @param  pCore
     540                 :            :                     used to start emegrency save.
     541                 :            :          */
     542                 :            :         SaveProgressDialog(Window*       pParent,
     543                 :            :                            RecoveryCore* pCore  );
     544                 :            : 
     545                 :            :         //---------------------------------------
     546                 :            :         /** @short  free all controls and used memory. */
     547                 :            :         virtual ~SaveProgressDialog();
     548                 :            : 
     549                 :            :         //---------------------------------------
     550                 :            :         /** @short  start the emergency save operation. */
     551                 :            :         virtual short Execute();
     552                 :            : 
     553                 :            :         // IRecoveryUpdateListener
     554                 :            :         virtual void updateItems();
     555                 :            :         virtual void stepNext(TURLInfo* pItem);
     556                 :            :         virtual void start();
     557                 :            :         virtual void end();
     558                 :            : };
     559                 :            : 
     560                 :            : //===============================================
     561         [ #  # ]:          0 : class RecovDocListEntry : public SvLBoxString
     562                 :            : {
     563                 :            :     //-------------------------------------------
     564                 :            :     // interface
     565                 :            :     private:
     566                 :            : 
     567                 :            :     //-------------------------------------------
     568                 :            :     // interface
     569                 :            :     public:
     570                 :            : 
     571                 :            :         //---------------------------------------
     572                 :            :         /** @short TODO */
     573                 :            :         RecovDocListEntry(      SvLBoxEntry* pEntry,
     574                 :            :                                 sal_uInt16       nFlags,
     575                 :            :                           const String&      sText );
     576                 :            : 
     577                 :            :         //---------------------------------------
     578                 :            :         /** @short TODO */
     579                 :            :         virtual void Paint(const Point&       aPos   ,
     580                 :            :                                  SvLBox&      aDevice,
     581                 :            :                                  sal_uInt16       nFlags ,
     582                 :            :                                  SvLBoxEntry* pEntry );
     583                 :            : };
     584                 :            : 
     585                 :            : //===============================================
     586                 :            : class RecovDocList : public SvxSimpleTable
     587                 :            : {
     588                 :            :     //-------------------------------------------
     589                 :            :     // member
     590                 :            :     public:
     591                 :            : 
     592                 :            :         Image  m_aGreenCheckImg;
     593                 :            :         Image  m_aYellowCheckImg;
     594                 :            :         Image  m_aRedCrossImg;
     595                 :            : 
     596                 :            :         String m_aSuccessRecovStr;
     597                 :            :         String m_aOrigDocRecovStr;
     598                 :            :         String m_aRecovFailedStr;
     599                 :            :         String m_aRecovInProgrStr;
     600                 :            :         String m_aNotRecovYetStr;
     601                 :            : 
     602                 :            :     //-------------------------------------------
     603                 :            :     // interface
     604                 :            :     public:
     605                 :            : 
     606                 :            :         //---------------------------------------
     607                 :            :         /** @short TODO */
     608                 :            :         RecovDocList(SvxSimpleTableContainer& rParent, ResMgr& rResMgr);
     609                 :            :         //---------------------------------------
     610                 :            :         /** @short TODO */
     611                 :            :         virtual ~RecovDocList();
     612                 :            : 
     613                 :            :         //---------------------------------------
     614                 :            :         /** @short TODO */
     615                 :            :         virtual void InitEntry(      SvLBoxEntry* pEntry ,
     616                 :            :                                const XubString&   sText  ,
     617                 :            :                                const Image&       aImage1,
     618                 :            :                                const Image&       aImage2,
     619                 :            :                                      SvLBoxButtonKind eButtonKind);
     620                 :            : };
     621                 :            : 
     622                 :            : //===============================================
     623                 :            : class RecoveryDialog : public IExtendedTabPage
     624                 :            :                      , public IRecoveryUpdateListener
     625                 :            : {
     626                 :            :     //-------------------------------------------
     627                 :            :     // member
     628                 :            :     private:
     629                 :            :         Window          m_aTitleWin;
     630                 :            :         FixedText       m_aTitleFT;
     631                 :            :         FixedLine       m_aTitleFL;
     632                 :            :         FixedText       m_aDescrFT;
     633                 :            :         FixedText       m_aProgressFT;
     634                 :            :         Window          m_aProgrParent;
     635                 :            :         FixedText       m_aFileListFT;
     636                 :            :         SvxSimpleTableContainer m_aFileListLBContainer;
     637                 :            :         RecovDocList    m_aFileListLB;
     638                 :            :         FixedLine       m_aBottomFL;
     639                 :            :         PushButton      m_aNextBtn;
     640                 :            :         CancelButton    m_aCancelBtn;
     641                 :            :         String          m_aNextStr;
     642                 :            :         String          m_aTitleRecoveryInProgress;
     643                 :            :         String          m_aTitleRecoveryReport;
     644                 :            :         String          m_aRecoveryOnlyFinish;
     645                 :            :         String          m_aRecoveryOnlyFinishDescr;
     646                 :            : 
     647                 :            :         PushButton*     m_pDefButton;
     648                 :            :         RecoveryCore*   m_pCore;
     649                 :            :         css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
     650                 :            :         enum EInternalRecoveryState
     651                 :            :         {
     652                 :            :             E_RECOVERY_PREPARED,            // dialog started ... recovery prepared
     653                 :            :             E_RECOVERY_IN_PROGRESS,         // recovery core still in progress
     654                 :            :             E_RECOVERY_CORE_DONE,           // recovery core finished it's task
     655                 :            :             E_RECOVERY_DONE,                // user clicked "next" button
     656                 :            :             E_RECOVERY_CANCELED,            // user clicked "cancel" button
     657                 :            :             E_RECOVERY_CANCELED_BEFORE,     // user clicked "cancel" button before recovery was started
     658                 :            :             E_RECOVERY_CANCELED_AFTERWARDS, // user clicked "cancel" button after reovery was finished
     659                 :            :             E_RECOVERY_HANDLED              // the recovery wizard page was shown already ... and will be shown now again ...
     660                 :            :         };
     661                 :            :         sal_Int32 m_eRecoveryState;
     662                 :            :         sal_Bool  m_bWaitForUser;
     663                 :            :         sal_Bool  m_bWaitForCore;
     664                 :            :         sal_Bool  m_bUserDecideNext;
     665                 :            :         sal_Bool  m_bWasRecoveryStarted;
     666                 :            :         sal_Bool  m_bRecoveryOnly;
     667                 :            : 
     668                 :            :     //-------------------------------------------
     669                 :            :     // member
     670                 :            :     public:
     671                 :            : 
     672                 :            :         //---------------------------------------
     673                 :            :         /** @short TODO */
     674                 :            :         RecoveryDialog(Window*       pParent,
     675                 :            :                        RecoveryCore* pCore  );
     676                 :            : 
     677                 :            :         //---------------------------------------
     678                 :            :         /** @short TODO */
     679                 :            :         virtual ~RecoveryDialog();
     680                 :            : 
     681                 :            :         //---------------------------------------
     682                 :            :         // IRecoveryUpdateListener
     683                 :            :         virtual void updateItems();
     684                 :            :         virtual void stepNext(TURLInfo* pItem);
     685                 :            :         virtual void start();
     686                 :            :         virtual void end();
     687                 :            : 
     688                 :            :         //---------------------------------------
     689                 :            :         /** @short TODO */
     690                 :            :         virtual short execute();
     691                 :            : 
     692                 :            :         //---------------------------------------
     693                 :            :         /** @short  TODO*/
     694                 :            :         virtual void    setDefButton();
     695                 :            : 
     696                 :            :     //-------------------------------------------
     697                 :            :     // helper
     698                 :            :     private:
     699                 :            : 
     700                 :            :         //---------------------------------------
     701                 :            :         /** @short TODO */
     702                 :            :         DECL_LINK(NextButtonHdl, void*);
     703                 :            :         DECL_LINK(CancelButtonHdl, void*);
     704                 :            : 
     705                 :            :         //---------------------------------------
     706                 :            :         /** @short TODO */
     707                 :            :         String impl_getStatusString( const TURLInfo& rInfo ) const;
     708                 :            : };
     709                 :            : 
     710                 :            : //===============================================
     711                 :            : class BrokenRecoveryDialog : public ModalDialog
     712                 :            : {
     713                 :            :     //-------------------------------------------
     714                 :            :     // member
     715                 :            :     private:
     716                 :            :         FixedText       m_aDescrFT;
     717                 :            :         FixedText       m_aFileListFT;
     718                 :            :         ListBox         m_aFileListLB;
     719                 :            :         FixedText       m_aSaveDirFT;
     720                 :            :         Edit            m_aSaveDirED;
     721                 :            :         PushButton      m_aSaveDirBtn;
     722                 :            :         FixedLine       m_aBottomFL;
     723                 :            :         OKButton        m_aOkBtn;
     724                 :            :         CancelButton    m_aCancelBtn;
     725                 :            : 
     726                 :            :         ::rtl::OUString m_sSavePath;
     727                 :            :         RecoveryCore*   m_pCore;
     728                 :            :         sal_Bool        m_bBeforeRecovery;
     729                 :            :         sal_Bool        m_bExecutionNeeded;
     730                 :            : 
     731                 :            :     //-------------------------------------------
     732                 :            :     // interface
     733                 :            :     public:
     734                 :            : 
     735                 :            :         //---------------------------------------
     736                 :            :         /** @short TODO */
     737                 :            :         BrokenRecoveryDialog(Window*       pParent        ,
     738                 :            :                              RecoveryCore* pCore          ,
     739                 :            :                              sal_Bool      bBeforeRecovery);
     740                 :            : 
     741                 :            :         //---------------------------------------
     742                 :            :         /** @short TODO */
     743                 :            :         virtual ~BrokenRecoveryDialog();
     744                 :            : 
     745                 :            :         //---------------------------------------
     746                 :            :         /** @short TODO */
     747                 :            :         virtual sal_Bool isExecutionNeeded();
     748                 :            : 
     749                 :            :         //---------------------------------------
     750                 :            :         /** @short TODO */
     751                 :            :         virtual ::rtl::OUString getSaveDirURL();
     752                 :            : 
     753                 :            :     //-------------------------------------------
     754                 :            :     // helper
     755                 :            :     private:
     756                 :            : 
     757                 :            :         //---------------------------------------
     758                 :            :         /** @short TODO */
     759                 :            :         void impl_refresh();
     760                 :            : 
     761                 :            :         //---------------------------------------
     762                 :            :         /** @short TODO */
     763                 :            :         DECL_LINK(SaveButtonHdl, void*);
     764                 :            : 
     765                 :            :         //---------------------------------------
     766                 :            :         /** @short TODO */
     767                 :            :         DECL_LINK(OkButtonHdl, void*);
     768                 :            : 
     769                 :            :         //---------------------------------------
     770                 :            :         /** @short TODO */
     771                 :            :         DECL_LINK(CancelButtonHdl, void*);
     772                 :            : 
     773                 :            :         //---------------------------------------
     774                 :            :         /** @short TODO */
     775                 :            :         void impl_askForSavePath();
     776                 :            : };
     777                 :            : 
     778                 :            : 
     779                 :            : 
     780                 :            :         class ErrorRepWelcomeDialog : public IExtendedTabPage
     781                 :            :         {
     782                 :            :         private:
     783                 :            :             Window              maTitleWin;
     784                 :            :             FixedText           maTitleFT;
     785                 :            :             FixedLine           maTitleFL;
     786                 :            :             FixedText           maDescrFT;
     787                 :            : 
     788                 :            :             FixedLine           maBottomFL;
     789                 :            :             PushButton          maPrevBtn;
     790                 :            :             OKButton            maNextBtn;
     791                 :            :             CancelButton        maCancelBtn;
     792                 :            : 
     793                 :            :             DECL_LINK(          PrevBtnHdl, void* );
     794                 :            :             DECL_LINK(          NextBtnHdl, void* );
     795                 :            :             DECL_LINK(          CancelBtnHdl, void* );
     796                 :            :         public:
     797                 :            :                                 ErrorRepWelcomeDialog( Window* _pParent, sal_Bool _bAllowBack = sal_True );
     798                 :            :             virtual             ~ErrorRepWelcomeDialog();
     799                 :            :         /** @short  TODO*/
     800                 :            :         virtual short execute();
     801                 :            : 
     802                 :            :         //---------------------------------------
     803                 :            :         /** @short  TODO*/
     804                 :            :         virtual void    setDefButton();
     805                 :            :         };
     806                 :            : 
     807 [ #  # ][ #  # ]:          0 :         struct ErrorRepParams
         [ #  # ][ #  # ]
     808                 :            :         {
     809                 :          0 :             ErrorRepParams()
     810                 :            : #ifdef WNT
     811                 :            :                 : miHTTPConnectionType( 0 )
     812                 :            : #else
     813                 :            :                 : miHTTPConnectionType( 1 )
     814                 :            : #endif
     815 [ #  # ][ #  # ]:          0 :                 , mbAllowContact( false )
         [ #  # ][ #  # ]
     816                 :          0 :             {}
     817                 :            : 
     818                 :            :             String              maHTTPProxyServer;
     819                 :            :             String              maHTTPProxyPort;
     820                 :            :             int                 miHTTPConnectionType;
     821                 :            :             bool                mbAllowContact;
     822                 :            :             String              maReturnAddress;
     823                 :            :             String              maSubject;
     824                 :            :             String              maBody;
     825                 :            :         };
     826                 :            : 
     827                 :            :         class ErrorDescriptionEdit : public MultiLineEdit
     828                 :            :         {
     829                 :            :         private:
     830                 :            :                         DECL_LINK( ModifyHdl, void* );
     831                 :            : 
     832                 :            :         public:
     833                 :            :                         ErrorDescriptionEdit( Window* pParent, const ResId& rResId );
     834                 :            :             virtual     ~ErrorDescriptionEdit();
     835                 :            :         };
     836                 :            : 
     837                 :            :         class ErrorRepSendDialog : public IExtendedTabPage
     838                 :            :         {
     839                 :            :         private:
     840                 :            :             Window              maTitleWin;
     841                 :            :             FixedText           maTitleFT;
     842                 :            :             FixedLine           maTitleFL;
     843                 :            :             FixedText           maDescrFT;
     844                 :            : 
     845                 :            :             FixedText           maDocTypeFT;
     846                 :            :             Edit                maDocTypeED;
     847                 :            :             FixedText           maUsingFT;
     848                 :            :             ErrorDescriptionEdit maUsingML;
     849                 :            :             PushButton          maShowRepBtn;
     850                 :            :             PushButton          maOptBtn;
     851                 :            :             CheckBox            maContactCB;
     852                 :            :             FixedText           maEMailAddrFT;
     853                 :            :             Edit                maEMailAddrED;
     854                 :            : 
     855                 :            :             FixedLine           maBottomFL;
     856                 :            :             PushButton          maPrevBtn;
     857                 :            :             OKButton            maNextBtn;
     858                 :            :             CancelButton        maCancelBtn;
     859                 :            : 
     860                 :            :             ErrorRepParams      maParams;
     861                 :            : 
     862                 :            :             DECL_LINK(          ShowRepBtnHdl, void* );
     863                 :            :             DECL_LINK(          OptBtnHdl, void* );
     864                 :            :             DECL_LINK(          ContactCBHdl, void* );
     865                 :            :             DECL_LINK(          PrevBtnHdl, void* );
     866                 :            :             DECL_LINK(          SendBtnHdl, void* );
     867                 :            :             DECL_LINK(          CancelBtnHdl, void* );
     868                 :            : 
     869                 :            :             void                initControls();
     870                 :            : 
     871                 :            :         public:
     872                 :            :                                 ErrorRepSendDialog( Window* _pParent );
     873                 :            :             virtual             ~ErrorRepSendDialog();
     874                 :            : 
     875                 :            :             String              GetDocType( void ) const;
     876                 :            :             String              GetUsing( void ) const;
     877                 :            :             bool                IsContactAllowed( void ) const;
     878                 :            :             String              GetEMailAddress( void ) const;
     879                 :            : 
     880                 :            :             bool                ReadParams();
     881                 :            :             bool                SaveParams();
     882                 :            :             bool                SendReport();
     883                 :            : 
     884                 :            :             /** @short  TODO*/
     885                 :            :             virtual short execute();
     886                 :            : 
     887                 :            :             //---------------------------------------
     888                 :            :             /** @short  TODO*/
     889                 :            :             virtual void    setDefButton();
     890                 :            :         };
     891                 :            : 
     892                 :            :         class ErrorRepOptionsDialog : public ModalDialog
     893                 :            :         {
     894                 :            :         private:
     895                 :            :             FixedLine           maProxyFL;
     896                 :            :             RadioButton         maSystemBtn;
     897                 :            :             RadioButton         maDirectBtn;
     898                 :            :             RadioButton         maManualBtn;
     899                 :            :             FixedText           maProxyServerFT;
     900                 :            :             Edit                maProxyServerEd;
     901                 :            :             FixedText           maProxyPortFT;
     902                 :            :             Edit                maProxyPortEd;
     903                 :            :             FixedText           maDescriptionFT;
     904                 :            :             FixedLine           maButtonsFL;
     905                 :            :             OKButton            maOKBtn;
     906                 :            :             CancelButton        maCancelBtn;
     907                 :            : 
     908                 :            :             ErrorRepParams&     mrParams;
     909                 :            : 
     910                 :            :             DECL_LINK(          CancelBtnHdl, void* );
     911                 :            :             DECL_LINK(          OKBtnHdl, void * );
     912                 :            :             DECL_LINK(          ManualBtnHdl, void * );
     913                 :            : 
     914                 :            :         public:
     915                 :            :                                 ErrorRepOptionsDialog( Window* _pParent, ErrorRepParams& rParams );
     916                 :            :             virtual             ~ErrorRepOptionsDialog();
     917                 :            :         };
     918                 :            : 
     919                 :            :         class ErrorRepEdit : public ExtMultiLineEdit
     920                 :            :         {
     921                 :            :         public:
     922                 :            :                         ErrorRepEdit( Window* pParent, const ResId& rResId );
     923                 :            :             virtual     ~ErrorRepEdit();
     924                 :            :         };
     925                 :            : 
     926                 :            :         class ErrorRepPreviewDialog : public ModalDialog
     927                 :            :         {
     928                 :            :         private:
     929                 :            :             ErrorRepEdit        maContentML;
     930                 :            :             OKButton            maOKBtn;
     931                 :            : 
     932                 :            :             long                mnMinHeight;
     933                 :            : 
     934                 :            :         public:
     935                 :            :                                 ErrorRepPreviewDialog( Window* _pParent );
     936                 :            :             virtual             ~ErrorRepPreviewDialog();
     937                 :            : 
     938                 :            :             virtual void        Resize();
     939                 :            :         };
     940                 :            :     }   // namespace DocRecovery
     941                 :            : }   // namespace svx
     942                 :            : 
     943                 :            : #endif
     944                 :            : 
     945                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10