diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-06-17 10:58:14 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-06-17 10:58:14 +0000 |
commit | 09616816855320394fe9d2bf4dc2a949296dc80f (patch) | |
tree | dce11dca85d86c03f0a64be0fcab3e1c5ee091ee /svx/source/table/tablemodel.cxx | |
parent | b49ac08f3b5f9474f606bb76f9256d2a9aa1a522 (diff) |
CWS-TOOLING: integrate CWS impress171
2009-06-02 16:32:02 +0200 cl r272511 : fixed build error
2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49)
2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given)
2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given)
2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given)
2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar
2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document
2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes
2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem
2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes
2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature
2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature
2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature
2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes
2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons
2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit
2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug
2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object)
2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells
2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state
2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone
2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal
2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles
2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path
2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility
2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj
2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
Diffstat (limited to 'svx/source/table/tablemodel.cxx')
-rw-r--r-- | svx/source/table/tablemodel.cxx | 118 |
1 files changed, 73 insertions, 45 deletions
diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx index 83b1a95723a9..32646c8e0347 100644 --- a/svx/source/table/tablemodel.cxx +++ b/svx/source/table/tablemodel.cxx @@ -52,6 +52,8 @@ #include "svdstr.hrc" #include "svdglob.hxx" +//#define PLEASE_DEBUG_THE_TABLES 1 + using ::rtl::OUString; using namespace ::osl; using namespace ::vos; @@ -620,14 +622,29 @@ void TableModel::notifyModification() ::osl::MutexGuard guard( m_aMutex ); if( (mnNotifyLock == 0) && mpTableObj && mpTableObj->GetModel() ) { + mbNotifyPending = false; + + ::cppu::OInterfaceContainerHelper * pModifyListeners = rBHelper.getContainer( XModifyListener::static_type() ); + if( pModifyListeners ) + { + EventObject aSource; + aSource.Source = static_cast< ::cppu::OWeakObject* >(this); + pModifyListeners->notifyEach( &XModifyListener::modified, aSource); + } + } + else + { + mbNotifyPending = true; + } #ifdef PLEASE_DEBUG_THE_TABLES - FILE* file = fopen( "e:\\table.log","a+" ); + FILE* file = fopen( "c:\\table.xml","w" ); const sal_Int32 nColCount = getColumnCountImpl(); const sal_Int32 nRowCount = getRowCountImpl(); - fprintf( file, "<table columns=\"%ld\" rows=\"%ld\">\n\r", nColCount, nRowCount ); + fprintf( file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\r" ); + fprintf( file, "<table columns=\"%ld\" rows=\"%ld\" updated=\"%s\">\n\r", nColCount, nRowCount, mbNotifyPending ? "false" : "true"); for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol ) { @@ -647,9 +664,9 @@ void TableModel::notifyModification() sal_Int32 nColSpan = xCell->getColumnSpan(); sal_Bool bMerged = xCell->isMerged(); - if( nColSpan > 1 ) + if( nColSpan != 1 ) fprintf( file, " column-span=\"%ld\"", nColSpan ); - if( nRowSpan > 1 ) + if( nRowSpan != 1 ) fprintf( file, " row-span=\"%ld\"", nRowSpan ); if( bMerged ) @@ -663,20 +680,6 @@ void TableModel::notifyModification() fprintf( file, "</table>\n\r" ); fclose( file ); #endif - mbNotifyPending = false; - - ::cppu::OInterfaceContainerHelper * pModifyListeners = rBHelper.getContainer( XModifyListener::static_type() ); - if( pModifyListeners ) - { - EventObject aSource; - aSource.Source = static_cast< ::cppu::OWeakObject* >(this); - pModifyListeners->notifyEach( &XModifyListener::modified, aSource); - } - } - else - { - mbNotifyPending = true; - } } // ----------------------------------------------------------------------------- @@ -784,19 +787,7 @@ void TableModel::insertColumns( sal_Int32 nIndex, sal_Int32 nCount ) // cell merges over newly created columns, so add the new columns to the merged cell const sal_Int32 nRowSpan = xCell->getRowSpan(); nColSpan += nCount; - if( bUndo ) - xCell->AddUndo(); - xCell->merge( nColSpan, nRowSpan ); - // set newly inserted cells to merged state - for( sal_Int32 nColOffset = 0; nColOffset < nCount; ++nColOffset ) - { - for( sal_Int32 nRowOffset = 0; nRowOffset < nRowSpan; ++nRowOffset ) - { - CellRef xMergedCell( getCell( nIndex + nColOffset, nRow + nRowOffset ) ); - if( xMergedCell.is() ) - xMergedCell->setMerged(); - } - } + merge( nCol, nRow, nColSpan, nRowSpan ); } } } @@ -909,7 +900,10 @@ void TableModel::removeColumns( sal_Int32 nIndex, sal_Int32 nCount ) maRows[nRows]->removeColumns( nIndex, nCount ); if( bUndo ) + { pModel->EndUndo(); + pModel->SetChanged(); + } } catch( Exception& ) { @@ -964,20 +958,7 @@ void TableModel::insertRows( sal_Int32 nIndex, sal_Int32 nCount ) // cell merges over newly created columns, so add the new columns to the merged cell const sal_Int32 nColSpan = xCell->getColumnSpan(); nRowSpan += nCount; - if( bUndo ) - xCell->AddUndo(); - xCell->merge( nColSpan, nRowSpan ); - - // set newly inserted cells to merged state - for( sal_Int32 nColOffset = 1; nColOffset < nColSpan; ++nColOffset ) - { - for( sal_Int32 nRowOffset = 0; nRowOffset <= nCount; ++nRowOffset ) - { - CellRef xMergedCell( getCell( nCol + nColOffset - 1, nIndex + nRowOffset ) ); - if( xMergedCell.is() ) - xMergedCell->setMerged(); - } - } + merge( nCol, nRow, nColSpan, nRowSpan ); } } } @@ -1075,7 +1056,10 @@ void TableModel::removeRows( sal_Int32 nIndex, sal_Int32 nCount ) remove_range<RowVector,RowVector::iterator>( maRows, nIndex, nCount ); if( bUndo ) + { pModel->EndUndo(); + pModel->SetChanged(); + } } catch( Exception& ) { @@ -1198,6 +1182,50 @@ void TableModel::optimize() // ----------------------------------------------------------------------------- +void TableModel::merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan ) +{ + const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled(); + + const sal_Int32 nLastRow = nRow + nRowSpan; + const sal_Int32 nLastCol = nCol + nColSpan; + + if( (nLastRow > getRowCount()) || (nLastCol > getRowCount() ) ) + { + DBG_ERROR("TableModel::merge(), merge beyound the table!"); + } + + // merge first cell + CellRef xOriginCell( dynamic_cast< Cell* >( getCellByPosition( nCol, nRow ).get() ) ); + if( xOriginCell.is() ) + { + if( bUndo ) + xOriginCell->AddUndo(); + xOriginCell->merge( nColSpan, nRowSpan ); + } + + sal_Int32 nTempCol = nCol + 1; + + // merge remaining cells + for( ; nRow < nLastRow; nRow++ ) + { + for( ; nTempCol < nLastCol; nTempCol++ ) + { + CellRef xCell( dynamic_cast< Cell* >( getCellByPosition( nTempCol, nRow ).get() ) ); + if( xCell.is() && !xCell->isMerged() ) + { + if( bUndo ) + xCell->AddUndo(); + xCell->setMerged(); + xOriginCell->mergeContent( xCell ); + } + } + nTempCol = nCol; + } +} + + +// ----------------------------------------------------------------------------- + void TableModel::updateRows() { sal_Int32 nRow = 0; |