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 _SVX_ACCESSIBLEEMPTYEDITSOURCE_HXX
25 #define _SVX_ACCESSIBLEEMPTYEDITSOURCE_HXX
26 
27 #include <svl/brdcst.hxx>
28 #include <svl/lstner.hxx>
29 
30 #include <memory>
31 #include <editeng/unoedsrc.hxx>
32 
33 class SdrObject;
34 class SdrView;
35 class Window;
36 
37 namespace accessibility
38 {
39     /** Proxy edit source for shapes without text
40 
41     	Extracted from old SvxDummyEditSource
42      */
43     class AccessibleEmptyEditSource : public SvxEditSource, public SfxListener, public SfxBroadcaster
44     {
45     public:
46         /** Create proxy edit source for shapes without text
47 
48         	Since the views don't broadcast their dying, make sure that
49             this object gets destroyed if the view becomes invalid
50 
51             The window is necessary, since our views can display on multiple windows
52 
53             Make sure you only create such an object if the shape _really_
54             does not contain text.
55         */
56         AccessibleEmptyEditSource(	SdrObject& rObj, SdrView& rView, const Window& rViewWindow );
57         ~AccessibleEmptyEditSource();
58 
59         // from the SvxEditSource interface
60         SvxTextForwarder*		GetTextForwarder();
61         SvxViewForwarder*		GetViewForwarder();
62 
63         SvxEditSource*			Clone() const;
64 
65         // this method internally switches from empty to proxy mode,
66         // creating an SvxTextEditSource for the functionality.
67         SvxEditViewForwarder*	GetEditViewForwarder( sal_Bool bCreate = sal_False );
68 
69         void					UpdateData();
70         SfxBroadcaster&			GetBroadcaster() const;
71 
72         // from the SfxListener interface
73         void					Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
74 
75     private:
76         void Switch2ProxyEditSource();
77 
78         /** Pointer to edit source implementation. This is switched on
79             a GetEditViewForwarder( true ) call, to actually create a
80             SvxTextEditSource.
81 
82             @dyn
83          */
84         std::auto_ptr< SvxEditSource > 	mpEditSource;
85 
86         SdrObject& 						mrObj;
87         SdrView& 						mrView;
88         const Window& 					mrViewWindow;
89 
90         bool							mbEditSourceEmpty;
91     };
92 
93 } // namespace accessibility
94 
95 #endif
96 
97