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