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

Generated by: LCOV version 1.11