fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / dialogs / DataBrowser.hxx
blob69386a2908fbcb909d26b1330f3ac4aa6242d712
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
21 #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
23 #include <svtools/editbrowsebox.hxx>
24 #include <vcl/outdev.hxx>
25 #include <svtools/fmtfield.hxx>
26 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <vector>
29 #include <boost/shared_ptr.hpp>
30 #include <boost/scoped_ptr.hpp>
32 namespace com { namespace sun { namespace star {
33 namespace chart2 {
34 class XChartDocument;
36 }}}
38 namespace chart
41 class DataBrowserModel;
42 class NumberFormatterWrapper;
44 namespace impl
46 class SeriesHeader;
47 class SeriesHeaderEdit;
50 class DataBrowser : public ::svt::EditBrowseBox
52 protected:
53 // EditBrowseBox overridables
54 virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const SAL_OVERRIDE;
55 virtual bool SeekRow( long nRow ) SAL_OVERRIDE;
56 virtual bool IsTabAllowed( bool bForward ) const SAL_OVERRIDE;
57 virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ) SAL_OVERRIDE;
58 virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ) SAL_OVERRIDE;
59 virtual bool SaveModified() SAL_OVERRIDE;
60 virtual void CursorMoved() SAL_OVERRIDE;
61 // called whenever the control of the current cell has been modified
62 virtual void CellModified() SAL_OVERRIDE;
63 virtual void ColumnResized( sal_uInt16 nColId ) SAL_OVERRIDE;
64 virtual void EndScroll() SAL_OVERRIDE;
65 virtual void MouseButtonDown( const BrowserMouseEvent& rEvt ) SAL_OVERRIDE;
67 void SetDirty();
69 public:
70 DataBrowser( vcl::Window* pParent, WinBits nStyle, bool bLiveUpdate );
71 virtual ~DataBrowser();
72 virtual void dispose() SAL_OVERRIDE;
74 /** GetCellText returns the text at the given position
75 @param nRow
76 the number of the row
77 @param nColId
78 the ID of the column
79 @return
80 the text out of the cell
82 virtual OUString GetCellText(long nRow, sal_uInt16 nColId) const SAL_OVERRIDE;
84 /** returns the number in the given cell. If a cell is empty or contains a
85 string, the result will be Nan
87 double GetCellNumber( long nRow, sal_uInt16 nColumnId ) const;
89 bool isDateTimeString( const OUString& aInputString, double& fOutDateTimeValue );
91 // Window
92 virtual void Resize() SAL_OVERRIDE;
94 /// @return old state
95 bool SetReadOnly( bool bNewState );
96 bool IsReadOnly() const { return m_bIsReadOnly;}
98 /// reset the dirty status, if changes have been saved
99 void SetClean();
101 void SetDataFromModel( const ::com::sun::star::uno::Reference<
102 ::com::sun::star::chart2::XChartDocument > & xChartDoc,
103 const ::com::sun::star::uno::Reference<
104 ::com::sun::star::uno::XComponentContext > & xContext );
106 // predicates to determine what actions are possible at the current cursor
107 // position. This depends on the implementation of the according mutators
108 // below. (They are used for enabling toolbar icons)
109 bool MayInsertRow() const;
110 bool MayInsertColumn() const;
111 bool MayDeleteRow() const;
112 bool MayDeleteColumn() const;
114 bool MaySwapRows() const;
115 bool MaySwapColumns() const;
117 // mutators mutating data
118 void InsertRow();
119 void InsertColumn();
120 void InsertTextColumn();
121 void RemoveRow();
122 void RemoveColumn();
124 using BrowseBox::RemoveColumn;
125 using BrowseBox::MouseButtonDown;
127 void SwapRow();
128 void SwapColumn();
130 void SetCursorMovedHdl( const Link<>& rLink );
132 void SetCellModifiedHdl( const Link<>& rLink );
134 /// confirms all pending changes to be ready to be closed
135 bool EndEditing();
137 // calls the protected inline-function BrowseBox::GetFirstVisibleColNumber()
138 sal_Int16 GetFirstVisibleColumNumber() const;
140 bool CellContainsNumbers( sal_Int32 nRow, sal_uInt16 nCol ) const;
142 sal_uInt32 GetNumberFormatKey( sal_Int32 nRow, sal_uInt16 nCol ) const;
144 bool IsEnableItem() { return m_bDataValid;}
145 bool IsDataValid();
146 void ShowWarningBox();
147 bool ShowQueryBox();
149 void RenewSeriesHeaders();
151 private:
152 ::com::sun::star::uno::Reference<
153 ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
154 boost::scoped_ptr< DataBrowserModel > m_apDataBrowserModel;
156 typedef ::std::vector< ::boost::shared_ptr< impl::SeriesHeader > > tSeriesHeaderContainer;
157 tSeriesHeaderContainer m_aSeriesHeaders;
159 ::boost::shared_ptr< NumberFormatterWrapper > m_spNumberFormatterWrapper;
161 /// the row that is currently painted
162 long m_nSeekRow;
163 bool m_bIsReadOnly;
164 bool m_bIsDirty;
165 bool m_bLiveUpdate;
166 bool m_bDataValid;
168 VclPtr<FormattedField> m_aNumberEditField;
169 VclPtr<Edit> m_aTextEditField;
171 /// note: m_aNumberEditField must precede this member!
172 ::svt::CellControllerRef m_rNumberEditController;
173 /// note: m_aTextEditField must precede this member!
174 ::svt::CellControllerRef m_rTextEditController;
176 Link<> m_aCursorMovedHdlLink;
177 Link<> m_aCellModifiedLink;
179 void clearHeaders();
180 void RenewTable();
181 void ImplAdjustHeaderControls();
183 OUString GetColString( sal_Int32 nColumnId ) const;
184 static OUString GetRowString( sal_Int32 nRow );
186 DECL_LINK( SeriesHeaderGotFocus, impl::SeriesHeaderEdit* );
187 DECL_LINK( SeriesHeaderChanged, impl::SeriesHeaderEdit* );
189 DataBrowser( const DataBrowser & ) SAL_DELETED_FUNCTION;
192 } // namespace chart
194 #endif // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */