[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 20 commits - basic/source cppuhelper/source cui/source desktop/qa desktop/source extensions/README extensions/source include/comphelper include/LibreOfficeKit include/oox include/sfx2 include/vcl oox/source sc/inc sc/qa sc/source sd/qa sd/source sfx2/source stoc/source sw/inc sw/qa sw/source udkapi/com uui/inc uui/source vbahelper/source vcl/source

Tor Lillqvist tml at collabora.com
Sun Mar 25 17:55:57 UTC 2018


 basic/source/classes/sbxmod.cxx                   |    5 
 cppuhelper/source/servicemanager.cxx              |   33 +++++
 cui/source/tabpages/backgrnd.cxx                  |   20 ---
 desktop/qa/desktop_lib/test_desktop_lib.cxx       |    3 
 desktop/source/lib/init.cxx                       |   19 +++
 extensions/README                                 |    2 
 extensions/source/ole/ole2uno.cxx                 |    5 
 extensions/source/ole/ole2uno.hxx                 |    6 
 extensions/source/ole/oleobjw.cxx                 |   12 -
 extensions/source/ole/oleobjw.hxx                 |    6 
 extensions/source/ole/olethread.cxx               |    5 
 extensions/source/ole/servprov.cxx                |   40 ------
 extensions/source/ole/servprov.hxx                |   29 ----
 extensions/source/ole/servreg.cxx                 |    7 -
 extensions/source/ole/unoconversionutilities.hxx  |   21 +--
 extensions/source/ole/unoobjw.cxx                 |   10 -
 extensions/source/ole/unoobjw.hxx                 |   15 --
 extensions/source/ole/windata.hxx                 |    5 
 include/LibreOfficeKit/LibreOfficeKit.h           |    5 
 include/LibreOfficeKit/LibreOfficeKit.hxx         |   11 +
 include/LibreOfficeKit/LibreOfficeKitEnums.h      |   11 +
 include/comphelper/windowsdebugoutput.hxx         |   41 ++++++
 include/oox/ppt/slidetransitioncontext.hxx        |    1 
 include/sfx2/docfile.hxx                          |   19 ++-
 include/sfx2/strings.hrc                          |    3 
 include/vcl/ITiledRenderable.hxx                  |    7 +
 include/vcl/ctrl.hxx                              |    2 
 include/vcl/vclevent.hxx                          |    2 
 include/vcl/window.hxx                            |    3 
 oox/source/ppt/slidetransitioncontext.cxx         |    9 +
 sc/inc/docuno.hxx                                 |    3 
 sc/qa/unit/tiledrendering/tiledrendering.cxx      |   35 +++++
 sc/source/ui/app/scdll.cxx                        |   14 ++
 sc/source/ui/docshell/impex.cxx                   |    4 
 sc/source/ui/unoobj/docuno.cxx                    |   25 ++++
 sd/qa/unit/data/pptx/tdf115394-zero.pptx          |binary
 sd/qa/unit/export-tests-ooxml2.cxx                |   16 ++
 sd/qa/unit/tiledrendering/tiledrendering.cxx      |   42 ++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx          |   10 -
 sd/source/ui/app/sddll.cxx                        |   11 +
 sd/source/ui/inc/unomodel.hxx                     |    2 
 sd/source/ui/unoidl/unomodel.cxx                  |   27 ++++
 sfx2/source/doc/docfile.cxx                       |   71 ++++++++---
 sfx2/source/view/viewfrm.cxx                      |  134 ++++++++++++++++------
 stoc/source/invocation/invocation.cxx             |    4 
 sw/inc/unotxdoc.hxx                               |    2 
 sw/qa/extras/tiledrendering/tiledrendering.cxx    |   33 +++++
 sw/source/uibase/app/swdll.cxx                    |   11 +
 sw/source/uibase/uno/unotxdoc.cxx                 |   22 +++
 udkapi/com/sun/star/bridge/XBridgeSupplier.idl    |    3 
 udkapi/com/sun/star/bridge/XBridgeSupplier2.idl   |    3 
 uui/inc/strings.hrc                               |    3 
 uui/source/iahndl-locking.cxx                     |   12 +
 uui/source/iahndl.cxx                             |    9 -
 uui/source/openlocked.cxx                         |   22 +--
 uui/source/openlocked.hxx                         |    2 
 vbahelper/source/vbahelper/vbaapplicationbase.cxx |    8 -
 vbahelper/source/vbahelper/vbahelper.cxx          |    8 +
 vcl/source/control/ctrl.cxx                       |   18 --
 vcl/source/gdi/sallayout.cxx                      |   30 +++-
 vcl/source/window/paint.cxx                       |   57 ++++++++-
 vcl/source/window/window.cxx                      |   20 +++
 62 files changed, 716 insertions(+), 302 deletions(-)

New commits:
commit da9ea2718f6a5ee46b317ef5cb47552adf8c752d
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Feb 12 15:31:14 2018 +0200

    Get rid of ole_adapter namespace level
    
    None of this is DLLPUBLIC anyway, and it all goes into one DLL.
    
    Change-Id: I3756f87aaa4561ef54a9e6aaeeac47b99350c6b3
    Reviewed-on: https://gerrit.libreoffice.org/49616
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit d9fc18d5a797972ba182fbcae941535a50098dcb)

diff --git a/extensions/README b/extensions/README
index eeff42a5d853..b74ff369baa1 100644
--- a/extensions/README
+++ b/extensions/README
@@ -24,7 +24,7 @@ See udkapi/com/sun/star/bridge/oleautomation/ApplicationRegistration.idl
 
 This is initialized in Desktop::Main() in Desktop::OpenClients_Impl()
 by creating the service "com.sun.star.bridge.OleApplicationRegistration",
-which is implemented by ole_adapter::OleServer_Impl.
+which is implemented by OleServer_Impl.
 
 See extensions/source/ole/
 
diff --git a/extensions/source/ole/ole2uno.cxx b/extensions/source/ole/ole2uno.cxx
index a42c26fac140..4899a2df11d4 100644
--- a/extensions/source/ole/ole2uno.cxx
+++ b/extensions/source/ole/ole2uno.cxx
@@ -23,8 +23,6 @@
 #include "ole2uno.hxx"
 
 using namespace osl;
-namespace ole_adapter
-{
 
 struct MutexInit
 {
@@ -43,7 +41,4 @@ Mutex * getBridgeMutex()
             MutexInit(), ::osl::GetGlobalMutex());
 }
 
-
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/ole2uno.hxx b/extensions/source/ole/ole2uno.hxx
index a3447a8d952c..e4d83c48b73b 100644
--- a/extensions/source/ole/ole2uno.hxx
+++ b/extensions/source/ole/ole2uno.hxx
@@ -53,9 +53,6 @@ using namespace com::sun::star::beans;
 using namespace osl;
 using namespace std;
 
-namespace ole_adapter
-{
-
 VARTYPE getVarType( const Any& val);
 /* creates a Type object for a given type name.
 
@@ -78,9 +75,6 @@ public:
 
 Mutex* getBridgeMutex();
 
-} // end namespace
-
-
 #endif // INCLUDED_EXTENSIONS_SOURCE_OLE_OLE2UNO_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index ab4f9d30fc75..13ae64cde6c8 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -57,9 +57,6 @@ using namespace ::com::sun::star;
 
 #define JSCRIPT_ID_PROPERTY L"_environment"
 #define JSCRIPT_ID          L"jscript"
-namespace ole_adapter
-{
-
 
 // key: XInterface pointer created by Invocation Adapter Factory
 // value: XInterface pointer to the wrapper class.
@@ -2496,6 +2493,4 @@ ITypeInfo* IUnknownWrapper_Impl::getTypeInfo()
     return m_spTypeInfo;
 }
 
-} // end namespace
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
index dbf1b74924eb..6c673f178c82 100644
--- a/extensions/source/ole/oleobjw.hxx
+++ b/extensions/source/ole/oleobjw.hxx
@@ -46,10 +46,6 @@ using namespace com::sun::star::lang;
 using namespace com::sun::star::bridge;
 using namespace com::sun::star::bridge::oleautomation;
 
-namespace ole_adapter
-{
-
-
 typedef std::unordered_map<OUString, pair<DISPID, unsigned short>> DispIdMap;
 
 typedef std::unordered_multimap<OUString, unsigned int> TLBFuncIndexMap;
@@ -246,8 +242,6 @@ protected:
     bool m_bHasDfltProperty;
 };
 
-} // end namespace
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/olethread.cxx b/extensions/source/ole/olethread.cxx
index 72434b89febb..6bb0c5daab2a 100644
--- a/extensions/source/ole/olethread.cxx
+++ b/extensions/source/ole/olethread.cxx
@@ -24,9 +24,6 @@
 
 using namespace std;
 
-namespace ole_adapter
-{
-
 void o2u_attachCurrentThread()
 {
     static osl::ThreadData oleThreadData;
@@ -44,6 +41,4 @@ void o2u_attachCurrentThread()
     }
 }
 
-} // end namespace
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 712062486853..59bdcbfa6337 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -37,10 +37,6 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::bridge;
 using namespace com::sun::star::bridge::ModelDependent;
 
-
-namespace ole_adapter
-{
-
 #include <initguid.h>
 
 // GUID used since 5.2 ( src569 m)
@@ -643,7 +639,4 @@ bool OleServer_Impl::provideInstance(const Reference<XInterface>& xInst, GUID co
     return pFac->registerClass();
 }
 
-
-} // end namespace
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index 98d3b48ed613..b1bcb2cadf4f 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -31,8 +31,6 @@ using namespace com::sun::star::bridge;
 using namespace cppu;
 using namespace std;
 
-namespace ole_adapter
-{
 /// @throws Exception
 Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance2(  const Reference<XMultiServiceFactory> & xSMgr);
 /// @throws Exception
@@ -253,7 +251,6 @@ protected:
     Reference<XMultiServiceFactory> m_smgr;
 };
 
-} // end namespace
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/servreg.cxx b/extensions/source/ole/servreg.cxx
index 70dfe403338d..e92fd9c61975 100644
--- a/extensions/source/ole/servreg.cxx
+++ b/extensions/source/ole/servreg.cxx
@@ -22,12 +22,8 @@
 #include "servprov.hxx"
 #include <rtl/ustring.hxx>
 #include <cppuhelper/factory.hxx>
-using namespace ole_adapter;
-using namespace cppu;
-
 
-namespace ole_adapter
-{
+using namespace cppu;
 
 Reference<XInterface> SAL_CALL ConverterProvider_CreateInstance2(   const Reference<XMultiServiceFactory> & xSMgr)
 {
@@ -52,7 +48,6 @@ Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiS
     Reference<XInterface > xService = *new OleServer_Impl(xSMgr);
     return xService;
 }
-} // end namespace
 
 extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL oleautobridge_component_getFactory(
     const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index c463544b93f6..c5a3fb0aa433 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -59,8 +59,7 @@ using namespace com::sun::star::script;
 using namespace com::sun::star::beans;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::bridge::oleautomation;
-namespace ole_adapter
-{
+
 extern std::unordered_map<sal_uIntPtr, sal_uIntPtr> AdapterToWrapperMap;
 extern std::unordered_map<sal_uIntPtr, sal_uIntPtr> WrapperToAdapterMap;
 
@@ -2361,7 +2360,6 @@ inline void reduceRange( Any& any)
     }
 }
 
-} // end namespace
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 843c599d65d2..604c74577e72 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -69,8 +69,6 @@ using namespace com::sun::star::reflection;
 extern "C" const GUID IID_IDispatchEx;
 #endif
 
-namespace ole_adapter
-{
 std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > UnoObjToWrapperMap;
 static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource);
 static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource);
@@ -1605,6 +1603,4 @@ VARTYPE getVarType( const Any& value)
     return ret;
 }
 
-} // end namespace
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx
index 36af08e4d46f..94d49f51fd21 100644
--- a/extensions/source/ole/unoobjw.hxx
+++ b/extensions/source/ole/unoobjw.hxx
@@ -45,9 +45,6 @@ using namespace std;
 using namespace cppu;
 using namespace com::sun::star::bridge;
 using namespace com::sun::star::script;
-namespace ole_adapter
-{
-
 
 struct hash_IUnknown_Impl
 {
@@ -268,8 +265,6 @@ protected:
 
 };
 
-} // end namespace
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/windata.hxx b/extensions/source/ole/windata.hxx
index 69aa63398d18..9bb9a6169e71 100644
--- a/extensions/source/ole/windata.hxx
+++ b/extensions/source/ole/windata.hxx
@@ -47,8 +47,6 @@
 
 #include <osl/diagnose.h>
 
-namespace ole_adapter
-{
 //Wrapper for VARDESC
 class VarDesc
 {
@@ -202,9 +200,6 @@ public:
    }
 };
 
-
-}
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 301cf7ce3873e9d54eaade0250508324c9852481
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Feb 12 15:24:12 2018 +0200

    Reduce ASCII graphics and pointless comments a bit
    
    Change-Id: Ia5cf6b923a6c6057463171d219af250ddb069bad
    (cherry picked from commit 4c925efc4373a5a09941b56d2edd30500987dd25)

diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index e0ecea12b063..ab4f9d30fc75 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -79,11 +79,6 @@ std::unordered_map<sal_uIntPtr, sal_uIntPtr> AdapterToWrapperMap;
 std::unordered_map<sal_uIntPtr,sal_uIntPtr> WrapperToAdapterMap;
 
 std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > ComPtrToWrapperMap;
-/*****************************************************************************
-
-    class implementation IUnknownWrapper_Impl
-
-*****************************************************************************/
 
 IUnknownWrapper_Impl::IUnknownWrapper_Impl( Reference<XMultiServiceFactory> const & xFactory,
                                            sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 4fa08a3a6181..712062486853 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -47,12 +47,6 @@ namespace ole_adapter
 // {82154420-0FBF-11d4-8313-005004526AB4}
 DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
 
-/*****************************************************************************
-
-    class implementation ProviderOleWrapper_Impl
-
-*****************************************************************************/
-
 ProviderOleWrapper_Impl::ProviderOleWrapper_Impl(const Reference<XMultiServiceFactory>& smgr,
                                                  const Reference<XSingleServiceFactory>& xSFact, GUID const * pGuid)
     : m_xSingleServiceFactory(xSFact),
@@ -181,12 +175,6 @@ STDMETHODIMP ProviderOleWrapper_Impl::LockServer(int /*fLock*/)
     return NOERROR;
 }
 
-/*****************************************************************************
-
-    class implementation OneInstanceOleWrapper_Impl
-
-*****************************************************************************/
-
 OneInstanceOleWrapper_Impl::OneInstanceOleWrapper_Impl(  const Reference<XMultiServiceFactory>& smgr,
                                                          const Reference<XInterface>& xInst,
                                                          GUID const * pGuid )
@@ -307,13 +295,6 @@ STDMETHODIMP OneInstanceOleWrapper_Impl::LockServer(int /*fLock*/)
     return NOERROR;
 }
 
-
-/*****************************************************************************
-
-    class implementation OleConverter_Impl2
-
-*****************************************************************************/
-
 OleConverter_Impl2::OleConverter_Impl2( const Reference<XMultiServiceFactory> &smgr):
     UnoConversionUtilities<OleConverter_Impl2>( smgr)
 
@@ -481,13 +462,6 @@ Reference< XInterface > OleConverter_Impl2::createComWrapperInstance()
     return Reference<XInterface>( xWeak, UNO_QUERY);
 }
 
-
-/*****************************************************************************
-
-    class implementation OleClient_Impl
-
-*****************************************************************************/
-
 OleClient_Impl::OleClient_Impl( const Reference<XMultiServiceFactory>& smgr):
     UnoConversionUtilities<OleClient_Impl>( smgr)
 {
@@ -606,13 +580,6 @@ Reference< XInterface > OleClient_Impl::createComWrapperInstance( )
     return Reference<XInterface>( xWeak, UNO_QUERY);
 }
 
-
-/*****************************************************************************
-
-    class implementation OleServer_Impl
-
-*****************************************************************************/
-
 OleServer_Impl::OleServer_Impl( const Reference<XMultiServiceFactory>& smgr):
     m_smgr( smgr)
 {
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index 67dc9a71723d..98d3b48ed613 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -43,7 +43,7 @@ Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiS
 Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr);
 /*****************************************************************************
 
-    class declaration IClassFactoryWrapper
+    IClassFactoryWrapper
 
     Specify abstract helper methods on class factories, which provide
     UNO objects. These methods are used by objects of class OleServer_Impl,
@@ -64,7 +64,7 @@ protected:
 
 /*****************************************************************************
 
-    class declaration ProviderOleWrapper_Impl
+    ProviderOleWrapper_Impl
 
     Provides an UNO service provider as OLE class factory. Handle the
     OLE registration by overriding the abstract methods from
@@ -108,7 +108,7 @@ protected:
 
 /*****************************************************************************
 
-    class declaration OneInstanceOleWrapper_Impl
+    OneInstanceOleWrapper_Impl
 
     Provides an single UNO object as OLE object. Handle the
     OLE registration by overriding the abstract methods from
@@ -148,13 +148,7 @@ protected:
     Reference<XMultiServiceFactory> m_smgr;
 };
 
-/*****************************************************************************
-
-    class declaration OleConverter_Impl2
-
-    Implementation of the UNO service com.sun.star.bridge.OleBridgeSupplier2.
-
-*****************************************************************************/
+// Implementation of the UNO service com.sun.star.bridge.OleBridgeSupplier2.
 
 // This class realizes the service com.sun.star.bridge.OleBridgeSupplier2 and
 // com.sun.star.bridge.OleBridgeSupplierVar1. The class implements XBridgeSupplier2
@@ -197,15 +191,7 @@ protected:
 
 };
 
-
-/*****************************************************************************
-
-    class declaration OleClient_Impl
-
-    Implementation of the UNO service com.sun.star.bridge.OleObjectFactory.
-
-*****************************************************************************/
-
+// Implementation of the UNO service com.sun.star.bridge.OleObjectFactory.
 
 class OleClient_Impl : public WeakImplHelper<XMultiServiceFactory, css::lang::XServiceInfo>,
                        public UnoConversionUtilities<OleClient_Impl>
@@ -235,7 +221,7 @@ protected:
 
 /*****************************************************************************
 
-    class declaration OleServer_Impl
+    OleServer_Impl
 
     Implementation of the UNO service com.sun.star.bridge.OleApplicationRegistration.
     Register the calling application as OLE automation server for
diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx
index 22036dbe4762..36af08e4d46f 100644
--- a/extensions/source/ole/unoobjw.hxx
+++ b/extensions/source/ole/unoobjw.hxx
@@ -93,12 +93,6 @@ typedef std::unordered_map
     MemberInfo
 > IdToMemberInfoMap;
 
-/*****************************************************************************
-
-    class declaration: InterfaceOleWrapper_Impl
-
-*****************************************************************************/
-
 class InterfaceOleWrapper_Impl : public WeakImplHelper<XBridgeSupplier2, XInitialization>,
                                  public IDispatchEx,
                                  public UnoConversionUtilities<InterfaceOleWrapper_Impl>,
@@ -221,8 +215,8 @@ protected:
 
 /*****************************************************************************
 
-    class declaration: UnoObjectWrapperRemoteOpt
-    ( Uno Object Wrapper Remote Optimized)
+    UnoObjectWrapperRemoteOpt = Uno Object Wrapper Remote Optimized
+
     This is the UNO wrapper used in the service com.sun.star.bridge.OleBridgeSupplierVar1.
     Key features:
     DISPIDs are passed out blindly. That is in GetIDsOfNames is no name checking carried out.
commit 4f2abe9f54d33c4e8bebb3358f8db3d1897893b2
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Mon Feb 12 12:42:45 2018 +0100

    Coverity: unused value
    
    Change-Id: I4b166b3e15a457fe93128ee9efa55fdd6dca6178
    Reviewed-on: https://gerrit.libreoffice.org/49592
    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>
    (cherry picked from commit ac97ca547de9593ff5f8e7615f1aa779a5091126)

diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 1ab1a7dc68ff..91f11ac4d2d0 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -705,7 +705,6 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
 
     if (GETA(Change))
         mAny >>= changeType;
-    bool isAdvanceTimingSet = advanceTiming != -1;
 
     // 1 means automatic, 2 half automatic - not sure what it means - at least I don't see it in UI
     if (changeType == 1 && GETA(Duration))
@@ -804,6 +803,7 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
         }
     }
 
+    bool isAdvanceTimingSet = advanceTiming != -1;
     if (nTransition14 || pPresetTransition || isTransitionDurationSet)
     {
         const char* pRequiresNS = (nTransition14 || isTransitionDurationSet) ? "p14" : "p15";
commit e31511f7f9c6e6282784435f02ff0ad1515ec790
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Feb 12 18:13:51 2018 +0200

    Don't even mention CORBA, it isn't and won't be specified
    
    Change-Id: I87f6effdd3ef68749a3326ff277c6e8e7412c956
    (cherry picked from commit 7517e53a96b956f369a6003690174fa156b7a0e5)

diff --git a/udkapi/com/sun/star/bridge/XBridgeSupplier.idl b/udkapi/com/sun/star/bridge/XBridgeSupplier.idl
index fbdb6f606d8c..d6d6aff37faa 100644
--- a/udkapi/com/sun/star/bridge/XBridgeSupplier.idl
+++ b/udkapi/com/sun/star/bridge/XBridgeSupplier.idl
@@ -57,9 +57,6 @@
 
         <dt>JAVA:   </dt>
         <dd>not yet specified.  </dd>
-
-        <dt>CORBA: </dt>
-        <dd>not yet specified.  </dd>
     </dl>
 
     <p>Any implementation can supply its own bridges to other object
diff --git a/udkapi/com/sun/star/bridge/XBridgeSupplier2.idl b/udkapi/com/sun/star/bridge/XBridgeSupplier2.idl
index 01930ca321d4..94c36850116c 100644
--- a/udkapi/com/sun/star/bridge/XBridgeSupplier2.idl
+++ b/udkapi/com/sun/star/bridge/XBridgeSupplier2.idl
@@ -72,9 +72,6 @@
 
         <dt>JAVA:   </dt>
         <dd>not specified yet.  </dd>
-
-        <dt>CORBA: </dt>
-        <dd>not specified yet.  </dd>
     </dl>
 
     </p>
commit e8f8f9ddfd2002eed680ebff8933e789fde3e9c7
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Feb 12 12:04:23 2018 +0100

    Disable lok_preload_hooks when not dynamically loading.
    
    Change-Id: I00f1e8978607f450d3ad33f4515be1fc962c0332
    Reviewed-on: https://gerrit.libreoffice.org/49591
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit 93eef21ce1f74c848fcf0ad4f4eab7a8167a39a8)

diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 6f8287cd1b9d..6ee59f75efe9 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -267,6 +267,8 @@ void ScDLL::Init()
     //  StarOne Services are now handled in the registry
 }
 
+#ifndef DISABLE_DYNLOADING
+
 extern "C" SAL_DLLPUBLIC_EXPORT
 void lok_preload_hook()
 {
@@ -276,5 +278,6 @@ void lok_preload_hook()
     ScAbstractDialogFactory::Create();
 }
 
+#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index 9239951476d1..0835e1dd281b 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -290,10 +290,14 @@ void SdDLL::Init()
 #endif
 }
 
+#ifndef DISABLE_DYNLOADING
+
 extern "C" SAL_DLLPUBLIC_EXPORT
 void lok_preload_hook()
 {
     SdAbstractDialogFactory::Create();
 }
 
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx
index 7df0cec3a0db..a126f56524ea 100644
--- a/sw/source/uibase/app/swdll.cxx
+++ b/sw/source/uibase/app/swdll.cxx
@@ -172,10 +172,14 @@ sw::Filters & SwDLL::getFilters()
     return *filters_.get();
 }
 
+#ifndef DISABLE_DYNLOADING
+
 extern "C" SAL_DLLPUBLIC_EXPORT
 void lok_preload_hook()
 {
     SwAbstractDialogFactory::Create();
 }
 
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 647da8fdbcf00eadfd37693590a0880a2d7ce3cc
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Feb 8 22:21:32 2018 +0200

    Whitespace (alignment) fix
    
    Change-Id: Ib3ecfc5524744f49f3995202f377a625ea80b998
    (cherry picked from commit 2191169c83c15bfc9546204fc1640b1674717af1)

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index c94c8eac147c..843c599d65d2 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -782,10 +782,10 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember,
                                               REFIID /*riid*/,
                                               LCID /*lcid*/,
                                               unsigned short wFlags,
