Issue 76129 - Impossible to bind a macro to an event of a FORM or REPORT inside an OpenOffice.org Base
Summary: Impossible to bind a macro to an event of a FORM or REPORT inside an OpenOffi...
Status: CLOSED FIXED
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: recent-trunk
Hardware: All All
: P3 Trivial with 2 votes (vote)
Target Milestone: OOo 2.x
Assignee: marc.neumann
QA Contact: issues@dba
URL:
Keywords:
: 76131 (view as issue list)
Depends on:
Blocks:
 
Reported: 2007-04-05 14:49 UTC by Ariel Constenla-Haile
Modified: 2009-07-20 15:22 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
first steps of a patch (20.43 KB, patch)
2007-07-25 19:57 UTC, Frank Schönheit
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Ariel Constenla-Haile 2007-04-05 14:49:16 UTC
It is imposible to BIND a macro to an EVENT of a FORM inside an OpenOffice.org
Base document (ODB).
If we open a FORM inside an ODB, go to the menu "TOOLS" - "CUSTOMIZE", 
and we choose the tab "EVENTS", in the "Save in" list box there is NO 
chance to choose the current open form document (which is really an 
ODT), just OpenOffice.org as a whole. Therefore, the user can't assign a 
macro to an event (what is called "event binding") using this dialog.

He/she can bind an event using an OOoBasic macro, because the FORM document
suports the interface com.sun.star.document.XEventsSupplier that has a method
getEvents() to bind events to the 
com.sun.star.document.OfficeDocument; but the user can't use the GUI to 
do this, as he can with other Writer (ODT) documents.
Comment 1 Frank Schönheit 2007-04-10 07:14:19 UTC
*** Issue 76131 has been marked as a duplicate of this issue. ***
Comment 2 Frank Schönheit 2007-04-10 07:16:12 UTC
configming, grabbing, targeting
Comment 3 Frank Schönheit 2007-06-11 09:53:33 UTC
Hmm, this is more difficult than I thought. I have a patch which enables the
respective tab page. Unfortunately, there's a lot of strange code involved which
uses the infamous SfxDocShell::GetFoo methods, which do not work together with
database documents (and embedded forms). As a result, the Macro Selector dialog,
which opens when you press the "Macro" button on the "Events" page, does not
contain the form document's macros.

Sigh. This code is a piece of ... ehm, well ...
Comment 4 Frank Schönheit 2007-07-25 19:57:31 UTC
Created attachment 47088 [details]
first steps of a patch
Comment 5 Frank Schönheit 2007-07-25 19:59:54 UTC
The attachment contains first steps towards a patch. I started developing this
in CWS dba23b (so the patch is relative to this CWS), but found that there's
much more components (ScriptProvider, e.g.) which stupidly use SfxObjectShell
and friends, instead of clean UNO methods.
The patch fixes the UI to allow to select the embedded documents as event
source, but when browsing for the macro to bind to an event, this dialog will
not list the embedded documents.

IoW: more work to be done.
Comment 6 Frank Schönheit 2007-07-25 20:00:28 UTC
resetting STARTED state - do not work at this anymore ATM.
Comment 7 Frank Schönheit 2007-08-01 13:31:05 UTC
fs->kso: please take over the remaining part (in CWS basmgr03):
With the patch above (already committed and built), the behavior now is as follows:
- start OOo
- open a database document
- open a form embedded in this database document
- select menu: Tools / Customize
- select tab page: Events
- press button: Macro
=> the macro selector is opened, but the form does *not* appear in the list
- close the dialogs
- close the form
- re-open the form
- Tools / Customize / Events / Macro
=> the macro selector is opened, this time the form *does* appear in the list

The reason for this is in the tdoc UCP, more precise, in
OfficeDocumentsManager::isOfficeDocument: There, a check is made whether the
frame of the current controller of the document is "on top" - if not, it's
assumed the document is no office document. Now when the document manager is
created while the form already is open, then isTop returns false, thus the form
is assumed to be no office document.

Now when the form is opened while the document manager is already alive, the
isTop check still returns true - it only becomes false later when the frame gets
a new parent frame. (In fact, the definition for isTop is "the frame has no
parent, or the parent is the desktop".)

All in all, I think the isOfficeDocument method is wrong here.
I could imagine the following alternative solutions:
- use supportsService( "com.sun.star.document.OfficeDocument" ) instead.
  Finally, it might make sense to simply believe what the document is telling
  about itself.
- use XFrame.getContainerWindow, to determine whether it supports the
  XTopWindow interface. (Though, comments in AS' code in the framework module
  suggest this might not be reliable. Perhaps AS - on cc - has an opinion here.)
- convince AS to adjust XFrame::isTop to the new realities :)
  Which means: The fact that top level frames can have parent frames has been
  introduced with the changes in CWS fwkdbdesign01, and is pretty new. Maybe
  XFrame::isTop simply doesn't care for this new concept, yet.

  fs->as: In recent code in framework, there's a WindowHelper::isTopWindow
  method which encapsulates the question whether a window really is a top window.
  Perhaps Frame::isTop should use isTopWindow instead?
Comment 8 Frank Schönheit 2007-08-01 13:40:40 UTC
> please take over the remaining part (in CWS basmgr03):
this one was too optimistic ... there's more to do, since there are dozens of
assertions from SFX if you actually try to assign a macro to an event of the
form. However, this will be my part, again(at least to find out).
Comment 9 kai.sommerfeld 2007-08-21 12:17:17 UTC
fs: As discussed... your task again.
Comment 10 Frank Schönheit 2007-08-24 19:48:23 UTC
implemented in CWS basmgr03
Comment 11 Frank Schönheit 2007-08-24 19:50:02 UTC
note that when you actually bind a macro to any of the events, then in a
non-product builds, you will be slain by dozens of assertions. This, however, is
also the case for "normal" text (and other) documents, which now is issue 81004.
Comment 12 Frank Schönheit 2007-09-13 20:41:17 UTC
fs-> msc: please verify in CWS basmgr03
Comment 13 marc.neumann 2007-10-02 09:58:50 UTC
verified in cws basmgr03
Comment 14 drewjensen.inbox 2007-10-13 19:29:15 UTC
Specific issue passes test on XP

SERIOUS SECURITY ISSUE
See Issue#52527

Comment 15 drewjensen.inbox 2007-10-13 20:01:42 UTC
My security test was INVALID - I had used a library function

Retested with a macro embedded in the embedded form. The security settings
behavior is unchanged from Issue#52527 the embedded macro is not allowed to run
with the setting to Very high.

With setting of Medium the embedded macro is reported and the user must
authorize even if in the trusted path. Sorry for my jumping the gun on the warning.
Comment 16 oooforum (fr) 2008-12-11 13:18:03 UTC
Thanks for clarify this. The fix is targeted for OOo 2.x but it's still unable
to bind a macro in Base 3.0.
Comment 17 thorsten.ziehm 2009-07-20 15:22:17 UTC
This issue is closed automatically and wasn't rechecked in a current version of
OOo. The fixed issue should be integrated in OOo since more than half a year. If
you think this issue isn't fixed in a current version (OOo 3.1), please reopen
it and change the field 'Target Milestone' accordingly.

If you want to download a current version of OOo =>
http://download.openoffice.org/index.html
If you want to know more about the handling of fixed/verified issues =>
http://wiki.services.openoffice.org/wiki/Handle_fixed_verified_issues