summaryrefslogtreecommitdiff
path: root/svx/source/table/tablecontroller.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/table/tablecontroller.cxx')
-rw-r--r--svx/source/table/tablecontroller.cxx145
1 files changed, 72 insertions, 73 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index bcbfa618ffcc..521ace14a873 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1164,58 +1164,58 @@ void SvxTableController::SetTableStyleSettings( const SfxItemSet* pArgs )
void SvxTableController::SetVertical( sal_uInt16 nSId )
{
SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
- if( mxTable.is() && pTableObj )
- {
- TableModelNotifyGuard aGuard( mxTable.get() );
+ if( !mxTable.is() || !pTableObj )
+ return;
- bool bUndo = mpModel && mpModel->IsUndoEnabled();
- if (bUndo)
- {
- mpModel->BegUndo(ImpGetResStr(STR_TABLE_NUMFORMAT));
- mpModel->AddUndo(mpModel->GetSdrUndoFactory().CreateUndoAttrObject(*pTableObj));
- }
+ TableModelNotifyGuard aGuard( mxTable.get() );
- CellPos aStart, aEnd;
- getSelectedCells( aStart, aEnd );
+ bool bUndo = mpModel && mpModel->IsUndoEnabled();
+ if (bUndo)
+ {
+ mpModel->BegUndo(ImpGetResStr(STR_TABLE_NUMFORMAT));
+ mpModel->AddUndo(mpModel->GetSdrUndoFactory().CreateUndoAttrObject(*pTableObj));
+ }
- SdrTextVertAdjust eAdj = SDRTEXTVERTADJUST_TOP;
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
- switch( nSId )
- {
- case SID_TABLE_VERT_BOTTOM:
- eAdj = SDRTEXTVERTADJUST_BOTTOM;
- break;
- case SID_TABLE_VERT_CENTER:
- eAdj = SDRTEXTVERTADJUST_CENTER;
- break;
- //case SID_TABLE_VERT_NONE:
- default:
- break;
- }
+ SdrTextVertAdjust eAdj = SDRTEXTVERTADJUST_TOP;
- SdrTextVertAdjustItem aItem( eAdj );
+ switch( nSId )
+ {
+ case SID_TABLE_VERT_BOTTOM:
+ eAdj = SDRTEXTVERTADJUST_BOTTOM;
+ break;
+ case SID_TABLE_VERT_CENTER:
+ eAdj = SDRTEXTVERTADJUST_CENTER;
+ break;
+ //case SID_TABLE_VERT_NONE:
+ default:
+ break;
+ }
- for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ SdrTextVertAdjustItem aItem( eAdj );
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
{
- for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
{
- CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
- if( xCell.is() )
- {
- if (bUndo)
- xCell->AddUndo();
- SfxItemSet aSet(xCell->GetItemSet());
- aSet.Put(aItem);
- xCell->SetMergedItemSetAndBroadcast(aSet, /*bClearAllItems=*/false);
- }
+ if (bUndo)
+ xCell->AddUndo();
+ SfxItemSet aSet(xCell->GetItemSet());
+ aSet.Put(aItem);
+ xCell->SetMergedItemSetAndBroadcast(aSet, /*bClearAllItems=*/false);
}
}
+ }
- UpdateTableShape();
+ UpdateTableShape();
- if (bUndo)
- mpModel->EndUndo();
- }
+ if (bUndo)
+ mpModel->EndUndo();
}
void SvxTableController::MergeMarkedCells()
@@ -2507,52 +2507,51 @@ void SvxTableController::UpdateTableShape()
void SvxTableController::SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll)
{
- if( mxTable.is() )
- {
- const bool bUndo = mpModel && mpModel->IsUndoEnabled();
+ if( !mxTable.is() )
+ return;
- if( bUndo )
- mpModel->BegUndo( ImpGetResStr(STR_TABLE_NUMFORMAT) );
+ const bool bUndo = mpModel && mpModel->IsUndoEnabled();
- CellPos aStart, aEnd;
- getSelectedCells( aStart, aEnd );
+ if( bUndo )
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_NUMFORMAT) );
- SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
- aAttr.Put(rAttr);
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
- const bool bFrame = (rAttr.GetItemState( SDRATTR_TABLE_BORDER ) == SfxItemState::SET) || (rAttr.GetItemState( SDRATTR_TABLE_BORDER_INNER ) == SfxItemState::SET);
+ SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
+ aAttr.Put(rAttr);
- if( bFrame )
- {
- aAttr.ClearItem( SDRATTR_TABLE_BORDER );
- aAttr.ClearItem( SDRATTR_TABLE_BORDER_INNER );
- }
+ const bool bFrame = (rAttr.GetItemState( SDRATTR_TABLE_BORDER ) == SfxItemState::SET) || (rAttr.GetItemState( SDRATTR_TABLE_BORDER_INNER ) == SfxItemState::SET);
- for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ if( bFrame )
+ {
+ aAttr.ClearItem( SDRATTR_TABLE_BORDER );
+ aAttr.ClearItem( SDRATTR_TABLE_BORDER_INNER );
+ }
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
{
- for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
{
- CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
- if( xCell.is() )
- {
- if( bUndo )
- xCell->AddUndo();
- xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
- }
+ if( bUndo )
+ xCell->AddUndo();
+ xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
}
}
+ }
- if( bFrame )
- {
- ApplyBorderAttr( rAttr );
- }
-
- UpdateTableShape();
+ if( bFrame )
+ {
+ ApplyBorderAttr( rAttr );
+ }
- if( bUndo )
- mpModel->EndUndo();
+ UpdateTableShape();
- }
+ if( bUndo )
+ mpModel->EndUndo();
}