1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <sfx2/request.hxx>
22 #include <svx/svdview.hxx>
25 #include <mediash.hxx>
27 #include <sfx2/objface.hxx>
28 #include <vcl/EnumContext.hxx>
29 #include <svx/MediaShellHelpers.hxx>
31 #define ShellClass_SwMediaShell
32 #include <swslots.hxx>
36 SFX_IMPL_INTERFACE(SwMediaShell
, SwBaseShell
)
38 void SwMediaShell::InitInterface_Impl()
40 GetStaticInterface()->RegisterPopupMenu("media");
42 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT
, SfxVisibilityFlags::Invisible
,
43 ToolbarId::Media_Toolbox
);
46 void SwMediaShell::ExecMedia(SfxRequest
const& rReq
)
48 SwWrtShell
* pSh
= &GetShell();
49 SdrView
* pSdrView
= pSh
->GetDrawView();
54 const bool bChanged
= pSdrView
->GetModel().IsChanged();
55 pSdrView
->GetModel().SetChanged(false);
57 switch (rReq
.GetSlot())
60 if (pSh
->IsObjSelected())
63 pSh
->DelSelectedObj();
65 if (pSh
->IsSelFrameMode())
66 pSh
->LeaveSelFrameMode();
68 GetView().AttrChangedNotify(nullptr);
72 case SID_AVMEDIA_TOOLBOX
:
73 if (pSh
->IsObjSelected())
74 MediaShellHelpers::Execute(pSdrView
, rReq
);
81 if (pSdrView
->GetModel().IsChanged())
82 GetShell().SetModified();
84 pSdrView
->GetModel().SetChanged();
87 void SwMediaShell::GetMediaState(SfxItemSet
& rSet
)
89 MediaShellHelpers::GetState(GetShell().GetDrawView(), rSet
);
92 SwMediaShell::SwMediaShell(SwView
& _rView
)
95 SetName("Media Playback");
96 SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Media
));
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */