xref: /aoo42x/main/svx/inc/svdibrow.hxx (revision 3334a7e6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDIBROW_HXX
25 #define _SVDIBROW_HXX
26 
27 #include <svtools/brwbox.hxx>
28 #include <vcl/edit.hxx>
29 #include <vcl/floatwin.hxx>
30 
31 class SfxItemSet;
32 class ImpItemListRow;
33 class BrowserMouseEvent;
34 
35 class _SdrItemBrowserControl: public BrowseBox
36 {
37 friend class ImpItemEdit;
38 	Container aList;
39 	long nAktPaintRow;
40 	Edit* pEditControl;
41 	XubString aWNamMerk;
42 	Link aEntryChangedHdl;
43 	Link aSetDirtyHdl;
44 	ImpItemListRow* pAktChangeEntry;
45 	long   nLastWhichOfs;
46 	sal_uInt16 nLastWhich;
47 	sal_uInt16 nLastWhichOben;
48 	sal_uInt16 nLastWhichUnten;
49 	FASTBOOL bWhichesButNames;
50 	FASTBOOL bDontHideIneffectiveItems;
51 	FASTBOOL bDontSortItems;
52 	FASTBOOL bShowWhichIds;
53 	FASTBOOL bShowRealValues;
54 private:
55 #if _SOLAR__PRIVATE
56 	void ImpCtor();
57 	void ImpSetEntry(const ImpItemListRow& rEntry, sal_uIntPtr nEntryNum);
ImpGetEntry(sal_uIntPtr nPos) const58 	ImpItemListRow* ImpGetEntry(sal_uIntPtr nPos) const { return (ImpItemListRow*)aList.GetObject(nPos); }
59 	void ImpSaveWhich();
60 	void ImpRestoreWhich();
61 #endif // __PRIVATE
62 protected:
63 	virtual long GetRowCount() const;
64 	virtual sal_Bool SeekRow(long nRow);
65 	virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const;
66 	virtual void DoubleClick(const BrowserMouseEvent&);
67 	virtual void KeyInput(const KeyEvent& rEvt);
68 	virtual void Select();
69 	virtual void SetDirty(); // wird z.B. bei Modusumschaltungen gerufen
70 	virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
71 	virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
72 public:
73 	_SdrItemBrowserControl(Window* pParent, WinBits nBits=WB_3DLOOK|WB_BORDER|WB_TABSTOP);
74 	virtual ~_SdrItemBrowserControl();
75 	void Clear();
76 	void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL);
77 	sal_uIntPtr GetCurrentPos() const;
78 	sal_uInt16 GetCurrentWhich() const;
79 	virtual FASTBOOL BegChangeEntry(sal_uIntPtr nPos);
80 	virtual FASTBOOL EndChangeEntry();
81 	virtual void     BrkChangeEntry();
82 
83 	/** GetCellText returns the text at the given position
84 		@param	_nRow
85 			the number of the row
86 		@param	_nColId
87 			the ID of the column
88 		@return
89 			the text out of the cell
90 	*/
91 	virtual String	GetCellText(long _nRow, sal_uInt16 _nColId) const;
92 
GetAktChangeEntry() const93 	const ImpItemListRow* GetAktChangeEntry() const { return pAktChangeEntry; }
GetNewEntryValue() const94 	XubString GetNewEntryValue() const                 { return pEditControl->GetText(); }
SetEntryChangedHdl(const Link & rLink)95 	void SetEntryChangedHdl(const Link& rLink)      { aEntryChangedHdl=rLink; }
GetEntryChangedHdl() const96 	const Link& GetEntryChangedHdl() const          { return aEntryChangedHdl; }
SetSetDirtyHdl(const Link & rLink)97 	void SetSetDirtyHdl(const Link& rLink)          { aSetDirtyHdl=rLink; }
GetSetDirtyHdl() const98 	const Link& GetSetDirtyHdl() const              { return aSetDirtyHdl; }
99 };
100 
101 #define WB_STDSIZEABLEDOCKWIN  (WB_STDDOCKWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
102 #define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
103 
104 class _SdrItemBrowserWindow: public FloatingWindow {
105 	_SdrItemBrowserControl aBrowse;
106 public:
107 	_SdrItemBrowserWindow(Window* pParent, WinBits nBits=WB_STDSIZEABLEDOCKWIN);
108 	virtual ~_SdrItemBrowserWindow();
109 	virtual void Resize();
110 	virtual void GetFocus();
Clear()111 	void Clear()                                            { aBrowse.Clear(); }
SetAttributes(const SfxItemSet * pAttr,const SfxItemSet * p2ndSet=NULL)112 	void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL) { aBrowse.SetAttributes(pAttr,p2ndSet); }
SetFloatingMode(FASTBOOL)113 	void SetFloatingMode(FASTBOOL /*bOn*/) {}
GetBrowserControl() const114 	const _SdrItemBrowserControl& GetBrowserControl() const { return aBrowse; }
GetBrowserControl()115 	_SdrItemBrowserControl& GetBrowserControl()             { return aBrowse; }
116 };
117 
118 class SdrView;
119 
120 class SdrItemBrowser: public _SdrItemBrowserWindow {
121 	Timer aIdleTimer;
122 	SdrView* pView;
123 	FASTBOOL bDirty;
124 private:
125 	static Window* ImpGetViewWin(SdrView& rView);
126 	DECL_LINK(IdleHdl,Timer*);
127 	DECL_LINK(ChangedHdl,_SdrItemBrowserControl*);
128 	DECL_LINK(SetDirtyHdl,_SdrItemBrowserControl*);
129 public:
130 	SdrItemBrowser(SdrView& rView);
131 	void ForceParent();
SetView(SdrView & rView)132 	void SetView(SdrView& rView) { pView=&rView; ForceParent(); SetDirty(); }
133 	void SetDirty();
134 	void Undirty();
ForceUndirty()135 	void ForceUndirty() { if (bDirty) Undirty(); }
136 };
137 
138 #endif //_SVDIBROW_HXX
139 
140 
141