Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/sfx2/request.hxx
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
#ifndef INCLUDED_SFX2_REQUEST_HXX
20
#define INCLUDED_SFX2_REQUEST_HXX
21
22
#include <sal/config.h>
23
#include <sfx2/dllapi.h>
24
#include <sal/types.h>
25
#include <svl/itemset.hxx>
26
27
#include <memory>
28
29
class SfxPoolItem;
30
class SfxItemPool;
31
class SfxShell;
32
class SfxSlot;
33
class SfxViewFrame;
34
struct SfxRequest_Impl;
35
enum class SfxCallMode : sal_uInt16;
36
37
namespace com::sun::star::beans { struct PropertyValue; }
38
namespace com::sun::star::frame { class XDispatchRecorder; }
39
namespace com::sun::star::uno { template <class E> class Sequence; }
40
namespace weld { class Window; }
41
42
class SFX2_DLLPUBLIC SfxRequest final
43
{
44
friend struct SfxRequest_Impl;
45
46
    sal_uInt16          nSlot;
47
    std::unique_ptr<SfxAllItemSet>        pArgs;
48
    std::unique_ptr< SfxRequest_Impl >    pImpl;
49
50
public:
51
    SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot,
52
                                     const css::uno::Reference< css::frame::XDispatchRecorder >& xRecorder,
53
                                     SfxViewFrame* );
54
private:
55
    SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet );
56
57
public:
58
                        SfxRequest( SfxViewFrame&, sal_uInt16 nSlotId );
59
                        SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, SfxItemPool &rPool );
60
                        SfxRequest( const SfxSlot* pSlot, const css::uno::Sequence < css::beans::PropertyValue >& rArgs,
61
                                            SfxCallMode nCallMode, SfxItemPool &rPool );
62
                        SfxRequest(sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs);
63
                        SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs, const SfxAllItemSet& rSfxInternalArgs );
64
                        SfxRequest( const SfxRequest& rOrig );
65
                        ~SfxRequest();
66
67
0
    sal_uInt16              GetSlot() const { return nSlot; }
68
0
    void                SetSlot(sal_uInt16 nNewSlot) { nSlot = nNewSlot; }
69
70
    sal_uInt16          GetModifier() const;
71
    void                SetModifier( sal_uInt16 nModi );
72
    void                SetInternalArgs_Impl( const SfxAllItemSet& rArgs );
73
    SAL_DLLPRIVATE const SfxItemSet* GetInternalArgs_Impl() const;
74
0
    const SfxItemSet*   GetArgs() const { return pArgs.get(); }
75
    void                SetArgs( const SfxAllItemSet& rArgs );
76
    void                AppendItem(const SfxPoolItem &);
77
    void                RemoveItem( sal_uInt16 nSlotId );
78
79
    /** Templatized access to the individual parameters of the SfxRequest.
80
81
        Use like: const SfxInt32Item *pPosItem = rReq.GetArg<SfxInt32Item>(SID_POS);
82
    */
83
    template<class T> const T* GetArg(sal_uInt16 nSlotId) const
84
0
    {
85
0
        if (!pArgs)
86
0
            return nullptr;
87
0
        return pArgs->GetItem<T>(nSlotId, false);
88
0
    }
Unexecuted instantiation: SfxBoolItem const* SfxRequest::GetArg<SfxBoolItem>(unsigned short) const
Unexecuted instantiation: SfxUInt16Item const* SfxRequest::GetArg<SfxUInt16Item>(unsigned short) const
Unexecuted instantiation: SfxStringItem const* SfxRequest::GetArg<SfxStringItem>(unsigned short) const
Unexecuted instantiation: SfxUInt32Item const* SfxRequest::GetArg<SfxUInt32Item>(unsigned short) const
Unexecuted instantiation: SfxInt32Item const* SfxRequest::GetArg<SfxInt32Item>(unsigned short) const
Unexecuted instantiation: SvxSizeItem const* SfxRequest::GetArg<SvxSizeItem>(unsigned short) const
Unexecuted instantiation: SfxInt16Item const* SfxRequest::GetArg<SfxInt16Item>(unsigned short) const
Unexecuted instantiation: SfxUnoAnyItem const* SfxRequest::GetArg<SfxUnoAnyItem>(unsigned short) const
Unexecuted instantiation: SfxFrameItem const* SfxRequest::GetArg<SfxFrameItem>(unsigned short) const
Unexecuted instantiation: SfxLinkItem const* SfxRequest::GetArg<SfxLinkItem>(unsigned short) const
Unexecuted instantiation: SvxBrushItem const* SfxRequest::GetArg<SvxBrushItem>(unsigned short) const
Unexecuted instantiation: SfxByteItem const* SfxRequest::GetArg<SfxByteItem>(unsigned short) const
Unexecuted instantiation: SwEnvItem const* SfxRequest::GetArg<SwEnvItem>(unsigned short) const
Unexecuted instantiation: SvxColorItem const* SfxRequest::GetArg<SvxColorItem>(unsigned short) const
89
    template<class T> const T* GetArg(TypedWhichId<T> nSlotId) const
90
0
    {
91
0
        if (!pArgs)
92
0
            return nullptr;
93
0
        return pArgs->GetItem(nSlotId, false);
94
0
    }
