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 .
23 #include <svtools/brwbox.hxx>
24 #include <vcl/edit.hxx>
25 #include <vcl/floatwin.hxx>
29 class BrowserMouseEvent
;
31 class _SdrItemBrowserControl
: public BrowseBox
33 friend class ImpItemEdit
;
34 std::vector
<ImpItemListRow
*> aList
;
38 Link aEntryChangedHdl
;
40 ImpItemListRow
* pAktChangeEntry
;
42 sal_uInt16 nLastWhich
;
43 sal_uInt16 nLastWhichOben
;
44 sal_uInt16 nLastWhichUnten
;
45 bool bWhichesButNames
;
46 bool bDontHideIneffectiveItems
;
53 void ImpSetEntry(const ImpItemListRow
& rEntry
, sal_uIntPtr nEntryNum
);
54 ImpItemListRow
* ImpGetEntry(sal_uIntPtr nPos
) const { return aList
[nPos
]; }
56 void ImpRestoreWhich();
59 virtual long GetRowCount() const;
60 virtual sal_Bool
SeekRow(long nRow
);
61 virtual void PaintField(OutputDevice
& rDev
, const Rectangle
& rRect
, sal_uInt16 nColumnId
) const;
62 virtual void DoubleClick(const BrowserMouseEvent
&);
63 virtual void KeyInput(const KeyEvent
& rEvt
);
64 virtual void Select();
65 virtual void SetDirty(); // is called for example in mode switches
66 virtual Rectangle
GetFieldCharacterBounds(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,sal_Int32 nIndex
);
67 virtual sal_Int32
GetFieldIndexAtPoint(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,const Point
& _rPoint
);
69 _SdrItemBrowserControl(Window
* pParent
, WinBits nBits
=WB_3DLOOK
|WB_BORDER
|WB_TABSTOP
);
70 virtual ~_SdrItemBrowserControl();
72 void SetAttributes(const SfxItemSet
* pAttr
, const SfxItemSet
* p2ndSet
=NULL
);
73 sal_uIntPtr
GetCurrentPos() const;
74 sal_uInt16
GetCurrentWhich() const;
75 virtual bool BegChangeEntry(sal_uIntPtr nPos
);
76 virtual bool EndChangeEntry();
77 virtual void BrkChangeEntry();
79 /** GetCellText returns the text at the given position
85 the text out of the cell
87 virtual String
GetCellText(long _nRow
, sal_uInt16 _nColId
) const;
89 const ImpItemListRow
* GetAktChangeEntry() const { return pAktChangeEntry
; }
90 XubString
GetNewEntryValue() const { return pEditControl
->GetText(); }
91 void SetEntryChangedHdl(const Link
& rLink
) { aEntryChangedHdl
=rLink
; }
92 const Link
& GetEntryChangedHdl() const { return aEntryChangedHdl
; }
93 void SetSetDirtyHdl(const Link
& rLink
) { aSetDirtyHdl
=rLink
; }
94 const Link
& GetSetDirtyHdl() const { return aSetDirtyHdl
; }
97 #define WB_STDSIZEABLEDOCKWIN (WB_STDDOCKWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
98 #define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
100 class _SdrItemBrowserWindow
: public FloatingWindow
{
101 _SdrItemBrowserControl aBrowse
;
103 _SdrItemBrowserWindow(Window
* pParent
, WinBits nBits
=WB_STDSIZEABLEDOCKWIN
);
104 virtual ~_SdrItemBrowserWindow();
105 virtual void Resize();
106 virtual void GetFocus();
107 void Clear() { aBrowse
.Clear(); }
108 void SetAttributes(const SfxItemSet
* pAttr
, const SfxItemSet
* p2ndSet
=NULL
) { aBrowse
.SetAttributes(pAttr
,p2ndSet
); }
109 void SetFloatingMode(bool /*bOn*/) {}
110 const _SdrItemBrowserControl
& GetBrowserControl() const { return aBrowse
; }
111 _SdrItemBrowserControl
& GetBrowserControl() { return aBrowse
; }
116 class SdrItemBrowser
: public _SdrItemBrowserWindow
{
121 static Window
* ImpGetViewWin(SdrView
& rView
);
122 DECL_LINK(IdleHdl
, void *);
123 DECL_LINK(ChangedHdl
,_SdrItemBrowserControl
*);
124 DECL_LINK(SetDirtyHdl
, void *);
126 SdrItemBrowser(SdrView
& rView
);
128 void SetView(SdrView
& rView
) { pView
=&rView
; ForceParent(); SetDirty(); }
131 void ForceUndirty() { if (bDirty
) Undirty(); }
134 #endif //_SVDIBROW_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */