diff options
-rw-r--r-- | include/tools/errinf.hxx | 11 | ||||
-rw-r--r-- | tools/source/ref/errinf.cxx | 29 |
2 files changed, 28 insertions, 12 deletions
diff --git a/include/tools/errinf.hxx b/include/tools/errinf.hxx index ae6e14015e9c..4a9f07a69d62 100644 --- a/include/tools/errinf.hxx +++ b/include/tools/errinf.hxx @@ -27,11 +27,12 @@ #include <tools/rtti.hxx> #include <tools/errcode.hxx> #include <tools/toolsdllapi.h> -#include <vcl/vclptr.hxx> + +// FIXME: horrible legacy dependency on VCL from tools. +namespace vcl { class Window; } class EDcr_Impl; class ErrHdl_Impl; -namespace vcl { class Window; } class ErrorInfo { @@ -116,20 +117,20 @@ private: OUString aArg; }; +struct ErrorContextImpl; class TOOLS_DLLPUBLIC ErrorContext { friend class ErrorHandler; private: - ErrorContext* pNext; - VclPtr<vcl::Window> pWin; + ErrorContextImpl *pImpl; public: ErrorContext(vcl::Window *pWin=0); virtual ~ErrorContext(); virtual bool GetString( sal_uIntPtr nErrId, OUString& rCtxStr ) = 0; - vcl::Window* GetParent() { return pWin; } + vcl::Window* GetParent(); static ErrorContext* GetContext(); }; diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index babe0acd776f..688cd93109c3 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -186,22 +186,32 @@ static void aDspFunc(const OUString &rErr, const OUString &rAction) OSL_FAIL(aErr.getStr()); } +// FIXME: this is a truly horrible reverse dependency on VCL +#include <vcl/window.hxx> +struct ErrorContextImpl +{ + ErrorContext* pNext; + VclPtr<vcl::Window> pWin; +}; + ErrorContext::ErrorContext(vcl::Window *pWinP) { + pImpl = new ErrorContextImpl(); EDcrData *pData=EDcrData::GetData(); - ErrorContext *&pHdl=pData->pFirstCtx; - pWin=pWinP; - pNext=pHdl; - pHdl=this; + ErrorContext *&pHdl = pData->pFirstCtx; + pImpl->pWin = pWinP; + pImpl->pNext = pHdl; + pHdl = this; } ErrorContext::~ErrorContext() { ErrorContext **ppCtx=&(EDcrData::GetData()->pFirstCtx); while(*ppCtx && *ppCtx!=this) - ppCtx=&((*ppCtx)->pNext); + ppCtx=&((*ppCtx)->pImpl->pNext); if(*ppCtx) - *ppCtx=(*ppCtx)->pNext; + *ppCtx=(*ppCtx)->pImpl->pNext; + delete pImpl; } ErrorContext *ErrorContext::GetContext() @@ -230,6 +240,11 @@ ErrorHandler::~ErrorHandler() delete pImpl; } +vcl::Window* ErrorContext::GetParent() +{ + return pImpl ? pImpl->pWin.get() : NULL; +} + void ErrorHandler::RegisterDisplay(WindowDisplayErrorFunc *aDsp) { EDcrData *pData=EDcrData::GetData(); @@ -276,7 +291,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl( pCtx->GetString(pInfo->GetErrorCode(), aAction); vcl::Window *pParent=0; // Remove parent from context - for(;pCtx;pCtx=pCtx->pNext) + for(;pCtx;pCtx=pCtx->pImpl->pNext) if(pCtx->GetParent()) { pParent=pCtx->GetParent(); |