diff options
author | Christian Lippka <cl@openoffice.org> | 2010-02-23 00:23:09 +0100 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2010-02-23 00:23:09 +0100 |
commit | 1294294cc6db6560140b3ebc7aed82f77e58dd44 (patch) | |
tree | 285b16410ff0606196a254976694d1ca16f5e318 /sd/source/ui | |
parent | 9a0e6f1451435e0c2223d91dec51e95b1ccb0b35 (diff) |
presentation placeholder rework
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 19 | ||||
-rw-r--r-- | sd/source/ui/table/tablefunction.cxx | 22 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 33 | ||||
-rw-r--r-- | sd/source/ui/view/drawview.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/sdview4.cxx | 50 | ||||
-rw-r--r-- | sd/source/ui/view/sdview5.cxx | 1 |
7 files changed, 80 insertions, 63 deletions
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index daae9f37b49f..ce0dc8f67a58 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -368,19 +368,8 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage()); if(pPage && pPage->IsPresObj(pPickObj)) { - bUndo = mpView->IsUndoEnabled(); - - if( bUndo ) - mpView->BegUndo( SdrUndoNewObj::GetComment(*pOleObj) ); - - // add new PresObj to the list + pPage->InsertPresObj( pOleObj, ePresObjKind ); pOleObj->SetUserCall(pPickObj->GetUserCall()); - if( bUndo ) - { - mpView->AddUndo( new sd::UndoObjectPresentationKind( *pPickObj ) ); - mpView->AddUndo( new sd::UndoObjectPresentationKind( *pOleObj ) ); - } - pPage->ReplacePresObj(pPickObj, pOleObj, ePresObjKind); } } @@ -423,11 +412,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) } } - if( bUndo ) - { - mpView->EndUndo(); - } - else if( pPickObj ) + if( !mpView->IsUndoEnabled() && pPickObj ) { // replaced object must be freed if there is no undo action owning it SdrObject::Free( pPickObj ); diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index dc5f999ff601..4c12445a513f 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -177,26 +177,14 @@ void DrawViewShell::FuTable(SfxRequest& rReq) apply_table_style( pObj, GetDoc(), sTableStyle ); SdrPageView* pPV = mpView->GetSdrPageView(); - bool bUndo = false; // 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)) { - bUndo = mpView->IsUndoEnabled(); - - if( bUndo ) - mpView->BegUndo( SdrUndoNewObj::GetComment(*pObj) ); - - // add new PresObj to the list - pObj->SetUserCall(pPickObj->GetUserCall()); - if( bUndo ) - { - mpView->AddUndo( new sd::UndoObjectPresentationKind( *pPickObj ) ); - mpView->AddUndo( new sd::UndoObjectPresentationKind( *pObj ) ); - } - pPage->ReplacePresObj(pPickObj, pObj, PRESOBJ_TABLE); + pObj->SetUserCall( pPickObj->GetUserCall() ); + pPage->InsertPresObj( pObj, PRESOBJ_TABLE ); } } @@ -205,11 +193,7 @@ void DrawViewShell::FuTable(SfxRequest& rReq) else mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER); - if( bUndo ) - { - mpView->EndUndo(); - } - else if( pPickObj ) + if( !mpView->IsUndoEnabled() && pPickObj ) { // replaced object must be freed if there is no undo action owning it SdrObject::Free( pPickObj ); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 2e753fd859d1..32c86305941c 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1083,10 +1083,14 @@ uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( c { nType = OBJ_OLE2; } - else if( aType.EqualsAscii( "TableShape", 26, 10 ) ) + else if( aType.EqualsAscii( "CalcShape", 26, 9 ) ) { nType = OBJ_OLE2; } + else if( aType.EqualsAscii( "TableShape", 26, 10 ) ) + { + nType = OBJ_TABLE; + } else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) ) { nType = OBJ_OLE2; @@ -1115,9 +1119,9 @@ uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( c { nType = OBJ_TEXT; } - else if( aType.EqualsAscii( "TableShape", 26, 10 ) ) + else if( aType.EqualsAscii( "MediaShape", 26, 10 ) ) { - nType = OBJ_TABLE; + nType = OBJ_MEDIA; } else { @@ -1168,7 +1172,7 @@ uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames( const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); - uno::Sequence< OUString > aSNS( mbImpressDoc ? (34) : (19) ); + uno::Sequence< OUString > aSNS( mbImpressDoc ? (36) : (19) ); sal_uInt16 i(0); @@ -1211,6 +1215,8 @@ uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames( aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HeaderShape")); aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SlideNumberShape")); aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DateTimeShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CalcShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.MediaShape")); } else { diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 685bb4a48144..dd455e5557bb 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -412,7 +412,7 @@ SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShap String aType( xShape->getShapeType() ); const String aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.") ); - if(aType.CompareTo( aPrefix, aPrefix.Len() ) != 0) + if( aType.CompareTo( aPrefix, aPrefix.Len() ) != 0 ) { SdrObject* pObj = SvxFmDrawPage::_CreateSdrObject( xShape ); if( pObj && ( (pObj->GetObjInventor() != SdrInventor) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) ) @@ -448,6 +448,10 @@ SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShap { eObjKind = PRESOBJ_CHART; } + else if( aType.EqualsAscii( "CalcShape" ) ) + { + eObjKind = PRESOBJ_CALC; + } else if( aType.EqualsAscii( "TableShape" ) ) { eObjKind = PRESOBJ_TABLE; @@ -495,6 +499,10 @@ SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShap { eObjKind = PRESOBJ_DATETIME; } + else if( aType.EqualsAscii( "MediaShape" ) ) + { + eObjKind = PRESOBJ_MEDIA; + } Rectangle aRect( eObjKind == PRESOBJ_TITLE ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() ); @@ -504,7 +512,22 @@ SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShap const awt::Size aSize( aRect.GetWidth(), aRect.GetHeight() ); xShape->setSize( aSize ); - SdrObject *pPresObj = GetPage()->CreatePresObj( eObjKind, FALSE, aRect, sal_True ); + SdrObject *pPresObj = 0; + if( (eObjKind == PRESOBJ_TABLE) || (eObjKind == PRESOBJ_MEDIA) ) + { + pPresObj = SvxFmDrawPage::_CreateSdrObject( xShape ); + if( pPresObj ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel(); + if( pDoc ) + pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True ); + GetPage()->InsertPresObj( pPresObj, eObjKind ); + } + } + else + { + pPresObj = GetPage()->CreatePresObj( eObjKind, FALSE, aRect, sal_True ); + } if( pPresObj ) pPresObj->SetUserCall( GetPage() ); @@ -1389,9 +1412,15 @@ Reference< drawing::XShape > SdGenericDrawPage::_CreateShape( SdrObject *pObj ) case PRESOBJ_ORGCHART: aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OrgChartShape") ); break; + case PRESOBJ_CALC: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("CalcShape") ); + break; case PRESOBJ_TABLE: aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TableShape") ); break; + case PRESOBJ_MEDIA: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("MediaShape") ); + break; case PRESOBJ_BACKGROUND: DBG_ASSERT( sal_False, "Danger! Someone got hold of the horrible background shape!" ); break; diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index c96417d04640..e6fb02a06c3d 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -627,7 +627,9 @@ void DrawView::DeleteMarked() case PRESOBJ_CHART: case PRESOBJ_ORGCHART: case PRESOBJ_TABLE: + case PRESOBJ_CALC: case PRESOBJ_IMAGE: + case PRESOBJ_MEDIA: ePresObjKind = PRESOBJ_OUTLINE; break; default: @@ -640,8 +642,6 @@ void DrawView::DeleteMarked() pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() ); - pPage->ReplacePresObj( pObj, pNewObj, ePresObjKind ); - bResetLayout = true; } } diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 25d1b22dc633..49496086e084 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -145,20 +145,11 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, pNewGrafObj->SetEmptyPresObj(FALSE); } - const bool bUndo = IsUndoEnabled(); - if( bUndo ) - BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); - if (pPage && pPage->IsPresObj(pPickObj)) { // Neues PresObj in die Liste eintragen + pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC ); pNewGrafObj->SetUserCall(pPickObj->GetUserCall()); - if( bUndo ) - { - AddUndo( new sd::UndoObjectPresentationKind( *pPickObj ) ); - AddUndo( new sd::UndoObjectPresentationKind( *pNewGrafObj ) ); - } - pPage->ReplacePresObj(pPickObj, pNewGrafObj, PRESOBJ_GRAPHIC); } if (pImageMap) @@ -166,11 +157,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView - if( bUndo ) - { - EndUndo(); - } - else + if( !IsUndoEnabled() && pPickObj ) { SdrObject::Free( pPickObj ); } @@ -310,7 +297,7 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc SdrMediaObj* pNewMediaObj = NULL; SdrPageView* pPV = GetSdrPageView(); - SdrObject* pPickObj = NULL; + SdrObject* pPickObj = GetEmptyPresentationObject( PRESOBJ_MEDIA ); if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView )) { @@ -335,10 +322,35 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc } else if( pPV ) { - pNewMediaObj = new SdrMediaObj( Rectangle( rPos, rSize ) ); + Rectangle aRect( rPos, rSize ); + if( pPickObj ) + aRect = pPickObj->GetLogicRect(); + + + pNewMediaObj = new SdrMediaObj( aRect ); + + if( pPickObj ) + { + SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage()); + if(pPage && pPage->IsPresObj(pPickObj)) + { + pPage->InsertPresObj( pNewMediaObj, PRESOBJ_MEDIA ); + pNewMediaObj->SetUserCall(pPickObj->GetUserCall()); + } + } + + if( pPickObj ) + ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj); + else + InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER ); + + pNewMediaObj->setURL( rMediaURL ); + + if( pPickObj ) + pNewMediaObj->AdjustToMaxRect( pPickObj->GetLogicRect() ); - if( pPV && InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER ) ) - pNewMediaObj->setURL( rMediaURL ); + if( !IsUndoEnabled() ) + SdrObject::Free( pPickObj ); } rAction = mnAction; diff --git a/sd/source/ui/view/sdview5.cxx b/sd/source/ui/view/sdview5.cxx index c86b8f191b9c..18a58b8cd2cf 100644 --- a/sd/source/ui/view/sdview5.cxx +++ b/sd/source/ui/view/sdview5.cxx @@ -48,6 +48,7 @@ static bool implIsMultiPresObj( PresObjKind eKind ) case PRESOBJ_ORGCHART: case PRESOBJ_TABLE: case PRESOBJ_IMAGE: + case PRESOBJ_MEDIA: return true; default: return false; |