[Libreoffice-commits] .: 2 commits - chart2/source cui/source sc/source sfx2/source svl/source sw/inc sw/source unotools/inc unotools/Library_utl.mk unotools/Package_inc.mk unotools/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Fri Jan 27 06:12:44 PST 2012


 chart2/source/model/main/UndoManager.cxx |    7 -
 cui/source/options/optmemory.cxx         |   15 +-
 sc/source/ui/unoobj/docuno.cxx           |   11 +
 sfx2/source/appl/app.cxx                 |    1 
 sfx2/source/appl/appbas.cxx              |   16 ++
 sfx2/source/appl/appcfg.cxx              |   18 +-
 sfx2/source/appl/appdata.cxx             |    1 
 sfx2/source/control/shell.cxx            |    8 -
 sfx2/source/inc/appdata.hxx              |    2 
 svl/source/undo/undo.cxx                 |    5 
 sw/inc/swmodule.hxx                      |    3 
 sw/source/core/undo/docundo.cxx          |    2 
 sw/source/ui/app/apphdl.cxx              |   32 ----
 sw/source/ui/app/swmodule.cxx            |    1 
 sw/source/ui/inc/inputwin.hxx            |    1 
 sw/source/ui/ribbar/inputwin.cxx         |   18 +-
 sw/source/ui/uiview/view.cxx             |    9 +
 unotools/Library_utl.mk                  |    1 
 unotools/Package_inc.mk                  |    1 
 unotools/inc/unotools/itemholderbase.hxx |    1 
 unotools/inc/unotools/undoopt.hxx        |   51 -------
 unotools/source/config/itemholder1.cxx   |    5 
 unotools/source/config/undoopt.cxx       |  201 -------------------------------
 23 files changed, 68 insertions(+), 342 deletions(-)

New commits:
commit 452d86c9cbfb6b4b7e86426931a0d982dd8bb180
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 27 15:03:39 2012 +0100

    Replace SvtUndoOptions with (simplified) direct configuration access.
    
    Also, code in sw can be simplified under the premise that always
    /org.openoffice.Office.Common/Undo/Steps > 0.

diff --git a/chart2/source/model/main/UndoManager.cxx b/chart2/source/model/main/UndoManager.cxx
index 919c0fa..a4b876f 100644
--- a/chart2/source/model/main/UndoManager.cxx
+++ b/chart2/source/model/main/UndoManager.cxx
@@ -33,9 +33,10 @@
 #include <com/sun/star/lang/DisposedException.hpp>
 /** === end UNO includes === **/
 
+#include <comphelper/processfactory.hxx>
 #include <framework/undomanagerhelper.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <svl/undo.hxx>
-#include <unotools/undoopt.hxx>
 
 //......................................................................................................................
 namespace chart
@@ -85,7 +86,9 @@ namespace chart
                 ,m_aUndoManager()
                 ,m_aUndoHelper( *this )
             {
-                m_aUndoManager.SetMaxUndoActionCount( (sal_uInt16)SvtUndoOptions().GetUndoCount() );
+                m_aUndoManager.SetMaxUndoActionCount(
+                    officecfg::Office::Common::Undo::Steps::get(
+                        comphelper::getProcessComponentContext()));
             }
 
             virtual ~UndoManager_Impl()
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
index 6146620..82782f5 100644
--- a/cui/source/options/optmemory.cxx
+++ b/cui/source/options/optmemory.cxx
@@ -43,7 +43,6 @@
 #include <sfx2/viewfrm.hxx>
 #include <vcl/msgbox.hxx>
 #include <rtl/math.hxx>
-#include <unotools/undoopt.hxx>
 #include <unotools/useroptions.hxx>
 #include <unotools/fontoptions.hxx>
 #include <svtools/menuoptions.hxx>
