LCOV - code coverage report
Current view: top level - include/tools - errinf.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 14 0.0 %
Date: 2014-04-14 Functions: 0 16 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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef __RSC
      21             : 
      22             : #ifndef INCLUDED_TOOLS_ERRINF_HXX
      23             : #define INCLUDED_TOOLS_ERRINF_HXX
      24             : 
      25             : #include <limits.h>
      26             : #include <rtl/ustring.hxx>
      27             : #include <tools/rtti.hxx>
      28             : #include <tools/errcode.hxx>
      29             : #include <tools/toolsdllapi.h>
      30             : 
      31             : class EDcr_Impl;
      32             : class ErrHdl_Impl;
      33             : class Window;
      34             : 
      35             : class ErrorInfo
      36             : {
      37             : private:
      38             :     sal_uIntPtr             lUserId;
      39             : 
      40             : public:
      41             :                             TYPEINFO();
      42             : 
      43           0 :                             ErrorInfo( sal_uIntPtr lArgUserId ) :
      44           0 :                                 lUserId( lArgUserId ){}
      45           0 :     virtual                 ~ErrorInfo(){}
      46             : 
      47           0 :     sal_uIntPtr             GetErrorCode() const { return lUserId; }
      48             : 
      49             :     static ErrorInfo*       GetErrorInfo(sal_uIntPtr);
      50             : };
      51             : 
      52             : class TOOLS_DLLPUBLIC DynamicErrorInfo : public ErrorInfo
      53             : {
      54             :     friend class EDcr_Impl;
      55             : 
      56             : private:
      57             :     EDcr_Impl*              pImpl;
      58             : 
      59             : public:
      60             :                             TYPEINFO_OVERRIDE();
      61             : 
      62             :                             DynamicErrorInfo(sal_uIntPtr lUserId, sal_uInt16 nMask);
      63             :     virtual                 ~DynamicErrorInfo();
      64             : 
      65             :     operator                sal_uIntPtr() const;
      66             :     sal_uInt16              GetDialogMask() const;
      67             : };
      68             : 
      69           0 : class TOOLS_DLLPUBLIC StringErrorInfo : public DynamicErrorInfo
      70             : {
      71             : private:
      72             :     OUString                aString;
      73             : 
      74             : public:
      75             :                             TYPEINFO_OVERRIDE();
      76             : 
      77             :                             StringErrorInfo( sal_uIntPtr lUserId,
      78             :                                             const OUString& aStringP,
      79             :                                             sal_uInt16 nFlags = 0);
      80           0 :     const OUString&         GetErrorString() const { return aString; }
      81             : };
      82             : 
      83             : class TOOLS_DLLPUBLIC TwoStringErrorInfo: public DynamicErrorInfo
      84             : {
      85             : private:
      86             :     OUString aArg1;
      87             :     OUString aArg2;
      88             : 
      89             : public:
      90             :     TYPEINFO_OVERRIDE();
      91             : 
      92           0 :     TwoStringErrorInfo(sal_uIntPtr nUserID, const OUString & rTheArg1,
      93             :                        const OUString & rTheArg2, sal_uInt16 nFlags = 0):
      94           0 :         DynamicErrorInfo(nUserID, nFlags), aArg1(rTheArg1), aArg2(rTheArg2) {}
      95             : 
      96           0 :     virtual ~TwoStringErrorInfo() {}
      97             : 
      98           0 :     const OUString& GetArg1() const { return aArg1; }
      99           0 :     const OUString& GetArg2() const { return aArg2; }
     100             : };
     101             : 
     102           0 : class TOOLS_DLLPUBLIC MessageInfo : public DynamicErrorInfo
     103             : {
     104             : public:
     105             :     TYPEINFO_OVERRIDE();
     106             : 
     107             :     MessageInfo(sal_uIntPtr UserId, sal_uInt16 nFlags = 0) :
     108             :         DynamicErrorInfo(UserId, nFlags) {}
     109             :     MessageInfo(sal_uIntPtr UserId, const OUString &rArg, sal_uInt16 nFlags = 0 ) :
     110             :         DynamicErrorInfo(UserId, nFlags), aArg(rArg) {}
     111             : 
     112           0 :     const OUString&         GetMessageArg() const { return aArg; }
     113             : 
     114             : private:
     115             :     OUString           aArg;
     116             : };
     117             : 
     118             : class TOOLS_DLLPUBLIC ErrorContext
     119             : {
     120             :     friend class ErrorHandler;
     121             : 
     122             : private:
     123             :     ErrorContext*           pNext;
     124             :     Window*                 pWin;
     125             : 
     126             : public:
     127             :                             ErrorContext(Window *pWin=0);
     128             :     virtual                 ~ErrorContext();
     129             : 
     130             :     virtual bool            GetString( sal_uIntPtr nErrId, OUString& rCtxStr ) = 0;
     131           0 :     Window*                 GetParent() { return pWin; }
     132             : 
     133             :     static ErrorContext*    GetContext();
     134             : };
     135             : 
     136             : typedef sal_uInt16 WindowDisplayErrorFunc(
     137             :     Window *, sal_uInt16 nMask, const OUString &rErr, const OUString &rAction);
     138             : 
     139             : typedef void BasicDisplayErrorFunc(
     140             :     const OUString &rErr, const OUString &rAction);
     141             : 
     142             : class TOOLS_DLLPUBLIC ErrorHandler
     143             : {
     144             :     friend class ErrHdl_Impl;
     145             : 
     146             : private:
     147             :     ErrHdl_Impl*        pImpl;
     148             : 
     149             :     static sal_uInt16   HandleError_Impl( sal_uIntPtr lId,
     150             :                               sal_uInt16 nFlags,
     151             :                               bool bJustCreateString,
     152             :                               OUString & rError);
     153             : protected:
     154             :     virtual bool        CreateString( const ErrorInfo *,
     155             :                               OUString &, sal_uInt16& nMask ) const = 0;
     156             : 
     157             : public:
     158             :                         ErrorHandler();
     159             :     virtual             ~ErrorHandler();
     160             : 
     161             :     static sal_uInt16   HandleError ( sal_uIntPtr lId, sal_uInt16 nMask = USHRT_MAX );
     162             :     static bool         GetErrorString( sal_uIntPtr lId, OUString& rStr );
     163             : 
     164             :     static void         RegisterDisplay( BasicDisplayErrorFunc* );
     165             :     static void         RegisterDisplay( WindowDisplayErrorFunc* );
     166             : };
     167             : 
     168             : #endif
     169             : #endif
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10