Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / svx / inc / svdibrow.hxx
blobdefb0e260df1b025fad2360c131047fa6780d8d9
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 #ifndef INCLUDED_SVX_INC_SVDIBROW_HXX
21 #define INCLUDED_SVX_INC_SVDIBROW_HXX
23 #include <svtools/brwbox.hxx>
24 #include <vcl/edit.hxx>
25 #include <vcl/floatwin.hxx>
26 #include <vcl/idle.hxx>
27 #include <memory>
29 class SfxItemSet;
30 class ImpItemListRow;
31 class BrowserMouseEvent;
33 class SdrItemBrowserControl final : public BrowseBox
35 friend class ImpItemEdit;
36 std::vector<std::unique_ptr<ImpItemListRow>> aList;
37 long nCurrentPaintRow;
38 VclPtr<Edit> pEditControl;
39 OUString aWNameMemorized;
40 Link<SdrItemBrowserControl&,void> aEntryChangedHdl;
41 Link<SdrItemBrowserControl&,void> aSetDirtyHdl;
42 std::unique_ptr<ImpItemListRow> pCurrentChangeEntry;
43 long nLastWhichOfs;
44 sal_uInt16 nLastWhich;
45 bool bWhichesButNames;
46 bool bDontHideIneffectiveItems;
47 bool bDontSortItems;
49 void ImpCtor();
50 void ImpSetEntry(const ImpItemListRow& rEntry, std::size_t nEntryNum);
51 void ImpSaveWhich();
52 void ImpRestoreWhich();
53 std::size_t GetCurrentPos() const;
54 bool BeginChangeEntry(std::size_t nPos);
56 virtual long GetRowCount() const override;
57 virtual bool SeekRow(long nRow) override;
58 virtual void PaintField(vcl::RenderContext& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId) const override;
59 virtual void DoubleClick(const BrowserMouseEvent&) override;
60 virtual void KeyInput(const KeyEvent& rEvt) override;
61 virtual void Select() override;
62 void SetDirty(); // is called for example in mode switches
63 virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
64 virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
66 public:
67 SdrItemBrowserControl(vcl::Window* pParent);
68 virtual ~SdrItemBrowserControl() override;
69 virtual void dispose() override;
70 void Clear();
71 void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet);
72 sal_uInt16 GetCurrentWhich() const;
73 void EndChangeEntry();
74 void BreakChangeEntry();
76 /** GetCellText returns the text at the given position
77 @param _nRow
78 the number of the row
79 @param _nColId
80 the ID of the column
81 @return
82 the text out of the cell
84 virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const override;
86 const ImpItemListRow* GetCurrentChangeEntry() const { return pCurrentChangeEntry.get(); }
87 OUString GetNewEntryValue() const { return pEditControl->GetText(); }
88 void SetEntryChangedHdl(const Link<SdrItemBrowserControl&,void>& rLink) { aEntryChangedHdl=rLink; }
89 void SetSetDirtyHdl(const Link<SdrItemBrowserControl&,void>& rLink) { aSetDirtyHdl=rLink; }
92 class SdrView;
94 class SdrItemBrowser: public FloatingWindow {
95 VclPtr<SdrItemBrowserControl> aBrowse;
96 Idle aIdle;
97 SdrView* pView;
98 bool bDirty;
99 static vcl::Window* ImpGetViewWin(SdrView const & rView);
100 DECL_LINK(IdleHdl, Timer *, void);
101 DECL_LINK(ChangedHdl, SdrItemBrowserControl&, void);
102 DECL_LINK(SetDirtyHdl, SdrItemBrowserControl&, void);
103 public:
104 SdrItemBrowser(SdrView& rView);
105 virtual ~SdrItemBrowser() override;
106 void ForceParent();
107 void SetDirty();
108 void Undirty();
109 virtual void dispose() override;
110 virtual void Resize() override;
111 virtual void GetFocus() override;
112 void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet) { aBrowse->SetAttributes(pAttr,p2ndSet); }
113 SdrItemBrowserControl *GetBrowserControl() { return aBrowse.get(); }
116 #endif // INCLUDED_SVX_INC_SVDIBROW_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */