1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdibrow.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <svtools/brwbox.hxx>
35 #include <vcl/edit.hxx>
36 #include <vcl/floatwin.hxx>
40 class BrowserMouseEvent
;
42 class _SdrItemBrowserControl
: public BrowseBox
44 friend class ImpItemEdit
;
49 Link aEntryChangedHdl
;
51 ImpItemListRow
* pAktChangeEntry
;
54 USHORT nLastWhichOben
;
55 USHORT nLastWhichUnten
;
56 FASTBOOL bWhichesButNames
;
57 FASTBOOL bDontHideIneffectiveItems
;
58 FASTBOOL bDontSortItems
;
59 FASTBOOL bShowWhichIds
;
60 FASTBOOL bShowRealValues
;
64 void ImpSetEntry(const ImpItemListRow
& rEntry
, ULONG nEntryNum
);
65 ImpItemListRow
* ImpGetEntry(ULONG nPos
) const { return (ImpItemListRow
*)aList
.GetObject(nPos
); }
67 void ImpRestoreWhich();
70 virtual long GetRowCount() const;
71 virtual BOOL
SeekRow(long nRow
);
72 virtual void PaintField(OutputDevice
& rDev
, const Rectangle
& rRect
, USHORT nColumnId
) const;
73 virtual void DoubleClick(const BrowserMouseEvent
&);
74 virtual void KeyInput(const KeyEvent
& rEvt
);
75 virtual void Select();
76 virtual void SetDirty(); // wird z.B. bei Modusumschaltungen gerufen
77 virtual Rectangle
GetFieldCharacterBounds(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,sal_Int32 nIndex
);
78 virtual sal_Int32
GetFieldIndexAtPoint(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,const Point
& _rPoint
);
80 _SdrItemBrowserControl(Window
* pParent
, WinBits nBits
=WB_3DLOOK
|WB_BORDER
|WB_TABSTOP
);
81 virtual ~_SdrItemBrowserControl();
83 void SetAttributes(const SfxItemSet
* pAttr
, const SfxItemSet
* p2ndSet
=NULL
);
84 ULONG
GetCurrentPos() const;
85 USHORT
GetCurrentWhich() const;
86 virtual FASTBOOL
BegChangeEntry(ULONG nPos
);
87 virtual FASTBOOL
EndChangeEntry();
88 virtual void BrkChangeEntry();
90 /** GetCellText returns the text at the given position
96 the text out of the cell
98 virtual String
GetCellText(long _nRow
, USHORT _nColId
) const;
100 const ImpItemListRow
* GetAktChangeEntry() const { return pAktChangeEntry
; }
101 XubString
GetNewEntryValue() const { return pEditControl
->GetText(); }
102 void SetEntryChangedHdl(const Link
& rLink
) { aEntryChangedHdl
=rLink
; }
103 const Link
& GetEntryChangedHdl() const { return aEntryChangedHdl
; }
104 void SetSetDirtyHdl(const Link
& rLink
) { aSetDirtyHdl
=rLink
; }
105 const Link
& GetSetDirtyHdl() const { return aSetDirtyHdl
; }
108 #define WB_STDSIZEABLEDOCKWIN (WB_STDDOCKWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
109 #define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
111 class _SdrItemBrowserWindow
: public FloatingWindow
{
112 _SdrItemBrowserControl aBrowse
;
114 _SdrItemBrowserWindow(Window
* pParent
, WinBits nBits
=WB_STDSIZEABLEDOCKWIN
);
115 virtual ~_SdrItemBrowserWindow();
116 virtual void Resize();
117 virtual void GetFocus();
118 void Clear() { aBrowse
.Clear(); }
119 void SetAttributes(const SfxItemSet
* pAttr
, const SfxItemSet
* p2ndSet
=NULL
) { aBrowse
.SetAttributes(pAttr
,p2ndSet
); }
120 void SetFloatingMode(FASTBOOL
/*bOn*/) {}
121 const _SdrItemBrowserControl
& GetBrowserControl() const { return aBrowse
; }
122 _SdrItemBrowserControl
& GetBrowserControl() { return aBrowse
; }
127 class SdrItemBrowser
: public _SdrItemBrowserWindow
{
132 static Window
* ImpGetViewWin(SdrView
& rView
);
133 DECL_LINK(IdleHdl
,Timer
*);
134 DECL_LINK(ChangedHdl
,_SdrItemBrowserControl
*);
135 DECL_LINK(SetDirtyHdl
,_SdrItemBrowserControl
*);
137 SdrItemBrowser(SdrView
& rView
);
139 void SetView(SdrView
& rView
) { pView
=&rView
; ForceParent(); SetDirty(); }
142 void ForceUndirty() { if (bDirty
) Undirty(); }
145 #endif //_SVDIBROW_HXX