Line data Source code
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 : #ifndef INCLUDED_FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
21 : #define INCLUDED_FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
22 :
23 : #include "featuredispatcher.hxx"
24 : #include <tools/link.hxx>
25 :
26 : class TransferableClipboardListener;
27 : class TransferableDataHelper;
28 :
29 : namespace frm
30 : {
31 :
32 :
33 :
34 : //= OClipboardDispatcher
35 :
36 0 : class OClipboardDispatcher : public ORichTextFeatureDispatcher
37 : {
38 : public:
39 : enum ClipboardFunc
40 : {
41 : eCut,
42 : eCopy,
43 : ePaste
44 : };
45 :
46 : private:
47 : ClipboardFunc m_eFunc;
48 : sal_Bool m_bLastKnownEnabled;
49 :
50 : public:
51 : OClipboardDispatcher( EditView& _rView, ClipboardFunc _eFunc );
52 :
53 : protected:
54 : // XDispatch
55 : virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& URL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
56 :
57 : // ORichTextFeatureDispatcher
58 : virtual void invalidateFeatureState_Broadcast() SAL_OVERRIDE;
59 : virtual ::com::sun::star::frame::FeatureStateEvent
60 : buildStatusEvent() const SAL_OVERRIDE;
61 :
62 : protected:
63 : /** determines whether our functionality is currently available
64 : to be overridden for ePaste
65 : */
66 : virtual sal_Bool implIsEnabled( ) const;
67 : };
68 :
69 :
70 : //= OPasteClipboardDispatcher
71 :
72 : class OPasteClipboardDispatcher : public OClipboardDispatcher
73 : {
74 : private:
75 : TransferableClipboardListener* m_pClipListener;
76 : sal_Bool m_bPastePossible;
77 :
78 : public:
79 : OPasteClipboardDispatcher( EditView& _rView );
80 :
81 : protected:
82 : virtual ~OPasteClipboardDispatcher();
83 :
84 : // OClipboardDispatcher
85 : virtual sal_Bool implIsEnabled( ) const SAL_OVERRIDE;
86 :
87 : // ORichTextFeatureDispatcher
88 : virtual void disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify ) SAL_OVERRIDE;
89 :
90 : private:
91 : DECL_LINK( OnClipboardChanged, TransferableDataHelper* );
92 : };
93 :
94 :
95 : } // namespace frm
96 :
97 :
98 : #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|