xref: /trunk/main/svx/inc/svdibrow.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SVDIBROW_HXX
29*cdf0e10cSrcweir #define _SVDIBROW_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svtools/brwbox.hxx>
32*cdf0e10cSrcweir #include <vcl/edit.hxx>
33*cdf0e10cSrcweir #include <vcl/floatwin.hxx>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir class SfxItemSet;
36*cdf0e10cSrcweir class ImpItemListRow;
37*cdf0e10cSrcweir class BrowserMouseEvent;
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir class _SdrItemBrowserControl: public BrowseBox
40*cdf0e10cSrcweir {
41*cdf0e10cSrcweir friend class ImpItemEdit;
42*cdf0e10cSrcweir 	Container aList;
43*cdf0e10cSrcweir 	long nAktPaintRow;
44*cdf0e10cSrcweir 	Edit* pEditControl;
45*cdf0e10cSrcweir 	XubString aWNamMerk;
46*cdf0e10cSrcweir 	Link aEntryChangedHdl;
47*cdf0e10cSrcweir 	Link aSetDirtyHdl;
48*cdf0e10cSrcweir 	ImpItemListRow* pAktChangeEntry;
49*cdf0e10cSrcweir 	long   nLastWhichOfs;
50*cdf0e10cSrcweir 	sal_uInt16 nLastWhich;
51*cdf0e10cSrcweir 	sal_uInt16 nLastWhichOben;
52*cdf0e10cSrcweir 	sal_uInt16 nLastWhichUnten;
53*cdf0e10cSrcweir 	FASTBOOL bWhichesButNames;
54*cdf0e10cSrcweir 	FASTBOOL bDontHideIneffectiveItems;
55*cdf0e10cSrcweir 	FASTBOOL bDontSortItems;
56*cdf0e10cSrcweir 	FASTBOOL bShowWhichIds;
57*cdf0e10cSrcweir 	FASTBOOL bShowRealValues;
58*cdf0e10cSrcweir private:
59*cdf0e10cSrcweir #if _SOLAR__PRIVATE
60*cdf0e10cSrcweir 	void ImpCtor();
61*cdf0e10cSrcweir 	void ImpSetEntry(const ImpItemListRow& rEntry, sal_uIntPtr nEntryNum);
62*cdf0e10cSrcweir 	ImpItemListRow* ImpGetEntry(sal_uIntPtr nPos) const { return (ImpItemListRow*)aList.GetObject(nPos); }
63*cdf0e10cSrcweir 	void ImpSaveWhich();
64*cdf0e10cSrcweir 	void ImpRestoreWhich();
65*cdf0e10cSrcweir #endif // __PRIVATE
66*cdf0e10cSrcweir protected:
67*cdf0e10cSrcweir 	virtual long GetRowCount() const;
68*cdf0e10cSrcweir 	virtual sal_Bool SeekRow(long nRow);
69*cdf0e10cSrcweir 	virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const;
70*cdf0e10cSrcweir 	virtual void DoubleClick(const BrowserMouseEvent&);
71*cdf0e10cSrcweir 	virtual void KeyInput(const KeyEvent& rEvt);
72*cdf0e10cSrcweir 	virtual void Select();
73*cdf0e10cSrcweir 	virtual void SetDirty(); // wird z.B. bei Modusumschaltungen gerufen
74*cdf0e10cSrcweir 	virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
75*cdf0e10cSrcweir 	virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
76*cdf0e10cSrcweir public:
77*cdf0e10cSrcweir 	_SdrItemBrowserControl(Window* pParent, WinBits nBits=WB_3DLOOK|WB_BORDER|WB_TABSTOP);
78*cdf0e10cSrcweir 	virtual ~_SdrItemBrowserControl();
79*cdf0e10cSrcweir 	void Clear();
80*cdf0e10cSrcweir 	void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL);
81*cdf0e10cSrcweir 	sal_uIntPtr GetCurrentPos() const;
82*cdf0e10cSrcweir 	sal_uInt16 GetCurrentWhich() const;
83*cdf0e10cSrcweir 	virtual FASTBOOL BegChangeEntry(sal_uIntPtr nPos);
84*cdf0e10cSrcweir 	virtual FASTBOOL EndChangeEntry();
85*cdf0e10cSrcweir 	virtual void     BrkChangeEntry();
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 	/** GetCellText returns the text at the given position
88*cdf0e10cSrcweir 		@param	_nRow
89*cdf0e10cSrcweir 			the number of the row
90*cdf0e10cSrcweir 		@param	_nColId
91*cdf0e10cSrcweir 			the ID of the column
92*cdf0e10cSrcweir 		@return
93*cdf0e10cSrcweir 			the text out of the cell
94*cdf0e10cSrcweir 	*/
95*cdf0e10cSrcweir 	virtual String	GetCellText(long _nRow, sal_uInt16 _nColId) const;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 	const ImpItemListRow* GetAktChangeEntry() const { return pAktChangeEntry; }
98*cdf0e10cSrcweir 	XubString GetNewEntryValue() const                 { return pEditControl->GetText(); }
99*cdf0e10cSrcweir 	void SetEntryChangedHdl(const Link& rLink)      { aEntryChangedHdl=rLink; }
100*cdf0e10cSrcweir 	const Link& GetEntryChangedHdl() const          { return aEntryChangedHdl; }
101*cdf0e10cSrcweir 	void SetSetDirtyHdl(const Link& rLink)          { aSetDirtyHdl=rLink; }
102*cdf0e10cSrcweir 	const Link& GetSetDirtyHdl() const              { return aSetDirtyHdl; }
103*cdf0e10cSrcweir };
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir #define WB_STDSIZEABLEDOCKWIN  (WB_STDDOCKWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
106*cdf0e10cSrcweir #define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir class _SdrItemBrowserWindow: public FloatingWindow {
109*cdf0e10cSrcweir 	_SdrItemBrowserControl aBrowse;
110*cdf0e10cSrcweir public:
111*cdf0e10cSrcweir 	_SdrItemBrowserWindow(Window* pParent, WinBits nBits=WB_STDSIZEABLEDOCKWIN);
112*cdf0e10cSrcweir 	virtual ~_SdrItemBrowserWindow();
113*cdf0e10cSrcweir 	virtual void Resize();
114*cdf0e10cSrcweir 	virtual void GetFocus();
115*cdf0e10cSrcweir 	void Clear()                                            { aBrowse.Clear(); }
116*cdf0e10cSrcweir 	void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL) { aBrowse.SetAttributes(pAttr,p2ndSet); }
117*cdf0e10cSrcweir 	void SetFloatingMode(FASTBOOL /*bOn*/) {}
118*cdf0e10cSrcweir 	const _SdrItemBrowserControl& GetBrowserControl() const { return aBrowse; }
119*cdf0e10cSrcweir 	_SdrItemBrowserControl& GetBrowserControl()             { return aBrowse; }
120*cdf0e10cSrcweir };
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir class SdrView;
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir class SdrItemBrowser: public _SdrItemBrowserWindow {
125*cdf0e10cSrcweir 	Timer aIdleTimer;
126*cdf0e10cSrcweir 	SdrView* pView;
127*cdf0e10cSrcweir 	FASTBOOL bDirty;
128*cdf0e10cSrcweir private:
129*cdf0e10cSrcweir 	static Window* ImpGetViewWin(SdrView& rView);
130*cdf0e10cSrcweir 	DECL_LINK(IdleHdl,Timer*);
131*cdf0e10cSrcweir 	DECL_LINK(ChangedHdl,_SdrItemBrowserControl*);
132*cdf0e10cSrcweir 	DECL_LINK(SetDirtyHdl,_SdrItemBrowserControl*);
133*cdf0e10cSrcweir public:
134*cdf0e10cSrcweir 	SdrItemBrowser(SdrView& rView);
135*cdf0e10cSrcweir 	void ForceParent();
136*cdf0e10cSrcweir 	void SetView(SdrView& rView) { pView=&rView; ForceParent(); SetDirty(); }
137*cdf0e10cSrcweir 	void SetDirty();
138*cdf0e10cSrcweir 	void Undirty();
139*cdf0e10cSrcweir 	void ForceUndirty() { if (bDirty) Undirty(); }
140*cdf0e10cSrcweir };
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir #endif //_SVDIBROW_HXX
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 
145