@@ -185,14 +184,16 @@ sal_Bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet& rSet )
 {
     sal_Bool bModified = sal_False;
 
-    // Undo-Schritte
-    if ( aUndoEdit.GetText() != aUndoEdit.GetSavedValue() )
-        SvtUndoOptions().SetUndoCount((sal_uInt16)aUndoEdit.GetValue());
-
     boost::shared_ptr< unotools::ConfigurationChanges > batch(
         unotools::ConfigurationChanges::create(
             comphelper::getProcessComponentContext()));
 
+    // Undo-Schritte
+    if ( aUndoEdit.GetText() != aUndoEdit.GetSavedValue() )
+        officecfg::Office::Common::Undo::Steps::set(
+            comphelper::getProcessComponentContext(), batch,
+            aUndoEdit.GetValue());
+
     // GraphicCache
     sal_Int32 totalCacheSize = GetNfGraphicCacheVal();
     officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(
@@ -241,7 +242,9 @@ void OfaMemoryOptionsPage::Reset( const SfxItemSet& rSet )
     const SfxPoolItem*  pItem;
 
     // Undo-Schritte
-    aUndoEdit.SetValue( SvtUndoOptions().GetUndoCount() );
+    aUndoEdit.SetValue(
+        officecfg::Office::Common::Undo::Steps::get(
+            comphelper::getProcessComponentContext()));
     aUndoEdit.SaveValue();
 
     // GraphicCache
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a0866c3..eb2cff7 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -35,9 +35,10 @@
 #include <svx/svxids.hrc>
 #include <svx/unoshape.hxx>
 
+#include <comphelper/processfactory.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <svl/numuno.hxx>
 #include <svl/smplhint.hxx>
-#include <unotools/undoopt.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <sfx2/printer.hxx>
 #include <sfx2/bindings.hxx>
@@ -1680,9 +1681,11 @@ void SAL_CALL ScModelObj::setPropertyValue(
         {
             sal_Bool bUndoEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             pDoc->EnableUndo( bUndoEnabled );
-            sal_uInt16 nCount = ( bUndoEnabled ?
-                static_cast< sal_uInt16 >( SvtUndoOptions().GetUndoCount() ) : 0 );
-            pDocShell->GetUndoManager()->SetMaxUndoActionCount( nCount );
+            pDocShell->GetUndoManager()->SetMaxUndoActionCount(
+                bUndoEnabled
+                ? officecfg::Office::Common::Undo::Steps::get(
+                    comphelper::getProcessComponentContext())
+                : 0);
         }
         else if ( aString.EqualsAscii( SC_UNO_ISADJUSTHEIGHTENABLED ) )
         {
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 7e29777..6cae961 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -113,7 +113,6 @@
 #endif
 
 #include <unotools/saveopt.hxx>
-#include <unotools/undoopt.hxx>
 #include <svtools/helpopt.hxx>
 #include <unotools/pathoptions.hxx>
 #include <unotools/viewoptions.hxx>
diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx
index 1f28ec8..660f9a1 100644
--- a/sfx2/source/appl/appbas.cxx
+++ b/sfx2/source/appl/appbas.cxx
@@ -31,6 +31,7 @@
 #include <comphelper/processfactory.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <basic/basrdll.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <svl/macitem.hxx>
 #include <basic/sbxfac.hxx>
 #include <basic/sbx.hxx>
@@ -48,7 +49,6 @@
 #include <svtools/sfxecode.hxx>
 #include <svtools/ehdl.hxx>
 
-#include <unotools/undoopt.hxx>
 #include <unotools/pathoptions.hxx>
 #include <unotools/useroptions.hxx>
 #include <unotools/bootstrap.hxx>
@@ -182,7 +182,13 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq )
         case SID_ATTR_UNDO_COUNT:
         {
             SFX_REQUEST_ARG(rReq, pCountItem, SfxUInt16Item, nSID, sal_False);
-            SvtUndoOptions().SetUndoCount( pCountItem->GetValue() );
+            boost::shared_ptr< unotools::ConfigurationChanges > batch(
+                unotools::ConfigurationChanges::create(
+                    comphelper::getProcessComponentContext()));
+            officecfg::Office::Common::Undo::Steps::set(
+                comphelper::getProcessComponentContext(), batch,
+                pCountItem->GetValue());
+            batch->commit();
             break;
         }
 
@@ -245,7 +251,11 @@ void SfxApplication::PropState_Impl( SfxItemSet &rSet )
                 break;
 
             case SID_ATTR_UNDO_COUNT:
-                rSet.Put( SfxUInt16Item( SID_ATTR_UNDO_COUNT, sal::static_int_cast< sal_uInt16 >( SvtUndoOptions().GetUndoCount() ) ) );
+                rSet.Put(
+                    SfxUInt16Item(
+                        SID_ATTR_UNDO_COUNT,
+                        officecfg::Office::Common::Undo::Steps::get(
+                            comphelper::getProcessComponentContext())));
                 break;
 
             case SID_UPDATE_VERSION:
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index cd91d40..25ff74c 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -52,11 +52,11 @@
 #include <svl/isethint.hxx>
 
 #include <officecfg/Inet.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <unotools/configmgr.hxx>
 #include <tools/urlobj.hxx>
 #include <unotools/saveopt.hxx>
 #include <svtools/helpopt.hxx>
-#include <unotools/undoopt.hxx>
 #include <unotools/securityoptions.hxx>
 #include <unotools/pathoptions.hxx>
 #include <svtools/miscopt.hxx>
@@ -169,7 +169,6 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet )
 
     const sal_uInt16 *pRanges = rSet.GetRanges();
     SvtSaveOptions aSaveOptions;
-    SvtUndoOptions aUndoOptions;
     SvtHelpOptions aHelpOptions;
     SvtSecurityOptions  aSecurityOptions;
     SvtMiscOptions aMiscOptions;
@@ -296,9 +295,14 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet )
                         bRet = sal_True;
                 break;
                 case SID_ATTR_UNDO_COUNT :
-                    if(rSet.Put( SfxUInt16Item ( rPool.GetWhich( SID_ATTR_UNDO_COUNT ),
-                                 (sal_uInt16)aUndoOptions.GetUndoCount() ) ) )
-                        bRet = sal_True;
+                    if (rSet.Put(
+                            SfxUInt16Item (
+                                rPool.GetWhich(SID_ATTR_UNDO_COUNT),
+                                officecfg::Office::Common::Undo::Steps::get(
+                                    comphelper::getProcessComponentContext()))))
+                    {
+                        bRet = true;
+                    }
                     break;
                 case SID_ATTR_QUICKLAUNCHER :
                 {
@@ -531,7 +535,6 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
     SfxItemPool &rPool = GetPool();
 
     SvtSaveOptions aSaveOptions;
-    SvtUndoOptions aUndoOptions;
     SvtHelpOptions aHelpOptions;
     SvtSecurityOptions aSecurityOptions;
     SvtPathOptions aPathOptions;
@@ -703,7 +706,8 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
     {
         DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected");
         sal_uInt16 nUndoCount = ((const SfxUInt16Item*)pItem)->GetValue();
-        aUndoOptions.SetUndoCount( nUndoCount );
+        officecfg::Office::Common::Undo::Steps::set(
+            comphelper::getProcessComponentContext(), batch, nUndoCount);
 
         // To catch all Undo-Managers: Iterate over all Frames
         for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst();
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 182ed41..0358dd4 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -103,7 +103,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* )
     , pPool(0)
     , pDisabledSlotList( 0 )
     , pSaveOptions( 0 )
-    , pUndoOptions( 0 )
     , pHelpOptions( 0 )
     , pProgress(0)
     , pTemplateCommon( 0 )
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 74ce184..de87975 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -28,7 +28,9 @@
 
 #include <com/sun/star/embed/VerbDescriptor.hpp>
 #include <com/sun/star/embed/VerbAttributes.hpp>
+#include <comphelper/processfactory.hxx>
 #include <basic/sbstar.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <rtl/oustringostreaminserter.hxx>
 #include <sal/log.hxx>
 #include <svl/itempool.hxx>
@@ -37,8 +39,6 @@
 #include <svtools/asynclink.hxx>
 #include <basic/sbx.hxx>
 
-#include <unotools/undoopt.hxx>
-
 #include <sfx2/app.hxx>
 #include <sfx2/shell.hxx>
 #include <sfx2/bindings.hxx>
@@ -486,7 +486,9 @@ void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr )
 
     pUndoMgr = pNewUndoMgr;
     if ( pUndoMgr )
-        pUndoMgr->SetMaxUndoActionCount( (sal_uInt16) SvtUndoOptions().GetUndoCount() );
+        pUndoMgr->SetMaxUndoActionCount(
+            officecfg::Office::Common::Undo::Steps::get(
+                comphelper::getProcessComponentContext()));
 }
 
 //--------------------------------------------------------------------
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 96a3118..9387730 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -55,7 +55,6 @@ class SfxDdeTriggerTopic_Impl;
 class SfxDocumentTemplates;
 class SfxFrameArr_Impl;
 class SvtSaveOptions;
-class SvtUndoOptions;
 class SvtHelpOptions;
 class SfxObjectFactory;
 class SfxObjectShell;
@@ -115,7 +114,6 @@ public:
     SfxItemPool*                        pPool;
     std::vector<sal_uInt16>*            pDisabledSlotList;
     SvtSaveOptions*                     pSaveOptions;
-    SvtUndoOptions*                     pUndoOptions;
     SvtHelpOptions*                     pHelpOptions;
 
     // "current" functionality
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index 70cae0f..72f026a 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -62,7 +62,6 @@ namespace svtools{ class ColorConfig;}
 class SvtAccessibilityOptions;
 class SvtCTLOptions;
 class SvtUserOptions;
-class SvtUndoOptions;
 
 struct SwDBData;
 #define VIEWOPT_DEST_VIEW       0
@@ -94,7 +93,6 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::C
     SvtAccessibilityOptions* pAccessibilityOptions;
     SvtCTLOptions*      pCTLOptions;
     SvtUserOptions*     pUserOptions;
-    SvtUndoOptions*     pUndoOptions;
 
     SfxErrorHandler*    pErrorHdl;
 
@@ -180,7 +178,6 @@ public:
     SvtAccessibilityOptions&    GetAccessibilityOptions();
     SvtCTLOptions&      GetCTLOptions();
     SvtUserOptions&     GetUserOptions();
-    SvtUndoOptions&     GetUndoOptions();
 
     // Iterate over views.
     static SwView*      GetFirstView();
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index abc863e..18dc5b6 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -29,8 +29,6 @@
 
 #include <UndoManager.hxx>
 
-#include <unotools/undoopt.hxx>
-
 #include <vcl/wrkwin.hxx>
 
 #include <svx/svdmodel.hxx>
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx
index 716300e..34fce61 100644
--- a/sw/source/ui/app/apphdl.cxx
+++ b/sw/source/ui/app/apphdl.cxx
@@ -32,7 +32,6 @@
 #include <tools/link.hxx>
 #include <svl/svstdarr.hxx>
 #include <svl/urihelper.hxx>
-#include <unotools/undoopt.hxx>
 #include <unotools/pathoptions.hxx>
 #include <svtools/accessibilityoptions.hxx>
 #include <sfx2/dispatch.hxx>
@@ -770,11 +769,6 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
                 pUserOptions->RemoveListener(this);
                 DELETEZ(pUserOptions);
             }
-            if( pUndoOptions )
-            {
-                pUndoOptions->RemoveListener(this);
-                DELETEZ(pUndoOptions);
-            }
         }
     }
 }
@@ -785,22 +779,6 @@ void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal
     {
         bAuthorInitialised = sal_False;
     }
-    else if( pBrdCst == pUndoOptions )
-    {
-        sal_Int32 const nNew = GetUndoOptions().GetUndoCount();
-        bool const bUndo = (nNew != 0);
-        // switch Undo for all DocShells
-            // Iterate through DocShells and switch undos
-        TypeId aType(TYPE(SwDocShell));
-        SwDocShell * pDocShell =
-            static_cast<SwDocShell *>(SfxObjectShell::GetFirst(&aType));
-        while (pDocShell)
-        {
-            pDocShell->GetDoc()->GetIDocumentUndoRedo().DoUndo(bUndo);
-            pDocShell = static_cast<SwDocShell *>(
-                    SfxObjectShell::GetNext(*pDocShell, &aType));
-        }
-    }
     else if ( pBrdCst == pColorConfig || pBrdCst == pAccessibilityOptions )
     {
         sal_Bool bAccessibility = sal_False;
@@ -902,16 +880,6 @@ SvtUserOptions& SwModule::GetUserOptions()
     return *pUserOptions;
 }
 
-SvtUndoOptions& SwModule::GetUndoOptions()
-{
-    if(!pUndoOptions)
-    {
-        pUndoOptions = new SvtUndoOptions;
-        pUndoOptions->AddListener(this);
-    }
-    return *pUndoOptions;
-}
-
 const SwMasterUsrPref *SwModule::GetUsrPref(sal_Bool bWeb) const
 {
     SwModule* pNonConstModule = (SwModule*)this;
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index bbaff8f..b37b86f 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -176,7 +176,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
     pAccessibilityOptions(0),
     pCTLOptions(0),
     pUserOptions(0),
-    pUndoOptions(0),
     pAttrPool(0),
     pView(0),
     bAuthorInitialised(sal_False),
diff --git a/sw/source/ui/inc/inputwin.hxx b/sw/source/ui/inc/inputwin.hxx
index 0c9b185..0040d43 100644
--- a/sw/source/ui/inc/inputwin.hxx
+++ b/sw/source/ui/inc/inputwin.hxx
@@ -67,7 +67,6 @@ friend class InputEdit;
     SwView*         pView;
     SfxBindings*    pBindings;
     String          aAktTableName, sOldFml;
-    sal_Int32       m_nActionCount;
 
     sal_Bool        bFirst : 1;  // initialisations at first call
     sal_Bool        bActive : 1; // for hide/show when switching documents
diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx
index 9657ca3..34497e8 100644
--- a/sw/source/ui/ribbar/inputwin.cxx
+++ b/sw/source/ui/ribbar/inputwin.cxx
@@ -26,8 +26,10 @@
  *
  ************************************************************************/
 
+#include "sal/config.h"
 
-
+#include <comphelper/processfactory.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <tools/gen.hxx>
 #include <sfx2/imgmgr.hxx>
 #include <sfx2/viewfrm.hxx>
@@ -35,7 +37,6 @@
 #include <svx/ruler.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/stritem.hxx>
-#include <unotools/undoopt.hxx>
 
 #include "swtypes.hxx"
 #include "cmdid.h"
@@ -74,7 +75,6 @@ SwInputWindow::SwInputWindow( Window* pParent, SfxBindings* pBind )
     pView(0),
     pBindings(pBind),
     aAktTableName(aEmptyStr)
-    , m_nActionCount(0)
     , m_bDoesUndo(true)
     , m_bResetUndo(false)
     , m_bCallUndo(false)
@@ -158,10 +158,6 @@ void SwInputWindow::CleanupUglyHackWithUndo()
         {
             pWrtShell->Undo();
         }
-        if (0 == m_nActionCount)
-        {
-            SW_MOD()->GetUndoOptions().SetUndoCount(0);
-        }
         m_bResetUndo = false; // #i117122# once is enough :)
     }
 }
@@ -246,10 +242,10 @@ void SwInputWindow::ShowWin()
             if( bIsTable )
             {
                 m_bResetUndo = true;
-                m_nActionCount = SW_MOD()->GetUndoOptions().GetUndoCount();
-                if (0 == m_nActionCount) { // deactivated? turn it on...
-                    SW_MOD()->GetUndoOptions().SetUndoCount(1);
-                }
+                SAL_WARN_IF(
+                    officecfg::Office::Common::Undo::Steps::get(
+                        comphelper::getProcessComponentContext()) <= 0,
+                    "sw", "/org.openoffice.Office.Common/Undo/Steps <= 0");
 
                 m_bDoesUndo = pWrtShell->DoesUndo();
                 if( !m_bDoesUndo )
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 738758f..0b10a46 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -31,12 +31,13 @@
 #include <stdlib.h>
 #include <hintids.hxx>
 #include <comphelper/string.hxx>
+#include <comphelper/processfactory.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <rtl/logfile.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/inputctx.hxx>
 #include <basic/sbxobj.hxx>
 #include <svl/eitem.hxx>
-#include <unotools/undoopt.hxx>
 #include <unotools/lingucfg.hxx>
 #include <unotools/useroptions.hxx>
 #include <sfx2/dispatch.hxx>
@@ -946,7 +947,11 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
         !pDocSh->GetVisArea(ASPECT_CONTENT).IsEmpty() )
         SetVisArea( pDocSh->GetVisArea(ASPECT_CONTENT),sal_False);
 
-    pWrtShell->DoUndo( 0 != SW_MOD()->GetUndoOptions().GetUndoCount() );
+    SAL_WARN_IF(
+        officecfg::Office::Common::Undo::Steps::get(
+            comphelper::getProcessComponentContext()) <= 0,
+        "sw", "/org.openoffice.Office.Common/Undo/Steps <= 0");
+    pWrtShell->DoUndo( true );
 
     const sal_Bool bBrowse = pWrtShell->GetViewOptions()->getBrowseMode();
     // Disable "multiple window"
diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk
index 687c8d3..71ca9c8 100644
--- a/unotools/Library_utl.mk
+++ b/unotools/Library_utl.mk
@@ -106,7 +106,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\
     unotools/source/config/securityoptions \
     unotools/source/config/startoptions \
     unotools/source/config/syslocaleoptions \
-    unotools/source/config/undoopt \
     unotools/source/config/useroptions \
     unotools/source/config/viewoptions \
     unotools/source/config/workingsetoptions \
diff --git a/unotools/Package_inc.mk b/unotools/Package_inc.mk
index 1e54854..426a8c0 100644
--- a/unotools/Package_inc.mk
+++ b/unotools/Package_inc.mk
@@ -99,7 +99,6 @@ $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/transliterationwrapp
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucbhelper.hxx,unotools/ucbhelper.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucblockbytes.hxx,unotools/ucblockbytes.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucbstreamhelper.hxx,unotools/ucbstreamhelper.hxx))
-$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/undoopt.hxx,unotools/undoopt.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/unotoolsdllapi.h,unotools/unotoolsdllapi.h))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions_const.hxx,unotools/useroptions_const.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions.hxx,unotools/useroptions.hxx))
diff --git a/unotools/inc/unotools/itemholderbase.hxx b/unotools/inc/unotools/itemholderbase.hxx
index 67a5d35..34bf43f 100644
--- a/unotools/inc/unotools/itemholderbase.hxx
+++ b/unotools/inc/unotools/itemholderbase.hxx
@@ -99,7 +99,6 @@ enum EItem
     E_STARTOPTIONS                  ,   //
     E_SYSLOCALEOPTIONS              ,   // 2
 
-    E_UNDOOPTIONS                   ,   // 2
     E_USEROPTIONS                   ,   // 2
 
     E_VIEWOPTIONS_DIALOG            ,   //
diff --git a/unotools/inc/unotools/undoopt.hxx b/unotools/inc/unotools/undoopt.hxx
deleted file mode 100644
index 840687b..0000000
--- a/unotools/inc/unotools/undoopt.hxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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 INCLUDED_unotools_UNDOOPT_HXX
-#define INCLUDED_unotools_UNDOOPT_HXX
-
-#include "unotools/unotoolsdllapi.h"
-#include <sal/types.h>
-#include <unotools/options.hxx>
-
-class SvtUndoOptions_Impl;
-
-class UNOTOOLS_DLLPUBLIC SvtUndoOptions: public utl::detail::Options
-{
-    SvtUndoOptions_Impl*    pImp;
-
-public:
-                            SvtUndoOptions();
-                            virtual ~SvtUndoOptions();
-
-    void                    SetUndoCount( sal_Int32 n );
-    sal_Int32               GetUndoCount() const;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index 5df8afc..0c83cb8 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -35,7 +35,6 @@
 #include <com/sun/star/lang/XComponent.hpp>
 
 #include <unotools/misccfg.hxx>
-#include <unotools/undoopt.hxx>
 #include <unotools/useroptions.hxx>
 #include <unotools/accelcfg.hxx>
 #include <unotools/cmdoptions.hxx>
@@ -284,10 +283,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
             // ??? TODO
             break;
 
-        case E_UNDOOPTIONS :
-            rItem.pItem = new SvtUndoOptions();
-            break;
-
         case E_USEROPTIONS :
             rItem.pItem = new SvtUserOptions();
             break;
diff --git a/unotools/source/config/undoopt.cxx b/unotools/source/config/undoopt.cxx
deleted file mode 100644
index 3233b85..0000000
--- a/unotools/source/config/undoopt.cxx
+++ /dev/null
@@ -1,201 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-
-#include <unotools/undoopt.hxx>
-#include "rtl/instance.hxx"
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <osl/mutex.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-using namespace utl;
-using namespace com::sun::star::uno;
-using ::rtl::OUString;
-
-static SvtUndoOptions_Impl* pOptions = NULL;
-static sal_Int32           nRefCount = 0;
-
-#define STEPS 0
-
-class SvtUndoOptions_Impl : public utl::ConfigItem
-{
-    sal_Int32               nUndoCount;
-    Sequence< rtl::OUString > m_aPropertyNames;
-
-public:
-                            SvtUndoOptions_Impl();
-
-    virtual void            Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
-    virtual void            Commit();
-    void                    Load();
-
-    void                    SetUndoCount( sal_Int32 n ) { nUndoCount = n; SetModified();  }
-    sal_Int32               GetUndoCount() const        { return nUndoCount; }
-};
-
-// -----------------------------------------------------------------------
-
-SvtUndoOptions_Impl::SvtUndoOptions_Impl()
-    : ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Undo")) )
-    , nUndoCount( 20 )
-{
-    Load();
-}
-
-void SvtUndoOptions_Impl::Commit()
-{
-    Sequence< Any > aValues( m_aPropertyNames.getLength() );
-    Any* pValues = aValues.getArray();
-    for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ )
-    {
-        switch ( nProp )
-        {
-            case STEPS :
-                pValues[nProp] <<= nUndoCount;
-                break;
-            default:
-                SAL_WARN( "unotools.config", "invalid index to save a path" );
-        }
-    }
-
-    PutProperties( m_aPropertyNames, aValues );
-    NotifyListeners(0);
-}
-
-// -----------------------------------------------------------------------
-void SvtUndoOptions_Impl::Load()
-{
-    if(!m_aPropertyNames.getLength())
-    {
-        static const char* aPropNames[] =
-        {
-            "Steps",
-        };
-
-        const int nCount = sizeof( aPropNames ) / sizeof( const char* );
-        m_aPropertyNames.realloc(nCount);
-        OUString* pNames = m_aPropertyNames.getArray();
-        for ( int i = 0; i < nCount; i++ )
-            pNames[i] = OUString::createFromAscii( aPropNames[i] );
-        EnableNotification( m_aPropertyNames );
-    }
-
-    Sequence< Any > aValues = GetProperties( m_aPropertyNames );
-    const Any* pValues = aValues.getConstArray();
-    DBG_ASSERT( aValues.getLength() == m_aPropertyNames.getLength(), "GetProperties failed" );
-    if ( aValues.getLength() == m_aPropertyNames.getLength() )
-    {
-        for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ )
-        {
-            if ( pValues[nProp].hasValue() )
-            {
-                switch ( nProp )
-                {
-                    case STEPS :
-                    {
-                        sal_Int32 nTemp = 0;
-                        if ( pValues[nProp] >>= nTemp )
-                            nUndoCount = nTemp;
-                        else
-                        {
-                            OSL_FAIL( "Wrong Type!" );
-                        }
-                        break;
-                    }
-
-                    default:
-                        OSL_FAIL( "Wrong Type!" );
-                        break;
-                }
-            }
-        }
-    }
-}
-// -----------------------------------------------------------------------
-void SvtUndoOptions_Impl::Notify( const Sequence<rtl::OUString>& )
-{
-    Load();
-}
-
-// -----------------------------------------------------------------------
-namespace
-{
-    class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton >
-    {
-    };
-}
-
-// -----------------------------------------------------------------------
-SvtUndoOptions::SvtUndoOptions()
-{
-    // Global access, must be guarded (multithreading)
-    ::osl::MutexGuard aGuard( LocalSingleton::get() );
-    if ( !pOptions )
-    {
-        RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtUndoOptions_Impl::ctor()");
-        pOptions = new SvtUndoOptions_Impl;
-
-        ItemHolder1::holdConfigItem(E_UNDOOPTIONS);
-    }
-    ++nRefCount;
-    pImp = pOptions;
-    pImp->AddListener(this);
-}
-
-// -----------------------------------------------------------------------
-
-SvtUndoOptions::~SvtUndoOptions()
-{
-    // Global access, must be guarded (multithreading)
-    ::osl::MutexGuard aGuard( LocalSingleton::get() );
-    pImp->RemoveListener(this);
-    if ( !--nRefCount )
-    {
-        if ( pOptions->IsModified() )
-            pOptions->Commit();
-        DELETEZ( pOptions );
-    }
-}
-
-void SvtUndoOptions::SetUndoCount( sal_Int32 n )
-{
-    pImp->SetUndoCount( n );
-}
-
-sal_Int32 SvtUndoOptions::GetUndoCount() const
-{
-    return pImp->GetUndoCount();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit db59e4481614f58e111a86a1926e49fb523ebbae
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 27 14:58:19 2012 +0100

    Do not move nCurUndoAction < 0.
    
    (Could easily happen when max undo steps is set to 1.)

diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index b3bd440..449b79a 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -654,7 +654,10 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( SfxUndoAction *pAction, bool bT
         {
             i_guard.markForDeletion( m_pData->pActUndoArray->aUndoActions[0].pAction );
             m_pData->pActUndoArray->aUndoActions.Remove(0);
-            --m_pData->pActUndoArray->nCurUndoAction;
+            if (m_pData->pActUndoArray->nCurUndoAction > 0)
+            {
+                --m_pData->pActUndoArray->nCurUndoAction;
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list