LCOV - code coverage report
Current view: top level - sw/source/core/uibase/wrtsh - wrtundo.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 64 0.0 %
Date: 2014-04-14 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <tools/resid.hxx>
      21             : #include <sfx2/app.hxx>
      22             : #include <svl/slstitm.hxx>
      23             : #include <wrtsh.hxx>
      24             : #include <swundo.hxx>
      25             : #include <IDocumentUndoRedo.hxx>
      26             : #include <swdtflvr.hxx>
      27             : #include <svtools/svtresid.hxx>
      28             : #include <svtools/svtools.hrc>
      29             : #include <wrtsh.hrc>
      30             : #include <sfx2/sfx.hrc>
      31             : 
      32             : // Undo ends all modes. If a selection is emerged by the Undo,
      33             : // this must be considered for further action.
      34             : 
      35           0 : void SwWrtShell::Do( DoType eDoType, sal_uInt16 nCnt )
      36             : {
      37             :     // #105332# save current state of DoesUndo()
      38           0 :     sal_Bool bSaveDoesUndo = DoesUndo();
      39             : 
      40           0 :     StartAllAction();
      41           0 :     switch (eDoType)
      42             :     {
      43             :         case UNDO:
      44           0 :             DoUndo(sal_False); // #i21739#
      45             :             // Reset modes
      46           0 :             EnterStdMode();
      47           0 :             SwEditShell::Undo(nCnt);
      48           0 :             break;
      49             :         case REDO:
      50           0 :             DoUndo(sal_False); // #i21739#
      51             :             // Reset modes
      52           0 :             EnterStdMode();
      53           0 :             SwEditShell::Redo( nCnt );
      54           0 :             break;
      55             :         case REPEAT:
      56             :             // #i21739# do not touch undo flag here !!!
      57           0 :             SwEditShell::Repeat( nCnt );
      58           0 :             break;
      59             :     }
      60           0 :     EndAllAction();
      61             :     // #105332# restore undo state
      62           0 :     DoUndo(bSaveDoesUndo);
      63             : 
      64           0 :     bool bCreateXSelection = false;
      65           0 :     const bool bFrmSelected = IsFrmSelected() || IsObjSelected();
      66           0 :     if ( IsSelection() )
      67             :     {
      68           0 :         if ( bFrmSelected )
      69           0 :             UnSelectFrm();
      70             : 
      71             :         // Set the function pointer for canceling the selection at the
      72             :         // cursor position.
      73           0 :         fnKillSel = &SwWrtShell::ResetSelect;
      74           0 :         fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
      75           0 :         bCreateXSelection = true;
      76             :     }
      77           0 :     else if ( bFrmSelected )
      78             :     {
      79           0 :         EnterSelFrmMode();
      80           0 :         bCreateXSelection = true;
      81             :     }
      82           0 :     else if( (CNT_GRF | CNT_OLE ) & GetCntType() )
      83             :     {
      84           0 :         SelectObj( GetCharRect().Pos() );
      85           0 :         EnterSelFrmMode();
      86           0 :         bCreateXSelection = true;
      87             :     }
      88             : 
      89           0 :     if( bCreateXSelection )
      90           0 :         SwTransferable::CreateSelection( *this );
      91             : 
      92             :     // Bug 32918: After deleting of the numbering the object panel remains.
      93             :     //            Why is not here always a CallChgLink called?
      94           0 :     CallChgLnk();
      95           0 : }
      96             : 
      97           0 : OUString SwWrtShell::GetDoString( DoType eDoType ) const
      98             : {
      99           0 :     OUString aUndoStr;
     100           0 :     sal_uInt16 nResStr = STR_UNDO;
     101           0 :     switch( eDoType )
     102             :     {
     103             :     case UNDO:
     104           0 :         nResStr = STR_UNDO;
     105           0 :         GetLastUndoInfo(& aUndoStr, 0);
     106           0 :         break;
     107             :     case REDO:
     108           0 :         nResStr = STR_REDO;
     109           0 :         GetFirstRedoInfo(& aUndoStr);
     110           0 :         break;
     111             :     default:;//prevent warning
     112             :     }
     113             : 
     114           0 :     return  SvtResId( nResStr ).toString() + aUndoStr;
     115             : }
     116             : 
     117           0 : sal_uInt16 SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const
     118             : {
     119           0 :     SwUndoComments_t comments;
     120           0 :     switch( eDoType )
     121             :     {
     122             :     case UNDO:
     123           0 :         comments = GetIDocumentUndoRedo().GetUndoComments();
     124           0 :         break;
     125             :     case REDO:
     126           0 :         comments = GetIDocumentUndoRedo().GetRedoComments();
     127           0 :         break;
     128             :     default:;//prevent warning
     129             :     }
     130             : 
     131           0 :     OUString buf;
     132           0 :     for (size_t i = 0; i < comments.size(); ++i)
     133             :     {
     134             :         OSL_ENSURE(!comments[i].isEmpty(), "no Undo/Redo Text set");
     135           0 :         buf += comments[i] + "\n";
     136             :     }
     137           0 :     rStrs.SetString(buf);
     138           0 :     return static_cast<sal_uInt16>(comments.size());
     139             : }
     140             : 
     141           0 : OUString SwWrtShell::GetRepeatString() const
     142             : {
     143           0 :     OUString str;
     144           0 :     GetRepeatInfo(& str);
     145             : 
     146           0 :     if (str.isEmpty())
     147             :     {
     148           0 :         return str;
     149             :     }
     150             : 
     151           0 :     return SvtResId(STR_REPEAT).toString() + str;
     152             : }
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10