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