Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
libreoffice.2556
bnc945443.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc945443.patch of Package libreoffice.2556
From 64b2f209b72c5a5662afcb0ac1706b882e0e059b Mon Sep 17 00:00:00 2001 From: Miklos Vajna <vmiklos@collabora.co.uk> Date: Tue, 19 Apr 2016 17:38:14 +0200 Subject: [PATCH] tdf#99396 SvxTableController::SetVertical: implement undo support All the table and cell objects know how to undo this change, what was missing is the begin/end undo calls and the broadcast of the cell format change. (cherry picked from commits 3057b5cdb989d44613518900b25ebad8b7c600a2, d60d70d92cec7bbc471f8f0c653d443282227d34, 6819992113947e7a6272bf750fee712c2df41905 and 100eb15b4d8529d7a11d98a28742f31f0f792fa1) Conflicts: sd/qa/unit/misc-tests.cxx Change-Id: I3dfd203faf5c579da2937fedab5647129a8e903a Reviewed-on: https://gerrit.libreoffice.org/24276 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com> --- include/svx/svdotable.hxx | 4 ++ sd/inc/drawdoc.hxx | 2 +- sd/qa/unit/data/tdf99396.odp | Bin 0 -> 10956 bytes sd/qa/unit/misc-tests.cxx | 104 +++++++++++++++++++++++++++++++++ sd/source/ui/table/TableDesignPane.cxx | 10 +++- svx/source/table/cell.cxx | 5 ++ svx/source/table/svdotable.cxx | 12 ++++ svx/source/table/tablecontroller.cxx | 18 +++++- 8 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 sd/qa/unit/data/tdf99396.odp diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx index 78a7e53c..f70d768 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -31,6 +31,7 @@ class SvStream; class SfxStyleSheet; +class SdrUndoAction; namespace sdr { namespace contact { class ViewContactOfTableObj; @@ -257,6 +258,9 @@ public: css::text::WritingMode GetWritingMode() const; + /// Add an undo action that should be on the undo stack after ending text edit. + void AddUndo(SdrUndoAction* pUndo); + virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus ) override; diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index e2ff20c..ee8a876 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -571,7 +571,7 @@ public: languages set at this document */ SAL_DLLPRIVATE void getDefaultFonts( vcl::Font& rLatinFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont ); - SAL_DLLPRIVATE sd::UndoManager* GetUndoManager() const; + sd::UndoManager* GetUndoManager() const; /** converts the given western font height to a corresponding ctl font height, depending on the system language */ SAL_DLLPRIVATE static sal_uInt32 convertFontHeightToCTL( sal_uInt32 nWesternFontHeight ); diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 2bd52b5..4ae2e1d 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -806,7 +806,15 @@ short TableDesignDialog::Execute() VclPtr<vcl::Window> createTableDesignPanel( vcl::Window* pParent, ViewShellBase& rBase ) { - return VclPtr<TableDesignPane>::Create( pParent, rBase ); + VclPtr<TableDesignPane> pRet = nullptr; + try + { + pRet = VclPtr<TableDesignPane>::Create( pParent, rBase ); + } + catch (const uno::Exception&) + { + } + return pRet; } void showTableDesignDialog( vcl::Window* pParent, ViewShellBase& rBase ) diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index b2d1604..c783cb1 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -799,6 +799,11 @@ void Cell::AddUndo() { CellRef xCell( this ); GetModel()->AddUndo( new CellUndo( &rObj, xCell ) ); + + // Undo action for the after-text-edit-ended stack. + SdrTableObj* pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(&rObj); + if (pTableObj && pTableObj->IsTextEditActive()) + pTableObj->AddUndo(new CellUndo(pTableObj, xCell)); } } diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 15bbb7f..5b979fe 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -205,6 +205,7 @@ public: CellPos maEditPos; TableStyleSettings maTableStyle; Reference< XIndexAccess > mxTableStyle; + std::vector<std::unique_ptr<SdrUndoAction>> maUndos; void SetModel(SdrModel* pOldModel, SdrModel* pNewModel); @@ -1860,7 +1861,14 @@ void SdrTableObj::EndTextEdit(SdrOutliner& rOutl) if(rOutl.IsModified()) { if( GetModel() && GetModel()->IsUndoEnabled() ) + { + // These actions should be on the undo stack after text edit. + for (std::unique_ptr<SdrUndoAction>& pAction : mpImpl->maUndos) + GetModel()->AddUndo(pAction.release()); + mpImpl->maUndos.clear(); + GetModel()->AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*this) ); + } OutlinerParaObject* pNewText = nullptr; Paragraph* p1stPara = rOutl.GetParagraph( 0 ); @@ -2085,6 +2093,10 @@ WritingMode SdrTableObj::GetWritingMode() const return eWritingMode; } +void SdrTableObj::AddUndo(SdrUndoAction* pUndo) +{ + mpImpl->maUndos.push_back(std::unique_ptr<SdrUndoAction>(pUndo)); +} // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 0238e85..beb75e0 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -1177,6 +1177,13 @@ void SvxTableController::SetVertical( sal_uInt16 nSId ) { TableModelNotifyGuard aGuard( mxTable.get() ); + bool bUndo = mpModel && mpModel->IsUndoEnabled(); + if (bUndo) + { + mpModel->BegUndo(ImpGetResStr(STR_TABLE_NUMFORMAT)); + mpModel->AddUndo(mpModel->GetSdrUndoFactory().CreateUndoAttrObject(*pTableObj)); + } + CellPos aStart, aEnd; getSelectedCells( aStart, aEnd ); @@ -1203,11 +1210,20 @@ void SvxTableController::SetVertical( sal_uInt16 nSId ) { CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); if( xCell.is() ) - xCell->SetMergedItem(aItem); + { + if (bUndo) + xCell->AddUndo(); + SfxItemSet aSet(xCell->GetItemSet()); + aSet.Put(aItem); + xCell->SetMergedItemSetAndBroadcast(aSet, /*bClearAllItems=*/false); + } } } UpdateTableShape(); + + if (bUndo) + mpModel->EndUndo(); } } -- 2.6.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor