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_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>
30 class BrowserMouseEvent
;
32 class SdrItemBrowserControl
: public BrowseBox
34 friend class ImpItemEdit
;
35 std::vector
<ImpItemListRow
*> aList
;
37 VclPtr
<Edit
> pEditControl
;
39 Link
<SdrItemBrowserControl
&,void> aEntryChangedHdl
;
40 Link
<SdrItemBrowserControl
&,void> aSetDirtyHdl
;
41 ImpItemListRow
* pAktChangeEntry
;
43 sal_uInt16 nLastWhich
;
44 sal_uInt16 nLastWhichOben
;
45 sal_uInt16 nLastWhichUnten
;
46 bool bWhichesButNames
;
47 bool bDontHideIneffectiveItems
;
54 void ImpSetEntry(const ImpItemListRow
& rEntry
, std::size_t nEntryNum
);
55 ImpItemListRow
* ImpGetEntry(std::size_t nPos
) const { return aList
[nPos
]; }
57 void ImpRestoreWhich();
58 std::size_t GetCurrentPos() const;
59 bool BeginChangeEntry(std::size_t nPos
);
62 virtual long GetRowCount() const override
;
63 virtual bool SeekRow(long nRow
) override
;
64 virtual void PaintField(OutputDevice
& rDev
, const tools::Rectangle
& rRect
, sal_uInt16 nColumnId
) const override
;
65 virtual void DoubleClick(const BrowserMouseEvent
&) override
;
66 virtual void KeyInput(const KeyEvent
& rEvt
) override
;
67 virtual void Select() override
;
68 void SetDirty(); // is called for example in mode switches
69 virtual tools::Rectangle
GetFieldCharacterBounds(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,sal_Int32 nIndex
) override
;
70 virtual sal_Int32
GetFieldIndexAtPoint(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,const Point
& _rPoint
) override
;
72 SdrItemBrowserControl(vcl::Window
* pParent
);
73 virtual ~SdrItemBrowserControl() override
;
74 virtual void dispose() override
;
76 void SetAttributes(const SfxItemSet
* pAttr
, const SfxItemSet
* p2ndSet
);
77 sal_uInt16
GetCurrentWhich() const;
78 void EndChangeEntry();
79 void BreakChangeEntry();
81 /** GetCellText returns the text at the given position
87 the text out of the cell
89 virtual OUString
GetCellText(long _nRow
, sal_uInt16 _nColId
) const override
;
91 const ImpItemListRow
* GetAktChangeEntry() const { return pAktChangeEntry
; }
92 OUString
GetNewEntryValue() const { return pEditControl
->GetText(); }
93 void SetEntryChangedHdl(const Link
<SdrItemBrowserControl
&,void>& rLink
) { aEntryChangedHdl
=rLink
; }
94 void SetSetDirtyHdl(const Link
<SdrItemBrowserControl
&,void>& rLink
) { aSetDirtyHdl
=rLink
; }
99 class SdrItemBrowser
: public FloatingWindow
{
100 VclPtr
<SdrItemBrowserControl
> aBrowse
;
104 static vcl::Window
* ImpGetViewWin(SdrView
& rView
);
105 DECL_LINK(IdleHdl
, Timer
*, void);
106 DECL_LINK(ChangedHdl
, SdrItemBrowserControl
&, void);
107 DECL_LINK(SetDirtyHdl
, SdrItemBrowserControl
&, void);
109 SdrItemBrowser(SdrView
& rView
);
110 virtual ~SdrItemBrowser() override
;
114 virtual void dispose() override
;
115 virtual void Resize() override
;
116 virtual void GetFocus() override
;
117 void SetAttributes(const SfxItemSet
* pAttr
, const SfxItemSet
* p2ndSet
) { aBrowse
->SetAttributes(pAttr
,p2ndSet
); }
118 SdrItemBrowserControl
*GetBrowserControl() { return aBrowse
.get(); }
121 #endif // INCLUDED_SVX_INC_SVDIBROW_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */