<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 09/09/14 15:55, Justin Luth wrote:<br>
    </div>
    <blockquote cite="mid:540F14D5.4070800@mail.com" type="cite">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      Are sc/source/ui/vba/vbaapplications.cxx and
      vbahelper/source/vbahelper/vbahelper.cxx ONLY used for MS VBA
      compatibility, or does it also affect StarBasic etc?<br>
    </blockquote>
    it only affects MS VBA compatability<br>
    <blockquote cite="mid:540F14D5.4070800@mail.com" type="cite"> <br>
      I have identified that the vbahelper function getCurrentDoc() is
      broken, causing bug 71248, and suggested a band-aid solution for
      it in the comments.  However, I don't know the larger implications
      of replacing getCurrentDoc with getThisExcelDoc.  In practice,
      THIS and CURRENT are likely the same thing</blockquote>
    no, 'THIS' refers to the document running the macro and 'CURRENT' is
    the 'active' document. E.g. if a macro in foo.xls opens existing
    ba.xls, 'THIS' refers to foo.xls and CURRENT refers to ba.xls (after
    the document is raised and opened and is still on top)<br>
    <blockquote cite="mid:540F14D5.4070800@mail.com" type="cite">, but
      perhaps the current implementation is necessary and working for
      someone...<br>
      <br>
      I'm still going to try to figure out how to properly fix
      "getCurrentDoc" but so far I don't really understand what it is
      doing. <br>
    </blockquote>
    I haven't looked at that code in a long time so feel free to dive in
    there, iirc basically 'THIS' is tracked in the uno context (VBA has
    a custom uno context), CURRENT should be accessible as a UNO global
    variable inserted in to 'application' StarBasic. It sounds like
    somehow somewhere getCurrentDoc either is no longer searching for
    the correct variable, or its no longer getting updated (used to be
    updated somewhere in sfx2/.../objxstor.cxx (try searching for
    'ThisComponent', it's bound to be handled somewhere close to that)<br>
    There used to be some confusing (but necessary) indirection to
    handling this e.g. because Libreoffice is a single application (and
    VBA support was trying to support both Word & Excel) the code in
    objxstor.cxx needs to find out which variable in StartBasic to
    update, in the case of a Word document it would need to update
    StarBasic variable named 'ThisWordDoc' & for Excel
    'ThisExcelDoc' variable (both can exist simulateously if multiple
    documents xls/doc are open).  That is my recollection how this used
    to work, it is possible imports from AOO code have trampled/changed
    this possibly in an incompatible way<br>
    <blockquote cite="mid:540F14D5.4070800@mail.com" type="cite"> If
      someone who actually knows how to program and submit patches could
      take over from this point, that would be great.<br>
      <br>
      suggested Band-aid fix:<br>
      <font color="#000099">uno::Reference< frame::XModel > 
        getCurrentExcelDoc( const uno::Reference<
        uno::XComponentContext >& xContext ) throw
        (uno::RuntimeException)<br>
        {<br>
            return </font><font color="#000099">getThisExcelDoc(
        xContext );</font><br>
      <font color="#000099">}<br>
      </font></blockquote>
    I think this would be a bad idea, getCurrentExcelDoc needs fixing to
    return the topmost open Excel document<br>
    <blockquote cite="mid:540F14D5.4070800@mail.com" type="cite">
      Thanks,<br>
      Justin<br>
      <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="https://bugs.freedesktop.org/show_bug.cgi?id=71248">https://bugs.freedesktop.org/show_bug.cgi?id=71248</a><br>
      <br>
    </blockquote>
    thanks,<br>
    <br>
    Noel<br>
  </body>
</html>