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