2000-09-18 11:07:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 14:32:04 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 14:32:04 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 14:32:04 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 14:32:04 -05:00
|
|
|
* 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.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 14:32:04 -05:00
|
|
|
* 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).
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 14:32:04 -05:00
|
|
|
* 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.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 13:00:34 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "unmovss.hxx"
|
2004-01-20 04:25:30 -06:00
|
|
|
#include "DrawDocShell.hxx"
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "drawdoc.hxx"
|
|
|
|
#include "stlsheet.hxx"
|
2008-03-12 05:41:25 -05:00
|
|
|
#include "stlpool.hxx"
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2008-03-12 05:41:25 -05:00
|
|
|
SdMoveStyleSheetsUndoAction::SdMoveStyleSheetsUndoAction( SdDrawDocument* pTheDoc, SdStyleSheetVector& rTheStyles, bool bInserted)
|
|
|
|
: SdUndoAction(pTheDoc)
|
|
|
|
, mbMySheets( !bInserted )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2008-03-12 05:41:25 -05:00
|
|
|
maStyles.swap( rTheStyles );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2008-03-12 05:41:25 -05:00
|
|
|
maListOfChildLists.resize( maStyles.size() );
|
2000-09-18 11:07:07 -05:00
|
|
|
// Liste mit den Listen der StyleSheet-Kinder erstellen
|
2008-03-12 05:41:25 -05:00
|
|
|
std::size_t i = 0;
|
|
|
|
for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); iter++ )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2008-03-12 05:41:25 -05:00
|
|
|
maListOfChildLists[i++] = SdStyleSheetPool::CreateChildList( (*iter).get() );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Undo()
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-10-22 07:36:57 -05:00
|
|
|
void SdMoveStyleSheetsUndoAction::Undo()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2006-12-12 10:29:34 -06:00
|
|
|
SfxStyleSheetBasePool* pPool = mpDoc->GetStyleSheetPool();
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2008-03-12 05:41:25 -05:00
|
|
|
if (mbMySheets)
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2008-03-12 05:41:25 -05:00
|
|
|
// the styles have to be inserted in the pool
|
|
|
|
|
|
|
|
// first insert all styles to the pool
|
|
|
|
for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); iter++ )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2008-03-12 05:41:25 -05:00
|
|
|
pPool->Insert((*iter).get());
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
2008-03-12 05:41:25 -05:00
|
|
|
// now assign the childs again
|
|
|
|
std::vector< SdStyleSheetVector >::iterator childlistiter( maListOfChildLists.begin() );
|
|
|
|
for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); iter++, childlistiter++ )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2008-03-12 05:41:25 -05:00
|
|
|
String aParent((*iter)->GetName());
|
|
|
|
for( SdStyleSheetVector::iterator childiter = (*childlistiter).begin(); childiter != (*childlistiter).end(); childiter++ )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2008-03-12 05:41:25 -05:00
|
|
|
(*childiter)->SetParent(aParent);
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-12 05:41:25 -05:00
|
|
|
// remove the styles again from the pool
|
|
|
|
for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); iter++ )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2008-03-12 05:41:25 -05:00
|
|
|
pPool->Remove((*iter).get());
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
2008-03-12 05:41:25 -05:00
|
|
|
mbMySheets = !mbMySheets;
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
2001-10-22 07:36:57 -05:00
|
|
|
void SdMoveStyleSheetsUndoAction::Redo()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
Undo();
|
|
|
|
}
|
|
|
|
|
2001-10-22 07:36:57 -05:00
|
|
|
SdMoveStyleSheetsUndoAction::~SdMoveStyleSheetsUndoAction()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-10-22 07:36:57 -05:00
|
|
|
String SdMoveStyleSheetsUndoAction::GetComment() const
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
return String();
|
|
|
|
}
|
|
|
|
|
|
|
|
|