diff options
author | Christian Lippka <christian.lippka@sun.com> | 2010-04-12 13:03:45 +0200 |
---|---|---|
committer | Christian Lippka <christian.lippka@sun.com> | 2010-04-12 13:03:45 +0200 |
commit | 6e40e38b269e5be505454550e7c142a9697b9f6f (patch) | |
tree | ae6aceb664c0f90d4d7ba0865297079722d524fb /sd/source/ui/table | |
parent | e725e315399f527e63f919a9a6861066b1f41512 (diff) | |
parent | 646895d3ee78647feb51582e3cdea75d01960cd5 (diff) |
renaissance2: rebase m76
Diffstat (limited to 'sd/source/ui/table')
-rw-r--r-- | sd/source/ui/table/tablefunction.cxx | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index 9d3de5904f43..b30e259e049a 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -70,6 +70,7 @@ #include "Window.hxx" #include "drawview.hxx" #include "sdresid.hxx" +#include "undo/undoobjects.hxx" using ::rtl::OUString; using namespace ::sd; @@ -147,21 +148,48 @@ void DrawViewShell::FuTable(SfxRequest& rReq) nRows = pDlg->getRows(); } - Size aSize( 14100, 200 ); + Rectangle aRect; - Point aPos; - Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() ); - aPos = aWinRect.Center(); - aPos = GetActiveWindow()->PixelToLogic(aPos); - aPos.X() -= aSize.Width() / 2; - aPos.Y() -= aSize.Height() / 2; - Rectangle aRect (aPos, aSize); + SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_TABLE ); + if( pPickObj ) + { + aRect = pPickObj->GetLogicRect(); + aRect.setHeight( 200 ); + } + else + { + Size aSize( 14100, 200 ); + + Point aPos; + Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() ); + aPos = aWinRect.Center(); + aPos = GetActiveWindow()->PixelToLogic(aPos); + aPos.X() -= aSize.Width() / 2; + aPos.Y() -= aSize.Height() / 2; + aRect = Rectangle(aPos, aSize); + } ::sdr::table::SdrTableObj* pObj = new ::sdr::table::SdrTableObj( GetDoc(), aRect, nColumns, nRows ); pObj->NbcSetStyleSheet( GetDoc()->GetDefaultStyleSheet(), sal_True ); apply_table_style( pObj, GetDoc(), sTableStyle ); SdrPageView* pPV = mpView->GetSdrPageView(); - mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER); + + // if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj + if( pPickObj ) + { + SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage()); + if(pPage && pPage->IsPresObj(pPickObj)) + { + pObj->SetUserCall( pPickObj->GetUserCall() ); + pPage->InsertPresObj( pObj, PRESOBJ_TABLE ); + } + } + + if( pPickObj ) + mpView->ReplaceObjectAtView(pPickObj, *pPV, pObj, TRUE ); + else + mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER); + Invalidate(SID_DRAWTBX_INSERT); rReq.Ignore(); break; |