Unexecuted instantiation: SvxLRSpaceItem const* SfxRequest::GetArg<SvxLRSpaceItem>(TypedWhichId<SvxLRSpaceItem>) const
Unexecuted instantiation: SvxULSpaceItem const* SfxRequest::GetArg<SvxULSpaceItem>(TypedWhichId<SvxULSpaceItem>) const
Unexecuted instantiation: SfxBoolItem const* SfxRequest::GetArg<SfxBoolItem>(TypedWhichId<SfxBoolItem>) const
Unexecuted instantiation: SfxStringItem const* SfxRequest::GetArg<SfxStringItem>(TypedWhichId<SfxStringItem>) const
Unexecuted instantiation: SfxUInt16Item const* SfxRequest::GetArg<SfxUInt16Item>(TypedWhichId<SfxUInt16Item>) const
Unexecuted instantiation: SfxIntegerListItem const* SfxRequest::GetArg<SfxIntegerListItem>(TypedWhichId<SfxIntegerListItem>) const
Unexecuted instantiation: SfxUInt32Item const* SfxRequest::GetArg<SfxUInt32Item>(TypedWhichId<SfxUInt32Item>) const
Unexecuted instantiation: SfxGlobalNameItem const* SfxRequest::GetArg<SfxGlobalNameItem>(TypedWhichId<SfxGlobalNameItem>) const
Unexecuted instantiation: SfxStringListItem const* SfxRequest::GetArg<SfxStringListItem>(TypedWhichId<SfxStringListItem>) const
Unexecuted instantiation: SfxUnoAnyItem const* SfxRequest::GetArg<SfxUnoAnyItem>(TypedWhichId<SfxUnoAnyItem>) const
Unexecuted instantiation: SfxUnoFrameItem const* SfxRequest::GetArg<SfxUnoFrameItem>(TypedWhichId<SfxUnoFrameItem>) const
Unexecuted instantiation: SfxDocumentInfoItem const* SfxRequest::GetArg<SfxDocumentInfoItem>(TypedWhichId<SfxDocumentInfoItem>) const
Unexecuted instantiation: SfxInt32Item const* SfxRequest::GetArg<SfxInt32Item>(TypedWhichId<SfxInt32Item>) const
Unexecuted instantiation: SfxInt16Item const* SfxRequest::GetArg<SfxInt16Item>(TypedWhichId<SfxInt16Item>) const
Unexecuted instantiation: SvxUnderlineItem const* SfxRequest::GetArg<SvxUnderlineItem>(TypedWhichId<SvxUnderlineItem>) const
Unexecuted instantiation: SvxPostItAuthorItem const* SfxRequest::GetArg<SvxPostItAuthorItem>(TypedWhichId<SvxPostItAuthorItem>) const
Unexecuted instantiation: SvxPostItTextItem const* SfxRequest::GetArg<SvxPostItTextItem>(TypedWhichId<SvxPostItTextItem>) const
Unexecuted instantiation: SvxPostItIdItem const* SfxRequest::GetArg<SvxPostItIdItem>(TypedWhichId<SvxPostItIdItem>) const
Unexecuted instantiation: SvxZoomSliderItem const* SfxRequest::GetArg<SvxZoomSliderItem>(TypedWhichId<SvxZoomSliderItem>) const
Unexecuted instantiation: SvxFontItem const* SfxRequest::GetArg<SvxFontItem>(TypedWhichId<SvxFontItem>) const
Unexecuted instantiation: SvxFontHeightItem const* SfxRequest::GetArg<SvxFontHeightItem>(TypedWhichId<SvxFontHeightItem>) const
Unexecuted instantiation: SvxWeightItem const* SfxRequest::GetArg<SvxWeightItem>(TypedWhichId<SvxWeightItem>) const
Unexecuted instantiation: SvxPostureItem const* SfxRequest::GetArg<SvxPostureItem>(TypedWhichId<SvxPostureItem>) const
Unexecuted instantiation: SvxOverlineItem const* SfxRequest::GetArg<SvxOverlineItem>(TypedWhichId<SvxOverlineItem>) const
Unexecuted instantiation: SvxShadowedItem const* SfxRequest::GetArg<SvxShadowedItem>(TypedWhichId<SvxShadowedItem>) const
Unexecuted instantiation: SvxContourItem const* SfxRequest::GetArg<SvxContourItem>(TypedWhichId<SvxContourItem>) const
Unexecuted instantiation: SvxCrossedOutItem const* SfxRequest::GetArg<SvxCrossedOutItem>(TypedWhichId<SvxCrossedOutItem>) const
Unexecuted instantiation: SvxColorItem const* SfxRequest::GetArg<SvxColorItem>(TypedWhichId<SvxColorItem>) const
Unexecuted instantiation: SvxKerningItem const* SfxRequest::GetArg<SvxKerningItem>(TypedWhichId<SvxKerningItem>) const
Unexecuted instantiation: SvxCaseMapItem const* SfxRequest::GetArg<SvxCaseMapItem>(TypedWhichId<SvxCaseMapItem>) const
95
96
    void                ReleaseArgs();
97
    void                SetReturnValue(const SfxPoolItem &);
98
    const SfxPoolItemHolder& GetReturnValue() const;
99
100
    static css::uno::Reference< css::frame::XDispatchRecorder > GetMacroRecorder(const SfxViewFrame& rFrame);
101
    static bool         HasMacroRecorder(const SfxViewFrame& rFrame);
102
    SfxCallMode         GetCallMode() const;
103
    void                AllowRecording( bool );
104
    bool                AllowsRecording() const;
105
    bool                IsAPI() const;
106
    bool                IsSynchronCall() const;
107
    void                SetSynchronCall( bool bSynchron );
108
109
    bool                IsDone() const;
110
    void                Done( bool bRemove = false );
111
112
    void                Ignore();
113
    void                Cancel();
114
    bool                IsCancelled() const;
115
    void                Done(const SfxItemSet &);
116
117
    void                ForgetAllArgs();
118
119
    /** Return the window that should be used as the parent for any dialogs this request creates
120
    */
121
    weld::Window* GetFrameWeld() const;
122
123
    void SetLokViewId(int nId);
124
125
    int GetLokViewId() const;
126
127
private:
128
    const SfxRequest&   operator=(const SfxRequest &) = delete;
129
};
130
131
#endif
132
133
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */