summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-05-17 22:59:52 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2021-05-26 15:37:06 +0200
commit2e30d16bb945042b5c033dc9bdba690ee4a08fed (patch)
tree5122c1b3e6a5859141a35ec897c6a727f9c499bd
parent456b87b6b188984579c1d809aab805f6f324ea53 (diff)
Refactor module media item handling
Move common functionality into svx::MediaShellHelpers. Change-Id: I6f5db59bdcff7cad00a64e76f6aad7b8ecb4ffa9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116126 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--include/svx/MediaShellHelpers.hxx39
-rw-r--r--sc/source/ui/drawfunc/mediash.cxx90
-rw-r--r--sc/source/ui/inc/mediash.hxx1
-rw-r--r--sd/source/ui/view/MediaObjectBar.cxx97
-rw-r--r--solenv/clang-format/excludelist4
-rw-r--r--svx/Library_svx.mk1
-rw-r--r--svx/source/svdraw/MediaShellHelpers.cxx103
-rw-r--r--sw/source/uibase/shells/mediash.cxx112
8 files changed, 197 insertions, 250 deletions
diff --git a/include/svx/MediaShellHelpers.hxx b/include/svx/MediaShellHelpers.hxx
new file mode 100644
index 000000000000..5cfecaedf1a1
--- /dev/null
+++ b/include/svx/MediaShellHelpers.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+
+class SdrMarkView;
+class SfxItemSet;
+class SfxRequest;
+
+namespace avmedia
+{
+class MediaItem;
+}
+
+namespace svx::MediaShellHelpers
+{
+SVX_DLLPUBLIC void GetState(SdrMarkView* pSdrView, SfxItemSet& rSet);
+SVX_DLLPUBLIC const ::avmedia::MediaItem* Execute(SdrMarkView* pSdrView, SfxRequest const& rReq);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/drawfunc/mediash.cxx b/sc/source/ui/drawfunc/mediash.cxx
index 242ee95120b7..b203cfeb7fd4 100644
--- a/sc/source/ui/drawfunc/mediash.cxx
+++ b/sc/source/ui/drawfunc/mediash.cxx
@@ -19,12 +19,8 @@
#include <memory>
#include <sfx2/objface.hxx>
-#include <sfx2/request.hxx>
-#include <avmedia/mediaitem.hxx>
-#include <svl/whiter.hxx>
-#include <svx/svdomedia.hxx>
-#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
#include <vcl/EnumContext.hxx>
+#include <svx/MediaShellHelpers.hxx>
#include <mediash.hxx>
#include <strings.hrc>
@@ -35,95 +31,35 @@
#define ShellClass_ScMediaShell
#include <scslots.hxx>
+using namespace svx;
+
SFX_IMPL_INTERFACE(ScMediaShell, ScDrawShell)
void ScMediaShell::InitInterface_Impl()
{
- GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Media_Objectbar);
+ GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible,
+ ToolbarId::Media_Objectbar);
GetStaticInterface()->RegisterPopupMenu("media");
}
-
-ScMediaShell::ScMediaShell(ScViewData& rData) :
- ScDrawShell(rData)
+ScMediaShell::ScMediaShell(ScViewData& rData)
+ : ScDrawShell(rData)
{
- SetName( ScResId( SCSTR_MEDIASHELL ) );
+ SetName(ScResId(SCSTR_MEDIASHELL));
SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Media));
}
-ScMediaShell::~ScMediaShell()
-{
-}
+ScMediaShell::~ScMediaShell() {}
-void ScMediaShell::GetMediaState( SfxItemSet& rSet )
+void ScMediaShell::GetMediaState(SfxItemSet& rSet)
{
- ScDrawView* pView = GetViewData().GetScDrawView();
-
- if( !pView )
- return;
-
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while( nWhich )
- {
- if( SID_AVMEDIA_TOOLBOX == nWhich )
- {
- std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( pView->GetMarkedObjectList() ));
- bool bDisable = true;
-
- if( 1 == pMarkList->GetMarkCount() )
- {
- SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
- if( dynamic_cast<const SdrMediaObj*>( pObj) )
- {
- ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
-
- static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
- rSet.Put( aItem );
- bDisable = false;
- }
- }
-
- if( bDisable )
- rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
- }
-
- nWhich = aIter.NextWhich();
- }
+ MediaShellHelpers::GetState(GetViewData().GetScDrawView(), rSet);
}
-void ScMediaShell::ExecuteMedia( const SfxRequest& rReq )
+void ScMediaShell::ExecuteMedia(const SfxRequest& rReq)
{
- ScDrawView* pView = GetViewData().GetScDrawView();
-
- if( pView && SID_AVMEDIA_TOOLBOX == rReq.GetSlot() )
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem;
-
- if( !pArgs || ( SfxItemState::SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
- pItem = nullptr;
-
- if( pItem )
- {
- std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( pView->GetMarkedObjectList() ));
-
- if( 1 == pMarkList->GetMarkCount() )
- {
- SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
- if( dynamic_cast<const SdrMediaObj*>( pObj) )
- {
- static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
- static_cast< const ::avmedia::MediaItem& >( *pItem ) );
- }
- }
- }
- }
-
+ MediaShellHelpers::Execute(GetViewData().GetScDrawView(), rReq);
Invalidate();
}
diff --git a/sc/source/ui/inc/mediash.hxx b/sc/source/ui/inc/mediash.hxx
index fb75f303ec82..cc7b6db7dd33 100644
--- a/sc/source/ui/inc/mediash.hxx
+++ b/sc/source/ui/inc/mediash.hxx
@@ -19,7 +19,6 @@
#pragma once
-#include <sfx2/shell.hxx>
#include <shellids.hxx>
class ScViewData;
diff --git a/sd/source/ui/view/MediaObjectBar.cxx b/sd/source/ui/view/MediaObjectBar.cxx
index b6ee505f98a5..8d77b5b8c501 100644
--- a/sd/source/ui/view/MediaObjectBar.cxx
+++ b/sd/source/ui/view/MediaObjectBar.cxx
@@ -19,13 +19,9 @@
#include <MediaObjectBar.hxx>
#include <avmedia/mediaitem.hxx>
-#include <sfx2/msg.hxx>
#include <sfx2/sfxsids.hrc>
-#include <sfx2/request.hxx>
#include <sfx2/objface.hxx>
-#include <svl/whiter.hxx>
-#include <svx/svdomedia.hxx>
-#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <svx/MediaShellHelpers.hxx>
#include <strings.hrc>
#include <DrawDocShell.hxx>
@@ -35,100 +31,41 @@
#include <memory>
using namespace sd;
+using namespace svx;
#define ShellClass_MediaObjectBar
#include <sdslots.hxx>
-namespace sd {
-
-
+namespace sd
+{
SFX_IMPL_INTERFACE(MediaObjectBar, SfxShell)
-void MediaObjectBar::InitInterface_Impl()
-{
-}
+void MediaObjectBar::InitInterface_Impl() {}
-MediaObjectBar::MediaObjectBar( const ViewShell* pSdViewShell, ::sd::View* pSdView ) :
- SfxShell( pSdViewShell->GetViewShell() ),
- mpView( pSdView )
+MediaObjectBar::MediaObjectBar(const ViewShell* pSdViewShell, ::sd::View* pSdView)
+ : SfxShell(pSdViewShell->GetViewShell())
+ , mpView(pSdView)
{
DrawDocShell* pDocShell = pSdViewShell->GetDocSh();
- SetPool( &pDocShell->GetPool() );
- SetUndoManager( pDocShell->GetUndoManager() );
- SetRepeatTarget( mpView );
+ SetPool(&pDocShell->GetPool());
+ SetUndoManager(pDocShell->GetUndoManager());
+ SetRepeatTarget(mpView);
SetName(SdResId(RID_DRAW_MEDIA_TOOLBOX));
}
-MediaObjectBar::~MediaObjectBar()
-{
- SetRepeatTarget( nullptr );
-}
+MediaObjectBar::~MediaObjectBar() { SetRepeatTarget(nullptr); }
-void MediaObjectBar::GetState( SfxItemSet& rSet )
-{
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
+void MediaObjectBar::GetState(SfxItemSet& rSet) { MediaShellHelpers::GetState(mpView, rSet); }
- while( nWhich )
- {
- if( SID_AVMEDIA_TOOLBOX == nWhich )
- {
- std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( mpView->GetMarkedObjectList() ));
- bool bDisable = true;
-
- if( 1 == pMarkList->GetMarkCount() )
- {
- SdrObject* pObj =pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
- if( dynamic_cast< SdrMediaObj *>( pObj ) )
- {
- ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
-
- static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
- rSet.Put( aItem );
- bDisable = false;
- }
- }
-
- if( bDisable )
- rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
- }
-
- nWhich = aIter.NextWhich();
- }
-}
-
-void MediaObjectBar::Execute( SfxRequest const & rReq )
+void MediaObjectBar::Execute(SfxRequest const& rReq)
{
- if( SID_AVMEDIA_TOOLBOX != rReq.GetSlot() )
- return;
-
- const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem;
-
- if( !pArgs || ( SfxItemState::SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
- pItem = nullptr;
-
- if( !pItem )
- return;
-
- std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( mpView->GetMarkedObjectList() ));
-
- if( 1 != pMarkList->GetMarkCount() )
+ const ::avmedia::MediaItem* pMediaItem = MediaShellHelpers::Execute(mpView, rReq);
+ if (!pMediaItem)
return;
- SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
- if( !dynamic_cast< SdrMediaObj *>( pObj ) )
- return;
-
- static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
- static_cast< const ::avmedia::MediaItem& >( *pItem ) );
-
-
//if only changing state then don't set modified flag (e.g. playing a video)
- if( !(static_cast< const ::avmedia::MediaItem& >( *pItem ).getMaskSet() & AVMediaSetMask::STATE))
+ if (!(pMediaItem->getMaskSet() & AVMediaSetMask::STATE))
{
//fdo #32598: after changing playback opts, set document's modified flag
SdDrawDocument& rDoc = mpView->GetDoc();
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 22cd1b275860..046f7dd4e061 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -8901,7 +8901,6 @@ sc/source/ui/drawfunc/fusel2.cxx
sc/source/ui/drawfunc/futext.cxx
sc/source/ui/drawfunc/futext3.cxx
sc/source/ui/drawfunc/graphsh.cxx
-sc/source/ui/drawfunc/mediash.cxx
sc/source/ui/drawfunc/oleobjsh.cxx
sc/source/ui/formdlg/dwfunctr.cxx
sc/source/ui/formdlg/formula.cxx
@@ -9822,7 +9821,6 @@ sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/FrameView.hxx
sd/source/ui/inc/GraphicObjectBar.hxx
sd/source/ui/inc/LayerTabBar.hxx
-sd/source/ui/inc/MediaObjectBar.hxx
sd/source/ui/inc/NavigatorChildWindow.hxx
sd/source/ui/inc/OutlineView.hxx
sd/source/ui/inc/OutlineViewShell.hxx
@@ -10132,7 +10130,6 @@ sd/source/ui/view/DocumentRenderer.cxx
sd/source/ui/view/FormShellManager.cxx
sd/source/ui/view/GraphicObjectBar.cxx
sd/source/ui/view/ImpressViewShellBase.cxx
-sd/source/ui/view/MediaObjectBar.cxx
sd/source/ui/view/OutlineViewShellBase.cxx
sd/source/ui/view/Outliner.cxx
sd/source/ui/view/OutlinerIterator.cxx
@@ -13512,7 +13509,6 @@ sw/source/uibase/shells/grfsh.cxx
sw/source/uibase/shells/grfshex.cxx
sw/source/uibase/shells/langhelper.cxx
sw/source/uibase/shells/listsh.cxx
-sw/source/uibase/shells/mediash.cxx
sw/source/uibase/shells/olesh.cxx
sw/source/uibase/shells/tabsh.cxx
sw/source/uibase/shells/textdrw.cxx
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index c951d91169f3..5ff8a89f6196 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -220,6 +220,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/stbctrls/zoomsliderctrl \
svx/source/stbctrls/zoomctrl \
svx/source/svdraw/ActionDescriptionProvider \
+ svx/source/svdraw/MediaShellHelpers \
svx/source/smarttags/SmartTagMgr \
svx/source/table/accessiblecell \
svx/source/table/accessibletableshape \
diff --git a/svx/source/svdraw/MediaShellHelpers.cxx b/svx/source/svdraw/MediaShellHelpers.cxx
new file mode 100644
index 000000000000..03fb24174e7b
--- /dev/null
+++ b/svx/source/svdraw/MediaShellHelpers.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/MediaShellHelpers.hxx>
+#include <avmedia/mediaitem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svl/whiter.hxx>
+#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <svx/svdmrkv.hxx>
+
+#include <memory>
+
+namespace svx::MediaShellHelpers
+{
+void GetState(SdrMarkView* pSdrView, SfxItemSet& rSet)
+{
+ if (!pSdrView)
+ return;
+
+ SfxWhichIter aIter(rSet);
+
+ for (sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich())
+ {
+ if (SID_AVMEDIA_TOOLBOX != nWhich)
+ continue;
+
+ std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList(pSdrView->GetMarkedObjectList()));
+ bool bDisable = true;
+
+ if (1 == pMarkList->GetMarkCount())
+ {
+ SdrObject* pObj = pMarkList->GetMark(0)->GetMarkedSdrObj();
+
+ if (dynamic_cast<SdrMediaObj*>(pObj))
+ {
+ ::avmedia::MediaItem aItem(SID_AVMEDIA_TOOLBOX);
+
+ static_cast<sdr::contact::ViewContactOfSdrMediaObj&>(pObj->GetViewContact())
+ .updateMediaItem(aItem);
+ rSet.Put(aItem);
+ bDisable = false;
+ }
+ }
+
+ if (bDisable)
+ rSet.DisableItem(SID_AVMEDIA_TOOLBOX);
+ }
+}
+
+const ::avmedia::MediaItem* Execute(SdrMarkView* pSdrView, SfxRequest const& rReq)
+{
+ if (!pSdrView)
+ return nullptr;
+
+ if (SID_AVMEDIA_TOOLBOX != rReq.GetSlot())
+ return nullptr;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+
+ if (!pArgs || (SfxItemState::SET != pArgs->GetItemState(SID_AVMEDIA_TOOLBOX, false, &pItem)))
+ pItem = nullptr;
+
+ if (!pItem)
+ return nullptr;
+
+ std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList(pSdrView->GetMarkedObjectList()));
+
+ if (1 != pMarkList->GetMarkCount())
+ return nullptr;
+
+ SdrObject* pObj = pMarkList->GetMark(0)->GetMarkedSdrObj();
+
+ if (!dynamic_cast<SdrMediaObj*>(pObj))
+ return nullptr;
+
+ const ::avmedia::MediaItem* pMediaItem = static_cast<const ::avmedia::MediaItem*>(pItem);
+ static_cast<sdr::contact::ViewContactOfSdrMediaObj&>(pObj->GetViewContact())
+ .executeMediaItem(*pMediaItem);
+
+ return pMediaItem;
+}
+
+} // end of namespace svx::MediaShellHelpers
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/mediash.cxx b/sw/source/uibase/shells/mediash.cxx
index 7aaabc817c08..2eeffe659989 100644
--- a/sw/source/uibase/shells/mediash.cxx
+++ b/sw/source/uibase/shells/mediash.cxx
@@ -18,7 +18,6 @@
*/
#include <cmdid.h>
-#include <svl/whiter.hxx>
#include <sfx2/request.hxx>
#include <svx/svdview.hxx>
#include <view.hxx>
@@ -27,135 +26,72 @@
#include <sfx2/objface.hxx>
#include <vcl/EnumContext.hxx>
-#include <svx/svdomedia.hxx>
-#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
-#include <avmedia/mediaitem.hxx>
+#include <svx/MediaShellHelpers.hxx>
#define ShellClass_SwMediaShell
-#include <sfx2/msg.hxx>
#include <swslots.hxx>
#include <memory>
+using namespace svx;
+
SFX_IMPL_INTERFACE(SwMediaShell, SwBaseShell)
void SwMediaShell::InitInterface_Impl()
{
GetStaticInterface()->RegisterPopupMenu("media");
- GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Media_Toolbox);
+ GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible,
+ ToolbarId::Media_Toolbox);
}
-void SwMediaShell::ExecMedia(SfxRequest const &rReq)
+void SwMediaShell::ExecMedia(SfxRequest const& rReq)
{
SwWrtShell* pSh = &GetShell();
- SdrView* pSdrView = pSh->GetDrawView();
+ SdrView* pSdrView = pSh->GetDrawView();
- if( !pSdrView )
+ if (!pSdrView)
return;
- const SfxItemSet* pArgs = rReq.GetArgs();
- bool bChanged = pSdrView->GetModel()->IsChanged();
-
- pSdrView->GetModel()->SetChanged( false );
+ const bool bChanged = pSdrView->GetModel()->IsChanged();
+ pSdrView->GetModel()->SetChanged(false);
- switch( rReq.GetSlot() )
+ switch (rReq.GetSlot())
{
case SID_DELETE:
- {
- if( pSh->IsObjSelected() )
+ if (pSh->IsObjSelected())
{
pSh->SetModified();
pSh->DelSelectedObj();
- if( pSh->IsSelFrameMode() )
+ if (pSh->IsSelFrameMode())
pSh->LeaveSelFrameMode();
GetView().AttrChangedNotify(nullptr);
}
- }
- break;
+ break;
case SID_AVMEDIA_TOOLBOX:
- {
- if( pSh->IsObjSelected() )
- {
- const SfxPoolItem* pItem;
-
- if( !pArgs || ( SfxItemState::SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
- pItem = nullptr;
-
- if( pItem )
- {
- std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( pSdrView->GetMarkedObjectList() ));
-
- if( 1 == pMarkList->GetMarkCount() )
- {
- SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
- if( dynamic_cast< const SdrMediaObj *>( pObj ) )
- {
- static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
- static_cast< const ::avmedia::MediaItem& >( *pItem ) );
- }
- }
- }
- }
- }
- break;
+ if (pSh->IsObjSelected())
+ MediaShellHelpers::Execute(pSdrView, rReq);
+ break;
default:
- break;
+ break;
}
- if( pSdrView->GetModel()->IsChanged() )
+ if (pSdrView->GetModel()->IsChanged())
GetShell().SetModified();
- else if( bChanged )
+ else if (bChanged)
pSdrView->GetModel()->SetChanged();
}
-void SwMediaShell::GetMediaState(SfxItemSet &rSet)
+void SwMediaShell::GetMediaState(SfxItemSet& rSet)
{
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while( nWhich )
- {
- if( SID_AVMEDIA_TOOLBOX == nWhich )
- {
- SwWrtShell& rSh = GetShell();
- SdrView* pView = rSh.GetDrawView();
-
- if( pView )
- {
- bool bDisable = true;
- std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( pView->GetMarkedObjectList() ));
-
- if( 1 == pMarkList->GetMarkCount() )
- {
- SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
- if( dynamic_cast< const SdrMediaObj *>( pObj ) )
- {
- ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
-
- static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
- rSet.Put( aItem );
- bDisable = false;
- }
- }
-
- if( bDisable )
- rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
- }
- }
-
- nWhich = aIter.NextWhich();
- }
+ MediaShellHelpers::GetState(GetShell().GetDrawView(), rSet);
}
-SwMediaShell::SwMediaShell(SwView &_rView) :
- SwBaseShell(_rView)
-
+SwMediaShell::SwMediaShell(SwView& _rView)
+ : SwBaseShell(_rView)
{
SetName("Media Playback");
SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Media));