-                                               DISPPARAMS * pdispparams,
+                                              DISPPARAMS * pdispparams,
                                               VARIANT * pvarResult,
                                               EXCEPINFO * pexcepinfo,
-                                               unsigned int * puArgErr )
+                                              unsigned int * puArgErr )
 {
     comphelper::ProfileZone aZone("COM Bridge");
     HRESULT ret = S_OK;
commit 418fa1c6b66005e3c99a582357dd599feb41b510
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Feb 9 18:24:51 2018 +0200

    Get rid of a few unused or once-used typedefs
    
    This code is complicated enough without weirdly named typedefs for
    trivial iterators. Just use 'auto'.
    
    Change-Id: Ib2d9271ccd0f63eab338d9fe214a2523cb57ce97
    Reviewed-on: https://gerrit.libreoffice.org/49510
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 9d6257a995c3e6e6d1af1d850194ae14e7c26df1)

diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index c856992fbc96..e0ecea12b063 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -115,7 +115,7 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
         WrapperToAdapterMap.erase( it);
     }
 
-     IT_Com it_c= ComPtrToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_spUnknown.p));
+    auto it_c= ComPtrToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_spUnknown.p));
     if(it_c != ComPtrToWrapperMap.end())
         ComPtrToWrapperMap.erase(it_c);
 }
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index 98f1885367d2..c463544b93f6 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -63,15 +63,12 @@ namespace ole_adapter
 {
 extern std::unordered_map<sal_uIntPtr, sal_uIntPtr> AdapterToWrapperMap;
 extern std::unordered_map<sal_uIntPtr, sal_uIntPtr> WrapperToAdapterMap;
-typedef std::unordered_map<sal_uIntPtr, sal_uIntPtr>::iterator IT_Wrap;
-typedef std::unordered_map<sal_uIntPtr, sal_uIntPtr>::iterator CIT_Wrap;
+
 //Maps IUnknown pointers to a weak reference of the respective wrapper class (e.g.
 // IUnknownWrapperImpl. It is the responsibility of the wrapper to remove the entry when
 // it is being destroyed.
 // Used to ensure that an Automation object is always mapped to the same UNO objects.
 extern std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > ComPtrToWrapperMap;
-typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::iterator IT_Com;
-typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::const_iterator CIT_Com;
 
 // Maps XInterface pointers to a weak reference of its wrapper class (i.e.
 // InterfaceOleWrapper_Impl). It is the responsibility of the wrapper to remove the entry when
@@ -80,8 +77,6 @@ typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::const_itera
 // UNO interface is mapped again to COM then the IDispach of the first mapped instance
 // must be returned.
 extern std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > UnoObjToWrapperMap;
-typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::iterator IT_Uno;
-typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::const_iterator CIT_Uno;
 
 // createUnoObjectWrapper gets a wrapper instance by calling createUnoWrapperInstance
     // and initializes it via XInitialization. The wrapper object is required to implement
@@ -1368,7 +1363,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
 
         Reference<XInterface> xIntWrapper;
         // Does a UNO wrapper exist already ?
-        IT_Uno it_uno = UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(xInt.get()));
+        auto it_uno = UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(xInt.get()));
         if(it_uno != UnoObjToWrapperMap.end())
         {
             xIntWrapper =  it_uno->second;
@@ -1383,9 +1378,9 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
         else
         {
             Reference<XInterface> xIntComWrapper = xInt;
-            typedef std::unordered_map<sal_uIntPtr,sal_uIntPtr>::iterator IT;
+
             // Adapter? then get the COM wrapper to which the adapter delegates its calls
-            IT it= AdapterToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(xInt.get()));
+            auto it = AdapterToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(xInt.get()));
             if( it != AdapterToWrapperMap.end() )
                 xIntComWrapper= reinterpret_cast<XInterface*>(it->second);
 
@@ -1729,7 +1724,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
     // wrap ordinary dispatch objects. The dispatch-UNO objects usually are adapted to represent
     // particular UNO interfaces.
     Reference<XInterface> xIntWrapper;
-    CIT_Com cit_currWrapper= ComPtrToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(spUnknown.p));
+    auto cit_currWrapper= ComPtrToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(spUnknown.p));
     if(cit_currWrapper != ComPtrToWrapperMap.end())
             xIntWrapper = cit_currWrapper->second;
     if (xIntWrapper.is())
@@ -1738,7 +1733,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
         //find the proper Adapter. The pointer in the WrapperToAdapterMap are valid as long as
         //we get a pointer to the wrapper from ComPtrToWrapperMap, because the Adapter hold references
         //to the wrapper.
-        CIT_Wrap it = WrapperToAdapterMap.find(reinterpret_cast<sal_uIntPtr>(xIntWrapper.get()));
+        auto it = WrapperToAdapterMap.find(reinterpret_cast<sal_uIntPtr>(xIntWrapper.get()));
         if (it == WrapperToAdapterMap.end())
         {
             // No adapter available.
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index f3355d2acf21..c94c8eac147c 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -100,7 +100,7 @@ InterfaceOleWrapper_Impl::~InterfaceOleWrapper_Impl()
 {
     MutexGuard guard(getBridgeMutex());
     // remove entries in global map
-    IT_Uno it= UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_xOrigin.get()));
+    auto it = UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_xOrigin.get()));
     if(it != UnoObjToWrapperMap.end())
         UnoObjToWrapperMap.erase(it);
 }
commit 0e1a60ba244a4d89701c38ebda1797e0833ca15b
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date:   Sat Feb 10 17:11:37 2018 +0100

    tdf#115353 tdf#114743 Use first valid glyph
    
    in AdjustLayout.
    
    Change-Id: Iaa9a0cde2bd35fed5cbc9ebf0690341812679b6f
    Reviewed-on: https://gerrit.libreoffice.org/49541
    Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
    Tested-by: Tamás Bunth <btomi96 at gmail.com>
    (cherry picked from commit e3546db362e9dfed94572d164359a0fc1eae742f)

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index b8957ae14eb3..7bba0b9428a0 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1206,13 +1206,25 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
     double fUnitMul = 1.0;
     for( n = 0; n < nLevel; ++n )
         maFallbackRuns[n].ResetPos();
+
+    int nFirstValid = -1;
+    for( n = 0; n < nLevel; ++n )
+    {
+        if(nValid[n] > 0)
+        {
+            nFirstValid = n;
+            break;
+        }
+    }
+    assert(nFirstValid >= 0);
+
     // get the next codepoint index that needs fallback
-    int nActiveCharPos = pGlyphs[0]->mnCharPos;
+    int nActiveCharPos = pGlyphs[nFirstValid]->mnCharPos;
     int nActiveCharIndex = nActiveCharPos - mnMinCharPos;
     // get the end index of the active run
     int nLastRunEndChar = (nActiveCharIndex >= 0 && vRtl[nActiveCharIndex]) ?
         rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1;
-    int nRunVisibleEndChar = pGlyphs[0]->mnCharPos;
+    int nRunVisibleEndChar = pGlyphs[nFirstValid]->mnCharPos;
     // merge the fallback levels
     while( nValid[0] && (nLevel > 0))
     {
@@ -1241,13 +1253,13 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
         {
             // drop the NotDef glyphs in the base layout run if a fallback run exists
             while (
-                    (maFallbackRuns[n-1].PosIsInRun(pGlyphs[0]->mnCharPos)) &&
-                    (!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[0]->mnCharPos))
+                    (maFallbackRuns[n-1].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos)) &&
+                    (!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[nFirstValid]->mnCharPos))
                   )
             {
                 mpLayouts[0]->DropGlyph( nStartOld[0] );
                 nStartOld[0] = nStartNew[0];
-                nValid[0] = mpLayouts[0]->GetNextGlyphs(1, &pGlyphs[0], aPos, nStartNew[0]);
+                nValid[nFirstValid] = mpLayouts[0]->GetNextGlyphs(1, &pGlyphs[nFirstValid], aPos, nStartNew[0]);
 
                 if( !nValid[0] )
                    break;
@@ -1301,9 +1313,9 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
             else
             {
                 // break when a fallback is needed and available
-                bool bNeedFallback = maFallbackRuns[0].PosIsInRun(pGlyphs[0]->mnCharPos);
+                bool bNeedFallback = maFallbackRuns[0].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos);
                 if( bNeedFallback )
-                    if (!maFallbackRuns[nLevel-1].PosIsInRun(pGlyphs[0]->mnCharPos))
+                    if (!maFallbackRuns[nLevel-1].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos))
                         break;
                 // break when change from resolved to unresolved base layout run
                 if( bKeepNotDef && !bNeedFallback )
@@ -1356,7 +1368,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
                   nRunAdvance -= aMultiArgs.mpDXArray[nLastRunEndChar - mnMinCharPos];
             }
             nLastRunEndChar = nRunVisibleEndChar;
-            nRunVisibleEndChar = pGlyphs[0]->mnCharPos;
+            nRunVisibleEndChar = pGlyphs[nFirstValid]->mnCharPos;
             // the requested width is still in pixel units
             // => convert it to base level font units
             nRunAdvance *= mnUnitsPerPixel;
@@ -1373,7 +1385,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
         nXPos += nRunAdvance;
 
         // prepare for next fallback run
-        nActiveCharPos = pGlyphs[0]->mnCharPos;
+        nActiveCharPos = pGlyphs[nFirstValid]->mnCharPos;
         // it essential that the runs don't get ahead of themselves and in the
         // if( bKeepNotDef && !bNeedFallback ) statement above, the next run may
         // have already been reached on the base level
commit 1d4d71ba33b210db58bb1c3637e8388f720c2ff7
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Jan 22 22:02:56 2018 +0000

    Pre-load key UNO mappings.
    
    Change-Id: I415e07d737c734d63ac969783464babcbb9ea884
    Reviewed-on: https://gerrit.libreoffice.org/48365
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit 720759ad342000f2729a6c983523af931f01dbef)

diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index b7f8b04557f4..891cf5a60904 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -43,6 +43,7 @@
 #include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
 #include <uno/environment.hxx>
+#include <uno/mapping.hxx>
 
 #include "loadsharedlibcomponentfactory.hxx"
 
@@ -1992,6 +1993,25 @@ void cppuhelper::ServiceManager::preloadImplementations() {
         }
     }
     std::cerr << std::endl;
+
+    // Various rather important uno mappings.
+    struct {
+        const char *mpFrom;
+        const char *mpTo;
+        const char *mpPurpose;
+    } aMappingLoad[] = {
+        { "gcc3", "uno",  "" },
+        { "uno",  "gcc3", "" },
+    };
+
+    static std::vector<css::uno::Mapping> maMaps;
+    for (auto &it : aMappingLoad)
+    {
+        maMaps.push_back(css::uno::Mapping(
+                             OUString::createFromAscii(it.mpFrom),
+                             OUString::createFromAscii(it.mpTo),
+                             OUString::createFromAscii(it.mpPurpose)));
+    }
 #endif
 }
 
commit 27b208c5f945b06d308fede54523f77dbea5445b
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Feb 10 17:27:42 2018 +0100

    lok: allow libraries to pre-init themselves.
    
    Populate static module references before entering a jail
    containing no code.
    
    Implement for scfilt, scui, swui, sdui.
    
    Change-Id: I8fec2aa78e67053a7945926c818122bd4290103c
    Reviewed-on: https://gerrit.libreoffice.org/49545
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit f215096c24429fe69e7e5ab37898d0f0beeff0ab)

diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 556440dc8733..b7f8b04557f4 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -1974,6 +1974,19 @@ void cppuhelper::ServiceManager::preloadImplementations() {
                 iterator->second->status = Data::Implementation::STATUS_LOADED;
 
             }
+
+            // Some libraries use other (non-UNO) libraries requiring preinit
+            oslGenericFunction fpPreload = aModule.getFunctionSymbol( "lok_preload_hook" );
+            if (fpPreload)
+            {
+                static std::vector<oslGenericFunction> aPreloaded;
+                if (std::find(aPreloaded.begin(), aPreloaded.end(), fpPreload) == aPreloaded.end())
+                {
+                    aPreloaded.push_back(fpPreload);
+                    fpPreload();
+                }
+            }
+
             // leak aModule
             aModule.release();
         }
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 0f398c5d4170..6f8287cd1b9d 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -106,6 +106,7 @@
 #include <dwfunctr.hxx>
 #include <acredlin.hxx>
 #include <o3tl/make_unique.hxx>
+#include <filter.hxx>
 #include <scabstdlg.hxx>
 
 OUString ScResId(const char* pId)
@@ -266,4 +267,14 @@ void ScDLL::Init()
     //  StarOne Services are now handled in the registry
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT
+void lok_preload_hook()
+{
+    // scfilt
+    ScFormatFilter::Get();
+    // scui
+    ScAbstractDialogFactory::Create();
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 6d0d788c46ad..58c47e2cb1cf 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2308,7 +2308,9 @@ ScFormatFilterPlugin &ScFormatFilter::Get()
 #ifndef DISABLE_DYNLOADING
     OUString sFilterLib(SVLIBRARY("scfilt"));
     static ::osl::Module aModule;
-    bool bLoaded = aModule.loadRelative(&thisModule, sFilterLib);
+    bool bLoaded = aModule.is();
+    if (!bLoaded)
+        bLoaded = aModule.loadRelative(&thisModule, sFilterLib);
     if (!bLoaded)
         bLoaded = aModule.load(sFilterLib);
     if (bLoaded)
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index b48b928dd31b..9239951476d1 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -96,6 +96,7 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <comphelper/processfactory.hxx>
 #include <o3tl/make_unique.hxx>
+#include <sdabstdlg.hxx>
 
 using namespace ::com::sun::star;
 
@@ -289,4 +290,10 @@ void SdDLL::Init()
 #endif
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT
+void lok_preload_hook()
+{
+    SdAbstractDialogFactory::Create();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx
index f1f7b9039d86..7df0cec3a0db 100644
--- a/sw/source/uibase/app/swdll.cxx
+++ b/sw/source/uibase/app/swdll.cxx
@@ -45,6 +45,7 @@
 
 #include <swacorr.hxx>
 #include <unomid.h>
+#include <swabstdlg.hxx>
 
 #include "swdllimpl.hxx"
 #include <o3tl/make_unique.hxx>
@@ -171,4 +172,10 @@ sw::Filters & SwDLL::getFilters()
     return *filters_.get();
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT
+void lok_preload_hook()
+{
+    SwAbstractDialogFactory::Create();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b871f33f85422640ec9a248c80935f18e4eadb57
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Sat Feb 10 17:31:44 2018 +0100

    lokdialog: Render non-pixel based preview windows
    
    PaintToDevice() method was designed for pixel based windows,
    now I added some scaling to handle different units.
    
    Change-Id: Id242c44101c1e842409ba3a9b13291e48bdd44ca
    Reviewed-on: https://gerrit.libreoffice.org/49543
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit d6a2dc03806c4e7c0be8e4f2aee272f036f4765e)

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index fdd7029d2828..b9ac88de33c5 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1351,9 +1351,29 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
     bool bOutput = IsOutputEnabled();
     EnableOutput();
 
-    SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl.window", "MapMode must be PIXEL based" );
-    if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel )
-        return;
+    double fScaleX = 1;
+    double fScaleY = 1;
+    bool bNeedsScaling = false;
+    if(comphelper::LibreOfficeKit::isActive())
+    {
+        if(GetMapMode().GetMapUnit() != MapUnit::MapPixel &&
+        // Some of the preview windows (SvxPreviewBase) uses different painting (drawinglayer primitives)
+        // For these preview we don't need to scale even tough the unit is not pixel.
+        GetMapMode().GetMapUnit() != MapUnit::Map100thMM)
+        {
+            bNeedsScaling = true;
+            // 1000.0 is used to reduce rounding imprecision (Size uses integers)
+            Size aLogicSize = PixelToLogic(Size(1000.0, 1000.0));
+            fScaleX = aLogicSize.Width() / 1000.0;
+            fScaleY = aLogicSize.Height() / 1000.0;
+        }
+    }
+    else
+    {   // TODO: Above scaling was added for LOK only, would be good to check how it works in other use cases
+        SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl.window", "MapMode must be PIXEL based" );
+        if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel )
+            return;
+    }
 
     // preserve graphicsstate
     Push();
@@ -1403,7 +1423,17 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
         SetRefPoint();
     SetLayoutMode( GetLayoutMode() );
     SetDigitLanguage( GetDigitLanguage() );
-    tools::Rectangle aPaintRect( Point( 0, 0 ), GetOutputSizePixel() );
+
+    tools::Rectangle aPaintRect;
+    if(bNeedsScaling)
+    {
+        aPaintRect = tools::Rectangle( Point( 0, 0 ),
+            Size(GetOutputSizePixel().Width() * fScaleX, GetOutputSizePixel().Height() * fScaleY)  );
+    }
+    else
+    {
+        aPaintRect = tools::Rectangle( Point( 0, 0 ), GetOutputSizePixel() );
+    }
     aClipRegion.Intersect( aPaintRect );
     SetClipRegion( aClipRegion );
 
@@ -1411,7 +1441,11 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
 
     // background
     if( ! IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() & ParentClipMode::NoClip ) )
+    {
         Erase(*this);
+        if(bNeedsScaling)
+            aMtf.Scale(fScaleX, fScaleY);
+    }
     // foreground
     Paint(*this, aPaintRect);
     // put a pop action to metafile
@@ -1425,11 +1459,14 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
     VclPtrInstance<VirtualDevice> pMaskedDevice(*i_pTargetOutDev,
                                                 DeviceFormat::DEFAULT,
                                                 DeviceFormat::DEFAULT);
+
+    if(bNeedsScaling)
+        pMaskedDevice->SetMapMode( GetMapMode() );
     pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
     pMaskedDevice->EnableRTL( IsRTLEnabled() );
     aMtf.WindStart();
     aMtf.Play( pMaskedDevice );
-    BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), pMaskedDevice->GetOutputSizePixel() ) );
+    BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), aPaintRect.GetSize() ) );
     i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx );
     // get rid of virtual device now so they don't pile up during recursive calls
     pMaskedDevice.disposeAndClear();
@@ -1462,8 +1499,6 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
 
 void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& /*rSize*/ )
 {
-    // FIXME: scaling: currently this is for pixel copying only
-
     SAL_WARN_IF(  pDev->HasMirroredGraphics(), "vcl.window", "PaintToDevice to mirroring graphics" );
     SAL_WARN_IF(  pDev->IsRTLEnabled(), "vcl.window", "PaintToDevice to mirroring device" );
 
commit 7ca6096d38270e39eaf61c988aec13aa2eda8e74
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Sat Feb 10 13:24:21 2018 +0100

    lokdialog: Handle dialog items' invalidation in general
    
    Change-Id: Ib7b178fe97964bc5fd6ac173a143ba8ba089e237
    Reviewed-on: https://gerrit.libreoffice.org/49240
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit b33287cde2d270d83e2658529be768a99dba98f0)

diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 79e501721fb1..41f7c3ebb0d5 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -156,7 +156,6 @@ protected:
     virtual void    Paint( vcl::RenderContext& /*rRenderContext*/, const ::tools::Rectangle& rRect ) override;
     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) override;
     virtual void    Resize() override;
-    virtual void    LogicInvalidate(const ::tools::Rectangle* pRectangle) override;
 
 private:
 
@@ -313,25 +312,6 @@ void BackgroundPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt )
     Window::DataChanged( rDCEvt );
 }
 
-
-void BackgroundPreviewImpl::LogicInvalidate(const ::tools::Rectangle* /*pRectangle*/)
-{
-    // Invalidate the container dialog or floating window
-    // The code is same as in Control::LogicInvalidate() method
-    if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isDialogPainting())
-    {
-        if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
-        {
-            // invalidate the complete floating window for now
-            if (pParent->ImplIsFloatingWindow())
-                return pParent->LogicInvalidate(nullptr);
-
-            const ::tools::Rectangle aRect(Point(GetOutOffXPixel(), GetOutOffYPixel()), Size(GetOutputWidthPixel(), GetOutputHeightPixel()));
-            pParent->LogicInvalidate(&aRect);
-        }
-    }
-}
-
 #define HDL(hdl) LINK(this,SvxBackgroundTabPage,hdl)
 
 SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index 8e2926ae1774..cb68cfe8f78a 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -44,8 +44,6 @@ private:
 
     SAL_DLLPRIVATE void     ImplInitControlData();
 
-    virtual void            LogicInvalidate(const tools::Rectangle* pRectangle) override;
-
                             Control (const Control &) = delete;
                             Control & operator= (const Control &) = delete;
 
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 1f69c13da342..9e728e4a10ab 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -567,7 +567,7 @@ public:
 
     SAL_DLLPRIVATE bool                 ImplIsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
     SAL_DLLPRIVATE bool                 ImplIsChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
-                   bool                 ImplIsFloatingWindow() const;
+    SAL_DLLPRIVATE bool                 ImplIsFloatingWindow() const;
     SAL_DLLPRIVATE bool                 ImplIsPushButton() const;
     SAL_DLLPRIVATE bool                 ImplIsSplitter() const;
     SAL_DLLPRIVATE bool                 ImplIsOverlapWindow() const;
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index e4c68d700a7a..e1092fc7c572 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -416,24 +416,6 @@ void Control::ImplInitSettings()
     ApplySettings(*this);
 }
 
-void Control::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
-{
-    // Several repaint, resize invalidations are emitted when we are painting,
-    // ignore all of those
-    if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isDialogPainting())
-    {
-        if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
-        {
-            // invalidate the complete floating window for now
-            if (pParent->ImplIsFloatingWindow())
-                return pParent->LogicInvalidate(nullptr);
-
-            const tools::Rectangle aRect(Point(GetOutOffXPixel(), GetOutOffYPixel()), Size(GetOutputWidthPixel(), GetOutputHeightPixel()));
-            pParent->LogicInvalidate(&aRect);
-        }
-    }
-}
-
 tools::Rectangle Control::DrawControlText( OutputDevice& _rTargetDevice, const tools::Rectangle& rRect, const OUString& _rStr,
     DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize ) const
 {
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 256b2024af1f..fdd7029d2828 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1209,7 +1209,7 @@ void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
 
 void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
 {
-    if (comphelper::LibreOfficeKit::isDialogPainting())
+    if (comphelper::LibreOfficeKit::isDialogPainting() || !comphelper::LibreOfficeKit::isActive())
         return;
 
     if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
@@ -1221,6 +1221,12 @@ void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
 
         pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload);
     }
+    // Added for dialog items. Pass invalidation to the parent window.
+    else if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
+    {
+        const tools::Rectangle aRect(Point(GetOutOffXPixel(), GetOutOffYPixel()), Size(GetOutputWidthPixel(), GetOutputHeightPixel()));
+        pParent->LogicInvalidate(&aRect);
+    }
 }
 
 void Window::Validate()
commit a860ec6b4e567366c731e9aadbbd1ec85f0a072a
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Thu Feb 8 23:21:38 2018 +0100

    tdf#115394 correct transition in case of 0s
    
    Change-Id: I23d18acef0bd5db4a4ad6fc67d409e7ed5c93949
    Reviewed-on: https://gerrit.libreoffice.org/49462
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    (cherry picked from commit df835773fa8d66a1bd534c5b374ac27552751941)

diff --git a/include/oox/ppt/slidetransitioncontext.hxx b/include/oox/ppt/slidetransitioncontext.hxx
index 3361fd07a5a5..f6b2e7a91d56 100644
--- a/include/oox/ppt/slidetransitioncontext.hxx
+++ b/include/oox/ppt/slidetransitioncontext.hxx
@@ -47,6 +47,7 @@ namespace oox { namespace ppt {
     private:
         PropertyMap&                    maSlideProperties;
         bool                            mbHasTransition;
+        bool                            mbHasTransitionDuration;
         SlideTransition                 maTransition;
     };
 
diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx
index 7639df7c023b..94fc1c3862ae 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -47,6 +47,7 @@ SlideTransitionContext::SlideTransitionContext( FragmentHandler2 const & rParent
 : FragmentHandler2( rParent )
 , maSlideProperties( aProperties )
 , mbHasTransition( false )
+, mbHasTransitionDuration( false )
 {
     // ST_TransitionSpeed
     maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) );
@@ -54,7 +55,13 @@ SlideTransitionContext::SlideTransitionContext( FragmentHandler2 const & rParent
     // p14:dur
     sal_Int32 nDurationInMs = rAttribs.getInteger( P14_TOKEN( dur ), -1 );
     if( nDurationInMs > -1 )
+    {
+        // In MSO 0 is visible as 0.01s
+        if( nDurationInMs == 0.0 )
+            nDurationInMs = 10;
         maTransition.setOoxTransitionSpeed( nDurationInMs / 1000.0 );
+        mbHasTransitionDuration = true;
+    }
 
     // TODO
     rAttribs.getBool( XML_advClick, true );
@@ -182,7 +189,7 @@ void SlideTransitionContext::onEndElement()
 {
     if( isCurrentElement(PPT_TOKEN( transition )) )
     {
-        if( mbHasTransition )
+        if( mbHasTransition || mbHasTransitionDuration )
         {
             maTransition.setSlideProperties( maSlideProperties );
             mbHasTransition = false;
diff --git a/sd/qa/unit/data/pptx/tdf115394-zero.pptx b/sd/qa/unit/data/pptx/tdf115394-zero.pptx
new file mode 100644
index 000000000000..e8fb0cfa240c
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf115394-zero.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 1386966717f5..411eb5f1a09c 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -127,6 +127,7 @@ public:
     void testTdf107608();
     void testTdf111786();
     void testTdf115394();
+    void testTdf115394Zero();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -179,6 +180,7 @@ public:
     CPPUNIT_TEST(testTdf107608);
     CPPUNIT_TEST(testTdf111786);
     CPPUNIT_TEST(testTdf115394);
+    CPPUNIT_TEST(testTdf115394Zero);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1400,6 +1402,20 @@ void SdOOXMLExportTest2::testTdf115394()
     xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf115394Zero()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394-zero.pptx"), PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    double fTransitionDuration;
+
+    SdPage* pPage = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard);
+    fTransitionDuration = pPage->getTransitionDuration();
+    CPPUNIT_ASSERT_EQUAL(0.01, fTransitionDuration);
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 9ba23b0ac016..1ab1a7dc68ff 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -641,10 +641,6 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
         }
     }
 
-    // check if we resolved what transition to export
-    if (!nPPTTransitionType && !bOOXmlSpecificTransition)
-        return;
-
     AnimationSpeed animationSpeed = AnimationSpeed_MEDIUM;
     const char* speed = nullptr;
     sal_Int32 advanceTiming = -1;
@@ -703,6 +699,10 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
         }
     }
 
+    // check if we resolved what transition to export or time is set
+    if (!nPPTTransitionType && !bOOXmlSpecificTransition && !isTransitionDurationSet)
+        return;
+
     if (GETA(Change))
         mAny >>= changeType;
     bool isAdvanceTimingSet = advanceTiming != -1;
commit 32e187572335e6490b356d2535c0c6792094a023
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Thu Feb 8 18:06:06 2018 +0300

    tdf#108210: Allow to ignore a lock file if there's no filesystem lock
    
    Two cases are handled: when a file is being opened, and when it was
    opened read-only already, and one tries to reopen it in edit mode.
    The option to ignore locking and open the file anyway is only offered
    when there is no filesystem lock present on the file.
    
    Change-Id: I377d3cae4c949ae64d449634acea8fb3f68a5700
    Reviewed-on: https://gerrit.libreoffice.org/49448
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 2a7057250c8f73fdfb4c65a7525d17e9770459df)

diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
index 9fd18fda2782..a2a66640529c 100644
--- a/include/sfx2/docfile.hxx
+++ b/include/sfx2/docfile.hxx
@@ -162,11 +162,13 @@ public:
     bool                Commit();
     bool                IsStorage();
 
-    enum class ShowLockResult { NoLock, Succeeded,Try };
-    ShowLockResult      ShowLockedDocumentDialog( const LockFileEntry& aData, bool bIsLoading, bool bOwnLock, bool bHandleSysLocked);
-    void                LockOrigFileOnDemand( bool bLoading, bool bNoUI );
-    enum class MessageDlg    { LockFileIgnore, LockFileCorrupt };
-    bool                ShowLockFileProblemDialog(MessageDlg nWhichDlg);
+    enum class          LockFileResult
+    {
+        Failed,
+        FailedLockFile, // there was only lock file that prevented success - no syslock or IO error
+        Succeeded,
+    };
+    LockFileResult      LockOrigFileOnDemand( bool bLoading, bool bNoUI, bool bTryIgnoreLockFile = false );
     void                DisableUnlockWebDAV( bool bDisableUnlockWebDAV = true );
     void                UnlockFile( bool bReleaseLockStream );
 
@@ -273,6 +275,13 @@ public:
 
     static bool         SetWritableForUserOnly( const OUString& aURL );
     static sal_uInt32   CreatePasswordToModifyHash( const OUString& aPasswd, bool bWriter );
+
+private:
+    enum class ShowLockResult { NoLock, Succeeded, Try };
+    ShowLockResult      ShowLockedDocumentDialog(const LockFileEntry& aData, bool bIsLoading, bool bOwnLock, bool bHandleSysLocked);
+    enum class MessageDlg { LockFileIgnore, LockFileCorrupt };
+    bool                ShowLockFileProblemDialog(MessageDlg nWhichDlg);
+
 };
 
 #endif
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index d323efd25258..17d3c2a1859d 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -236,6 +236,9 @@
 #define STR_CANT_CLOSE                          NC_("STR_CANT_CLOSE", "The document cannot be closed because a\n print job is being carried out.")
 #define STR_ERROR_SEND_MAIL                     NC_("STR_ERROR_SEND_MAIL", "An error occurred in sending the message. Possible errors could be a missing user account or a defective setup.\nPlease check the %PRODUCTNAME settings or your e-mail program settings.")
 #define STR_QUERY_OPENASTEMPLATE                NC_("STR_QUERY_OPENASTEMPLATE", "This document cannot be edited, possibly due to missing access rights. Do you want to edit a copy of the document?")
+#define STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE   NC_("STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE", "This document cannot be edited, because it is locked in another session. Do you want to edit a copy of the document?\n\nYou can also try to ignore the lock and open the file for editing.")
+#define STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN   NC_("STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN", "Open ~Copy")
+#define STR_QUERY_OPENASTEMPLATE_OPEN_BTN       NC_("STR_QUERY_OPENASTEMPLATE_OPEN_BTN", "~Open")
 #define STR_REPAIREDDOCUMENT                    NC_("STR_REPAIREDDOCUMENT", " (repaired document)")
 #define STR_NONCHECKEDOUT_DOCUMENT              NC_("STR_NONCHECKEDOUT_DOCUMENT", "This document is not checked out on the server.")
 #define STR_READONLY_DOCUMENT                   NC_("STR_READONLY_DOCUMENT", "This document is open in read-only mode.")
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 757336c6ac1c..2d06bdf86ef6 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -844,6 +844,8 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const LockFileEnt
         OUString aInfo;
         ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl;
 
+        sal_Int32 nContinuations = 3;
+
         if ( bOwnLock )
         {
             aInfo = aData[LockFileComponent::EDITTIME];
@@ -867,12 +869,23 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const LockFileEnt
 
             xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
                 document::LockedDocumentRequest( OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo ) ) );
+
+            // Use a fourth continuation in case there's no filesystem lock:
+            // "Ignore lock file and open the document"
+            if (!bHandleSysLocked)
+                nContinuations = 4;
         }
 
-        uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
+        uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations(nContinuations);
         aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() );
         aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() );
         aContinuations[2] = new ::ucbhelper::InteractionDisapprove( xInteractionRequestImpl.get() );
+        if (nContinuations > 3)
+        {
+            // We use InteractionRetry to reflect that user wants to
+            // ignore the (stale?) alien lock file and open the document
+            aContinuations[3] = new ::ucbhelper::InteractionRetry(xInteractionRequestImpl.get());
+        }
         xInteractionRequestImpl->setContinuations( aContinuations );
 
         xHandler->handle( xInteractionRequestImpl.get() );
@@ -888,14 +901,19 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const LockFileEnt
             // own lock on saving, user has selected to ignore the lock
             // alien lock on loading, user has selected to edit a copy of document
             // TODO/LATER: alien lock on saving, user has selected to do SaveAs to different location
-            if ( bIsLoading && !bOwnLock )
+            if ( !bOwnLock ) // bIsLoading implied from outermost condition
             {
                 // means that a copy of the document should be opened
                 GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, true ) );
             }
-            else if ( bOwnLock )
+            else
                 nResult = ShowLockResult::Succeeded;
         }
+        else if (uno::Reference< task::XInteractionRetry >(xSelected.get(), uno::UNO_QUERY).is())
+        {
+            // User decided to ignore the alien (stale?) lock file without filesystem lock
+            nResult = ShowLockResult::Succeeded;
+        }
         else // if ( XSelected == aContinuations[1] )
         {
             // own lock on loading, user has selected to open readonly
@@ -990,12 +1008,16 @@ namespace
 
 // sets SID_DOC_READONLY if the document cannot be opened for editing
 // if user cancel the loading the ERROR_ABORT is set
-void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
+SfxMedium::LockFileResult SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI, bool bTryIgnoreLockFile )
 {
 #if !HAVE_FEATURE_MULTIUSER_ENVIRONMENT
     (void) bLoading;
     (void) bNoUI;
+    (void) bTryIgnoreLockFile;
+    return LockFileResult::Succeeded;
 #else
+    LockFileResult eResult = LockFileResult::Failed;
+
     // check if path scheme is http:// or https://
     // may be this is better if used always, in Android and iOS as well?
     // if this code should be always there, remember to move the relevant code in UnlockFile method as well !
@@ -1067,7 +1089,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
 
                             if ( !bResult && !bNoUI )
                             {
-                                bUIStatus = ShowLockedDocumentDialog( aLockData, bLoading, false , false );
+                                bUIStatus = ShowLockedDocumentDialog( aLockData, bLoading, false , true );
                             }
                         }
                         catch( ucb::InteractiveNetworkWriteException& )
@@ -1106,23 +1128,28 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
             // when the file is locked, get the current file date
             if ( bResult && DocNeedsFileDateCheck() )
                 GetInitFileDate( true );
+
+            if ( bResult )
+                eResult = LockFileResult::Succeeded;
         }
         catch ( const uno::Exception& )
         {
             SAL_WARN( "sfx.doc", "Locking exception: WebDAV while trying to lock the file" );
         }
-        return;
+        return eResult;
     }
 
-    if (!IsLockingUsed() || GetURLObject().HasError())
-        return;
+    if (!IsLockingUsed())
+        return LockFileResult::Succeeded;
+    if (GetURLObject().HasError())
+        return eResult;
 
     try
     {
         if ( pImpl->m_bLocked && bLoading
              && GetURLObject().GetProtocol() == INetProtocol::File )
         {
-            // if the document is already locked the system locking might be temporarely off after storing
+            // if the document is already locked the system locking might be temporarily off after storing
             // check whether the system file locking should be taken again
             GetLockingStream_Impl();
         }
@@ -1174,7 +1201,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
                         // let the stream be opened to check the system file locking
                         GetMedium_Impl();
                         if (GetError() != ERRCODE_NONE) {
-                            return;
+                            return eResult;
                         }
                     }
 
@@ -1200,15 +1227,6 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
                                 {
                                     bResult = aLockFile.CreateOwnLockFile();
                                 }
-                                catch (const ucb::InteractiveIOException&)
-                                {
-                                    if (bLoading && !bNoUI)
-                                    {
-                                        bIoErr = true;
-                                        ShowLockFileProblemDialog(MessageDlg::LockFileIgnore);
-                                        bResult = true;   // always delete the defect lock-file
-                                    }
-                                }
                                 catch (const uno::Exception&)
                                 {
                                     if (bLoading && !bNoUI)
@@ -1268,14 +1286,20 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
                                     }
                                 }
 
-                                if ( !bResult && !bNoUI && !bIoErr)
+                                if ( !bResult && !bIoErr)
                                 {
-                                    bUIStatus = ShowLockedDocumentDialog( aData, bLoading, bOwnLock, bHandleSysLocked );
+                                    if (!bNoUI)
+                                        bUIStatus = ShowLockedDocumentDialog(aData, bLoading, bOwnLock, bHandleSysLocked);
+                                    else if (bLoading && bTryIgnoreLockFile && !bHandleSysLocked)
+                                        bUIStatus = ShowLockResult::Succeeded;
+
                                     if ( bUIStatus == ShowLockResult::Succeeded )
                                     {
                                         // take the ownership over the lock file
                                         bResult = aLockFile.OverwriteOwnLockFile();
                                     }
+                                    else if (bLoading && !bHandleSysLocked)
+                                        eResult = LockFileResult::FailedLockFile;
                                 }
                             }
                         }
@@ -1309,11 +1333,16 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
         // when the file is locked, get the current file date
         if ( bResult && DocNeedsFileDateCheck() )
             GetInitFileDate( true );
+
+        if ( bResult )
+            eResult = LockFileResult::Succeeded;
     }
     catch( const uno::Exception& )
     {
         SAL_WARN( "sfx.doc", "Locking exception: high probability, that the content has not been created" );
     }
+
+    return eResult;
 #endif
 }
 
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 8f4d56792435..07a1c3b5fad4 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -134,6 +134,7 @@ using ::com::sun::star::container::XIndexContainer;
 #include <sfx2/minfitem.hxx>
 #include <sfx2/strings.hrc>
 #include "impviewframe.hxx"
+#include <vcl/msgbox.hxx>
 
 #define SfxViewFrame
 #include <sfxslots.hxx>
@@ -151,6 +152,7 @@ void SfxViewFrame::InitInterface_Impl()
 #endif
 }
 
+namespace {
 /// Asks the user if editing a read-only document is really wanted.
 class SfxEditDocumentDialog : public MessageDialog
 {
@@ -183,8 +185,31 @@ void SfxEditDocumentDialog::dispose()
     MessageDialog::dispose();
 }
 
+class SfxQueryOpenAsTemplate : public QueryBox
+{
+public:
+    SfxQueryOpenAsTemplate(vcl::Window* pParent, MessBoxStyle nStyle, bool bAllowIgnoreLock);
+};
+
+SfxQueryOpenAsTemplate::SfxQueryOpenAsTemplate(vcl::Window* pParent, MessBoxStyle nStyle, bool bAllowIgnoreLock)
+    : QueryBox(pParent, nStyle, SfxResId(bAllowIgnoreLock ? STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE : STR_QUERY_OPENASTEMPLATE))
+{
+    AddButton(SfxResId(STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN), RET_YES,
+        ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus);
+    SetButtonHelpText(RET_YES, OUString());
+
+    if (bAllowIgnoreLock)
+    {
+        AddButton(SfxResId(STR_QUERY_OPENASTEMPLATE_OPEN_BTN), RET_IGNORE);
+        SetButtonHelpText(RET_IGNORE, OUString());
+    }
+
+    AddButton(StandardButtonType::Cancel, RET_CANCEL);
+    SetButtonHelpText(RET_CANCEL, OUString());
+}
+
 /// Is this read-only object shell opened via .uno:SignPDF?
-static bool IsSignPDF(const SfxObjectShellRef& xObjSh)
+bool IsSignPDF(const SfxObjectShellRef& xObjSh)
 {
     if (!xObjSh.is())
         return false;
@@ -200,7 +225,7 @@ static bool IsSignPDF(const SfxObjectShellRef& xObjSh)
     return false;
 }
 
-static bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const OUString& aPath, const std::shared_ptr<const SfxFilter>& pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue >& aInfo )
+bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const OUString& aPath, const std::shared_ptr<const SfxFilter>& pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue >& aInfo )
 {
     // TODO/LATER: In future the info should replace the direct hash completely
     bool bResult = ( !nPasswordHash && !aInfo.getLength() );
@@ -248,6 +273,7 @@ static bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHa
 
     return bResult;
 }
+}
 
 void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 {
@@ -262,6 +288,23 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
             if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT ))
                 break;
 
+            // Only change read-only UI and remove info bar when we succeed
+            struct ReadOnlyUIGuard
+            {
+                SfxViewFrame* m_pFrame;
+                SfxObjectShell* m_pSh;
+                bool m_bSetRO;
+                ~ReadOnlyUIGuard()
+                {
+                    if (m_bSetRO != m_pSh->IsReadOnlyUI())
+                    {
+                        m_pSh->SetReadOnlyUI(m_bSetRO);
+                        if (!m_bSetRO)
+                            m_pFrame->RemoveInfoBar("readonly");
+                    }
+                }
+            } aReadOnlyUIGuard{ this, pSh, pSh->IsReadOnlyUI() };
+
             SfxMedium* pMed = pSh->GetMedium();
 
             const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(pSh->GetMedium()->GetItemSet(), SID_VIEWONLY, false);
@@ -311,7 +354,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                     }
                 }
                 nOpenMode = SFX_STREAM_READONLY;
-                pSh->SetReadOnlyUI();
+                aReadOnlyUIGuard.m_bSetRO = true;
             }
             else
             {
@@ -331,10 +374,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                     pSh->SetModifyPasswordEntered();
                 }
 
-                // Remove infobar if document was read-only (after password check)
-                RemoveInfoBar("readonly");
-
                 nOpenMode = pSh->IsOriginallyReadOnlyMedium() ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE;
+                aReadOnlyUIGuard.m_bSetRO = false;
 
                 // if only the view was in the readonly mode then there is no need to do the reload
                 if ( !pSh->IsReadOnlyMedium() )
@@ -343,12 +384,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                     // open mode among other things, so call SetOpenMode before
                     // SetReadOnlyUI:
                     pMed->SetOpenMode( nOpenMode );
-                    pSh->SetReadOnlyUI( false );
                     return;
                 }
