[Libreoffice-commits] core.git: desktop/source drawinglayer/source include/vcl slideshow/source svx/source vcl/qa vcl/source vcl/workben

2023-12-06 Thread Noel Grandin (via logerrit)
 desktop/source/lib/init.cxx  |2 
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx  |2 
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |6 
 include/vcl/alpha.hxx|   83 +--
 include/vcl/bitmap.hxx   |6 
 slideshow/source/engine/shapes/gdimtftools.cxx   |8 -
 svx/source/dialog/_contdlg.cxx   |2 
 vcl/qa/cppunit/BitmapExTest.cxx  |4 
 vcl/qa/cppunit/canvasbitmaptest.cxx  |4 
 vcl/qa/cppunit/skia/skia.cxx |   27 +--
 vcl/source/bitmap/BitmapEx.cxx   |8 -
 vcl/source/bitmap/alpha.cxx  |   63 
 vcl/source/bitmap/bitmap.cxx |8 -
 vcl/source/bitmap/bitmappaint.cxx|   14 -
 vcl/source/bitmap/dibtools.cxx   |2 
 vcl/source/filter/jpeg/JpegReader.cxx|2 
 vcl/source/filter/png/PngImageWriter.cxx |4 
 vcl/source/filter/wmf/emfwr.cxx  |6 
 vcl/source/filter/wmf/wmfwr.cxx  |4 
 vcl/source/gdi/FileDefinitionWidgetDraw.cxx  |2 
 vcl/source/gdi/pdfwriter_impl.cxx|4 
 vcl/source/graphic/UnoGraphic.cxx|2 
 vcl/source/outdev/background.cxx |2 
 vcl/source/outdev/bitmap.cxx |4 
 vcl/source/outdev/bitmapex.cxx   |   12 -
 vcl/workben/vcldemo.cxx  |2 
 26 files changed, 168 insertions(+), 115 deletions(-)

New commits:
commit aa7d1c8f1411fe35465f265259cf1082adf05aea
Author: Noel Grandin 
AuthorDate: Fri Dec 1 13:27:52 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 6 09:51:17 2023 +0100

make AlphaMask separate from Bitmap

Having it subclass Bitmap encourages confusion in passing it around, and
I need the extra type-safety for my work on merged-alpha

Change-Id: I35819f9b8ee609cbdaf865563c78531e397b529b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160235
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 66075e3312d9..fa1c55c09e05 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4222,7 +4222,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 Bitmap aBmp = aBmpEx.GetBitmap();
 AlphaMask aAlpha = aBmpEx.GetAlphaMask();
 Bitmap::ScopedReadAccess sraBmp(aBmp);
-Bitmap::ScopedReadAccess sraAlpha(aAlpha);
+AlphaMask::ScopedReadAccess sraAlpha(aAlpha);
 
 assert(sraBmp->Height() == nCanvasHeight);
 assert(sraBmp->Width() == nCanvasWidth);
diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index ee4b6d4cb14f..e1dcac421344 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -40,7 +40,7 @@ AlphaMask ProcessAndBlurAlphaMask(const AlphaMask& rMask, 
double fErodeDilateRad
 
 // Only completely white pixels on the initial mask must be considered for 
transparency. Any
 // other color must be treated as black. This creates 1-bit B bitmap.
-BitmapEx mask(bConvertTo1Bit ? tmpMask.CreateMask(COL_WHITE) : tmpMask);
+BitmapEx mask(bConvertTo1Bit ? tmpMask.GetBitmap().CreateMask(COL_WHITE) : 
tmpMask.GetBitmap());
 
 // Scaling down increases performance without noticeable quality loss. 
Additionally,
 // current blur implementation can only handle blur radius between 2 and 
254.
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index e5658f6cf0d3..6a0dd7e070ee 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -283,7 +283,7 @@ namespace drawinglayer::primitive2d
 }
 else
 {
-BitmapEx aExpandVisibilityMask(aAlphaMask, 
aAlphaMask);
+BitmapEx 
aExpandVisibilityMask(aAlphaMask.GetBitmap(), aAlphaMask);
 
maVirtualDeviceMask->DrawBitmapEx(rAnimationFrame.maPositionPixel, 
aExpandVisibilityMask);
 }
 
@@ -306,7 +306,7 @@ namespace drawinglayer::primitive2d
 }
 else
 {
-

[Libreoffice-commits] core.git: desktop/source

2023-11-17 Thread Noel Grandin (via logerrit)
 desktop/source/lib/init.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 8369765ec5be151082a6e31c16e2ab2b0df13f5c
Author: Noel Grandin 
AuthorDate: Fri Nov 17 11:58:54 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 17 19:45:21 2023 +0100

cool#6893 pre-init dictionary list

so the forked processes don't need to

Change-Id: Id37688ac88c14679e216cca744563ee75c7c4736
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159561
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3ee743d4aada..dcdbf35b7d03 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -125,6 +125,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -7423,6 +7424,7 @@ static void preloadData()
 setLanguageToolConfig();
 
 // preload all available dictionaries
+
linguistic2::DictionaryList::create(comphelper::getProcessComponentContext());
 css::uno::Reference xLngSvcMgr =
 
css::linguistic2::LinguServiceManager::create(comphelper::getProcessComponentContext());
 css::uno::Reference 
xSpellChecker(xLngSvcMgr->getSpellChecker());


[Libreoffice-commits] core.git: desktop/source extensions/source include/curlinit.hxx include/opensslinit.hxx include/systools lingucomponent/source linguistic/source svl/source ucb/source vcl/source

2023-11-10 Thread Mike Kaganski (via logerrit)
 desktop/source/app/updater.cxx|2 
 desktop/source/minidump/minidump.cxx  |2 
 extensions/source/update/check/download.cxx   |2 
 include/systools/curlinit.hxx |   24 

 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   10 ---
 linguistic/source/translate.cxx   |2 
 svl/source/crypto/cryptosign.cxx  |2 
 ucb/source/ucp/cmis/cmis_content.cxx  |2 
 ucb/source/ucp/webdav-curl/CurlSession.cxx|   28 
--
 vcl/source/app/svmain.cxx |2 
 10 files changed, 34 insertions(+), 42 deletions(-)

New commits:
commit f5926c8cfbd5af1fb7214428b4b03453b826f9a5
Author: Mike Kaganski 
AuthorDate: Fri Nov 10 15:36:45 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Nov 11 08:42:57 2023 +0100

Move user agent initialization to InitCurl_easy

Places that didn't initialize it previously, would benefit automatically

Change-Id: I2f1ff25fc58d9378462072bc92d7b37be2370fc8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159299
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 7ff6234b4555..edac2cb38350 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -38,7 +38,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 #include 
diff --git a/desktop/source/minidump/minidump.cxx 
b/desktop/source/minidump/minidump.cxx
index 7fbb0884987d..0a31fff6f285 100644
--- a/desktop/source/minidump/minidump.cxx
+++ b/desktop/source/minidump/minidump.cxx
@@ -17,7 +17,7 @@
 
 #include 
 
-#include 
+#include 
 
 #ifdef _WIN32
 #include 
diff --git a/extensions/source/update/check/download.cxx 
b/extensions/source/update/check/download.cxx
index 9b4823777289..ab5402c0ae42 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -23,7 +23,7 @@
 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/include/curlinit.hxx b/include/systools/curlinit.hxx
similarity index 56%
rename from include/curlinit.hxx
rename to include/systools/curlinit.hxx
index c80397caf466..7034534af66f 100644
--- a/include/curlinit.hxx
+++ b/include/systools/curlinit.hxx
@@ -19,6 +19,11 @@
 #include "opensslinit.hxx"
 #endif
 
+#include 
+#include 
+
+#include 
+
 static void InitCurl_easy(CURL* const pCURL)
 {
 CURLcode rc;
@@ -44,6 +49,25 @@ static void InitCurl_easy(CURL* const pCURL)
 rc = curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "https");
 assert(rc == CURLE_OK);
 }
+
+curl_version_info_data const* const 
pVersion(curl_version_info(CURLVERSION_NOW));
+assert(pVersion);
+SAL_INFO("ucb.ucp.webdav.curl",
+ "curl version: " << pVersion->version << " " << pVersion->host
+  << " features: " << ::std::hex << 
pVersion->features << " ssl: "
+  << pVersion->ssl_version << " libz: " << 
pVersion->libz_version);
+// Make sure a User-Agent header is always included, as at least
+// en.wikipedia.org:80 forces back 403 "Scripts should use an informative
+// User-Agent string with contact information, or they may be IP-blocked
+// without notice" otherwise:
+OString const useragent(
+OString::Concat("LibreOffice " LIBO_VERSION_DOTTED " 
denylistedbackend/")
++ pVersion->version + " " + pVersion->ssl_version);
+// looks like an explicit "User-Agent" header in CURLOPT_HTTPHEADER
+// will override CURLOPT_USERAGENT, see Curl_http_useragent(), so no need
+// to check anything here
+rc = curl_easy_setopt(pCURL, CURLOPT_USERAGENT, useragent.getStr());
+assert(rc == CURLE_OK);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/include/opensslinit.hxx b/include/systools/opensslinit.hxx
similarity index 100%
rename from include/opensslinit.hxx
rename to include/systools/opensslinit.hxx
diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 45b4f9df6bdc..599bb01c6194 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -42,7 +42,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
@@ -135,14 +135,6 @@ std::string makeHttpRequest_impl(std::u16string_view aURL, 
HTTP_METHOD method,
 
 ::InitCurl_easy(curl.get());
 
-// Same useragent string as in CurlSession 
(ucp/webdav-curl/CurlSession.cxx)
-curl_version_info_data const* const 
pVersion(curl_version_info(CURLVERSION_NOW));
-  

[Libreoffice-commits] core.git: desktop/source

2023-11-09 Thread Stephan Bergmann (via logerrit)
 desktop/source/app/appinit.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 4897083c120fbe7ea2fbe14f0f7d2cb293b79fa8
Author: Stephan Bergmann 
AuthorDate: Wed Nov 8 16:54:20 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Nov 9 09:06:22 2023 +0100

Move "Acceptor already exists" warning to where it belongs

036ed05fe35044e49a91e12b6a8e5f36a5b9c4c2 "MWS_SRX644: migrate branch 
mws_srx644
-> HEAD" had added this with misleading indentation, so it (apparently
accidentally) did not pertain to the "aAcceptString was found in the map of
already existing acceptors" case.  Then 
4acffc240b4845beedfe66eaa571b814d65e2e57
"catch by const reference" fixed the indentation, but left the warning at 
the
apparently wrong place.

Change-Id: Ie73368bc1294e9b716e3fca75e12363cb6240fdd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159157
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx
index 926ad1bfa6b7..6eca704c7fb9 100644
--- a/desktop/source/app/appinit.cxx
+++ b/desktop/source/app/appinit.cxx
@@ -138,7 +138,11 @@ void Desktop::createAcceptor(const OUString& aAcceptString)
 AcceptorMap  = acceptorMap();
 AcceptorMap::const_iterator pIter = rMap.find(aAcceptString);
 if (pIter != rMap.end() )
+{
+// there is already an acceptor with this description
+SAL_WARN( "desktop.app", "Acceptor already exists.");
 return;
+}
 
 Sequence< Any > aSeq{ Any(aAcceptString), Any(bAccept) };
 Reference< XComponentContext > xContext = 
::comphelper::getProcessComponentContext();
@@ -161,8 +165,7 @@ void Desktop::createAcceptor(const OUString& aAcceptString)
 }
 else
 {
-// there is already an acceptor with this description
-SAL_WARN( "desktop.app", "Acceptor already exists.");
+SAL_WARN( "desktop.app", "Acceptor could not be created");
 }
 }
 


[Libreoffice-commits] core.git: desktop/source extensions/source fpicker/source shell/source

2023-11-08 Thread Stephan Bergmann (via logerrit)
 desktop/source/app/crashreport.cxx   |2 +-
 extensions/source/ole/unoobjw.cxx|2 +-
 fpicker/source/win32/VistaFilePickerImpl.cxx |2 +-
 shell/source/tools/lngconvex/lngconvex.cxx   |   10 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit e624979ce4e06f34ce8c8e8c2ee5c2b5a9a10f57
Author: Stephan Bergmann 
AuthorDate: Wed Nov 8 08:41:12 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 8 14:32:49 2023 +0100

loplugin:unnecessarygetstr (clang-cl)

Change-Id: Ic0ec1614d48382bb5735a67bf9588657b9ebd521
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159106
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/desktop/source/app/crashreport.cxx 
b/desktop/source/app/crashreport.cxx
index 186a59b02101..b90a04907f69 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -76,7 +76,7 @@ static bool dumpCallback(const wchar_t* path, const wchar_t* 
id,
 std::string aPath = conv1.to_bytes(std::wstring(path)) + 
conv1.to_bytes(std::wstring(id)) + ".dmp";
 
CrashReporter::addKeyValue("Active-SfxObject",CrashReporter::getActiveSfxObjectName(),CrashReporter::AddItem);
 
CrashReporter::addKeyValue("Last-4-Uno-Commands",CrashReporter::getLoggedUnoCommands(),CrashReporter::AddItem);
-CrashReporter::addKeyValue("DumpFile", OStringToOUString(aPath.c_str(), 
RTL_TEXTENCODING_UTF8), CrashReporter::AddItem);
+CrashReporter::addKeyValue("DumpFile", OStringToOUString(aPath, 
RTL_TEXTENCODING_UTF8), CrashReporter::AddItem);
 CrashReporter::addKeyValue("GDIHandles", 
OUString::number(::GetGuiResources(::GetCurrentProcess(), GR_GDIOBJECTS)), 
CrashReporter::Write);
 SAL_WARN("desktop", "minidump generated: " << aPath);
 return succeeded;
diff --git a/extensions/source/ole/unoobjw.cxx 
b/extensions/source/ole/unoobjw.cxx
index 936e049b147a..915ecd92f8fc 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -1817,7 +1817,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
InterfaceOleWrapper::Invoke(DISPID dispidMembe
 sParams += ",";
 std::stringstream aStringStream;
 aStringStream << pdispparams->rgvarg[i];
-sParams += OUString::createFromAscii(aStringStream.str().c_str());
+sParams += OUString::createFromAscii(aStringStream.str());
 }
 sParams += "]";
 #endif
diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx 
b/fpicker/source/win32/VistaFilePickerImpl.cxx
index 67e977156bd2..8a2531ab0119 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.cxx
@@ -1116,7 +1116,7 @@ void 
VistaFilePickerImpl::impl_sta_GetControlValue(Request& rRequest)
 if ( SUCCEEDED(hResult) )
 {
 const OUString& sItem = m_lItems[bValue];
-aValue <<= OUString(sItem.getStr());
+aValue <<= sItem;
 }
 }
 break;
diff --git a/shell/source/tools/lngconvex/lngconvex.cxx 
b/shell/source/tools/lngconvex/lngconvex.cxx
index 546d76653dca..f016d01f7133 100644
--- a/shell/source/tools/lngconvex/lngconvex.cxx
+++ b/shell/source/tools/lngconvex/lngconvex.cxx
@@ -113,7 +113,7 @@ OUString get_absolute_path(
 std::string make_absolute(const std::string& file_name)
 {
 OUString fp = get_absolute_path(
-get_module_path(), OStringToOUString(file_name.c_str()));
+get_module_path(), OStringToOUString(file_name));
 return std::string(OUStringToOString(fp));
 }
 
@@ -157,7 +157,7 @@ public:
 { return OStringToOUString( maBcp47, RTL_TEXTENCODING_ASCII_US); }
 
 std::string make_std_string() const
-{ return maBcp47.getStr(); }
+{ return std::string(maBcp47); }
 
 private:
 OString maBcp47;
@@ -184,7 +184,7 @@ std::string make_winrc_unicode_string(const OUString& str)
 std::string make_winrc_unicode_string(const std::string& str)
 {
 return make_winrc_unicode_string(
-OUString::createFromAscii(str.c_str()));
+OUString::createFromAscii(str));
 }
 
 /** A replacement table contains pairs of
@@ -272,8 +272,8 @@ void add_group_entries(
 OStringToOUString(key_value_utf8, RTL_TEXTENCODING_UTF8);
 
 Substitutor.add_substitution(
-GroupName.getStr(), 
make_winrc_unicode_string(key_value_utf16));
-map[ ltype ] = std::string( iso_lang.getStr() );
+std::string(GroupName), 
make_winrc_unicode_string(key_value_utf16));
+map[ ltype ] = std::string( iso_lang );
 }
 else
 {


[Libreoffice-commits] core.git: desktop/source extensions/source include/curlinit.hxx lingucomponent/source linguistic/source svl/source ucb/source

2023-11-07 Thread Michael Stahl (via logerrit)
 desktop/source/app/updater.cxx|4 
 desktop/source/minidump/minidump.cxx  |4 
 extensions/source/update/check/download.cxx   |4 
 include/curlinit.hxx  |   59 
++
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |5 
 linguistic/source/translate.cxx   |4 
 svl/source/crypto/cryptosign.cxx  |6 +
 ucb/source/ucp/cmis/cmis_content.cxx  |5 
 ucb/source/ucp/ftp/ftploaderthread.cxx|4 
 ucb/source/ucp/webdav-curl/CurlSession.cxx|2 
 10 files changed, 97 insertions(+)

New commits:
commit 11f439b861922b9286b2e47ed326f3508a48d44e
Author: Michael Stahl 
AuthorDate: Fri Nov 3 20:16:09 2023 +0100
Commit: Michael Stahl 
CommitDate: Tue Nov 7 14:26:38 2023 +0100

curl: mitigate migration to OpenSSL on Linux

The problem is that curl 8.3.0 removed the NSS backend, so we now
have no other choice than to use the bundled OpenSSL on Linux.

Currently any curl https connection fails with:

  CurlSession.cxx:963: curl_easy_perform failed: (60) SSL certificate 
problem: unable to get local issuer certificate

Apparently this requires manually telling curl which CA certificates to
trust; there is a configure flag --with-ca-bundle but that is useless as
it tries to load the file relative to whatever is the current working
directory, and also did i mention that there are at least 3 different
locations where a Linux system may store its system trusted CA
certificates because ALL ABOUT CHOICE.

So add a new header with an init function to try out various file
locations listed in this nice blog article and call it from way too many
places that independently use curl.


https://www.happyassassin.net/posts/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/

TODO: perhaps bundle a cacert.pem as a fallback in case the system chose
to innovate by putting its certificates in yet another unexpected place

(regression from commit c2930ebff82c4f7ffe8377ab82627131f8544226)

Change-Id: Ibf1cc0069bc2ae011ecead9a4c2b455e94b01241
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158915
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 92f060b976e2..7ff6234b4555 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -37,6 +37,8 @@
 #include 
 #include 
 #include 
+
+#include 
 #include 
 
 #include 
@@ -546,6 +548,8 @@ std::string download_content(const OString& rURL, bool 
bFile, OUString& rHash)
 if (!curl)
 return std::string();
 
+::InitCurl_easy(curl.get());
+
 curl_easy_setopt(curl.get(), CURLOPT_URL, rURL.getStr());
 curl_easy_setopt(curl.get(), CURLOPT_USERAGENT, kUserAgent);
 bool bUseProxy = false;
diff --git a/desktop/source/minidump/minidump.cxx 
b/desktop/source/minidump/minidump.cxx
index 0bf20f2aa419..7fbb0884987d 100644
--- a/desktop/source/minidump/minidump.cxx
+++ b/desktop/source/minidump/minidump.cxx
@@ -17,6 +17,8 @@
 
 #include 
 
+#include 
+
 #ifdef _WIN32
 #include 
 #include 
@@ -95,6 +97,8 @@ static bool uploadContent(std::map& 
parameters, std::s
 if (!curl)
 return false;
 
+::InitCurl_easy(curl);
+
 std::string proxy, proxy_user_pwd, ca_certificate_file, file, url, version;
 
 getProperty("Proxy", proxy, parameters);
diff --git a/extensions/source/update/check/download.cxx 
b/extensions/source/update/check/download.cxx
index 8f090ed9b6dd..2124ee5a0512 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -23,6 +23,8 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -222,6 +224,8 @@ static bool curl_run(std::u16string_view rURL, OutData& 
out, const OString& aPro
 
 if( nullptr != pCURL )
 {
+::InitCurl_easy(pCURL);
+
 out.curl = pCURL;
 
 OString aURL(OUStringToOString(rURL, RTL_TEXTENCODING_UTF8));
diff --git a/include/curlinit.hxx b/include/curlinit.hxx
new file mode 100644
index ..8b3a9968419d
--- /dev/null
+++ b/include/curlinit.hxx
@@ -0,0 +1,59 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include 
+
+#if defined(LINUX) && !defined(SYSTEM_CURL)
+#include 
+
+#include 
+
+static char const* GetCABundleFile()
+{
+// 

[Libreoffice-commits] core.git: desktop/source

2023-11-04 Thread Mike Kaganski (via logerrit)
 desktop/source/lib/init.cxx |   24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 2bf894e91adf8783baaabc2203f7e97c4b8f3ca7
Author: Mike Kaganski 
AuthorDate: Sat Nov 4 17:53:47 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Nov 4 20:06:26 2023 +0100

External data must be checked when parsed

Change-Id: I8bc5afb29fe22a4b06462a7c61b689c88c41003f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158938
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 92628177cb66..71eeabcbc380 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -542,34 +542,38 @@ RectangleAndPart RectangleAndPart::Create(const OString& 
rPayload)
 const char* pos = rPayload.getStr();
 const char* end = rPayload.getStr() + rPayload.getLength();
 tools::Long nLeft = rtl_str_toInt64_WithLength(pos, 10, end - pos);
-while( *pos != ',' )
+while (pos < end && *pos != ',')
+++pos;
+if (pos < end)
 ++pos;
-++pos;
 assert(pos < end);
 tools::Long nTop = rtl_str_toInt64_WithLength(pos, 10, end - pos);
-while( *pos != ',' )
+while (pos < end && *pos != ',')
+++pos;
+if (pos < end)
 ++pos;
-++pos;
 assert(pos < end);
 tools::Long nWidth = rtl_str_toInt64_WithLength(pos, 10, end - pos);
-while( *pos != ',' )
+while (pos < end && *pos != ',')
+++pos;
+if (pos < end)
 ++pos;
-++pos;
 assert(pos < end);
 tools::Long nHeight = rtl_str_toInt64_WithLength(pos, 10, end - pos);
 tools::Long nPart = INT_MIN;
 tools::Long nMode = 0;
 if (comphelper::LibreOfficeKit::isPartInInvalidation())
 {
-while( *pos != ',' )
+while (pos < end && *pos != ',')
+++pos;
+if (pos < end)
 ++pos;
-++pos;
 assert(pos < end);
 nPart = rtl_str_toInt64_WithLength(pos, 10, end - pos);
 
-while( *pos && *pos != ',' )
+while (pos < end && *pos != ',')
 ++pos;
-if (*pos)
+if (pos < end)
 {
 ++pos;
 assert(pos < end);


[Libreoffice-commits] core.git: desktop/source

2023-11-04 Thread Mike Kaganski (via logerrit)
 desktop/source/lib/init.cxx | 1131 +---
 1 file changed, 548 insertions(+), 583 deletions(-)

New commits:
commit e14a55c9aa834c160e9a5c70f0de3b0635cde66f
Author: Mike Kaganski 
AuthorDate: Sat Nov 4 12:25:11 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Nov 4 15:42:28 2023 +0100

LOK: Simplify a bit, and use more compile-time knowledge

Bring some C++20 goodness to LOK code: avoid lots of small memory
allocations when constructing OUString from ASCII char arrays;
use string lengths known at compile and run time; use safer and
cleaner syntax.

Change-Id: Ia59ed3c8d8ce521880bb8d70b69a64b2d3e73c14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158927
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index af2eba39876a..92628177cb66 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -261,8 +261,8 @@ namespace {
 
 struct ExtensionMap
 {
-const char *extn;
-const char *filterName;
+std::string_view extn;
+OUString filterName;
 };
 
 class TraceEventDumper : public AutoTimer
@@ -300,88 +300,81 @@ public:
 }
 };
 
-} // unnamed namespace
-
-static TraceEventDumper *traceEventDumper = nullptr;
-
-const ExtensionMap aWriterExtensionMap[] =
-{
-{ "doc",   "MS Word 97" },
-{ "docm",  "MS Word 2007 XML VBA" },
-{ "docx",  "MS Word 2007 XML" },
-{ "fodt",  "OpenDocument Text Flat XML" },
-{ "html",  "HTML (StarWriter)" },
-{ "odt",   "writer8" },
-{ "ott",   "writer8_template" },
-{ "pdf",   "writer_pdf_Export" },
-{ "epub",  "EPUB" },
-{ "rtf",   "Rich Text Format" },
-{ "txt",   "Text" },
-{ "xhtml", "XHTML Writer File" },
-{ "png",   "writer_png_Export" },
-{ "xml",   "writer_indexing_export" },
-{ nullptr, nullptr }
+TraceEventDumper *traceEventDumper = nullptr;
+
+constexpr ExtensionMap aWriterExtensionMap[] =
+{
+{ "doc",   u"MS Word 97"_ustr },
+{ "docm",  u"MS Word 2007 XML VBA"_ustr },
+{ "docx",  u"MS Word 2007 XML"_ustr },
+{ "fodt",  u"OpenDocument Text Flat XML"_ustr },
+{ "html",  u"HTML (StarWriter)"_ustr },
+{ "odt",   u"writer8"_ustr },
+{ "ott",   u"writer8_template"_ustr },
+{ "pdf",   u"writer_pdf_Export"_ustr },
+{ "epub",  u"EPUB"_ustr },
+{ "rtf",   u"Rich Text Format"_ustr },
+{ "txt",   u"Text"_ustr },
+{ "xhtml", u"XHTML Writer File"_ustr },
+{ "png",   u"writer_png_Export"_ustr },
+{ "xml",   u"writer_indexing_export"_ustr },
 };
 
-const ExtensionMap aCalcExtensionMap[] =
-{
-{ "csv",   "Text - txt - csv (StarCalc)" },
-{ "fods",  "OpenDocument Spreadsheet Flat XML" },
-{ "html",  "HTML (StarCalc)" },
-{ "ods",   "calc8" },
-{ "ots",   "calc8_template" },
-{ "pdf",   "calc_pdf_Export" },
-{ "xhtml", "XHTML Calc File" },
-{ "xls",   "MS Excel 97" },
-{ "xlsm",  "Calc MS Excel 2007 VBA XML" },
-{ "xlsx",  "Calc MS Excel 2007 XML" },
-{ "png",   "calc_png_Export" },
-{ nullptr, nullptr }
+constexpr ExtensionMap aCalcExtensionMap[] =
+{
+{ "csv",   u"Text - txt - csv (StarCalc)"_ustr },
+{ "fods",  u"OpenDocument Spreadsheet Flat XML"_ustr },
+{ "html",  u"HTML (StarCalc)"_ustr },
+{ "ods",   u"calc8"_ustr },
+{ "ots",   u"calc8_template"_ustr },
+{ "pdf",   u"calc_pdf_Export"_ustr },
+{ "xhtml", u"XHTML Calc File"_ustr },
+{ "xls",   u"MS Excel 97"_ustr },
+{ "xlsm",  u"Calc MS Excel 2007 VBA XML"_ustr },
+{ "xlsx",  u"Calc MS Excel 2007 XML"_ustr },
+{ "png",   u"calc_png_Export"_ustr },
 };
 
-const ExtensionMap aImpressExtensionMap[] =
-{
-{ "fodp",  "OpenDocument Presentation Flat XML" },
-{ "html",  "impress_html_Export" },
-{ "odg",   "impress8_draw" },
-{ "odp",   "impress8" },
-{ "otp",   "impress8_template" },
-{ "pdf",   "impress_pdf_Export" },
-{ "potm",  "Impress MS PowerPoint 2007 XML Template" },
-{ "pot",   "MS PowerPoint 97 Vorlage" },
-{ "pptm",  "Impress MS PowerPoint 2007 XML VBA" },
-{ "pptx",  "Impress MS PowerPoint 2007 XML" },
-{ "pps",   "MS PowerPoint 97 Autoplay" },
-{ "ppt",   "MS PowerPoint 97" },
-{ "svg",   "impress_svg_Export" },
-{ "xhtml", "XHTML Impress File" },
-{ "png",   "impress_png_Export"},
-{ nullptr, nullptr }
+constexpr ExtensionMap aImpressExtensionMap[] =
+{
+{ "fodp",  u"OpenDocument Presentation Flat XML"_ustr },
+{ "html",  u"impress_html_Export"_ustr },
+{ "odg",   u"impress8_draw"_ustr },
+{ "odp",   u"impress8"_ustr },
+{ "otp",   u"impress8_template"_ustr },
+{ "pdf",   u"impress_pdf_Export"_ustr },
+{ "potm",  u"Impress MS PowerPoint 2007 XML Template"_ustr },
+{ "pot",   u"MS PowerPoint 97 Vorlage"_ustr },
+{ "pptm",  u"Impress MS PowerPoint 2007 XML VBA"_ustr },
+{ "pptx",  u"Impress MS PowerPoint 2007 XML"_ustr },
+  

[Libreoffice-commits] core.git: desktop/source

2023-11-03 Thread Ankit_Jaipuriar (via logerrit)
 desktop/source/lib/init.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e963da8716a9e418ff220f0c0b5299dcaa82f53a
Author: Ankit_Jaipuriar 
AuthorDate: Tue Oct 10 17:06:39 2023 +0530
Commit: Hossein 
CommitDate: Fri Nov 3 22:53:01 2023 +0100

tdf#114441 Convert sal_uLong to better data types

The function getLength() returns a value as sal_Int32, which is then
assigned to the variable nLinks.

Change-Id: I44d626e2a26e3d9eb15b0884500f0dfddff12e9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157755
Tested-by: Hossein 
Reviewed-by: Hossein 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 78e8eeaf2180..af2eba39876a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -432,12 +432,12 @@ static void extractLinks(const uno::Reference< 
container::XNameAccess >& xLinks,
 {
 const uno::Sequence< OUString > aNames( xLinks->getElementNames() );
 
-const sal_uLong nLinks = aNames.getLength();
+const sal_Int32 nLinks = aNames.getLength();
 const OUString* pNames = aNames.getConstArray();
 static constexpr OUStringLiteral aProp_LinkDisplayName( u"LinkDisplayName" 
);
 static constexpr OUStringLiteral aProp_LinkTarget( 
u"com.sun.star.document.LinkTarget" );
 bool bIsTarget = false;
-for( sal_uLong i = 0; i < nLinks; i++ )
+for( sal_Int32 i = 0; i < nLinks; i++ )
 {
 uno::Any aAny;
 OUString aLink( *pNames++ );


[Libreoffice-commits] core.git: desktop/source

2023-10-31 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a269f52d2016ef72f51e8b73574b6cbd0f448e33
Author: Marco Cecchetti 
AuthorDate: Thu Oct 26 20:22:17 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Oct 31 15:44:24 2023 +0100

lok a11y: calc: make possible to enable accessibility for spreadsheets

Change-Id: I462b2d386b58a895bd4c45d4bd61a049404d3848
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158512
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
(cherry picked from commit e5481fdaf33a3921ef0624e8a62e28e2f68086da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158691
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ab4987376f4f..78e8eeaf2180 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7179,7 +7179,7 @@ static void 
doc_setAccessibilityState(SAL_UNUSED_PARAMETER LibreOfficeKitDocumen
 SolarMutexGuard aGuard;
 
 int nDocType = getDocumentType(pThis);
-if (!(nDocType == LOK_DOCTYPE_TEXT || nDocType == 
LOK_DOCTYPE_PRESENTATION))
+if (!(nDocType == LOK_DOCTYPE_TEXT || nDocType == LOK_DOCTYPE_PRESENTATION 
|| nDocType == LOK_DOCTYPE_SPREADSHEET))
 return;
 
 SfxLokHelper::setAccessibilityState(nId, nEnabled);


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sfx2/source svx/source

2023-10-27 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx  |2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   31 
 libreofficekit/source/gtk/lokdocview.cxx |2 
 sfx2/source/view/viewsh.cxx  |  835 ---
 svx/source/accessibility/ChildrenManagerImpl.cxx |   17 
 5 files changed, 642 insertions(+), 245 deletions(-)

New commits:
commit f3b20f31d55f304ed9d4a3eb257bf9d468fffe5f
Author: Marco Cecchetti 
AuthorDate: Tue Oct 10 10:50:50 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 27 19:28:52 2023 +0200

lok: a11y: impress: help screen reader to report shape selection

Refactored LOKDocumentFocusListener::notifyEvent.

Implemented 2 new callbacks:
- LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE: it says the client if
editing in a shape or cell is active or it isn't.
- LOK_CALLBACK_A11Y_SELECTION_CHANGED: it says if a shape has been
selected/unselected, the name of the shape and text content are sent
too for being reported by a screen reader.

(cherry picked from commit 76899152ec3d1924cc72d2b869e197a1e34a0a1a)

Conflicts:
sfx2/source/view/viewsh.cxx

Change-Id: I644bcc7daeb8772805688a9bccdabd0631ce0a22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158562
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bccac7338367..ab4987376f4f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1818,6 +1818,8 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED:
 case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 case LOK_CALLBACK_COLOR_PALETTES:
+case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE:
+case LOK_CALLBACK_A11Y_SELECTION_CHANGED:
 {
 const auto& pos = std::find(m_queue1.rbegin(), m_queue1.rend(), 
type);
 auto pos2 = toQueue2(pos);
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 883a68ce09c6..378347108de6 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -1001,7 +1001,32 @@ typedef enum
  *   the user got in from the outer to the inner; row/column span default
  *   value is 1; paragraph is the cell text content.
  */
-LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67
+LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67,
+
+/**
+ * Accessibility event: text editing in a shape or cell has been 
enabled/disabled
+ *
+ *  {
+ *  "cell": true/false (editing a cell ?)
+ *  "enabled": true|false
+ *  "selection": a selection description
+ *  "paragraph": focused paragraph
+ *  }
+ */
+LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE = 68,
+
+/**
+ * Accessibility event: a selection (of a shape/graphic, etc.) has changed
+ *
+ *  {
+ *  "cell": true/false (selected object is a cell ?)
+ *  "action": "create"|"add"|"remove"
+ *  "name": selected object name
+ *  "text": text content if any
+ *  }
+ */
+LOK_CALLBACK_A11Y_SELECTION_CHANGED = 69
+
 }
 LibreOfficeKitCallbackType;
 
@@ -1166,6 +1191,10 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET";
 case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 return "LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED";
+case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE:
+return "LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE";
+case LOK_CALLBACK_A11Y_SELECTION_CHANGED:
+return "LOK_CALLBACK_A11Y_SELECTION_CHANGED";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index c3df48448815..6c7e6dbfc652 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1494,6 +1494,8 @@ callback (gpointer pData)
 case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 case LOK_CALLBACK_COLOR_PALETTES:
 case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET:
+case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE:
+case LOK_CALLBACK_A11Y_SELECTION_CHANGED:
 {
 // TODO: Implement me
 break;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 34edb460d4e3..8f2218c66175 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -253,6 +253,29 @@ typedef 
std::list> XAccessibleTa
 
 namespace
 {
+constexpr
+bool isText(sal_Int16 nRole)
+{
+return nRole == accessibility::AccessibleRole::DOCUMENT_TEXT;
+}
+
+constexpr
+bool isSpreadsheet(sal_Int16 nRole)
+{
+return nRole == accessibility::AccessibleRole::DOCUMENT_SPREADSHEET;
+}
+
+constexpr
+bool 

[Libreoffice-commits] core.git: desktop/source sfx2/source svx/source

2023-10-22 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx  |2 
 sfx2/source/view/viewsh.cxx  |  135 ---
 svx/source/accessibility/ChildrenManagerImpl.cxx |8 -
 3 files changed, 126 insertions(+), 19 deletions(-)

New commits:
commit c34f465a21dab492afec12011f4a16584a663d9f
Author: Marco Cecchetti 
AuthorDate: Tue Oct 3 12:34:45 2023 +0200
Commit: Caolán McNamara 
CommitDate: Sun Oct 22 16:39:59 2023 +0200

lok: a11y: impress: screen reader support for text shape editing

Now accessibility support can be enabled in Impress.
Fixed an issue that prevented to receive accessibility event when a
shape text content was edited.
Some rectangles overlapping check is performed for excluding not
visible shapes from the a11y tree
Anyway client and core visible area can differ some shape was wrongly
pruned from the a11y tree.
The problem has been fixed by not performing the overlapping test in
the LOK case: we already do the same for shape area invalidation.
In order to avoid the screen reader to report no more focused
paragraph we send an empty paragraph to clear the editable area when
shape selection state changes. When shape ediding becomes active the
text content of the shape is sent to the client.

Change-Id: Ia9ee08d060162891725d26efd2aa36e47b38ed50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157525
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158329
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bbb32dd3d74f..57869a7540ef 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7293,7 +7293,7 @@ static void 
doc_setAccessibilityState(SAL_UNUSED_PARAMETER LibreOfficeKitDocumen
 SolarMutexGuard aGuard;
 
 int nDocType = getDocumentType(pThis);
-if (nDocType != LOK_DOCTYPE_TEXT)
+if (!(nDocType == LOK_DOCTYPE_TEXT || nDocType == 
LOK_DOCTYPE_PRESENTATION))
 return;
 
 SfxLokHelper::setAccessibilityState(nId, nEnabled);
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 68c99691fb4c..34edb460d4e3 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -271,6 +271,28 @@ bool isFocused(const accessibility::AccessibleEventObject& 
aEvent)
 return hasState(aEvent, accessibility::AccessibleStateType::FOCUSED);
 }
 
+sal_Int16 getParentRole(const uno::Reference& 
xAccObject)
+{
+if (!xAccObject.is())
+return 0;
+
+uno::Reference xContext(xAccObject, 
uno::UNO_QUERY);
+if (xContext.is())
+{
+uno::Reference xParent = 
xContext->getAccessibleParent();
+if (xParent.is())
+{
+uno::Reference 
xParentContext(xParent,
+ 
uno::UNO_QUERY);
+if (xParentContext.is())
+{
+return xParentContext->getAccessibleRole();
+}
+}
+}
+return 0;
+}
+
 // Put in rAncestorList all ancestors of xTable up to xAncestorTable or
 // up to the first not-a-table ancestor if xAncestorTable is not an ancestor.
 // xTable is included in the list, xAncestorTable is not included.
@@ -364,6 +386,16 @@ void aboutEvent(std::string msg, const 
accessibility::AccessibleEventObject& aEv
 << "\n  parent: " << 
xContext->getAccessibleParent().get()
 << "\n  child count: " << 
xContext->getAccessibleChildCount());
 }
+else
+{
+SAL_INFO("lok.a11y", msg << ": event id: " << aEvent.EventId
+ << ", no accessible context!");
+}
+}
+else
+{
+SAL_INFO("lok.a11y", msg << ": event id: " << aEvent.EventId
+ << ", no accessible source!");
 }
 uno::Reference< accessibility::XAccessible > xOldValue;
 aEvent.OldValue >>= xOldValue;
@@ -690,6 +722,7 @@ private:
  bool force, std::string msg = "");
 void updateAndNotifyParagraph(const 
uno::Reference& xAccText,
   bool force, std::string msg = "");
+void resetParagraphInfo();
 };
 
 LOKDocumentFocusListener::LOKDocumentFocusListener(const SfxViewShell* 
pViewShell)
@@ -891,6 +924,20 @@ bool LOKDocumentFocusListener::updateParagraphInfo(const 
uno::ReferencegetSelectionEnd();
 m_nListPrefixLength = getListPrefixSize(xAccText);
 
+// Inside a text shape when there is no selection, selection-start and 
selection-end are
+// set to current caret position instead of -1. Moreover, inside a 
text shape pressing
+// delete or backspace with an empty selection really deletes text and 
not only the empty
+  

[Libreoffice-commits] core.git: desktop/source sfx2/source

2023-10-18 Thread Pranam Lashkari (via logerrit)
 desktop/source/lib/init.cxx  |3 ++-
 sfx2/source/control/unoctitm.cxx |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit b83f069101f1e6d8aaac09a805f02bbc4c619e7a
Author: Pranam Lashkari 
AuthorDate: Wed Jul 26 16:39:49 2023 +0700
Commit: Pranam Lashkari 
CommitDate: Wed Oct 18 23:57:18 2023 +0200

LOK: send state of protected cells

Change-Id: I432a3af50b6089faa80a28804d95d816af6cd278
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154936
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-by: Pranam Lashkari 
(cherry picked from commit 5f13751cefd725cb2a38e66c9484046e6141c6c2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158150
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6d9697d60aed..416265df4099 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3842,7 +3842,8 @@ static void doc_iniUnoCommands ()
 OUString(".uno:InsertDropdownContentControl"),
 OUString(".uno:InsertPlainTextContentControl"),
 OUString(".uno:InsertPictureContentControl"),
-OUString(".uno:DataFilterAutoFilter")
+OUString(".uno:DataFilterAutoFilter"),
+OUString(".uno:CellProtection")
 };
 
 util::URL aCommandURL;
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 89e94caff794..1f3f37f5fc1b 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -935,7 +935,8 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, 
SfxViewFrame* pViewFra
 aEvent.FeatureURL.Path == "SpacePara1" ||
 aEvent.FeatureURL.Path == "SpacePara15" ||
 aEvent.FeatureURL.Path == "SpacePara2" ||
-aEvent.FeatureURL.Path == "DataFilterAutoFilter")
+aEvent.FeatureURL.Path == "DataFilterAutoFilter" ||
+aEvent.FeatureURL.Path == "CellProtection")
 {
 bool bTemp = false;
 aEvent.State >>= bTemp;


[Libreoffice-commits] core.git: desktop/source

2023-10-14 Thread Andrea Gelmini (via logerrit)
 desktop/source/lib/init.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 0379bdc8c5cd8cdca64e3e0d567b32699308dcac
Author: Andrea Gelmini 
AuthorDate: Thu Oct 12 13:04:14 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 14 16:30:51 2023 +0200

Remove duplicated include

Change-Id: I0a5bbd375e1841e3a441ab241b18933858ecd45c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157864
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fc57d748d5d4..6d9697d60aed 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -9,7 +9,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 


[Libreoffice-commits] core.git: desktop/source svx/source vcl/source

2023-10-11 Thread Ashod Nakashian (via logerrit)
 desktop/source/lib/init.cxx|   36 +
 svx/source/sdr/contact/viewcontact.cxx |2 +
 vcl/source/filter/graphicfilter.cxx|2 +
 3 files changed, 40 insertions(+)

New commits:
commit 01e89930f8a0d50758ed23b0cf2bfd7b9ee47b9b
Author: Ashod Nakashian 
AuthorDate: Sun Jul 23 10:07:04 2023 -0400
Commit: Caolán McNamara 
CommitDate: Wed Oct 11 12:45:49 2023 +0200

lok: flush the VOC primitives when trimming memory

Signed-off-by: Ashod Nakashian 
Change-Id: I0a7748a1fb1b58b3bcfc6b8fdfa1410a345849a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154812
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 5fba074e7f22ff0e5d5b9591a912193f7be8c08c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154868
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 67957a370751..40c11e54d080 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -8,6 +8,11 @@
  */
 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -3170,6 +3175,37 @@ static char* lo_extractRequest(LibreOfficeKit* 
/*pThis*/, const char* pFilePath)
 static void lo_trimMemory(LibreOfficeKit* /* pThis */, int nTarget)
 {
 vcl::lok::trimMemory(nTarget);
+
+if (nTarget > 2000)
+{
+SolarMutexGuard aGuard;
+
+// Flush all buffered VOC primitives from the pages.
+SfxViewShell* pViewShell = SfxViewShell::Current();
+if (pViewShell)
+{
+const SdrView* pView = pViewShell->GetDrawView();
+if (pView)
+{
+SdrPageView* pPageView = pView->GetSdrPageView();
+if (pPageView)
+{
+SdrPage* pCurPage = pPageView->GetPage();
+if (pCurPage)
+{
+SdrModel& sdrModel = 
pCurPage->getSdrModelFromSdrPage();
+for (sal_uInt16 i = 0; i < sdrModel.GetPageCount(); 
++i)
+{
+SdrPage* pPage = sdrModel.GetPage(i);
+if (pPage)
+
pPage->GetViewContact().flushViewObjectContacts();
+}
+}
+}
+}
+}
+}
+
 if (nTarget > 1000)
 {
 #ifdef HAVE_MALLOC_TRIM
diff --git a/svx/source/sdr/contact/viewcontact.cxx 
b/svx/source/sdr/contact/viewcontact.cxx
index 3529f98cf385..99106d0d6ed0 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -58,6 +58,8 @@ void ViewContact::deleteAllVOCs()
 
 // assert when there were new entries added during deletion
 DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted 
ViewObjectContactList in VC (!)");
+
+mxViewIndependentPrimitive2DSequence = 
drawinglayer::primitive2d::Primitive2DContainer();
 }
 
 // get an Object-specific ViewObjectContact for a specific
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index e323418674c8..f082e5b17d8b 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -694,12 +694,14 @@ void 
GraphicFilter::MakeGraphicsAvailableThreaded(std::vector& graphic
 if( toLoad.empty())
 return;
 std::vector< std::unique_ptr> streams;
+streams.reserve(toLoad.size());
 for( auto graphic : toLoad )
 {
 streams.push_back( std::make_unique( 
const_cast(graphic->GetSharedGfxLink()->GetData()),
 graphic->GetSharedGfxLink()->GetDataSize(), StreamMode::READ | 
StreamMode::WRITE));
 }
 std::vector< std::shared_ptr> loadedGraphics;
+loadedGraphics.reserve(streams.size());
 ImportGraphics(loadedGraphics, std::move(streams));
 assert(loadedGraphics.size() == toLoad.size());
 for( size_t i = 0; i < toLoad.size(); ++i )


[Libreoffice-commits] core.git: desktop/source

2023-10-10 Thread Andras Timar (via logerrit)
 desktop/source/lib/init.cxx |   21 +
 1 file changed, 21 insertions(+)

New commits:
commit a6c68549d0132d76a04d21c146a48345742c451f
Author: Andras Timar 
AuthorDate: Sun May 14 18:19:18 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Oct 10 17:31:52 2023 +0200

lok: set help root URL

Change-Id: Id4089027f095daebb69942eb3315d516cfb14779
(cherry picked from commit 2239e4c1b2dcf06650316a106e5bd883ceefb6c1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157750
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a2399b125b94..67957a370751 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7678,6 +7678,25 @@ static void activateNotebookbar(std::u16string_view rApp)
 }
 }
 
+void setHelpRootURL()
+{
+const char* pHelpRootURL = ::getenv("LOK_HELP_URL");
+if (pHelpRootURL)
+{
+OUString aHelpRootURL = OStringToOUString(pHelpRootURL, 
RTL_TEXTENCODING_UTF8);
+try
+{
+std::shared_ptr 
batch(comphelper::ConfigurationChanges::create());
+officecfg::Office::Common::Help::HelpRootURL::set(aHelpRootURL, 
batch);
+batch->commit();
+}
+catch (uno::Exception const& rException)
+{
+SAL_WARN("lok", "Failed to set the help root URL: " << 
rException.Message);
+}
+}
+}
+
 void setCertificateDir()
 {
 const char* pEnvVarString = ::getenv("LO_CERTIFICATE_DATABASE_PATH");
@@ -8106,6 +8125,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 }
 #endif
 
+
+setHelpRootURL();
 setCertificateDir();
 setDeeplConfig();
 setLanguageToolConfig();


[Libreoffice-commits] core.git: desktop/source

2023-10-10 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx |   11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

New commits:
commit fa834e64e927efca00c9c47edfee58f0714c4fd4
Author: Henry Castro 
AuthorDate: Mon Sep 25 16:23:20 2023 -0400
Commit: Caolán McNamara 
CommitDate: Tue Oct 10 09:30:46 2023 +0200

lok: fix getting SID_DOC_READONLY slot property

Unfortunately, the property is not always set when
import XLSX documents.

Signed-off-by: Henry Castro 
Change-Id: If501734704174b92b3589b61a019ba973592c331
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157259
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157736
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 52ca105d09b9..a2399b125b94 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5982,18 +5982,9 @@ static char* getDocReadOnly(LibreOfficeKitDocument* 
pThis)
 if (!pObjectShell)
 return nullptr;
 
-SfxMedium* pMedium = pObjectShell->GetMedium();
-if (!pMedium)
-return nullptr;
-
-bool bDocReadOnly = false;
-if (const SfxBoolItem* pReadOnlyItem =
-pMedium->GetItemSet().GetItem(SID_DOC_READONLY, false))
-bDocReadOnly = pReadOnlyItem->GetValue();
-
 boost::property_tree::ptree aTree;
 aTree.put("commandName", ".uno:ReadOnly");
-aTree.put("success", bDocReadOnly);
+aTree.put("success", pObjectShell->IsLoadReadonly());
 
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);


[Libreoffice-commits] core.git: desktop/source

2023-10-09 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx |   44 +++-
 1 file changed, 43 insertions(+), 1 deletion(-)

New commits:
commit 4dade552c67a36f83cb419f90369722dc913d9fe
Author: Henry Castro 
AuthorDate: Fri Sep 8 14:23:33 2023 -0400
Commit: Henry Castro 
CommitDate: Mon Oct 9 21:32:49 2023 +0200

lok: add getter function to read "ReadOnly" flag

Signed-off-by: Henry Castro 
Change-Id: Id9d2bc638d0f48cb33764b07fb8976b97117a621
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156621
Reviewed-by: Ashod Nakashian 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157733
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d0c3e5fe939b..52ca105d09b9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5968,6 +5968,44 @@ static void doc_resetSelection(LibreOfficeKitDocument* 
pThis)
 pDoc->resetSelection();
 }
 
+static char* getDocReadOnly(LibreOfficeKitDocument* pThis)
+{
+LibLODocument_Impl* pDocument = static_cast(pThis);
+if (!pDocument)
+return nullptr;
+
+SfxBaseModel* pBaseModel = 
dynamic_cast(pDocument->mxComponent.get());
+if (!pBaseModel)
+return nullptr;
+
+SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell();
+if (!pObjectShell)
+return nullptr;
+
+SfxMedium* pMedium = pObjectShell->GetMedium();
+if (!pMedium)
+return nullptr;
+
+bool bDocReadOnly = false;
+if (const SfxBoolItem* pReadOnlyItem =
+pMedium->GetItemSet().GetItem(SID_DOC_READONLY, false))
+bDocReadOnly = pReadOnlyItem->GetValue();
+
+boost::property_tree::ptree aTree;
+aTree.put("commandName", ".uno:ReadOnly");
+aTree.put("success", bDocReadOnly);
+
+std::stringstream aStream;
+boost::property_tree::write_json(aStream, aTree);
+char* pJson = static_cast(malloc(aStream.str().size() + 1));
+if (!pJson)
+return nullptr;
+
+strcpy(pJson, aStream.str().c_str());
+pJson[aStream.str().size()] = '\0';
+return pJson;
+}
+
 static char* getLanguages(LibreOfficeKitDocument* pThis, const char* pCommand)
 {
 css::uno::Sequence< css::lang::Locale > aLocales;
@@ -6345,7 +6383,11 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 return nullptr;
 }
 
-if (!strcmp(pCommand, ".uno:LanguageStatus"))
+if (!strcmp(pCommand, ".uno:ReadOnly"))
+{
+return getDocReadOnly(pThis);
+}
+else if (!strcmp(pCommand, ".uno:LanguageStatus"))
 {
 return getLanguages(pThis, pCommand);
 }


[Libreoffice-commits] core.git: desktop/source uui/source

2023-10-09 Thread Henry Castro (via logerrit)
 desktop/source/lib/lokinteractionhandler.cxx |   24 
 desktop/source/lib/lokinteractionhandler.hxx |2 ++
 uui/source/iahndl-errorhandler.cxx   |1 -
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 447d6af45b3c454bb858bc904f50e500aaaefc60
Author: Henry Castro 
AuthorDate: Wed Sep 6 10:28:59 2023 -0400
Commit: Henry Castro 
CommitDate: Mon Oct 9 16:32:35 2023 +0200

lok: implement "handleLoadReadOnlyRequest"

Is used for interaction handle to query user decision
regarding to open the document read only.

Signed-off-by: Henry Castro 
Change-Id: Ia945eae7b1627d57d6211ae92a784d50313c2627
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156623
Reviewed-by: Ashod Nakashian 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157703
Tested-by: Jenkins

diff --git a/desktop/source/lib/lokinteractionhandler.cxx 
b/desktop/source/lib/lokinteractionhandler.cxx
index 6df4fe2d98e5..a05091cedf5e 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -23,6 +23,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -368,6 +369,26 @@ bool 
LOKInteractionHandler::handlePackageReparationRequest(const uno::Reference<
 return false;
 }
 
+bool LOKInteractionHandler::handleLoadReadOnlyRequest(const 
uno::Reference& xRequest)
+{
+uno::Any const request(xRequest->getRequest());
+
+OUString aFileName;
+beans::NamedValue aLoadReadOnlyRequest;
+if ((request >>= aLoadReadOnlyRequest) &&
+aLoadReadOnlyRequest.Name == "LoadReadOnlyRequest" &&
+(aLoadReadOnlyRequest.Value >>= aFileName))
+{
+auto 
xInteraction(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(),
 nullptr));
+
+if (xInteraction.is())
+xInteraction->handleInteractionRequest(xRequest);
+
+return true;
+}
+return false;
+}
+
 bool LOKInteractionHandler::handleFilterOptionsRequest(const 
uno::Reference& xRequest)
 {
 document::FilterOptionsRequest aFilterOptionsRequest;
@@ -410,6 +431,9 @@ sal_Bool SAL_CALL 
LOKInteractionHandler::handleInteractionRequest(
 if (handlePackageReparationRequest(xRequest))
 return true;
 
+if (handleLoadReadOnlyRequest(xRequest))
+return true;
+
 // TODO: perform more interactions 'for real' like the above
 selectApproved(rContinuations);
 
diff --git a/desktop/source/lib/lokinteractionhandler.hxx 
b/desktop/source/lib/lokinteractionhandler.hxx
index fc2bf12b48cc..c3641db0762f 100644
--- a/desktop/source/lib/lokinteractionhandler.hxx
+++ b/desktop/source/lib/lokinteractionhandler.hxx
@@ -79,6 +79,8 @@ private:
 static bool handleFilterOptionsRequest(const 
::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& 
Request);
 static bool handlePackageReparationRequest(const 
css::uno::Reference& xRequest);
 
+static bool handleLoadReadOnlyRequest(const 
css::uno::Reference& xRequest);
+
 public:
 void SetPassword(char const* pPassword);
 
diff --git a/uui/source/iahndl-errorhandler.cxx 
b/uui/source/iahndl-errorhandler.cxx
index c89e66b93c35..e4be8a713911 100644
--- a/uui/source/iahndl-errorhandler.cxx
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -94,7 +94,6 @@ executeErrorDialog(
 break;
 }
 
-
 switch (nButtonMask)
 {
 case MessageBoxStyle::NONE:


[Libreoffice-commits] core.git: desktop/source sfx2/source uui/source

2023-10-02 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/lokinteractionhandler.cxx |   21 +
 desktop/source/lib/lokinteractionhandler.hxx |1 +
 sfx2/source/doc/sfxbasemodel.cxx |4 +++-
 uui/source/iahndl.cxx|2 +-
 4 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit e2ee3dd61ab8ea5d970d8da5df3233e7bba5909e
Author: Szymon Kłos 
AuthorDate: Fri Sep 22 11:11:06 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Oct 2 17:55:04 2023 +0200

lok: add broken package interaction handler

in case of repair don't use template flag to not make
file readonly so we can overwrite it and upload to storage
updated version

Conflicts:
desktop/source/lib/lokinteractionhandler.cxx
desktop/source/lib/lokinteractionhandler.hxx
sfx2/source/doc/sfxbasemodel.cxx

Change-Id: Ia460009fc3b77582dde06dd6f94a85aef3aee11b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157493
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/lokinteractionhandler.cxx 
b/desktop/source/lib/lokinteractionhandler.cxx
index ec3d2e365c45..6df4fe2d98e5 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -350,6 +351,23 @@ bool 
LOKInteractionHandler::handleMacroConfirmationRequest(const uno::Reference<
 return false;
 }
 
+bool LOKInteractionHandler::handlePackageReparationRequest(const 
uno::Reference& xRequest)
+{
+uno::Any const request(xRequest->getRequest());
+
+document::BrokenPackageRequest aBrokenPackageRequest;
+if (request >>= aBrokenPackageRequest)
+{
+auto 
xInteraction(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(),
 nullptr));
+
+if (xInteraction.is())
+xInteraction->handleInteractionRequest(xRequest);
+
+return true;
+}
+return false;
+}
+
 bool LOKInteractionHandler::handleFilterOptionsRequest(const 
uno::Reference& xRequest)
 {
 document::FilterOptionsRequest aFilterOptionsRequest;
@@ -389,6 +407,9 @@ sal_Bool SAL_CALL 
LOKInteractionHandler::handleInteractionRequest(
 if (handleMacroConfirmationRequest(xRequest))
 return true;
 
+if (handlePackageReparationRequest(xRequest))
+return true;
+
 // TODO: perform more interactions 'for real' like the above
 selectApproved(rContinuations);
 
diff --git a/desktop/source/lib/lokinteractionhandler.hxx 
b/desktop/source/lib/lokinteractionhandler.hxx
index 5c6c6f87de6d..fc2bf12b48cc 100644
--- a/desktop/source/lib/lokinteractionhandler.hxx
+++ b/desktop/source/lib/lokinteractionhandler.hxx
@@ -77,6 +77,7 @@ private:
 static bool handleMacroConfirmationRequest(const 
css::uno::Reference& xRequest);
 
 static bool handleFilterOptionsRequest(const 
::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& 
Request);
+static bool handlePackageReparationRequest(const 
css::uno::Reference& xRequest);
 
 public:
 void SetPassword(char const* pPassword);
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index e5eb0177fe6d..761bd16d2a76 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1980,9 +1980,11 @@ void SAL_CALL SfxBaseModel::load(   const Sequence< 
beans::PropertyValue >& seqA
 xHandler->handle( aRequest.GetRequest() );
 if( aRequest.isApproved() )
 {
+// lok: we want to overwrite file in jail, so don't use 
template flag
+bool bIsLOK = comphelper::LibreOfficeKit::isActive();
 // broken package: try second loading and allow repair
 pMedium->GetItemSet().Put( SfxBoolItem( SID_REPAIRPACKAGE, 
true ) );
-pMedium->GetItemSet().Put( SfxBoolItem( SID_TEMPLATE, true 
) );
+pMedium->GetItemSet().Put( SfxBoolItem( SID_TEMPLATE, 
!bIsLOK ) );
 pMedium->GetItemSet().Put( SfxStringItem( 
SID_DOCINFO_TITLE, aDocName ) );
 
 // the error must be reset and the storage must be 
reopened in new mode
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index b6e88bcd3e40..e4aedbfc72dd 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -936,7 +936,7 @@ executeMessageBox(
 SolarMutexGuard aGuard;
 
 std::unique_ptr 
xBox(Application::CreateMessageDialog(pParent, eMessageType,
-eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : 
VclButtonsType::Ok, rMessage));
+eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : 
VclButtonsType::Ok, rMessage, GetpApp()));
 xBox->set_title(rTitle);
 
 short nMessResult = xBox->run();


[Libreoffice-commits] core.git: desktop/source filter/Configuration_filter.mk filter/source officecfg/registry sd/inc sd/Library_sd.mk sd/qa sd/source

2023-09-28 Thread Xisco Fauli (via logerrit)
 desktop/source/lib/init.cxx |2 
 filter/Configuration_filter.mk  |2 
 filter/source/config/fragments/filters/draw_html_Export.xcu |   30 
 filter/source/config/fragments/filters/impress_html_Export.xcu  |   30 
 officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu |2 
 sd/Library_sd.mk|2 
 sd/inc/sdhtmlfilter.hxx |   34 
 sd/qa/unit/HtmlExportTest.cxx   |   29 
 sd/qa/unit/dialogs-test.cxx |1 
 sd/source/filter/html/htmlex.cxx|  858 
++
 sd/source/filter/html/htmlex.hxx|   84 
 sd/source/filter/html/sdhtmlfilter.cxx  |   44 
 sd/source/ui/docshell/docshel4.cxx  |7 
 13 files changed, 1118 insertions(+), 7 deletions(-)

New commits:
commit 608c35665bee5990bd7e2799854e233d1454b6a4
Author: Xisco Fauli 
AuthorDate: Wed Sep 27 10:58:34 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Sep 28 15:39:03 2023 +0200

tdf#105303: re-introduce single-document html export filter

which was deleted in 28b6480c6bdd179f3943f768926b7f196226c768
"tdf#105303: Drop html export wizard"

With this commit, exporting to HTML from File - Export dialog
behaves the same way as using --convert-to html:"impress_html_Export"
from the commandline. The slides are exported as a single document
For more information see the discussion in tdf#105303

Change-Id: Ib96b3d855ae807e79f276099422903c86ea2628a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157331
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 777d1030d075..434b65319776 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -335,6 +335,7 @@ const ExtensionMap aCalcExtensionMap[] =
 const ExtensionMap aImpressExtensionMap[] =
 {
 { "fodp",  "OpenDocument Presentation Flat XML" },
+{ "html",  "impress_html_Export" },
 { "odg",   "impress8_draw" },
 { "odp",   "impress8" },
 { "otp",   "impress8_template" },
@@ -354,6 +355,7 @@ const ExtensionMap aImpressExtensionMap[] =
 const ExtensionMap aDrawExtensionMap[] =
 {
 { "fodg",  "draw_ODG_FlatXML" },
+{ "html",  "draw_html_Export" },
 { "odg",   "draw8" },
 { "pdf",   "draw_pdf_Export" },
 { "svg",   "draw_svg_Export" },
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 921189c4de25..bd3d3486234e 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -764,6 +764,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f
draw_emz_Export \
draw_eps_Export \
draw_gif_Export \
+   draw_html_Export \
draw_jpg_Export \
draw_png_Export \
draw_svg_Export \
@@ -808,6 +809,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_impressgraphic
impress_emf_Export \
impress_eps_Export \
impress_gif_Export \
+   impress_html_Export \
impress_jpg_Export \
impress_png_Export \
impress_svg_Export \
diff --git a/filter/source/config/fragments/filters/draw_html_Export.xcu 
b/filter/source/config/fragments/filters/draw_html_Export.xcu
new file mode 100644
index ..ebb14b75b19f
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_html_Export.xcu
@@ -0,0 +1,30 @@
+
+
+EXPORT ALIEN
+
+
+
+0
+graphic_HTML
+
+com.sun.star.drawing.DrawingDocument
+
+HTML Document (Draw)
+
+
diff --git a/filter/source/config/fragments/filters/impress_html_Export.xcu 
b/filter/source/config/fragments/filters/impress_html_Export.xcu
new file mode 100644
index ..1e0fb435e01e
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_html_Export.xcu
@@ -0,0 +1,30 @@
+
+
+EXPORT ALIEN
+
+
+
+0
+graphic_HTML
+
+com.sun.star.presentation.PresentationDocument
+
+HTML Document (Impress)
+
+
diff --git a/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu 
b/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu
index 3dc6272ab7b2..5dcce7b1e688 100644
--- a/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu
+++ b/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu
@@ -26,7 +26,7 @@
 
 
   
-draw8;draw8_template;StarOffice XML 
(Draw);draw_StarOffice_XML_Draw_Template;OpenDocument Drawing Flat 
XML;draw_pdf_Export;draw_flash_Export;WordPerfect Graphics;DXF - AutoCAD 
Interchange;EMF - MS Windows 

[Libreoffice-commits] core.git: desktop/source

2023-09-02 Thread Andrea Gelmini (via logerrit)
 desktop/source/lib/init.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit b0b7db318717b64259fc136e8d5b3268cd9af1c3
Author: Andrea Gelmini 
AuthorDate: Fri Sep 1 18:17:47 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Sep 2 12:03:21 2023 +0200

Remove duplicated include

Change-Id: I3a3ca7313e1921f806b256c7a66340d0e90a582e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156428
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4b81619cbc1f..434b65319776 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -127,7 +127,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #ifdef IOS


[Libreoffice-commits] core.git: desktop/source

2023-09-01 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 4c2aa7e073d6ab9f063272011d2866addeeed526
Author: Henry Castro 
AuthorDate: Tue Aug 8 15:12:27 2023 -0400
Commit: Henry Castro 
CommitDate: Fri Sep 1 15:59:34 2023 +0200

lok: use constant keys enumeration

Useful to better readability code.

Signed-off-by: Henry Castro 
Change-Id: I335d010c3b1ddf3f8052b7ed6cb0f94ad20045f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155495
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156416
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 21c47eacdfc7..6db6f722bee6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4534,12 +4534,12 @@ static void 
doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWi
 // backspace
 if (nLOKWindowId == 0)
 {
-KeyEvent aEvt(8, 1283);
+KeyEvent aEvt(8, KEY_BACKSPACE);
 for (int i = 0; i < nCharBefore; ++i)
 pWindow->KeyInput(aEvt);
 }
 else
-SfxLokHelper::postKeyEventAsync(pWindow, LOK_KEYEVENT_KEYINPUT, 8, 
1283, nCharBefore - 1);
+SfxLokHelper::postKeyEventAsync(pWindow, LOK_KEYEVENT_KEYINPUT, 8, 
KEY_BACKSPACE, nCharBefore - 1);
 }
 
 if (nCharAfter > 0)
@@ -4547,12 +4547,12 @@ static void 
doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWi
 // delete (forward)
 if (nLOKWindowId == 0)
 {
-KeyEvent aEvt(46, 1286);
+KeyEvent aEvt(46, KEY_DELETE);
 for (int i = 0; i < nCharAfter; ++i)
 pWindow->KeyInput(aEvt);
 }
 else
-SfxLokHelper::postKeyEventAsync(pWindow, LOK_KEYEVENT_KEYINPUT, 
46, 1286, nCharAfter - 1);
+SfxLokHelper::postKeyEventAsync(pWindow, LOK_KEYEVENT_KEYINPUT, 
46, KEY_DELETE, nCharAfter - 1);
 }
 }
 


[Libreoffice-commits] core.git: desktop/source

2023-08-29 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit beeeb3b8d5dcdee45d3fb2cb97f3def789db0f6a
Author: Szymon Kłos 
AuthorDate: Tue Aug 8 06:49:04 2023 +0200
Commit: Szymon Kłos 
CommitDate: Tue Aug 29 11:18:21 2023 +0200

jsdialog: detect special window id earlier

Change-Id: Ib90d9d728d93a26d44a7f52b7ca0074338b1fae9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155853
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156235
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 86a32708e59b..21c47eacdfc7 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4721,11 +4721,21 @@ static void lcl_sendDialogEvent(unsigned long long int 
nWindowId, const char* pA
 try
 {
 OUString sControlId = aMap["id"];
+OUString sWindowId = OUString::number(nWindowId);
+OUString sCurrentShellId = OUString::number(nCurrentShellId);
+
+// special values for window id
+if (nWindowId == static_cast(-1))
+sWindowId = sCurrentShellId + "sidebar";
+if (nWindowId == static_cast(-2))
+sWindowId = sCurrentShellId + "notebookbar";
+if (nWindowId == static_cast(-3))
+sWindowId = sCurrentShellId + "formulabar";
 
 // dialogs send own id but notebookbar and sidebar controls are 
remembered by SfxViewShell id
-if (jsdialog::ExecuteAction(OUString::number(nWindowId), sControlId, 
aMap))
+if (jsdialog::ExecuteAction(sWindowId, sControlId, aMap))
 return;
-auto sCurrentShellId = OUString::number(nCurrentShellId);
+
 if (jsdialog::ExecuteAction(sCurrentShellId + "sidebar", sControlId, 
aMap))
 return;
 if (jsdialog::ExecuteAction(sCurrentShellId + "notebookbar", 
sControlId, aMap))


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sfx2/source

2023-08-14 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx  |2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   44 +++-
 libreofficekit/source/gtk/lokdocview.cxx |1 
 sfx2/source/view/viewsh.cxx  |  280 ---
 4 files changed, 302 insertions(+), 25 deletions(-)

New commits:
commit 59c2e114f76247158a0da9dcf91d6449d5d61224
Author: Marco Cecchetti 
AuthorDate: Wed Jun 7 14:03:56 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 14 08:09:53 2023 +0200

lok: a11y: when we are inside a table notify table and current cell info

When we get in one or more tables we notify row and column count.
When we get out one or more table we notify we are leaving a table.
When the fosused cell changes we notify the new row/col index.
The paragraph content is notified together with table info, so that
client has some opportunity for getting the screen reader to report
together content and table info.

Change-Id: Ic524259aa1879a70fc3de2467bdee27475352b7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155577
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 42d838b889b6..6d5295222f74 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1798,6 +1798,7 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 case LOK_CALLBACK_A11Y_FOCUS_CHANGED:
 case LOK_CALLBACK_A11Y_CARET_CHANGED:
 case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED:
+case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 case LOK_CALLBACK_COLOR_PALETTES:
 {
 const auto& pos = std::find(m_queue1.rbegin(), m_queue1.rend(), 
type);
@@ -1860,6 +1861,7 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 case LOK_CALLBACK_A11Y_FOCUS_CHANGED:
 case LOK_CALLBACK_A11Y_CARET_CHANGED:
 case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED:
+case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 case LOK_CALLBACK_COLOR_PALETTES:
 {
 if (removeAll(type))
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index b7a43acf7d27..e7f31c2a14fe 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -924,14 +924,17 @@ typedef enum
LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR = 61,
 
 /**
- * Accessibility event: a paragraph get focus.
+ * Accessibility event: a paragraph got focus.
  * The payload is a json with the following structure.
  *
  *   {
  *   "content": ""
  *   "position": N
+ *   "start": N1
+ *   "end": N2
  *   }
- *   where N is the position of the text cursor inside the focused 
paragraph.
+ *   where N is the position of the text cursor inside the focused 
paragraph,
+ *   and [N1,N2] is the range of the text selection inside the focused 
paragraph.
  */
 LOK_CALLBACK_A11Y_FOCUS_CHANGED = 62,
 
@@ -946,7 +949,7 @@ typedef enum
 LOK_CALLBACK_A11Y_CARET_CHANGED = 63,
 
 /**
- * Accessibility event: text cursor position has changed.
+ * Accessibility event: text selection has changed.
  *
  *  {
  *  "start": N1
@@ -965,7 +968,38 @@ typedef enum
  * Informs that the document password has been successfully changed.
  * The payload contains the new password and the type.
 */
-LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66
+LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66,
+
+/**
+ * Accessibility event: a cell got focus.
+ * The payload is a json with the following structure.
+ *
+ *   {
+ *   "outCount": 
+ *   "inList": [
+ *   {
+ *   "rowCount": 
+ *   "colCount": 
+ *   },
+ *   ...
+ *   {
+ *   "rowCount": 
+ *   "colCount": 
+ *   }
+ *   ]
+ *   "row": 
+ *   "col": 
+ *   "rowSpan": 
+ *   "colSpan": 
+ *   "paragraph": {
+ *   
+ *}
+ *   }
+ *   where row/column indexes start from 0, inList is the list of tables
+ *   the user got in from the outer to the inner; row/column span default
+ *   value is 1; paragraph is the cell text content.
+ */
+LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67
 }
 LibreOfficeKitCallbackType;
 
@@ -1128,6 +1162,8 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_COLOR_PALETTES";
 case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET:
 return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET";
+case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
+return "LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED";
 }
 
 assert(!"Unknown 

[Libreoffice-commits] core.git: desktop/source sfx2/source

2023-08-11 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx |1 
 sfx2/source/view/viewsh.cxx |  558 +---
 2 files changed, 374 insertions(+), 185 deletions(-)

New commits:
commit 5964796de82a4050081d25ab20151020de0a16cc
Author: Marco Cecchetti 
AuthorDate: Mon May 22 16:32:50 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Aug 11 16:13:36 2023 +0200

lok: a11y: paragraph notifyied on text change, even coming from another view

Debug code has been re-organized.
Paragraph content is notifyied on any text change.
That fixed issues related to fast typing.
Paragraph content is also notified on text changed performed in
another view.
A paragraph is regarded as focused whenever the cursor position is
valid.

(cherry picked from commit cd726ba43c22e723b243dd6dfd5e3c253e81000b)

Conflicts:
sfx2/source/view/viewsh.cxx

Change-Id: I33a187ced368b74824e55265be921804a492349c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155574
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 932810fd4758..42d838b889b6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7023,7 +7023,6 @@ static void doc_setViewTimezone(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* /*p
 static void doc_setAccessibilityState(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* pThis, int nId, bool nEnabled)
 {
 SolarMutexGuard aGuard;
-SetLastExceptionMsg();
 
 int nDocType = getDocumentType(pThis);
 if (nDocType != LOK_DOCTYPE_TEXT)
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index cef69764bb14..0d61e2f3f005 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -237,6 +238,246 @@ void SAL_CALL 
SfxClipboardChangeListener::changedContents( const datatransfer::c
 delete pInfo;
 }
 
+namespace
+{
+
+bool hasState(const accessibility::AccessibleEventObject& aEvent, ::sal_Int64 
nState)
+{
+bool res = false;
+uno::Reference< accessibility::XAccessibleContext > 
xContext(aEvent.Source, uno::UNO_QUERY);
+if (xContext.is())
+{
+::sal_Int64 nStateSet = xContext->getAccessibleStateSet();
+res = (nStateSet & nState) != 0;
+}
+return res;
+}
+
+bool isFocused(const accessibility::AccessibleEventObject& aEvent)
+{
+return hasState(aEvent, accessibility::AccessibleStateType::FOCUSED);
+}
+
+std::string stateSetToString(::sal_Int64 stateSet)
+{
+static const std::string states[34] = {
+"ACTIVE", "ARMED", "BUSY", "CHECKED", "DEFUNC",
+"EDITABLE", "ENABLED", "EXPANDABLE", "EXPANDED", "FOCUSABLE",
+"FOCUSED", "HORIZONTAL", "ICONIFIED", "INDETERMINATE", 
"MANAGES_DESCENDANTS",
+"MODAL", "MULTI_LINE", "MULTI_SELECTABLE", "OPAQUE", "PRESSED",
+"RESIZABLE", "SELECTABLE", "SELECTED", "SENSITIVE", "SHOWING",
+"SINGLE_LINE", "STALE", "TRANSIENT", "VERTICAL", "VISIBLE",
+"MOVEABLE", "DEFAULT", "OFFSCREEN", "COLLAPSE"
+};
+
+if (stateSet == 0)
+return "INVALID";
+::sal_Int64 state = 1;
+std::string s;
+for (int i = 0; i < 34; ++i)
+{
+if (stateSet & state)
+{
+s += states[i];
+s += "|";
+}
+state <<= 1;
+}
+return s;
+}
+
+void aboutView(std::string msg,  const void* pInstance, const SfxViewShell* 
pViewShell)
+{
+if (!pViewShell)
+return;
+
+SAL_INFO("lok.a11y", ">>> " << msg << ": instance: " << pInstance
+<< ", VIED ID: " <<  pViewShell->GetViewShellId().get() << " <<<");
+}
+
+void aboutEvent(std::string msg, const accessibility::AccessibleEventObject& 
aEvent)
+{
+try
+{
+uno::Reference< accessibility::XAccessible > xSource(aEvent.Source, 
uno::UNO_QUERY);
+if (xSource.is())
+{
+uno::Reference< accessibility::XAccessibleContext > xContext =
+xSource->getAccessibleContext();
+
+if (xContext.is())
+{
+SAL_INFO("lok.a11y", msg << ": event id: " << aEvent.EventId
+<< "\n  xSource: " << xSource.get()
+<< "\n  role: " << xContext->getAccessibleRole()
+<< "\n  name: " << xContext->getAccessibleName()
+<< "\n  index in parent: " << 
xContext->getAccessibleIndexInParent()
+<< "\n  state set: " << 
stateSetToString(xContext->getAccessibleStateSet())
+<< "\n  parent: " << 
xContext->getAccessibleParent().get()
+<< "\n  child count: " << 
xContext->getAccessibleChildCount());
+}
+}
+uno::Reference< accessibility::XAccessible > xOldValue;
+aEvent.OldValue >>= 

[Libreoffice-commits] core.git: desktop/source

2023-08-02 Thread Paris Oplopoios (via logerrit)
 desktop/source/lib/init.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 06ebb2a0c94e89eb638b0aec3d597a83dfafd10c
Author: Paris Oplopoios 
AuthorDate: Wed Jul 26 14:19:35 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Aug 2 23:39:34 2023 +0200

Compare viewRenderState before setting view on doc_paintPartTile

It shouldn't be the case that the view is changed upon painting a tile
if the new view has different view options, as it may have a different
theme (light/dark)

Change-Id: Ie218ab1ca99a588cd04e93deb7b42a18b354b811
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154940
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 8e90368b55b2a8c23ccae8aa6cd1e157294a67db)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155172
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 08609ef442d9..932810fd4758 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4118,6 +4118,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 int nViewId = nOrigViewId;
 int nLastNonEditorView = -1;
 int nViewMatchingMode = -1;
+SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
+
 if (!isText)
 {
 // Check if just switching to another view is enough, that has
@@ -4129,11 +4131,16 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 {
 bool bIsInEdit = pViewShell->GetDrawView() &&
 pViewShell->GetDrawView()->GetTextEditOutliner();
-if (!bIsInEdit)
+
+OString sCurrentViewRenderState = 
pDoc->getViewRenderState(pCurrentViewShell);
+OString sNewRenderState = 
pDoc->getViewRenderState(pViewShell);
+
+if (sCurrentViewRenderState == sNewRenderState && 
!bIsInEdit)
 nLastNonEditorView = 
pViewShell->GetViewShellId().get();
 
 if (pViewShell->getPart() == nPart &&
 pViewShell->getEditMode() == nMode &&
+sCurrentViewRenderState == sNewRenderState &&
 !bIsInEdit)
 {
 nViewId = pViewShell->GetViewShellId().get();
@@ -4142,7 +4149,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 doc_setView(pThis, nViewId);
 break;
 }
-else if (pViewShell->getEditMode() == nMode && !bIsInEdit)
+else if (pViewShell->getEditMode() == nMode && 
sCurrentViewRenderState == sNewRenderState && !bIsInEdit)
 {
 nViewMatchingMode = pViewShell->GetViewShellId().get();
 }
@@ -4154,7 +4161,6 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 // if not found view with correct part
 // - at least avoid rendering active textbox, This is for Impress.
 // - prefer view with the same mode
-SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
 if (nViewMatchingMode >= 0 && nViewMatchingMode != nViewId)
 {
 nViewId = nViewMatchingMode;


[Libreoffice-commits] core.git: desktop/source sfx2/source

2023-07-30 Thread Aron Budea (via logerrit)
 desktop/source/lib/init.cxx  |3 +++
 sfx2/source/control/unoctitm.cxx |3 +++
 2 files changed, 6 insertions(+)

New commits:
commit c93267f2901805aa6fe7b7ea44d4ba24e47233da
Author: Aron Budea 
AuthorDate: Mon Jul 17 03:37:05 2023 +0200
Commit: Aron Budea 
CommitDate: Sun Jul 30 14:51:39 2023 +0200

Send Calc pivot table command state changes to LOK

Change-Id: I0d9e04b0a0452f66cb9703d9f34fe6cb44d724c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154506
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 
(cherry picked from commit b62f9f484a0fc9215e34153daac4a8bdb9698d4b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155034
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6e8c0db99223..08609ef442d9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3606,6 +3606,9 @@ static void doc_iniUnoCommands ()
 OUString(".uno:GroupSparklines"),
 OUString(".uno:UngroupSparklines"),
 OUString(".uno:FormatSparklineMenu"),
+OUString(".uno:DataDataPilotRun"),
+OUString(".uno:RecalcPivotTable"),
+OUString(".uno:DeletePivotTable"),
 OUString(".uno:Protect"),
 OUString(".uno:UnsetCellsReadOnly"),
 OUString(".uno:ContentControlProperties"),
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 20ae855ab6f3..9b75d0a51118 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1097,6 +1097,9 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, 
SfxViewFrame* pViewFra
  aEvent.FeatureURL.Path == "GroupSparklines" ||
  aEvent.FeatureURL.Path == "UngroupSparklines" ||
  aEvent.FeatureURL.Path == "FormatSparklineMenu" ||
+ aEvent.FeatureURL.Path == "DataDataPilotRun" ||
+ aEvent.FeatureURL.Path == "RecalcPivotTable" ||
+ aEvent.FeatureURL.Path == "DeletePivotTable" ||
  aEvent.FeatureURL.Path == "NumberFormatDecDecimals" ||
  aEvent.FeatureURL.Path == "NumberFormatIncDecimals" ||
  aEvent.FeatureURL.Path == "Protect" ||


[Libreoffice-commits] core.git: desktop/source sfx2/source

2023-07-28 Thread Jaume Pujantell (via logerrit)
 desktop/source/lib/init.cxx  |   21 +
 sfx2/source/doc/sfxbasemodel.cxx |   18 +-
 2 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit a52ba26e6a3567a1f63aeb8d20c084eb286974b4
Author: Jaume Pujantell 
AuthorDate: Fri Jul 14 09:11:07 2023 +0200
Commit: Caolán McNamara 
CommitDate: Fri Jul 28 10:04:50 2023 +0200

Added possibility to set password on save through arguments

Change-Id: I579ed7487f87515a21d83912d9c0d12e9edc5eea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154415
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8d830c0cbd00..6e8c0db99223 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3270,6 +3270,23 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, 
const char* sUrl, const cha
 
 bool bFullSheetPreview = sFullSheetPreview == u"true";
 
+OUString filePassword;
+if ((aIndex = aFilterOptions.indexOf(",Password=")) >= 0)
+{
+int bIndex = aFilterOptions.indexOf("PASSWORDEND");
+filePassword = aFilterOptions.subView(aIndex + 10, bIndex - 
(aIndex + 10));
+aFilterOptions = OUString::Concat(aFilterOptions.subView(0, 
aIndex))
+ + aFilterOptions.subView(bIndex + 11);
+}
+OUString filePasswordToModify;
+if ((aIndex = aFilterOptions.indexOf(",PasswordToModify=")) >= 0)
+{
+int bIndex = aFilterOptions.indexOf("PASSWORDTOMODIFYEND");
+filePassword = aFilterOptions.subView(aIndex + 18, bIndex - 
(aIndex + 18));
+aFilterOptions = OUString::Concat(aFilterOptions.subView(0, 
aIndex))
+ + aFilterOptions.subView(bIndex + 19);
+}
+
 // Select a pdf version if specified a valid one. If not specified 
then ignore.
 // If invalid then fail.
 sal_Int32 pdfVer = 0;
@@ -3344,6 +3361,10 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, 
const char* sUrl, const cha
 {
 aSaveMediaDescriptor["FilterData"] <<= 
aFilterDataMap.getAsConstPropertyValueList();
 }
+if (!filePassword.isEmpty())
+aSaveMediaDescriptor["Password"] <<= filePassword;
+if (!filePasswordToModify.isEmpty())
+aSaveMediaDescriptor["PasswordToModify"] <<= filePasswordToModify;
 
 // add interaction handler too
 if (gImpl)
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 2b34d5fd5b46..ac0de0cc89a5 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -131,6 +131,7 @@
 #include 
 #include "printhelper.hxx"
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3046,13 +3047,13 @@ void SfxBaseModel::impl_store(  const   OUString&   
sURL
 throw frame::IllegalArgumentIOException();
 
 bool bSaved = false;
+::comphelper::SequenceAsHashMap aArgHash(seqArguments);
 if ( !bSaveTo && m_pData->m_pObjectShell.is() && !sURL.isEmpty()
   && !sURL.startsWith( "private:stream" )
   && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) )
 {
 // this is the same file URL as the current document location, try to 
use storeOwn if possible
 
-::comphelper::SequenceAsHashMap aArgHash( seqArguments );
 static constexpr OUStringLiteral aFilterString( u"FilterName"  );
 const OUString aFilterName( aArgHash.getUnpackedValueOrDefault( 
aFilterString, OUString() ) );
 if ( !aFilterName.isEmpty() )
@@ -3122,11 +3123,26 @@ void SfxBaseModel::impl_store(  const   OUString&   
sURL
 SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? 
SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, 
GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : 
GlobalEventId::SAVEASDOC ),
 m_pData->m_pObjectShell.get() ) );
 
+const OUString 
aFilterName(aArgHash.getUnpackedValueOrDefault("FilterName", OUString()));
+OUString aPassword, aPasswordToModify;
+if (!aArgHash.getUnpackedValueOrDefault("EncryptionData", 
Sequence())
+ .hasElements())
+aPassword = aArgHash.getUnpackedValueOrDefault("Password", OUString());
+if (!aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", 
Sequence())
+ .hasElements()
+&& aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", 
static_cast(0)) == 0)
+aPasswordToModify = 
aArgHash.getUnpackedValueOrDefault("PasswordToModify", OUString());
+aArgHash.erase("PasswordToModify");
+
 std::optional pItemSet(SfxGetpApp()->GetPool());
 pItemSet->Put(SfxStringItem(SID_FILE_NAME, sURL));
 if ( bSaveTo )
 pItemSet->Put(SfxBoolItem(SID_SAVETO, true));
 
+if (!aFilterName.isEmpty() && (!aPassword.isEmpty() || 

[Libreoffice-commits] core.git: desktop/source include/tools tools/source

2023-07-13 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx   |   57 +++---
 include/tools/json_writer.hxx |2 +
 tools/source/misc/json_writer.cxx |   20 +
 3 files changed, 39 insertions(+), 40 deletions(-)

New commits:
commit 6086d896183a529d4a0b83d4862970c8f320b0aa
Author: Szymon Kłos 
AuthorDate: Thu May 18 15:00:38 2023 +0200
Commit: Szymon Kłos 
CommitDate: Thu Jul 13 12:17:36 2023 +0200

linking: api: use JsonWriter

Change-Id: If5bf1897f1aef8db1672789cbee14b90cb96dc08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151959
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154378
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 99ba738c17d5..8d830c0cbd00 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -410,7 +410,7 @@ std::vector 
desktop::jsonToPropertyValuesVector(const char
 return aArguments;
 }
 
-static bool extractLinks(const uno::Reference< container::XNameAccess >& 
xLinks, bool subcontent, OUStringBuffer& jsonText)
+static void extractLinks(const uno::Reference< container::XNameAccess >& 
xLinks, bool subcontent, tools::JsonWriter& aJson)
 {
 const uno::Sequence< OUString > aNames( xLinks->getElementNames() );
 
@@ -451,47 +451,27 @@ static bool extractLinks(const uno::Reference< 
container::XNameAccess >& xLinks,
 
 if (subcontent)
 {
-jsonText.append("\"");
-jsonText.append(aStrDisplayname);
-jsonText.append("\": \"");
-jsonText.append(aLink);
-jsonText.append("\"");
-if (i < nLinks-1)
-{
-jsonText.append(", ");
-}
+aJson.put(aStrDisplayname, aLink);
 }
 else
 {
 uno::Reference< lang::XServiceInfo > xSI( xTarget, 
uno::UNO_QUERY );
 bIsTarget = xSI->supportsService( aProp_LinkTarget );
-if (i != 0)
-{
-if (!bIsTarget)
-jsonText.append("}");
-if (i < nLinks)
-{
-jsonText.append(", ");
-}
-}
-jsonText.append("\"");
-jsonText.append(aStrDisplayname);
-jsonText.append("\": ");
 
 if (bIsTarget)
 {
-jsonText.append("\"");
-jsonText.append(aLink);
-jsonText.append("\"");
+aJson.put(aStrDisplayname, aLink);
 continue;
 }
-jsonText.append("{");
-}
+else
+{
+std::unique_ptr 
pName(convertOUString(aStrDisplayname));
+auto aNode = aJson.startNode(pName.get());
 
-uno::Reference< document::XLinkTargetSupplier > xLTS( xTarget, 
uno::UNO_QUERY );
-if( xLTS.is() )
-{
-extractLinks(xLTS->getLinks(), true, jsonText);
+uno::Reference< document::XLinkTargetSupplier > xLTS( 
xTarget, uno::UNO_QUERY );
+if( xLTS.is() )
+extractLinks(xLTS->getLinks(), true, aJson);
+}
 }
 }
 catch(...)
@@ -500,7 +480,6 @@ static bool extractLinks(const uno::Reference< 
container::XNameAccess >& xLinks,
 }
 }
 }
-return bIsTarget;
 }
 
 static void unoAnyToJson(tools::JsonWriter& rJson, std::string_view pNodeName, 
const uno::Any& anyItem)
@@ -3145,14 +3124,12 @@ static char* lo_extractRequest(LibreOfficeKit* 
/*pThis*/, const char* pFilePath)
 
 if( xLTS.is() )
 {
-OUStringBuffer jsonText("{ \"Targets\": { ");
-bool lastParentheses = extractLinks(xLTS->getLinks(), 
false, jsonText);
-jsonText.append("} }");
-if (!lastParentheses)
-jsonText.append(" }");
-
-OUString res(jsonText.makeStringAndClear());
-return convertOUString(res);
+tools::JsonWriter aJson;
+{
+auto aNode = aJson.startNode("Targets");
+extractLinks(xLTS->getLinks(), false, aJson);
+}
+return strdup(aJson.finishAndGetAsOString().getStr());
 }
 xComp->dispose();
 }
diff --git 

[Libreoffice-commits] core.git: desktop/source

2023-07-12 Thread Patrick Luby (via logerrit)
 desktop/source/lib/init.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit dd1d74281a119f076e58598c8e022ee30232e5bf
Author: Patrick Luby 
AuthorDate: Wed Jul 12 13:08:29 2023 -0400
Commit: Patrick Luby 
CommitDate: Wed Jul 12 22:14:58 2023 +0200

Natively draw to pixel buffer with RBGA pixel format in iOS app

Change-Id: I31917f914ed22bebffc52777cb974224d08bed83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154367
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
(cherry picked from commit 272de6ec30021fdbda38a1bd84a3036a0afc73d6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154325
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dbd236858ce8..99ba738c17d5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3964,9 +3964,11 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #if defined(IOS)
 double fDPIScale = 1.0;
 
+// Onine uses the LOK_TILEMODE_RGBA by default so flip the normal flags
+// to kCGImageAlphaPremultipliedLast | kCGImageByteOrder32Big
 CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, 
nCanvasHeight, 8,
 nCanvasWidth * 4, 
CGColorSpaceCreateDeviceRGB(),
-
kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little);
+
kCGImageAlphaPremultipliedLast | kCGImageByteOrder32Big);
 
 CGContextTranslateCTM(pCGContext, 0, nCanvasHeight);
 CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale);
@@ -4234,7 +4236,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 static int doc_getTileMode(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* 
/*pThis*/)
 {
 SetLastExceptionMsg();
-#if ENABLE_CAIRO_RGBA
+#if ENABLE_CAIRO_RGBA || defined IOS
 return LOK_TILEMODE_RGBA;
 #else
 return LOK_TILEMODE_BGRA;
@@ -6613,8 +6615,9 @@ static void 
doc_paintWindowForView(LibreOfficeKitDocument* pThis, unsigned nLOKW
 comphelper::LibreOfficeKit::setDPIScale(fDPIScale);
 
 #if defined(IOS)
-
-CGContextRef cgc = CGBitmapContextCreate(pBuffer, nWidth, nHeight, 8, 
nWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipFirst | 
kCGImageByteOrder32Little);
+// Onine uses the LOK_TILEMODE_RGBA by default so flip the normal flags
+// to kCGImageAlphaNoneSkipLast | kCGImageByteOrder32Big
+CGContextRef cgc = CGBitmapContextCreate(pBuffer, nWidth, nHeight, 8, 
nWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipLast | 
kCGImageByteOrder32Big);
 
 CGContextTranslateCTM(cgc, 0, nHeight);
 CGContextScaleCTM(cgc, fDPIScale, -fDPIScale);


[Libreoffice-commits] core.git: desktop/source include/unotools lingucomponent/config lingucomponent/source postprocess/CustomTarget_registry.mk unotools/source

2023-07-12 Thread Xisco Fauli (via logerrit)
 desktop/source/lib/init.cxx|  195 
+++---
 include/unotools/lingucfg.hxx  |2 
 lingucomponent/config/Linguistic-lingucomponent-grammarchecker.xcu |   30 -
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx  |   59 +--
 postprocess/CustomTarget_registry.mk   |1 
 unotools/source/config/lingucfg.cxx|   21 -
 6 files changed, 186 insertions(+), 122 deletions(-)

New commits:
commit 94e6049b6467d9bc1e52a1a80c7cf1a5f138e82d
Author: Xisco Fauli 
AuthorDate: Wed Jul 12 07:03:15 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 12 08:57:41 2023 +0200

Revert recent LanguageTool commits

Reason for revert: See discussion in 
https://gerrit.libreoffice.org/c/core/+/154302
- it's causing CppunitTest_sw_layoutwriter2 to fail on Windows.
- it's causing CppunitTest_sw_layoutwriter to fail on Linux.
- Probably other recent CI failures are also related.
- A similar commit was reverted one year ago for similar reasons -> 
https://gerrit.libreoffice.org/c/core/+/135859

This commit contains the following commits:

Revert "lok: remove old hack for LanguageTool locales"

This reverts commit 9a5329a266bd74abc4794f1fcbae3db07582dbde.

Revert "lok: LanguageTool provides list of languages"

This reverts commit 21d0489a5efa970e975ce1a70dfda2fd9e2c186d.

Revert "lok: remove duplicated locales for LanguageTool"

This reverts commit a0865169ab62508a7b933ed4634defa57b25f7b7.

Revert "Load the locales from config file for languagetool"

This reverts commit 81b0d9a951c9b15f4f1a76d45d0bd955b4dfc95b.

Change-Id: I3dc48097615f510e33e233e868b6b10704d81e67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154342
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4f1b5287130f..dbd236858ce8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -117,7 +117,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -228,8 +227,6 @@ using namespace vcl;
 using namespace desktop;
 using namespace utl;
 
-using LanguageToolCfg = 
officecfg::Office::Linguistic::GrammarChecking::LanguageTool;
-
 static LibLibreOffice_Impl *gImpl = nullptr;
 static bool lok_preinit_2_called = false;
 static std::weak_ptr< LibreOfficeKitClass > gOfficeClass;
@@ -5620,6 +5617,132 @@ static void 
doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, in
 pDoc->setGraphicSelection(nType, nX, nY);
 }
 
+static void getDocLanguages(LibreOfficeKitDocument* pThis, 
uno::Sequence& rSeq)
+{
+SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+if (!pViewFrame)
+return;
+
+SfxDispatcher* pDispatcher = pViewFrame->GetBindings().GetDispatcher();
+if (!pDispatcher)
+return;
+
+css::uno::Any aLangStatus;
+pDispatcher->QueryState(SID_LANGUAGE_STATUS, aLangStatus);
+
+OUString sCurrent;
+OUString sKeyboard;
+OUString sGuessText;
+SvtScriptType eScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN
+| SvtScriptType::COMPLEX;
+
+Sequence aSeqLang;
+if (aLangStatus >>= aSeqLang)
+{
+if (aSeqLang.getLength() == 4)
+{
+sCurrent = aSeqLang[0];
+eScriptType = static_cast(aSeqLang[1].toInt32());
+sKeyboard = aSeqLang[1];
+sGuessText = aSeqLang[2];
+}
+}
+else
+{
+aLangStatus >>= sCurrent;
+}
+
+LanguageType nLangType;
+std::set aLangItems;
+
+if (!sCurrent.isEmpty())
+{
+nLangType = SvtLanguageTable::GetLanguageType(sCurrent);
+if (nLangType != LANGUAGE_DONTKNOW)
+{
+aLangItems.insert(nLangType);
+}
+}
+
+const AllSettings& rAllSettings = Application::GetSettings();
+nLangType = rAllSettings.GetLanguageTag().getLanguageType();
+if (nLangType != LANGUAGE_DONTKNOW &&
+(eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
+{
+aLangItems.insert(nLangType);
+}
+
+nLangType = rAllSettings.GetUILanguageTag().getLanguageType();
+if (nLangType != LANGUAGE_DONTKNOW &&
+(eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
+{
+aLangItems.insert(nLangType);
+}
+
+if (!sKeyboard.isEmpty())
+{
+nLangType = SvtLanguageTable::GetLanguageType(sKeyboard);
+if (nLangType != LANGUAGE_DONTKNOW &&
+(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
+{
+aLangItems.insert(nLangType);
+}
+}
+
+if (!sGuessText.isEmpty())
+{
+Reference xLangGuesser;
+try
+{
+xLangGuesser = linguistic2::LanguageGuessing::create(xContext);
+  

[Libreoffice-commits] core.git: desktop/source

2023-07-11 Thread Rene Engelhard (via logerrit)
 desktop/source/deployment/misc/dp_platform.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 091eec9828c3cba728fb52924ad9a4103175e41f
Author: Rene Engelhard 
AuthorDate: Tue Jul 11 16:56:02 2023 +0200
Commit: René Engelhard 
CommitDate: Wed Jul 12 00:41:17 2023 +0200

add linux_riscv64 and linux_loongarch64 to dp_platform.cxx

forgotten in bc9487f745befde6534fd46058e119256952323d and 
d3625d968901eb93a9680db8d1165f70de3fd64e

Change-Id: I7f33c1db54b8f66e797a29cd1ccf96d19a88cc60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154333
Tested-by: Jenkins
Reviewed-by: René Engelhard 

diff --git a/desktop/source/deployment/misc/dp_platform.cxx 
b/desktop/source/deployment/misc/dp_platform.cxx
index ad1b5ea13fed..b2af59f9b926 100644
--- a/desktop/source/deployment/misc/dp_platform.cxx
+++ b/desktop/source/deployment/misc/dp_platform.cxx
@@ -126,6 +126,10 @@ namespace
 ret = checkOSandCPU(u"Linux", u"ALPHA");
 else if (token == u"linux_aarch64")
 ret = checkOSandCPU(u"Linux", u"AARCH64");
+else if (token == u"linux_riscv64")
+ret = checkOSandCPU(u"Linux", u"RISCV64");
+else if (token == u"linux_loongarch64")
+ret = checkOSandCPU(u"Linux", u"LOONGARCH64");
 else if (token == u"freebsd_x86")
 ret = checkOSandCPU(u"FreeBSD", u"x86");
 else if (token == u"freebsd_x86_64")


[Libreoffice-commits] core.git: desktop/source

2023-07-10 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx |  142 
 1 file changed, 2 insertions(+), 140 deletions(-)

New commits:
commit 9a5329a266bd74abc4794f1fcbae3db07582dbde
Author: Szymon Kłos 
AuthorDate: Fri Feb 10 14:56:06 2023 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jul 10 11:36:30 2023 +0200

lok: remove old hack for LanguageTool locales

Change-Id: I1098c51f03b4cdd4f21a635f7b6aae8e90fd9f9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146779
Reviewed-by: Henry Castro 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153962
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154162
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 539291218213..4f1b5287130f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5620,132 +5620,6 @@ static void 
doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, in
 pDoc->setGraphicSelection(nType, nX, nY);
 }
 
-static void getDocLanguages(LibreOfficeKitDocument* pThis, 
uno::Sequence& rSeq)
-{
-SfxViewFrame* pViewFrame = SfxViewFrame::Current();
-if (!pViewFrame)
-return;
-
-SfxDispatcher* pDispatcher = pViewFrame->GetBindings().GetDispatcher();
-if (!pDispatcher)
-return;
-
-css::uno::Any aLangStatus;
-pDispatcher->QueryState(SID_LANGUAGE_STATUS, aLangStatus);
-
-OUString sCurrent;
-OUString sKeyboard;
-OUString sGuessText;
-SvtScriptType eScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN
-| SvtScriptType::COMPLEX;
-
-Sequence aSeqLang;
-if (aLangStatus >>= aSeqLang)
-{
-if (aSeqLang.getLength() == 4)
-{
-sCurrent = aSeqLang[0];
-eScriptType = static_cast(aSeqLang[1].toInt32());
-sKeyboard = aSeqLang[1];
-sGuessText = aSeqLang[2];
-}
-}
-else
-{
-aLangStatus >>= sCurrent;
-}
-
-LanguageType nLangType;
-std::set aLangItems;
-
-if (!sCurrent.isEmpty())
-{
-nLangType = SvtLanguageTable::GetLanguageType(sCurrent);
-if (nLangType != LANGUAGE_DONTKNOW)
-{
-aLangItems.insert(nLangType);
-}
-}
-
-const AllSettings& rAllSettings = Application::GetSettings();
-nLangType = rAllSettings.GetLanguageTag().getLanguageType();
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-
-nLangType = rAllSettings.GetUILanguageTag().getLanguageType();
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-
-if (!sKeyboard.isEmpty())
-{
-nLangType = SvtLanguageTable::GetLanguageType(sKeyboard);
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-}
-
-if (!sGuessText.isEmpty())
-{
-Reference xLangGuesser;
-try
-{
-xLangGuesser = linguistic2::LanguageGuessing::create(xContext);
-}
-catch(...)
-{
-}
-
-if (xLangGuesser.is())
-{
-lang::Locale aLocale = 
xLangGuesser->guessPrimaryLanguage(sGuessText, 0,
-  
sGuessText.getLength());
-LanguageTag aLanguageTag(aLocale);
-nLangType = aLanguageTag.getLanguageType(false);
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-}
-}
-
-LibLODocument_Impl* pDocument = static_cast(pThis);
-Reference 
xDocumentLanguages(pDocument->mxComponent, UNO_QUERY);
-if (xDocumentLanguages.is())
-{
-const Sequence 
aLocales(xDocumentLanguages->getDocumentLanguages(
-  
static_cast(eScriptType), 64));
-
-for (const lang::Locale& aLocale : aLocales)
-{
-nLangType = SvtLanguageTable::GetLanguageType(aLocale.Language);
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-}
-}
-
-int nLocale = 0;
-Sequence aLocales(aLangItems.size());
-auto pLocales = aLocales.getArray();
-for (const LanguageType& itLang : aLangItems)
-{
-pLocales[nLocale++] = LanguageTag::convertToLocale(itLang);
-}
-

[Libreoffice-commits] core.git: desktop/source lingucomponent/source

2023-07-07 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx   |   63 
+++---
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   15 ++
 2 files changed, 62 insertions(+), 16 deletions(-)

New commits:
commit 21d0489a5efa970e975ce1a70dfda2fd9e2c186d
Author: Szymon Kłos 
AuthorDate: Wed Feb 8 11:10:58 2023 +0100
Commit: Szymon Kłos 
CommitDate: Fri Jul 7 19:30:47 2023 +0200

lok: LanguageTool provides list of languages

- it sends supported list to the LOK client
- disables Spell Checker for locales supported by LanguageTool
- duden protocol supports only german
- initialize language tool config before usage to fetch correct
  list of supported languages

Change-Id: Id9de8519303774163721def8661fa408da449348
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146665
Reviewed-by: Henry Castro 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153960
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154161
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dbd236858ce8..539291218213 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -117,6 +117,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -227,6 +228,8 @@ using namespace vcl;
 using namespace desktop;
 using namespace utl;
 
+using LanguageToolCfg = 
officecfg::Office::Linguistic::GrammarChecking::LanguageTool;
+
 static LibLibreOffice_Impl *gImpl = nullptr;
 static bool lok_preinit_2_called = false;
 static std::weak_ptr< LibreOfficeKitClass > gOfficeClass;
@@ -5760,12 +5763,28 @@ static void doc_resetSelection(LibreOfficeKitDocument* 
pThis)
 pDoc->resetSelection();
 }
 
+static void addLocale(boost::property_tree::ptree& rValues, css::lang::Locale 
const & rLocale)
+{
+boost::property_tree::ptree aChild;
+OUString sLanguage;
+const LanguageTag aLanguageTag( rLocale );
+sLanguage = 
SvtLanguageTable::GetLanguageString(aLanguageTag.getLanguageType());
+if (sLanguage.endsWith("}"))
+return;
+
+sLanguage += ";" + aLanguageTag.getBcp47(false);
+aChild.put("", sLanguage.toUtf8());
+rValues.push_back(std::make_pair("", aChild));
+}
+
 static char* getLanguages(LibreOfficeKitDocument* pThis, const char* pCommand)
 {
 css::uno::Sequence< css::lang::Locale > aLocales;
+css::uno::Sequence< css::lang::Locale > aGrammarLocales;
 
 if (xContext.is())
 {
+// SpellChecker
 css::uno::Reference xLangSrv 
= css::linguistic2::LinguServiceManager::create(xContext);
 if (xLangSrv.is())
 {
@@ -5774,6 +5793,18 @@ static char* getLanguages(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 aLocales = xSpell->getLocales();
 }
 
+// LanguageTool
+if (LanguageToolCfg::IsEnabled::get())
+{
+uno::Reference< linguistic2::XProofreader > xGC(
+
xContext->getServiceManager()->createInstanceWithContext("org.openoffice.lingu.LanguageToolGrammarChecker",
 xContext),
+uno::UNO_QUERY_THROW );
+uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xGC, 
uno::UNO_QUERY_THROW );
+aGrammarLocales = xSuppLoc->getLocales();
+}
+
+// Fallback
+
 /* FIXME: To obtain the document languages the spell checker can be 
disabled,
so a future re-work of the getLanguages function is needed in favor 
to use
getDocLanguages */
@@ -5788,19 +5819,10 @@ static char* getLanguages(LibreOfficeKitDocument* 
pThis, const char* pCommand)
 boost::property_tree::ptree aTree;
 aTree.put("commandName", pCommand);
 boost::property_tree::ptree aValues;
-boost::property_tree::ptree aChild;
-OUString sLanguage;
-for ( css::lang::Locale const & locale : std::as_const(aLocales) )
-{
-const LanguageTag aLanguageTag( locale );
-sLanguage = 
SvtLanguageTable::GetLanguageString(aLanguageTag.getLanguageType());
-if (sLanguage.startsWith("{") && sLanguage.endsWith("}"))
-continue;
-
-sLanguage += ";" + aLanguageTag.getBcp47(false);
-aChild.put("", sLanguage.toUtf8());
-aValues.push_back(std::make_pair("", aChild));
-}
+for ( css::lang::Locale const & rLocale : std::as_const(aLocales) )
+addLocale(aValues, rLocale);
+for ( css::lang::Locale const & rLocale : std::as_const(aGrammarLocales) )
+addLocale(aValues, rLocale);
 aTree.add_child("commandValues", aValues);
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);
@@ -7276,6 +7298,8 @@ static void preLoadShortCutAccelerators()
 batch->commit();
 }
 
+void setLanguageToolConfig();
+
 /// Used only by LibreOfficeKit when used by 

[Libreoffice-commits] core.git: desktop/source include/svtools svtools/source

2023-07-05 Thread Noel Grandin (via logerrit)
 desktop/source/app/app.cxx |8 
 include/svtools/apearcfg.hxx   |   14 --
 svtools/source/config/apearcfg.cxx |8 
 3 files changed, 8 insertions(+), 22 deletions(-)

New commits:
commit ea0e9c0d4de19ac3f8fdfe91bdb085ad9e2b1757
Author: Noel Grandin 
AuthorDate: Wed Jul 5 14:22:20 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 5 18:55:23 2023 +0200

these enums are unnecessary

Change-Id: I29bf28202e11db836764276f773b134356d93e0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154057
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index c0b30c2ae2fd..e4058bfe8932 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1827,16 +1827,16 @@ void Desktop::OverrideSystemSettings( AllSettings& 
rSettings )
 
 DragFullOptions nDragFullOptions = hStyleSettings.GetDragFullOptions();
 
-DragMode nDragMode = 
static_cast(officecfg::Office::Common::View::Window::Drag::get());
+sal_uInt16 nDragMode = 
officecfg::Office::Common::View::Window::Drag::get();
 switch ( nDragMode )
 {
-case DragMode::FullWindow:
+case 0: //FullWindow:
 nDragFullOptions |= DragFullOptions::All;
 break;
-case DragMode::Frame:
+case 1: // Frame:
 nDragFullOptions &= ~DragFullOptions::All;
 break;
-case DragMode::SystemDep:
+case 2: // SystemDep
 default:
 break;
 }
diff --git a/include/svtools/apearcfg.hxx b/include/svtools/apearcfg.hxx
index 85a521862ba7..fe2bc61df7de 100644
--- a/include/svtools/apearcfg.hxx
+++ b/include/svtools/apearcfg.hxx
@@ -21,20 +21,6 @@
 #include 
 
 class Application;
-enum class MouseMiddleButtonAction;
-
-enum class SnapType {
-ToButton = 0,
-ToMiddle,
-NONE
-};
-
-enum class DragMode {
-FullWindow,
-Frame,
-SystemDep
-};
-
 
 namespace SvtTabAppearanceCfg
 {
diff --git a/svtools/source/config/apearcfg.cxx 
b/svtools/source/config/apearcfg.cxx
index fec538b62a71..4e8a0215043b 100644
--- a/svtools/source/config/apearcfg.cxx
+++ b/svtools/source/config/apearcfg.cxx
@@ -64,16 +64,16 @@ void SvtTabAppearanceCfg::SetApplicationDefaults ( 
Application* pApp )
 
 nMouseOptions &=  ~ 
MouseSettingsOptions(MouseSettingsOptions::AutoCenterPos | 
MouseSettingsOptions::AutoDefBtnPos);
 
-SnapType nSnapMode = 
static_cast(officecfg::Office::Common::View::Dialog::MousePositioning::get());
+sal_uInt16 nSnapMode = 
officecfg::Office::Common::View::Dialog::MousePositioning::get();
 switch ( nSnapMode )
 {
-case SnapType::ToButton:
+case 0: // ToButton
 nMouseOptions |= MouseSettingsOptions::AutoDefBtnPos;
 break;
-case SnapType::ToMiddle:
+case 1: // ToMiddle
 nMouseOptions |= MouseSettingsOptions::AutoCenterPos;
 break;
-case SnapType::NONE:
+case 2: // NONE
 default:
 break;
 }


[Libreoffice-commits] core.git: desktop/source

2023-07-03 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit dbd124519daa507f560fad4619c0b41f24001818
Author: Marco Cecchetti 
AuthorDate: Tue Jun 13 19:30:05 2023 +0200
Commit: Aron Budea 
CommitDate: Tue Jul 4 01:16:14 2023 +0200

lok: on switching from tabbed to compact ui 2 buttons were disabled

Number Format Increase Decimals, Number Format Decrease Decimals were
not enabled on switching ui.

Change-Id: Ia81a43ef40168dcbf071d071231b795f9bf8659e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153050
Reviewed-by: Gökay ŞATIR 
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit cd4ad81ca334a3d2bc90bab81502ae5350bac84d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153594
Tested-by: Jenkins
Reviewed-by: Aron Budea 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 971e1ecc75e4..bef06bcd4f98 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3486,6 +3486,8 @@ static void doc_iniUnoCommands ()
 OUString(".uno:NumberFormatCurrency"),
 OUString(".uno:NumberFormatPercent"),
 OUString(".uno:NumberFormatDecimal"),
+OUString(".uno:NumberFormatIncDecimals"),
+OUString(".uno:NumberFormatDecDecimals"),
 OUString(".uno:NumberFormatDate"),
 OUString(".uno:EditHeaderAndFooter"),
 OUString(".uno:FrameLineColor"),


[Libreoffice-commits] core.git: desktop/source sfx2/source

2023-06-26 Thread Pranam Lashkari (via logerrit)
 desktop/source/lib/init.cxx  |3 ++-
 sfx2/source/control/unoctitm.cxx |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 1be3ab048d417611055a76d1776a0a69eb6fc6dd
Author: Pranam Lashkari 
AuthorDate: Fri Jun 23 23:31:10 2023 +0700
Commit: Aron Budea 
CommitDate: Mon Jun 26 22:58:13 2023 +0200

LOK: send state of DataFilterAutoFilter

Change-Id: Ib71dcdb6b02f3c1e9e1c552a718cb03e7cd9a4b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153532
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 
(cherry picked from commit 0407d4290617dc717abed3ea48f1abf3cf1d750f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153602
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 102028689451..074a5b81b1ad 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3611,7 +3611,8 @@ static void doc_iniUnoCommands ()
 OUString(".uno:InsertDateContentControl"),
 OUString(".uno:InsertDropdownContentControl"),
 OUString(".uno:InsertPlainTextContentControl"),
-OUString(".uno:InsertPictureContentControl")
+OUString(".uno:InsertPictureContentControl"),
+OUString(".uno:DataFilterAutoFilter")
 };
 
 util::URL aCommandURL;
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 4495873a89af..2feec75dac6c 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -935,7 +935,8 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, 
SfxViewFrame* pViewFra
 aEvent.FeatureURL.Path == "SheetRightToLeft" ||
 aEvent.FeatureURL.Path == "SpacePara1" ||
 aEvent.FeatureURL.Path == "SpacePara15" ||
-aEvent.FeatureURL.Path == "SpacePara2")
+aEvent.FeatureURL.Path == "SpacePara2" ||
+aEvent.FeatureURL.Path == "DataFilterAutoFilter")
 {
 bool bTemp = false;
 


[Libreoffice-commits] core.git: desktop/source include/comphelper include/vcl sd/source sw/source vcl/source

2023-06-14 Thread Szymon Kłos (via logerrit)
 desktop/source/deployment/registry/configuration/dp_configuration.cxx |   36 
-
 include/comphelper/xmlencode.hxx  |   62 
++
 include/vcl/pdfwriter.hxx |2 
 sd/source/filter/html/htmlex.cxx  |5 
 sw/source/filter/html/css1atr.cxx |3 
 sw/source/filter/html/htmlfldw.cxx|3 
 vcl/source/gdi/pdfwriter_impl.cxx |   39 
--
 7 files changed, 75 insertions(+), 75 deletions(-)

New commits:
commit 71075740aee2e15f574d19d452f0a586e25a6bd0
Author: Szymon Kłos 
AuthorDate: Fri Apr 7 09:48:41 2023 +0200
Commit: Caolán McNamara 
CommitDate: Wed Jun 14 13:27:04 2023 +0200

Make encodeForXml accessible for other modules

and share similar code

Change-Id: I7729a46d40845893f577c273c1ab340f69ebb51b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151230
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151754
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git 
a/desktop/source/deployment/registry/configuration/dp_configuration.cxx 
b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 1f4ba053ec55..622814248670 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -566,39 +567,6 @@ BackendImpl::PackageImpl::isRegistered_(
 }
 
 
-OUString encodeForXml( std::u16string_view text )
-{
-// encode conforming xml:
-size_t len = text.size();
-OUStringBuffer buf;
-for ( size_t pos = 0; pos < len; ++pos )
-{
-sal_Unicode c = text[ pos ];
-switch (c) {
-case '<':
-buf.append( "" );
-break;
-case '>':
-buf.append( "" );
-break;
-case '&':
-buf.append( "" );
-break;
-case '\'':
-buf.append( "" );
-break;
-case '\"':
-buf.append( "" );
-break;
-default:
-buf.append( c );
-break;
-}
-}
-return buf.makeStringAndClear();
-}
-
-
 OUString replaceOrigin(
 OUString const & url, std::u16string_view destFolder, Reference< 
XCommandEnvironment > const & xCmdEnv, Reference< XComponentContext > const & 
xContext, bool & out_replaced)
 {
@@ -651,7 +619,7 @@ OUString replaceOrigin(
 if (origin.isEmpty()) {
 // encode only once
 origin = OUStringToOString(
-encodeForXml( url.subView( 0, url.lastIndexOf( '/' ) ) ),
+comphelper::string::encodeForXml( url.subView( 0, 
url.lastIndexOf( '/' ) ) ),
 // xxx todo: encode always for UTF-8? => lookup doc-header?
 RTL_TEXTENCODING_UTF8 );
 }
diff --git a/include/comphelper/xmlencode.hxx b/include/comphelper/xmlencode.hxx
new file mode 100644
index ..160de5c9cf42
--- /dev/null
+++ b/include/comphelper/xmlencode.hxx
@@ -0,0 +1,62 @@
+/* -*- 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/.
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include 
+
+namespace comphelper::string
+{
+inline OUString encodeForXml(std::u16string_view rStr)
+{
+// encode conforming xml:
+sal_Int32 len = rStr.length();
+OUStringBuffer buf(len + 16); // it's going to be at least len
+for (sal_Int32 pos = 0; pos < len; ++pos)
+{
+sal_Unicode c = rStr[pos];
+switch (c)
+{
+case '<':
+buf.append("");
+break;
+case '>':
+buf.append("");
+break;
+case '&':
+buf.append("");
+break;
+case '\'':
+buf.append("");
+

[Libreoffice-commits] core.git: desktop/source include/svtools sc/source sd/source svtools/source svx/source sw/inc sw/source

2023-06-06 Thread Noel Grandin (via logerrit)
 desktop/source/app/app.cxx |3 
 include/svtools/accessibilityoptions.hxx   |   12 
 sc/source/ui/view/output.cxx   |2 
 sd/source/ui/annotations/annotationwindow.cxx  |5 
 sd/source/ui/view/outlview.cxx |3 
 svtools/source/config/accessibilityoptions.cxx |  264 +++--
 svx/source/sdr/contact/objectcontactofpageview.cxx |8 
 svx/source/svdraw/svdedxv.cxx  |3 
 sw/inc/view.hxx|2 
 sw/inc/viewsh.hxx  |2 
 sw/source/core/view/viewsh.cxx |8 
 sw/source/uibase/app/apphdl.cxx|4 
 sw/source/uibase/config/viewopt.cxx|2 
 sw/source/uibase/inc/pview.hxx |2 
 sw/source/uibase/uiview/pview.cxx  |6 
 sw/source/uibase/uiview/view.cxx   |2 
 sw/source/uibase/uiview/view0.cxx  |5 
 17 files changed, 73 insertions(+), 260 deletions(-)

New commits:
commit 1527fa8435ef415678b2e4a6972f5e378ee5cab1
Author: Noel Grandin 
AuthorDate: Tue Jun 6 11:20:17 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 6 19:32:38 2023 +0200

convert SvtAccessibilityOptions to officecfg where possible

Change-Id: Ia530086fe35e64379e55135d392020304b466325
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152649
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 4e3daca9893b..c0b30c2ae2fd 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1528,8 +1528,7 @@ int Desktop::Main()
 
 SvtTabAppearanceCfg::SetInitialized();
 SvtTabAppearanceCfg::SetApplicationDefaults( this );
-SvtAccessibilityOptions aOptions;
-aOptions.SetVCLSettings();
+SvtAccessibilityOptions::SetVCLSettings();
 SetSplashScreenProgress(60);
 
 if ( !pExecGlobals->bRestartRequested )
diff --git a/include/svtools/accessibilityoptions.hxx 
b/include/svtools/accessibilityoptions.hxx
index 2733cfa0e7ee..cb4596228bee 100644
--- a/include/svtools/accessibilityoptions.hxx
+++ b/include/svtools/accessibilityoptions.hxx
@@ -23,7 +23,7 @@
 
 class SvtAccessibilityOptions_Impl;
 
-class SVT_DLLPUBLIC SvtAccessibilityOptions final :
+class SAL_WARN_UNUSED SVT_DLLPUBLIC SvtAccessibilityOptions final :
 public utl::detail::Options
 {
 private:
@@ -35,12 +35,12 @@ public:
 virtual ~SvtAccessibilityOptions() override;
 
 // get & set config entries
-boolGetIsAllowAnimatedGraphics() const;
-boolGetIsAllowAnimatedText() const;
-boolGetIsAutomaticFontColor() const;
-boolIsSelectionInReadonly() const;
+static bool GetIsAllowAnimatedGraphics();
+static bool GetIsAllowAnimatedText();
+static bool GetIsAutomaticFontColor();
+static bool IsSelectionInReadonly();
 
-voidSetVCLSettings();
+static void SetVCLSettings();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 8608817b6099..c43a903484cd 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -169,7 +169,7 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, 
ScOutputType eNewType,
 bPagebreakMode( false ),
 bSolidBackground( false ),
 mbUseStyleColor( false ),
-mbForceAutoColor( SC_MOD()->GetAccessOptions().GetIsAutomaticFontColor() ),
+mbForceAutoColor( SvtAccessibilityOptions::GetIsAutomaticFontColor() ),
 mbSyntaxMode( false ),
 aGridColor( COL_BLACK ),
 mbShowNullValues( true ),
diff --git a/sd/source/ui/annotations/annotationwindow.cxx 
b/sd/source/ui/annotations/annotationwindow.cxx
index bc6304529e43..a5ab1eb0b784 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -550,10 +550,7 @@ void AnnotationWindow::SetColor()
 maColorLight = AnnotationManagerImpl::GetColorLight( nAuthorIdx );
 }
 
-{
-SvtAccessibilityOptions aOptions;
-mpOutliner->ForceAutoColor( bHighContrast || 
aOptions.GetIsAutomaticFontColor() );
-}
+mpOutliner->ForceAutoColor( bHighContrast || 
SvtAccessibilityOptions::GetIsAutomaticFontColor() );
 
 mxPopover->set_background(maColor);
 mxMenuButton->set_background(maColor);
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 4ddc3be230bd..8ce0a5dcb874 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -154,8 +154,7 @@ OutlineView::~OutlineView()
 EEControlBits nCntrl = mrOutliner.GetControlWord();
 mrOutliner.SetUpdateLayout(false); // otherwise there will be drawn on 
SetControlWord
 mrOutliner.SetControlWord(nCntrl & ~EEControlBits::NOCOLORS);
-SvtAccessibilityOptions 

[Libreoffice-commits] core.git: desktop/source

2023-05-25 Thread Xisco Fauli (via logerrit)
 desktop/source/deployment/gui/dp_gui_theextmgr.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 578758835e700b38b167753ccda9527f3a8cc43b
Author: Xisco Fauli 
AuthorDate: Thu May 25 11:15:37 2023 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 25 16:57:51 2023 +0200

desktop: check getDialog()

it might return nullptr

See 
https://crashreport.libreoffice.org/stats/signature/dp_gui::TheExtensionManager::ToTop()

Change-Id: I4023529aec0ba2c72b4e7db5449d235c208ee30b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152268
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx 
b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index 10a2cfb1f136..e844f09c1b85 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -158,7 +158,8 @@ void TheExtensionManager::SetText( const OUString  )
 {
 const SolarMutexGuard guard;
 
-getDialog()->set_title( rTitle );
+if (weld::Window* pDialog = getDialog())
+pDialog->set_title( rTitle );
 }
 
 
@@ -166,7 +167,8 @@ void TheExtensionManager::ToTop()
 {
 const SolarMutexGuard guard;
 
-getDialog()->present();
+if (weld::Window* pDialog = getDialog())
+pDialog->present();
 }
 
 void TheExtensionManager::Close()


[Libreoffice-commits] core.git: desktop/source framework/IwyuFilter_framework.yaml framework/source include/sfx2 include/svtools offapi/com offapi/UnoApi_offapi.mk sfx2/source svtools/source

2023-05-23 Thread Gökay Şatır (via logerrit)
 desktop/source/lib/init.cxx   |   48 
++
 framework/IwyuFilter_framework.yaml   |2 
 framework/source/uiconfiguration/moduleuicfgsupplier.cxx  |6 -
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |   10 +-
 framework/source/uiconfiguration/uiconfigurationmanager.cxx   |   10 +-
 include/sfx2/app.hxx  |4 
 include/sfx2/lokhelper.hxx|3 
 include/svtools/acceleratorexecute.hxx|2 
 offapi/UnoApi_offapi.mk   |2 
 offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl   |2 
 offapi/com/sun/star/ui/UIConfigurationManager.idl |2 
 offapi/com/sun/star/ui/XModuleUIConfigurationManager3.idl |   41 

 offapi/com/sun/star/ui/XUIConfigurationManager3.idl   |   39 

 sfx2/source/appl/app.cxx  |5 +
 sfx2/source/inc/appdata.hxx   |2 
 sfx2/source/view/lokhelper.cxx|   12 +-
 sfx2/source/view/viewsh.cxx   |   41 

 svtools/source/misc/acceleratorexecute.cxx|   27 +
 18 files changed, 244 insertions(+), 14 deletions(-)

New commits:
commit d4bc98c5bf8d099ab1df32cc8ac30169ac537e62
Author: Gökay Şatır 
AuthorDate: Thu Feb 16 16:47:22 2023 +0300
Commit: Miklos Vajna 
CommitDate: Tue May 23 15:40:57 2023 +0200

[API CHANGE] Add createShortCutManager function to uiconfigurationmanager.

We need to have different accelerator classes for differnt languages.
This PR creates a new accelerator class for different languages.

Since current code uses single instance for accelerators, i needed to add a 
create function.

Also we now have an unordered map for different languages and modules.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147157
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148680
Tested-by: Miklos Vajna 
Change-Id: Ia646f20b3206f430ece614fc127e8b748044e4c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151798
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7cd3304a2185..8561760febce 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -217,6 +217,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 using namespace css;
 using namespace vcl;
 using namespace desktop;
@@ -7147,6 +7151,47 @@ static void lo_status_indicator_callback(void *data, 
comphelper::LibreOfficeKit:
 }
 }
 
+/// Used by preloadData (LibreOfficeKit) for providing different shortcuts for 
different languages.
+static void preLoadShortCutAccelerators()
+{
+std::unordered_map>& 
acceleratorConfs = SfxLokHelper::getAcceleratorConfs();
+css::uno::Sequence 
installedLocales(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
+OUString actualLang = officecfg::Setup::L10N::ooLocale::get();
+
+for (sal_Int32 i = 0; i < installedLocales.getLength(); i++)
+{
+OUString language = 
LanguageTag(installedLocales[i]).getLocale().Language;
+
+if (!comphelper::LibreOfficeKit::isAllowlistedLanguage(language))
+{
+// Language is listed by COOL and also installed in core. We can 
create the short cut accelerator.
+
+// Set the UI language to current one, before creating the 
accelerator.
+std::shared_ptr 
batch(comphelper::ConfigurationChanges::create());
+officecfg::Setup::L10N::ooLocale::set(installedLocales[i], batch);
+batch->commit();
+
+// Supported module names: Writer, Calc, Draw, Impress
+std::vector supportedModuleNames = { 
"com.sun.star.text.TextDocument", "com.sun.star.sheet.SpreadsheetDocument", 
"com.sun.star.drawing.DrawingDocument", 
"com.sun.star.presentation.PresentationDocument" };
+// Create the accelerators.
+for (std::size_t j = 0; j < supportedModuleNames.size(); j++)
+{
+OUString key = supportedModuleNames[j] + installedLocales[i];
+acceleratorConfs[key] = 
svt::AcceleratorExecute::lok_createNewAcceleratorConfiguration(::comphelper::getProcessComponentContext(),
 supportedModuleNames[j]);
+}
+}
+else
+{
+std::cerr << "Language is installed in core but not in the list of 
COOL languages: " << language << "\n";
+}
+}
+
+// Set the UI language back to default one.
+std::shared_ptr 
batch(comphelper::ConfigurationChanges::create());
+officecfg::Setup::L10N::ooLocale::set(actualLang, batch);
+

[Libreoffice-commits] core.git: desktop/source

2023-05-10 Thread Arnaud VERSINI (via logerrit)
 desktop/source/app/appinit.cxx |1 -
 desktop/source/app/cmdlineargs.cxx |4 
 2 files changed, 5 deletions(-)

New commits:
commit 5582b8c6da7e9d8cbcf20b381a8b0f5344b4d743
Author: Arnaud VERSINI 
AuthorDate: Mon May 8 16:57:12 2023 +0200
Commit: Bartosz Kosiorek 
CommitDate: Wed May 10 12:01:08 2023 +0200

desktop : remove useless using namespace

Change-Id: I23a2932402120d9097ab6bd9793d4b4e92be03e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151538
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx
index 8596f80aaafc..926ad1bfa6b7 100644
--- a/desktop/source/app/appinit.cxx
+++ b/desktop/source/app/appinit.cxx
@@ -43,7 +43,6 @@
 #include 
 #include 
 
-using namespace desktop;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::beans;
diff --git a/desktop/source/app/cmdlineargs.cxx 
b/desktop/source/app/cmdlineargs.cxx
index 432bff1f4efc..e7f315204048 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -42,10 +42,6 @@
 
 #include 
 
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uri;
-using namespace com::sun::star::uno;
-
 namespace desktop
 {
 


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2023-04-26 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx   |  102 +++---
 include/LibreOfficeKit/LibreOfficeKit.h   |   12 ---
 include/LibreOfficeKit/LibreOfficeKit.hxx |   28 
 3 files changed, 25 insertions(+), 117 deletions(-)

New commits:
commit 0340cbbc34d2c97baa5b7ebc4a57650861907067
Author: Tor Lillqvist 
AuthorDate: Wed Apr 26 15:39:38 2023 +0300
Commit: Tor Lillqvist 
CommitDate: Thu Apr 27 06:53:22 2023 +0200

Bin the unused paintTileToCGContext special thing for iOS

It was used by "LibreOfficeLight" which died years ago.

Change-Id: I71a1315448baa4f1ec7a22b20cb3dd39c88cda78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151066
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index af31b1829163..d6ce62b38be4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1119,13 +1119,6 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
   const int nCanvasWidth, const int nCanvasHeight,
   const int nTilePosX, const int nTilePosY,
   const int nTileWidth, const int nTileHeight);
-#ifdef IOS
-static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
- void* rCGContext,
- const int nCanvasWidth, const int 
nCanvasHeight,
- const int nTilePosX, const int nTilePosY,
- const int nTileWidth, const int 
nTileHeight);
-#endif
 static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
   unsigned char* pBuffer,
   const int nPart,
@@ -1392,9 +1385,6 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference 
 xC
 m_pDocumentClass->setPartMode = doc_setPartMode;
 m_pDocumentClass->getEditMode = doc_getEditMode;
 m_pDocumentClass->paintTile = doc_paintTile;
-#ifdef IOS
-m_pDocumentClass->paintTileToCGContext = doc_paintTileToCGContext;
-#endif
 m_pDocumentClass->paintPartTile = doc_paintPartTile;
 m_pDocumentClass->getTileMode = doc_getTileMode;
 m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
@@ -2586,41 +2576,6 @@ LibLibreOffice_Impl::~LibLibreOffice_Impl()
 namespace
 {
 
-#ifdef IOS
-void paintTileToCGContext(ITiledRenderable* pDocument,
-  void* rCGContext, const Size nCanvasSize,
-  const int nTilePosX, const int nTilePosY,
-  const int nTileWidth, const int nTileHeight)
-{
-SystemGraphicsData aData;
-aData.rCGContext = reinterpret_cast(rCGContext);
-
-ScopedVclPtrInstance pDevice(aData, Size(1, 1), 
DeviceFormat::WITHOUT_ALPHA);
-pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
-pDevice->SetOutputSizePixel(nCanvasSize);
-pDocument->paintTile(*pDevice, nCanvasSize.Width(), nCanvasSize.Height(),
-nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-}
-
-void paintTileIOS(LibreOfficeKitDocument* pThis,
- unsigned char* pBuffer,
- const int nCanvasWidth, const int nCanvasHeight, const double 
fDPIScale,
- const int nTilePosX, const int nTilePosY,
- const int nTileWidth, const int nTileHeight)
-{
-CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, 
nCanvasHeight, 8,
-nCanvasWidth * 4, 
CGColorSpaceCreateDeviceRGB(),
-
kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little);
-
-CGContextTranslateCTM(pCGContext, 0, nCanvasHeight);
-CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale);
-
-doc_paintTileToCGContext(pThis, (void*) pCGContext, nCanvasWidth, 
nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-
-CGContextRelease(pCGContext);
-}
-#endif
-
 void setLanguageAndLocale(OUString const & aLangISO)
 {
 SvtSysLocaleOptions aLocalOptions;
@@ -3933,8 +3888,31 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 comphelper::ScopeGuard dpiScaleGuard([]() { 
comphelper::LibreOfficeKit::setDPIScale(1.0); });
 
 #if defined(IOS)
-double fDPIScaleX = 1.0;
-paintTileIOS(pThis, pBuffer, nCanvasWidth, nCanvasHeight, fDPIScaleX, 
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+double fDPIScale = 1.0;
+
+CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, 
nCanvasHeight, 8,
+nCanvasWidth * 4, 
CGColorSpaceCreateDeviceRGB(),
+
kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little);
+
+CGContextTranslateCTM(pCGContext, 0, nCanvasHeight);
+CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale);
+
+SAL_INFO( "lok.tiledrendering", 

[Libreoffice-commits] core.git: desktop/source

2023-04-20 Thread Thorsten Behrens (via logerrit)
 desktop/source/app/app.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 68912948e376ce0b080a0d2a76dd9d951f8bcdf6
Author: Thorsten Behrens 
AuthorDate: Thu Apr 20 01:18:06 2023 +0200
Commit: Thorsten Behrens 
CommitDate: Thu Apr 20 13:15:07 2023 +0200

WASM: don't run gfx tests on startup

Change-Id: Ibc04b5c1bb3972544fa605447c635b4af84f7584
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150668
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 169330dab9f7..4e3daca9893b 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1557,12 +1557,14 @@ int Desktop::Main()
 CheckOpenCLCompute(xDesktop);
 #endif
 
+#if !defined(EMSCRIPTEN)
 //Running the VCL graphics rendering tests
 const char * pDisplay = std::getenv("DISPLAY");
 if (!pDisplay || pDisplay[0] == ':')
 {
 runGraphicsRenderTests();
 }
+#endif
 
 // Post user event to startup first application component window
 // We have to send this OpenClients message short before execute() to


[Libreoffice-commits] core.git: desktop/source

2023-04-13 Thread Michael Meeks (via logerrit)
 desktop/source/lib/init.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit 15f0fd06346618c772466993598df5fd25181202
Author: Michael Meeks 
AuthorDate: Wed Apr 12 16:01:46 2023 +0100
Commit: Michael Meeks 
CommitDate: Thu Apr 13 10:45:38 2023 +0200

lok: trim glibc allocator's pending heap when called.

Change-Id: I8d1bda01a0e6ccff0fa868013c67c0fbbf78a836
Signed-off-by: Michael Meeks 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150299
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 49d4298c7a66..a4f34cc349e8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -26,8 +26,14 @@
 #include 
 #endif
 
+#undef HAVE_MALLOC_TRIM
+
 #ifdef LINUX
 #include 
+#if defined __GLIBC__
+#  include 
+#  define HAVE_MALLOC_TRIM
+#endif
 #endif
 
 #ifdef ANDROID
@@ -3146,6 +3152,12 @@ static char* lo_extractRequest(LibreOfficeKit* 
/*pThis*/, const char* pFilePath)
 static void lo_trimMemory(LibreOfficeKit* /* pThis */, int nTarget)
 {
 vcl::lok::trimMemory(nTarget);
+if (nTarget > 1000)
+{
+#ifdef HAVE_MALLOC_TRIM
+malloc_trim(0);
+#endif
+}
 }
 
 static void lo_registerCallback (LibreOfficeKit* pThis,


[Libreoffice-commits] core.git: desktop/source

2023-04-12 Thread Ashod Nakashian (via logerrit)
 desktop/source/lib/init.cxx |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 81dc568ab3f504bca58810da0b0bd3c4c2737096
Author: Ashod Nakashian 
AuthorDate: Sat Mar 11 10:11:07 2023 -0500
Commit: Miklos Vajna 
CommitDate: Wed Apr 12 14:03:55 2023 +0200

lok: capture and publish the modified status in save result

This is necessary to flag to the storage whether or not
the contents of the file being uploaded has any user
modifications or not. This is typically used to optimize
the versioning and storage utilization.

We also add the time when saving started and the duration
it took. The timestamp is to figure out if there has been
subsequent activity/commands that could have modified
the document. The duration is to help Online throttle
saving if too frequent.

Signed-off-by: Ashod Nakashian 
Change-Id: Id6d8e629ef9b6e723d1d8b84d64fc7741b997bc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149985
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0521af8b427a..49d4298c7a66 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4612,13 +4612,17 @@ namespace {
 */
 class DispatchResultListener : public 
cppu::WeakImplHelper
 {
-OString maCommand; ///< Command for which this is the 
result.
-std::shared_ptr mpCallback; ///< Callback to call.
+const OString maCommand; ///< Command for which this is the result.
+const std::shared_ptr mpCallback; ///< Callback to 
call.
+const std::chrono::steady_clock::time_point mSaveTime; //< The time we 
started saving.
+const bool mbWasModified; //< Whether or not the document was modified 
before saving.
 
 public:
 DispatchResultListener(const char* pCommand, 
std::shared_ptr pCallback)
 : maCommand(pCommand)
 , mpCallback(std::move(pCallback))
+, mSaveTime(std::chrono::steady_clock::now())
+, mbWasModified(SfxObjectShell::Current()->IsModified())
 {
 assert(mpCallback);
 }
@@ -4635,6 +4639,14 @@ public:
 }
 
 unoAnyToJson(aJson, "result", rEvent.Result);
+aJson.put("wasModified", mbWasModified);
+aJson.put("startUnixTimeMics",
+  
std::chrono::time_point_cast(mSaveTime)
+  .time_since_epoch()
+  .count());
+aJson.put("saveDurationMics", 
std::chrono::duration_cast(
+  std::chrono::steady_clock::now() - 
mSaveTime)
+  .count());
 mpCallback->queue(LOK_CALLBACK_UNO_COMMAND_RESULT, 
aJson.finishAndGetAsOString());
 }
 


[Libreoffice-commits] core.git: desktop/source

2023-04-11 Thread Stephan Bergmann (via logerrit)
 desktop/source/app/crashreport.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 8029a239cf294d06bb9f29aeb9b6897cb422a880
Author: Stephan Bergmann 
AuthorDate: Tue Apr 11 08:06:51 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Apr 11 09:38:01 2023 +0200

loplugin:stringadd

Change-Id: I2dec226b3fb17f5ea361673139f2511ce7c3fe89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150214
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/desktop/source/app/crashreport.cxx 
b/desktop/source/app/crashreport.cxx
index 0458edf9793a..e5ed070a2f44 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -198,8 +198,7 @@ OUString CrashReporter::getLoggedUnoCommands()
 
 for( auto& unocommand: maloggedUnoCommands)
 {
-aUnoCommandBuffer.append(aCommandSeperator);
-aUnoCommandBuffer.append(unocommand);
+aUnoCommandBuffer.append(aCommandSeperator + unocommand);
 aCommandSeperator=",";
 }
 return aUnoCommandBuffer.makeStringAndClear();


[Libreoffice-commits] core.git: desktop/source editeng/source sc/source sd/source starmath/source svtools/source sw/source tools/source writerfilter/source xmloff/source

2023-04-10 Thread Mike Kaganski (via logerrit)
 desktop/source/lib/init.cxx|   12 
 editeng/source/editeng/impedit4.cxx|4 +-
 sc/source/filter/excel/excdoc.cxx  |   26 -
 sc/source/filter/excel/excrecds.cxx|   35 +++
 sc/source/filter/excel/xeescher.cxx|   11 +++
 sc/source/filter/excel/xename.cxx  |2 -
 sc/source/filter/excel/xepage.cxx  |   16 +-
 sc/source/filter/excel/xestream.cxx|   37 -
 sc/source/filter/xcl97/xcl97rec.cxx|4 +-
 sd/source/filter/eppt/pptx-epptooxml.cxx   |   32 ++---
 starmath/source/view.cxx   |4 +-
 svtools/source/svrtf/rtfout.cxx|3 --
 sw/source/filter/ww8/WW8TableInfo.cxx  |2 -
 sw/source/filter/ww8/docxexport.cxx|   10 +++---
 tools/source/stream/stream.cxx |6 +---
 writerfilter/source/ooxml/OOXMLPropertySet.cxx |4 +-
 writerfilter/source/rtftok/rtfvalue.cxx|4 +-
 xmloff/source/core/fasttokenhandler.cxx|8 ++---
 18 files changed, 107 insertions(+), 113 deletions(-)

New commits:
commit f6fa9c455502e9a00e4a4cff6e19f3e17c5479c3
Author: Mike Kaganski 
AuthorDate: Mon Apr 10 18:01:17 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Apr 10 20:09:26 2023 +0200

Use more *string_view

Change-Id: I1172febd45da4dba006f8495427fe45c6d9b9fa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150187
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index cda953a928f4..0521af8b427a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -490,18 +490,18 @@ static bool extractLinks(const uno::Reference< 
container::XNameAccess >& xLinks,
 return bIsTarget;
 }
 
-static void unoAnyToJson(tools::JsonWriter& rJson, const char * pNodeName, 
const uno::Any& anyItem)
+static void unoAnyToJson(tools::JsonWriter& rJson, std::string_view pNodeName, 
const uno::Any& anyItem)
 {
 auto aNode = rJson.startNode(pNodeName);
 OUString aType = anyItem.getValueTypeName();
-rJson.put("type", aType.toUtf8().getStr());
+rJson.put("type", aType);
 
 if (aType == "string")
-rJson.put("value", anyItem.get().toUtf8().getStr());
+rJson.put("value", anyItem.get());
 else if (aType == "unsigned long")
-rJson.put("value", 
OString::number(anyItem.get()).getStr());
+rJson.put("value", OString::number(anyItem.get()));
 else if (aType == "long")
-rJson.put("value", OString::number(anyItem.get()).getStr());
+rJson.put("value", OString::number(anyItem.get()));
 else if (aType == "[]any")
 {
 uno::Sequence aSeq;
@@ -511,7 +511,7 @@ static void unoAnyToJson(tools::JsonWriter& rJson, const 
char * pNodeName, const
 
 for (auto i = 0; i < aSeq.getLength(); ++i)
 {
-unoAnyToJson(rJson, OString::number(i).getStr(), aSeq[i]);
+unoAnyToJson(rJson, OString::number(i), aSeq[i]);
 }
 }
 }
diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index 424b43aadaeb..2bc0e8a2e8a7 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -954,8 +954,8 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
 // SWG:
 if ( nEsc )
 {
-rOutput.WriteCharPtr( "{\\*\\updnprop" ).WriteCharPtr( 
OString::number(
-nProp100).getStr() ).WriteChar( '}' );
+rOutput.WriteCharPtr( "{\\*\\updnprop" ).WriteOString( 
OString::number(
+nProp100) ).WriteChar( '}' );
 }
 tools::Long nUpDown = nFontHeight * std::abs( nEsc ) / 100;
 if ( nEsc < 0 )
diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index c01dde32981c..8e394ad73146 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -692,12 +692,12 @@ void ExcTable::WriteXml( XclExpXmlStream& rStrm )
 rStrm.PushStream( pWorksheet );
 
 pWorksheet->startElement( XML_worksheet,
-XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
-FSNS(XML_xmlns, XML_r), 
rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
-FSNS(XML_xmlns, XML_xdr), 
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing;, // 
rStrm.getNamespaceURL(OOX_NS(xm)).toUtf8() -> 
"http://schemas.microsoft.com/office/excel/2006/main;,
-FSNS(XML_xmlns, XML_x14), 
rStrm.getNamespaceURL(OOX_NS(xls14Lst)).toUtf8(),
-FSNS(XML_xmlns, XML_xr2), rStrm.getNamespaceURL(OOX_NS(xr2)).toUtf8(),
-FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)).toUtf8());
+XML_xmlns, 

[Libreoffice-commits] core.git: desktop/source

2023-03-22 Thread Stephan Bergmann (via logerrit)
 desktop/source/app/app.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit a1faf14f74a62ea76141115538d7d30d90c9eeb6
Author: Stephan Bergmann 
AuthorDate: Wed Mar 22 14:40:04 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Mar 22 15:01:17 2023 +

rhbz#2171265 Report fatal InitApplicationServiceManager failures more 
reliably

For example, when initialization of the UNO type manager failed, any code 
run
between this SetBootstrapError and the HandleBootstrapErrors in 
Desktop::Main
which would need the type manager (e.g., to set a css::uno::Any) would have
caused a crash, so would have failed to print to std::cerr the sought-after
css::uno::Exception message.  The mis-initialized process would most 
definitely
crash sooner or later anyway, so there's no harm in a controlled 
std::abort()
here (if that is even reached, and the process doesn't already crash in
HandleBootstrapErrors, after it has printed the relevant information to
std::cerr).

Change-Id: Ic5889aedec0908fa4b1e2966eb188508d0f92d26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149323
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 5a35b5a745c2..f1ec0b679bc0 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -28,6 +28,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -458,7 +459,8 @@ void Desktop::Init()
 }
 catch (css::uno::Exception & e)
 {
-SetBootstrapError( BE_UNO_SERVICEMANAGER, e.Message );
+HandleBootstrapErrors( BE_UNO_SERVICEMANAGER, e.Message );
+std::abort();
 }
 
 // Check whether safe mode is enabled


[Libreoffice-commits] core.git: desktop/source

2023-03-17 Thread Baole Fang (via logerrit)
 desktop/source/app/dispatchwatcher.cxx |   45 -
 1 file changed, 22 insertions(+), 23 deletions(-)

New commits:
commit 70b8adb100499178ad52f23f7c0a1b7a31129921
Author: Baole Fang 
AuthorDate: Thu Mar 16 20:47:03 2023 -0400
Commit: Mike Kaganski 
CommitDate: Fri Mar 17 19:52:06 2023 +

tdf#153683: Refactor fix

Change-Id: I3358c99425edae92bde120eda4fd905552444eba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149034
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/app/dispatchwatcher.cxx 
b/desktop/source/app/dispatchwatcher.cxx
index f314fcd0ff4b..b00cff042b7e 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -285,41 +285,38 @@ void batchPrint( std::u16string_view rPrinterName, const 
Reference< XPrintable >
 }
 
 // Get xDoc module name
-OUString getName(const Reference< XPrintable > & xDoc)
+OUString getName(const Reference< XInterface > & xDoc)
 {
-OUString aDocService;
 Reference< XModel > xModel( xDoc, UNO_QUERY );
-const Reference xServiceInfo(xModel, UNO_QUERY_THROW);
-if ( xModel.is() )
-{
-utl::MediaDescriptor aMediaDesc( xModel->getArgs() );
-aDocService = 
aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE,
 OUString() );
-}
-OString aModuleId = OUStringToOString(aDocService, 
osl_getThreadTextEncoding());
-if (aModuleId == "com.sun.star.text.TextDocument"
-|| aModuleId == "com.sun.star.text.GlobalDocument")
+if (!xModel)
+return OUString();
+utl::MediaDescriptor aMediaDesc( xModel->getArgs() );
+OUString aDocService = 
aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE,
 OUString() );
+if (aDocService == "com.sun.star.text.TextDocument")
 return "Writer";
-else if (aModuleId == "com.sun.star.text.WebDocument")
+else if (aDocService == "com.sun.star.text.GlobalDocument")
+return "Writer master";
+else if (aDocService == "com.sun.star.text.WebDocument")
 return "Writer/Web";
-else if (aModuleId == "com.sun.star.drawing.DrawingDocument")
+else if (aDocService == "com.sun.star.drawing.DrawingDocument")
 return "Draw";
-else if (aModuleId == "com.sun.star.presentation.PresentationDocument")
+else if (aDocService == "com.sun.star.presentation.PresentationDocument")
 return "Impress";
-else if (aModuleId == "com.sun.star.sheet.SpreadsheetDocument")
+else if (aDocService == "com.sun.star.sheet.SpreadsheetDocument")
 return "Calc";
-else if (aModuleId == "com.sun.star.script.BasicIDE")
+else if (aDocService == "com.sun.star.script.BasicIDE")
 return "Basic";
-else if (aModuleId == "com.sun.star.formula.FormulaProperties")
+else if (aDocService == "com.sun.star.formula.FormulaProperties")
 return "Math";
-else if (aModuleId == "com.sun.star.sdb.RelationDesign")
+else if (aDocService == "com.sun.star.sdb.RelationDesign")
 return "Relation Design";
-else if (aModuleId == "com.sun.star.sdb.QueryDesign")
+else if (aDocService == "com.sun.star.sdb.QueryDesign")
 return "Query Design";
-else if (aModuleId == "com.sun.star.sdb.TableDesign")
+else if (aDocService == "com.sun.star.sdb.TableDesign")
 return "Table Design";
-else if (aModuleId == "com.sun.star.sdb.DataSourceBrowser")
+else if (aDocService == "com.sun.star.sdb.DataSourceBrowser")
 return "Data Source Browser";
-else if (aModuleId == "com.sun.star.sdb.DatabaseDocument")
+else if (aDocService == "com.sun.star.sdb.DatabaseDocument")
 return "Database";
 
 return OUString();
@@ -704,8 +701,10 @@ bool DispatchWatcher::executeDispatchRequests( const 
std::vector " << aTargetURL8 << 
" as a " << name <<" document";
+std::cout << " -> " << aTargetURL8;
 std::cout << " using filter : " << 
OUStringToOString(aFilter, osl_getThreadTextEncoding()) << std::endl;
 if (!bMultiFileTarget && 
FStatHelper::IsDocument(aOutFile))
 std::cout << "Overwriting: " << 
OUStringToOString(aTempName, osl_getThreadTextEncoding()) << std::endl ;


[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/sdi sfx2/source

2023-03-16 Thread Paris Oplopoios (via logerrit)
 desktop/source/lib/init.cxx  |1 +
 include/sfx2/sfxsids.hrc |2 ++
 sfx2/sdi/appslots.sdi|4 
 sfx2/sdi/sfx.sdi |   14 ++
 sfx2/source/appl/appserv.cxx |   14 ++
 5 files changed, 35 insertions(+)

New commits:
commit 9310192a4a0af4e7e3e9ac6124cdd2a706dfedcb
Author: Paris Oplopoios 
AuthorDate: Thu Mar 16 03:55:34 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Thu Mar 16 23:45:34 2023 +

Add uno command that changes the theme

Add an uno command that changes the theme to the one specified in the
first parameter

Change-Id: Ia0fef2ca698415e07f1943cf80ab667fb5c37238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148942
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bdab0c035563..6753220051e0 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3418,6 +3418,7 @@ static void doc_iniUnoCommands ()
 OUString(".uno:InsertSlide"),
 OUString(".uno:DeleteSlide"),
 OUString(".uno:DuplicateSlide"),
+OUString(".uno:ChangeTheme"),
 OUString(".uno:Cut"),
 OUString(".uno:Copy"),
 OUString(".uno:Paste"),
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index d63a5b2d3ae8..97b9c2c71e06 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -295,6 +295,8 @@ class SvxZoomItem;
 #define SID_TOOLBAR_MODE_UI (SID_SFX_START + 1742)
 #define SID_TOOLBAR_LOCK(SID_SFX_START + 1743)
 #define SID_WIDGET_TEST_DIALOG  (SID_SFX_START + 1744)
+#define FN_CHANGE_THEME (SID_SFX_START + 1745)
+#define FN_PARAM_NEW_THEME  
TypedWhichId(SID_SFX_START + 1746)
 
 //  SID_SFX_free_END(SID_SFX_START + 3999)
 
diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index daa0a86265e0..429c48332f7f 100644
--- a/sfx2/sdi/appslots.sdi
+++ b/sfx2/sdi/appslots.sdi
@@ -64,6 +64,10 @@ interface Application
 [
 ExecMethod = MiscExec_Impl ;
 ]
+FN_CHANGE_THEME // ole(no) api(final/play/rec)
+[
+ExecMethod = MiscExec_Impl ;
+]
 SID_CONFIG // ole(no) api(final/play/rec)
 [
 ExecMethod = MiscExec_Impl ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 71b0557bb5d0..750cf6825d31 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -5844,3 +5844,17 @@ SfxVoidItem WidgetTestDialog SID_WIDGET_TEST_DIALOG
 ToolBoxConfig = TRUE,
 GroupId = SfxGroupId::Application;
 ]
+
+SfxVoidItem ChangeTheme FN_CHANGE_THEME
+(SfxStringItem NewTheme FN_PARAM_NEW_THEME)
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = FALSE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+
+GroupId = SfxGroupId::Application;
+]
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 83bc6daa210e..5ccfd3c6a597 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -50,6 +50,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -574,6 +575,19 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 break;
 }
 
+case FN_CHANGE_THEME:
+{
+const SfxStringItem* pNewThemeArg = 
rReq.GetArg(FN_PARAM_NEW_THEME);
+if (!pNewThemeArg)
+{
+SAL_WARN("sfx.appl", "FN_CHANGE_THEME: no theme name");
+break;
+}
+svtools::EditableColorConfig aEditableConfig;
+aEditableConfig.LoadScheme(pNewThemeArg->GetValue());
+break;
+}
+
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 case SID_HELPINDEX:
 {


[Libreoffice-commits] core.git: desktop/source

2023-03-16 Thread Baole Fang (via logerrit)
 desktop/source/app/dispatchwatcher.cxx |   44 -
 1 file changed, 43 insertions(+), 1 deletion(-)

New commits:
commit 80d5d2eb70fd84e98cbe19cd4363d12d50ec31f6
Author: Baole Fang 
AuthorDate: Wed Mar 15 01:51:12 2023 -0400
Commit: Noel Grandin 
CommitDate: Thu Mar 16 06:36:22 2023 +

tdf#153683: Show the used module in --convert-to

Implements getName that returns the module name.
When outputs the convert-to message, module name is included.

Change-Id: Ic18d8899d160e9c1afa8801dc07120f5ef822d07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148905
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/desktop/source/app/dispatchwatcher.cxx 
b/desktop/source/app/dispatchwatcher.cxx
index 5b7fd944fee9..f314fcd0ff4b 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -284,6 +284,47 @@ void batchPrint( std::u16string_view rPrinterName, const 
Reference< XPrintable >
 xDoc->print( aPrinterArgs );
 }
 
+// Get xDoc module name
+OUString getName(const Reference< XPrintable > & xDoc)
+{
+OUString aDocService;
+Reference< XModel > xModel( xDoc, UNO_QUERY );
+const Reference xServiceInfo(xModel, UNO_QUERY_THROW);
+if ( xModel.is() )
+{
+utl::MediaDescriptor aMediaDesc( xModel->getArgs() );
+aDocService = 
aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE,
 OUString() );
+}
+OString aModuleId = OUStringToOString(aDocService, 
osl_getThreadTextEncoding());
+if (aModuleId == "com.sun.star.text.TextDocument"
+|| aModuleId == "com.sun.star.text.GlobalDocument")
+return "Writer";
+else if (aModuleId == "com.sun.star.text.WebDocument")
+return "Writer/Web";
+else if (aModuleId == "com.sun.star.drawing.DrawingDocument")
+return "Draw";
+else if (aModuleId == "com.sun.star.presentation.PresentationDocument")
+return "Impress";
+else if (aModuleId == "com.sun.star.sheet.SpreadsheetDocument")
+return "Calc";
+else if (aModuleId == "com.sun.star.script.BasicIDE")
+return "Basic";
+else if (aModuleId == "com.sun.star.formula.FormulaProperties")
+return "Math";
+else if (aModuleId == "com.sun.star.sdb.RelationDesign")
+return "Relation Design";
+else if (aModuleId == "com.sun.star.sdb.QueryDesign")
+return "Query Design";
+else if (aModuleId == "com.sun.star.sdb.TableDesign")
+return "Table Design";
+else if (aModuleId == "com.sun.star.sdb.DataSourceBrowser")
+return "Data Source Browser";
+else if (aModuleId == "com.sun.star.sdb.DatabaseDocument")
+return "Database";
+
+return OUString();
+}
+
 } // anonymous namespace
 
 DispatchWatcher::DispatchWatcher()
@@ -661,9 +702,10 @@ bool DispatchWatcher::executeDispatchRequests( const 
std::vector " << aTargetURL8;
+std::cout << " -> " << aTargetURL8 << 
" as a " << name <<" document";
 std::cout << " using filter : " << 
OUStringToOString(aFilter, osl_getThreadTextEncoding()) << std::endl;
 if (!bMultiFileTarget && 
FStatHelper::IsDocument(aOutFile))
 std::cout << "Overwriting: " << 
OUStringToOString(aTempName, osl_getThreadTextEncoding()) << std::endl ;


[Libreoffice-commits] core.git: desktop/source

2023-03-08 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bcf0f2b6d87f6be18c417e3537f5cf9b320c4348
Author: Tor Lillqvist 
AuthorDate: Wed Mar 8 13:01:39 2023 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Mar 8 12:22:48 2023 +

Make error message more useful

Change-Id: I3c6efcbd2a2759385912aa352d0c250963e5f004
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148464
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ee1f47a8ea96..54ffbac8e322 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3213,7 +3213,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, 
const char* sUrl, const cha
 }
 else
 {
-SetLastExceptionMsg("input filename without a suffix");
+SetLastExceptionMsg("input URL '" + aURL + "' lacks a suffix");
 return false;
 }
 }


[Libreoffice-commits] core.git: desktop/source

2023-03-07 Thread Noel Grandin (via logerrit)
 desktop/source/deployment/manager/dp_extensionmanager.cxx |2 +-
 desktop/source/deployment/manager/dp_extensionmanager.hxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f7d6f437ad81cc51d78cffb413dd90a7a8dd960d
Author: Noel Grandin 
AuthorDate: Tue Mar 7 13:43:42 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 8 06:43:54 2023 +

osl::Mutex->std::mutex in ExtensionManager

Change-Id: I33c39076093dc0c23b5e7c85cbdf0a88e6231d2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148435
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx 
b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index 44bd4648eff0..b51f4c77b47b 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -627,7 +627,7 @@ Reference 
ExtensionManager::addExtension(
 static_cast(this), 0);
 //We must make sure that the xTmpExtension is not create twice, because 
this
 //would remove the first one.
-::osl::MutexGuard addGuard(m_addMutex);
+std::unique_lock addGuard(m_addMutex);
 
 Reference 
xTmpRepository(getTmpRepository());
 // make sure xTmpRepository is alive as long as xTmpExtension is; as
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx 
b/desktop/source/deployment/manager/dp_extensionmanager.hxx
index 0e08314c36f6..a70f4fbd2e26 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.hxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -146,7 +146,7 @@ private:
 css::uno::Reference 
m_xPackageManagerFactory;
 
 //only to be used within addExtension
-::osl::Mutex m_addMutex;
+std::mutex m_addMutex;
 /* contains the names of all repositories (except tmp) in order of there
priority. That is, the first element is "user" followed by "shared" and
then "bundled"


[Libreoffice-commits] core.git: desktop/source

2023-03-07 Thread Michael Meeks (via logerrit)
 desktop/source/app/app.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 5a41b0a42acac80d7c601f0899c82b9f390bff3d
Author: Michael Meeks 
AuthorDate: Sat Mar 4 21:19:08 2023 +
Commit: Michael Meeks 
CommitDate: Tue Mar 7 08:34:25 2023 +

Avoid running graphics tests when in lok mode.

Best to avoid allocating and freeing 64Mb of RAM, and
burning lots of CPU doing CPU rendering on an invisible
for each document loaded through lok API.

Change-Id: I656b400159b9d6a7a9f2c79d188e3aec9b3dd0e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148258
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 135a5b5fdb1f..d2eb5f3e2a9b 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -81,6 +81,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -340,6 +341,8 @@ namespace {
 
 void runGraphicsRenderTests()
 {
+if (comphelper::LibreOfficeKit::isActive())
+return;
 #if !ENABLE_WASM_STRIP_PINGUSER
 if (!utl::isProductVersionUpgraded(false))
 {


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2023-03-01 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx   |   23 +--
 include/LibreOfficeKit/LibreOfficeKit.h   |7 +--
 include/LibreOfficeKit/LibreOfficeKit.hxx |   24 ++--
 3 files changed, 48 insertions(+), 6 deletions(-)

New commits:
commit 91afabee6bece4cbf61a8f32a6e6a69becd857ae
Author: Tor Lillqvist 
AuthorDate: Tue Feb 28 18:23:06 2023 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Mar 1 08:28:21 2023 +

Improve the LibreOfficeKit Document::paintThumbnail() API

No implementation yet.

Change-Id: Ie1dc955bc8b589bd336af0545a2270cbe84a8b9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148028
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index eee57facee65..903dc2b06687 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1114,7 +1114,12 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
   const int nCanvasWidth, const int nCanvasHeight,
   const int nTilePosX, const int nTilePosY,
   const int nTileWidth, const int nTileHeight);
-static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* 
pBuffer, int x, int y);
+static void doc_paintThumbnail(LibreOfficeKitDocument* pThis,
+   unsigned char* pBuffer,
+   int bufferWidth,
+   int bufferHeight,
+   int width,
+   const char* pURL);
 #ifdef IOS
 static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
  void* rCGContext,
@@ -4010,8 +4015,14 @@ static void 
doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
 
 #endif
 
-static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* 
pBuffer, int x, int y)
+static void doc_paintThumbnail(LibreOfficeKitDocument* pThis,
+   unsigned char* pBuffer,
+   int bufferWidth,
+   int bufferHeight,
+   int width,
+   const char* pURL)
 {
+#if 0
 constexpr float zoom = 0.5f;
 constexpr int pixelWidth = 120;
 constexpr int pixelHeight = 120;
@@ -4021,6 +4032,14 @@ static void doc_paintThumbnail(LibreOfficeKitDocument* 
pThis, unsigned char* pBu
 constexpr int offsetYTwips = 15 * 15;
 
 doc_paintTile(pThis, pBuffer, pixelWidth, pixelHeight, x-offsetXTwips, 
y-offsetYTwips, pixelWidthTwips, pixelHeightTwips);
+#else
+(void) pThis;
+(void) pBuffer;
+(void) bufferWidth;
+(void) bufferHeight;
+(void) width;
+(void) pURL;
+#endif
 }
 
 static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 4de2380998b4..09d3e91e8640 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -501,10 +501,13 @@ struct _LibreOfficeKitDocumentClass
 /// @see lok::Document::setViewTimezone().
 void (*setViewTimezone) (LibreOfficeKitDocument* pThis, int nId, const 
char* timezone);
 
+/// @see lok::Document::paintThumbnail().
 void (*paintThumbnail) (LibreOfficeKitDocument* pThis,
 unsigned char* pBuffer,
-int x,
-int y);
+int bufferWidth,
+int bufferHeight,
+int width,
+const char* pURL);
 
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 17fc518fbe13..04a3b82e6eca 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -886,9 +886,29 @@ public:
 mpDoc->pClass->setViewTimezone(mpDoc, nId, timezone);
 }
 
-void paintThumbnail(unsigned char* pBuffer, int x, int y)
+/**
+ * Create a thumbnail of a location in the document.
+ *
+ * @param pBuffer Where the thumbnail is painted. Same format as a tile 
painted
+ * by paintTile().
+ * @param bufferWidth number of pixels in a row of pBuffer.
+ * @param bufferHeight number of pixels in a column of pBuffer.
+ * @param width logical width of the rendered rectangle, in TWIPs.
+ * @param pURL Just the fragment part of a URL, indicating the location in 
the document
+ * to render as a thumbnail. As returned by extractRequest(), or null, 
meaning the start
+ * of the document.
+ *
+ * Note that there is no parameter for the logical height of the
+ * rendered rectangle. The aspect ratio of the rendered rectangle
+ * is determined by the 

[Libreoffice-commits] core.git: desktop/source

2023-02-28 Thread Patrick Luby (via logerrit)
 desktop/source/lib/init.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 68f33bcc41cd3895e91578e9e2990a919748cc2b
Author: Patrick Luby 
AuthorDate: Tue Feb 28 09:56:38 2023 -0500
Commit: Patrick Luby 
CommitDate: Tue Feb 28 18:44:45 2023 +

Fix iOS build breakage

There were a few remaining DeviceFormat::DEFAULTS in remaining in
IOS blocks after commit  00659bcdbbb167596e6fd18e283a54819dd6fe91

Change-Id: I29e1f2bd6d4ce20dea7a45ce17bc6f3b929859c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148008
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6cd7a5a27470..eee57facee65 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2589,7 +2589,7 @@ void paintTileToCGContext(ITiledRenderable* pDocument,
 SystemGraphicsData aData;
 aData.rCGContext = reinterpret_cast(rCGContext);
 
-ScopedVclPtrInstance pDevice(aData, Size(1, 1), 
DeviceFormat::DEFAULT);
+ScopedVclPtrInstance pDevice(aData, Size(1, 1), 
DeviceFormat::WITHOUT_ALPHA);
 pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
 pDevice->SetOutputSizePixel(nCanvasSize);
 pDocument->paintTile(*pDevice, nCanvasSize.Width(), nCanvasSize.Height(),
@@ -6585,7 +6585,7 @@ static void 
doc_paintWindowForView(LibreOfficeKitDocument* pThis, unsigned nLOKW
 SystemGraphicsData aData;
 aData.rCGContext = cgc;
 
-ScopedVclPtrInstance pDevice(aData, Size(1, 1), 
DeviceFormat::DEFAULT);
+ScopedVclPtrInstance pDevice(aData, Size(1, 1), 
DeviceFormat::WITHOUT_ALPHA);
 pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
 
 pDevice->SetOutputSizePixel(Size(nWidth, nHeight));


[Libreoffice-commits] core.git: desktop/source

2023-02-25 Thread Andrea Gelmini (via logerrit)
 desktop/source/lib/init.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit a885d4839800f03759c5c22b513b5ffdc8478848
Author: Andrea Gelmini 
AuthorDate: Wed Feb 22 14:40:28 2023 +0100
Commit: Julien Nabet 
CommitDate: Sat Feb 25 11:41:16 2023 +

Remove duplicated include

Change-Id: I3848788410525b36a1ece56b125e75a2281fafe6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147474
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1a077ce19500..6cd7a5a27470 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -67,7 +67,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 


[Libreoffice-commits] core.git: desktop/source desktop/uiconfig offapi/com officecfg/registry sysui/desktop

2023-02-13 Thread Samuel Mehrbrodt (via logerrit)
 desktop/source/pkgchk/unopkg/unopkg_app.cxx  |4 
++--
 desktop/uiconfig/ui/extensionmanager.ui  |2 +-
 desktop/uiconfig/ui/updateinstalldialog.ui   |2 +-
 offapi/com/sun/star/deployment/XPackageManager.idl   |2 +-
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |2 +-
 officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs |4 
++--
 officecfg/registry/schema/org/openoffice/Office/OptionsDialog.xcs|3 +--
 sysui/desktop/man/unopkg.1   |2 +-
 8 files changed, 10 insertions(+), 11 deletions(-)

New commits:
commit ef3c81d0fca9c8f80fd0d4e4025c37a114528344
Author: Samuel Mehrbrodt 
AuthorDate: Thu Feb 9 14:52:58 2023 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Feb 13 13:17:12 2023 +

Rename: Extension Manager -> Extensions

simplify dialog title, should be clear what this is about.

Change-Id: I65d8ca89e32cc225a07483703cd27b0fdc630b42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146715
Reviewed-by: Heiko Tietze 
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx 
b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index c235eba1f523..0ecb328b7c69 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -92,7 +92,7 @@ u"\n"
 " remove  remove extensions by identifier\n"
 " reinstall   expert feature: reinstall all deployed extensions\n"
 " listlist information about deployed extensions\n"
-" gui raise Extension Manager Graphical User Interface 
(GUI)\n"
+" gui raise Extensions dialog\n"
 "\n"
 "options:\n"
 " -h, --help  this help\n"
@@ -110,7 +110,7 @@ u"\n"
 " --deployment-contextexpert feature: explicit deployment context\n"
 " \n"
 "\n"
-"To learn more about the Extension Manager and extensions, see:\n"
+"To learn more about extensions, see:\n"
 "https://wiki.documentfoundation.org/Documentation/DevGuide/Extensions\n\n;;
 
 
diff --git a/desktop/uiconfig/ui/extensionmanager.ui 
b/desktop/uiconfig/ui/extensionmanager.ui
index f1eba95b038d..215536e179ab 100644
--- a/desktop/uiconfig/ui/extensionmanager.ui
+++ b/desktop/uiconfig/ui/extensionmanager.ui
@@ -5,7 +5,7 @@
   
 False
 6
-Extension Manager
+Extensions
 0
 0
 dialog
diff --git a/desktop/uiconfig/ui/updateinstalldialog.ui 
b/desktop/uiconfig/ui/updateinstalldialog.ui
index 6ef80d393df2..15e7bcc398f3 100644
--- a/desktop/uiconfig/ui/updateinstalldialog.ui
+++ b/desktop/uiconfig/ui/updateinstalldialog.ui
@@ -175,7 +175,7 @@
 
 
   
-Click the Check 
for Updates button in the Extension Manager to check for online updates for all 
installed extensions. To check for online updates for only the selected 
extension, right-click to open the context menu, then choose Update.
+Click the Check 
for Updates button in the Extensions dialog to check for online updates for all 
installed extensions. To check for online updates for only the selected 
extension, right-click to open the context menu, then choose Update.
   
 
   
diff --git a/offapi/com/sun/star/deployment/XPackageManager.idl 
b/offapi/com/sun/star/deployment/XPackageManager.idl
index 2fc1769a583a..4e163e6fba24 100644
--- a/offapi/com/sun/star/deployment/XPackageManager.idl
+++ b/offapi/com/sun/star/deployment/XPackageManager.idl
@@ -225,7 +225,7 @@ interface XPackageManager
 
 Normally one would call a method and handle the exception
 if writing failed. However, a GUI interface may need to know beforehand
-if writing is allowed. For example, the Extension Manager dialog
+if writing is allowed. For example, the Extensions dialog
 needs to enable / disable the Add button depending if the user has
 write permission. Only the XPackageManager implementation knows the
 location of the installed extensions. Therefore it is not possible
diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 250d641f3b25..07a772f54d72 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6328,7 +6328,7 @@ bit 3 (0x8): #define 
UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
   
   
 
-  ~Extension Manager...
+  ~Extensions...
 
 
   1
diff --git 
a/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs 
b/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs
index eaf840cd90e4..1f6f0c4c35e8 100644
--- 

[Libreoffice-commits] core.git: desktop/source filter/source scripting/source sfx2/source ucb/source wizards/com

2023-02-13 Thread Mike Kaganski (via logerrit)
 desktop/source/deployment/misc/dp_misc.cxx  |8 ++--
 filter/source/xsltfilter/XSLTFilter.cxx |   13 +++--
 scripting/source/basprov/basprov.cxx|5 ++---
 sfx2/source/doc/DocumentMetadataAccess.cxx  |3 +--
 sfx2/source/doc/doctemplates.cxx|   12 
 ucb/source/ucp/expand/ucpexpand.cxx |   11 +++
 wizards/com/sun/star/wizards/common/FileAccess.java |   10 +++---
 7 files changed, 26 insertions(+), 36 deletions(-)

New commits:
commit 00f6c36b603416b73e1327ac4c862b1eaca2d277
Author: Mike Kaganski 
AuthorDate: Mon Feb 13 11:22:03 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Feb 13 11:29:34 2023 +

Fix/simplify some vnd.sun.star.expand: handling

The vnd.sun.star.expand: payload must be URL-decoded prior to passing
it to expandMacros; the protocol must be checked case-insensitively.
Use startsWithIgnoreAsciiCase for that.

Change-Id: I2be993a0400a27cb7dc57207cd0824b4505afd2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146855
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/deployment/misc/dp_misc.cxx 
b/desktop/source/deployment/misc/dp_misc.cxx
index ea5c737c2d7b..ed394382bb5c 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -300,9 +300,7 @@ OUString expandUnoRcTerm( OUString const & term_ )
 OUString makeRcTerm( OUString const & url )
 {
 OSL_ASSERT( url.match( "vnd.sun.star.expand:" ));
-if (url.match( "vnd.sun.star.expand:" )) {
-// cut protocol:
-OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) );
+if (OUString rcterm; url.startsWithIgnoreAsciiCase("vnd.sun.star.expand:", 
)) {
 // decode uric class chars:
 rcterm = ::rtl::Uri::decode(
 rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
@@ -315,9 +313,7 @@ OUString makeRcTerm( OUString const & url )
 
 OUString expandUnoRcUrl( OUString const & url )
 {
-if (url.match( "vnd.sun.star.expand:" )) {
-// cut protocol:
-OUString rcurl( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) );
+if (OUString rcurl; url.startsWithIgnoreAsciiCase("vnd.sun.star.expand:", 
)) {
 // decode uric class chars:
 rcurl = ::rtl::Uri::decode(
 rcurl, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx 
b/filter/source/xsltfilter/XSLTFilter.cxx
index 8ebbd874ed1e..f08933276055 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -207,20 +208,20 @@ namespace XSLT
 OUString
 XSLTFilter::expandUrl(const OUString& sUrl)
 {
-OUString sExpandedUrl;
 try
 {
+OUString sPreparedURL(sUrl);
+if 
(sPreparedURL.startsWithIgnoreAsciiCase("vnd.sun.star.expand:", ))
+sPreparedURL = rtl::Uri::decode(sPreparedURL, 
rtl_UriDecodeWithCharset,
+RTL_TEXTENCODING_UTF8);
 css::uno::Reference
 xMacroExpander = theMacroExpander::get(m_xContext);
-sExpandedUrl = xMacroExpander->expandMacros(sUrl);
-sal_Int32 nPos = sExpandedUrl.indexOf( "vnd.sun.star.expand:" 
);
-if (nPos != -1)
-sExpandedUrl = sExpandedUrl.copy(nPos + 20);
+return xMacroExpander->expandMacros(sPreparedURL);
 }
 catch (const Exception&)
 {
 }
-return sExpandedUrl;
+return {};
 }
 
 css::uno::Reference
diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index d4afb41eaea3..cafd4daa76d0 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -103,10 +103,9 @@ namespace basprov
 }
 else if ( 
aScheme.equalsIgnoreAsciiCase("vnd.sun.star.pkg") )
 {
-OUString aAuthority = xUriRef->getAuthority();
-if ( aAuthority.matchIgnoreAsciiCase( 
"vnd.sun.star.expand:" ) )
+OUString aDecodedURL = xUriRef->getAuthority();
+if ( aDecodedURL.startsWithIgnoreAsciiCase( 
"vnd.sun.star.expand:",  ) )
 {
-OUString aDecodedURL( aAuthority.copy( sizeof ( 
"vnd.sun.star.expand:" ) - 1 ) );
 aDecodedURL = ::rtl::Uri::decode( aDecodedURL, 
rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
 Reference xMacroExpander =
 util::theMacroExpander::get(m_xContext);
diff --git 

[Libreoffice-commits] core.git: desktop/source

2023-02-07 Thread Caolán McNamara (via logerrit)
 desktop/source/lib/init.cxx |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 58732c0760478d00dbf34c8d631e75a0262a2b75
Author: Caolán McNamara 
AuthorDate: Tue Feb 7 16:35:11 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 7 19:55:00 2023 +

cid#1520802 Dereference null return value

Change-Id: Iba193386d1ee82c8f47ece2445cfb2ecaeeed998
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146636
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9eb8fc64547b..d0eda23e0eb8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7190,18 +7190,24 @@ void setLanguageToolConfig()
 const char* pRestProtocol = ::getenv("LANGUAGETOOL_RESTPROTOCOL");
 
 OUString aEnabled = OStringToOUString(pEnabled, RTL_TEXTENCODING_UTF8);
-OUString aSSLVerification = OStringToOUString(pSSLVerification, 
RTL_TEXTENCODING_UTF8);
 if (aEnabled != "true")
 return;
 OUString aBaseUrl = OStringToOUString(pBaseUrlString, 
RTL_TEXTENCODING_UTF8);
-OUString aRestProtocol = OStringToOUString(pRestProtocol, 
RTL_TEXTENCODING_UTF8);
 try
 {
 SvxLanguageToolOptions& rLanguageOpts = 
SvxLanguageToolOptions::Get();
 rLanguageOpts.setBaseURL(aBaseUrl);
 rLanguageOpts.setEnabled(true);
-rLanguageOpts.setSSLVerification(aSSLVerification == "true");
-rLanguageOpts.setRestProtocol(aRestProtocol);
+if (pSSLVerification)
+{
+OUString aSSLVerification = 
OStringToOUString(pSSLVerification, RTL_TEXTENCODING_UTF8);
+rLanguageOpts.setSSLVerification(aSSLVerification == "true");
+}
+if (pRestProtocol)
+{
+OUString aRestProtocol = OStringToOUString(pRestProtocol, 
RTL_TEXTENCODING_UTF8);
+rLanguageOpts.setRestProtocol(aRestProtocol);
+}
 if (pUsername && pApikey)
 {
 OUString aUsername = OStringToOUString(pUsername, 
RTL_TEXTENCODING_UTF8);


[Libreoffice-commits] core.git: desktop/source

2023-02-03 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx |   45 
 1 file changed, 29 insertions(+), 16 deletions(-)

New commits:
commit 967c56f7d4c46240a37b2d4dd0a2f577b621f75d
Author: Henry Castro 
AuthorDate: Tue Jan 17 11:02:13 2023 -0400
Commit: Henry Castro 
CommitDate: Fri Feb 3 12:32:50 2023 +

lok: fix query language status

The Calc and Impress return language status
as a SfxStringItem, but Writer is a SfxListStringItem.

Signed-off-by: Henry Castro 
Change-Id: I88f77288e422a8f80473f0e33257078cfaa704b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145675
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146479
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d19d2717ffaa..0e9e2c203fff 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5399,22 +5399,34 @@ static void getDocLanguages(LibreOfficeKitDocument* 
pThis, uno::SequenceQueryState(SID_LANGUAGE_STATUS, aLangStatus);
 
-Sequence aSeqLang;
-if (!(aLangStatus >>= aSeqLang))
-return;
+OUString sCurrent;
+OUString sKeyboard;
+OUString sGuessText;
+SvtScriptType eScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN
+| SvtScriptType::COMPLEX;
 
-// (aSeqLang[0] == "Current Language",  aSeqLang[1] == "Script Type",
-//  aSeqLang[2] == "Keyboard Language", aSeqLang[3] == "Guess Text Lang")
-if (aSeqLang.getLength() != 4)
-return;
+Sequence aSeqLang;
+if (aLangStatus >>= aSeqLang)
+{
+if (aSeqLang.getLength() == 4)
+{
+sCurrent = aSeqLang[0];
+eScriptType = static_cast(aSeqLang[1].toInt32());
+sKeyboard = aSeqLang[1];
+sGuessText = aSeqLang[2];
+}
+}
+else
+{
+aLangStatus >>= sCurrent;
+}
 
 LanguageType nLangType;
 std::set aLangItems;
-SvtScriptType eScriptType = 
static_cast(aSeqLang[1].toInt32());
 
-if (!aSeqLang[0].isEmpty())
+if (!sCurrent.isEmpty())
 {
-nLangType = SvtLanguageTable::GetLanguageType(aSeqLang[0]);
+nLangType = SvtLanguageTable::GetLanguageType(sCurrent);
 if (nLangType != LANGUAGE_DONTKNOW)
 {
 aLangItems.insert(nLangType);
@@ -5436,9 +5448,9 @@ static void getDocLanguages(LibreOfficeKitDocument* 
pThis, uno::Sequence xLangGuesser;
 try
@@ -5459,9 +5471,10 @@ static void getDocLanguages(LibreOfficeKitDocument* 
pThis, uno::SequenceguessPrimaryLanguage(aSeqLang[3], 0,
-  
aSeqLang[3].getLength());
-nLangType = LanguageTag(aLocale).makeFallback().getLanguageType();
+lang::Locale aLocale = 
xLangGuesser->guessPrimaryLanguage(sGuessText, 0,
+  
sGuessText.getLength());
+LanguageTag aLanguageTag(aLocale);
+nLangType = aLanguageTag.getLanguageType(false);
 if (nLangType != LANGUAGE_DONTKNOW &&
 (eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
 {


[Libreoffice-commits] core.git: desktop/source

2023-02-03 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx |  129 +++-
 1 file changed, 127 insertions(+), 2 deletions(-)

New commits:
commit f74031d4eaeb289f062f77209da10d464c09c2a6
Author: Henry Castro 
AuthorDate: Wed Jan 11 16:14:57 2023 -0400
Commit: Henry Castro 
CommitDate: Fri Feb 3 12:32:24 2023 +

lok: add function getDocLanguages

If the spell checker is disabled to use a remote
spelling feature, the getLanguages function is obsolete.

In order to not break stable functions, introduce the
getDocLanguages for the remote spelling feature.

Signed-off-by: Henry Castro 
Change-Id: Ic210f31eddd3208b29d073ff35ba4fa2d98ea772
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145363
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
(cherry picked from commit bb0c63cc73998a0f67ae4c3e59acea3827a6e11c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146399
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 71c53f2d097a..d19d2717ffaa 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,6 +103,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -5384,6 +5386,119 @@ static void 
doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, in
 pDoc->setGraphicSelection(nType, nX, nY);
 }
 
+static void getDocLanguages(LibreOfficeKitDocument* pThis, 
uno::Sequence& rSeq)
+{
+SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+if (!pViewFrame)
+return;
+
+SfxDispatcher* pDispatcher = pViewFrame->GetBindings().GetDispatcher();
+if (!pDispatcher)
+return;
+
+css::uno::Any aLangStatus;
+pDispatcher->QueryState(SID_LANGUAGE_STATUS, aLangStatus);
+
+Sequence aSeqLang;
+if (!(aLangStatus >>= aSeqLang))
+return;
+
+// (aSeqLang[0] == "Current Language",  aSeqLang[1] == "Script Type",
+//  aSeqLang[2] == "Keyboard Language", aSeqLang[3] == "Guess Text Lang")
+if (aSeqLang.getLength() != 4)
+return;
+
+LanguageType nLangType;
+std::set aLangItems;
+SvtScriptType eScriptType = 
static_cast(aSeqLang[1].toInt32());
+
+if (!aSeqLang[0].isEmpty())
+{
+nLangType = SvtLanguageTable::GetLanguageType(aSeqLang[0]);
+if (nLangType != LANGUAGE_DONTKNOW)
+{
+aLangItems.insert(nLangType);
+}
+}
+
+const AllSettings& rAllSettings = Application::GetSettings();
+nLangType = rAllSettings.GetLanguageTag().getLanguageType();
+if (nLangType != LANGUAGE_DONTKNOW &&
+(eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
+{
+aLangItems.insert(nLangType);
+}
+
+nLangType = rAllSettings.GetUILanguageTag().getLanguageType();
+if (nLangType != LANGUAGE_DONTKNOW &&
+(eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
+{
+aLangItems.insert(nLangType);
+}
+
+if (!aSeqLang[2].isEmpty())
+{
+nLangType = SvtLanguageTable::GetLanguageType(aSeqLang[2]);
+if (nLangType != LANGUAGE_DONTKNOW &&
+(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
+{
+aLangItems.insert(nLangType);
+}
+}
+
+if (!aSeqLang[3].isEmpty())
+{
+Reference xLangGuesser;
+try
+{
+xLangGuesser = linguistic2::LanguageGuessing::create(xContext);
+}
+catch(...)
+{
+}
+
+if (xLangGuesser.is())
+{
+lang::Locale aLocale = 
xLangGuesser->guessPrimaryLanguage(aSeqLang[3], 0,
+  
aSeqLang[3].getLength());
+nLangType = LanguageTag(aLocale).makeFallback().getLanguageType();
+if (nLangType != LANGUAGE_DONTKNOW &&
+(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
+{
+aLangItems.insert(nLangType);
+}
+}
+}
+
+LibLODocument_Impl* pDocument = static_cast(pThis);
+Reference 
xDocumentLanguages(pDocument->mxComponent, UNO_QUERY);
+if (xDocumentLanguages.is())
+{
+const Sequence 
aLocales(xDocumentLanguages->getDocumentLanguages(
+  
static_cast(eScriptType), 64));
+
+for (const lang::Locale& aLocale : aLocales)
+{
+nLangType = SvtLanguageTable::GetLanguageType(aLocale.Language);
+if (nLangType != LANGUAGE_DONTKNOW &&
+(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
+{
+aLangItems.insert(nLangType);
+}
+}
+}
+
+int nLocale = 0;
+Sequence aLocales(aLangItems.size());
+auto 

[Libreoffice-commits] core.git: desktop/source

2023-02-01 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx |   19 +++
 1 file changed, 19 insertions(+)

New commits:
commit 56cb2b78dbd355c74d3454721b8d37ad24292f85
Author: Henry Castro 
AuthorDate: Fri Dec 23 13:57:01 2022 -0400
Commit: Henry Castro 
CommitDate: Wed Feb 1 20:06:09 2023 +

lok: disable spell if remote language tool enabled

.

Signed-off-by: Henry Castro 
Change-Id: I73158c3feaa84af4d713d3f1b1fc9a60dcf95463
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144785
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145601
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1097058a81c5..71c53f2d097a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -58,6 +58,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -7069,6 +7071,23 @@ void setLanguageToolConfig()
 rLanguageOpts.setUsername(aUsername);
 rLanguageOpts.setApiKey(aApiKey);
 }
+
+css::uno::Reference 
xLangSrv =
+css::linguistic2::LinguServiceManager::create(xContext);
+if (xLangSrv.is())
+{
+css::uno::Reference xSpell = 
xLangSrv->getSpellChecker();
+if (xSpell.is())
+{
+Sequence aEmpty;
+Sequence aLocales = 
xSpell->getLocales();
+
+for (int itLocale = 0; itLocale < aLocales.getLength(); 
itLocale++)
+{
+xLangSrv->setConfiguredServices(SN_SPELLCHECKER, 
aLocales[itLocale], aEmpty);
+}
+}
+}
 }
 catch(uno::Exception const& rException)
 {


[Libreoffice-commits] core.git: desktop/source

2023-01-31 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 5cd9ca5d4232c725661131137975549c06231d5c
Author: Henry Castro 
AuthorDate: Tue Nov 22 11:39:45 2022 -0400
Commit: Henry Castro 
CommitDate: Tue Jan 31 16:04:39 2023 +

lok: add Rest Protocol property

Signed-off-by: Henry Castro 
Change-Id: I7353e16dbf835684e5ce5963387359924352937b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143124
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145599
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 45b2b126fadb..1097058a81c5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7041,22 +7041,27 @@ void setLanguageToolConfig()
 {
 const char* pEnabled = ::getenv("LANGUAGETOOL_ENABLED");
 const char* pBaseUrlString = ::getenv("LANGUAGETOOL_BASEURL");
-const char* pUsername = ::getenv("LANGUAGETOOL_USERNAME");
-const char* pApikey = ::getenv("LANGUAGETOOL_APIKEY");
-const char* pSSLVerification = ::getenv("LANGUAGETOOL_SSL_VERIFICATION");
+
 if (pEnabled && pBaseUrlString)
 {
+const char* pUsername = ::getenv("LANGUAGETOOL_USERNAME");
+const char* pApikey = ::getenv("LANGUAGETOOL_APIKEY");
+const char* pSSLVerification = 
::getenv("LANGUAGETOOL_SSL_VERIFICATION");
+const char* pRestProtocol = ::getenv("LANGUAGETOOL_RESTPROTOCOL");
+
 OUString aEnabled = OStringToOUString(pEnabled, RTL_TEXTENCODING_UTF8);
 OUString aSSLVerification = OStringToOUString(pSSLVerification, 
RTL_TEXTENCODING_UTF8);
 if (aEnabled != "true")
 return;
 OUString aBaseUrl = OStringToOUString(pBaseUrlString, 
RTL_TEXTENCODING_UTF8);
+OUString aRestProtocol = OStringToOUString(pRestProtocol, 
RTL_TEXTENCODING_UTF8);
 try
 {
 SvxLanguageToolOptions& rLanguageOpts = 
SvxLanguageToolOptions::Get();
 rLanguageOpts.setBaseURL(aBaseUrl);
 rLanguageOpts.setEnabled(true);
 rLanguageOpts.setSSLVerification(aSSLVerification == "true");
+rLanguageOpts.setRestProtocol(aRestProtocol);
 if (pUsername && pApikey)
 {
 OUString aUsername = OStringToOUString(pUsername, 
RTL_TEXTENCODING_UTF8);


[Libreoffice-commits] core.git: desktop/source

2023-01-30 Thread Mert Tumer (via logerrit)
 desktop/source/lib/init.cxx |   33 +
 1 file changed, 33 insertions(+)

New commits:
commit 080d39e6832b0ebbf588b6d02ad00bba968d1360
Author: Mert Tumer 
AuthorDate: Fri Jun 10 13:09:51 2022 +0300
Commit: Henry Castro 
CommitDate: Mon Jan 30 17:23:24 2023 +

lok: set LanguageTool config parameters from environment

Signed-off-by: Mert Tumer 
Change-Id: Ic7343439536abee626c269d2a824bb36f9abc40f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135583
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145573
Tested-by: Jenkins
Reviewed-by: Henry Castro 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index db9a9632e4c3..78f03b8a0d43 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -136,6 +136,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #ifdef IOS
 #include 
@@ -7036,6 +7037,37 @@ void setDeeplConfig()
 }
 }
 
+void setLanguageToolConfig()
+{
+const char* pEnabled = ::getenv("LANGUAGETOOL_ENABLED");
+const char* pBaseUrlString = ::getenv("LANGUAGETOOL_BASEURL");
+const char* pUsername = ::getenv("LANGUAGETOOL_USERNAME");
+const char* pApikey = ::getenv("LANGUAGETOOL_APIKEY");
+if (pEnabled && pBaseUrlString)
+{
+OUString aEnabled = OStringToOUString(pEnabled, RTL_TEXTENCODING_UTF8);
+if (aEnabled != "true")
+return;
+OUString aBaseUrl = OStringToOUString(pBaseUrlString, 
RTL_TEXTENCODING_UTF8);
+try
+{
+SvxLanguageToolOptions& rLanguageOpts = 
SvxLanguageToolOptions::Get();
+rLanguageOpts.setBaseURL(aBaseUrl);
+rLanguageOpts.setEnabled(true);
+if (pUsername && pApikey)
+{
+OUString aUsername = OStringToOUString(pUsername, 
RTL_TEXTENCODING_UTF8);
+OUString aApiKey = OStringToOUString(pApikey, 
RTL_TEXTENCODING_UTF8);
+rLanguageOpts.setUsername(aUsername);
+rLanguageOpts.setApiKey(aApiKey);
+}
+}
+catch(uno::Exception const& rException)
+{
+SAL_WARN("lok", "Failed to set LanguageTool API settings: " << 
rException.Message);
+}
+}
+}
 
 }
 
@@ -7359,6 +7391,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 
 setCertificateDir();
 setDeeplConfig();
+setLanguageToolConfig();
 
 if (bNotebookbar)
 {


[Libreoffice-commits] core.git: desktop/source

2023-01-28 Thread Tor Lillqvist (via logerrit)
 desktop/source/deployment/misc/dp_misc.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 18d2c7e82dbbe708925588d101e7c59a5b9327a1
Author: Tor Lillqvist 
AuthorDate: Thu Jul 7 11:37:21 2022 +0300
Commit: Andras Timar 
CommitDate: Sat Jan 28 20:24:24 2023 +

Avoid compiler warning

Change-Id: I322b2c0ea14bbf8ed2fe1a306c0ed28f5e5ae258
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136875
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 
(cherry picked from commit ece304df9ad2aa0f974927320a1324c06b89f337)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146076
Tested-by: Jenkins
Reviewed-by: Andras Timar 

diff --git a/desktop/source/deployment/misc/dp_misc.cxx 
b/desktop/source/deployment/misc/dp_misc.cxx
index bbe3a085fc68..ea5c737c2d7b 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -515,7 +515,9 @@ void syncRepositories(
 Reference(), xCmdEnv);
 }
 }
-#if !HAVE_FEATURE_MACOSX_SANDBOX
+#if HAVE_FEATURE_MACOSX_SANDBOX
+(void) bModified;
+#else
 if (bModified && !comphelper::LibreOfficeKit::isActive())
 {
 Reference 
restarter(task::OfficeRestartManager::get(comphelper::getProcessComponentContext()));


[Libreoffice-commits] core.git: desktop/source

2023-01-24 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit d514097753a5971f2d5616319238a1a9eb6d8f9a
Author: Tor Lillqvist 
AuthorDate: Tue Jan 24 15:43:15 2023 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Jan 24 15:17:30 2023 +

Surround recently added code that breaks on COWASM with ifdef

After 7a6324ea0d81bbe2bba09f8a7f5230342a4f4e85 I started getting UNO
exceptions with the message "component context fails to supply service
com.sun.star.xml.crypto.SEInitializer of type
com.sun.star.xml.crypto.XSEInitializer".

It is likely that it breaks in the iOS and Android apps, too, so
bypass for those, too.

Change-Id: Id08afbf6bea071c8b0b6564342716e0b064cb712
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146071
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8e98e675bb79..97d74bc4682d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3404,6 +3404,7 @@ static void doc_iniUnoCommands ()
 return;
 }
 
+#if !defined IOS && !defined ANDROID && !defined __EMSCRIPTEN__
 uno::Reference xSEInitializer = 
xml::crypto::SEInitializer::create(xContext);
 if (!xSEInitializer.is())
 {
@@ -3417,6 +3418,7 @@ static void doc_iniUnoCommands ()
 {
 SAL_WARN("lok", "iniUnoCommands: failed to create security context");
 }
+#endif
 
 SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
 uno::Reference 
xParser(util::URLTransformer::create(xContext));


[Libreoffice-commits] core.git: desktop/source

2023-01-23 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit 7a6324ea0d81bbe2bba09f8a7f5230342a4f4e85
Author: Henry Castro 
AuthorDate: Fri Nov 4 14:00:26 2022 -0400
Commit: Andras Timar 
CommitDate: Mon Jan 23 21:47:29 2023 +

lok: ensure to initialize the security context

if the backend NSS is used, before load the document
ensure the NSS is initialized otherwise NSS next functions
calls will fail.

Signed-off-by: Henry Castro 
Change-Id: I7ac1d7681995e6c284e2dd4595a33d044af4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142213
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142289
Tested-by: Jenkins
Reviewed-by: Andras Timar 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bdc4b1869ded..8e98e675bb79 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3404,6 +3404,20 @@ static void doc_iniUnoCommands ()
 return;
 }
 
+uno::Reference xSEInitializer = 
xml::crypto::SEInitializer::create(xContext);
+if (!xSEInitializer.is())
+{
+SAL_WARN("lok", "iniUnoCommands: XSEInitializer is not available");
+return;
+}
+
+uno::Reference xSecurityContext =
+xSEInitializer->createSecurityContext(OUString());
+if (!xSecurityContext.is())
+{
+SAL_WARN("lok", "iniUnoCommands: failed to create security context");
+}
+
 SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
 uno::Reference 
xParser(util::URLTransformer::create(xContext));
 


[Libreoffice-commits] core.git: desktop/source extensions/source

2023-01-12 Thread Julien Nabet (via logerrit)
 desktop/source/app/updater.cxx  |6 +++---
 extensions/source/update/check/download.cxx |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit e78859005b632860c9464335fdf6836c4fd41807
Author: Julien Nabet 
AuthorDate: Wed Jan 11 11:28:27 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Jan 12 10:32:36 2023 +

Curl:CURLOPT_REDIR_PROTOCOLS(_STR): use only "https", not "http"

Change-Id: If615503b598f6823d7978f12e666832c82b63ece
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145334
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index f74dfbeceb6e..5fb18dfad0bf 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -562,11 +562,11 @@ std::string download_content(const OString& rURL, bool 
bFile, OUString& rHash)
 headerlist = curl_slist_append(headerlist, buf);
 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, headerlist);
 curl_easy_setopt(curl.get(), CURLOPT_FOLLOWLOCATION, 1); // follow 
redirects
-// only allow redirect to http:// and https://
+// only allow redirect to https://
 #if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && 
LIBCURL_VERSION_MINOR >= 85)
-curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
+curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS_STR, "https");
 #else
-curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
+curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
 #endif
 
 std::string response_body;
diff --git a/extensions/source/update/check/download.cxx 
b/extensions/source/update/check/download.cxx
index 4ba5863930ba..ba371bdee570 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -232,11 +232,11 @@ static bool curl_run(std::u16string_view rURL, OutData& 
out, const OString& aPro
 
 // enable redirection
 (void)curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1);
-// only allow redirect to http:// and https://
+// only allow redirect to https://
 #if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && 
LIBCURL_VERSION_MINOR >= 85)
-curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
+curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "https");
 #else
-curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
+curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
 #endif
 
 // write function


[Libreoffice-commits] core.git: desktop/source extensions/source

2023-01-11 Thread Julien Nabet (via logerrit)
 desktop/source/app/updater.cxx  |6 +-
 extensions/source/update/check/download.cxx |   22 +-
 2 files changed, 18 insertions(+), 10 deletions(-)

New commits:
commit 071c66521c6db7136ea7f4606d48ab9fbcc4c71d
Author: Julien Nabet 
AuthorDate: Mon Jan 9 13:54:45 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Jan 11 10:14:47 2023 +

Fix types for Curl elements (update part)

"CURLOPT_REDIR_PROTOCOLS_STR" has been added with Curl 7.85
so check if Curl version is 7.85 min or use the previous version 
"CURLOPT_REDIR_PROTOCOLS"

Change-Id: Iacf6a3c37aba63d615eaa93352b098b1c9183533
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145208
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 9f60a64d7235..f74dfbeceb6e 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -563,7 +563,11 @@ std::string download_content(const OString& rURL, bool 
bFile, OUString& rHash)
 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, headerlist);
 curl_easy_setopt(curl.get(), CURLOPT_FOLLOWLOCATION, 1); // follow 
redirects
 // only allow redirect to http:// and https://
-curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS_STR, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
+#if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && 
LIBCURL_VERSION_MINOR >= 85)
+curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
+#else
+curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
+#endif
 
 std::string response_body;
 utl::TempFileNamed aTempFile;
diff --git a/extensions/source/update/check/download.cxx 
b/extensions/source/update/check/download.cxx
index 3b76f9cc8a27..4ba5863930ba 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -60,8 +60,8 @@ static void openFile( OutData& out )
 char * effective_url;
 curl_easy_getinfo(out.curl, CURLINFO_EFFECTIVE_URL, _url);
 
-double fDownloadSize;
-curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, 
);
+curl_off_t nDownloadSize;
+curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, 
);
 
 OString aURL(effective_url);
 
@@ -94,7 +94,7 @@ static void openFile( OutData& out )
 } while( osl_File_E_EXIST == rc );
 
 if( osl_File_E_None == rc )
-out.Handler->downloadStarted(out.File, 
static_cast(fDownloadSize));
+out.Handler->downloadStarted(out.File, 
static_cast(nDownloadSize));
 }
 }
 
@@ -140,7 +140,7 @@ write_function( void *ptr, size_t size, size_t nmemb, void 
*stream )
 
 
 static int
-progress_callback( void *clientp, double dltotal, double dlnow, 
SAL_UNUSED_PARAMETER double, SAL_UNUSED_PARAMETER double )
+progress_callback( void *clientp, curl_off_t dltotal, curl_off_t dlnow, 
SAL_UNUSED_PARAMETER curl_off_t, SAL_UNUSED_PARAMETER curl_off_t)
 {
 OutData *out = static_cast < OutData * > (clientp);
 
@@ -148,7 +148,7 @@ progress_callback( void *clientp, double dltotal, double 
dlnow, SAL_UNUSED_PARAM
 
 if (out && !out->StopCondition.check())
 {
-double fPercent = 0;
+float fPercent = 0;
 if ( dltotal + out->Offset )
 fPercent = (dlnow + out->Offset) * 100 / (dltotal + out->Offset);
 if( fPercent < 0 )
@@ -233,7 +233,11 @@ static bool curl_run(std::u16string_view rURL, OutData& 
out, const OString& aPro
 // enable redirection
 (void)curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1);
 // only allow redirect to http:// and https://
-(void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, 
CURLPROTO_HTTP | CURLPROTO_HTTPS);
+#if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && 
LIBCURL_VERSION_MINOR >= 85)
+curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
+#else
+curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
+#endif
 
 // write function
 (void)curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, );
@@ -274,9 +278,9 @@ static bool curl_run(std::u16string_view rURL, OutData& 
out, const OString& aPro
 {
 // this sometimes happens, when a user throws away his user data, 
but has already
 // completed the download of an update.
-double fDownloadSize;
-curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, 
 );
-if ( -1 == fDownloadSize )
+curl_off_t nDownloadSize;
+curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, 
 );
+if ( -1 == nDownloadSize )
 {
 out.Handler->downloadFinished(out.File);
 ret = true;


[Libreoffice-commits] core.git: desktop/source include/vcl sw/inc sw/source

2023-01-09 Thread Miklos Vajna (via logerrit)
 desktop/source/lib/init.cxx   |2 +-
 include/vcl/ITiledRenderable.hxx  |2 +-
 sw/inc/unotxdoc.hxx   |4 ++--
 sw/source/uibase/uno/loktxdoc.cxx |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 913b399a73c4d6dfd2c9f5983f56f612f3262fa7
Author: Miklos Vajna 
AuthorDate: Mon Jan 9 15:30:26 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 10 07:06:30 2023 +

vcl ITiledRenderable: rename supportsCommandValues() to supportsCommand()

It gets a single command (to determine if using it with
getCommandValues() is OK or not), so the plural was confusing, as
mentioned at

.

Change-Id: Idf3c81aadeaeb3d42a50aba2ac58d5ed4278651f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145212
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 133531034c15..35070994d943 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5878,7 +5878,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* 
pThis, const char* pCo
 {
 return getFontSubset(aCommand.substr(aFontSubset.getLength()));
 }
-else if 
(pDoc->supportsCommandValues(INetURLObject(OUString::fromUtf8(aCommand)).GetURLPath()))
+else if 
(pDoc->supportsCommand(INetURLObject(OUString::fromUtf8(aCommand)).GetURLPath()))
 {
 tools::JsonWriter aJsonWriter;
 pDoc->getCommandValues(aJsonWriter, aCommand);
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 7d3f4b7aaf33..d110e33f7e19 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -370,7 +370,7 @@ public:
 virtual void setPaintTextEdit(bool) {}
 
 /// Decides if it's OK to call getCommandValues(rCommand).
-virtual bool supportsCommandValues(std::u16string_view /*rCommand*/) { 
return false; }
+virtual bool supportsCommand(std::u16string_view /*rCommand*/) { return 
false; }
 
 /// Returns a json mapping of the possible values for the given command.
 virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, 
std::string_view /*rCommand*/)
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index a7bbcb776f44..57cb3ccca589 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -462,8 +462,8 @@ public:
 /// @see vcl::ITiledRenderable::getCommandValues().
 void getCommandValues(tools::JsonWriter& rJsonWriter, std::string_view 
rCommand) override;
 
-/// @see vcl::ITiledRenderable::supportsCommandValues().
-bool supportsCommandValues(std::u16string_view rCommand) override;
+/// @see vcl::ITiledRenderable::supportsCommand().
+bool supportsCommand(std::u16string_view rCommand) override;
 
 voidInvalidate();
 voidReactivate(SwDocShell* pNewDocShell);
diff --git a/sw/source/uibase/uno/loktxdoc.cxx 
b/sw/source/uibase/uno/loktxdoc.cxx
index 9c92d071e27e..2291cf3f7ab5 100644
--- a/sw/source/uibase/uno/loktxdoc.cxx
+++ b/sw/source/uibase/uno/loktxdoc.cxx
@@ -322,7 +322,7 @@ void GetSections(tools::JsonWriter& rJsonWriter, 
SwDocShell* pDocShell,
 }
 }
 
-bool SwXTextDocument::supportsCommandValues(std::u16string_view rCommand)
+bool SwXTextDocument::supportsCommand(std::u16string_view rCommand)
 {
 static const std::initializer_list vForward
 = { u"TextFormFields", u"TextFormField", u"SetDocumentProperties",


[Libreoffice-commits] core.git: desktop/source extensions/source

2023-01-09 Thread Julien Nabet (via logerrit)
 desktop/source/app/updater.cxx  |2 +-
 extensions/source/update/check/download.cxx |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 6410fafc6f4d58062d82f86549303f4ae2eec32a
Author: Julien Nabet 
AuthorDate: Mon Jan 9 09:01:41 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Jan 9 10:40:19 2023 +

Fix deprecated Curl elements for update part

Change-Id: Ide008c8a80800b33c8104ec3d697e836fae73827
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145186
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index e0d5bcd832b5..9f60a64d7235 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -563,7 +563,7 @@ std::string download_content(const OString& rURL, bool 
bFile, OUString& rHash)
 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, headerlist);
 curl_easy_setopt(curl.get(), CURLOPT_FOLLOWLOCATION, 1); // follow 
redirects
 // only allow redirect to http:// and https://
-curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
+curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS_STR, CURLPROTO_HTTP | 
CURLPROTO_HTTPS);
 
 std::string response_body;
 utl::TempFileNamed aTempFile;
diff --git a/extensions/source/update/check/download.cxx 
b/extensions/source/update/check/download.cxx
index 387c1efd7a4f..3b76f9cc8a27 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -61,7 +61,7 @@ static void openFile( OutData& out )
 curl_easy_getinfo(out.curl, CURLINFO_EFFECTIVE_URL, _url);
 
 double fDownloadSize;
-curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, 
);
+curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, 
);
 
 OString aURL(effective_url);
 
@@ -233,7 +233,7 @@ static bool curl_run(std::u16string_view rURL, OutData& 
out, const OString& aPro
 // enable redirection
 (void)curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1);
 // only allow redirect to http:// and https://
-(void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP 
| CURLPROTO_HTTPS);
+(void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, 
CURLPROTO_HTTP | CURLPROTO_HTTPS);
 
 // write function
 (void)curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, );
@@ -241,7 +241,7 @@ static bool curl_run(std::u16string_view rURL, OutData& 
out, const OString& aPro
 
 // progress handler - Condition::check unfortunately is not defined 
const
 (void)curl_easy_setopt(pCURL, CURLOPT_NOPROGRESS, 0);
-(void)curl_easy_setopt(pCURL, CURLOPT_PROGRESSFUNCTION, 
_callback);
+(void)curl_easy_setopt(pCURL, CURLOPT_XFERINFOFUNCTION, 
_callback);
 (void)curl_easy_setopt(pCURL, CURLOPT_PROGRESSDATA, );
 
 // proxy
@@ -275,7 +275,7 @@ static bool curl_run(std::u16string_view rURL, OutData& 
out, const OString& aPro
 // this sometimes happens, when a user throws away his user data, 
but has already
 // completed the download of an update.
 double fDownloadSize;
-curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD, 
 );
+curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, 
 );
 if ( -1 == fDownloadSize )
 {
 out.Handler->downloadFinished(out.File);


[Libreoffice-commits] core.git: desktop/source

2023-01-08 Thread Julien Nabet (via logerrit)
 desktop/source/minidump/minidump.cxx |   34 +-
 1 file changed, 13 insertions(+), 21 deletions(-)

New commits:
commit 5c4fa7ddb0b12d30304bbc6119a0aa1d3d65b55d
Author: Julien Nabet 
AuthorDate: Sun Jan 8 14:08:53 2023 +0100
Commit: Julien Nabet 
CommitDate: Sun Jan 8 14:46:10 2023 +

Fix deprecated Curl elements for minidump part

Change-Id: I43df411eed24e86f5d72982b5d24188e0cb7e507
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145177
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/desktop/source/minidump/minidump.cxx 
b/desktop/source/minidump/minidump.cxx
index b6f52251206b..0bf20f2aa419 100644
--- a/desktop/source/minidump/minidump.cxx
+++ b/desktop/source/minidump/minidump.cxx
@@ -132,27 +132,21 @@ static bool uploadContent(std::map& parameters, std::s
 if (!ca_certificate_file.empty())
 curl_easy_setopt(curl, CURLOPT_CAINFO, ca_certificate_file.c_str());
 
-curl_httppost* formpost = nullptr;
-curl_httppost* lastptr = nullptr;
+curl_mime* mime = curl_mime_init(curl);
 std::string additional_data = generate_json(parameters);
-curl_formadd(, ,
-CURLFORM_COPYNAME, "AdditionalData",
-CURLFORM_COPYCONTENTS, additional_data.c_str(),
-CURLFORM_END);
+curl_mimepart* part = curl_mime_addpart(mime);
+curl_mime_name(part, "AdditionalData");
+curl_mime_data(part, additional_data.c_str(), CURL_ZERO_TERMINATED);
 
-curl_formadd(, ,
-CURLFORM_COPYNAME, "Version",
-CURLFORM_COPYCONTENTS, version.c_str(),
-CURLFORM_END);
+part = curl_mime_addpart(mime);
+curl_mime_name(part, "Version");
+curl_mime_data(part, version.c_str(), CURL_ZERO_TERMINATED);
 
-std::string response_body;
-long response_code;
-curl_formadd(, ,
-CURLFORM_COPYNAME, "upload_file_minidump",
-CURLFORM_FILE, file.c_str(),
-CURLFORM_END);
+part = curl_mime_addpart(mime);
+curl_mime_name(part, "upload_file_minidump");
+curl_mime_filedata(part, file.c_str());
 
-curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
+curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
 
 
 // Disable 100-continue header.
@@ -162,6 +156,7 @@ static bool uploadContent(std::map& parameters, std::s
 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
 
 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
+std::string response_body;
 curl_easy_setopt(curl, CURLOPT_WRITEDATA,
 static_cast(_body));
 
@@ -169,6 +164,7 @@ static bool uploadContent(std::map& parameters, std::s
 curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
 
 CURLcode cc = curl_easy_perform(curl);
+long response_code;
 curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, _code);
 SAL_WARN_IF(cc != CURLE_OK, "desktop",
 "Failed to send http request to " <<
@@ -176,10 +172,6 @@ static bool uploadContent(std::map& parameters, std::s
 ", error: " <<
 curl_easy_strerror(cc));
 
-if (formpost != nullptr)
-{
-curl_formfree(formpost);
-}
 if (headerlist != nullptr)
 {
 curl_slist_free_all(headerlist);


[Libreoffice-commits] core.git: desktop/source officecfg/registry sfx2/source sw/inc sw/Library_swui.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk vcl/inc vcl/jsdialog

2023-01-05 Thread offtkp (via logerrit)
 desktop/source/lib/init.cxx |1 
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |5 
 sfx2/source/control/unoctitm.cxx|1 
 sw/Library_swui.mk  |1 
 sw/UIConfig_swriter.mk  |1 
 sw/inc/cmdid.h  |1 
 sw/inc/strings.hrc  |1 
 sw/inc/swabstdlg.hxx|   11 
 sw/inc/swundo.hxx   |1 
 sw/qa/extras/accessibility/basics.cxx   |6 
 sw/sdi/_textsh.sdi  |7 
 sw/sdi/swriter.sdi  |   18 
 sw/source/core/undo/undobj.cxx  |3 
 sw/source/ui/dialog/swdlgfact.cxx   |   26 +
 sw/source/ui/dialog/swdlgfact.hxx   |   16 
 sw/source/ui/misc/pagenumberdlg.cxx |   92 
 sw/source/uibase/inc/pagenumberdlg.hxx  |   51 ++
 sw/source/uibase/shells/textfld.cxx |   81 +++
 sw/uiconfig/swriter/menubar/menubar.xml |2 
 sw/uiconfig/swriter/ui/pagenumberdlg.ui |  222 
++
 vcl/inc/jsdialog/jsdialogbuilder.hxx|2 
 vcl/jsdialog/enabled.cxx|1 
 vcl/jsdialog/jsdialogbuilder.cxx|   12 
 23 files changed, 558 insertions(+), 4 deletions(-)

New commits:
commit c010b5d2b2cdb22f48ef9d2b9d1fdc6125e1fec2
Author: offtkp 
AuthorDate: Wed Dec 21 14:29:59 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jan 6 07:42:32 2023 +

tdf#86630 sw: Add one-step page number insertion wizard

Add a one-step wizard for easy insertion of the page number to the
header/footer.

Change-Id: Idb33c92d594e04d9256460fe414e4b10e5166af5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144683
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8d191f7741da..133531034c15 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3336,6 +3336,7 @@ static void doc_iniUnoCommands ()
 OUString(".uno:InsertAuthoritiesEntry"),
 OUString(".uno:InsertMultiIndex"),
 OUString(".uno:InsertField"),
+OUString(".uno:PageNumberWizard"),
 OUString(".uno:InsertPageNumberField"),
 OUString(".uno:InsertPageCountField"),
 OUString(".uno:InsertDateField"),
diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 2e234e51ecb3..5f9ca119eeba 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -1011,6 +1011,11 @@
   1
 
   
+  
+
+  ~Page Number...
+
+  
   
 
   ~Page Number
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 76f4c9693dc0..20934ecf8f56 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1088,6 +1088,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, 
SfxViewFrame* pViewFra
  aEvent.FeatureURL.Path == "InsertAuthoritiesEntry" ||
  aEvent.FeatureURL.Path == "InsertMultiIndex" ||
  aEvent.FeatureURL.Path == "InsertField" ||
+ aEvent.FeatureURL.Path == "PageNumberWizard" ||
  aEvent.FeatureURL.Path == "InsertPageNumberField" ||
  aEvent.FeatureURL.Path == "InsertPageCountField" ||
  aEvent.FeatureURL.Path == "InsertDateField" ||
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index 7228dca1cd7e..81a21d003e19 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -143,6 +143,7 @@ $(eval $(call gb_Library_add_exception_objects,swui,\
 sw/source/ui/misc/bookmark \
 sw/source/ui/misc/contentcontroldlg \
 sw/source/ui/misc/contentcontrollistitemdlg \
+sw/source/ui/misc/pagenumberdlg \
 sw/source/ui/misc/docfnote \
 sw/source/ui/misc/glosbib \
 sw/source/ui/misc/glossary \
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index d6e935e65c5b..867baf40ba88 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -253,6 +253,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/notebookbar_online \
sw/uiconfig/swriter/ui/pagecolumncontrol \
   

[Libreoffice-commits] core.git: desktop/source include/vcl sw/inc sw/qa sw/source

2023-01-05 Thread Miklos Vajna (via logerrit)
 desktop/source/lib/init.cxx   |   44 ---
 include/vcl/ITiledRenderable.hxx  |3 +
 sw/inc/unotxdoc.hxx   |3 +
 sw/qa/uibase/uno/uno.cxx  |   38 
 sw/source/uibase/uno/loktxdoc.cxx |   71 +-
 5 files changed, 122 insertions(+), 37 deletions(-)

New commits:
commit bb20dee2ef1b0804065e1cda2c834d257fdd90ed
Author: Miklos Vajna 
AuthorDate: Thu Jan 5 08:13:21 2023 +0100
Commit: Miklos Vajna 
CommitDate: Thu Jan 5 08:33:16 2023 +

sw lok: expose field type & command of fieldmark under cursor

It was possible to get the properties of all fieldmarks, but you could
not get the properties of the fieldmark under the current cursor.

Getting the properties of the current fieldmark is useful for Zotero: if
we already have a citation and want to insert one more, then we should
turn the current citation into a citation cluster.

Fix the problem by adding API similar to what commit
24219cc1e9829f82a533667aef0f51b6a7df6fc2 (sw lok, .uno:TextFormFields:
expose field code of fieldmarks, 2022-11-25), did: but here we return
properties of the innermost fieldmark, not all fieldmarks.

Also introduce a ITiledRenderable::supportsCommandValues(), this way
next time a command value getter is added in sw/sc/sd, no need to touch
desktop/ anymore.

Change-Id: I7f1a7064307034a18527ab5e985d2eac56807cb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145062
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6cb0c9493516..8d191f7741da 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5714,12 +5714,13 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 static constexpr OStringLiteral 
aSheetGeometryData(".uno:SheetGeometryData");
 static constexpr OStringLiteral aCellCursor(".uno:CellCursor");
 static constexpr OStringLiteral aFontSubset(".uno:FontSubset=");
-static const std::initializer_list vForward = {
-u"TextFormFields",
-u"SetDocumentProperties",
-u"Bookmarks",
-u"Fields"
-};
+
+ITiledRenderable* pDoc = getTiledRenderable(pThis);
+if (!pDoc)
+{
+SetLastExceptionMsg("Document doesn't support tiled rendering");
+return nullptr;
+}
 
 if (!strcmp(pCommand, ".uno:LanguageStatus"))
 {
@@ -5763,13 +5764,6 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 }
 else if (o3tl::starts_with(aCommand, aViewRowColumnHeaders))
 {
-ITiledRenderable* pDoc = getTiledRenderable(pThis);
-if (!pDoc)
-{
-SetLastExceptionMsg("Document doesn't support tiled rendering");
-return nullptr;
-}
-
 tools::Rectangle aRectangle;
 if (aCommand.size() > 
o3tl::make_unsigned(aViewRowColumnHeaders.getLength()))
 {
@@ -5815,13 +5809,6 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 }
 else if (o3tl::starts_with(aCommand, aSheetGeometryData))
 {
-ITiledRenderable* pDoc = getTiledRenderable(pThis);
-if (!pDoc)
-{
-SetLastExceptionMsg("Document doesn't support tiled rendering");
-return nullptr;
-}
-
 bool bColumns = true;
 bool bRows = true;
 bool bSizes = true;
@@ -5881,12 +5868,6 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 }
 else if (o3tl::starts_with(aCommand, aCellCursor))
 {
-ITiledRenderable* pDoc = getTiledRenderable(pThis);
-if (!pDoc)
-{
-SetLastExceptionMsg("Document doesn't support tiled rendering");
-return nullptr;
-}
 // Ignore command's deprecated parameters.
 tools::JsonWriter aJsonWriter;
 pDoc->getCellCursor(aJsonWriter);
@@ -5896,17 +5877,8 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 {
 return getFontSubset(aCommand.substr(aFontSubset.getLength()));
 }
-else if (std::find(vForward.begin(), vForward.end(),
-   
INetURLObject(OUString::fromUtf8(aCommand)).GetURLPath())
- != vForward.end())
+else if 
(pDoc->supportsCommandValues(INetURLObject(OUString::fromUtf8(aCommand)).GetURLPath()))
 {
-ITiledRenderable* pDoc = getTiledRenderable(pThis);
-if (!pDoc)
-{
-SetLastExceptionMsg("Document doesn't support tiled rendering");
-return nullptr;
-}
-
 tools::JsonWriter aJsonWriter;
 pDoc->getCommandValues(aJsonWriter, aCommand);
 return aJsonWriter.extractData();
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 

[Libreoffice-commits] core.git: desktop/source sw/qa sw/source

2023-01-03 Thread Miklos Vajna (via logerrit)
 desktop/source/lib/init.cxx   |3 +-
 sw/qa/uibase/uno/uno.cxx  |   29 
 sw/source/uibase/uno/loktxdoc.cxx |   53 ++
 3 files changed, 84 insertions(+), 1 deletion(-)

New commits:
commit 3585d0414ffe08890856e5c09f453b9f566323df
Author: Miklos Vajna 
AuthorDate: Tue Jan 3 11:28:04 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 3 11:58:27 2023 +

sw, lok: implement a getCommandValues(Fields)

There was no LOK API to get a list of all fields of a given type where
the name matches a certain prefix.

This is useful in case the API cilent wants to know what previously
inserted refmarks were deleted by the user as part of deleting text
content.

Add a new getCommandValues(".uno:Fields") that returns the names of
matching refmarks. Do not return the refmark text, assuming that would
be updated by the API client anyway.

In practice this is needed by Zotero in case it wants to model its
citations with refmarks.

Change-Id: Ie469253891896aa8ab00d434c9ab116adbe3864b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144985
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f805f4a73322..6cb0c9493516 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5717,7 +5717,8 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* 
pThis, const char* pCo
 static const std::initializer_list vForward = {
 u"TextFormFields",
 u"SetDocumentProperties",
-u"Bookmarks"
+u"Bookmarks",
+u"Fields"
 };
 
 if (!strcmp(pCommand, ".uno:LanguageStatus"))
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index 64d2a70fe4e2..12f6124ec1f8 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -318,6 +318,35 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetBookmarks)
 CPPUNIT_ASSERT_EQUAL(static_cast(2), 
aTree.get_child("bookmarks").count(""));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetFields)
+{
+// Given a document with a refmark:
+createSwDoc();
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("TypeName", 
uno::Any(OUString("SetRef"))),
+comphelper::makePropertyValue(
+"Name", uno::Any(OUString("ZOTERO_ITEM CSL_CITATION {} 
RNDpyJknp173F"))),
+comphelper::makePropertyValue("Content", 
uno::Any(OUString("mycontent"))),
+};
+dispatchCommand(mxComponent, ".uno:InsertField", aArgs);
+
+// When getting the refmarks:
+tools::JsonWriter aJsonWriter;
+std::string_view 
aCommand(".uno:Fields?typeName=SetRef=ZOTERO_ITEM%20CSL_CITATION");
+auto pXTextDocument = dynamic_cast(mxComponent.get());
+pXTextDocument->getCommandValues(aJsonWriter, aCommand);
+
+// Then make sure we get the 1 refmark:
+std::unique_ptr 
pJSON(aJsonWriter.extractData());
+std::stringstream aStream(pJSON.get());
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+// Without the accompanying fix in place, this test would have failed with:
+// - No such node (setRefs)
+// i.e. the returned JSON was just empty.
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 
aTree.get_child("setRefs").count(""));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/uno/loktxdoc.cxx 
b/sw/source/uibase/uno/loktxdoc.cxx
index 5381fd5c1dfe..d82fc8388775 100644
--- a/sw/source/uibase/uno/loktxdoc.cxx
+++ b/sw/source/uibase/uno/loktxdoc.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -170,6 +171,53 @@ void GetBookmarks(tools::JsonWriter& rJsonWriter, 
SwDocShell* pDocShell,
 rJsonWriter.put("name", pMark->GetName());
 }
 }
+
+/// Implements getCommandValues(".uno:Fields").
+///
+/// Parameters:
+///
+/// - typeName: field type condition to not return all fields
+/// - namePrefix: field name prefix to not return all fields
+void GetFields(tools::JsonWriter& rJsonWriter, SwDocShell* pDocShell,
+   const std::map& rArguments)
+{
+OUString aTypeName;
+{
+auto it = rArguments.find("typeName");
+if (it != rArguments.end())
+{
+aTypeName = it->second;
+}
+}
+// See SwFieldTypeFromString().
+if (aTypeName != "SetRef")
+{
+return;
+}
+
+OUString aNamePrefix;
+{
+auto it = rArguments.find("namePrefix");
+if (it != rArguments.end())
+{
+aNamePrefix = it->second;
+}
+}
+
+SwDoc* pDoc = pDocShell->GetDoc();
+tools::ScopedJsonWriterArray aBookmarks = 
rJsonWriter.startArray("setRefs");
+for (sal_uInt16 i = 0; i < pDoc->GetRefMarks(); ++i)
+{
+const SwFormatRefMark* pRefMark = pDoc->GetRefMark(i);
+

[Libreoffice-commits] core.git: desktop/source i18nlangtag/source include/osl Repository.mk sal/emscripten sal/Library_lo-bootstrap.mk sal/Library_sal.mk sal/Module_sal.mk sal/rtl solenv/clang-format

2022-12-28 Thread Tor Lillqvist (via logerrit)
 Repository.mk  |6 +
 desktop/source/lib/init.cxx|8 ---
 i18nlangtag/source/languagetag/languagetag.cxx |6 -
 include/osl/detail/emscripten-bootstrap.h  |   26 +
 sal/Library_lo-bootstrap.mk|9 
 sal/Library_sal.mk |2 -
 sal/Module_sal.mk  |2 -
 sal/emscripten/lo-bootstrap.c  |   19 ++
 sal/rtl/bootstrap.cxx  |6 -
 solenv/clang-format/excludelist|2 +
 unotools/source/i18n/resmgr.cxx|   10 ++---
 11 files changed, 86 insertions(+), 10 deletions(-)

New commits:
commit de3b4b02008d708a66f8d6a8a365974eac7de3b3
Author: Tor Lillqvist 
AuthorDate: Wed Dec 28 13:47:26 2022 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Dec 28 13:08:56 2022 +

Introduce lo_get_app_data_dir() for Emscripten, too

And not just Android. Hardcoded to return "/instdir" to match what is
in the emscripten_fs_image.

Change-Id: I26d4ec5e02ec9900e35ca47f1565a13ad2b723b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144849
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/Repository.mk b/Repository.mk
index 56d8b2d28b84..d6db83c47873 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -335,6 +335,12 @@ $(eval $(call 
gb_Helper_register_libraries_for_install,OOOLIBS,ogltrans, \
OGLTrans \
 ))
 
+ifeq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
+   lo-bootstrap \
+))
+endif
+
 ifneq ($(ENABLE_WASM_STRIP_CANVAS),TRUE)
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
canvastools \
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index cdf6049d193d..f805f4a73322 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -29,6 +29,10 @@
 #include 
 #endif
 
+#ifdef EMSCRIPTEN
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -7106,10 +7110,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 }
 else
 {
-#ifdef ANDROID
+#if defined ANDROID || defined EMSCRIPTEN
 aAppPath = OUString::fromUtf8(lo_get_app_data_dir()) + "/program";
-#elif defined __EMSCRIPTEN__
-aAppPath = OUString::fromUtf8("instdir/program");
 #else
 // Fun conversion dance back and forth between URLs and system paths...
 OUString aAppURL;
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx 
b/i18nlangtag/source/languagetag/languagetag.cxx
index 92b9b5807e99..b54c2614e7f2 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -36,6 +36,10 @@
 #include 
 #endif
 
+#ifdef EMSCRIPTEN
+#include 
+#endif
+
 using namespace com::sun::star;
 
 namespace {
@@ -215,7 +219,7 @@ void LiblangtagDataRef::teardown()
 
 void LiblangtagDataRef::setupDataPath()
 {
-#if defined(ANDROID)
+#if defined(ANDROID) || defined(EMSCRIPTEN)
 maDataPath = OString(lo_get_app_data_dir()) + "/share/liblangtag";
 #else
 // maDataPath is assumed to be empty here.
diff --git a/include/osl/detail/emscripten-bootstrap.h 
b/include/osl/detail/emscripten-bootstrap.h
new file mode 100644
index ..580964253377
--- /dev/null
+++ b/include/osl/detail/emscripten-bootstrap.h
@@ -0,0 +1,26 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#if defined(EMSCRIPTEN)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char *lo_get_app_data_dir(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // EMSCRIPTEN
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/Library_lo-bootstrap.mk b/sal/Library_lo-bootstrap.mk
index 3dc4bf9dfeaa..1e727cdee427 100644
--- a/sal/Library_lo-bootstrap.mk
+++ b/sal/Library_lo-bootstrap.mk
@@ -10,6 +10,8 @@
 
 $(eval $(call gb_Library_Library,lo-bootstrap))
 
+ifeq (ANDROID,$(OS))
+
 # We explicitly *don't* want gb_STDLIBS to be linked here
 $(eval $(call gb_Library_disable_standard_system_libs,lo-bootstrap))
 
@@ -22,6 +24,13 @@ $(eval $(call gb_Library_add_cobjects,lo-bootstrap,\
sal/android/libreofficekit-jni \
sal/android/lo-bootstrap \
 ))
+endif
+
+ifeq (EMSCRIPTEN,$(OS))
+$(eval $(call gb_Library_add_cobjects,lo-bootstrap,\
+   sal/emscripten/lo-bootstrap \
+))
+endif
 
 $(eval $(call gb_Library_set_include,lo-bootstrap,\
$$(INCLUDE) \
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk
index aae7c97f0310..decfa39ce304 100644
--- a/sal/Library_sal.mk
+++ b/sal/Library_sal.mk
@@ 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2022-12-13 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx |   10 ++
 include/LibreOfficeKit/LibreOfficeKitInit.h |4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 1e421b30e2440f8a6e82ba4df1be3fb7c63e6996
Author: Tor Lillqvist 
AuthorDate: Mon Dec 12 17:59:30 2022 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Dec 13 08:19:40 2022 +

Attempt to add ifdefs for WASM (Emscripten) for LOKit-based code

Change-Id: I5b2556d1be61fa3a1d7996ce8d61958fbe7984c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144002
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c777bc7bb731..19937da00d6d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6768,7 +6768,7 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/,
LibreOfficeKitWakeCallback pWakeCallback,
void* pData)
 {
-#if defined(IOS) || defined(ANDROID)
+#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__)
 Application::GetSolarMutex().acquire();
 #endif
 
@@ -6779,7 +6779,7 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/,
 Application::UpdateMainThread();
 soffice_main();
 }
-#if defined(IOS) || defined(ANDROID)
+#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__)
 vcl::lok::unregisterPollCallbacks();
 Application::ReleaseSolarMutex();
 #endif
@@ -7100,6 +7100,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 {
 #ifdef ANDROID
 aAppPath = OUString::fromUtf8(lo_get_app_data_dir()) + "/program";
+#elif defined __EMSCRIPTEN__
+aAppPath = OUString::fromUtf8("instdir/program");
 #else
 // Fun conversion dance back and forth between URLs and system paths...
 OUString aAppURL;
@@ -7296,8 +7298,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 comphelper::ThreadPool::getSharedOptimalPool().shutdown();
 }
 
-// Turn off quick editing on IOS and ANDROID
-#if defined IOS || defined ANDROID
+// Turn off quick editing on iOS, Android and Emscripten
+#if defined IOS || defined ANDROID || defined __EMSCRIPTEN__
 if (officecfg::Office::Impress::Misc::TextObject::QuickEditing::get())
 {
 std::shared_ptr 
batch(comphelper::ConfigurationChanges::create());
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h 
b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 08feb42c1e18..506f373c5108 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -259,13 +259,13 @@ typedef int (LokHookPreInit)  ( const char 
*install_path, const char
 
 typedef int (LokHookPreInit2) ( const char *install_path, const 
char *user_profile_url, LibreOfficeKit** kit);
 
-#if defined(IOS) || defined(ANDROID)
+#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__)
 LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* 
user_profile_path);
 #endif
 
 static LibreOfficeKit *lok_init_2( const char *install_path,  const char 
*user_profile_url )
 {
-#if !defined(IOS) && !defined(ANDROID)
+#if !defined(IOS) && !defined(ANDROID) && !defined(__EMSCRIPTEN__)
 void *dlhandle;
 char *imp_lib;
 LokHookFunction *pSym;


[Libreoffice-commits] core.git: desktop/source sw/qa sw/source

2022-12-07 Thread Miklos Vajna (via logerrit)
 desktop/source/lib/init.cxx   |3 +-
 sw/qa/uibase/uno/uno.cxx  |   40 +
 sw/source/uibase/uno/loktxdoc.cxx |   41 --
 3 files changed, 81 insertions(+), 3 deletions(-)

New commits:
commit e0bf2712aa9e240748534e3a7498d41c8eeeb9d7
Author: Miklos Vajna 
AuthorDate: Wed Dec 7 09:35:15 2022 +0100
Commit: Miklos Vajna 
CommitDate: Wed Dec 7 12:30:52 2022 +

sw, lok: implement a getCommandValues(Bookmarks)

There was no LOK API to get a list of all bookmarks where the name
matches a certain prefix.

This is useful in case the API client wants to know what previously
inserted bookmarks were deleted by the user as part of deleting text
content.

Add a new getCommandValues(".uno:Bookmarks") that returns the names of
matching bookmarks. Do not return the bookmark text, assuming that would
be updated by the API client anyway.

In practice this is needed by Zotero in case it wants to model its
citations with bookmarks.

Change-Id: I42a544c3c64496519eec6826b58a310ec86dee74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143764
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 734f76f76362..c777bc7bb731 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5704,7 +5704,8 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* 
pThis, const char* pCo
 static constexpr OStringLiteral aFontSubset(".uno:FontSubset=");
 static const std::initializer_list vForward = {
 u"TextFormFields",
-u"SetDocumentProperties"
+u"SetDocumentProperties",
+u"Bookmarks"
 };
 
 if (!strcmp(pCommand, ".uno:LanguageStatus"))
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index 8e6b06453d86..e0806672e6af 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -236,6 +236,46 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, 
testGetDocumentProperties)
  aTree.get_child("userDefinedProperties").count(""));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetBookmarks)
+{
+// Given a document with 3 bookmarks: 2 zotero references and a zotero 
bibliography:
+createSwDoc();
+{
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("Bookmark", 
uno::Any(OUString("ZOTERO_BREF_1"))),
+};
+dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs);
+}
+{
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("Bookmark", 
uno::Any(OUString("ZOTERO_BREF_2"))),
+};
+dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs);
+}
+{
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("Bookmark", 
uno::Any(OUString("ZOTERO_BIBL"))),
+};
+dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs);
+}
+
+// When getting the reference bookmarks:
+tools::JsonWriter aJsonWriter;
+std::string_view aCommand(".uno:Bookmarks?namePrefix=ZOTERO_BREF_");
+auto pXTextDocument = dynamic_cast(mxComponent.get());
+pXTextDocument->getCommandValues(aJsonWriter, aCommand);
+
+// Then make sure we get the 2 references but not the bibliography:
+std::unique_ptr 
pJSON(aJsonWriter.extractData());
+std::stringstream aStream(pJSON.get());
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+// Without the accompanying fix in place, this test would have failed with:
+// - No such node (bookmarks)
+// i.e. the returned JSON was just empty.
+CPPUNIT_ASSERT_EQUAL(static_cast(2), 
aTree.get_child("bookmarks").count(""));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/uno/loktxdoc.cxx 
b/sw/source/uibase/uno/loktxdoc.cxx
index cf58f1ca4a7b..5381fd5c1dfe 100644
--- a/sw/source/uibase/uno/loktxdoc.cxx
+++ b/sw/source/uibase/uno/loktxdoc.cxx
@@ -99,7 +99,7 @@ void GetTextFormFields(tools::JsonWriter& rJsonWriter, 
SwDocShell* pDocShell,
 ///
 /// Parameters:
 ///
-/// - namePrefix: field name prefix not not return all user-defined properties
+/// - namePrefix: field name prefix to not return all user-defined properties
 void GetDocumentProperties(tools::JsonWriter& rJsonWriter, SwDocShell* 
pDocShell,
const std::map& rArguments)
 {
@@ -138,6 +138,38 @@ void GetDocumentProperties(tools::JsonWriter& rJsonWriter, 
SwDocShell* pDocShell
 rJsonWriter.put("value", aValue);
 }
 }
+
+/// Implements getCommandValues(".uno:Bookmarks").
+///
+/// Parameters:
+///
+/// - namePrefix: bookmark name prefix to not return all bookmarks
+void GetBookmarks(tools::JsonWriter& rJsonWriter, SwDocShell* pDocShell,
+  const std::map& rArguments)
+{
+OUString aNamePrefix;
+

[Libreoffice-commits] core.git: desktop/source sw/qa sw/source

2022-11-29 Thread Miklos Vajna (via logerrit)
 desktop/source/lib/init.cxx   |9 ++-
 sw/qa/uibase/uno/uno.cxx  |   37 ++
 sw/source/uibase/uno/unotxdoc.cxx |   94 --
 3 files changed, 114 insertions(+), 26 deletions(-)

New commits:
commit 5e8f6dcb8ce00d2d5e35b3cf5654187b3068276c
Author: Miklos Vajna 
AuthorDate: Tue Nov 29 16:18:16 2022 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 30 08:13:28 2022 +0100

sw lok, .uno:SetDocumentProperties: expose value of custom document 
properties

LOK API clients currently have no knowledge about document properties.

Clients like Zotero that want to store custom properties on documents
need a way to read and write such properties. This commit focuses on the
reading side.

Add a getter for .uno:SetDocumentProperties that allows filtering for a
certain prefix, this way the returned value can contain only the
relevant information.

Rework doc_getCommandValues() and SwXTextDocument::getCommandValues() a
bit, so adding new getters require less duplication.

Change-Id: I0c52cd2efcc8b1ea7307763c8252dd1e8ffdea2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143468
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 15371581c818..734f76f76362 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5702,7 +5702,10 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 static constexpr OStringLiteral 
aSheetGeometryData(".uno:SheetGeometryData");
 static constexpr OStringLiteral aCellCursor(".uno:CellCursor");
 static constexpr OStringLiteral aFontSubset(".uno:FontSubset=");
-static constexpr OStringLiteral aTextFormFields(".uno:TextFormFields");
+static const std::initializer_list vForward = {
+u"TextFormFields",
+u"SetDocumentProperties"
+};
 
 if (!strcmp(pCommand, ".uno:LanguageStatus"))
 {
@@ -5879,7 +5882,9 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* 
pThis, const char* pCo
 {
 return getFontSubset(aCommand.substr(aFontSubset.getLength()));
 }
-else if (o3tl::starts_with(aCommand, aTextFormFields))
+else if (std::find(vForward.begin(), vForward.end(),
+   
INetURLObject(OUString::fromUtf8(aCommand)).GetURLPath())
+ != vForward.end())
 {
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index 02d95df370c4..8e6b06453d86 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -195,12 +196,46 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, 
testGetTextFormFields)
 std::stringstream aStream(pJSON.get());
 boost::property_tree::ptree aTree;
 boost::property_tree::read_json(aStream, aTree);
-// Without the needed PixelToLogic() call in place, this test would have 
failed with:
+// Without the accompanying fix in place, this test would have failed with:
 // - No such node (fields)
 // i.e. the returned JSON was just empty.
 CPPUNIT_ASSERT_EQUAL(static_cast(2), 
aTree.get_child("fields").count(""));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetDocumentProperties)
+{
+// Given a document with 3 custom properties: 2 zotero ones and an other 
one:
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+SwDocShell* pDocShell = pDoc->GetDocShell();
+uno::Reference 
xDPS(pDocShell->GetModel(),
+   uno::UNO_QUERY);
+uno::Reference xDP = 
xDPS->getDocumentProperties();
+uno::Reference xUDP = 
xDP->getUserDefinedProperties();
+xUDP->addProperty("ZOTERO_PREF_1", beans::PropertyAttribute::REMOVABLE,
+  uno::Any(OUString("foo")));
+xUDP->addProperty("ZOTERO_PREF_2", beans::PropertyAttribute::REMOVABLE,
+  uno::Any(OUString("bar")));
+xUDP->addProperty("OTHER", beans::PropertyAttribute::REMOVABLE, 
uno::Any(OUString("baz")));
+
+// When getting the zotero properties:
+tools::JsonWriter aJsonWriter;
+std::string_view 
aCommand(".uno:SetDocumentProperties?namePrefix=ZOTERO_PREF_");
+auto pXTextDocument = dynamic_cast(mxComponent.get());
+pXTextDocument->getCommandValues(aJsonWriter, aCommand);
+
+// Then make sure we find the 2 properties and ignore the other one:
+std::unique_ptr 
pJSON(aJsonWriter.extractData());
+std::stringstream aStream(pJSON.get());
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+// Without the accompanying fix in place, this test would have failed with:
+// - No such node (userDefinedProperties)
+// i.e. the returned JSON was just empty.
+

[Libreoffice-commits] core.git: desktop/source include/vcl sw/inc sw/qa sw/source

2022-11-25 Thread Miklos Vajna (via logerrit)
 desktop/source/lib/init.cxx   |   14 +
 include/vcl/ITiledRenderable.hxx  |5 ++
 sw/inc/unotxdoc.hxx   |3 +
 sw/qa/uibase/uno/uno.cxx  |   50 
 sw/source/uibase/uno/unotxdoc.cxx |   95 ++
 5 files changed, 167 insertions(+)

New commits:
commit 24219cc1e9829f82a533667aef0f51b6a7df6fc2
Author: Miklos Vajna 
AuthorDate: Fri Nov 25 12:30:56 2022 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 25 16:16:39 2022 +0100

sw lok, .uno:TextFormFields: expose field code of fieldmarks

The fieldmarks in a document were kind of invisible for LOK clients
previously.

The Zotero use-case requires a way to fetch certain types of fieldmarks
from a document, to be able to update them and then write back those
updated versions to the document later.

Fix this by introducing a new .uno:TextFormFields, you can get its value
using the getCommandValues() LOK API. This allows filtering for a
certain field command prefix, which is generic, but e.g. in the Zotero
case allows getting the citations or the bibliography. The returned JSON
is an array of matching fieldmarks, containing their type and field
command. It seems there is no way to return the field result, till the
motivation is to just update that field result. (If there will be need,
the field result can be added.)

Do this in a way that next time we add a Writer-specific command (to be
able to return its values), there will be no need to touch
include/vcl/ITiledRenderable.hxx, causing a large rebuild.

Change-Id: I2ef1159bec4034bbdd6b4ba00715a69423106edd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143275
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 766248ef00ef..15371581c818 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5702,6 +5702,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* 
pThis, const char* pCo
 static constexpr OStringLiteral 
aSheetGeometryData(".uno:SheetGeometryData");
 static constexpr OStringLiteral aCellCursor(".uno:CellCursor");
 static constexpr OStringLiteral aFontSubset(".uno:FontSubset=");
+static constexpr OStringLiteral aTextFormFields(".uno:TextFormFields");
 
 if (!strcmp(pCommand, ".uno:LanguageStatus"))
 {
@@ -5878,6 +5879,19 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 {
 return getFontSubset(aCommand.substr(aFontSubset.getLength()));
 }
+else if (o3tl::starts_with(aCommand, aTextFormFields))
+{
+ITiledRenderable* pDoc = getTiledRenderable(pThis);
+if (!pDoc)
+{
+SetLastExceptionMsg("Document doesn't support tiled rendering");
+return nullptr;
+}
+
+tools::JsonWriter aJsonWriter;
+pDoc->getCommandValues(aJsonWriter, aCommand);
+return aJsonWriter.extractData();
+}
 else
 {
 SetLastExceptionMsg("Unknown command, no values returned");
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 3bf7bcdddacb..771ecf225c5a 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -368,6 +368,11 @@ public:
  *  Allow / disable drawing current text edit (used in Impress for slide 
previews)
  */
 virtual void setPaintTextEdit(bool) {}
+
+/// Returns a json mapping of the possible values for the given command.
+virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, 
std::string_view /*rCommand*/)
+{
+}
 };
 } // namespace vcl
 
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 90f605406d5b..150ea15af498 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -459,6 +459,9 @@ public:
 /// @see vcl::ITiledRenderable::executeContentControlEvent().
 void executeContentControlEvent(const StringMap& aArguments) override;
 
+/// @see vcl::ITiledRenderable::getCommandValues().
+void getCommandValues(tools::JsonWriter& rJsonWriter, std::string_view 
rCommand) override;
+
 voidInvalidate();
 voidReactivate(SwDocShell* pNewDocShell);
 SwXDocumentPropertyHelper * GetPropertyHelper ();
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index 62af105d24dc..02d95df370c4 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -9,12 +9,17 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -26,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /// Covers sw/source/uibase/uno/ fixes.
 class SwUibaseUnoTest : public SwModelTestBase
@@ -151,6 +157,50 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, 
testCreateTextRangeByPixelPositionGraphic)
   

[Libreoffice-commits] core.git: desktop/source

2022-11-19 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx |   18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

New commits:
commit bac26f91ae930902c336b1e5ceb08e1ae5de8d8a
Author: Szymon Kłos 
AuthorDate: Mon Nov 14 16:11:55 2022 +0100
Commit: Szymon Kłos 
CommitDate: Sat Nov 19 17:44:34 2022 +0100

lok: masterpage: disable callbacks on painting

We did that only for original view, but we need to disable
callbacks for used view - so when we switch mode or part it
will not send the notification to the client.

Bug fixed by this patch:
1. open impress in two LOK sessions
2. A enters MasterPage mode
3. B switched slide
4. A exits MasterPage mode

result: A was switched to the slide selected by B

Change-Id: I7dde8bb4c73862813d064319922aba4c4b727db9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142716
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Ashod Nakashian 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142966
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 41f05517082f..1163ef2a638f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3817,7 +3817,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 {
 // Text documents have a single coordinate system; don't change part.
 int nOrigPart = 0;
-const bool isText = (doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT);
+const int aType = doc_getDocumentType(pThis);
+const bool isText = (aType == LOK_DOCTYPE_TEXT);
 int nViewId = nOrigViewId;
 int nLastNonEditorView = nViewId;
 if (!isText)
@@ -3853,6 +3854,14 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 doc_setView(pThis, nLastNonEditorView);
 }
 
+// Disable callbacks while we are painting - after setting the view
+if (nViewId != nOrigViewId && nViewId >= 0)
+{
+const auto handlerIt = 
pDocument->mpCallbackFlushHandlers.find(nViewId);
+if (handlerIt != pDocument->mpCallbackFlushHandlers.end())
+handlerIt->second->disableCallbacks();
+}
+
 nOrigPart = doc_getPart(pThis);
 if (nPart != nOrigPart)
 {
@@ -3880,6 +3889,13 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 }
 if (!isText && nViewId != nOrigViewId)
 {
+if (nViewId >= 0)
+{
+const auto handlerIt = 
pDocument->mpCallbackFlushHandlers.find(nViewId);
+if (handlerIt != pDocument->mpCallbackFlushHandlers.end())
+handlerIt->second->enableCallbacks();
+}
+
 doc_setView(pThis, nOrigViewId);
 }
 }


[Libreoffice-commits] core.git: desktop/source

2022-11-05 Thread Stephan Bergmann (via logerrit)
 desktop/source/deployment/misc/lockfile.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit ccce14bcceea0978764f720e1de1b2a9f90fbcb4
Author: Stephan Bergmann 
AuthorDate: Sat Nov 5 15:56:09 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Nov 6 01:15:04 2022 +0100

-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): desktop

Change-Id: I438acf8e63a5d855bb19daee07af0f92b4b609a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142323
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/desktop/source/deployment/misc/lockfile.cxx 
b/desktop/source/deployment/misc/lockfile.cxx
index 206da8286d76..a46eedc62a3a 100644
--- a/desktop/source/deployment/misc/lockfile.cxx
+++ b/desktop/source/deployment/misc/lockfile.cxx
@@ -91,7 +91,9 @@ namespace desktop {
 time_t t = time(nullptr);
 for (int i = 0; i

[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source starmath/inc starmath/source

2022-11-05 Thread Mike Kaganski (via logerrit)
 desktop/source/lib/init.cxx|5 +
 include/sfx2/lokcomponenthelpers.hxx   |2 
 sfx2/source/view/lokstarmathhelper.cxx |   23 ++--
 starmath/inc/cursor.hxx|2 
 starmath/inc/view.hxx  |9 +--
 starmath/inc/visitors.hxx  |   60 +
 starmath/source/cursor.cxx |   14 -
 starmath/source/view.cxx   |   56 +++-
 starmath/source/visitors.cxx   |   91 -
 9 files changed, 205 insertions(+), 57 deletions(-)

New commits:
commit 14ed342dd3f4cae607f7785905787f73c7b1fde2
Author: Mike Kaganski 
AuthorDate: Wed Nov 2 11:03:08 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sat Nov 5 09:19:07 2022 +0100

lok: show Math cursor

Change-Id: I17a449f0a0662f0433de9cad1522a090434c1e30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142178
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 46dbe3e5d9c6..6414a3fe1ca9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2138,6 +2138,11 @@ void CallbackFlushHandler::enqueueUpdatedTypes()
 
 void CallbackFlushHandler::enqueueUpdatedType( int type, const SfxViewShell* 
viewShell, int viewId )
 {
+if (type == LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR)
+{
+if (const SfxViewShell* viewShell2 = 
LokStarMathHelper(viewShell).GetSmViewShell())
+viewShell = viewShell2;
+}
 std::optional payload = viewShell->getLOKPayload( type, viewId );
 if(!payload)
 return; // No actual payload to send.
diff --git a/include/sfx2/lokcomponenthelpers.hxx 
b/include/sfx2/lokcomponenthelpers.hxx
index b26cd0a13fb8..23bdcd44369e 100644
--- a/include/sfx2/lokcomponenthelpers.hxx
+++ b/include/sfx2/lokcomponenthelpers.hxx
@@ -72,6 +72,8 @@ public:
 
 vcl::Window* GetGraphicWindow();
 vcl::Window* GetWidgetWindow();
+const SfxViewShell* GetSmViewShell();
+tools::Rectangle GetBoundingBox() const;
 
 void Dispatch(const OUString& cmd, const 
css::uno::Sequence& rArguments) const;
 
diff --git a/sfx2/source/view/lokstarmathhelper.cxx 
b/sfx2/source/view/lokstarmathhelper.cxx
index fb30d9cee449..8ec65c45a274 100644
--- a/sfx2/source/view/lokstarmathhelper.cxx
+++ b/sfx2/source/view/lokstarmathhelper.cxx
@@ -122,14 +122,29 @@ vcl::Window* LokStarMathHelper::GetWidgetWindow()
 return mpWidgetWindow.get();
 }
 
+const SfxViewShell* LokStarMathHelper::GetSmViewShell()
+{
+if (vcl::Window* pGraphWindow = GetGraphicWindow())
+{
+return SfxViewShell::GetFirst(false, [pGraphWindow](const 
SfxViewShell* shell) {
+return shell->GetWindow() && 
shell->GetWindow()->IsChild(pGraphWindow);
+});
+}
+return nullptr;
+}
+
+tools::Rectangle LokStarMathHelper::GetBoundingBox() const
+{
+return mpIPClient ? mpIPClient->GetObjArea() : tools::Rectangle{};
+}
+
 bool LokStarMathHelper::postMouseEvent(int nType, int nX, int nY, int nCount, 
int nButtons,
int nModifier, double /*fScaleX*/, 
double /*fScaleY*/)
 {
-if (vcl::Window* pWindow = GetWidgetWindow())
+const tools::Rectangle rBBox = GetBoundingBox();
+if (Point aMousePos(nX, nY); rBBox.Contains(aMousePos))
 {
-Point aMousePos(nX, nY);
-tools::Rectangle rBBox = mpIPClient->GetObjArea();
-if (rBBox.Contains(aMousePos))
+if (vcl::Window* pWindow = GetWidgetWindow())
 {
 aMousePos -= rBBox.TopLeft();
 LokMouseEventData aMouseEventData(
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx
index 5886ffaf2eac..a1491c5decfe 100644
--- a/starmath/inc/cursor.hxx
+++ b/starmath/inc/cursor.hxx
@@ -186,6 +186,8 @@ public:
 /** Draw the caret */
 void Draw(OutputDevice& pDev, Point Offset, bool isCaretVisible);
 
+tools::Rectangle GetCaretRectangle(OutputDevice& rOutDev) const;
+
 bool IsAtTailOfBracket(SmBracketType eBracketType) const;
 
 private:
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 309c89513489..1905edb02741 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -136,10 +136,7 @@ public:
 }
 
 private:
-void SetIsCursorVisible(bool bVis)
-{
-bIsCursorVisible = bVis;
-}
+void SetIsCursorVisible(bool bVis);
 void SetCursor(const SmNode *pNode);
 void SetCursor(const tools::Rectangle );
 
@@ -295,7 +292,7 @@ public:
 SmViewShell(SfxViewFrame *pFrame, SfxViewShell *pOldSh);
 virtual ~SmViewShell() override;
 
-SmDocShell * GetDoc()
+SmDocShell * GetDoc() const
 {
 return static_cast( GetViewFrame()->GetObjectShell() );
 }
@@ -325,6 +322,8 @@ public:
 SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+SfxInterfaceId(2))
 SFX_DECL_VIEWFACTORY(SmViewShell);
 
+void SendCaretToLOK() const;
+
 private:
 /// SfxInterface 

[Libreoffice-commits] core.git: desktop/source framework/source include/unotools

2022-10-31 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx  |3 ++-
 framework/source/loadenv/loadenv.cxx |8 
 include/unotools/mediadescriptor.hxx |1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit f43a5ec28d36422c105da3d640bf94ad9c8a2ba6
Author: Henry Castro 
AuthorDate: Thu Oct 27 18:11:08 2022 -0400
Commit: Gökay ŞATIR 
CommitDate: Mon Oct 31 13:29:39 2022 +0100

lok: fix convert-to batch mode, quiet interaction

If it is a batch mode to convert *.csv to *.ods,
use the quiet interaction to avoid unwanted filter dialogs.

Signed-off-by: Henry Castro 
Change-Id: I4ef82c1079888ae099084072c146b5db4cc0f2a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141950
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b0ebc21138eb..46dbe3e5d9c6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2596,7 +2596,8 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 comphelper::makePropertyValue("FilterOptions", sFilterOptions),
 comphelper::makePropertyValue("InteractionHandler", xInteraction),
 comphelper::makePropertyValue("MacroExecutionMode", 
nMacroExecMode),
-comphelper::makePropertyValue("AsTemplate", false)
+comphelper::makePropertyValue("AsTemplate", false),
+comphelper::makePropertyValue("Silent", !aBatch.isEmpty())
 };
 
 /* TODO
diff --git a/framework/source/loadenv/loadenv.cxx 
b/framework/source/loadenv/loadenv.cxx
index b3f351a22cae..89feaa25d0ab 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -295,6 +295,14 @@ void LoadEnv::startLoading(const OUString& sURL, const 
uno::Sequence pQuietInteraction = new 
QuietInteraction();
+uno::Reference 
xInteractionHandler(pQuietInteraction);
+m_lMediaDescriptor[utl::MediaDescriptor::PROP_INTERACTIONHANDLER] <<= 
xInteractionHandler;
+}
+
 initializeUIDefaults(m_xContext, m_lMediaDescriptor, bUIMode, 
_pQuietInteraction);
 
 start();
diff --git a/include/unotools/mediadescriptor.hxx 
b/include/unotools/mediadescriptor.hxx
index 92728fa51972..8b4f9365acf9 100644
--- a/include/unotools/mediadescriptor.hxx
+++ b/include/unotools/mediadescriptor.hxx
@@ -86,6 +86,7 @@ class UNOTOOLS_DLLPUBLIC MediaDescriptor : public 
comphelper::SequenceAsHashMap
 static constexpr OUStringLiteral PROP_REFERRER = u"Referer";
 static constexpr OUStringLiteral PROP_REPLACEABLE = u"Replaceable";
 static constexpr OUStringLiteral PROP_SALVAGEDFILE = u"SalvagedFile";
+static constexpr OUStringLiteral PROP_SILENT = u"Silent";
 static constexpr OUStringLiteral PROP_STATUSINDICATOR = 
u"StatusIndicator";
 static constexpr OUStringLiteral PROP_STREAM = u"Stream";
 static constexpr OUStringLiteral PROP_STREAMFOROUTPUT = 
u"StreamForOutput";


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sfx2 include/svx libreofficekit/source sfx2/source svx/source

2022-10-26 Thread Ashod Nakashian (via logerrit)
 desktop/source/lib/init.cxx  |1 +
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   19 +++
 include/sfx2/lokhelper.hxx   |4 
 include/svx/svdomedia.hxx|3 +++
 libreofficekit/source/gtk/lokdocview.cxx |1 +
 sfx2/source/view/lokhelper.cxx   |9 +
 svx/source/svdraw/svdmrkv.cxx|9 +
 svx/source/svdraw/svdomedia.cxx  |   25 +
 svx/source/svdraw/svdxcgv.cxx|   13 +
 9 files changed, 84 insertions(+)

New commits:
commit 038c4a42834014b421a2e8a99ae436eb2dc8f8c5
Author: Ashod Nakashian 
AuthorDate: Sun May 15 10:05:54 2022 -0400
Commit: Miklos Vajna 
CommitDate: Wed Oct 26 08:18:55 2022 +0200

lok: support embedded media

Change-Id: Ie8f3ed188cec0050a10a5d49325756931b902ef1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141807
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ee6802ebb24e..b0ebc21138eb 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1545,6 +1545,7 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 type != LOK_CALLBACK_TEXT_SELECTION &&
 type != LOK_CALLBACK_TEXT_SELECTION_START &&
 type != LOK_CALLBACK_TEXT_SELECTION_END &&
+type != LOK_CALLBACK_MEDIA_SHAPE &&
 type != LOK_CALLBACK_REFERENCE_MARKS)
 {
 SAL_INFO("lok", "Skipping while painting [" << type << "]: [" << 
aCallbackData.getPayload() << "].");
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 3bc0ad940b18..1e9821204c0b 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -882,6 +882,23 @@ typedef enum
  *
  */
 LOK_CALLBACK_FONTS_MISSING = 57,
+
+/**
+ * Insertion, removal, movement, and selection of a media shape.
+ * The payload is a json with the relevant details.
+ *
+ *  {
+ *  "action": "insert",
+ *  "id": 123456,
+ *  "url": "file:// ..."
+ *  "x": ...,
+ *  "y": ...,
+ *  }
+ *
+ *  where the "svg" property is a string containing an svg document
+ *  which is a representation of the pie segment.
+ */
+LOK_CALLBACK_MEDIA_SHAPE = 58,
 }
 LibreOfficeKitCallbackType;
 
@@ -1026,6 +1043,8 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_PRINT_RANGES";
 case LOK_CALLBACK_FONTS_MISSING:
 return "LOK_CALLBACK_FONTS_MISSING";
+case LOK_CALLBACK_MEDIA_SHAPE:
+return "LOK_CALLBACK_MEDIA_SHAPE";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 1c5a94966776..eaa7abe9785c 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -157,6 +157,10 @@ public:
 /// Helper for diagnosing run-time problems
 static void dumpState(rtl::OStringBuffer );
 
+/// Notify all views of a media update.
+/// This could be a new insertion or property modifications to an existing 
one.
+static void notifyMediaUpdate(boost::property_tree::ptree& json);
+
 private:
 static int createView(SfxViewFrame* pViewFrame, ViewShellDocId docId);
 };
diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx
index 020f4d56c947..6199fcaffe5b 100644
--- a/include/svx/svdomedia.hxx
+++ b/include/svx/svdomedia.hxx
@@ -72,6 +72,9 @@ public:
 
 virtual bool shouldKeepAspectRatio() const override { return true; }
 
+/// When Lokit is enabled, notify the media details.
+void notifyPropertiesForLOKit();
+
 private:
 voidmediaPropertiesChanged( const 
::avmedia::MediaItem& rNewState );
 virtual std::unique_ptr 
CreateObjectSpecificViewContact() override;
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index fba48d9293ef..ce4bd1890619 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1485,6 +1485,7 @@ callback (gpointer pData)
 case LOK_CALLBACK_SC_FOLLOW_JUMP:
 case LOK_CALLBACK_PRINT_RANGES:
 case LOK_CALLBACK_FONTS_MISSING:
+case LOK_CALLBACK_MEDIA_SHAPE:
 {
 // TODO: Implement me
 break;
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index e0cdb25505ec..b168538fe0c8 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -892,4 +892,13 @@ void SfxLokHelper::dumpState(rtl::OStringBuffer )
 }
 }
 
+void SfxLokHelper::notifyMediaUpdate(boost::property_tree::ptree& json)
+{
+std::stringstream aStream;
+

[Libreoffice-commits] core.git: desktop/source

2022-10-24 Thread Mike Kaganski (via logerrit)
 desktop/source/lib/init.cxx |   35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

New commits:
commit ebb3a72ba0c4f070c9c254c439147beea8b2d93d
Author: Mike Kaganski 
AuthorDate: Mon Oct 24 09:01:32 2022 +0200
Commit: Mike Kaganski 
CommitDate: Mon Oct 24 14:08:42 2022 +0200

Paint tiles on Windows

A step toward enabling gtktiledviewer on Windows
Not the nicest solution, but it does the job initially.

Change-Id: I9144c2b899eb122e918123a70279cd50a4a02df1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141710
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 388ca174c23b..ee6802ebb24e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -137,6 +137,9 @@
 #include 
 #include 
 #include 
+#ifdef _WIN32
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -3618,7 +3621,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 return;
 }
 
-#if defined(UNX) && !defined(MACOSX)
+#if defined(UNX) && !defined(MACOSX) || defined(_WIN32)
 
 // Painting of zoomed or HiDPI spreadsheets is special, we actually draw 
everything at 100%,
 // and only set cairo's (or CoreGraphic's, in the iOS case) scale factor 
accordingly, so that
@@ -3655,6 +3658,36 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 pDevice->DrawRect(aRect);
 pDevice->Pop();
 }
+
+#ifdef _WIN32
+// pBuffer was not used there
+tools::Rectangle r(pDevice->PixelToLogic({ Point(0, 0), Size(nCanvasWidth 
+ 1, nCanvasHeight + 1) }));
+BitmapEx aBmpEx = pDevice->GetBitmapEx(r.TopLeft(), r.GetSize());
+Bitmap aBmp = aBmpEx.GetBitmap();
+Bitmap aAlpha = aBmpEx.GetAlpha();
+Bitmap::ScopedReadAccess sraBmp(aBmp);
+Bitmap::ScopedReadAccess sraAlpha(aAlpha);
+
+assert(sraBmp->Height() == nCanvasHeight);
+assert(sraBmp->Width() == nCanvasWidth);
+assert(!sraAlpha || sraBmp->Height() == sraAlpha->Height());
+assert(!sraAlpha || sraBmp->Width() == sraAlpha->Width());
+auto p = pBuffer;
+for (tools::Long y = 0; y < sraBmp->Height(); ++y)
+{
+Scanline dataBmp = sraBmp->GetScanline(y);
+Scanline dataAlpha = sraAlpha ? sraAlpha->GetScanline(y) : nullptr;
+for (tools::Long x = 0; x < sraBmp->Width(); ++x)
+{
+BitmapColor color = sraBmp->GetPixelFromData(dataBmp, x);
+sal_uInt8 alpha = dataAlpha ? 
sraAlpha->GetPixelFromData(dataAlpha, x).GetBlue() : 255;
+*p++ = color.GetBlue();
+*p++ = color.GetGreen();
+*p++ = color.GetRed();
+*p++ = alpha;
+}
+}
+#endif
 #endif
 
 #else


[Libreoffice-commits] core.git: desktop/source include/vcl vcl/source vcl/workben

2022-10-11 Thread Mike Kaganski (via logerrit)
 desktop/source/splash/splash.cxx |   20 +---
 include/vcl/svapp.hxx|2 +-
 vcl/source/app/brand.cxx |4 ++--
 vcl/workben/vcldemo.cxx  |2 +-
 4 files changed, 9 insertions(+), 19 deletions(-)

New commits:
commit 6c65c62c26a8aa4d04466545f8f04ec86b797012
Author: Mike Kaganski 
AuthorDate: Tue Oct 11 09:17:38 2022 +0300
Commit: Mike Kaganski 
CommitDate: Tue Oct 11 12:45:09 2022 +0200

Don't convert OUString to char* to get OUString in the end

Which by the way fixes the mismatch between converting _sAppName to
OString as UTF-8 in SplashScreen::SetScreenBitmap, and converting
pName to OUString as ASCII in Application::LoadBrandBitmap.

Change-Id: I2082f92693ca9633b64411dd668befaa30e978d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141202
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index c3b106cb3b44..1f5461ecaf21 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -472,25 +472,15 @@ void SplashScreen::SetScreenBitmap(BitmapEx )
 }
 
 // create file name from screen resolution information
-OStringBuffer aStrBuf( 128 );
-aStrBuf.append( "intro_" );
+OUString aResBuf = "_" + OUString::number(nWidth) + "x" + 
OUString::number(nHeight);
 if ( !_sAppName.isEmpty() )
-{
-aStrBuf.append( OUStringToOString(_sAppName, RTL_TEXTENCODING_UTF8) );
-aStrBuf.append( "_" );
-}
-OString aResBuf = OString::number( nWidth ) + "x" + OString::number( 
nHeight );
-
-aStrBuf.append( aResBuf.getStr() );
-if (Application::LoadBrandBitmap (aStrBuf.makeStringAndClear().getStr(), 
rBitmap))
-return;
+if (Application::LoadBrandBitmap(OUStringConcatenation("intro_" + 
_sAppName + aResBuf), rBitmap))
+return;
 
-aStrBuf.append( "intro_" );
-aStrBuf.append( aResBuf.getStr() );
-if (Application::LoadBrandBitmap (aStrBuf.getStr(), rBitmap))
+if (Application::LoadBrandBitmap(OUStringConcatenation("intro" + aResBuf), 
rBitmap))
 return;
 
-(void)Application::LoadBrandBitmap ("intro", rBitmap);
+(void)Application::LoadBrandBitmap (u"intro", rBitmap);
 }
 
 void SplashScreen::determineProgressRatioValues(
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 93dd4873009b..5400157ffa57 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -926,7 +926,7 @@ public:
 
  @returns true if the PNG could be loaded, otherwise returns false.
 */
-static bool LoadBrandBitmap (const char* pName, BitmapEx 
);
+static bool LoadBrandBitmap (std::u16string_view pName, 
BitmapEx );
 
 ///@}
 
diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx
index 57db30d458e4..15615c35410b 100644
--- a/vcl/source/app/brand.cxx
+++ b/vcl/source/app/brand.cxx
@@ -52,13 +52,13 @@ namespace {
 }
 }
 
-bool Application::LoadBrandBitmap (const char* pName, BitmapEx )
+bool Application::LoadBrandBitmap (std::u16string_view pName, BitmapEx 
)
 {
 // TODO - if we want more flexibility we could add a branding path
 // in an rc file perhaps fallback to "about.bmp"
 OUString aBaseDir( "$BRAND_BASE_DIR");
 rtl::Bootstrap::expandMacros( aBaseDir );
-OUString aBaseName( "/" + OUString::createFromAscii( pName ) );
+OUString aBaseName(OUStringChar('/') + pName);
 OUString aPng( ".png" );
 
 rtl_Locale *pLoc = nullptr;
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index f37a99666143..e6ef740dd6aa 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -141,7 +141,7 @@ public:
, mnBounceY(1)
 #endif
 {
-if (!Application::LoadBrandBitmap("intro", maIntro))
+if (!Application::LoadBrandBitmap(u"intro", maIntro))
 Application::Abort("Failed to load intro image");
 
 maIntroBW = maIntro.GetBitmap();


[Libreoffice-commits] core.git: desktop/source

2022-10-10 Thread Caolán McNamara (via logerrit)
 desktop/source/splash/splash.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d58dcdae6f6f2367a6713ba7a109923a9c239b12
Author: Caolán McNamara 
AuthorDate: Mon Oct 10 12:49:04 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Oct 10 20:43:44 2022 +0200

attempting to load "1920x1080" not "intro_1920x1080"

since...

commit ff953c36ac8f335d6f12d9e22a29deafe90de34d
Date:   Mon Oct 11 11:50:10 2010 +0100

clean cut/paste brand location code

Change-Id: I727a3698d70c3516dbdfa337e3ebf418a65f965b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141156
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index fb6b0bfcb804..c3b106cb3b44 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -487,7 +487,7 @@ void SplashScreen::SetScreenBitmap(BitmapEx )
 
 aStrBuf.append( "intro_" );
 aStrBuf.append( aResBuf.getStr() );
-if (Application::LoadBrandBitmap (aResBuf.getStr(), rBitmap))
+if (Application::LoadBrandBitmap (aStrBuf.getStr(), rBitmap))
 return;
 
 (void)Application::LoadBrandBitmap ("intro", rBitmap);


[Libreoffice-commits] core.git: desktop/source

2022-09-22 Thread Ashod Nakashian (via logerrit)
 desktop/source/lib/init.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit ddc5a7bb10c6229018dbdb3192740b6d893fa08b
Author: Ashod Nakashian 
AuthorDate: Sun Jul 24 08:46:38 2022 -0400
Commit: Miklos Vajna 
CommitDate: Thu Sep 22 08:30:12 2022 +0200

lok: initialize the load-language

We need to use the load-language for
saving the document. This is to avoid
using the language of the view that is
issuing the save, which causes all sorts
of issues (language-translation related).
This logic was implemented in 4b7b449bbdc5
but for some reason the load-language
wasn't set.

This patch sets the load-language.

Signed-off-by: Ashod Nakashian 
Change-Id: I0cd1574d48a99e6ee84bacf75fc0d9ebe26e526b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137391
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit a0b2739b2354b622538304c0846606247bcf09c0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140362
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 5e562862da53..7d9c4cfc3643 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2513,6 +2513,14 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 
 if (!aLanguage.isEmpty() && isValidLangTag)
 {
+static bool isLoading = true;
+if (isLoading)
+{
+// Capture the language used to load the document.
+SfxLokHelper::setLoadLanguage(aLanguage);
+isLoading = false;
+}
+
 SfxLokHelper::setDefaultLanguage(aLanguage);
 // Set the LOK language tag, used for dialog tunneling.
 comphelper::LibreOfficeKit::setLanguageTag(LanguageTag(aLanguage));


[Libreoffice-commits] core.git: desktop/source

2022-09-20 Thread Mike Kaganski (via logerrit)
 desktop/source/app/officeipcthread.cxx |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 321a1b5034e36e156755bbd5794c33c73608e5a5
Author: Mike Kaganski 
AuthorDate: Tue Sep 20 11:19:16 2022 +0300
Commit: Mike Kaganski 
CommitDate: Tue Sep 20 13:59:14 2022 +0200

Only try to convert outdir to system path when it's not empty

Avoids a warning on startup of a debug build:

  > instdir/program/soffice
  warn:legacy.osl:1528:2140:sal/osl/w32/file_url.cxx:849: 
osl_getAbsoluteFileURL
  called with empty base URL and/or invalid relative URL

Change-Id: Ic456f08011d099a95894259f31800f12318af223
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140230
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/desktop/source/app/officeipcthread.cxx 
b/desktop/source/app/officeipcthread.cxx
index ea330ea3d415..45b8906c3b42 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -1249,7 +1249,6 @@ static void AddConversionsToDispatchList(
 nType = DispatchWatcher::REQUEST_CAT;
 else
 nType = DispatchWatcher::REQUEST_CONVERSION;
-aParam = rParam;
 }
 else
 {
@@ -1262,8 +1261,6 @@ static void AddConversionsToDispatchList(
 }
 }
 
-OUString aOutDir( rParamOut.trim() );
-std::u16string_view aImgOut = o3tl::trim(rImgOut);
 OUString aPWD;
 if (cwdUrl)
 {
@@ -1274,11 +1271,10 @@ static void AddConversionsToDispatchList(
 utl::Bootstrap::getProcessWorkingDir( aPWD );
 }
 
-if( !::osl::FileBase::getAbsoluteFileURL( aPWD, rParamOut, aOutDir ) )
-::osl::FileBase::getSystemPathFromFileURL( aOutDir, aOutDir );
-
-if( !rParamOut.trim().isEmpty() )
+if (OUString aOutDir(rParamOut.trim()); !aOutDir.isEmpty())
 {
+if (osl::FileBase::getAbsoluteFileURL(aPWD, rParamOut, aOutDir) == 
osl::FileBase::E_None)
+osl::FileBase::getSystemPathFromFileURL(aOutDir, aOutDir);
 aParam += ";" + aOutDir;
 }
 else
@@ -1288,7 +1284,7 @@ static void AddConversionsToDispatchList(
 }
 
 if( !rImgOut.empty() )
-aParam += OUString::Concat("|") + aImgOut;
+aParam += OUString::Concat("|") + o3tl::trim(rImgOut);
 
 for (auto const& request : rRequestList)
 {


[Libreoffice-commits] core.git: desktop/source

2022-09-19 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b20a64ce05ebf3720dd2d10ccd384020803c2ff2
Author: Tor Lillqvist 
AuthorDate: Fri Sep 16 11:26:07 2022 +0300
Commit: Tor Lillqvist 
CommitDate: Mon Sep 19 10:44:36 2022 +0200

Ignore also when a font has been substituted by itself with an empty style

Change-Id: I40fbce716a11b010323ac07e0dacdc114f7d2320
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140135
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6b932f8c7b53..5e562862da53 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2642,7 +2642,8 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 
 if (x.mOriginalFont.indexOf('/') == -1)
 for (const auto  : x.mUsedFonts)
-if 
(j.startsWith(OUStringConcatenation(x.mOriginalFont + "/")))
+if (j == x.mOriginalFont ||
+
j.startsWith(OUStringConcatenation(x.mOriginalFont + "/")))
 return true;
 
 return false;


[Libreoffice-commits] core.git: desktop/source

2022-09-15 Thread Julien Nabet (via logerrit)
 desktop/source/migration/migration.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit c4fb915213875fda248593743421d8c43533e375
Author: Julien Nabet 
AuthorDate: Thu Sep 15 18:26:16 2022 +0200
Commit: Julien Nabet 
CommitDate: Thu Sep 15 20:28:17 2022 +0200

[loplugin:fakebool] in desktop

/home/julien/lo/libreoffice/desktop/source/migration/migration.cxx:628:5: 
error: VarDecl, use "bool" instead of '::sal_Bool' (aka 'unsigned char') 
[loplugin:fakebool]
auto const hasCurrent = set->hasByName(currentName);
^~~
/home/julien/lo/libreoffice/desktop/source/migration/migration.cxx:629:5: 
error: VarDecl, use "bool" instead of '::sal_Bool' (aka 'unsigned char') 
[loplugin:fakebool]
auto const hasMigrated = set->hasByName(migratedName);
^
/home/julien/lo/libreoffice/desktop/source/migration/migration.cxx:647:5: 
error: VarDecl, use "bool" instead of '::sal_Bool' (aka 'unsigned char') 
[loplugin:fakebool]
auto const hasMigrated = set->hasByName(migratedName);
^

since 7f04bb393f830a2983e3e26485bbe217c66006ff
Clean up color scheme migration

Change-Id: I2a06b73cecc4812d2876689f22ba89eba12b308f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140024
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/desktop/source/migration/migration.cxx 
b/desktop/source/migration/migration.cxx
index 162941bfd0ea..4ae3482a55c9 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -625,8 +625,8 @@ void renameMigratedSetElementTo(
 // To avoid unexpected data loss, the code is careful to only rename from 
currentName to
 // migratedName in the expected case where the currentName element exists 
and the migratedName
 // element doesn't exist:
-auto const hasCurrent = set->hasByName(currentName);
-auto const hasMigrated = set->hasByName(migratedName);
+bool const hasCurrent = set->hasByName(currentName);
+bool const hasMigrated = set->hasByName(migratedName);
 if (hasCurrent && !hasMigrated) {
 auto const elem = set->getByName(currentName);
 set->removeByName(currentName);
@@ -644,7 +644,7 @@ void renameMigratedSetElementBack(
 // To avoid unexpected data loss, the code is careful to ensure that in 
the end a currentName
 // element exists, creating it from a template if the migratedName element 
had unexpectedly gone
 // missing:
-auto const hasMigrated = set->hasByName(migratedName);
+bool const hasMigrated = set->hasByName(migratedName);
 css::uno::Any elem;
 if (hasMigrated) {
 elem = set->getByName(migratedName);


[Libreoffice-commits] core.git: desktop/source

2022-09-14 Thread Caolán McNamara (via logerrit)
 desktop/source/app/officeipcthread.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b8914154f5f24c429633d6ec1c5762e50ebe80d2
Author: Caolán McNamara 
AuthorDate: Tue Sep 13 20:45:50 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Sep 14 16:30:38 2022 +0200

close "OSL_PIPE" pipe on SIGTERM

so we don't accumulate ever growing number of stray OSL_PIPE_* in /tmp
in crashtesting where timed out instances are killed off with SIGTERM

and negate the need for hackery such as
https://stackoverflow.com/questions/42515894/open-xchange-java-issues
of:

ox_kill_readerengine_instances() {
...
rm -f /tmp/OSL_PIPE_*
}

Change-Id: Id5909cba6afc57498adb4ff0677d8a411330e221
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139881
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/app/officeipcthread.cxx 
b/desktop/source/app/officeipcthread.cxx
index 6e3e97b06d19..ea330ea3d415 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -303,7 +303,7 @@ static void ImplPostProcessDocumentsEvent( 
std::unique_ptrSignal == osl_Signal_Terminate )
-RequestHandler::SetDowning();
+RequestHandler::Disable();
 return osl_Signal_ActCallNextHdl;
 }
 


[Libreoffice-commits] core.git: desktop/source

2022-09-13 Thread Andrea Gelmini (via logerrit)
 desktop/source/migration/migration.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0484d071bf9b7cf87521dbd57ad93fbea009ebf2
Author: Andrea Gelmini 
AuthorDate: Tue Sep 13 20:00:01 2022 +0200
Commit: Julien Nabet 
CommitDate: Wed Sep 14 06:46:14 2022 +0200

Fix typo

Change-Id: Ibdcc95a3275b4af1b278a5d069c19f47e3e2c8d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139874
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/desktop/source/migration/migration.cxx 
b/desktop/source/migration/migration.cxx
index 0f8099278c0c..c8f00d03 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -640,7 +640,7 @@ void MigrationImpl::copyConfig()
 bool bRegistryModificationsXcuExists = false;
 OUString regFilePath = m_aInfo.userdata + 
"/user/registrymodifications.xcu";
 OUString sMigratedProductName = m_aInfo.productname;
-// remove version number from the end of pruduct name if exist
+// remove version number from the end of product name if there’s one
 if (isdigit(sMigratedProductName[sMigratedProductName.getLength() - 1]))
 sMigratedProductName = (sMigratedProductName.copy(0, 
m_aInfo.productname.getLength() - 1)).trim();
 File regFile(regFilePath);


[Libreoffice-commits] core.git: desktop/source

2022-09-06 Thread Arnaud VERSINI (via logerrit)
 desktop/source/app/cmdlineargs.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit ebd697df0cfed7078346e61c069891cf02c2cc54
Author: Arnaud VERSINI 
AuthorDate: Mon Sep 5 16:16:59 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Sep 6 18:07:05 2022 +0200

desktop : use a std::mutex instead of a osl::Mutex

Change-Id: I149af335196eaa31cbd11965e1656c3dfe7431ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139440
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/desktop/source/app/cmdlineargs.cxx 
b/desktop/source/app/cmdlineargs.cxx
index 9f9251064fb2..f1949cbd0bbf 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -40,6 +40,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace com::sun::star::lang;
 using namespace com::sun::star::uri;
 using namespace com::sun::star::uno;
@@ -198,8 +200,8 @@ CommandLineEvent CheckWebQuery(/* in,out */ OUString& arg, 
CommandLineEvent curE
 if (!arg.endsWithIgnoreAsciiCase(".iqy"))
 return curEvt;
 
-static osl::Mutex aMutex;
-osl::MutexGuard aGuard(aMutex);
+static std::mutex aMutex;
+std::lock_guard aGuard(aMutex);
 
 try
 {


[Libreoffice-commits] core.git: desktop/source

2022-09-01 Thread Stephan Bergmann (via logerrit)
 desktop/source/app/cmdlineargs.cxx |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 21229c2f45f96a8ee3060acb3296be77be3a9f1a
Author: Stephan Bergmann 
AuthorDate: Thu Sep 1 17:33:51 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 1 22:47:35 2022 +0200

Filter out unwanted command URIs

Change-Id: I0b7e5329af8cc053d14d5c60ec14fe7f364ef993
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139225
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/desktop/source/app/cmdlineargs.cxx 
b/desktop/source/app/cmdlineargs.cxx
index 05daddfda2f3..9f9251064fb2 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -28,6 +28,7 @@
 #include "cmdlineargs.hxx"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -166,7 +167,14 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& 
arg, CommandLineEvent cur
 }
 if (nURIlen < 0)
 nURIlen = rest2.getLength();
-arg = rest2.copy(0, nURIlen);
+auto const uri = rest2.subView(0, nURIlen);
+if (INetURLObject(uri).GetProtocol() == INetProtocol::Macro) {
+// Let the "Open" machinery process the full command URI (leading to 
failure, by intention,
+// as the "Open" machinery does not know about those command URI 
schemes):
+curEvt = CommandLineEvent::Open;
+} else {
+arg = uri;
+}
 return curEvt;
 }
 


[Libreoffice-commits] core.git: desktop/source

2022-09-01 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx |  131 +++-
 1 file changed, 57 insertions(+), 74 deletions(-)

New commits:
commit 63f7765c1d50fbd87b53d692a2cd1720a7a16d70
Author: Tor Lillqvist 
AuthorDate: Thu Sep 1 12:39:52 2022 +0300
Commit: Tor Lillqvist 
CommitDate: Thu Sep 1 13:41:43 2022 +0200

Use more idiomatic C++

Change-Id: I0e9460f2500b76bec049c12413fbbee5dcb239c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139149
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f37c0bba8cd9..95f96ee67cf4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2627,85 +2627,68 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 // Serif" -> "Liberation Serif/Regular". If even one of the 
"substitutions" of a font is to
 // the same font, don't count that as a missing font.
 
-for (std::size_t i = 0; i < aFontMappingUseData.size();)
-{
-// If the original font had an empty style and one of its 
replacement fonts has the same
-// family name, we assume the font is present. The root problem 
here is that the code
-// that collects font substitutions tends to get just empty styles 
for the font that is
-// being substituted, as vcl::Font::GetStyleName() tends to return 
an empty string.
-// (Italicness is instead indicated by what vcl::Font::GetItalic() 
returns and boldness
-// by what vcl::Font::GetWeight() returns.)
-if (aFontMappingUseData[i].mOriginalFont.indexOf('/') == -1)
-{
-bool bSubstitutedByTheSame = false;
-for (const auto  : aFontMappingUseData[i].mUsedFonts)
-{
-if 
(j.startsWith(OUStringConcatenation(aFontMappingUseData[i].mOriginalFont + 
"/")))
-{
-bSubstitutedByTheSame = true;
-break;
-}
-}
-
-if (bSubstitutedByTheSame)
-aFontMappingUseData.erase(aFontMappingUseData.begin() + i);
-else
-i++;
-}
-else
-{
-i++;
-}
-}
+aFontMappingUseData.erase
+(std::remove_if(aFontMappingUseData.begin(), 
aFontMappingUseData.end(),
+[](OutputDevice::FontMappingUseItem x)
+{
+// If the original font had an empty style and 
one of its
+// replacement fonts has the same family name, 
we assume the font is
+// present. The root problem here is that the 
code that collects
+// font substitutions tends to get just empty 
styles for the font
+// that is being substituted, as 
vcl::Font::GetStyleName() tends to
+// return an empty string. (Italicness is 
instead indicated by what
+// vcl::Font::GetItalic() returns and boldness 
by what
+// vcl::Font::GetWeight() returns.)
+
+if (x.mOriginalFont.indexOf('/') == -1)
+for (const auto  : x.mUsedFonts)
+if 
(j.startsWith(OUStringConcatenation(x.mOriginalFont + "/")))
+return true;
+
+return false;
+}),
+ aFontMappingUseData.end());
 
 // Filter out substitutions where a proprietary font has been 
substituted by a
 // metric-compatible one. Obviously this is just a heuristic and 
implemented only for some
 // well-known cases.
 
-for (std::size_t i = 0; i < aFontMappingUseData.size();)
-{
-// Again, handle only cases where the original font does not 
include a style. Unclear
-// whether there ever will be a style part included in the 
mOriginalFont.
-
-if (aFontMappingUseData[i].mOriginalFont.indexOf('/') == -1)
-{
-bool bSubstitutedByMetricCompatible = false;
-for (const auto  : aFontMappingUseData[i].mUsedFonts)
-{
-if ((aFontMappingUseData[i].mOriginalFont == "Arial" &&
- j.startsWith("Liberation Sans/")) ||
-(aFontMappingUseData[i].mOriginalFont == "Times New 
Roman" &&
- j.startsWith("Liberation Serif/")) ||
-(aFontMappingUseData[i].mOriginalFont == "Courier New" 
&&
- j.startsWith("Liberation Mono/")) ||
-  

  1   2   3   4   5   6   7   8   9   10   >