diff options
Diffstat (limited to 'sw/source/ui')
50 files changed, 305 insertions, 539 deletions
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index df6e9af0eca3..91e4dc5bc61a 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <tools/urlobj.hxx> @@ -71,9 +72,7 @@ #include <srcview.hxx> #include <wrtsh.hxx> #include <docsh.hxx> -#ifndef _CMDID_H #include <cmdid.h> // Funktion-Ids -#endif #include <initui.hxx> #include <uitool.hxx> #include <swmodule.hxx> @@ -83,13 +82,12 @@ #include <gloslst.hxx> // SwGlossaryList #include <glosdoc.hxx> // SwGlossaryList #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cfgitems.hxx> #include <prtopt.hxx> #include <modcfg.hxx> #include <globals.h> // globale Konstanten z.B. -#ifndef _APP_HRC #include <app.hrc> -#endif #include <fontcfg.hxx> #include <barcfg.hxx> #include <uinums.hxx> @@ -802,22 +800,18 @@ void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal } else if( pBrdCst == pUndoOptions ) { - const int nNew = GetUndoOptions().GetUndoCount(); - const int nOld = SwEditShell::GetUndoActionCount(); - if(!nNew || !nOld) + sal_Int32 const nNew = GetUndoOptions().GetUndoCount(); + bool const bUndo = (nNew != 0); + // switch Undo for all DocShells + TypeId aType(TYPE(SwDocShell)); + SwDocShell * pDocShell = + static_cast<SwDocShell *>(SfxObjectShell::GetFirst(&aType)); + while (pDocShell) { - sal_Bool bUndo = nNew != 0; - //ueber DocShells iterieren und Undo umschalten - - TypeId aType(TYPE(SwDocShell)); - SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType); - while( pDocShell ) - { - pDocShell->GetDoc()->DoUndo( bUndo ); - pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType); - } + pDocShell->GetDoc()->GetIDocumentUndoRedo().DoUndo(bUndo); + pDocShell = static_cast<SwDocShell *>( + SfxObjectShell::GetNext(*pDocShell, &aType)); } - SwEditShell::SetUndoActionCount( static_cast< sal_uInt16 >(nNew)); } else if ( pBrdCst == pColorConfig || pBrdCst == pAccessibilityOptions ) { diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx index 5f2697405cb3..ca39c1330790 100644 --- a/sw/source/ui/app/appopt.cxx +++ b/sw/source/ui/app/appopt.cxx @@ -246,8 +246,8 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) /*-----------------01.02.97 13.02------------------- Optionen fuer PrintTabPage --------------------------------------------------*/ - SwPrintData* pOpt = pAppView ? - pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() : + const SwPrintData* pOpt = pAppView ? + &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() : 0; if(!pOpt) diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 4143f316dd05..f7bb6f4703cb 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -81,6 +81,7 @@ #include <shellio.hxx> // I/O #include <docstyle.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docstat.hxx> #include <pagedesc.hxx> #include <pview.hxx> @@ -494,7 +495,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) // Modified-Flag merken und erhalten ohne den Link zu Callen // (fuer OLE; nach Anweisung von MM) sal_Bool bIsModified = pDoc->IsModified(); - SwUndoNoModifiedPosition aOldPos = pDoc->getUndoNoModifiedPosition(); + pDoc->GetIDocumentUndoRedo().LockUndoNoModifiedPosition(); Link aOldOLELnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); @@ -521,7 +522,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) if( bIsModified ) { pDoc->SetModified(); - pDoc->setUndoNoModifiedPosition( aOldPos ); + pDoc->GetIDocumentUndoRedo().UnLockUndoNoModifiedPosition(); } pDoc->SetOle2Link( aOldOLELnk ); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index e4b5b6ab3700..8963a837389c 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -44,9 +44,7 @@ #include <svl/zformat.hxx> #include <unotools/pathoptions.hxx> #include <svtools/transfer.hxx> -#ifndef _SFXSIDS_HRC //autogen #include <sfx2/dialogs.hrc> -#endif #include <sfx2/dinfdlg.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> @@ -57,9 +55,7 @@ #include <svtools/sfxecode.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> -#ifndef _SVX_SVXIDS_HRC //autogen #include <svx/svxids.hrc> -#endif #include <svx/drawitem.hxx> #include <editeng/svxacorr.hxx> #include <editeng/langitem.hxx> @@ -86,6 +82,7 @@ #include <redlndlg.hxx> #include <docstyle.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagedesc.hxx> #include <shellio.hxx> #include <pview.hxx> @@ -103,15 +100,9 @@ #include <cmdid.h> #include <globals.h> #include <helpid.h> -#ifndef _APP_HRC #include <app.hrc> -#endif -#ifndef _POOLFMT_HRC #include <poolfmt.hrc> -#endif -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> @@ -342,8 +333,7 @@ sal_Bool SwDocShell::Insert( SfxObjectShell &rSource, // --> OD 2005-05-10 #i48949# - actions aren't undoable. Thus, allow no undo // actions // Note: The undo action stack is cleared at the end of this method. - bool bDoesUndo( GetDoc()->DoesUndo() ); - GetDoc()->DoUndo( sal_False ); + ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo()); // <-- sal_Bool bRet = sal_False; @@ -542,11 +532,10 @@ sal_Bool SwDocShell::Insert( SfxObjectShell &rSource, // --> OD 2005-05-10 #i48949# - actions aren't undoable and could have change // the document node array. Thus, clear the undo action stack. - if ( bDoesUndo ) + if (undoGuard.UndoWasEnabled()) { - GetDoc()->DelAllUndoObj(); + GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); } - GetDoc()->DoUndo( bDoesUndo ); // <-- return bRet; @@ -947,12 +936,11 @@ void SwDocShell::Execute(SfxRequest& rReq) aTempFile.EnableKillingFile(); pSrcView->SaveContent(aTempFile.GetURL()); bDone = sal_True; - SfxEventConfiguration* pEvent = SFX_APP()->GetEventConfig(); SvxMacro aMac(aEmptyStr, aEmptyStr, STARBASIC); - pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this); - pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this); - pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this); - pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this); + SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this); + SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this); + SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this); + SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this); ReloadFromHtml(aTempFile.GetURL(), pSrcView); nSlot = 0; } @@ -1637,7 +1625,9 @@ void SwDocShell::SetModified( sal_Bool bSet ) sal_Bool bOld = pDoc->IsModified(); pDoc->SetModified(); if( !bOld ) - pDoc->SetUndoNoResetModified(); + { + pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } } else pDoc->ResetModified(); @@ -1697,9 +1687,6 @@ void SwDocShell::ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView ClearHeaderAttributesForSourceViewHack(); // MIB 24.07.97: Das Dokument-Basic muss auch noch d'ran glauben ... - // Ein EnterBasicCall braucht man hier nicht, weil man nichts ruft und - // in HTML-Dokument kein Dok-Basic vorhanden sein kann, das noch nicht - // geladen wurde. SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get(); //#59620# HasBasic() zeigt an, dass es schon einen BasicManager an der DocShell // gibt. Der wurde im HTML-Import immer angelegt, wenn Macros im Quelltext diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index 5740300d3e66..2e38cde62c52 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -52,7 +53,8 @@ #include <fchrfmt.hxx> #include <svtools/htmlcfg.hxx> #include <SwStyleNameMapper.hxx> -#include <undobj.hxx> +#include <SwRewriter.hxx> +#include <numrule.hxx> #include <swundo.hxx> #include "view.hxx" @@ -62,7 +64,8 @@ #include "cmdid.h" #include "globals.hrc" #include "viewopt.hxx" -#include "doc.hxx" +#include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include "swstyle.h" #include "frmfmt.hxx" #include "charfmt.hxx" @@ -751,7 +754,9 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn pDoc->SetModified(); if( !bModified ) // Bug 57028 - pDoc->SetUndoNoResetModified(); + { + pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } GetWrtShell()->EndAllAction(); } @@ -761,8 +766,8 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn { // #116530# //pBasePool->Erase( &aTmp ); - GetWrtShell()->Undo(UNDO_EMPTY, 1); - pDoc->ClearRedo(); + GetWrtShell()->Undo(1); + pDoc->GetIDocumentUndoRedo().ClearRedo(); } if( !bModified ) @@ -814,7 +819,9 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn pDoc->SetModified(); if( !bModified ) // Bug 57028 - pDoc->SetUndoNoResetModified(); + { + pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } GetWrtShell()->EndAllAction(); } @@ -1003,7 +1010,7 @@ sal_uInt16 SwDocShell::UpdateStyle(const String &rName, sal_uInt16 nFamily, SwWr // Vorlage auch anwenden, um harte Attributierung // zu entfernen GetWrtShell()->SetTxtFmtColl( pColl ); - GetWrtShell()->EndUndo(UNDO_INSFMTATTR, NULL); + GetWrtShell()->EndUndo(); GetWrtShell()->EndAllAction(); } break; @@ -1200,7 +1207,7 @@ sal_uInt16 SwDocShell::MakeByExample( const String &rName, sal_uInt16 nFamily, rDest.SetPoolHlpFileId( nHFId ); // werden Kopf-/Fusszeilen angelegt, so gibt es kein Undo mehr! - pCurrWrtShell->GetDoc()->DelAllUndoObj(); + pCurrWrtShell->GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); pCurrWrtShell->EndAllAction(); } @@ -1274,7 +1281,7 @@ void SwDocShell::_LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrent { // die View wird spaeter angelegt, ueberschreibt aber das // Modify-Flag. Per Undo ist sowieso nichts mehr zu machen - pDoc->SetUndoNoResetModified(); + pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); } } } diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index cc7792038f32..71a52cb582f5 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -54,6 +54,7 @@ #include <docary.hxx> #include <ccoll.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cmdid.h> #include <swstyle.h> #include <app.hrc> @@ -68,7 +69,6 @@ #include <svx/svxids.hrc> // --> OD 2008-02-12 #newlistlevelattrs# #include <SwRewriter.hxx> -#include <undobj.hxx> // <-- // MD 06.02.95: Die Formatnamen in der Liste aller Namen haben als @@ -844,11 +844,11 @@ sal_Bool SwDocStyleSheet::SetName( const String& rStr) String aOldName(aPageDesc.GetName()); aPageDesc.SetName( rStr ); - sal_Bool bDoesUndo = rDoc.DoesUndo(); + bool const bDoesUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); - rDoc.DoUndo(aOldName.Len() > 0); + rDoc.GetIDocumentUndoRedo().DoUndo(aOldName.Len() > 0); rDoc.ChgPageDesc(aOldName, aPageDesc); - rDoc.DoUndo(bDoesUndo); + rDoc.GetIDocumentUndoRedo().DoUndo(bDoesUndo); // <- #116530# rDoc.SetModified(); @@ -1140,11 +1140,11 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, ASSERT( &rSet != &aCoreSet, "SetItemSet mit eigenem Set ist nicht erlaubt" ); // --> OD 2008-02-12 #newlistlevelattrs# - if ( rDoc.DoesUndo() ) + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) { SwRewriter aRewriter; aRewriter.AddRule( UNDO_ARG1, GetName() ); - rDoc.StartUndo( UNDO_INSFMTATTR, &aRewriter ); + rDoc.GetIDocumentUndoRedo().StartUndo( UNDO_INSFMTATTR, &aRewriter ); } // <-- @@ -1310,10 +1310,8 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, pNewDsc = new SwPageDesc( *pDesc ); // --> OD 2005-05-09 #i48949# - no undo actions for the // copy of the page style - const sal_Bool bDoesUndo( rDoc.DoesUndo() ); - rDoc.DoUndo( sal_False ); + ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo()); rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983# - rDoc.DoUndo( bDoesUndo ); // <-- pFmt = &pNewDsc->GetMaster(); @@ -1409,9 +1407,9 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, } // --> OD 2008-02-12 #newlistlevelattrs# - if ( rDoc.DoesUndo() ) + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) { - rDoc.EndUndo( UNDO_INSFMTATTR, NULL ); + rDoc.GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); } // <-- } diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index f3570d0d21ff..0bae918f3c4f 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -34,13 +34,9 @@ #include <tools/shl.hxx> #include <swtypes.hxx> -#ifndef _HELPID_H #include <helpid.h> -#endif #include <uiitems.hxx> -#ifndef _MODCFG_HXX #include <modcfg.hxx> -#endif #include "swmodule.hxx" #include "usrpref.hxx" #include "wrtsh.hxx" @@ -65,9 +61,7 @@ #include <sot/clsids.hxx> #include <unotools/configmgr.hxx> #include <docsh.hxx> -#ifndef _CONFIG_HRC #include <config.hrc> -#endif #include <SwStyleNameMapper.hxx> #include <numrule.hxx> #include <SwNodeNum.hxx> diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 57b8072aa831..13645f395d04 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -643,7 +643,8 @@ sal_Bool SwNewDBMgr::GetTableNames(ListBox* pListBox, const String& rDBName) else { rtl::OUString sDBName(rDBName); - xConnection = RegisterConnection( sDBName ); + if ( sDBName.getLength() ) + xConnection = RegisterConnection( sDBName ); } if(xConnection.is()) { @@ -1750,7 +1751,7 @@ String SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps, try { SwDbtoolsClient& aClient = SwNewDBMgr::GetDbtoolsClient(); - sRet = aClient.getValue( + sRet = aClient.getFormattedValue( xColumnProps, rDBFormatData.xFormatter, rDBFormatData.aLocale, @@ -2948,8 +2949,14 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, SwNewDBMgr* pWorkDBMgr = pWorkDoc->GetNewDBMgr(); pWorkDoc->SetNewDBMgr( this ); pWorkDoc->EmbedAllLinks(); - if(UNDO_UI_DELETE_INVISIBLECNTNT == rWorkShell.GetUndoIds()) - rWorkShell.Undo(); + SwUndoId nLastUndoId(UNDO_EMPTY); + if (rWorkShell.GetLastUndoInfo(0, & nLastUndoId)) + { + if (UNDO_UI_DELETE_INVISIBLECNTNT == nLastUndoId) + { + rWorkShell.Undo(); + } + } // #i69485# lock fields to prevent access to the result set while calculating layout rWorkShell.LockExpFlds(); // create a layout diff --git a/sw/source/ui/dbui/swdbtoolsclient.cxx b/sw/source/ui/dbui/swdbtoolsclient.cxx index ca50ee02d593..bb932f0f9a04 100644 --- a/sw/source/ui/dbui/swdbtoolsclient.cxx +++ b/sw/source/ui/dbui/swdbtoolsclient.cxx @@ -230,7 +230,7 @@ sal_Int32 SwDbtoolsClient::getDefaultNumberFormat( /* -----------------------------30.08.2001 12:38------------------------------ ---------------------------------------------------------------------------*/ -::rtl::OUString SwDbtoolsClient::getValue( +::rtl::OUString SwDbtoolsClient::getFormattedValue( const uno::Reference< beans::XPropertySet>& _rxColumn, const uno::Reference< util::XNumberFormatter>& _rxFormatter, const lang::Locale& _rLocale, @@ -242,7 +242,7 @@ sal_Int32 SwDbtoolsClient::getDefaultNumberFormat( getAccessTypeConversion(); rtl::OUString sRet; if(xConversion.is()) - sRet = xConversion->getValue(_rxColumn, _rxFormatter, _rLocale, _rNullDate); + sRet = xConversion->getFormattedValue(_rxColumn, _rxFormatter, _rLocale, _rNullDate); return sRet; } diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx index 9cca0c02b8fc..4ae83ef60d77 100644 --- a/sw/source/ui/dialog/macassgn.cxx +++ b/sw/source/ui/dialog/macassgn.cxx @@ -61,8 +61,6 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::frame::XFrame; -// SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage*, const String& ); - SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) { // const SfxItemSet& rSet = rPg.GetItemSet(); @@ -163,34 +161,3 @@ sal_Bool SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, } return bRet; } - -/* -SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage* , const String& rLanguage ) -{ - SvStringsDtor* pNew = new SvStringsDtor; - - SfxApplication* pSfxApp = SFX_APP(); - if ( !rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT) ) - { - pSfxApp->EnterBasicCall(); - - String* pNewEntry = new String( pSfxApp->GetName() ); - pNew->Insert( pNewEntry, pNew->Count() ); - - TypeId aType( TYPE( SwDocShell )); - SfxObjectShell* pDoc = SfxObjectShell::GetFirst( &aType ); - while( pDoc ) - { - pNewEntry = new String( pDoc->GetTitle() ); - pNew->Insert( pNewEntry, pNew->Count() ); - pDoc = SfxObjectShell::GetNext( *pDoc, &aType ); - } - pSfxApp->LeaveBasicCall(); - } - - return pNew; -} -*/ - - - diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 21dc2866ecda..693723cc16b3 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -88,6 +88,7 @@ #include <shellio.hxx> #include <ddefld.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagedesc.hxx> #include <IMark.hxx> #include <docary.hxx> @@ -132,7 +133,6 @@ // #109590# #include <swcrsr.hxx> #include <SwRewriter.hxx> -#include <undobj.hxx> #include <globals.hrc> #include <vos/mutex.hxx> #include <vcl/svapp.hxx> @@ -228,7 +228,7 @@ public: } ~SwTrnsfrActionAndUndo() { - pSh->EndUndo( eUndoId ); + pSh->EndUndo(); pSh->EndAllAction(); } }; @@ -3434,7 +3434,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, { // nicht in sich selbst kopieren/verschieben rSh.DestroyCrsr(); - rSh.EndUndo( eUndoId ); + rSh.EndUndo(); rSh.EndAction(); rSh.EndAction(); return 0; @@ -3542,8 +3542,8 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, rSrcSh.LeaveSelFrmMode(); if( rSrcSh.GetDoc() != rSh.GetDoc() ) - rSrcSh.EndUndo( eUndoId ); - rSh.EndUndo( eUndoId ); + rSrcSh.EndUndo(); + rSh.EndUndo(); // Shell in den richtigen Status versetzen if( &rSrcSh != &rSh && ( rSh.IsFrmSelected() || rSh.IsObjSelected() )) @@ -3797,8 +3797,7 @@ void SwTrnsfrDdeLink::Disconnect( sal_Bool bRemoveDataAdvise ) if( bDelBookmrk && refObj.Is() && FindDocShell() ) { SwDoc* pDoc = pDocShell->GetDoc(); - sal_Bool bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( sal_False ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); // --> OD, CD, OS 2005-11-25 #i58448# Link aSavedOle2Link( pDoc->GetOle2Link() ); @@ -3815,7 +3814,6 @@ void SwTrnsfrDdeLink::Disconnect( sal_Bool bRemoveDataAdvise ) pDoc->SetOle2Link( aSavedOle2Link ); // <-- - pDoc->DoUndo( bUndo ); bDelBookmrk = sal_False; } diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx index 1c201f4665f3..4675805e527c 100644 --- a/sw/source/ui/docvw/AnnotationWin.cxx +++ b/sw/source/ui/docvw/AnnotationWin.cxx @@ -28,7 +28,6 @@ * ************************************************************************/ - #include "precompiled_sw.hxx" #include <AnnotationWin.hxx> @@ -62,8 +61,10 @@ #include <wrtsh.hxx> #include <docsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <SwUndoField.hxx> + namespace sw { namespace annotation { SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin, @@ -116,7 +117,8 @@ void SwAnnotationWin::UpdateData() SwField* pOldField = mpFld->Copy(); mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); delete pOldField; // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one) Mgr().SetLayout(); @@ -246,7 +248,8 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText) SwField* pOldField = mpFld->Copy(); mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); delete pOldField; Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) ); Engine()->ClearModifyFlag(); diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx index 5f7ffa042869..c52082028e16 100644 --- a/sw/source/ui/docvw/PostItMgr.cxx +++ b/sw/source/ui/docvw/PostItMgr.cxx @@ -59,16 +59,12 @@ #include <redline.hxx> #include <docary.hxx> #include <SwRewriter.hxx> -#include <undobj.hxx> #include <tools/color.hxx> #include <swmodule.hxx> #include <annotation.hrc> #include "cmdid.h" -#include <SwRewriter.hxx> -#include <undobj.hxx> - #include <sfx2/request.hxx> #include <sfx2/event.hxx> #include <svl/srchitem.hxx> @@ -1251,7 +1247,7 @@ void SwPostItMgr::Delete(String aAuthor) mpWrtShell->GotoField( *(*i) ); mpWrtShell->DelRight(); } - mpWrtShell->EndUndo( UNDO_DELETE ); + mpWrtShell->EndUndo(); PrepareView(); mpWrtShell->EndAllAction(); mbLayout = true; @@ -1297,7 +1293,7 @@ void SwPostItMgr::Delete() mvPostItFlds.clear(); */ - mpWrtShell->EndUndo( UNDO_DELETE ); + mpWrtShell->EndUndo(); PrepareView(); mpWrtShell->EndAllAction(); mbLayout = true; diff --git a/sw/source/ui/docvw/SidebarTxtControl.cxx b/sw/source/ui/docvw/SidebarTxtControl.cxx index 5d71ca3696ce..b0cc39372dd7 100644 --- a/sw/source/ui/docvw/SidebarTxtControl.cxx +++ b/sw/source/ui/docvw/SidebarTxtControl.cxx @@ -64,7 +64,6 @@ #include <wrtsh.hxx> #include <shellres.hxx> #include <SwRewriter.hxx> -#include <undobj.hxx> namespace css = ::com::sun::star; diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index afb0f49cac84..396c71f9f4a9 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -4320,8 +4320,14 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) !GetConnectMetaFile() && rSh.VisArea().IsInside( aDocPt )) { - if( UNDO_INS_FROM_SHADOWCRSR == rSh.GetUndoIds() ) - rSh.Undo(); + SwUndoId nLastUndoId(UNDO_EMPTY); + if (rSh.GetLastUndoInfo(0, & nLastUndoId)) + { + if (UNDO_INS_FROM_SHADOWCRSR == nLastUndoId) + { + rSh.Undo(); + } + } SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCrsrFillMode(); rSh.SetShadowCrsrPos( aDocPt, eMode ); } diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 709fe09cd21e..106e792229e6 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -804,11 +804,8 @@ bool SwMailMergeDlg::ExecQryShell() } } } - SwPrintData aPrtData = *SW_MOD()->GetPrtOptions(sal_False); IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess(); - SwPrintData* pShellPrintData = pIDDA->getPrintData(); - if(pShellPrintData) - aPrtData = *pShellPrintData; + SwPrintData aPrtData( pIDDA->getPrintData() ); aPrtData.SetPrintSingleJobs(aSingleJobsCB.IsChecked()); pIDDA->setPrintData(aPrtData); diff --git a/sw/source/ui/inc/annotsh.hxx b/sw/source/ui/inc/annotsh.hxx index 120321a5ffee..ee8d8e9ccf17 100755 --- a/sw/source/ui/inc/annotsh.hxx +++ b/sw/source/ui/inc/annotsh.hxx @@ -71,7 +71,8 @@ public: void StateSearch(SfxItemSet &); - virtual SfxUndoManager* GetUndoManager(); + virtual ::svl::IUndoManager* + GetUndoManager(); }; #endif diff --git a/sw/source/ui/inc/drwtxtsh.hxx b/sw/source/ui/inc/drwtxtsh.hxx index 3a502a2b2779..add257a36ac2 100644 --- a/sw/source/ui/inc/drwtxtsh.hxx +++ b/sw/source/ui/inc/drwtxtsh.hxx @@ -57,7 +57,8 @@ public: SwDrawTextShell(SwView &rView); virtual ~SwDrawTextShell(); - virtual SfxUndoManager* GetUndoManager(); + virtual ::svl::IUndoManager* + GetUndoManager(); void StateDisableItems(SfxItemSet &); diff --git a/sw/source/ui/inc/inputwin.hxx b/sw/source/ui/inc/inputwin.hxx index 317fb8697295..2f9aaa669205 100644 --- a/sw/source/ui/inc/inputwin.hxx +++ b/sw/source/ui/inc/inputwin.hxx @@ -27,17 +27,11 @@ #ifndef SW_INPUTWIN_HXX #define SW_INPUTWIN_HXX - -#ifndef _MENU_HXX //autogen +#include <vcl/edit.hxx> #include <vcl/menu.hxx> -#endif -#include <sfx2/childwin.hxx> -#ifndef _TOOLBOX_HXX //autogen #include <vcl/toolbox.hxx> -#endif -#ifndef _EDIT_HXX //autogen -#include <vcl/edit.hxx> -#endif + +#include <sfx2/childwin.hxx> class SwFldMgr; class SwWrtShell; @@ -72,16 +66,17 @@ friend class InputEdit; SwView* pView; SfxBindings* pBindings; String aAktTableName, sOldFml; - sal_uInt16 nActionCnt; + sal_Int32 m_nActionCount; - sal_Bool bFirst : 1; //Initialisierungen beim ersten Aufruf - sal_Bool bActive : 1; //fuer Hide/Show beim Dokumentwechsel - sal_Bool bIsTable : 1; - sal_Bool bDelSel : 1; - sal_Bool bDoesUndo : 1; - sal_Bool bResetUndo : 1; - sal_Bool bCallUndo : 1; + sal_Bool bFirst : 1; //Initialisierungen beim ersten Aufruf + sal_Bool bActive : 1; //fuer Hide/Show beim Dokumentwechsel + sal_Bool bIsTable : 1; + sal_Bool bDelSel : 1; + bool m_bDoesUndo : 1; + bool m_bResetUndo : 1; + bool m_bCallUndo : 1; + void CleanupUglyHackWithUndo(); void DelBoxCntnt(); DECL_LINK( ModifyHdl, InputEdit* ); diff --git a/sw/source/ui/inc/prtopt.hxx b/sw/source/ui/inc/prtopt.hxx deleted file mode 100644 index 75f0520e35e8..000000000000 --- a/sw/source/ui/inc/prtopt.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _PRTOPT_HXX -#define _PRTOPT_HXX - -#include <unotools/configitem.hxx> -#include <printdata.hxx> - -class SwPrintOptions : public SwPrintData, public utl::ConfigItem -{ - sal_Bool bIsWeb; - - com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); -public: - SwPrintOptions(sal_Bool bWeb); - virtual ~SwPrintOptions(); - - virtual void Commit(); - virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void doSetModified( ) { bModified = sal_True; SetModified();} - - SwPrintOptions& operator=(const SwPrintData& rData) - { - SwPrintData::operator=( rData ); - SetModified(); - return *this; - } -}; - -#endif - diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 92b3f649ae9a..5a3359ad9571 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -33,9 +33,7 @@ #include "swuiidxmrk.hxx" #include <hintids.hxx> -#ifndef _HELPID_H #include <helpid.h> -#endif #define _SVSTDARR_STRINGSSORT #include <svl/svstdarr.hxx> #include <comphelper/processfactory.hxx> @@ -46,9 +44,7 @@ #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> #include <svl/stritem.hxx> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <sfx2/dispatch.hxx> #include <svl/eitem.hxx> #include <svtools/txtcmp.hxx> @@ -60,20 +56,12 @@ #include <idxmrk.hxx> #include <txttxmrk.hxx> #include <wrtsh.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <multmrk.hxx> #include <swundo.hxx> // fuer Undo-Ids -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _INDEX_HRC #include <index.hrc> -#endif -#ifndef _IDXMRK_HRC #include <idxmrk.hrc> -#endif #include <swmodule.hxx> #include <fldmgr.hxx> #include <fldbas.hxx> @@ -83,7 +71,6 @@ #include <ndtxt.hxx> #include <breakit.hxx> #include <SwRewriter.hxx> -#include <undobj.hxx> #include "swuiidxmrk.hxx" #include <unomid.h> diff --git a/sw/source/ui/index/toxmgr.cxx b/sw/source/ui/index/toxmgr.cxx index dd22ad00e540..76b06194b9e6 100644 --- a/sw/source/ui/index/toxmgr.cxx +++ b/sw/source/ui/index/toxmgr.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <wrtsh.hxx> #include <shellres.hxx> #include <swwait.hxx> @@ -34,10 +35,9 @@ #include <toxmgr.hxx> #include <crsskip.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swundo.hxx> -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif /*-------------------------------------------------------------------- Beschreibung: Handhabung der Verzeichnisse durch TOXMgr @@ -450,12 +450,14 @@ sal_Bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc, { SwDoc * pDoc = pSh->GetDoc(); - if (pDoc->DoesUndo()) + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { if (pNewTOX != NULL) - pDoc->DelAllUndoObj(); + { + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + } - pDoc->StartUndo(UNDO_TOXCHANGE, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_TOXCHANGE, NULL); } if (pNewTOX != NULL) // => pTOX != NULL @@ -463,12 +465,14 @@ sal_Bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc, bRet = pSh->UpdateTableOf(*pTOX, pSet); - if (pDoc->DoesUndo()) + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { - pDoc->EndUndo(UNDO_TOXCHANGE, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_TOXCHANGE, NULL); if (pNewTOX == NULL) - pDoc->DelAllUndoObj(); + { + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + } } } diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 88c0b16ab668..0bdbb6b60bb5 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -47,7 +47,6 @@ #include "swtypes.hxx" #include "swundo.hxx" #include "uitool.hxx" -#include "undobj.hxx" #include "unomid.h" #include "view.hxx" #include "viewopt.hxx" @@ -789,7 +788,7 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) of temporary auto correction is now undoable two and must reside in the same undo group.*/ pSh->EndAction(); - pSh->EndUndo(UNDO_UI_REPLACE); + pSh->EndUndo(); pSh->SetInsMode( bOldIns ); } diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx index e656070796b2..ce41c2906e45 100644 --- a/sw/source/ui/misc/glshell.cxx +++ b/sw/source/ui/misc/glshell.cxx @@ -49,18 +49,13 @@ #include <view.hxx> #include <glshell.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <glosdoc.hxx> #include <shellio.hxx> #include <initui.hxx> // fuer ::GetGlossaries() -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _SWERROR_H #include <swerror.h> -#endif -#ifndef _MISC_HRC #include <misc.hrc> -#endif #define SwWebGlosDocShell @@ -311,8 +306,9 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS aDocTitle += ' '; aDocTitle += sLongName; - sal_Bool bDoesUndo = xDocSh->GetDoc()->DoesUndo(); - xDocSh->GetDoc()->DoUndo( sal_False ); + bool const bDoesUndo = + xDocSh->GetDoc()->GetIDocumentUndoRedo().DoesUndo(); + xDocSh->GetDoc()->GetIDocumentUndoRedo().DoUndo( false ); xDocSh->GetWrtShell()->InsertGlossary( *pGroup, rShortName ); if( !xDocSh->GetDoc()->getPrinter( false ) ) @@ -340,7 +336,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS catch( uno::Exception& ) {} - xDocSh->GetDoc()->DoUndo( bDoesUndo ); + xDocSh->GetDoc()->GetIDocumentUndoRedo().DoUndo( bDoesUndo ); xDocSh->GetDoc()->ResetModified(); if ( bShow ) pFrame->GetFrame().Appear(); diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx index 9cb595be6302..e1971af27497 100644 --- a/sw/source/ui/misc/redlndlg.cxx +++ b/sw/source/ui/misc/redlndlg.cxx @@ -37,9 +37,7 @@ #include <redline.hxx> #include <tools/datetime.hxx> #include <vcl/msgbox.hxx> -#ifndef _SVSTDARR_HXX #include <svl/svstdarr.hxx> -#endif #include <svl/eitem.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> @@ -47,9 +45,7 @@ #include <svx/postattr.hxx> #include <swtypes.hxx> #include <wrtsh.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <swmodule.hxx> #ifndef _REDLNDLG_HXX #define _REDLNACCEPTDLG @@ -58,26 +54,15 @@ #include <swwait.hxx> #include <uitool.hxx> -#ifndef _HELPID_H #include <helpid.h> -#endif -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _MISC_HRC #include <misc.hrc> -#endif -#ifndef _REDLNDLG_HRC #include <redlndlg.hrc> -#endif -#ifndef _SHELLS_HRC #include <shells.hrc> -#endif // -> #111827# #include <comcore.hrc> #include <swundo.hxx> -#include <undobj.hxx> #include <SwRewriter.hxx> // <- #111827# @@ -975,7 +960,9 @@ void SwRedlineAcceptDlg::CallAcceptReject( sal_Bool bSelect, sal_Bool bAccept ) // #111827# if (aRedlines.size() > 1) - pSh->EndUndo(bAccept? UNDO_ACCEPT_REDLINE : UNDO_REJECT_REDLINE); + { + pSh->EndUndo(); + } pSh->EndAction(); diff --git a/sw/source/ui/ribbar/drawbase.cxx b/sw/source/ui/ribbar/drawbase.cxx index 5dc985d47ab1..f41e0ce2835a 100644 --- a/sw/source/ui/ribbar/drawbase.cxx +++ b/sw/source/ui/ribbar/drawbase.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <tools/list.hxx> #include <svx/svdview.hxx> @@ -45,7 +46,7 @@ #include "edtwin.hxx" #include "caption.hxx" #include "swundo.hxx" -#include "undobj.hxx" +#include <SwRewriter.hxx> #include "comcore.hrc" using namespace ::com::sun::star; @@ -363,7 +364,9 @@ sal_Bool SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt) } } if (m_pWin->GetSdrDrawMode() == OBJ_NONE) - m_pSh->EndUndo(UNDO_INSERT); + { + m_pSh->EndUndo(); + } } bReturn = sal_True; diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx index f6429dbdfc9f..d205e8650f43 100755 --- a/sw/source/ui/ribbar/inputwin.cxx +++ b/sw/source/ui/ribbar/inputwin.cxx @@ -36,6 +36,7 @@ #include <svx/ruler.hxx> #include <svl/zforlist.hxx> #include <svl/stritem.hxx> +#include <unotools/undoopt.hxx> #include "swtypes.hxx" #include "cmdid.h" @@ -74,9 +75,13 @@ SwInputWindow::SwInputWindow( Window* pParent, SfxBindings* pBind ) pView(0), pBindings(pBind), aAktTableName(aEmptyStr) + , m_nActionCount(0) + , m_bDoesUndo(true) + , m_bResetUndo(false) + , m_bCallUndo(false) { - bFirst = bDoesUndo = sal_True; - bActive = bIsTable = bDelSel = bResetUndo = bCallUndo = sal_False; + bFirst = sal_True; + bActive = bIsTable = bDelSel = sal_False; FreeResource(); @@ -143,16 +148,27 @@ __EXPORT SwInputWindow::~SwInputWindow() if(pWrtShell) pWrtShell->EndSelTblCells(); - if( bResetUndo ) + CleanupUglyHackWithUndo(); +} + +void SwInputWindow::CleanupUglyHackWithUndo() +{ + if (m_bResetUndo) { DelBoxCntnt(); - pWrtShell->DoUndo( bDoesUndo ); - if(bCallUndo) + pWrtShell->DoUndo(m_bDoesUndo); + if (m_bCallUndo) + { pWrtShell->Undo(); - SwEditShell::SetUndoActionCount( nActionCnt ); + } + if (0 == m_nActionCount) + { + SW_MOD()->GetUndoOptions().SetUndoCount(0); + } } } + //================================================================== void SwInputWindow::DataChanged( const DataChangedEvent& rDCEvt ) @@ -233,9 +249,11 @@ void SwInputWindow::ShowWin() { if( bIsTable ) { - bResetUndo = sal_True; - nActionCnt = SwEditShell::GetUndoActionCount(); - SwEditShell::SetUndoActionCount( nActionCnt + 1 ); + m_bResetUndo = true; + m_nActionCount = SW_MOD()->GetUndoOptions().GetUndoCount(); + if (0 == m_nActionCount) { // deactivated? turn it on... + SW_MOD()->GetUndoOptions().SetUndoCount(1); + } bDoesUndo = pWrtShell->DoesUndo(); if( !bDoesUndo ) @@ -252,9 +270,11 @@ void SwInputWindow::ShowWin() pWrtShell->StartUndo( UNDO_DELETE ); pWrtShell->Delete(); if( 0 != pWrtShell->EndUndo( UNDO_DELETE )) - bCallUndo = sal_True; + { + m_bCallUndo = true; + } } - pWrtShell->DoUndo( sal_False ); + pWrtShell->DoUndo(false); SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA ); if( pWrtShell->GetTblBoxFormulaAttrs( aSet )) @@ -376,15 +396,7 @@ void SwInputWindow::ApplyFormula() { pView->GetViewFrame()->GetDispatcher()->Lock(sal_False); pView->GetEditWin().LockKeyInput(sal_False); - if( bResetUndo ) - { - DelBoxCntnt(); - pWrtShell->DoUndo( bDoesUndo ); - SwEditShell::SetUndoActionCount( nActionCnt ); - if( bCallUndo ) - pWrtShell->Undo(); - bResetUndo = sal_False; - } + CleanupUglyHackWithUndo(); pWrtShell->Pop( sal_False ); // JP 13.01.97: Formel soll immer mit einem "=" beginnen, hier @@ -411,15 +423,7 @@ void SwInputWindow::CancelFormula() { pView->GetViewFrame()->GetDispatcher()->Lock( sal_False ); pView->GetEditWin().LockKeyInput(sal_False); - if( bResetUndo ) - { - DelBoxCntnt(); - pWrtShell->DoUndo( bDoesUndo ); - SwEditShell::SetUndoActionCount( nActionCnt ); - if( bCallUndo ) - pWrtShell->Undo(); - bResetUndo = sal_False; - } + CleanupUglyHackWithUndo(); pWrtShell->Pop( sal_False ); if( bDelSel ) @@ -496,7 +500,7 @@ void SwInputWindow::SetFormula( const String& rFormula, sal_Bool bDelFlag ) IMPL_LINK( SwInputWindow, ModifyHdl, InputEdit*, EMPTYARG ) { - if( bIsTable && bResetUndo ) + if (bIsTable && m_bResetUndo) { pWrtShell->StartAllAction(); DelBoxCntnt(); @@ -670,25 +674,3 @@ SfxChildWinInfo __EXPORT SwInputChild::GetInfo() const return aInfo; } - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index ea342e17c776..608c3e8afff0 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -161,7 +161,7 @@ SwAnnotationShell::~SwAnnotationShell() { } -SfxUndoManager* SwAnnotationShell::GetUndoManager() +::svl::IUndoManager* SwAnnotationShell::GetUndoManager() { SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); if ( !pPostItMgr || @@ -1358,7 +1358,7 @@ void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq) void SwAnnotationShell::ExecUndo(SfxRequest &rReq) { const SfxItemSet* pArgs = rReq.GetArgs(); - SfxUndoManager* pUndoManager = GetUndoManager(); + ::svl::IUndoManager* pUndoManager = GetUndoManager(); SwWrtShell &rSh = rView.GetWrtShell(); long aOldHeight = rView.GetPostItMgr()->HasActiveSidebarWin() @@ -1387,7 +1387,7 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq) nCnt = 0; while( nSteps-- ) - pUndoManager->Undo(0); + pUndoManager->Undo(); } if ( nCnt ) @@ -1411,7 +1411,7 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq) nCnt = 0; while( nSteps-- ) - pUndoManager->Redo(0); + pUndoManager->Redo(); } if ( nCnt ) @@ -1435,7 +1435,7 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - SfxUndoManager* pUndoManager = GetUndoManager(); + ::svl::IUndoManager* pUndoManager = GetUndoManager(); SfxViewFrame *pSfxViewFrame = rView.GetViewFrame(); SwWrtShell &rSh = rView.GetWrtShell(); @@ -1448,8 +1448,10 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) sal_uInt16 nCount = pUndoManager->GetUndoActionCount(); if ( nCount ) pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); - else if( rSh.GetUndoIds() ) + else if (rSh.GetLastUndoInfo(0, 0)) + { rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) ); + } else rSet.DisableItem(nWhich); break; @@ -1459,8 +1461,10 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) sal_uInt16 nCount = pUndoManager->GetRedoActionCount(); if ( nCount ) pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); - else if(rSh.GetRedoIds()) + else if (rSh.GetFirstRedoInfo(0)) + { rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) ); + } else rSet.DisableItem(nWhich); break; @@ -1470,34 +1474,36 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) { if( pUndoManager ) { - UniString (SfxUndoManager:: *fnGetComment)( sal_uInt16 ) const; + UniString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const; sal_uInt16 nCount; if( SID_GETUNDOSTRINGS == nWhich ) { nCount = pUndoManager->GetUndoActionCount(); - fnGetComment = &SfxUndoManager::GetUndoActionComment; + fnGetComment = &::svl::IUndoManager::GetUndoActionComment; } else { nCount = pUndoManager->GetRedoActionCount(); - fnGetComment = &SfxUndoManager::GetRedoActionComment; + fnGetComment = &::svl::IUndoManager::GetRedoActionComment; } String sList; if( nCount ) { for( sal_uInt16 n = 0; n < nCount; ++n ) - ( sList += (pUndoManager->*fnGetComment)( n ) ) + ( sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) ) += '\n'; } SfxStringListItem aItem( nWhich ); - if( nWhich == SID_GETUNDOSTRINGS && rSh.GetUndoIds() ) + if ((nWhich == SID_GETUNDOSTRINGS) && + rSh.GetLastUndoInfo(0, 0)) { rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); } - else if( nWhich == SID_GETREDOSTRINGS && rSh.GetRedoIds() ) + else if ((nWhich == SID_GETREDOSTRINGS) && + (rSh.GetFirstRedoInfo(0))) { rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); } diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index a4e26f20fbd2..044b4c1883b0 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -27,14 +27,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <sot/factory.hxx> #include <hintids.hxx> #include <svl/urihelper.hxx> #include <svl/languageoptions.hxx> -#ifndef _SVX_SVXIDS_HRC #include <svx/svxids.hrc> -#endif #include <sfx2/linkmgr.hxx> #include <svx/htmlmode.hxx> #include <svx/imapdlg.hxx> @@ -97,15 +96,9 @@ #include <caption.hxx> #include <swwait.hxx> #include <cmdid.h> -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif -#ifndef _SHELLS_HRC #include <shells.hrc> -#endif -#ifndef _STATSTR_HRC #include <statstr.hrc> -#endif #include <globals.h> #include <unotxdoc.hxx> #include <crsskip.hxx> @@ -120,10 +113,7 @@ #include <instable.hxx> #include <svx/fmshell.hxx> // for FN_XFORMS_DESIGN_MODE #include <SwRewriter.hxx> -#include <undobj.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <unomid.h> @@ -553,35 +543,41 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) { case SID_UNDO: { - if( rSh.GetUndoIds() ) + if (rSh.GetLastUndoInfo(0, 0)) + { rSet.Put( SfxStringItem(nWhich, rSh.GetDoString(SwWrtShell::UNDO))); + } else rSet.DisableItem(nWhich); break; } case SID_REDO: { - if(rSh.GetRedoIds()) + if (rSh.GetFirstRedoInfo(0)) + { rSet.Put(SfxStringItem(nWhich, rSh.GetDoString(SwWrtShell::REDO))); + } else rSet.DisableItem(nWhich); break; } case SID_REPEAT: { // Repeat nur moeglich wenn kein REDO moeglich - UI-Restriktion - if(rSh.GetRedoIds() == UNDO_EMPTY && + if ((!rSh.GetFirstRedoInfo(0)) && !rSh.IsSelFrmMode() && - rSh.GetRepeatIds() ) + (UNDO_EMPTY != rSh.GetRepeatInfo(0))) + { rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString())); + } else rSet.DisableItem(nWhich); break; } case SID_GETUNDOSTRINGS: - if( rSh.GetUndoIds() ) + if (rSh.GetLastUndoInfo(0, 0)) { SfxStringListItem aStrLst( nWhich ); rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst ); @@ -592,7 +588,7 @@ void SwBaseShell::StateUndo(SfxItemSet &rSet) break; case SID_GETREDOSTRINGS: - if( rSh.GetRedoIds() ) + if (rSh.GetFirstRedoInfo(0)) { SfxStringListItem aStrLst( nWhich ); rSh.GetDoStrings( SwWrtShell::REDO, aStrLst ); diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx index e595db36447f..3d5023c311eb 100644 --- a/sw/source/ui/shells/drwbassh.cxx +++ b/sw/source/ui/shells/drwbassh.cxx @@ -294,7 +294,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) pSh->StartAllAction(); // --> OD 2004-07-14 #i30451# - pSh->StartUndo(); + pSh->StartUndo(UNDO_INSFMTATTR); pSdrView->SetGeoAttrToMarked(*pOutSet); diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 8a0c3def7e3f..8e4dfd362c15 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -623,15 +623,15 @@ void SwDrawTextShell::ExecUndo(SfxRequest &rReq) 1 < (nCnt = ((SfxUInt16Item*)pItem)->GetValue()) ) { // then we make by ourself. - SfxUndoManager* pUndoManager = GetUndoManager(); + ::svl::IUndoManager* pUndoManager = GetUndoManager(); if( pUndoManager ) { if( SID_UNDO == nId ) while( nCnt-- ) - pUndoManager->Undo(0); + pUndoManager->Undo(); else while( nCnt-- ) - pUndoManager->Redo(0); + pUndoManager->Redo(); } bCallBase = sal_False; GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); @@ -668,27 +668,27 @@ void SwDrawTextShell::StateUndo(SfxItemSet &rSet) case SID_GETUNDOSTRINGS: case SID_GETREDOSTRINGS: { - SfxUndoManager* pUndoManager = GetUndoManager(); + ::svl::IUndoManager* pUndoManager = GetUndoManager(); if( pUndoManager ) { - UniString (SfxUndoManager:: *fnGetComment)( sal_uInt16 ) const; + UniString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const; sal_uInt16 nCount; if( SID_GETUNDOSTRINGS == nWhich ) { nCount = pUndoManager->GetUndoActionCount(); - fnGetComment = &SfxUndoManager::GetUndoActionComment; + fnGetComment = &::svl::IUndoManager::GetUndoActionComment; } else { nCount = pUndoManager->GetRedoActionCount(); - fnGetComment = &SfxUndoManager::GetRedoActionComment; + fnGetComment = &::svl::IUndoManager::GetRedoActionComment; } if( nCount ) { String sList; for( sal_uInt16 n = 0; n < nCount; ++n ) - ( sList += (pUndoManager->*fnGetComment)( n ) ) + ( sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) ) += '\n'; SfxStringListItem aItem( nWhich ); @@ -899,7 +899,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) /*-- 22.10.2003 14:26:32--------------------------------------------------- -----------------------------------------------------------------------*/ -SfxUndoManager* SwDrawTextShell::GetUndoManager() +::svl::IUndoManager* SwDrawTextShell::GetUndoManager() { SwWrtShell &rSh = GetShell(); pSdrView = rSh.GetDrawView(); diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx index fe2e7502a3df..8669c4e201c1 100644 --- a/sw/source/ui/shells/grfshex.cxx +++ b/sw/source/ui/shells/grfshex.cxx @@ -34,42 +34,28 @@ #include <wrtsh.hxx> #include <view.hxx> #include <docary.hxx> -#ifndef _TEXTSH_HXX #include <textsh.hxx> -#endif #include <viewopt.hxx> #include <swundo.hxx> -#ifndef _SHELLS_HRC #include <shells.hrc> -#endif #include <caption.hxx> #define _SVSTDARR_STRINGSSORTDTOR #include <svl/svstdarr.hxx> #include <svtools/filter.hxx> #include <svx/htmlmode.hxx> -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <frmfmt.hxx> #include <frmmgr.hxx> #include <vcl/msgbox.hxx> -#ifndef _SVX_SVDOMEDIA_HXX #include <svx/svdomedia.hxx> -#endif -#ifndef _SVX_SVDVIEW_HXX #include <svx/svdview.hxx> -#endif -#ifndef _SVX_SVDPAGV_HXX #include <svx/svdpagv.hxx> -#endif #include <SwStyleNameMapper.hxx> #include <sfx2/filedlghelper.hxx> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp> -#ifndef _POOLFMT_HRC #include <poolfmt.hrc> -#endif #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> @@ -79,7 +65,6 @@ // -> #111827# #include <SwRewriter.hxx> -#include <undobj.hxx> #include <comcore.hrc> // <- #111827# diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx index 83eee472e91d..6f00f198e33f 100755 --- a/sw/source/ui/shells/langhelper.cxx +++ b/sw/source/ui/shells/langhelper.cxx @@ -300,11 +300,9 @@ namespace SwLangHelper } rWrtSh.SetDefault( SvxLanguageItem( nLang, nLangWhichId ) ); - // set respective language attribute in text document to default + // #i102191: hard set respective language attribute in text document // (for all text in the document - which should be selected by now...) - SvUShortsSort aAttribs; - aAttribs.Insert( nLangWhichId ); - rWrtSh.ResetAttr( &aAttribs ); + rWrtSh.SetAttr( SvxLanguageItem( nLang, nLangWhichId ) ); } } } diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index dfd12abffe57..6ed0e3050f26 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -79,9 +79,7 @@ #include <doc.hxx> #include <uitool.hxx> #include <cmdid.h> -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif #include <frmmgr.hxx> #include <textsh.hxx> #include <frmfmt.hxx> @@ -100,12 +98,8 @@ #include <modcfg.hxx> #include <column.hxx> #include <edtwin.hxx> -#ifndef _SHELLS_HRC #include <shells.hrc> -#endif -#ifndef _POPUP_HRC #include <popup.hrc> -#endif #include <swerror.h> #include <SwAppletImpl.hxx> #include <unochart.hxx> @@ -120,10 +114,7 @@ #include <sfx2/msg.hxx> #include <swslots.hxx> #include <SwRewriter.hxx> -#include <undobj.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif using namespace ::com::sun::star; using ::rtl::OUString; @@ -1217,7 +1208,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) } rSh.EndAllAction(); - rSh.EndUndo( UNDO_INSERT ); + rSh.EndUndo(); if ( aChars.Len() ) { diff --git a/sw/source/ui/table/chartins.cxx b/sw/source/ui/table/chartins.cxx index 684c69b9852b..ce370ced3304 100644 --- a/sw/source/ui/table/chartins.cxx +++ b/sw/source/ui/table/chartins.cxx @@ -53,9 +53,7 @@ #include <edtwin.hxx> #include <cmdid.h> -#ifndef _CHARTINS_HRC #include <chartins.hrc> -#endif #include <anchoredobject.hxx> #include <sot/clsids.hxx> @@ -259,7 +257,7 @@ void SwInsertChart(Window* pParent, SfxBindings* pBindings ) if( nDialogRet == ui::dialogs::ExecutableDialogResults::CANCEL ) { rWrtShell.Undo(); - rWrtShell.getIDocumentUndoRedoAccess()->ClearRedo(); + rWrtShell.GetIDocumentUndoRedo().ClearRedo(); } else { diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 4f9c6910011a..79fdcef1f5c8 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -553,7 +553,7 @@ void SwSrcView::GetState(SfxItemSet& rSet) case SID_UNDO: case SID_REDO: { - SfxUndoManager& rMgr = pTextView->GetTextEngine()->GetUndoManager(); + ::svl::IUndoManager& rMgr = pTextView->GetTextEngine()->GetUndoManager(); sal_uInt16 nCount = 0; if(nWhich == SID_UNDO) { diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index e53f7317e318..e9e3bc34dc31 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -74,12 +74,12 @@ #include <beziersh.hxx> #include <globdoc.hxx> #include <scroll.hxx> -#include <globdoc.hxx> #include <navipi.hxx> #include <gloshdl.hxx> #include <usrpref.hxx> #include <srcview.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <drawdoc.hxx> #include <wdocsh.hxx> #include <wview.hxx> @@ -973,9 +973,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) !pDocSh->GetVisArea(ASPECT_CONTENT).IsEmpty() ) SetVisArea( pDocSh->GetVisArea(ASPECT_CONTENT),sal_False); - SwEditShell::SetUndoActionCount( - static_cast< sal_uInt16 >( SW_MOD()->GetUndoOptions().GetUndoCount() ) ); - pWrtShell->DoUndo( 0 != SwEditShell::GetUndoActionCount() ); + pWrtShell->DoUndo( 0 != SW_MOD()->GetUndoOptions().GetUndoCount() ); const sal_Bool bBrowse = pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); SetNewWindowAllowed(!bBrowse); @@ -1020,7 +1018,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) // so setze das Modified NICHT zurueck. // --> OD 2005-02-11 #i38810# - no reset of modified state, if document // was already modified. - if ( !pWrtShell->GetDoc()->IsUndoNoResetModified() && + if (!pWrtShell->GetDoc()->GetIDocumentUndoRedo().IsUndoNoResetModified() && ( !pFirst || pFirst == pVFrame ) && !bIsDocModified ) // <-- diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index cd79109f5723..35b5c5648c96 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> @@ -43,7 +44,7 @@ #include <docary.hxx> #include <hintids.hxx> #include <SwRewriter.hxx> -#include <undobj.hxx> +#include <numrule.hxx> #include <swundo.hxx> #include <caption.hxx> #include <svl/PasswordHelper.hxx> @@ -86,6 +87,7 @@ #include <uivwimp.hxx> #include <docsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <wrtsh.hxx> #include <viewopt.hxx> #include <basesh.hxx> @@ -469,7 +471,7 @@ sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq ) rReq.Done(); } - rSh.EndUndo(UNDO_INSERT); // wegen moegl. Shellwechsel + rSh.EndUndo(); // due to possible change of Shell } delete pFileDlg; @@ -2105,10 +2107,8 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe } else { - sal_Bool bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( sal_False ); + ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); nErrno = pDocSh->InsertFrom( *pMedium ) ? 0 : ERR_SWG_READ_ERROR; - pDoc->DoUndo( bUndo ); } } @@ -2125,7 +2125,9 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe { // Disable Undo for .sdw (136991) or // if the number of page styles with header/footer has changed (#i67305) if( !pRead || nUndoCheck != lcl_PageDescWithHeader( *pDoc ) ) - pDoc->DelAllUndoObj(); + { + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + } } pWrtShell->EndAllAction(); diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index f830806ee165..4ba284987091 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -301,12 +301,8 @@ SfxTabPage* CreatePrintOptionsPage( Window *pParent, void SetAppPrintOptions( ViewShell* pSh, sal_Bool bWeb ) { - SwPrintData aPrtData = *SW_MOD()->GetPrtOptions(bWeb); const IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); - SwPrintData* pShellPrintData = pIDDA->getPrintData(); - - if(pShellPrintData) - aPrtData = *pShellPrintData; + SwPrintData aPrtData = pIDDA->getPrintData(); if( pIDDA->getPrinter( false ) ) { diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index f622f021e1d3..1c702dddab3d 100644 --- a/sw/source/ui/uiview/viewsrch.cxx +++ b/sw/source/ui/uiview/viewsrch.cxx @@ -38,9 +38,7 @@ #include <svl/whiter.hxx> #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> -#ifndef _T2XTCMP_HXX //autogen #include <svtools/txtcmp.hxx> -#endif #include <svl/itempool.hxx> #include <svl/eitem.hxx> #include <svl/srchitem.hxx> @@ -52,27 +50,16 @@ #include <swmodule.hxx> #include <swwait.hxx> #include <workctrl.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <wrtsh.hxx> #include <swundo.hxx> // fuer Undo-Ids #include <uitool.hxx> -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif -#ifndef _VIEW_HRC #include <view.hrc> -#endif #include <SwRewriter.hxx> -#include <undobj.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include "PostItMgr.hxx" @@ -598,7 +585,7 @@ void SwView::Replace() pSrchItem->GetReplaceString(), SwWrtShell::GETSTYLE_CREATESOME )); - pWrtShell->EndUndo(UNDO_UI_REPLACE_STYLE); // #111827# + pWrtShell->EndUndo(); // #111827# } else { diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index c3702734011c..fed08c5e90c9 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <com/sun/star/linguistic2/XThesaurus.hpp> #include <com/sun/star/uno/Sequence.hxx> @@ -49,28 +50,20 @@ #include <tox.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/app.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <wrtsh.hxx> -#ifndef _BASESH_HXX #include <basesh.hxx> -#endif #include <uitool.hxx> #include <viewopt.hxx> #include <tablemgr.hxx> #include <pagedesc.hxx> -#ifndef _WVIEW_HXX #include <wview.hxx> -#endif #include <globdoc.hxx> #include <svl/stritem.hxx> #include <unotools/moduleoptions.hxx> #include <svl/visitem.hxx> -#ifndef _CMDID_H #include <cmdid.h> -#endif #include <IDocumentRedlineAccess.hxx> @@ -163,7 +156,7 @@ void SwView::GetState(SfxItemSet &rSet) break; case SID_CLEARHISTORY: { - rSet.Put(SfxBoolItem(nWhich, pWrtShell->GetUndoIds() != UNDO_EMPTY)); + rSet.Put(SfxBoolItem(nWhich, pWrtShell->GetLastUndoInfo(0, 0))); } break; case SID_UNDO: diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index 57eeb265e109..fba5ac67a8d4 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -708,11 +708,7 @@ void SwXDocumentSettings::_postSetValues () // #i86352# the printer is also used as container for options by sfx // when setting a printer it should have decent default options SfxItemSet aOptions( mpPrinter->GetOptions() ); - SwPrintData aPrtData; - if( mpDoc->getPrintData() ) - aPrtData = *mpDoc->getPrintData(); - else - aPrtData = *SW_MOD()->GetPrtOptions(false); + SwPrintData aPrtData( mpDoc->getPrintData() ); SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData); aOptions.Put(aAddPrinterItem); mpPrinter->SetOptions( aOptions ); diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index 2cfc6785b963..1c4a838ae1ca 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -712,11 +712,8 @@ uno::Any SAL_CALL SwXMailMerge::execute( uno::Reference< mail::XMailService > xInService; if (MailMergeType::PRINTER == nCurOutputType) { - SwPrintData aPrtData = *SW_MOD()->GetPrtOptions( sal_False ); IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess(); - SwPrintData* pShellPrintData = pIDDA->getPrintData(); - if (pShellPrintData) - aPrtData = *pShellPrintData; + SwPrintData aPrtData( pIDDA->getPrintData() ); aPrtData.SetPrintSingleJobs( bCurSinglePrintJobs ); pIDDA->setPrintData( aPrtData ); // #i25686# printing should not be done asynchronously to prevent dangling offices diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx index 31e28fccb5d6..c19587f514f2 100644 --- a/sw/source/ui/uno/unomod.cxx +++ b/sw/source/ui/uno/unomod.cxx @@ -340,13 +340,7 @@ void SwXPrintSettings::_preSetValues () { if (!mpDoc) throw IllegalArgumentException (); - if ( !mpDoc->getPrintData() ) - { - mpPrtOpt = new SwPrintData; - mpDoc->setPrintData ( *mpPrtOpt ); - delete mpPrtOpt; - } - mpPrtOpt = mpDoc->getPrintData(); + mpPrtOpt = const_cast< SwPrintData * >(&mpDoc->getPrintData()); } break; } @@ -502,13 +496,7 @@ void SwXPrintSettings::_preGetValues () { if (!mpDoc) throw IllegalArgumentException (); - if ( !mpDoc->getPrintData() ) - { - mpPrtOpt = new SwPrintData; - mpDoc->setPrintData ( *mpPrtOpt ); - delete mpPrtOpt; - } - mpPrtOpt = mpDoc->getPrintData(); + mpPrtOpt = const_cast< SwPrintData * >(&mpDoc->getPrintData()); } break; } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index cc59ae786cdb..023dabf27043 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -198,10 +198,9 @@ SwPrintUIOptions * lcl_GetPrintUIOptions( const bool bHasPostIts = lcl_GetPostIts( pDocShell->GetDoc(), 0 ); // get default values to use in dialog from documents SwPrintData - const SwPrintData *pPrintData = pDocShell->GetDoc()->getPrintData(); - DBG_ASSERT( pPrintData, "failed to get SwPrintData from document" ); + const SwPrintData &rPrintData = pDocShell->GetDoc()->getPrintData(); - return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, *pPrintData ); + return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData ); } //////////////////////////////////////////////////////////// @@ -2616,33 +2615,28 @@ static void lcl_SavePrintUIOptionsToDocumentPrintData( const SwPrintUIOptions &rPrintUIOptions, bool bIsPDFEXport ) { - if (!rDoc.getPrintData()) - { - SwPrintData *pTmpData = new SwPrintData; - rDoc.setPrintData ( *pTmpData ); - delete pTmpData; // setPrintData does make its own copy! - } - - SwPrintData *pDocPrintData = rDoc.getPrintData(); - - pDocPrintData->SetPrintGraphic( rPrintUIOptions.IsPrintGraphics() ); - pDocPrintData->SetPrintTable( rPrintUIOptions.IsPrintTables() ); - pDocPrintData->SetPrintDraw( rPrintUIOptions.IsPrintDrawings() ); - pDocPrintData->SetPrintControl( rPrintUIOptions.IsPrintFormControls() ); - pDocPrintData->SetPrintLeftPage( rPrintUIOptions.IsPrintLeftPages() ); - pDocPrintData->SetPrintRightPage( rPrintUIOptions.IsPrintRightPages() ); - pDocPrintData->SetPrintReverse( rPrintUIOptions.IsPrintReverse() ); - pDocPrintData->SetPaperFromSetup( rPrintUIOptions.IsPaperFromSetup() ); - pDocPrintData->SetPrintEmptyPages( rPrintUIOptions.IsPrintEmptyPages( bIsPDFEXport ) ); - pDocPrintData->SetPrintPostIts( rPrintUIOptions.GetPrintPostItsType() ); - pDocPrintData->SetPrintProspect( rPrintUIOptions.IsPrintProspect() ); - pDocPrintData->SetPrintProspect_RTL( rPrintUIOptions.IsPrintProspectRTL() ); - pDocPrintData->SetPrintPageBackground( rPrintUIOptions.IsPrintPageBackground() ); - pDocPrintData->SetPrintBlackFont( rPrintUIOptions.IsPrintWithBlackTextColor() ); - // pDocPrintData->SetPrintSingleJobs( b ); handled by File/Print dialog itself - // pDocPrintData->SetFaxName( s ); n/a in File/Print dialog - pDocPrintData->SetPrintHiddenText( rPrintUIOptions.IsPrintHiddenText() ); - pDocPrintData->SetPrintTextPlaceholder( rPrintUIOptions.IsPrintTextPlaceholders() ); + SwPrintData aDocPrintData( rDoc.getPrintData() ); + + aDocPrintData.SetPrintGraphic( rPrintUIOptions.IsPrintGraphics() ); + aDocPrintData.SetPrintTable( rPrintUIOptions.IsPrintTables() ); + aDocPrintData.SetPrintDraw( rPrintUIOptions.IsPrintDrawings() ); + aDocPrintData.SetPrintControl( rPrintUIOptions.IsPrintFormControls() ); + aDocPrintData.SetPrintLeftPage( rPrintUIOptions.IsPrintLeftPages() ); + aDocPrintData.SetPrintRightPage( rPrintUIOptions.IsPrintRightPages() ); + aDocPrintData.SetPrintReverse( rPrintUIOptions.IsPrintReverse() ); + aDocPrintData.SetPaperFromSetup( rPrintUIOptions.IsPaperFromSetup() ); + aDocPrintData.SetPrintEmptyPages( rPrintUIOptions.IsPrintEmptyPages( bIsPDFEXport ) ); + aDocPrintData.SetPrintPostIts( rPrintUIOptions.GetPrintPostItsType() ); + aDocPrintData.SetPrintProspect( rPrintUIOptions.IsPrintProspect() ); + aDocPrintData.SetPrintProspect_RTL( rPrintUIOptions.IsPrintProspectRTL() ); + aDocPrintData.SetPrintPageBackground( rPrintUIOptions.IsPrintPageBackground() ); + aDocPrintData.SetPrintBlackFont( rPrintUIOptions.IsPrintWithBlackTextColor() ); + // aDocPrintData.SetPrintSingleJobs( b ); handled by File/Print dialog itself + // arDocPrintData.SetFaxName( s ); n/a in File/Print dialog + aDocPrintData.SetPrintHiddenText( rPrintUIOptions.IsPrintHiddenText() ); + aDocPrintData.SetPrintTextPlaceholder( rPrintUIOptions.IsPrintTextPlaceholders() ); + + rDoc.setPrintData( aDocPrintData ); } diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index 11456749c164..62ceb3860fe6 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -36,9 +36,7 @@ #include <tools/urlobj.hxx> #include <sfx2/docfile.hxx> #include <sfx2/dispatch.hxx> -#ifndef _HELP_HXX #include <vcl/help.hxx> -#endif #include <sot/formats.hxx> #include <vcl/sound.hxx> #include <uiitems.hxx> @@ -47,13 +45,9 @@ #include <fmtfld.hxx> #include <swmodule.hxx> #include <wrtsh.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <errhdl.hxx> -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <content.hxx> #include <frmfmt.hxx> #include <fldbas.hxx> @@ -69,24 +63,12 @@ #include <doc.hxx> #include <unotools.hxx> #include <crsskip.hxx> -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _HELPID_H #include <helpid.h> -#endif -#ifndef _NAVIPI_HRC #include <navipi.hrc> -#endif -#ifndef _UTLUI_HRC #include <utlui.hrc> -#endif -#ifndef _MISC_HRC #include <misc.hrc> -#endif -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <com/sun/star/text/XTextSectionsSupplier.hpp> #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> @@ -102,7 +84,9 @@ #include <svx/svdview.hxx> #include <vcl/scrbar.hxx> #include <comcore.hrc> -#include <undobj.hxx> +#include <SwRewriter.hxx> +#include <hints.hxx> +#include <numrule.hxx> #include <swundo.hxx> #include <ndtxt.hxx> #include <PostItMgr.hxx> @@ -2834,7 +2818,7 @@ void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode) pActiveShell->StartUndo(UNDO_DELETE, &aRewriter); pActiveShell->GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL); pActiveShell->DeleteRow(); - pActiveShell->EndUndo(UNDO_DELETE); + pActiveShell->EndUndo(); pActiveShell->EndAction(); } else if(nMode == EDIT_MODE_RENAME) diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx index badceaa0b572..f0f1d8f88ff4 100644 --- a/sw/source/ui/wrtsh/select.cxx +++ b/sw/source/ui/wrtsh/select.cxx @@ -210,7 +210,7 @@ sal_uLong SwWrtShell::SearchPattern( const SearchOptions& rSearchOpt, sal_Bool b sal_uLong nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace ); if(bCancel) { - Undo(UNDO_EMPTY, 1); + Undo(1); nRet = ULONG_MAX; } return nRet; @@ -238,7 +238,7 @@ sal_uLong SwWrtShell::SearchTempl( const String &rTempl, eStt,eEnd, bCancel, eFlags, pReplaceColl); if(bCancel) { - Undo(UNDO_EMPTY, 1); + Undo(1); nRet = ULONG_MAX; } return nRet; @@ -263,7 +263,7 @@ sal_uLong SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, sal_Bool bNoColls, if(bCancel) { - Undo(UNDO_EMPTY, 1); + Undo(1); nRet = ULONG_MAX; } return nRet; diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 674332335ca2..2d0bcc433be1 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -102,7 +102,6 @@ // -> #111827# #include <SwRewriter.hxx> #include <comcore.hrc> -#include <undobj.hxx> // <- #111827# #include <toolkit/helper/vclunohelper.hxx> @@ -278,7 +277,7 @@ JP 21.01.98: Ueberschreiben ueberschreibt nur die Selektion, nicht das if( bStarted ) { EndAllAction(); - EndUndo(UNDO_REPLACE); + EndUndo(); } // delete pChgFlg; } @@ -378,7 +377,7 @@ void SwWrtShell::Insert( const String &rPath, const String &rFilter, if ( bOwnMgr ) delete pFrmMgr; - EndUndo(UNDO_INSERT); + EndUndo(); EndAllAction(); } diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index c1ace145f7c5..297a9865722b 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -51,6 +51,7 @@ #include <reffld.hxx> #include <swundo.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <viewopt.hxx> // SwViewOptions #include <frmfmt.hxx> // fuer UpdateTable #include <swtable.hxx> // fuer UpdateTable @@ -67,8 +68,7 @@ #include <wrtsh.hrc> #include "swabstdlg.hxx" #include "fldui.hrc" - -#include <undobj.hxx> +#include <SwRewriter.hxx> #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> @@ -97,7 +97,7 @@ void SwWrtShell::Insert(SwField &rFld) } SwEditShell::Insert2(rFld, bDeleted); - EndUndo(UNDO_INSERT); + EndUndo(); EndAllAction(); } @@ -229,10 +229,11 @@ sal_Bool SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet if (pSet == NULL) { - SwDoc * _pDoc = GetDoc(); - - if (_pDoc != NULL) - _pDoc->DelAllUndoObj(); + SwDoc *const pDoc_ = GetDoc(); + if (pDoc_) + { + pDoc_->GetIDocumentUndoRedo().DelAllUndoObj(); + } } } @@ -480,8 +481,14 @@ void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk, // the undostack. Then the change of the section dont create // any undoobject. - BUG 69145 sal_Bool bDoesUndo = DoesUndo(); - if( UNDO_INSSECTION != GetUndoIds() ) - DoUndo( sal_False ); + SwUndoId nLastUndoId(UNDO_EMPTY); + if (GetLastUndoInfo(0, & nLastUndoId)) + { + if (UNDO_INSSECTION != nLastUndoId) + { + DoUndo(false); + } + } UpdateSection( GetSectionFmtPos( *pIns->GetFmt() ), aSection ); DoUndo( bDoesUndo ); } diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx index 89ee4821b0d8..995315b5ada4 100644 --- a/sw/source/ui/wrtsh/wrtundo.cxx +++ b/sw/source/ui/wrtsh/wrtundo.cxx @@ -36,6 +36,7 @@ #include <svl/slstitm.hxx> #include <wrtsh.hxx> #include <swundo.hxx> // fuer Undo-Ids +#include <IDocumentUndoRedo.hxx> #include <swdtflvr.hxx> #include <svtools/svtdata.hxx> #include <svtools/svtools.hrc> @@ -60,7 +61,7 @@ void SwWrtShell::Do( DoType eDoType, sal_uInt16 nCnt ) DoUndo(sal_False); // #i21739# // Modi zuruecksetzen EnterStdMode(); - SwEditShell::Undo(UNDO_EMPTY, nCnt ); + SwEditShell::Undo(nCnt); break; case REDO: DoUndo(sal_False); // #i21739# @@ -113,70 +114,66 @@ void SwWrtShell::Do( DoType eDoType, sal_uInt16 nCnt ) String SwWrtShell::GetDoString( DoType eDoType ) const { - String aStr, aUndoStr; + ::rtl::OUString aUndoStr; sal_uInt16 nResStr = STR_UNDO; switch( eDoType ) { case UNDO: nResStr = STR_UNDO; - aUndoStr = GetUndoIdsStr(); + GetLastUndoInfo(& aUndoStr, 0); break; case REDO: nResStr = STR_REDO; - aUndoStr = GetRedoIdsStr(); + GetFirstRedoInfo(& aUndoStr); break; default:;//prevent warning } - aStr.Insert( String( SvtResId( nResStr)), 0 ); - aStr += aUndoStr; + ::rtl::OUStringBuffer buf = ::rtl::OUStringBuffer( String( SvtResId( nResStr ) ) ); + buf.append(aUndoStr); - return aStr; + return buf.makeStringAndClear(); } sal_uInt16 SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const { - SwUndoIds aIds; + SwUndoComments_t comments; switch( eDoType ) { case UNDO: - GetUndoIds( NULL, &aIds ); + comments = GetIDocumentUndoRedo().GetUndoComments(); break; case REDO: - GetRedoIds( NULL, &aIds ); + comments = GetIDocumentUndoRedo().GetRedoComments(); break; default:;//prevent warning } - String sList; - for( sal_uInt16 n = 0, nEnd = aIds.Count(); n < nEnd; ++n ) + ::rtl::OUStringBuffer buf; + for (size_t i = 0; i < comments.size(); ++i) { - const SwUndoIdAndName& rIdNm = *aIds[ n ]; - if( rIdNm.GetUndoStr() ) - sList += *rIdNm.GetUndoStr(); - else - { - ASSERT( !this, "no Undo/Redo Test set" ); - } - sList += '\n'; + OSL_ENSURE(comments[i].getLength(), "no Undo/Redo Text set"); + buf.append(comments[i]); + buf.append(sal_Unicode('\n')); } - rStrs.SetString( sList ); - return aIds.Count(); + rStrs.SetString(buf.makeStringAndClear()); + return static_cast<sal_uInt16>(comments.size()); } String SwWrtShell::GetRepeatString() const { - String aStr; - String aUndoStr = GetRepeatIdsStr(); + ::rtl::OUString str; + GetRepeatInfo(& str); - if (aUndoStr.Len() > 0) + if (str.getLength() == 0) { - aStr.Insert( SvtResId( STR_REPEAT ), 0 ); - aStr += aUndoStr; + return str; } - return aStr; + ::rtl::OUStringBuffer buf( String(SvtResId(STR_REPEAT)) ); + buf.append(str); + return buf.makeStringAndClear(); } |