LibreOffice Module chart2 (master) 1
DataBrowser.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
23#include <vcl/weld.hxx>
24
25#include <memory>
26#include <vector>
27
28namespace com::sun::star {
29 namespace awt {
30 class XWindow;
31 }
32 namespace chart2 {
33 class XChartDocument;
34 }
35}
36
37namespace com::sun::star::uno { class XComponentContext; }
38
39class OutputDevice;
40
41namespace chart
42{
43
44class DataBrowserModel;
45class NumberFormatterWrapper;
46class ChartModel;
47
48namespace impl
49{
50class SeriesHeader;
51class SeriesHeaderEdit;
52}
53
55{
56protected:
57 // EditBrowseBox overridables
58 virtual void PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId ) const override;
59 virtual bool SeekRow( sal_Int32 nRow ) override;
60 virtual bool IsTabAllowed( bool bForward ) const override;
61 virtual ::svt::CellController* GetController( sal_Int32 nRow, sal_uInt16 nCol ) override;
62 virtual void InitController( ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol ) override;
63 virtual bool SaveModified() override;
64 virtual void CursorMoved() override;
65 // called whenever the control of the current cell has been modified
66 virtual void CellModified() override;
67 virtual void ColumnResized( sal_uInt16 nColId ) override;
68 virtual void EndScroll() override;
69 virtual void MouseButtonDown( const BrowserMouseEvent& rEvt ) override;
70
71public:
72 DataBrowser(const css::uno::Reference<css::awt::XWindow> &rParent,
73 weld::Container* pColumns, weld::Container* pColors);
74
75 virtual ~DataBrowser() override;
76 virtual void dispose() override;
77
86 virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override;
87
91 double GetCellNumber( sal_Int32 nRow, sal_uInt16 nColumnId ) const;
92
93 bool isDateTimeString( const OUString& aInputString, double& fOutDateTimeValue );
94
95 // Window
96 virtual void Resize() override;
97
98 void SetReadOnly( bool bNewState );
99 bool IsReadOnly() const { return m_bIsReadOnly;}
100
102
103 // predicates to determine what actions are possible at the current cursor
104 // position. This depends on the implementation of the according mutators
105 // below. (They are used for enabling toolbar icons)
106 bool MayInsertRow() const;
107 bool MayInsertColumn() const;
108 bool MayDeleteRow() const;
109 bool MayDeleteColumn() const;
110
111 bool MayMoveUpRows() const;
112 bool MayMoveDownRows() const;
113 bool MayMoveRightColumns() const;
114 bool MayMoveLeftColumns() const;
115
116 // mutators mutating data
117 void InsertRow();
118 void InsertColumn();
119 void InsertTextColumn();
120 void RemoveRow();
121 void RemoveColumn();
122
125
126 void MoveUpRow();
127 void MoveDownRow();
128 void MoveLeftColumn();
129 void MoveRightColumn();
130
131 void SetCursorMovedHdl( const Link<DataBrowser*,void>& rLink );
132
134 bool EndEditing();
135
136 bool CellContainsNumbers( sal_uInt16 nCol ) const;
137
138 sal_uInt32 GetNumberFormatKey( sal_uInt16 nCol ) const;
139
140 bool IsEnableItem() const { return m_bDataValid;}
141 bool IsDataValid() const;
142 void ShowWarningBox();
143 bool ShowQueryBox();
144
145 void RenewSeriesHeaders();
146
147private:
149 std::unique_ptr< DataBrowserModel > m_apDataBrowserModel;
150
151 typedef std::vector< std::shared_ptr< impl::SeriesHeader > > tSeriesHeaderContainer;
153
154 std::shared_ptr< NumberFormatterWrapper > m_spNumberFormatterWrapper;
155
157 sal_Int32 m_nSeekRow;
160
165
170
172
173 void clearHeaders();
174 void RenewTable();
176
177 OUString GetColString( sal_Int32 nColumnId ) const;
178
179 DECL_LINK( SeriesHeaderGotFocus, impl::SeriesHeaderEdit&, void );
180 DECL_LINK( SeriesHeaderChanged, impl::SeriesHeaderEdit&, void );
181
182 DataBrowser( const DataBrowser & ) = delete;
183};
184
185} // namespace chart
186
187/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void MouseButtonDown(const MouseEvent &rEvt) override
void RemoveColumn(sal_uInt16 nColumnId)
weld::Container * m_pColorsWin
DECL_LINK(SeriesHeaderChanged, impl::SeriesHeaderEdit &, void)
virtual bool IsTabAllowed(bool bForward) const override
tSeriesHeaderContainer m_aSeriesHeaders
virtual ::svt::CellController * GetController(sal_Int32 nRow, sal_uInt16 nCol) override
::svt::CellControllerRef m_rTextEditController
note: m_aTextEditField must precede this member!
virtual bool SaveModified() override
virtual void CursorMoved() override
std::vector< std::shared_ptr< impl::SeriesHeader > > tSeriesHeaderContainer
bool MayMoveDownRows() const
DataBrowser(const css::uno::Reference< css::awt::XWindow > &rParent, weld::Container *pColumns, weld::Container *pColors)
double GetCellNumber(sal_Int32 nRow, sal_uInt16 nColumnId) const
returns the number in the given cell.
bool MayDeleteRow() const
bool IsDataValid() const
sal_uInt32 GetNumberFormatKey(sal_uInt16 nCol) const
virtual void ColumnResized(sal_uInt16 nColId) override
weld::Container * m_pColumnsWin
::svt::CellControllerRef m_rNumberEditController
note: m_aNumberEditField must precede this member!
OUString GetColString(sal_Int32 nColumnId) const
bool CellContainsNumbers(sal_uInt16 nCol) const
bool MayMoveUpRows() const
bool MayMoveRightColumns() const
void SetCursorMovedHdl(const Link< DataBrowser *, void > &rLink)
bool MayDeleteColumn() const
virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override
GetCellText returns the text at the given position.
virtual void PaintCell(OutputDevice &rDev, const tools::Rectangle &rRect, sal_uInt16 nColumnId) const override
void ImplAdjustHeaderControls()
virtual void Resize() override
virtual bool SeekRow(sal_Int32 nRow) override
bool isDateTimeString(const OUString &aInputString, double &fOutDateTimeValue)
virtual void EndScroll() override
bool IsReadOnly() const
Definition: DataBrowser.hxx:99
void SetReadOnly(bool bNewState)
DataBrowser(const DataBrowser &)=delete
virtual void MouseButtonDown(const BrowserMouseEvent &rEvt) override
bool IsEnableItem() const
sal_Int32 m_nSeekRow
the row that is currently painted
DECL_LINK(SeriesHeaderGotFocus, impl::SeriesHeaderEdit &, void)
Link< DataBrowser *, void > m_aCursorMovedHdlLink
virtual void InitController(::svt::CellControllerRef &rController, sal_Int32 nRow, sal_uInt16 nCol) override
std::shared_ptr< NumberFormatterWrapper > m_spNumberFormatterWrapper
virtual ~DataBrowser() override
std::unique_ptr< DataBrowserModel > m_apDataBrowserModel
bool MayMoveLeftColumns() const
VclPtr< svt::EditControl > m_aTextEditField
rtl::Reference<::chart::ChartModel > m_xChartDoc
virtual void dispose() override
bool EndEditing()
confirms all pending changes to be ready to be closed
void SetDataFromModel(const rtl::Reference<::chart::ChartModel > &xChartDoc)
virtual void CellModified() override
bool MayInsertColumn() const
bool MayInsertRow() const
VclPtr< svt::FormattedControl > m_aNumberEditField