Apache OpenOffice (AOO) Bugzilla – Issue 100953
Basic macro functions: StrConv, LeftB, LenB, MidB, and RightB
Last modified: 2015-11-25 14:30:56 UTC
This is an experimental implementation of OpenOffice.org/StarOffice Basic macro functions: - StrConv - LeftB - LenB - MidB - RightB Algorithm To share algorithms of the existing Unicode string functions - Left, Len, Mid, and Right - with corresponding byte string functions - LeftB, LenB, MidB, and RightB -, this implementation employs C++ templates. That is, one algorithm is used by both String and ByteString classes. Code conversion Conversion between Unicode string and byte string is implemented in the StrConv function. It can take either Unicode and byte strings, convert it, and return converted string. Todo: A type of character encoding is automatically determined with the operating system's default encoding. E.g. It would be - CodePage 932 on Windows Japanese - UTF-8 on Solaris/Linux with LANG=en_US.UTF-8 There might be demands to allow macro programmers to explicitly specify a type of character encoding. Calculation Concatenation and comparison of byte strings are also implemented. An attempt of concatenating or comparing a Unicode string with byte one is resulted in an error. Implicit type conversion Implicit type conversion from byte string to Unicode string and vice versa is also implemented. The byte order is tuned for x86/x64 processors. Implicit type conversion from byte string to one of the basic types such as integer, and versa is also preliminarily implemented. It converts a byte string into Unicode string first and then utilizes a type conversion method from Unicode string to the basic type. Todo: All possible combinations of original type and destination type are not covered yet. The rest of the combinations should be implemented, if needed. References issue 85036 http://l10n.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=2205928 http://msdn.microsoft.com/en-us/library/aa263373(VS.60).aspx http://msdn.microsoft.com/en-us/library/aa286591(office.10).aspx
Created attachment 61457 [details] An experimental patch to DEV300_m41, could be also applied to DEV300_m44
Some corrections In the section "Code conversion" above, Conversion between Unicode string and byte string is implemented as an implicit type conversion. A user can use it through StrConv macro function. In the section "Implicit type conversion" above, Implicit type conversion from byte string to Unicode string and vice versa is also implemented. Its byte order in this implementation is little endian regardless of type of processor on which OpenOffice.org is running. Little endian is used by x86/x64 processors.
Andreas, here are coming some functions to be more close to some other BASICs :-)
Needs some evaluation, STARTED
.
Found no time for evaluation so far.
Could you please take time to review this?
moving to framework...
LibreOffice: https://bugs.freedesktop.org/show_bug.cgi?id=35006
Technical notes If you are implementing this patch for the upcoming version of OpenOffice.org or its siblings, you might find that use of "ByteString aBytePic" in the same fashion as "String aPic" was better than current code in the patch. basic/inc/basic/sbxvar.hxx class SbxValue : public SbxBase { SbxValues aData; // Daten String aPic; // Picture-String // ByteString aBytePic; // Picture-ByteString There were restriction during development of the patch. The patch aimed at providing a single shared library file to our clients, not several shared library files. Under the circumstances where "class SbxValue" is used by other modules outside of "basic," adding a member variable to the class results in increasing the size of its instance. Consequently, OpenOffice.org will crash unless its relevant shared libraries are also replaced at the same time. To avoid such a crash problem, I knew that addition of "ByteString aBytePic" to the class SbxValue was an appropriate way, I did a tricky implementation without use of it. No need to exactly follow the patch.
I'm adding this comment to all open issues with Issue Type == PATCH. We have 220 such issues, many of them quite old. I apologize for that. We need your help in prioritizing which patches should be integrated into our next release, Apache OpenOffice 4.0. If you have submitted a patch and think it is applicable for AOO 4.0, please respond with a comment to let us know. On the other hand, if the patch is no longer relevant, please let us know that as well. If you have any general questions or want to discuss this further, please send a note to our dev mailing list: dev@openoffice.apache.org Thanks! -Rob
LeftB, LenB, MidB, and RightB are implemented in core for Calc and available in macros same way as the other Calc functions. So this part is obsolete. I will close this issue as obsolete. Calc has the function Unicode and Unichar, so I don't know, whether the string conversion part is still meaningful. If yes, then please open a new issue for it and adapt the patch.
(In reply to Regina Henschel from comment #15) > LeftB, LenB, MidB, and RightB are implemented in core for Calc and available > in macros same way as the other Calc functions. So this part is obsolete. OK for these 4 functions. But StrConv is not implemented in Basic. So this enhancement will be welcome in a next build. :-) Could we reopen this RFE?