1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
25 #define FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
26 
27 #include "featuredispatcher.hxx"
28 #include <tools/link.hxx>
29 
30 class TransferableClipboardListener;
31 class TransferableDataHelper;
32 //........................................................................
33 namespace frm
34 {
35 //........................................................................
36 
37 	//====================================================================
38 	//= OClipboardDispatcher
39 	//====================================================================
40     class OClipboardDispatcher : public ORichTextFeatureDispatcher
41 	{
42     public:
43         enum ClipboardFunc
44         {
45             eCut,
46             eCopy,
47             ePaste
48         };
49 
50     private:
51         ClipboardFunc   m_eFunc;
52         sal_Bool        m_bLastKnownEnabled;
53 
54     public:
55         OClipboardDispatcher( EditView& _rView, ClipboardFunc _eFunc );
56 
57     protected:
58         // XDispatch
59         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);
60 
61         // ORichTextFeatureDispatcher
62         virtual void    invalidateFeatureState_Broadcast();
63         virtual ::com::sun::star::frame::FeatureStateEvent
64                         buildStatusEvent() const;
65 
66     protected:
67         /** determines whether our functionality is currently available
68             to be overridden for ePaste
69         */
70         virtual sal_Bool implIsEnabled( ) const;
71 	};
72 
73 	//====================================================================
74 	//= OPasteClipboardDispatcher
75 	//====================================================================
76     class OPasteClipboardDispatcher : public OClipboardDispatcher
77     {
78     private:
79         TransferableClipboardListener*  m_pClipListener;
80         sal_Bool                        m_bPastePossible;
81 
82     public:
83         OPasteClipboardDispatcher( EditView& _rView );
84 
85     protected:
86         ~OPasteClipboardDispatcher();
87 
88         // OClipboardDispatcher
89         virtual sal_Bool    implIsEnabled( ) const;
90 
91         // ORichTextFeatureDispatcher
92         virtual void    disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
93 
94     private:
95         DECL_LINK( OnClipboardChanged, TransferableDataHelper* );
96     };
97 
98 //........................................................................
99 } // namespace frm
100 //........................................................................
101 
102 #endif // FORMS_SOURCE_RICHTEXT_CLIPBOARDDISPATCHER_HXX
103 
104