LibreOffice Module sc (master)  1
datatableview.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 #ifndef INCLUDED_SC_SOURCE_UI_INC_DATATABLEVIEW_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_DATATABLEVIEW_HXX
22 
23 #include <com/sun/star/awt/XWindow.hpp>
24 #include <vcl/ctrl.hxx>
25 #include <vcl/scrbar.hxx>
26 #include <types.hxx>
27 #include "hdrcont.hxx"
28 
29 class ScDocument;
30 
32 {
35 
36 public:
37  ScDataTableColView(vcl::Window* pParent, SelectionEngine* pSelectionEngine);
38 
39  void SetPos(SCCOLROW nRow);
40  void Init(ScDocument* pDoc);
41 
42  virtual SCCOLROW GetPos() const override;
43  virtual sal_uInt16 GetEntrySize(SCCOLROW nPos) const override;
44  virtual OUString GetEntryText(SCCOLROW nPos) const override;
45  virtual bool IsLayoutRTL() const override;
46  virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nWidth) override;
47  virtual void HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) override;
48 };
49 
51 {
54 
55 public:
56  ScDataTableRowView(vcl::Window* pParent, SelectionEngine* pSelectionEngine);
57 
58  void SetPos(SCCOLROW nRow);
59  void Init(ScDocument* pDoc);
60 
61  virtual SCCOLROW GetPos() const override;
62  virtual sal_uInt16 GetEntrySize(SCCOLROW nPos) const override;
63  virtual OUString GetEntryText(SCCOLROW nPos) const override;
64  virtual bool IsLayoutRTL() const override;
65  virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nWidth) override;
66  virtual void HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) override;
67 };
68 
69 /*
70  * A simple UI component that presents a data table.
71  *
72  * Shares as much code as possible with the normal
73  * Calc grid rendering.
74  *
75  * This class should only depend on ScDocument and not
76  * on some of the Calc view shells.
77  */
78 class ScDataTableView : public Control
79 {
80  std::shared_ptr<ScDocument> mpDoc;
81  std::unique_ptr<SelectionEngine> mpSelectionEngine;
87 
90 
91  std::unique_ptr<MouseEvent> mpMouseEvent;
92 
93  DECL_LINK(ScrollHdl, ScrollBar*, void);
94 
95 public:
96  ScDataTableView(const css::uno::Reference<css::awt::XWindow>& rParent);
97 
98  void Init(std::shared_ptr<ScDocument> pDoc);
99 
100  ~ScDataTableView() override;
101 
102  virtual void dispose() override;
103 
104  virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
105  virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
106  virtual void Resize() override;
107  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
108  virtual Size GetOptimalSize() const override;
109 
110  void getColRange(SCCOL& rStartCol, SCCOL& rEndCol) const;
111  void getRowRange(SCROW& rStartRow, SCROW& rEndRow) const;
112 };
113 
114 #endif
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool IsLayoutRTL() const override
void Init(std::shared_ptr< ScDocument > pDoc)
tools::Long nWidth
Definition: hdrcont.hxx:44
void Init(ScDocument *pDoc)
virtual void HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) override
VclPtr< ScrollBar > mpHScroll
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
VclPtr< ScDataTableRowView > mpRowView
void getColRange(SCCOL &rStartCol, SCCOL &rEndCol) const
virtual sal_uInt16 GetEntrySize(SCCOLROW nPos) const override
DECL_LINK(ScrollHdl, ScrollBar *, void)
std::unique_ptr< SelectionEngine > mpSelectionEngine
virtual void dispose() override
virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nWidth) override
ScDataTableRowView(vcl::Window *pParent, SelectionEngine *pSelectionEngine)
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:24
VclPtr< ScrollBar > mpVScroll
virtual void Resize() override
std::unique_ptr< MouseEvent > mpMouseEvent
~ScDataTableView() override
sal_Int16 SCCOL
Definition: types.hxx:22
std::shared_ptr< ScDocument > mpDoc
VclPtr< ScrollBarBox > mpTopLeft
void SetPos(SCCOLROW nRow)
virtual sal_uInt16 GetEntrySize(SCCOLROW nPos) const override
void Init(ScDocument *pDoc)
virtual OUString GetEntryText(SCCOLROW nPos) const override
void SetPos(SCCOLROW nRow)
virtual SCCOLROW GetPos() const override
ScDocument * mpDoc
sal_Int32 SCROW
Definition: types.hxx:18
virtual bool IsLayoutRTL() const override
virtual void HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) override
ScDataTableColView(vcl::Window *pParent, SelectionEngine *pSelectionEngine)
VclPtr< ScDataTableColView > mpColView
ScDocument * mpDoc
ScDataTableView(const css::uno::Reference< css::awt::XWindow > &rParent)
virtual OUString GetEntryText(SCCOLROW nPos) const override
virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nWidth) override
virtual SCCOLROW GetPos() const override
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
virtual Size GetOptimalSize() const override
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
void getRowRange(SCROW &rStartRow, SCROW &rEndRow) const