diff options
author | Andre Fischer <andre.f.fischer <Andre Fischer<andre.f.fischer@oracle.com> | 2011-01-26 11:11:11 +0100 |
---|---|---|
committer | Andre Fischer <andre.f.fischer <Andre Fischer<andre.f.fischer@oracle.com> | 2011-01-26 11:11:11 +0100 |
commit | cf054f6ef9d88233703678889bc3eb3efe516ec3 (patch) | |
tree | 1d2e2e6166cab18b3cec15dafa144557c63c5a8d /svx/source/form/fmvwimp.cxx | |
parent | 312cafc472e4ac74a045baf123476a2457c15185 (diff) | |
parent | d646413d464dc5d6518f87daa8538cd0c600797f (diff) |
impress195: rebase to DEV300 m98
Diffstat (limited to 'svx/source/form/fmvwimp.cxx')
-rw-r--r-- | svx/source/form/fmvwimp.cxx | 252 |
1 files changed, 106 insertions, 146 deletions
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 0bf6a35abd98..8e0f6b2a261a 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -32,15 +32,15 @@ #include "fmobj.hxx" #include "fmpgeimp.hxx" #include "fmprop.hrc" -#include "fmresids.hrc" +#include "svx/fmresids.hrc" #include "fmservs.hxx" #include "fmshimp.hxx" #include "svx/fmtools.hxx" #include "fmundo.hxx" #include "fmvwimp.hxx" #include "formcontrolfactory.hxx" -#include "sdrpaintwindow.hxx" -#include "svditer.hxx" +#include "svx/sdrpaintwindow.hxx" +#include "svx/svditer.hxx" #include "svx/dataaccessdescriptor.hxx" #include "svx/dialmgr.hxx" #include "svx/fmglob.hxx" @@ -51,7 +51,7 @@ #include "svx/sdrpagewindow.hxx" #include "svx/svdogrp.hxx" #include "svx/svdpagv.hxx" -#include "xmlexchg.hxx" +#include "svx/xmlexchg.hxx" /** === begin UNO includes === **/ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> @@ -173,20 +173,19 @@ public: }; //======================================================================== -DBG_NAME(FmXPageViewWinRec) +DBG_NAME(FormViewPageWindowAdapter) //------------------------------------------------------------------------ -FmXPageViewWinRec::FmXPageViewWinRec( const ::comphelper::ComponentContext& _rContext, const SdrPageWindow& _rWindow, FmXFormView* _pViewImpl ) +FormViewPageWindowAdapter::FormViewPageWindowAdapter( const ::comphelper::ComponentContext& _rContext, const SdrPageWindow& _rWindow, FmXFormView* _pViewImpl ) : m_xControlContainer( _rWindow.GetControlContainer() ), m_aContext( _rContext ), m_pViewImpl( _pViewImpl ), m_pWindow( dynamic_cast< Window* >( &_rWindow.GetPaintWindow().GetOutputDevice() ) ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::FmXPageViewWinRec" ); - DBG_CTOR(FmXPageViewWinRec,NULL); + DBG_CTOR(FormViewPageWindowAdapter,NULL); // create an XFormController for every form FmFormPage* pFormPage = dynamic_cast< FmFormPage* >( _rWindow.GetPageView().GetPage() ); - DBG_ASSERT( pFormPage, "FmXPageViewWinRec::FmXPageViewWinRec: no FmFormPage found!" ); + DBG_ASSERT( pFormPage, "FormViewPageWindowAdapter::FormViewPageWindowAdapter: no FmFormPage found!" ); if ( pFormPage ) { try @@ -207,15 +206,14 @@ FmXPageViewWinRec::FmXPageViewWinRec( const ::comphelper::ComponentContext& _rCo } } // ----------------------------------------------------------------------------- -FmXPageViewWinRec::~FmXPageViewWinRec() +FormViewPageWindowAdapter::~FormViewPageWindowAdapter() { - DBG_DTOR(FmXPageViewWinRec,NULL); + DBG_DTOR(FormViewPageWindowAdapter,NULL); } //------------------------------------------------------------------ -void FmXPageViewWinRec::dispose() +void FormViewPageWindowAdapter::dispose() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::dispose" ); for ( ::std::vector< Reference< XFormController > >::const_iterator i = m_aControllerList.begin(); i != m_aControllerList.end(); ++i @@ -249,39 +247,34 @@ void FmXPageViewWinRec::dispose() //------------------------------------------------------------------------------ -sal_Bool SAL_CALL FmXPageViewWinRec::hasElements(void) throw( RuntimeException ) +sal_Bool SAL_CALL FormViewPageWindowAdapter::hasElements(void) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::hasElements" ); return getCount() != 0; } //------------------------------------------------------------------------------ -Type SAL_CALL FmXPageViewWinRec::getElementType(void) throw( RuntimeException ) +Type SAL_CALL FormViewPageWindowAdapter::getElementType(void) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::getElementType" ); return ::getCppuType((const Reference< XFormController>*)0); } // XEnumerationAccess //------------------------------------------------------------------------------ -Reference< XEnumeration > SAL_CALL FmXPageViewWinRec::createEnumeration(void) throw( RuntimeException ) +Reference< XEnumeration > SAL_CALL FormViewPageWindowAdapter::createEnumeration(void) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::createEnumeration" ); return new ::comphelper::OEnumerationByIndex(this); } // XIndexAccess //------------------------------------------------------------------------------ -sal_Int32 SAL_CALL FmXPageViewWinRec::getCount(void) throw( RuntimeException ) +sal_Int32 SAL_CALL FormViewPageWindowAdapter::getCount(void) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::getCount" ); return m_aControllerList.size(); } //------------------------------------------------------------------------------ -Any SAL_CALL FmXPageViewWinRec::getByIndex(sal_Int32 nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) +Any SAL_CALL FormViewPageWindowAdapter::getByIndex(sal_Int32 nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::getByIndex" ); if (nIndex < 0 || nIndex >= getCount()) throw IndexOutOfBoundsException(); @@ -292,7 +285,7 @@ Any SAL_CALL FmXPageViewWinRec::getByIndex(sal_Int32 nIndex) throw( IndexOutOfBo } //------------------------------------------------------------------------ -void SAL_CALL FmXPageViewWinRec::makeVisible( const Reference< XControl >& _Control ) throw (RuntimeException) +void SAL_CALL FormViewPageWindowAdapter::makeVisible( const Reference< XControl >& _Control ) throw (RuntimeException) { ::vos::OGuard aSolarGuard(Application::GetSolarMutex()); @@ -331,9 +324,8 @@ Reference< XFormController > getControllerSearchChilds( const Reference< XIndex // Search the according controller //------------------------------------------------------------------------ -Reference< XFormController > FmXPageViewWinRec::getController( const Reference< XForm > & xForm ) const +Reference< XFormController > FormViewPageWindowAdapter::getController( const Reference< XForm > & xForm ) const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::getController" ); Reference< XTabControllerModel > xModel(xForm, UNO_QUERY); for (::std::vector< Reference< XFormController > >::const_iterator i = m_aControllerList.begin(); i != m_aControllerList.end(); i++) @@ -350,9 +342,9 @@ Reference< XFormController > FmXPageViewWinRec::getController( const Reference< } //------------------------------------------------------------------------ -void FmXPageViewWinRec::setController(const Reference< XForm > & xForm, const Reference< XFormController >& _rxParentController ) +void FormViewPageWindowAdapter::setController(const Reference< XForm > & xForm, const Reference< XFormController >& _rxParentController ) { - DBG_ASSERT( xForm.is(), "FmXPageViewWinRec::setController: there should be a form!" ); + DBG_ASSERT( xForm.is(), "FormViewPageWindowAdapter::setController: there should be a form!" ); Reference< XIndexAccess > xFormCps(xForm, UNO_QUERY); if (!xFormCps.is()) return; @@ -410,10 +402,9 @@ void FmXPageViewWinRec::setController(const Reference< XForm > & xForm, const Re } //------------------------------------------------------------------------ -void FmXPageViewWinRec::updateTabOrder( const Reference< XForm >& _rxForm ) +void FormViewPageWindowAdapter::updateTabOrder( const Reference< XForm >& _rxForm ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXPageViewWinRec::updateTabOrder" ); - OSL_PRECOND( _rxForm.is(), "FmXPageViewWinRec::updateTabOrder: illegal argument!" ); + OSL_PRECOND( _rxForm.is(), "FormViewPageWindowAdapter::updateTabOrder: illegal argument!" ); if ( !_rxForm.is() ) return; @@ -457,13 +448,11 @@ FmXFormView::FmXFormView(const ::comphelper::ComponentContext& _rContext, FmForm ,m_bFirstActivation( true ) ,m_isTabOrderUpdateSuspended( false ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::FmXFormView" ); } //------------------------------------------------------------------------ void FmXFormView::cancelEvents() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::cancelEvents" ); if ( m_nActivationEvent ) { Application::RemoveUserEvent( m_nActivationEvent ); @@ -492,7 +481,6 @@ void FmXFormView::cancelEvents() //------------------------------------------------------------------------ void FmXFormView::notifyViewDying( ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::notifyViewDying" ); DBG_ASSERT( m_pView, "FmXFormView::notifyViewDying: my view already died!" ); m_pView = NULL; cancelEvents(); @@ -501,7 +489,17 @@ void FmXFormView::notifyViewDying( ) //------------------------------------------------------------------------ FmXFormView::~FmXFormView() { - DBG_ASSERT(m_aWinList.size() == 0, "FmXFormView::~FmXFormView: Window list not empty!"); + DBG_ASSERT( m_aPageWindowAdapters.empty(), "FmXFormView::~FmXFormView: Window list not empty!" ); + if ( !m_aPageWindowAdapters.empty() ) + { + for ( PageWindowAdapterList::const_iterator loop = m_aPageWindowAdapters.begin(); + loop != m_aPageWindowAdapters.end(); + ++loop + ) + { + (*loop)->dispose(); + } + } cancelEvents(); @@ -513,7 +511,6 @@ FmXFormView::~FmXFormView() //------------------------------------------------------------------------------ void SAL_CALL FmXFormView::disposing(const EventObject& Source) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::disposing" ); if ( m_xWindow.is() && Source.Source == m_xWindow ) removeGridWindowListening(); } @@ -522,7 +519,6 @@ void SAL_CALL FmXFormView::disposing(const EventObject& Source) throw( RuntimeEx //------------------------------------------------------------------------------ void SAL_CALL FmXFormView::formActivated(const EventObject& rEvent) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::formActivated" ); if ( m_pView && m_pView->GetFormShell() && m_pView->GetFormShell()->GetImpl() ) m_pView->GetFormShell()->GetImpl()->formActivated( rEvent ); } @@ -530,7 +526,6 @@ void SAL_CALL FmXFormView::formActivated(const EventObject& rEvent) throw( Runti //------------------------------------------------------------------------------ void SAL_CALL FmXFormView::formDeactivated(const EventObject& rEvent) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::formDeactivated" ); if ( m_pView && m_pView->GetFormShell() && m_pView->GetFormShell()->GetImpl() ) m_pView->GetFormShell()->GetImpl()->formDeactivated( rEvent ); } @@ -539,7 +534,6 @@ void SAL_CALL FmXFormView::formDeactivated(const EventObject& rEvent) throw( Run //------------------------------------------------------------------------------ void SAL_CALL FmXFormView::elementInserted(const ContainerEvent& evt) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::elementInserted" ); try { Reference< XControlContainer > xControlContainer( evt.Source, UNO_QUERY_THROW ); @@ -554,11 +548,9 @@ void SAL_CALL FmXFormView::elementInserted(const ContainerEvent& evt) throw( Run } else { - FmWinRecList::iterator pos = findWindow( xControlContainer ); - if ( pos != m_aWinList.end() ) - { - (*pos)->updateTabOrder( xForm ); - } + PFormViewPageWindowAdapter pAdapter = findWindow( xControlContainer ); + if ( pAdapter.is() ) + pAdapter->updateTabOrder( xForm ); } } catch( const Exception& ) @@ -570,92 +562,80 @@ void SAL_CALL FmXFormView::elementInserted(const ContainerEvent& evt) throw( Run //------------------------------------------------------------------------------ void SAL_CALL FmXFormView::elementReplaced(const ContainerEvent& evt) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::elementReplaced" ); elementInserted(evt); } //------------------------------------------------------------------------------ void SAL_CALL FmXFormView::elementRemoved(const ContainerEvent& /*evt*/) throw( RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::elementRemoved" ); } //------------------------------------------------------------------------------ -FmWinRecList::const_iterator FmXFormView::findWindow( const Reference< XControlContainer >& _rxCC ) const +PFormViewPageWindowAdapter FmXFormView::findWindow( const Reference< XControlContainer >& _rxCC ) const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::findWindow" ); - for (FmWinRecList::const_iterator i = m_aWinList.begin(); - i != m_aWinList.end(); i++) - { - if ( _rxCC == (*i)->getControlContainer() ) - return i; - } - return m_aWinList.end(); -} - -//------------------------------------------------------------------------------ -FmWinRecList::iterator FmXFormView::findWindow( const Reference< XControlContainer >& _rxCC ) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::findWindow" ); - for (FmWinRecList::iterator i = m_aWinList.begin(); - i != m_aWinList.end(); i++) + for ( PageWindowAdapterList::const_iterator i = m_aPageWindowAdapters.begin(); + i != m_aPageWindowAdapters.end(); + ++i + ) { if ( _rxCC == (*i)->getControlContainer() ) - return i; + return *i; } - return m_aWinList.end(); + return NULL; } //------------------------------------------------------------------------------ void FmXFormView::addWindow(const SdrPageWindow& rWindow) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::addWindow" ); FmFormPage* pFormPage = PTR_CAST( FmFormPage, rWindow.GetPageView().GetPage() ); if ( !pFormPage ) return; Reference< XControlContainer > xCC = rWindow.GetControlContainer(); - if ( xCC.is() && findWindow( xCC ) == m_aWinList.end()) + if ( xCC.is() + && ( !findWindow( xCC ).is() ) + ) { - FmXPageViewWinRec *pFmRec = new FmXPageViewWinRec( m_aContext, rWindow, this ); - pFmRec->acquire(); - - m_aWinList.push_back(pFmRec); + PFormViewPageWindowAdapter pAdapter = new FormViewPageWindowAdapter( m_aContext, rWindow, this ); + m_aPageWindowAdapters.push_back( pAdapter ); // Am ControlContainer horchen um Aenderungen mitzbekommen Reference< XContainer > xContainer( xCC, UNO_QUERY ); - if (xContainer.is()) - xContainer->addContainerListener(this); + if ( xContainer.is() ) + xContainer->addContainerListener( this ); } } //------------------------------------------------------------------------------ void FmXFormView::removeWindow( const Reference< XControlContainer >& _rxCC ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::removeWindow" ); // Wird gerufen, wenn // - in den Design-Modus geschaltet wird // - ein Window geloescht wird, waehrend man im Design-Modus ist // - der Control-Container fuer ein Window entfernt wird, waehrend // der aktive Modus eingeschaltet ist. - FmWinRecList::iterator i = findWindow( _rxCC ); - if (i != m_aWinList.end()) + + for ( PageWindowAdapterList::iterator i = m_aPageWindowAdapters.begin(); + i != m_aPageWindowAdapters.end(); + ++i + ) { - // Am ControlContainer horchen um Aenderungen mitzbekommen + if ( _rxCC != (*i)->getControlContainer() ) + continue; + Reference< XContainer > xContainer( _rxCC, UNO_QUERY ); - if (xContainer.is()) - xContainer->removeContainerListener(this); + if ( xContainer.is() ) + xContainer->removeContainerListener( this ); (*i)->dispose(); - (*i)->release(); - m_aWinList.erase(i); + m_aPageWindowAdapters.erase( i ); + break; } } //------------------------------------------------------------------------------ void FmXFormView::displayAsyncErrorMessage( const SQLErrorEvent& _rEvent ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::displayAsyncErrorMessage" ); DBG_ASSERT( 0 == m_nErrorMessageEvent, "FmXFormView::displayAsyncErrorMessage: not too fast, please!" ); // This should not happen - usually, the PostUserEvent is faster than any possible user // interaction which could trigger a new error. If it happens, we need a queue for the events. @@ -674,7 +654,6 @@ IMPL_LINK(FmXFormView, OnDelayedErrorMessage, void*, /*EMPTYTAG*/) //------------------------------------------------------------------------------ void FmXFormView::onFirstViewActivation( const FmFormModel* _pDocModel ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::onFirstViewActivation" ); if ( _pDocModel && _pDocModel->GetAutoControlFocus() ) m_nAutoFocusEvent = Application::PostUserEvent( LINK( this, FmXFormView, OnAutoFocus ) ); } @@ -682,7 +661,6 @@ void FmXFormView::onFirstViewActivation( const FmFormModel* _pDocModel ) //------------------------------------------------------------------------------ void FmXFormView::suspendTabOrderUpdate() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::suspendTabOrderUpdate" ); OSL_ENSURE( !m_isTabOrderUpdateSuspended, "FmXFormView::suspendTabOrderUpdate: nesting not allowed!" ); m_isTabOrderUpdateSuspended = true; } @@ -690,7 +668,6 @@ void FmXFormView::suspendTabOrderUpdate() //------------------------------------------------------------------------------ void FmXFormView::resumeTabOrderUpdate() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::resumeTabOrderUpdate" ); OSL_ENSURE( m_isTabOrderUpdateSuspended, "FmXFormView::resumeTabOrderUpdate: not suspended!" ); m_isTabOrderUpdateSuspended = false; @@ -700,8 +677,8 @@ void FmXFormView::resumeTabOrderUpdate() ++container ) { - FmWinRecList::iterator pos = findWindow( container->first ); - if ( pos == m_aWinList.end() ) + PFormViewPageWindowAdapter pAdapter = findWindow( container->first ); + if ( !pAdapter.is() ) continue; for ( SetOfForms::const_iterator form = container->second.begin(); @@ -709,7 +686,7 @@ void FmXFormView::resumeTabOrderUpdate() ++form ) { - (*pos)->updateTabOrder( *form ); + pAdapter->updateTabOrder( *form ); } } m_aNeedTabOrderUpdate.clear(); @@ -730,41 +707,42 @@ IMPL_LINK(FmXFormView, OnActivate, void*, /*EMPTYTAG*/) if (m_pView->GetFormShell() && m_pView->GetActualOutDev() && m_pView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW) { Window* pWindow = const_cast<Window*>(static_cast<const Window*>(m_pView->GetActualOutDev())); - FmXPageViewWinRec* pFmRec = m_aWinList.size() ? m_aWinList[0] : NULL; - for (FmWinRecList::const_iterator i = m_aWinList.begin(); - i != m_aWinList.end(); i++) + PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? NULL : m_aPageWindowAdapters[0]; + for ( PageWindowAdapterList::const_iterator i = m_aPageWindowAdapters.begin(); + i != m_aPageWindowAdapters.end(); + ++i + ) { - if (pWindow == (*i)->getWindow()) - pFmRec =*i; + if ( pWindow == (*i)->getWindow() ) + pAdapter =*i; } - if (pFmRec) + if ( pAdapter.get() ) { - for (::std::vector< Reference< XFormController > >::const_iterator i = pFmRec->GetList().begin(); - i != pFmRec->GetList().end(); i++) + for ( ::std::vector< Reference< XFormController > >::const_iterator i = pAdapter->GetList().begin(); + i != pAdapter->GetList().end(); + ++i + ) { const Reference< XFormController > & xController = *i; - if (xController.is()) + if ( !xController.is() ) + continue; + + // only database forms are to be activated + Reference< XRowSet > xForm(xController->getModel(), UNO_QUERY); + if ( !xForm.is() || !OStaticDataAccessTools().getRowSetConnection( xForm ).is() ) + continue; + + Reference< XPropertySet > xFormSet( xForm, UNO_QUERY ); + ENSURE_OR_CONTINUE( xFormSet.is(), "FmXFormView::OnActivate: a form which does not have properties?" ); + + const ::rtl::OUString aSource = ::comphelper::getString( xFormSet->getPropertyValue( FM_PROP_COMMAND ) ); + if ( aSource.getLength() ) { - // Nur bei Datenbankformularen erfolgt eine aktivierung - Reference< XRowSet > xForm(xController->getModel(), UNO_QUERY); - if (xForm.is() && OStaticDataAccessTools().getRowSetConnection(xForm).is()) - { - Reference< XPropertySet > xFormSet(xForm, UNO_QUERY); - if (xFormSet.is()) - { - // wenn es eine Datenquelle gibt, dann als aktive ::com::sun::star::form setzen - ::rtl::OUString aSource = ::comphelper::getString(xFormSet->getPropertyValue(FM_PROP_COMMAND)); - if (aSource.getLength()) - { - // benachrichtigung der Shell - FmXFormShell* pShImpl = m_pView->GetFormShell()->GetImpl(); - if (pShImpl) - pShImpl->setActiveController(xController); - break; - } - } - } + FmXFormShell* pShImpl = m_pView->GetFormShell()->GetImpl(); + if ( pShImpl ) + pShImpl->setActiveController( xController ); + break; } } } @@ -775,7 +753,6 @@ IMPL_LINK(FmXFormView, OnActivate, void*, /*EMPTYTAG*/) //------------------------------------------------------------------------------ void FmXFormView::Activate(sal_Bool bSync) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::Activate" ); if (m_nActivationEvent) { Application::RemoveUserEvent(m_nActivationEvent); @@ -793,7 +770,6 @@ void FmXFormView::Activate(sal_Bool bSync) //------------------------------------------------------------------------------ void FmXFormView::Deactivate(BOOL bDeactivateController) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::Deactivate" ); if (m_nActivationEvent) { Application::RemoveUserEvent(m_nActivationEvent); @@ -808,13 +784,11 @@ void FmXFormView::Deactivate(BOOL bDeactivateController) //------------------------------------------------------------------------------ FmFormShell* FmXFormView::GetFormShell() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::GetFormShell" ); return m_pView ? m_pView->GetFormShell() : NULL; } // ----------------------------------------------------------------------------- void FmXFormView::AutoFocus( sal_Bool _bSync ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::AutoFocus" ); if (m_nAutoFocusEvent) Application::RemoveUserEvent(m_nAutoFocusEvent); @@ -927,18 +901,20 @@ namespace // ----------------------------------------------------------------------------- Reference< XFormController > FmXFormView::getFormController( const Reference< XForm >& _rxForm, const OutputDevice& _rDevice ) const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::getFormController" ); Reference< XFormController > xController; - for ( FmWinRecList::const_iterator rec = m_aWinList.begin(); rec != m_aWinList.end(); ++rec ) + for ( PageWindowAdapterList::const_iterator pos = m_aPageWindowAdapters.begin(); + pos != m_aPageWindowAdapters.end(); + ++pos + ) { - const FmXPageViewWinRec* pViewWinRec( *rec ); - OSL_ENSURE( pViewWinRec, "FmXFormView::getFormController: invalid PageViewWinRec!" ); - if ( !pViewWinRec || ( pViewWinRec->getWindow() != &_rDevice ) ) + const PFormViewPageWindowAdapter pAdapter( *pos ); + ENSURE_OR_CONTINUE( pAdapter.get(), "FmXFormView::getFormController: invalid page window adapter!" ); + if ( pAdapter->getWindow() != &_rDevice ) // wrong device continue; - xController = pViewWinRec->getController( _rxForm ); + xController = pAdapter->getController( _rxForm ); if ( xController.is() ) break; } @@ -960,12 +936,10 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/) FmFormPage* pPage = m_pView ? PTR_CAST( FmFormPage, m_pView->GetSdrPageView()->GetPage() ) : NULL; Reference< XIndexAccess > xForms( pPage ? Reference< XIndexAccess >( pPage->GetForms(), UNO_QUERY ) : Reference< XIndexAccess >() ); - const FmXPageViewWinRec* pViewWinRec = m_aWinList.size() ? m_aWinList[0] : NULL; - const Window* pWindow = pViewWinRec ? pViewWinRec->getWindow() : NULL; + const PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? NULL : m_aPageWindowAdapters[0]; + const Window* pWindow = pAdapter.get() ? pAdapter->getWindow() : NULL; - OSL_ENSURE( xForms.is() && pWindow, "FmXFormView::OnAutoFocus: could not collect all essentials!" ); - if ( !xForms.is() || !pWindow ) - return 0L; + ENSURE_OR_RETURN( xForms.is() && pWindow, "FmXFormView::OnAutoFocus: could not collect all essentials!", 0L ); try { @@ -973,7 +947,7 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/) if ( !xForms->getCount() ) break; Reference< XForm > xForm( xForms->getByIndex( 0 ), UNO_QUERY_THROW ); - Reference< XTabController > xTabController( pViewWinRec->getController( xForm ), UNO_QUERY_THROW ); + Reference< XTabController > xTabController( pAdapter->getController( xForm ), UNO_QUERY_THROW ); // go for the first control of the controller Sequence< Reference< XControl > > aControls( xTabController->getControls() ); @@ -1024,7 +998,6 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/) // ----------------------------------------------------------------------------- void FmXFormView::onCreatedFormObject( FmFormObj& _rFormObject ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::onCreatedFormObject" ); FmFormShell* pShell = m_pView ? m_pView->GetFormShell() : NULL; FmXFormShell* pShellImpl = pShell ? pShell->GetImpl() : NULL; OSL_ENSURE( pShellImpl, "FmXFormView::onCreatedFormObject: no form shell!" ); @@ -1155,7 +1128,6 @@ namespace // ----------------------------------------------------------------------------- SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::implCreateFieldControl" ); // not if we're in design mode if ( !m_pView->IsDesignMode() ) return NULL; @@ -1387,7 +1359,6 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript // ----------------------------------------------------------------------------- SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::implCreateXFormsControl" ); // not if we're in design mode if ( !m_pView->IsDesignMode() ) return NULL; @@ -1523,7 +1494,6 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO const Reference< XDataSource >& _rxDataSource, const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rCommand, const sal_Int32 _nCommandType ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::createControlLabelPair" ); if ( !createControlLabelPair( m_aContext, _rOutDev, _nXOffsetMM, _nYOffsetMM, _rxField, _rxNumberFormats, _nControlObjectID, _rFieldPostfix, FmFormInventor, OBJ_FM_FIXEDTEXT, NULL, NULL, NULL, _rpLabel, _rpControl ) @@ -1551,7 +1521,6 @@ bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& const ::rtl::OUString& _rFieldPostfix, UINT32 _nInventor, UINT16 _nLabelObjectID, SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::createControlLabelPair" ); sal_Int32 nDataType = 0; ::rtl::OUString sFieldName; Any aFieldName; @@ -1717,7 +1686,6 @@ void FmXFormView::ObjectRemoveListener::Notify( SfxBroadcaster& /*rBC*/, const S //------------------------------------------------------------------------------ void FmXFormView::ObjectRemovedInAliveMode( const SdrObject* pObject ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::ObjectRemovedInAliveMode" ); // wenn das entfernte Objekt in meiner MarkList, die ich mir beim Umschalten in den Alive-Mode gemerkt habe, steht, // muss ich es jetzt da rausnehmen, da ich sonst beim Zurueckschalten versuche, die Markierung wieder zu setzen // (interesanterweise geht das nur bei gruppierten Objekten schief (beim Zugriff auf deren ObjList GPF), nicht bei einzelnen) @@ -1740,7 +1708,6 @@ void FmXFormView::ObjectRemovedInAliveMode( const SdrObject* pObject ) //------------------------------------------------------------------------------ void FmXFormView::stopMarkListWatching() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::stopMarkListWatching" ); if ( m_pWatchStoredList ) { m_pWatchStoredList->EndListeningAll(); @@ -1752,7 +1719,6 @@ void FmXFormView::stopMarkListWatching() //------------------------------------------------------------------------------ void FmXFormView::startMarkListWatching() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::startMarkListWatching" ); if ( !m_pWatchStoredList ) { m_pWatchStoredList = new ObjectRemoveListener( this ); @@ -1769,7 +1735,6 @@ void FmXFormView::startMarkListWatching() //------------------------------------------------------------------------------ void FmXFormView::saveMarkList( sal_Bool _bSmartUnmark ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::saveMarkList" ); if ( m_pView ) { m_aMark = m_pView->GetMarkedObjectList(); @@ -1828,7 +1793,6 @@ static sal_Bool lcl_hasObject( SdrObjListIter& rIter, SdrObject* pObj ) //------------------------------------------------------------------------------ void FmXFormView::restoreMarkList( SdrMarkList& _rRestoredMarkList ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::restoreMarkList" ); if ( !m_pView ) return; @@ -1916,7 +1880,6 @@ void FmXFormView::restoreMarkList( SdrMarkList& _rRestoredMarkList ) // ----------------------------------------------------------------------------- void SAL_CALL FmXFormView::focusGained( const FocusEvent& /*e*/ ) throw (RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::focusGained" ); if ( m_xWindow.is() && m_pView ) { m_pView->SetMoveOutside( TRUE, FmFormView::ImplAccess() ); @@ -1925,7 +1888,6 @@ void SAL_CALL FmXFormView::focusGained( const FocusEvent& /*e*/ ) throw (Runtime // ----------------------------------------------------------------------------- void SAL_CALL FmXFormView::focusLost( const FocusEvent& /*e*/ ) throw (RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::focusLost" ); // when switch the focus outside the office the mark didn't change // so we can not remove us as focus listener if ( m_xWindow.is() && m_pView ) @@ -1936,7 +1898,6 @@ void SAL_CALL FmXFormView::focusLost( const FocusEvent& /*e*/ ) throw (RuntimeEx // ----------------------------------------------------------------------------- void FmXFormView::removeGridWindowListening() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::removeGridWindowListening" ); if ( m_xWindow.is() ) { m_xWindow->removeFocusListener(this); @@ -1951,7 +1912,6 @@ void FmXFormView::removeGridWindowListening() // ----------------------------------------------------------------------------- DocumentType FmXFormView::impl_getDocumentType() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::impl_getDocumentType" ); if ( GetFormShell() && GetFormShell()->GetImpl() ) return GetFormShell()->GetImpl()->getDocumentType(); return eUnknownDocumentType; |