diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2010-03-23 11:58:14 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2010-03-23 11:58:14 +0100 |
commit | 19dcc11eb4ad63118ef1345cd2901763b126d34c (patch) | |
tree | 32a5f5f2b4cb0471021fafb0965a15d79318a640 /svx | |
parent | 1dfffc435b365edf9d621373e85879df6a16222f (diff) | |
parent | 9cb7d012fccf37c491ffcfa83ce795534e6ed475 (diff) |
CWS-TOOLING: integrate CWS autorecovery
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/globlmn_tmpl.hrc | 6 | ||||
-rw-r--r-- | svx/inc/pch/precompiled_svx.hxx | 1 | ||||
-rw-r--r-- | svx/inc/svx/unomodel.hxx | 12 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 25 | ||||
-rw-r--r-- | svx/source/dialog/hyprlink.cxx | 4 | ||||
-rw-r--r-- | svx/source/dialog/rubydialog.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/datanavi.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmPropBrw.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmobj.cxx | 15 | ||||
-rw-r--r-- | svx/source/form/fmshell.cxx | 11 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 477 | ||||
-rw-r--r-- | svx/source/form/fmstring.src | 4 | ||||
-rw-r--r-- | svx/source/form/formcontroller.cxx | 2 | ||||
-rw-r--r-- | svx/source/inc/fmresids.hrc | 2 | ||||
-rw-r--r-- | svx/source/inc/fmservs.hxx | 1 | ||||
-rw-r--r-- | svx/source/inc/fmshimp.hxx | 167 | ||||
-rw-r--r-- | svx/source/items/svxitems.src | 4 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbxcolor.cxx | 2 | ||||
-rw-r--r-- | svx/source/xml/xmlexport.cxx | 84 |
19 files changed, 49 insertions, 774 deletions
diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index f9ee36de1ab0..e328a39a0707 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -468,12 +468,6 @@ HelpID = SID_LOGOUT ; \ Text [ en-US ] = "Logout" ; \ -#define ITEM_FILE_BACKTOWEBTOP \ - Identifier = SID_BACKTOWEBTOP ; \ - Command = ".uno:BackToWebtop" ; \ - HelpID = SID_BACKTOWEBTOP ; \ - Text [ en-US ] = "Back to Webtop"; \ - #define ITEM_EDIT_UNDO \ Identifier = SID_UNDO ; \ Command = ".uno:UndoAction" ; \ diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index 235544f22f28..95ed1449c846 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -754,7 +754,6 @@ #include "svtools/apearcfg.hxx" #include "svl/brdcst.hxx" #include "unotools/cacheoptions.hxx" -#include "svl/cancel.hxx" #include "svl/cjkoptions.hxx" #include "unotools/cmdoptions.hxx" #include "svl/cntwall.hxx" diff --git a/svx/inc/svx/unomodel.hxx b/svx/inc/svx/unomodel.hxx index dd60be206c2e..35d53a655a86 100644 --- a/svx/inc/svx/unomodel.hxx +++ b/svx/inc/svx/unomodel.hxx @@ -99,12 +99,12 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); }; -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> xOut ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> xOut, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> xOut, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent, const char* pExportService ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent, const char* pImportService ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pExportService ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pImportService ); #endif diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 8c245a11862f..5f243b90067d 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -13165,31 +13165,6 @@ SfxVoidItem SpellCheckerChanged SID_SPELLCHECKER_CHANGED ] //-------------------------------------------------------------------------- -SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EXPLORER; -] - -//-------------------------------------------------------------------------- SfxUInt16Item Year2000 SID_ATTR_YEAR2000 () [ diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx index 117b3b3a9beb..c7c9f7a22939 100644 --- a/svx/source/dialog/hyprlink.cxx +++ b/svx/source/dialog/hyprlink.cxx @@ -482,7 +482,7 @@ void SvxHyperlinkDlg::TargetMenu(const String& rSelEntry, BOOL bExecute) if (pVwFrm) // Alle moeglichen Target Frames zusammensammeln und anzeigen { TargetList aList; - pVwFrm->GetTopFrame()->GetTargetList(aList); + pVwFrm->GetTopFrame().GetTargetList(aList); USHORT nCount = (USHORT)aList.Count(); if( nCount ) @@ -960,7 +960,7 @@ void SvxHyperlinkDlg::OpenDoc( const String& rURL, SfxViewFrame* pViewFrame ) if ( pViewFrame ) { - SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? pViewFrame->GetFrame() : NULL ); + SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? &pViewFrame->GetFrame() : NULL ); if ( pDisp ) pDisp->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aName, &aView, &aNewView, &aSilent, &aReadOnly, &aReferer, &aExternal, 0L ); diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index f2cabe5fa4e1..5a5839443170 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -321,7 +321,7 @@ void SvxRubyDialog::Activate() aStylistPB.Enable(bEnable); //get selection from current view frame SfxViewFrame* pCurFrm = SfxViewFrame::Current(); - Reference< XController > xCtrl = pCurFrm->GetFrame()->GetController(); + Reference< XController > xCtrl = pCurFrm->GetFrame().GetController(); pImpl->SetController(xCtrl); if(pImpl->HasSelectionChanged()) { diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 0db7b43afb47..e22ee66e0ea2 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1608,7 +1608,7 @@ namespace svxform DBG_ASSERT( pBindings != NULL, "DataNavigatorWindow::LoadModels(): no SfxBindings; can't get frame" ); m_xFrame = Reference<XFrame>( - pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), + pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" ); // add frameaction listener diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index 5e4f30bd7c83..bcc275896410 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -245,7 +245,7 @@ FmPropBrw::FmPropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBinding if ( _pBindings->GetDispatcher() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier > - xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); // if ( xSupp.is() ) // xSupp->getFrames()->append( m_xMeAsFrame ); // Don't append frame to frame hierachy to prevent UI_DEACTIVATE messages diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 6a62340b04a6..e679779887a2 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -516,7 +516,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > while (nCurrentSourceIndex <= nIndex) { sal_Bool bEqualDSS = sal_False; - while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bounded by nIndex) + while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bound by nIndex) { xSourceContainer->getByIndex(nCurrentSourceIndex) >>= xCurrentSourceForm; DBG_ASSERT(xCurrentSourceForm.is(), "FmFormObj::ensureModelEnv : invalid form ancestor (2) !"); @@ -578,12 +578,11 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > // correct this ... try { - Reference< XPersistObject > xSourcePersist(xCurrentSourceForm, UNO_QUERY); - DBG_ASSERT(xSourcePersist.is(), "FmFormObj::ensureModelEnv : invalid form (no persist object) !"); - - // create and insert (into the destination) a clone of the form - Reference< XCloneable > xCloneable( xSourcePersist, UNO_QUERY_THROW ); - xCurrentDestForm.set( xCloneable->createClone(), UNO_QUERY_THROW ); + // create and insert (into the destination) a copy of the form + xCurrentDestForm.set( + ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.form.component.DataForm" ) ), + UNO_QUERY_THROW ); + ::comphelper::copyProperties( xCurrentSourceForm, xCurrentDestForm ); DBG_ASSERT(nCurrentDestIndex == xDestContainer->getCount(), "FmFormObj::ensureModelEnv : something went wrong with the numbers !"); xDestContainer->insertByIndex(nCurrentDestIndex, makeAny(xCurrentDestForm)); @@ -601,7 +600,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > } } - // now xCurrentDestForm is a form aequivalent to xSourceForm (which means they have the same DSS and the same number + // now xCurrentDestForm is a form equivalent to xSourceForm (which means they have the same DSS and the same number // of left siblings with the same DSS, which counts for all their ancestors, too) // go down diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 1d22ae5e9516..f507068b6e2d 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -298,9 +298,6 @@ sal_uInt16 FmFormShell::PrepareClose(sal_Bool bUI, sal_Bool bForBrowsing) m_pFormView && m_pFormView->GetActualOutDev() && m_pFormView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW) { - if (GetImpl()->HasAnyPendingCursorAction()) - GetImpl()->CancelAnyPendingCursorAction(); - SdrPageView* pCurPageView = m_pFormView->GetSdrPageView(); // sal_uInt16 nPos = pCurPageView ? pCurPageView->GetWinList().Find((OutputDevice*)m_pFormView->GetActualOutDev()) : SDRPAGEVIEWWIN_NOTFOUND; @@ -1128,9 +1125,6 @@ void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich) || m_bDesignMode || !GetImpl()->getActiveForm().is() || GetImpl()->isInFilterMode() - || ( GetImpl()->HasPendingCursorAction(GetImpl()->getNavController()) - && (SID_FM_RECORD_TOTAL != nWhich) - ) ) rSet.DisableItem(nWhich); else @@ -1417,11 +1411,6 @@ void FmFormShell::SetDesignMode( sal_Bool _bDesignMode ) if ( _bDesignMode == m_bDesignMode ) return; - // if we are moving our data source cursor currently .... - if ( GetImpl()->HasAnyPendingCursorAction() ) - // ... cancel this - GetImpl()->CancelAnyPendingCursorAction(); - FmFormModel* pModel = GetFormModel(); if (pModel) // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 79def586af27..463749b68364 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -570,11 +570,6 @@ sal_Bool FmXBoundFormFieldIterator::ShouldHandleElement(const Reference< XInterf return aVal.hasValue(); } -//============================================================================== - -DECL_CURSOR_ACTION_THREAD(FmMoveToLastThread) -IMPL_CURSOR_ACTION_THREAD(FmMoveToLastThread, SVX_RES(RID_STR_MOVING_CURSOR), last()); - //------------------------------------------------------------------------------ sal_Bool isControlList(const SdrMarkList& rMarkList) { @@ -684,9 +679,8 @@ FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame ) m_aMarkTimer.SetTimeout(100); m_aMarkTimer.SetTimeoutHdl(LINK(this,FmXFormShell,OnTimeOut)); - SfxFrame* pFrame = _pViewFrame ? _pViewFrame->GetFrame() : NULL; - if ( pFrame ) - m_xAttachedFrame = pFrame->GetFrameInterface(); + if ( _pViewFrame ) + m_xAttachedFrame = _pViewFrame->GetFrame().GetFrameInterface(); // to prevent deletion of this we acquire our refcounter once ::comphelper::increment(FmXFormShell_BASE::m_refCount); @@ -988,8 +982,6 @@ void FmXFormShell::disposing() { ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); - if (HasAnyPendingCursorAction()) - CancelAnyPendingCursorAction(); aGuard.clear(); DBG_ASSERT(!m_nInvalidationEvent, "FmXFormShell::~FmXFormShell : still have an invalidation event !"); @@ -1982,10 +1974,6 @@ void FmXFormShell::setActiveController( const Reference< runtime::XFormControlle if (xController != m_xActiveController) { - // if there is a async cursor action running we have to restore the locking state of the controls of the old controller - if (HasPendingCursorAction(Reference< XResultSet>(m_xActiveForm, UNO_QUERY))) - restoreControlLocks(); - ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); // switch all nav dispatchers belonging to the form of the current nav controller to 'non active' Reference< XResultSet> xNavigationForm; @@ -2065,10 +2053,6 @@ void FmXFormShell::setActiveController( const Reference< runtime::XFormControlle if (m_xNavigationController.is()) xNavigationForm = Reference< XResultSet>(m_xNavigationController->getModel(), UNO_QUERY); - // if there is a async cursor action running we have to lock the controls of the new controller - if (HasPendingCursorAction(Reference< XResultSet>(m_xActiveForm, UNO_QUERY))) - setControlLocks(); - m_bInActivate = sal_False; m_pShell->UIFeatureChanged(); @@ -3313,312 +3297,6 @@ void FmXFormShell::clearFilter() } //------------------------------------------------------------------------------ -void FmXFormShell::setControlLocks() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::setControlLocks" ); - if ( impl_checkDisposed() ) - return; - - Reference< XTabController> xCtrler(getActiveController(), UNO_QUERY); - if (!xCtrler.is()) - return; - - Reference< XControlContainer> xControls(xCtrler->getContainer(), UNO_QUERY); - if (!xControls.is()) - return; - - DBG_ASSERT( m_aControlLocks.empty(), "FmXFormShell::setControlLocks: locking state array isn't empty (called me twice ?)!" ); - - Sequence< Reference< XControl> > aControls = xControls->getControls(); - const Reference< XControl>* pControls = aControls.getConstArray(); - - // iterate through all bound controls, remember the old locking state, set the lock - for (sal_Int32 i=0; i<aControls.getLength(); ++i) - { - Reference< XBoundControl> xCtrl(pControls[i], UNO_QUERY); - if (!xCtrl.is()) - { - // it may be a container of controls - Reference< XIndexAccess> xContainer(pControls[i], UNO_QUERY); - if (xContainer.is()) - { // no recursion. we only know top level control containers (e.g. grid controls) - for (sal_Int16 j=0; j<xContainer->getCount(); ++j) - { - xContainer->getByIndex(j) >>= xCtrl; - if (!xCtrl.is()) - continue; - - m_aControlLocks.push_back( xCtrl->getLock() ); - xCtrl->setLock(sal_True); - } - } - continue; - } - - m_aControlLocks.push_back( xCtrl->getLock() ); - xCtrl->setLock(sal_True); - } -} - -//------------------------------------------------------------------------------ -void FmXFormShell::restoreControlLocks() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::restoreControlLocks" ); - if ( impl_checkDisposed() ) - return; - - Reference< XTabController> xCtrler(getActiveController(), UNO_QUERY); - if (!xCtrler.is()) - return; - - Reference< XControlContainer> xControls(xCtrler->getContainer(), UNO_QUERY); - if (!xControls.is()) - return; - - Sequence< Reference< XControl> > aControls(xControls->getControls()); - const Reference< XControl>* pControls = aControls.getConstArray(); - - // iterate through all bound controls, restore the old locking state - size_t nBoundControl = 0; - for (sal_Int32 i=0; i<aControls.getLength(); ++i) - { - Reference< XBoundControl> xCtrl(pControls[i], UNO_QUERY); - if (!xCtrl.is()) - { - // it may be a container of controls - Reference< XIndexAccess> xContainer(pControls[i], UNO_QUERY); - if (xContainer.is()) - { // no recursion. we only know top level control containers (e.g. grid controls) - for (sal_Int16 j=0; j<xContainer->getCount(); ++j) - { - xContainer->getByIndex(j) >>= xCtrl; - if (!xCtrl.is()) - continue; - - DBG_ASSERT( nBoundControl < m_aControlLocks.size(), "FmXFormShell::restoreControlLocks: m_aControlLocks is invalid!" ); - xCtrl->setLock( m_aControlLocks[ nBoundControl ] ); - ++nBoundControl; - } - } - continue; - } - - DBG_ASSERT( nBoundControl < m_aControlLocks.size(), "FmXFormShell::restoreControlLocks: m_aControlLocks is invalid!" ); - // a violation of this condition would mean a) setControlLocks hasn't been called or b) the ControlContainer - // has changed since the last call to setControlLocks. - // a) clearly is a fault of the programmer and b) shouldn't be possible (as we are in alive mode) - xCtrl->setLock( m_aControlLocks[ nBoundControl ] ); - ++nBoundControl; - } - ::std::vector< sal_Bool > aEmpty; - m_aControlLocks.swap( aEmpty ); -} - -//------------------------------------------------------------------------------ -void FmXFormShell::DoAsyncCursorAction(const Reference< runtime::XFormController >& _xController, CURSOR_ACTION _eWhat) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::DoAsyncCursorAction" ); - if ( impl_checkDisposed() ) - return; - - DBG_ASSERT(_xController.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); - DoAsyncCursorAction(Reference< XResultSet>(_xController->getModel(), UNO_QUERY), _eWhat); -} - -//------------------------------------------------------------------------------ -void FmXFormShell::DoAsyncCursorAction(const Reference< XResultSet>& _xForm, CURSOR_ACTION _eWhat) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::DoAsyncCursorAction" ); - if ( impl_checkDisposed() ) - return; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - DBG_ASSERT(_xForm.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); - - // build the access path for the form - if (HasPendingCursorAction(_xForm)) - { - DBG_ERROR("FmXFormShell::DoAsyncCursorAction : invalid call !"); - return; - } - - CursorActionDescription& rDesc = m_aCursorActions[ _xForm ]; - // [] will create a new one if non-existent - DBG_ASSERT(rDesc.pThread == NULL, "FmXFormShell::DoAsyncCursorAction : the cursor action thread for this form is still alive !"); - - Reference< XResultSet > xCursor( getInternalForm( _xForm ), UNO_QUERY ); - switch (_eWhat) - { - case CA_MOVE_TO_LAST : - rDesc.pThread = new FmMoveToLastThread( xCursor ); - break; - case CA_MOVE_ABSOLUTE: - DBG_ERROR("FmXFormShell::DoAsyncCursorAction : CA_MOVE_ABSOLUTE not supported yet !"); - return; - } - rDesc.pThread->SetTerminationHdl(LINK(this, FmXFormShell, OnCursorActionDone)); - rDesc.pThread->EnableSelfDelete(sal_False); - - rDesc.bCanceling = sal_False; - - // set the control locks before starting the thread - DBG_ASSERT(getInternalForm(m_xActiveForm) == m_xActiveForm, "FmXFormShell::DoAsyncCursorAction : the active form should always be a internal one !"); - if (getInternalForm(_xForm) == m_xActiveForm) - setControlLocks(); - - // go ... - rDesc.pThread->create(); - - // set a priority slightly below normal - rDesc.pThread->setPriority(::vos::OThread::TPriority_BelowNormal); -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasPendingCursorAction(const Reference< XResultSet>& _xForm) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasPendingCursorAction" ); - if ( impl_checkDisposed() ) - return sal_False; - - if (!_xForm.is()) - return sal_False; - - // TODO: if we ever re-implement the asynchronous cursor actions, then this will happen - // in the controller, and not in the form. In such a case, we here probably need to check - // whether the controller for the form has this "pending cursor action" - - return sal_False; -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasPendingCursorAction(const Reference< runtime::XFormController >& xController) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasPendingCursorAction" ); - if ( impl_checkDisposed() ) - return sal_False; - - if (!xController.is()) - return sal_False; - - return HasPendingCursorAction(Reference< XResultSet>(xController->getModel(), UNO_QUERY)); -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasAnyPendingCursorAction() const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasAnyPendingCursorAction" ); - ::osl::MutexGuard aGuard( const_cast< FmXFormShell* >( this )->m_aAsyncSafety ); - - for ( CursorActions::const_iterator aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter ) - { - if (((*aIter).second.pThread != NULL) || ((*aIter).second.nFinishedEvent != 0)) - return sal_True; - } - return sal_False; -} - -//------------------------------------------------------------------------------ -void FmXFormShell::CancelAnyPendingCursorAction() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::CancelAnyPendingCursorAction" ); - if ( impl_checkDisposed() ) - return; - - ::osl::ResettableMutexGuard aGuard( m_aAsyncSafety ); - - CursorActions::iterator aIter; - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if (!(*aIter).second.nFinishedEvent && (*aIter).second.pThread) - { // the thread is really running - (*aIter).second.bCanceling = sal_True; - - aGuard.clear(); - (*aIter).second.pThread->StopItWait(); - // StopItWait returns after the termination handler (our OnCursorActionDone) has been called - aGuard.reset(); - } - } - - // all threads are finished (means canceled), now do the cleanup - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if ((*aIter).second.pThread) - { - LINK(this, FmXFormShell, OnCursorActionDoneMainThread).Call((*aIter).second.pThread); - DBG_ASSERT((*aIter).second.pThread == NULL, "FmXFormShell::CancelAnyPendingCursorAction : strange behaviour of OnCursorActionDoneMainThread !"); - } - } -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmXFormShell, OnCursorActionDone, FmCursorActionThread*, pThread) -{ - if ( impl_checkDisposed() ) - return 0L; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - - // search the pos of the thread within m_aCursorActions - CursorActions::iterator aIter; - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if ((*aIter).second.pThread == pThread) - break; - } - - DBG_ASSERT(aIter != m_aCursorActions.end(), "FmXFormShell::OnCursorActionDone : could not ::std::find the thread !"); - DBG_ASSERT((*aIter).second.nFinishedEvent == 0, "FmXFormShell::OnCursorActionDone : another 'ActionDone' for this thread is pending !"); - // as we allow only one async action at a time (per form) this shouldn't happen - - if (!(*aIter).second.bCanceling) - (*aIter).second.nFinishedEvent = Application::PostUserEvent(LINK(this, FmXFormShell, OnCursorActionDoneMainThread), pThread); - // if bCanceling is sal_True an other thread's execution is in CancelAnyPendingCursorAction - return 0L; -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmXFormShell, OnCursorActionDoneMainThread, FmCursorActionThread*, pThread) -{ - if ( impl_checkDisposed() ) - return 0L; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - - // search the pos of the thread within m_aCursorActions - CursorActions::iterator aIter = m_aCursorActions.find( pThread->getDataSource() ); - DBG_ASSERT(aIter != m_aCursorActions.end(), "FmXFormShell::OnCursorActionDoneMainThread : could not ::std::find the thread data !"); - DBG_ASSERT((*aIter).second.pThread == pThread, "FmXFormShell::OnCursorActionDoneMainThread : invalid thread data !"); - - // remember some thread parameters - Reference< XResultSet> xForm(pThread->getDataSource(), UNO_QUERY); - - // throw away the thread - delete (*aIter).second.pThread; - (*aIter).second.pThread = NULL; - (*aIter).second.nFinishedEvent = 0; - (*aIter).second.bCanceling = sal_False; - // as we allow exactly one thread per form we may remove this ones data from m_aCursorActions - m_aCursorActions.erase(aIter); - - DBG_ASSERT(getInternalForm(m_xActiveForm) == m_xActiveForm, "FmXFormShell::DoAsyncCursorAction : the active form should always be a internal one !"); - DBG_ASSERT(getInternalForm(xForm) == xForm, "FmXFormShell::DoAsyncCursorAction : the thread's form should always be a internal one !"); - // if one of the two asserts above fails the upcoming comparison is senseless - if (xForm == m_xActiveForm) - { - // the active controller belongs to the form where the action is finished - // -> re-enable the controls if they are not locked because of another running thread - if (!HasPendingCursorAction(xForm)) - restoreControlLocks(); - } - - m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(DatabaseSlotMap); - // it may not be neccessary but me thinks it's faster without the check if we really have to do this - - return 0L; -} - -//------------------------------------------------------------------------------ void FmXFormShell::CreateExternalView() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::CreateExternalView" ); @@ -4604,155 +4282,4 @@ void ControlConversionMenuController::StateChanged(sal_uInt16 nSID, SfxItemState } } -//================================================================== - -FmCursorActionThread::FmCursorActionThread(const Reference< XResultSet>& _xDataSource, const UniString& _rStopperCaption) - :m_xDataSource(_xDataSource) - ,m_sStopperCaption(_rStopperCaption) - ,m_bCanceled(sal_False) - ,m_bDeleteMyself(sal_False) - ,m_bDisposeCursor(sal_False) - ,m_bTerminated(sal_False) - ,m_bRunFailed(sal_False) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmCursorActionThread::FmCursorActionThread" ); - DBG_ASSERT(m_xDataSource.is() && Reference< XCancellable>(m_xDataSource, UNO_QUERY).is(), - "FmCursorActionThread::FmCursorActionThread : invalid cursor !"); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::run() -{ - // On instantiation of a SfxCancellable the application is notified and 'switches on' the red stop button. - // Unfortunally this is conditioned with the acquirement of the solar mutex, and the application tries - // only once and ignores the notification if it fails. - // To prevent that we get the solar mutex and _block_ 'til we got it. - // As we are in the 'top level execution' of this thread (with a rather small stack and no other mutexes locked) - // we shouldn't experience problems with deadlocks ... - ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex()); - ThreadStopper* pStopper = new ThreadStopper(this, m_sStopperCaption); - aSolarGuard.clear(); - - // we're not canceled yet - ::osl::ClearableMutexGuard aInitGuard(m_aAccessSafety); - m_bCanceled = sal_False; - m_bRunFailed = sal_False; - aInitGuard.clear(); - - // start it - try - { - RunImpl(); - } - catch(SQLException e) - { - ::osl::MutexGuard aErrorGuard(m_aAccessSafety); - m_bRunFailed = sal_True; - m_aRunException = e; - } - catch(Exception&) - { - DBG_ERROR("FmCursorActionThread::run : catched a non-database exception !"); - } - - - sal_Bool bReallyCanceled; - ::osl::ClearableMutexGuard aEvalGuard(m_aAccessSafety); - bReallyCanceled = m_bCanceled; - aEvalGuard.clear(); - - pStopper->OwnerTerminated(); - // this will cause the stopper to delete itself (in the main thread) so we don't have to care of the - // solar mutex -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::onTerminated() -{ - ::osl::ClearableMutexGuard aResetGuard(m_aAccessSafety); - if (m_aTerminationHandler.IsSet()) - m_aTerminationHandler.Call(this); - - if (IsCursorDisposeEnabled()) - { - Reference< ::com::sun::star::lang::XComponent> xDataSourceComponent(m_xDataSource, UNO_QUERY); - if (xDataSourceComponent.is()) - xDataSourceComponent->dispose(); - } - - aResetGuard.clear(); - // with this StopItWait has a chance to do it's Terminated() - - ::osl::MutexGuard aGuard(m_aFinalExitControl); - // Terminated() in StopItWait still returns sal_False - m_bTerminated = sal_True; - // Terminated() now returns sal_True, but StopItWait can't exit until this method exits (because of the guarded m_aFinalExitControl) - - if (IsSelfDeleteEnabled()) - delete this; -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::StopIt() -{ - ::osl::MutexGuard aGuard(m_aAccessSafety); - m_bCanceled = sal_True; - - Reference< XCancellable> xCancel(m_xDataSource, UNO_QUERY); - DBG_ASSERT(xCancel.is(), "FmCursorActionThread::StopIt : invalid cursor !"); - xCancel->cancel(); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::StopItWait() -{ - StopIt(); - - while (!Terminated()) - ; - - // OnTerminated has been called, but we can't simply exit : Suppose the caller want's to delete the thread object - // immediately after returning from StopItWait. With the following guard we ensure that we exit this method - // only after onTerminated has exited. - ::osl::ClearableMutexGuard aGuard(m_aFinalExitControl); - - // now onTerminated has exited, so we can leave, too -} - -//------------------------------------------------------------------------------ -FmCursorActionThread::ThreadStopper::ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle) - :SfxCancellable(SFX_APP()->GetCancelManager(), rTitle) - ,m_pOwner(pOwner) -{ -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::ThreadStopper::Cancel() -{ - if (!m_pOwner) // the owner is already terminated and we're waiting for the OnDeleteInMainThread event - return; - - ::osl::MutexGuard aGuard(m_pOwner->m_aAccessSafety); - if (IsCancelled()) - // we already did pass this to our owner - return; - - SfxCancellable::Cancel(); - m_pOwner->StopIt(); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::ThreadStopper::OwnerTerminated() -{ - m_pOwner = NULL; - Application::PostUserEvent(LINK(this, FmCursorActionThread::ThreadStopper, OnDeleteInMainThread), this); -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmCursorActionThread::ThreadStopper, OnDeleteInMainThread, FmCursorActionThread::ThreadStopper*, pThis) -{ - delete pThis; - return 0L; -} - //============================================================================== diff --git a/svx/source/form/fmstring.src b/svx/source/form/fmstring.src index 681f05219424..8e3df1a8cdf5 100644 --- a/svx/source/form/fmstring.src +++ b/svx/source/form/fmstring.src @@ -214,10 +214,6 @@ String RID_STR_PROPTITLE_FORMATTED { Text [ en-US ] = "Formatted Field"; }; -String RID_STR_MOVING_CURSOR -{ - Text [ en-US ] = "align data source"; -}; String RID_STR_PROPTITLE_LISTBOX { Text [ en-US ] = "List Box"; diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index affe5579d49d..b8292785b457 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -4254,7 +4254,7 @@ bool FormController::ensureInteractionHandler() return false; m_bAttemptedHandlerCreation = true; - m_xInteractionHandler.set( m_aContext.createComponent( (::rtl::OUString)SRV_SDB_INTERACTION_HANDLER ), UNO_QUERY ); + m_xInteractionHandler.set( m_aContext.createComponent( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY ); OSL_ENSURE( m_xInteractionHandler.is(), "FormController::ensureInteractionHandler: could not create an interaction handler!" ); return m_xInteractionHandler.is(); } diff --git a/svx/source/inc/fmresids.hrc b/svx/source/inc/fmresids.hrc index 2d8058bc45cc..f6843801e522 100644 --- a/svx/source/inc/fmresids.hrc +++ b/svx/source/inc/fmresids.hrc @@ -183,7 +183,7 @@ #define RID_STR_FILTER_FILTER_OR (RID_FORMS_START + 80) #define RID_STR_PROPTITLE_FORMATTED (RID_FORMS_START + 81) #define RID_STR_SYNTAXERROR (RID_FORMS_START + 82) -#define RID_STR_MOVING_CURSOR (RID_FORMS_START + 83) + // FREE #define RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY (RID_FORMS_START + 84) #define RID_STR_AUTOFIELD (RID_FORMS_START + 89) #define RID_STR_SVT_SQL_SYNTAX_ERROR (RID_FORMS_START + 90) diff --git a/svx/source/inc/fmservs.hxx b/svx/source/inc/fmservs.hxx index b06a57148979..d90774cea4ee 100644 --- a/svx/source/inc/fmservs.hxx +++ b/svx/source/inc/fmservs.hxx @@ -56,7 +56,6 @@ #define FM_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.GridControl" ) ) #define FM_FORM_CONTROLLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.runtime.FormController" ) ) #define SRV_SDB_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.Connection" ) ) -#define SRV_SDB_INTERACTION_HANDLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) #define FM_SUN_COMPONENT_FORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.Form" ) ) #define FM_SUN_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ) ) #define FM_SUN_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ListBox" ) ) diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index d88f891474be..3f89adb42626 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -68,7 +68,6 @@ #include "fmsrccfg.hxx" #include <osl/mutex.hxx> #include <vos/thread.hxx> -#include <svl/cancel.hxx> #include <tools/debug.hxx> #include <cppuhelper/component.hxx> #include <comphelper/stl_types.hxx> @@ -119,21 +118,6 @@ protected: virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rContainer) const; }; -//======================================================================== -// I would prefer this to be a struct local to FmXFormShell but unfortunately local structs/classes -// are somewhat difficult with some of our compilers -class FmCursorActionThread; -struct SAL_DLLPRIVATE CursorActionDescription -{ - FmCursorActionThread* pThread; - ULONG nFinishedEvent; - // we want to do the cleanup of the thread in the main thread so we post an event to ourself - sal_Bool bCanceling; - // this thread is being canceled - - CursorActionDescription() : pThread(NULL), nFinishedEvent(0), bCanceling(sal_False) { } -}; - class FmFormPage; //======================================================================== struct SAL_DLLPRIVATE FmLoadAction @@ -202,18 +186,6 @@ class SAL_DLLPRIVATE FmXFormShell :public FmXFormShell_BASE // we explicitly switch off the propbrw before leaving the design mode // this flag tells us if we have to switch it on again when reentering - typedef ::std::map< - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >, - CursorActionDescription, - ::comphelper::OInterfaceCompare< ::com::sun::star::sdbc::XResultSet > - > CursorActions; - CursorActions m_aCursorActions; - // all actions on async cursors - - ::std::vector< sal_Bool > - m_aControlLocks; - // while doing a async cursor action we have to lock all controls of the active controller. - // m_aControlLocks remembers the previous lock states to be restored afterwards. ::osl::Mutex m_aAsyncSafety; // secure the access to our thread related members ::osl::Mutex m_aInvalidationSafety; @@ -559,20 +531,7 @@ private: // --------------------------------------------------- // asyncronous cursor actions/navigation slot handling - void setControlLocks(); // lock all controls of the active controller - void restoreControlLocks(); // restore the lock state of all controls of the active controller - public: - enum CURSOR_ACTION { CA_MOVE_TO_LAST, CA_MOVE_ABSOLUTE }; - void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& _xController, CURSOR_ACTION _eWhat); - void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm, CURSOR_ACTION _eWhat); - - sal_Bool HasAnyPendingCursorAction() const; - void CancelAnyPendingCursorAction(); - - sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& _xController) const; - sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const; - /** execute the given form slot <p>Warning. Only a small set of slots implemented currently.</p> @param _nSlot @@ -585,9 +544,6 @@ public: bool IsFormSlotEnabled( sal_Int32 _nSlot, ::com::sun::star::form::runtime::FeatureState* _pCompleteState = NULL ); protected: - DECL_LINK(OnCursorActionDone, FmCursorActionThread*); - DECL_LINK(OnCursorActionDoneMainThread, FmCursorActionThread*); - DECL_LINK( OnLoadForms, FmFormPage* ); }; @@ -642,127 +598,4 @@ public: SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); }; -//================================================================== -// FmCursorActionThread -//================================================================== - -class SAL_DLLPRIVATE FmCursorActionThread : public ::vos::OThread -{ - Link m_aTerminationHandler; // the handler to be called upon termination - ::com::sun::star::sdbc::SQLException m_aRunException; // the database exception thrown by RunImpl - ::osl::Mutex m_aAccessSafety; // for securing the multi-thread access - ::osl::Mutex m_aFinalExitControl; // see StopItWait - -protected: - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xDataSource; // the cursor which we work with - -private: - - UniString m_sStopperCaption; // the caption for the ThreadStopper - sal_Bool m_bCanceled:1; // StopIt has been called ? - sal_Bool m_bDeleteMyself:1; // delete the thread upon termination (defaults to sal_False) ? - sal_Bool m_bDisposeCursor:1; // dispose the cursor upon termination (defaults to sal_False) ? - sal_Bool m_bTerminated:1; // onTerminated already called ? - sal_Bool m_bRunFailed:1; // a database execption occured in RunImpl ? - - // a ThreadStopper will be instantiated so that the open can be canceled via the UI - class ThreadStopper : protected SfxCancellable - { - FmCursorActionThread* m_pOwner; - - virtual ~ThreadStopper() { } - - public: - ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle); - - virtual void Cancel(); - - virtual void OwnerTerminated(); - // Normally the Owner (a FmCursorActionThread) would delete the stopper when terminated. - // Unfortunally the application doesn't remove the 'red light' when a SfxCancellable is deleted - // if it (the app) can't acquire the solar mutex. The deletion is IGNORED then. So we have make - // sure that a) the stopper is deleted from inside the main thread (where the solar mutex is locked) - // and b) that in the time between the termination of the thread and the deletion of the stopper - // the latter doesn't access the former. - // The OwnerTerminated cares for both aspects. - // SO DON'T DELETE THE STOPPER EXPLICITLY ! - - protected: - // HACK HACK HACK HACK HACK : this should be private, but MSVC doesn't accept the LINK-macro then .... - DECL_LINK(OnDeleteInMainThread, ThreadStopper*); - }; - friend class FmCursorActionThread::ThreadStopper; - - -public: - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getDataSource() const { return m_xDataSource; } - -private: - sal_Bool Terminated() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bTerminated; } - -public: - FmCursorActionThread(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource, const UniString& _rStopperCaption); - virtual ~FmCursorActionThread() {} - - // control of self-deletion - sal_Bool IsSelfDeleteEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDeleteMyself; } - void EnableSelfDelete(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDeleteMyself = bEnable; } - - // control of cursor-dipose - sal_Bool IsCursorDisposeEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDisposeCursor; } - void EnableCursorDispose(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDisposeCursor = bEnable; } - - // error-access - sal_Bool RunFailed() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bRunFailed; } - ::com::sun::star::sdbc::SQLException GetRunException() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_aRunException; } - - /// the excution (within the method "run") was canceled ? - sal_Bool WasCanceled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bCanceled; } - - /// the handler will be called synchronously (the parameter is a pointer to the thread) - void SetTerminationHdl(const Link& aTermHdl) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_aTerminationHandler = aTermHdl; } - - /// cancels the process. returns to the caller immediately. to be called from another thread (of course ;) - void StopIt(); - - /// cancels the process. does not return to the caller until the thread is terminated. - void StopItWait(); - -protected: - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - /// called from within run. run itself handles (de)initialisation of the cancel handling. - virtual void RunImpl() = 0; -}; - -//------------------------------------------------------------------------------ - -#define DECL_CURSOR_ACTION_THREAD(classname) \ - \ -class SAL_DLLPRIVATE classname : public FmCursorActionThread \ -{ \ -public: \ - classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource); \ -protected: \ - virtual void RunImpl(); \ -}; \ - - -//------------------------------------------------------------------------------ - -#define IMPL_CURSOR_ACTION_THREAD(classname, caption, action) \ - \ -classname::classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource) \ - :FmCursorActionThread(_xDataSource, caption) \ -{ \ -} \ - \ -void classname::RunImpl() \ -{ \ - m_xDataSource->action; \ -} \ - - - #endif // _SVX_FMSHIMP_HXX diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src index 5faaf1cb31f0..e21ea8fc6e4b 100644 --- a/svx/source/items/svxitems.src +++ b/svx/source/items/svxitems.src @@ -26,8 +26,8 @@ ************************************************************************/ // include ------------------------------------------------------------------ -#include <svx/svxitems.hrc> -#include <svx/svxids.hrc> +#include "svx/svxitems.hrc" +#include "svx/svxids.hrc" #include <editeng/editids.hrc> StringArray RID_ATTR_NAMES diff --git a/svx/source/tbxctrls/tbxcolor.cxx b/svx/source/tbxctrls/tbxcolor.cxx index 072d56e0f772..57d791f1babd 100644 --- a/svx/source/tbxctrls/tbxcolor.cxx +++ b/svx/source/tbxctrls/tbxcolor.cxx @@ -62,7 +62,7 @@ namespace svx { try { - Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame()->GetFrameInterface(); + Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY ); if ( xFrameProps.is() ) xFrameProps->getPropertyValue( PROPNAME_LAYOUTMANAGER ) >>= m_xLayouter; diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx index e39b3a82b017..55a80ec40d89 100644 --- a/svx/source/xml/xmlexport.cxx +++ b/svx/source/xml/xmlexport.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <com/sun/star/xml/sax/InputSource.hpp> #include <com/sun/star/xml/sax/XParser.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -52,12 +53,12 @@ using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStream> xOut, Reference< lang::XComponent > xComponent ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut, const Reference< lang::XComponent >& xComponent ) { return SvxDrawingLayerExport( pModel, xOut, xComponent, "com.sun.star.comp.DrawingLayer.XMLExporter" ); } -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStream> xOut, Reference< lang::XComponent > xComponent, const char* pExportService ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut, const Reference< lang::XComponent >& xComponent, const char* pExportService ) { sal_Bool bDocRet = xOut.is(); @@ -67,12 +68,13 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre Reference< document::XEmbeddedObjectResolver > xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; + Reference< lang::XComponent > xSourceDoc( xComponent ); try { - if( !xComponent.is() ) + if( !xSourceDoc.is() ) { - xComponent = new SvxUnoDrawingModel( pModel ); - pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); + xSourceDoc = new SvxUnoDrawingModel( pModel ); + pModel->setUnoModel( Reference< XInterface >::query( xSourceDoc ) ); } uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); @@ -127,7 +129,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY ); if( xExporter.is() ) { - xExporter->setSourceDocument( xComponent ); + xExporter->setSourceDocument( xSourceDoc ); uno::Sequence< beans::PropertyValue > aDescriptor( 0 ); bDocRet = xFilter->filter( aDescriptor ); @@ -138,11 +140,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre } catch(uno::Exception e) { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "uno Exception caught while exporting:\n" ); - aError += ByteString( String( e.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#endif + DBG_UNHANDLED_EXCEPTION(); bDocRet = sal_False; } @@ -157,7 +155,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre return bDocRet; } -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStream> xOut ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut ) { Reference< lang::XComponent > xComponent; return SvxDrawingLayerExport( pModel, xOut, xComponent ); @@ -165,12 +163,12 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre //-//////////////////////////////////////////////////////////////////// -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStream> xInputStream, Reference< lang::XComponent > xComponent ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream, const Reference< lang::XComponent >& xComponent ) { return SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Draw.XMLOasisImporter" ); } -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStream> xInputStream, Reference< lang::XComponent > xComponent, const char* pImportService ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream, const Reference< lang::XComponent >& xComponent, const char* pImportService ) { sal_uInt32 nRet = 0; @@ -180,13 +178,14 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea Reference< document::XEmbeddedObjectResolver > xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; - if( !xComponent.is() ) + Reference< lang::XComponent > xTargetDocument( xComponent ); + if( !xTargetDocument.is() ) { - xComponent = new SvxUnoDrawingModel( pModel ); - pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); + xTargetDocument = new SvxUnoDrawingModel( pModel ); + pModel->setUnoModel( Reference< XInterface >::query( xTargetDocument ) ); } - Reference< frame::XModel > xModel( xComponent, UNO_QUERY ); + Reference< frame::XModel > xTargetModel( xTargetDocument, UNO_QUERY ); try { @@ -199,7 +198,8 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea if( 0 == nRet ) { - xModel->lockControllers(); + if ( xTargetModel.is() ) + xTargetModel->lockControllers(); // ------------------------------------- @@ -248,7 +248,7 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea // connect model and filter uno::Reference < document::XImporter > xImporter( xFilter, UNO_QUERY ); - xImporter->setTargetDocument( xComponent ); + xImporter->setTargetDocument( xTargetDocument ); // finally, parser the stream xParser->parseStream( aParserInput ); @@ -257,45 +257,9 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea } } } - catch( xml::sax::SAXParseException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "SAX parse exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } - catch( xml::sax::SAXException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "SAX exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } - catch( io::IOException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "IO exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } catch( uno::Exception& r ) { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "uno exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif + DBG_UNHANDLED_EXCEPTION(); } if( pGraphicHelper ) @@ -306,13 +270,13 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper ); xObjectResolver = 0; - if( xModel.is() ) - xModel->unlockControllers(); + if ( xTargetModel.is() ) + xTargetModel->unlockControllers(); return nRet == 0; } -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStream> xInputStream ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream ) { Reference< lang::XComponent > xComponent; return SvxDrawingLayerImport( pModel, xInputStream, xComponent ); |