Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/sw/source/uibase/inc/uivwimp.hxx
Line
Count
Source (jump to first uncovered line)
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_SW_SOURCE_UIBASE_INC_UIVWIMP_HXX
20
#define INCLUDED_SW_SOURCE_UIBASE_INC_UIVWIMP_HXX
21
22
#include <view.hxx>
23
24
#include <sfx2/objsh.hxx>
25
#include <com/sun/star/view/XSelectionSupplier.hpp>
26
#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
27
#include <cppuhelper/implbase.hxx>
28
#include <cppuhelper/weakref.hxx>
29
#include <unotools/weakref.hxx>
30
31
class SwXTextView;
32
class SfxRequest;
33
class SwTransferable;
34
35
namespace sfx2 { class DocumentInserter; }
36
37
class SwScannerEventListener final : public ::cppu::WeakImplHelper<
38
    css::lang::XEventListener >
39
{
40
    SwView* m_pView;
41
42
public:
43
44
0
    SwScannerEventListener( SwView& rView ) : m_pView( &rView )  {}
45
    virtual ~SwScannerEventListener() override;
46
47
    // XEventListener
48
    virtual void SAL_CALL disposing(
49
                    const css::lang::EventObject& rEventObject ) override;
50
51
0
    void ViewDestroyed() { m_pView = nullptr; }
52
};
53
54
// Clipboard EventListener
55
class SwClipboardChangeListener final : public ::cppu::WeakImplHelper<
56
    css::datatransfer::clipboard::XClipboardListener >
57
{
58
    SwView* m_pView;
59
60
    // XEventListener
61
    virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) override;
62
63
    // XClipboardListener
64
    virtual void SAL_CALL changedContents( const css::datatransfer::clipboard::ClipboardEvent& rEventObject ) override;
65
66
public:
67
0
    SwClipboardChangeListener( SwView& rView ) : m_pView( &rView ) {}
68
    virtual ~SwClipboardChangeListener() override;
69
70
0
    void ViewDestroyed() { m_pView = nullptr; }
71
72
    void AddRemoveListener( bool bAdd );
73
};
74
75
class SwMailMergeConfigItem;
76
class SwXDispatchProviderInterceptor;
77
78
class SwView_Impl
79
{
80
    rtl::Reference< SwXDispatchProviderInterceptor > m_xDispatchProviderInterceptor;
81
    rtl::Reference< SwXTextView > mxXTextView;       // UNO object
82
    std::vector< unotools::WeakReference< SwTransferable > > mxTransferables;
83
84
    // temporary document for printing text of selection / multi selection
85
    // in PDF export.
86
    SfxObjectShellLock          m_xTmpSelDocShell;
87
88
    SwView*                     m_pView;
89
    rtl::Reference<SwScannerEventListener>
90
                                mxScanEvtLstnr;
91
    rtl::Reference<SwClipboardChangeListener>
92
                                mxClipEvtLstnr;
93
    ShellMode                   m_eShellMode;
94
95
    std::shared_ptr<SwMailMergeConfigItem>
96
                                m_xConfigItem;
97
98
    std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter;
99
    std::unique_ptr<SfxRequest>             m_pRequest;
100
    sal_Int16                   m_nParam;
101
102
    Point                       m_aEditingPosition;
103
    bool                        m_bSelectObject;
104
    bool                        m_bEditingPositionSet;
105
106
    void                        DisconnectTransferableDDE();
107
108
public:
109
    /// Redline author that's specific to this view.
110
    OUString m_sRedlineAuthor;
111
112
    SwView_Impl(SwView* pShell);
113
    ~SwView_Impl();
114
115
    void                            SetShellMode(ShellMode eSet);
116
117
    css::view::XSelectionSupplier* GetUNOObject();
118
    SwXTextView*                    GetUNOObject_Impl();
119
    void                            Invalidate();
120
121
1
    ShellMode                       GetShellMode() const {return m_eShellMode;}
122
123
    void                            ExecuteScan(SfxRequest& rReq);
124
    SwScannerEventListener&         GetScannerEventListener();
125
126
    void                            AddClipboardListener();
127
128
    void                            AddTransferable(SwTransferable& rTransferable);
129
130
    void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rItem)
131
0
    {
132
0
        m_xConfigItem = rItem;
133
0
    }
134
0
    std::shared_ptr<SwMailMergeConfigItem> const & GetMailMergeConfigItem() const {return m_xConfigItem;}
135
136
    //#i33307# restore editing position
137
    void                    SetRestorePosition(const Point& rCursorPos, bool bSelectObj)
138
8.42k
                            {
139
8.42k
                                m_aEditingPosition = rCursorPos;
140
8.42k
                                m_bSelectObject = bSelectObj;
141
8.42k
                                m_bEditingPositionSet = true;
142
8.42k
                            }
143
    bool                    GetRestorePosition(Point& rCursorPos, bool& rbSelectObj)
144
0
                            {
145
0
                                rCursorPos = m_aEditingPosition;
146
0
                                rbSelectObj = m_bSelectObject;
147
0
                                return m_bEditingPositionSet;
148
0
                            }
149
150
    void                    StartDocumentInserter(
151
                                const OUString& rFactory,
152
                                const Link<sfx2::FileDialogHelper*,void>& rEndDialogHdl,
153
                                const sal_uInt16 nSlotId
154
                            );
155
    std::unique_ptr<SfxMedium> CreateMedium();
156
    void                    InitRequest( const SfxRequest& rRequest );
157
158
0
    SfxRequest*      GetRequest() const { return m_pRequest.get(); }
159
0
    sal_Int16        GetParam() const { return m_nParam; }
160
0
    void             SetParam( sal_Int16 nParam ) { m_nParam = nParam; }
161
};
162
#endif
163
164
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */