https://bugs.documentfoundation.org/show_bug.cgi?id=150281

            Bug ID: 150281
           Summary: VBA Application.CentimetersToPoints must give Double
                    in Calc
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Keywords: difficultyBeginner, easyHack, skillCpp
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

In both Word and Excel, there are Application.CentimetersToPoints. However,
they return different types: Word's return Single [1], while Excel's returns
Double [2]. Note that the argument types they take are also different.

Create a text document in Writer; add a macro *to it* (Application object seems
to only be available from document modules):


Option VBASupport 1

Sub Main
  msgbox TypeName(Application.CentimetersToPoints(1))
End Sub

The result is the expected "Single".

Now repeat the process with a Calc document. The same macro must give "Double",
but gives the same "Single".

The common method is declared in ooo::vba::XApplicationBase [3], and defined in
VbaApplicationBase [4].

Interesting thing is, that for Word VBA Application, this function is *also*
declared in XApplication [5], and overloaded in SwVbaApplication [6], together
with other conversion function absent from Excel's Application object.

I suspect that initially, it was assumed that same-name methods in both VBA
Application objects were the same, hence it was declared in the common ancestor
class. However, the methods are different, so it makes sense to remove it from
the ancestor, and declare/define in Excel VBA Application compatibility class
(ScVbaApplication).

[1]
https://docs.microsoft.com/en-us/office/vba/api/Word.Application.CentimetersToPoints
[2]
https://docs.microsoft.com/en-us/office/vba/api/Excel.Application.CentimetersToPoints
[3]
https://opengrok.libreoffice.org/xref/core/oovbaapi/ooo/vba/XApplicationBase.idl?r=5687eba4#40
[4]
https://opengrok.libreoffice.org/xref/core/vbahelper/source/vbahelper/vbaapplicationbase.cxx?r=da9b11a5#410
[5]
https://opengrok.libreoffice.org/xref/core/oovbaapi/ooo/vba/word/XApplication.idl?r=c9b57b72#55
[6]
https://opengrok.libreoffice.org/xref/core/sw/source/ui/vba/vbaapplication.cxx?r=c9b57b72#416

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to