/************************************************************************ * * Licensed Materials - Property of IBM. * (C) Copyright IBM Corporation 2003, 2012. All Rights Reserved. * U.S. Government Users Restricted Rights: * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * ************************************************************************/ #ifndef __DATAPILOT_UNDO_DATA_INL_INCLUDE_____ #define __DATAPILOT_UNDO_DATA_INL_INCLUDE_____ template< typename TContainer > inline ScDPKFUndoStyleData::ScDPKFUndoStyleData( const ScDocument * pDoc, const TContainer & rAttributes, typename TContainer::const_iterator I, /*const SfxStyleSheet & rStyleSheet,*/ BYTE bFlag, rtl::Reference< ScDPFormatPool > xFmtPool ): mpDoc( pDoc ), maRangeKey( I->first ), mpStyleSheet( I->second ), mbFlag( bFlag ), mxFmtPool( xFmtPool ), mnPos( -1 ) { if( mpStyleSheet ) mnFamily = mpStyleSheet->GetFamily(), mstrName = mpStyleSheet->GetName(); switch( mbFlag ) { default: __noop; break; case eScStyleDelete: mnPos = std::distance( rAttributes.begin(), I ); break; case eScStyleNew: break; } } namespace stlext{ template<> ScDPStyleSheet & reconstruct( ScDPStyleSheet & rObj, const ScStyleSheet& r ); } inline void ScDPKFUndoStyleData::Undo() { switch( mbFlag ) { default: __noop; break; case eScStyleDelete: if( ScStyleSheetPool* pStlPool = mpDoc ? mpDoc->GetStyleSheetPool() : NULL ) if( const ScStyleSheet* (pStyleSheet) = (ScStyleSheet*)pStlPool->Find( mstrName, mnFamily ) ) if( mpStyleSheet ) { stlext::reconstruct( *mpStyleSheet, *pStyleSheet ); if( mxFmtPool.is() ) SYMVERIFY( mxFmtPool->InsertFormat( mnPos, maRangeKey, mpStyleSheet ) ); } break; case eScStyleNew: break; } } inline void ScDPKFUndoStyleData::Redo() { switch( mbFlag ) { default: __noop; break; case eScStyleDelete: if( mpStyleSheet ) { mpStyleSheet->SetSourceStyleSheet( NULL ); if( mxFmtPool.is() ) SYMVERIFY( mxFmtPool->EraseFormat( mnPos, maRangeKey, mpStyleSheet ) ); } break; case eScStyleNew: break; } } #endif