tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / datatableview.hxx
blob2635c7952a9ee0cfd7c7d26907037b18b5851e2b
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 #pragma once
22 #include <com/sun/star/awt/XWindow.hpp>
23 #include <svtools/scrolladaptor.hxx>
24 #include <vcl/ctrl.hxx>
25 #include <types.hxx>
26 #include "hdrcont.hxx"
28 class ScDocument;
30 class ScDataTableColView : public ScHeaderControl
32 ScDocument* mpDoc;
33 SCCOL mnCol;
35 public:
36 ScDataTableColView(vcl::Window* pParent, ScDocument* pDoc, SelectionEngine* pSelectionEngine);
38 void SetPos(SCCOLROW nRow);
40 virtual SCCOLROW GetPos() const override;
41 virtual sal_uInt16 GetEntrySize(SCCOLROW nPos) const override;
42 virtual OUString GetEntryText(SCCOLROW nPos) const override;
43 virtual bool IsLayoutRTL() const override;
44 virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nWidth) override;
45 virtual void HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) override;
48 class ScDataTableRowView : public ScHeaderControl
50 ScDocument* mpDoc;
51 SCROW mnRow;
53 public:
54 ScDataTableRowView(vcl::Window* pParent, ScDocument* pDoc, SelectionEngine* pSelectionEngine);
56 void SetPos(SCCOLROW nRow);
58 virtual SCCOLROW GetPos() const override;
59 virtual sal_uInt16 GetEntrySize(SCCOLROW nPos) const override;
60 virtual OUString GetEntryText(SCCOLROW nPos) const override;
61 virtual bool IsLayoutRTL() const override;
62 virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nWidth) override;
63 virtual void HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) override;
67 * A simple UI component that presents a data table.
69 * Shares as much code as possible with the normal
70 * Calc grid rendering.
72 * This class should only depend on ScDocument and not
73 * on some of the Calc view shells.
75 class ScDataTableView : public Control
77 std::shared_ptr<ScDocument> mpDoc;
78 std::unique_ptr<SelectionEngine> mpSelectionEngine;
79 VclPtr<ScDataTableColView> mpColView;
80 VclPtr<ScDataTableRowView> mpRowView;
81 VclPtr<ScrollAdaptor> mpVScroll;
82 VclPtr<ScrollAdaptor> mpHScroll;
84 sal_uInt16 mnScrollBarSize;
86 SCROW mnFirstVisibleRow;
87 SCCOL mnFirstVisibleCol;
89 std::unique_ptr<MouseEvent> mpMouseEvent;
91 DECL_LINK(VertScrollHdl, weld::Scrollbar&, void);
92 DECL_LINK(HorzScrollHdl, weld::Scrollbar&, void);
94 public:
95 ScDataTableView(const css::uno::Reference<css::awt::XWindow>& rParent,
96 std::shared_ptr<ScDocument> pDoc);
97 ~ScDataTableView() override;
99 virtual void dispose() override;
101 virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
102 virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
103 virtual void Resize() override;
104 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
105 virtual Size GetOptimalSize() const override;
107 void getColRange(SCCOL& rStartCol, SCCOL& rEndCol) const;
108 void getRowRange(SCROW& rStartRow, SCROW& rEndRow) const;
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */