/src/libreoffice/sw/source/uibase/shells/mediash.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <cmdid.h> |
21 | | #include <sfx2/request.hxx> |
22 | | #include <svx/svdview.hxx> |
23 | | #include <view.hxx> |
24 | | #include <wrtsh.hxx> |
25 | | #include <mediash.hxx> |
26 | | |
27 | | #include <sfx2/objface.hxx> |
28 | | #include <sfx2/toolbarids.hxx> |
29 | | #include <vcl/EnumContext.hxx> |
30 | | #include <svx/MediaShellHelpers.hxx> |
31 | | |
32 | | #define ShellClass_SwMediaShell |
33 | | #include <swslots.hxx> |
34 | | |
35 | | using namespace svx; |
36 | | |
37 | | SFX_IMPL_INTERFACE(SwMediaShell, SwBaseShell) |
38 | | |
39 | | void SwMediaShell::InitInterface_Impl() |
40 | 9 | { |
41 | 9 | GetStaticInterface()->RegisterPopupMenu(u"media"_ustr); |
42 | | |
43 | 9 | GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, |
44 | 9 | ToolbarId::Media_Toolbox); |
45 | 9 | } |
46 | | |
47 | | void SwMediaShell::ExecMedia(SfxRequest const& rReq) |
48 | 0 | { |
49 | 0 | SwWrtShell* pSh = &GetShell(); |
50 | 0 | SdrView* pSdrView = pSh->GetDrawView(); |
51 | |
|
52 | 0 | if (!pSdrView) |
53 | 0 | return; |
54 | | |
55 | 0 | const bool bChanged = pSdrView->GetModel().IsChanged(); |
56 | 0 | pSdrView->GetModel().SetChanged(false); |
57 | |
|
58 | 0 | switch (rReq.GetSlot()) |
59 | 0 | { |
60 | 0 | case SID_DELETE: |
61 | 0 | if (pSh->GetSelectedObjCount()) |
62 | 0 | { |
63 | 0 | pSh->SetModified(); |
64 | 0 | pSh->DelSelectedObj(); |
65 | |
|
66 | 0 | if (pSh->IsSelFrameMode()) |
67 | 0 | pSh->LeaveSelFrameMode(); |
68 | |
|
69 | 0 | GetView().AttrChangedNotify(nullptr); |
70 | 0 | } |
71 | 0 | break; |
72 | | |
73 | 0 | case SID_AVMEDIA_TOOLBOX: |
74 | 0 | if (pSh->GetSelectedObjCount()) |
75 | 0 | MediaShellHelpers::Execute(pSdrView, rReq); |
76 | 0 | break; |
77 | | |
78 | 0 | default: |
79 | 0 | break; |
80 | 0 | } |
81 | | |
82 | 0 | if (pSdrView->GetModel().IsChanged()) |
83 | 0 | GetShell().SetModified(); |
84 | 0 | else if (bChanged) |
85 | 0 | pSdrView->GetModel().SetChanged(); |
86 | 0 | } |
87 | | |
88 | | void SwMediaShell::GetMediaState(SfxItemSet& rSet) |
89 | 0 | { |
90 | 0 | MediaShellHelpers::GetState(GetShell().GetDrawView(), rSet); |
91 | 0 | } |
92 | | |
93 | | SwMediaShell::SwMediaShell(SwView& _rView) |
94 | 0 | : SwBaseShell(_rView) |
95 | 0 | { |
96 | 0 | SetName(u"Media Playback"_ustr); |
97 | 0 | SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Media)); |
98 | 0 | } |
99 | | |
100 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |