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 _SCH_DGRDATA_HXX
29 #define _SCH_DGRDATA_HXX
30 
31 #include <svl/lstner.hxx>
32 #include <svtools/stdctrl.hxx>
33 #include <vcl/toolbox.hxx>
34 #include <comphelper/stl_types.hxx>
35 #include <vcl/dialog.hxx>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 
38 #include <memory>
39 
40 namespace com { namespace sun { namespace star {
41     namespace chart2 {
42         class XChartDocument;
43     }
44 }}}
45 
46 namespace chart
47 {
48 
49 class DataBrowser;
50 
51 class DataEditor : public ModalDialog
52 {
53 public:
54     DataEditor( Window* pParent,
55                 const ::com::sun::star::uno::Reference<
56                     ::com::sun::star::chart2::XChartDocument > & xChartDoc,
57                 const ::com::sun::star::uno::Reference<
58                     ::com::sun::star::uno::XComponentContext > & xContext );
59     virtual ~DataEditor();
60 
61     // Window
62     virtual void Resize();
63 
64     // Dialog
65 	virtual sal_Bool Close();
66 
67     void SetReadOnly( bool bReadOnly );
68     bool ApplyChangesToModel();
69 
70 private:
71     bool                            m_bReadOnly;
72     ::std::auto_ptr< DataBrowser >  m_apBrwData;
73     ToolBox                         m_aTbxData;
74     ::com::sun::star::uno::Reference<
75             ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
76     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
77         m_xContext;
78     ImageList       m_aToolboxImageList;
79     ImageList       m_aToolboxImageListHighContrast;
80 
81     /// handles actions of the toolbox
82     DECL_LINK( ToolboxHdl, void* );
83     /// is called, if the cursor of the table has moved
84     DECL_LINK( BrowserCursorMovedHdl, void*);
85     /// this is called if MiscOptions change, esp. High-Contrast mode
86     DECL_LINK( MiscHdl, void* );
87     /// is called when the contents of the edit cell changes
88     DECL_LINK( CellModified, void* );
89     /// is called when the width of any column in the edit browsebox has changed
90     DECL_LINK( BrowserColumnResized, void* );
91     /// is called when the browser view was scrolled, @todo: only call on horizontal scroll
92     DECL_LINK( BrowserContentScrolled, void* );
93 
94     void UpdateData();
95     void ApplyImageList();
96     /// moved and resizes the series name control etc. to fit the dimensions of the edit browsebox
97 //     void ImplAdjustHeaderControls( bool bRefreshFromModel );
98 
99     /** notifySystemWindow adds or remove the given window pToRegister at the Systemwindow found when search pWindow.
100         @param  pWindow
101             The window which is used to search for the SystemWindow.
102         @param  pToRegister
103             The window which should be added or removed on the TaskPaneList.
104         @param  rMemFunc
105             The member function which should be called at the SystemWindow when found.
106             Possible values are:
107             ::comphelper::mem_fun(&TaskPaneList::AddWindow)
108             ::comphelper::mem_fun(&TaskPaneList::RemoveWindow)
109 
110         @note this code is taken from dbaccess/source/ui/inc/UITools.hxx
111     */
112     void notifySystemWindow( Window* pWindow,
113                              Window* pToRegister,
114                              ::comphelper::mem_fun1_t< TaskPaneList, Window* > rMemFunc );
115 
116     void AdaptBrowseBoxSize();
117 };
118 
119 } // namespace chart
120 
121 #endif	// _SCH_DGRDATA_HXX
122