xref: /AOO41X/main/forms/source/richtext/clipboarddispatcher.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
29 #define FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
30 
31 #include "featuredispatcher.hxx"
32 #include <tools/link.hxx>
33 
34 class TransferableClipboardListener;
35 class TransferableDataHelper;
36 //........................................................................
37 namespace frm
38 {
39 //........................................................................
40 
41 	//====================================================================
42 	//= OClipboardDispatcher
43 	//====================================================================
44     class OClipboardDispatcher : public ORichTextFeatureDispatcher
45 	{
46     public:
47         enum ClipboardFunc
48         {
49             eCut,
50             eCopy,
51             ePaste
52         };
53 
54     private:
55         ClipboardFunc   m_eFunc;
56         sal_Bool        m_bLastKnownEnabled;
57 
58     public:
59         OClipboardDispatcher( EditView& _rView, ClipboardFunc _eFunc );
60 
61     protected:
62         // XDispatch
63         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);
64 
65         // ORichTextFeatureDispatcher
66         virtual void    invalidateFeatureState_Broadcast();
67         virtual ::com::sun::star::frame::FeatureStateEvent
68                         buildStatusEvent() const;
69 
70     protected:
71         /** determines whether our functionality is currently available
72             to be overridden for ePaste
73         */
74         virtual sal_Bool implIsEnabled( ) const;
75 	};
76 
77 	//====================================================================
78 	//= OPasteClipboardDispatcher
79 	//====================================================================
80     class OPasteClipboardDispatcher : public OClipboardDispatcher
81     {
82     private:
83         TransferableClipboardListener*  m_pClipListener;
84         sal_Bool                        m_bPastePossible;
85 
86     public:
87         OPasteClipboardDispatcher( EditView& _rView );
88 
89     protected:
90         ~OPasteClipboardDispatcher();
91 
92         // OClipboardDispatcher
93         virtual sal_Bool    implIsEnabled( ) const;
94 
95         // ORichTextFeatureDispatcher
96         virtual void    disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
97 
98     private:
99         DECL_LINK( OnClipboardChanged, TransferableDataHelper* );
100     };
101 
102 //........................................................................
103 } // namespace frm
104 //........................................................................
105 
106 #endif // FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
107 
108