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