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