-
-
-                pSh->SetReadOnlyUI( false );
             }
 
             if ( rReq.IsAPI() )
@@ -395,31 +432,58 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
             // <- tdf#82744
             {
                 bool bOK = false;
-                if ( !pVersionItem )
-                {
-                    bool bHasStorage = pMed->HasStorage_Impl();
-                    // switching edit mode could be possible without reload
-                    if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() )
+                bool bRetryIgnoringLock = false;
+                bool bOpenTemplate = false;
+                do {
+                    if ( !pVersionItem )
                     {
-                        // TODO/LATER: faster creation of copy
-                        if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) )
-                            return;
-                    }
+                        if (bRetryIgnoringLock)
+                            pMed->ResetError();
 
-                    pMed->CloseAndRelease();
-                    pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & StreamMode::WRITE ) ) );
-                    pMed->SetOpenMode( nOpenMode );
+                        bool bHasStorage = pMed->HasStorage_Impl();
+                        // switching edit mode could be possible without reload
+                        if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() )
+                        {
+                            // TODO/LATER: faster creation of copy
+                            if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) )
+                                return;
+                        }
+
+                        pMed->CloseAndRelease();
+                        pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & StreamMode::WRITE ) ) );
+                        pMed->SetOpenMode( nOpenMode );
 
-                    pMed->CompleteReOpen();
-                    if ( nOpenMode & StreamMode::WRITE )
-                        pMed->LockOrigFileOnDemand( false, true );
+                        pMed->CompleteReOpen();
+                        if ( nOpenMode & StreamMode::WRITE )
+                        {
+                             auto eResult = pMed->LockOrigFileOnDemand( true, true, bRetryIgnoringLock );
+                             bRetryIgnoringLock = eResult == SfxMedium::LockFileResult::FailedLockFile;
+                        }
+
+                        // LockOrigFileOnDemand might set the readonly flag itself, it should be set back
+                        pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & StreamMode::WRITE ) ) );
+
+                        if ( !pMed->GetErrorCode() )
+                            bOK = true;
+                    }
 
-                    // LockOrigFileOnDemand might set the readonly flag itself, it should be set back
-                    pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & StreamMode::WRITE ) ) );
+                    if( !bOK )
+                    {
+                        if (nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI())
+                        {
+                            // css::sdbcx::User offering to open it as a template
+                            ScopedVclPtrInstance<SfxQueryOpenAsTemplate> aBox(&GetWindow(), MessBoxStyle::NONE, bRetryIgnoringLock);
 
-                    if ( !pMed->GetErrorCode() )
-                        bOK = true;
+                            short nUserAnswer = aBox->Execute();
+                            bOpenTemplate = RET_YES == nUserAnswer;
+                            // Always reset this here to avoid infinite loop
+                            bRetryIgnoringLock = RET_IGNORE == nUserAnswer;
+                        }
+                        else
+                            bRetryIgnoringLock = false;
+                    }
                 }
+                while ( !bOK && bRetryIgnoringLock );
 
                 if( !bOK )
                 {
@@ -439,10 +503,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 
                     if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() )
                     {
-                        // css::sdbcx::User offering to open it as a template
-                        ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
-                                           VclMessageType::Question, VclButtonsType::YesNo);
-                        if ( RET_YES == aBox->Execute() )
+                        if ( bOpenTemplate )
                         {
                             SfxApplication* pApp = SfxGetpApp();
                             SfxAllItemSet aSet( pApp->GetPool() );
@@ -465,10 +526,13 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                             GetDispatcher()->Execute( SID_OPENDOC, SfxCallMode::ASYNCHRON, aSet );
                             return;
                         }
-                        else
-                            nErr = ERRCODE_NONE;
+
+                        nErr = ERRCODE_NONE;
                     }
 
+                    // Keep the read-only UI
+                    aReadOnlyUIGuard.m_bSetRO = true;
+
                     ErrorHandler::HandleError( nErr );
                     rReq.SetReturnValue(
                         SfxBoolItem( rReq.GetSlot(), false ) );
diff --git a/uui/inc/strings.hrc b/uui/inc/strings.hrc
index 760402c1d57b..590a582eba06 100644
--- a/uui/inc/strings.hrc
+++ b/uui/inc/strings.hrc
@@ -47,7 +47,8 @@
 #define STR_LOCKFAILED_OPENREADONLY_BTN         NC_("STR_LOCKFAILED_OPENREADONLY_BTN", "Open ~Read-Only")
 
 #define STR_OPENLOCKED_TITLE                    NC_("STR_OPENLOCKED_TITLE", "Document in Use")
-#define STR_OPENLOCKED_MSG                      NC_("STR_OPENLOCKED_MSG", "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nOpen document read-only or open a copy of the document for editing.\n\n")
+#define STR_OPENLOCKED_MSG                      NC_("STR_OPENLOCKED_MSG", "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nOpen document read-only or open a copy of the document for editing.\n\n$(ARG3)")
+#define STR_OPENLOCKED_ALLOWIGNORE_MSG          NC_("STR_OPENLOCKED_ALLOWIGNORE_MSG", "You may also ignore the file locking and open the document for editing.\n\n")
 #define STR_OPENLOCKED_OPENREADONLY_BTN         NC_("STR_OPENLOCKED_OPENREADONLY_BTN", "Open ~Read-Only")
 #define STR_OPENLOCKED_OPENCOPY_BTN             NC_("STR_OPENLOCKED_OPENCOPY_BTN", "Open ~Copy")
 #define STR_UNKNOWNUSER                         NC_("STR_UNKNOWNUSER", "Unknown User")
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
index 53b0e6a2fc77..08b5b5c7fd99 100644
--- a/uui/source/iahndl-locking.cxx
+++ b/uui/source/iahndl-locking.cxx
@@ -29,6 +29,7 @@
 #include <com/sun/star/task/XInteractionDisapprove.hpp>
 #include <com/sun/star/task/XInteractionAbort.hpp>
 #include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
 
 #include <unotools/resmgr.hxx>
 #include <vcl/svapp.hxx>
@@ -66,7 +67,9 @@ handleLockedDocumentRequest_(
     uno::Reference< task::XInteractionApprove > xApprove;
     uno::Reference< task::XInteractionDisapprove > xDisapprove;
     uno::Reference< task::XInteractionAbort > xAbort;
-    getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort);
+    // In case an option to ignore lock and open the file is available
+    uno::Reference< task::XInteractionRetry > xRetry;
+    getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort, &xRetry);
 
     if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() )
         return;
@@ -86,11 +89,14 @@ handleLockedDocumentRequest_(
             aArguments.push_back( !aInfo.isEmpty()
                                   ? aInfo
                                   : Translate::get( STR_UNKNOWNUSER, aResLocale) );
+            aArguments.push_back( xRetry.is()
+                                  ? Translate::get( STR_OPENLOCKED_ALLOWIGNORE_MSG, aResLocale )
+                                  : "" );
             aMessage = Translate::get(STR_OPENLOCKED_MSG, aResLocale);
             aMessage = UUIInteractionHelper::replaceMessageWithArguments(
                 aMessage, aArguments );
 
-            ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, aResLocale, aMessage);
+            ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, aResLocale, aMessage, xRetry.is());
             nResult = xDialog->Execute();
         }
         else if ( nMode == UUI_DOC_SAVE_LOCK )
@@ -128,6 +134,8 @@ handleLockedDocumentRequest_(
             xApprove->select();
         else if ( nResult == RET_NO )
             xDisapprove->select();
+        else if ( nResult == RET_IGNORE && xRetry.is() )
+            xRetry->select();
         else
             xAbort->select();
     }
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 67f28e089e51..2d7be0930178 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -246,10 +246,11 @@ UUIInteractionHelper::replaceMessageWithArguments(
     OUString aMessage = _aMessage;
 
     SAL_WARN_IF(rArguments.size() == 0, "uui", "replaceMessageWithArguments: No arguments passed!");
-    if (rArguments.size() > 0)
-        aMessage = aMessage.replaceAll("$(ARG1)", rArguments[0]);
-    if (rArguments.size() > 1)
-        aMessage = aMessage.replaceAll("$(ARG2)", rArguments[1]);
+    for (size_t i = 0; i < rArguments.size(); ++i)
+    {
+        const OUString sReplaceTemplate = "$(ARG" + OUString::number(i+1) + ")";
+        aMessage = aMessage.replaceAll(sReplaceTemplate, rArguments[i]);
+    }
 
     return aMessage;
 }
diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx
index 074242b964b8..3267610b78d1 100644
--- a/uui/source/openlocked.cxx
+++ b/uui/source/openlocked.cxx
@@ -21,7 +21,7 @@
 #include "openlocked.hxx"
 #include <unotools/resmgr.hxx>
 
-OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage ) :
+OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bEnableOverride ) :
     MessBox(pParent, MessBoxStyle::NONE, 0,
             Translate::get(STR_OPENLOCKED_TITLE, rResLocale),
             aMessage )
@@ -30,13 +30,19 @@ OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale&
 
     AddButton(Translate::get(STR_OPENLOCKED_OPENREADONLY_BTN, rResLocale), RET_YES,
             ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus);
+    SetButtonHelpText(RET_YES, OUString());
 
     AddButton(Translate::get(STR_OPENLOCKED_OPENCOPY_BTN, rResLocale), RET_NO);
+    SetButtonHelpText(RET_NO, OUString());
 
-    AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel );
-    SetButtonHelpText( RET_YES, OUString() );
-    SetButtonHelpText( RET_NO, OUString() );
+    if (bEnableOverride)
+    {
+        // Present option to ignore the (stale?) lock file and open the document
+        AddButton(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rResLocale), RET_IGNORE);
+        SetButtonHelpText(RET_IGNORE, OUString());
+    }
 
+    AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel );
 }
 
 OpenLockedQueryBox::~OpenLockedQueryBox()
diff --git a/uui/source/openlocked.hxx b/uui/source/openlocked.hxx
index 8584c45c2c7e..bb80a3c64146 100644
--- a/uui/source/openlocked.hxx
+++ b/uui/source/openlocked.hxx
@@ -24,7 +24,7 @@
 class OpenLockedQueryBox : public MessBox
 {
 public:
-    OpenLockedQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& rMessage);
+    OpenLockedQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride);
     virtual ~OpenLockedQueryBox() override;
 };
 
commit 318f4e7d06681a664e7cb52589f130fa5628a350
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Feb 8 21:36:07 2018 +0200

    Fix exception message: add colon between function name and the word "expected"
    
    (cherry picked from commit 7d56128654457bfc859217c23a957d1712fd6e1c)
    
    Change-Id: I80eadaa097afdbe4394aceca9f40b9753792f30b

diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index 355da85b9bed..614b4b4b9cf6 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -608,8 +608,8 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>&
         {
             throw IllegalArgumentException(
                 "incorrect number of parameters passed invoking function " + FunctionName +
-                "expected " + OUString::number(nFParamsLen) + ", got " + OUString::number(InParams.getLength()),
-                static_cast<OWeakObject *>(this), (sal_Int16) 1 );
+                ": expected " + OUString::number(nFParamsLen) + ", got " + OUString::number(InParams.getLength()),
+                static_cast<OWeakObject *>(this), sal_Int16(1) );
         }
 
         // IN Parameter
commit 238316748ca29caf29ec69eca9b1a50ad36fa1af
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Feb 8 19:31:20 2018 +0200

    Decrease fragility in odd use cases with no current document
    
    Change-Id: I9966166561d4c6e577f3f7e8e04572f97a0b295e
    Reviewed-on: https://gerrit.libreoffice.org/49450
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 73256b918119e378c762f6a3d79d04f311a075cc)

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index bebdc0ca1619..f68d541d69a9 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -409,7 +409,10 @@ uno::Reference< vba::XVBACompatibility > getVBACompatibility( const uno::Referen
 
 bool getDefaultVBAMode( StarBASIC* pb )
 {
-    uno::Reference< vba::XVBACompatibility > xVBACompat = getVBACompatibility( getDocumentModel( pb ) );
+    uno::Reference< frame::XModel > xModel( getDocumentModel( pb ) );
+    if (!xModel.is())
+        return false;
+    uno::Reference< vba::XVBACompatibility > xVBACompat = getVBACompatibility( xModel );
     return xVBACompat.is() && xVBACompat->getVBACompatibilityMode();
 }
 
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 60056ef40b6a..2ed78493be97 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -184,7 +184,9 @@ VbaApplicationBase::~VbaApplicationBase()
 sal_Bool SAL_CALL
 VbaApplicationBase::getScreenUpdating()
 {
-    uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+    uno::Reference< frame::XModel > xModel = getCurrentDocument();
+    if (!xModel.is())
+        return false;
     return !xModel->hasControllersLocked();
 }
 
@@ -238,7 +240,9 @@ VbaApplicationBase::setDisplayStatusBar(sal_Bool bDisplayStatusBar)
 
 sal_Bool SAL_CALL VbaApplicationBase::getInteractive()
 {
-    uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+    uno::Reference< frame::XModel > xModel = getCurrentDocument();
+    if (!xModel.is())
+        return false;
     uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
     uno::Reference< awt::XWindow2 > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY_THROW );
 
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 82cd2bf197c0..0b07f2a57ba1 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -277,7 +277,13 @@ getCurrentWordDoc( const uno::Reference< uno::XComponentContext >& xContext )
     }
     catch (const uno::Exception&)
     {
-        xModel = getThisWordDoc( xContext );
+        try
+        {
+            xModel = getThisWordDoc( xContext );
+        }
+        catch (const uno::Exception&)
+        {
+        }
     }
     return xModel;
 }
commit a82c57de51e8cfa06a744d9cc29cbece50443a7c
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Feb 8 12:51:29 2018 +0200

    Add debug output operator for IID
    
    This file is the place for future similar additions.
    
    Change-Id: Ibe168731ed97fe2366afb89409fe5ae2afa711e4
    (cherry picked from commit ceb082c94fd1a8bb308a2c2699699b1fc0f0e7fb)

diff --git a/include/comphelper/windowsdebugoutput.hxx b/include/comphelper/windowsdebugoutput.hxx
new file mode 100644
index 000000000000..5efda11e7271
--- /dev/null
+++ b/include/comphelper/windowsdebugoutput.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/* Debug output operators for Windows-specific types. For use in SAL_INFO(), SAL_WARN(), and
+ * friends. The exact format of the generated output is not guaranteed to be stable or contain
+ * complete information.
+ */
+
+#ifndef INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX
+#define INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX
+
+#include <ostream>
+#include <prewin.h>
+#include <postwin.h>
+#include <rtl/ustring.hxx>
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
+                                                     const IID& rIid)
+{
+    LPOLESTR pRiid;
+    if (StringFromIID(rIid, &pRiid) != S_OK)
+        return stream << "?";
+
+    // TODO: Maybe look up a descriptive name for the service or interface, from HKCR\CLSID or
+    // HKCR\Interface?
+
+    stream << OUString(reinterpret_cast<sal_Unicode*>(pRiid));
+    CoTaskMemFree(pRiid);
+    return stream;
+}
+
+#endif // INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 24b0de3f0e71515b49dcb4a039cfe492ec384b26
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 7 21:23:42 2018 +0530

    sd, sc lok: IME support + unit tests
    
    Reviewed-on: https://gerrit.libreoffice.org/49385
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit b746577d27437f9298fa111512d083eaccd4fbed)
    
    Change-Id: I710ba4347977641102b89fd274a159d34bc29e72

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 135f74064afa..de3b098a496d 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -107,7 +107,7 @@ public:
      *
      * @see lok::Document::postExtTextInputEvent().
      */
-    virtual void postExtTextInputEvent(int /*nType*/, const OUString& /*rText*/) {}
+    virtual void postExtTextInputEvent(int nType, const OUString& rText) = 0;
 
     /**
      * Posts a mouse event on the document.
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index ecb7cf494763..ff348af3c68c 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -318,6 +318,9 @@ public:
     /// @see vcl::ITiledRenderable::postKeyEvent().
     virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) override;
 
+    /// @see vcl::ITiledRenderable::postExtTextInputEvent().
+    virtual void postExtTextInputEvent(int nType, const OUString& rText) override;
+
     /// @see vcl::ITiledRenderable::postMouseEvent().
     virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override;
 
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 7d80d8349ded..3a9f9b74b3c3 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -89,6 +89,7 @@ public:
     void testDocumentRepair();
     void testLanguageStatus();
     void testMultiViewCopyPaste();
+    void testIMESupport();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnSelections);
@@ -119,6 +120,7 @@ public:
     CPPUNIT_TEST(testDocumentRepair);
     CPPUNIT_TEST(testLanguageStatus);
     CPPUNIT_TEST(testMultiViewCopyPaste);
+    CPPUNIT_TEST(testIMESupport);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1560,6 +1562,39 @@ void ScTiledRenderingTest::testMultiViewCopyPaste()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void ScTiledRenderingTest::testIMESupport()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    ScModelObj* pModelObj = createDoc("empty.ods");
+    ScDocument* pDoc = pModelObj->GetDocument();
+
+    ScTabViewShell* pView = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+    CPPUNIT_ASSERT(pView);
+
+    pView->SetCursor(0, 0);
+    // sequence of chineese IME compositions when 'nihao' is typed in an IME
+    const std::vector<OString> aUtf8Inputs{ "年", "你", "你好", "你哈", "你好", "你好" };
+    std::vector<OUString> aInputs;
+    std::transform(aUtf8Inputs.begin(), aUtf8Inputs.end(),
+                   std::back_inserter(aInputs), [](OString aInput) {
+                       return OUString::fromUtf8(aInput);
+                   });
+    for (const auto& aInput: aInputs)
+    {
+        pModelObj->postExtTextInputEvent(LOK_EXT_TEXTINPUT, aInput);
+    }
+    pModelObj->postExtTextInputEvent(LOK_EXT_TEXTINPUT_END, "");
+
+    // commit the string to the cell
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN);
+
+    CPPUNIT_ASSERT_EQUAL(aInputs[aInputs.size() - 1], pDoc->GetString(ScAddress(0, 0, 0)));
+
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index d5560485bc62..5f3a5d6d942a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -44,6 +44,7 @@
 #include <sfx2/printer.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
+#include <vcl/commandevent.hxx>
 #include <vcl/pdfextoutdevdata.hxx>
 #include <vcl/waitobj.hxx>
 #include <unotools/charclass.hxx>
@@ -618,6 +619,30 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode)
     }
 }
 
+void ScModelObj::postExtTextInputEvent(int nType, const OUString& rText)
+{
+    SolarMutexGuard aGuard;
+
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    vcl::Window* pWindow = pViewData->GetActiveWin();
+
+    if (!pWindow)
+        return;
+
+    CommandExtTextInputData aTextInputData(rText, nullptr, 0, 0, false);
+    switch (nType)
+    {
+    case LOK_EXT_TEXTINPUT:
+        pWindow->PostExtTextInputEvent(VclEventId::ExtTextInput, rText);
+        break;
+    case LOK_EXT_TEXTINPUT_END:
+        pWindow->PostExtTextInputEvent(VclEventId::EndExtTextInput, "");
+        break;
+    default:
+        assert(false && "Unhandled External Text input event!");
+    }
+}
+
 void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
 {
     SolarMutexGuard aGuard;
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index f5899f450ffd..338859bb2242 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -111,6 +111,7 @@ public:
     void testTdf115783();
     void testTdf115873();
     void testTdf115873Group();
+    void testIMESupport();
 
     CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -154,6 +155,7 @@ public:
     CPPUNIT_TEST(testTdf115783);
     CPPUNIT_TEST(testTdf115873);
     CPPUNIT_TEST(testTdf115873Group);
+    CPPUNIT_TEST(testIMESupport);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2062,6 +2064,46 @@ void SdTiledRenderingTest::testTdf115873Group()
     CPPUNIT_ASSERT(pObjects->IsEqualToDoc(pXImpressDocument->GetDoc()));
 }
 
+void SdTiledRenderingTest::testIMESupport()
+{
+    // Load the document with notes view.
+    comphelper::LibreOfficeKit::setActive();
+
+    SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    SdrObject* pObject = pViewShell->GetActualPage()->GetObj(0);
+    SdrTextObj* pTextObj = static_cast<SdrTextObj*>(pObject);
+    SdrView* pView = pViewShell->GetView();
+    pView->MarkObj(pTextObj, pView->GetSdrPageView());
+    SfxStringItem aInputString(SID_ATTR_CHAR, "x");
+    pViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(SID_ATTR_CHAR,
+                                                             SfxCallMode::SYNCHRON, { &aInputString });
+
+    // sequence of chineese IME compositions when 'nihao' is typed in an IME
+    const std::vector<OString> aUtf8Inputs{ "年", "你", "你好", "你哈", "你好", "你好" };
+    std::vector<OUString> aInputs;
+    std::transform(aUtf8Inputs.begin(), aUtf8Inputs.end(),
+                   std::back_inserter(aInputs), [](OString aInput) {
+                       return OUString::fromUtf8(aInput);
+                   });
+    for (const auto& aInput: aInputs)
+    {
+        pXImpressDocument->postExtTextInputEvent(LOK_EXT_TEXTINPUT, aInput);
+    }
+    pXImpressDocument->postExtTextInputEvent(LOK_EXT_TEXTINPUT_END, "");
+
+    // the cursor should be at position 3rd
+    EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView();
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), rEditView.GetSelection().nStartPos);
+
+    ESelection aWordSelection(0, 0, 0, 3); // start para, start char, end para, end char.
+    rEditView.SetSelection(aWordSelection);
+    // content contains only the last IME composition, not all
+    CPPUNIT_ASSERT_EQUAL(OUString("x").concat(aInputs[aInputs.size() - 1]), rEditView.GetSelected());
+
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 404c34c49b72..ff55748e3122 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -246,6 +246,8 @@ public:
     virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) override;
     /// @see vcl::ITiledRenderable::postKeyEvent().
     virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) override;
+    /// @see vcl::ITiledRenderable::postExtTextInputEvent().
+    virtual void postExtTextInputEvent(int nType, const OUString& rText) override;
     /// @see vcl::ITiledRenderable::postMouseEvent().
     virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override;
     /// @see vcl::ITiledRenderable::setTextSelection().

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list