1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
32 #include <tools/contnr.hxx>
33 #include <svtools/brwbox.hxx>
34 #include <vcl/edit.hxx>
35 #include <vcl/floatwin.hxx>
39 class BrowserMouseEvent
;
41 class _SdrItemBrowserControl
: public BrowseBox
43 friend class ImpItemEdit
;
48 Link aEntryChangedHdl
;
50 ImpItemListRow
* pAktChangeEntry
;
52 sal_uInt16 nLastWhich
;
53 sal_uInt16 nLastWhichOben
;
54 sal_uInt16 nLastWhichUnten
;
55 bool bWhichesButNames
;
56 bool bDontHideIneffectiveItems
;
63 void ImpSetEntry(const ImpItemListRow
& rEntry
, sal_uIntPtr nEntryNum
);
64 ImpItemListRow
* ImpGetEntry(sal_uIntPtr nPos
) const { return (ImpItemListRow
*)aList
.GetObject(nPos
); }
66 void ImpRestoreWhich();
69 virtual long GetRowCount() const;
70 virtual sal_Bool
SeekRow(long nRow
);
71 virtual void PaintField(OutputDevice
& rDev
, const Rectangle
& rRect
, sal_uInt16 nColumnId
) const;
72 virtual void DoubleClick(const BrowserMouseEvent
&);
73 virtual void KeyInput(const KeyEvent
& rEvt
);
74 virtual void Select();
75 virtual void SetDirty(); // is called for example in mode switches
76 virtual Rectangle
GetFieldCharacterBounds(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,sal_Int32 nIndex
);
77 virtual sal_Int32
GetFieldIndexAtPoint(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,const Point
& _rPoint
);
79 _SdrItemBrowserControl(Window
* pParent
, WinBits nBits
=WB_3DLOOK
|WB_BORDER
|WB_TABSTOP
);
80 virtual ~_SdrItemBrowserControl();
82 void SetAttributes(const SfxItemSet
* pAttr
, const SfxItemSet
* p2ndSet
=NULL
);
83 sal_uIntPtr
GetCurrentPos() const;
84 sal_uInt16
GetCurrentWhich() const;
85 virtual bool BegChangeEntry(sal_uIntPtr nPos
);
86 virtual bool EndChangeEntry();
87 virtual void BrkChangeEntry();
89 /** GetCellText returns the text at the given position
95 the text out of the cell
97 virtual String
GetCellText(long _nRow
, sal_uInt16 _nColId
) const;
99 const ImpItemListRow
* GetAktChangeEntry() const { return pAktChangeEntry
; }
100 XubString
GetNewEntryValue() const { return pEditControl
->GetText(); }
101 void SetEntryChangedHdl(const Link
& rLink
) { aEntryChangedHdl
=rLink
; }
102 const Link
& GetEntryChangedHdl() const { return aEntryChangedHdl
; }
103 void SetSetDirtyHdl(const Link
& rLink
) { aSetDirtyHdl
=rLink
; }
104 const Link
& GetSetDirtyHdl() const { return aSetDirtyHdl
; }
107 #define WB_STDSIZEABLEDOCKWIN (WB_STDDOCKWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
108 #define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
110 class _SdrItemBrowserWindow
: public FloatingWindow
{
111 _SdrItemBrowserControl aBrowse
;
113 _SdrItemBrowserWindow(Window
* pParent
, WinBits nBits
=WB_STDSIZEABLEDOCKWIN
);
114 virtual ~_SdrItemBrowserWindow();
115 virtual void Resize();
116 virtual void GetFocus();
117 void Clear() { aBrowse
.Clear(); }
118 void SetAttributes(const SfxItemSet
* pAttr
, const SfxItemSet
* p2ndSet
=NULL
) { aBrowse
.SetAttributes(pAttr
,p2ndSet
); }
119 void SetFloatingMode(bool /*bOn*/) {}
120 const _SdrItemBrowserControl
& GetBrowserControl() const { return aBrowse
; }
121 _SdrItemBrowserControl
& GetBrowserControl() { return aBrowse
; }
126 class SdrItemBrowser
: public _SdrItemBrowserWindow
{
131 static Window
* ImpGetViewWin(SdrView
& rView
);
132 DECL_LINK(IdleHdl
, void *);
133 DECL_LINK(ChangedHdl
,_SdrItemBrowserControl
*);
134 DECL_LINK(SetDirtyHdl
, void *);
136 SdrItemBrowser(SdrView
& rView
);
138 void SetView(SdrView
& rView
) { pView
=&rView
; ForceParent(); SetDirty(); }
141 void ForceUndirty() { if (bDirty
) Undirty(); }
144 #endif //_SVDIBROW_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */