parent
8c86133ae7
commit
e98b301446
File diff suppressed because one or more lines are too long
@ -1,36 +0,0 @@
|
|||||||
From a344462ccb324b14dbf17391146f78d84307cbec Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stephan Bergmann <sbergman@redhat.com>
|
|
||||||
Date: Tue, 22 Jun 2021 14:14:34 +0200
|
|
||||||
Subject: [PATCH] Remove unused DOCTYPE from odk/examples xcu file
|
|
||||||
|
|
||||||
The declared entities have apparently never been referenced ever since the
|
|
||||||
file's introduction in 9fa09d43d0dc0ec0ac71bad31b85ce7fc302ee90 "INTEGRATION:
|
|
||||||
CWS sdkinspector2". (And at least xmlreader skips and ignores the content of
|
|
||||||
such document type declarations anyway.)
|
|
||||||
|
|
||||||
Change-Id: I8263200f52bb5f1692090995574619f9c0ec478f
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117658
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
||||||
---
|
|
||||||
odk/examples/java/Inspector/ObjectInspector.xcu | 4 ----
|
|
||||||
1 file changed, 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/odk/examples/java/Inspector/ObjectInspector.xcu b/odk/examples/java/Inspector/ObjectInspector.xcu
|
|
||||||
index b7696086629c..d6fb08a0f8ce 100644
|
|
||||||
--- a/odk/examples/java/Inspector/ObjectInspector.xcu
|
|
||||||
+++ b/odk/examples/java/Inspector/ObjectInspector.xcu
|
|
||||||
@@ -16,10 +16,6 @@
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
||||||
-->
|
|
||||||
-<!DOCTYPE local [
|
|
||||||
- <!ENTITY ProductName "Object Inspector">
|
|
||||||
- <!ENTITY ProductVersion "0.8">
|
|
||||||
-]>
|
|
||||||
<oor:component-data
|
|
||||||
xmlns:oor="http://openoffice.org/2001/registry"
|
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
@ -1,162 +0,0 @@
|
|||||||
From 366e9237399a948d2ef616b758d390bd7d0978a5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stephan Bergmann <sbergman@redhat.com>
|
|
||||||
Date: Mon, 31 May 2021 09:36:28 +0200
|
|
||||||
Subject: [PATCH] Replace inet_ntoa with inet_ntop
|
|
||||||
|
|
||||||
...as inet_ntoa is potentially not thread-safe; and add a test
|
|
||||||
|
|
||||||
Change-Id: I9df945b006ba7194c3b1444c4886101c08339ad0
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116425
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
||||||
(cherry picked from commit 33bf4f0bcf941ee4609f558442035514f54cbc8a)
|
|
||||||
|
|
||||||
and
|
|
||||||
|
|
||||||
Replace inet_addr with inet_pton
|
|
||||||
|
|
||||||
...as inet_addr is deprecated (it does not allow to distinguish successful
|
|
||||||
return for "255.255.255.255" from -1 error return); and update tests
|
|
||||||
|
|
||||||
Change-Id: I605cb2ba18fe9bd11d2d68c8f1c94271c4503509
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116441
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
||||||
(cherry picked from commit 1fef071c01caf6c293dd941ee7c8340e6894afc3)
|
|
||||||
|
|
||||||
fix leak in SocketTest
|
|
||||||
|
|
||||||
Change-Id: I8c5e2d4c4687beab08876fe3e945d19a1629bc36
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116514
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
||||||
(cherry picked from commit 313eaf979ea2d69e4ffa88a5e87cc09ffe0ff088)
|
|
||||||
---
|
|
||||||
sal/CppunitTest_sal_osl.mk | 1 +
|
|
||||||
sal/osl/unx/socket.cxx | 16 +++++++----
|
|
||||||
sal/qa/osl/socket.cxx | 58 ++++++++++++++++++++++++++++++++++++++
|
|
||||||
3 files changed, 70 insertions(+), 5 deletions(-)
|
|
||||||
create mode 100644 sal/qa/osl/socket.cxx
|
|
||||||
|
|
||||||
diff --git a/sal/CppunitTest_sal_osl.mk b/sal/CppunitTest_sal_osl.mk
|
|
||||||
index 2e4b77509f56..d8c2627d9e0f 100644
|
|
||||||
--- a/sal/CppunitTest_sal_osl.mk
|
|
||||||
+++ b/sal/CppunitTest_sal_osl.mk
|
|
||||||
@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sal_osl,\
|
|
||||||
sal/qa/osl/process/osl_Thread \
|
|
||||||
sal/qa/osl/profile/osl_old_testprofile \
|
|
||||||
sal/qa/osl/setthreadname/test-setthreadname \
|
|
||||||
+ sal/qa/osl/socket \
|
|
||||||
))
|
|
||||||
|
|
||||||
$(eval $(call gb_CppunitTest_use_libraries,sal_osl,\
|
|
||||||
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
|
|
||||||
index 56a8f6cd63ac..9fafc6d1db81 100644
|
|
||||||
--- a/sal/osl/unx/socket.cxx
|
|
||||||
+++ b/sal/osl/unx/socket.cxx
|
|
||||||
@@ -437,7 +437,10 @@ oslSocketAddr SAL_CALL osl_createInetBroadcastAddr (
|
|
||||||
&pDottedAddr, strDottedAddr->buffer, strDottedAddr->length,
|
|
||||||
RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
|
|
||||||
|
|
||||||
- nAddr = inet_addr (pDottedAddr->buffer);
|
|
||||||
+ in_addr buf;
|
|
||||||
+ if (inet_pton (AF_INET, pDottedAddr->buffer, &buf) == 1) {
|
|
||||||
+ nAddr = buf.s_addr;
|
|
||||||
+ }
|
|
||||||
rtl_string_release (pDottedAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -505,11 +508,11 @@ oslSocketAddr osl_psz_createInetSocketAddr (
|
|
||||||
sal_Int32 Port)
|
|
||||||
{
|
|
||||||
oslSocketAddr pAddr = nullptr;
|
|
||||||
- sal_Int32 Addr = inet_addr(pszDottedAddr);
|
|
||||||
- if(Addr != -1)
|
|
||||||
+ in_addr buf;
|
|
||||||
+ if(inet_pton(AF_INET, pszDottedAddr, &buf) == 1)
|
|
||||||
{
|
|
||||||
/* valid dotted addr */
|
|
||||||
- pAddr = createSocketAddrWithFamily( osl_Socket_FamilyInet, htons(Port) , Addr );
|
|
||||||
+ pAddr = createSocketAddrWithFamily( osl_Socket_FamilyInet, htons(Port) , buf.s_addr );
|
|
||||||
}
|
|
||||||
return pAddr;
|
|
||||||
}
|
|
||||||
@@ -1090,7 +1093,10 @@ oslSocketResult SAL_CALL osl_getDottedInetAddrOfSocketAddr(oslSocketAddr Addr, r
|
|
||||||
return osl_Socket_Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
- rtl_uString_newFromAscii(ustrDottedInetAddr,inet_ntoa(pSystemInetAddr->sin_addr));
|
|
||||||
+ char buf[INET_ADDRSTRLEN];
|
|
||||||
+ auto const text = inet_ntop(AF_INET, &pSystemInetAddr->sin_addr, buf, INET_ADDRSTRLEN);
|
|
||||||
+ assert(text != nullptr);
|
|
||||||
+ rtl_uString_newFromAscii(ustrDottedInetAddr,text);
|
|
||||||
|
|
||||||
return osl_Socket_Ok;
|
|
||||||
|
|
||||||
diff --git a/sal/qa/osl/socket.cxx b/sal/qa/osl/socket.cxx
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000000..ed31c9ede7ae
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/sal/qa/osl/socket.cxx
|
|
||||||
@@ -0,0 +1,58 @@
|
|
||||||
+/* -*- 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/.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <cppunit/TestAssert.h>
|
|
||||||
+#include <cppunit/TestFixture.h>
|
|
||||||
+#include <cppunit/extensions/HelperMacros.h>
|
|
||||||
+
|
|
||||||
+#include <osl/socket.h>
|
|
||||||
+#include <rtl/ustring.hxx>
|
|
||||||
+
|
|
||||||
+namespace
|
|
||||||
+{
|
|
||||||
+class SocketTest : public CppUnit::TestFixture
|
|
||||||
+{
|
|
||||||
+ CPPUNIT_TEST_SUITE(SocketTest);
|
|
||||||
+ CPPUNIT_TEST(test_createInetSocketAddr);
|
|
||||||
+ CPPUNIT_TEST(test_createInetBroadcastAddr);
|
|
||||||
+ CPPUNIT_TEST_SUITE_END();
|
|
||||||
+
|
|
||||||
+ void test_createInetSocketAddr()
|
|
||||||
+ {
|
|
||||||
+ OUString const in("123.4.56.78");
|
|
||||||
+ auto const addr = osl_createInetSocketAddr(in.pData, 100);
|
|
||||||
+ CPPUNIT_ASSERT(addr != nullptr);
|
|
||||||
+ CPPUNIT_ASSERT_EQUAL(osl_Socket_FamilyInet, osl_getFamilyOfSocketAddr(addr));
|
|
||||||
+ OUString out;
|
|
||||||
+ auto const res = osl_getDottedInetAddrOfSocketAddr(addr, &out.pData);
|
|
||||||
+ CPPUNIT_ASSERT_EQUAL(osl_Socket_Ok, res);
|
|
||||||
+ CPPUNIT_ASSERT_EQUAL(in, out);
|
|
||||||
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(100), osl_getInetPortOfSocketAddr(addr));
|
|
||||||
+ osl_destroySocketAddr(addr);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ void test_createInetBroadcastAddr()
|
|
||||||
+ {
|
|
||||||
+ OUString const in("123.4.56.78");
|
|
||||||
+ auto const addr = osl_createInetBroadcastAddr(in.pData, 100);
|
|
||||||
+ CPPUNIT_ASSERT(addr != nullptr);
|
|
||||||
+ CPPUNIT_ASSERT_EQUAL(osl_Socket_FamilyInet, osl_getFamilyOfSocketAddr(addr));
|
|
||||||
+ OUString out;
|
|
||||||
+ auto const res = osl_getDottedInetAddrOfSocketAddr(addr, &out.pData);
|
|
||||||
+ CPPUNIT_ASSERT_EQUAL(osl_Socket_Ok, res);
|
|
||||||
+ CPPUNIT_ASSERT_EQUAL(OUString("123.255.255.255"), out);
|
|
||||||
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(100), osl_getInetPortOfSocketAddr(addr));
|
|
||||||
+ osl_destroySocketAddr(addr);
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+CPPUNIT_TEST_SUITE_REGISTRATION(SocketTest);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +0,0 @@
|
|||||||
From 68a6c70f25762374f7aed0d4d755345c6f37c78d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stephan Bergmann <sbergman@redhat.com>
|
|
||||||
Date: Mon, 31 May 2021 10:56:38 +0200
|
|
||||||
Subject: [PATCH] Simplify construction of a hardcoded IPv4 address
|
|
||||||
|
|
||||||
Change-Id: I822313ee708935dd4ecb636c13a961fdd054d660
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116434
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
||||||
---
|
|
||||||
sd/source/ui/remotecontrol/DiscoveryService.cxx | 12 +-----------
|
|
||||||
1 file changed, 1 insertion(+), 11 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
|
|
||||||
index 9ed2ae727761..cf0043387403 100644
|
|
||||||
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
|
|
||||||
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
|
|
||||||
@@ -119,17 +119,7 @@ void DiscoveryService::setupSockets()
|
|
||||||
|
|
||||||
struct ip_mreq multicastRequest;
|
|
||||||
|
|
||||||
-// the Win32 SDK 8.1 deprecates inet_addr()
|
|
||||||
-#if defined(_WIN32)
|
|
||||||
- IN_ADDR addr;
|
|
||||||
- INT ret = InetPtonW(AF_INET, L"239.0.0.1", & addr);
|
|
||||||
- if (1 == ret)
|
|
||||||
- {
|
|
||||||
- multicastRequest.imr_multiaddr.s_addr = addr.S_un.S_addr;
|
|
||||||
- }
|
|
||||||
-#else
|
|
||||||
- multicastRequest.imr_multiaddr.s_addr = inet_addr( "239.0.0.1" );
|
|
||||||
-#endif
|
|
||||||
+ multicastRequest.imr_multiaddr.s_addr = htonl((239U << 24) | 1U); // 239.0.0.1
|
|
||||||
multicastRequest.imr_interface.s_addr = htonl(INADDR_ANY);
|
|
||||||
|
|
||||||
rc = setsockopt( mSocket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
|||||||
From 83bf31d8befdcf006323966fb6a6d4a1f32c64da Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Tue, 10 Aug 2021 09:19:04 +0100
|
|
||||||
Subject: [PATCH] fix detecting qrcodegen
|
|
||||||
|
|
||||||
Change-Id: I26813ca12967a52a30b0032965cf707dbee4b59a
|
|
||||||
---
|
|
||||||
configure.ac | 2 +-
|
|
||||||
cui/source/dialogs/QrCodeGenDialog.cxx | 39 ++++++++++++++++++++++++--
|
|
||||||
2 files changed, 38 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index b3aa9d6cb566..5895bfc26af2 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -10812,7 +10812,7 @@ else
|
|
||||||
AC_MSG_RESULT([external])
|
|
||||||
SYSTEM_QRCODEGEN=TRUE
|
|
||||||
AC_LANG_PUSH([C++])
|
|
||||||
- AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
|
|
||||||
+ AC_CHECK_HEADER(qrcodegencpp/qrcodegen.hpp, [],
|
|
||||||
[AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
|
|
||||||
AC_CHECK_LIB([qrcodegencpp], [main], [:],
|
|
||||||
[ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
|
|
||||||
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx
|
|
||||||
index 28bbfabcf845..7db4bc74da16 100644
|
|
||||||
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
|
|
||||||
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
|
|
||||||
@@ -19,7 +19,7 @@
|
|
||||||
|
|
||||||
#if ENABLE_QRCODEGEN
|
|
||||||
#if defined(SYSTEM_QRCODEGEN)
|
|
||||||
-#include <qrcodegen/QrCode.hpp>
|
|
||||||
+#include <qrcodegencpp/qrcodegen.hpp>
|
|
||||||
#else
|
|
||||||
#include <QrCode.hpp>
|
|
||||||
#endif
|
|
||||||
@@ -263,6 +263,41 @@ void QrCodeGenDialog::Apply()
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if ENABLE_QRCODEGEN
|
|
||||||
+static std::string toSvgString(const QrCode& qr, int border)
|
|
||||||
+{
|
|
||||||
+ if (border < 0)
|
|
||||||
+ throw std::domain_error("Border must be non-negative");
|
|
||||||
+ if (border > INT_MAX / 2 || border * 2 > INT_MAX - qr.getSize())
|
|
||||||
+ throw std::overflow_error("Border too large");
|
|
||||||
+
|
|
||||||
+ std::ostringstream sb;
|
|
||||||
+ sb << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
|
||||||
+ sb << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" "
|
|
||||||
+ "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
|
|
||||||
+ sb << "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 ";
|
|
||||||
+ sb << (qr.getSize() + border * 2) << " " << (qr.getSize() + border * 2)
|
|
||||||
+ << "\" stroke=\"none\">\n";
|
|
||||||
+ sb << "\t<rect width=\"100%\" height=\"100%\" fill=\"#FFFFFF\"/>\n";
|
|
||||||
+ sb << "\t<path d=\"";
|
|
||||||
+ for (int y = 0; y < qr.getSize(); y++)
|
|
||||||
+ {
|
|
||||||
+ for (int x = 0; x < qr.getSize(); x++)
|
|
||||||
+ {
|
|
||||||
+ if (qr.getModule(x, y))
|
|
||||||
+ {
|
|
||||||
+ if (x != 0 || y != 0)
|
|
||||||
+ sb << " ";
|
|
||||||
+ sb << "M" << (x + border) << "," << (y + border) << "h1v1h-1z";
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ sb << "\" fill=\"#000000\"/>\n";
|
|
||||||
+ sb << "</svg>\n";
|
|
||||||
+ return sb.str();
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, tools::Long aQRECC, int aQRBorder)
|
|
||||||
{
|
|
||||||
#if ENABLE_QRCODEGEN
|
|
||||||
@@ -299,7 +334,7 @@ OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, tools::Long aQRECC, i
|
|
||||||
|
|
||||||
// From QR Code library
|
|
||||||
qrcodegen::QrCode qr0 = qrcodegen::QrCode::encodeText(qrtext, bqrEcc);
|
|
||||||
- std::string svg = qr0.toSvgString(aQRBorder);
|
|
||||||
+ std::string svg = toSvgString(qr0, aQRBorder);
|
|
||||||
//cstring to OUString
|
|
||||||
return OUString::createFromAscii(svg.c_str());
|
|
||||||
#else
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
|||||||
From b06e5e2b9761d242d9269b091da9a98ec705d2b1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Tue, 1 Jun 2021 13:20:43 +0100
|
|
||||||
Subject: [PATCH] gtk3: workaround missing gdk_threads_enter calls in external
|
|
||||||
code
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
with gtk3 file dialog. file, open, +other locations,
|
|
||||||
type davs://somewhere + return
|
|
||||||
|
|
||||||
#0 0x00007ffff7a6e2a2 in raise () at /lib64/libc.so.6
|
|
||||||
#1 0x00007ffff7a578a4 in abort () at /lib64/libc.so.6
|
|
||||||
#2 0x00007ffff7a57789 in _nl_load_domain.cold () at /lib64/libc.so.6
|
|
||||||
#3 0x00007ffff7a66a16 in () at /lib64/libc.so.6
|
|
||||||
#4 0x00007fffd9be7672 in GtkYieldMutex::ThreadsLeave() (this=0x513480) at vcl/unx/gtk3/gtkinst.cxx:354
|
|
||||||
#5 0x00007fffd9be6a53 in GdkThreadsLeave() () at vcl/unx/gtk3/gtkinst.cxx:116
|
|
||||||
#6 0x00007fffd947ac2d in gtk_dialog_run (dialog=0xa984310) at /usr/src/debug/gtk3-3.24.29-1.fc34.x86_64/gtk/gtkdialog.c:1397
|
|
||||||
^^^ this also (see #30) calls gdk_threads_leave before g_main_loop_run, but no gdk_threads_enter has been called, presumably emit_show_error_message should have called it (?) ^^^
|
|
||||||
#7 0x00007fffd94a6dc6 in error_message_with_parent (detail=0xa97f9b0 "HTTP Error: Error resolving “nowhere”: Name or service not known", msg=<optimized out>, parent=<optimized out>)
|
|
||||||
at /usr/src/debug/gtk3-3.24.29-1.fc34.x86_64/gtk/gtkfilechooserwidget.c:763
|
|
||||||
#8 error_message (impl=<optimized out>, msg=<optimized out>, detail=0xa97f9b0 "HTTP Error: Error resolving “nowhere”: Name or service not known") at /usr/src/debug/gtk3-3.24.29-1.fc34.x86_64/gtk/gtkfilechooserwidget.c:786
|
|
||||||
#9 0x00007fffe996ec2f in g_closure_invoke () at /lib64/libgobject-2.0.so.0
|
|
||||||
#10 0x00007fffe998aea6 in signal_emit_unlocked_R () at /lib64/libgobject-2.0.so.0
|
|
||||||
#11 0x00007fffe998c76a in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
|
|
||||||
#12 0x00007fffe998c983 in g_signal_emit () at /lib64/libgobject-2.0.so.0
|
|
||||||
#13 0x00007fffd9561fc7 in emit_show_error_message (secondary_message=0x7fffbc0566f0 "HTTP Error: Error resolving “nowhere”: Name or service not known", primary_message=<optimized out>, view=0x900a240)
|
|
||||||
at /usr/src/debug/gtk3-3.24.29-1.fc34.x86_64/gtk/gtkplacesview.c:171
|
|
||||||
#14 server_mount_ready_cb (source_file=0x7fffbc05b4c0, res=<optimized out>, user_data=0x900a240) at /usr/src/debug/gtk3-3.24.29-1.fc34.x86_64/gtk/gtkplacesview.c:1232
|
|
||||||
#15 0x00007fffe9a64a7a in g_task_return_now () at /lib64/libgio-2.0.so.0
|
|
||||||
#16 0x00007fffe9a64c7b in g_task_return () at /lib64/libgio-2.0.so.0
|
|
||||||
#17 0x00007fffd80653b8 in mount_reply () at /usr/lib64/gio/modules/libgvfsdbus.so
|
|
||||||
#18 0x00007fffe9a64a7a in g_task_return_now () at /lib64/libgio-2.0.so.0
|
|
||||||
#19 0x00007fffe9a64c7b in g_task_return () at /lib64/libgio-2.0.so.0
|
|
||||||
#20 0x00007fffe9acd2dd in reply_cb () at /lib64/libgio-2.0.so.0
|
|
||||||
#21 0x00007fffe9a64a7a in g_task_return_now () at /lib64/libgio-2.0.so.0
|
|
||||||
#22 0x00007fffe9a64c7b in g_task_return () at /lib64/libgio-2.0.so.0
|
|
||||||
#23 0x00007fffe9ac4c34 in g_dbus_connection_call_done () at /lib64/libgio-2.0.so.0
|
|
||||||
#24 0x00007fffe9a64a7a in g_task_return_now () at /lib64/libgio-2.0.so.0
|
|
||||||
#25 0x00007fffe9a64abd in complete_in_idle_cb () at /lib64/libgio-2.0.so.0
|
|
||||||
#26 0x00007fffe987074b in g_idle_dispatch () at /lib64/libglib-2.0.so.0
|
|
||||||
#27 0x00007fffe98744cf in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
|
|
||||||
#28 0x00007fffe98c84e8 in g_main_context_iterate.constprop () at /lib64/libglib-2.0.so.0
|
|
||||||
#29 0x00007fffe9873a93 in g_main_loop_run () at /lib64/libglib-2.0.so.0
|
|
||||||
#30 0x00007fffd947ac37 in gtk_dialog_run (dialog=0x1604460) at /usr/src/debug/gtk3-3.24.29-1.fc34.x86_64/gtk/gtkdialog.c:1398
|
|
||||||
^^^ this will call gdk_threads_leave before g_main_loop_run, (gdk_threads_enter has been called earlier, and gdk_threads_enter will be called after g_main_loop_run) ^^^
|
|
||||||
#31 0x00007fffd9bdbd96 in RunDialog::run() (this=0x9134f00) at vcl/unx/gtk3/fpicker/SalGtkPicker.cxx:199
|
|
||||||
#32 0x00007fffd9bbf23f in SalGtkFilePicker::execute() (this=0x9004690) at vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:953
|
|
||||||
#33 0x00007ffff474741a in sfx2::FileDialogHelper_Impl::implDoExecute() (this=0x1667470) at sfx2/source/dialog/filedlghelper.cxx:1279
|
|
||||||
|
|
||||||
#14 presumably server_mount_ready_cb of gtkplacesview.c should protect its gtk
|
|
||||||
calls with gdk_threads_enter/gdk_threads_leave like enclosing_volume_mount_cb
|
|
||||||
of gtkfilesystem.c does.
|
|
||||||
|
|
||||||
Seeing as gdk_threads_leave/gdk_threads_enter is gone in gtk4 I doubt
|
|
||||||
there's any point looking for a fix in gtk3 and we should just try and
|
|
||||||
survive the problem.
|
|
||||||
|
|
||||||
Change-Id: I007be4dee4f615d4431e27034dcf7f3d446c3e9a
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116559
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
||||||
(cherry picked from commit 08b7529f628eda1d209cf27f9bbe52ee336fef62)
|
|
||||||
---
|
|
||||||
vcl/unx/gtk3/gtk3gtkinst.cxx | 30 ++++++++++++++++++++++--------
|
|
||||||
1 file changed, 22 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
index 2d4dc36ce5fe..bba4e07f3003 100644
|
|
||||||
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
@@ -314,20 +314,34 @@ thread_local std::stack<sal_uInt32> GtkYieldMutex::yieldCounts;
|
|
||||||
void GtkYieldMutex::ThreadsEnter()
|
|
||||||
{
|
|
||||||
acquire();
|
|
||||||
- if (!yieldCounts.empty()) {
|
|
||||||
- auto n = yieldCounts.top();
|
|
||||||
- yieldCounts.pop();
|
|
||||||
- assert(n > 0);
|
|
||||||
- n--;
|
|
||||||
- if (n > 0)
|
|
||||||
- acquire(n);
|
|
||||||
+ if (yieldCounts.empty())
|
|
||||||
+ return;
|
|
||||||
+ auto n = yieldCounts.top();
|
|
||||||
+ yieldCounts.pop();
|
|
||||||
+
|
|
||||||
+ const bool bUndoingLeaveWithoutEnter = n == 0;
|
|
||||||
+ // if the ThreadsLeave bLeaveWithoutEnter of true condition occurred to
|
|
||||||
+ // create this entry then return early undoing the initial acquire of the
|
|
||||||
+ // function
|
|
||||||
+ if G_UNLIKELY(bUndoingLeaveWithoutEnter)
|
|
||||||
+ {
|
|
||||||
+ release();
|
|
||||||
+ return;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ assert(n > 0);
|
|
||||||
+ n--;
|
|
||||||
+ if (n > 0)
|
|
||||||
+ acquire(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GtkYieldMutex::ThreadsLeave()
|
|
||||||
{
|
|
||||||
- assert(m_nCount != 0);
|
|
||||||
+ const bool bLeaveWithoutEnter = m_nCount == 0;
|
|
||||||
+ SAL_WARN_IF(bLeaveWithoutEnter, "vcl.gtk", "gdk_threads_leave without matching gdk_threads_enter");
|
|
||||||
yieldCounts.push(m_nCount);
|
|
||||||
+ if G_UNLIKELY(bLeaveWithoutEnter) // this ideally shouldn't happen, but can due to the gtk3 file dialog
|
|
||||||
+ return;
|
|
||||||
release(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
From f586051919d047e2b67d32637817c3d96a898494 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Wed, 9 Jun 2021 09:13:23 +0100
|
|
||||||
Subject: [PATCH] math.desktop include "Spreadsheet" category
|
|
||||||
|
|
||||||
but it's not a spreadsheet
|
|
||||||
|
|
||||||
since...
|
|
||||||
|
|
||||||
commit dad7fe7227fb80a32d3c2c777584dc9d74b9e929
|
|
||||||
Date: Thu Jan 2 16:16:55 2014 +0100
|
|
||||||
|
|
||||||
Fix math categories to make SUSE rpm check happy
|
|
||||||
|
|
||||||
Change-Id: I0397ea12cd7f29f4b0c1f0e0ad76a3429b55c455
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116884
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
|
|
||||||
(cherry picked from commit 2df2ce1b51d13bc9e203fab1b7eb3c88c906588c)
|
|
||||||
---
|
|
||||||
sysui/desktop/menus/math.desktop | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sysui/desktop/menus/math.desktop b/sysui/desktop/menus/math.desktop
|
|
||||||
index d2391be5c234..5a8192ae4abc 100644
|
|
||||||
--- a/sysui/desktop/menus/math.desktop
|
|
||||||
+++ b/sysui/desktop/menus/math.desktop
|
|
||||||
@@ -21,7 +21,7 @@ Terminal=false
|
|
||||||
NoDisplay=false
|
|
||||||
Icon=math
|
|
||||||
Type=Application
|
|
||||||
-Categories=Office;Spreadsheet;Education;Science;Math;X-Red-Hat-Base;X-MandrivaLinux-Office-Other;
|
|
||||||
+Categories=Office;Education;Science;Math;X-Red-Hat-Base;X-MandrivaLinux-Office-Other;
|
|
||||||
Exec=${UNIXBASISROOTNAME} --math %%FILE%%
|
|
||||||
MimeType=application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math;application/vnd.oasis.opendocument.formula-template;text/mathml;application/mathml+xml;
|
|
||||||
Name=%PRODUCTNAME Math
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From 8b8a49e14c1010c5ab325b64fc3b65524a6a6049 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Wed, 20 Jan 2021 09:19:25 +0000
|
|
||||||
Subject: [PATCH] rhbz#1918152 fix FTBFS
|
|
||||||
|
|
||||||
Change-Id: I5c03c810d3b2572b0e58c62293add49bd7025e70
|
|
||||||
---
|
|
||||||
vcl/source/gdi/bitmap3.cxx | 2 --
|
|
||||||
1 file changed, 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
|
|
||||||
index ec80b03c6008..8ea5c31bee3e 100644
|
|
||||||
--- a/vcl/source/gdi/bitmap3.cxx
|
|
||||||
+++ b/vcl/source/gdi/bitmap3.cxx
|
|
||||||
@@ -17,8 +17,6 @@
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
||||||
*/
|
|
||||||
|
|
||||||
-#include <math.h>
|
|
||||||
-
|
|
||||||
#include <vcl/bitmapaccess.hxx>
|
|
||||||
#include <vcl/bitmapex.hxx>
|
|
||||||
#include <vcl/bitmap.hxx>
|
|
||||||
--
|
|
||||||
2.28.0
|
|
||||||
|
|
@ -1,428 +0,0 @@
|
|||||||
From aec3e189e6e9aa1eb2fe91cbb1c46f308b074cd5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Tue, 13 Jul 2021 12:38:07 +0100
|
|
||||||
Subject: [PATCH] rhbz#1980800 allow --convert-to csv to write each sheet to a
|
|
||||||
separate file
|
|
||||||
|
|
||||||
Related: tdf#135762 except only currently implemented for command line use
|
|
||||||
|
|
||||||
sample usage:
|
|
||||||
soffice --convert-to csv:"Text - txt - csv (StarCalc)":44,34,UTF8,1,,0,false,true,false,false,false,-1 sample.ods
|
|
||||||
where the new (11th!) final token ("-1") enables writing each sheet to a
|
|
||||||
new file based on the suggested target name so output in this example
|
|
||||||
is files sample-Sheet1.csv and sample-Sheet2.csv
|
|
||||||
|
|
||||||
Only -1 for 'all sheets' vs 0 for existing 'current sheet only' (which
|
|
||||||
is always sheet 0 from the command line) are currently options but the
|
|
||||||
token could be expanded in the future to select specific sheets to
|
|
||||||
export.
|
|
||||||
|
|
||||||
Change-Id: Ib99a120f1a2c8d1008a7a3c59a6b39f572fb346e
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118850
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Eike Rathke <erack@redhat.com>
|
|
||||||
(cherry picked from commit b8903bc106dad036acb3d117e5c4fc955697fe02)
|
|
||||||
|
|
||||||
Related: tdf#135762 Allow --convert-to csv to specify 1-based sheet number
|
|
||||||
|
|
||||||
Same multifile mechanism as for -1 all sheets is used, so
|
|
||||||
|
|
||||||
soffice --convert-to csv:"Text - txt - csv (StarCalc)":44,34,UTF8,1,,0,false,true,false,false,false,2 sample.ods
|
|
||||||
|
|
||||||
writes a file sample-Sheet2.csv
|
|
||||||
|
|
||||||
Change-Id: Ib9248c9561e4e340c88458ac5dfd159e443a4cfd
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118971
|
|
||||||
Reviewed-by: Eike Rathke <erack@redhat.com>
|
|
||||||
Tested-by: Jenkins
|
|
||||||
(cherry picked from commit fda91f8be16ba760e360940ebafd6244c648cb8c)
|
|
||||||
|
|
||||||
Related: tdf#135762 Suppress cout if not command line
|
|
||||||
|
|
||||||
Change-Id: I9431221aadf97739bb197871f25fa151ef4c391c
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119294
|
|
||||||
Reviewed-by: Eike Rathke <erack@redhat.com>
|
|
||||||
Tested-by: Jenkins
|
|
||||||
(cherry picked from commit 0cda081c9aa3b3dcb363f97bac60c845ce9a13e0)
|
|
||||||
---
|
|
||||||
desktop/source/app/dispatchwatcher.cxx | 50 +++++++--
|
|
||||||
sc/source/ui/dbgui/imoptdlg.cxx | 16 ++-
|
|
||||||
sc/source/ui/docshell/docsh.cxx | 141 +++++++++++++++++++++----
|
|
||||||
sc/source/ui/inc/docsh.hxx | 2 +-
|
|
||||||
sc/source/ui/inc/imoptdlg.hxx | 6 +-
|
|
||||||
5 files changed, 179 insertions(+), 36 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
|
|
||||||
index 50b92ecb7834..3df4f34ccf83 100644
|
|
||||||
--- a/desktop/source/app/dispatchwatcher.cxx
|
|
||||||
+++ b/desktop/source/app/dispatchwatcher.cxx
|
|
||||||
@@ -30,6 +30,7 @@
|
|
||||||
#include "officeipcthread.hxx"
|
|
||||||
#include <rtl/ustring.hxx>
|
|
||||||
#include <comphelper/processfactory.hxx>
|
|
||||||
+#include <comphelper/string.hxx>
|
|
||||||
#include <comphelper/synchronousdispatch.hxx>
|
|
||||||
#include <com/sun/star/io/IOException.hpp>
|
|
||||||
#include <com/sun/star/util/XCloseable.hpp>
|
|
||||||
@@ -598,6 +599,8 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
|
|
||||||
aFilter = impl_GuessFilter( aOutFile, aDocService );
|
|
||||||
}
|
|
||||||
|
|
||||||
+ bool bMultiFileTarget = false;
|
|
||||||
+
|
|
||||||
if (aFilter.isEmpty())
|
|
||||||
{
|
|
||||||
std::cerr << "Error: no export filter" << std::endl;
|
|
||||||
@@ -605,29 +608,54 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sal_Int32 nFilterOptionsIndex = aFilter.indexOf(':');
|
|
||||||
- sal_Int32 nProps = ( 0 < nFilterOptionsIndex ) ? 3 : 2;
|
|
||||||
+ sal_Int32 nProps = ( 0 < nFilterOptionsIndex ) ? 4 : 3;
|
|
||||||
|
|
||||||
if ( !aImgOut.isEmpty() )
|
|
||||||
nProps +=1;
|
|
||||||
Sequence<PropertyValue> conversionProperties( nProps );
|
|
||||||
- conversionProperties[0].Name = "Overwrite";
|
|
||||||
- conversionProperties[0].Value <<= true;
|
|
||||||
+ conversionProperties[0].Name = "ConversionRequestOrigin";
|
|
||||||
+ conversionProperties[0].Value <<= OUString("CommandLine");
|
|
||||||
+ conversionProperties[1].Name = "Overwrite";
|
|
||||||
+ conversionProperties[1].Value <<= true;
|
|
||||||
|
|
||||||
- conversionProperties[1].Name = "FilterName";
|
|
||||||
+ conversionProperties[2].Name = "FilterName";
|
|
||||||
if( 0 < nFilterOptionsIndex )
|
|
||||||
{
|
|
||||||
- conversionProperties[1].Value <<= aFilter.copy(0, nFilterOptionsIndex);
|
|
||||||
+ OUString sFilterName = aFilter.copy(0, nFilterOptionsIndex);
|
|
||||||
+ OUString sFilterOptions = aFilter.copy(nFilterOptionsIndex + 1);
|
|
||||||
+
|
|
||||||
+ if (sFilterName == "Text - txt - csv (StarCalc)")
|
|
||||||
+ {
|
|
||||||
+ sal_Int32 nIdx(0);
|
|
||||||
+ // If the 11th token is '-1' then we export a file
|
|
||||||
+ // per sheet where the file name is based on the suggested
|
|
||||||
+ // output filename concatenated with the sheet name, so adjust
|
|
||||||
+ // the output and overwrite messages
|
|
||||||
+ // If the 11th token is not present or numeric 0 then the
|
|
||||||
+ // default sheet is exported with the output filename. If it
|
|
||||||
+ // is numeric >0 then that sheet (1-based) with the output
|
|
||||||
+ // filename concatenated with the sheet name. So even if
|
|
||||||
+ // that is a single file, the multi file target mechanism is
|
|
||||||
+ // used.
|
|
||||||
+ const OUString aTok(sFilterOptions.getToken(11, ',', nIdx));
|
|
||||||
+ // Actual validity is checked in Calc, here just check for
|
|
||||||
+ // presence of numeric value at start.
|
|
||||||
+ bMultiFileTarget = (!aTok.isEmpty() && aTok.toInt32() != 0);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ conversionProperties[2].Value <<= sFilterName;
|
|
||||||
|
|
||||||
- conversionProperties[2].Name = "FilterOptions";
|
|
||||||
- conversionProperties[2].Value <<= aFilter.copy(nFilterOptionsIndex + 1);
|
|
||||||
+ conversionProperties[3].Name = "FilterOptions";
|
|
||||||
+ conversionProperties[3].Value <<= sFilterOptions;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- conversionProperties[1].Value <<= aFilter;
|
|
||||||
+ conversionProperties[2].Value <<= aFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !aImgOut.isEmpty() )
|
|
||||||
{
|
|
||||||
+ assert(conversionProperties[nProps-1].Name.isEmpty());
|
|
||||||
conversionProperties[nProps-1].Name = "ImageFilter";
|
|
||||||
conversionProperties[nProps-1].Value <<= aImgOut;
|
|
||||||
}
|
|
||||||
@@ -639,9 +667,11 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
|
|
||||||
OString aTargetURL8 = OUStringToOString(aTempName, osl_getThreadTextEncoding());
|
|
||||||
if (aDispatchRequest.aRequestType != REQUEST_CAT)
|
|
||||||
{
|
|
||||||
- std::cout << "convert " << aSource8 << " -> " << aTargetURL8;
|
|
||||||
+ std::cout << "convert " << aSource8;
|
|
||||||
+ if (!bMultiFileTarget)
|
|
||||||
+ std::cout << " -> " << aTargetURL8;
|
|
||||||
std::cout << " using filter : " << OUStringToOString(aFilter, osl_getThreadTextEncoding()) << std::endl;
|
|
||||||
- if (FStatHelper::IsDocument(aOutFile))
|
|
||||||
+ if (!bMultiFileTarget && FStatHelper::IsDocument(aOutFile))
|
|
||||||
std::cout << "Overwriting: " << OUStringToOString(aTempName, osl_getThreadTextEncoding()) << std::endl ;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx
|
|
||||||
index 071f1b0257bc..a362e4df0ee7 100644
|
|
||||||
--- a/sc/source/ui/dbgui/imoptdlg.cxx
|
|
||||||
+++ b/sc/source/ui/dbgui/imoptdlg.cxx
|
|
||||||
@@ -20,6 +20,7 @@
|
|
||||||
#include <imoptdlg.hxx>
|
|
||||||
#include <asciiopt.hxx>
|
|
||||||
#include <comphelper/string.hxx>
|
|
||||||
+#include <unotools/charclass.hxx>
|
|
||||||
#include <osl/thread.h>
|
|
||||||
#include <global.hxx>
|
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ ScImportOptions::ScImportOptions( const OUString& rStr )
|
|
||||||
bSaveNumberAsSuch = true;
|
|
||||||
bSaveFormulas = false;
|
|
||||||
bRemoveSpace = false;
|
|
||||||
+ nSheetToExport = 0;
|
|
||||||
sal_Int32 nTokenCount = comphelper::string::getTokenCount(rStr, ',');
|
|
||||||
if ( nTokenCount < 3 )
|
|
||||||
return;
|
|
||||||
@@ -77,6 +79,16 @@ ScImportOptions::ScImportOptions( const OUString& rStr )
|
|
||||||
bSaveFormulas = rStr.getToken(0, ',', nIdx) == "true";
|
|
||||||
if ( nTokenCount >= 11 )
|
|
||||||
bRemoveSpace = rStr.getToken(0, ',', nIdx) == "true";
|
|
||||||
+ if ( nTokenCount >= 12 )
|
|
||||||
+ {
|
|
||||||
+ const OUString aTok(rStr.getToken(0, ',', nIdx));
|
|
||||||
+ if (aTok == "-1")
|
|
||||||
+ nSheetToExport = -1; // all
|
|
||||||
+ else if (aTok.isEmpty() || CharClass::isAsciiNumeric(aTok))
|
|
||||||
+ nSheetToExport = aTok.toInt32();
|
|
||||||
+ else
|
|
||||||
+ nSheetToExport = -23; // invalid, force error
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -99,7 +111,9 @@ OUString ScImportOptions::BuildString() const
|
|
||||||
"," +
|
|
||||||
OUString::boolean( bSaveFormulas ) + // "save formulas": not in ScAsciiOptions
|
|
||||||
"," +
|
|
||||||
- OUString::boolean( bRemoveSpace ); // same as "Remove space" in ScAsciiOptions
|
|
||||||
+ OUString::boolean( bRemoveSpace ) + // same as "Remove space" in ScAsciiOptions
|
|
||||||
+ "," +
|
|
||||||
+ OUString::number(nSheetToExport) ; // Only available for command line --convert-to
|
|
||||||
|
|
||||||
return aResult;
|
|
||||||
}
|
|
||||||
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
|
|
||||||
index 91020db0b2e0..5fdfddd0c89b 100644
|
|
||||||
--- a/sc/source/ui/docshell/docsh.cxx
|
|
||||||
+++ b/sc/source/ui/docshell/docsh.cxx
|
|
||||||
@@ -44,6 +44,7 @@
|
|
||||||
#include <sfx2/objface.hxx>
|
|
||||||
#include <sfx2/viewfrm.hxx>
|
|
||||||
#include <svl/documentlockfile.hxx>
|
|
||||||
+#include <svl/fstathelper.hxx>
|
|
||||||
#include <svl/sharecontrolfile.hxx>
|
|
||||||
#include <svl/urihelper.hxx>
|
|
||||||
#include <osl/file.hxx>
|
|
||||||
@@ -119,6 +120,7 @@
|
|
||||||
#include <comphelper/processfactory.hxx>
|
|
||||||
#include <comphelper/string.hxx>
|
|
||||||
#include <unotools/configmgr.hxx>
|
|
||||||
+#include <unotools/ucbstreamhelper.hxx>
|
|
||||||
#include <uiitems.hxx>
|
|
||||||
#include <dpobject.hxx>
|
|
||||||
#include <markdata.hxx>
|
|
||||||
@@ -1925,7 +1927,7 @@ void escapeTextSep(sal_Int32 nPos, const StrT& rStrDelim, StrT& rStr)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt )
|
|
||||||
+void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt, SCTAB nTab )
|
|
||||||
{
|
|
||||||
sal_Unicode cDelim = rAsciiOpt.nFieldSepCode;
|
|
||||||
sal_Unicode cStrDelim = rAsciiOpt.nTextSepCode;
|
|
||||||
@@ -1971,7 +1973,6 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
|
|
||||||
|
|
||||||
SCCOL nStartCol = 0;
|
|
||||||
SCROW nStartRow = 0;
|
|
||||||
- SCTAB nTab = GetSaveTab();
|
|
||||||
SCCOL nEndCol;
|
|
||||||
SCROW nEndRow;
|
|
||||||
m_aDocument.GetCellArea( nTab, nEndCol, nEndRow );
|
|
||||||
@@ -2389,35 +2390,129 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
|
|
||||||
}
|
|
||||||
else if (aFltName == pFilterAscii)
|
|
||||||
{
|
|
||||||
- SvStream* pStream = rMed.GetOutStream();
|
|
||||||
- if (pStream)
|
|
||||||
+ OUString sItStr;
|
|
||||||
+ SfxItemSet* pSet = rMed.GetItemSet();
|
|
||||||
+ const SfxPoolItem* pItem;
|
|
||||||
+ if ( pSet && SfxItemState::SET ==
|
|
||||||
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
|
|
||||||
{
|
|
||||||
- OUString sItStr;
|
|
||||||
- SfxItemSet* pSet = rMed.GetItemSet();
|
|
||||||
- const SfxPoolItem* pItem;
|
|
||||||
- if ( pSet && SfxItemState::SET ==
|
|
||||||
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
|
|
||||||
+ sItStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if ( sItStr.isEmpty() )
|
|
||||||
+ {
|
|
||||||
+ // default for ascii export (from API without options):
|
|
||||||
+ // ISO8859-1/MS_1252 encoding, comma, double quotes
|
|
||||||
+
|
|
||||||
+ ScImportOptions aDefOptions( ',', '"', RTL_TEXTENCODING_MS_1252 );
|
|
||||||
+ sItStr = aDefOptions.BuildString();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ weld::WaitObject aWait( GetActiveDialogParent() );
|
|
||||||
+ ScImportOptions aOptions( sItStr );
|
|
||||||
+
|
|
||||||
+ if (aOptions.nSheetToExport)
|
|
||||||
+ {
|
|
||||||
+ // Only from command line --convert-to
|
|
||||||
+ bRet = true;
|
|
||||||
+
|
|
||||||
+ // Verbose only from command line, not UI (in case we actually
|
|
||||||
+ // implement that) nor macro filter options.
|
|
||||||
+ bool bVerbose = false;
|
|
||||||
+ const css::uno::Sequence<css::beans::PropertyValue> & rArgs = rMed.GetArgs();
|
|
||||||
+ const auto pProp = std::find_if( rArgs.begin(), rArgs.end(),
|
|
||||||
+ [](const css::beans::PropertyValue& rProp) { return rProp.Name == "ConversionRequestOrigin"; });
|
|
||||||
+ if (pProp != rArgs.end())
|
|
||||||
{
|
|
||||||
- sItStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
|
|
||||||
+ OUString aOrigin;
|
|
||||||
+ pProp->Value >>= aOrigin;
|
|
||||||
+ bVerbose = (aOrigin == "CommandLine");
|
|
||||||
}
|
|
||||||
|
|
||||||
- if ( sItStr.isEmpty() )
|
|
||||||
+ SCTAB nStartTab;
|
|
||||||
+ SCTAB nCount = m_aDocument.GetTableCount();
|
|
||||||
+ if (aOptions.nSheetToExport == -1)
|
|
||||||
{
|
|
||||||
- // default for ascii export (from API without options):
|
|
||||||
- // ISO8859-1/MS_1252 encoding, comma, double quotes
|
|
||||||
-
|
|
||||||
- ScImportOptions aDefOptions( ',', '"', RTL_TEXTENCODING_MS_1252 );
|
|
||||||
- sItStr = aDefOptions.BuildString();
|
|
||||||
+ // All sheets.
|
|
||||||
+ nStartTab = 0;
|
|
||||||
+ }
|
|
||||||
+ else if (0 < aOptions.nSheetToExport && aOptions.nSheetToExport <= nCount)
|
|
||||||
+ {
|
|
||||||
+ // One sheet, 1-based.
|
|
||||||
+ nCount = aOptions.nSheetToExport;
|
|
||||||
+ nStartTab = nCount - 1;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ // Usage error, no export but log.
|
|
||||||
+ if (bVerbose)
|
|
||||||
+ {
|
|
||||||
+ if (aOptions.nSheetToExport < 0)
|
|
||||||
+ std::cout << "Bad sheet number string given." << std::endl;
|
|
||||||
+ else
|
|
||||||
+ std::cout << "No sheet number " << aOptions.nSheetToExport
|
|
||||||
+ << ", number of sheets is " << nCount << std::endl;
|
|
||||||
+ }
|
|
||||||
+ nStartTab = 0;
|
|
||||||
+ nCount = 0;
|
|
||||||
+ SetError(SCERR_EXPORT_DATA);
|
|
||||||
+ bRet = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- weld::WaitObject aWait( GetActiveDialogParent() );
|
|
||||||
- ScImportOptions aOptions( sItStr );
|
|
||||||
- AsciiSave( *pStream, aOptions );
|
|
||||||
- bRet = true;
|
|
||||||
+ INetURLObject aURLObject(rMed.GetURLObject());
|
|
||||||
+ OUString sExt = aURLObject.CutExtension();
|
|
||||||
+ OUString sBaseName = aURLObject.GetLastName();
|
|
||||||
+ aURLObject.CutLastName();
|
|
||||||
|
|
||||||
- if (m_aDocument.GetTableCount() > 1)
|
|
||||||
- if (!rMed.GetError())
|
|
||||||
- rMed.SetError(SCWARN_EXPORT_ASCII);
|
|
||||||
+ for (SCTAB i = nStartTab; i < nCount; ++i)
|
|
||||||
+ {
|
|
||||||
+ OUString sTabName;
|
|
||||||
+ if (!m_aDocument.GetName(i, sTabName))
|
|
||||||
+ sTabName = OUString::number(i);
|
|
||||||
+ INetURLObject aSheetURLObject(aURLObject);
|
|
||||||
+ OUString sFileName = sBaseName + "-" + sTabName;
|
|
||||||
+ if (!sExt.isEmpty())
|
|
||||||
+ sFileName = sFileName + "." + sExt;
|
|
||||||
+ aSheetURLObject.Append(sFileName);
|
|
||||||
+
|
|
||||||
+ // log similar to DispatchWatcher::executeDispatchRequests
|
|
||||||
+ OUString aOutFile = aSheetURLObject.GetMainURL(INetURLObject::DecodeMechanism::NONE);
|
|
||||||
+ if (bVerbose)
|
|
||||||
+ {
|
|
||||||
+ OUString aDisplayedName;
|
|
||||||
+ if (osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(aOutFile, aDisplayedName))
|
|
||||||
+ aDisplayedName = aOutFile;
|
|
||||||
+ std::cout << "Writing sheet " << OUStringToOString(sTabName, osl_getThreadTextEncoding()) << " -> "
|
|
||||||
+ << OUStringToOString(aDisplayedName, osl_getThreadTextEncoding())
|
|
||||||
+ << std::endl;
|
|
||||||
+
|
|
||||||
+ if (FStatHelper::IsDocument(aOutFile))
|
|
||||||
+ std::cout << "Overwriting: " << OUStringToOString(aDisplayedName, osl_getThreadTextEncoding())
|
|
||||||
+ << std::endl ;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ std::unique_ptr<SvStream> xStm = ::utl::UcbStreamHelper::CreateStream(aOutFile, StreamMode::TRUNC | StreamMode::WRITE);
|
|
||||||
+ if (!xStm)
|
|
||||||
+ {
|
|
||||||
+ SetError(ERRCODE_IO_CANTCREATE);
|
|
||||||
+ bRet = false;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ AsciiSave(*xStm, aOptions, i);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ SvStream* pStream = rMed.GetOutStream();
|
|
||||||
+ if (pStream)
|
|
||||||
+ {
|
|
||||||
+ AsciiSave(*pStream, aOptions, GetSaveTab());
|
|
||||||
+ bRet = true;
|
|
||||||
+
|
|
||||||
+ if (m_aDocument.GetTableCount() > 1)
|
|
||||||
+ if (!rMed.GetError())
|
|
||||||
+ rMed.SetError(SCWARN_EXPORT_ASCII);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (aFltName == pFilterDBase)
|
|
||||||
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
|
|
||||||
index 41c0b30a42a8..3aa5f6caf311 100644
|
|
||||||
--- a/sc/source/ui/inc/docsh.hxx
|
|
||||||
+++ b/sc/source/ui/inc/docsh.hxx
|
|
||||||
@@ -227,7 +227,7 @@ public:
|
|
||||||
|
|
||||||
ScDrawLayer* MakeDrawLayer();
|
|
||||||
|
|
||||||
- void AsciiSave( SvStream& rStream, const ScImportOptions& rOpt );
|
|
||||||
+ void AsciiSave( SvStream& rStream, const ScImportOptions& rOpt, SCTAB nTab );
|
|
||||||
|
|
||||||
void Execute( SfxRequest& rReq );
|
|
||||||
void GetState( SfxItemSet &rSet );
|
|
||||||
diff --git a/sc/source/ui/inc/imoptdlg.hxx b/sc/source/ui/inc/imoptdlg.hxx
|
|
||||||
index bac941c2a377..382067d67813 100644
|
|
||||||
--- a/sc/source/ui/inc/imoptdlg.hxx
|
|
||||||
+++ b/sc/source/ui/inc/imoptdlg.hxx
|
|
||||||
@@ -32,7 +32,8 @@ public:
|
|
||||||
ScImportOptions( sal_Unicode nFieldSep, sal_Unicode nTextSep, rtl_TextEncoding nEnc )
|
|
||||||
: nFieldSepCode(nFieldSep), nTextSepCode(nTextSep),
|
|
||||||
bFixedWidth(false), bSaveAsShown(false), bQuoteAllText(false),
|
|
||||||
- bSaveNumberAsSuch(true), bSaveFormulas(false), bRemoveSpace(false)
|
|
||||||
+ bSaveNumberAsSuch(true), bSaveFormulas(false), bRemoveSpace(false),
|
|
||||||
+ nSheetToExport(0)
|
|
||||||
{ SetTextEncoding( nEnc ); }
|
|
||||||
|
|
||||||
ScImportOptions& operator=( const ScImportOptions& rCpy ) = default;
|
|
||||||
@@ -51,6 +52,9 @@ public:
|
|
||||||
bool bSaveNumberAsSuch;
|
|
||||||
bool bSaveFormulas;
|
|
||||||
bool bRemoveSpace;
|
|
||||||
+ // "0" for 'current sheet', "-1" for all sheets (each to a separate file),
|
|
||||||
+ // or 1-based specific sheet number (to a separate file).
|
|
||||||
+ sal_Int32 nSheetToExport;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // INCLUDED_SC_SOURCE_UI_INC_IMOPTDLG_HXX
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
Loading…
Reference in new issue