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_TABLE_CELLEDITSOURCE_HXX
29 #define SVX_TABLE_CELLEDITSOURCE_HXX
30 
31 #include "cell.hxx"
32 #include "celltypes.hxx"
33 #include "editeng/unoedsrc.hxx"
34 
35 class SvxTextForwarder;
36 class SdrObject;
37 class SdrModel;
38 class SdrView;
39 class Window;
40 
41 namespace sdr { namespace table {
42 
43 class CellEditSourceImpl;
44 
45 class CellEditSource : public SvxEditSource, public SvxViewForwarder
46 {
47 public:
48 	CellEditSource( const CellRef& xCell );
49 
50     /** Since the views don't broadcast their dying, make sure that
51         this object gets destroyed if the view becomes invalid
52 
53         The window is necessary, since our views can display on multiple windows
54      */
55 	CellEditSource( const CellRef& xCell, SdrView& rView, const Window& rViewWindow );
56 	virtual ~CellEditSource();
57 
58 	virtual SvxEditSource*			Clone() const;
59 	virtual SvxTextForwarder*		GetTextForwarder();
60  	virtual SvxViewForwarder*		GetViewForwarder();
61  	virtual SvxEditViewForwarder*	GetEditViewForwarder( sal_Bool bCreate = sal_False );
62 	virtual void					UpdateData();
63 
64 	virtual void addRange( SvxUnoTextRangeBase* pNewRange );
65 	virtual void removeRange( SvxUnoTextRangeBase* pOldRange );
66 	virtual const SvxUnoTextRangeBaseList& getRanges() const;
67 
68     virtual SfxBroadcaster&			GetBroadcaster() const;
69 
70 	void lock();
71 	void unlock();
72 
73     // the SvxViewForwarder interface
74 	virtual sal_Bool		IsValid() const;
75     virtual Rectangle	GetVisArea() const;
76     virtual Point		LogicToPixel( const Point&, const MapMode& ) const;
77     virtual Point		PixelToLogic( const Point&, const MapMode& ) const;
78 
79 	void ChangeModel( SdrModel* pNewModel );
80 
81 private:
82 	CellEditSource( CellEditSourceImpl* pImpl );
83 
84 	CellEditSourceImpl*	mpImpl;
85 };
86 
87 } }
88 
89 #endif
90