merge the formfield patch from ooo-build
[ooovba.git] / svx / inc / svdibrow.hxx
blob534ff73c2a17f4159b0705b29e4e5e615dd319b8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdibrow.hxx,v $
10 * $Revision: 1.9 $
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 ************************************************************************/
31 #ifndef _SVDIBROW_HXX
32 #define _SVDIBROW_HXX
34 #include <svtools/brwbox.hxx>
35 #include <vcl/edit.hxx>
36 #include <vcl/floatwin.hxx>
38 class SfxItemSet;
39 class ImpItemListRow;
40 class BrowserMouseEvent;
42 class _SdrItemBrowserControl: public BrowseBox
44 friend class ImpItemEdit;
45 Container aList;
46 long nAktPaintRow;
47 Edit* pEditControl;
48 XubString aWNamMerk;
49 Link aEntryChangedHdl;
50 Link aSetDirtyHdl;
51 ImpItemListRow* pAktChangeEntry;
52 long nLastWhichOfs;
53 USHORT nLastWhich;
54 USHORT nLastWhichOben;
55 USHORT nLastWhichUnten;
56 FASTBOOL bWhichesButNames;
57 FASTBOOL bDontHideIneffectiveItems;
58 FASTBOOL bDontSortItems;
59 FASTBOOL bShowWhichIds;
60 FASTBOOL bShowRealValues;
61 private:
62 #if _SOLAR__PRIVATE
63 void ImpCtor();
64 void ImpSetEntry(const ImpItemListRow& rEntry, ULONG nEntryNum);
65 ImpItemListRow* ImpGetEntry(ULONG nPos) const { return (ImpItemListRow*)aList.GetObject(nPos); }
66 void ImpSaveWhich();
67 void ImpRestoreWhich();
68 #endif // __PRIVATE
69 protected:
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);
79 public:
80 _SdrItemBrowserControl(Window* pParent, WinBits nBits=WB_3DLOOK|WB_BORDER|WB_TABSTOP);
81 virtual ~_SdrItemBrowserControl();
82 void Clear();
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
91 @param _nRow
92 the number of the row
93 @param _nColId
94 the ID of the column
95 @return
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;
113 public:
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; }
125 class SdrView;
127 class SdrItemBrowser: public _SdrItemBrowserWindow {
128 Timer aIdleTimer;
129 SdrView* pView;
130 FASTBOOL bDirty;
131 private:
132 static Window* ImpGetViewWin(SdrView& rView);
133 DECL_LINK(IdleHdl,Timer*);
134 DECL_LINK(ChangedHdl,_SdrItemBrowserControl*);
135 DECL_LINK(SetDirtyHdl,_SdrItemBrowserControl*);
136 public:
137 SdrItemBrowser(SdrView& rView);
138 void ForceParent();
139 void SetView(SdrView& rView) { pView=&rView; ForceParent(); SetDirty(); }
140 void SetDirty();
141 void Undirty();
142 void ForceUndirty() { if (bDirty) Undirty(); }
145 #endif //_SVDIBROW_HXX