LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - unchss.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 57 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 234 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <svl/itemset.hxx>
      30                 :            : #include <svl/style.hxx>
      31                 :            : #include <svl/smplhint.hxx>
      32                 :            : #include <svx/svdobj.hxx>
      33                 :            : 
      34                 :            : #include "unchss.hxx"
      35                 :            : 
      36                 :            : #include "strings.hrc"
      37                 :            : #include "glob.hxx"
      38                 :            : #include "sdresid.hxx"
      39                 :            : #include "drawdoc.hxx"
      40                 :            : #include "stlsheet.hxx"
      41                 :            : #include "glob.hrc"
      42                 :            : 
      43                 :            : 
      44 [ #  # ][ #  # ]:          0 : TYPEINIT1(StyleSheetUndoAction, SdUndoAction);
      45                 :            : 
      46                 :            : 
      47                 :            : 
      48                 :            : /*************************************************************************
      49                 :            : |*
      50                 :            : |* Konstruktor
      51                 :            : |*
      52                 :            : \************************************************************************/
      53                 :            : 
      54                 :          0 : StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument* pTheDoc,
      55                 :            :                                            SfxStyleSheet* pTheStyleSheet,
      56                 :            :                                            const SfxItemSet* pTheNewItemSet) :
      57         [ #  # ]:          0 :                       SdUndoAction(pTheDoc)
      58                 :            : {
      59                 :            :     DBG_ASSERT(pTheStyleSheet, "Undo ohne StyleSheet ???");
      60                 :          0 :     pStyleSheet = pTheStyleSheet;
      61                 :            : 
      62                 :            :     // ItemSets anlegen; Vorsicht, das neue koennte aus einem anderen Pool
      63                 :            :     // stammen, also mitsamt seinen Items clonen
      64 [ #  # ][ #  # ]:          0 :     pNewSet = new SfxItemSet((SfxItemPool&)SdrObject::GetGlobalDrawObjectItemPool(), pTheNewItemSet->GetRanges());
                 [ #  # ]
      65         [ #  # ]:          0 :     pTheDoc->MigrateItemSet( pTheNewItemSet, pNewSet, pTheDoc );
      66                 :            : 
      67 [ #  # ][ #  # ]:          0 :     pOldSet = new SfxItemSet((SfxItemPool&)SdrObject::GetGlobalDrawObjectItemPool(),pStyleSheet->GetItemSet().GetRanges());
         [ #  # ][ #  # ]
      68 [ #  # ][ #  # ]:          0 :     pTheDoc->MigrateItemSet( &pStyleSheet->GetItemSet(), pOldSet, pTheDoc );
      69                 :            : 
      70 [ #  # ][ #  # ]:          0 :     aComment = String(SdResId(STR_UNDO_CHANGE_PRES_OBJECT));
         [ #  # ][ #  # ]
      71 [ #  # ][ #  # ]:          0 :     String aName(pStyleSheet->GetName());
      72                 :            : 
      73                 :            :     // Layoutnamen und Separator loeschen
      74         [ #  # ]:          0 :     String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ) );
      75         [ #  # ]:          0 :     sal_uInt16 nPos = aName.Search(aSep);
      76         [ #  # ]:          0 :     if( nPos != STRING_NOTFOUND )
      77         [ #  # ]:          0 :         aName.Erase(0, nPos + aSep.Len());
      78                 :            : 
      79 [ #  # ][ #  # ]:          0 :     if (aName == String(SdResId(STR_LAYOUT_TITLE)))
         [ #  # ][ #  # ]
                 [ #  # ]
      80                 :            :     {
      81 [ #  # ][ #  # ]:          0 :         aName = String(SdResId(STR_PSEUDOSHEET_TITLE));
         [ #  # ][ #  # ]
      82                 :            :     }
      83 [ #  # ][ #  # ]:          0 :     else if (aName == String(SdResId(STR_LAYOUT_SUBTITLE)))
         [ #  # ][ #  # ]
                 [ #  # ]
      84                 :            :     {
      85 [ #  # ][ #  # ]:          0 :         aName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE));
         [ #  # ][ #  # ]
      86                 :            :     }
      87 [ #  # ][ #  # ]:          0 :     else if (aName == String(SdResId(STR_LAYOUT_BACKGROUND)))
         [ #  # ][ #  # ]
                 [ #  # ]
      88                 :            :     {
      89 [ #  # ][ #  # ]:          0 :         aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND));
         [ #  # ][ #  # ]
      90                 :            :     }
      91 [ #  # ][ #  # ]:          0 :     else if (aName == String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS)))
         [ #  # ][ #  # ]
                 [ #  # ]
      92                 :            :     {
      93 [ #  # ][ #  # ]:          0 :         aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS));
         [ #  # ][ #  # ]
      94                 :            :     }
      95 [ #  # ][ #  # ]:          0 :     else if (aName == String(SdResId(STR_LAYOUT_NOTES)))
         [ #  # ][ #  # ]
                 [ #  # ]
      96                 :            :     {
      97 [ #  # ][ #  # ]:          0 :         aName = String(SdResId(STR_PSEUDOSHEET_NOTES));
         [ #  # ][ #  # ]
      98                 :            :     }
      99                 :            :     else
     100                 :            :     {
     101 [ #  # ][ #  # ]:          0 :         String aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE));
     102         [ #  # ]:          0 :         nPos = aName.Search(aOutlineStr);
     103         [ #  # ]:          0 :         if (nPos != STRING_NOTFOUND)
     104                 :            :         {
     105         [ #  # ]:          0 :             String aNumStr(aName.Copy(aOutlineStr.Len()));
     106 [ #  # ][ #  # ]:          0 :             aName = String(SdResId(STR_LAYOUT_OUTLINE));
         [ #  # ][ #  # ]
     107 [ #  # ][ #  # ]:          0 :             aName += aNumStr;
     108         [ #  # ]:          0 :         }
     109                 :            :     }
     110                 :            : 
     111                 :            :     // Platzhalter durch Vorlagennamen ersetzen
     112         [ #  # ]:          0 :     nPos = aComment.Search(sal_Unicode('$'));
     113         [ #  # ]:          0 :     aComment.Erase(nPos, 1);
     114 [ #  # ][ #  # ]:          0 :     aComment.Insert(aName, nPos);
                 [ #  # ]
     115                 :          0 : }
     116                 :            : 
     117                 :            : 
     118                 :            : /*************************************************************************
     119                 :            : |*
     120                 :            : |* Undo()
     121                 :            : |*
     122                 :            : \************************************************************************/
     123                 :            : 
     124                 :          0 : void StyleSheetUndoAction::Undo()
     125                 :            : {
     126         [ #  # ]:          0 :     SfxItemSet aNewSet( mpDoc->GetItemPool(), pOldSet->GetRanges() );
     127         [ #  # ]:          0 :     mpDoc->MigrateItemSet( pOldSet, &aNewSet, mpDoc );
     128                 :            : 
     129 [ #  # ][ #  # ]:          0 :     pStyleSheet->GetItemSet().Set(aNewSet);
     130         [ #  # ]:          0 :     if( pStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO )
     131 [ #  # ][ #  # ]:          0 :         ( (SdStyleSheet*)pStyleSheet )->GetRealStyleSheet()->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
         [ #  # ][ #  # ]
     132                 :            :     else
     133 [ #  # ][ #  # ]:          0 :         pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
         [ #  # ][ #  # ]
     134                 :          0 : }
     135                 :            : 
     136                 :            : /*************************************************************************
     137                 :            : |*
     138                 :            : |* Redo()
     139                 :            : |*
     140                 :            : \************************************************************************/
     141                 :            : 
     142                 :          0 : void StyleSheetUndoAction::Redo()
     143                 :            : {
     144         [ #  # ]:          0 :     SfxItemSet aNewSet( mpDoc->GetItemPool(), pOldSet->GetRanges() );
     145         [ #  # ]:          0 :     mpDoc->MigrateItemSet( pNewSet, &aNewSet, mpDoc );
     146                 :            : 
     147 [ #  # ][ #  # ]:          0 :     pStyleSheet->GetItemSet().Set(aNewSet);
     148         [ #  # ]:          0 :     if( pStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO )
     149 [ #  # ][ #  # ]:          0 :         ( (SdStyleSheet*)pStyleSheet )->GetRealStyleSheet()->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
         [ #  # ][ #  # ]
     150                 :            :     else
     151 [ #  # ][ #  # ]:          0 :         pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
         [ #  # ][ #  # ]
     152                 :          0 : }
     153                 :            : 
     154                 :            : /*************************************************************************
     155                 :            : |*
     156                 :            : |* Destruktor
     157                 :            : |*
     158                 :            : \************************************************************************/
     159                 :            : 
     160         [ #  # ]:          0 : StyleSheetUndoAction::~StyleSheetUndoAction()
     161                 :            : {
     162 [ #  # ][ #  # ]:          0 :     delete pNewSet;
     163 [ #  # ][ #  # ]:          0 :     delete pOldSet;
     164         [ #  # ]:          0 : }
     165                 :            : 
     166                 :            : /*************************************************************************
     167                 :            : |*
     168                 :            : |* Kommentar liefern
     169                 :            : |*
     170                 :            : \************************************************************************/
     171                 :            : 
     172                 :          0 : rtl::OUString StyleSheetUndoAction::GetComment() const
     173                 :            : {
     174                 :          0 :     return aComment;
     175                 :            : }
     176                 :            : 
     177                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10