1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SC_SOURCE_UI_INC_DATATABLEVIEW_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_DATATABLEVIEW_HXX
23 #include <com/sun/star/awt/XWindow.hpp>
24 #include <vcl/ctrl.hxx>
25 #include <vcl/scrbar.hxx>
28 #include "hdrcont.hxx"
32 class ScDataTableColView
: public ScHeaderControl
39 ScDataTableColView(vcl::Window
* pParent
, SelectionEngine
* pSelectionEngine
);
41 void SetPos(SCCOLROW nRow
);
42 void Init(ScDocument
* pDoc
);
44 virtual SCCOLROW
GetPos() const override
;
45 virtual sal_uInt16
GetEntrySize(SCCOLROW nPos
) const override
;
46 virtual OUString
GetEntryText(SCCOLROW nPos
) const override
;
47 virtual bool IsLayoutRTL() const override
;
48 virtual void SetEntrySize(SCCOLROW nPos
, sal_uInt16 nWidth
) override
;
49 virtual void HideEntries(SCCOLROW nPos
, SCCOLROW nEndPos
) override
;
52 class ScDataTableRowView
: public ScHeaderControl
59 ScDataTableRowView(vcl::Window
* pParent
, SelectionEngine
* pSelectionEngine
);
61 void SetPos(SCCOLROW nRow
);
62 void Init(ScDocument
* pDoc
);
64 virtual SCCOLROW
GetPos() const override
;
65 virtual sal_uInt16
GetEntrySize(SCCOLROW nPos
) const override
;
66 virtual OUString
GetEntryText(SCCOLROW nPos
) const override
;
67 virtual bool IsLayoutRTL() const override
;
68 virtual void SetEntrySize(SCCOLROW nPos
, sal_uInt16 nWidth
) override
;
69 virtual void HideEntries(SCCOLROW nPos
, SCCOLROW nEndPos
) override
;
73 * A simple UI component that presents a data table.
75 * Shares as much code as possible with the normal
76 * Calc grid rendering.
78 * This class should only depend on ScDocument and not
79 * on some of the Calc view shells.
81 class ScDataTableView
: public Control
83 std::shared_ptr
<ScDocument
> mpDoc
;
84 std::unique_ptr
<SelectionEngine
> mpSelectionEngine
;
85 VclPtr
<ScrollBarBox
> mpTopLeft
;
86 VclPtr
<ScDataTableColView
> mpColView
;
87 VclPtr
<ScDataTableRowView
> mpRowView
;
88 VclPtr
<ScrollBar
> mpVScroll
;
89 VclPtr
<ScrollBar
> mpHScroll
;
91 SCROW mnFirstVisibleRow
;
92 SCCOL mnFirstVisibleCol
;
94 std::unique_ptr
<MouseEvent
> mpMouseEvent
;
96 DECL_LINK( ScrollHdl
, ScrollBar
*, void );
99 ScDataTableView(const css::uno::Reference
<css::awt::XWindow
> &rParent
);
101 void Init(std::shared_ptr
<ScDocument
> pDoc
);
103 ~ScDataTableView() override
;
105 virtual void dispose() override
;
107 virtual void MouseButtonDown(const MouseEvent
& rMEvt
) override
;
108 virtual void MouseButtonUp(const MouseEvent
& rMEvt
) override
;
109 virtual void Resize() override
;
110 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
111 virtual Size
GetOptimalSize() const override
;
113 void getColRange(SCCOL
& rStartCol
, SCCOL
& rEndCol
) const;
114 void getRowRange(SCROW
& rStartRow
, SCROW
& rEndRow
) const;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */