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

2021-12-03 Thread Mike Kaganski (via logerrit)
 sot/source/base/exchange.cxx |2 -
 sot/source/base/formats.cxx  |8 ++---
 vcl/source/treelist/transfer.cxx |   56 ---
 3 files changed, 40 insertions(+), 26 deletions(-)

New commits:
commit f586839956d6937920aa377fe95854c1a0518d96
Author: Mike Kaganski 
AuthorDate: Fri Dec 3 11:51:03 2021 +0300
Commit: Mike Kaganski 
CommitDate: Fri Dec 3 12:01:39 2021 +0100

Windows format name is FileGroupDescriptorW for Unicode strings

See also commit 5fb9f4ffa9284c7248e2e82210506babaad4044d
tdf#145964: Windows format name is FileNameW for Unicode strings
and commit 52e1d0ca6ad38b4b4fdc77b0951ad26f0ac18ec5
Windows format name is UniformResourceLocatorW for Unicode strings

We don't use other standard clipboard formats which have W variants.

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

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 3138d89de0aa..582ca49c5598 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -141,7 +141,7 @@ const DataFlavorRepresentation* FormatArray_Impl()
 /* 86 SotClipboardFormatId::LINK_SOURCE*/{ 
"application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source 
(XML)\"", "Star Link Source (XML)", &cppu::UnoType>::get() },
 /* 87 SotClipboardFormatId::EMBEDDED_OBJ*/   { 
"application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded 
Object (XML)\"", "Star Embedded Object (XML)", 
&cppu::UnoType>::get() },
 /* 88 SotClipboardFormatId::FILECONTENT*/{ 
"application/x-openoffice-filecontent;windows_formatname=\"FileContents\"", 
"FileContents", &cppu::UnoType>::get() },
-/* 89 SotClipboardFormatId::FILEGRPDESCRIPTOR*/  { 
"application/x-openoffice-filegrpdescriptor;windows_formatname=\"FileGroupDescriptor\"",
 "FileGroupDescriptor", &cppu::UnoType>::get() },
+/* 89 SotClipboardFormatId::FILEGRPDESCRIPTOR*/  { 
"application/x-openoffice-filegrpdescriptor;windows_formatname=\"FileGroupDescriptorW\"",
 "FileGroupDescriptor", &cppu::UnoType>::get() },
 /* 90 SotClipboardFormatId::FILENAME*/   { 
"application/x-openoffice-filename;windows_formatname=\"FileNameW\"", 
"FileName", &cppu::UnoType::get() },
 /* 91 SotClipboardFormatId::SD_OLE*/ { 
"application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE", 
&cppu::UnoType>::get() },
 /* 92 SotClipboardFormatId::EMBEDDED_OBJ_OLE*/   { 
"application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded 
Object\"", "Embedded Object", &cppu::UnoType>::get() },
diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 8901064d6901..0b3d80120022 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -1359,12 +1359,12 @@ static bool CheckTransferableContext_Impl( const 
Reference< XTransferable >* pxT
 
 if( aSeq.getLength() )
 {
-FILEGROUPDESCRIPTOR const * pFDesc = 
reinterpret_cast(aSeq.getConstArray());
+FILEGROUPDESCRIPTORW const * pFDesc = 
reinterpret_cast(aSeq.getConstArray());
 
 if( pFDesc->cItems )
 {
-OString sDesc( pFDesc->fgd[ 0 ].cFileName 
);
-bRet = 4 < sDesc.getLength() && 
sDesc.copy(sDesc.getLength()-4).equalsIgnoreAsciiCase(".URL");
+OUString sDesc( o3tl::toU(pFDesc->fgd[ 0 
].cFileName) );
+bRet = 4 < sDesc.getLength() && 
sDesc.endsWithIgnoreAsciiCase(".URL");
 }
 }
 }
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 4561535d0291..260e3ba65613 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #endif
+#include 
 #include 
 #include 
 #include 
@@ -76,6 +77,7 @@ using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::datatransfer;
 using namespace ::com::sun::star::datatransfer::clipboard;
 using namespace ::com::sun::star::datatransfer::dnd;
+using namespace std::literals::string_view_literals;
 
 
 #define TOD_SIG1 0x01234567
@@ -797,23 +799,21 @@ bool TransferableHelper::SetINetBookmark( const 
INetBookmark& rBmk,
 #ifdef _WIN32
 case SotClipboardFormatId::FILEGRPDESCRIPTOR:
 {
-Sequence< sal_Int8 >aSeq( sizeof( FILEGROUPDESCRIPTOR ) );
-FILEGROUPDESCRIPT

[Libreoffice-commits] core.git: sot/source vcl/source vcl/win

2021-12-02 Thread Mike Kaganski (via logerrit)
 sot/source/base/exchange.cxx |2 +-
 vcl/source/treelist/transfer.cxx |   10 +-
 vcl/win/dtrans/ftransl.cxx   |5 +++--
 3 files changed, 5 insertions(+), 12 deletions(-)

New commits:
commit 52e1d0ca6ad38b4b4fdc77b0951ad26f0ac18ec5
Author: Mike Kaganski 
AuthorDate: Thu Dec 2 08:50:41 2021 +0300
Commit: Mike Kaganski 
CommitDate: Fri Dec 3 08:13:24 2021 +0100

Windows format name is UniformResourceLocatorW for Unicode strings

See also commit 5fb9f4ffa9284c7248e2e82210506babaad4044d
tdf#145964: Windows format name is FileNameW for Unicode strings

TODO: replace one remaining format from CFSTR_* family that we use (see
https://www.codeproject.com/Reference/1091137/Windows-Clipboard-Formats):
FileGroupDescriptor -> FileGroupDescriptorW. That one needs more complex
handling.

Change-Id: I4d4ad83099854768cf36c7b3d89059d79c8e77f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126213
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 2d26887557a6..3138d89de0aa 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -156,7 +156,7 @@ const DataFlavorRepresentation* FormatArray_Impl()
 /*101 SotClipboardFormatId::NETSCAPE_IMAGE*/ { 
"application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image 
Format\"", "Netscape Image Format", &cppu::UnoType>::get() },
 /*102 SotClipboardFormatId::SBA_FORMEXCHANGE*/   { 
"application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"",
 "SBA_FORMEXCHANGE", &cppu::UnoType>::get() },
 /*103 SotClipboardFormatId::SBA_REPORTEXCHANGE*/ { 
"application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"",
 "SBA_REPORTEXCHANGE", &cppu::UnoType>::get() },
-/*104 SotClipboardFormatId::UNIFORMRESOURCELOCATOR*/ { 
"application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocator\"",
 "UniformResourceLocator", &cppu::UnoType>::get() },
+/*104 SotClipboardFormatId::UNIFORMRESOURCELOCATOR*/ { 
"application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocatorW\"",
 "UniformResourceLocator", &cppu::UnoType::get() },
 /*105 SotClipboardFormatId::STARCHARTDOCUMENT_50*/   { 
"application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument
 5.0\"", "StarChartDocument 5.0", &cppu::UnoType>::get() },
 /*106 SotClipboardFormatId::GRAPHOBJ*/   { 
"application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\"", 
"Graphic Object", &cppu::UnoType>::get() },
 /*107 SotClipboardFormatId::STARWRITER_60*/  { 
MIMETYPE_VND_SUN_XML_WRITER_ASCII, "Writer 6.0", 
&cppu::UnoType>::get() },
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index bb245767cb63..81c99653578f 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -777,18 +777,10 @@ bool TransferableHelper::SetINetBookmark( const 
INetBookmark& rBmk,
 break;
 
 case SotClipboardFormatId::STRING:
+case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
 maAny <<= rBmk.GetURL();
 break;
 
-case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
-{
-OString sURL(OUStringToOString(rBmk.GetURL(), eSysCSet));
-Sequence< sal_Int8 > aSeq( sURL.getLength() );
-memcpy( aSeq.getArray(), sURL.getStr(), sURL.getLength() );
-maAny <<= aSeq;
-}
-break;
-
 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
 {
 Sequence< sal_Int8 > aSeq( 2048 );
diff --git a/vcl/win/dtrans/ftransl.cxx b/vcl/win/dtrans/ftransl.cxx
index 0fc4aa53f804..2d5ecd492754 100644
--- a/vcl/win/dtrans/ftransl.cxx
+++ b/vcl/win/dtrans/ftransl.cxx
@@ -302,10 +302,11 @@ const std::vector< FormatEntry > g_TranslTable {
 //SotClipboardFormatId::NETSCAPE_IMAGE
 
FormatEntry("application/x-openoffice-netscape-image;windows_formatname=\"Netscape
 Image Format\"", "Netscape Image Format", nullptr, CF_INVALID, 
CPPUTYPE_DEFAULT),
 //SotClipboardFormatId::SBA_FORMEXCHANGE
-
FormatEntry("application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"",
 "SBA_FORMEXCHANGE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT),  
//SotClipboardFormatId::SBA_REPORTEXCHANGE
+
FormatEntry("application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"",
 "SBA_FORMEXCHANGE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT),
+//SotClipboardFormatId::SBA_REPORTEXCHANGE
 
FormatEntry("application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"",
 "SBA_REPORTEXCHANGE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT),
 //SotClipboardFormatId::UNIFORMRESOURCELOCATOR
-
FormatEntry("application/x-openo