diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-04-23 22:01:46 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-04-27 08:12:28 +0200 |
commit | 201f05f9bf66d0467b1137f3712108a96c159698 (patch) | |
tree | 0190be400c55c5647acad545115fea9a4007f909 /vcl/source/window/errinf.cxx | |
parent | 7c4c9947b8e52ce67af1ab131ed583a41f0ddbfa (diff) |
vcl: move RegisterDisplay() from ErrorHandler to ErrorRegistry
It is the error registry that should register the display, not
the error handler. Move this function to the class that is
responsible for it.
Change-Id: I95ca1662b907a7f38a42a39ec729b35fd530bb79
Reviewed-on: https://gerrit.libreoffice.org/36853
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl/source/window/errinf.cxx')
-rw-r--r-- | vcl/source/window/errinf.cxx | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/vcl/source/window/errinf.cxx b/vcl/source/window/errinf.cxx index fbef60953241..b6ed18d616c1 100644 --- a/vcl/source/window/errinf.cxx +++ b/vcl/source/window/errinf.cxx @@ -27,25 +27,14 @@ #include <limits.h> class ErrorHandler; +class TheErrorRegistry: public rtl::Static<ErrorRegistry, TheErrorRegistry> {}; -namespace { - typedef void (* DisplayFnPtr)(); -} - -struct ErrorRegistry +void ErrorRegistry::RegisterDisplay(WindowDisplayErrorFunc *aDsp) { -public: - std::vector<ErrorHandler*> errorHandlers; - std::vector<ErrorContext*> contexts; - DisplayFnPtr pDsp; - bool bIsWindowDsp; - - DynamicErrorInfo* ppDynErrInfo[ERRCODE_DYNAMIC_COUNT]; - sal_uInt16 nNextError; - ErrorRegistry(); -}; - -struct TheErrorRegistry: public rtl::Static<ErrorRegistry, TheErrorRegistry> {}; + ErrorRegistry &rData = TheErrorRegistry::get(); + rData.bIsWindowDsp = true; + rData.pDsp = reinterpret_cast< DisplayFnPtr >(aDsp); +} class DynamicErrorInfo_Impl { @@ -71,6 +60,13 @@ ErrorRegistry::ErrorRegistry() rp = nullptr; } +void ErrorRegistry::RegisterDisplay(BasicDisplayErrorFunc *aDsp) +{ + ErrorRegistry &rData = TheErrorRegistry::get(); + rData.bIsWindowDsp = false; + rData.pDsp = reinterpret_cast< DisplayFnPtr >(aDsp); +} + void DynamicErrorInfo_Impl::RegisterError(DynamicErrorInfo *pDynErrInfo) { // Register dynamic identifier @@ -194,7 +190,7 @@ ErrorHandler::ErrorHandler() rData.errorHandlers.insert(rData.errorHandlers.begin(), this); if(!rData.pDsp) - RegisterDisplay(&aDspFunc); + ErrorRegistry::RegisterDisplay(&aDspFunc); } ErrorHandler::~ErrorHandler() @@ -209,20 +205,6 @@ vcl::Window* ErrorContext::GetParent() return pImpl ? pImpl->pWin : nullptr; } -void ErrorHandler::RegisterDisplay(WindowDisplayErrorFunc *aDsp) -{ - ErrorRegistry &rData = TheErrorRegistry::get(); - rData.bIsWindowDsp = true; - rData.pDsp = reinterpret_cast< DisplayFnPtr >(aDsp); -} - -void ErrorHandler::RegisterDisplay(BasicDisplayErrorFunc *aDsp) -{ - ErrorRegistry &rData = TheErrorRegistry::get(); - rData.bIsWindowDsp = false; - rData.pDsp = reinterpret_cast< DisplayFnPtr >(aDsp); -} - bool ErrorHandler::GetErrorString(sal_uInt32 nErrCodeId, OUString& rErrStr) { OUString aErr; |