diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
commit | e96ecfe77ea289e5ebc12e25bbd5c799f715462e (patch) | |
tree | a219740439e76cc87f0edee9fd5039321d7819aa /svx/source/table | |
parent | 5d2e992e045ed3c0ab3563da2128daccba5b3afa (diff) | |
parent | 12c7dc97e4470d70a9df30429c3dc51343682c07 (diff) |
merge to m67
Diffstat (limited to 'svx/source/table')
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 82 | ||||
-rw-r--r-- | svx/source/table/tablecontroller.hxx | 4 |
2 files changed, 86 insertions, 0 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 2cf9c2be96..43ef34d8c0 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2514,6 +2514,88 @@ bool SvxTableController::PasteObject( SdrTableObj* pPasteTableObj ) return true; } +bool SvxTableController::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& /*rFormatSet*/ ) +{ + // SdrView::TakeFormatPaintBrush() is enough + return false; +} + +bool SvxTableController::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) +{ + if( mbCellSelectionMode ) + { + SdrTextObj* pTableObj = dynamic_cast<SdrTextObj*>( mxTableObj.get() ); + if( !pTableObj ) + return false; + + const bool bUndo = mpModel && mpModel->IsUndoEnabled(); + + if( bUndo ) + mpModel->BegUndo( ImpGetResStr(STR_TABLE_NUMFORMAT) ); + + CellPos aStart, aEnd; + getSelectedCells( aStart, aEnd ); + + SfxItemSet aAttr(*rFormatSet.GetPool(), rFormatSet.GetRanges()); + aAttr.Put(rFormatSet, TRUE); + + const bool bFrame = (rFormatSet.GetItemState( SDRATTR_TABLE_BORDER ) == SFX_ITEM_SET) || (rFormatSet.GetItemState( SDRATTR_TABLE_BORDER_INNER ) == SFX_ITEM_SET); + + if( bFrame ) + { + aAttr.ClearItem( SDRATTR_TABLE_BORDER ); + aAttr.ClearItem( SDRATTR_TABLE_BORDER_INNER ); + } + + const USHORT* pRanges = rFormatSet.GetRanges(); + bool bTextOnly = true; + + while( *pRanges ) + { + if( (*pRanges != EE_PARA_START) && (*pRanges != EE_CHAR_START) ) + { + bTextOnly = true; + break; + } + pRanges += 2; + } + + const bool bReplaceAll = false; + for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ ) + { + for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) + { + CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + if( xCell.is() ) + { + if( bUndo ) + xCell->AddUndo(); + if( !bTextOnly ) + xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll); + + SdrText* pText = static_cast< SdrText* >( xCell.get() ); + mpView->ApplyFormatPaintBrushToText( rFormatSet, *pTableObj, pText, bNoCharacterFormats, bNoParagraphFormats ); + } + } + } + + if( bFrame ) + { + ApplyBorderAttr( rFormatSet ); + } + + UpdateTableShape(); + + if( bUndo ) + mpModel->EndUndo(); + + return true; + + } + return false; +} + + // -------------------------------------------------------------------- IMPL_LINK( SvxTableController, UpdateHdl, void *, EMPTYARG ) diff --git a/svx/source/table/tablecontroller.hxx b/svx/source/table/tablecontroller.hxx index b4eecf0902..24d9a27ff4 100644 --- a/svx/source/table/tablecontroller.hxx +++ b/svx/source/table/tablecontroller.hxx @@ -57,6 +57,7 @@ public: SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj ); SVX_DLLPRIVATE virtual ~SvxTableController(); + // from sdr::SelectionController SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin); SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin); SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin); @@ -72,6 +73,9 @@ public: SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const; SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ); + SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet ); + SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ); + // slots SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 ); SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId ); |