LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/func - unmovss.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-12-27 Functions: 0 6 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             : 
      21             : #include "unmovss.hxx"
      22             : #include "DrawDocShell.hxx"
      23             : #include "drawdoc.hxx"
      24             : #include "stlsheet.hxx"
      25             : #include "stlpool.hxx"
      26             : 
      27           0 : SdMoveStyleSheetsUndoAction::SdMoveStyleSheetsUndoAction( SdDrawDocument* pTheDoc, SdStyleSheetVector& rTheStyles, bool bInserted)
      28             : : SdUndoAction(pTheDoc)
      29           0 : , mbMySheets( !bInserted )
      30             : {
      31           0 :     maStyles.swap( rTheStyles );
      32             : 
      33           0 :     maListOfChildLists.resize( maStyles.size() );
      34             :     // Liste mit den Listen der StyleSheet-Kinder erstellen
      35           0 :     std::size_t i = 0;
      36           0 :     for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); ++iter )
      37             :     {
      38           0 :         maListOfChildLists[i++] = SdStyleSheetPool::CreateChildList( (*iter).get() );
      39             :     }
      40           0 : }
      41             : 
      42             : /*************************************************************************
      43             : |*
      44             : |* Undo()
      45             : |*
      46             : \************************************************************************/
      47             : 
      48           0 : void SdMoveStyleSheetsUndoAction::Undo()
      49             : {
      50           0 :     SfxStyleSheetBasePool* pPool  = mpDoc->GetStyleSheetPool();
      51             : 
      52           0 :     if (mbMySheets)
      53             :     {
      54             :         // the styles have to be inserted in the pool
      55             : 
      56             :         // first insert all styles to the pool
      57           0 :         for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); ++iter )
      58             :         {
      59           0 :             pPool->Insert((*iter).get());
      60             :         }
      61             : 
      62             :         // now assign the children again
      63           0 :         std::vector< SdStyleSheetVector >::iterator childlistiter( maListOfChildLists.begin() );
      64           0 :         for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); ++iter, ++childlistiter )
      65             :         {
      66           0 :             String aParent((*iter)->GetName());
      67           0 :             for( SdStyleSheetVector::iterator childiter = (*childlistiter).begin(); childiter != (*childlistiter).end(); ++childiter )
      68             :             {
      69           0 :                 (*childiter)->SetParent(aParent);
      70             :             }
      71           0 :         }
      72             :     }
      73             :     else
      74             :     {
      75             :         // remove the styles again from the pool
      76           0 :         for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); ++iter )
      77             :         {
      78           0 :             pPool->Remove((*iter).get());
      79             :         }
      80             :     }
      81           0 :     mbMySheets = !mbMySheets;
      82           0 : }
      83             : 
      84           0 : void SdMoveStyleSheetsUndoAction::Redo()
      85             : {
      86           0 :     Undo();
      87           0 : }
      88             : 
      89           0 : SdMoveStyleSheetsUndoAction::~SdMoveStyleSheetsUndoAction()
      90             : {
      91           0 : }
      92             : 
      93           0 : rtl::OUString SdMoveStyleSheetsUndoAction::GetComment() const
      94             : {
      95           0 :     return rtl::OUString();
      96             : }
      97             : 
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10