Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Where I've got to thus far is -

Line 209 is not called in 
comphelper/source/eventattachermgr/eventattachermgr.cxx

206 // Iterate over all listeners and pass events.
207 OInterfaceIteratorHelper aIt( mpManager->aScriptListeners );
208 while( aIt.hasMoreElements() )
209 ((XScriptListener *)aIt.next())->firing( aScriptEvent );






So I commented out lines 1279 and 1280 in 
/home/libreoffice/core/forms/source/misc/InterfaceContainer.cxx
1277 void SAL_CALL OInterfaceContainer::removeScriptListener( const Reference< 
XScriptListener >& xListener ) throw(IllegalArgumentException, 
RuntimeException)
1278 {
1279 //mcmurchy if ( m_xEventAttacher.is() )
1280 //mcmurchy m_xEventAttacher->removeScriptListener( xListener );
1281 }




which gets me to lines 439/440 in 
/home/libreoffice/core/svx/source/form/fmscriptingenv.cxx before returning which 
suggests that scripting isn't running

437 // SfxObjectShellRef is good here since the model controls the lifetime of 
the object
438 SfxObjectShellRef xObjectShell = m_rFormModel.GetObjectShell();
439 if( !xObjectShell.Is() )
440 return;


Iain



On Monday 08 Apr 2013 17:06:30 Lionel Elie Mamane wrote:
On Wed, Mar 27, 2013 at 09:46:44AM +0000, mcmurchy1917-libreoffice@yahoo.co.uk 
wrote:
In the bug report it was confirmed that a macro assigned to either
the Before Unloading or When Unloading events of a dataform are not
called when the form document is closed.

However, when editing a form and the "Design Mode" option is toggled
the events are called.

I completely missed that in my first reading of your mail:

 The *same* event (namely "Before Unloading" on the FormData) is:

 1) *not* called when closing the form document

 2) *called* when switching normal mode to design mode

So we need to see *what* codepath calls it in case "2)" (with the
msgbox / ctrl-c in gdb trick I described). That's already more or less
done, with Noel's quote of:

 FmFormView::ChangeDesignMode

 258     // --- 4. load resp. unload the forms
 259     FmFormPage*  pCurPage = GetCurPage();
 260     if ( pCurPage )
 261     {
 262         if ( pFormShell && pFormShell->GetImpl() )
 263             pFormShell->GetImpl()->loadForms( pCurPage, ( bDesign ?
FORMS_UNLOAD : FORMS_LOAD ) ); 264     }

The operative call seems to be:
 pFormShell->GetImpl()->loadForms(pCurPage, FORMS_UNLOAD)

And then, we need to find where we need to call
 pFormShell->GetImpl()->loadForms(pCurPage, FORMS_UNLOAD)
in the case "1)". My idea for that is to see what triggers the *form*
*document* "before close" event (there does not seem to be a "before
unload" event for it). That codepath should call
 pFormShell->GetImpl()->loadForms(pCurPage, FORMS_UNLOAD)
somewhere

I've taken a look, and this the relevant part of the backtrace:


#36 0x00007f745fce2226 in SfxObjectShell::PrepareClose
(this=0x3d2a1a0, bUI=<optimized out>,
    bForBrowsing=<optimized out>)
    at
   
/home/master/src/libreoffice/workdirs/libreoffice-4.0/sfx2/source/doc/objxt
or.cxx:596 #37 0x00007f742c1e82a7 in SwDocShell::PrepareClose
(this=0x3d2a1a0, bUI=<optimized out>,
    bForBrowsing=<optimized out>)
    at
   
/home/master/src/libreoffice/workdirs/libreoffice-4.0/sw/source/ui/app/docs
h2.cxx:317 #38 0x00007f745fd87500 in SfxBaseController::suspend
(this=0x3e89980, bSuspend=<optimized out>)
    at
   
/home/master/src/libreoffice/workdirs/libreoffice-4.0/sfx2/source/view/sfxb
asecontroller.cxx:650 #39 0x00007f743c5a1955 in
dbaccess::ODocumentDefinition::prepareClose (this=0x31dfe30)
    at
   
/home/master/src/libreoffice/workdirs/libreoffice-4.0/dbaccess/source/core/
dataaccess/documentdefinition.cxx:2058 #40 0x00007f743c5b4c74 in
dbaccess::OInterceptor::OnDispatch
(this=0x2ca0990, _pDispatcher=0x3d680f0)
    at
   
/home/master/src/libreoffice/workdirs/libreoffice-4.0/dbaccess/source/core/
dataaccess/intercept.cxx:192


But frankly, at this point I'm not sure how to get the "pFormShell"
and "pCurPage" somewhere in this call stack; I think we need to do
that in SwDocShell::PrepareClose or SfxObjectShell::PrepareClose
somehow.


Mcmurchy1917, I've also seen your email looking at the
"m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt );"
That looks like a promising avenue, too.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.