Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/source/ui/view/MediaObjectBar.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 <MediaObjectBar.hxx>
21
#include <avmedia/mediaitem.hxx>
22
#include <sfx2/sfxsids.hrc>
23
#include <sfx2/objface.hxx>
24
#include <svx/MediaShellHelpers.hxx>
25
26
#include <strings.hrc>
27
#include <DrawDocShell.hxx>
28
#include <ViewShell.hxx>
29
#include <sdresid.hxx>
30
#include <drawdoc.hxx>
31
32
using namespace sd;
33
using namespace svx;
34
35
#define ShellClass_MediaObjectBar
36
#include <sdslots.hxx>
37
38
namespace sd
39
{
40
SFX_IMPL_INTERFACE(MediaObjectBar, SfxShell)
41
42
5
void MediaObjectBar::InitInterface_Impl() {}
43
44
MediaObjectBar::MediaObjectBar(ViewShell& rSdViewShell, ::sd::View* pSdView)
45
0
    : SfxShell(rSdViewShell.GetViewShell())
46
0
    , mpView(pSdView)
47
0
{
48
0
    DrawDocShell* pDocShell = rSdViewShell.GetDocSh();
49
50
0
    SetPool(&pDocShell->GetPool());
51
0
    SetUndoManager(pDocShell->GetUndoManager());
52
0
    SetRepeatTarget(mpView);
53
0
    SetName(SdResId(RID_DRAW_MEDIA_TOOLBOX));
54
0
}
55
56
0
MediaObjectBar::~MediaObjectBar() { SetRepeatTarget(nullptr); }
57
58
0
void MediaObjectBar::GetState(SfxItemSet& rSet) { MediaShellHelpers::GetState(mpView, rSet); }
59
60
void MediaObjectBar::Execute(SfxRequest const& rReq)
61
0
{
62
0
    const ::avmedia::MediaItem* pMediaItem = MediaShellHelpers::Execute(mpView, rReq);
63
0
    if (!pMediaItem)
64
0
        return;
65
66
    //if only changing state then don't set modified flag (e.g. playing a video)
67
0
    if (!(pMediaItem->getMaskSet() & AVMediaSetMask::STATE))
68
0
    {
69
        //fdo #32598: after changing playback opts, set document's modified flag
70
0
        SdDrawDocument& rDoc = mpView->GetDoc();
71
0
        rDoc.SetChanged();
72
0
    }
73
0
}
74
75
} // end of namespace sd
76
77
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */