diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-06-10 18:55:07 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-10 18:55:07 +0200 |
commit | 7bf2f61ac786e969e33693647b1365aca3b2731c (patch) | |
tree | 900a2113ad5d5e06296cecaf2d88363168279f96 /framework | |
parent | 0def3a7dc4c0eacd95eeba71af71eface4f42260 (diff) |
Clean up uses of Any::getValue() in framework
Change-Id: I55982944bf2ee3d9aa6899bcc59e94f9342b4036
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/recording/dispatchrecorder.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx index c1bf64606c33..b4298edf8dea 100644 --- a/framework/source/recording/dispatchrecorder.cxx +++ b/framework/source/recording/dispatchrecorder.cxx @@ -20,6 +20,7 @@ #include <recording/dispatchrecorder.hxx> #include <com/sun/star/frame/DispatchStatement.hpp> #include <com/sun/star/script/Converter.hpp> +#include <o3tl/any.hxx> #include <services.h> #include <vcl/svapp.hxx> #include <comphelper/processfactory.hxx> @@ -251,15 +252,14 @@ void SAL_CALL DispatchRecorder::AppendToBuffer( const css::uno::Any& aValue, OUS else aArgumentBuffer.append("\"\""); } - else if (aValue.getValueType() == cppu::UnoType<cppu::UnoCharType>::get()) + else if (auto nVal = o3tl::tryAccess<sal_Unicode>(aValue)) { // character variables are recorded as strings, back conversion must be handled in client code - sal_Unicode nVal = *static_cast<sal_Unicode const *>(aValue.getValue()); aArgumentBuffer.append("\""); - if ( (sal_Unicode(nVal) == '\"') ) + if ( (*nVal == '\"') ) // encode \" to \"\" - aArgumentBuffer.append((sal_Unicode)nVal); - aArgumentBuffer.append((sal_Unicode)nVal); + aArgumentBuffer.append(*nVal); + aArgumentBuffer.append(*nVal); aArgumentBuffer.append("\""); } else @@ -416,9 +416,7 @@ void SAL_CALL DispatchRecorder::replaceByIndex(sal_Int32 idx, const css::uno::An } - css::frame::DispatchStatement const *pStatement; - - pStatement = static_cast<css::frame::DispatchStatement const *>(element.getValue()); + auto pStatement = o3tl::doAccess<css::frame::DispatchStatement>(element); css::frame::DispatchStatement aStatement( pStatement->aCommand, |