[Libreoffice-commits] core.git: Branch 'private/jmux/scheduler-fixes' - 218 commits - accessibility/source avmedia/source basctl/source basic/qa basic/source bean/native binaryurp/source bin/get-bugzilla-attachments-by-mimetype bridges/source canvas/source chart2/source cli_ure/source codemaker/source comphelper/source compilerplugins/clang compilerplugins/Makefile-clang.mk config_host.mk.in configmgr/source configure.ac connectivity/source cppcanvas/source cppuhelper/source cppu/qa cui/source cui/uiconfig dbaccess/source desktop/qa desktop/source desktop/test distro-configs/Jenkins drawinglayer/source dtrans/source editeng/source embeddedobj/source embedserv/source emfio/source extensions/source extensions/test external/coinmp external/firebird external/libabw external/libcdr external/libebook external/libetonyek external/libfreehand external/libmspub external/libmwaw external/libodfgen external/liborcus external/libpagemaker external/libqxp external/libstaroffice external/libvisio external/libw pd external/libwpg external/libwps external/libxslt external/libzmf external/mythes external/openldap external/pdfium filter/qa filter/source forms/source formula/uiconfig fpicker/source framework/inc framework/qa framework/source helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/source i18npool/inc i18npool/qa i18npool/source i18nutil/source icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_svg icon-themes/tango idlc/source include/basegfx include/comphelper include/connectivity include/editeng include/filter include/i18nlangtag include/i18nutil include/LibreOfficeKit include/sal include/sfx2 include/svl include/svtools include/svx include/toolkit include/tools include/unotools include/vcl include/xmloff ios/CustomTarget_iOS.mk ios/LibreOfficeKit ios/loApp.xcconfig.in ios/loKit.xcconfig.in io/source ios/README javaunohelper/source jvmfwk/plugins jvmfwk/source libreofficekit/Executable_gtktiledviewer.mk libreofficekit/qa libreofficekit/source lingucomponent/source li nguistic/source Makefile.in mysqlc/source odk/examples oox/source opencl/source package/source pyuno/qa qadevOOo/runner qadevOOo/tests README.md reportdesign/source sal/osl sax/source scaddins/source sc/inc sc/qa scripting/source sc/source sdext/source sd/qa sd/source sd/uiconfig sfx2/inc sfx2/source shell/source slideshow/source slideshow/test solenv/CompilerTest_compilerplugins_clang.mk solenv/gbuild solenv/inc sot/source starmath/source stoc/source stoc/test svgio/source svl/qa svl/source svtools/langsupport svtools/source svx/inc svx/source svx/workben sw/CppunitTest_sw_uiwriter.mk sw/inc sw/qa sw/source sw/uiconfig toolkit/source tools/qa tools/source ucbhelper/source ucb/source uitest/libreoffice unodevtools/source unotools/qa unotools/source unoxml/source uui/source vcl/backendtest vcl/inc vcl/Library_vcl.mk vcl/opengl vcl/osx vcl/quartz vcl/README.scheduler vcl/source vcl/unx vcl/win vcl/workben winaccessibility/source wizards/com wizards/source writerfilter/inc writerfilter /source writerperfect/qa writerperfect/source xmlhelp/source xmloff/inc xmloff/source xmlscript/source xmlscript/test xmlsecurity/inc xmlsecurity/source xmlsecurity/workben
Jan-Marek Glogowski
glogow at fbihome.de
Thu Oct 5 16:41:38 UTC 2017
Rebased ref, commits from common ancestor:
commit d1169d324d63c98731a3f21ec74899e991c12dda
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Thu Oct 5 18:19:32 2017 +0200
Some more stuff
Change-Id: Ia17be032ae39dc4c7bfa44cadd22d85a1b9c4fbd
diff --git a/sw/source/core/doc/SwDocIdle.cxx b/sw/source/core/doc/SwDocIdle.cxx
index 9461807943d8..ff0c9fd3945c 100644
--- a/sw/source/core/doc/SwDocIdle.cxx
+++ b/sw/source/core/doc/SwDocIdle.cxx
@@ -24,6 +24,7 @@
#include <vcl/scheduler.hxx>
#include "SwDocIdle.hxx"
+#include "IDocumentLayoutAccess.hxx"
namespace sw
{
@@ -31,12 +32,25 @@ namespace sw
sal_uInt64 SwDocIdle::UpdateMinPeriod( sal_uInt64 /* nMinPeriod */, sal_uInt64 /* nTimeNow */ ) const
{
bool bReadyForSchedule = true;
+
SwView* pView = m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetView() : nullptr;
if( pView )
{
SwWrtShell& rWrtShell = pView->GetWrtShell();
bReadyForSchedule = rWrtShell.GetViewOptions()->IsIdle();
}
+
+ if( bReadyForSchedule )
+ {
+ SwViewShell* pShell( m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() );
+ for( SwViewShell& rSh : pShell->GetRingContainer() )
+ if( rSh.ActionPend() )
+ {
+ bReadyForSchedule = false;
+ break;
+ }
+ }
+
return bReadyForSchedule
? Scheduler::ImmediateTimeoutMs : Scheduler::InfiniteTimeoutMs;
}
diff --git a/vcl/inc/unx/gendisp.hxx b/vcl/inc/unx/gendisp.hxx
index 5c8f5113c300..2d5bc12fcadf 100644
--- a/vcl/inc/unx/gendisp.hxx
+++ b/vcl/inc/unx/gendisp.hxx
@@ -47,7 +47,7 @@ public:
void SendInternalEvent( SalFrame* pFrame, void* pData, SalEvent nEvent = SalEvent::UserEvent );
void CancelInternalEvent( SalFrame* pFrame, void* pData, SalEvent nEvent );
- bool DispatchInternalEvent();
+ bool DispatchInternalEvent( bool bHandleAllCurrentEvent = false );
bool MouseCaptured( const SalFrame *pFrameData ) const
{ return m_pCapture == pFrameData; }
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index 8f96e03630b0..54799149e25c 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -179,7 +179,7 @@ public:
virtual void StartTimer( sal_uLong nMS );
virtual void StopTimer();
- bool CheckTimeout( bool bExecuteTimers = true );
+ virtual bool CheckTimeout( bool bExecuteTimers = true );
SalI18N_InputMethod* GetInputMethod() const { return m_pInputMethod; }
Display* GetDisplay() const { return m_pDisplay; }
diff --git a/vcl/source/app/salusereventlist.cxx b/vcl/source/app/salusereventlist.cxx
index 6384d8805be4..8f9d76ed313f 100644
--- a/vcl/source/app/salusereventlist.cxx
+++ b/vcl/source/app/salusereventlist.cxx
@@ -51,6 +51,7 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents )
{
osl::MutexGuard aGuard( m_aUserEventsMutex );
+ assert( m_aProcessingUserEvents.empty() );
if( ! m_aUserEvents.empty() )
{
if( bHandleAllCurrentEvents )
diff --git a/vcl/unx/generic/app/gendisp.cxx b/vcl/unx/generic/app/gendisp.cxx
index 1be8606602e0..c83283a7b0e0 100644
--- a/vcl/unx/generic/app/gendisp.cxx
+++ b/vcl/unx/generic/app/gendisp.cxx
@@ -47,9 +47,9 @@ void SalGenericDisplay::emitDisplayChanged()
pAnyFrame->CallCallback( SalEvent::DisplayChanged, nullptr );
}
-bool SalGenericDisplay::DispatchInternalEvent()
+bool SalGenericDisplay::DispatchInternalEvent( bool bHandleAllCurrentEvent )
{
- return DispatchUserEvents( false );
+ return DispatchUserEvents( bHandleAllCurrentEvent );
}
void SalGenericDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, SalEvent nEvent )
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index abd29a78c077..66c804df9fb9 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -146,8 +146,9 @@ bool X11SalInstance::AnyInput(VclInputFlags nType)
bool bRet = false;
if( (nType & VclInputFlags::TIMER) && (mpXLib && mpXLib->CheckTimeout(false)) )
- bRet = true;
- else if (XPending(pDisplay) )
+ return true;
+
+ if (XPending(pDisplay) )
{
PredicateReturn aInput;
XEvent aEvent;
diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx
index 8a2422a3918d..14a753e1c0a1 100644
--- a/vcl/unx/kde4/KDESalDisplay.cxx
+++ b/vcl/unx/kde4/KDESalDisplay.cxx
@@ -47,9 +47,6 @@ SalKDEDisplay::~SalKDEDisplay()
void SalKDEDisplay::Yield()
{
- if( DispatchInternalEvent() )
- return;
-
// Prevent blocking from Drag'n'Drop events, which may have already have processed the event
if (XEventsQueued( pDisp_, QueuedAfterReading ) == 0)
return;
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index f047ed9fce65..43e055a2c0bb 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -53,6 +53,7 @@ KDEXLib::KDEXLib() :
m_nFakeCmdLineArgs( 0 ),
m_isGlibEventLoopType(false), m_allowKdeDialogs(false),
m_timerEventId( -1 ), m_postUserEventId( -1 )
+ , m_bTimedOut( false )
{
m_timerEventId = QEvent::registerEventType();
m_postUserEventId = QEvent::registerEventType();
@@ -269,22 +270,24 @@ void KDEXLib::socketNotifierActivated( int fd )
bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
+ bool bWasEvent = false;
if( !m_isGlibEventLoopType )
{
- bool wasEvent = false;
if( qApp->thread() == QThread::currentThread())
{
// even if we use the LO event loop, still process Qt's events,
// otherwise they can remain unhandled for quite a long while
- wasEvent = processYield( false, bHandleAllCurrentEvents );
+ bWasEvent = processYield( false, bHandleAllCurrentEvents );
}
- return SalXLib::Yield(bWait, bHandleAllCurrentEvents) || wasEvent;
+ return SalXLib::Yield(bWait, bHandleAllCurrentEvents) || bWasEvent;
}
// if we are the main thread (which is where the event processing is done),
// good, just do it
if( qApp->thread() == QThread::currentThread())
{
- return processYield( bWait, bHandleAllCurrentEvents );
+ bWasEvent = processYield( bWait, bHandleAllCurrentEvents );
+ if ( bWasEvent )
+ m_aWaitingYieldCond.set();
}
else
{
@@ -292,23 +295,40 @@ bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
// release the yield lock to prevent deadlock with the main thread
// (it's ok to release it here, since even normal processYield() would
// temporarily do it while checking for new events)
- SolarMutexReleaser aReleaser;
- return Q_EMIT processYieldSignal( bWait, bHandleAllCurrentEvents );
+ {
+ SolarMutexReleaser aReleaser;
+ bWasEvent = Q_EMIT processYieldSignal( false, bHandleAllCurrentEvents );
+ }
+ if ( !bWasEvent && bWait )
+ {
+ m_aWaitingYieldCond.reset();
+ SolarMutexReleaser aReleaser;
+ m_aWaitingYieldCond.wait();
+ bWasEvent = true;
+ }
}
+ return bWasEvent;
}
-/**
- * Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes
- * pending events that match flags until there are no more events to process.
- */
-bool KDEXLib::processYield( bool bWait, bool )
+bool KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents )
{
- QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread());
bool wasEvent = false;
- if ( bWait )
+ if ( m_isGlibEventLoopType )
+ {
+ wasEvent = SalKDEDisplay::self()->DispatchInternalEvent( bHandleAllCurrentEvents );
+ if ( !bHandleAllCurrentEvents && wasEvent )
+ return true;
+ }
+
+ /**
+ * Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes
+ * pending events that match flags until there are no more events to process.
+ */
+ QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread());
+ if ( bWait && !wasEvent )
wasEvent = dispatcher->processEvents( QEventLoop::WaitForMoreEvents );
else
- wasEvent = dispatcher->processEvents( QEventLoop::AllEvents );
+ wasEvent = dispatcher->processEvents( QEventLoop::AllEvents ) || wasEvent;
return wasEvent;
}
@@ -336,18 +356,28 @@ void KDEXLib::StopTimer()
timeoutTimer.stop();
}
+bool KDEXLib::CheckTimeout( bool bExecuteTimers )
+{
+ if( !m_isGlibEventLoopType )
+ return SalXLib::CheckTimeout( bExecuteTimers );
+ assert( !bExecuteTimers );
+ return m_bTimedOut;
+}
+
void KDEXLib::timeoutActivated()
{
// don't potentially wait in timeout, as QTimer is non-recursive
+ m_bTimedOut = true;
QApplication::postEvent(this, new QEvent(QEvent::Type( m_timerEventId )));
}
void KDEXLib::customEvent(QEvent* e)
{
if( e->type() == m_timerEventId )
+ {
+ m_bTimedOut = false;
X11SalData::Timeout();
- else if( e->type() == m_postUserEventId )
- SalKDEDisplay::self()->DispatchInternalEvent();
+ }
}
void KDEXLib::Wakeup()
diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx
index 4c06104b4c59..452aae8b3286 100644
--- a/vcl/unx/kde4/KDEXLib.hxx
+++ b/vcl/unx/kde4/KDEXLib.hxx
@@ -30,13 +30,14 @@
#include <QtCore/QTimer>
#include <unx/salinst.h>
+#include <osl/conditn.hxx>
class VCLKDEApplication;
class KDEXLib : public QObject, public SalXLib
{
Q_OBJECT
- private:
+
bool m_bStartupDone;
std::unique_ptr<VCLKDEApplication> m_pApplication;
std::unique_ptr<char*[]> m_pFreeCmdLineArgs;
@@ -56,23 +57,24 @@ class KDEXLib : public QObject, public SalXLib
bool m_allowKdeDialogs;
int m_timerEventId;
int m_postUserEventId;
+ osl::Condition m_aWaitingYieldCond;
+ bool m_bTimedOut;
- private:
- void setupEventLoop();
+ void setupEventLoop();
- private Q_SLOTS:
+private Q_SLOTS:
void socketNotifierActivated( int fd );
void timeoutActivated();
void startTimeoutTimer();
- static bool processYield( bool bWait, bool bHandleAllCurrentEvents );
+ bool processYield( bool bWait, bool bHandleAllCurrentEvents );
- Q_SIGNALS:
+Q_SIGNALS:
void startTimeoutTimerSignal();
bool processYieldSignal( bool bWait, bool bHandleAllCurrentEvents );
css::uno::Reference< css::ui::dialogs::XFilePicker2 >
createFilePickerSignal( const css::uno::Reference< css::uno::XComponentContext >& );
- public:
+public:
KDEXLib();
virtual ~KDEXLib() override;
@@ -82,6 +84,7 @@ class KDEXLib : public QObject, public SalXLib
virtual void Remove( int fd ) override;
virtual void StartTimer( sal_uLong nMS ) override;
virtual void StopTimer() override;
+ virtual bool CheckTimeout( bool bExecuteTimers = true ) override;
virtual void Wakeup() override;
void TriggerUserEventProcessing();
@@ -90,7 +93,7 @@ class KDEXLib : public QObject, public SalXLib
virtual void customEvent(QEvent* e) override;
- public Q_SLOTS:
+public Q_SLOTS:
css::uno::Reference< css::ui::dialogs::XFilePicker2 >
createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& );
};
commit 3f4511523269d53a86afdb4e56710e68365c4578
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Fri Sep 29 22:24:15 2017 +0200
WIP Fix unprocessed shutdown events
DO NOT MERGE!
This is just a test patch, since I can't reproduce the
Jenkins failures locally. It's not "make check" tested,
just "make vcl".
This fixes multiple problems, which I missed.
We're not interested in WM_TIMER events, but in active
SAL_MSG_TIMER_CALLBACK, which is indicated by PollForMessage().
This includes a revert of "tdf#38915: don't wait on message queue
if application already has quit.", which is commited as
f054b9187155bc32b7d06808aea87127cb0a3a4f.
We can't ignore the wait flag, just because the application will
quit, as we have to deliver the expected event announced by
pTimer->PollForMessage().
And we don't try to "clean" the message queue, as invalid events
are simply identified by there version ID.
On Mac we can probably drop the workaround. We can't wait for a
timer event in a redirected dispatch_async, for whatever reason.
Change-Id: If806d41c6fcfce10b0c4c7fdcf1df5df6ac16a1d
diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h
index 5ad6a1718f19..532765e050f0 100644
--- a/vcl/inc/win/saltimer.h
+++ b/vcl/inc/win/saltimer.h
@@ -34,7 +34,7 @@ class WinSalTimer final : public SalTimer, protected VersionedEvent
void ImplStart( sal_uIntPtr nMS );
void ImplStop();
- void ImplEmitTimerCallback();
+ void ImplHandleTimerEvent( WPARAM aWPARAM );
public:
WinSalTimer();
@@ -43,16 +43,9 @@ public:
virtual void Start(sal_uIntPtr nMS) override;
virtual void Stop() override;
- inline bool IsValidWPARAM( WPARAM wParam ) const;
-
inline bool PollForMessage() const;
};
-inline bool WinSalTimer::IsValidWPARAM( WPARAM aWPARAM ) const
-{
- return IsValidEventVersion( static_cast<sal_Int32>( aWPARAM ) );
-}
-
inline bool WinSalTimer::PollForMessage() const
{
return m_bPollForMessage;
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index d475f30275b0..0334087f57cf 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -570,10 +570,10 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
// handle available events
NSEvent* pEvent = nil;
NSTimeInterval now = [[NSProcessInfo processInfo] systemUptime];
+ AquaSalInstance *pInst = GetSalData()->mpInstance;
do
{
SolarMutexReleaser aReleaser;
-
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12
pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask
@@ -591,6 +591,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
[NSApp updateWindows];
+ if ( AquaSalInstance::AnyInput( VclInputFlags::TIMER ) && !pInst->mbNoYieldLock && !bHadEvent )
+ continue;
if ( !bHandleAllCurrentEvents || !pEvent || now < [pEvent timestamp] )
break;
}
@@ -618,7 +620,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
}
// collect update rectangles
- for( auto pSalFrame : GetSalData()->mpInstance->getFrames() )
+ for( auto pSalFrame : pInst->getFrames() )
{
AquaSalFrame* pFrame = static_cast<AquaSalFrame*>( pSalFrame );
if( pFrame->mbShown && ! pFrame->maInvalidRect.IsEmpty() )
diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx
index 877fdfae85b5..e6336fbedd6e 100644
--- a/vcl/osx/saltimer.cxx
+++ b/vcl/osx/saltimer.cxx
@@ -44,30 +44,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
subtype: nEventId
data1: nUserData
data2: 0];
- assert( pEvent );
if ( nil == pEvent )
- return;
- if ( NO == bAtStart )
- {
- // nextEventMatchingMask has to run in the main thread!
- assert([NSThread isMainThread]);
-
- // Posting an event to the end of an empty queue fails,
- // so we peek the queue and post to the start, if empty.
- // Some Qt bugs even indicate nextEvent without dequeue
- // sometimes blocks, so we dequeue and re-add the event.
-SAL_WNODEPRECATED_DECLARATIONS_PUSH
-// 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12
- NSEvent* pPeekEvent = [NSApp nextEventMatchingMask: NSAnyEventMask
-SAL_WNODEPRECATED_DECLARATIONS_POP
- untilDate: nil
- inMode: NSDefaultRunLoopMode
- dequeue: YES];
- if ( nil == pPeekEvent )
- bAtStart = YES;
- else
- [NSApp postEvent: pPeekEvent atStart: YES];
- }
+ std::abort();
[NSApp postEvent: pEvent atStart: bAtStart];
}
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 5c1b1bc8f5f4..92db1e23563a 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -171,7 +171,7 @@ void Scheduler::ImplDeInitScheduler()
SAL_INFO( "vcl.schedule.deinit", "DeInit the scheduler - finished" );
SAL_WARN_IF( 0 != nActiveTasks, "vcl.schedule.deinit", "DeInit active tasks: "
<< nActiveTasks << " (ignored: " << nIgnoredTasks << ")" );
-// assert( nIgnoredTasks == nActiveTasks );
+ assert( nIgnoredTasks == nActiveTasks );
#endif
rSchedCtx.mpFirstSchedulerData = nullptr;
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 3cfa96a5b0b4..60d809a83007 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -513,8 +513,7 @@ static bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
if ( bHandleAllCurrentEvents )
nLastTicks = nCurTicks;
- // Also check that we don't wait when application already has quit
- if ( bWait && !bWasMsg && !pSVData->maAppData.mbAppQuit )
+ if ( bWait && !bWasMsg )
{
if ( GetMessageW( &aMsg, nullptr, 0, 0 ) )
{
@@ -539,8 +538,6 @@ bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
SolarMutexReleaser aReleaser;
if ( !IsMainThread() )
{
- // If you change the SendMessageW function, you might need to update
- // the PeekMessage( ... PM_QS_POSTMESSAGE) calls!
bDidWork = SendMessageW( mhComWnd, SAL_MSG_THREADYIELD,
(WPARAM) false, (LPARAM) bHandleAllCurrentEvents );
if ( !bDidWork && bWait )
@@ -658,17 +655,7 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, i
{
WinSalTimer *const pTimer = static_cast<WinSalTimer*>( ImplGetSVData()->maSchedCtx.mpSalTimer );
assert( pTimer != nullptr );
- MSG aMsg;
- bool bValidMSG = pTimer->IsValidWPARAM( wParam );
- // PM_QS_POSTMESSAGE is needed, so we don't process the SendMessage from DoYield!
- while ( PeekMessageW(&aMsg, pInst->mhComWnd, SAL_MSG_TIMER_CALLBACK,
- SAL_MSG_TIMER_CALLBACK, PM_REMOVE | PM_NOYIELD | PM_QS_POSTMESSAGE) )
- {
- assert( !bValidMSG && "Unexpected non-last valid message" );
- bValidMSG = pTimer->IsValidWPARAM( aMsg.wParam );
- }
- if ( bValidMSG )
- pTimer->ImplEmitTimerCallback();
+ pTimer->ImplHandleTimerEvent( wParam );
break;
}
}
@@ -699,6 +686,13 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
{
MSG aMsg;
+ if ( nType & VclInputFlags::TIMER )
+ {
+ const WinSalTimer* pTimer = static_cast<WinSalTimer*>( ImplGetSVData()->maSchedCtx.mpSalTimer );
+ if ( pTimer && pTimer->PollForMessage() )
+ return true;
+ }
+
if ( (nType & VCL_INPUT_ANY) == VCL_INPUT_ANY )
{
// revert bugfix for #108919# which never reported timeouts when called from the timer handler
@@ -755,15 +749,6 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
return true;
}
- if ( nType & VclInputFlags::TIMER )
- {
- // Test for timer input
- if ( PeekMessageW( &aMsg, nullptr, WM_TIMER, WM_TIMER,
- PM_NOREMOVE | PM_NOYIELD ) )
- return true;
-
- }
-
if ( nType & VclInputFlags::OTHER )
{
// Test for any input
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 93b93fbb832f..8354886fbcd6 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -50,12 +50,6 @@ void WinSalTimer::ImplStop()
// Keep both after DeleteTimerQueueTimer, because they are set in SalTimerProc
InvalidateEvent();
m_bPollForMessage = false;
-
- // remove as many pending SAL_MSG_TIMER_CALLBACK messages as possible
- // PM_QS_POSTMESSAGE is needed, so we don't process the SendMessage from DoYield!
- MSG aMsg;
- while ( PeekMessageW(&aMsg, pInst->mhComWnd, SAL_MSG_TIMER_CALLBACK,
- SAL_MSG_TIMER_CALLBACK, PM_REMOVE | PM_NOYIELD | PM_QS_POSTMESSAGE) );
}
void WinSalTimer::ImplStart( sal_uLong nMS )
@@ -75,9 +69,7 @@ void WinSalTimer::ImplStart( sal_uLong nMS )
// probably WT_EXECUTEONLYONCE is not needed, but it enforces Period
// to be 0 and should not hurt; also see
// https://www.microsoft.com/msj/0499/pooling/pooling.aspx
- CreateTimerQueueTimer(&m_nTimerId, nullptr, SalTimerProc,
- reinterpret_cast<void*>(
- sal_IntPtr(GetNextEventVersion())),
+ CreateTimerQueueTimer(&m_nTimerId, nullptr, SalTimerProc, this,
nMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE);
}
@@ -126,12 +118,11 @@ void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
{
__try
{
- // always post message when the timer fires, we will remove the ones
- // that happened during execution of the callback later directly from
- // the message queue
- BOOL const ret = PostMessageW(GetSalData()->mpInstance->mhComWnd,
- SAL_MSG_TIMER_CALLBACK,
- reinterpret_cast<WPARAM>(data), 0);
+ WinSalTimer *pTimer = reinterpret_cast<WinSalTimer*>( data );
+ pTimer->m_bPollForMessage = true;
+ BOOL const ret = PostMessageW(
+ GetSalData()->mpInstance->mhComWnd, SAL_MSG_TIMER_CALLBACK,
+ static_cast<WPARAM>(pTimer->GetNextEventVersion()), 0 );
#if OSL_DEBUG_LEVEL > 0
if (0 == ret) // SEH prevents using SAL_WARN here?
fputs("ERROR: PostMessage() failed!\n", stderr);
@@ -142,8 +133,12 @@ void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
}
}
-void WinSalTimer::ImplEmitTimerCallback()
+void WinSalTimer::ImplHandleTimerEvent( WPARAM aWPARAM )
{
+ assert( aWPARAM <= SAL_MAX_INT32 );
+ if ( !IsValidEventVersion( static_cast<sal_Int32>( aWPARAM ) ) )
+ return;
+
// Test for MouseLeave
SalTestMouseLeave();
commit 0cb424fec7389801578085b618c5ad68a98f4637
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Wed Sep 27 16:42:57 2017 +0200
Minimize GtkSalData scope in timeout callback
After commit 2e8a95d1f87a3dbdcc8846fa44d1899abc8edd9c this doesn't
anymore generate false positives in the constparams clang plugin:
vcl/unx/gtk/gtkdata.cxx:817:39: error: ...
... this parameter can be const [loplugin:constparams]
static gboolean call_userEventFn( void *data )
^~~~~~~~~~
1 error generated.
/vcl/unx/gtk3/gtk3gtkdata.cxx:782:39: error: ...
... this parameter can be const [loplugin:constparams]
static gboolean call_userEventFn( void *data )
^~~~~~~~~~
1 error generated.
Change-Id: Id8d42a0c14bfcc887ec1ecbf70f4c41c26e26efb
Reviewed-on: https://gerrit.libreoffice.org/42912
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx
index da70c0fbd62c..77abe724298d 100644
--- a/vcl/unx/gtk/gtkdata.cxx
+++ b/vcl/unx/gtk/gtkdata.cxx
@@ -816,12 +816,11 @@ void GtkSalTimer::Stop()
extern "C" {
static gboolean call_userEventFn( void *data )
{
- GtkSalData *pThis = static_cast<GtkSalData *>(data);
SolarMutexGuard aGuard;
const SalGenericDisplay *pDisplay = GetGenericUnixSalData()->GetDisplay();
if ( pDisplay )
{
- GtkSalDisplay *pThisDisplay = pThis->GetGtkDisplay();
+ GtkSalDisplay *pThisDisplay = static_cast<GtkSalData *>(data)->GetGtkDisplay();
assert(static_cast<const SalGenericDisplay *>(pThisDisplay) == pDisplay);
pThisDisplay->DispatchInternalEvent();
}
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index fbd449ef4ec6..f4d41a53d2c0 100644
--- a/vcl/unx/gtk3/gtk3gtkdata.cxx
+++ b/vcl/unx/gtk3/gtk3gtkdata.cxx
@@ -781,12 +781,11 @@ void GtkSalTimer::Stop()
extern "C" {
static gboolean call_userEventFn( void *data )
{
- GtkSalData *pThis = static_cast<GtkSalData *>(data);
SolarMutexGuard aGuard;
const SalGenericDisplay *pDisplay = GetGenericUnixSalData()->GetDisplay();
if ( pDisplay )
{
- GtkSalDisplay *pThisDisplay = pThis->GetGtkDisplay();
+ GtkSalDisplay *pThisDisplay = static_cast<GtkSalData *>(data)->GetGtkDisplay();
assert(static_cast<const SalGenericDisplay *>(pThisDisplay) == pDisplay);
pThisDisplay->DispatchInternalEvent();
}
commit 62c040e5ed827f1aa451b1169095d52db46fbc1c
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 5 10:15:26 2017 +0200
Blind fix for MSVC warning C4211
..."nonstandard extension used: redefined extern to static", after the 'static'
in the friend declaration had to be removed for clang-cl with
e5d943d984bb0918f971eec45f45384cc0c72b67 "'static' is invalid in friend
declarations"
Change-Id: I14524ec0a5d8e7e12c5b506cbf7ac43508ae26ae
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index e8d3e10d0b86..93b93fbb832f 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -26,7 +26,7 @@
#include <win/saltimer.h>
#include <win/salinst.h>
-static void CALLBACK SalTimerProc(PVOID pParameter, BOOLEAN bTimerOrWaitFired);
+void CALLBACK SalTimerProc(PVOID pParameter, BOOLEAN bTimerOrWaitFired);
// See http://msdn.microsoft.com/en-us/library/windows/desktop/ms687003%28v=vs.85%29.aspx
// (and related pages) for details about the Timer Queues.
@@ -122,7 +122,7 @@ void WinSalTimer::Stop()
* This gets invoked from a Timer Queue thread.
* Don't acquire the SolarMutex to avoid deadlocks.
*/
-static void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
+void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
{
__try
{
commit f561531b69ae4870eaa9648f7c104cabcd0a7fa0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 4 21:14:06 2017 +0100
Related: tdf#112063 validation dialog legitimally changes modality
so to keep tdf#112063 working as with...
commit e66c9aa362c1e8729d76090023960610321b14f3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Sep 1 16:23:20 2017 +0100
Related: tdf#112063 unsetting and resetting gtk modality is a problem
for gtk3, so just set it on execute and no need to unset and reset it
for whatever vcl nuttiness the existing code is doing
then let the proper calls to SetModalInputMode call the frame modality switch
and the hackery vcl calls the underlying vcl-specific body as ImplSetModalInputMode
Change-Id: I853ca50e0d9830ca7ba3077e243ccdee6e84e696
Reviewed-on: https://gerrit.libreoffice.org/43142
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 6cea3b193ec2..1ff5136fb41a 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -157,6 +157,7 @@ public:
private:
bool ImplStartExecuteModal();
static void ImplEndExecuteModal();
+ void ImplSetModalInputMode(bool bModal);
public:
// Dialog::Execute replacement API
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 85abcd4c5238..c6d54e3de38a 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -629,8 +629,8 @@ bool Dialog::EventNotify( NotifyEvent& rNEvt )
// have re-enabled input for our parent
if( mbInExecute && mbModalMode )
{
- SetModalInputMode( false );
- SetModalInputMode( true );
+ ImplSetModalInputMode( false );
+ ImplSetModalInputMode( true );
// #93022# def-button might have changed after show
if( !mnMousePositioned )
@@ -825,7 +825,6 @@ bool Dialog::ImplStartExecuteModal()
GetParent()->CompatNotify( aNEvt );
}
mbInExecute = true;
- ImplGetFrame()->SetModal(true);
SetModalInputMode(true);
// FIXME: no layouting, workaround some clipping issues
@@ -1097,7 +1096,6 @@ void Dialog::EndDialog( long nResult )
if ( mbInExecute )
{
SetModalInputMode(false);
- ImplGetFrame()->SetModal(false);
// remove dialog from the list of dialogs which are being executed
ImplSVData* pSVData = ImplGetSVData();
@@ -1185,6 +1183,15 @@ void Dialog::SetModalInputMode( bool bModal )
if ( bModal == mbModalMode )
return;
+ ImplGetFrame()->SetModal(bModal);
+ ImplSetModalInputMode(bModal);
+}
+
+void Dialog::ImplSetModalInputMode( bool bModal )
+{
+ if ( bModal == mbModalMode )
+ return;
+
mbModalMode = bModal;
if ( bModal )
{
@@ -1232,8 +1239,8 @@ void Dialog::SetModalInputMode( bool bModal )
( pPrevModalDlg == mpPrevExecuteDlg.get()
|| !pPrevModalDlg->IsWindowOrChild( this, true ) ) )
{
- mpPrevExecuteDlg->SetModalInputMode( false );
- mpPrevExecuteDlg->SetModalInputMode( true );
+ mpPrevExecuteDlg->ImplSetModalInputMode( false );
+ mpPrevExecuteDlg->ImplSetModalInputMode( true );
}
}
}
commit a25868231adba6a3be30f9aedb71315de0c79acd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 4 13:04:25 2017 +0100
coverity#1399440 Dm: Dubious method used
Change-Id: Ied0a5218b4f95a300d09483315d577b5bdf01bae
Reviewed-on: https://gerrit.libreoffice.org/43135
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/framework/qa/complex/api_internal/CheckAPI.java b/framework/qa/complex/api_internal/CheckAPI.java
index bdeb2173dc10..8ee5b1f06c05 100644
--- a/framework/qa/complex/api_internal/CheckAPI.java
+++ b/framework/qa/complex/api_internal/CheckAPI.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.fail;
import helper.OfficeProvider;
import helper.ProcessHandler;
+import java.io.UnsupportedEncodingException;
import java.util.StringTokenizer;
import lib.TestParameters;
@@ -110,14 +111,18 @@ public class CheckAPI {
handler.kill();
util.utils.pause(10000);
OfficeProvider op = new OfficeProvider();
- xMSF = (XMultiServiceFactory)op.getManager(param);
- param.put("ServiceFactory",xMSF);
try {
+ xMSF = (XMultiServiceFactory)op.getManager(param);
+ param.put("ServiceFactory",xMSF);
+
oObj = xMSF.createInstance("org.openoffice.RunnerService");
}
catch(com.sun.star.uno.Exception e) {
fail("Could not create Instance of 'org.openoffice.RunnerService'");
}
+ catch (UnsupportedEncodingException e) {
+ fail("Could not get Manager'");
+ }
}
System.out.println(erg);
String processedErg = parseResult(erg);
diff --git a/qadevOOo/runner/base/java_complex.java b/qadevOOo/runner/base/java_complex.java
index 212c9337778f..9e61c5c5f9ae 100644
--- a/qadevOOo/runner/base/java_complex.java
+++ b/qadevOOo/runner/base/java_complex.java
@@ -29,6 +29,7 @@ import share.LogWriter;
import stats.Summarizer;
import lib.TestParameters;
import util.PropertyName;
+import java.io.UnsupportedEncodingException;
/**
* Test base for executing a java complex test.
@@ -110,6 +111,10 @@ public class java_complex implements TestBase
{
office = null;
}
+ catch (UnsupportedEncodingException e)
+ {
+ office = null;
+ }
}
log.initialize(entries[i], param.getBool(PropertyName.LOGGING_IS_ACTIVE));
entries[i].Logger = log;
diff --git a/qadevOOo/runner/base/java_fat.java b/qadevOOo/runner/base/java_fat.java
index 4ed28f2c3652..c85103508cbe 100644
--- a/qadevOOo/runner/base/java_fat.java
+++ b/qadevOOo/runner/base/java_fat.java
@@ -24,6 +24,7 @@ import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import lib.MultiMethodTest;
import lib.TestCase;
@@ -446,7 +447,7 @@ public class java_fat implements TestBase {
return ifc.run(entry, tEnv, param);
}
- private AppProvider startOffice(lib.TestParameters param) {
+ private AppProvider startOffice(lib.TestParameters param) throws UnsupportedEncodingException {
if (m_aDynamicClassLoader == null) {
m_aDynamicClassLoader = new DynamicClassLoader();
}
diff --git a/qadevOOo/runner/helper/AppProvider.java b/qadevOOo/runner/helper/AppProvider.java
index e8f77d1f059a..a42411ac6589 100644
--- a/qadevOOo/runner/helper/AppProvider.java
+++ b/qadevOOo/runner/helper/AppProvider.java
@@ -18,6 +18,8 @@
package helper;
+import java.io.UnsupportedEncodingException;
+
/**
*
* Interface to get a Manager to access the application to check
@@ -27,7 +29,7 @@ public interface AppProvider {
/**
* Method to get the desired Manager
*/
- Object getManager(lib.TestParameters param);
+ Object getManager(lib.TestParameters param) throws UnsupportedEncodingException;
/**
* Method to dispose the desired Manager
diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java
index 880565896443..01599cd3ff15 100644
--- a/qadevOOo/runner/helper/OfficeProvider.java
+++ b/qadevOOo/runner/helper/OfficeProvider.java
@@ -31,6 +31,7 @@ import com.sun.star.util.XStringSubstitution;
import java.io.File;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import lib.TestParameters;
@@ -146,7 +147,7 @@ public class OfficeProvider implements AppProvider
/**
* Method to get the ServiceManager of an Office
*/
- public Object getManager(lib.TestParameters param)
+ public Object getManager(lib.TestParameters param) throws UnsupportedEncodingException
{
String errorMessage = null;
boolean bAppExecutionHasWarning = false;
diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java
index 2b2e94efed38..7098db7d2590 100644
--- a/qadevOOo/runner/helper/ProcessHandler.java
+++ b/qadevOOo/runner/helper/ProcessHandler.java
@@ -19,6 +19,8 @@ package helper;
import java.io.InputStream;
import java.io.File;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.LineNumberReader;
@@ -128,7 +130,7 @@ public class ProcessHandler
* log stream where debug info and output
* of external command is printed out.
*/
- public ProcessHandler(String cmdLine, PrintWriter log)
+ public ProcessHandler(String cmdLine, PrintWriter log) throws UnsupportedEncodingException
{
this(cmdLine, log, null, null);
}
@@ -157,7 +159,7 @@ public class ProcessHandler
* Waits for the process to end regulary
*
*/
- private ProcessHandler(String cmdLine, PrintWriter log, File workDir, String[] envVars)
+ private ProcessHandler(String cmdLine, PrintWriter log, File workDir, String[] envVars) throws UnsupportedEncodingException
{
this.cmdLine = cmdLine;
this.workDir = workDir;
@@ -165,7 +167,7 @@ public class ProcessHandler
this.envVars = envVars;
if (log == null)
{
- this.log = new PrintWriter(System.out);
+ this.log = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
}
else
{
diff --git a/qadevOOo/runner/util/dbg.java b/qadevOOo/runner/util/dbg.java
index ba06f3c714ff..3a0035cde079 100644
--- a/qadevOOo/runner/util/dbg.java
+++ b/qadevOOo/runner/util/dbg.java
@@ -29,6 +29,8 @@ import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.lang.XServiceInfo;
import java.io.PrintWriter;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
/**
@@ -125,8 +127,8 @@ public class dbg {
* @param name The name of the property.
* @see com.sun.star.beans.XPropertySet
*/
- public static void printPropertyInfo(XPropertySet PS, String name) {
- printPropertyInfo(PS, name, new PrintWriter(System.out)) ;
+ public static void printPropertyInfo(XPropertySet PS, String name) throws UnsupportedEncodingException {
+ printPropertyInfo(PS, name, new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")));
}
/**
diff --git a/qadevOOo/tests/java/ifc/form/component/_DatabaseForm.java b/qadevOOo/tests/java/ifc/form/component/_DatabaseForm.java
index 17121cb990e8..887c881a2dc9 100644
--- a/qadevOOo/tests/java/ifc/form/component/_DatabaseForm.java
+++ b/qadevOOo/tests/java/ifc/form/component/_DatabaseForm.java
@@ -23,6 +23,7 @@ import util.dbg;
import com.sun.star.form.TabulatorCycle;
import com.sun.star.uno.Enum;
+import java.io.UnsupportedEncodingException;
/**
* Testing <code>com.sun.star.form.component.DatabaseForm</code>
@@ -45,7 +46,7 @@ public class _DatabaseForm extends MultiPropertyTest {
* In this property test only debugging information output
* is customized.
*/
- public void _NavigationBarMode() {
+ public void _NavigationBarMode() throws UnsupportedEncodingException {
dbg.printPropertyInfo(oObj, "NavigationBarMode");
testProperty("NavigationBarMode", new PropertyTester() {
@Override
@@ -64,7 +65,7 @@ public class _DatabaseForm extends MultiPropertyTest {
* This property new value is always fixed and debugging
* information output is customized.
*/
- public void _Cycle() {
+ public void _Cycle() throws UnsupportedEncodingException {
dbg.printPropertyInfo(oObj, "Cycle");
testProperty("Cycle", new PropertyTester() {
@Override
diff --git a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
index 40c032a37312..d31bfe1ea029 100644
--- a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
+++ b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
@@ -20,7 +20,9 @@ package mod._dbaccess;
import ifc.sdb._XCompletedExecution;
+import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import lib.StatusException;
import lib.TestCase;
@@ -535,8 +537,13 @@ public class ORowSet extends TestCase {
* @see ifc.sdb._XCompletedExecution
*/
private static class InteractionHandlerImpl implements _XCompletedExecution.CheckInteractionHandler {
+
private boolean handlerWasUsed = false;
- private PrintWriter log = new PrintWriter(System.out);
+ private PrintWriter log;
+
+ InteractionHandlerImpl() throws UnsupportedEncodingException {
+ log = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
+ }
public boolean checkInteractionHandler() {
return handlerWasUsed;
diff --git a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
index d424a1b4f5fb..ac2dd166df73 100644
--- a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
+++ b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
@@ -20,7 +20,9 @@ package mod._forms;
import ifc.form._XDatabaseParameterBroadcaster;
import ifc.sdb._XCompletedExecution;
+import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import lib.StatusException;
import lib.TestCase;
@@ -756,7 +758,12 @@ public class ODatabaseForm extends TestCase {
*/
private static class ParameterListenerImpl implements _XDatabaseParameterBroadcaster.CheckParameterListener {
private boolean listenerWasCalled = false;
- private PrintWriter log = new PrintWriter(System.out);
+
+ private PrintWriter log;
+
+ ParameterListenerImpl() throws UnsupportedEncodingException {
+ log = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
+ }
/**
* Return true, if the listener was called, false otherwise.
@@ -818,7 +825,11 @@ public class ODatabaseForm extends TestCase {
*/
private static class InteractionHandlerImpl implements _XCompletedExecution.CheckInteractionHandler {
private boolean handlerWasUsed = false;
- private PrintWriter log = new PrintWriter(System.out);
+ private PrintWriter log;
+
+ InteractionHandlerImpl() throws UnsupportedEncodingException {
+ log = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
+ }
public boolean checkInteractionHandler() {
return handlerWasUsed;
commit e1261e6ea6e897d38f69c0d250ec34ccf0f6d545
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Oct 5 07:50:24 2017 +0200
loplugin:finalclasses in vcl
Change-Id: I7de9cd6c5569217aa8d379c6d112cd1874bca8e2
Reviewed-on: https://gerrit.libreoffice.org/43151
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/finalclasses.cxx b/compilerplugins/clang/finalclasses.cxx
index 4b7a35804719..294e52592a51 100644
--- a/compilerplugins/clang/finalclasses.cxx
+++ b/compilerplugins/clang/finalclasses.cxx
@@ -57,7 +57,11 @@ public:
bool shouldVisitTemplateInstantiations () const { return true; }
+ bool shouldVisitImplicitCode() const { return true; }
+
bool VisitCXXRecordDecl( const CXXRecordDecl* decl);
+private:
+ void checkBase(QualType qt);
};
bool startsWith(const std::string& rStr, const char* pSubStr) {
@@ -81,23 +85,18 @@ bool FinalClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
if (ignoreLocation(decl))
return true;
decl = decl->getCanonicalDecl();
- if (!decl->isThisDeclarationADefinition())
+ if (!decl->hasDefinition())
return true;
for (auto it = decl->bases_begin(); it != decl->bases_end(); ++it)
{
const CXXBaseSpecifier spec = *it;
- // need to look through typedefs, hence the getUnqualifiedDesugaredType
- QualType baseType = spec.getType().getDesugaredType(compiler.getASTContext());
- std::string x;
- // so that we get just the template name, excluding the template parameters
- if (baseType->isRecordType())
- x = baseType->getAsCXXRecordDecl()->getQualifiedNameAsString();
- else if (auto templateType = baseType->getAs<TemplateSpecializationType>())
- x = templateType->getTemplateName().getAsTemplateDecl()->getQualifiedNameAsString();
- else
- x = baseType.getAsString();
- inheritedFromSet.insert( x );
+ checkBase(spec.getType());
+ }
+ for (auto it = decl->vbases_begin(); it != decl->vbases_end(); ++it)
+ {
+ const CXXBaseSpecifier spec = *it;
+ checkBase(spec.getType());
}
bool bFoundProtected = false;
@@ -135,6 +134,21 @@ bool FinalClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
return true;
}
+void FinalClasses::checkBase(QualType baseType)
+{
+ // need to look through typedefs, hence the getUnqualifiedDesugaredType
+ baseType = baseType.getDesugaredType(compiler.getASTContext());
+ std::string x;
+ // so that we get just the template name, excluding the template parameters
+ if (baseType->isRecordType())
+ x = baseType->getAsCXXRecordDecl()->getQualifiedNameAsString();
+ else if (auto templateType = baseType->getAs<TemplateSpecializationType>())
+ x = templateType->getTemplateName().getAsTemplateDecl()->getQualifiedNameAsString();
+ else
+ x = baseType.getAsString();
+ inheritedFromSet.insert( x );
+}
+
loplugin::Plugin::Registration< FinalClasses > X("finalclasses", false);
}
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 133a16486834..fd6c3db22dc3 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -304,11 +304,10 @@ public:
ErrCode compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream);
-protected:
+private:
OUString aFilterPath;
FilterConfigCache* pConfig;
-private:
void ImplInit();
ErrCode ImplSetError( ErrCode nError, const SvStream* pStm = nullptr );
ErrCode ImpTestOrFindFormat( const OUString& rPath, SvStream& rStream, sal_uInt16& rFormat );
diff --git a/include/vcl/i18nhelp.hxx b/include/vcl/i18nhelp.hxx
index 7e22bd9571b3..b3a14255ca06 100644
--- a/include/vcl/i18nhelp.hxx
+++ b/include/vcl/i18nhelp.hxx
@@ -47,7 +47,6 @@ namespace vcl
class VCL_DLLPUBLIC I18nHelper
{
-private:
::osl::Mutex maMutex;
LanguageTag maLanguageTag;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
@@ -59,8 +58,6 @@ private:
SAL_DLLPRIVATE void ImplDestroyWrappers();
-protected:
-
SAL_DLLPRIVATE utl::TransliterationWrapper& ImplGetTransliterationWrapper() const;
SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const;
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 2c0f00fe7a4b..f52b95e3a9ec 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -488,13 +488,12 @@ public:
//set to true to disable the built-in scrolling callbacks to allow the user
//to override it
void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;}
-protected:
+private:
virtual Size calculateRequisition() const override;
virtual void setAllocation(const Size &rAllocation) override;
DECL_LINK(ScrollBarHdl, ScrollBar*, void);
void InitScrollBars(const Size &rRequest);
virtual bool EventNotify(NotifyEvent& rNEvt) override;
-private:
bool m_bUserManagedScrolling;
VclPtr<ScrollBar> m_pVScroll;
VclPtr<ScrollBar> m_pHScroll;
diff --git a/include/vcl/mnemonic.hxx b/include/vcl/mnemonic.hxx
index f531ab66d348..f6d1dc73b6b7 100644
--- a/include/vcl/mnemonic.hxx
+++ b/include/vcl/mnemonic.hxx
@@ -51,12 +51,10 @@
class VCL_DLLPUBLIC MnemonicGenerator
{
-private:
// 0 == Mnemonic; >0 == count of characters
sal_uInt8 maMnemonics[MAX_MNEMONICS];
css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass;
-protected:
SAL_DLLPRIVATE static sal_uInt16 ImplGetMnemonicIndex( sal_Unicode c );
SAL_DLLPRIVATE static sal_Unicode ImplFindMnemonic( const OUString& rKey );
diff --git a/include/vcl/morebtn.hxx b/include/vcl/morebtn.hxx
index a18e341fccd1..1ee17a348380 100644
--- a/include/vcl/morebtn.hxx
+++ b/include/vcl/morebtn.hxx
@@ -30,7 +30,6 @@ struct ImplMoreButtonData;
class VCL_DLLPUBLIC MoreButton : public PushButton
{
-private:
ImplMoreButtonData* mpMBData;
bool mbState;
@@ -38,7 +37,6 @@ private:
MoreButton& operator=( const MoreButton & ) = delete;
SAL_DLLPRIVATE void ShowState();
-protected:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 3abf26abf172..1596e0094c7b 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -93,7 +93,6 @@ class VCL_DLLPUBLIC TextEngine : public SfxBroadcaster
friend class TextUndoInsertChars;
friend class TextUndoRemoveChars;
-private:
TextDoc* mpDoc;
TEParaPortions* mpTEParaPortions;
VclPtr<OutputDevice> mpRefDev;
@@ -137,8 +136,6 @@ private:
bool mbRightToLeft : 1;
bool mbHasMultiLineParas : 1;
-protected:
-
void CursorMoved( sal_uInt32 nNode );
void TextModified();
diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx
index 9688d9544782..c0cb1de16b96 100644
--- a/include/vcl/textview.hxx
+++ b/include/vcl/textview.hxx
@@ -84,13 +84,11 @@ class VCL_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient
friend class TextUndoManager;
friend class TextSelFunctionSet;
-private:
std::unique_ptr<ImpTextView> mpImpl;
TextView( const TextView& ) = delete;
TextView& operator=( const TextView& ) = delete;
-protected:
bool ImpIndentBlock( bool bRight );
void ShowSelection();
void HideSelection();
diff --git a/vcl/inc/headless/svpcairotextrender.hxx b/vcl/inc/headless/svpcairotextrender.hxx
index dbd69b399732..bb258512a7c2 100644
--- a/vcl/inc/headless/svpcairotextrender.hxx
+++ b/vcl/inc/headless/svpcairotextrender.hxx
@@ -16,7 +16,6 @@ class SvpSalGraphics;
class SvpCairoTextRender : public CairoTextRender
{
-protected:
SvpSalGraphics& mrParent;
public:
diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx
index 88ec1b7c1896..da2be164866f 100644
--- a/vcl/inc/opengl/program.hxx
+++ b/vcl/inc/opengl/program.hxx
@@ -112,7 +112,7 @@ public:
GLenum eType, GLboolean bNormalized, GLsizei aStride,
const GLvoid* pPointer);
-protected:
+private:
GLuint GetUniformLocation( const OString& rName );
};
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 4fd0e4c25317..b64de3ffed69 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -89,7 +89,6 @@ public:
ImplLayoutRuns maRuns;
ImplLayoutRuns maFallbackRuns;
-public:
ImplLayoutArgs( const OUString& rStr,
int nMinCharPos, int nEndCharPos, SalLayoutFlags nFlags,
const LanguageTag& rLanguageTag,
@@ -111,7 +110,7 @@ public:
{ return !maFallbackRuns.IsEmpty(); }
bool PrepareFallback();
-protected:
+private:
void AddRun( int nMinCharPos, int nEndCharPos, bool bRTL );
};
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index c3e7c35cc350..49682011954b 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -41,7 +41,6 @@ class ImplFontMetricData;
class VCL_DLLPUBLIC GenPspGraphics : public SalGraphics
{
- protected:
psp::JobData* m_pJobData;
psp::PrinterGfx* m_pPrinterGfx;
diff --git a/vcl/inc/unx/pixmap.hxx b/vcl/inc/unx/pixmap.hxx
index 658935a70e4d..81144a2cda10 100644
--- a/vcl/inc/unx/pixmap.hxx
+++ b/vcl/inc/unx/pixmap.hxx
@@ -35,7 +35,7 @@ public:
int GetWidth() const { return mnWidth; };
int GetHeight() const { return mnHeight; };
-protected:
+private:
int mnWidth;
int mnHeight;
};
diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx
index 5a6fd869b040..61839aae9936 100644
--- a/vcl/source/edit/textdoc.hxx
+++ b/vcl/source/edit/textdoc.hxx
@@ -65,11 +65,9 @@ public:
class TextNode
{
-private:
OUString maText;
TextCharAttribList maCharAttribs;
-protected:
void ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNewChars );
void CollapseAttribs( sal_Int32 nIndex, sal_Int32 nDelChars );
@@ -95,11 +93,9 @@ public:
class TextDoc
{
-private:
std::vector<TextNode*> maTextNodes;
sal_uInt16 mnLeftMargin;
-protected:
void DestroyTextNodes();
public:
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index f040a6489676..44f0bc6c2f27 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -88,8 +88,6 @@ static ::osl::Mutex& getListMutex()
class ImpFilterOutputStream : public ::cppu::WeakImplHelper< css::io::XOutputStream >
{
-protected:
-
SvStream& mrStm;
virtual void SAL_CALL writeBytes( const css::uno::Sequence< sal_Int8 >& rData ) override
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index bd7312457b77..f78d601fcc0a 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -266,7 +266,7 @@ public:
static const int NMAXSTACK = 48; // see CFF.appendixB
static const int NMAXHINTS = 2*96; // see CFF.appendixB
static const int NMAXTRANS = 32; // see CFF.appendixB
-public:
+
explicit CffSubsetterContext( const U8* pBasePtr, int nBaseLen);
bool initialCffRead();
@@ -274,9 +274,8 @@ public:
const sal_GlyphId* pGlyphIds, const U8* pEncoding,
GlyphWidth* pGlyphWidths, int nGlyphCount, FontSubsetInfo& );
-protected:
- int convert2Type1Ops( CffLocal*, const U8* pType2Ops, int nType2Len, U8* pType1Ops);
private:
+ int convert2Type1Ops( CffLocal*, const U8* pType2Ops, int nType2Len, U8* pType1Ops);
void convertOneTypeOp();
void convertOneTypeEsc();
void callType2Subr( bool bGlobal, int nSubrNumber);
@@ -293,11 +292,9 @@ private:
bool mbIgnoreHints;
sal_Int32 mnCntrMask;
-private:
int seekIndexData( int nIndexBase, int nDataIndex);
void seekIndexEnd( int nIndexBase);
-private:
CffLocal maCffLocal[256];
CffLocal* mpCffLocal;
diff --git a/vcl/source/fontsubset/xlat.cxx b/vcl/source/fontsubset/xlat.cxx
index 3363b5bd21c5..630720a520b4 100644
--- a/vcl/source/fontsubset/xlat.cxx
+++ b/vcl/source/fontsubset/xlat.cxx
@@ -30,9 +30,8 @@ public:
explicit ConverterCache();
~ConverterCache();
sal_uInt16 convertOne( int nSelect, sal_Unicode );
-protected:
- void ensureConverter( int nSelect );
private:
+ void ensureConverter( int nSelect );
rtl_UnicodeToTextConverter maConverterCache[ MAX_CVT_SELECT+1 ];
rtl_UnicodeToTextContext maContexts[ MAX_CVT_SELECT+1 ];
};
diff --git a/vcl/unx/generic/dtrans/X11_clipboard.hxx b/vcl/unx/generic/dtrans/X11_clipboard.hxx
index 8c7773fd02e2..45c8c35b0353 100644
--- a/vcl/unx/generic/dtrans/X11_clipboard.hxx
+++ b/vcl/unx/generic/dtrans/X11_clipboard.hxx
@@ -47,8 +47,6 @@ namespace x11 {
X11Clipboard( SelectionManager& rManager, Atom aSelection );
- protected:
-
friend class SelectionManager;
void fireChangedContentsEvent();
diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
index 216ab9e4b890..08524157f906 100644
--- a/vcl/workben/icontest.cxx
+++ b/vcl/workben/icontest.cxx
@@ -60,9 +60,6 @@ namespace {
class MyWorkWindow : public WorkWindow
{
-private:
-
-protected:
double mnStartTime;
int mnPaintCount;
diff --git a/vcl/workben/mtfdemo.cxx b/vcl/workben/mtfdemo.cxx
index 6effbadcc473..a9f52da4397a 100644
--- a/vcl/workben/mtfdemo.cxx
+++ b/vcl/workben/mtfdemo.cxx
@@ -104,7 +104,7 @@ public:
return 0;
}
-protected:
+private:
uno::Reference<lang::XMultiServiceFactory> xMSF;
void Init() override
{
commit e5d943d984bb0918f971eec45f45384cc0c72b67
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 5 09:44:37 2017 +0200
'static' is invalid in friend declarations
Change-Id: I993e4dd219e247ca33022010da350f565c5e0dcf
diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h
index 06e77b171cb3..5ad6a1718f19 100644
--- a/vcl/inc/win/saltimer.h
+++ b/vcl/inc/win/saltimer.h
@@ -27,7 +27,7 @@ class WinSalTimer final : public SalTimer, protected VersionedEvent
// for access to Impl* functions
friend LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef );
// for access to m_bPollForMessage
- friend static void CALLBACK SalTimerProc( PVOID data, BOOLEAN );
+ friend void CALLBACK SalTimerProc( PVOID data, BOOLEAN );
HANDLE m_nTimerId; ///< Windows timer id
bool m_bPollForMessage; ///< Run yield until a message is caught (most likely the 0ms timer)
commit 26537a9c1ae27faa24a760bdc91a2162a92b58d7
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 5 09:42:58 2017 +0200
Missing #include <tools/time.hxx> (--disable-pch)
Change-Id: I8cf1092bb2a5718b90fda8925eeb5dd281842b70
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index c75b7534e718..e8d3e10d0b86 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -19,6 +19,8 @@
#include <sal/config.h>
+#include <tools/time.hxx>
+
#include <svsys.h>
#include <win/saldata.hxx>
#include <win/saltimer.h>
commit 4355ef6a6265c8e8dbba44b832f4847c6c8cd9bf
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 5 09:42:11 2017 +0200
loplugin:blockblock (clang-cl)
Change-Id: I210c322ab44057e45e2b75b3ce3d13529fb62d13
diff --git a/embedserv/source/inprocserv/inprocembobj.cxx b/embedserv/source/inprocserv/inprocembobj.cxx
index 51173c9c9c65..4cc083652f68 100644
--- a/embedserv/source/inprocserv/inprocembobj.cxx
+++ b/embedserv/source/inprocserv/inprocembobj.cxx
@@ -150,34 +150,32 @@ BOOL InprocEmbedDocument_Impl::CheckDefHandler()
HRESULT hr = OleCreateDefaultHandler( m_guid, nullptr, IID_IUnknown, reinterpret_cast<void**>(&m_pDefHandler) );
if ( SUCCEEDED( hr ) )
{
+ if ( m_nInitMode == INIT_FROM_STORAGE )
{
- if ( m_nInitMode == INIT_FROM_STORAGE )
- {
- ComSmart< IPersistStorage > pPersist;
- hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, reinterpret_cast<void**>(&pPersist) );
-
- ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem
- if ( SUCCEEDED( hr ) && pPersist && m_pStorage )
- hr = pPersist->InitNew( m_pStorage );
- }
- else if ( m_nInitMode == LOAD_FROM_STORAGE )
- {
- ComSmart< IPersistStorage > pPersist;
- hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, reinterpret_cast<void**>(&pPersist) );
-
- ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem
- if ( SUCCEEDED( hr ) && pPersist && m_pStorage )
- hr = pPersist->Load( m_pStorage );
- }
- else if ( m_nInitMode == LOAD_FROM_FILE )
- {
- ComSmart< IPersistFile > pPersistFile;
- hr = m_pDefHandler->QueryInterface( IID_IPersistFile, reinterpret_cast<void**>(&pPersistFile) );
-
- ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem
- if ( SUCCEEDED( hr ) && pPersistFile && m_pFileName )
- hr = pPersistFile->Load( m_pFileName, m_nFileOpenMode );
- }
+ ComSmart< IPersistStorage > pPersist;
+ hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, reinterpret_cast<void**>(&pPersist) );
+
+ ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem
+ if ( SUCCEEDED( hr ) && pPersist && m_pStorage )
+ hr = pPersist->InitNew( m_pStorage );
+ }
+ else if ( m_nInitMode == LOAD_FROM_STORAGE )
+ {
+ ComSmart< IPersistStorage > pPersist;
+ hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, reinterpret_cast<void**>(&pPersist) );
+
+ ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem
+ if ( SUCCEEDED( hr ) && pPersist && m_pStorage )
+ hr = pPersist->Load( m_pStorage );
+ }
+ else if ( m_nInitMode == LOAD_FROM_FILE )
+ {
+ ComSmart< IPersistFile > pPersistFile;
+ hr = m_pDefHandler->QueryInterface( IID_IPersistFile, reinterpret_cast<void**>(&pPersistFile) );
+
+ ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem
+ if ( SUCCEEDED( hr ) && pPersistFile && m_pFileName )
+ hr = pPersistFile->Load( m_pFileName, m_nFileOpenMode );
}
}
commit be8bbd297e8eada7658783fef727b690fda5f224
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 5 09:41:18 2017 +0200
loplugin:flatten (clang-cl, embeddedobj)
Change-Id: Ic870347b3dc0ce6b7ad223c47a36b54843a26613
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index 8fbe0aa6b121..48cba783fcfd 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -1563,19 +1563,17 @@ uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor&
uno::Reference< io::XOutputStream > xTempOutStream = xTempFileStream->getOutputStream();
uno::Reference< io::XInputStream > xTempInStream = xTempFileStream->getInputStream();
- if ( xTempOutStream.is() && xTempInStream.is() )
- {
- OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
- if ( !m_pUnoOleObject )
- throw uno::RuntimeException();
+ if ( !(xTempOutStream.is() && xTempInStream.is()) )
+ throw io::IOException(); // TODO:
- m_pUnoOleObject->StoreObjectToStream( xTempOutStream );
+ OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
+ if ( !m_pUnoOleObject )
+ throw uno::RuntimeException();
- xTempOutStream->closeOutput();
- xTempOutStream.clear();
- }
- else
- throw io::IOException(); // TODO:
+ m_pUnoOleObject->StoreObjectToStream( xTempOutStream );
+
+ xTempOutStream->closeOutput();
+ xTempOutStream.clear();
aResult <<= xTempInStream;
}
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
index b2d564be8dd6..f701268464d6 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -176,92 +176,90 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia
uTemp=pInsertFct(&io);
- if ( OLEUI_OK == uTemp )
+ if ( OLEUI_OK != uTemp )
+ throw ucb::CommandAbortedException();
+
+ if (io.dwFlags & IOF_SELECTCREATENEW)
{
- if (io.dwFlags & IOF_SELECTCREATENEW)
- {
- uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator = embed::EmbeddedObjectCreator::create( comphelper::getComponentContext(m_xFactory) );
-
- uno::Sequence< sal_Int8 > aClassID = MimeConfigurationHelper::GetSequenceClassID( io.clsid.Data1,
- io.clsid.Data2,
- io.clsid.Data3,
- io.clsid.Data4[0],
- io.clsid.Data4[1],
- io.clsid.Data4[2],
- io.clsid.Data4[3],
- io.clsid.Data4[4],
- io.clsid.Data4[5],
- io.clsid.Data4[6],
- io.clsid.Data4[7] );
-
- aClassID = GetRelatedInternalID_Impl( aClassID );
-
- //TODO: retrieve ClassName
- aObjectInfo.Object.set( xEmbCreator->createInstanceInitNew( aClassID, OUString(), xStorage, sEntName, aObjArgs ),
- uno::UNO_QUERY );
- }
- else
- {
- OUString aFileName = OStringToOUString( OString( szFile ), osl_getThreadTextEncoding() );
- OUString aFileURL;
- if ( osl::FileBase::getFileURLFromSystemPath( aFileName, aFileURL ) != osl::FileBase::E_None )
- throw uno::RuntimeException();
+ uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator = embed::EmbeddedObjectCreator::create( comphelper::getComponentContext(m_xFactory) );
+
+ uno::Sequence< sal_Int8 > aClassID = MimeConfigurationHelper::GetSequenceClassID( io.clsid.Data1,
+ io.clsid.Data2,
+ io.clsid.Data3,
+ io.clsid.Data4[0],
+ io.clsid.Data4[1],
+ io.clsid.Data4[2],
+ io.clsid.Data4[3],
+ io.clsid.Data4[4],
+ io.clsid.Data4[5],
+ io.clsid.Data4[6],
+ io.clsid.Data4[7] );
+
+ aClassID = GetRelatedInternalID_Impl( aClassID );
+
+ //TODO: retrieve ClassName
+ aObjectInfo.Object.set( xEmbCreator->createInstanceInitNew( aClassID, OUString(), xStorage, sEntName, aObjArgs ),
+ uno::UNO_QUERY );
+ }
+ else
+ {
+ OUString aFileName = OStringToOUString( OString( szFile ), osl_getThreadTextEncoding() );
+ OUString aFileURL;
+ if ( osl::FileBase::getFileURLFromSystemPath( aFileName, aFileURL ) != osl::FileBase::E_None )
+ throw uno::RuntimeException();
- uno::Sequence< beans::PropertyValue > aMediaDescr( 1 );
- aMediaDescr[0].Name = "URL";
- aMediaDescr[0].Value <<= aFileURL;
+ uno::Sequence< beans::PropertyValue > aMediaDescr( 1 );
+ aMediaDescr[0].Name = "URL";
+ aMediaDescr[0].Value <<= aFileURL;
- // TODO: use config helper for type detection
- uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator;
- ::comphelper::MimeConfigurationHelper aHelper( comphelper::getComponentContext(m_xFactory) );
+ // TODO: use config helper for type detection
+ uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator;
+ ::comphelper::MimeConfigurationHelper aHelper( comphelper::getComponentContext(m_xFactory) );
- if ( aHelper.AddFilterNameCheckOwnFile( aMediaDescr ) )
- xEmbCreator = embed::EmbeddedObjectCreator::create( comphelper::getComponentContext(m_xFactory) );
- else
- xEmbCreator = embed::OLEEmbeddedObjectFactory::create( comphelper::getComponentContext(m_xFactory) );
+ if ( aHelper.AddFilterNameCheckOwnFile( aMediaDescr ) )
+ xEmbCreator = embed::EmbeddedObjectCreator::create( comphelper::getComponentContext(m_xFactory) );
+ else
+ xEmbCreator = embed::OLEEmbeddedObjectFactory::create( comphelper::getComponentContext(m_xFactory) );
- if ( !xEmbCreator.is() )
- throw uno::RuntimeException();
+ if ( !xEmbCreator.is() )
+ throw uno::RuntimeException();
- aObjectInfo.Object.set( xEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aMediaDescr, aObjArgs ),
- uno::UNO_QUERY );
- }
+ aObjectInfo.Object.set( xEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aMediaDescr, aObjArgs ),
+ uno::UNO_QUERY );
+ }
- if ( ( io.dwFlags & IOF_CHECKDISPLAYASICON) && io.hMetaPict != nullptr )
+ if ( ( io.dwFlags & IOF_CHECKDISPLAYASICON) && io.hMetaPict != nullptr )
+ {
+ METAFILEPICT* pMF = static_cast<METAFILEPICT*>(GlobalLock( io.hMetaPict ));
+ if ( pMF )
{
- METAFILEPICT* pMF = static_cast<METAFILEPICT*>(GlobalLock( io.hMetaPict ));
- if ( pMF )
+ sal_uInt32 nBufSize = GetMetaFileBitsEx( pMF->hMF, 0, nullptr );
+ uno::Sequence< sal_Int8 > aMetafile( nBufSize + 22 );
+ sal_Int8* pBuf = aMetafile.getArray();
+ *reinterpret_cast<long*>( pBuf ) = 0x9ac6cdd7L;
+ *reinterpret_cast<short*>( pBuf+6 ) = ( SHORT ) 0;
+ *reinterpret_cast<short*>( pBuf+8 ) = ( SHORT ) 0;
+ *reinterpret_cast<short*>( pBuf+10 ) = ( SHORT ) pMF->xExt;
+ *reinterpret_cast<short*>( pBuf+12 ) = ( SHORT ) pMF->yExt;
+ *reinterpret_cast<short*>( pBuf+14 ) = ( USHORT ) 2540;
+
+ if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize, pBuf+22 ) )
{
- sal_uInt32 nBufSize = GetMetaFileBitsEx( pMF->hMF, 0, nullptr );
- uno::Sequence< sal_Int8 > aMetafile( nBufSize + 22 );
- sal_Int8* pBuf = aMetafile.getArray();
- *reinterpret_cast<long*>( pBuf ) = 0x9ac6cdd7L;
- *reinterpret_cast<short*>( pBuf+6 ) = ( SHORT ) 0;
- *reinterpret_cast<short*>( pBuf+8 ) = ( SHORT ) 0;
- *reinterpret_cast<short*>( pBuf+10 ) = ( SHORT ) pMF->xExt;
- *reinterpret_cast<short*>( pBuf+12 ) = ( SHORT ) pMF->yExt;
- *reinterpret_cast<short*>( pBuf+14 ) = ( USHORT ) 2540;
-
- if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize, pBuf+22 ) )
- {
- datatransfer::DataFlavor aFlavor(
- "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"",
- "Image WMF",
- cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );
-
- aObjectInfo.Options.realloc( 2 );
- aObjectInfo.Options[0].Name = "Icon";
- aObjectInfo.Options[0].Value <<= aMetafile;
- aObjectInfo.Options[1].Name = "IconFormat";
- aObjectInfo.Options[1].Value <<= aFlavor;
- }
-
- GlobalUnlock( io.hMetaPict );
+ datatransfer::DataFlavor aFlavor(
+ "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"",
+ "Image WMF",
+ cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );
+
+ aObjectInfo.Options.realloc( 2 );
+ aObjectInfo.Options[0].Name = "Icon";
+ aObjectInfo.Options[0].Value <<= aMetafile;
+ aObjectInfo.Options[1].Name = "IconFormat";
+ aObjectInfo.Options[1].Value <<= aFlavor;
}
+
+ GlobalUnlock( io.hMetaPict );
}
}
- else
- throw ucb::CommandAbortedException();
OSL_ENSURE( aObjectInfo.Object.is(), "No object was created!" );
if ( !aObjectInfo.Object.is() )
commit 3d1b53a0998659e6a75def21d2b539c692168149
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Sat Sep 30 22:39:33 2017 +0200
Also suppress loplugin:flatten in C++ class member functions...
...invovling preprocessing conditionals, to actually make the unhelpful warning
on Windows about OleEmbeddedObject::changeState go away. And while at it, make
the check for preprocessing conditionals more targeted (similar to
1084e8be44661aaeacb8801707701013eb3fcdbc "More targeted check for preprocessing
conditionals in loplugin:blockblock").
Change-Id: I0300e0a547e969520a90cd126ea8f788cc17560f
Reviewed-on: https://gerrit.libreoffice.org/42975
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/compilerplugins/clang/flatten.cxx b/compilerplugins/clang/flatten.cxx
index 1dd265990cb7..7fa408ea1731 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -30,13 +30,6 @@ public:
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
- bool TraverseFunctionDecl(FunctionDecl * decl) {
- if (containsPreprocessingConditionalInclusion(decl->getSourceRange())) {
- return true;
- }
- return RecursiveASTVisitor::TraverseFunctionDecl(decl);
- }
-
bool TraverseCXXCatchStmt(CXXCatchStmt * );
bool VisitIfStmt(IfStmt const * );
private:
@@ -115,6 +108,10 @@ bool Flatten::VisitIfStmt(IfStmt const * ifStmt)
if (parentIfStmt && parentIfStmt->getElse() == ifStmt)
return true;
+ if (containsPreprocessingConditionalInclusion(ifStmt->getSourceRange())) {
+ return true;
+ }
+
auto throwExpr = containsSingleThrowExpr(ifStmt->getElse());
if (throwExpr)
{
diff --git a/compilerplugins/clang/test/flatten.cxx b/compilerplugins/clang/test/flatten.cxx
index 91321276c45e..a901d273b9a1 100644
--- a/compilerplugins/clang/test/flatten.cxx
+++ b/compilerplugins/clang/test/flatten.cxx
@@ -56,13 +56,16 @@ void top4() {
}
void top5() {
- // no warning expected
#if 1
if (foo() == 2) {
- bar();
+ if (foo() == 3) { // expected-note {{if condition here [loplugin:flatten]}}
+ bar();
+ } else {
+ throw std::exception(); // expected-error {{unconditional throw in else branch, rather invert the condition, throw early, and flatten the normal case [loplugin:flatten]}}
+ }
} else
#endif
- throw std::exception();
+ throw std::exception(); // no warning expected
}
int main() {
commit 5be8c9cc1b92101e6f9fe5685df86e77d3eee3cc
Author: Eike Rathke <erack at redhat.com>
Date: Wed Oct 4 23:50:31 2017 +0200
Resolves: tdf#102075 support system [$-F400] time and [$-F800] long date
By substituting a (valid matching the type) format using these
special LCID modifier values with the current system locale's
format.
See ECMA-376-1:2016 18.8.31 numFmts (Number Formats) and
https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.numberingformats.aspx
which seems to be the only documentation available.
Change-Id: Ieca048a77d4ef473ae475e202557d1353ff5387d
Reviewed-on: https://gerrit.libreoffice.org/43148
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index 35a1bc5c50c1..19015cc1000c 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -552,6 +552,9 @@ public:
/// Return the format for a format index
const SvNumberformat* GetEntry( sal_uInt32 nKey ) const;
+ /// Obtain substituted GetFormatEntry(), i.e. system formats.
+ const SvNumberformat* GetSubstitutedEntry( sal_uInt32 nKey, sal_uInt32 & o_rNewKey ) const;
+
/// Return the format index of the standard default number format for language/country
sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
@@ -904,6 +907,9 @@ private:
// return position of a special character
sal_Int32 ImpPosToken ( const OUStringBuffer & sFormat, sal_Unicode token, sal_Int32 nStartPos = 0 );
+ // Substitute a format during GetFormatEntry(), i.e. system formats.
+ SvNumberformat* ImpSubstituteEntry( SvNumberformat* pFormat, sal_uInt32 * o_pRealKey = nullptr );
+
public:
// own static mutex, may also be used by internal class SvNumberFormatterRegistry_Impl
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index 6fcb24dd7a24..5d0e1f288643 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -141,9 +141,17 @@ class SVL_DLLPUBLIC SvNumberformat
{
struct LocaleType
{
+ enum class Substitute : sal_uInt8
+ {
+ NONE,
+ TIME,
+ LONGDATE
+ };
+
+ LanguageType meLanguage;
+ Substitute meSubstitute;
sal_uInt8 mnNumeralShape;
sal_uInt8 mnCalendarType;
- LanguageType meLanguage;
OUString generateCode() const;
@@ -184,6 +192,28 @@ public:
LanguageType GetLanguage() const { return maLocale.meLanguage;}
+ /** If the format is a placeholder and needs to be substituted. */
+ bool IsSubstituted() const
+ {
+ return maLocale.meSubstitute != LocaleType::Substitute::NONE;
+ }
+
+ /** If the format is a placeholder for the sytem time format and needs to
+ be substituted during formatting time.
+ */
+ bool IsSystemTimeFormat() const
+ {
+ return maLocale.meSubstitute == LocaleType::Substitute::TIME && maLocale.meLanguage == LANGUAGE_SYSTEM;
+ }
+
+ /** If the format is a placeholder for the sytem long date format and needs
+ to be substituted during formatting time.
+ */
+ bool IsSystemLongDateFormat() const
+ {
+ return maLocale.meSubstitute == LocaleType::Substitute::LONGDATE && maLocale.meLanguage == LANGUAGE_SYSTEM;
+ }
+
const OUString& GetFormatstring() const { return sFormatstring; }
// Build a format string of application defined keywords
diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx
index c3c51ea57797..79df5c853f5d 100644
--- a/include/xmloff/xmlnumfe.hxx
+++ b/include/xmloff/xmlnumfe.hxx
@@ -92,10 +92,10 @@ private:
SAL_DLLPRIVATE void WriteRepeatedElement_Impl( sal_Unicode ch );
SAL_DLLPRIVATE bool WriteTextWithCurrency_Impl( const OUString& rString,
const css::lang::Locale& rLocale );
- SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey,
+ SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey,
sal_uInt16 nPart, bool bDefPart );
- SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey );
+ SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey );
public:
SvXMLNumFmtExport( SvXMLExport& rExport,
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index c573a02ba377..1a5147daaa54 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1065,7 +1065,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
double& fOutNumber)
{
short FType;
- const SvNumberformat* pFormat = GetFormatEntry(F_Index);
+ const SvNumberformat* pFormat = ImpSubstituteEntry( GetFormatEntry(F_Index));
if (!pFormat)
{
ChangeIntl(IniLnge);
@@ -1472,7 +1472,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
OUString& sOutString)
{
Color* pColor;
- SvNumberformat* pFormat = GetFormatEntry( nFIndex );
+ sal_uInt32 nRealKey = nFIndex;
+ SvNumberformat* pFormat = ImpSubstituteEntry( GetFormatEntry( nFIndex ), &nRealKey);
if (!pFormat)
{
pFormat = GetFormatEntry(ZF_STANDARD);
@@ -1507,8 +1508,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
bPrecChanged = true;
}
- sal_uInt32 nKey = GetEditFormat( fOutNumber, nFIndex, eType, eLang, pFormat);
- if ( nKey != nFIndex )
+ sal_uInt32 nKey = GetEditFormat( fOutNumber, nRealKey, eType, eLang, pFormat);
+ if ( nKey != nRealKey )
{
pFormat = GetFormatEntry( nKey );
}
@@ -1534,6 +1535,8 @@ void SvNumberFormatter::GetOutputString(const OUString& sString,
bool bUseStarFormat )
{
SvNumberformat* pFormat = GetFormatEntry( nFIndex );
+ // ImpSubstituteEntry() is unnecessary here because so far only numeric
+ // (time and date) are substituted.
if (!pFormat)
{
pFormat = GetFormatEntry(ZF_STANDARD_TEXT);
@@ -1569,7 +1572,7 @@ void SvNumberFormatter::GetOutputString(const double& fOutNumber,
sOutString.clear();
return;
}
- SvNumberformat* pFormat = GetFormatEntry( nFIndex );
+ SvNumberformat* pFormat = ImpSubstituteEntry( GetFormatEntry( nFIndex ));
if (!pFormat)
pFormat = GetFormatEntry(ZF_STANDARD);
ChangeIntl(pFormat->GetLanguage());
@@ -2216,6 +2219,40 @@ const SvNumberformat* SvNumberFormatter::GetEntry( sal_uInt32 nKey ) const
return nullptr;
}
+const SvNumberformat* SvNumberFormatter::GetSubstitutedEntry( sal_uInt32 nKey, sal_uInt32 & o_rNewKey ) const
+{
+ // A tad ugly, but GetStandardFormat() and GetFormatIndex() in
+ // ImpSubstituteEntry() may have to add the LANGUAGE_SYSTEM formats if not
+ // already present (which in practice most times they are).
+ SvNumberFormatter* pThis = const_cast<SvNumberFormatter*>(this);
+ return pThis->ImpSubstituteEntry( pThis->GetFormatEntry( nKey), &o_rNewKey);
+}
+
+SvNumberformat* SvNumberFormatter::ImpSubstituteEntry( SvNumberformat* pFormat, sal_uInt32 * o_pRealKey )
+{
+ if (!pFormat || !pFormat->IsSubstituted())
+ return pFormat;
+
+ // XXX NOTE: substitution can not be done in GetFormatEntry() as otherwise
+ // to be substituted formats would "vanish", i.e. from the number formatter
+ // dialog or when exporting to Excel.
+
+ sal_uInt32 nKey;
+ if (pFormat->IsSystemTimeFormat())
+ /* TODO: should we have NF_TIME_SYSTEM for consistency? */
+ nKey = GetStandardFormat( css::util::NumberFormat::TIME, LANGUAGE_SYSTEM);
+ else if (pFormat->IsSystemLongDateFormat())
+ /* TODO: either that above, or have a long option for GetStandardFormat() */
+ nKey = GetFormatIndex( NF_DATE_SYSTEM_LONG, LANGUAGE_SYSTEM);
+ else
+ return pFormat;
+
+ if (o_pRealKey)
+ *o_pRealKey = nKey;
+ SvNumberFormatTable::const_iterator it = aFTable.find( nKey);
+ return it == aFTable.end() ? nullptr : it->second;
+}
+
void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditionalFormats )
{
bool bOldConvertMode = pFormatScanner->GetConvertMode();
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index d40c7d977f17..116b5e668df5 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1208,6 +1208,24 @@ SvNumberformat::SvNumberformat(OUString& rString,
}
}
+ if (!nCheckPos && IsSubstituted())
+ {
+ // For to be substituted formats the scanned type must match the
+ // substitute type.
+ if (IsSystemTimeFormat())
+ {
+ if ((eType & ~css::util::NumberFormat::DEFINED) != css::util::NumberFormat::TIME)
+ nCheckPos = std::max<sal_Int32>( sBuff.indexOf(']') + 1, 1);
+ }
+ else if (IsSystemLongDateFormat())
+ {
+ if ((eType & ~css::util::NumberFormat::DEFINED) != css::util::NumberFormat::DATE)
+ nCheckPos = std::max<sal_Int32>( sBuff.indexOf(']') + 1, 1);
+ }
+ else
+ assert(!"unhandled substitute");
+ }
+
if ( bCondition && !nCheckPos )
{
if ( nIndex == 1 && NumFor[0].GetCount() == 0 &&
@@ -1437,6 +1455,21 @@ OUString SvNumberformat::LocaleType::generateCode() const
#endif
sal_uInt16 n16 = static_cast<sal_uInt16>(meLanguage);
+ if (meLanguage == LANGUAGE_SYSTEM)
+ {
+ switch (meSubstitute)
+ {
+ case Substitute::NONE:
+ ; // nothing
+ break;
+ case Substitute::TIME:
+ n16 = static_cast<sal_uInt16>(LANGUAGE_NF_SYSTEM_TIME);
+ break;
+ case Substitute::LONGDATE:
+ n16 = static_cast<sal_uInt16>(LANGUAGE_NF_SYSTEM_DATE);
+ break;
+ }
+ }
for (sal_uInt8 i = 0; i < 4; ++i)
{
sal_uInt8 n = static_cast<sal_uInt8>((n16 & 0xF000) >> 12);
@@ -1452,18 +1485,30 @@ OUString SvNumberformat::LocaleType::generateCode() const
}
SvNumberformat::LocaleType::LocaleType()
- : mnNumeralShape(0)
+ : meLanguage(LANGUAGE_DONTKNOW)
+ , meSubstitute(Substitute::NONE)
+ , mnNumeralShape(0)
, mnCalendarType(0)
- , meLanguage(LANGUAGE_DONTKNOW)
{
}
SvNumberformat::LocaleType::LocaleType(sal_uInt32 nRawNum)
- : mnNumeralShape(0)
+ : meLanguage(LANGUAGE_DONTKNOW)
+ , meSubstitute(Substitute::NONE)
+ , mnNumeralShape(0)
, mnCalendarType(0)
- , meLanguage(LANGUAGE_DONTKNOW)
{
meLanguage = static_cast<LanguageType>(nRawNum & 0x0000FFFF);
+ if (meLanguage == LANGUAGE_NF_SYSTEM_TIME)
+ {
+ meSubstitute = Substitute::TIME;
+ meLanguage = LANGUAGE_SYSTEM;
+ }
+ else if (meLanguage == LANGUAGE_NF_SYSTEM_DATE)
+ {
+ meSubstitute = Substitute::LONGDATE;
+ meLanguage = LANGUAGE_SYSTEM;
+ }
nRawNum = (nRawNum >> 16);
mnCalendarType = static_cast<sal_uInt8>(nRawNum & 0xFF);
nRawNum = (nRawNum >> 8);
@@ -4913,6 +4958,14 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
LanguageType nOriginalLang /* =LANGUAGE_DONTKNOW */ ) const
{
OUStringBuffer aStr;
+ if (maLocale.meSubstitute != LocaleType::Substitute::NONE)
+ {
+ // XXX: theoretically this could clash with the first subformat's
+ // lcl_insertLCID() below, in practice as long as it is used for system
+ // time and date modifiers it shouldn't (i.e. there is no calendar or
+ // numeral specified as well).
+ aStr.append("[$-").append( maLocale.generateCode()).append(']');
+ }
bool bDefault[4];
// 1 subformat matches all if no condition specified,
bDefault[0] = ( NumFor[1].GetCount() == 0 && eOp1 == NUMBERFORMAT_OP_NO );
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index a1ee8d905804..c2f1920e8bda 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1040,14 +1040,14 @@ static bool lcl_IsDefaultDateFormat( const SvNumberformat& rFormat, bool bSystem
// export one part (condition)
-void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey,
+void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey,
sal_uInt16 nPart, bool bDefPart )
{
//! for the default part, pass the conditions from the other parts!
// element name
- NfIndexTableOffset eBuiltIn = pFormatter->GetIndexTableOffset( nKey );
+ NfIndexTableOffset eBuiltIn = pFormatter->GetIndexTableOffset( nRealKey );
short nFmtType = 0;
bool bThousand = false;
@@ -1768,7 +1768,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// export one format
-void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey )
+void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey )
{
const sal_uInt16 XMLNUM_MAX_PARTS = 4;
bool bParts[XMLNUM_MAX_PARTS] = { false, false, false, false };
@@ -1812,7 +1812,7 @@ void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uI
if (bParts[nPart])
{
bool bDefault = ( nPart+1 == nUsedParts ); // last = default
- ExportPart_Impl( rFormat, nKey, nPart, bDefault );
+ ExportPart_Impl( rFormat, nKey, nRealKey, nPart, bDefault );
}
}
}
@@ -1829,9 +1829,12 @@ void SvXMLNumFmtExport::Export( bool bIsAutoStyle )
bool bNext(pUsedList->GetFirstUsed(nKey));
while(bNext)
{
- pFormat = pFormatter->GetEntry(nKey);
+ // ODF has its notation of system formats, so obtain the "real" already
+ // substituted format but use the original key for style name.
+ sal_uInt32 nRealKey = nKey;
+ pFormat = pFormatter->GetSubstitutedEntry( nKey, nRealKey);
if(pFormat)
- ExportFormat_Impl( *pFormat, nKey );
+ ExportFormat_Impl( *pFormat, nKey, nRealKey );
bNext = pUsedList->GetNextUsed(nKey);
}
if (!bIsAutoStyle)
@@ -1853,8 +1856,14 @@ void SvXMLNumFmtExport::Export( bool bIsAutoStyle )
if (!pUsedList->IsUsed(nKey))
{
DBG_ASSERT((pFormat->GetType() & css::util::NumberFormat::DEFINED), "a not user defined numberformat found");
+ sal_uInt32 nRealKey = nKey;
+ if (pFormat->IsSubstituted())
+ {
+ pFormat = pFormatter->GetSubstitutedEntry( nKey, nRealKey); // export the "real" format
+ assert(pFormat);
+ }
// user-defined and used formats are exported
- ExportFormat_Impl( *pFormat, nKey );
+ ExportFormat_Impl( *pFormat, nKey, nRealKey );
// if it is a user-defined Format it will be added else nothing will happen
pUsedList->SetUsed(nKey);
}
commit 4fd81a26681063dcc0d8d2eae795d39c8d894cb8
Author: Yousuf Philips <philipz85 at hotmail.com>
Date: Tue Oct 3 19:43:59 2017 +0400
tdf#107569 Add small edit style icon
Change-Id: Ic5f94197577659bb5ec9017d6967316c699cb93a
Reviewed-on: https://gerrit.libreoffice.org/43087
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/icon-themes/tango/cmd/sc_editstyle.png b/icon-themes/tango/cmd/sc_editstyle.png
new file mode 100644
index 000000000000..70059eef5cb8
Binary files /dev/null and b/icon-themes/tango/cmd/sc_editstyle.png differ
commit 83c00b33594a59157ed483eb11c3c5022c978939
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Oct 4 15:31:35 2017 +0200
loplugin:mergerclass merge FillAttrLB with SvxFillAttrBox
Change-Id: I5dfa7689eb219548bde7ce181a0a453c84b0f066
Reviewed-on: https://gerrit.libreoffice.org/43136
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results
index 51388db5a6a5..c2527800b025 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -31,7 +31,6 @@ merge EscherPersistTable with EscherEx
merge ExcBoolRecord with Exc1904
merge ExportTyp with ExportBiff5
merge FailTest with testMathMalformedXml
-merge FillAttrLB with SvxFillAttrBox
merge FillTypeLB with SvxFillTypeBox
merge FmGridListener with FmXGridPeer::GridListenerDelegator
merge FmXDisposeListener with DisposeListenerGridBridge
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 0f2bc33f0e18..13387f123317 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -229,22 +229,6 @@ public:
/************************************************************************/
-class SAL_WARN_UNUSED SVX_DLLPUBLIC FillAttrLB : public ListBox
-{
-private:
- BitmapEx maBitmapEx;
-
-public:
- FillAttrLB( vcl::Window* pParent, WinBits aWB );
-
- void Fill( const XHatchListRef &pList );
- void Fill( const XGradientListRef &pList );
- void Fill( const XBitmapListRef &pList );
- void Fill( const XPatternListRef &pList );
-};
-
-/************************************************************************/
-
class SAL_WARN_UNUSED SVX_DLLPUBLIC FillTypeLB : public ListBox
{
diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx
index d0dd8826bc3e..e82c3ca944b9 100644
--- a/include/svx/itemwin.hxx
+++ b/include/svx/itemwin.hxx
@@ -108,19 +108,22 @@ private:
static void ReleaseFocus_Impl();
};
-// class SvxFillAttrBox --------------------------------------------------
-
-class SVX_DLLPUBLIC SvxFillAttrBox : public FillAttrLB
+class SVX_DLLPUBLIC SvxFillAttrBox : public ListBox
{
public:
SvxFillAttrBox( vcl::Window* pParent );
+ void Fill( const XHatchListRef &pList );
+ void Fill( const XGradientListRef &pList );
+ void Fill( const XBitmapListRef &pList );
+ void Fill( const XPatternListRef &pList );
protected:
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
private:
sal_uInt16 nCurPos;
+ BitmapEx maBitmapEx;
static void ReleaseFocus_Impl();
};
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index e031b940a0b8..3a109baa72d1 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1044,27 +1044,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL makeHatchingLB(VclPtr<vcl::Window>
// Fills the listbox (provisional) with strings
-void FillAttrLB::Fill( const XHatchListRef &pList )
-{
- long nCount = pList->Count();
- ListBox::SetUpdateMode( false );
-
- for( long i = 0; i < nCount; i++ )
- {
- const XHatchEntry* pEntry = pList->GetHatch(i);
- const Bitmap aBitmap = pList->GetUiBitmap( i );
- if( !aBitmap.IsEmpty() )
- ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
- else
- InsertEntry( pEntry->GetName() );
- }
-
- AdaptDropDownLineCountToMaximum();
- ListBox::SetUpdateMode( true );
-}
-
-// Fills the listbox (provisional) with strings
-
GradientLB::GradientLB( vcl::Window* pParent, WinBits aWB)
: ListBox( pParent, aWB )
{
@@ -1082,27 +1061,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL makeGradientLB(VclPtr<vcl::Window>
rRet = pListBox;
}
-// Fills the listbox (provisional) with strings
-
-void FillAttrLB::Fill( const XGradientListRef &pList )
-{
- long nCount = pList->Count();
- ListBox::SetUpdateMode( false );
-
- for( long i = 0; i < nCount; i++ )
- {
- const XGradientEntry* pEntry = pList->GetGradient(i);
- const Bitmap aBitmap = pList->GetUiBitmap( i );
- if( !aBitmap.IsEmpty() )
- ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
- else
- InsertEntry( pEntry->GetName() );
- }
-
- AdaptDropDownLineCountToMaximum();
- ListBox::SetUpdateMode( true );
-}
-
// BitmapLB Constructor
BitmapLB::BitmapLB( vcl::Window* pParent, WinBits aWB)
@@ -1122,107 +1080,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL makeBitmapLB(VclPtr<vcl::Window> &
rRet = pListBox;
}
-namespace
-{
- void formatBitmapExToSize(BitmapEx& rBitmapEx, const Size& rSize)
- {
- if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0)
- {
- ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
- pVirtualDevice->SetOutputSizePixel(rSize);
-
- if(rBitmapEx.IsTransparent())
- {
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
- if(rStyleSettings.GetPreviewUsesCheckeredBackground())
- {
- const Point aNull(0, 0);
- static const sal_uInt32 nLen(8);
- static const Color aW(COL_WHITE);
- static const Color aG(0xef, 0xef, 0xef);
-
- pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG);
- }
- else
- {
- pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
- pVirtualDevice->Erase();
- }
- }
-
- if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height())
- {
- rBitmapEx.Scale(rSize);
- pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx);
- }
- else
- {
- const Size aBitmapSize(rBitmapEx.GetSizePixel());
-
- for(long y(0); y < rSize.Height(); y += aBitmapSize.Height())
- {
- for(long x(0); x < rSize.Width(); x += aBitmapSize.Width())
- {
- pVirtualDevice->DrawBitmapEx(
- Point(x, y),
- rBitmapEx);
- }
- }
- }
-
- rBitmapEx = pVirtualDevice->GetBitmap(Point(0, 0), rSize);
- }
- }
-} // end of anonymous namespace
-
-FillAttrLB::FillAttrLB(vcl::Window* pParent, WinBits aWB)
- : ListBox(pParent, aWB)
-{
-}
-
-void FillAttrLB::Fill( const XBitmapListRef &pList )
-{
- const long nCount(pList->Count());
- const XBitmapEntry* pEntry;
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
-
- ListBox::SetUpdateMode(false);
-
- for(long i(0); i < nCount; i++)
- {
- pEntry = pList->GetBitmap( i );
- maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
- formatBitmapExToSize(maBitmapEx, aSize);
- ListBox::InsertEntry(pEntry->GetName(), Image(maBitmapEx));
- }
-
- AdaptDropDownLineCountToMaximum();
- ListBox::SetUpdateMode(true);
-}
-
-void FillAttrLB::Fill( const XPatternListRef &pList )
-{
- const long nCount(pList->Count());
- const XBitmapEntry* pEntry;
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
-
- ListBox::SetUpdateMode(false);
-
- for(long i(0); i < nCount; i++)
- {
- pEntry = pList->GetBitmap( i );
- maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
- formatBitmapExToSize(maBitmapEx, aSize);
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list