[Libreoffice-commits] core.git: 2 commits - desktop/Library_sofficeapp.mk desktop/source vcl/source

Jan Holesovsky kendy at collabora.com
Fri Sep 11 09:57:48 PDT 2015


 desktop/Library_sofficeapp.mk                |    2 
 desktop/source/lib/init.cxx                  |   19 +++++-
 desktop/source/lib/lokinteractionhandler.cxx |   83 +++++++++++++++++++++++++++
 desktop/source/lib/lokinteractionhandler.hxx |   70 ++++++++++++++++++++++
 vcl/source/window/paint.cxx                  |    2 
 5 files changed, 173 insertions(+), 3 deletions(-)

New commits:
commit f1f179ba0ff3d293e81c7b95554f8e6b140340d7
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Sep 11 18:46:53 2015 +0200

    LOK: Implement an own trivial InteractionHandler.
    
    So far it just selects 'Approve' for any interaction that is done through
    that, later we want to route the information via callbacks to the caller.
    
    Change-Id: I7ae3e2dcc04877b8b0197b0396299126e1217a2a

diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 103581f..eec7e42 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -123,6 +123,7 @@ endif
 ifneq ($(filter $(OS),ANDROID IOS MACOSX),)
 $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
 	desktop/source/lib/init \
+	desktop/source/lib/lokinteractionhandler \
 	$(if $(filter $(OS),ANDROID), \
 		desktop/source/lib/lokandroid) \
 ))
@@ -130,6 +131,7 @@ else
 ifeq ($(GUIBASE),unx)
 $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
 	desktop/source/lib/init \
+	desktop/source/lib/lokinteractionhandler \
 ))
 endif
 endif
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index be1a018..fb8ec3e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -71,6 +71,8 @@
 #include "../app/officeipcthread.hxx"
 #include "../../inc/lib/init.hxx"
 
+#include "lokinteractionhandler.hxx"
+
 using namespace css;
 using namespace vcl;
 using namespace desktop;
@@ -385,11 +387,26 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 
     try
     {
-        uno::Sequence<css::beans::PropertyValue> aFilterOptions(1);
+        uno::Sequence<css::beans::PropertyValue> aFilterOptions(2);
         aFilterOptions[0] = css::beans::PropertyValue( OUString("FilterOptions"),
                                                        0,
                                                        uno::makeAny(OUString::createFromAscii(pOptions)),
                                                        beans::PropertyState_DIRECT_VALUE);
+
+        uno::Reference<task::XInteractionHandler2> xInteraction(new LOKInteractionHandler(::comphelper::getProcessComponentContext()));
+        aFilterOptions[1].Name = "InteractionHandler";
+        aFilterOptions[1].Value <<= xInteraction;
+
+        /* TODO
+        sal_Int16 nMacroExecMode = document::MacroExecMode::USE_CONFIG;
+        aFilterOptions[2].Name = "MacroExecutionMode";
+        aFilterOptions[2].Value <<= nMacroExecMode;
+
+        sal_Int16 nUpdateDoc = document::UpdateDocMode::ACCORDING_TO_CONFIG;
+        aFilterOptions[3].Name = "UpdateDocMode";
+        aFilterOptions[3].Value <<= nUpdateDoc;
+        */
+
         uno::Reference<lang::XComponent> xComponent;
         xComponent = xComponentLoader->loadComponentFromURL(
                                             aURL, OUString("_blank"), 0,
diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx
new file mode 100644
index 0000000..1d20b02
--- /dev/null
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "lokinteractionhandler.hxx"
+
+#include <cppuhelper/supportsservice.hxx>
+
+#include <com/sun/star/task/XInteractionApprove.hpp>
+
+using namespace com::sun::star;
+
+LOKInteractionHandler::LOKInteractionHandler(uno::Reference<uno::XComponentContext> const & /*rxContext*/)
+{
+}
+
+LOKInteractionHandler::~LOKInteractionHandler()
+{
+}
+
+OUString SAL_CALL LOKInteractionHandler::getImplementationName() throw (uno::RuntimeException, std::exception)
+{
+    return OUString("com.sun.star.comp.uui.LOKInteractionHandler");
+}
+
+sal_Bool SAL_CALL LOKInteractionHandler::supportsService(OUString const & rServiceName) throw (uno::RuntimeException, std::exception)
+{
+    return cppu::supportsService(this, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL LOKInteractionHandler::getSupportedServiceNames() throw (uno::RuntimeException, std::exception)
+{
+    uno::Sequence< OUString > aNames(3);
+    aNames[0] = "com.sun.star.task.InteractionHandler";
+    // added to indicate support for configuration.backend.MergeRecoveryRequest
+    aNames[1] = "com.sun.star.configuration.backend.InteractionHandler";
+    aNames[2] = "com.sun.star.uui.InteractionHandler";
+    // for backwards compatibility
+    return aNames;
+}
+
+void SAL_CALL LOKInteractionHandler::initialize(uno::Sequence<uno::Any> const & /*rArguments*/) throw (uno::Exception, std::exception)
+{
+}
+
+void SAL_CALL LOKInteractionHandler::handle(uno::Reference<task::XInteractionRequest> const & rRequest) throw (uno::RuntimeException, std::exception)
+{
+    // just do the same thing in both cases
+    handleInteractionRequest(rRequest);
+}
+
+sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest(const uno::Reference<task::XInteractionRequest >& rRequest) throw ( uno::RuntimeException, std::exception )
+{
+    uno::Sequence<uno::Reference<task::XInteractionContinuation>> const &rContinuations = rRequest->getContinuations();
+
+    // TODO: add LOK api that allows handling this for real, for the moment we
+    // just set the interaction as 'Approved'
+    for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+    {
+        uno::Reference<task::XInteractionApprove> xApprove(rContinuations[i], uno::UNO_QUERY);
+        if (xApprove.is())
+            xApprove->select();
+    }
+
+    return sal_True;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/lib/lokinteractionhandler.hxx b/desktop/source/lib/lokinteractionhandler.hxx
new file mode 100644
index 0000000..6d4aa82
--- /dev/null
+++ b/desktop/source/lib/lokinteractionhandler.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DESKTOP_SOURCE_LIB_LOKINTERACTIONHANDLER_HXX
+#define INCLUDED_DESKTOP_SOURCE_LIB_LOKINTERACTIONHANDLER_HXX
+
+#include <cppuhelper/implbase.hxx>
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/task/InteractionHandler.hpp>
+
+/** InteractionHandler is an interface that provides the user with various dialogs / error messages.
+
+We need an own implementation for the LibreOfficeKit so that we can route the
+information easily via callbacks.
+
+TODO: the callbacks are not implemented yet, we just approve any interaction
+that we get.
+*/
+class LOKInteractionHandler: public cppu::WeakImplHelper<com::sun::star::lang::XServiceInfo,
+                                                         com::sun::star::lang::XInitialization,
+                                                         com::sun::star::task::XInteractionHandler2>
+{
+    LOKInteractionHandler(const LOKInteractionHandler&) SAL_DELETED_FUNCTION;
+    LOKInteractionHandler& operator=(const LOKInteractionHandler&) SAL_DELETED_FUNCTION;
+
+public:
+    explicit LOKInteractionHandler(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const & rxContext);
+
+    virtual ~LOKInteractionHandler();
+
+    virtual OUString SAL_CALL getImplementationName()
+        throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual sal_Bool SAL_CALL supportsService(OUString const & rServiceName)
+        throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual com::sun::star::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual void SAL_CALL initialize(com::sun::star::uno::Sequence<com::sun::star::uno::Any > const & rArguments)
+        throw (com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
+
+    virtual void SAL_CALL handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const & rRequest)
+        throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual sal_Bool SAL_CALL handleInteractionRequest(const ::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& _Request)
+        throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 560e2ea8512be606c330cf8f858c67694f690a52
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Sep 8 18:49:20 2015 +0200

    tdf#93480: Don't send an EMPTY Invalidate() on .uno:DefaultBullet.
    
    When there was no modification to the document, and .uno:DefaultBullet was
    sent, we have got an invalidtion of the entire document.
    
    It seems that Invalidate() was not supposed to be called in the Validate()
    call, and instead, we should rely on what the Validate() invalidates :-)
    
    Change-Id: Ia65df90e4ff34078b59c1b2eb1ce1faac790b40d

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 8fc4c23..74c74db 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1252,12 +1252,10 @@ void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
 
 void Window::Validate( ValidateFlags nFlags )
 {
-
     if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) )
         return;
 
     ImplValidate( NULL, nFlags );
-    LogicInvalidate(0);
 }
 
 bool Window::HasPaintEvent() const


More information about the Libreoffice-commits mailing list