Source Code (Use browser search to find items of interest.)

Class Index

kspread'KSpreadUndoCellLayout (./koffice/kspread/kspread_undo.h:136)

class KSpreadUndoCellLayout : public KSpreadUndoAction
{
public:
    KSpreadUndoCellLayout( KSpreadDoc *_doc, KSpreadTable *_table, QRect &_selection );
    virtual ~KSpreadUndoCellLayout();

    virtual void undo();
    virtual void redo();

    void copyLayout( QList<KSpreadLayout> &list);

protected:
    QRect m_rctRect;
    QList<KSpreadLayout> m_lstLayouts;
    QList<KSpreadLayout> m_lstRedoLayouts;
    KSpreadTable *m_pTable;
};


kspread'KSpreadUndoCellLayout::KSpreadUndoCellLayout() (./koffice/kspread/kspread_undo.cc:372)

KSpreadUndoCellLayout::KSpreadUndoCellLayout( KSpreadDoc *_doc, KSpreadTable *_table, QRect &_selection ) :
    KSpreadUndoAction( _doc )
{
  m_rctRect = _selection;
  m_pTable = _table;
  m_lstLayouts.setAutoDelete( TRUE );

  copyLayout( m_lstLayouts );
}


kspread'KSpreadUndoCellLayout::copyLayout() (./koffice/kspread/kspread_undo.cc:382)

void KSpreadUndoCellLayout::copyLayout( QList<KSpreadLayout> &list)
{
    list.clear();

    for ( int y = m_rctRect.top(); y <= m_rctRect.bottom(); y++ )
	for ( int x = m_rctRect.left(); x <= m_rctRect.right(); x++ )
	{
	    KSpreadLayout *l = new KSpreadLayout( m_pTable );
	    l->copy( *(m_pTable->cellAt( x, y )) );
	    list.append( l );
	}
}


kspread'KSpreadUndoCellLayout::~KSpreadUndoCellLayout() (./koffice/kspread/kspread_undo.cc:395)

KSpreadUndoCellLayout::~KSpreadUndoCellLayout()
{
}


kspread'KSpreadUndoCellLayout::undo() (./koffice/kspread/kspread_undo.cc:399)

void KSpreadUndoCellLayout::undo()
{
    m_pDoc->undoBuffer()->lock();

    copyLayout( m_lstRedoLayouts );

    KSpreadLayout *l;
    l = m_lstLayouts.first();

    for ( int y = m_rctRect.top(); y <= m_rctRect.bottom(); y++ )
	for ( int x = m_rctRect.left(); x <= m_rctRect.right(); x++ )
	{
	    KSpreadCell *cell = m_pTable->nonDefaultCell( x, y );
	    cell->copy( *l );
	    cell->setLayoutDirtyFlag();
	    l = m_lstLayouts.next();
	}

    // TODO
    /*
    if ( m_pTable->gui() )
	m_pTable->drawVisibleObjects( TRUE );
	*/

    m_pDoc->undoBuffer()->unlock();
}


kspread'KSpreadUndoCellLayout::redo() (./koffice/kspread/kspread_undo.cc:426)

void KSpreadUndoCellLayout::redo()
{
    m_pDoc->undoBuffer()->lock();

    KSpreadLayout *l;
    l = m_lstRedoLayouts.first();

    for ( int y = m_rctRect.top(); y <= m_rctRect.bottom(); y++ )
	for ( int x = m_rctRect.left(); x <= m_rctRect.right(); x++ )
	{
	    KSpreadCell *cell = m_pTable->nonDefaultCell( x, y );
	    cell->copy( *l );
	    cell->setLayoutDirtyFlag();
	    l = m_lstRedoLayouts.next();
	}

    // TODO
    /*
    if ( m_pTable->gui() )
	m_pTable->drawVisibleObjects( TRUE );
	*/

    m_pDoc->undoBuffer()->unlock();
}

/****************************************************************************
 *
 * KSpreadUndoDelete
 *
 ***************************************************************************/