Rebased ref, commits from common ancestor: commit 6380cfbe303a682c7d83ae96c3eed70410becd51 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Tue Jan 17 10:42:10 2017 +0100
MM send event for successful emails Most times generating the mail merge documents will be much faster then posting them as emails to an SMTP server, so this informs a mail merge user about the posted mail status. Change-Id: I980e3d86739f1cfd79c52852c720a0bc42d96158 diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx index f0fc855..0ad7e39 100644 --- a/include/sfx2/event.hxx +++ b/include/sfx2/event.hxx @@ -67,6 +67,7 @@ enum class SfxEventHintId { SwEventFieldMerge, SwEventFieldMergeFinished, SwEventLayoutFinished, + SwEventMailMergeSendMail, }; class SFX2_DLLPUBLIC SfxEventHint : public SfxHint diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx index ed63b5f..432cf86 100644 --- a/sw/inc/swevent.hxx +++ b/sw/inc/swevent.hxx @@ -44,6 +44,7 @@ #define STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10 #define STR_SW_EVENT_FRM_RESIZE 11 #define STR_SW_EVENT_FRM_MOVE 12 +#define STR_SW_EVENT_MAIL_MERGE_SEND_MAIL 13 class SwFrameFormat; class SwFormatINetFormat; diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index ec6d483..a9bcce9 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -302,6 +302,7 @@ struct SwDBManager::SwDBManager_Impl rtl::Reference<SwDataSourceRemovedListener> m_xDataSourceRemovedListener; osl::Mutex m_aAllEmailSendMutex; uno::Reference< mail::XMailMessage> m_xLastMessage; + SfxObjectShell *m_pObjectShell; explicit SwDBManager_Impl(SwDBManager& rDBManager) : pMergeData( nullptr ) @@ -1090,6 +1091,9 @@ public: virtual void mailDelivered( ::rtl::Reference<MailDispatcher>, uno::Reference< mail::XMailMessage> xMessage ) override { + lcl_emitEvent( SfxEventHintId::SwEventMailMergeSendMail, + STR_SW_EVENT_MAIL_MERGE_SEND_MAIL, + m_rDBManager.pImpl->m_pObjectShell ); osl::MutexGuard aGuard( m_rDBManager.pImpl->m_aAllEmailSendMutex ); if ( m_rDBManager.pImpl->m_xLastMessage == xMessage ) m_rDBManager.pImpl->m_xLastMessage.clear(); @@ -1182,6 +1186,8 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, { // Reset internal mail accounting data pImpl->m_xLastMessage.clear(); + pImpl->m_pObjectShell = + pSourceShell->GetView().GetViewFrame()->GetObjectShell(); xMailDispatcher.set( new MailDispatcher(rMergeDescriptor.xSmtpServer) ); xMailListener = new MailDispatcherListener_Impl( *this ); commit 69affe31849c6015975562050b26f2a0a8808909 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Thu Jan 12 15:48:52 2017 +0100 tdf#105288 MM wait until all emails are send Seems mail merge is now much faster then the sending of the merged documents via email. This is why the attached workaround patch to the tdf#103919 bug report, which simply sleeps after queuing a new message, helped solving the problem. It slowes down the mail merge and gives time to the mail dispatcher thread. But we actually want to wait until all mails are send, so we have to add a listener and wait for the mail thread to become idle. This listener also allows us to cancel further mail merge when an SMTP error has occured. Change-Id: I9d13bcd8f0d0ff084b20d72ab96f70afa3a764ba diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index bc22bdf..e1ad5f7 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -238,6 +238,7 @@ class SW_DLLPUBLIC SwDBManager { struct SwDBManager_Impl; class ConnectionDisposedListener_Impl; + class MailDispatcherListener_Impl; enum class MergeStatus { diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index e372b8e..ec6d483 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -132,6 +132,7 @@ #include <calc.hxx> #include <dbfld.hxx> #include <IDocumentState.hxx> +#include <imaildsplistener.hxx> #include <memory> #include <comphelper/propertysequence.hxx> @@ -295,10 +296,12 @@ void SwDataSourceRemovedListener::Dispose() struct SwDBManager::SwDBManager_Impl { - SwDSParam* pMergeData; + SwDSParam *pMergeData; VclPtr<AbstractMailMergeDlg> pMergeDialog; rtl::Reference<SwDBManager::ConnectionDisposedListener_Impl> m_xDisposeListener; rtl::Reference<SwDataSourceRemovedListener> m_xDataSourceRemovedListener; + osl::Mutex m_aAllEmailSendMutex; + uno::Reference< mail::XMailMessage> m_xLastMessage; explicit SwDBManager_Impl(SwDBManager& rDBManager) : pMergeData( nullptr ) @@ -1020,14 +1023,13 @@ static SfxObjectShell* lcl_CreateWorkingDocument( return xWorkObjectShell.get(); } -uno::Reference< mail::XMailMessage > lcl_CreateMailFromDoc( +static SwMailMessage* lcl_CreateMailFromDoc( const SwMergeDescriptor &rMergeDescriptor, const OUString &sFileURL, const OUString &sMailRecipient, const OUString &sMailBodyMimeType, rtl_TextEncoding sMailEncoding, const OUString &sAttachmentMimeType ) { SwMailMessage* pMessage = new SwMailMessage; - uno::Reference< mail::XMailMessage > xMessage = pMessage; if( rMergeDescriptor.pMailMergeConfigItem->IsMailReplyTo() ) pMessage->setReplyToAddress(rMergeDescriptor.pMailMergeConfigItem->GetMailReplyTo()); pMessage->addRecipient( sMailRecipient ); @@ -1050,7 +1052,7 @@ uno::Reference< mail::XMailMessage > lcl_CreateMailFromDoc( SvStream* pInStream = aMedium.GetInStream(); assert( pInStream && "no output file created?" ); if( !pInStream ) - return xMessage; + return pMessage; pInStream->SetStreamCharSet( sMailEncoding ); OString sLine; @@ -1070,10 +1072,39 @@ uno::Reference< mail::XMailMessage > lcl_CreateMailFromDoc( for( const OUString& sBccRecipient : rMergeDescriptor.aBlindCopiesTo ) pMessage->addBccRecipient( sBccRecipient ); - xMessage = pMessage; - return xMessage; + return pMessage; } +class SwDBManager::MailDispatcherListener_Impl : public IMailDispatcherListener +{ + SwDBManager &m_rDBManager; + +public: + explicit MailDispatcherListener_Impl( SwDBManager &rDBManager ) + : m_rDBManager( rDBManager ) {} + + virtual void started( ::rtl::Reference<MailDispatcher> ) override {}; + virtual void stopped( ::rtl::Reference<MailDispatcher> ) override {}; + virtual void idle( ::rtl::Reference<MailDispatcher> ) override {}; + + virtual void mailDelivered( ::rtl::Reference<MailDispatcher>, + uno::Reference< mail::XMailMessage> xMessage ) override + { + osl::MutexGuard aGuard( m_rDBManager.pImpl->m_aAllEmailSendMutex ); + if ( m_rDBManager.pImpl->m_xLastMessage == xMessage ) + m_rDBManager.pImpl->m_xLastMessage.clear(); + } + + virtual void mailDeliveryError( ::rtl::Reference<MailDispatcher> xMailDispatcher, + uno::Reference< mail::XMailMessage>, const OUString& ) override + { + osl::MutexGuard aGuard( m_rDBManager.pImpl->m_aAllEmailSendMutex ); + m_rDBManager.m_aMergeStatus = MergeStatus::ERROR; + m_rDBManager.pImpl->m_xLastMessage.clear(); + xMailDispatcher->stop(); + } +}; + /** * Please have a look at the README in the same directory, before you make * larger changes in this function! @@ -1120,7 +1151,8 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, nMaxDumpDocs = OUString(sMaxDumpDocs, strlen(sMaxDumpDocs), osl_getThreadTextEncoding()).toInt32(); } - ::rtl::Reference< MailDispatcher > xMailDispatcher; + ::rtl::Reference< MailDispatcher > xMailDispatcher; + ::rtl::Reference< IMailDispatcherListener > xMailListener; OUString sMailBodyMimeType; rtl_TextEncoding sMailEncoding = ::osl_getThreadTextEncoding(); @@ -1148,7 +1180,12 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, if( bMT_EMAIL ) { - xMailDispatcher.set( new MailDispatcher(rMergeDescriptor.xSmtpServer)); + // Reset internal mail accounting data + pImpl->m_xLastMessage.clear(); + + xMailDispatcher.set( new MailDispatcher(rMergeDescriptor.xSmtpServer) ); + xMailListener = new MailDispatcherListener_Impl( *this ); + xMailDispatcher->addListener( xMailListener ); if(!rMergeDescriptor.bSendAsAttachment && rMergeDescriptor.bSendAsHTML) { sMailBodyMimeType = "text/html; charset="; @@ -1485,6 +1522,8 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, sMailEncoding, pStoreToFilter->GetMimeType() ); if( xMessage.is() ) { + osl::MutexGuard aGuard( pImpl->m_aAllEmailSendMutex ); + pImpl->m_xLastMessage.set( xMessage ); xMailDispatcher->enqueueMailMessage( xMessage ); if( !xMailDispatcher->isStarted() ) xMailDispatcher->start(); @@ -1594,10 +1633,6 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, pProgressDlg.disposeAndClear(); - // remove the temporary files - for( const OUString &sFileURL : aFilesToRemove ) - SWUnoHelper::UCB_DeleteFile( sFileURL ); - // unlock all dispatchers pViewFrame = SfxViewFrame::GetFirst(pSourceDocSh); while (pViewFrame) @@ -1610,10 +1645,29 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, if( xMailDispatcher.is() ) { + if( IsMergeOk() ) + { + // TODO: Instead of polling via an AutoTimer, post an Idle event, + // if the main loop has been made thread-safe. + AutoTimer aEmailDispatcherPollTimer; + aEmailDispatcherPollTimer.SetDebugName( + "sw::SwDBManager aEmailDispatcherPollTimer" ); + aEmailDispatcherPollTimer.SetTimeout( 500 ); + aEmailDispatcherPollTimer.Start(); + while( IsMergeOk() && pImpl->m_xLastMessage.is() ) + Application::Yield(); + aEmailDispatcherPollTimer.Stop(); + } xMailDispatcher->stop(); xMailDispatcher->shutdown(); } + // remove the temporary files + // has to be done after xMailDispatcher is finished, as mails may be + // delivered as message attachments! + for( const OUString &sFileURL : aFilesToRemove ) + SWUnoHelper::UCB_DeleteFile( sFileURL ); + return !IsMergeError(); } commit 6574aa57db96938248388c470d4061eca70bfa2e Author: Michael Stahl <mst...@redhat.com> Date: Tue Jan 17 16:15:07 2017 +0100 remove SunStudio hacks There is no "SOLARIS compiler". Change-Id: Idcfaee36307b1a4112f7fd6702c5f0e528f812c8 diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx index 039db83..d1165a6 100644 --- a/slideshow/source/inc/tools.hxx +++ b/slideshow/source/inc/tools.hxx @@ -292,20 +292,6 @@ namespace slideshow return comphelper::rng::uniform_size_distribution(0, n-1); } - /// To work around ternary operator in initializer lists - /// (Solaris compiler problems) -#ifdef __sun - template <typename T> - inline T const & ternary_op( - const bool cond, T const & arg1, T const & arg2 ) - { - if (cond) - return arg1; - else - return arg2; - } -#endif - template <typename ValueType> inline bool getPropertyValue( ValueType & rValue, diff --git a/svx/source/sdr/event/eventhandler.cxx b/svx/source/sdr/event/eventhandler.cxx index ae55c9e..9511c62 100644 --- a/svx/source/sdr/event/eventhandler.cxx +++ b/svx/source/sdr/event/eventhandler.cxx @@ -19,8 +19,6 @@ #include "eventhandler.hxx" -// for SOLARIS compiler include of algorithm part of _STL is necessary to -// get access to basic algos like ::std::find #include <algorithm> #include <tools/debug.hxx> diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx index 6438bc7..32ed7db 100644 --- a/svx/source/sdr/overlay/overlayobjectlist.cxx +++ b/svx/source/sdr/overlay/overlayobjectlist.cxx @@ -24,8 +24,6 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <tools/gen.hxx> -// for SOLARIS compiler include of algorithm part of _STL is necessary to -// get access to basic algos like ::std::find #include <algorithm> #include <drawinglayer/processor2d/hittestprocessor2d.hxx> commit 0cee740c95496210d62206a21e8bc9adebf4fa4d Author: Michael Stahl <mst...@redhat.com> Date: Tue Jan 17 16:13:54 2017 +0100 replace #ifdef SOLARIS with #ifdef __sun Check for a macro that is defined by the compiler, we don't really need one defined by the build system. Change-Id: Iccb8e3198396881395c97a6b81690ebe64b7e9d2 diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 5c23f18..79a875b 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -103,7 +103,7 @@ inline OUString getBuildId() } -#if defined LINUX || defined SOLARIS +#if (defined LINUX || defined __sun) inline OUString getBaseInstallation() { OUString aPathVal("$BRAND_BASE_DIR"); @@ -889,7 +889,7 @@ UpdateCheck::install() OUString aParameter; sal_Int32 nFlags = c3s::SystemShellExecuteFlags::DEFAULTS; -#if ( defined LINUX || defined SOLARIS ) +#if (defined LINUX || defined __sun) nFlags = 42; aParameter = getBaseInstallation(); if( !aParameter.isEmpty() ) diff --git a/extensions/workben/testcomponent.cxx b/extensions/workben/testcomponent.cxx index 47eedfa..e9bed4c 100644 --- a/extensions/workben/testcomponent.cxx +++ b/extensions/workben/testcomponent.cxx @@ -43,7 +43,7 @@ using ::rtl::OWStringToOString; // Needed to switch on solaris threads -#ifdef SOLARIS +#ifdef __sun extern "C" void ChangeGlobalInit(); #endif @@ -54,7 +54,7 @@ int SAL_CALL main (int argc, char **argv) printf( "usage : testcomponent service dll [additional dlls]\n" ); exit( 0 ); } -#ifdef SOLARIS +#ifdef __sun // switch on threads in solaris ChangeGlobalInit(); #endif diff --git a/external/jpeg/configs/jconfig.h b/external/jpeg/configs/jconfig.h index 1ac8ea9..bb8aa9e 100644 --- a/external/jpeg/configs/jconfig.h +++ b/external/jpeg/configs/jconfig.h @@ -37,7 +37,7 @@ typedef unsigned char boolean; /* #undef RIGHT_SHIFT_IS_UNSIGNED */ #ifdef _WIN32 #define INLINE __inline -#elif defined SOLARIS +#elif defined __sun #define INLINE #else #define INLINE inline diff --git a/external/mysqlcppconn/config.h b/external/mysqlcppconn/config.h index 7736c61..cad5b67 100644 --- a/external/mysqlcppconn/config.h +++ b/external/mysqlcppconn/config.h @@ -6,7 +6,7 @@ #define HAVE_FUNCTION_STRTOL 1 #define HAVE_FUNCTION_STRTOULL 1 -#if defined(MACOSX) || defined(SOLARIS) || defined(LINUX) || (defined _MSC_VER && _MSC_VER >= 1600) +#if defined(MACOSX) || defined(__sun) || defined(LINUX) || (defined _MSC_VER && _MSC_VER >= 1600) #define HAVE_STDINT_H #ifndef _MSC_VER #define HAVE_INTTYPES_H diff --git a/external/neon/configs/config.h b/external/neon/configs/config.h index 996f744..a2e0c8d 100644 --- a/external/neon/configs/config.h +++ b/external/neon/configs/config.h @@ -488,7 +488,7 @@ /* #undef SIZEOF_XML_SIZE */ /* Define to 1 if you have the ANSI C header files. */ -#ifdef SOLARIS +#ifdef __sun #define STDC_HEADERS 1 #endif @@ -530,7 +530,7 @@ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined (SOLARIS) && defined (SPARC) +#if defined (__sun) && defined (SPARC) #define WORDS_BIGENDIAN 1 #endif @@ -556,7 +556,7 @@ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus -#if defined (SOLARIS) && defined (__SUNPRO_C) +#if defined (__sun) && defined (__SUNPRO_C) #define inline #endif #endif diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index 7a9d624..b35f5b7 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -905,7 +905,7 @@ void OS2METReader::ReadRelLine(bool bGivenPos, sal_uInt16 nOrderLen) if (nPolySize==0) return; tools::Polygon aPolygon(nPolySize); for (i=0; i<nPolySize; i++) { -#if defined SOLARIS && defined PPC +#if defined __sun && defined PPC sal_uInt8 nunsignedbyte; *pOS2MET >> nunsignedbyte; aP0.X()+=(sal_Int8)nunsignedbyte; *pOS2MET >> nunsignedbyte; aP0.Y()+=(sal_Int8)nunsignedbyte; diff --git a/hwpfilter/source/fontmap.cxx b/hwpfilter/source/fontmap.cxx index c25ec84..a59d131 100644 --- a/hwpfilter/source/fontmap.cxx +++ b/hwpfilter/source/fontmap.cxx @@ -18,7 +18,7 @@ */ #include <stdio.h> -#ifdef SOLARIS +#ifdef __sun #include <strings.h> #else #include <string.h> diff --git a/i18npool/source/search/levdis.cxx b/i18npool/source/search/levdis.cxx index c175ccd..60970fe 100644 --- a/i18npool/source/search/levdis.cxx +++ b/i18npool/source/search/levdis.cxx @@ -63,7 +63,7 @@ #include "levdis.hxx" -#ifdef SOLARIS +#ifdef __sun #undef min #endif diff --git a/include/osl/endian.h b/include/osl/endian.h index ebc4854..ca3640b 100644 --- a/include/osl/endian.h +++ b/include/osl/endian.h @@ -65,7 +65,7 @@ extern "C" { # elif BYTE_ORDER == BIG_ENDIAN # define OSL_BIGENDIAN # endif -#elif defined SOLARIS +#elif defined __sun # include <sys/isa_defs.h> # if defined _LITTLE_ENDIAN # define OSL_LITENDIAN diff --git a/include/sal/alloca.h b/include/sal/alloca.h index ad4f512..4a817c7 100644 --- a/include/sal/alloca.h +++ b/include/sal/alloca.h @@ -20,7 +20,7 @@ #ifndef INCLUDED_SAL_ALLOCA_H #define INCLUDED_SAL_ALLOCA_H -#if defined (SOLARIS) || defined (LINUX) || defined(AIX) || defined(ANDROID) || defined(EMSCRIPTEN) +#if defined (__sun) || defined (LINUX) || defined(AIX) || defined(ANDROID) || defined(EMSCRIPTEN) #ifndef INCLUDED_ALLOCA_H #include <alloca.h> diff --git a/include/sal/config.h b/include/sal/config.h index 9388de9..a363b19 100644 --- a/include/sal/config.h +++ b/include/sal/config.h @@ -53,7 +53,7 @@ #endif /* defined WIN32 */ -#if defined(SOLARIS) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || \ +#if defined(__sun) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || \ defined(AIX) || defined(OPENBSD) || defined(DRAGONFLY) || defined(ANDROID) #define SAL_UNX #define SAL_DLLEXTENSION ".so" diff --git a/include/sal/mathconf.h b/include/sal/mathconf.h index 5ef6322..4b977f5 100644 --- a/include/sal/mathconf.h +++ b/include/sal/mathconf.h @@ -24,9 +24,9 @@ #include <float.h> -#if defined SOLARIS +#if defined __sun #include <ieeefp.h> -#endif /* SOLARIS */ +#endif /* __sun */ #if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L ) #include <cmath> @@ -62,7 +62,7 @@ extern "C" { /* SAL_MATH_FINITE(d): test double d on INFINITY, NaN et al. */ -#if !defined SOLARIS && !defined ANDROID \ +#if !defined __sun && !defined ANDROID \ && defined(__cplusplus) \ && ( defined(__GXX_EXPERIMENTAL_CXX0X__) \ || __cplusplus >= 201103L \ diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 65fe642..01169a7 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -1174,7 +1174,7 @@ bool makeDriveLetterSame(OUString * fileURL) } #ifdef UNX -#ifdef SOLARIS +#ifdef __sun void addJavaInfosDirScan( std::vector<rtl::Reference<VendorBase>> & allInfos, @@ -1327,7 +1327,7 @@ void addJavaInfosDirScan( } #endif // MACOSX } -#endif // ifdef SOLARIS +#endif // ifdef __sun #endif // ifdef UNX } diff --git a/onlineupdate/source/update/common/updatedefines.h b/onlineupdate/source/update/common/updatedefines.h index 52a8b84..7347310 100644 --- a/onlineupdate/source/update/common/updatedefines.h +++ b/onlineupdate/source/update/common/updatedefines.h @@ -109,7 +109,7 @@ static inline int mywcsprintf(WCHAR* dest, size_t count, const WCHAR* fmt, ...) # include <sys/wait.h> # include <unistd.h> -#ifdef SOLARIS +#ifdef __sun # include <sys/stat.h> #else # include <fts.h> diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx index bb2dc35..c8d3bb9 100644 --- a/onlineupdate/source/update/updater/updater.cxx +++ b/onlineupdate/source/update/updater/updater.cxx @@ -3406,7 +3406,7 @@ int add_dir_entries(const NS_tchar *dirpath, ActionList *list) return rv; } -#elif defined(SOLARIS) +#elif defined(__sun) int add_dir_entries(const NS_tchar *dirpath, ActionList *list) { int rv = OK; diff --git a/rsc/inc/rsclex.hxx b/rsc/inc/rsclex.hxx index 690b67a..0e1fcf3 100644 --- a/rsc/inc/rsclex.hxx +++ b/rsc/inc/rsclex.hxx @@ -92,7 +92,7 @@ class ObjectStack }; /****************** F o r w a r d s **************************************/ -#if defined ( SOLARIS ) +#if defined(__sun) extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion extern "C" void yyerror( const char * ); extern "C" int yylex(); diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index 0725d8d..b7446db 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -326,7 +326,7 @@ int yylex() return aKeyVal[ 0 ].nKeyWord; } -#if defined SOLARIS +#if defined __sun extern "C" void yyerror( const char* pMessage ) #else void yyerror( char* pMessage ) diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c index 5df6fcf..1945f03 100644 --- a/sal/osl/unx/backtrace.c +++ b/sal/osl/unx/backtrace.c @@ -19,7 +19,7 @@ #include "sal/types.h" -#ifdef SOLARIS +#ifdef __sun #include <dlfcn.h> #include <pthread.h> @@ -128,7 +128,7 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) } } -#endif /* defined SOLARIS */ +#endif /* defined __sun */ #if defined FREEBSD || defined NETBSD || defined OPENBSD || defined(DRAGONFLY) #include <dlfcn.h> diff --git a/sal/osl/unx/backtrace.h b/sal/osl/unx/backtrace.h index 35d2543..7cc574b 100644 --- a/sal/osl/unx/backtrace.h +++ b/sal/osl/unx/backtrace.h @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#if defined (SOLARIS) || defined (FREEBSD) || defined (NETBSD) || \ +#if defined (__sun) || defined (FREEBSD) || defined (NETBSD) || \ defined (OPENBSD) || defined (DRAGONFLY) || defined (MACOSX) #ifdef __cplusplus @@ -43,7 +43,7 @@ struct frame { } /* extern "C" */ #endif -#endif /* defined SOLARIS || FREEBSD || NETBSD || OPENBSD */ +#endif /* defined __sun || FREEBSD || NETBSD || OPENBSD */ #if defined (LINUX) #include <execinfo.h> diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 4751dc2..1d673cd 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -1202,13 +1202,13 @@ SAL_CALL osl_mapFile ( // OS simultaneously pages in the rest); on other platforms, it remains // to be evaluated whether madvise or equivalent is available and // actually useful: -#if defined MACOSX || ( defined(SOLARIS) && ( !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) ) ) +#if defined MACOSX || (defined(__sun) && (!defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__))) int e = posix_madvise(p, nLength, POSIX_MADV_WILLNEED); if (e != 0) { SAL_INFO("sal.file", "posix_madvise(..., POSIX_MADV_WILLNEED) failed with " << e); } -#elif defined SOLARIS +#elif defined __sun if (madvise(static_cast< caddr_t >(p), nLength, MADV_WILLNEED) != 0) { SAL_INFO("sal.file", "madvise(..., MADV_WILLNEED) failed with " << strerror(errno)); diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index 28ce4a9..0940eab 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -44,7 +44,7 @@ #define FREEBSD 1 #endif -#if defined(SOLARIS) +#if defined(__sun) #include <sys/mnttab.h> #include <sys/statvfs.h> @@ -180,7 +180,7 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI # define OSL_detail_STATFS_IS_CASE_PRESERVING_FS(a) ((OSL_detail_MSDOS_SUPER_MAGIC != (a).f_type)) #endif /* LINUX */ -#if defined(SOLARIS) +#if defined(__sun) # define OSL_detail_STATFS_STRUCT struct statvfs # define OSL_detail_STATFS(dir, sfs) statvfs((dir), (sfs)) # define OSL_detail_STATFS_BLKSIZ(a) ((sal_uInt64)((a).f_frsize)) @@ -192,7 +192,7 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI of the target platforms fix it!!!! */ # define OSL_detail_STATFS_IS_CASE_SENSITIVE_FS(a) (true) # define OSL_detail_STATFS_IS_CASE_PRESERVING_FS(a) (true) -#endif /* SOLARIS */ +#endif /* __sun */ # define OSL_detail_STATFS_INIT(a) (memset(&(a), 0, sizeof(OSL_detail_STATFS_STRUCT))) diff --git a/sal/osl/unx/interlck.cxx b/sal/osl/unx/interlck.cxx index 28ba48e..e799805 100644 --- a/sal/osl/unx/interlck.cxx +++ b/sal/osl/unx/interlck.cxx @@ -22,9 +22,9 @@ #include <osl/interlck.h> #include <osl/diagnose.h> -#if ( defined ( SOLARIS ) || defined ( NETBSD ) ) && defined ( SPARC ) +#if ( defined (__sun) || defined ( NETBSD ) ) && defined ( SPARC ) #error please use asm/interlck_sparc.s -#elif defined ( SOLARIS) && defined ( X86 ) +#elif defined (__sun) && defined ( X86 ) #error please use asm/interlck_x86.s #elif defined ( __GNUC__ ) && ( defined ( X86 ) || defined ( X86_64 ) ) /* That's possible on x86-64 too since oslInterlockedCount is a sal_Int32 */ diff --git a/sal/osl/unx/nlsupport.cxx b/sal/osl/unx/nlsupport.cxx index 5d27f38..b2afcfd 100644 --- a/sal/osl/unx/nlsupport.cxx +++ b/sal/osl/unx/nlsupport.cxx @@ -25,7 +25,7 @@ #include "nlsupport.hxx" -#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || \ +#if defined(LINUX) || defined(__sun) || defined(NETBSD) || \ defined(FREEBSD) || defined(MACOSX) || defined(IOS) || defined(OPENBSD) || \ defined(DRAGONFLY) #include <pthread.h> @@ -36,7 +36,7 @@ #include <osl/module.h> #include <osl/thread.h> #endif /* !MACOSX && !IOS */ -#endif /* LINUX || SOLARIS || NETBSD || MACOSX || IOS */ +#endif /* LINUX || __sun || NETBSD || MACOSX || IOS */ #if defined(MACOSX) || defined(IOS) #include "system.hxx" @@ -226,7 +226,7 @@ static rtl_Locale * parse_locale( const char * locale ) return nullptr; } -#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || \ +#if defined(LINUX) || defined(__sun) || defined(NETBSD) || \ defined(FREEBSD) || defined(OPENBSD) || defined(DRAGONFLY) /* @@ -254,7 +254,7 @@ static rtl_Locale * parse_locale( const char * locale ) * to be completely upper- , or lowercase. */ -#if defined(SOLARIS) +#if defined(__sun) /* The values in the below list can be obtained with a script like * #!/bin/sh @@ -562,7 +562,7 @@ static const Pair nl_language_list[] = { { "UTF-8", RTL_TEXTENCODING_UTF8 } /* ISO-10646/UTF-8 */ }; -#endif /* ifdef SOLARIS LINUX FREEBSD NETBSD OPENBSD */ +#endif /* ifdef __sun LINUX FREEBSD NETBSD OPENBSD */ static pthread_mutex_t aLocalMutex = PTHREAD_MUTEX_INITIALIZER; @@ -684,7 +684,7 @@ int imp_setProcessLocale( rtl_Locale * pLocale ) return ret; } -#else /* ifdef LINUX || SOLARIS || MACOSX || NETBSD */ +#else /* ifdef LINUX || __sun || MACOSX || NETBSD */ /* * This implementation of osl_getTextEncodingFromLocale maps @@ -943,6 +943,6 @@ int imp_setProcessLocale( rtl_Locale * pLocale ) return 0; } -#endif /* ifdef LINUX || SOLARIS || MACOSX || NETBSD || AIX */ +#endif /* ifdef LINUX || __sun || MACOSX || NETBSD || AIX */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index e43a1c4..52b676a 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -29,7 +29,7 @@ * - cleanup of resource transfer */ -#if defined(SOLARIS) +#if defined(__sun) // The procfs may only be used without LFS in 32bits. # ifdef _FILE_OFFSET_BITS # undef _FILE_OFFSET_BITS @@ -41,7 +41,7 @@ #endif #include "system.hxx" -#if defined(SOLARIS) +#if defined(__sun) # include <sys/procfs.h> #endif #include <osl/diagnose.h> @@ -1016,7 +1016,7 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F if (Fields & (osl_Process_HEAPUSAGE | osl_Process_CPUTIMES)) { -#if defined(SOLARIS) +#if defined(__sun) int fd; sal_Char name[PATH_MAX + 1]; diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 9e6de6f..2e27154 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -309,7 +309,7 @@ oslProcessError SAL_CALL osl_setEnvironment(rtl_uString* pustrEnvVar, rtl_uStrin if (pstr_env_var != nullptr && pstr_val != nullptr) { -#if defined (SOLARIS) +#if defined (__sun) rtl_String * pBuffer = NULL; sal_Int32 nCapacity = rtl_stringbuffer_newFromStringBuffer( &pBuffer, @@ -358,7 +358,7 @@ oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString* pustrEnvVar) if (pstr_env_var) { -#if defined (SOLARIS) +#if defined (__sun) rtl_String * pBuffer = NULL; sal_Int32 nCapacity = rtl_stringbuffer_newFromStringBuffer( &pBuffer, diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx index 8ea26db..55bb641 100644 --- a/sal/osl/unx/security.cxx +++ b/sal/osl/unx/security.cxx @@ -38,7 +38,7 @@ #include "osl/thread.h" #include "osl/file.h" -#if defined LINUX || defined SOLARIS +#if defined LINUX || defined __sun #include <crypt.h> #endif @@ -352,7 +352,7 @@ static bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirec if (getuid() == pSecImpl->m_pPasswd.pw_uid) { sal_Char *pStr = nullptr; -#ifdef SOLARIS +#ifdef __sun char buffer[8192]; struct passwd pwd; diff --git a/sal/osl/unx/signal.cxx b/sal/osl/unx/signal.cxx index 3892818..b127272 100644 --- a/sal/osl/unx/signal.cxx +++ b/sal/osl/unx/signal.cxx @@ -41,12 +41,12 @@ #define INCLUDE_BACKTRACE #endif -#ifdef SOLARIS +#ifdef __sun #include "backtrace.h" #define INCLUDE_BACKTRACE -#endif /* defined SOLARIS */ +#endif /* defined __sun */ #if defined INCLUDE_BACKTRACE #define MAX_STACK_FRAMES 256 diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx index 23c8a2a..7176431 100644 --- a/sal/osl/unx/socket.cxx +++ b/sal/osl/unx/socket.cxx @@ -42,10 +42,10 @@ #define HAVE_POLL_H #endif /* HAVE_POLL_H */ -#if defined(SOLARIS) +#if defined(__sun) #include <poll.h> #define HAVE_POLL_H -#endif /* SOLARIS */ +#endif /* __sun */ #ifndef HAVE_POLL_H #define POLLIN 0x0001 diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx index 320b1c7..4b1462c 100644 --- a/sal/osl/unx/system.hxx +++ b/sal/osl/unx/system.hxx @@ -43,7 +43,7 @@ #include <sys/types.h> /* Make sockets of type AF_UNIX use underlying FS rights */ -#if defined(SOLARIS) && !defined(_XOPEN_SOURCE) +#if defined(__sun) && !defined(_XOPEN_SOURCE) # define _XOPEN_SOURCE 500 # include <sys/socket.h> # undef _XOPEN_SOURCE @@ -182,7 +182,7 @@ # define LIBPATH "LIBPATH" #endif -#ifdef SOLARIS +#ifdef __sun # include <shadow.h> # include <sys/un.h> # include <stropts.h> @@ -240,7 +240,7 @@ int macxp_resolveAlias(char *path, int buflen); #if !defined(_WIN32) && \ !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && \ !defined(AIX) && \ - !defined(SOLARIS) && !defined(MACOSX) && \ + !defined(__sun) && !defined(MACOSX) && \ !defined(OPENBSD) && !defined(DRAGONFLY) && \ !defined(IOS) && !defined(ANDROID) && \ !defined(EMSCRIPTEN) diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx index deed11d..80d8cbb 100644 --- a/sal/osl/unx/thread.cxx +++ b/sal/osl/unx/thread.cxx @@ -711,7 +711,7 @@ static void osl_thread_priority_init_Impl() return; } -#if defined (SOLARIS) +#if defined (__sun) if ( policy >= _SCHED_NEXT) { /* mfe: pthread_getschedparam on Solaris has a possible Bug */ @@ -719,7 +719,7 @@ static void osl_thread_priority_init_Impl() /* so set the policy to a default one */ policy=SCHED_OTHER; } -#endif /* SOLARIS */ +#endif /* __sun */ if ((nRet = sched_get_priority_min(policy) ) != -1) { @@ -812,7 +812,7 @@ void SAL_CALL osl_setThreadPriority ( if (pthread_getschedparam(pImpl->m_hThread, &policy, &Param) != 0) return; /* ESRCH */ -#if defined (SOLARIS) +#if defined (__sun) if ( policy >= _SCHED_NEXT) { /* mfe: pthread_getschedparam on Solaris has a possible Bug */ @@ -820,7 +820,7 @@ void SAL_CALL osl_setThreadPriority ( /* so set the policy to a default one */ policy=SCHED_OTHER; } -#endif /* SOLARIS */ +#endif /* __sun */ pthread_once (&(g_thread.m_once), osl_thread_init_Impl); diff --git a/sal/osl/unx/time.cxx b/sal/osl/unx/time.cxx index 624f820..8fe65f5 100644 --- a/sal/osl/unx/time.cxx +++ b/sal/osl/unx/time.cxx @@ -37,7 +37,7 @@ defined(LINUX) || defined(OPENBSD) || defined(DRAGONFLY) #define STRUCT_TM_HAS_GMTOFF 1 -#elif defined(SOLARIS) +#elif defined(__sun) #define HAS_ALTZONE 1 #endif diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index ae4243b..1cffa30 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -1605,7 +1605,7 @@ namespace osl_FileStatus void getFileType_007() { -#if defined ( SOLARIS ) //Special file is differ in Windows +#if defined(__sun) //Special file is differ in Windows nError1 = ::osl::DirectoryItem::get( aTypeURL2, m_aSpecialItem ); CPPUNIT_ASSERT_EQUAL( nError1, ::osl::FileBase::E_None ); @@ -4783,7 +4783,7 @@ namespace osl_Directory deleteTestDirectory( aTmpName3 ); ::rtl::OString sError = "test for remove function: try to remove a directory that is not empty."; sError += errorToStr( nError1 ).getStr(); -#if defined ( SOLARIS ) +#if defined(__sun) //on UNX, the implementation uses rmdir(), which EEXIST is thrown on Solaris when the directory is not empty, refer to: 'man -s 2 rmdir', while on linux, ENOTEMPTY is thrown. //EEXIST The directory contains entries other than those for "." and "..". printf("#Solaris test\n"); diff --git a/sal/qa/osl/file/osl_File_Const.h b/sal/qa/osl/file/osl_File_Const.h index cd39fb4..b8c7e12 100644 --- a/sal/qa/osl/file/osl_File_Const.h +++ b/sal/qa/osl/file/osl_File_Const.h @@ -163,7 +163,7 @@ OUString aTypeURL3( FILE_PREFIX "" ); #if ( defined UNX ) // Unix OUString aVolURL1( FILE_PREFIX ""); //ufs Solaris/Linux -#ifdef SOLARIS +#ifdef __sun OUString aVolURL2( FILE_PREFIX "dev/fd" ); //fd Solaris #else OUString aVolURL2( FILE_PREFIX "dev/floppy/0u1440" ); //fd0 Linux diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx index 24f8dac..3353b2e 100644 --- a/sal/qa/osl/process/osl_Thread.cxx +++ b/sal/qa/osl/process/osl_Thread.cxx @@ -1339,7 +1339,7 @@ namespace osl_Thread } CPPUNIT_TEST_SUITE(setPriority); -#ifndef SOLARIS +#ifndef __sun CPPUNIT_TEST(setPriority_002); CPPUNIT_TEST(setPriority_003); CPPUNIT_TEST(setPriority_004); @@ -1374,7 +1374,7 @@ namespace osl_Thread ThreadHelper::outputPriority(aPriority); // LLA: Priority settings may not work within some OS versions. -#if defined(_WIN32) || defined(SOLARIS) +#if defined(_WIN32) || defined(__sun) CPPUNIT_ASSERT_MESSAGE( "getPriority", aPriority == osl_Thread_PriorityHighest diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx index 234a3d5..74254ee 100644 --- a/sal/rtl/alloc_arena.cxx +++ b/sal/rtl/alloc_arena.cxx @@ -1119,7 +1119,7 @@ SAL_CALL rtl_machdep_alloc ( assert(pArena == gp_machdep_arena); -#if defined(SOLARIS) && defined(SPARC) +#if defined(__sun) && defined(SPARC) /* see @ mmap(2) man pages */ size += (pArena->m_quantum + pArena->m_quantum); /* "red-zone" pages */ if (size > (4 << 20)) diff --git a/sax/test/saxdemo.cxx b/sax/test/saxdemo.cxx index 419ce7e..baab11f 100644 --- a/sax/test/saxdemo.cxx +++ b/sax/test/saxdemo.cxx @@ -470,7 +470,7 @@ void OFileWriter::closeOutput() // Needed to switch on solaris threads -#ifdef SOLARIS +#ifdef __sun extern "C" void ChangeGlobalInit(); #endif int main (int argc, char **argv) @@ -480,7 +480,7 @@ int main (int argc, char **argv) printf( "usage : saxdemo inputfile outputfile\n" ); exit( 0 ); } -#ifdef SOLARIS +#ifdef __sun // switch on threads in solaris ChangeGlobalInit(); #endif diff --git a/sax/test/testcomponent.cxx b/sax/test/testcomponent.cxx index 339ee62..8380b3b 100644 --- a/sax/test/testcomponent.cxx +++ b/sax/test/testcomponent.cxx @@ -42,7 +42,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; // Needed to switch on solaris threads -#ifdef SOLARIS +#ifdef __sun extern "C" void ChangeGlobalInit(); #endif @@ -53,7 +53,7 @@ int main (int argc, char **argv) printf( "usage : testcomponent service dll [additional dlls]\n" ); exit( 0 ); } -#ifdef SOLARIS +#ifdef __sun // switch on threads in solaris ChangeGlobalInit(); #endif diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 9a3ae1b..6f1cc06 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -246,8 +246,8 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, Graphic aGraphic; SotClipboardFormatId nGrFormat = SotClipboardFormatId::NONE; -// (wg. Selection Manager bei Trustet Solaris) -#ifndef SOLARIS +// (for Selection Manager in Trusted Solaris) +#ifndef __sun if( aDataHelper.GetGraphic( SotClipboardFormatId::SVXB, aGraphic ) ) nGrFormat = SotClipboardFormatId::SVXB; else if( aDataHelper.GetGraphic( SotClipboardFormatId::GDIMETAFILE, aGraphic ) ) diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index b39c475..50146ce 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -1093,8 +1093,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, Graphic aGraphic; SotClipboardFormatId nGrFormat = SotClipboardFormatId::NONE; -// (wg. Selection Manager bei Trustet Solaris) -#ifndef SOLARIS +// (for Selection Manager in Trusted Solaris) +#ifndef __sun if( aDataHelper.GetGraphic( SotClipboardFormatId::SVXB, aGraphic ) ) nGrFormat = SotClipboardFormatId::SVXB; else if( aDataHelper.GetGraphic( SotClipboardFormatId::GDIMETAFILE, aGraphic ) ) diff --git a/setup_native/scripts/source/getuid.c b/setup_native/scripts/source/getuid.c index 2f1aaa4..8d0d9eb 100644 --- a/setup_native/scripts/source/getuid.c +++ b/setup_native/scripts/source/getuid.c @@ -28,7 +28,7 @@ extern "C" { #endif -#ifdef SOLARIS +#ifdef __sun #include <sys/systeminfo.h> #include <strings.h> diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 4721b05..c39c7ef 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -18,7 +18,7 @@ */ -#ifdef SOLARIS +#ifdef __sun #include <ctime> #endif diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 79f05ab..bd592dc 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifdef SOLARIS +#ifdef __sun #include <ctime> #endif diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index 061cf8f..f77a276 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifdef SOLARIS +#ifdef __sun #include <ctime> #endif diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 1378d0f..599a206 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -18,7 +18,7 @@ */ -#ifdef SOLARIS +#ifdef __sun #include <ctime> #endif diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx index bb50d8a..039db83 100644 --- a/slideshow/source/inc/tools.hxx +++ b/slideshow/source/inc/tools.hxx @@ -294,7 +294,7 @@ namespace slideshow /// To work around ternary operator in initializer lists /// (Solaris compiler problems) -#ifdef SOLARIS +#ifdef __sun template <typename T> inline T const & ternary_op( const bool cond, T const & arg1, T const & arg2 ) diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 6e4ad01..45e8004 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -1280,7 +1280,7 @@ bool SvtURLBox_Impl::TildeParsing( OUString aUserName = aText.copy( 1, ( nNameEnd != -1 ) ? nNameEnd : ( aText.getLength() - 1 ) ); struct passwd* pPasswd = nullptr; -#ifdef SOLARIS +#ifdef __sun Sequence< sal_Int8 > sBuf( 1024 ); struct passwd aTmp; sal_Int32 nRes = getpwnam_r( OUStringToOString( aUserName, RTL_TEXTENCODING_ASCII_US ).getStr(), diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index 91c8ea0..2c0ebe4 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -40,7 +40,7 @@ #include <tools/time.hxx> #include <osl/diagnose.h> -#if defined(SOLARIS) && defined(__GNUC__) +#if defined(__sun) && defined(__GNUC__) extern long altzone; #endif @@ -386,7 +386,7 @@ Time tools::Time::GetUTCOffset() nTime = time( nullptr ); localtime_r( &nTime, &aTM ); nLocalTime = mktime( &aTM ); -#if defined( SOLARIS ) +#if defined(__sun) // Solaris gmtime_r() seems not to handle daylight saving time // flags correctly nUTC = nLocalTime + ( aTM.tm_isdst == 0 ? timezone : altzone ); diff --git a/vcl/inc/unx/screensaverinhibitor.hxx b/vcl/inc/unx/screensaverinhibitor.hxx index 80289f4..76c5772 100644 --- a/vcl/inc/unx/screensaverinhibitor.hxx +++ b/vcl/inc/unx/screensaverinhibitor.hxx @@ -12,7 +12,7 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> -#if !defined(SOLARIS) && !defined(AIX) +#if !defined(__sun) && !defined(AIX) #include <X11/extensions/dpms.h> #endif @@ -38,7 +38,7 @@ private: boost::optional<int> mnXScreenSaverTimeout; -#if !defined(SOLARIS) && !defined(AIX) +#if !defined(__sun) && !defined(AIX) BOOL mbDPMSWasEnabled; CARD16 mnDPMSStandbyTimeout; CARD16 mnDPMSSuspendTimeout; diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 21691b5..1837364 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -141,7 +141,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : mpStatusAttributes( nullptr ), mpPreeditAttributes( nullptr ) { -#ifdef SOLARIS +#ifdef __sun static const char* pIIIMPEnable = getenv( "SAL_DISABLE_OWN_IM_STATUS" ); if( pIIIMPEnable && *pIIIMPEnable ) mnSupportedStatusStyle &= ~XIMStatusCallbacks; diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx index 0f6672d..2f09e10 100644 --- a/vcl/unx/generic/app/i18n_im.cxx +++ b/vcl/unx/generic/app/i18n_im.cxx @@ -143,7 +143,7 @@ SetSystemLocale( const char* p_inlocale ) return p_outlocale; } -#ifdef SOLARIS +#ifdef __sun static void SetSystemEnvironment( const OUString& rLocale ) { @@ -206,15 +206,15 @@ SalI18N_InputMethod::SetLocale() { osl_setThreadTextEncoding (RTL_TEXTENCODING_ISO_8859_1); locale = SetSystemLocale( "en_US" ); - #ifdef SOLARIS +#ifdef __sun SetSystemEnvironment( "en_US" ); - #endif +#endif if (! IsXWindowCompatibleLocale(locale)) { locale = SetSystemLocale( "C" ); - #ifdef SOLARIS +#ifdef __sun SetSystemEnvironment( "C" ); - #endif +#endif if (! IsXWindowCompatibleLocale(locale)) mbUseable = False; } diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index ab4c73d..4939927 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -26,7 +26,7 @@ #include <unistd.h> #include <ctype.h> -#if defined(SOLARIS) || defined(AIX) +#if defined(__sun) || defined(AIX) #include <osl/module.h> #endif @@ -37,7 +37,7 @@ #include <X11/cursorfont.h> #include "unx/x11_cursors/salcursors.h" #include "unx/x11_cursors/invert50.h" -#ifdef SOLARIS +#ifdef __sun #define XK_KOREAN #endif #include <X11/keysym.h> diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 969dfe4..2f578f2 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -577,7 +577,7 @@ OString SelectionManager::convertToCompound( const OUString& rText ) { aRet = reinterpret_cast<char*>(aProp.value); XFree( aProp.value ); -#ifdef SOLARIS +#ifdef __sun /* * for currently unknown reasons XmbTextListToTextProperty on Solaris returns * no data in ISO8859-n encodings (at least for n = 1, 15) diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 23a28e8..e69323e 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -372,7 +372,7 @@ void PrinterInfoManager::initialize() * porters: please append your platform to the Solaris * case if your platform has SystemV printing per default. */ - #if defined SOLARIS + #if defined __sun aValue = "lp"; #else aValue = "lpr"; diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx b/vcl/unx/generic/window/screensaverinhibitor.cxx index c63916b..bcba9c1 100644 --- a/vcl/unx/generic/window/screensaverinhibitor.cxx +++ b/vcl/unx/generic/window/screensaverinhibitor.cxx @@ -322,7 +322,7 @@ void ScreenSaverInhibitor::inhibitXAutoLock( bool bInhibit, Display* pDisplay ) void ScreenSaverInhibitor::inhibitDPMS( bool bInhibit, Display* pDisplay ) { -#if !defined(SOLARIS) && !defined(AIX) +#if !defined(__sun) && !defined(AIX) int dummy; // This won't change while X11 is running, hence // we can evaluate only once and store as static @@ -357,7 +357,7 @@ void ScreenSaverInhibitor::inhibitDPMS( bool bInhibit, Display* pDisplay ) mnDPMSSuspendTimeout, mnDPMSOffTimeout ); } -#endif // !defined(SOLARIS) && !defined(AIX) +#endif // !defined(__sun) && !defined(AIX) } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx index 2777c36..7ec9197 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -3629,7 +3629,7 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* pContext, gchar* pTex pThis->updateIMSpotLocation(); } } -#ifdef SOLARIS +#ifdef __sun // #i51356# workaround a solaris IIIMP bug // in case of partial commits the preedit changed signal // and commit signal come in wrong order commit b170265a6bba70faf1cb4172834586f4f45dd2bf Author: Michael Stahl <mst...@redhat.com> Date: Tue Jan 17 15:40:24 2017 +0100 remove executable bit from .mk files Change-Id: I2ed12aae6596492e1059f8461efbafb711d16472 diff --git a/solenv/CustomTarget_gbuildtesttools.mk b/solenv/CustomTarget_gbuildtesttools.mk old mode 100755 new mode 100644 diff --git a/wizards/Package_access2base.mk b/wizards/Package_access2base.mk old mode 100755 new mode 100644 commit eaf2b87a2e4a2a72c3efdf979c7b87fad5c7cbe5 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Thu Jan 5 09:47:50 2017 +0100 KDE4 Qt always processes all pending events Change-Id: I6a6e37c36a64640b641b116867da5c63c9d36bca diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 06340be..8d59315 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -301,21 +301,19 @@ SalYieldResult KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) } } -SalYieldResult KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents ) +/** + * Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes + * pending events that match flags until there are no more events to process. + */ +SalYieldResult KDEXLib::processYield( bool bWait, bool ) { m_blockIdleTimeout = !bWait; QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread()); bool wasEvent = false; - for( int cnt = bHandleAllCurrentEvents ? 100 : 1; - cnt > 0; - --cnt ) - { - if( !dispatcher->processEvents( QEventLoop::AllEvents )) - break; - wasEvent = true; - } - if( bWait && !wasEvent ) - dispatcher->processEvents( QEventLoop::WaitForMoreEvents ); + if ( bWait ) + wasEvent = dispatcher->processEvents( QEventLoop::WaitForMoreEvents ); + else + wasEvent = dispatcher->processEvents( QEventLoop::AllEvents ); m_blockIdleTimeout = false; return wasEvent ? SalYieldResult::EVENT : SalYieldResult::TIMEOUT; commit 59b84bc78dff2adb265d9fa8edb4c42794cf9771 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Wed Sep 14 13:48:02 2016 +0200 Change Idle to be a Timer subclass Drops a lot of duplicated code, as Idle is just a convenience class for instant, mostly low priority timers. Change-Id: I847592e92e86d15ab1cab168bf0e667322e48048 diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 12ccf1c..a7d88ef 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1325,7 +1325,7 @@ void EditorWindow::DestroyProgress() void EditorWindow::ForceSyntaxTimeout() { aSyntaxIdle.Stop(); - aSyntaxIdle.GetIdleHdl().Call(&aSyntaxIdle); + aSyntaxIdle.Invoke(); } // BreakPointWindow diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 0d30081..f089225 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -809,7 +809,7 @@ void IdleFormattter::ForceTimeout() if ( IsActive() ) { Stop(); - ((Link<Idle *, void>&)GetIdleHdl()).Call( this ); + Invoke(); } } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index b6303be..d78a4a7 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -2668,8 +2668,7 @@ throw( uno::RuntimeException, std::exception ) m_bMustDoLayout = true; if ( !m_aAsyncLayoutTimer.IsActive() ) { - const Link<Timer *, void>& aLink = m_aAsyncLayoutTimer.GetTimeoutHdl(); - aLink.Call( &m_aAsyncLayoutTimer ); + m_aAsyncLayoutTimer.Invoke(); } if ( m_nLockCount == 0 ) m_aAsyncLayoutTimer.Start(); diff --git a/include/tools/link.hxx b/include/tools/link.hxx index 8b65be4..de76c25 100644 --- a/include/tools/link.hxx +++ b/include/tools/link.hxx @@ -102,6 +102,7 @@ public: { return function_ == other.function_ && instance_ == other.instance_; }; void *GetInstance() const { return instance_; } + Stub* GetFunction() const { return function_; } private: Stub * function_; diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx index 9f491e1..85ea758 100644 --- a/include/vcl/idle.hxx +++ b/include/vcl/idle.hxx @@ -20,12 +20,19 @@ #ifndef INCLUDED_VCL_IDLE_HXX #define INCLUDED_VCL_IDLE_HXX -#include <tools/link.hxx> -#include <vcl/scheduler.hxx> +#include <vcl/timer.hxx> -class VCL_DLLPUBLIC Idle : public Task +/** + * An idle is a timer to be scheduled immediately. + * + * It's - more or less - just a convenience class. + */ +class VCL_DLLPUBLIC Idle : public Timer { - Link<Idle *, void> maIdleHdl; // Callback Link +private: + // Delete all timeout specific functions, we don't want in an Idle + void SetTimeout( sal_uInt64 nTimeoutMs ) = delete; + sal_uInt64 GetTimeout() const = delete; protected: virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const override; @@ -34,18 +41,23 @@ protected: public: Idle( const sal_Char *pDebugName = nullptr ); - Idle( const Idle& rIdle ); - virtual void Start() override; + virtual void Start() override; - /// Make it possible to associate a callback with this idle handler - /// of course, you can also sub-class and override 'Invoke' - void SetIdleHdl( const Link<Idle *, void>& rLink ) { maIdleHdl = rLink; } - const Link<Idle *, void>& GetIdleHdl() const { return maIdleHdl; } - virtual void Invoke() override; - Idle& operator=( const Idle& rIdle ); + /** + * Convenience function for more readable code + * + * TODO: actually rename it and it's instances to SetInvokeHandler + */ + inline void SetIdleHdl( const Link<Idle *, void>& rLink ); }; +inline void Idle::SetIdleHdl( const Link<Idle*, void> &rLink ) +{ + SetInvokeHandler( Link<Timer*, void>( rLink.GetInstance(), + reinterpret_cast< Link<Timer*, void>::Stub* >( rLink.GetFunction()) ) ); +} + #endif // INCLUDED_VCL_IDLE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index 19a882f..07fb9a8 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -26,9 +26,9 @@ class VCL_DLLPUBLIC Timer : public Task { protected: - Link<Timer *, void> maTimeoutHdl; // Callback Link - sal_uInt64 mnTimeout; - bool mbAuto; + Link<Timer *, void> maInvokeHandler; ///< Callback Link + sal_uInt64 mnTimeout; + bool mbAuto; virtual void SetDeletionFlags() override; virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const override; @@ -37,29 +37,45 @@ protected: public: Timer( const sal_Char *pDebugName = nullptr ); - Timer( const Timer& rTimer ); - /// Make it possible to associate a callback with this timer handler - /// of course, you can also sub-class and override 'Invoke' - void SetTimeoutHdl( const Link<Timer *, void>& rLink ) { maTimeoutHdl = rLink; } - const Link<Timer *, void>& GetTimeoutHdl() const { return maTimeoutHdl; } + /** + * Calls the maInvokeHandler with the parameter this. + */ + virtual void Invoke() override; + /** + * Calls the maInvokeHandler with the parameter. + * + * Convenience Invoke function, mainly used to call with nullptr. + * + * @param arg parameter for the Link::Call function + */ + void Invoke( Timer *arg ); + void SetInvokeHandler( const Link<Timer *, void>& rLink ) { maInvokeHandler = rLink; } + bool HasInvokeHandler() const { return maInvokeHandler.IsSet(); }; + + /** + * Convenience function for more readable code + * + * TODO: actually use SetInvokeHandler and drop it + */ + inline void SetTimeoutHdl( const Link<Timer *, void>& rLink ); + void SetTimeout( sal_uInt64 nTimeoutMs ); sal_uInt64 GetTimeout() const { return mnTimeout; } - virtual void Invoke() override; - void Timeout() { Invoke(); } - Timer& operator=( const Timer& rTimer ); virtual void Start() override; }; +inline void Timer::SetTimeoutHdl( const Link<Timer *, void>& rLink ) +{ + SetInvokeHandler( rLink ); +} + /// An auto-timer is a multi-shot timer re-emitting itself at /// interval until destroyed. class VCL_DLLPUBLIC AutoTimer : public Timer { public: - AutoTimer( const sal_Char *pDebugName = nullptr ); - AutoTimer( const AutoTimer& rTimer ); - - AutoTimer& operator=( const AutoTimer& rTimer ); + AutoTimer( const sal_Char *pDebugName = nullptr ); }; #endif // INCLUDED_VCL_TIMER_HXX diff --git a/sc/source/core/tool/refreshtimer.cxx b/sc/source/core/tool/refreshtimer.cxx index cb83c4c..954c132 100644 --- a/sc/source/core/tool/refreshtimer.cxx +++ b/sc/source/core/tool/refreshtimer.cxx @@ -120,7 +120,7 @@ void ScRefreshTimer::Invoke() { // now we COULD make the call in another thread ... ::osl::MutexGuard aGuard( (*ppControl)->GetMutex() ); - maTimeoutHdl.Call( this ); + Timer::Invoke(); // restart from now on, don't execute immediately again if timed out // a second time during refresh if ( IsActive() ) diff --git a/solenv/gdb/libreoffice/vcl.py b/solenv/gdb/libreoffice/vcl.py index 28ba3eb..62dc3a0 100644 --- a/solenv/gdb/libreoffice/vcl.py +++ b/solenv/gdb/libreoffice/vcl.py @@ -26,19 +26,27 @@ class ImplSchedulerDataPrinter(object): def as_string(self, gdbobj): if gdbobj['mpTask']: - sched = gdbobj['mpTask'].dereference() - if gdbobj['mpTask'].dynamic_cast( self.timer_type_ptr ): - sched_type = "Timer" - elif gdbobj['mpTask'].dynamic_cast( self.idle_type_ptr ): - sched_type = "Idle" + task = gdbobj['mpTask'].dereference() + timer = gdbobj['mpTask'].dynamic_cast( self.timer_type_ptr ) + idle = gdbobj['mpTask'].dynamic_cast( self.idle_type_ptr ) + if idle: + task_type = "Idle" + elif timer: + task_type = "Timer" else: - assert sched_type, "Task object neither Timer nor Idle" - res = "{:7s}{:10s} active: {:6s}".format( sched_type, str(sched['mePriority']), str(sched['mbActive']) ) - name = sched['mpDebugName'] + task_type = "Task" + res = "{:7s}{:10s} active: {:6s}".format( task_type, str(task['mePriority']), str(task['mbActive']) ) + name = task['mpDebugName'] if not name: res = res + " (task debug name not set)" else: - res = "{} '{}' ({})".format(res, str(name.string()), str(sched.dynamic_type)) + res = "{} '{}' ({})".format(res, str(name.string()), str(task.dynamic_type)) + val_type = gdb.lookup_type(str( task.dynamic_type )).pointer() + timer = gdbobj['mpTask'].cast( val_type ) + if (task_type == "Timer"): + res = "{}: {}ms".format(res, timer['mnTimeout']) + else: + assert 1 == timer['mnTimeout'], "Idle with timeout == {}".format( timer['mnTimeout'] ) return res else: assert gdbobj['mbDelete'], "No task set and not marked for deletion!" diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx index 52b8d98..895000a 100644 --- a/vcl/source/app/idle.cxx +++ b/vcl/source/app/idle.cxx @@ -20,25 +20,9 @@ #include <vcl/idle.hxx> #include "saltimer.hxx" -void Idle::Invoke() +Idle::Idle( const sal_Char *pDebugName ) + : Timer( pDebugName ) { - maIdleHdl.Call( this ); -} - -Idle& Idle::operator=( const Idle& rIdle ) -{ - Task::operator=(rIdle); - maIdleHdl = rIdle.maIdleHdl; - return *this; -} - -Idle::Idle( const sal_Char *pDebugName ) : Task( pDebugName ) -{ -} - -Idle::Idle( const Idle& rIdle ) : Task(rIdle) -{ - maIdleHdl = rIdle.maIdleHdl; } void Idle::Start() diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index 96485ae..77704db 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -53,25 +53,22 @@ sal_uInt64 Timer::UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) } } -Timer::Timer(const sal_Char *pDebugName) : - Task(pDebugName), - mnTimeout(Scheduler::ImmediateTimeoutMs), - mbAuto(false) +Timer::Timer(const sal_Char *pDebugName) + : Task( pDebugName ) + , mnTimeout( Scheduler::ImmediateTimeoutMs ) + , mbAuto( false ) { mePriority = TaskPriority::HIGHEST; } -Timer::Timer( const Timer& rTimer ) : - Task(rTimer), - mnTimeout(rTimer.mnTimeout), - mbAuto(rTimer.mbAuto) +void Timer::Invoke() { - maTimeoutHdl = rTimer.maTimeoutHdl; + maInvokeHandler.Call( this ); } -void Timer::Invoke() +void Timer::Invoke( Timer *arg ) { - maTimeoutHdl.Call( this ); + maInvokeHandler.Call( arg ); } void Timer::Start() @@ -88,29 +85,10 @@ void Timer::SetTimeout( sal_uInt64 nNewTimeout ) StartTimer( mnTimeout ); } -Timer& Timer::operator=( const Timer& rTimer ) -{ - Task::operator=(rTimer); - maTimeoutHdl = rTimer.maTimeoutHdl; - mnTimeout = rTimer.mnTimeout; - mbAuto = rTimer.mbAuto; - return *this; -} - AutoTimer::AutoTimer( const sal_Char *pDebugName ) : Timer( pDebugName ) { mbAuto = true; } -AutoTimer::AutoTimer( const AutoTimer& rTimer ) : Timer( rTimer ) -{ - mbAuto = true; -} - -AutoTimer& AutoTimer::operator=( const AutoTimer& rTimer ) -{ - Timer::operator=( rTimer ); - return *this; -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 610e492..8ee93fb 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1909,7 +1909,7 @@ void Edit::LoseFocus() { //notify an update latest when the focus is lost mpUpdateDataTimer->Stop(); - mpUpdateDataTimer->Timeout(); + mpUpdateDataTimer->Invoke(); } if ( !mpSubEdit ) diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index ceb42d0..6b8abdf 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -293,7 +293,7 @@ void IdleFormatter::DoIdleFormat( TextView* pV, sal_uInt16 nMaxRestarts ) if ( mnRestarts > nMaxRestarts ) { mnRestarts = 0; - ((Link<Idle *, void>&)GetIdleHdl()).Call( this ); + Invoke(); } else { @@ -307,7 +307,7 @@ void IdleFormatter::ForceTimeout() { Stop(); mnRestarts = 0; - ((Link<Idle *, void>&)GetIdleHdl()).Call( this ); + Invoke(); } } diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index e0e1a93..8e8dfcc 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -660,7 +660,7 @@ IMPL_LINK_NOARG(Window, ImplHandleResizeTimerHdl, Idle *, void) if( mpWindowImpl->mpFrameData->maPaintIdle.IsActive() ) { mpWindowImpl->mpFrameData->maPaintIdle.Stop(); - mpWindowImpl->mpFrameData->maPaintIdle.GetIdleHdl().Call( nullptr ); + mpWindowImpl->mpFrameData->maPaintIdle.Invoke( nullptr ); } } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 2757800..46d949a 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2407,7 +2407,7 @@ Size Window::GetSizePixel() const { VclPtr<vcl::Window> xWindow( const_cast<Window*>(this) ); mpWindowImpl->mpFrameData->maResizeIdle.Stop(); - mpWindowImpl->mpFrameData->maResizeIdle.GetIdleHdl().Call( nullptr ); + mpWindowImpl->mpFrameData->maResizeIdle.Invoke( nullptr ); if( xWindow->IsDisposed() ) return Size(0,0); } commit 1531152eff8061d63be5d98641fcafaa1da05167 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Wed Nov 2 16:43:02 2016 +0100 Add sensible timer handling for Calc input There is no need to destroy and recreate the timer object. Simply stop and start the timer as required. Change-Id: I2885fef8bdb90c379dc2e9b9caf986d250face5c diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index e2c96c6..2f1c901 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -645,6 +645,10 @@ ScInputHandler::ScInputHandler() pActiveViewSh = nullptr; // Bindings (only still used for Invalidate) are retrieved if needed on demand + + pDelayTimer = new Timer( "ScInputHandlerDelay timer" ); + pDelayTimer->SetTimeout( 500 ); // 500 ms delay + pDelayTimer->SetTimeoutHdl( LINK( this, ScInputHandler, DelayTimer ) ); } ScInputHandler::~ScInputHandler() @@ -3722,36 +3726,23 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, { if ( !pInputWin->IsEnabled()) { + pDelayTimer->Stop(); pInputWin->Enable(); - if(pDelayTimer ) - { - DELETEZ( pDelayTimer ); - } } } else if(pScMod->IsRefDialogOpen()) { // Because every document has its own InputWin, // we should start Timer again, because the input line may // still be active - if ( !pDelayTimer ) - { - pDelayTimer = new Timer("Restart ScInputHandlerDelay timer"); - pDelayTimer->SetTimeout( 500 ); // 500 ms delay - pDelayTimer->SetTimeoutHdl( LINK( this, ScInputHandler, DelayTimer ) ); + if ( !pDelayTimer->IsActive() ) pDelayTimer->Start(); - } } } } else // !pState || !pActiveViewSh { - if ( !pDelayTimer ) - { - pDelayTimer = new Timer("ScInputHandlerDelay timer"); - pDelayTimer->SetTimeout( 500 ); // 500 ms delay - pDelayTimer->SetTimeoutHdl( LINK( this, ScInputHandler, DelayTimer ) ); + if ( !pDelayTimer->IsActive() ) pDelayTimer->Start(); - } } HideTip(); @@ -3767,50 +3758,42 @@ void ScInputHandler::UpdateCellAdjust( SvxCellHorJustify eJust ) void ScInputHandler::ResetDelayTimer() { - if(pDelayTimer!=nullptr) + if( pDelayTimer->IsActive() ) { - DELETEZ( pDelayTimer ); - - if ( pInputWin) - { + pDelayTimer->Stop(); + if ( pInputWin ) pInputWin->Enable(); - } } } -IMPL_LINK( ScInputHandler, DelayTimer, Timer*, pTimer, void ) +IMPL_LINK_NOARG( ScInputHandler, DelayTimer, Timer*, void ) { - if ( pTimer == pDelayTimer ) + if ( nullptr == pLastState || SC_MOD()->IsFormulaMode() || SC_MOD()->IsRefDialogOpen()) { - DELETEZ( pDelayTimer ); - - if ( nullptr == pLastState || SC_MOD()->IsFormulaMode() || SC_MOD()->IsRefDialogOpen()) + //! New method at ScModule to query if function autopilot is open + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + if ( pViewFrm && pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ) { - //! New method at ScModule to query if function autopilot is open - SfxViewFrame* pViewFrm = SfxViewFrame::Current(); - if ( pViewFrm && pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ) + if ( pInputWin) { - if ( pInputWin) - { - pInputWin->EnableButtons( false ); - pInputWin->Disable(); - } + pInputWin->EnableButtons( false ); + pInputWin->Disable(); } - else if ( !bFormulaMode ) // Keep formula e.g. for help - { - bInOwnChange = true; // disable ModifyHdl (reset below) - - pActiveViewSh = nullptr; - mpEditEngine->SetText( EMPTY_OUSTRING ); - if ( pInputWin ) - { - pInputWin->SetPosString( EMPTY_OUSTRING ); - pInputWin->SetTextString( EMPTY_OUSTRING ); - pInputWin->Disable(); - } + } + else if ( !bFormulaMode ) // Keep formula e.g. for help + { + bInOwnChange = true; // disable ModifyHdl (reset below) - bInOwnChange = false; + pActiveViewSh = nullptr; + mpEditEngine->SetText( EMPTY_OUSTRING ); + if ( pInputWin ) + { + pInputWin->SetPosString( EMPTY_OUSTRING ); + pInputWin->SetTextString( EMPTY_OUSTRING ); + pInputWin->Disable(); } + + bInOwnChange = false; } } } commit fdc612619c1c133353026166206cea18c48089a6 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Wed Jan 4 12:06:42 2017 +0100 Refactor Scheduler to add Task class Moves all the "task-specific" stuff into a Task class and just keeps the "real" static Scheduler functions in the original Scheduler class. Change-Id: I9eb02d46e2bcf1abb06af5bab1fa0ee734d1984c diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index 8d3ac38..0f257ef 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -114,7 +114,7 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl mpZoomToolBox->SetPaintTransparent( true ); } - maIdle.SetPriority( SchedulerPriority::LOW ); + maIdle.SetPriority( TaskPriority::LOW ); maIdle.SetIdleHdl( LINK( this, MediaControl, implTimeoutHdl ) ); maIdle.Start(); } diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index 753fddc..0907555 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -221,7 +221,7 @@ void SAL_CALL SoundHandler::dispatchWithNotification(const css::util::URL& // Count this request and initialize self-holder against dying by uno ref count ... m_xSelfHold.set(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); m_xPlayer->start(); - m_aUpdateIdle.SetPriority( SchedulerPriority::LOWER ); + m_aUpdateIdle.SetPriority( TaskPriority::LOWER ); m_aUpdateIdle.Start(); } catch( css::uno::Exception& e ) diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx index bfc25d4..12b746a 100644 --- a/avmedia/source/opengl/oglplayer.cxx +++ b/avmedia/source/opengl/oglplayer.cxx @@ -123,7 +123,7 @@ bool OGLPlayer::create( const OUString& rURL ) // Set timer m_aTimer.SetTimeout(8); // is 125fps enough for anyone ? - m_aTimer.SetPriority(SchedulerPriority::LOW); + m_aTimer.SetPriority(TaskPriority::LOW); m_aTimer.SetTimeoutHdl(LINK(this,OGLPlayer,TimerHandler)); return true; diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index d7a9074..12ccf1c 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -960,7 +960,7 @@ void EditorWindow::CreateEditEngine() ImplSetFont(); - aSyntaxIdle.SetPriority( SchedulerPriority::LOWER ); + aSyntaxIdle.SetPriority( TaskPriority::LOWER ); aSyntaxIdle.SetIdleHdl( LINK( this, EditorWindow, SyntaxTimerHdl ) ); bool bWasDoSyntaxHighlight = bDoSyntaxHighlight; diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 411cb55..cc0aa7f 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -217,7 +217,7 @@ DlgEditor::DlgEditor ( m_ClipboardDataFlavorsResource[1].HumanPresentableName = "Dialog 8.0" ; m_ClipboardDataFlavorsResource[1].DataType = cppu::UnoType<Sequence< sal_Int8 >>::get(); - aMarkIdle.SetPriority(SchedulerPriority::LOW); + aMarkIdle.SetPriority(TaskPriority::LOW); aMarkIdle.SetIdleHdl( LINK( this, DlgEditor, MarkTimeout ) ); rWindow.SetMapMode( MapMode( MapUnit::Map100thMM ) ); diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 6891007..fea7cf0 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -558,7 +558,7 @@ GL3DBarChart::GL3DBarChart( { mbAutoFly = atoi(aAutoFly); } - maIdle.SetPriority(SchedulerPriority::REPAINT); + maIdle.SetPriority(TaskPriority::REPAINT); maIdle.SetIdleHdl(LINK(this, GL3DBarChart, UpdateTimerHdl)); maIdle.SetDebugName( "charttypes::GL3DBarChart maIdle" ); maIdle.Start(); diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 08b28da..185ffc6 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -450,7 +450,7 @@ short ActualizeProgress::Execute() pIdle = new Idle("ActualizeProgressTimeout"); pIdle->SetIdleHdl( LINK( this, ActualizeProgress, TimeoutHdl ) ); - pIdle->SetPriority( SchedulerPriority::LOWEST ); + pIdle->SetPriority( TaskPriority::LOWEST ); pIdle->Start(); nRet = ModalDialog::Execute(); diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx index bba24a8..1da650d 100644 --- a/cui/source/dialogs/linkdlg.cxx +++ b/cui/source/dialogs/linkdlg.cxx @@ -124,7 +124,7 @@ SvBaseLinksDlg::SvBaseLinksDlg( vcl::Window * pParent, LinkManager* pMgr, bool b // UpdateTimer for DDE-/Grf-links, which are waited for aUpdateIdle.SetIdleHdl( LINK( this, SvBaseLinksDlg, UpdateWaitingHdl ) ); - aUpdateIdle.SetPriority( SchedulerPriority::LOWEST ); + aUpdateIdle.SetPriority( TaskPriority::LOWEST ); m_pPbOpenSource->Hide(); diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index cd71d22..3f831e7 100644 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -64,7 +64,7 @@ LookUpComboBox::LookUpComboBox(vcl::Window *pParent) EnableAutoSize(true); m_aModifyIdle.SetIdleHdl( LINK( this, LookUpComboBox, ModifyTimer_Hdl ) ); - m_aModifyIdle.SetPriority( SchedulerPriority::LOWEST ); + m_aModifyIdle.SetPriority( TaskPriority::LOWEST ); EnableAutocomplete( false ); } diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 03f51c9..4621607 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -186,7 +186,7 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet& m_pParameterBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ParameterHdl_Impl ) ); m_pClassPathBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ClassPathHdl_Impl ) ); m_aResetIdle.SetIdleHdl( LINK( this, SvxJavaOptionsPage, ResetHdl_Impl ) ); - m_aResetIdle.SetPriority(SchedulerPriority::LOWER); + m_aResetIdle.SetPriority(TaskPriority::LOWER); m_pExpertConfigBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ExpertConfigHdl_Impl) ); if (!officecfg::Office::Common::Security::EnableExpertConfiguration::get()) diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 9938b36..5858783 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -953,7 +953,7 @@ void SvxBackgroundTabPage::ShowSelector() // delayed loading via timer (because of UI-Update) pPageImpl->pLoadIdle = new Idle("DelayedLoad"); - pPageImpl->pLoadIdle->SetPriority( SchedulerPriority::LOWEST ); + pPageImpl->pLoadIdle->SetPriority( TaskPriority::LOWEST ); pPageImpl->pLoadIdle->SetIdleHdl( LINK( this, SvxBackgroundTabPage, LoadIdleHdl_Impl ) ); diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 5bb00f4..240698f 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -247,7 +247,7 @@ struct SvxCharNamePage_Impl m_bInSearchMode ( false ) { - m_aUpdateIdle.SetPriority( SchedulerPriority::LOWEST ); + m_aUpdateIdle.SetPriority( TaskPriority::LOWEST ); } ~SvxCharNamePage_Impl() diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index 529124c..7485ad5 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -138,7 +138,7 @@ SfxMacroTabPage::SfxMacroTabPage(vcl::Window* pParent, const Reference< XFrame > mpImpl.reset(new SfxMacroTabPage_Impl); mpImpl->maFillGroupIdle.SetIdleHdl( LINK( this, SfxMacroTabPage, TimeOut_Impl ) ); - mpImpl->maFillGroupIdle.SetPriority( SchedulerPriority::HIGHEST ); + mpImpl->maFillGroupIdle.SetPriority( TaskPriority::HIGHEST ); mpImpl->maFillGroupIdle.SetDebugName( "SfxMacroTabPage maFillGroupIdle" ); mpImpl->sStrEvent = get<FixedText>("eventft")->GetText(); diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index f08beee..7289032 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -1063,7 +1063,7 @@ void OJoinTableView::ScrollWhileDragging() // resetting timer, if still necessary if (bNeedScrollTimer) { - m_aDragScrollIdle.SetPriority(SchedulerPriority::LOW); + m_aDragScrollIdle.SetPriority(TaskPriority::LOW); m_aDragScrollIdle.Start(); } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 89ac27c..04a0259 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -521,7 +521,7 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager, m_pUpdateBtn->Hide(); #endif - m_aIdle.SetPriority(SchedulerPriority::LOWEST); + m_aIdle.SetPriority(TaskPriority::LOWEST); m_aIdle.SetIdleHdl( LINK( this, ExtMgrDialog, TimeOutHdl ) ); } @@ -1065,7 +1065,7 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan m_pUpdateBtn->Enable( false ); m_pCloseBtn->GrabFocus(); - m_aIdle.SetPriority( SchedulerPriority::LOWEST ); + m_aIdle.SetPriority( TaskPriority::LOWEST ); m_aIdle.SetIdleHdl( LINK( this, UpdateRequiredDialog, TimeOutHdl ) ); } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 79e284a..d29a695 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -602,7 +602,7 @@ CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, Li m_bPartTilePainting(false), m_bEventLatch(false) { - SetPriority(SchedulerPriority::POST_PAINT); + SetPriority(TaskPriority::POST_PAINT); // Add the states that are safe to skip duplicates on, // even when not consequent. diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 946ae5c..fc2b2aa 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -148,7 +148,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : aStatusTimer.SetTimeoutHdl( LINK( this, ImpEditEngine, StatusTimerHdl ) ); aStatusTimer.SetDebugName( "editeng::ImpEditEngine aStatusTimer" ); - aIdleFormatter.SetPriority( SchedulerPriority::REPAINT ); + aIdleFormatter.SetPriority( TaskPriority::REPAINT ); aIdleFormatter.SetIdleHdl( LINK( this, ImpEditEngine, IdleFormatHdl ) ); aIdleFormatter.SetDebugName( "editeng::ImpEditEngine aIdleFormatter" ); diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx index 834d400..3429248 100644 --- a/extensions/source/bibliography/bibcont.cxx +++ b/extensions/source/bibliography/bibcont.cxx @@ -121,7 +121,7 @@ BibBookContainer::BibBookContainer(vcl::Window* pParent): { pBibMod = OpenBibModul(); aIdle.SetIdleHdl(LINK( this, BibBookContainer, SplitHdl)); - aIdle.SetPriority(SchedulerPriority::LOWEST); + aIdle.SetPriority(TaskPriority::LOWEST); } BibBookContainer::~BibBookContainer() diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index 9f5541d..b62a03c 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -202,7 +202,7 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link<void*,void> aLink) Application::AddEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) ); aIdle.SetIdleHdl(LINK( this, BibToolBar, SendSelHdl)); - aIdle.SetPriority(SchedulerPriority::LOWEST); + aIdle.SetPriority(TaskPriority::LOWEST); SetDropdownClickHdl( LINK( this, BibToolBar, MenuHdl)); diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index 13268df..d8f3a03 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -206,7 +206,7 @@ UpdateCheckUI::UpdateCheckUI(const uno::Reference<uno::XComponentContext>& xCont maBubbleImage = GetBubbleImage( maBubbleImageURL ); - maWaitIdle.SetPriority( SchedulerPriority::LOWEST ); + maWaitIdle.SetPriority( TaskPriority::LOWEST ); maWaitIdle.SetIdleHdl( LINK( this, UpdateCheckUI, WaitTimeOutHdl ) ); maTimeoutTimer.SetTimeout( 10000 ); diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 00e1e7a..8a7276c 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -1798,7 +1798,7 @@ namespace frm doSetDelegator(); - m_aChangeIdle.SetPriority(SchedulerPriority::LOWEST); + m_aChangeIdle.SetPriority(TaskPriority::LOWEST); m_aChangeIdle.SetIdleHdl(LINK(this,OListBoxControl,OnTimeout)); } diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index f745cbc..a0eacea 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -1801,7 +1801,7 @@ OUString FormulaDlg::GetMeText() const void FormulaDlg::Update() { m_pImpl->Update(); - m_pImpl->aIdle.SetPriority(SchedulerPriority::LOWER); + m_pImpl->aIdle.SetPriority(TaskPriority::LOWER); m_pImpl->aIdle.SetIdleHdl(LINK( this, FormulaDlg, UpdateFocusHdl)); m_pImpl->aIdle.Start(); } diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx index 2389864..6472fde 100644 --- a/formula/source/ui/dlg/funcutl.cxx +++ b/formula/source/ui/dlg/funcutl.cxx @@ -409,7 +409,7 @@ RefEdit::RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits , pLabelWidget(pShrinkModeLabel) { aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) ); - aIdle.SetPriority( SchedulerPriority::LOW ); + aIdle.SetPriority( TaskPriority::LOW ); } VCL_BUILDER_DECL_FACTORY(RefEdit) @@ -478,7 +478,7 @@ void RefEdit::SetReferences( IControlReferenceHandler* pDlg, vcl::Window* pLabel if( pDlg ) { aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) ); - aIdle.SetPriority( SchedulerPriority::LOW ); + aIdle.SetPriority( TaskPriority::LOW ); } else { diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx index d3fdfbb..9f491e1 100644 --- a/include/vcl/idle.hxx +++ b/include/vcl/idle.hxx @@ -23,7 +23,7 @@ #include <tools/link.hxx> #include <vcl/scheduler.hxx> -class VCL_DLLPUBLIC Idle : public Scheduler +class VCL_DLLPUBLIC Idle : public Task { Link<Idle *, void> maIdleHdl; // Callback Link diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index 16aba06..1e4b9d6 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -22,9 +22,43 @@ #include <vcl/dllapi.h> +class Task; + +class VCL_DLLPUBLIC Scheduler +{ + friend class Task; + Scheduler() = delete; + +protected: + static void ImplStartTimer ( sal_uInt64 nMS, bool bForce = false ); + +public: + static const SAL_CONSTEXPR sal_uInt64 ImmediateTimeoutMs = 1; + static const SAL_CONSTEXPR sal_uInt64 InfiniteTimeoutMs = 1000 * 60 * 60 * 24; // 1 day + + static void ImplDeInitScheduler(); + + /// Process one pending Timer with highhest priority + static void CallbackTaskScheduling( bool ignore ); + /// Calculate minimum timeout - and return its value. + static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles ); + /// Process one pending task ahead of time with highest priority. + static bool ProcessTaskScheduling( bool bIdle ); + /// Process all events until we are idle + static void ProcessEventsToIdle(); + + /// Control the deterministic mode. In this mode, two subsequent runs of + /// LibreOffice fire about the same amount idles. + static void SetDeterministicMode(bool bDeterministic); + /// Return the current state of deterministic mode. + static bool GetDeterministicMode(); +}; + + struct ImplSchedulerData; -enum class SchedulerPriority { +enum class TaskPriority +{ HIGHEST = 0, HIGH = 1, RESIZE = 2, @@ -37,21 +71,19 @@ enum class SchedulerPriority { LOWEST = 8 }; -class VCL_DLLPUBLIC Scheduler +class VCL_DLLPUBLIC Task { -protected: - ImplSchedulerData* mpSchedulerData; /// Pointer to element in scheduler list - const sal_Char *mpDebugName; /// Useful for debugging - SchedulerPriority mePriority; /// Scheduler priority - bool mbActive; /// Currently in the scheduler + friend class Scheduler; + friend struct ImplSchedulerData; - // These should be constexpr static, when supported. - static const sal_uInt64 ImmediateTimeoutMs = 1; - static const sal_uInt64 InfiniteTimeoutMs = 1000 * 60 * 60 * 24; // 1 day +protected: + ImplSchedulerData *mpSchedulerData; /// Pointer to the element in scheduler list + const sal_Char *mpDebugName; /// Useful for debugging + TaskPriority mePriority; /// Task priority + bool mbActive; /// Currently in the scheduler - static void ImplStartTimer(sal_uInt64 nMS, bool bForce = false); + void StartTimer( sal_uInt64 nMS ); - friend struct ImplSchedulerData; virtual void SetDeletionFlags(); /// Is this item ready to be dispatched at nTimeNow virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const = 0; @@ -64,12 +96,12 @@ protected: virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) const = 0; public: - Scheduler( const sal_Char *pDebugName ); - Scheduler( const Scheduler& rScheduler ); - virtual ~Scheduler(); + Task( const sal_Char *pDebugName ); + Task( const Task& rTask ); + virtual ~Task(); - void SetPriority(SchedulerPriority ePriority) { mePriority = ePriority; } - SchedulerPriority GetPriority() const { return mePriority; } + void SetPriority(TaskPriority ePriority) { mePriority = ePriority; } + TaskPriority GetPriority() const { return mePriority; } void SetDebugName( const sal_Char *pDebugName ) { mpDebugName = pDebugName; } const char *GetDebugName() { return mpDebugName; } @@ -82,23 +114,7 @@ public: bool IsActive() const { return mbActive; } - Scheduler& operator=( const Scheduler& rScheduler ); - static void ImplDeInitScheduler(); - - /// Process one pending Timer with highhest priority - static void CallbackTaskScheduling( bool ignore ); - /// Calculate minimum timeout - and return its value. - static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles ); - /// Process one pending task ahead of time with highest priority. - static bool ProcessTaskScheduling( bool bIdle ); - /// Process all events until we are idle - static void ProcessEventsToIdle(); - - /// Control the deterministic mode. In this mode, two subsequent runs of - /// LibreOffice fire about the same amount idles. - static void SetDeterministicMode(bool bDeterministic); - /// Return the current state of deterministic mode. - static bool GetDeterministicMode(); + Task& operator=( const Task& rTask ); }; #endif // INCLUDED_VCL_SCHEDULER_HXX diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index ff79acd..19a882f 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -23,7 +23,7 @@ #include <tools/link.hxx> #include <vcl/scheduler.hxx> -class VCL_DLLPUBLIC Timer : public Scheduler +class VCL_DLLPUBLIC Timer : public Task { protected: Link<Timer *, void> maTimeoutHdl; // Callback Link diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 9a752ae..2f43476 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -447,7 +447,7 @@ LngSvcMgr::LngSvcMgr() UpdateAll(); - aUpdateIdle.SetPriority(SchedulerPriority::LOWEST); + aUpdateIdle.SetPriority(TaskPriority::LOWEST); aUpdateIdle.SetIdleHdl(LINK(this, LngSvcMgr, updateAndBroadcast)); // request to be notified if an extension has been added/removed diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index 5332dbc..bddccde 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -116,7 +116,7 @@ ODesignView::ODesignView( vcl::Window* pParent, m_aSplitWin->SetAlign(WindowAlign::Left); m_aSplitWin->Show(); - m_aMarkIdle.SetPriority( SchedulerPriority::LOW ); + m_aMarkIdle.SetPriority( TaskPriority::LOW ); m_aMarkIdle.SetIdleHdl( LINK( this, ODesignView, MarkTimeout ) ); } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index c199c11..b5d60ab 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -249,7 +249,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : SetLanguage( ScGlobal::eLnge, ScGlobal::eLnge, ScGlobal::eLnge ); aTrackIdle.SetIdleHdl( LINK( this, ScDocument, TrackTimeHdl ) ); - aTrackIdle.SetPriority( SchedulerPriority::LOW ); + aTrackIdle.SetPriority( TaskPriority::LOW ); } sfx2::LinkManager* ScDocument::GetLinkManager() diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx index fd27fbd..c159f39 100644 --- a/sc/source/core/tool/chartlis.cxx +++ b/sc/source/core/tool/chartlis.cxx @@ -405,7 +405,7 @@ ScChartHiddenRangeListener::~ScChartHiddenRangeListener() void ScChartListenerCollection::Init() { aIdle.SetIdleHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); - aIdle.SetPriority( SchedulerPriority::REPAINT ); + aIdle.SetPriority( TaskPriority::REPAINT ); aIdle.SetDebugName( "sc::ScChartListenerCollection aIdle" ); } diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index c81adcc..1bf3cba 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -179,7 +179,7 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : ERRCODE_AREA_APP2-1, GetResMgr() ); - aSpellIdle.SetPriority(SchedulerPriority::LOWER); + aSpellIdle.SetPriority(TaskPriority::LOWER); aSpellIdle.SetIdleHdl( LINK( this, ScModule, SpellTimerHdl ) ); aSpellIdle.SetDebugName( "sc::ScModule aSpellIdle" ); diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index e49bf82..5148a7c 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -88,7 +88,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc // Hack: RefInput-Kontrolle pIdle = new Idle; // FIXME: this is an abomination - pIdle->SetPriority( SchedulerPriority::LOWEST ); + pIdle->SetPriority( TaskPriority::LOWEST ); pIdle->SetIdleHdl( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) ); pIdle->Start(); } diff --git a/sc/source/ui/docshell/autostyl.cxx b/sc/source/ui/docshell/autostyl.cxx index 3888dbc..355d5b7 100644 --- a/sc/source/ui/docshell/autostyl.cxx +++ b/sc/source/ui/docshell/autostyl.cxx @@ -65,7 +65,7 @@ ScAutoStyleList::ScAutoStyleList(ScDocShell* pShell) { aTimer.SetTimeoutHdl( LINK( this, ScAutoStyleList, TimerHdl ) ); aInitIdle.SetIdleHdl( LINK( this, ScAutoStyleList, InitHdl ) ); - aInitIdle.SetPriority( SchedulerPriority::HIGHEST ); + aInitIdle.SetPriority( TaskPriority::HIGHEST ); } ScAutoStyleList::~ScAutoStyleList() diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index e92e3ee..6bfa541 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -108,13 +108,13 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window m_pAcceptChgCtr = VclPtr<SvxAcceptChgCtr>::Create(get_content_area(), this); nAcceptCount=0; nRejectCount=0; - aReOpenIdle.SetPriority(SchedulerPriority::MEDIUM); + aReOpenIdle.SetPriority(TaskPriority::MEDIUM); aReOpenIdle.SetIdleHdl(LINK( this, ScAcceptChgDlg, ReOpenTimerHdl )); pTPFilter=m_pAcceptChgCtr->GetFilterPage(); pTPView=m_pAcceptChgCtr->GetViewPage(); pTheView=pTPView->GetTableControl(); - aSelectionIdle.SetPriority(SchedulerPriority::LOW); + aSelectionIdle.SetPriority(TaskPriority::LOW); aSelectionIdle.SetIdleHdl(LINK( this, ScAcceptChgDlg, UpdateSelectionHdl )); aSelectionIdle.SetDebugName( "ScAcceptChgDlg aSelectionIdle" ); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 1498a1f..5998d39 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -764,7 +764,7 @@ ScRefHandler::ScRefHandler( vcl::Window &rWindow, SfxBindings* pB, bool bBindRef pActiveWin(nullptr) { m_aHelper.SetWindow(m_rWindow.get()); - aIdle.SetPriority(SchedulerPriority::LOWER); + aIdle.SetPriority(TaskPriority::LOWER); aIdle.SetIdleHdl(LINK( this, ScRefHandler, UpdateFocusHdl)); if( bBindRef ) EnterRefMode(); diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index 578efed..6b50687 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -421,7 +421,7 @@ ScConflictsDlg::ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScD m_pLbConflicts->SetSelectionMode( SelectionMode::Multiple ); m_pLbConflicts->SetHighlightRange(); - maSelectionIdle.SetPriority( SchedulerPriority::LOW ); + maSelectionIdle.SetPriority( TaskPriority::LOW ); maSelectionIdle.SetIdleHdl( LINK( this, ScConflictsDlg, UpdateSelectionHdl ) ); maSelectionIdle.SetDebugName( "ScConflictsDlg maSelectionIdle" ); diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index e8e5745..0d17bbb 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -528,7 +528,7 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pPar aScenarioBox->Hide(); aContentIdle.SetIdleHdl( LINK( this, ScNavigatorDlg, TimeHdl ) ); - aContentIdle.SetPriority( SchedulerPriority::LOWEST ); + aContentIdle.SetPriority( TaskPriority::LOWEST ); if (bInSidebar) { diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx index 2fd8ff0..9602323 100644 --- a/sc/source/ui/pagedlg/tphfedit.cxx +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -341,7 +341,7 @@ ScExtIButton::ScExtIButton(vcl::Window* pParent, WinBits nBits ) pPopupMenu(nullptr) { nSelected=0; - aIdle.SetPriority(SchedulerPriority::LOWEST); + aIdle.SetPriority(TaskPriority::LOWEST); SetDropDown(PushButtonDropdownStyle::Toolbox); } diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 9787754..0f5fe0e 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -771,7 +771,7 @@ void SdDrawDocument::StartOnlineSpelling(bool bForceSpelling) mpOnlineSpellingList->seekShape(0); mpOnlineSpellingIdle = new Idle("OnlineSpelling"); mpOnlineSpellingIdle->SetIdleHdl( LINK(this, SdDrawDocument, OnlineSpellingHdl) ); - mpOnlineSpellingIdle->SetPriority(SchedulerPriority::LOWEST); + mpOnlineSpellingIdle->SetPriority(TaskPriority::LOWEST); mpOnlineSpellingIdle->Start(); } } diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx index 0626fde..cdb2448 100644 --- a/sd/source/ui/dlg/brkdlg.cxx +++ b/sd/source/ui/dlg/brkdlg.cxx @@ -47,7 +47,7 @@ BreakDlg::BreakDlg( : SfxModalDialog(pWindow, "BreakDialog", "modules/sdraw/ui/breakdialog.ui") , mpProgress( nullptr ) { - m_aUpdateIdle.SetPriority( SchedulerPriority::REPAINT ); + m_aUpdateIdle.SetPriority( TaskPriority::REPAINT ); m_aUpdateIdle.SetIdleHdl( LINK( this, BreakDlg, InitialUpdate ) ); m_aUpdateIdle.SetDebugName( "sd::BreakDlg m_aUpdateIdle" ); diff --git a/sd/source/ui/dlg/filedlg.cxx b/sd/source/ui/dlg/filedlg.cxx index b06c780..bcf3913 100644 --- a/sd/source/ui/dlg/filedlg.cxx +++ b/sd/source/ui/dlg/filedlg.cxx @@ -129,7 +129,7 @@ IMPL_LINK_NOARG(SdFileDialog_Imp, PlayMusicHdl, void*, void) { mxPlayer.set( avmedia::MediaWindow::createPlayer( aUrl, "" ), css::uno::UNO_QUERY_THROW ); mxPlayer->start(); - maUpdateIdle.SetPriority( SchedulerPriority::LOW ); + maUpdateIdle.SetPriority( TaskPriority::LOW ); maUpdateIdle.Start(); } catch (const css::uno::Exception&) diff --git a/sd/source/ui/framework/module/ShellStackGuard.cxx b/sd/source/ui/framework/module/ShellStackGuard.cxx index cf4fe2d..7022b91 100644 --- a/sd/source/ui/framework/module/ShellStackGuard.cxx ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits