LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/dialogs - restartdialog.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 27 0.0 %
Date: 2012-12-27 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include "sal/config.h"
      11             : 
      12             : #include <cassert>
      13             : 
      14             : #include "com/sun/star/task/OfficeRestartManager.hpp"
      15             : #include "com/sun/star/task/XInteractionHandler.hpp"
      16             : #include "com/sun/star/uno/Reference.hxx"
      17             : #include "com/sun/star/uno/XComponentContext.hpp"
      18             : #include "svtools/restartdialog.hxx"
      19             : #include "tools/link.hxx"
      20             : #include "vcl/button.hxx"
      21             : #include "vcl/dialog.hxx"
      22             : #include "vcl/window.hxx"
      23             : 
      24             : namespace {
      25             : 
      26           0 : class RestartDialog: public ModalDialog {
      27             : public:
      28           0 :     RestartDialog(Window * parent, svtools::RestartReason reason):
      29           0 :         ModalDialog(parent, "RestartDialog", "svt/ui/restartdialog.ui")
      30             :     {
      31           0 :         get(btnYes_, "yes");
      32           0 :         get(btnNo_, "no");
      33           0 :         switch (reason) {
      34             :         case svtools::RESTART_REASON_JAVA:
      35           0 :             get(reason_, "reason_java");
      36           0 :             break;
      37             :         case svtools::RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT:
      38           0 :             get(reason_, "reason_pdf");
      39           0 :             break;
      40             :         case svtools::RESTART_REASON_BIBLIOGRAPHY_INSTALL:
      41           0 :             get(reason_, "reason_bibliography_install");
      42           0 :             break;
      43             :         default:
      44             :             assert(false); // this cannot happen
      45             :         }
      46           0 :         reason_->Show();
      47           0 :         btnYes_->SetClickHdl(LINK(this, RestartDialog, hdlYes));
      48           0 :         btnNo_->SetClickHdl(LINK(this, RestartDialog, hdlNo));
      49           0 :     }
      50             : 
      51             : private:
      52             :     DECL_LINK(hdlYes, void *);
      53             :     DECL_LINK(hdlNo, void *);
      54             : 
      55             :     Window * reason_;
      56             :     PushButton * btnYes_;
      57             :     PushButton * btnNo_;
      58             : };
      59             : 
      60           0 : IMPL_LINK_NOARG(RestartDialog, hdlYes) {
      61           0 :     EndDialog(true);
      62           0 :     return 0;
      63             : }
      64             : 
      65           0 : IMPL_LINK_NOARG(RestartDialog, hdlNo) {
      66           0 :     EndDialog(false);
      67           0 :     return 0;
      68             : }
      69             : 
      70             : }
      71             : 
      72           0 : void svtools::executeRestartDialog(
      73             :     css::uno::Reference< css::uno::XComponentContext > const & context,
      74             :     Window * parent, RestartReason reason)
      75             : {
      76           0 :     if (RestartDialog(parent, reason).Execute()) {
      77           0 :         css::task::OfficeRestartManager::get(context)->requestRestart(
      78           0 :             css::uno::Reference< css::task::XInteractionHandler >());
      79             :     }
      80           0 : }
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10