diff options
Diffstat (limited to 'sd/source/ui/func/fusel.cxx')
-rw-r--r-- | sd/source/ui/func/fusel.cxx | 306 |
1 files changed, 7 insertions, 299 deletions
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 7a0a1ed09fcc..0a8bd4452dfe 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -307,30 +307,14 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) ) { pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER); - if (pObj) + if (pObj && !bReturn && !bReadOnly && rMEvt.GetClicks() == 2 + && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr + || dynamic_cast<const E3dScene*>(pObj) != nullptr)) { - // Animate object when not just selecting. - if ( ! bSelectionOnly) - bReturn = AnimateObj(pObj, aMDPos); - - if( !bReturn && (dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr || dynamic_cast< const E3dScene* >(pObj) != nullptr)) - { - if(rMEvt.GetClicks() == 1) - { - // Look into the group - pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP); - if (pObj) - bReturn = AnimateObj(pObj, aMDPos); - } - else if( !bReadOnly && rMEvt.GetClicks() == 2) - { - // New: double click on selected Group object - // enter group - if ( ! bSelectionOnly - && pObj->getSdrPageFromSdrObject() == pPV->GetPage()) - bReturn = pPV->EnterGroup(pObj); - } - } + // New: double click on selected Group object + // enter group + if (!bSelectionOnly && pObj->getSdrPageFromSdrObject() == pPV->GetPage()) + bReturn = pPV->EnterGroup(pObj); } // #i71727# replaced else here with two possibilities, once the original else (!pObj) @@ -1184,282 +1168,6 @@ void FuSelection::SetEditMode(sal_uInt16 nMode) rBindings.Invalidate(SID_BEZIER_INSERT); } -/** - * Execute animation or interaction - */ -bool FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos) -{ - bool bAnimated = false; - bool bClosed = pObj->IsClosedObj(); - bool bFilled = false; - - if (bClosed) - { - SfxItemSet aSet(mpDoc->GetPool()); - - aSet.Put(pObj->GetMergedItemSet()); - - const XFillStyleItem& rFillStyle = aSet.Get(XATTR_FILLSTYLE); - bFilled = rFillStyle.GetValue() != drawing::FillStyle_NONE; - } - - const SdrLayerIDSet* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers(); - sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); - const long n2HitLog = nHitLog * 2; - Point aHitPosR(rPos); - Point aHitPosL(rPos); - Point aHitPosT(rPos); - Point aHitPosB(rPos); - - aHitPosR.AdjustX(n2HitLog ); - aHitPosL.AdjustX( -n2HitLog ); - aHitPosT.AdjustY( n2HitLog ); - aHitPosB.AdjustY( -n2HitLog ); - - if ( !bClosed || - !bFilled || - (SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && - SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && - SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && - SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) ) ) - { - if ( SdDrawDocument::GetIMapInfo( pObj ) ) - { - const IMapObject* pIMapObj = SdDrawDocument::GetHitIMapObject( pObj, rPos ); - - if ( pIMapObj && !pIMapObj->GetURL().isEmpty() ) - { - // Jump to Document - mpWindow->ReleaseMouse(); - SfxStringItem aStrItem(SID_FILE_NAME, pIMapObj->GetURL()); - SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName()); - SfxViewFrame* pFrame = mpViewShell->GetViewFrame(); - SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame); - SfxBoolItem aBrowseItem( SID_BROWSE, true ); - mpWindow->ReleaseMouse(); - pFrame->GetDispatcher()->ExecuteList(SID_OPENDOC, - SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, - { &aStrItem, &aFrameItem, &aBrowseItem, &aReferer }); - - bAnimated = true; - } - } - else if( dynamic_cast< const GraphicDocShell *>( mpDocSh ) == nullptr && - dynamic_cast< const DrawView *>( mpView ) != nullptr && - SdDrawDocument::GetAnimationInfo(pObj)) - { - /********************************************************** - * Animation-object hit in the middle -> interaction - **********************************************************/ - SdAnimationInfo* pInfo = SdDrawDocument::GetAnimationInfo(pObj); - DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell); - mpWindow->ReleaseMouse(); - - switch (pInfo->meClickAction) - { - case presentation::ClickAction_BOOKMARK: - { - // Jump to Bookmark (Page or Object) - SfxStringItem aItem(SID_NAVIGATOR_OBJECT, pInfo->GetBookmark()); - mpViewShell->GetViewFrame()->GetDispatcher()->ExecuteList( - SID_NAVIGATOR_OBJECT, - SfxCallMode::SLOT | SfxCallMode::RECORD, { &aItem }); - bAnimated = true; - } - break; - - case presentation::ClickAction_DOCUMENT: - { - OUString sBookmark( pInfo->GetBookmark() ); - // Jump to document - if (!sBookmark.isEmpty()) - { - SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName()); - SfxStringItem aStrItem(SID_FILE_NAME, sBookmark); - SfxViewFrame* pFrame = mpViewShell->GetViewFrame(); - SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame); - SfxBoolItem aBrowseItem( SID_BROWSE, true ); - pFrame->GetDispatcher()-> - ExecuteList(SID_OPENDOC, - SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, - { &aStrItem, &aFrameItem, &aBrowseItem, &aReferer }); - } - - bAnimated = true; - } - break; - - case presentation::ClickAction_PREVPAGE: - { - // Jump to the previous page - SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_PREVIOUS); - mpViewShell->GetViewFrame()->GetDispatcher()-> - ExecuteList(SID_NAVIGATOR_PAGE, - SfxCallMode::SLOT | SfxCallMode::RECORD, - { &aItem }); - bAnimated = true; - } - break; - - case presentation::ClickAction_NEXTPAGE: - { - // Jump to the next page - SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_NEXT); - mpViewShell->GetViewFrame()->GetDispatcher()-> - ExecuteList(SID_NAVIGATOR_PAGE, - SfxCallMode::SLOT | SfxCallMode::RECORD, - { &aItem }); - bAnimated = true; - } - break; - - case presentation::ClickAction_FIRSTPAGE: - { - // Jump to the first page - SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_FIRST); - mpViewShell->GetViewFrame()->GetDispatcher()-> - ExecuteList(SID_NAVIGATOR_PAGE, - SfxCallMode::SLOT | SfxCallMode::RECORD, - { &aItem }); - bAnimated = true; - } - break; - - case presentation::ClickAction_LASTPAGE: - { - // Jump to the last page - SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_LAST); - mpViewShell->GetViewFrame()->GetDispatcher()-> - ExecuteList(SID_NAVIGATOR_PAGE, - SfxCallMode::SLOT | SfxCallMode::RECORD, - { &aItem }); - bAnimated = true; - } - break; - - case presentation::ClickAction_SOUND: - { -#if HAVE_FEATURE_AVMEDIA - try - { - mxPlayer.set( avmedia::MediaWindow::createPlayer( pInfo->GetBookmark(), ""/*TODO?*/), uno::UNO_SET_THROW ); - mxPlayer->start(); - } - catch( uno::Exception& ) - { - } -#endif - bAnimated = true; - } - break; - - case presentation::ClickAction_VERB: - { - // Assign verb - mpView->UnmarkAll(); - mpView->MarkObj(pObj, mpView->GetSdrPageView()); - pDrViewSh->DoVerb(static_cast<sal_Int16>(pInfo->mnVerb)); - bAnimated = true; - } - break; - - case presentation::ClickAction_PROGRAM: - { - OUString aBaseURL = GetDocSh()->GetMedium()->GetBaseURL(); - INetURLObject aURL( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pInfo->GetBookmark(), - URIHelper::GetMaybeFileHdl(), true, false, - INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism::Unambiguous ) ); - - if( INetProtocol::File == aURL.GetProtocol() ) - { - SfxStringItem aUrl( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); - SfxBoolItem aBrowsing( SID_BROWSE, true ); - - SfxViewFrame* pViewFrm = SfxViewFrame::Current(); - if (pViewFrm) - pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC, - SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, - { &aUrl, &aBrowsing }); - } - - bAnimated = true; - } - break; - - case presentation::ClickAction_MACRO: - { - // Execute macro - OUString aMacro = pInfo->GetBookmark(); - - if ( SfxApplication::IsXScriptURL( aMacro ) ) - { - uno::Any aRet; - uno::Sequence< sal_Int16 > aOutArgsIndex; - uno::Sequence<uno::Any> aParams; - uno::Sequence< uno::Any > aOutArgs; - - ErrCode eErr = mpDocSh->CallXScript( aMacro, - aParams, aRet, aOutArgsIndex, aOutArgs); - - // Check the return value from the script - bool bTmp = false; - bAnimated = eErr == ERRCODE_NONE && - aRet.getValueType() == cppu::UnoType<bool>::get() && - ( aRet >>= bTmp ) && - bTmp; - } - else - { - // aMacro has got following format: - // "Macroname.Modulname.Libname.Documentname" or - // "Macroname.Modulname.Libname.Applicationname" - sal_Int32 nIdx{ 0 }; - const OUString aMacroName = aMacro.getToken(0, '.', nIdx); - const OUString aModulName = aMacro.getToken(0, '.', nIdx); - - // In this moment the Call-method only - // resolves modulename+macroname - OUString aExecMacro(aModulName + "." + aMacroName); - bAnimated = mpDocSh->GetBasic()->Call(aExecMacro); - } - } - break; - - default: - { - bAnimated = false; - } - break; - } - } - - if (!bAnimated && - dynamic_cast< const DrawView *>( mpView ) != nullptr && - dynamic_cast< const GraphicDocShell *>( mpDocSh ) == nullptr && - SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) && - SdDrawDocument::GetAnimationInfo(pObj)) - { - /********************************************************** - * Effect-Object hit in the middle -> Play effect - **********************************************************/ - SdAnimationInfo* pInfo = SdDrawDocument::GetAnimationInfo(pObj); - - switch (pInfo->meClickAction) - { - case presentation::ClickAction_VANISH: - case presentation::ClickAction_INVISIBLE: - break; - - default: - bAnimated = false; - break; - } - } - } - - return bAnimated; -} - /** is called when the current function should be aborted. <p> This is used when a function gets a KEY_ESCAPE but can also be called directly. |