[Libreoffice-commits] core.git: Branch 'distro/escriba/escriba-5.2' - 3 commits - offapi/com solenv/gbuild sw/inc sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jul 28 10:21:22 UTC 2017


 offapi/com/sun/star/text/TextRangeContentProperties.idl |    6 ++++
 solenv/gbuild/platform/filter-showIncludes.awk          |    7 ++++
 sw/inc/cmdid.h                                          |    1 
 sw/inc/unoprnms.hxx                                     |    1 
 sw/qa/extras/uiwriter/data/paragraph-of-text-range.odt  |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                      |   23 ++++++++++++++++
 sw/source/core/unocore/unocrsrhelper.cxx                |   13 +++++++++
 sw/source/core/unocore/unomapproperties.hxx             |    1 
 sw/source/uibase/inc/unodispatch.hxx                    |    7 ++++
 sw/source/uibase/uno/unodispatch.cxx                    |   10 ++++++
 10 files changed, 68 insertions(+), 1 deletion(-)

New commits:
commit 28927faf2c90e19b2a1b0b220712f088923f34c2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jul 27 13:59:01 2017 +0200

    sw: add new TextParagraph property to XTextRange
    
    A text range represents a selection or cursor position, so similar to
    sections or tables, it makes sense to expose the containing paragraph as
    well. This new property does exactly that.
    
    Reviewed-on: https://gerrit.libreoffice.org/40483
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 7ed402ba648dd0f3de3b0dadebc13403b2c0a620)
    
    Conflicts:
            sw/qa/extras/uiwriter/uiwriter.cxx
    
    Change-Id: If92a3b5e61f13c7c14ca52bc8593a2b286a596cc

diff --git a/offapi/com/sun/star/text/TextRangeContentProperties.idl b/offapi/com/sun/star/text/TextRangeContentProperties.idl
index 042b4d5b3736..9daad2e139dc 100644
--- a/offapi/com/sun/star/text/TextRangeContentProperties.idl
+++ b/offapi/com/sun/star/text/TextRangeContentProperties.idl
@@ -81,6 +81,12 @@ service TextRangeContentProperties
     [optional, readonly, property] com::sun::star::text::XTextContent
         NestedTextContent;
 
+    /** Paragraph for the start of this range.
+
+        @since LibreOffice 6.0
+     */
+    [optional, readonly, property] com::sun::star::text::XTextContent TextParagraph;
+
 };
 
 
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 09cd1f48513c..6f1ec12ee124 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -544,6 +544,7 @@
 #define FN_UNO_FOOTER                       (FN_EXTRA2 + 38)
 #define FN_UNO_FOOTER_LEFT                  (FN_EXTRA2 + 39)
 #define FN_UNO_FOOTER_RIGHT                 (FN_EXTRA2 + 40)
+#define FN_UNO_TEXT_PARAGRAPH               (FN_EXTRA2 + 41)
 #define FN_UNO_FOLLOW_STYLE                 (FN_EXTRA2 + 59)
 
 #define FN_API_CALL                         (FN_EXTRA2 + 60)
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 63589f273ce5..1c1371222bc6 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -384,6 +384,7 @@
 #define UNO_NAME_FOOTER_BODY_DISTANCE "FooterBodyDistance"
 #define UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT "FooterIsDynamicHeight"
 #define UNO_NAME_FOOTER_IS_SHARED "FooterIsShared"
+#define UNO_NAME_TEXT_PARAGRAPH "TextParagraph"
 
 #define UNO_NAME_FOOTER_HEIGHT "FooterHeight"
 #define UNO_NAME_FOOTER_IS_ON "FooterIsOn"
diff --git a/sw/qa/extras/uiwriter/data/paragraph-of-text-range.odt b/sw/qa/extras/uiwriter/data/paragraph-of-text-range.odt
new file mode 100644
index 000000000000..52cdb0be1ff2
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/paragraph-of-text-range.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index bbd16708152c..36c1a5a10199 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -201,6 +201,7 @@ public:
     void testTdf84695NormalChar();
     void testTdf78727();
     void testTdf104814();
+    void testParagraphOfTextRange();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -304,6 +305,7 @@ public:
     CPPUNIT_TEST(testTdf84695NormalChar);
     CPPUNIT_TEST(testTdf78727);
     CPPUNIT_TEST(testTdf104814);
+    CPPUNIT_TEST(testParagraphOfTextRange);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3730,6 +3732,27 @@ void SwUiWriterTest::testTdf104814()
         pEditShell->AcceptRedline(0);
 }
 
+void SwUiWriterTest::testParagraphOfTextRange()
+{
+    SwDoc* pDoc = createDoc("paragraph-of-text-range.odt");
+
+    // Enter the table.
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->Down(/*bSelect=*/false);
+    CPPUNIT_ASSERT(pWrtShell->IsCursorInTable());
+    // Enter the section.
+    pWrtShell->Down(/*bSelect=*/false);
+    CPPUNIT_ASSERT(pWrtShell->IsDirectlyInSection());
+
+    // Assert that we get the right paragraph object.
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextViewCursorSupplier> xController(xModel->getCurrentController(), uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xViewCursor(xController->getViewCursor(), uno::UNO_QUERY);
+    // This failed as there were no TextParagraph property.
+    auto xParagraph = getProperty< uno::Reference<text::XTextRange> >(xViewCursor->getStart(), "TextParagraph");
+    CPPUNIT_ASSERT_EQUAL(OUString("In section"), xParagraph->getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 22b41fed67fc..83646a892b97 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -85,6 +85,7 @@
 #include <SwNodeNum.hxx>
 #include <fmtmeta.hxx>
 #include <txtfld.hxx>
+#include <unoparagraph.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -592,6 +593,18 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
                 eNewState = PropertyState_DEFAULT_VALUE;
         }
         break;
+        case FN_UNO_TEXT_PARAGRAPH:
+        {
+            SwTextNode* pTextNode = rPam.GetPoint()->nNode.GetNode().GetTextNode();
+            if (pTextNode)
+            {
+                uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode);
+                *pAny <<= xParagraph;
+            }
+            else
+                eNewState = PropertyState_DEFAULT_VALUE;
+        }
+        break;
         case FN_UNO_ENDNOTE:
         case FN_UNO_FOOTNOTE:
         {
diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx
index 1f528f0ba596..8580ba0c8805 100644
--- a/sw/source/core/unocore/unomapproperties.hxx
+++ b/sw/source/core/unocore/unomapproperties.hxx
@@ -87,6 +87,7 @@
         { OUString(UNO_NAME_CELL), FN_UNO_CELL,         cppu::UnoType<css::table::XCell>::get(),         PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },                     \
         { OUString(UNO_NAME_TEXT_FRAME), FN_UNO_TEXT_FRAME,     cppu::UnoType<css::text::XTextFrame>::get(),        PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },                     \
         { OUString(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, cppu::UnoType<css::text::XTextSection>::get(),  PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },                    \
+        { OUString(UNO_NAME_TEXT_PARAGRAPH), FN_UNO_TEXT_PARAGRAPH, cppu::UnoType<css::text::XTextContent>::get(),  PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },                    \
         { OUString(UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL), FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL,cppu::UnoType<sal_Int8>::get(), PROPERTY_NONE, 0},                                                     \
         { OUString(UNO_NAME_PARA_CONDITIONAL_STYLE_NAME), FN_UNO_PARA_CONDITIONAL_STYLE_NAME, cppu::UnoType<OUString>::get(),      PropertyAttribute::READONLY, 0},                                                     \
         { OUString(UNO_NAME_LIST_ID), FN_UNO_LIST_ID, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, \
commit 6e856335678034e40d3cade38ef4d856948b46a0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 26 15:50:09 2017 +0200

    gbuild: strip away unexpected CR char at the end of Windows filenames
    
    As reported at e.g.
    <https://ask.libreoffice.org/en/question/90346/building-libreoffice-in-cygwin-leads-to-infinite-loop/>,
    sometimes MSVC (seen with 2013 on libreoffice-5-2, but there is no
    indication that 2015 on master would be different) emits CR characters
    at the end of filenames, resulting in unnecessary rebuilds at per-module
    builds, and actually to an infinite loop when doing toplevel make.
    
    Given that CR characters are unexpected in any filenames, it should be
    safe to just strip those away unconditionally.
    
    Change-Id: I3d56670b4d930a32489f889085711bfd436de82a
    Reviewed-on: https://gerrit.libreoffice.org/40452
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit e9b9a456221b4b0660f90efa1ee092ea00c2c728)

diff --git a/solenv/gbuild/platform/filter-showIncludes.awk b/solenv/gbuild/platform/filter-showIncludes.awk
index 21a458521308..05a9a2c8d5ec 100755
--- a/solenv/gbuild/platform/filter-showIncludes.awk
+++ b/solenv/gbuild/platform/filter-showIncludes.awk
@@ -44,6 +44,13 @@ BEGIN {
     if (index($0, showincludes_prefix) == 1) {
         $0 = substr($0, length(showincludes_prefix) + 1)
         sub(/^ */, "")
+
+        # The output from MSVC may contain a carriage return character at the
+        # end of filenames, in which case the translation unit will depend on a
+        # non-existing header, resulting in constant rebuild of all files,
+        # prevent that.
+        sub(/
/, "")
+
         gsub(/\\/, "/")
         gsub(/ /, "\\ ")
         if ($0 ~ whitelist) { # filter out system headers
commit 958891883e9bc4024405981695e6236b23aef5c3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 6 12:34:08 2016 +0200

    SwXDispatchProviderInterceptor: implement frame::XInterceptorInfo
    
    With this, framework::InterceptionHelper can make a better decision what
    interceptor to call: it can avoid calling SwXDispatchProviderInterceptor
    when the sw code would just call the previous interceptor anyway.
    
    Change-Id: I92897f2c8baa264dc9ccbc11b63f415da30a910d
    Reviewed-on: https://gerrit.libreoffice.org/25961
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit b0d819ac5667a07f629f2acb5d3c542fa76d348b)

diff --git a/sw/source/uibase/inc/unodispatch.hxx b/sw/source/uibase/inc/unodispatch.hxx
index b115f7e49744..f5408d724fc4 100644
--- a/sw/source/uibase/inc/unodispatch.hxx
+++ b/sw/source/uibase/inc/unodispatch.hxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/view/XSelectionChangeListener.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XInterceptorInfo.hpp>
 #include <cppuhelper/implbase.hxx>
 #include <list>
 #include <vcl/svapp.hxx>
@@ -35,7 +36,8 @@ class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper
 <
     css::frame::XDispatchProviderInterceptor,
     css::lang::XEventListener,
-    css::lang::XUnoTunnel
+    css::lang::XUnoTunnel,
+    css::frame::XInterceptorInfo
 >
 {
     class DispatchMutexLock_Impl
@@ -83,6 +85,9 @@ public:
     static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
     virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException, std::exception) override;
 
+    // XInterceptorInfo
+    virtual css::uno::Sequence<OUString> SAL_CALL getInterceptedURLs() throw (css::uno::RuntimeException, std::exception) override;
+
     // view destroyed
     void    Invalidate();
 };
diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx
index 985f28387e2b..3335eebc4dfd 100644
--- a/sw/source/uibase/uno/unodispatch.cxx
+++ b/sw/source/uibase/uno/unodispatch.cxx
@@ -88,6 +88,16 @@ uno::Reference< frame::XDispatch > SwXDispatchProviderInterceptor::queryDispatch
     return xResult;
 }
 
+uno::Sequence<OUString> SAL_CALL SwXDispatchProviderInterceptor::getInterceptedURLs() throw (uno::RuntimeException, std::exception)
+{
+    uno::Sequence<OUString> aRet =
+    {
+         OUString(".uno:DataSourceBrowser/*")
+    };
+
+    return aRet;
+}
+
 uno::Sequence< uno::Reference< frame::XDispatch > > SwXDispatchProviderInterceptor::queryDispatches(
     const uno::Sequence< frame::DispatchDescriptor >& aDescripts ) throw(uno::RuntimeException, std::exception)
 {


More information about the Libreoffice-commits mailing list